把trySkillAudio的分析地址部分拆分成parseSkillAudio

This commit is contained in:
kuangshen04 2023-10-25 16:06:47 +08:00
parent 26fb07426b
commit 47526cb8b9
1 changed files with 37 additions and 27 deletions

View File

@ -36827,14 +36827,15 @@
}); });
return audio; return audio;
}, },
trySkillAudio:function(skill,player,directaudio,nobroadcast/*,index*/){ /**
if(!nobroadcast) game.broadcast(game.trySkillAudio,skill,player,directaudio,nobroadcast/*,index*/); * 根据skill中的audio,audioname,audioname2和player来获取音频地址列表
var info=get.info(skill); * @param {String} skill 技能名
if(!info) return; * @param {Player|String} player 角色/角色名
if(!lib.config.background_speak) return; * @returns {Array} 分析完的语音地址列表
if(info.direct&&!directaudio) return; */
if(lib.skill.global.includes(skill)&&!lib.skill[skill].forceaudio) return; parseSkillAudio:function(skill,player){
if(typeof player=='string') player={name:player}; if(typeof player=='string') player={name:player};
else player={};
/** /**
* 处理 audioInfo 外的参数 * 处理 audioInfo 外的参数
@ -36857,7 +36858,7 @@
history.push(skill); history.push(skill);
let audioInfo=info.audio; let audioInfo=info.audio;
if(info.audioname2&&player){ if(info.audioname2){
if(info.audioname2[player.name]) audioInfo=info.audioname2[player.name]; if(info.audioname2[player.name]) audioInfo=info.audioname2[player.name];
else if(info.audioname2[player.name1]) audioInfo=info.audioname2[player.name1]; else if(info.audioname2[player.name1]) audioInfo=info.audioname2[player.name1];
else if(info.audioname2[player.name2]) audioInfo=info.audioname2[player.name2]; else if(info.audioname2[player.name2]) audioInfo=info.audioname2[player.name2];
@ -36919,8 +36920,17 @@
return audioList; return audioList;
} }
let list=getAudioList(skill,player); return getAudioList(skill,player);
// console.log(skill,lib.skill[skill]&&lib.skill[skill].audio,list); },
trySkillAudio:function(skill,player,directaudio,nobroadcast/*,index*/){
if(!nobroadcast) game.broadcast(game.trySkillAudio,skill,player,directaudio,nobroadcast/*,index*/);
var info=get.info(skill);
if(!info) return;
if(!lib.config.background_speak) return;
if(info.direct&&!directaudio) return;
if(lib.skill.global.includes(skill)&&!lib.skill[skill].forceaudio) return;
let list=game.parseSkillAudio(skill,player);
if(!list.length) return; if(!list.length) return;
// if(index) index=index%list.length||list.length; // if(index) index=index%list.length||list.length;
// let audio=list[index?index-1:Math.floor(Math.random()*list.length)]; // let audio=list[index?index-1:Math.floor(Math.random()*list.length)];