Support audios with "db:".

This commit is contained in:
Tipx-L 2023-09-24 08:43:35 -07:00
parent a0b410e923
commit 2e1fa45917
1 changed files with 20 additions and 28 deletions

View File

@ -17343,33 +17343,23 @@
if(event.audio===false){ if(event.audio===false){
cardaudio=false; cardaudio=false;
} }
if(cardaudio){ if(cardaudio) game.broadcastAll((player,card)=>{
game.broadcastAll(function(player,card){ if(!lib.config.background_audio||get.type(card)=='equip'&&!lib.config.equip_audio) return;
if(lib.config.background_audio){ const sex=player.sex=='female'?'female':'male';
if(get.type(card)=='equip'&&!lib.config.equip_audio) return; if(card.name=='sha'&&['fire','thunder','ice','stab'].includes(card.nature)){
var sex=player.sex=='female'?'female':'male'; game.playAudio('card',sex,`${card.name}_${card.nature}`);
var audioinfo=lib.card[card.name].audio; return;
// if(audioinfo||true){ }
if(card.name=='sha'&&(card.nature=='fire'||card.nature=='thunder'||card.nature=='ice'||card.nature=='stab')){ const audio=lib.card[card.name].audio;
game.playAudio('card',sex,card.name+'_'+card.nature); if(typeof audio=='string'){
} const audioInfo=audio.split('::');
else{ if(audioInfo.length<2) audioInfo.push('mp3');
if(typeof audioinfo=='string'){ if(audio.indexOf('db:')==0) game.playAudio(`${audioInfo[0]}${card.name}_${sex}.${audioInfo[1]}`);
if(audioinfo.indexOf('db:')==0) game.playAudio(`${audioinfo}${card.name}_${sex}.mp3`); else if(audio.indexOf('ext:')==0) game.playAudio('..','extension',audioInfo[0].slice(4),`${card.name}_${sex}.${audioInfo[1]}`);
else if(audioinfo.indexOf('ext:')==0) game.playAudio('..','extension',audioinfo.slice(4),`${card.name}_${sex}`); else game.playAudio('card',sex,`${audioInfo[0]}.${audioInfo[1]}`);
else game.playAudio('card',sex,audioinfo); }
} else game.playAudio('card',sex,card.name);
else{ },player,card);
game.playAudio('card',sex,card.name);
}
}
// }
// else if(get.type(card)!='equip'){
// game.playAudio('card/default');
// }
}
},player,card);
}
if(event.animate!=false&&event.line!=false){ if(event.animate!=false&&event.line!=false){
if(card.name=='wuxie'&&event.getParent()._info_map){ if(card.name=='wuxie'&&event.getParent()._info_map){
var evtmap=event.getParent()._info_map; var evtmap=event.getParent()._info_map;
@ -54746,7 +54736,9 @@
}, },
}; };
const get={ const get={
objectURL:octetStream=>URL.createObjectURL(new Blob([Uint8Array.from(atob(octetStream.replace(/^data:[\s\S]*\/[\s\S]*;base64,/,'')),v=>v.charCodeAt(0))])), //Generate an object URL from the Base64-encoded octet stream
//从Base64编码的八位字节流生成对象URL
objectURL:octetStream=>URL.createObjectURL(new Blob([Uint8Array.from(atob(octetStream.replace(/^data:[\s\S]*\/[\s\S]*;base64,/,'')),v=>v.charCodeAt())])),
//Get the card name length //Get the card name length
//获取此牌的字数 //获取此牌的字数
cardNameLength:(card,player)=>{ cardNameLength:(card,player)=>{