trySkillAudio更改

This commit is contained in:
2832899707 2023-09-04 10:52:00 +08:00
parent 738f276db0
commit 542fc92db0
1 changed files with 42 additions and 46 deletions

View File

@ -32670,60 +32670,56 @@
game.broadcast(game.trySkillAudio,skill,player,directaudio); game.broadcast(game.trySkillAudio,skill,player,directaudio);
var info=get.info(skill); var info=get.info(skill);
if(!info) return; if(!info) return;
if((!info.direct||directaudio)&&lib.config.background_speak&& if(info.direct&&!directaudio) return;
(!lib.skill.global.contains(skill)||lib.skill[skill].forceaudio)){ if(!lib.config.background_speak) return;
var audioname=skill; if(lib.skill.global.contains(skill)&&!lib.skill[skill].forceaudio) return;
if(info.audioname2&&info.audioname2[player.name]){ var audioname=skill;
audioname=info.audioname2[player.name]; var audioinfo=info.audio;
info=lib.skill[audioname]; var fixednum;
} if(info.audioname2&&info.audioname2[player.name]){
var audioinfo=info.audio; audioname=info.audioname2[player.name];
audioinfo=lib.skill[audioname].audio;
}
var history=[];
while(true){//可以嵌套引用了
if(history.contains(audioname)) break;
history.push(audioname);
if(typeof audioinfo=='string'&&lib.skill[audioinfo]){ if(typeof audioinfo=='string'&&lib.skill[audioinfo]){
audioname=audioinfo; audioname=audioinfo;
audioinfo=lib.skill[audioname].audio; audioinfo=lib.skill[audioname].audio;
continue;
} }
if(typeof audioinfo=='string'){ if(Array.isArray(audioinfo)){
if(audioinfo.indexOf('ext:')==0){
audioinfo=audioinfo.split(':');
if(audioinfo.length==3){
if(audioinfo[2]=='true'){
game.playAudio('..','extension',audioinfo[1],audioname);
}
else{
audioinfo[2]=parseInt(audioinfo[2]);
if(audioinfo[2]){
game.playAudio('..','extension',audioinfo[1],audioname+Math.ceil(audioinfo[2]*Math.random()));
}
}
}
return;
}
}
else if(Array.isArray(audioinfo)){
audioname=audioinfo[0]; audioname=audioinfo[0];
audioinfo=audioinfo[1]; audioinfo=lib.skill[audioname].audio;
if(!fixednum) fixednum=audioinfo[1];//数组会取第一个指定语音数
continue;
} }
if(Array.isArray(info.audioname)&&player){ break;
if(info.audioname.contains(player.name)){ }
audioname+='_'+player.name; if(Array.isArray(info.audioname)&&player){
} if(info.audioname.contains(player.name)) audioname+='_'+player.name;
else if(info.audioname.contains(player.name1)){ else if(info.audioname.contains(player.name1)) audioname+='_'+player.name1;
audioname+='_'+player.name1; else if(info.audioname.contains(player.name2)) audioname+='_'+player.name2;
} }
else if(info.audioname.contains(player.name2)){ if(typeof audioinfo=='string'){
audioname+='_'+player.name2; if(audioinfo.indexOf('ext:')!=0) return;
} audioinfo=audioinfo.split(':');
} if(audioinfo.length!=3) return;
if(typeof audioinfo=='number'){ if(audioinfo[2]=='true') game.playAudio('..','extension',audioinfo[1],audioname);
game.playAudio('skill',audioname+Math.ceil(audioinfo*Math.random())); else{
} audioinfo[2]=parseInt(audioinfo[2]);
else if(audioinfo){ if(fixednum) audioinfo[2]=Math.min(audioinfo[2],fixednum);
game.playAudio('skill',audioname); if(!audioinfo[2]) return;
} game.playAudio('..','extension',audioinfo[1],audioname+Math.ceil(audioinfo[2]*Math.random()));
else if(true&&info.audio!==false){
game.playSkillAudio(audioname);
} }
} }
else if(typeof audioinfo=='number'){
if(fixednum) audioinfo=Math.min(audioinfo, fixednum);
game.playAudio('skill',audioname+Math.ceil(audioinfo*Math.random()));
}
else if(audioinfo) game.playAudio('skill',audioname);
else if(info.audio!==false) game.playSkillAudio(audioname);
}, },
playSkillAudio:function(name,index){ playSkillAudio:function(name,index){
if(_status.video&&arguments[1]!='video') return; if(_status.video&&arguments[1]!='video') return;