添加character[4]的'tempname:'参数,便于直接给一个武将使用另一个id的武将的audioname和audioname2

This commit is contained in:
mengxinzxz 2023-12-14 14:59:43 +08:00
parent 1ff0d115a3
commit 3aa62f025a
1 changed files with 42 additions and 6 deletions

View File

@ -37688,13 +37688,31 @@ new Promise(resolve=>{
let audioInfo=info.audio;
if(info.audioname2){
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.name2]) audioInfo=info.audioname2[player.name2];
if(player.name&&info.audioname2[player.name]) audioInfo=info.audioname2[player.name];
else if(player.name1&&info.audioname2[player.name1]) audioInfo=info.audioname2[player.name1];
else if(player.name2&&info.audioname2[player.name2]) audioInfo=info.audioname2[player.name2];
else if(player.tempname){
const name=player.tempname.find(i=>info.audioname2[i]);
if(name) audioInfo=info.audioname2[name];
}
else if(player.name&&get.character(player.name)&&get.character(player.name)[4]&&get.character(player.name)[4].some(tag=>tag.startsWith('tempname:'))){
const list=get.character(player.name)[4].find(tag=>tag.startsWith('tempname:'));
list=list.split(':').slice(1);
const name=list.find(i=>info.audioname2[i]);
if(name) audioInfo=info.audioname2[name];
}
else if(player.name1&&get.character(player.name1)&&get.character(player.name1)[4]&&get.character(player.name1)[4].some(tag=>tag.startsWith('tempname:'))){
const list=get.character(player.name1)[4].find(tag=>tag.startsWith('tempname:'));
list=list.split(':').slice(1);
const name=list.find(i=>info.audioname2[i]);
if(name) audioInfo=info.audioname2[name];
}
else if(player.name2&&get.character(player.name2)&&get.character(player.name2)[4]&&get.character(player.name2)[4].some(tag=>tag.startsWith('tempname:'))){
const list=get.character(player.name2)[4].find(tag=>tag.startsWith('tempname:'));
list=list.split(':').slice(1);
const name=list.find(i=>info.audioname2[i]);
if(name) audioInfo=info.audioname2[name];
}
}
if(typeof audioInfo=='function') audioInfo=audioInfo(player);
@ -37736,13 +37754,31 @@ new Promise(resolve=>{
let list=audioInfo.match(/(?:(.*):|^)(true|\d+)(?::(.*)|$)/);
if(list&&list[2]){
let _audioname='';
if(audioname.includes(player.name)) _audioname=`_${player.name}`;
else if(audioname.includes(player.name1)) _audioname=`_${player.name1}`;
else if(audioname.includes(player.name2)) _audioname=`_${player.name2}`;
if(player.name&&audioname.includes(player.name)) _audioname=`_${player.name}`;
else if(player.name1&&audioname.includes(player.name1)) _audioname=`_${player.name1}`;
else if(player.name2&&audioname.includes(player.name2)) _audioname=`_${player.name2}`;
else if(player.tempname){
const name=player.tempname.find(i=>audioname.includes(i));
if(name) _audioname=`_${name}`;
}
else if(player.name&&get.character(player.name)&&get.character(player.name)[4]&&get.character(player.name)[4].some(tag=>tag.startsWith('tempname:'))){
const list=get.character(player.name)[4].find(tag=>tag.startsWith('tempname:'));
list=list.split(':').slice(1);
const name=list.find(i=>audioname.includes(i));
if(name) _audioname=`_${player.name}`;
}
else if(player.name1&&get.character(player.name1)&&get.character(player.name1)[4]&&get.character(player.name1)[4].some(tag=>tag.startsWith('tempname:'))){
const list=get.character(player.name1)[4].find(tag=>tag.startsWith('tempname:'));
list=list.split(':').slice(1);
const name=list.find(i=>audioname.includes(i));
if(name) _audioname=`_${player.name1}`;
}
else if(player.name2&&get.character(player.name2)&&get.character(player.name2)[4]&&get.character(player.name2)[4].some(tag=>tag.startsWith('tempname:'))){
const list=get.character(player.name2)[4].find(tag=>tag.startsWith('tempname:'));
list=list.split(':').slice(1);
const name=list.find(i=>audioname.includes(i));
if(name) _audioname=`_${player.name2}`;
}
list=list.slice(1);//[路径,number/true,格式]
if(list[1]=='true') audioList.add(`${list[0]||'skill'}/${skill}${_audioname}.${list[2]||'mp3'}`);