noname/extension/boss/extension.js

139 lines
4.2 KiB
JavaScript
Raw Normal View History

2017-04-14 23:35:56 +00:00
'use strict';
2017-04-17 05:18:46 +00:00
game.import('play',function(lib,game,ui,get,ai,_status){
2017-04-15 00:25:50 +00:00
return {
name:'boss',
init:function(){
if(get.mode()=='tafang') return;
2017-09-15 07:45:38 +00:00
var storage=localStorage.getItem('boss_storage_playpackconfig');
try{
storage=JSON.parse(storage)||{};
}
catch(e){
storage={};
}
2017-04-15 00:25:50 +00:00
if(get.mode()!='boss'){
2017-09-15 07:45:38 +00:00
lib.characterPack.mode_extension_boss=storage.boss||{};
2017-04-15 00:25:50 +00:00
for(var i in lib.characterPack.mode_extension_boss){
lib.characterPack.mode_extension_boss[i][4].push('mode:boss');
lib.character[i]=lib.characterPack.mode_extension_boss[i];
2019-07-25 11:17:52 +00:00
if(typeof lib.character[i][2]!='number'&&(typeof lib.character[i][2]!='string'||lib.character[i][2].indexOf('/')==-1)){
2017-09-15 07:45:38 +00:00
lib.character[i][2]=Infinity;
}
2016-12-19 09:40:20 +00:00
if(!lib.config.boss_enableai_playpackconfig){
lib.config.forbidai.push(i);
}
}
2017-09-15 07:45:38 +00:00
}
var list2=storage.versus||{};
if(get.mode()!='versus'||get.config('versus_mode')!='jiange'){
lib.characterPack.mode_extension_jiange=list2;
for(var i in list2){
lib.characterPack.mode_extension_jiange[i]=list2[i];
lib.characterPack.mode_extension_jiange[i][4].push('mode:versus');
lib.character[i]=list2[i];
if(typeof lib.character[i][2]!='number'){
lib.character[i][2]=Infinity;
}
if(!lib.config.boss_enableai_playpackconfig){
lib.config.forbidai.push(i);
2016-12-19 09:40:20 +00:00
}
}
2017-09-15 07:45:38 +00:00
lib.characterIntro.boss_liedixuande=lib.characterIntro.liubei;
lib.characterIntro.boss_gongshenyueying=lib.characterIntro.huangyueying;
lib.characterIntro.boss_tianhoukongming=lib.characterIntro.shen_zhugeliang;
lib.characterIntro.boss_yuhuoshiyuan=lib.characterIntro.pangtong;
lib.characterIntro.boss_qiaokuijunyi=lib.characterIntro.zhanghe;
lib.characterIntro.boss_jiarenzidan=lib.characterIntro.caozhen;
lib.characterIntro.boss_duanyuzhongda=lib.characterIntro.simayi;
lib.characterIntro.boss_juechenmiaocai=lib.characterIntro.xiahouyuan;
}
else if(_status.mode!='jiange'){
for(var i in list2){
lib.character[i]=list2[i];
if(!lib.config.boss_enableai_playpackconfig){
lib.config.forbidai.push(i);
2017-04-15 00:25:50 +00:00
}
}
2017-09-15 07:45:38 +00:00
}
var list=storage.translate||{};
list.mode_extension_boss_character_config='挑战武将';
list.mode_extension_jiange_character_config='剑阁武将';
2016-09-23 15:23:19 +00:00
2017-09-15 07:45:38 +00:00
for(var i in list){
lib.translate[i]=lib.translate[i]||list[i];
2016-09-23 15:23:19 +00:00
}
2017-04-15 00:25:50 +00:00
},
arenaReady:function(){
if(get.mode()=='tafang') return;
2017-09-15 07:45:38 +00:00
var storage=localStorage.getItem('boss_storage_playpackconfig');
try{
storage=JSON.parse(storage)||{};
}
catch(e){
storage={};
}
if(!storage.translate){
storage.translate={};
}
2017-04-15 00:25:50 +00:00
var loadversus=function(){
if(get.mode()!='versus'){
2017-04-17 04:48:19 +00:00
game.loadModeAsync('versus',function(mode){
for(var i in mode.translate){
lib.translate[i]=lib.translate[i]||mode.translate[i];
2017-09-15 07:45:38 +00:00
storage.translate[i]=mode.translate[i];
2017-04-15 00:25:50 +00:00
}
2017-04-17 04:48:19 +00:00
for(var i in mode.skill){
2017-04-15 00:25:50 +00:00
if(lib.skill[i]) console.log(i);
if(i!='versus_ladder'){
2017-04-17 06:33:52 +00:00
lib.skill[i]=mode.skill[i];
2019-12-07 12:48:38 +00:00
}
}
for(var ii in mode.skill){
if(ii!='versus_ladder'){
game.finishSkill(ii);
2017-04-15 00:25:50 +00:00
}
}
2017-09-15 07:45:38 +00:00
storage.versus={};
for(var i in mode.jiangeboss){
if(mode.jiangeboss[i][4].contains('bossallowed')){
storage.versus[i]=mode.jiangeboss[i];
}
}
localStorage.setItem('boss_storage_playpackconfig',JSON.stringify(storage));
2017-04-15 00:25:50 +00:00
});
}
2017-09-15 07:45:38 +00:00
else{
localStorage.setItem('boss_storage_playpackconfig',JSON.stringify(storage));
}
2017-04-15 00:25:50 +00:00
};
if(get.mode()!='boss'){
2017-04-17 04:48:19 +00:00
game.loadModeAsync('boss',function(mode){
for(var i in mode.translate){
lib.translate[i]=lib.translate[i]||mode.translate[i];
2017-09-15 07:45:38 +00:00
storage.translate[i]=mode.translate[i];
2016-12-19 09:40:20 +00:00
}
2017-04-17 04:48:19 +00:00
for(var i in mode.skill){
2017-02-28 08:31:05 +00:00
if(lib.skill[i]) console.log(i);
2017-04-17 06:33:52 +00:00
lib.skill[i]=mode.skill[i];
2019-12-07 12:48:38 +00:00
}
for(var ii in mode.skill){
if(ii!='versus_ladder'){
game.finishSkill(ii);
}
2016-12-19 09:40:20 +00:00
}
2017-09-15 07:45:38 +00:00
storage.boss={};
for(var i in mode.characterPack.mode_boss){
if(mode.characterPack.mode_boss[i][4].contains('bossallowed')){
storage.boss[i]=mode.characterPack.mode_boss[i];
}
}
2017-04-15 00:25:50 +00:00
loadversus();
2016-12-19 09:40:20 +00:00
});
}
2017-04-15 00:25:50 +00:00
else{
2016-12-19 09:40:20 +00:00
loadversus();
2017-04-15 00:25:50 +00:00
}
},
};
2017-04-14 23:35:56 +00:00
});