403Webshell
Server IP : 39.108.156.168  /  Your IP : 216.73.216.104
Web Server : nginx/1.24.0
System : Linux e2.ksyuki.com 6.11.0-25-generic #25~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 15 17:20:50 UTC 2 x86_64
User : root ( 0)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/pfm/h5mota/libs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/pfm/h5mota/libs/libs.min.js
"use strict";function loader(){this._init()}loader.prototype._init=function(){};loader.prototype._setStartProgressVal=function(a){core.dom.startTopProgress.style.width=a+"%"};loader.prototype._setStartLoadTipText=function(a){core.dom.startTopLoadTips.innerText=a};loader.prototype._load=function(a){if(main.useCompress){this._load_async(a)}else{this._load_sync(a)}};loader.prototype._load_sync=function(a){this._loadAnimates_sync();this._loadMusic_sync();core.loader._loadMaterials_sync(function(){core.loader._loadExtraImages_sync(function(){core.loader._loadAutotiles_sync(function(){core.loader._loadTilesets_sync(a)})})})};loader.prototype._load_async=function(d){core.loader._setStartLoadTipText("正在加载资源文件...");var c={};var b=function(e){if(!c[e]){c[e]={loaded:0,total:0,finished:false}}return function(h,j){c[e].loaded=h;c[e].total=j;var f=0,g=0;for(var i in c){f+=c[i].loaded;g+=c[i].total}if(g>0){if(f==g){core.loader._setStartLoadTipText("正在处理资源文件... 请稍候...")}else{core.loader._setStartLoadTipText("正在加载资源文件... "+core.formatSize(f)+" / "+core.formatSize(g)+" ("+(f/g*100).toFixed(2)+"%)")}core.loader._setStartProgressVal(f/g*100)}}};var a=function(e){return function(){setTimeout(function(){c[e].finished=true;for(var f in c){if(!c[f].finished){return}}d()})}};this._loadAnimates_async(b("animates"),a("animates"));this._loadMusic_async(b("sounds"),a("sounds"));this._loadMaterials_async(b("materials"),a("materials"));this._loadExtraImages_async(b("images"),a("images"));this._loadAutotiles_async(b("autotiles"),a("autotiles"));this._loadTilesets_async(b("tilesets"),a("tilesets"))};loader.prototype._loadMaterials_sync=function(a){this._setStartLoadTipText("正在加载资源文件...");this.loadImages("materials",core.materials,core.material.images,function(){core.loader._loadMaterials_afterLoad();a()})};loader.prototype._loadMaterials_async=function(b,a){this.loadImagesFromZip("project/materials/materials.h5data",core.materials,core.material.images,b,function(){core.loader._loadMaterials_afterLoad();a()})};loader.prototype._loadMaterials_afterLoad=function(){var a=core.splitImage(core.material.images.icons);for(var b in core.statusBar.icons){if(typeof core.statusBar.icons[b]=="number"){core.statusBar.icons[b]=a[core.statusBar.icons[b]];if(core.statusBar.image[b]!=null){core.statusBar.image[b].src=core.statusBar.icons[b].src}}}};loader.prototype._loadExtraImages_sync=function(a){core.material.images.images={};this._setStartLoadTipText("正在加载图片文件...");core.loadImages("images",core.images,core.material.images.images,a)};loader.prototype._loadExtraImages_async=function(d,c){core.material.images.images={};var b=core.images;var a=b.filter(function(e){return e.toLowerCase().endsWith(".gif")});b=b.filter(function(e){return !e.toLowerCase().endsWith(".gif")});this.loadImagesFromZip("project/images/images.h5data",b,core.material.images.images,d,c);a.forEach(function(e){this.loadImage("images",e,function(f,g){if(g!=null){core.material.images.images[e]=g}})},this)};loader.prototype._loadAutotiles_sync=function(b){core.material.images.autotile={};var c=Object.keys(core.material.icons.autotile);var a={};this._setStartLoadTipText("正在加载自动元件...");this.loadImages("autotiles",c,a,function(){core.loader._loadAutotiles_afterLoad(c,a);b()})};loader.prototype._loadAutotiles_async=function(d,c){core.material.images.autotile={};var b=Object.keys(core.material.icons.autotile);var a={};this.loadImagesFromZip("project/autotiles/autotiles.h5data",b,a,d,function(){core.loader._loadAutotiles_afterLoad(b,a);c()})};loader.prototype._loadAutotiles_afterLoad=function(b,a){b.forEach(function(c){core.material.images.autotile[c]=a[c]});setTimeout(function(){core.maps._makeAutotileEdges()})};loader.prototype._loadTilesets_sync=function(a){core.material.images.tilesets={};this._setStartLoadTipText("正在加载额外素材...");this.loadImages("tilesets",core.tilesets,core.material.images.tilesets,function(){core.loader._loadTilesets_afterLoad();a()})};loader.prototype._loadTilesets_async=function(b,a){core.material.images.tilesets={};this.loadImagesFromZip("project/tilesets/tilesets.h5data",core.tilesets,core.material.images.tilesets,b,function(){core.loader._loadTilesets_afterLoad();a()})};loader.prototype._loadTilesets_afterLoad=function(){for(var b in core.material.images.tilesets){var a=core.material.images.tilesets[b];if(a.width%32!=0||a.height%32!=0){console.warn("警告!"+b+"的宽或高不是32的倍数!")}if(a.width*a.height>32*32*3000){console.warn("警告!"+b+"上的图块素材个数大于3000!")}}};loader.prototype.loadImages=function(b,e,f,a){if(!e||e.length==0){if(a){a()}return}var d=0;for(var c=0;c<e.length;c++){this.loadImage(b,e[c],function(g,h){core.loader._setStartLoadTipText("正在加载图片 "+g+"...");if(f[g]!==undefined){if(h!=null){f[g]=h}return}f[g]=h;d++;core.loader._setStartProgressVal(d*(100/e.length));if(d==e.length){if(a){a()}}})}};loader.prototype.loadImage=function(b,f,a){try{var g=f;if(g.indexOf(".")<0){g=g+".png"}var d=new Image();d.onload=function(){d.setAttribute("_width",d.width);d.setAttribute("_height",d.height);a(f,d)};d.onerror=function(){a(f,null)};d.src="project/"+b+"/"+g+"?v="+main.version;if(g.endsWith(".gif")){a(f,null)}}catch(c){main.log(c)}};loader.prototype.loadImagesFromZip=function(e,a,d,c,b){if(!a||a.length==0){if(b){b()}return}core.unzip(e+"?v="+main.version,function(g){var f=1;a.forEach(function(j){var i=j;if(i.indexOf(".")<0){i+=".png"}if(i in g){var h=new Image();var k=URL.createObjectURL(g[i]);f++;h.onload=function(){f--;URL.revokeObjectURL(k);h.setAttribute("_width",h.width);h.setAttribute("_height",h.height);if(f==0&&b){b()}};h.src=k;d[j]=h}});f--;if(f==0&&b){b()}},null,false,c)};loader.prototype._loadAnimates_sync=function(){this._setStartLoadTipText("正在加载动画文件...");if(main.supportBunch){if(core.animates.length>0){core.http("GET","__all_animates__?v="+main.version+"&id="+core.animates.join(","),null,function(a){var c=a.split("@@@~~~###~~~@@@");for(var b=0;b<core.animates.length;++b){if(c[b]!=""){core.material.animates[core.animates[b]]=core.loader._loadAnimate(c[b])}else{console.error("无法找到动画文件"+core.animates[b]+"!")}}},"text/plain; charset=x-user-defined")}return}core.animates.forEach(function(a){core.http("GET","project/animates/"+a+".animate?v="+main.version,null,function(b){core.material.animates[a]=core.loader._loadAnimate(b)},function(b){main.log(b);core.material.animates[a]=null},"text/plain; charset=x-user-defined")})};loader.prototype._loadAnimates_async=function(b,a){core.unzip("project/animates/animates.h5data?v="+main.version,function(c){for(var d in c){if(d.endsWith(".animate")){var e=d.substring(0,d.length-8);if(core.animates.indexOf(e)>=0){core.material.animates[e]=core.loader._loadAnimate(c[d])}}}a()},null,true,b)};loader.prototype._loadAnimate=function(a){try{a=JSON.parse(a);var b={};b.ratio=a.ratio;b.se=a.se;b.pitch=a.pitch;b.images=[];a.bitmaps.forEach(function(g){if(!g){b.images.push(null)}else{try{var f=new Image();f.src=g;b.images.push(f)}catch(d){main.log(d);b.images.push(null)}}});b.frame=a.frame_max;b.frames=[];a.frames.forEach(function(e){var d=[];e.forEach(function(f){d.push({index:f[0],x:f[1],y:f[2],zoom:f[3],opacity:f[4],mirror:f[5]||0,angle:f[6]||0,})});b.frames.push(d)});return b}catch(c){main.log(c);return null}};loader.prototype._loadMusic_sync=function(){this._setStartLoadTipText("正在加载音效文件...");core.bgms.forEach(function(a){core.loader.loadOneMusic(a)});core.sounds.forEach(function(a){core.loader.loadOneSound(a)});core.playBgm(main.startBgm)};loader.prototype._loadMusic_async=function(b,a){core.bgms.forEach(function(c){core.loader.loadOneMusic(c)});core.unzip("project/sounds/sounds.h5data?v="+main.version,function(c){setTimeout(function(){for(var d in c){if(core.sounds.indexOf(d)>=0){core.loader._loadOneSound_decodeData(d,c[d])}}});a()},null,false,b);core.playBgm(main.startBgm)};loader.prototype.loadOneMusic=function(b){var a=new Audio();a.preload="none";if(main.bgmRemote){a.src=main.bgmRemoteRoot+core.firstData.name+"/"+b}else{a.src="project/bgms/"+b}a.loop="loop";core.material.bgms[b]=a};loader.prototype.loadOneSound=function(a){core.http("GET","project/sounds/"+a+"?v="+main.version,null,function(b){core.loader._loadOneSound_decodeData(a,b)},function(b){main.log(b);core.material.sounds[a]=null},null,"arraybuffer")};loader.prototype._loadOneSound_decodeData=function(d,b){if(b instanceof Blob){var a=new zip.BlobReader(b);a.init(function(){a.readUint8Array(0,a.size,function(e){core.loader._loadOneSound_decodeData(d,e.buffer)})});return}try{core.musicStatus.audioContext.decodeAudioData(b,function(e){core.material.sounds[d]=e},function(f){main.log(f);core.material.sounds[d]=null})}catch(c){main.log(c);core.material.sounds[d]=null}};loader.prototype.loadBgm=function(b){b=core.getMappedName(b);if(!core.material.bgms[b]){return}if(!core.musicStatus.bgmStatus){return}var a=core.musicStatus.cachedBgms.indexOf(b);if(a>=0){core.musicStatus.cachedBgms.splice(a,1)}else{this._preloadBgm(core.material.bgms[b]);if(core.musicStatus.cachedBgms.length==core.musicStatus.cachedBgmCount){this.freeBgm(core.musicStatus.cachedBgms.pop())}}core.musicStatus.cachedBgms.unshift(b)};loader.prototype._preloadBgm=function(a){a.volume=0;a.play()};loader.prototype.freeBgm=function(a){a=core.getMappedName(a);if(!core.material.bgms[a]){return}core.musicStatus.cachedBgms=core.musicStatus.cachedBgms.filter(function(b){return b!=a});core.material.bgms[a].removeAttribute("src");core.material.bgms[a].load();core.material.bgms[a]=null;if(a==core.musicStatus.playingBgm){core.musicStatus.playingBgm=null}setTimeout(function(){core.loader.loadOneMusic(a)},3000)};"use strict";function control(){this._init()}control.prototype._init=function(){this.controldata=functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.control;this.renderFrameFuncs=[];this.replayActions=[];this.weathers={};this.resizes=[];this.registerAnimationFrame("totalTime",false,this._animationFrame_totalTime);this.registerAnimationFrame("autoSave",true,this._animationFrame_autoSave);this.registerAnimationFrame("globalAnimate",true,this._animationFrame_globalAnimate);this.registerAnimationFrame("animate",true,this._animationFrame_animate);this.registerAnimationFrame("heroMoving",true,this._animationFrame_heroMoving);this.registerAnimationFrame("weather",true,this._animationFrame_weather);this.registerAnimationFrame("tip",true,this._animateFrame_tip);this.registerAnimationFrame("parallelDo",false,this._animationFrame_parallelDo);this.registerWeather("rain",this._weather_rain,this._animationFrame_weather_rain);this.registerWeather("snow",this._weather_snow,this._animationFrame_weather_snow);this.registerWeather("fog",this._weather_fog,this.__animateFrame_weather_image);this.registerWeather("cloud",this._weather_cloud,this.__animateFrame_weather_image);this.registerWeather("sun",this._weather_sun,this._animationFrame_weather_sun);this.registerReplayAction("move",this._replayAction_move);this.registerReplayAction("item",this._replayAction_item);this.registerReplayAction("equip",this._replayAction_equip);this.registerReplayAction("unEquip",this._replayAction_unEquip);this.registerReplayAction("saveEquip",this._replayAction_saveEquip);this.registerReplayAction("loadEquip",this._replayAction_loadEquip);this.registerReplayAction("fly",this._replayAction_fly);this.registerReplayAction("shop",this._replayAction_shop);this.registerReplayAction("turn",this._replayAction_turn);this.registerReplayAction("getNext",this._replayAction_getNext);this.registerReplayAction("moveDirectly",this._replayAction_moveDirectly);this.registerReplayAction("key",this._replayAction_key);this.registerReplayAction("click",this._replayAction_click);this.registerReplayAction("ignoreInput",this._replayAction_ignoreInput);this.registerReplayAction("no",this._replayAction_no);this.registerResize("gameGroup",this._resize_gameGroup);this.registerResize("canvas",this._resize_canvas);this.registerResize("statusBar",this._resize_statusBar);this.registerResize("status",this._resize_status);this.registerResize("toolBar",this._resize_toolBar);this.registerResize("tools",this._resize_tools)};control.prototype.registerAnimationFrame=function(b,c,a){this.unregisterAnimationFrame(b);this.renderFrameFuncs.push({name:b,needPlaying:c,func:a})};control.prototype.unregisterAnimationFrame=function(a){this.renderFrameFuncs=this.renderFrameFuncs.filter(function(b){return b.name!=a})};control.prototype._setRequestAnimationFrame=function(){this._checkRequestAnimationFrame();core.animateFrame.totalTime=Math.max(core.animateFrame.totalTime,core.getLocalStorage("totalTime",0));var a=function(b){core.control.renderFrameFuncs.forEach(function(c){if(c.func){try{if(core.isPlaying()||!c.needPlaying){core.doFunc(c.func,core.control,b)}}catch(d){main.log(d);main.log("ERROR in requestAnimationFrame["+c.name+"]:已自动注销该项。");core.unregisterAnimationFrame(c.name)}}});window.requestAnimationFrame(a)};window.requestAnimationFrame(a)};control.prototype._checkRequestAnimationFrame=function(){(function(){var a=0;var b=["webkit","moz"];for(var c=0;c<b.length&&!window.requestAnimationFrame;++c){window.requestAnimationFrame=window[b[c]+"RequestAnimationFrame"];window.cancelAnimationFrame=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"CancelRequestAnimationFrame"]}if(!window.requestAnimationFrame){window.requestAnimationFrame=function(d,f){var e=new Date().getTime();var h=Math.max(0,16.7-(e-a));var g=window.setTimeout(function(){d(e+h)},h);a=e+h;return g}}if(!window.cancelAnimationFrame){window.cancelAnimationFrame=function(d){clearTimeout(d)}}}())};control.prototype._animationFrame_totalTime=function(a){core.animateFrame.totalTime+=a-core.animateFrame.totalTimeStart;core.animateFrame.totalTimeStart=a;if(core.isPlaying()){core.status.hero.statistics.totalTime=core.animateFrame.totalTime;core.status.hero.statistics.currTime+=a-(core.status.hero.statistics.start||a);core.status.hero.statistics.start=a}};control.prototype._animationFrame_autoSave=function(a){if(a-core.saves.autosave.time<=5000){return}core.control.checkAutosave();core.saves.autosave.time=a};control.prototype._animationFrame_globalAnimate=function(a){if(a-core.animateFrame.globalTime<=core.values.animateSpeed){return}core.status.globalAnimateStatus++;if(core.status.floorId){core.status.globalAnimateObjs.forEach(function(b){core.drawBlock(b,core.status.globalAnimateStatus)});core.maps._drawFloorImages(core.status.floorId,core.canvas.bg,"bg",core.status.floorAnimateObjs||[],core.status.globalAnimateStatus);core.maps._drawFloorImages(core.status.floorId,core.canvas.fg,"fg",core.status.floorAnimateObjs||[],core.status.globalAnimateStatus);core.status.autotileAnimateObjs.forEach(function(b){core.maps._drawAutotileAnimate(b,core.status.globalAnimateStatus)});if((core.status.hero||{}).animate&&core.status.heroMoving==0&&main.mode=="play"&&!core.status.preview.enabled){core.drawHero("stop",null,core.status.globalAnimateStatus)}}core.drawBoxAnimate();core.animateFrame.globalTime=a};control.prototype._animationFrame_animate=function(c){if(c-core.animateFrame.animateTime<50||!core.status.animateObjs||core.status.animateObjs.length==0){return}core.clearMap("animate");for(var a=0;a<core.status.animateObjs.length;a++){var b=core.status.animateObjs[a];if(b.index==b.animate.frames.length){(function(d){setTimeout(function(){if(d){d()}})})(b.callback)}}core.status.animateObjs=core.status.animateObjs.filter(function(d){return d.index<d.animate.frames.length});core.status.animateObjs.forEach(function(d){if(d.hero){core.maps._drawAnimateFrame("animate",d.animate,core.status.heroCenter.px,core.status.heroCenter.py,d.index++)}else{core.maps._drawAnimateFrame("animate",d.animate,d.centerX,d.centerY,d.index++)}});core.animateFrame.animateTime=c};control.prototype._animationFrame_heroMoving=function(a){if(core.status.heroMoving<=0){return}if(a-core.animateFrame.moveTime>core.values.moveSpeed){core.animateFrame.leftLeg=!core.animateFrame.leftLeg;core.animateFrame.moveTime=a}core.drawHero(core.animateFrame.leftLeg?"leftFoot":"rightFoot",4*core.status.heroMoving)};control.prototype._animationFrame_weather=function(b){var d=core.animateFrame.weather,c=d.type;if(!core.dymCanvas.weather||!core.control.weathers[c]||!core.control.weathers[c].frameFunc){return}try{core.doFunc(core.control.weathers[c].frameFunc,core.control,b,core.animateFrame.weather.level)}catch(a){main.log(a);main.log("ERROR in weather["+c+"]:已自动注销该项。");core.unregisterWeather(c)}};control.prototype._animationFrame_weather_rain=function(e,b){if(e-core.animateFrame.weather.time<30){return}var a=core.dymCanvas.weather,c=core.bigmap.offsetX,d=core.bigmap.offsetY;core.clearMap("weather");a.strokeStyle="rgba(174,194,224,0.8)";a.lineWidth=1;a.lineCap="round";core.animateFrame.weather.nodes.forEach(function(f){a.beginPath();a.moveTo(f.x-c,f.y-d);a.lineTo(f.x+f.l*f.xs-c,f.y+f.l*f.ys-d);a.stroke();f.x+=f.xs;f.y+=f.ys;if(f.x>core.bigmap.width*32||f.y>core.bigmap.height*32){f.x=Math.random()*core.bigmap.width*32;f.y=-10}});a.fill();core.animateFrame.weather.time=e};control.prototype._animationFrame_weather_snow=function(f,c){if(f-core.animateFrame.weather.time<30){return}var b=core.dymCanvas.weather,d=core.bigmap.offsetX,e=core.bigmap.offsetY;core.clearMap("weather");b.fillStyle="rgba(255, 255, 255, 0.8)";b.beginPath();core.animateFrame.weather.data=core.animateFrame.weather.data||0;core.animateFrame.weather.data+=0.01;var a=core.animateFrame.weather.data;core.animateFrame.weather.nodes.forEach(function(g){b.moveTo(g.x-d,g.y-e);b.arc(g.x-d,g.y-e,g.r,0,Math.PI*2,true);g.x+=Math.sin(a)*core.animateFrame.weather.level;g.y+=Math.cos(a+g.d)+1+g.r/2;if(g.x>core.bigmap.width*32+5||g.x<-5||g.y>core.bigmap.height*32){if(Math.random()>1/3){g.x=Math.random()*core.bigmap.width*32;g.y=-10}else{if(Math.sin(a)>0){g.x=-5}else{g.x=core.bigmap.width*32+5}g.y=Math.random()*core.bigmap.height*32}}});b.fill();core.animateFrame.weather.time=f};control.prototype.__animateFrame_weather_image=function(g,e){if(g-core.animateFrame.weather.time<30){return}var f=core.animateFrame.weather.nodes[0];var c=f.image;if(!c){return}core.clearMap("weather");core.setAlpha("weather",f.level/500);var k=1.5;var h=c.width,a=c.height;f.x+=f.dx*k;f.y+=(2*f.dy-1)*k;if(f.x+3*h<=core.__PIXELS__){f.x+=4*h;while(f.x>0){f.x-=h}}f.dy+=f.delta;if(f.dy>=1){f.delta=-0.001}else{if(f.dy<=0){f.delta=0.001}}if(f.y+3*a<=core.__PIXELS__){f.y+=4*a;while(f.y>0){f.y-=a}}else{if(f.y>=0){f.y-=a}}for(var b=0;b<3;++b){for(var d=0;d<3;++d){if(f.x+(b+1)*h<=0||f.x+b*h>=core.__PIXELS__||f.y+(d+1)*a<=0||f.y+d*a>=core.__PIXELS__){continue}core.drawImage("weather",c,f.x+b*h,f.y+d*a)}}core.setAlpha("weather",1);core.animateFrame.weather.time=g};control.prototype._animationFrame_weather_sun=function(d,a){if(d-core.animateFrame.weather.time<30){return}var b=core.animateFrame.weather.nodes[0];var c=b.opacity+b.delta;if(c>a/10+0.3||c<a/10-0.3){b.delta=-b.delta}b.opacity=c;core.setOpacity("weather",core.clamp(c,0,1));core.animateFrame.weather.time=d};control.prototype._animateFrame_tip=function(b){if(core.animateFrame.tip==null){return}var c=core.animateFrame.tip;if(b-c.time<=30){return}var a=b-c.time;c.time=b;core.setFont("data","16px Arial");core.setTextAlign("data","left");core.clearMap("data",0,0,core.__PIXELS__,50);core.ui._drawTip_drawOne(c);if(c.stage==1){c.opacity+=0.05;if(c.opacity>=0.6){c.stage=2;c.displayTime=0}}else{if(c.stage==2){c.displayTime+=a;if(c.displayTime>=1000){c.stage=3}}else{c.opacity-=0.05}}if(c.opacity<=0){core.animateFrame.tip=null}};control.prototype._animationFrame_parallelDo=function(a){core.control.controldata.parallelDo(a)};control.prototype.showStartAnimate=function(b,a){this._showStartAnimate_resetDom();if(core.flags.startUsingCanvas||b){return this._showStartAnimate_finished(core.flags.startUsingCanvas,a)}core.hideWithAnimate(core.dom.startTop,20,function(){core.control._showStartAnimate_finished(false,a)})};control.prototype._showStartAnimate_resetDom=function(){core.dom.startPanel.style.opacity=1;core.dom.startPanel.style.display="block";core.dom.startTop.style.opacity=1;core.dom.startTop.style.display="block";core.dom.startButtonGroup.style.display="none";core.dom.startButtons.style.display="block";core.dom.levelChooseButtons.style.display="none";core.status.played=false;core.clearStatus();core.clearMap("all");core.dom.musicBtn.style.display="block";core.dom.enlargeBtn.style.display="block";core.setMusicBtn();core.events.setVolume(1,0);core.updateStatusBar()};control.prototype._showStartAnimate_finished=function(b,a){core.dom.startTop.style.display="none";core.dom.startButtonGroup.style.display="block";main.selectedButton=null;main.selectButton(0);if(b){core.startGame()}if(a){a()}};control.prototype.hideStartAnimate=function(a){core.hideWithAnimate(core.dom.startPanel,20,a)};control.prototype.isPlaying=function(){return core.status.played};control.prototype.clearStatus=function(){for(var a in core.timeout){clearTimeout(core.timeout[a]);core.timeout[a]=null}for(var a in core.interval){clearInterval(core.interval[a]);core.interval[a]=null}core.status={};core.clearStatusBar();core.deleteAllCanvas();core.status.played=false};control.prototype._initStatistics=function(a){if(!core.isset(core.status.hero.statistics)){core.status.hero.statistics={totalTime:a,currTime:0,hp:0,battle:0,money:0,exp:0,battleDamage:0,poisonDamage:0,extraDamage:0,moveDirectly:0,ignoreSteps:0,}}};control.prototype.clearAutomaticRouteNode=function(a,b){core.clearMap("route",a*32+5-core.status.automaticRoute.offsetX,b*32+5-core.status.automaticRoute.offsetY,27,27)};control.prototype.stopAutomaticRoute=function(){if(!core.status.played){return}core.status.automaticRoute.autoHeroMove=false;core.status.automaticRoute.autoStep=0;core.status.automaticRoute.destStep=0;core.status.automaticRoute.movedStep=0;core.status.automaticRoute.autoStepRoutes=[];core.status.automaticRoute.destX=null;core.status.automaticRoute.destY=null;core.status.automaticRoute.lastDirection=null;core.status.heroStop=true;if(core.status.automaticRoute.moveStepBeforeStop.length==0){core.deleteCanvas("route")}};control.prototype.saveAndStopAutomaticRoute=function(){var a=core.status.automaticRoute;if(a.moveStepBeforeStop.length==0){a.moveStepBeforeStop=a.autoStepRoutes.slice(a.autoStep-1);if(a.moveStepBeforeStop.length>=1){a.moveStepBeforeStop[0].step-=a.movedStep}}this.stopAutomaticRoute()};control.prototype.continueAutomaticRoute=function(){var a=core.status.automaticRoute.moveStepBeforeStop;if(a.length===0||(a.length===1&&a[0].step===1)){core.status.automaticRoute.moveStepBeforeStop=[]}else{core.setAutoHeroMove(a)}};control.prototype.clearContinueAutomaticRoute=function(a){core.deleteCanvas("route");core.status.automaticRoute.moveStepBeforeStop=[];if(a){a()}};control.prototype.setAutomaticRoute=function(a,b,d){if(!core.status.played||core.status.lockControl){return}if(this._setAutomaticRoute_isMoving(a,b)){return}if(this._setAutomaticRoute_isTurning(a,b,d)){return}if(this._setAutomaticRoute_clickMoveDirectly(a,b,d)){return}var c=core.automaticRoute(a,b);if(c.length==0&&(a!=core.status.hero.loc.x||b!=core.status.hero.loc.y||d.length==0)){return}c=c.concat(d);core.status.automaticRoute.destX=a;core.status.automaticRoute.destY=b;this._setAutomaticRoute_drawRoute(c);this._setAutomaticRoute_setAutoSteps(c);core.setAutoHeroMove()};control.prototype._setAutomaticRoute_isMoving=function(a,b){if(core.status.automaticRoute.autoHeroMove){var c=core.status.automaticRoute.destX,d=core.status.automaticRoute.destY;core.stopAutomaticRoute();if(c==a&&d==b){core.status.automaticRoute.moveDirectly=true;setTimeout(function(){if(core.status.automaticRoute.moveDirectly&&core.status.heroMoving==0){core.control.tryMoveDirectly(a,b)}core.status.automaticRoute.moveDirectly=false},core.values.moveSpeed)}return true}return false};control.prototype._setAutomaticRoute_isTurning=function(a,b,d){if(a==core.status.hero.loc.x&&b==core.status.hero.loc.y&&d.length==0){if(core.timeout.turnHeroTimeout==null){var c=core.status.route.length;core.timeout.turnHeroTimeout=setTimeout(function(){if(core.status.route.length==c){core.turnHero()}clearTimeout(core.timeout.turnHeroTimeout);core.timeout.turnHeroTimeout=null},250)}else{clearTimeout(core.timeout.turnHeroTimeout);core.timeout.turnHeroTimeout=null;core.getNextItem()}return true}if(core.timeout.turnHeroTimeout!=null){return true}return false};control.prototype._setAutomaticRoute_clickMoveDirectly=function(a,b,c){if(core.status.heroStop&&core.status.heroMoving==0){if(c.length<=1&&!core.hasFlag("__noClickMove__")&&core.control.tryMoveDirectly(a,b)){return true}}return false};control.prototype._setAutomaticRoute_drawRoute=function(h){var j=core.bigmap.width*32,k=core.bigmap.height*32,e=0,f=0;h.forEach(function(l){j=Math.min(j,l.x*32);e=Math.max(e,l.x*32);k=Math.min(k,l.y*32);f=Math.max(f,l.y*32)});core.status.automaticRoute.offsetX=j;core.status.automaticRoute.offsetY=k;var a=core.createCanvas("route",j-core.bigmap.offsetX,k-core.bigmap.offsetY,e-j+32,f-k+32,95);a.fillStyle="#bfbfbf";a.strokeStyle="#bfbfbf";a.lineWidth=8;for(var g=0;g<h.length;g++){if(g==h.length-1){a.fillRect(h[g].x*32+10-j,h[g].y*32+10-k,12,12)}else{a.beginPath();var c=h[g].x*32+16-j,d=h[g].y*32+16-k;var b=h[g].direction,i=h[g+1].direction;a.moveTo(c-core.utils.scan[b].x*11,d-core.utils.scan[b].y*11);a.lineTo(c,d);a.lineTo(c+core.utils.scan[i].x*11,d+core.utils.scan[i].y*11);a.stroke()}}};control.prototype._setAutomaticRoute_setAutoSteps=function(b){var c=0,a=null;b.forEach(function(e){var d=e.direction;if(a==null||a==d){c++}else{core.status.automaticRoute.autoStepRoutes.push({direction:a,step:c});c=1}a=d});core.status.automaticRoute.autoStepRoutes.push({direction:a,step:c})};control.prototype.setAutoHeroMove=function(a){a=a||core.status.automaticRoute.autoStepRoutes;if(a.length==0){return}core.status.automaticRoute.autoStepRoutes=a;core.status.automaticRoute.autoHeroMove=true;core.status.automaticRoute.autoStep=1;core.status.automaticRoute.destStep=a[0].step;core.moveHero(a[0].direction)};control.prototype.setHeroMoveInterval=function(a){if(core.status.heroMoving>0){return}if(core.status.replay.speed==24){if(a){a()}return}core.status.heroMoving=1;var b=1;if(core.status.replay.speed>3){b=2}if(core.status.replay.speed>6){b=4}if(core.status.replay.speed>12){b=8}core.interval.heroMoveInterval=window.setInterval(function(){core.status.heroMoving+=b;if(core.status.heroMoving>=8){clearInterval(core.interval.heroMoveInterval);core.status.heroMoving=0;if(a){a()}}},core.values.moveSpeed/8*b/core.status.replay.speed)};control.prototype.moveOneStep=function(a){return this.controldata.moveOneStep(a)};control.prototype.moveAction=function(a){if(core.status.heroMoving>0){return}var c=core.noPass(core.nextX(),core.nextY()),b=core.canMoveHero();if(c||!b){return this._moveAction_noPass(b,a)}this._moveAction_moving(a)};control.prototype._moveAction_noPass=function(b,a){core.status.route.push(core.getHeroLoc("direction"));core.status.automaticRoute.moveStepBeforeStop=[];core.status.automaticRoute.lastDirection=core.getHeroLoc("direction");if(b){core.trigger(core.nextX(),core.nextY())}core.drawHero();if(core.status.automaticRoute.moveStepBeforeStop.length==0){core.clearContinueAutomaticRoute();core.stopAutomaticRoute()}if(a){a()}};control.prototype._moveAction_moving=function(a){core.setHeroMoveInterval(function(){core.setHeroLoc("x",core.nextX(),true);core.setHeroLoc("y",core.nextY(),true);var b=core.getHeroLoc("direction");core.control._moveAction_popAutomaticRoute();core.status.route.push(b);core.moveOneStep();core.checkRouteFolding();if(a){a()}})};control.prototype._moveAction_popAutomaticRoute=function(){var a=core.status.automaticRoute;if(a.autoHeroMove){a.movedStep++;a.lastDirection=core.getHeroLoc("direction");if(a.destStep==a.movedStep){if(a.autoStep==a.autoStepRoutes.length){core.clearContinueAutomaticRoute();core.stopAutomaticRoute()}else{a.movedStep=0;a.destStep=a.autoStepRoutes[a.autoStep].step;core.setHeroLoc("direction",a.autoStepRoutes[a.autoStep].direction);core.status.automaticRoute.autoStep++}}}};control.prototype.moveHero=function(b,a){if(core.status.heroMoving!=0){return}if(core.isset(b)){core.setHeroLoc("direction",b)}if(a){return this.moveAction(a)}this._moveHero_moving()};control.prototype._moveHero_moving=function(){core.status.heroStop=false;core.status.automaticRoute.moveDirectly=false;var a=function(){if(!core.status.heroStop){if(core.hasFlag("debug")&&core.status.ctrlDown){if(core.status.heroMoving!=0){return}var b=core.nextX(),c=core.nextY();if(b<0||b>=core.bigmap.width||c<0||c>=core.bigmap.height){return}core.eventMoveHero([core.getHeroLoc("direction")],core.values.moveSpeed,a)}else{core.moveAction();setTimeout(a,50)}}};a()};control.prototype.isMoving=function(){return !core.status.heroStop||core.status.heroMoving>0};control.prototype.waitHeroToStop=function(a){var b=core.status.automaticRoute.lastDirection;core.stopAutomaticRoute();core.clearContinueAutomaticRoute();if(a){core.status.replay.animate=true;core.lockControl();core.status.automaticRoute.moveDirectly=false;setTimeout(function(){core.status.replay.animate=false;if(core.isset(b)){core.setHeroLoc("direction",b)}core.drawHero();a()},core.status.replay.speed==24?1:30)}};control.prototype.turnHero=function(a){if(a){core.setHeroLoc("direction",a);core.drawHero();core.status.route.push("turn:"+a);return}core.setHeroLoc("direction",core.turnDirection(":right"));core.drawHero();core.status.route.push("turn");core.checkRouteFolding()};control.prototype.moveDirectly=function(a,b,c){return this.controldata.moveDirectly(a,b,c)};control.prototype.tryMoveDirectly=function(e,f){if(this.nearHero(e,f)){return false}var a=core.maps.generateMovableArray();var h=[[e,f],[e-1,f,"right"],[e,f-1,"down"],[e,f+1,"up"],[e+1,f,"left"]];var b=core.canMoveDirectlyArray(h,a);for(var l=0;l<h.length;++l){var c=h[l],j=c[0],k=c[1],g=c[2];if(j<0||j>=core.bigmap.width||k<0||k>=core.bigmap.height){continue}if(g&&!core.inArray(a[j][k],g)){continue}if(b[l]<0){continue}if(core.control.moveDirectly(j,k,b[l])){if(g){core.moveHero(g,function(){})}return true}}return false};control.prototype.drawHero=function(h,e,d){if(!core.isPlaying()||!core.status.floorId||core.status.gameOver){return}var j=core.getHeroLoc("x"),k=core.getHeroLoc("y"),a=core.getHeroLoc("direction");h=h||"stop";if(!e){e=0}var i=core.utils.scan2[a];var b=i.x,c=i.y;var f=typeof e=="number"?b*e:(e.x||0);var g=typeof e=="number"?c*e:(e.y||0);e={x:f,y:g,offset:e};core.clearAutomaticRouteNode(j+b,k+c);core.clearMap("hero");core.status.heroCenter.px=32*j+f+16;core.status.heroCenter.py=32*k+g+32-core.material.icons.hero.height/2;core.setGameCanvasTranslate("hero",0,0);delete core.canvas.hero._px;delete core.canvas.hero._py;core.status.preview.enabled=false;if(!core.hasFlag("__lockViewport__")){this._drawHero_updateViewport(j,k,e)}this._drawHero_draw(a,j,k,h,e,d)};control.prototype._drawHero_updateViewport=function(b,c,a){core.bigmap.offsetX=core.clamp((b-core.__HALF_SIZE__)*32+a.x,0,32*core.bigmap.width-core.__PIXELS__);core.bigmap.offsetY=core.clamp((c-core.__HALF_SIZE__)*32+a.y,0,32*core.bigmap.height-core.__PIXELS__);core.control.updateViewport()};control.prototype._drawHero_draw=function(a,f,g,e,c,b){c=c||{x:0,y:0,offset:0,px:0,py:0};var d=core.setAlpha("hero",core.getFlag("__heroOpacity__",1));this._drawHero_getDrawObjs(a,f,g,e,c).forEach(function(h){core.drawImage("hero",h.img,(h.heroIcon[h.status]+(b||0))%4*h.width,h.heroIcon.loc*h.height,h.width,h.height,h.posx+(32-h.width)/2,h.posy+32-h.height,h.width,h.height)});core.setAlpha("hero",d)};control.prototype._drawHero_getDrawObjs=function(a,g,h,f,e){var c=core.material.icons.hero,b=[],d=0;b.push({img:core.material.images.hero,width:core.material.icons.hero.width||32,height:core.material.icons.hero.height,heroIcon:c[a],posx:g*32-core.bigmap.offsetX+e.x,posy:h*32-core.bigmap.offsetY+e.y,status:f,index:d++,});if(typeof e.offset=="number"){core.status.hero.followers.forEach(function(i){b.push({img:core.material.images.images[i.name],width:core.material.images.images[i.name].width/4,height:core.material.images.images[i.name].height/4,heroIcon:c[i.direction],posx:32*i.x-core.bigmap.offsetX+(i.stop?0:core.utils.scan2[i.direction].x*Math.abs(e.offset)),posy:32*i.y-core.bigmap.offsetY+(i.stop?0:core.utils.scan2[i.direction].y*Math.abs(e.offset)),status:i.stop?"stop":f,index:d++})})}return b.sort(function(i,j){return i.posy==j.posy?j.index-i.index:i.posy-j.posy})};control.prototype.setHeroOpacity=function(f,e,i,b){i=i||0;if(i==0){core.setFlag("__heroOpacity__",f);core.drawHero();if(b){b()}return}i/=Math.max(core.status.replay.speed,1);var c=core.getFlag("__heroOpacity__",1);var g=0,h=parseInt(i/10);if(h<=0){h=1}var d=core.applyEasing(e);var a=setInterval(function(){g++;core.setFlag("__heroOpacity__",c+(f-c)*d(g/h));core.drawHero();if(g==h){delete core.animateFrame.asyncId[a];clearInterval(a);if(b){b()}}},10);core.animateFrame.lastAsyncId=a;core.animateFrame.asyncId[a]=b};control.prototype.setGameCanvasTranslate=function(b,d,e){var a=core.dom.gameCanvas[b];d=d*core.domStyle.scale;e=e*core.domStyle.scale;a.style.transform="translate("+d+"px,"+e+"px)";a.style.webkitTransform="translate("+d+"px,"+e+"px)";a.style.OTransform="translate("+d+"px,"+e+"px)";a.style.MozTransform="translate("+d+"px,"+e+"px)";if(main.mode==="editor"&&editor.isMobile){a.style.transform="translate("+(d/core.__PIXELS__*96)+"vw,"+(e/core.__PIXELS__*96)+"vw)";a.style.webkitTransform="translate("+(d/core.__PIXELS__*96)+"vw,"+(e/core.__PIXELS__*96)+"vw)";a.style.OTransform="translate("+(d/core.__PIXELS__*96)+"vw,"+(e/core.__PIXELS__*96)+"vw)";a.style.MozTransform="translate("+(d/core.__PIXELS__*96)+"vw,"+(e/core.__PIXELS__*96)+"vw)"}};control.prototype.addGameCanvasTranslate=function(f,g){for(var c=0,a;a=core.dom.gameCanvas[c];c++){var b=a.getAttribute("id");if(b=="ui"||b=="data"){continue}var d=f,e=g;if(core.bigmap.canvas.indexOf(b)>=0){if(core.bigmap.v2){d-=(core.bigmap.offsetX-32*core.bigmap.posX)+32;e-=(core.bigmap.offsetY-32*core.bigmap.posY)+32}else{d-=core.bigmap.offsetX;e-=core.bigmap.offsetY}}core.control.setGameCanvasTranslate(b,d,e)}};control.prototype.updateViewport=function(){if(core.bigmap.v2){if(core.bigmap.offsetX>=core.bigmap.posX*32+32||core.bigmap.offsetX<=core.bigmap.posX*32-32||core.bigmap.offsetY>=core.bigmap.posY*32+32||core.bigmap.offsetY<=core.bigmap.posY*32-32){core.bigmap.posX=parseInt(core.bigmap.offsetX/32);core.bigmap.posY=parseInt(core.bigmap.offsetY/32);core.redrawMap()}}else{core.bigmap.posX=core.bigmap.posY=0}var a=core.bigmap.v2?-(core.bigmap.offsetX-32*core.bigmap.posX)-32:-core.bigmap.offsetX;var b=core.bigmap.v2?-(core.bigmap.offsetY-32*core.bigmap.posY)-32:-core.bigmap.offsetY;core.bigmap.canvas.forEach(function(f){core.control.setGameCanvasTranslate(f,a,b)});core.relocateCanvas("route",core.status.automaticRoute.offsetX-core.bigmap.offsetX,core.status.automaticRoute.offsetY-core.bigmap.offsetY);for(var c in core.dymCanvas){if(c.startsWith("_bigImage_")){var d=core.dymCanvas[c].canvas.getAttribute("_ox");var e=core.dymCanvas[c].canvas.getAttribute("_oy");if(d!=null&&e!=null){core.relocateCanvas(c,parseInt(d)-core.bigmap.offsetX,parseInt(e)-core.bigmap.offsetY)}}}};control.prototype.setViewport=function(c,d){var a=core.bigmap.offsetX,b=core.bigmap.offsetY;core.bigmap.offsetX=core.clamp(c,0,32*core.bigmap.width-core.__PIXELS__);core.bigmap.offsetY=core.clamp(d,0,32*core.bigmap.height-core.__PIXELS__);this.updateViewport();var c=parseFloat(core.canvas.hero._px)||0;var d=parseFloat(core.canvas.hero._py)||0;c+=a-core.bigmap.offsetX;d+=b-core.bigmap.offsetY;core.control.setGameCanvasTranslate("hero",c,d);core.canvas.hero._px=c;core.canvas.hero._py=d};control.prototype.moveViewport=function(m,n,f,l,b){l=l||0;l/=Math.max(core.status.replay.speed,1);var g=10,j=0,k=parseInt(l/g);if(k<=0){this.setViewport(32*m,32*n);if(b){b()}return}var h=core.clamp(32*m,0,32*core.bigmap.width-core.__PIXELS__);var i=core.clamp(32*n,0,32*core.bigmap.height-core.__PIXELS__);var c=core.bigmap.offsetX;var d=core.bigmap.offsetY;var e=core.applyEasing(f);var a=window.setInterval(function(){j++;core.setViewport(c+e(j/k)*(h-c),d+e(j/k)*(i-d));if(j==k){delete core.animateFrame.asyncId[a];clearInterval(a);core.setViewport(h,i);if(b){b()}}},g);core.animateFrame.lastAsyncId=a;core.animateFrame.asyncId[a]=b};control.prototype.nextX=function(a){if(a==null){a=1}return core.getHeroLoc("x")+core.utils.scan[core.getHeroLoc("direction")].x*a};control.prototype.nextY=function(a){if(a==null){a=1}return core.getHeroLoc("y")+core.utils.scan[core.getHeroLoc("direction")].y*a};control.prototype.nearHero=function(b,c,a){if(a==null){a=1}return Math.abs(b-core.getHeroLoc("x"))+Math.abs(c-core.getHeroLoc("y"))<=a};control.prototype.gatherFollowers=function(){var b=core.getHeroLoc("x"),c=core.getHeroLoc("y"),a=core.getHeroLoc("direction");core.status.hero.followers.forEach(function(d){d.x=b;d.y=c;d.stop=true;d.direction=a})};control.prototype.updateFollowers=function(){core.status.hero.followers.forEach(function(c){if(!c.stop){c.x+=core.utils.scan2[c.direction].x;c.y+=core.utils.scan2[c.direction].y}});var a=core.getHeroLoc("x"),b=core.getHeroLoc("y");core.status.hero.followers.forEach(function(f){f.stop=true;var d=a-f.x,e=b-f.y;for(var c in core.utils.scan2){if(core.utils.scan2[c].x==d&&core.utils.scan2[c].y==e){f.stop=false;f.direction=c}}a=f.x;b=f.y})};control.prototype._moveDirectyFollowers=function(k,l){var h=core.automaticRoute(k,l);if(h.length==0){h=[{x:k,y:l,direction:core.getHeroLoc("direction")}]}var f=k,g=l;for(var d=0;d<core.status.hero.followers.length;++d){var j=core.status.hero.followers[d];var e=h.length-d-2;if(e<0){e=0}j.stop=true;j.x=h[e].x;j.y=h[e].y;j.direction=h[e].direction;var b=f-j.x,c=g-j.y;for(var a in core.utils.scan2){if(core.utils.scan2[a].x==b&&core.utils.scan2[a].y==c){j.stop=false;j.direction=a}}f=j.x;g=j.y}};control.prototype.updateCheckBlock=function(a){return this.controldata.updateCheckBlock(a)};control.prototype.checkBlock=function(){var d=core.getHeroLoc("x"),e=core.getHeroLoc("y"),b=d+","+e;var a=core.status.checkBlock.damage[b];if(a){core.status.hero.hp-=a;var c=(Object.keys(core.status.checkBlock.type[b]||{}).join(","))||"伤害";core.drawTip("受到"+c+a+"点");core.drawHeroAnimate("zone");this._checkBlock_disableQuickShop();core.status.hero.statistics.extraDamage+=a;if(core.status.hero.hp<=0){core.status.hero.hp=0;core.updateStatusBar();core.events.lose();return}else{core.updateStatusBar()}}this._checkBlock_ambush(core.status.checkBlock.ambush[b]);this._checkBlock_repulse(core.status.checkBlock.repulse[b])};control.prototype._checkBlock_disableQuickShop=function(){if(core.flags.disableShopOnDamage){Object.keys(core.status.shops).forEach(function(a){core.setShopVisited(a,false)})}};control.prototype._checkBlock_repulse=function(b){if(!b||b.length==0){return}var a=[];b.forEach(function(c){a.push({type:"move",loc:[c[0],c[1]],steps:[c[3]],time:250,keep:true,async:true})});a.push({type:"waitAsync"});core.insertAction(a)};control.prototype._checkBlock_ambush=function(b){if(!b||b.length==0){return}var a=[];b.forEach(function(c){a.push({type:"move",loc:[c[0],c[1]],steps:[c[3]],time:250,keep:false,async:true})});a.push({type:"waitAsync"});b.forEach(function(c){a.push({type:"function","function":"function() { core.battle('"+c[2]+"', "+c[0]+","+c[1]+", true, core.doAction); }",async:true})});core.insertAction(a)};control.prototype.updateDamage=function(b,a){b=b||core.status.floorId;if(!b||core.status.gameOver||main.mode!="play"){return}var d=a==null;if(!core.hasItem("book")){return}core.status.damage.posX=core.bigmap.posX;core.status.damage.posY=core.bigmap.posY;if(!d){var e=core.floors[b].width,c=core.floors[b].height;if(e*c>core.bigmap.threshold){return}}this._updateDamage_damage(b,d);this._updateDamage_extraDamage(b,d);this.drawDamage(a)};control.prototype._updateDamage_damage=function(a,b){core.status.damage.data=[];if(!core.flags.displayEnemyDamage&&!core.flags.displayExtraDamage){return}core.extractBlocks(a);core.status.maps[a].blocks.forEach(function(c){var f=c.x,g=c.y;if(b&&core.bigmap.v2){if(f<core.bigmap.posX-core.bigmap.extend||f>core.bigmap.posX+core.__SIZE__+core.bigmap.extend||g<core.bigmap.posY-core.bigmap.extend||g>core.bigmap.posY+core.__SIZE__+core.bigmap.extend){return}}if(!c.disable&&c.event.cls.indexOf("enemy")==0&&c.event.displayDamage!==false){if(core.flags.displayEnemyDamage){var e=core.enemys.getDamageString(c.event.id,f,g,a);core.status.damage.data.push({text:e.damage,px:32*f+1,py:32*(g+1)-1,color:e.color})}if(core.flags.displayCritical){var d=core.enemys.nextCriticals(c.event.id,1,f,g,a);d=core.formatBigNumber((d[0]||[])[0],true);if(d=="???"){d="?"}core.status.damage.data.push({text:d,px:32*f+1,py:32*(g+1)-11,color:"#FFFFFF"})}}})};control.prototype._updateDamage_extraDamage=function(e,g){core.status.damage.extraData=[];if(!core.flags.displayExtraDamage){return}var j=core.floors[e].width,f=core.floors[e].height;var h=g&&core.bigmap.v2?Math.max(0,core.bigmap.posX-core.bigmap.extend):0;var c=g&&core.bigmap.v2?Math.min(j,core.bigmap.posX+core.__SIZE__+core.bigmap.extend+1):j;var i=g&&core.bigmap.v2?Math.max(0,core.bigmap.posY-core.bigmap.extend):0;var d=g&&core.bigmap.v2?Math.min(f,core.bigmap.posY+core.__SIZE__+core.bigmap.extend+1):f;for(var k=h;k<c;k++){for(var l=i;l<d;l++){var a=1;if(core.noPass(k,l,e)){if(core.flags.extraDamageType==2){a=0}else{if(core.flags.extraDamageType==1){a=0.6}}}var b=core.status.checkBlock.damage[k+","+l]||0;if(b>0){b=core.formatBigNumber(b,true);core.status.damage.extraData.push({text:b,px:32*k+16,py:32*(l+1)-14,color:"#ffaa33",alpha:a})}else{if(core.status.checkBlock.ambush[k+","+l]){core.status.damage.extraData.push({text:"!",px:32*k+16,py:32*(l+1)-14,color:"#ffaa33",alpha:a})}}}}};control.prototype.drawDamage=function(a){if(core.status.gameOver||!core.status.damage||main.mode!="play"){return}var b=false;if(a==null){a=core.canvas.damage;core.clearMap("damage");b=true}if(b&&core.bigmap.v2){if(Math.abs(core.bigmap.posX-core.status.damage.posX)>=core.bigmap.extend-1||Math.abs(core.bigmap.posY-core.status.damage.posY)>=core.bigmap.extend-1){return this.updateDamage()}}return this._drawDamage_draw(a,b)};control.prototype._drawDamage_draw=function(a,b){if(!core.hasItem("book")){return}core.setFont(a,"bold 11px Arial");core.setTextAlign(a,"left");core.status.damage.data.forEach(function(c){var d=c.px,e=c.py;if(b&&core.bigmap.v2){d-=core.bigmap.posX*32;e-=core.bigmap.posY*32;if(d<-32*2||d>core.__PIXELS__+32||e<-32||e>core.__PIXELS__+32){return}}core.fillBoldText(a,c.text,d,e,c.color)});core.setTextAlign(a,"center");core.status.damage.extraData.forEach(function(d){var e=d.px,f=d.py;if(b&&core.bigmap.v2){e-=core.bigmap.posX*32;f-=core.bigmap.posY*32;if(e<-32||e>core.__PIXELS__+32||f<-32||f>core.__PIXELS__+32){return}}var c=core.setAlpha(a,d.alpha);core.fillBoldText(a,d.text,e,f,d.color);core.setAlpha(a,c)})};control.prototype.chooseReplayFile=function(){core.readFile(function(b){if(b.name!=core.firstData.name){return alert("存档和游戏不一致!")}if(!b.route){return alert("无效的录像!")}var a=function(){core.startGame(core.flags.startUsingCanvas?"":b.hard||"",b.seed,core.decodeRoute(b.route))};if(b.version&&b.version!=core.firstData.version){core.myconfirm("游戏版本不一致!\n你仍然想播放录像吗?",a);return}a()},null,".h5route")};control.prototype.startReplay=function(a){if(!core.isPlaying()){return}core.status.replay.replaying=true;core.status.replay.pausing=true;core.status.replay.failed=false;core.status.replay.speed=1;core.status.replay.toReplay=core.cloneArray(a);core.status.replay.totalList=core.status.route.concat(a);core.status.replay.steps=0;core.status.replay.save=[];core.createCanvas("replay",0,core.__PIXELS__-40,core.__PIXELS__,40,199);core.setOpacity("replay",0.6);this._replay_drawProgress();core.updateStatusBar();core.drawTip("开始播放");this.replay()};control.prototype.triggerReplay=function(){if(core.status.replay.pausing){this.resumeReplay()}else{this.pauseReplay()}};control.prototype.pauseReplay=function(){if(!core.isPlaying()||!core.isReplaying()){return}core.status.replay.pausing=true;core.updateStatusBar();core.drawTip("暂停播放")};control.prototype.resumeReplay=function(){if(!core.isPlaying()||!core.isReplaying()){return}if(core.isMoving()||core.status.replay.animate||core.status.event.id){core.playSound("操作失败");return core.drawTip("请等待当前事件的处理结束")}core.status.replay.pausing=false;core.updateStatusBar();core.drawTip("恢复播放");core.replay()};control.prototype.stepReplay=function(){if(!core.isPlaying()||!core.isReplaying()){return}if(!core.status.replay.pausing){core.playSound("操作失败");return core.drawTip("请先暂停录像")}if(core.isMoving()||core.status.replay.animate||core.status.event.id){core.playSound("操作失败");return core.drawTip("请等待当前事件的处理结束")}core.replay(true)};control.prototype.speedUpReplay=function(){if(!core.isPlaying()||!core.isReplaying()){return}var b=[0.2,0.5,1,2,3,6,12,24];for(var a=b.length-2;a>=0;a--){if(b[a]<=core.status.replay.speed){core.status.replay.speed=b[a+1];break}}core.drawTip("x"+core.status.replay.speed+"倍")};control.prototype.speedDownReplay=function(){if(!core.isPlaying()||!core.isReplaying()){return}var b=[0.2,0.5,1,2,3,6,12,24];for(var a=1;a<=b.length;a++){if(b[a]>=core.status.replay.speed){core.status.replay.speed=b[a-1];break}}core.drawTip("x"+core.status.replay.speed+"倍")};control.prototype.setReplaySpeed=function(a){if(!core.isPlaying()||!core.isReplaying()){return}core.status.replay.speed=a;core.drawTip("x"+core.status.replay.speed+"倍")};control.prototype.stopReplay=function(a){if(!core.isPlaying()){return}if(!core.isReplaying()&&!a){return}core.status.replay.toReplay=[];core.status.replay.totalList=[];core.status.replay.replaying=false;core.status.replay.pausing=false;core.status.replay.failed=false;core.status.replay.speed=1;core.status.replay.steps=0;core.status.replay.save=[];core.deleteCanvas("replay");core.updateStatusBar();core.drawTip("停止播放并恢复游戏")};control.prototype.rewindReplay=function(){if(!core.isPlaying()||!core.isReplaying()){return}if(!core.status.replay.pausing){core.playSound("操作失败");return core.drawTip("请先暂停录像")}if(core.isMoving()||core.status.replay.animate||core.status.event.id){core.playSound("操作失败");return core.drawTip("请等待当前事件的处理结束")}if(core.status.replay.save.length==0){core.playSound("操作失败");return core.drawTip("无法再回到上一个节点")}var b=core.status.replay.save,a=b.pop();core.loadData(a.data,function(){core.removeFlag("__fromLoad__");core.status.replay={replaying:true,pausing:true,animate:false,toReplay:a.replay.toReplay,totalList:a.replay.totalList,speed:core.status.replay.speed,steps:a.replay.steps,save:b};core.createCanvas("replay",0,core.__PIXELS__-40,core.__PIXELS__,40,199);core.setOpacity("replay",0.6);core.control._replay_drawProgress();core.updateStatusBar();core.drawTip("成功回退到上一个节点")})};control.prototype._replay_SL=function(){if(!core.isPlaying()||!core.isReplaying()){return}if(!core.status.replay.pausing){core.playSound("操作失败");return core.drawTip("请先暂停录像")}if(core.isMoving()||core.status.replay.animate||core.status.event.id){core.playSound("操作失败");return core.drawTip("请等待当前事件的处理结束")}if(core.hasFlag("__forbidSave__")){core.playSound("操作失败");return core.drawTip("当前禁止存档")}this._replay_hideProgress();core.lockControl();core.status.event.id="save";var c=core.saves.saveIndex;var b=parseInt((c-1)/5),a=c-5*b;core.ui._drawSLPanel(10*b+a)};control.prototype._replay_book=function(){if(!core.isPlaying()||!core.isReplaying()){return}if(!core.status.replay.pausing){core.playSound("操作失败");return core.drawTip("请先暂停录像")}if(core.isMoving()||core.status.replay.animate||(core.status.event.id&&core.status.event.id!="viewMaps")){core.playSound("操作失败");return core.drawTip("请等待当前事件的处理结束")}if(!core.hasItem("book")){core.playSound("操作失败");return core.drawTip("你没有"+core.material.items.book.name,"book")}this._replay_hideProgress();if(core.status.event.id=="viewMaps"){core.status.event.ui=core.status.event.data}core.lockControl();core.status.event.id="book";core.useItem("book",true)};control.prototype._replay_viewMap=function(){if(!core.isPlaying()||!core.isReplaying()){return}if(!core.status.replay.pausing){core.playSound("操作失败");return core.drawTip("请先暂停录像")}if(core.isMoving()||core.status.replay.animate||core.status.event.id){core.playSound("操作失败");return core.drawTip("请等待当前事件的处理结束")}this._replay_hideProgress();core.lockControl();core.status.event.id="viewMaps";core.ui._drawViewMaps()};control.prototype._replay_toolbox=function(){if(!core.isPlaying()||!core.isReplaying()){return}if(!core.status.replay.pausing){core.playSound("操作失败");return core.drawTip("请先暂停录像")}if(core.isMoving()||core.status.replay.animate||core.status.event.id){core.playSound("操作失败");return core.drawTip("请等待当前事件的处理结束")}this._replay_hideProgress();core.lockControl();core.status.event.id="toolbox";core.ui._drawToolbox()};control.prototype._replay_equipbox=function(){if(!core.isPlaying()||!core.isReplaying()){return}if(!core.status.replay.pausing){core.playSound("操作失败");return core.drawTip("请先暂停录像")}if(core.isMoving()||core.status.replay.animate||core.status.event.id){core.playSound("操作失败");return core.drawTip("请等待当前事件的处理结束")}this._replay_hideProgress();core.lockControl();core.status.event.id="equipbox";core.ui._drawEquipbox()};control.prototype.isReplaying=function(){return(core.status.replay||{}).replaying};control.prototype.replay=function(b){if(!core.isPlaying()||!core.isReplaying()||core.status.replay.animate||core.status.event.id||core.status.replay.failed){return}if(core.status.replay.pausing&&!b){return}this._replay_drawProgress();if(core.status.replay.toReplay.length==0){return this._replay_finished()}this._replay_save();var a=core.status.replay.toReplay.shift();if(this._doReplayAction(a)){return}this._replay_error(a)};control.prototype.registerReplayAction=function(b,a){this.unregisterReplayAction(b);this.replayActions.push({name:b,func:a})};control.prototype.unregisterReplayAction=function(a){this.replayActions=this.replayActions.filter(function(c){return c.name!=a})};control.prototype._doReplayAction=function(a){for(var c in this.replayActions){try{if(core.doFunc(this.replayActions[c].func,this,a)){return true}}catch(b){main.log(b);main.log("ERROR in replayActions["+this.replayActions[c].name+"]:已自动注销该项。");core.unregisterReplayAction(this.replayActions[c].name)}}return false};control.prototype._replay_finished=function(){core.status.replay.replaying=false;core.status.replay.failed=false;core.status.event.selection=0;var a="录像播放完毕,你想退出播放吗?";if(core.status.route.length!=core.status.replay.totalList.length||core.subarray(core.status.route,core.status.replay.totalList)==null){a="录像播放完毕,但记录不一致。\n请检查录像播放时的二次记录问题。\n你想退出播放吗?"}core.ui.drawConfirmBox(a,function(){core.ui.closePanel();core.stopReplay(true)},function(){core.status.replay.replaying=true;core.ui.closePanel();core.pauseReplay()})};control.prototype._replay_save=function(){core.status.replay.steps++;if(core.status.replay.steps%40==1){if(core.status.replay.save.length==30){core.status.replay.save.shift()}core.status.replay.save.push({data:core.saveData(),replay:{totalList:core.cloneArray(core.status.replay.totalList),toReplay:core.cloneArray(core.status.replay.toReplay),steps:core.status.replay.steps}})}};control.prototype._replay_error=function(a,b){core.ui.closePanel();core.status.replay.replaying=false;core.status.replay.failed=true;var c=core.status.replay.toReplay.length;var e=core.status.replay.totalList.slice(-c-11,-c-1);var d=core.status.replay.toReplay.slice(0,10);main.log("录像文件出错,当前操作:"+a);main.log("之前的10个操作是:\n"+e.toString());main.log("接下来10个操作是:\n"+d.toString());core.ui.drawConfirmBox("录像文件出错,你想回到上个节点吗?",function(){core.status.replay.failed=false;core.ui.closePanel();if(core.status.replay.save.length>0){core.status.replay.replaying=true;core.status.replay.pausing=true;core.rewindReplay()}else{core.playSound("操作失败");core.stopReplay(true);core.drawTip("无法回到上一个节点");if(b){b()}}},function(){core.status.replay.failed=false;core.ui.closePanel();core.stopReplay(true);if(b){b()}})};control.prototype._replay_hideProgress=function(){if(core.dymCanvas.replay){core.dymCanvas.replay.canvas.style.display="none"}};control.prototype._replay_drawProgress=function(){if(!core.dymCanvas.replay){return}if(core.dymCanvas.replay.canvas.style.display=="none"){core.dymCanvas.replay.canvas.style.display="block"}var c=core.status.replay.totalList.length,b=c-core.status.replay.toReplay.length;var a="播放进度:"+b+" / "+c+"("+(b/c*100).toFixed(2)+"%)";var d=26+core.calWidth("replay",a,"16px Arial");core.clearMap("replay");core.fillRect("replay",0,0,d,40,"#000000");core.fillText("replay",a,16,27,"#FFFFFF")};control.prototype.__replay_getTimeout=function(){if(core.status.replay.speed==24){return 0}return 750/Math.max(1,core.status.replay.speed)};control.prototype._replayAction_move=function(a){if(["up","down","left","right"].indexOf(a)<0){return false}core.moveHero(a,core.replay);return true};control.prototype._replayAction_item=function(a){if(a.indexOf("item:")!=0){return false}var d=a.substring(5);if(!core.canUseItem(d)){return false}if(core.material.items[d].hideInReplay||core.status.replay.speed==24){core.useItem(d,false,core.replay);return true}var f=core.getToolboxItems("tools"),b=core.getToolboxItems("constants");var c,e=core.__SIZE__-1;if((c=f.indexOf(d))>=0){core.status.event.data={toolsPage:Math.floor(c/e)+1,constantsPage:1};c=c%e}else{if((c=b.indexOf(d))>=0){core.status.event.data={toolsPage:1,constantsPage:Math.floor(c/e)+1};c=c%e+e}}if(c<0){return false}core.ui._drawToolbox(c);setTimeout(function(){core.ui.closePanel();core.useItem(d,false,core.replay)},core.control.__replay_getTimeout());return true};control.prototype._replayAction_equip=function(a){if(a.indexOf("equip:")!=0){return false}var c=a.substring(6);var e=core.getToolboxItems("equips");var d=e.indexOf(c),f=core.__SIZE__-1;if(d<0){core.removeFlag("__doNotCheckAutoEvents__");return false}var b=function(){var g=core.status.replay.toReplay[0]||"";if(!g.startsWith("equip:")&&!g.startsWith("unEquip:")){core.removeFlag("__doNotCheckAutoEvents__");core.checkAutoEvents()}core.replay()};core.setFlag("__doNotCheckAutoEvents__",true);core.status.route.push(a);if(core.material.items[c].hideInReplay||core.status.replay.speed==24){core.loadEquip(c,b);return true}core.status.event.data={page:Math.floor(d/f)+1,selectId:null};d=d%f+f;core.ui._drawEquipbox(d);setTimeout(function(){core.ui.closePanel();core.loadEquip(c,b)},core.control.__replay_getTimeout());return true};control.prototype._replayAction_unEquip=function(a){if(a.indexOf("unEquip:")!=0){return false}var c=parseInt(a.substring(8));if(!core.isset(c)){core.removeFlag("__doNotCheckAutoEvents__");return false}var b=function(){var d=core.status.replay.toReplay[0]||"";if(!d.startsWith("equip:")&&!d.startsWith("unEquip:")){core.removeFlag("__doNotCheckAutoEvents__");core.checkAutoEvents()}core.replay()};core.setFlag("__doNotCheckAutoEvents__",true);core.ui._drawEquipbox(c);core.status.route.push(a);if(core.status.replay.speed==24){core.unloadEquip(c,b);return true}setTimeout(function(){core.ui.closePanel();core.unloadEquip(c,b)},core.control.__replay_getTimeout());return true};control.prototype._replayAction_saveEquip=function(a){if(a.indexOf("saveEquip:")!=0){return false}core.quickSaveEquip(parseInt(a.substring(10)));core.replay();return true};control.prototype._replayAction_loadEquip=function(a){if(a.indexOf("loadEquip:")!=0){return false}core.quickLoadEquip(parseInt(a.substring(10)));core.replay();return true};control.prototype._replayAction_fly=function(a){if(a.indexOf("fly:")!=0){return false}var b=a.substring(4);var c=core.floorIds.indexOf(b);if(!core.canUseItem("fly")){return false}core.ui.drawFly(c);if(core.status.replay.speed==24){if(!core.flyTo(b,core.replay)){core.control._replay_error(a)}return true}setTimeout(function(){if(!core.flyTo(b,core.replay)){core.control._replay_error(a)}},core.control.__replay_getTimeout());return true};control.prototype._replayAction_shop=function(a){if(a.indexOf("shop:")!=0){return false}var b=a.substring(5);if(core.canUseQuickShop(b)!=null||!core.canOpenShop(b)){this._replay_error(b);return true}core.openShop(b,false);core.replay();return true};control.prototype._replayAction_turn=function(a){if(a!="turn"&&a.indexOf("turn:")!=0){return false}if(a=="turn"){core.turnHero()}else{core.turnHero(a.substring(5))}core.replay();return true};control.prototype._replayAction_getNext=function(a){if(a!="getNext"){return false}core.getNextItem();core.replay();return true};control.prototype._replayAction_moveDirectly=function(a){if(a.indexOf("move:")!=0){return false}if(!core.hasFlag("poison")&&core.status.thisMap.width<2*core.bigmap.extend+core.__SIZE__&&core.status.thisMap.height<2*core.bigmap.extend+core.__SIZE__){while(core.status.replay.toReplay.length>0&&core.status.replay.toReplay[0].indexOf("move:")==0){core.status.route.push(a);a=core.status.replay.toReplay.shift()}}var e=a.substring(5).split(":");var g=parseInt(e[0]),h=parseInt(e[1]);var c=core.getHeroLoc("x"),d=core.getHeroLoc("y");var b=core.canMoveDirectly(g,h);if(!core.moveDirectly(g,h,b)){return false}if(core.status.replay.speed==24){core.replay();return true}core.ui.drawArrow("ui",32*c+16-core.bigmap.offsetX,32*d+16-core.bigmap.offsetY,32*g+16-core.bigmap.offsetX,32*h+16-core.bigmap.offsetY,"#FF0000",3);var f=this.__replay_getTimeout();if(b<10){f=f*b/10}setTimeout(function(){core.clearMap("ui");core.replay()},f);return true};control.prototype._replayAction_key=function(a){if(a.indexOf("key:")!=0){return false}core.actions.keyUp(parseInt(a.substring(4)),false,true);core.replay();return true};control.prototype._replayAction_click=function(a){if(a.indexOf("click:")!=0){return false}var b=a.split(":");if(b.length!=4){return false}core.actions.doRegisteredAction("onStatusBarClick",parseInt(b[2]),parseInt(b[3]),parseInt(b[1]));core.replay();return true};control.prototype._replayAction_ignoreInput=function(a){if(a.indexOf("input:")==0||a.indexOf("input2:")==0||a.indexOf("choices:")==0||a.indexOf("random:")==0){console.warn("警告!录像播放中出现了未知的 "+a+"!");core.replay();return true}return false};control.prototype._replayAction_no=function(a){if(a!="no"){return false}core.status.route.push(a);core.replay();return true};control.prototype.autosave=function(a){if(core.hasFlag("__forbidSave__")){return}var b=null;if(a){b=core.status.route.pop();core.status.route.push("turn:"+core.getHeroLoc("direction"))}if(core.status.event.id=="action"){core.setFlag("__events__",core.clone(core.status.event.data))}if(core.saves.autosave.data==null){core.saves.autosave.data=[]}core.saves.autosave.data.splice(core.saves.autosave.now,0,core.saveData());core.saves.autosave.now+=1;if(core.saves.autosave.data.length>core.saves.autosave.max){if(core.saves.autosave.now<core.saves.autosave.max/2){core.saves.autosave.data.pop()}else{core.saves.autosave.data.shift();core.saves.autosave.now=core.saves.autosave.now-1}}core.saves.autosave.updated=true;core.saves.ids[0]=true;core.removeFlag("__events__");if(a){core.status.route.pop();if(b){core.status.route.push(b)}}};control.prototype.checkAutosave=function(){if(!core.animateFrame||!core.saves||!core.saves.autosave){return}core.setLocalStorage("totalTime",core.animateFrame.totalTime);var a=core.saves.autosave;if(a.data==null||!a.updated||!a.storage){return}a.updated=false;if(a.data.length>=1){core.setLocalForage("autoSave",a.data[a.now-1])}};control.prototype.doSL=function(a,b){switch(b){case"save":this._doSL_save(a);break;case"load":this._doSL_load(a,this._doSL_load_afterGet);break;case"reload":this._doSL_reload(a,this._doSL_load_afterGet);break;case"replayLoad":this._doSL_load(a,this._doSL_replayLoad_afterGet);break;case"replayRemain":this._doSL_load(a,this._doSL_replayRemain_afterGet);break;case"replaySince":this._doSL_load(a,this._doSL_replaySince_afterGet);break}};control.prototype._doSL_save=function(b){if(b=="autoSave"){core.playSound("操作失败");return core.drawTip("不能覆盖自动存档!")}if(core.status.event.interval!=null){core.setFlag("__events__",core.status.event.interval)}var a=core.saveData();if(core.isReplaying()&&core.status.replay.toReplay.length>0){a.__toReplay__=core.encodeRoute(core.status.replay.toReplay)}core.setLocalForage("save"+b,a,function(){core.saves.saveIndex=b;core.setLocalStorage("saveIndex",core.saves.saveIndex);if(!core.events.recoverEvents(core.status.event.interval)){core.ui.closePanel()}core.playSound("存档");core.drawTip("存档成功!")},function(c){main.log(c);alert("存档失败,错误信息:\n"+c)});core.removeFlag("__events__");return};control.prototype._doSL_load=function(c,a){if(c=="autoSave"&&core.saves.autosave.data!=null){core.saves.autosave.now-=1;var b=core.saves.autosave.data.splice(core.saves.autosave.now,1)[0];if(core.isPlaying()&&!core.status.gameOver){core.control.autosave(0);core.saves.autosave.now-=1}if(core.saves.autosave.now==0){core.saves.autosave.data.unshift(core.clone(b));core.saves.autosave.now+=1}a(c,b)}else{core.getLocalForage(c=="autoSave"?c:"save"+c,null,function(d){if(c=="autoSave"&&d!=null){core.saves.autosave.data=d;if(!(core.saves.autosave.data instanceof Array)){core.saves.autosave.data=[core.saves.autosave.data]}core.saves.autosave.now=core.saves.autosave.data.length;return core.control._doSL_load(c,a)}a(c,d)},function(d){main.log(d);alert("无效的存档")})}return};control.prototype._doSL_reload=function(c,a){if(core.saves.autosave.data!=null&&core.saves.autosave.now<core.saves.autosave.data.length){var b=core.saves.autosave.data.splice(core.saves.autosave.now,1)[0];core.control.autosave(false);a(c,b)}return};control.prototype._doSL_load_afterGet=function(c,b){if(!b){return alert("无效的存档")}var a=function(){core.startGame(b.hard,b.hero.flags.__seed__,core.decodeRoute(b.route))};if(b.version!=core.firstData.version){core.myconfirm("存档版本不匹配!\n你想回放此存档的录像吗?\n可以随时停止录像播放以继续游戏。",a);return}if(b.hero.flags.__events__&&b.guid!=core.getGuid()){core.myconfirm("此存档可能存在风险,你想要播放录像么?",a);return}core.ui.closePanel();core.loadData(b,function(){core.removeFlag("__fromLoad__");core.drawTip("读档成功");if(c!="autoSave"){core.saves.saveIndex=c;core.setLocalStorage("saveIndex",core.saves.saveIndex)}})};control.prototype._doSL_replayLoad_afterGet=function(b,a){if(!a){core.playSound("操作失败");return core.drawTip("无效的存档")}if(a.version!=core.firstData.version){core.playSound("操作失败");return core.drawTip("存档版本不匹配")}if(a.hero.flags.__events__&&a.guid!=core.getGuid()){core.playSound("操作失败");return core.drawTip("此存档可能存在风险,无法读档")}var c=core.subarray(core.status.route,core.decodeRoute(a.route));if(c==null){core.playSound("操作失败");return core.drawTip("无法从此存档回放录像")}core.loadData(a,function(){core.removeFlag("__fromLoad__");core.startReplay(c);core.drawTip("回退到存档节点")})};control.prototype._doSL_replayRemain_afterGet=function(b,a){if(!a){core.playSound("操作失败");return core.drawTip("无效的存档")}var d=core.decodeRoute(a.route);if(core.status.tempRoute){var c=core.subarray(d,core.status.tempRoute);if(c==null){return alert("无法接续播放录像!\n该存档必须是前一个选择的存档的后续内容。")}delete core.status.tempRoute;core.ui.closePanel();core.startReplay(c);core.drawTip("接续播放录像");return}else{if(a.floorId!=core.status.floorId||a.hero.loc.x!=core.getHeroLoc("x")||a.hero.loc.y!=core.getHeroLoc("y")){return alert("楼层或坐标不一致!")}}core.status.tempRoute=d;core.ui.closePanel();core.drawText("\t[步骤2]请选择第二个存档。\n\r[yellow]该存档必须是前一个存档的后续。\r\n将尝试播放到此存档。",function(){core.status.event.id="replayRemain";core.lockControl();var g=core.saves.saveIndex;var f=parseInt((g-1)/5),e=g-5*f;core.ui._drawSLPanel(10*f+e)})};control.prototype._doSL_replaySince_afterGet=function(b,a){if(a.floorId!=core.status.floorId||a.hero.loc.x!=core.getHeroLoc("x")||a.hero.loc.y!=core.getHeroLoc("y")){return alert("楼层或坐标不一致!")}if(!a.__toReplay__){return alert("该存档没有剩余录像!")}core.ui.closePanel();core.startReplay(core.decodeRoute(a.__toReplay__));core.drawTip("播放存档剩余录像");return};control.prototype.syncSave=function(b){core.ui.drawWaiting("正在同步,请稍候...");var a=function(c){core.control._syncSave_http(b,c)};if(b=="all"){core.getAllSaves(a)}else{core.getSave(core.saves.saveIndex,a)}};control.prototype._syncSave_http=function(c,b){if(!b){return core.drawText("没有要同步的存档")}var a=new FormData();a.append("type","save");a.append("name",core.firstData.name);a.append("data",LZString.compressToBase64(JSON.stringify(b)));a.append("shorten","1");core.http("POST","/games/sync.php",a,function(d){var e=JSON.parse(d);if(e.code<0){core.drawText("出错啦!\n无法同步存档到服务器。\n错误原因:"+e.msg)}else{core.drawText((c=="all"?"所有存档":"存档"+core.saves.saveIndex)+"同步成功!\n\n您的存档编号+密码: \r[yellow]"+e.code+e.msg+"\r\n\n请牢记以上信息(如截图等),在从服务器\n同步存档时使用。\n\r[yellow]另外请注意,存档同步只会保存一个月的时间。\r")}},function(d){core.drawText("出错啦!\n无法同步存档到服务器。\n错误原因:"+d)})};control.prototype.syncLoad=function(){core.myprompt("请输入存档编号+密码",null,function(a){if(!a){return core.ui._drawSyncSave()}if(!/^\d{6}\w{4}$/.test(a)&&!/^\d{4}\w{3}$/.test(a)){core.drawText("不合法的存档编号+密码!");return}core.ui.drawWaiting("正在同步,请稍候...");if(a.length==7){core.control._syncLoad_http(a.substring(0,4),a.substring(4))}else{core.control._syncLoad_http(a.substring(0,6),a.substring(6))}})};control.prototype._syncLoad_http=function(b,c){var a=new FormData();a.append("type","load");a.append("name",core.firstData.name);a.append("id",b);a.append("password",c);core.http("POST","/games/sync.php",a,function(d){var h=JSON.parse(d);if(h.code==0){var g=null;try{g=JSON.parse(LZString.decompressFromBase64(h.msg))}catch(f){}if(!g){try{g=JSON.parse(h.msg)}catch(f){}}if(g){core.control._syncLoad_write(g)}else{core.drawText("出错啦!\n存档解析失败!")}}else{core.drawText("出错啦!\n无法从服务器同步存档。\n错误原因:"+h.msg)}},function(d){core.drawText("出错啦!\n无法从服务器同步存档。\n错误原因:"+d)})};control.prototype._syncLoad_write=function(a){if(a instanceof Array){core.status.event.selection=1;core.ui.drawConfirmBox("所有本地存档都将被覆盖,确认?",function(){for(var b=1;b<=5*(main.savePages||30);b++){if(b<=a.length){core.setLocalForage("save"+b,a[b-1])}else{if(core.saves.ids[b]){core.removeLocalForage("save"+b)}}}core.ui.closePanel();core.drawText("同步成功!\n你的本地所有存档均已被覆盖。")},function(){core.status.event.selection=0;core.ui._drawSyncSave()})}else{core.setLocalForage("save"+core.saves.saveIndex,a,function(){core.drawText("同步成功!\n单存档已覆盖至存档"+core.saves.saveIndex)})}};control.prototype.saveData=function(){return this.controldata.saveData()};control.prototype.loadData=function(b,a){return this.controldata.loadData(b,a)};control.prototype.getSave=function(b,a){if(b==0){if(core.saves.autosave.data!=null){a(core.saves.autosave.data)}else{core.getLocalForage("autoSave",null,function(c){if(c!=null){core.saves.autosave.data=c;if(!(core.saves.autosave.data instanceof Array)){core.saves.autosave.data=[core.saves.autosave.data]}core.saves.autosave.now=core.saves.autosave.data.length}a(core.saves.autosave.data)},function(c){main.log(c);a(null)})}return}core.getLocalForage("save"+b,null,function(c){if(a){a(c)}},function(c){main.log(c);if(a){a(null)}})};control.prototype.getSaves=function(e,a){if(!(e instanceof Array)){return this.getSave(e,a)}var b=e.length,c={};for(var d=0;d<e.length;++d){(function(f){core.getSave(e[f],function(g){c[f]=g;if(Object.keys(c).length==b){a(c)}})})(d)}};control.prototype.getAllSaves=function(a){var b=Object.keys(core.saves.ids).filter(function(d){return d!=0}).sort(function(d,e){return d-e}),c=[];this.getSaves(b,function(d){for(var e=0;e<b.length;++e){if(d[e]!=null){c.push(d[e])}}a(c)})};control.prototype.getSaveIndexes=function(a){var b={};core.keysLocalForage(function(c,d){if(c){main.log(c);return a(b)}d.forEach(function(e){core.control._getSaveIndexes_getIndex(b,e)});a(b)})};control.prototype._getSaveIndexes_getIndex=function(b,c){var a=new RegExp("^"+core.firstData.name+"_(save\\d+|autoSave)$").exec(c);if(a){if(a[1]=="autoSave"){b[0]=true}else{b[parseInt(a[1].substring(4))]=true}}};control.prototype.hasSave=function(a){return core.saves.ids[a]||false};control.prototype.removeSave=function(b,a){if(b==0||b=="autoSave"){b="autoSave";core.removeLocalForage(b,function(){core.saves.autosave.data=null;core.saves.autosave.updated=false;if(a){a()}});return}core.removeLocalForage("save"+b,function(){core.saves.favorite=core.saves.favorite.filter(function(c){return core.hasSave(c)});delete core.saves.favoriteName[b];core.control._updateFavoriteSaves();if(a){a()}},function(){core.playSound("操作失败");core.drawTip("无法删除存档!");if(a){a()}})};control.prototype._loadFavoriteSaves=function(){core.saves.favorite=core.getLocalStorage("favorite",[]);core.saves.favorite=core.saves.favorite.filter(function(a){return core.hasSave(a)});core.saves.favoriteName=core.getLocalStorage("favoriteName",{})};control.prototype._updateFavoriteSaves=function(){core.setLocalStorage("favorite",core.saves.favorite);core.setLocalStorage("favoriteName",core.saves.favoriteName)};control.prototype.setStatus=function(a,b){if(!core.status.hero){return}if(a=="x"||a=="y"||a=="direction"){this.setHeroLoc(a,b)}else{core.status.hero[a]=b}};control.prototype.addStatus=function(a,b){this.setStatus(a,this.getStatus(a)+b)};control.prototype.getStatus=function(a){if(!core.status.hero){return null}if(a=="x"||a=="y"||a=="direction"){return this.getHeroLoc(a)}if(main.mode=="editor"&&!core.hasFlag("__statistics__")){return data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.firstData.hero[a]}return core.status.hero[a]};control.prototype.getStatusOrDefault=function(b,a){if(b&&a in b){return Math.floor(b[a])}return Math.floor(this.getStatus(a))};control.prototype.getRealStatus=function(a){return this.getRealStatusOrDefault(null,a)};control.prototype.getRealStatusOrDefault=function(b,a){return Math.floor(this.getStatusOrDefault(b,a)*this.getBuff(a))};control.prototype.getNakedStatus=function(a){var b=this.getStatus(a);if(b==null){return b}core.status.hero.equipment.forEach(function(c){if(!c||!(core.material.items[c]||{}).equip){return}b-=core.material.items[c].equip.value[a]||0});if(core.hasFlag("weak")&&core.values.weakValue>=1&&(a=="atk"||a=="def")){b+=core.values.weakValue}return b};control.prototype.getStatusLabel=function(a){if(this.controldata.getStatusLabel){return this.controldata.getStatusLabel(a)||a}return{name:"名称",lv:"等级",hpmax:"生命上限",hp:"生命",manamax:"魔力上限",mana:"魔力",atk:"攻击",def:"防御",mdef:"护盾",money:"金币",exp:"经验",point:"加点",steps:"步数"}[a]||a};control.prototype.setBuff=function(a,b){b=parseFloat(b.toFixed(3));this.setFlag("__"+a+"_buff__",b)};control.prototype.addBuff=function(b,c){var a=this.getBuff(b)+c;a=parseFloat(a.toFixed(3));this.setFlag("__"+b+"_buff__",a)};control.prototype.getBuff=function(a){return core.getFlag("__"+a+"_buff__",1)};control.prototype.triggerDebuff=function(a,b){return this.controldata.triggerDebuff(a,b)};control.prototype.setHeroLoc=function(a,c,b){if(!core.status.hero){return}core.status.hero.loc[a]=c;if((a=="x"||a=="y")&&!b){this.gatherFollowers()}};control.prototype.getHeroLoc=function(a){if(!core.status.hero){return}if(main.mode=="editor"){if(a==null){return data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.firstData.hero.loc}return data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.firstData.hero.loc[a]}if(a==null){return core.status.hero.loc}return core.status.hero.loc[a]};control.prototype.getLvName=function(a){if(!core.status.hero){return null}if(a==null){a=core.status.hero.lv}return((core.firstData.levelUp||[])[a-1]||{}).title||a};control.prototype.getNextLvUpNeed=function(){if(!core.status.hero){return null}if(core.status.hero.lv>=core.firstData.levelUp.length){return null}var a=core.calValue(core.firstData.levelUp[core.status.hero.lv].need);if(core.flags.statusBarItems.indexOf("levelUpLeftMode")>=0){return Math.max(a-core.getStatus("exp"),0)}else{return a}};control.prototype.setFlag=function(a,b){if(b==null){return this.removeFlag(a)}if(!core.status.hero){return}core.status.hero.flags[a]=b};control.prototype.addFlag=function(a,b){if(!core.status.hero){return}core.setFlag(a,core.getFlag(a,0)+b)};control.prototype.getFlag=function(b,a){if(!core.status.hero){return a}var c=core.status.hero.flags[b];return c!=null?c:a};control.prototype.hasFlag=function(a){return !!core.getFlag(a)};control.prototype.removeFlag=function(a){if(!core.status.hero){return}delete core.status.hero.flags[a]};control.prototype.getSwitch=function(e,f,b,c,a){var d=[b||core.status.floorId||":f",e!=null?e:"x",f!=null?f:"y"].join("@");return this.getFlag(d+"@"+c,a)};control.prototype.setSwitch=function(e,f,a,b,d){var c=[a||core.status.floorId||":f",e!=null?e:"x",f!=null?f:"y"].join("@");return this.setFlag(c+"@"+b,d)};control.prototype.addSwitch=function(e,f,a,b,d){var c=[a||core.status.floorId||":f",e!=null?e:"x",f!=null?f:"y"].join("@");return this.addFlag(c+"@"+b,d)};control.prototype.hasSwitch=function(d,e,a,b){var c=[a||core.status.floorId||":f",d!=null?d:"x",e!=null?e:"y"].join("@");return this.hasFlag(c+"@"+b)};control.prototype.removeSwitch=function(d,e,a,b){var c=[a||core.status.floorId||":f",d!=null?d:"x",e!=null?e:"y"].join("@");return this.removeFlag(c+"@"+b)};control.prototype.lockControl=function(){core.status.lockControl=true};control.prototype.unlockControl=function(){core.status.lockControl=false};control.prototype.debug=function(){core.setFlag("debug",true);core.drawText("\t[调试模式开启]此模式下按住Ctrl键(或Ctrl+Shift键)可以穿墙并忽略一切事件。\n此模式下将无法上传成绩。")};control.prototype._bindRoutePush=function(){core.status.route.push=function(a){if(["up","down","left","right","turn"].indexOf(a)<0&&!a.startsWith("move:")){core.clearRouteFolding()}Array.prototype.push.call(core.status.route,a)}};control.prototype.clearRouteFolding=function(){core.status.routeFolding={}};control.prototype.checkRouteFolding=function(){if(!core.flags.enableRouteFolding||!core.isPlaying()||core.isReplaying()||core.status.event.id){return this.clearRouteFolding()}var a=core.clone(core.status.hero,function(d,e){return d!="steps"&&typeof e=="number"});var b=[core.getHeroLoc("x"),core.getHeroLoc("y"),core.getHeroLoc("direction").charAt(0)].join(",");core.status.routeFolding=core.status.routeFolding||{};if(core.status.routeFolding[b]){var c=core.status.routeFolding[b];if(core.same(c.hero,a)&&c.length<core.status.route.length){Object.keys(core.status.routeFolding).forEach(function(d){if(core.status.routeFolding[d].length>=c.length){delete core.status.routeFolding[d]}});core.status.route=core.status.route.slice(0,c.length);this._bindRoutePush()}}core.status.routeFolding[b]={hero:a,length:core.status.route.length}};control.prototype.getMappedName=function(a){return core.getFlag("__nameMap__",{})[a]||(main.nameMap||{})[a]||a};control.prototype.setWeather=function(c,b){if(c==null||!this.weathers[c]){core.deleteCanvas("weather");core.animateFrame.weather.type=null;core.animateFrame.weather.nodes=[];return}if(b==null){b=core.animateFrame.weather.level}b=core.clamp(parseInt(b)||5,1,10);if(c==core.animateFrame.weather.type&&b==core.animateFrame.weather.level){return}core.createCanvas("weather",0,0,core.__PIXELS__,core.__PIXELS__,80);core.setOpacity("weather",1);core.animateFrame.weather.type=c;core.animateFrame.weather.level=b;core.animateFrame.weather.nodes=[];try{core.doFunc(this.weathers[c].initFunc,this,b)}catch(a){main.log(a);main.log("ERROR in weather["+c+"]:已自动注销该项。");core.unregisterWeather(c)}};control.prototype.registerWeather=function(c,b,a){this.unregisterWeather(c);this.weathers[c]={initFunc:b,frameFunc:a}};control.prototype.unregisterWeather=function(a){delete this.weathers[a];if(core.animateFrame.weather.type==a){this.setWeather(null)}};control.prototype._weather_rain=function(c){var d=c*parseInt(20*core.bigmap.width*core.bigmap.height/(core.__SIZE__*core.__SIZE__));for(var b=0;b<d;b++){core.animateFrame.weather.nodes.push({x:Math.random()*core.bigmap.width*32,y:Math.random()*core.bigmap.height*32,l:Math.random()*2.5,xs:-4+Math.random()*4+2,ys:Math.random()*10+10})}};control.prototype._weather_snow=function(c){var d=c*parseInt(20*core.bigmap.width*core.bigmap.height/(core.__SIZE__*core.__SIZE__));for(var b=0;b<d;b++){core.animateFrame.weather.nodes.push({x:Math.random()*core.bigmap.width*32,y:Math.random()*core.bigmap.height*32,r:Math.random()*5+1,d:Math.random()*Math.min(c,200),})}};control.prototype._weather_fog=function(a){if(!core.animateFrame.weather.fog){return}core.animateFrame.weather.nodes=[{image:core.animateFrame.weather.fog,level:40*a,x:0,y:-core.__PIXELS__/2,dx:-Math.random()*1.5,dy:Math.random(),delta:0.001,}]};control.prototype._weather_cloud=function(a){if(!core.animateFrame.weather.cloud){return}core.animateFrame.weather.nodes=[{image:core.animateFrame.weather.cloud,level:40*a,x:0,y:-core.__PIXELS__/2,dx:-Math.random()*1.5,dy:Math.random(),delta:0.001,}]};control.prototype._weather_sun=function(a){if(!core.animateFrame.weather.sun){return}core.clearMap("weather");core.drawImage("weather",core.animateFrame.weather.sun,0,0,core.animateFrame.weather.sun.width,core.animateFrame.weather.sun.height,0,0,core.__PIXELS__,core.__PIXELS__);core.setOpacity("weather",a/10);core.animateFrame.weather.nodes=[{opacity:a/10,delta:0.01}]};control.prototype.setCurtain=function(b,d,c,a){if(d==null){d=750}if(d<=0){d=0}if(!core.status.curtainColor){core.status.curtainColor=[0,0,0,0]}if(!b){b=[0,0,0,0]}if(b[3]==null){b[3]=1}b[3]=core.clamp(b[3],0,1);if(d==0){core.clearMap("curtain");core.fillRect("curtain",0,0,core.__PIXELS__,core.__PIXELS__,core.arrayToRGBA(b));core.status.curtainColor=b;if(a){a()}return}this._setCurtain_animate(core.status.curtainColor,b,d,c,a)};control.prototype._setCurtain_animate=function(h,d,l,g,b){l/=Math.max(core.status.replay.speed,1);var i=10,j=0,k=parseInt(l/i);if(k<=0){k=1}var e=h;var f=core.applyEasing(g);var c=function(){core.status.curtainColor=e;if(b){b()}};var a=setInterval(function(){j++;e=[h[0]+(d[0]-h[0])*f(j/k),h[1]+(d[1]-h[1])*f(j/k),h[2]+(d[2]-h[2])*f(j/k),h[3]+(d[3]-h[3])*f(j/k),];core.clearMap("curtain");core.fillRect("curtain",0,0,core.__PIXELS__,core.__PIXELS__,core.arrayToRGBA(e));if(j==k){delete core.animateFrame.asyncId[a];clearInterval(a);c()}},i);core.animateFrame.lastAsyncId=a;core.animateFrame.asyncId[a]=c};control.prototype.screenFlash=function(b,e,f,c,a){f=f||1;e=e/3;var d=core.clone(core.status.curtainColor);core.setCurtain(b,e,c,function(){core.setCurtain(d,e*2,c,function(){if(f>1){core.screenFlash(b,e*3,f-1,c,a)}else{if(a){a()}}})})};control.prototype.playBgm=function(a,c){a=core.getMappedName(a);if(main.mode!="play"||!core.material.bgms[a]){return}if(!core.musicStatus.bgmStatus){try{core.musicStatus.playingBgm=a;core.musicStatus.lastBgm=a;core.material.bgms[a].pause()}catch(b){main.log(b)}return}this.setMusicBtn();try{this._playBgm_play(a,c)}catch(b){console.log("无法播放BGM "+a);main.log(b);core.musicStatus.playingBgm=null}};control.prototype._playBgm_play=function(a,b){if(core.musicStatus.playingBgm==a&&!core.material.bgms[core.musicStatus.playingBgm].paused){return}if(core.musicStatus.playingBgm){core.material.bgms[core.musicStatus.playingBgm].pause()}core.loader.loadBgm(a);core.material.bgms[a].volume=core.musicStatus.userVolume*core.musicStatus.designVolume;core.material.bgms[a].currentTime=b||0;core.material.bgms[a].play();core.musicStatus.playingBgm=a;core.musicStatus.lastBgm=a;core.setBgmSpeed(100)};control.prototype.setBgmSpeed=function(b,c){var a=core.musicStatus.playingBgm;if(main.mode!="play"||!core.material.bgms[a]){return}a=core.material.bgms[a];if(b<30||b>300){return}a.playbackRate=b/100;core.musicStatus.bgmSpeed=b;if(a.preservesPitch!=null){if(a.__preservesPitch==null){a.__preservesPitch=a.preservesPitch}if(c==null){a.preservesPitch=a.__preservesPitch}else{if(c){a.preservesPitch=false}else{a.preservesPitch=true}}core.musicStatus.bgmUsePitch=c}};control.prototype.pauseBgm=function(){if(main.mode!="play"){return}try{if(core.musicStatus.playingBgm){core.musicStatus.pauseTime=core.material.bgms[core.musicStatus.playingBgm].currentTime;core.material.bgms[core.musicStatus.playingBgm].pause();core.musicStatus.playingBgm=null}}catch(a){console.log("无法暂停BGM");main.log(a)}this.setMusicBtn()};control.prototype.resumeBgm=function(b){if(main.mode!="play"){return}try{var c=core.musicStatus.bgmSpeed;var d=core.musicStatus.bgmUsePitch;core.playBgm(core.musicStatus.playingBgm||core.musicStatus.lastBgm||main.startBgm,b?core.musicStatus.pauseTime:0);if(b){core.setBgmSpeed(c,d)}}catch(a){console.log("无法恢复BGM");main.log(a)}this.setMusicBtn()};control.prototype.setMusicBtn=function(){if(core.musicStatus.bgmStatus){core.dom.musicBtn.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAMAAADzN3VRAAABWVBMVEX///9iYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmL///8AAAC5ubn+/v6xsbEtLS0MDAxmZmZoaGhvb2/c3Nzd3d38/Pz9/f0oKCgpKSl0dHR1dXW6urrb29v7+/v09PTv7+/39/cgICACAgImJibh4eGFhYWGhoaHh4eOjo5paWm7u7vDw8PMzMwyMjI7OztAQEDe3t5FRUVMTEzj4+Pl5eXm5ubp6enr6+tcXFzi4uL19fVeXl74+PgjIyNkZGQGBgaSkpKYmJiampqenp4DAwMwMDBnZ2cICAivr68eHh63t7cLCwsSEhLw8PBhYWEUFBQVFRXNzc3Pz8/Z2dna2toaGhqkpKSlpaWpqamrq6tFOUNAAAAAc3RSTlMAAwQFBhUWGxwkJSYyO0dISVBRUmpvj5CSk5SVoaOlpqiysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKyA0IuUgAAAVdJREFUeF5NkVVbw0AQRTcQrLR4IIEGcidJoaUuQHF3d3d3+P/CkuxCzss8nG++mbnDBJXhNt2CpbeFK1kQpSEKidlc8S9qdATRa6UIdQMoxEpDA0Ov3wUAPfW+qLWACydNv9zMrzkJwPK6FB3oHyOfXfuNxvoBQ+GmBYinhHB77TmiVBxoYUw1AYcEq332AS8OYKosAuTT0nza9uU2USYPRJgGxEiSOFywJ3mNARozgBJJzkfLvfu8JgGDWcC9FEsjWzR+y80gYDEAA8QZ3N6kmP1Fs3fEASB7pob7Hh+Wz5L0ci17Or05J7bH6B6dZv05XWK3rG+myV05Ert592Qo55sPuoIr7hEZHHtieIPWy0RU9DLwc3Mnck/vi8/E8XNrDWQtEVnL/ySKMrv0jPwPp870fprcyYifmiEmqGpHkI5q9ofSFIUk2qiwIGpEMyxYhhZRRcMPz89RJ2s9W8wAAAAASUVORK5CYII="}else{core.dom.musicBtn.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAMAAADzN3VRAAABYlBMVEX///9iYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmL////8/PwAAABmZmZoaGihoaGioqKxsbG5ubnb29vc3Nzd3d3h4eHi4uL9/f3+/v4tLS1nZ2d0dHSUlJSenp66uroMDAz7+/spKSkoKCgUFBRpaWkVFRVvb291dXU7OzuVlZWYmJhkZGQgICAjIyOkpKQCAgK3t7cGBgbv7++pqamrq6seHh4mJiZhYWGamprp6enr6+saGhpeXl7j4+Pl5eXm5uZKSkrw8PD09PT19fW7u7vDw8PMzMwICAgwMDAyMjILCwtAQECGhoaHh4eBgYGFhYUSEhJXV1dZWVlcXFyOjo6SkpLNzc339/fPz8/Z2dna2tqTk5OlpaWxOPeTAAAAdnRSTlMAAwQFBhUWGxwkJSYyO0dISVBRUmpvj5CSk5SVoaOlpqiysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKyNuo+uwAAAWJJREFUeF5NkmV34zAQReUm7WbTuJBNunY3bvXGDjNTkZkZlpn5/9eR5FPfbzr3jGb0RkwRiMQMDm7EIgHmRxtLwMOaHHoQjwz4MUKeCM8AWMrmd7u7f/aXAMyOShHiQD1n04DtN5e5FMBFlSauIsm585dKi4CpuSYKJIv1tBDVmvOSqJgEoowFLSBHaQh10XHWiCgHWEGmAw2blPrvOK/KRJUGoLM4kCVSKrWz7HwgoiwQZyaQJ0+9PvxV23BNATAZB25IqX9b3+jTW9fcApwB6NLgUD5NY3mPXnwmFwBezff1ztzRFzTp94FXMy36HDuCa2RafdnnmZqtL818Gl9/qNnEeyrUk2aTPiKj3qMyWBVi/YSuWq5qiwxkbtX3vYWzdz/l8M0k8ERlvViiB1Ygslb7SbVtJezncj+Cx5bYaeGuonZqhZlieAp+no74/s5EAh6JcY35Cepxk4ObcT3IJPe/1lKsDpFCFQAAAABJRU5ErkJggg=="}core.dom.enlargeBtn.src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjUiIGhlaWdodD0iMjUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiA8Zz4gPHBhdGggc3Ryb2tlPSJudWxsIiBmaWxsPSIjODg4ODg4IiBkPSJtMTQuMDc0NTcsMC4wMDAwMDRhMTAuOTY2ODM5LDEwLjkxODQ1MiAwIDAgMCAtMTAuOTUzNTM4LDEwLjkwNTIxYTEwLjg0ODkzMiwxMC44MDEwNjUgMCAwIDAgMi4yMTE1NzEsNi41MDA0NGwtNC44ODI3MjIsNC44NjExNzlhMS41NjQ2MzUsMS41NTc3MzEgMCAxIDAgMi4yMTI3MTksMi4yMDI5NTZsNC44ODI3MjIsLTQuODYxMTc5YTEwLjg0ODkzMiwxMC44MDEwNjUgMCAwIDAgNi41MjkyNDgsMi4yMDE4MTRhMTAuOTUzNTM4LDEwLjkwNTIxIDAgMCAwIDAsLTIxLjgxMDQyem0wLDE4LjY5NDY0NWE3LjgyMzk1Niw3Ljc4OTQzNiAwIDEgMSA3LjgyMzk1NiwtNy43ODk0MzZhNy44MzIxNzEsNy43OTc2MTQgMCAwIDEgLTcuODIzOTU2LDcuNzg5NDM2eiIvPgogIDxwYXRoIHN0cm9rZT0ibnVsbCIgZmlsbD0iIzg4ODg4OCIgZD0ibTE4LjQ5NDY0NSw4LjgyMjk2NmwtMi4xNjY0NzMsMGwwLC0yLjA1NTI0M2EyLjE2NjQ3MywyLjA1NTI0MyAwIDAgMCAtNC4zMzI5NDYsMGwwLDIuMDU1MjQzbC0yLjE2NjQ3MywwYTIuMTY2NDczLDIuMDU1MjQzIDAgMCAwIDAsNC4xMTA0ODZsMi4xNjY0NzMsMGwwLDIuMDU1MjQzYTIuMTY2NDczLDIuMDU1MjQzIDAgMCAwIDQuMzMyOTQ2LDBsMCwtMi4wNTUyNDNsMi4xNjY0NzMsMGEyLjE2NjQ3MywyLjA1NTI0MyAwIDAgMCAwLC00LjExMDQ4NnoiLz4KIDwvZz4KPC9zdmc+"};control.prototype.triggerBgm=function(){if(main.mode!="play"){return}core.musicStatus.bgmStatus=!core.musicStatus.bgmStatus;if(core.musicStatus.bgmStatus){this.resumeBgm()}else{this.pauseBgm()}core.setLocalStorage("bgmStatus",core.musicStatus.bgmStatus)};control.prototype.playSound=function(f,d,a){f=core.getMappedName(f);if(main.mode!="play"||!core.musicStatus.soundStatus||!core.material.sounds[f]){return}try{if(core.musicStatus.audioContext!=null){var g=core.musicStatus.audioContext.createBufferSource();g.__name=f;g.buffer=core.material.sounds[f];g.connect(core.musicStatus.gainNode);var c=setTimeout(null);if(d&&d>=30&&d<=300){g.playbackRate.setValueAtTime(d/100,0)}g.onended=function(){delete core.musicStatus.playingSounds[c];if(a){a()}};core.musicStatus.playingSounds[c]=g;if(g.start){g.start(0)}else{if(g.noteOn){g.noteOn(0)}}return c}else{core.material.sounds[f].volume=core.musicStatus.userVolume;core.material.sounds[f].play();if(a){a()}}}catch(b){console.log("无法播放SE "+f);main.log(b)}};control.prototype.stopSound=function(b){if(b==null){Object.keys(core.musicStatus.playingSounds).forEach(function(d){core.control.stopSound(d)});return}var c=core.musicStatus.playingSounds[b];if(!c){return}try{if(c.stop){c.stop()}else{if(c.noteOff){c.noteOff()}}}catch(a){main.log(a)}delete core.musicStatus.playingSounds[b]};control.prototype.getPlayingSounds=function(a){a=core.getMappedName(a);return Object.keys(core.musicStatus.playingSounds).filter(function(b){return a==null||core.musicStatus.playingSounds[b].__name==a})};control.prototype.checkBgm=function(){core.playBgm(core.musicStatus.playingBgm||main.startBgm)};control.prototype.setDisplayScale=function(a){var b=core.domStyle.availableScale.indexOf(core.domStyle.scale);if(b<0){return}b=(b+a+core.domStyle.availableScale.length)%core.domStyle.availableScale.length;core.domStyle.scale=core.domStyle.availableScale[b];core.setLocalStorage("scale",core.domStyle.scale);core.resize()};control.prototype.clearStatusBar=function(){Object.keys(core.statusBar).forEach(function(a){if(core.statusBar[a].innerHTML!=null){core.statusBar[a].innerHTML="&nbsp;";core.statusBar[a].removeAttribute("_style");core.statusBar[a].removeAttribute("_value")}});core.statusBar.image.book.style.opacity=0.3;if(!core.flags.equipboxButton){core.statusBar.image.fly.style.opacity=0.3}};control.prototype.updateStatusBar=function(a){if(!core.isPlaying()||core.hasFlag("__statistics__")){return}this.controldata.updateStatusBar();if(!a){core.checkAutoEvents()}this._updateStatusBar_setToolboxIcon();core.clearRouteFolding()};control.prototype._updateStatusBar_setToolboxIcon=function(){if(core.isReplaying()){core.statusBar.image.book.src=core.status.replay.pausing?core.statusBar.icons.play.src:core.statusBar.icons.pause.src;core.statusBar.image.book.style.opacity=1;core.statusBar.image.fly.src=core.statusBar.icons.stop.src;core.statusBar.image.fly.style.opacity=1;core.statusBar.image.toolbox.src=core.statusBar.icons.rewind.src;core.statusBar.image.keyboard.src=core.statusBar.icons.book.src;core.statusBar.image.shop.src=core.statusBar.icons.floor.src;core.statusBar.image.save.src=core.statusBar.icons.speedDown.src;core.statusBar.image.save.style.opacity=1;core.statusBar.image.load.src=core.statusBar.icons.speedUp.src;core.statusBar.image.settings.src=core.statusBar.icons.save.src}else{core.statusBar.image.book.src=core.statusBar.icons.book.src;core.statusBar.image.book.style.opacity=core.hasItem("book")?1:0.3;if(!core.flags.equipboxButton){core.statusBar.image.fly.src=core.statusBar.icons.fly.src;core.statusBar.image.fly.style.opacity=core.hasItem("fly")?1:0.3}else{core.statusBar.image.fly.src=core.statusBar.icons.equipbox.src;core.statusBar.image.fly.style.opacity=1}core.statusBar.image.toolbox.src=core.statusBar.icons.toolbox.src;core.statusBar.image.keyboard.src=core.statusBar.icons.keyboard.src;core.statusBar.image.shop.src=core.statusBar.icons.shop.src;core.statusBar.image.save.src=core.statusBar.icons.save.src;core.statusBar.image.save.style.opacity=core.hasFlag("__forbidSave__")?0.3:1;core.statusBar.image.load.src=core.statusBar.icons.load.src;core.statusBar.image.settings.src=core.statusBar.icons.settings.src}};control.prototype.showStatusBar=function(){if(main.mode=="editor"){return}if(core.domStyle.showStatusBar){return}var b=core.dom.status;core.domStyle.showStatusBar=true;core.removeFlag("hideStatusBar");for(var a=0;a<b.length;++a){b[a].style.opacity=1}this.setToolbarButton(false);core.dom.tools.hard.style.display="block";core.dom.toolBar.style.display="block"};control.prototype.hideStatusBar=function(b){if(main.mode=="editor"){return}if(!core.domStyle.showStatusBar){this.showStatusBar()}if(core.isReplaying()){b=true}var c=core.dom.status,d=core.dom.tools;core.domStyle.showStatusBar=false;core.setFlag("hideStatusBar",true);core.setFlag("showToolbox",b||null);for(var a=0;a<c.length;++a){c[a].style.opacity=0}if((!core.domStyle.isVertical&&!core.flags.extendToolbar)||!b){for(var a=0;a<d.length;++a){d[a].style.display="none"}}if(!core.domStyle.isVertical&&!core.flags.extendToolbar){core.dom.toolBar.style.display="none"}};control.prototype.updateHeroIcon=function(f){f=f||"hero.png";if(core.statusBar.icons.name==f){return}core.statusBar.icons.name=f;var d=core.material.images.hero;var i=core.material.icons.hero.width||32;var c=core.material.icons.hero.height||48;var g=Math.min(i/c,1),j=32*g,e=16-j/2;var a=document.createElement("canvas");var b=a.getContext("2d");a.width=32;a.height=32;core.drawImage(b,d,0,0,i,c,e,0,j,32);core.statusBar.image.name.src=a.toDataURL("image/png")};control.prototype.setToolbarButton=function(b){if(!core.domStyle.showStatusBar){if(!core.domStyle.isVertical&&!core.flags.extendToolbar){for(var a=0;a<core.dom.tools.length;++a){core.dom.tools[a].style.display="none"}return}if(!core.hasFlag("showToolbox")){return}else{core.dom.tools.hard.style.display="block"}}if(b==null){b=core.domStyle.toolbarBtn}if((!core.domStyle.isVertical&&!core.flags.extendToolbar)||core.isReplaying()){b=false}core.domStyle.toolbarBtn=b;if(b){["book","fly","toolbox","keyboard","shop","save","load","settings"].forEach(function(c){core.statusBar.image[c].style.display="none"});["btn1","btn2","btn3","btn4","btn5","btn6","btn7","btn8"].forEach(function(c){core.statusBar.image[c].style.display="block"});main.statusBar.image.btn8.style.filter=core.getLocalStorage("altKey")?"sepia(1) contrast(1.5)":""}else{["btn1","btn2","btn3","btn4","btn5","btn6","btn7","btn8"].forEach(function(c){core.statusBar.image[c].style.display="none"});["book","fly","toolbox","save","load","settings"].forEach(function(c){core.statusBar.image[c].style.display="block"});core.statusBar.image.keyboard.style.display=core.statusBar.image.shop.style.display=core.domStyle.isVertical||core.flags.extendToolbar?"block":"none"}};control.prototype._shouldDisplayStatus=function(c){if(c==null){var g=[],f=core.dom.status;for(var b=0;b<f.length;++b){var a=core.dom.status[b],d=a.id;if(d.indexOf("Col")!=d.length-3){continue}var c=d.substring(0,d.length-3);if(!this._shouldDisplayStatus(c)){continue}g.push(c)}return g}var e={};core.flags.statusBarItems.forEach(function(h){e[h]=true});switch(c){case"floor":return e.enableFloor;case"name":return e.enableName;case"lv":return e.enableLv;case"hp":return e.enableHP;case"hpmax":return e.enableHPMax;case"mana":return e.enableMana;case"atk":return e.enableAtk;case"def":return e.enableDef;case"mdef":return e.enableMDef;case"money":return e.enableMoney;case"exp":return e.enableExp&&!e.levelUpLeftMode;case"up":return e.enableLevelUp;case"skill":return e.enableSkill;case"key":return e.enableKeys;case"pzf":return e.enablePZF;case"debuff":return e.enableDebuff;default:return true}};control.prototype.registerResize=function(b,a){this.unregisterResize(b);this.resizes.push({name:b,func:a})};control.prototype.unregisterResize=function(a){this.resizes=this.resizes.filter(function(c){return c.name!=a})};control.prototype._doResize=function(c){for(var b in this.resizes){try{if(core.doFunc(this.resizes[b].func,this,c)){return true}}catch(a){main.log(a);main.log("ERROR in resizes["+this.resizes[b].name+"]:已自动注销该项。");this.unregisterResize(this.resizes[b].name)}}return false};control.prototype.resize=function(){if(main.mode=="editor"){return}var e=main.dom.body.clientWidth,d=main.dom.body.clientHeight;var c=core.__PIXELS__,a=Math.round(core.__PIXELS__*0.31);var b=3;var h=core.flags.extendToolbar;var j=(d-2*b-(h?b:0))/(c+(h?38:0));if(e-3*b>=c+a||(e>d&&j<1)){core.domStyle.isVertical=false;core.domStyle.availableScale=[];[1,1.25,1.5,1.75,2].forEach(function(o){if(e-3*b>=o*(c+a)&&j>=o){core.domStyle.availableScale.push(o)}});if(core.domStyle.availableScale.indexOf(core.domStyle.scale)<0){core.domStyle.scale=Math.min(1,j)}}else{core.domStyle.isVertical=true;core.domStyle.scale=Math.min(1,(e-2*b)/c);core.domStyle.availableScale=[];h=false}var n=this._shouldDisplayStatus(),g=n.length;var l=core.flags.statusCanvas,m=core.values.statusCanvasRowsOnMobile||3;var f=l?m:Math.ceil(g/3);if(f>5){if(l){alert("自绘状态栏的在竖屏下的行数应不超过5!")}else{alert("当前状态栏数目("+g+")大于15,请调整到不超过15以避免手机端出现显示问题。")}}var i=core.status.globalAttribute||core.initStatus.globalAttribute;var k={clientWidth:e,clientHeight:d,CANVAS_WIDTH:c,BORDER:b,BAR_WIDTH:a,TOOLBAR_HEIGHT:38,outerSize:c*core.domStyle.scale+2*b,globalAttribute:i,border:"3px "+core.arrayToRGBA(i.borderColor)+" solid",statusDisplayArr:n,count:g,col:f,statusBarHeightInVertical:core.domStyle.isVertical?(32*f+6)*core.domStyle.scale+2*b:0,toolbarHeightInVertical:core.domStyle.isVertical?38*core.domStyle.scale+2*b:0,extendToolbar:h,is15x15:core.__SIZE__==15};this._doResize(k);this.setToolbarButton();core.updateStatusBar()};control.prototype._resize_gameGroup=function(c){var d=core.domStyle.isVertical?(main.styles.startVerticalBackground||main.styles.startBackground):main.styles.startBackground;if(main.dom.startBackground.getAttribute("__src__")!=d){main.dom.startBackground.setAttribute("__src__",d);main.dom.startBackground.src=d}var b=core.dom.gameGroup;var f,e;if(core.domStyle.isVertical){f=c.outerSize;e=c.outerSize+c.statusBarHeightInVertical+c.toolbarHeightInVertical}else{f=c.outerSize+c.BAR_WIDTH*core.domStyle.scale+c.BORDER;e=c.outerSize+(c.extendToolbar?c.TOOLBAR_HEIGHT*core.domStyle.scale+c.BORDER:0)}b.style.width=f+"px";b.style.height=e+"px";b.style.left=(c.clientWidth-f)/2+"px";b.style.top=(c.clientHeight-e)/2+"px";var a=core.dom.floorMsgGroup;a.style=c.globalAttribute.floorChangingStyle;a.style.width=c.outerSize-2*c.BORDER+"px";a.style.height=e-2*c.BORDER+"px";a.style.fontSize=16*core.domStyle.scale+"px";core.dom.startPanel.style.fontSize=16*core.domStyle.scale+"px";if(core.domStyle.isVertical||core.domStyle.scale<1){core.dom.musicBtn.style.right=core.dom.musicBtn.style.bottom="3px";core.dom.enlargeBtn.style.right="34px";core.dom.enlargeBtn.style.bottom="3px"}else{core.dom.musicBtn.style.right=(c.clientWidth-f)/2+"px";core.dom.musicBtn.style.bottom=(c.clientHeight-e)/2-27+"px";core.dom.enlargeBtn.style.right=(c.clientWidth-f)/2+31+"px";core.dom.enlargeBtn.style.bottom=(c.clientHeight-e)/2-27+"px"}};control.prototype._resize_canvas=function(f){var d=(f.CANVAS_WIDTH*core.domStyle.scale)+"px";for(var c=0;c<core.dom.gameCanvas.length;++c){core.dom.gameCanvas[c].style.width=core.dom.gameCanvas[c].style.height=d}core.dom.gif.style.width=core.dom.gif.style.height=d;core.dom.gif2.style.width=core.dom.gif2.style.height=d;core.dom.gameDraw.style.width=core.dom.gameDraw.style.height=d;core.dom.gameDraw.style.top=f.statusBarHeightInVertical+"px";core.dom.gameDraw.style.right=0;core.dom.gameDraw.style.border=f.border;core.bigmap.canvas.forEach(function(h){var i=core.canvas[h].canvas.hasAttribute("isHD")?core.domStyle.ratio:1;core.canvas[h].canvas.style.width=core.canvas[h].canvas.width/i*core.domStyle.scale+"px";core.canvas[h].canvas.style.height=core.canvas[h].canvas.height/i*core.domStyle.scale+"px"});for(var e in core.dymCanvas){var b=core.dymCanvas[e],a=b.canvas;var g=a.hasAttribute("isHD")?core.domStyle.ratio:1;a.style.width=a.width/g*core.domStyle.scale+"px";a.style.height=a.height/g*core.domStyle.scale+"px";a.style.left=parseFloat(a.getAttribute("_left"))*core.domStyle.scale+"px";a.style.top=parseFloat(a.getAttribute("_top"))*core.domStyle.scale+"px"}main.dom.next.style.width=main.dom.next.style.height=5*core.domStyle.scale+"px";main.dom.next.style.borderBottomWidth=main.dom.next.style.borderRightWidth=4*core.domStyle.scale+"px"};control.prototype._resize_statusBar=function(a){var b=core.dom.statusBar;if(core.domStyle.isVertical){b.style.width=a.outerSize+"px";b.style.height=a.statusBarHeightInVertical+"px";b.style.background=a.globalAttribute.statusTopBackground;b.style.fontSize=16*core.domStyle.scale+"px"}else{b.style.width=(a.BAR_WIDTH*core.domStyle.scale+a.BORDER)+"px";b.style.height=a.outerSize+(a.extendToolbar?a.TOOLBAR_HEIGHT*core.domStyle.scale+a.BORDER:0)+"px";b.style.background=a.globalAttribute.statusLeftBackground;if(a.extendToolbar){b.style.fontSize=16*core.domStyle.scale+"px"}else{b.style.fontSize=16*Math.min(1,(core.__HALF_SIZE__+3)/a.count)*core.domStyle.scale+"px"}}b.style.display="block";b.style.borderTop=b.style.borderLeft=a.border;b.style.borderRight=core.domStyle.isVertical?a.border:"";b.style.borderBottom=core.domStyle.isVertical?"":a.border;if(core.domStyle.isVertical){core.dom.statusCanvas.style.width=a.CANVAS_WIDTH*core.domStyle.scale+"px";core.dom.statusCanvas.style.height=a.statusBarHeightInVertical-3+"px";core.maps._setHDCanvasSize(core.dom.statusCanvasCtx,a.CANVAS_WIDTH,a.col*32+9)}else{core.dom.statusCanvas.style.width=a.BAR_WIDTH*core.domStyle.scale+"px";core.dom.statusCanvas.style.height=a.outerSize-2*a.BORDER+(a.extendToolbar?a.TOOLBAR_HEIGHT*core.domStyle.scale+a.BORDER:0)+"px";core.maps._setHDCanvasSize(core.dom.statusCanvasCtx,a.BAR_WIDTH,a.CANVAS_WIDTH+(a.extendToolbar?a.TOOLBAR_HEIGHT+a.BORDER:0))}core.dom.statusCanvas.style.display=core.flags.statusCanvas?"block":"none"};control.prototype._resize_status=function(c){var d;if(core.domStyle.isVertical){d=32*core.domStyle.scale*0.8}else{d=(c.extendToolbar?core.__SIZE__:core.__HALF_SIZE__+3)/c.count*32*core.domStyle.scale*0.8}for(var a=0;a<core.dom.status.length;++a){var b=core.dom.status[a].id,e=core.dom.status[a].style;if(b.endsWith("Col")){b=b.substring(0,b.length-3)}e.display=core.flags.statusCanvas||c.statusDisplayArr.indexOf(b)<0?"none":"block";e.margin=3*core.domStyle.scale+"px";e.height=d+"px";e.maxWidth=c.BAR_WIDTH*core.domStyle.scale*(core.domStyle.isVertical?0.95:1)+c.BORDER+"px";if(c.is15x15&&!core.domStyle.isVertical){e.marginLeft=11*core.domStyle.scale+"px"}}for(var a=0;a<core.dom.statusLabels.length;++a){core.dom.statusLabels[a].style.lineHeight=d+"px";core.dom.statusLabels[a].style.marginLeft=6*core.domStyle.scale+"px"}for(var a=0;a<core.dom.statusTexts.length;++a){core.dom.statusTexts[a].style.color=core.arrayToRGBA(c.globalAttribute.statusBarColor)}if(core.flags.statusBarItems.indexOf("enableGreenKey")>=0){core.dom.keyCol.style.fontSize="0.75em";core.statusBar.greenKey.style.display=""}else{core.dom.keyCol.style.fontSize="";core.statusBar.greenKey.style.display="none"}};control.prototype._resize_toolBar=function(a){var b=core.dom.toolBar;if(core.domStyle.isVertical){b.style.left=0;b.style.right="";b.style.width=a.outerSize+"px";b.style.top=a.statusBarHeightInVertical+a.outerSize+"px";b.style.height=a.toolbarHeightInVertical+"px";b.style.background=a.globalAttribute.toolsBackground}else{if(a.extendToolbar){b.style.left="";b.style.right=0;b.style.width=a.outerSize+"px";b.style.top=a.outerSize+"px";b.style.height=a.TOOLBAR_HEIGHT*core.domStyle.scale+a.BORDER+"px";b.style.background=a.globalAttribute.toolsBackground}else{b.style.left=0;b.style.right="";b.style.width=a.BAR_WIDTH*core.domStyle.scale+a.BORDER+"px";b.style.top=0.718*a.outerSize+"px";b.style.height=0.281*a.outerSize+"px";b.style.background="transparent"}}b.style.borderLeft=a.border;b.style.borderRight=b.style.borderBottom=core.domStyle.isVertical||a.extendToolbar?a.border:"";b.style.fontSize=16*core.domStyle.scale+"px";if(!core.domStyle.showStatusBar&&!core.domStyle.isVertical&&!a.extendToolbar){b.style.display="none"}else{b.style.display="block"}};control.prototype._resize_tools=function(b){var d=32*core.domStyle.scale*((core.domStyle.isVertical||b.extendToolbar)&&!b.is15x15?0.95:1);var e;if(core.domStyle.isVertical||b.extendToolbar){e=(core.__HALF_SIZE__-3)*3*core.domStyle.scale}else{e=(b.BAR_WIDTH*core.domStyle.scale-9-d*3)/4}for(var a=0;a<core.dom.tools.length;++a){var c=core.dom.tools[a].style;c.height=d+"px";c.marginLeft=e+"px";c.marginTop=3*core.domStyle.scale+"px"}core.dom.hard.style.lineHeight=d+"px";if(core.domStyle.isVertical||b.extendToolbar){core.dom.hard.style.width=b.outerSize-9*e-8.5*d-12+"px"}else{core.dom.hard.style.width=b.BAR_WIDTH*core.domStyle.scale-9-2*e+"px";if(!b.is15x15){core.dom.hard.style.marginTop=0}}};"use strict";function utils(){this._init();this.scan={up:{x:0,y:-1},left:{x:-1,y:0},down:{x:0,y:1},right:{x:1,y:0}};this.scan2={up:{x:0,y:-1},left:{x:-1,y:0},down:{x:0,y:1},right:{x:1,y:0},leftup:{x:-1,y:-1},leftdown:{x:-1,y:1},rightup:{x:1,y:-1},rightdown:{x:1,y:1}}}utils.prototype._init=function(){if(typeof Object.assign!="function"){Object.assign=function(d,f){if(d==null){throw new TypeError("Cannot convert undefined or null to object")}var e=Object(d);for(var a=1;a<arguments.length;a++){var c=arguments[a];if(c!=null){for(var b in c){if(Object.prototype.hasOwnProperty.call(c,b)){e[b]=c[b]}}}}return e}}if(typeof String.prototype.endsWith!="function"){String.prototype.endsWith=function(a,b){if(b===undefined||b>this.length){b=this.length}return this.substring(b-a.length,b)===a}}if(typeof String.prototype.startsWith!="function"){String.prototype.startsWith=function(a,b){if(b===undefined||b>this.length){b=this.length}return this.substring(0,a.length)===a}}if(typeof Array.prototype.fill!="function"){Array.prototype.fill=function(b){for(var a=0;a<this.length;++a){if(this[a]==null){this[a]=b}}return this}}if(typeof Array.prototype.includes!="function"){Array.prototype.includes=function(a){return this.indexOf(a)>=0}}if(typeof String.prototype.includes!="function"){String.prototype.includes=function(a){return this.indexOf(a)>=0}}if(typeof Object.values!="function"){Object.values=function(a){return Object.keys(a).map(function(b){return a[b]})}}};utils.prototype.replaceText=function(e,d){if(typeof e!="string"){return e}var c=e.indexOf("${");if(c<0){return e}var a=0,b=c;while(++b<e.length){if(e.charAt(b)=="{"){a++}if(e.charAt(b)=="}"){a--}if(a==0){break}}if(a!=0){return e}var f=core.calValue(e.substring(c+2,b),d);if(f==null){f=""}return e.substring(0,c)+f+core.replaceText(e.substring(b+1),d)};utils.prototype.replaceValue=function(a){if(typeof a=="string"&&(a.indexOf(":")>=0||a.indexOf("flag:")>=0||a.indexOf("global:")>=0)){if(a.indexOf("status:")>=0){a=a.replace(/status:([a-zA-Z0-9_]+)/g,"core.getStatus('$1')")}if(a.indexOf("buff:")>=0){a=a.replace(/buff:([a-zA-Z0-9_]+)/g,"core.getBuff('$1')")}if(a.indexOf("item:")>=0){a=a.replace(/item:([a-zA-Z0-9_]+)/g,"core.itemCount('$1')")}if(a.indexOf("flag:")>=0||a.indexOf("flag:")>=0){a=a.replace(/flag[::]([a-zA-Z0-9_\u4E00-\u9FCC\u3040-\u30FF\u2160-\u216B\u0391-\u03C9]+)/g,"core.getFlag('$1', 0)")}if(a.indexOf("global:")>=0||a.indexOf("global:")>=0){a=a.replace(/global[::]([a-zA-Z0-9_\u4E00-\u9FCC\u3040-\u30FF\u2160-\u216B\u0391-\u03C9]+)/g,"core.getGlobal('$1', 0)")}if(a.indexOf("enemy:")>=0){a=a.replace(/enemy:([a-zA-Z0-9_]+)[\.:]([a-zA-Z0-9_]+)/g,"core.material.enemys['$1'].$2")}if(a.indexOf("blockId:")>=0){a=a.replace(/blockId:(\d+),(\d+)/g,"core.getBlockId($1, $2)")}if(a.indexOf("blockNumber:")>=0){a=a.replace(/blockNumber:(\d+),(\d+)/g,"core.getBlockNumber($1, $2)")}if(a.indexOf("blockCls:")>=0){a=a.replace(/blockCls:(\d+),(\d+)/g,"core.getBlockCls($1, $2)")}if(a.indexOf("equip:")>=0){a=a.replace(/equip:(\d)/g,"core.getEquip($1)")}if(a.indexOf("temp:")>=0){a=a.replace(/temp:([a-zA-Z0-9_]+)/g,"core.getFlag('@temp@$1', 0)")}}return a};utils.prototype.calValue=function(value,prefix){if(!core.isset(value)){return null}if(typeof value==="string"){if(value.indexOf(":")>=0||value.indexOf("flag:")>=0||value.indexOf("global:")>=0){if(value.indexOf("switch:">=0)){value=value.replace(/switch:([a-zA-Z0-9_]+)/g,"core.getFlag('"+(prefix||":f@x@y")+"@$1', 0)")}value=this.replaceValue(value)}return eval(value)}if(value instanceof Function){return value()}return value};utils.prototype.unshift=function(c,d){if(!(c instanceof Array)||d==null){return}if(d instanceof Array){core.clone(d).reverse().forEach(function(a){c.unshift(a)})}else{c.unshift(d)}return c};utils.prototype.push=function(c,d){if(!(c instanceof Array)||d==null){return}if(d instanceof Array){core.clone(d).forEach(function(a){c.push(a)})}else{c.push(d)}return c};utils.prototype.decompress=function(c){try{var b=lzw_decode(c);if(b){return JSON.parse(b)}}catch(a){}try{var b=LZString.decompress(c);if(b){return JSON.parse(b)}}catch(a){}try{return JSON.parse(c)}catch(a){main.log(a)}return null};utils.prototype.setLocalStorage=function(b,d){try{if(d==null){this.removeLocalStorage(b);return}var c=JSON.stringify(d).replace(/[\u007F-\uFFFF]/g,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).substr(-4)});localStorage.setItem(core.firstData.name+"_"+b,c);if(b=="autoSave"){core.saves.ids[0]=true}else{if(/^save\d+$/.test(b)){core.saves.ids[parseInt(b.substring(4))]=true}}return true}catch(a){main.log(a);return false}};utils.prototype.getLocalStorage=function(c,a){try{var d=JSON.parse(localStorage.getItem(core.firstData.name+"_"+c));if(d==null){return a}return d}catch(b){return a}};utils.prototype.removeLocalStorage=function(a){localStorage.removeItem(core.firstData.name+"_"+a);if(a=="autoSave"){delete core.saves.ids[0]}else{if(/^save\d+$/.test(a)){delete core.saves.ids[parseInt(a.substring(4))]}}};utils.prototype.setLocalForage=function(c,g,f,b){if(g==null){this.removeLocalForage(c);return}var d=core.firstData.name+"_"+c;var e=JSON.stringify(g).replace(/[\u007F-\uFFFF]/g,function(h){return"\\u"+("0000"+h.charCodeAt(0).toString(16)).substr(-4)});var a=function(h){if(h){if(b){b(h)}}else{if(c=="autoSave"){core.saves.ids[0]=true}else{if(/^save\d+$/.test(c)){core.saves.ids[parseInt(c.substring(4))]=true}}if(f){f()}}};this._setLocalForage_set(d,e,a)};utils.prototype._setLocalForage_set=function(d,e,a){if(window.jsinterface&&window.jsinterface.setLocalForage){var c=setTimeout(null);core["__callback"+c]=a;core.saves.cache[d]=e;window.jsinterface.setLocalForage(c,d,e)}else{var b=e.length>100000?LZString.compress(e):lzw_encode(e);core.saves.cache[d]=b;localforage.setItem(d,b,a)}};utils.prototype.getLocalForage=function(d,b,f,c){var e=core.firstData.name+"_"+d;var a=function(g,i){if(g){if(c){c(g)}}else{core.saves.cache[e]=i;if(!f){return}if(i!=null){var h=core.utils.decompress(i);f(h==null?b:h);return}f(b)}};if(core.saves.cache[e]!=null){return a(null,core.saves.cache[e])}this._getLocalForage_get(e,a)};utils.prototype._getLocalForage_get=function(c,a){if(window.jsinterface&&window.jsinterface.getLocalForage){var b=setTimeout(null);core["__callback"+b]=a;window.jsinterface.getLocalForage(b,c)}else{localforage.getItem(c,a)}};utils.prototype.removeLocalForage=function(c,e,b){var d=core.firstData.name+"_"+c;var a=function(f){if(f){if(b){b(f)}}else{if(c=="autoSave"){delete core.saves.ids[0]}else{if(/^save\d+$/.test(c)){delete core.saves.ids[parseInt(c.substring(4))]}}if(e){e()}}};delete core.saves.cache[d];this._removeLocalForage_remove(d,a)};utils.prototype._removeLocalForage_remove=function(c,a){if(window.jsinterface&&window.jsinterface.removeLocalForage){var b=setTimeout(null);core["__callback"+b]=a;window.jsinterface.removeLocalForage(b,c)}else{localforage.removeItem(c,a)}};utils.prototype.clearLocalForage=function(a){core.saves.cache={};if(window.jsinterface&&window.jsinterface.clearLocalForage){var b=setTimeout(null);core["__callback"+b]=a;window.jsinterface.clearLocalForage(b)}else{localforage.clear(a)}};utils.prototype.iterateLocalForage=function(c,a){if(window.jsinterface&&window.jsinterface.iterateLocalForage){var b=setTimeout(null);core["__iter"+b]=c;core["__callback"+b]=a;window.jsinterface.iterateLocalForage(b)}else{localforage.iterate(c,a)}};utils.prototype.keysLocalForage=function(a){if(window.jsinterface&&window.jsinterface.keysLocalForage){var b=setTimeout(null);core["__callback"+b]=a;window.jsinterface.keysLocalForage(b)}else{localforage.keys(a)}};utils.prototype.lengthLocalForage=function(a){if(window.jsinterface&&window.jsinterface.lengthLocalForage){var b=setTimeout(null);core["__callback"+b]=a;window.jsinterface.lengthLocalForage(b)}else{localforage.length(a)}};utils.prototype.setGlobal=function(a,b){if(core.isReplaying()){return}core.setLocalStorage(a,b)};utils.prototype.getGlobal=function(c,b){var d;if(core.isReplaying()){var a=core.status.replay.toReplay.shift();if(a.indexOf("input2:")==0){d=JSON.parse(core.decodeBase64(a.substring(7)));core.setFlag("__global__"+c,d);core.status.route.push("input2:"+core.encodeBase64(JSON.stringify(d)))}else{core.status.replay.toReplay.unshift(a);d=core.getFlag("__global__"+c,core.getLocalStorage(c,b))}}else{d=core.getLocalStorage(c,b);core.setFlag("__global__"+c,d);core.status.route.push("input2:"+core.encodeBase64(JSON.stringify(d)))}return d};utils.prototype.clone=function(b,c,e){if(!core.isset(b)){return null}if(b instanceof Date){var a=new Date();a.setTime(b.getTime());return a}if(b instanceof Array){var a=[];for(var d in b){if(!c||c(d,b[d])){a[d]=core.clone(b[d],e?c:null,e)}}return a}if(b instanceof Function){return b}if(b instanceof Object){var a={};for(var d in b){if(b.hasOwnProperty(d)&&(!c||c(d,b[d]))){a[d]=core.clone(b[d],e?c:null,e)}}return a}return b};utils.prototype.cloneArray=function(a){if(!(a instanceof Array)){return this.clone(a)}if(a[0] instanceof Array){return a.map(function(b){return b.slice()})}else{return a.slice()}};utils.prototype.splitImage=function(g,n,e){if(typeof g=="string"){g=core.getMappedName(g);g=core.material.images.images[g]}if(!g){return[]}n=n||32;e=e||n;var b=document.createElement("canvas");var c=b.getContext("2d");var a=[];for(var l=0;l<g.height;l+=e){for(var f=0;f<g.width;f+=n){var m=Math.min(n,g.width-f),d=Math.min(e,g.height-l);b.width=m;b.height=d;core.drawImage(c,g,f,l,m,d,0,0,m,d);var k=new Image();k.src=b.toDataURL("image/png");a.push(k)}}return a};utils.prototype.formatDate=function(a){if(!a){a=new Date()}return""+a.getFullYear()+"-"+core.setTwoDigits(a.getMonth()+1)+"-"+core.setTwoDigits(a.getDate())+" "+core.setTwoDigits(a.getHours())+":"+core.setTwoDigits(a.getMinutes())+":"+core.setTwoDigits(a.getSeconds())};utils.prototype.formatDate2=function(a){if(!a){a=new Date()}return""+a.getFullYear()+core.setTwoDigits(a.getMonth()+1)+core.setTwoDigits(a.getDate())+core.setTwoDigits(a.getHours())+core.setTwoDigits(a.getMinutes())+core.setTwoDigits(a.getSeconds())};utils.prototype.formatTime=function(a){return core.setTwoDigits(parseInt(a/3600000))+":"+core.setTwoDigits(parseInt(a/60000)%60)+":"+core.setTwoDigits(parseInt(a/1000)%60)};utils.prototype.setTwoDigits=function(a){return(parseInt(a)<10&&parseInt(a)>=0)?"0"+a:a};utils.prototype.formatSize=function(a){if(a<1024){return a+"B"}else{if(a<1024*1024){return(a/1024).toFixed(2)+"KB"}else{return(a/1024/1024).toFixed(2)+"MB"}}};utils.prototype.formatBigNumber=function(g,a){if(a===true){a=5}if(!a||a<5){a=6}g=Math.trunc(parseFloat(g));if(g==null||!Number.isFinite(g)){return"???"}var f=[{val:10000,suffix:"w"},{val:100000000,suffix:"e"},{val:1000000000000,suffix:"z"},{val:1e+16,suffix:"j"},{val:1e+20,suffix:"g"},];if(Math.abs(g)>1e+20*Math.pow(10,a-2)){return g.toExponential(0)}var d=g<0?"-":"";if(d){--a}g=Math.abs(g);if(g<Math.pow(10,a)){return d+g}for(var c=0;c<f.length;++c){var b=f[c];var e=(g/b.val).toFixed(a).substring(0,a);if(e.indexOf(".")<0){continue}e=e.substring(0,e[e.length-2]=="."?e.length-2:e.length-1);return d+e+b.suffix}return d+g.toExponential(0)};utils.prototype.applyEasing=function(c){var b={easeIn:function(d){return Math.pow(d,3)},easeOut:function(d){return 1-Math.pow(1-d,3)},easeInOut:function(d){if(d<0.5){return Math.pow(d,2)*2}else{return 1-Math.pow(1-d,2)*2}},linear:function(d){return d}};if(c=="random"){var a=Object.keys(b);c=a[Math.floor(Math.random()*a.length)]}return b[c]||b.linear};utils.prototype.arrayToRGB=function(a){if(!(a instanceof Array)){return a}var d=this.clamp(parseInt(a[0]),0,255),c=this.clamp(parseInt(a[1]),0,255),b=this.clamp(parseInt(a[2]),0,255);return"#"+((1<<24)+(d<<16)+(c<<8)+b).toString(16).slice(1)};utils.prototype.arrayToRGBA=function(a){if(!(a instanceof Array)){return a}if(a[3]==null){a[3]=1}var e=this.clamp(parseInt(a[0]),0,255),d=this.clamp(parseInt(a[1]),0,255),c=this.clamp(parseInt(a[2]),0,255),b=this.clamp(parseFloat(a[3]),0,1);return"rgba("+e+","+d+","+c+","+b+")"};utils.prototype.encodeRoute=function(d){var a="",c="",b=0;d.forEach(function(e){if(e=="up"||e=="down"||e=="left"||e=="right"){if(e!=c&&b>0){a+=c.substring(0,1).toUpperCase();if(b>1){a+=b}b=0}c=e;b++}else{if(b>0){a+=c.substring(0,1).toUpperCase();if(b>1){a+=b}b=0}a+=core.utils._encodeRoute_encodeOne(e)}});if(b>0){a+=c.substring(0,1).toUpperCase();if(b>1){a+=b}}return LZString.compressToBase64(a)};utils.prototype._encodeRoute_id2number=function(a){var b=core.maps.getNumberById(a);return b==0?a:b};utils.prototype._encodeRoute_encodeOne=function(a){if(a.indexOf("item:")==0){return"I"+this._encodeRoute_id2number(a.substring(5))+":"}else{if(a.indexOf("unEquip:")==0){return"u"+a.substring(8)}else{if(a.indexOf("equip:")==0){return"e"+this._encodeRoute_id2number(a.substring(6))+":"}else{if(a.indexOf("saveEquip:")==0){return"s"+a.substring(10)}else{if(a.indexOf("loadEquip:")==0){return"l"+a.substring(10)}else{if(a.indexOf("fly:")==0){return"F"+a.substring(4)+":"}else{if(a=="choices:none"){return"c"}else{if(a.indexOf("choices:")==0){return"C"+a.substring(8)}else{if(a.indexOf("shop:")==0){return"S"+a.substring(5)+":"}else{if(a=="turn"){return"T"}else{if(a.indexOf("turn:")==0){return"t"+a.substring(5).substring(0,1).toUpperCase()+":"}else{if(a=="getNext"){return"G"}else{if(a=="input:none"){return"p"}else{if(a.indexOf("input:")==0){return"P"+a.substring(6)}else{if(a.indexOf("input2:")==0){return"Q"+a.substring(7)+":"}else{if(a=="no"){return"N"}else{if(a.indexOf("move:")==0){return"M"+a.substring(5)}else{if(a.indexOf("key:")==0){return"K"+a.substring(4)}else{if(a.indexOf("click:")==0){return"k"+a.substring(6)}else{if(a.indexOf("random:")==0){return"X"+a.substring(7)}}}}}}}}}}}}}}}}}}}}return"("+a+")"};utils.prototype.decodeRoute=function(c){if(!c){return c}try{var d=LZString.decompressFromBase64(c);if(d!=null&&/^[-_a-zA-Z0-9+\/=:()]*$/.test(d)){if(d!=""||c.length<8){c=d}}}catch(b){}var a={route:c,index:0,ans:[]};while(a.index<a.route.length){this._decodeRoute_decodeOne(a,a.route.charAt(a.index++))}return a.ans};utils.prototype._decodeRoute_getNumber=function(b,d){var e="";var c=true;while(true){var a=b.route.charAt(b.index);if(a>="0"&&a<="9"){e+=a}else{if(a=="-"&&c){e+=a}else{break}}c=false;b.index++}if(e.length==0){e="1"}return d?e:parseInt(e)};utils.prototype._decodeRoute_getString=function(a){var b="";while(a.index<a.route.length&&a.route.charAt(a.index)!=":"){b+=a.route.charAt(a.index++)}a.index++;return b};utils.prototype._decodeRoute_number2id=function(b){if(/^\d+$/.test(b)){var a=core.maps.blocksInfo[b];if(a){return a.id}}return b};utils.prototype._decodeRoute_decodeOne=function(b,a){if(a=="("){var e=b.route.indexOf(")",b.index);if(e>=0){b.ans.push(b.route.substring(b.index,e));b.index=e+1;return}}var g=(a=="I"||a=="e"||a=="F"||a=="S"||a=="Q"||a=="t")?this._decodeRoute_getString(b):this._decodeRoute_getNumber(b);var f={U:"up",D:"down",L:"left",R:"right"};switch(a){case"U":case"D":case"L":case"R":for(var d=0;d<g;d++){b.ans.push(f[a])}break;case"I":b.ans.push("item:"+this._decodeRoute_number2id(g));break;case"u":b.ans.push("unEquip:"+g);break;case"e":b.ans.push("equip:"+this._decodeRoute_number2id(g));break;case"s":b.ans.push("saveEquip:"+g);break;case"l":b.ans.push("loadEquip:"+g);break;case"F":b.ans.push("fly:"+g);break;case"c":b.ans.push("choices:none");break;case"C":b.ans.push("choices:"+g);break;case"S":b.ans.push("shop:"+g);break;case"T":b.ans.push("turn");break;case"t":b.ans.push("turn:"+f[g]);break;case"G":b.ans.push("getNext");break;case"p":b.ans.push("input:none");break;case"P":b.ans.push("input:"+g);break;case"Q":b.ans.push("input2:"+g);break;case"N":b.ans.push("no");break;case"M":++b.index;b.ans.push("move:"+g+":"+this._decodeRoute_getNumber(b));break;case"K":b.ans.push("key:"+g);break;case"k":++b.index;var h=this._decodeRoute_getNumber(b);++b.index;var j=this._decodeRoute_getNumber(b);b.ans.push("click:"+g+":"+h+":"+j);break;case"X":b.ans.push("random:"+g);break}};utils.prototype.isset=function(a){return a!=null&&!(typeof a=="number"&&isNaN(a))};utils.prototype.subarray=function(c,d){if(!(c instanceof Array)||!(d instanceof Array)||c.length<d.length){return null}for(var e=0;e<d.length;++e){if(c[e]!=d[e]){return null}}return c.slice(d.length)};utils.prototype.inArray=function(a,b){return(a instanceof Array)&&a.indexOf(b)>=0};utils.prototype.clamp=function(g,c,d){var f=Math.min(c,d),e=Math.max(c,d);return Math.min(Math.max(g||0,f),e)};utils.prototype.getCookie=function(b){var a=document.cookie.match(new RegExp("(^| )"+b+"=([^;]+)"));return a?a[2]:null};utils.prototype.setStatusBarInnerHTML=function(f,h,c){if(!core.statusBar[f]){return}if(typeof h=="number"){h=this.formatBigNumber(h)}var d=/^[-a-zA-Z0-9`~!@#$%^&*()_=+\[{\]}\\|;:'",<.>\/?]*$/.test(h);var g="font-style: "+(d?"italic":"normal")+"; ";g+="text-shadow: #000 1px 0 0, #000 0 1px 0, #000 -1px 0 0, #000 0 -1px 0; ";var e=this.strlen(h)||1;g+="font-size: "+Math.min(1,7/e)+"em; ";if(c){g+=c}var a=core.statusBar[f].getAttribute("_style");var b=core.statusBar[f].getAttribute("_value");if(a==g){if(h==b){return}core.statusBar[f].children[0].innerText=h}else{core.statusBar[f].innerHTML="<span class='_status' style='"+g+"'></span>";core.statusBar[f].children[0].innerText=h;core.statusBar[f].setAttribute("_style",g)}core.statusBar[f].setAttribute("_value",h)};utils.prototype.strlen=function(d){var a=0;for(var b=0,c=d.length;b<c;b++){a+=d.charCodeAt(b)<256?1:2}return a};utils.prototype.turnDirection=function(d,a){a=a||core.getHeroLoc("direction");var b=["left","leftup","up","rightup","right","rightdown","down","leftdown"];if(b.indexOf(d)>=0){return d}if(d==":hero"){return core.getHeroLoc("direction")}if(d==":backhero"){return this.turnDirection(":back",core.getHeroLoc("direction"))}if(typeof d==="number"&&d%45==0){d/=45}else{switch(d){case":left":d=6;break;case":right":d=2;break;case":back":d=4;break;default:d=0;break}}var c=b.indexOf(a);if(c<0){return a}return b[(c+(d||0))%b.length]};utils.prototype.matchWildcard=function(b,c){try{return new RegExp("^"+b.split(/\*+/).map(function(d){return d.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")}).join(".*")+"$").test(c)}catch(a){return false}};utils.prototype.matchRegex=function(b,c){try{if(b.startsWith("^")){b=b.substring(1)}if(b.endsWith("$")){b=b.substring(0,b.length-1)}return new RegExp("^"+b+"$").test(c)}catch(a){return false}};utils.prototype.encodeBase64=function(a){return btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,function(b,c){return String.fromCharCode(parseInt(c,16))}))};utils.prototype.decodeBase64=function(a){return decodeURIComponent(atob(a).split("").map(function(b){return"%"+("00"+b.charCodeAt(0).toString(16)).slice(-2)}).join(""))};utils.prototype.rand=function(b){var c=core.getFlag("__rand__");c=this.__next_rand(c);core.setFlag("__rand__",c);var a=c/2147483647;if(b&&b>0){return Math.floor(a*b)}return a};utils.prototype.rand2=function(b){b=b||2147483648;b=Math.abs(b);var c;if(core.isReplaying()){var a=core.status.replay.toReplay.shift();if(a.indexOf("random:")==0){c=parseInt(a.substring(7));if(isNaN(c)||c>=b||c<0){console.warn("错误!当前random:项超过范围。将重新随机生成!");c=Math.floor(Math.random()*b)}}else{console.warn("错误!当前需要一个random:项。将重新随机生成!");c=Math.floor(Math.random()*b)}}else{c=Math.floor(Math.random()*b)}core.status.route.push("random:"+c);return c};utils.prototype.__init_seed=function(){var a=new Date().getTime()%34834795+3534;a=this.__next_rand(a);a=this.__next_rand(a);a=this.__next_rand(a);core.setFlag("__seed__",a);core.setFlag("__rand__",a)};utils.prototype.__next_rand=function(a){a=(a%127773)*16807-~~(a/127773)*2836;a+=a<0?2147483647:0;return a};utils.prototype.readFile=function(d,b,a,c){core.platform.successCallback=d;core.platform.errorCallback=b;if(window.jsinterface){window.jsinterface.readFile();return}if(!core.platform.isOnline){alert("离线状态下不支持文件读取!");if(b){b()}return}if(core.platform.fileReader==null){alert("当前浏览器不支持FileReader!");if(b){b()}return}if(core.platform.fileInput==null){core.platform.fileInput=document.createElement("input");core.platform.fileInput.style.opacity=0;core.platform.fileInput.type="file";core.platform.fileInput.onchange=function(){var e=core.platform.fileInput.files;if(e.length==0){if(core.platform.errorCallback){core.platform.errorCallback()}return}if(!c){core.platform.fileReader.readAsText(core.platform.fileInput.files[0])}else{core.platform.fileReader.readAsDataURL(core.platform.fileInput.files[0])}core.platform.fileInput.value=""}}core.platform.fileInput.value="";if(a){core.platform.fileInput.accept=a}core.platform.fileInput.click()};utils.prototype.readFileContent=function(a){var c=null;if(a.slice(0,4)==="data"){if(core.platform.successCallback){core.platform.successCallback(a)}return}try{c=JSON.parse(LZString.decompressFromBase64(a))}catch(b){}if(!c){try{c=JSON.parse(a)}catch(b){main.log(b)}}if(c){if(core.platform.successCallback){core.platform.successCallback(c)}return}if(core.platform.errorCallback){core.platform.errorCallback()}};utils.prototype.download=function(d,b){if(window.jsinterface){window.jsinterface.download(d,b);return}if(!core.platform.isOnline){alert("离线状态下不支持下载操作!");return}if(core.platform.isIOS){if(core.copy(b)){alert("iOS平台下不支持直接下载文件!\n所有应下载内容已经复制到您的剪切板,请自行创建空白文件并粘贴。")}else{alert("iOS平台下不支持下载操作!")}return}if(!core.platform.isPC){if(!core.platform.isChrome||core.platform.isQQ||core.platform.isWeChat){if(core.copy(b)){alert("移动端只有Chrome浏览器支持直接下载文件!\n所有应下载内容已经复制到您的剪切板,请自行创建空白文件并粘贴。")}else{alert("该平台或浏览器暂不支持下载操作!")}return}}if(core.platform.isSafari){alert("你当前使用的是Safari浏览器,不支持直接下载文件。\n即将打开一个新窗口为应下载内容,请自行全选复制然后创建空白文件并粘贴。");var a=new Blob([b],{type:"text/plain;charset=utf-8"});var e=window.URL.createObjectURL(a);var f=window.open(e,"_blank");window.URL.revokeObjectURL(e);return}var a=new Blob([b],{type:"text/plain;charset=utf-8"});if(window.navigator.msSaveOrOpenBlob){window.navigator.msSaveBlob(a,d)}else{var e=window.URL.createObjectURL(a);var c=window.document.createElement("a");c.href=e;c.download=d;document.body.appendChild(c);c.click();document.body.removeChild(c);window.URL.revokeObjectURL(e)}};utils.prototype.copy=function(a){if(window.jsinterface){window.jsinterface.copy(a);return true}if(!core.platform.supportCopy){return false}var d=document.createElement("textarea");d.style.position="fixed";d.style.top=0;d.style.left=0;d.style.width="2em";d.style.height="2em";d.style.padding=0;d.style.border="none";d.style.outline="none";d.style.boxShadow="none";d.style.background="transparent";d.value=a;document.body.appendChild(d);d.focus();d.setSelectionRange(0,d.value.length);var c=false;try{c=document.execCommand("copy")}catch(b){c=false}document.body.removeChild(d);return c};utils.prototype.myconfirm=function(a,c,b){main.dom.inputDiv.style.display="block";main.dom.inputMessage.innerHTML=a.replace(/\n/g,"<br/>");main.dom.inputBox.style.display="none";main.dom.inputYes.blur();main.dom.inputNo.blur();core.status.holdingKeys=[];core.platform.successCallback=c;core.platform.errorCallback=b};utils.prototype.myprompt=function(b,c,a){main.dom.inputDiv.style.display="block";main.dom.inputMessage.innerHTML=b.replace(/\n/g,"<br/>");main.dom.inputBox.style.display="block";main.dom.inputBox.value=c==null?"":c;main.dom.inputYes.blur();main.dom.inputNo.blur();setTimeout(function(){main.dom.inputBox.focus()});core.status.holdingKeys=[];core.platform.successCallback=core.platform.errorCallback=a};utils.prototype.showWithAnimate=function(b,e,a){b.style.display="block";if(!e||main.mode!="play"){b.style.opacity=1;if(a){a()}return}b.style.opacity=0;var c=0;var d=window.setInterval(function(){c+=0.03;b.style.opacity=c;if(c>1){clearInterval(d);if(a){a()}}},e)};utils.prototype.hideWithAnimate=function(c,e,a){if(!e||main.mode!="play"){c.style.display="none";if(a){a()}return}c.style.opacity=1;var d=1;var b=window.setInterval(function(){d-=0.03;c.style.opacity=d;if(d<0){c.style.display="none";clearInterval(b);if(a){a()}}},e)};utils.prototype.getGuid=function(){var a=localStorage.getItem("guid");if(a!=null){return a}a="xxxxxxxx_xxxx_4xxx_yxxx_xxxxxxxxxxxx".replace(/[xy]/g,function(b){var d=Math.random()*16|0,e=b=="x"?d:(d&3|8);return e.toString(16)});localStorage.setItem("guid",a);return a};utils.prototype.hashCode=function(d){if(typeof d=="string"){var b=0,c,a;if(d.length===0){return b}for(c=0;c<d.length;c++){a=d.charCodeAt(c);b=((b<<5)-b)+a;b|=0}return b}return this.hashCode(JSON.stringify(d).split("").sort().join(""))};utils.prototype.same=function(c,d){if(c==null&&d==null){return true}if(c==null||d==null){return false}if(c===d){return true}if(c instanceof Array&&d instanceof Array){if(c.length!=d.length){return false}for(var e=0;e<c.length;e++){if(!this.same(c[e],d[e])){return false}}return true}if(c instanceof Object&&d instanceof Object){var f={};for(var e in c){f[e]=true}for(var e in d){f[e]=true}for(var e in f){if(!this.same(c[e],d[e])){return false}}return true}return false};utils.prototype.unzip=function(b,f,d,c,e){var a=function(g){main.log(g);if(d){d(g)}};if(!window.zip){return a("zip.js not exists!")}if(typeof b=="string"){return core.http("GET",b,null,function(g){core.unzip(g,f,d,c)},a,null,"blob",e)}if(!(b instanceof Blob)){return a("Should use Blob or URL as input")}zip.createReader(new zip.BlobReader(b),function(g){g.getEntries(function(h){core.utils._unzip_readEntries(h,function(i){g.close(function(){if(f){f(i)}})},c)})},a)};utils.prototype._unzip_readEntries=function(b,e,a){var d={};if(b==null||b.length==0){return e(d)}var c=b.length;b.forEach(function(f){f.getData(a?new zip.TextWriter("utf8"):new zip.BlobWriter(),function(g){d[f.filename]=g;c--;if(c==0){e(d)}})})};utils.prototype.http=function(g,h,b,f,a,c,e,d){var i=new XMLHttpRequest();i.open(g,h,true);if(c){i.overrideMimeType(c)}if(e){i.responseType=e}i.onload=function(j){if(i.status==200){if(f){f(i.response)}}else{if(a){a("HTTP "+i.status)}}};i.onprogress=function(j){if(j.lengthComputable){if(d){d(j.loaded,j.total)}}};i.onabort=function(){if(a){a("Abort")}};i.ontimeout=function(){if(a){a("Timeout")}};i.onerror=function(){if(a){a("Error on Connection")}};if(b){i.send(b)}else{i.send()}};function lzw_encode(h){var d={};var c=(h+"").split("");var f=[];var b;var g=c[0];var a=256;for(var e=1;e<c.length;e++){b=c[e];if(d[g+b]!=null){g+=b}else{f.push(g.length>1?d[g]:g.charCodeAt(0));d[g+b]=a;a++;g=b}}f.push(g.length>1?d[g]:g.charCodeAt(0));for(var e=0;e<f.length;e++){f[e]=String.fromCharCode(f[e])}return f.join("")}function lzw_decode(k){var e={};var d=(k+"").split("");var b=d[0];var g=b;var h=[b];var a=256;var j;for(var f=1;f<d.length;f++){var c=d[f].charCodeAt(0);if(c<256){j=d[f]}else{j=e[c]?e[c]:(g+b)}h.push(j);b=j.charAt(0);e[a]=g+b;a++;g=j}return h.join("")};"use strict";function items(){this._init()}items.prototype._init=function(){this.items=items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a;for(var a in this.items){this.items[a].id=a}};items.prototype.getItems=function(){var c=core.clone(this.items);var a=core.getFlag("equipInfo");if(a){for(var b in a){c[b].equip=core.clone(a[b])}}return c};items.prototype.getItemEffect=function(itemId,itemNum){var itemCls=core.material.items[itemId].cls;if(itemCls==="items"){var curr_hp=core.status.hero.hp;var itemEffect=core.material.items[itemId].itemEffect;if(itemEffect){try{for(var i=0;i<itemNum;++i){eval(itemEffect)}}catch(e){main.log(e)}}core.status.hero.statistics.hp+=core.status.hero.hp-curr_hp;var useItemEvent=core.material.items[itemId].useItemEvent;if(useItemEvent){try{core.insertAction(useItemEvent)}catch(e){main.log(e)}}core.updateStatusBar()}else{core.addItem(itemId,itemNum)}};items.prototype.getItemEffectTip=function(d){var b=core.material.items[d].cls;if(b==="items"){var c=core.material.items[d].itemEffectTip;if(c){try{return core.replaceText(c)||""}catch(a){main.log(a);return""}}}return""};items.prototype.useItem=function(b,c,a){if(!this.canUseItem(b)){if(a){a()}return}this._useItemEffect(b);this._afterUseItem(b);if(!c){core.status.route.push("item:"+b)}if(a){a()}};items.prototype._useItemEffect=function(itemId){var useItemEffect=core.material.items[itemId].useItemEffect;if(useItemEffect){try{eval(useItemEffect)}catch(e){main.log(e)}}var useItemEvent=core.material.items[itemId].useItemEvent;if(useItemEvent){try{core.insertAction(useItemEvent)}catch(e){main.log(e)}}};items.prototype._afterUseItem=function(b){var a=core.material.items[b].cls;if(a=="tools"){core.status.hero.items[a][b]--}if(core.status.hero.items[a][b]<=0){delete core.status.hero.items[a][b]}core.updateStatusBar()};items.prototype.canUseItem=function(itemId){if(!core.hasItem(itemId)){return false}var canUseItemEffect=core.material.items[itemId].canUseItemEffect;if(canUseItemEffect){try{return eval(canUseItemEffect)}catch(e){main.log(e);return false}}};items.prototype.itemCount=function(b){if(!core.material.items[b]||!core.isPlaying()){return 0}var a=core.material.items[b].cls;if(a=="items"){return 0}return core.status.hero.items[a][b]||0};items.prototype.hasItem=function(a){return this.itemCount(a)>0};items.prototype.hasEquip=function(b){if(!(core.material.items[b]||{}).equip||!core.isPlaying()){return null}for(var a in core.status.hero.equipment){if(core.status.hero.equipment[a]==b){return true}}return false};items.prototype.getEquip=function(a){return core.status.hero.equipment[a]||null};items.prototype.setItem=function(b,c){c=c||0;var a=core.material.items[b].cls;if(a=="items"){return}core.status.hero.items[a][b]=c;if(core.status.hero.items[a][b]<=0){delete core.status.hero.items[a][b]}core.updateStatusBar()};items.prototype.addItem=function(c,d){if(d==null){d=1}var b=core.material.items[c];var a=b.cls;if(a=="items"){return}if(core.status.hero.items[a][c]==null){core.status.hero.items[a][c]=0}core.status.hero.items[a][c]+=d;if(core.status.hero.items[a][c]<=0){delete core.status.hero.items[a][c]}if(a=="constants"&&core.status.hero.items[a][c]>1){core.status.hero.items[a][c]=1}core.updateStatusBar()};items.prototype.removeItem=function(b,c){if(c==null){c=1}if(!core.hasItem(b)){return false}var a=core.material.items[b].cls;core.status.hero.items[a][b]-=c;if(core.status.hero.items[a][b]<=0){delete core.status.hero.items[a][b]}core.updateStatusBar();return true};items.prototype.getEquipTypeByName=function(b){var c=core.status.globalAttribute.equipName;var d=[];for(var a=0;a<c.length;++a){if(c[a]===b){d.push(a);if(!core.status.hero.equipment[a]){return a}}}return d.length==1?d[0]:-1};items.prototype.getEquipTypeById=function(a){var b=core.material.items[a].equip.type;if(typeof b=="string"){b=this.getEquipTypeByName(b)}return b};items.prototype.canEquip=function(equipId,hint){var equip=core.material.items[equipId]||{};if(!equip.equip){if(hint){core.playSound("操作失败");core.drawTip("不合法的装备!")}return false}if(!core.hasItem(equipId)&&!core.hasEquip(equipId)){if(hint){core.playSound("操作失败");core.drawTip("你当前没有"+equip.name+",无法换装")}return false}var canUseItemEffect=core.material.items[equipId].canUseItemEffect;if(canUseItemEffect){try{if(!eval(canUseItemEffect)){if(hint){core.playSound("操作失败");core.drawTip("当前不可换上"+equip.name)}return false}}catch(e){console.log(e);return false}}return true};items.prototype.loadEquip=function(b,a){if(!this.canEquip(b,true)){if(a){a()}return}var c=core.material.items[b]||{};var d=this.getEquipTypeById(b);if(d<0){core.playSound("操作失败");core.drawTip("当前没有"+c.equip.type+"的空位!");if(a){a()}return}this._realLoadEquip(d,b,core.status.hero.equipment[d],a)};items.prototype.unloadEquip=function(b,a){var c=core.status.hero.equipment[b];if(!c){if(a){a()}return}this._realLoadEquip(b,null,c,a)};items.prototype.compareEquipment=function(c,b){var g={value:{},percentage:{}};var d=core.material.items[c],h=core.material.items[b];for(var f in g){for(var e in core.status.hero){if(typeof core.status.hero[e]=="number"){var a=0;if(d){a+=((d.equip||{})[f]||{})[e]||0}if(h){a-=((h.equip||{})[f]||{})[e]||0}if(a!=0){g[f][e]=a}}}}return g};items.prototype._loadEquipEffect=function(a,d){var c=core.compareEquipment(a,d);for(var b in c.percentage){core.addBuff(b,c.percentage[b]/100)}for(var b in c.value){core.status.hero[b]+=c.value[b]}};items.prototype._realLoadEquip=function(d,c,f,a){var b=core.material.items[c]||{},e=core.material.items[f]||{};this._realLoadEquip_playSound();this._loadEquipEffect(c,f);if(c){core.removeItem(c)}if(f){core.addItem(f)}core.status.hero.equipment[d]=c||null;if(c){core.drawTip("已装备上"+b.name,c)}else{if(f){core.drawTip("已卸下"+e.name,f)}}if(a){a()}};items.prototype._realLoadEquip_playSound=function(){if(core.hasFlag("__quickLoadEquip__")){return}core.stopSound();core.playSound("穿脱装备")};items.prototype.quickSaveEquip=function(a){var b=core.getFlag("saveEquips",[]);b[a]=core.clone(core.status.hero.equipment);core.setFlag("saveEquips",b);core.status.route.push("saveEquip:"+a);core.drawTip("已保存"+a+"号套装")};items.prototype.quickLoadEquip=function(d){var a=core.getFlag("saveEquips",[])[d];if(!a){core.playSound("操作失败");core.drawTip(d+"号套装不存在");return}var b=core.status.globalAttribute.equipName.length;for(var c=0;c<b;c++){var h=a[c];if(h&&!this.canEquip(h,true)){return}}core.status.route.push("loadEquip:"+d);core.setFlag("__quickLoadEquip__",true);var g=[];for(var c=0;c<b;c++){var e=core.status.hero.equipment[c];var f=a[c];if(e!=f){g.push(f||null);if(e){this.unloadEquip(c)}}}for(var c in g){var f=g[c];if(f){this.loadEquip(f)}}core.removeFlag("__quickLoadEquip__");this._realLoadEquip_playSound();core.drawTip("成功换上"+d+"号套装")};items.prototype.setEquip=function(b,j,d,i,e,f){var a=core.material.items[b];if(!a||a.cls!="equips"){return}var c=a.equip||{};if(!c[j]){c[j]={}}var h=core.clone(c);h[j][d]=core.events._updateValueByOperator(core.calValue(i,f),c[j][d],e);if(core.hasEquip(b)){var g="temp:"+b;core.material.items[g]={cls:"equips",equip:core.clone(h)};this._loadEquipEffect(g,b);delete core.material.items[g];core.updateStatusBar()}a.equip=core.clone(h);flags.equipInfo=flags.equipInfo||{};flags.equipInfo[b]=core.clone(h)};"use strict";function icons(){this._init()}icons.prototype._init=function(){this.icons=icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1;this.tilesetStartOffset=10000};icons.prototype.getIcons=function(){var a=core.clone(this.icons);a.hero.leftup=a.hero.leftdown=a.hero.left;a.hero.rightup=a.hero.rightdown=a.hero.right;return a};icons.prototype.getClsFromId=function(b){for(var a in core.material.icons){if(a!="hero"&&b in core.material.icons[a]){return a}}return null};icons.prototype.getAllIconIds=function(){if(this.allIconIds){return this.allIconIds}this.allIconIds=[];for(var a in this.icons){this.allIconIds=this.allIconIds.concat(Object.keys(this.icons[a]))}return this.allIconIds};icons.prototype._getAnimateFrames=function(a){if(a=="enemys"||a=="npcs"){return 2}if(a=="animates"||a=="enemy48"||a=="npc48"){return 4}return 1};icons.prototype.getTilesetOffset=function(c){if(typeof c=="string"){c=core.getIdOfThis(c);if(!/^X\d+$/.test(c)){return null}c=parseInt(c.substring(1))}else{if(typeof c!="number"){return null}}core.tilesets=core.tilesets||[];var f=this.tilesetStartOffset;for(var b in core.tilesets){var e=core.tilesets[b];var d=core.material.images.tilesets[e];var g=Math.floor(parseInt(d.getAttribute("_width"))/32),a=Math.floor(parseInt(d.getAttribute("_height"))/32);if(c>=f&&c<f+g*a){var h=(c-f)%g,j=parseInt((c-f)/g);return{image:e,x:h,y:j}}f+=this.tilesetStartOffset}return null};"use strict";function maps(){this._init()}maps.prototype._init=function(){this.blocksInfo=maps_90f36752_8815_4be8_b32b_d7fad1d0542e};maps.prototype._initFloors=function(a){if(!a){core.floorIds.forEach(function(b){core.maps._initFloors(b)});return}core.floors[a].width=core.floors[a].width||core.__SIZE__;core.floors[a].height=core.floors[a].height||core.__SIZE__;if(!core.floors[a].beforeBattle){core.floors[a].beforeBattle={}}if(!core.floors[a].cannotMoveIn){core.floors[a].cannotMoveIn={}}};maps.prototype._resetFloorImages=function(){for(var a in core.status.maps){(core.status.maps[a].images||[]).forEach(function(c){var b="__floorImg__"+a+"_"+c.x+"_"+c.y;if(core.getFlag(b)==null){if(c.disabled){core.setFlag(b,true)}}})}};maps.prototype._setHDCanvasSize=function(a,c,b){a.setTransform(1,0,0,1,0,0);if(c!=null){a.canvas.width=c*core.domStyle.ratio}if(b!=null){a.canvas.height=b*core.domStyle.ratio}a.scale(core.domStyle.ratio,core.domStyle.ratio);a.canvas.setAttribute("isHD",1)};maps.prototype.loadFloor=function(c,d){var b=core.floors[c];if(!d){d=core.cloneArray(b.map)}if(d instanceof Array){d={map:d}}if(!d.map){d.map=core.cloneArray(b.map)}var a={};var f=this._loadFloor_doNotCopy();for(var e in b){if(f.indexOf(e)==-1&&b[e]!=null){a[e]=core.clone(b[e])}}for(var e in d){if(f.indexOf(e)==-1&&d[e]!=null){a[e]=core.clone(d[e])}}a.map=d.map;if(main.mode=="editor"){this.extractBlocks(a)}return a};maps.prototype._loadFloor_doNotCopy=function(){return["firstArrive","eachArrive","blocks","parallelDo","map","bgmap","fgmap","events","changeFloor","beforeBattle","afterBattle","afterGetItem","afterOpenDoor","cannotMove","cannotMoveIn"]};maps.prototype.extractBlocks=function(b){b=b||core.status.floorId;if(typeof b=="string"){b=(core.status.maps||{})[b]}if(!b){return}if(b.blocks){return}if(b.deleted){b.blocks=[];return}var a=b.floorId;b.blocks=this._mapIntoBlocks(this.decompressMap(b.map,a),core.floors[a],a)};maps.prototype._mapIntoBlocks=function(g,c,d){var b=[];var k=core.floors[d].width;var h=core.floors[d].height;for(var e=0;e<h;e++){for(var f=0;f<k;f++){var l=(g[e]||[])[f]||0,a;if(main.mode=="editor"){if(!l){continue}a={x:f,y:e,id:l,event:this.getBlockByNumber(l).event}}else{a=this.initBlock(f,e,l,true,c)}if(a.id!=0||a.event.trigger){b.push(a)}}}return b};maps.prototype.extractBlocksForUI=function(l,d){if(!l||l.blocks){return}if(l.deleted){return l.blocks=[]}var f=l.floorId;var a=this.decompressMap(l.map,f);l.blocks=[];var e=core.floors[f];var n=e.width;var m=e.height;for(var g=0;g<m;g++){for(var k=0;k<n;k++){var o=(a[g]||[])[k]||0;if(!o||o==17){continue}var h=this.isMapBlockDisabled(f,k,g,d);if(h){continue}if(h==null){var b=(e.events||{})[k+","+g];if(b!=null&&b.enable===false){continue}}var p=this._getBlockOpacityFromFlag(f,k,g,d);if(p==null){var b=(e.events||{})[k+","+g];if(b!=null&&b.opacity!=null){p=b.opacity}}var c=this._getBlockFilterFromFlag(f,k,g,d);if(c==null){var b=(e.events||{})[k+","+g];if(b!=null&&b.filter!=null){c=core.clone(b.filter)}}l.blocks.push(Object.assign({},this.getBlockByNumber(o),{x:k,y:g,opacity:p,filter:c}))}}};maps.prototype.getNumberById=function(a){a=this.getIdOfThis(a);core.status.id2number=core.status.id2number||{};if(core.status.id2number[a]!=null){return core.status.id2number[a]}return core.status.id2number[a]=this._getNumberById(a)};maps.prototype._getNumberById=function(a){for(var b in this.blocksInfo){if((this.blocksInfo[b]||{}).id==a){return parseInt(b)||0}}if(/^X\d+$/.test(a)){if(core.icons.getTilesetOffset(a)){return parseInt(a.substring(1))}}if(a=="none"){return 0}if(a=="airwall"){return 17}return 0};maps.prototype.getBlockByNumber=function(a){core.status.number2Block=core.status.number2Block||{};if(core.status.number2Block[a]!=null){return core.status.number2Block[a]}return core.status.number2Block[a]=this.initBlock(null,null,a,true)};maps.prototype.getBlockById=function(a){return this.getBlockByNumber(this.getNumberById(a))};maps.prototype.getIdOfThis=function(a){if(a!="this"){return a}if(core.status.event.id!="action"){return a}if(!core.status.event.data||core.status.event.data.x==null||core.status.event.data.y==null){return a}return core.getBlockId(core.status.event.data.x,core.status.event.data.y)||a};maps.prototype.initBlock=function(j,k,h,a,f){var d=null;var i=null;var g=null;if(f!=null){d=this.isMapBlockDisabled(f.floorId,j,k);i=this._getBlockOpacityFromFlag(f.floorId,j,k);g=this._getBlockFilterFromFlag(f.floorId,j,k)}var b={x:j,y:k,id:h};if(d!=null){b.disable=d}if(i!=null){b.opacity=i}if(g!=null){b.filter=g}if(h==17){b.event={cls:"terrains",id:"airwall",cannotIn:["up","down","left","right"]}}else{if(h in this.blocksInfo){b.event=JSON.parse(JSON.stringify(this.blocksInfo[h]))}else{if(core.icons.getTilesetOffset(h)){b.event={cls:"tileset",id:"X"+h}}else{b.event={cls:"terrains",id:"none",noPass:false}}}}if(b.event.noPass==null){if(b.event.canPass==null){b.event.noPass=b.event.cls!="items"}else{b.event.noPass=!b.event.canPass}}delete b.event.canPass;if(b.event.cls.indexOf("enemy")==0){var e=core.material.enemys[b.event.id];if(e&&e.faceIds){b.event.faceIds=e.faceIds}}if(a){this._addInfo(b)}if(f){this._addEvent(b,j,k,(f.events||{})[j+","+k]);var c=(f.changeFloor||{})[j+","+k];if(c){this._addEvent(b,j,k,{trigger:"changeFloor",data:c})}}if(main.mode=="editor"){delete b.disable}return b};maps.prototype._addInfo=function(a){if(a.event.cls.indexOf("enemy")==0&&!a.event.trigger){a.event.trigger="battle"}if(a.event.cls=="items"&&!a.event.trigger){a.event.trigger="getItem"}if(a.event.animate==null){a.event.animate=core.icons._getAnimateFrames(a.event.cls)}a.event.height=32;if(a.event.cls=="enemy48"||a.event.cls=="npc48"){a.event.height=48}};maps.prototype._addEvent=function(a,d,e,b){if(!b){return}if(typeof b=="string"){b={data:[b]}}else{if(b instanceof Array){b={data:b}}}b.data=b.data||[];if(a.disable==null&&b.enable!=null){a.disable=!b.enable}if(a.opacity==null&&b.opacity!=null){a.opacity=b.opacity}if(a.filter==null&&b.filter!=null){a.filter=core.clone(b.filter)}if(b.animate===false){a.event.animate=1}for(var c in b){if(c!="enable"&&c!="animate"&&c!="opacity"&&c!="filter"&&b[c]!=null){a.event[c]=core.clone(b[c])}}if(!a.event.trigger){a.event.trigger="action"}};maps.prototype._initMaps=function(){var b=core.floorIds;var d={};for(var c=0;c<b.length;c++){var a=b[c];d[a]=this.loadFloor(a)}return d};maps.prototype.compressMap=function(c,a){var b=core.floors[a].map;if(core.utils.same(c,b)){return null}var e=core.floors[a].width;var d=core.floors[a].height;for(var f=0;f<d;f++){if(core.utils.same(c[f],b[f])){c[f]=0}else{for(var g=0;g<e;g++){if(c[f][g]===b[f][g]){c[f][g]=-1}}}}return c};maps.prototype._processInvalidMap=function(e,f,a){if(e.length==a&&e[0].length==f){return e}var d=[];for(var b=0;b<a;++b){d.push(Array(f).fill(0))}for(var c=0;c<a;++c){for(var b=0;b<f;++b){if(c<e.length&&b<e[c].length){d[c][b]=e[c][b]}}}return d};maps.prototype._getBlockOpacityFromFlag=function(c,e,f,b){if(b==null){b=(core.status.hero||{}).flags}if(b==null){return null}var a=b.__opacity__||{};c=c||core.status.floorId;if(!c){return null}if((b.__removed__||[]).indexOf(c)>=0){return null}var d=e+f*core.floors[c].width;return(a[c]||{})[d]};maps.prototype._getBlockFilterFromFlag=function(c,e,f,b){if(b==null){b=(core.status.hero||{}).flags}if(b==null){return null}var a=b.__filter__||{};c=c||core.status.floorId;if(!c){return null}if((b.__removed__||[]).indexOf(c)>=0){return null}var d=e+f*core.floors[c].width;return core.clone((a[c]||{})[d])};maps.prototype.setBlockOpacity=function(e,f,g,c){if(window.flags==null){return}c=c||core.status.floorId;if(!c){return}if(!window.flags.__opacity__){window.flags.__opacity__={}}if((window.flags.__removed__||[]).indexOf(c)>=0){return}var d=f+g*core.floors[c].width;var a=window.flags.__opacity__;if(!a[c]){a[c]={}}if(e==null){delete a[c][d]}else{a[c][d]=e}var b=core.getBlock(f,g,c,true);if(b!=null){b.opacity=e;if(c==core.status.floorId&&!b.disable){if(b.event.cls=="autotile"){core.redrawMap()}else{core.drawBlock(b);core.addGlobalAnimate(b)}}}};maps.prototype.setBlockFilter=function(c,f,g,d){if(window.flags==null){return}d=d||core.status.floorId;if(!d){return}if(!window.flags.__filter__){window.flags.__filter__={}}if((window.flags.__removed__||[]).indexOf(d)>=0){return}var e=f+g*core.floors[d].width;var a=window.flags.__filter__;if(!a[d]){a[d]={}}if(c==null){delete a[d][e]}else{if(!c.blur&&!c.hue&&!c.shadow&&!c.grayscale&&!c.invert){delete a[d][e]}else{a[d][e]=core.clone(c)}}var b=core.getBlock(f,g,d,true);if(b!=null){b.filter=core.clone(c);if(d==core.status.floorId&&!b.disable){if(b.event.cls=="autotile"){core.redrawMap()}else{core.drawBlock(b);core.addGlobalAnimate(b)}}}};maps.prototype.isMapBlockDisabled=function(c,e,f,b){if(b==null){b=(core.status.hero||{}).flags}if(b==null){return null}var a=b.__disabled__||{};c=c||core.status.floorId;if(!c){return null}if((b.__removed__||[]).indexOf(c)>=0){return null}var d=e+f*core.floors[c].width;if(!a[c]){return null}if(a[c][0].indexOf(d)>=0){return true}if(a[c][1].indexOf(d)>=0){return false}};maps.prototype.setMapBlockDisabled=function(c,e,f,b){if(window.flags==null){return}c=c||core.status.floorId;if(!c){return null}if(!window.flags.__disabled__){window.flags.__disabled__={}}if((window.flags.__removed__||[]).indexOf(c)>=0){return}var a=window.flags.__disabled__||{};if(!a[c]){a[c]=[[],[]]}var d=e+f*core.floors[c].width;a[c][0]=a[c][0].filter(function(g){return g!=d});a[c][1]=a[c][1].filter(function(g){return g!=d});if(b==null){return}if(b){a[c][0].push(d)}else{a[c][1].push(d)}};maps.prototype.decompressMap=function(c,a){var e=core.floors[a].width;var d=core.floors[a].height;var b=this._processInvalidMap(core.floors[a].map,e,d);if(!c){return core.cloneArray(b)}for(var f=0;f<d;f++){if(f>=c.length){c.push(0)}if(c[f]===0){c[f]=core.cloneArray(b[f])}else{for(var g=0;g<e;g++){if(g>=c[f].length){c[f].push(-1)}if(c[f][g]===-1){c[f][g]=b[f][g]}}}}return c};maps.prototype.saveMap=function(a){var e=core.status.maps;if(!a){var c={};for(var b in e){var f=this.saveMap(b);if(Object.keys(f).length>0){c[b]=f}}return c}if((flags.__removed__||[]).indexOf(a)>=0){return{}}var c=e[a];var g=this._compressFloorData(c,core.floors[a]);var d=this.compressMap(c.blocks?this._getMapArrayFromBlocks(c.blocks,c.width,c.height,true):c.map,a);if(d!=null){g.map=d}return g};maps.prototype._compressFloorData=function(c,a){var f={};var e=this._loadFloor_doNotCopy();for(var d in c){if(e.indexOf(d)==-1){var b=a[d];if(!core.utils.same(c[d],b)){f[d]=core.clone(c[d])}}}return f};maps.prototype.loadMap=function(a,c,b){if(!c){var d={};core.floorIds.forEach(function(e){if(core.inArray((b||{}).__removed__,e)){a[e]={deleted:true,canFlyTo:false,canFlyFrom:false,cannotViewMap:true}}d[e]=core.maps.loadFloor(e,a[e])});return d}return this.loadFloor(c,a[c])};maps.prototype.resizeMap=function(a){a=a||core.status.floorId;if(!a){return}core.bigmap.width=core.floors[a].width;core.bigmap.height=core.floors[a].height;core.bigmap.posX=core.bigmap.posY=0;core.bigmap.v2=core.bigmap.width*core.bigmap.height>core.bigmap.threshold;var c=core.bigmap.v2?core.__PIXELS__+64:core.bigmap.width*32;var b=core.bigmap.v2?core.__PIXELS__+64:core.bigmap.height*32;core.bigmap.canvas.forEach(function(d){if(core.domStyle.hdCanvas.indexOf(d)>=0){core.maps._setHDCanvasSize(core.canvas[d],c,b)}else{core.canvas[d].canvas.width=c;core.canvas[d].canvas.height=b}core.canvas[d].canvas.style.width=c*core.domStyle.scale+"px";core.canvas[d].canvas.style.height=b*core.domStyle.scale+"px";core.canvas[d].translate(core.bigmap.v2?32:0,core.bigmap.v2?32:0);if(main.mode==="editor"&&editor.isMobile){core.canvas[d].canvas.style.width=c/core.__PIXELS__*96+"vw";core.canvas[d].canvas.style.height=b/core.__PIXELS__*96+"vw"}})};maps.prototype.getMapArray=function(a,c){a=a||core.status.floorId;var b=core.status.maps[a];if(!b.blocks||!c){return b.map}return b.map=this._getMapArrayFromBlocks(b.blocks,b.width,b.height)};maps.prototype.getMapNumber=function(c,d,a,b){return this.getMapArray(a,b)[d][c]};maps.prototype._updateMapArray=function(b,d,e){b=b||core.status.floorId;var c=core.status.maps[b];if(!c.blocks){return}if(d==null||e==null){return this.getMapArray(b,true)}var a=this.getBlock(d,e,b,true);if(a==null||a.disable){c.map[e][d]=0}else{c.map[e][d]=a.id}};maps.prototype._getMapArrayFromBlocks=function(a,e,c,d){var b=[];for(var f=0;f<c;f++){b.push(Array(e).fill(0))}a.forEach(function(g){if(d||!g.disable){b[g.y][g.x]=g.id}});return b};maps.prototype.getMapBlocksObj=function(a,b){a=a||core.status.floorId;if(core.status.mapBlockObjs[a]&&!b){return core.status.mapBlockObjs[a]}var c={};core.extractBlocks(a);core.status.maps[a].blocks.forEach(function(d){c[d.x+","+d.y]=d});return core.status.mapBlockObjs[a]=c};maps.prototype._getBgFgMapArray=function(d,b,e){b=b||core.status.floorId;if(!b){return[]}var f=core.floors[b].width;var c=core.floors[b].height;if(!e&&core.status[d+"maps"][b]){return core.status[d+"maps"][b]}var a=(main.mode=="editor"&&!(window.editor&&editor.uievent&&editor.uievent.isOpen))?core.cloneArray(editor[d+"map"]):null;if(a==null){a=core.cloneArray(core.floors[b][d+"map"]||[])}for(var h=0;h<c;++h){if(a[h]==null){a[h]=Array(f).fill(0)}}(core.getFlag("__"+d+"v__",{})[b]||[]).forEach(function(i){a[i[1]][i[0]]=i[2]||0});(core.getFlag("__"+d+"d__",{})[b]||[]).forEach(function(i){a[i[1]][i[0]]=0});if(main.mode=="editor"){for(var g=0;g<f;g++){for(var h=0;h<c;h++){a[h][g]=a[h][g].idnum||a[h][g]||0}}}if(core.status[d+"maps"]){core.status[d+"maps"][b]=a}return a};maps.prototype.getBgMapArray=function(a){return this._getBgFgMapArray("bg",a)};maps.prototype.getFgMapArray=function(a){return this._getBgFgMapArray("fg",a)};maps.prototype._getBgFgNumber=function(b,c,d,a){if(c==null){c=core.getHeroLoc("x")}if(d==null){d=core.getHeroLoc("y")}return this._getBgFgMapArray(b,a)[d][c]};maps.prototype.getBgNumber=function(b,c,a){return this._getBgFgNumber("bg",b,c,a)};maps.prototype.getFgNumber=function(b,c,a){return this._getBgFgNumber("fg",b,c,a)};maps.prototype.generateMovableArray=function(e){e=e||core.status.floorId;if(!e){return null}var b=this._generateMovableArray_arrays(e);var j=core.floors[e].width,f=core.floors[e].height;var a=[];for(var k=0;k<j;++k){a[k]=Array(f).fill([])}var i=e==core.status.floorId&&core.bigmap.v2;var g=i?Math.max(0,core.bigmap.posX-core.bigmap.extend):0;var c=i?Math.min(j,core.bigmap.posX+core.__SIZE__+core.bigmap.extend+1):j;var h=i?Math.max(0,core.bigmap.posY-core.bigmap.extend):0;var d=i?Math.min(f,core.bigmap.posY+core.__SIZE__+core.bigmap.extend+1):f;for(var k=g;k<c;k++){for(var l=h;l<d;l++){a[k][l]=["left","down","up","right"].filter(function(m){return core.maps._canMoveHero_checkPoint(k,l,m,e,b)})}}return a};maps.prototype._generateMovableArray_arrays=function(a){return{bgArray:this.getBgMapArray(a),fgArray:this.getFgMapArray(a),eventArray:this.getMapArray(a)}};maps.prototype.canMoveHero=function(c,d,a,b){if(c==null){c=core.getHeroLoc("x")}if(d==null){d=core.getHeroLoc("y")}a=a||core.getHeroLoc("direction");return this._canMoveHero_checkPoint(c,d,a,b)};maps.prototype._canMoveHero_checkPoint=function(f,g,b,c,a){c=c||core.status.floorId;if(!c){return false}a=a||this._generateMovableArray_arrays(c);if(core.inArray((core.floors[c].cannotMove||{})[f+","+g],b)){return false}var d=f+core.utils.scan[b].x,e=g+core.utils.scan[b].y;if(d<0||e<0||d>=core.floors[c].width||e>=core.floors[c].height){return false}if(core.inArray((core.floors[c].cannotMoveIn||{})[d+","+e],core.turnDirection(":back",b))){return false}if(this._canMoveHero_checkCannotInOut(Object.keys(a).map(function(h){return a[h][g][f]}),"cannotOut",b)){return false}if(this._canMoveHero_checkCannotInOut(Object.keys(a).map(function(h){return a[h][e][d]}),"cannotIn",b)){return false}if(c==core.status.floorId&&!core.flags.canGoDeadZone&&!core.status.lockControl&&Math.max(core.status.hero.hp,1)<=((core.status.checkBlock.damage||{})[d+","+e]||0)&&a.eventArray[e][d]==0){return false}return true};maps.prototype._canMoveHero_checkCannotInOut=function(c,b,a){if(c instanceof Array){for(var d in c){if(this._canMoveHero_checkCannotInOut(c[d],b,a)){return true}}return false}if(b=="cannotIn"){a=core.turnDirection(":back",a)}return core.inArray((this.getBlockByNumber(c).event||{})[b],a)};maps.prototype.canMoveDirectly=function(a,b){return this.canMoveDirectlyArray([[a,b]])[0]};maps.prototype.canMoveDirectlyArray=function(f,b){var a=[],g=f.length;var c=core.getHeroLoc("x"),d=core.getHeroLoc("y");if(!this._canMoveDirectly_checkGlobal()){for(var e=0;e<g;++e){a.push(-1)}return a}for(var e=0;e<g;++e){if(f[e][0]==c&&f[e][1]==d){a.push(0);g--}else{if(f[e][0]<0||f[e][0]>=core.bigmap.width||f[e][1]<0||f[e][1]>=core.bigmap.height){a.push(-1);g--}else{a.push(null)}}}if(g==0){return a}if(!this._canMoveDirectly_checkStartPoint(c,d)){for(var e in a){if(a[e]==null){a[e]=-1}}return a}return this._canMoveDirectly_bfs(c,d,f,g,a,b)};maps.prototype._canMoveDirectly_checkGlobal=function(){if(!core.flags.enableMoveDirectly){return false}if(core.status.thisMap.cannotMoveDirectly){return false}if(core.hasFlag("cannotMoveDirectly")){return false}return true};maps.prototype._canMoveDirectly_checkStartPoint=function(b,c){if(core.status.checkBlock.damage[b+","+c]){return false}var a=core.getBlock(b,c);if(a!=null){return a.event.trigger=="changeFloor"}return true};maps.prototype._canMoveDirectly_bfs=function(p,q,h,l,a,e){e=e||this.generateMovableArray();var d=this.getMapBlocksObj();var b=this.getBgMapArray();var r=[],o=[];r[p+","+q]=0;o.push(p+","+q);while(o.length>0){var k=o.shift().split(","),s=parseInt(k[0]),t=parseInt(k[1]);for(var f in core.utils.scan){if(!core.inArray(e[s][t],f)){continue}var m=s+core.utils.scan[f].x,n=t+core.utils.scan[f].y,j=m+","+n;if(r[j]){continue}if(core.onSki(b[n][m])){continue}if(!this._canMoveDirectly_checkNextPoint(d,m,n)){continue}r[j]=r[k]+1;for(var g in a){if(h[g][0]==m&&h[g][1]==n&&a[g]==null){var c=d[m+","+n];if(c&&!c.disable&&c.event.trigger){a[g]=-1}else{a[g]=r[j]}l--;if(l==0){return a}}}o.push(j)}}for(var g in a){if(a[g]==null){a[g]=-1}}return a};maps.prototype._canMoveDirectly_checkNextPoint=function(b,e,f){var d=e+","+f;var a=b[d];if(a&&!a.disable&&(a.event.noPass||a.event.script||a.event.event)){return false}if(a&&!a.disable&&a.event.trigger){if(a.event.trigger!="changeFloor"){return false}var c=core.flags.ignoreChangeFloor;if(a.event.data&&a.event.data.ignoreChangeFloor!=null){c=a.event.data.ignoreChangeFloor}if(!c){return false}}if(core.status.checkBlock.damage[d]){return false}if(core.status.checkBlock.repulse[d]){return false}if(core.status.checkBlock.ambush[d]){return false}return true};maps.prototype.automaticRoute=function(b,c){var h=core.getHeroLoc("x"),i=core.getHeroLoc("y");if(b==h&&c==i){return[]}var g=this._automaticRoute_bfs(h,i,b,c);if(g[b+","+c]==null){return[]}var a=[],e=b,f=c;while(e!=h||f!=i){var d=g[e+","+f];a.push({direction:d,x:e,y:f});e-=core.utils.scan[d].x;f-=core.utils.scan[d].y}a.reverse();return a};maps.prototype._automaticRoute_bfs=function(n,o,e,f){var m={},b=this.generateMovableArray();var l=new PriorityQueue({comparator:function(p,q){return p.depth-q.depth}});m[n+","+o]="";l.queue({depth:0,x:n,y:o});var a=core.getMapBlocksObj();while(l.length!=0){var c=l.dequeue(),d=c.depth,h=c.x,i=c.y;for(var g in core.utils.scan){if(!core.inArray(b[h][i],g)){continue}var j=h+core.utils.scan[g].x;var k=i+core.utils.scan[g].y;if(j<0||j>=core.bigmap.width||k<0||k>=core.bigmap.height||m[j+","+k]!=null){continue}if(j==e&&k==f){m[j+","+k]=g;break}if(core.noPass(j,k)){continue}m[j+","+k]=g;l.queue({depth:d+this._automaticRoute_deepAdd(j,k,a),x:j,y:k})}if(m[e+","+f]!=null){break}}return m};maps.prototype._automaticRoute_deepAdd=function(e,f,b){var c=1;var a=b[e+","+f];if(a&&!a.disable){var d=a.event.id;if(d=="light"){c+=100}if(d.endsWith("Net")&&!core.hasFlag(d.substring(0,d.length-3))){c+=100}if(core.hasFlag("__potionNoRouting__")&&(d.endsWith("Potion")||d=="greenGem")){c+=100}}c+=(core.status.checkBlock.damage[e+","+f]||0)*100;if(core.status.checkBlock.ambush[e+","+f]){c+=1000}return c};maps.prototype._getBigImageInfo=function(b,e,a){e=e||"down";if(["up","down","left","right"].indexOf(e)<0){e="down"}var g=b.width/4;var f=b.height/4;var h=a*g,i;if(f<=g/2){f=b.height;i=0}else{i=core.material.icons.hero[e].loc*f}var c,d;switch(e){case"down":case"up":case"left":case"right":c=16-g/2;d=32-f;break}return{sx:h,sy:i,per_width:g,per_height:f,face:e,dx:c,dy:d}};maps.prototype.drawBlock=function(b,a,d){if(b.event.id=="none"){return}var g=a!=null;if(!g){a=0}var h=b.x,i=b.y;if(core.bigmap.v2){var e=core.bigmap.posX,f=core.bigmap.posY;if(h<e-1||i<f-1||h>e+core.__SIZE__||i>f+core.__SIZE__+1){return}}else{if(g&&b.event.animate>1&&(32*h<core.bigmap.offsetX-64||32*h>core.bigmap.offsetX+core.__PIXELS__+32||32*i<core.bigmap.offsetY-64||32*i>core.bigmap.offsetY+core.__PIXELS__+32+16)){return}}var c=this.getBlockInfo(b);if(c==null){return}if(c.cls!="tileset"){c.posX=a%c.animate}c.opacity=b.opacity;c.filter=b.filter;if(!b.name){this._drawBlockInfo(c,b.x,b.y,d)}else{this._drawBlockInfo_bgfg(c,b.name,b.x,b.y,d)}};maps.prototype._drawBlockInfo_bigImage=function(c,o,p,e){var b=this._getBigImageInfo(c.bigImage,c.face,c.posX);var j=b.per_width,i=b.per_height,m=b.sx,n=b.sy;var a=c.bigImage;if(main.mode=="editor"){var k=32*o-32*core.bigmap.posX;var l=32*p-32*core.bigmap.posY;if(e==null){e="event"}core.clearMap(e,k,l,32,32);core.drawImage(e,a,m,n,j,i,k,l,32,32);return}var k=32*o-core.bigmap.offsetX;var l=32*p-core.bigmap.offsetY;var h="_bigImage_header_"+o+"_"+p;var d="_bigImage_body_"+o+"_"+p;var f=b.dx,g=b.dy;switch(b.face){case"down":case"up":case"left":case"right":core.createCanvas(h,k+f,l+g,j,-g,51);this._drawBlockInfo_drawWithFilter(c,h,function(){core.drawImage(h,a,m,n,j,-g,0,0,j,-g)});core.createCanvas(d,k+f,l,j,32,31);this._drawBlockInfo_drawWithFilter(c,d,function(){core.drawImage(d,a,m,n-g,j,32,0,0,j,32)});break}if(core.dymCanvas[h]){core.dymCanvas[h].canvas.setAttribute("_ox",32*o+f);core.dymCanvas[h].canvas.setAttribute("_oy",32*p+g)}if(core.dymCanvas[d]){core.dymCanvas[d].canvas.setAttribute("_ox",32*o+f);core.dymCanvas[d].canvas.setAttribute("_oy",32*p)}};maps.prototype._drawBlockInfo_drawWithFilter=function(b,c,d){var a=null;if(b.opacity!=null){a=core.setAlpha(c,b.opacity)}core.setFilter(c,b.filter);d();core.setFilter(c,null);if(a!=null){core.setAlpha(c,a)}};maps.prototype._drawBlockInfo=function(a,i,j,b){if(a.bigImage){return this._drawBlockInfo_bigImage(a,i,j,b)}var d=a.image,e=a.posX,f=a.posY,c=a.height;var g=32*i-32*core.bigmap.posX;var h=32*j-32*core.bigmap.posY;if(b==null){b="event"}this._drawBlockInfo_drawWithFilter(a,b,function(){core.clearMap(b,g,h,32,32);core.drawImage(b,d,e*32,f*c+c-32,32,32,g,h,32,32)});if(c>32){this._drawBlockInfo_drawWithFilter(a,"event2",function(){core.clearMap("event2",g,h+32-c,32,c-32);core.drawImage("event2",d,e*32,f*c,32,c-32,g,h+32-c,32,c-32)})}};maps.prototype._drawBlockInfo_bgfg=function(b,f,k,l,c){var e=b.image,g=b.posX,h=b.posY,d=b.height;var i=32*k-32*core.bigmap.posX;var j=32*l-32*core.bigmap.posY;if(c==null){c=f}core.clearMap(c,i,j+32-d,32,d);if(f=="bg"){if(d>32){core.clearMap(c,i,j-32,32,32);core.drawImage(c,core.material.groundCanvas.canvas,i,j-32)}core.drawImage(c,core.material.groundCanvas.canvas,i,j)}var a=null;if(b.opacity!=null){a=core.setAlpha(c,b.opacity)}else{if(f=="fg"&&this._drawBlockInfo_shouldBlurFg(k,l)){a=core.setAlpha(c,0.6)}}core.setFilter(c,b.filter);core.drawImage(c,e,g*32,h*d,32,d,i,j+32-d,32,d);core.setFilter(c,null);if(a!=null){core.setAlpha(c,a)}};maps.prototype._drawBlockInfo_shouldBlurFg=function(b,c){if(main.mode=="play"&&!core.flags.blurFg){return false}var a=this.getBlock(b,c);if(a==null||a.id==0){return false}if(a.event.cls=="autotile"||a.event.cls=="tileset"){return a.event.script||a.event.event}return true};maps.prototype.generateGroundPattern=function(a){var b=((core.status.maps||core.floors)[a||core.status.floorId]||{}).defaultGround||"ground";var c=core.getBlockInfo(b);if(c==null){return}core.material.groundCanvas.clearRect(0,0,32,32);core.material.groundCanvas.drawImage(c.image,32*c.posX,c.height*c.posY,32,32,0,0,32,32);core.material.groundPattern=core.material.groundCanvas.createPattern(core.material.groundCanvas.canvas,"repeat")};maps.prototype.drawMap=function(a){a=a||core.status.floorId;if(!a){return}core.clearMap("all");this.generateGroundPattern(a);core.status.floorId=a;core.extractBlocks(a);core.status.thisMap=core.status.maps[a];this._drawMap_drawAll();if(core.status.curtainColor){core.fillRect("curtain",0,0,core.__PIXELS__,core.__PIXELS__,core.arrayToRGBA(core.status.curtainColor))}core.drawHero();core.updateStatusBar()};maps.prototype.redrawMap=function(){core.bigmap.canvas.forEach(function(a){core.clearMap(a)});this._drawMap_drawAll(null,{redraw:true});core.drawDamage()};maps.prototype._drawMap_drawAll=function(b,a){b=b||core.status.floorId;this.drawBg(b,a);this.drawEvents(b);this.drawFg(b,a)};maps.prototype._drawMap_drawBlockInfo=function(f,c,d,b,e){if(d==null){return}var h=e.onMap;if(h&&core.bigmap.v2){var i=core.bigmap.posX,j=core.bigmap.posY;if(c.x<i-1||c.y<j-1||c.x>i+core.__SIZE__||c.y>j+core.__SIZE__+1){return}}if(d.cls=="autotile"){var a=null;if(c.opacity!=null){a=core.setAlpha(f,c.opacity)}core.setFilter(f,c.filter);this._drawAutotile(f,b,c,32,0,0,0,h);core.setFilter(f,null);if(a!=null){core.setAlpha(f,a)}if(h){this.addGlobalAnimate(c)}return}if(!h){var g=d.height;if(d.bigImage){e.postDraw.push(function(){var k=core.maps._getBigImageInfo(d.bigImage,d.face,0);var m=k.per_width,l=k.per_height;core.maps._drawBlockInfo_drawWithFilter(c,f,function(){core.drawImage(f,d.bigImage,k.sx,k.sy,m,l,32*c.x+k.dx,32*c.y+k.dy,m,l)})});return}this._drawBlockInfo_drawWithFilter(c,f,function(){core.drawImage(f,d.image,32*d.posX,g*d.posY,32,g,32*c.x,32*c.y+32-g,32,g)});return}this.drawBlock(c,null,f);this.addGlobalAnimate(c)};maps.prototype.drawBg=function(c,b){c=c||core.status.floorId;if(b==null){b={}}if(typeof b=="string"||b.canvas){b={ctx:b}}b=Object.assign({},b);if(b.ctx==null){b.onMap=true;b.ctx="bg";core.clearMap("bg");core.status.floorAnimateObjs=this._getFloorImages(c)}var d=core.getContextByName(b.ctx);if(!d){return}var a=d;if(b.onMap){a=core.bigmap.cacheCanvas;a.canvas.width=d.canvas.width;a.canvas.height=d.canvas.height;if(core.bigmap.v2){a.translate(32,32)}}this._drawBg_draw(c,d,a,b);if(b.onMap){a.translate(0,0)}};maps.prototype._drawBg_draw=function(c,d,a,b){b.ctx=a;core.maps._drawBg_drawBackground(c,b);core.maps._drawFloorImages(c,b.ctx,"bg",null,null,b.onMap);core.maps._drawBgFgMap(c,"bg",b);if(b.onMap){core.drawImage(d,a.canvas,core.bigmap.v2?-32:0,core.bigmap.v2?-32:0)}b.ctx=d};maps.prototype._drawBg_drawBackground=function(d,a){var e=(core.status.maps||core.floors)[d].defaultGround||"ground";var f=core.getBlockInfo(e);var g=a.onMap;if(f!=null){var j=g&&core.bigmap.v2?-1:0;var b=g&&core.bigmap.v2?core.__SIZE__+1:core.floors[d].width;var c=g&&core.bigmap.v2?core.__SIZE__+1:core.floors[d].height;var h=document.createElement("canvas");h.width=h.height=32;var i=h.getContext("2d");core.drawImage(i,f.image,32*f.posX,f.height*f.posY,32,32,0,0,32,32);core.fillRect(a.ctx,32*j,32*j,32*(b-j),32*(c-j),i.createPattern(h,"repeat"))}};maps.prototype.drawEvents=function(e,b,d){e=e||core.status.floorId;if(d==null){d={}}if(typeof d=="string"||d.canvas){d={ctx:d}}d=Object.assign({},d);if(d.ctx==null){d.onMap=true;d.ctx="event";core.clearMap("event");core.clearMap("event2")}var f=core.getContextByName(d.ctx);if(!f){return}var c=f;if(d.onMap){c=core.bigmap.cacheCanvas;c.canvas.width=f.canvas.width;c.canvas.height=f.canvas.height;if(core.bigmap.v2){c.translate(32,32)}}var a=null;if(!b){core.extractBlocks(e);b=core.status.maps[e].blocks;a=this.getMapArray(e,!d.redraw)}else{a=this._getMapArrayFromBlocks(b,core.floors[e].width,core.floors[e].height)}d.postDraw=[];b.filter(function(g){if(d.onMap&&core.bigmap.v2){var h=core.bigmap.posX,i=core.bigmap.posY;if(g.x<h-1||g.y<i-1||g.x>h+core.__SIZE__||g.y>i+core.__SIZE__+1){return false}}return g.event&&!g.disable}).forEach(function(g){core.maps._drawMap_drawBlockInfo(c,g,core.maps.getBlockInfo(g),a,d)});d.postDraw.forEach(function(g){g()});delete d.postDraw;if(d.onMap){core.drawImage(f,c.canvas,core.bigmap.v2?-32:0,core.bigmap.v2?-32:0);c.translate(0,0)}};maps.prototype.drawFg=function(c,b){c=c||core.status.floorId;if(b==null){b={}}if(typeof b=="string"||b.canvas){b={ctx:b}}b=Object.assign({},b);if(b.ctx==null){b.onMap=true;b.ctx="fg";core.clearMap("fg")}var d=core.getContextByName(b.ctx);if(!d){return}var a=d;if(b.onMap){a=core.bigmap.cacheCanvas;a.canvas.width=d.canvas.width;a.canvas.height=d.canvas.height;if(core.bigmap.v2){a.translate(32,32)}}this._drawFg_draw(c,d,a,b);if(b.onMap){a.translate(0,0)}};maps.prototype._drawFg_draw=function(c,d,a,b){b.ctx=a;core.maps._drawFloorImages(c,b.ctx,"fg",null,null,b.onMap);core.maps._drawBgFgMap(c,"fg",b);if(b.onMap){core.drawImage(d,a.canvas,core.bigmap.v2?-32:0,core.bigmap.v2?-32:0)}b.ctx=d};maps.prototype._drawBgFgMap=function(g,i,d){g=g||core.status.floorId;if(!g){return}var l=core.floors[g].width;var h=core.floors[g].height;if(!core.status[i+"maps"]){core.status[i+"maps"]={}}var j=d.onMap&&core.bigmap.v2?Math.max(0,core.bigmap.posX-1):0;var e=d.onMap&&core.bigmap.v2?Math.min(l,core.bigmap.posX+core.__SIZE__+1):l;var k=d.onMap&&core.bigmap.v2?Math.max(0,core.bigmap.posY-1):0;var f=d.onMap&&core.bigmap.v2?Math.min(h,core.bigmap.posY+core.__SIZE__+2):h;var a=this._getBgFgMapArray(i,g,!d.redraw);d.postDraw=[];for(var m=j;m<e;m++){for(var n=k;n<f;n++){if(a[n][m]==0){continue}var b=this.initBlock(m,n,a[n][m],true);b.name=i;var c=this.getBlockInfo(b);if(!c){continue}this._drawMap_drawBlockInfo(d.ctx,b,c,a,d)}}d.postDraw.forEach(function(o){o()});delete d.postDraw};maps.prototype._drawFloorImages=function(c,a,e,d,b,f){c=c||core.status.floorId;if(!d){d=this._getFloorImages(c)}var g=b!=null;d.forEach(function(k){var j=core.material.images.images[core.getMappedName(k.name)];var i=k.frame||1;if(!j){return}var h="__floorImg__"+c+"_"+k.x+"_"+k.y;if(core.hasFlag(h)){return}if(g&&i==1){return}if(/.*\.gif/i.test(k.name)){if(g){return}this._drawFloorImages_gif(j,k.x,k.y);return}this._drawFloorImage(a,e,k,j,b,f)},this)};maps.prototype._getFloorImages=function(a){return((core.status.maps||core.floors)[a||core.status.floorId]||{}).images||[]};maps.prototype._drawFloorImages_gif=function(d,a,b){core.dom.gif.innerHTML="";var c=new Image();c.src=d.src;c.style.position="absolute";c.style.left=(a*core.domStyle.scale)+"px";c.style.top=(b*core.domStyle.scale)+"px";c.style.width=d.width*core.domStyle.scale+"px";c.style.height=d.height*core.domStyle.scale+"px";core.dom.gif.appendChild(c);return};maps.prototype._drawFloorImage=function(a,f,g,d,b,h){var c=d.height;var e=g.name+(g.reverse||"");var k=parseInt((g.w==null?d.width:g.w)/(g.frame||1));var c=g.h==null?d.height:g.h;var i=(g.sx||0)+(b||0)%(g.frame||1)*k;var j=g.sy||0;var l=g.x||0,m=g.y||0;if(h&&core.bigmap.v2){if(l>32*core.bigmap.posX+core.__PIXELS__+32||l+k<32*core.bigmap.posX-32||m>32*core.bigmap.posX+core.__PIXELS__+32||m+c<32*core.bigmap.posY-32){return}l-=32*core.bigmap.posX;m-=32*core.bigmap.posY}if(g.canvas!="auto"&&g.canvas!=f){return}if(g.canvas!="auto"){if(b!=null){core.clearMap(a,l,m,k,c)}core.drawImage(a,e,i,j,k,c,l,m,k,c)}else{if(f=="bg"){if(b!=null){core.clearMap(a,l,m+c-32,k,32)}core.drawImage(a,e,i,j+c-32,k,32,l,m+c-32,k,32)}else{if(f=="fg"){if(b!=null){core.clearMap(a,l,m,k,c-32)}core.drawImage(a,e,i,j,k,c-32,l,m,k,c-32)}}}};maps.prototype._drawAutotile=function(d,i,c,k,h,m,l,j){var n=c.x,o=c.y;var b=core.material.images.autotile[c.event.id];l=l||0;l%=parseInt(b.width/96);var e={};var g=function(p,q){if(core.maps._drawAutotile_getAutotileAroundId(i[o][n],p,q,i)){return 1}else{return 0}};var f=[];[-1,0,1].forEach(function(p){f[p]=[];[-1,0,1].forEach(function(q){f[p][q]=g(n+p,o+q)})});if(f[-1][-1]+f[0][-1]+f[0][0]+f[-1][0]==3&&!f[-1][-1]){this._drawAutotile_render(d,n*k+h,o*k+m,k,b,l,16,null,j);e[0]=true}if(f[0][-1]+f[1][-1]+f[1][0]+f[0][0]==3&&!f[1][-1]){this._drawAutotile_render(d,n*k+h+k/2,o*k+m,k,b,l,17,null,j);e[1]=true}if(f[0][0]+f[1][0]+f[1][1]+f[0][1]==3&&!f[1][1]){this._drawAutotile_render(d,n*k+h+k/2,o*k+m+k/2,k,b,l,18,null,j);e[3]=true}if(f[0-1][0]+f[0][0]+f[0][1]+f[-1][1]==3&&!f[-1][1]){this._drawAutotile_render(d,n*k+h,o*k+m+k/2,k,b,l,19,null,j);e[2]=true}var a=f[0][-1]+2*f[-1][0]+4*f[0][1]+8*f[1][0];this._drawAutotile_render(d,n*k,o*k,k,b,l,a,e,j)};maps.prototype._drawAutotile_render=function(b,j,k,h,a,i,e,d,g){if(g){j-=32*core.bigmap.posX;k-=32*core.bigmap.posY}var f=[[[96*i,0,32,32,j,k,h,h],],[[96*i,3*32,16,32,j,k,h/2,h],[96*i+2*32+16,3*32,16,32,j+h/2,k,h/2,h],],[[96*i+2*32,32,32,16,j,k,h,h/2],[96*i+2*32,3*32+16,32,16,j,k+h/2,h,h/2],],[[96*i+2*32,3*32,32,32,j,k,h,h],],[[96*i,32,16,32,j,k,h/2,h],[96*i+2*32+16,32,16,32,j+h/2,k,h/2,h],],[[96*i,2*32,16,32,j,k,h/2,h],[96*i+2*32+16,2*32,16,32,j+h/2,k,h/2,h],],[[96*i+2*32,32,32,32,j,k,h,h],],[[96*i+2*32,2*32,32,32,j,k,h,h],],[[96*i,32,32,16,j,k,h,h/2],[96*i,3*32+16,32,16,j,k+h/2,h,h/2],],[[96*i,3*32,32,32,j,k,h,h],],[[96*i+32,32,32,16,j,k,h,h/2],[96*i+32,3*32+16,32,16,j,k+h/2,h,h/2],],[[96*i+32,3*32,32,32,j,k,h,h],],[[96*i,32,32,32,j,k,h,h],],[[96*i,2*32,32,32,j,k,h,h],],[[96*i+32,32,32,32,j,k,h,h],],[[96*i+32,2*32,32,32,j,k,h,h],],[[96*i+2*32,0,16,16,j,k,h/2,h/2],],[[96*i+2*32+16,0,16,16,j,k,h/2,h/2],],[[96*i+2*32+16,16,16,16,j,k,h/2,h/2],],[[96*i+2*32,16,16,16,j,k,h/2,h/2],],];var c=f[e];if(e>=16){core.drawImage(b,a,c[0][0],c[0][1],c[0][2],c[0][3],c[0][4],c[0][5],h/2,h/2)}else{this._drawAutotile_renderCut(b,a,j,k,h,c,d)}};maps.prototype._drawAutotile_renderCut=function(b,a,l,m,k,d,e){var f=[];e=e||{};if(d.length==2){var j=0;var c=0;for(var h in d){if(d[h][2]%32){c=0}else{if(d[h][3]%32){c=1}}if(d[h][0]%32||d[h][1]%32){j=1}else{j=0}if(c){j*=2;if(!e[j]){f[j]=[d[h][0],d[h][1]]}if(!e[j+1]){f[j+1]=[parseInt(d[h][0])+16,d[h][1]]}}else{if(!e[j]){f[j]=[d[h][0],d[h][1]]}if(!e[j+2]){f[j+2]=[d[h][0],parseInt(d[h][1])+16]}}}}else{if(!e[0]){f[0]=[d[0][0],d[0][1]]}if(!e[1]){f[1]=[d[0][0]+16,d[0][1]]}if(!e[2]){f[2]=[d[0][0],d[0][1]+16]}if(!e[3]){f[3]=[d[0][0]+16,d[0][1]+16]}}for(var h=0;h<4;h++){var g=f[h];if(!g){continue}core.drawImage(b,a,g[0],g[1],16,16,l+(h%2)*k/2,m+parseInt(h/2)*k/2,k/2,k/2)}};maps.prototype._drawAutotile_drawBlockByIndex=function(b,c,d,a,e,f,g){var h=16*((e-1)%6),i=16*(~~((e-1)/6));g=g||0;g%=parseInt(a.width/96);core.drawImage(b,a,h+96*g,i,16,16,c,d,f/2,f/2)};maps.prototype._drawAutotile_getAutotileAroundId=function(a,c,d,b){if(c<0||d<0||c>=b[0].length||d>=b.length){return 1}else{return(core.material.autotileEdges[a]||[]).indexOf(b[d][c])>=0}};maps.prototype._drawAutotile_checkAround=function(o,p,g){var d=g[p][o];var n=[];for(var e=0;e<4;e++){var c=0;var l=e%2,m=~~(e/2);for(var f=0;f<4;f++){var h=f%2,k=~~(f/2);var a=this._drawAutotile_getAutotileAroundId(d,o+l+h-1,p+m+k-1,g);c+=a*(Math.pow(2,3-f))}n.push(c)}return n};maps.prototype._drawAutotile_getAutotileIndexs=function(g,h,e,d){var c=[];var f=this._drawAutotile_checkAround(g,h,e);for(var b=0;b<4;b++){var a=d[f[b]];c.push(a[3-b])}return c};maps.prototype._drawAutotileAnimate=function(c,b){var g=c.x,h=c.y;if(core.bigmap.v2){var e=core.bigmap.posX,f=core.bigmap.posY;if(g<e-1||h<f-1||g>e+core.__SIZE__||h>f+core.__SIZE__){return}}else{if(32*g<core.bigmap.offsetX-64||32*g>core.bigmap.offsetX+core.__PIXELS__+32||32*h<core.bigmap.offsetY-64||32*h>core.bigmap.offsetY+core.__PIXELS__+32+16){return}}var d=c.name?core.canvas[c.name]:core.canvas.event;d.clearRect(32*g-32*core.bigmap.posX,32*h-32*core.bigmap.posY,32,32);var a=null;if(c.opacity!=null){a=core.setAlpha(d,c.opacity)}core.setFilter(d,c.filter);if(c.name){if(c.name=="bg"){core.drawImage("bg",core.material.groundCanvas.canvas,32*g-32*core.bigmap.posX,32*h-32*core.bigmap.posY)}this._drawAutotile(d,this._getBgFgMapArray(c.name),c,32,0,0,b,true)}else{this._drawAutotile(d,this.getMapArray(),c,32,0,0,b,true)}core.setFilter(d,null);if(a!=null){core.setAlpha(d,a)}};maps.prototype._makeAutotileEdges=function(){var a=Object.keys(core.material.images.autotile);core.material.autotileEdges={};var b=document.createElement("canvas"),c=b.getContext("2d");b.width=b.height=32;c.mozImageSmoothingEnabled=false;c.webkitImageSmoothingEnabled=false;c.msImageSmoothingEnabled=false;c.imageSmoothingEnabled=false;var d={},g={};a.forEach(function(i){var h=core.maps.getNumberById(i);core.clearMap(c,0,0,32,32);core.drawImage(c,core.material.images.autotile[i],0,0,32,32,0,0,32,32);d[h]=b.toDataURL("image/png");core.clearMap(c,0,0,32,32);core.drawImage(c,core.material.images.autotile[i],32,0,32,32,0,0,32,32);g[h]=b.toDataURL("image/png")});for(var e in d){e=parseInt(e);core.material.autotileEdges[e]=[e];for(var f in g){f=parseInt(f);if(e==f){continue}if(d[e]==g[f]){core.material.autotileEdges[e].push(f)}}}};maps.prototype.drawThumbnail=function(c,a,d){c=c||core.status.floorId;if(!c){return}d=d||{};if(typeof d=="string"||d.canvas){d={ctx:d}}var b=d.ctx;this._drawThumbnail_drawTempCanvas(c,a,d);d.ctx=b;this._drawThumbnail_drawToTarget(c,d)};maps.prototype._drawThumbnail_drawTempCanvas=function(e,a,j){var m=core.floors[e].width;var g=core.floors[e].height;var l=core.bigmap.tempCanvas;if(j.all){var k=Math.max(core.__SIZE__/m,core.__SIZE__/g);l.canvas.width=m*32*k;l.canvas.height=g*32*k;l.scale(k,k)}else{if(m*g>core.bigmap.threshold){j.v2=true;l.canvas.width=core.__PIXELS__;l.canvas.height=core.__PIXELS__;var b=j.centerX,c=j.centerY;if(b==null){b=Math.floor(m/2)}if(c==null){c=Math.floor(g/2)}var h=core.clamp(b-core.__HALF_SIZE__,0,m-core.__SIZE__),i=core.clamp(c-core.__HALF_SIZE__,0,g-core.__SIZE__);l.translate(-32*h,-32*i)}else{j.v2=false;l.canvas.width=m*32;l.canvas.height=g*32}}j.ctx=l;if(m*g>core.bigmap.threshold){j.damage=false}var f=core.status.hero!=null,d=null;if(j.flags){if(!f){core.status.hero={}}d=core.status.hero.flags;core.status.hero.flags=j.flags}this._drawThumbnail_realDrawTempCanvas(e,a,j);if(!f){delete core.status.hero}else{if(d!=null){core.status.hero.flags=d}}l.setTransform(1,0,0,1,0,0)};maps.prototype._drawThumbnail_realDrawTempCanvas=function(b,a,e){this.drawBg(b,e);this.drawEvents(b,a,e);if(e.heroLoc){e.heroIcon=e.heroIcon||core.status.hero.image||"hero.png";e.heroIcon=core.getMappedName(e.heroIcon);var d=core.material.icons.hero[e.heroLoc.direction];var c=core.material.images.images[e.heroIcon].height/4;var f=(core.material.images.images[e.heroIcon].width||128)/4;core.drawImage(e.ctx,core.material.images.images[e.heroIcon],d.stop*f,d.loc*c,f,c,32*e.heroLoc.x+32-f,32*e.heroLoc.y+32-c,f,c)}this.drawFg(b,e);if(e.damage&&core.hasItem("book")){core.updateCheckBlock(b);core.control.updateDamage(b,e.ctx)}};maps.prototype._drawThumbnail_drawToTarget=function(d,h){var c=core.getContextByName(h.ctx);if(c==null){return}var q=h.x||0,r=h.y||0,l=h.size||core.__PIXELS__;var p=core.floors[d].width,e=core.floors[d].height;var a=h.centerX,b=h.centerY;if(a==null){a=Math.floor(p/2)}if(b==null){b=Math.floor(e/2)}var m=core.bigmap.tempCanvas;if(h.all){var o=m.canvas.width,n=m.canvas.height;if(o<=n){var i=l,j=i*o/n;var k=(l-j)/2;core.fillRect(c,q,r,k,i,"#000000");core.fillRect(c,q+l-k,r,k,i);core.drawImage(c,m.canvas,0,0,o,n,q+k,r,j,i)}else{var j=l,i=j*n/o;var k=(l-i)/2;core.fillRect(c,q,r,j,k,"#000000");core.fillRect(c,q,r+l-k,j,k);core.drawImage(c,m.canvas,0,0,o,n,q,r+k,j,i)}}else{if(h.v2){core.drawImage(c,m.canvas,0,0,core.__PIXELS__,core.__PIXELS__,q,r,l,l)}else{var f=core.clamp(a-core.__HALF_SIZE__,0,p-core.__SIZE__),g=core.clamp(b-core.__HALF_SIZE__,0,e-core.__SIZE__);core.drawImage(c,m.canvas,f*32,g*32,core.__PIXELS__,core.__PIXELS__,q,r,l,l)}}};maps.prototype.noPass=function(c,d,b){var a=core.getBlock(c,d,b);if(a==null){return false}return a.event.noPass};maps.prototype.npcExists=function(c,d,b){var a=this.getBlock(c,d,b);if(a==null){return false}return a.event.cls.indexOf("npc")==0};maps.prototype.terrainExists=function(d,e,c,b){var a=this.getBlock(d,e,b);if(a==null){return false}return a.event.cls=="terrains"&&(c?a.event.id==c:true)};maps.prototype.stairExists=function(d,e,b){var a=this.getBlockId(d,e,b);if(a==null){return false}var c=["upFloor","downFloor"];c=c.concat(["leftPortal","rightPortal","upPortal","downPortal","portal","starPortal"]);return c.indexOf(a)>=0};maps.prototype.nearStair=function(){var a=core.getHeroLoc("x"),b=core.getHeroLoc("y");return this.stairExists(a,b)||this.stairExists(a-1,b)||this.stairExists(a,b-1)||this.stairExists(a+1,b)||this.stairExists(a,b+1)};maps.prototype.enemyExists=function(d,e,c,b){var a=this.getBlock(d,e,b);if(a==null){return false}return a.event.cls.indexOf("enemy")==0&&(c?a.event.id==c:true)};maps.prototype.getBlock=function(e,f,c,d){c=c||core.status.floorId;if(!c){return null}core.extractBlocks(c);var b=this.getMapBlocksObj(c);var a=b[e+","+f];if(a&&(d||!a.disable)){return a}return null};maps.prototype.getBlockId=function(d,e,b,c){var a=core.getBlock(d,e,b,c);return a==null?null:a.event.id};maps.prototype.getBlockNumber=function(d,e,b,c){var a=core.getBlock(d,e,b,c);return a==null?null:a.id};maps.prototype.getBlockCls=function(d,e,b,c){var a=core.getBlock(d,e,b,c);return a==null?null:a.event.cls};maps.prototype.getBlockOpacity=function(d,e,b,c){var a=core.getBlock(d,e,b,c);if(a==null){return null}if(a.opacity==null){return 1}return a.opacity==null?1:a.opacity};maps.prototype.getBlockFilter=function(d,e,b,c){var a=core.getBlock(d,e,b,c);if(a==null){return null}if(a.filter==null){return{blur:0,hue:0,grayscale:0,invert:false,shadow:0}}return core.clone(a.filter)};maps.prototype.getBlockInfo=function(c){if(!c){return null}if(typeof c=="string"){c=this.getNumberById(c)}if(typeof c=="number"){if(c==0){return null}c=this.getBlockByNumber(c)}var n=c.id,k=c.event.id,d=c.event.cls,m=c.event.name,l=null,p=0,q=0,a=c.event.animate,e=c.event.doorInfo,j=c.event.height||32,i={},h="down",b=null;if(k=="none"){return null}else{if(k=="airwall"){if(!core.material.images.airwall){return null}l=core.material.images.airwall;m="空气墙"}else{if(d=="tileset"){var o=core.icons.getTilesetOffset(k);if(o==null){return null}p=o.x;q=o.y;l=core.material.images.tilesets[o.image]}else{if(d=="autotile"){l=core.material.images.autotile[k]}else{l=core.material.images[d];q=core.material.icons[d][k];i=c.event.faceIds||{};for(var g in i){if(i[g]==k){h=g;break}}if(c.event.bigImage){b=core.material.images.images[c.event.bigImage]}if(core.material.enemys[k]){m=core.material.enemys[k].name;b=core.material.images.images[core.material.enemys[k].bigImage]}else{if(core.material.items[k]){m=core.material.items[k].name}}if(!e&&b!=null){a=4}}}}}return{number:n,id:k,cls:d,name:m,image:l,posX:p,doorInfo:e,posY:q,height:j,faceIds:i,animate:a,face:h,bigImage:b}};maps.prototype.searchBlock=function(d,b,f){if(typeof d=="number"){d=this.getBlockByNumber(d).event.id}b=b||core.status.floorId;var e=[];if(b instanceof Array){b.forEach(function(g){e=e.concat(core.searchBlock(d,g,f))});return e}core.extractBlocks(b);for(var c=0;c<core.status.maps[b].blocks.length;++c){var a=core.status.maps[b].blocks[c];if((f||!a.disable)&&(core.matchWildcard(d,a.event.id)||core.matchRegex(d,a.event.id))){e.push({floorId:b,x:a.x,y:a.y,block:a})}}return e};maps.prototype.searchBlockWithFilter=function(b,c,f){c=c||core.status.floorId;var e=[];if(c instanceof Array){c.forEach(function(g){e=e.concat(core.searchBlockWithFilter(b,g,f))});return e}core.extractBlocks(c);for(var d=0;d<core.status.maps[c].blocks.length;++d){var a=core.status.maps[c].blocks[d];if((f||!a.disable)&&b(a)){e.push({floorId:c,x:a.x,y:a.y,block:a})}}return e};maps.prototype.getFaceDownId=function(a){if(a==null){return null}if(typeof a=="string"){a=this.getNumberById(a)}if(typeof a=="number"){if(a==0){return null}a=this.getBlockByNumber(a)}if(!a.event){return null}return(a.event.faceIds||{}).down||a.event.id};maps.prototype.showBlock=function(c,d,b){b=b||core.status.floorId;if(!b){return}var a=core.getBlock(c,d,b,true);if(a==null){return}if(a.disable){a.disable=false;core.setMapBlockDisabled(b,c,d,false);this._updateMapArray(b,a.x,a.y);if(b==core.status.floorId){if(a.event.cls=="autotile"){core.redrawMap()}else{core.drawBlock(a);core.addGlobalAnimate(a);core.updateStatusBar()}}}};maps.prototype.hideBlock=function(c,d,b){b=b||core.status.floorId;if(!b){return}var a=core.getBlock(c,d,b,true);if(a==null){return}a.disable=true;core.setMapBlockDisabled(b,a.x,a.y,true);this._updateMapArray(b,a.x,a.y);this._removeBlockFromMap(b,a)};maps.prototype.hideBlockByIndex=function(d,c){c=c||core.status.floorId;if(!c){return}core.extractBlocks(c);var b=core.status.maps[c].blocks,a=b[d];a.disable=true;core.setMapBlockDisabled(c,a.x,a.y,true);this._updateMapArray(c,a.x,a.y)};maps.prototype.hideBlockByIndexes=function(b,a){b.sort(function(c,d){return d-c}).forEach(function(c){core.hideBlockByIndex(c,a)})};maps.prototype._removeBlockFromMap=function(c,a){if(c!=core.status.floorId){return}var b=a.filter||{};if(a.event.cls=="autotile"||b.blur>0||b.shadow>0){core.redrawMap()}else{var g=a.x,h=a.y;var e=32*g-core.bigmap.posX*32;var f=32*h-core.bigmap.posY*32;core.removeGlobalAnimate(g,h);core.clearMap("event",e,f,32,32);var d=a.event.height||32;if(d>32){core.clearMap("event2",e,f+32-d,32,d-32)}core.deleteCanvas("_bigImage_header_"+g+"_"+h);core.deleteCanvas("_bigImage_body_"+g+"_"+h);core.updateStatusBar()}};maps.prototype.removeBlock=function(d,e,b){b=b||core.status.floorId;if(!b){return false}core.extractBlocks(b);for(var c in core.status.maps[b].blocks){var a=core.status.maps[b].blocks[c];if(a.x==d&&a.y==e){this.removeBlockByIndex(c,b);this._removeBlockFromMap(b,a);return true}}return false};maps.prototype.removeBlockByIndex=function(d,c){c=c||core.status.floorId;if(!c){return}core.extractBlocks(c);var b=core.status.maps[c].blocks,a=b[d];b.splice(d,1);if(core.status.mapBlockObjs[c]){delete core.status.mapBlockObjs[c][a.x+","+a.y]}core.setMapBlockDisabled(c,a.x,a.y,true);this._updateMapArray(c,a.x,a.y)};maps.prototype.removeBlockByIndexes=function(b,a){b.sort(function(c,d){return d-c}).forEach(function(c){core.removeBlockByIndex(c,a)})};maps.prototype.showBgFgMap=function(d,c,b,a){this._triggerBgFgMap("show",d,c,b,a)};maps.prototype.hideBgFgMap=function(d,c,b,a){this._triggerBgFgMap("hide",d,c,b,a)};maps.prototype._triggerBgFgMap=function(f,e,d,c,a){if(f!="show"){f="hide"}if(!e||(!e.startsWith("bg")&&!e.startsWith("fg"))){return}if(typeof d[0]=="number"&&typeof d[1]=="number"){d=[d]}c=c||core.status.floorId;if(!c){return}if(d.length==0){return}var b=core.getFlag("__"+e+"d__",{});b[c]=b[c]||[];d.forEach(function(g){if(f=="hide"){b[c].push([g[0],g[1]])}else{b[c]=b[c].filter(function(h){return h[0]!=g[0]||h[1]!=g[1]})}});core.setFlag("__"+e+"d__",b);core.status[e+"maps"][c]=null;if(c==core.status.floorId){core.redrawMap()}if(a){a()}};maps.prototype.showFloorImage=function(c,b,a){this._triggerFloorImage("show",c,b,a)};maps.prototype.hideFloorImage=function(c,b,a){this._triggerFloorImage("hide",c,b,a)};maps.prototype._triggerFloorImage=function(d,c,b,a){if(d!="show"){d="hide"}if(typeof c[0]=="number"&&typeof c[1]=="number"){c=[c]}b=b||core.status.floorId;if(!b){return}if(c.length==0){return}c.forEach(function(f){var g=f[0],h=f[1];var e="__floorImg__"+b+"_"+g+"_"+h;if(d=="hide"){core.setFlag(e,true)}else{core.removeFlag(e)}});if(b==core.status.floorId){core.redrawMap()}if(a){a()}};maps.prototype.setBlock=function(c,f,g,b){b=b||core.status.floorId;if(!b||c==null||f==null||g==null){return}if(f<0||f>=core.floors[b].width||g<0||g>=core.floors[b].height){return}if(typeof c=="string"){if(/^\d+$/.test(c)){c=parseInt(c)}else{c=core.getNumberById(c)}}var a=this.initBlock(f,g,c,true,core.floors[b]);if(a.id==0&&!a.event.trigger){core.removeBlock(f,g,b);return}var d=core.getBlock(f,g,b,true);var e=d==null?null:d.event;if(d==null){core.status.maps[b].blocks.push(a);if(core.status.mapBlockObjs[b]){core.status.mapBlockObjs[b][a.x+","+a.y]=a}core.setMapBlockDisabled(b,a.x,a.y,false);delete a.disable}else{d.id=c;d.event=a.event;a=d}this._updateMapArray(b,f,g);if(b==core.status.floorId){if((e!=null&&e.cls=="autotile")||a.event.cls=="autotile"){core.redrawMap()}else{if(e!=null){this._removeBlockFromMap(b,{x:f,y:g,event:e})}if(!a.disable){core.drawBlock(a);core.addGlobalAnimate(a);core.updateStatusBar()}}}};maps.prototype.animateSetBlock=function(d,g,h,c,f,b){c=c||core.status.floorId;f=f||0;if(c!=core.status.floorId||f==0){this.setBlock(d,g,h,c);if(b){b()}return}if(typeof d=="string"){if(/^\d+$/.test(d)){d=parseInt(d)}else{d=core.getNumberById(d)}}var e=core.getBlock(g,h,c,true);var a=this.initBlock(g,h,d,true,core.floors[c]);if(e!=null&&!e.disable){return this._animateSetBlock_originEnabled(a,d,g,h,c,f,b)}if(e==null){return this._animateSetBlock_originNotExists(a,d,g,h,c,f,b)}if(e!=null&&e.disable){return this._animateSetBlock_originDisabled(d,g,h,c,b)}if(b){b()}};maps.prototype._animateSetBlock_originEnabled=function(a,d,f,g,c,e,b){if(a.id==0){if(!a.event.trigger){return this.animateBlock([f,g],"remove",e,b)}else{return this.animateBlock([f,g],"hide",e,function(){core.setBlock(0,f,g,c);core.showBlock(f,g,c);if(b){b()}})}}else{return this.animateBlock([f,g],"hide",e/2,function(){core.setBlock(d,f,g,c);core.animateBlock([f,g],"show",e/2,b)})}};maps.prototype._animateSetBlock_originNotExists=function(a,d,f,g,c,e,b){if(a.id==0){core.setBlock(d,f,g,c);if(b){b()}}else{core.setBlock(d,f,g,c);core.hideBlock(f,g,c);core.animateBlock([f,g],"show",e,b);return}};maps.prototype._animateSetBlock_originDisabled=function(c,d,e,b,a){core.setBlock(c,d,e,b);if(a){a()}};maps.prototype.animateSetBlocks=function(f,e,d,g,b){if(!(e instanceof Array)){if(b){b()}return}if(typeof e[0]=="number"&&typeof e[1]=="number"){e=[e]}var c=e.length;var a=function(){c--;if(c==0){if(b){b()}}};e.forEach(function(h){core.animateSetBlock(f,h[0],h[1],d,g,a)})};maps.prototype.turnBlock=function(d,j,k,f){var g=core.getBlockId(j,k,f,true);var a=core.getBlockInfo(g);if(a==null){return}var e=a.faceIds||{};var b=null;for(var c in core.utils.scan){if(e[c]==g){b=c}}if(b==null){return}var h=core.turnDirection(d,b);var i=e[h];if(i!=null&&i!=g){this.setBlock(i,j,k,f)}};maps.prototype.replaceBlock=function(b,d,a){a=a||core.status.floorId;if(a instanceof Array){a.forEach(function(e){core.replaceBlock(b,d,e)});return}var c=this.getBlockByNumber(d,true);core.extractBlocks(a);core.status.maps[a].blocks.forEach(function(e){if(e.id==b){e.id=d;for(var f in c.event){e.event[f]=core.clone(c.event[f])}this._updateMapArray(a,e.x,e.y)}},this);if(a==core.status.floorId){core.redrawMap()}};maps.prototype.setBgFgBlock=function(b,c,e,f,a){a=a||core.status.floorId;if(!a||c==null||e==null||f==null){return}if(e<0||e>=core.floors[a].width||f<0||f>=core.floors[a].height){return}if(!b||(!b.startsWith("bg")&&!b.startsWith("fg"))){return}if(typeof c=="string"){if(/^\d+$/.test(c)){c=parseInt(c)}else{c=core.getNumberById(c)}}var d=core.getFlag("__"+b+"v__",{});d[a]=(d[a]||[]).filter(function(g){return g[0]!=e||g[1]!=f});d[a].push([e,f,c]);core.setFlag("__"+b+"v__",d);core.status[b+"maps"][a]=null;if(a==core.status.floorId){core.clearMap(b);if(b.startsWith("bg")){core.drawBg(a)}else{core.drawFg(a)}}};maps.prototype.resetMap=function(a){a=a||core.status.floorId;if(!a){return}if(typeof a=="string"){a=[a]}var b=false;a.forEach(function(c){core.status.maps[c]=core.maps.loadFloor(c);Object.keys(core.status.hero.flags).forEach(function(d){if(d.startsWith(a+"@")){delete core.status.hero.flags[d]}});delete (flags.__disabled__||{})[c];delete (core.status.mapBlockObjs||{})[c];if(c==core.status.floorId){b=true}});if(b){this.redrawMap()}core.drawTip("地图重置成功")};maps.prototype._initDetachedBlock=function(b,l,m,j){var k=null,c="__body_"+l+"_"+m,g=null;if(!b.bigImage&&b.height>32){k="__head_"+l+"_"+m;core.createCanvas(k,0,0,32,b.height-32,55)}if(b.bigImage){var a=this._getBigImageInfo(b.bigImage,b.face,b.posX);core.createCanvas(c,0,0,a.per_width,a.per_height,35)}else{core.createCanvas(c,0,0,32,32,35)}var f=null,h=null;if(b.cls.indexOf("enemy")==0&&core.hasItem("book")&&j){var i=core.enemys.getDamageString(b.id,l,m);f=i.damage;h=i.color}if(f!=null){g="__damage_"+l+"_"+m;var e=core.createCanvas(g,0,0,32,32,65);e.textAlign="left";e.font="bold 11px Arial";core.fillBoldText(e,f,1,31,h);if(core.flags.displayCritical){var d=core.enemys.nextCriticals(b.id);if(d.length>0){d=d[0]}d=core.formatBigNumber(d[0],true);if(d=="???"){d="?"}core.fillBoldText(e,d,1,21,"#FFFFFF")}}return{headCanvas:k,bodyCanvas:c,damageCanvas:g}};maps.prototype._moveDetachedBlock=function(b,l,m,n,d){var j=b.height,q=b.posX,r=b.posY,k=b.image;var i=d.headCanvas,c=d.bodyCanvas,e=d.damageCanvas;if(i){core.dymCanvas[i].clearRect(0,0,32,j);core.dymCanvas[i].drawImage(k,q*32,r*j,32,j-32,0,0,32,j-32);core.relocateCanvas(i,l-core.bigmap.offsetX,m+32-j-core.bigmap.offsetY);core.setOpacity(i,n)}if(c){if(b.bigImage){var h=b.face;if(!b.faceIds){h="down"}else{if(!b.faceIds[h]){h="down";for(var g in b.faceIds){if(b.faceIds[g]==b.id){h=g}}}}var a=this._getBigImageInfo(b.bigImage,h,b.posX);var p=a.per_width,o=a.per_height;core.dymCanvas[c].clearRect(0,0,a.per_width,a.per_height);core.dymCanvas[c].drawImage(b.bigImage,a.sx,a.sy,p,o,0,0,p,o);core.relocateCanvas(c,l-core.bigmap.offsetX+a.dx,m-core.bigmap.offsetY+a.dy);core.setOpacity(c,n)}else{core.dymCanvas[c].clearRect(0,0,32,32);core.dymCanvas[c].drawImage(k,q*32,r*j+j-32,32,32,0,0,32,32);core.relocateCanvas(c,l-core.bigmap.offsetX,m-core.bigmap.offsetY);core.setOpacity(c,n)}}if(e){core.relocateCanvas(e,l-core.bigmap.offsetX,m-core.bigmap.offsetY);core.setOpacity(e,n)}};maps.prototype._deleteDetachedBlock=function(a){core.deleteCanvas(a.headCanvas);core.deleteCanvas(a.bodyCanvas);core.deleteCanvas(a.damageCanvas)};maps.prototype._getAndRemoveBlock=function(c,d){var a=core.getBlock(c,d);if(a==null){return null}var b=this.getBlockInfo(a);if(b==null){return}core.removeBlock(c,d);return[a,b]};maps.prototype.moveBlock=function(k,l,i,j,f,d){if(core.status.replay.speed==24){j=1}j=j||500;var b=this._getAndRemoveBlock(k,l);if(b==null){if(d){d()}return}var a=b[0],c=b[1];var h=(i||[]).map(function(m){return[m.split(":")[0],parseInt(m.split(":")[1]||"1")]}).filter(function(m){return["up","down","left","right","forward","backward","leftup","leftdown","rightup","rightdown","speed"].indexOf(m[0])>=0&&!(m[0]=="speed"&&m[1]<16)});var e=this._initDetachedBlock(c,k,l,a.event.animate!==false);this._moveDetachedBlock(c,32*k,32*l,1,e);var g={sx:k,sy:l,x:k,y:l,px:32*k,py:32*l,opacity:1,keep:f,lastDirection:null,offset:1,moveSteps:h,step:0,per_time:j/16/core.status.replay.speed};this._moveBlock_doMove(c,e,g,d)};maps.prototype._moveBlock_doMove=function(d,f,g,e){var c=d.animate,b=0;if(!d.doorInfo&&!d.bigImage&&d.cls=="npc48"){c=4}var a=function(){var i=function(){core.maps._deleteDetachedBlock(f);if(g.keep){core.setBlock(d.number,g.x,g.y);core.showBlock(g.x,g.y);core.moveEnemyOnPoint(g.sx,g.sy,g.x,g.y)}if(e){e()}};var h=window.setInterval(function(){if(d.cls!="tileset"){b+=g.per_time;if(b>core.values.animateSpeed){b=0;d.posX=(d.posX+1)%c}}if(g.moveSteps.length!=0){if(core.maps._moveBlock_updateSpeed(g)){clearInterval(h);delete core.animateFrame.asyncId[h];a()}else{core.maps._moveBlock_moving(d,f,g)}}else{core.maps._moveJumpBlock_finished(d,f,g,h,i)}},g.per_time);core.animateFrame.lastAsyncId=h;core.animateFrame.asyncId[h]=i};a()};maps.prototype._moveBlock_updateSpeed=function(a){if(a.step==0&&a.moveSteps[0][0]=="speed"&&a.moveSteps[0][1]>=16){a.per_time=a.moveSteps[0][1]/16/core.status.replay.speed;a.moveSteps.shift();return true}return false};maps.prototype._moveBlock_updateDirection=function(a,h){h.offset=1;var b=h.moveSteps[0];if((b[0]=="backward"||b[0]=="forward")&&b[1]>1){h.moveSteps.shift();for(var g=0;g<b[1];++g){h.moveSteps.unshift([b[0],1])}return this._moveBlock_updateDirection(a,h)}if(h.lastDirection==null){for(var e in a.faceIds){if(a.faceIds[e]==a.id){h.lastDirection=e;break}}}if(b[0]=="forward"||b[0]=="backward"){if(h.lastDirection==null){h.moveSteps.shift();return false}if(b[0]=="backward"){h.offset=-1}b[0]=h.lastDirection}h.lastDirection=b[0];var f=b[0];if(f=="leftup"||f=="leftdown"){f="left"}if(f=="rightup"||f=="rightdown"){f="right"}var c=a.faceIds[f];a.face=f;if(c){var j=core.material.icons[a.cls][c];if(j!=null){a.number=core.getNumberById(c)||a.number;a.posY=j}}if(b[1]<=0){h.moveSteps.shift();return false}h.x+=core.utils.scan2[b[0]].x*h.offset;h.y+=core.utils.scan2[b[0]].y*h.offset;return true};maps.prototype._moveBlock_moving=function(a,b,d){if(d.step==0){if(!this._moveBlock_updateDirection(a,d)){return}}var c=d.moveSteps[0];d.step++;d.px+=core.utils.scan2[c[0]].x*2*d.offset;d.py+=core.utils.scan2[c[0]].y*2*d.offset;this._moveDetachedBlock(a,d.px,d.py,d.opacity,b);if(d.step==16){d.step=0;d.moveSteps[0][1]--;if(d.moveSteps[0][1]<=0){d.moveSteps.shift()}}};maps.prototype.jumpBlock=function(j,k,f,g,l,i,d){l=l||500;var b=this._getAndRemoveBlock(j,k);if(b==null){if(d){d()}return}var a=b[0],c=b[1];var e=this._initDetachedBlock(c,j,k,a.event.animate!==false);this._moveDetachedBlock(c,32*j,32*k,1,e);var h=this.__generateJumpInfo(j,k,f,g,l);h.keep=i;this._jumpBlock_doJump(c,e,h,d)};maps.prototype.__generateJumpInfo=function(h,i,d,e,j){var b=d-h,c=e-i,a=Math.round(Math.sqrt(b*b+c*c));var g=6+a,f=g*2;j/=Math.max(core.status.replay.speed,1);return{sx:h,sy:i,x:h,y:i,ex:d,ey:e,px:32*h,py:32*i,opacity:1,jump_peak:g,jump_count:f,step:0,per_time:j/f}};maps.prototype._jumpBlock_doJump=function(b,d,f,c){var e=function(){core.maps._deleteDetachedBlock(d);if(f.keep){core.setBlock(b.number,f.ex,f.ey);core.showBlock(f.ex,f.ey);core.moveEnemyOnPoint(f.sx,f.sy,f.ex,f.ey)}if(c){c()}};var a=window.setInterval(function(){if(f.jump_count>0){core.maps._jumpBlock_jumping(b,d,f)}else{core.maps._moveJumpBlock_finished(b,d,f,a,e)}},f.per_time);core.animateFrame.lastAsyncId=a;core.animateFrame.asyncId[a]=e};maps.prototype.__updateJumpInfo=function(b){b.jump_count--;b.x=(b.x*b.jump_count+b.ex)/(b.jump_count+1);b.y=(b.y*b.jump_count+b.ey)/(b.jump_count+1);b.px=32*b.x;var a=Math.abs(b.jump_count-b.jump_peak);b.py=32*b.y-(b.jump_peak*b.jump_peak-a*a)/2};maps.prototype._jumpBlock_jumping=function(a,b,c){this.__updateJumpInfo(c);core.maps._moveDetachedBlock(a,c.px,c.py,c.opacity,b)};maps.prototype._moveJumpBlock_finished=function(b,c,e,a,d){if(e.keep){e.opacity=0}else{e.opacity-=0.06}if(e.opacity<=0){delete core.animateFrame.asyncId[a];clearInterval(a);d()}else{this._moveDetachedBlock(b,e.px,e.py,e.opacity,c)}};maps.prototype.animateBlock=function(c,e,d,a){if(core.status.replay.speed==24){d=1}if(typeof c[0]=="number"&&typeof c[1]=="number"){c=[c]}if(e!="show"&&e!="hide"&&e!="remove"&&typeof e!="number"){if(a){a()}}var b=this._animateBlock_getList(c,e);if(b.length==0){if(a){a()}return}this._animateBlock_drawList(b,0);d/=Math.max(core.status.replay.speed,1);this._animateBlock_doAnimate(c,b,e,d,a)};maps.prototype._animateBlock_doAnimate=function(e,d,i,h,b){var f=0,g=Math.max(parseInt(h/10),1);var c=function(){d.forEach(function(j){if(j.blockInfo){core.maps._deleteDetachedBlock(j.canvases)}});e.forEach(function(j){if(i=="show"){core.showBlock(j[0],j[1])}else{if(i=="hide"){core.hideBlock(j[0],j[1])}else{if(i=="remove"){core.removeBlock(j[0],j[1])}else{core.setBlockOpacity(i,j[0],j[1]);core.showBlock(j[0],j[1])}}}});if(b){b()}};var a=setInterval(function(){f++;core.maps._animateBlock_drawList(d,f/g);if(f==g){delete core.animateFrame.asyncId[a];clearInterval(a);c()}},10);core.animateFrame.lastAsyncId=a;core.animateFrame.asyncId[a]=c};maps.prototype._animateBlock_getList=function(b,c){var a=[];b.forEach(function(h){var d=core.getBlock(h[0],h[1],null,true);if(d==null){return}var g=d.opacity;if(g==null){g=1}var e=core.maps.getBlockInfo(d);if(e==null){a.push({x:h[0],y:h[1]});return}if(typeof c=="number"&&d.disable){return}if((c=="show"&&!d.disable)||((c=="hide"||c=="remove")&&d.disable)){a.push({x:h[0],y:h[1]});return}var i=c;if(c=="show"){i=g;g=0}else{if(c=="hide"||c=="remove"){core.hideBlock(h[0],h[1]);i=0}else{core.hideBlock(h[0],h[1])}}var f=core.maps._initDetachedBlock(e,h[0],h[1],d.event.displayDamage!==false);a.push({x:h[0],y:h[1],blockInfo:e,canvases:f,fromOpacity:g,toOpacity:i,})});return a};maps.prototype._animateBlock_drawList=function(a,b){a.forEach(function(c){if(c.blockInfo){core.maps._moveDetachedBlock(c.blockInfo,c.x*32,c.y*32,c.fromOpacity+b*(c.toOpacity-c.fromOpacity),c.canvases)}})};maps.prototype.addGlobalAnimate=function(a){if(!a||!a.event){return}this.removeGlobalAnimate(a.x,a.y,a.name);if(a.event.cls=="autotile"){var b=a.event.id,c=core.material.images.autotile[b];if(!c||c.width==96){return}core.status.autotileAnimateObjs.push(a)}else{if(!a.event.bigImage&&(!a.event.animate||a.event.animate==1)){return}core.status.globalAnimateObjs.push(a)}};maps.prototype.removeGlobalAnimate=function(b,c,a){if(b==null||c==null){core.status.globalAnimateStatus=0;core.status.globalAnimateObjs=[];core.status.autotileAnimateObjs=[];core.status.floorAnimateObjs=[];return}core.status.globalAnimateObjs=core.status.globalAnimateObjs.filter(function(d){return d.x!=b||d.y!=c||d.name!=a});core.status.autotileAnimateObjs=core.status.autotileAnimateObjs.filter(function(d){return d.x!=b||d.y!=c||d.name!=a})};maps.prototype.drawBoxAnimate=function(){if(core.status.boxAnimateObjs.length==0){return}if(main.mode=="play"&&core.status.boxAnimateObjs.filter(function(a){return a.bigImage}).length>0&&!core.dymCanvas.ui2){core.createCanvas("ui2",0,0,core.__PIXELS__,core.__PIXELS__,142)}core.clearMap("ui2");core.status.boxAnimateObjs.forEach(function(e){if(e.bigImage){var d=e.ctx||"ui2";var c=core.maps._getBigImageInfo(e.bigImage,e.face,core.status.globalAnimateStatus%4);var h=c.sx,i=c.sy,g=c.per_width,f=c.per_height;var b=Math.min(g,e.max_width||g),a=f*b/g;core.drawImage(d,e.bigImage,h,i,g,f,e.centerX-b/2,e.centerY-a/2,b,a)}else{var d=e.ctx||"ui";core.clearMap(d,e.bgx,e.bgy,e.bgWidth,e.bgHeight);core.fillRect(d,e.bgx,e.bgy,e.bgWidth,e.bgHeight,core.material.groundPattern);core.drawImage(d,e.image,core.status.globalAnimateStatus%e.animate*32,e.pos,32,e.height,e.x,e.y,e.dw||32,e.dh||e.height)}});if(main.mode!="play"){core.status.boxAnimateObjs=[]}};maps.prototype.drawAnimate=function(g,h,i,a,c){g=core.getMappedName(g);if(core.isReplaying()||!core.material.animates[g]||h==null||i==null){if(c){c()}return -1}var b=core.material.animates[g],d=32*h+16,e=32*i+16;if(a){d+=core.bigmap.offsetX;e+=core.bigmap.offsetY}b.se=b.se||{};if(typeof b.se=="string"){b.se={1:b.se}}var f=setTimeout(null);core.status.animateObjs.push({name:g,id:f,animate:b,centerX:d,centerY:e,index:0,callback:c});return f};maps.prototype.drawHeroAnimate=function(d,b){d=core.getMappedName(d);if(core.isReplaying()||!core.material.animates[d]){if(b){b()}return -1}var a=core.material.animates[d];a.se=a.se||{};if(typeof a.se=="string"){a.se={1:a.se}}var c=setTimeout(null);core.status.animateObjs.push({name:d,id:c,animate:a,hero:true,index:0,callback:b});return c};maps.prototype.getPlayingAnimates=function(a){return(core.status.animateObjs||[]).filter(function(b){return a==null||b.name==a}).map(function(b){return b.id})};maps.prototype._drawAnimateFrame=function(g,a,b,c,f){var d=core.getContextByName(g);if(!d){return}var e=a.frames[f%a.frame];core.playSound((a.se||{})[f%a.frame+1],(a.pitch||{})[f%a.frame+1]);var h=a.ratio;e.forEach(function(r){var l=a.images[r.index];if(!l){return}var q=l.width*h*r.zoom/100;var p=l.height*h*r.zoom/100;core.setAlpha(d,r.opacity/255);var j=b+r.x,k=c+r.y;var m=j-q/2-core.bigmap.offsetX,n=k-p/2-core.bigmap.offsetY;var o=r.mirror?"x":null;var i=r.angle?-r.angle*Math.PI/180:null;core.drawImage(d,l,m,n,q,p,null,null,null,null,i,o);core.setAlpha(d,1)})};maps.prototype.stopAnimate=function(c,a){for(var b=0;b<core.status.animateObjs.length;b++){var d=core.status.animateObjs[b];if(c==null||d.id==c){if(a){(function(e){setTimeout(function(){if(e){e()}})})(d.callback)}}}core.status.animateObjs=core.status.animateObjs.filter(function(e){return c!=null&&e.id!=c});if(core.status.animateObjs.length==0){core.clearMap("animate")}};"use strict";function enemys(){this._init()}enemys.prototype._init=function(){this.enemys=enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80;this.enemydata=functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.enemys;for(var a in this.enemys){this.enemys[a].id=a}if(main.mode=="play"){this.enemydata.hasSpecial=function(c,d){return core.enemys.hasSpecial(c,d)}}};enemys.prototype.getEnemys=function(){var c=core.clone(this.enemys);var b=core.getFlag("enemyInfo");if(b){for(var d in b){for(var e in b[d]){c[d][e]=core.clone(b[d][e])}}}for(var d in c){if(c[d].faceIds){var a=c[d].faceIds.down;if(a!=null&&a!=d&&c[a]){c[d]={id:d};for(var f in c[a]){if(f!="id"&&c[a].hasOwnProperty(f)){(function(h,g,i){Object.defineProperty(c[h],i,{get:function(){return c[g][i]},set:function(j){c[g][i]=j},enumerable:true})})(d,a,f)}}}}}return c};enemys.prototype.hasSpecial=function(a,b){if(a==null){return false}if(a instanceof Array){return a.indexOf(b)>=0}if(typeof a=="number"){return a===b}if(typeof a=="string"){return this.hasSpecial(core.material.enemys[a],b)}if(a.special!=null){return this.hasSpecial(a.special,b)}return false};enemys.prototype.getSpecials=function(){return this.enemydata.getSpecials()};enemys.prototype.getSpecialText=function(a){if(typeof a=="string"){a=core.material.enemys[a]}if(!a){return[]}var c=a.special;var e=[];var d=this.getSpecials();if(d){for(var b=0;b<d.length;b++){if(this.hasSpecial(c,d[b][0])){e.push(this._calSpecialContent(a,d[b][1]))}}}return e};enemys.prototype.getSpecialColor=function(b){if(typeof b=="string"){b=core.material.enemys[b]}if(!b){return[]}var d=b.special;var a=[];var e=this.getSpecials();if(e){for(var c=0;c<e.length;c++){if(this.hasSpecial(d,e[c][0])){a.push(e[c][3]||null)}}}return a};enemys.prototype.getSpecialFlag=function(a){if(typeof a=="string"){a=core.material.enemys[a]}if(!a){return[]}var d=a.special;var b=0;var e=this.getSpecials();if(e){for(var c=0;c<e.length;c++){if(this.hasSpecial(d,e[c][0])){b|=(e[c][4]||0)}}}return b};enemys.prototype.getSpecialHint=function(a,d){var e=this.getSpecials();if(d==null){if(e==null){return[]}var b=[];for(var c=0;c<e.length;c++){if(this.hasSpecial(a,e[c][0])){b.push("\r["+core.arrayToRGBA(e[c][3]||"#FF6A6A")+"]\\d"+this._calSpecialContent(a,e[c][1])+":\\d\r[]"+this._calSpecialContent(a,e[c][2]))}}return b}if(e==null){return""}for(var c=0;c<e.length;c++){if(d==e[c][0]){return"\r[#FF6A6A]\\d"+this._calSpecialContent(a,e[c][1])+":\\d\r[]"+this._calSpecialContent(a,e[c][2])}}return""};enemys.prototype._calSpecialContent=function(b,a){if(typeof a=="string"){return a}if(typeof b=="string"){b=core.material.enemys[b]}if(a instanceof Function){return a(b)}return""};enemys.prototype.getEnemyValue=function(b,d,e,f,c){c=c||core.status.floorId;if((((flags.enemyOnPoint||{})[c]||{})[e+","+f]||{})[d]!=null){return flags.enemyOnPoint[c][e+","+f][d]}if(b==null){var a=core.getBlock(e,f,c);if(a==null){return null}b=core.material.enemys[a.event.id]}if(typeof b=="string"){b=core.material.enemys[b]}if(b==null){return null}return b[d]};enemys.prototype.canBattle=function(b,d,e,c){if(typeof b=="string"){b=core.material.enemys[b]}var a=this.getDamage(b,d,e,c);return a!=null&&a<core.status.hero.hp};enemys.prototype.getDamageString=function(c,e,f,d){if(typeof c=="string"){c=core.material.enemys[c]}var b=this.getDamage(c,e,f,d);var a="#000000";if(b==null){b="???";a="#FF2222"}else{if(b<=0){a="#11FF11"}else{if(b<core.status.hero.hp/3){a="#FFFFFF"}else{if(b<core.status.hero.hp*2/3){a="#FFFF00"}else{if(b<core.status.hero.hp){a="#FF9933"}else{a="#FF2222"}}}}b=core.formatBigNumber(b,true);if(core.enemys.hasSpecial(c,19)){b+="+"}if(core.enemys.hasSpecial(c,21)){b+="-"}if(core.enemys.hasSpecial(c,11)){b+="^"}}return{damage:b,color:a}};enemys.prototype.nextCriticals=function(a,d,g,h,b){if(typeof a=="string"){a=core.material.enemys[a]}d=d||1;var f=this._nextCriticals_special(a,d,g,h,b);if(f!=null){return f}var c=this.getDamageInfo(a,null,g,h,b);if(c==null){var e=this._nextCriticals_overAtk(a,g,h,b);if(e==null){return[]}if(typeof e[1]=="number"){return[[e[0],-e[1]]]}c=e[1];c.__over__=true;c.__overAtk__=e[0]}if(typeof c=="number"){return[[0,0]]}if(c.damage<=0&&!core.flags.enableNegativeDamage){return[[c.__overAtk__||0,0]]}if(core.flags.useLoop){if(core.status.hero.atk<=(main.criticalUseLoop||1)){return this._nextCriticals_useLoop(a,c,d,g,h,b)}else{return this._nextCriticals_useBinarySearch(a,c,d,g,h,b)}}else{return this._nextCriticals_useTurn(a,c,d,g,h,b)}};enemys.prototype._nextCriticals_overAtk=function(b,d,e,c){var a=function(f,h){var k=f,g=h;if(k>g){return null}while(k<g){var i=Math.floor((k+g)/2);if(i-k>g-i){i--}var j=core.enemys.getDamageInfo(b,{atk:i},d,e,c);if(j!=null){g=i}else{k=i+1}}var j=core.enemys.getDamageInfo(b,{atk:k},d,e,c);return j==null?null:[k-core.status.hero.atk,j]};return a(core.status.hero.atk+1,core.getEnemyValue(b,"hp",d,e,c)+core.getEnemyValue(b,"def",d,e,c))};enemys.prototype._nextCriticals_special=function(a,c,d,e,b){if(this.hasSpecial(a.special,10)||this.hasSpecial(a.special,3)){return[]}return null};enemys.prototype._nextCriticals_useLoop=function(b,e,j,m,n,c){var h=e.mon_hp,d=core.status.hero.atk,g=e.mon_def,k=e.damage;var f=[];var l=d;if(e.__over__){l+=e.__overAtk__;f.push([e.__overAtk__,-e.damage])}for(var a=l+1;a<=h+g;a++){var i=this.getDamageInfo(b,{atk:a},m,n,c);if(i==null||(typeof i=="number")){break}if(k>i.damage){k=i.damage;f.push([a-d,e.damage-i.damage]);if(i.damage<=0&&!core.flags.enableNegativeDamage){break}if(f.length>=j){break}}}if(f.length==0){f.push([0,0])}return f};enemys.prototype._nextCriticals_useBinarySearch=function(c,f,k,n,o,d){var i=f.mon_hp,e=core.status.hero.atk,h=f.mon_def,l=f.damage;var g=[];var m=e;if(f.__over__){m+=f.__overAtk__;g.push([f.__overAtk__,-f.damage])}var a=function(p,r){var u=Math.floor(p),q=Math.floor(r);if(u>q){return null}while(u<q){var s=Math.floor((u+q)/2);if(s-u>q-s){s--}var t=core.enemys.getDamageInfo(c,{atk:s},n,o,d);if(t==null||(typeof t=="number")){return null}if(l>t.damage){q=s}else{u=s+1}}var t=core.enemys.getDamageInfo(c,{atk:u},n,o,d);return t==null||(typeof t=="number")||t.damage>=l?null:[u,t.damage]};var b=m;while(true){var j=a(b+1,i+h,l);if(j==null){break}b=j[0];l=j[1];g.push([b-e,f.damage-l]);if(l<=0&&!core.flags.enableNegativeDamage){break}if(g.length>=k){break}}if(g.length==0){g.push([0,0])}return g};enemys.prototype._nextCriticals_useTurn=function(a,d,j,o,p,b){var g=d.mon_hp,c=core.status.hero.atk,f=d.mon_def,n=d.turn;if(n>=1000000){return this._nextCriticals_useBinarySearch(a,d,j,o,p,b)}var e=[],k=null;var l=c;if(d.__over__){l+=d.__overAtk__;e.push([d.__overAtk__,-d.damage])}for(var m=n-1;m>=1;m--){var h=Math.ceil(g/m)+f;h=Math.ceil(h/core.getBuff("atk"));if(h<=l){break}if(h!=k){var i=this.getDamageInfo(a,{atk:h},o,p,b);if(i==null||(typeof i=="number")){break}e.push([h-c,Math.floor(d.damage-i.damage)]);if(i.damage<=0&&!core.flags.enableNegativeDamage){break}k=h}if(e.length>=j){break}}if(e.length==0){e.push([0,0])}return e};enemys.prototype.getDefDamage=function(a,c,f,g,b){if(typeof a=="string"){a=core.material.enemys[a]}c=c||1;var e=this._getDamage(a,null,f,g,b);var d=this._getDamage(a,{def:core.status.hero.def+c},f,g,b);if(e==null||d==null){return"???"}return e-d};enemys.prototype.getEnemyInfo=function(a,c,d,e,b){if(a==null){return null}if(typeof a=="string"){a=core.material.enemys[a]}return this.enemydata.getEnemyInfo(a,c,d,e,b)};enemys.prototype.getDamageInfo=function(a,c,d,e,b){if(a==null){return null}if(typeof a=="string"){a=core.material.enemys[a]}return this.enemydata.getDamageInfo(a,c,d,e,b)};enemys.prototype.getDamage=function(a,c,d,b){return this._getDamage(a,null,c,d,b)};enemys.prototype._getDamage=function(a,c,e,f,b){if(a==null){a=core.getBlockId(e,f,b)}if(typeof a=="string"){a=core.material.enemys[a]}if(a==null){return null}var d=this.getDamageInfo(a,c,e,f,b);if(d==null){return null}if(typeof d=="number"){return d}return d.damage};enemys.prototype.getCurrentEnemys=function(b){b=b||core.status.floorId;var a=[],c={};core.extractBlocks(b);core.status.maps[b].blocks.forEach(function(d){if(!d.disable&&d.event.cls.indexOf("enemy")==0){this._getCurrentEnemys_addEnemy(d.event.id,a,c,d.x,d.y,b)}},this);return this._getCurrentEnemys_sort(a)};enemys.prototype._getCurrentEnemys_getEnemy=function(b){var a=core.material.enemys[b];if(!a){return null}return core.material.enemys[a.displayIdInBook]||core.material.enemys[(a.faceIds||{}).down]||a};enemys.prototype._getCurrentEnemys_addEnemy=function(d,g,p,r,s,h){var c=this._getCurrentEnemys_getEnemy(d);if(c==null){return}var k=c.id;var f=this.getEnemyInfo(c,null,null,null,h);var l=this.getEnemyInfo(c,null,r,s,h);if(!core.flags.enableEnemyPoint||(l.atk==f.atk&&l.def==f.def&&l.hp==f.hp)){r=null;s=null}else{for(var j=0;j<g.length;++j){var m=g[j];if(k==m.id&&m.locs!=null&&l.atk==m.atk&&l.def==m.def&&l.hp==m.hp){m.locs.push([r,s]);return}}f=l}var k=c.id+":"+r+":"+s;if(p[k]){return}p[k]=true;var o=core.enemys.getSpecialText(c);var n=core.enemys.getSpecialColor(c);var a=this.nextCriticals(c,1,r,s,h);if(a.length>0){a=a[0]}var b=core.clone(c);for(var q in f){b[q]=f[q]}if(r!=null&&s!=null){b.locs=[[r,s]]}b.name=core.getEnemyValue(c,"name",r,s,h);b.specialText=o;b.specialColor=n;b.damage=this.getDamage(c,r,s,h);b.critical=a[0];b.criticalDamage=a[1];b.defDamage=this._getCurrentEnemys_addEnemy_defDamage(c,r,s,h);g.push(b)};enemys.prototype._getCurrentEnemys_addEnemy_defDamage=function(a,d,e,b){var c=core.status.maps[b||core.status.floorId].ratio||1;return this.getDefDamage(a,c,d,e,b)};enemys.prototype._getCurrentEnemys_sort=function(a){return a.sort(function(c,d){if(c.damage==d.damage){return c.money-d.money}if(c.damage==null){return 1}if(d.damage==null){return -1}return c.damage-d.damage})};enemys.prototype.hasEnemyLeft=function(c,e){if(e==null){e=core.status.floorId}if(!(e instanceof Array)){e=[e]}var d={};if(c instanceof Array){c.forEach(function(b){d[b]=true})}else{if(c){d[c]=true}else{d=null}}for(var f=0;f<e.length;f++){core.extractBlocks(e[f]);var g=core.status.maps[e[f]].blocks;for(var a=0;a<g.length;a++){if(!g[a].disable&&g[a].event.cls.indexOf("enemy")===0){if(d===null||d[core.getFaceDownId(g[a])]){return true}}}}return false};"use strict";function events(){this._init()}events.prototype._init=function(){this.eventdata=functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.events;this.commonEvent=events_c12a15a8_c380_4b28_8144_256cba95f760.commonEvent;this.systemEvents={};this.actions={}};events.prototype.resetGame=function(c,b,a,d,e){this.eventdata.resetGame(c,b,a,d,e)};events.prototype.startGame=function(b,d,c,a){main.dom.levelChooseButtons.style.display="none";main.dom.startButtonGroup.style.display="none";b=b||"";if(main.mode!="play"){return}if(core.flags.startUsingCanvas||c!=null){core.dom.startPanel.style.display="none";this._startGame_start(b,d,c,a)}else{core.hideStartAnimate(function(){core.events._startGame_start(b,d,c,a)})}};events.prototype._startGame_start=function(b,d,c,a){console.log("开始游戏");core.resetGame(core.firstData.hero,b,null,core.cloneArray(core.initStatus.maps));core.setHeroLoc("x",-1);core.setHeroLoc("y",-1);if(d!=null&&d>0){core.setFlag("__seed__",d);core.setFlag("__rand__",d)}else{core.utils.__init_seed()}core.clearStatusBar();var e=[];if(core.flags.startUsingCanvas){core.hideStatusBar();core.dom.musicBtn.style.display="block";core.dom.enlargeBtn.style.display="block";core.push(e,core.firstData.startCanvas)}core.push(e,{type:"function","function":"function() { core.events._startGame_setHard(); }"});core.push(e,core.firstData.startText);this.insertAction(e,null,null,function(){core.events._startGame_afterStart(a)});if(c!=null){core.startReplay(c)}};events.prototype._startGame_setHard=function(){var b=0;var a="red";main.levelChoose.forEach(function(c){if(c.name==core.status.hard){b=c.hard;a=core.arrayToRGBA(c.color||[255,0,0,1]);core.insertAction(c.action)}});core.setFlag("hard",b||0);core.setFlag("__hardColor__",a)};events.prototype._startGame_afterStart=function(a){core.ui.closePanel();core.changeFloor(core.firstData.floorId,null,core.firstData.hero.loc,null,function(){core.insertAction([]);if(a){a()}});this._startGame_upload()};events.prototype._startGame_upload=function(){var a=new FormData();a.append("type","people");a.append("name",core.firstData.name);a.append("version",core.firstData.version);a.append("platform",core.platform.string);a.append("hard",core.encodeBase64(core.status.hard));a.append("hardCode",core.getFlag("hard",0));a.append("base64",1);core.utils.http("POST","/games/upload.php",a)};events.prototype.win=function(c,b,a){if(!a){core.status.gameOver=true}return this.eventdata.win(c,b,a)};events.prototype.lose=function(a){if(core.isReplaying()){return core.control._replay_error(a,function(){core.lose(a)})}core.status.gameOver=true;return this.eventdata.lose(a)};events.prototype.gameOver=function(a,b,c){if(!core.status.extraEvent){core.clearMap("all");core.deleteAllCanvas();core.dom.gif2.innerHTML="";core.setWeather()}core.ui.closePanel();if(main.isCompetition&&a!=null){if(a==""){a="恭喜通关"}a+="[比赛]"}var d=null;if(b){d="录像回放完毕!"}else{if(core.hasFlag("debug")){d="\t[系统提示]调试模式下无法上传成绩"}}if(d!=null){core.drawText(d,core.restart)}else{this._gameOver_confirmUpload(a,c)}};events.prototype._gameOver_confirmUpload=function(a,b){core.ui.closePanel();if(a==null){this._gameOver_confirmDownload(a);return}core.ui.drawConfirmBox("你想记录你的ID和成绩吗?",function(){if(main.isCompetition){core.events._gameOver_doUpload("",a,b)}else{var d=core.getCookie("id")||"";var c="请输入你的ID:\n(登录状态下输入数字用户编号可成为蓝名成绩并计入用户通关数)";if(d){c="请输入你的ID:\n(输入数字用户编号"+d+"可成为蓝名成绩并计入用户通关数)"}core.myprompt(c,d,function(e){core.events._gameOver_doUpload(e,a,b)})}},function(){if(main.isCompetition){core.events._gameOver_confirmDownload(a)}else{core.events._gameOver_doUpload(null,a,b)}})};events.prototype._gameOver_doUpload=function(e,a,d){var c=core.status.hero.hp;if(e==null){c=1}core.ui.closePanel();var b=new FormData();b.append("type","score");b.append("name",core.firstData.name);b.append("version",core.firstData.version);b.append("platform",core.platform.string);b.append("hard",core.encodeBase64(core.status.hard));b.append("username",core.encodeBase64(e||""));b.append("ending",core.encodeBase64(a));b.append("lv",core.status.hero.lv);b.append("hp",Math.min(c,Math.pow(2,63)));b.append("atk",core.status.hero.atk);b.append("def",core.status.hero.def);b.append("mdef",core.status.hero.mdef);b.append("money",core.status.hero.money);b.append("experience",core.status.hero.exp);b.append("steps",core.status.hero.steps);b.append("norank",d?1:0);b.append("seed",core.getFlag("__seed__"));b.append("totalTime",Math.floor(core.status.hero.statistics.totalTime/1000));b.append("route",core.encodeRoute(core.status.route));b.append("base64",1);if(main.isCompetition){core.http("POST","/games/competition/upload.php",b)}else{core.http("POST","/games/upload.php",b)}core.events._gameOver_confirmDownload(a)};events.prototype._gameOver_confirmDownload=function(a){core.ui.closePanel();core.ui.drawConfirmBox("你想下载录像吗?",function(){var b={name:core.firstData.name,version:core.firstData.version,hard:core.status.hard,seed:core.getFlag("__seed__"),route:core.encodeRoute(core.status.route)};core.download(core.firstData.name+"_"+core.formatDate2(new Date())+".h5route",LZString.compressToBase64(JSON.stringify(b)));core.events._gameOver_askRate(a)},function(){core.events._gameOver_askRate(a)})};events.prototype._gameOver_askRate=function(a){core.ui.closePanel();if(core.status.extraEvent){core.status.event=core.status.extraEvent;delete core.status.extraEvent;core.lockControl();core.doAction();return}if(a==null){if(!core.hasSave(0)){core.ui.closePanel();core.restart();return}core.status.event.selection=0;core.ui.drawConfirmBox("你想读取自动存档么?",function(){core.ui.closePanel();core.doSL("autoSave","load")},function(){core.ui.closePanel();core.restart()});return}core.ui.drawConfirmBox("恭喜通关!你想查看榜单、评论,\n以及评分和标色投票吗?",function(){if(core.platform.isPC){window.open("/tower/?name="+core.firstData.name,"_blank");core.restart()}else{window.location.href="/tower/?name="+core.firstData.name}},function(){core.restart()})};events.prototype.restart=function(){core.showStartAnimate();core.playBgm(main.startBgm)};events.prototype.confirmRestart=function(){core.playSound("打开界面");core.status.event.selection=1;core.ui.drawConfirmBox("你确定要返回标题页面吗?",function(){core.playSound("确定");core.ui.closePanel();core.restart()},function(){core.playSound("取消");core.ui.closePanel()})};events.prototype.registerSystemEvent=function(b,a){this.systemEvents[b]=a};events.prototype.unregisterSystemEvent=function(a){delete this.systemEvents[a]};events.prototype.doSystemEvent=function(d,b,a){core.clearRouteFolding();if(this.systemEvents[d]){try{return core.doFunc(this.systemEvents[d],this,b,a)}catch(c){main.log(c);main.log("ERROR in systemEvents["+d+"]")}}if(this["_sys_"+d]){return this["_sys_"+d](b,a)}main.log("未知的系统事件: "+d+"!");if(a){a()}};events.prototype.trigger=function(x,y,callback){var _executeCallback=function(){if(callback){setTimeout(callback,1)}return};if(core.status.gameOver){return _executeCallback()}if(core.status.event.id=="action"){core.insertAction({type:"function","function":"function () { core.events._trigger_inAction("+x+","+y+"); }",async:true},null,null,null,true);return _executeCallback()}if(core.status.event.id){return _executeCallback()}var block=core.getBlock(x,y);if(block==null){return _executeCallback()}if(block.event.script){core.clearRouteFolding();try{eval(block.event.script)}catch(e){main.log(e)}}if(block.event.event){core.clearRouteFolding();core.insertAction(block.event.event,block.x,block.y);return _executeCallback()}if(block.event.trigger&&block.event.trigger!="null"){var noPass=block.event.noPass,trigger=block.event.trigger;if(noPass){core.clearAutomaticRouteNode(x,y)}if(trigger=="changeFloor"&&!noPass&&this._trigger_ignoreChangeFloor(block)){return _executeCallback()}core.status.automaticRoute.moveDirectly=false;this.doSystemEvent(trigger,block)}return _executeCallback()};events.prototype._trigger_inAction=function(x,y){if(core.status.gameOver||core.status.event.id!="action"){return}var block=core.getBlock(x,y);if(block==null){return core.doAction()}try{eval(block.event.script)}catch(e){main.log(e)}if(block.event.event){core.clearRouteFolding();core.insertAction(block.event.event,block.x,block.y);return core.doAction()}if(block.event.trigger&&block.event.trigger!="null"){this.setEvents(null,x,y);if(block.event.trigger=="action"){this.insertAction(block.event.data)}else{this.doSystemEvent(block.event.trigger,block,core.doAction);return}}return core.doAction()};events.prototype._trigger_ignoreChangeFloor=function(b){var a=core.flags.ignoreChangeFloor;if(b.event.data&&b.event.data.ignoreChangeFloor!=null){a=b.event.data.ignoreChangeFloor}if(a){if(core.isReplaying()){if(core.status.replay.toReplay[0]=="no"){core.status.replay.toReplay.shift();core.status.route.push("no");return true}}else{if(core.status.automaticRoute.autoHeroMove||core.status.automaticRoute.autoStep<core.status.automaticRoute.autoStepRoutes.length){core.status.route.push("no");return true}}}return false};events.prototype._sys_battle=function(c,b){var a=[];core.push(a,core.floors[core.status.floorId].beforeBattle[c.x+","+c.y]);core.push(a,(core.material.enemys[c.event.id]||{}).beforeBattle);if(a.length>0){core.push(a,[{type:"battle",x:c.x,y:c.y}]);core.clearContinueAutomaticRoute();var d=core.status.event.id=="action";if(d){core.insertAction(a,c.x,c.y);core.doAction()}else{core.autosave(true);core.insertAction(a,c.x,c.y,b)}}else{this.battle(c.event.id,c.x,c.y,false,b)}};events.prototype.battle=function(c,d,e,b,a){core.saveAndStopAutomaticRoute();c=c||core.getBlockId(d,e);if(!c){return core.clearContinueAutomaticRoute(a)}if(!core.enemys.canBattle(c,d,e)&&!b&&!core.status.event.id){core.stopSound();core.playSound("操作失败");core.drawTip("你打不过此怪物!",c);return core.clearContinueAutomaticRoute(a)}if(!core.status.event.id){core.autosave(true)}if(!this.beforeBattle(c,d,e)){return core.clearContinueAutomaticRoute(a)}this.afterBattle(c,d,e);if(a){a()}};events.prototype.beforeBattle=function(a,b,c){return this.eventdata.beforeBattle(a,b,c)};events.prototype.afterBattle=function(a,b,c){return this.eventdata.afterBattle(a,b,c)};events.prototype._sys_openDoor=function(b,a){this.openDoor(b.x,b.y,true,function(){core.replay();if(a){a()}})};events.prototype.openDoor=function(e,f,d,b){var a=core.getBlock(e,f);core.saveAndStopAutomaticRoute();if(!this._openDoor_check(a,e,f,d)){var c=core.status.lockControl;core.waitHeroToStop(function(){if(!c){core.unlockControl()}if(b){b()}});return}if(core.status.replay.speed==24){core.status.replay.animate=true;core.removeBlock(e,f);setTimeout(function(){core.status.replay.animate=false;core.events.afterOpenDoor(a.event.id,e,f);if(b){b()}},1)}else{this._openDoor_animate(a,e,f,b)}};events.prototype._openDoor_check=function(a,i,j,h){var b=function(){core.clearContinueAutomaticRoute();return false};if(a==null||a.event==null){return b()}var d=a.event.id;if(core.material.icons.animates[d]==null&&core.material.icons.npc48[d]==null){return b()}if(d=="steelDoor"&&core.flags.steelDoorWithoutKey){h=false}var c=a.event.doorInfo;if(c==null){return b()}var e=c.keys||{};if(h){for(var f in e){var g=e[f];if(f.endsWith(":o")){f=f.substring(0,f.length-2)}if(!core.material.items[f]){core.stopSound();core.playSound("操作失败");core.drawTip("无法开启此门");return b()}if(core.itemCount(f)<g){core.stopSound();core.playSound("操作失败");core.drawTip("你的"+((core.material.items[f]||{}).name||"钥匙")+"不足!",null,true);return false}}if(!core.status.event.id){core.autosave(true)}for(var f in e){if(!f.endsWith(":o")){core.removeItem(f,e[f])}}}core.playSound(c.openSound);return true};events.prototype._openDoor_animate=function(b,h,i,d){var c=core.getBlockInfo(b);c.opacity=b.opacity;c.filter=b.filter;var g=(b.event.doorInfo.time||160)/4;var f=core.status.lockControl;core.lockControl();core.status.replay.animate=true;core.removeBlock(h,i);c.posX=0;core.maps._drawBlockInfo(c,h,i);var e=function(){core.maps._removeBlockFromMap(core.status.floorId,b);if(!f){core.unlockControl()}core.status.replay.animate=false;core.events.afterOpenDoor(b.event.id,h,i);if(d){d()}};var a=window.setInterval(function(){c.posX++;if(c.posX==4){clearInterval(a);delete core.animateFrame.asyncId[a];e();return}core.maps._drawBlockInfo(c,h,i)},core.status.replay.speed==24?1:g/Math.max(core.status.replay.speed,1));core.animateFrame.lastAsyncId=a;core.animateFrame.asyncId[a]=e};events.prototype.afterOpenDoor=function(a,b,c){return this.eventdata.afterOpenDoor(a,b,c)};events.prototype._sys_getItem=function(b,a){this.getItem(b.event.id,1,b.x,b.y,false,a)};events.prototype.getItem=function(d,i,k,l,f,a){if(i==null){i=1}var g=core.material.items[d].cls;core.removeBlock(k,l);core.items.getItemEffect(d,i);var j="获得 "+core.material.items[d].name;if(i>1){j+="x"+i}if(g==="items"&&i==1){j+=core.items.getItemEffectTip(d)}core.drawTip(j,d);if(!core.hasFlag("__itemHint__")){core.setFlag("__itemHint__",[])}var h=core.getFlag("__itemHint__");if(core.flags.itemFirstText&&h.indexOf(d)<0&&g!="items"){var c=core.material.items[d].text||"该道具暂无描述";try{c=core.replaceText(c)}catch(b){}if(!core.status.event.id||core.status.event.id=="action"){core.insertAction("\t["+core.material.items[d].name+","+d+"]"+c+"\n"+(d.endsWith("Key")?"(钥匙类道具,遇到对应的门时自动打开)":g=="tools"?"(消耗类道具,请按T在道具栏使用)":g=="constants"?"(永久类道具,请按T在道具栏使用)":g=="equips"?"(装备类道具,请按Q在装备栏进行装备)":""))}h.push(d)}this.afterGetItem(d,k,l,f);if(a){a()}};events.prototype.afterGetItem=function(a,c,d,b){this.eventdata.afterGetItem(a,c,d,b)};events.prototype.getNextItem=function(b){if(core.isMoving()||!core.flags.enableGentleClick){return false}if(this._canGetNextItem()){return this._getNextItem(null,b)}var a=["up","down","left","right"].filter(function(c){return core.events._canGetNextItem(c)});return a.length>0?this._getNextItem(a[0],b):false};events.prototype._canGetNextItem=function(b){b=b||core.getHeroLoc("direction");if(!core.canMoveHero(null,null,b)){return}var c=core.getHeroLoc("x")+core.utils.scan[b].x;var d=core.getHeroLoc("y")+core.utils.scan[b].y;var a=core.getBlock(c,d);return a!=null&&!a.event.script&&!a.event.event&&a.event.trigger=="getItem"};events.prototype._getNextItem=function(a,b){a=a||core.getHeroLoc("direction");var c=core.getHeroLoc("x")+core.utils.scan[a].x;var d=core.getHeroLoc("y")+core.utils.scan[a].y;if(!b){core.status.route.push("getNext")}this.getItem(core.getBlockId(c,d),1,c,d,true);return true};events.prototype._sys_changeFloor=function(b,a){b=b.event.data;var c={};if(b.loc){c={x:b.loc[0],y:b.loc[1]}}if(b.direction){c.direction=b.direction}if(core.status.event.id!="action"){core.status.event.id=null}core.changeFloor(b.floorId,b.stair,c,b.time,function(){core.replay();if(a){a()}})};events.prototype.changeFloor=function(b,e,c,f,a){var d=this._changeFloor_getInfo(b,e,c,f);if(d==null){if(a){a()}return}b=d.floorId;d.locked=core.status.lockControl;core.dom.floorNameLabel.innerText=core.status.maps[b].title;core.lockControl();core.stopAutomaticRoute();core.clearContinueAutomaticRoute();core.status.replay.animate=true;clearInterval(core.interval.onDownInterval);core.interval.onDownInterval="tmp";this._changeFloor_beforeChange(d,a)};events.prototype._changeFloor_getInfo=function(a,d,b,e){a=a||core.status.floorId;if(a==":before"){var c=core.floorIds.indexOf(core.status.floorId);if(c>0){a=core.floorIds[c-1]}else{a=core.status.floorId}}else{if(a==":next"){var c=core.floorIds.indexOf(core.status.floorId);if(c<core.floorIds.length-1){a=core.floorIds[c+1]}else{a=core.status.floorId}}else{if(a==":now"){a=core.status.floorId}}}if(!core.status.maps[a]){main.log("不存在的楼层:"+a);return null}if(main.mode!="play"||core.isReplaying()){e=0}if(e==null){e=core.values.floorChangeTime}e/=20;return{floorId:a,time:e,heroLoc:core.clone(this._changeFloor_getHeroLoc(a,d,b))}};events.prototype._changeFloor_getHeroLoc=function(b,e,c){if(!c){c=core.clone(core.status.hero.loc)}if(e){if(e==":now"){c=core.clone(core.status.hero.loc)}else{if(e==":symmetry"){c.x=core.bigmap.width-1-core.getHeroLoc("x");c.y=core.bigmap.height-1-core.getHeroLoc("y")}else{if(e==":symmetry_x"){c.x=core.bigmap.width-1-core.getHeroLoc("x")}else{if(e==":symmetry_y"){c.y=core.bigmap.height-1-core.getHeroLoc("y")}else{if(core.status.maps[b][e]){c.x=core.status.maps[b][e][0];c.y=core.status.maps[b][e][1]}else{core.extractBlocks(b);var a=core.status.maps[b].blocks;for(var d in a){if(!a[d].disable&&a[d].event.id===e){c.x=a[d].x;c.y=a[d].y;break}}}}}}}}["x","y","direction"].forEach(function(f){if(c[f]==null){c[f]=core.getHeroLoc(f)}});return c};events.prototype._changeFloor_beforeChange=function(b,a){this._changeFloor_playSound();window.setTimeout(function(){if(b.time==0){core.events._changeFloor_changing(b,a)}else{core.showWithAnimate(core.dom.floorMsgGroup,b.time/2,function(){core.events._changeFloor_changing(b,a)})}},25)};events.prototype._changeFloor_playSound=function(){if(core.hasFlag("__fromLoad__")){core.playSound("读档")}else{if(core.hasFlag("__isFlying__")){core.playSound("飞行器")}else{core.playSound("上下楼")}}};events.prototype._changeFloor_changing=function(c,b){this.changingFloor(c.floorId,c.heroLoc);var a=flags.__lockViewport__;core.setFlag("__lockViewport__",null);core.drawHero();core.setFlag("__lockViewport__",a);if(c.time==0){this._changeFloor_afterChange(c,b)}else{core.hideWithAnimate(core.dom.floorMsgGroup,c.time/4,function(){core.events._changeFloor_afterChange(c,b)})}};events.prototype._changeFloor_afterChange=function(b,a){if(!b.locked){core.unlockControl()}core.status.replay.animate=false;core.events.afterChangeFloor(b.floorId);if(a){a()}};events.prototype.changingFloor=function(a,b){this.eventdata.changingFloor(a,b)};events.prototype.afterChangeFloor=function(a){if(main.mode!="play"){return}return this.eventdata.afterChangeFloor(a)};events.prototype.hasVisitedFloor=function(a){if(!core.hasFlag("__visited__")){core.setFlag("__visited__",{})}return core.getFlag("__visited__")[a]||false};events.prototype.visitFloor=function(a){if(!core.hasFlag("__visited__")){core.setFlag("__visited__",{})}core.getFlag("__visited__")[a]=true};events.prototype._sys_pushBox=function(b,a){this.pushBox(b);if(a){a()}};events.prototype.pushBox=function(b){if(b.event.id!="box"&&b.event.id!="boxed"){return}var c=core.getHeroLoc("direction"),e=b.x+core.utils.scan[c].x,f=b.y+core.utils.scan[c].y;if(!core.canMoveHero()){return}var a=core.flags.canGoDeadZone;core.flags.canGoDeadZone=true;if(!core.canMoveHero(b.x,b.y,c)){core.flags.canGoDeadZone=a;return}core.flags.canGoDeadZone=a;var d=core.getBlockId(e,f);if(d!=null&&d!="flower"){return}core.setBlock(d==null?"box":"boxed",e,f);if(b.event.id=="box"){core.removeBlock(b.x,b.y)}else{core.setBlock("flower",b.x,b.y)}core.insertAction([{type:"moveAction"},{type:"function","function":"function() { core.afterPushBox(); }"}])};events.prototype.afterPushBox=function(){return this.eventdata.afterPushBox()};events.prototype._sys_ski=function(b,a){core.insertAction(["V2.6后,请将滑冰放在背景层!"],b.x,b.y);if(a){a()}};events.prototype.onSki=function(b){if(b==null){b=core.getBgNumber()}var a=core.getBlockByNumber(b);return a&&a.event&&a.event.trigger=="ski"};events.prototype._sys_action=function(b,a){var d=core.clone(b.event.data),e=b.x,f=b.y;if(e==core.nextX()&&f==core.nextY()){var c=core.turnDirection(":back");var g=b.event.id,i=(b.event.faceIds||{})[c];if(i&&g!=i){var h=core.getNumberById(i);if(h>0){core.setBlock(h,e,f)}}}this.insertAction(d,e,f,a)};events.prototype._sys_custom=function(b,a){core.insertAction(["请使用\r[yellow]core.registerSystemEvent('custom', func)\r来处理自己添加的系统触发器!"],b.x,b.y,a)};events.prototype.registerEvent=function(b,a){this.actions[b]=a};events.prototype.unregisterEvent=function(a){delete this.actions[a]};events.prototype.doEvent=function(a,f,g,c){var d=a.type;if(this.actions[d]){try{return core.doFunc(this.actions[d],this,a,f,g,c)}catch(b){main.log(b);main.log("ERROR in actions["+d+"]")}}if(this["_action_"+d]){return this["_action_"+d](a,f,g,c)}core.insertAction("未知的自定义事件: "+d+"!");core.doAction()};events.prototype.setEvents=function(d,e,f,a){var b=core.status.event.data||{};if(d){var c=core.clone(d);if(!(c instanceof Array)){c=[c]}c.push({type:"_label"});b.list=[{todo:c,total:core.clone(c),condition:"false"}];if(d.length==0){core.status.autoEvents.forEach(function(g){core.autoEventExecuting(g.symbol,false)})}}if(e!=null){b.x=e}if(f!=null){b.y=f}if(a){b.callback=a}if(!b.appendingEvents){b.appendingEvents=[]}if(!b.locStack){b.locStack=[]}core.status.event.id="action";core.status.event.data=b};events.prototype.startEvents=function(b,c,d,a){if(!b){return}if(!(b instanceof Array)){b=[b]}this.setEvents(b,c,d,a);core.waitHeroToStop(function(){core.lockControl();core.doAction()})};events.prototype.doAction=function(){clearInterval(core.status.event.interval);clearTimeout(core.status.event.interval);clearInterval(core.status.event.animateUI);core.status.event.interval=null;delete core.status.event.aniamteUI;if(core.status.gameOver||core.status.replay.failed){return}if(this._doAction_finishEvents()){return}core.clearUI();var c=core.status.event.data.floorId||core.status.floorId;var e=core.status.event.data.x,f=core.status.event.data.y;var d=[c||":f",e!=null?e:"x",f!=null?f:"y"].join("@");var a=core.status.event.data.list[0];if(this._popEvents(a,d)){return}var b=a.todo.shift();core.status.event.data.current=b;if(typeof b=="string"){b={type:"text",text:b}}if(b._disabled){return core.doAction()}b.floorId=b.floorId||c;core.status.event.data.type=b.type;this.doEvent(b,e,f,d);return};events.prototype._doAction_finishEvents=function(){if(core.status.event.id!="action"){return true}if(core.status.event.data.list.length==0){if(core.status.event.data.appendingEvents.length>0){this.setEvents(core.status.event.data.appendingEvents.shift());return false}var a=core.status.event.data.callback;core.ui.closePanel();if(a){a()}core.replay();return true}return false};events.prototype._popEvents=function(a,b){if(a.todo.length==0){if(core.calValue(a.condition,b)){a.todo=core.clone(a.total)}else{core.status.event.data.list.shift()}core.doAction();return true}return false};events.prototype.insertAction=function(a,f,g,c,b){if(core.hasFlag("__statistics__")){return}if(core.status.gameOver){return}if(!a){return}core.clearRouteFolding();a=this.precompile(a);if(core.status.event.id!="action"){this.startEvents(a,f,g,c)}else{if(b){var e=core.status.event.data.list[0].todo;var d=0;for(var d=0;d<e.length;d++){if(e[d].type=="_label"){e.splice(d,0,a);break}}}else{core.unshift(core.status.event.data.list[0].todo,a)}this.setEvents(null,f,g,c)}};events.prototype.insertCommonEvent=function(h,b,j,k,c,a){var d=this.getCommonEvent(h);if(!d){if(c){c()}return}core.setFlag("arg0",h);if(b instanceof Array){for(var g=0;g<b.length;++g){try{if(b[g]!=null){core.setFlag("arg"+(g+1),b[g])}}catch(f){main.log(f)}}}this.insertAction({type:"dowhile",condition:"false",data:d},j,k,c,a)};events.prototype.getCommonEvent=function(a){if(!a||typeof a!=="string"){return null}return this.commonEvent[a]||null};events.prototype.recoverEvents=function(a){if(a){core.ui.closePanel();core.lockControl();core.status.event.id="action";core.status.event.data=a;setTimeout(function(){core.doAction()},30);return true}return false};events.prototype.checkAutoEvents=function(){if(!core.isPlaying()||(core.status.lockControl&&core.status.event.id!="action")){return}if(core.hasFlag("__doNotCheckAutoEvents__")){return}var b=[],a=[];core.status.autoEvents.forEach(function(c){var i=c.symbol,j=c.x,k=c.y,g=c.floorId;if(c.currentFloor&&g!=core.status.floorId){return}if(!c.multiExecute&&core.autoEventExecuted(i)){return}if((flags.__removed__||[]).indexOf(g)>=0){return}if(core.autoEventExecuting(i)){return}var h=g+"@"+j+"@"+k;try{if(!core.calValue(c.condition,h)){return}}catch(d){return}core.autoEventExecuting(i,true);core.autoEventExecuted(i,true);var f;if(j==null&&k==null){f=[{type:"dowhile",condition:"false",data:c.data},{type:"function","function":"function() { core.autoEventExecuting('"+i+"', false); }"}]}else{f=[{type:"function","function":"function() { core.pushEventLoc("+j+", "+k+", '"+g+"' ); }"},{type:"dowhile",condition:"false",data:c.data},{type:"function","function":"function() { core.popEventLoc(); core.autoEventExecuting('"+i+"', false); }"}]}if(c.delayExecute){a.push(f)}else{core.push(b,f)}});if(b.length==0&&a.length==0){return}if(core.status.event.id=="action"||b.length>0){core.insertAction(b);core.push(core.status.event.data.appendingEvents,a)}else{core.insertAction(a[0]);if(a.length>0){core.insertAction(a.slice(1))}}};events.prototype.autoEventExecuting=function(b,c){var a=core.getFlag("__aei__",[]);if(c==null){return a.indexOf(b)>=0}else{a=a.filter(function(d){return d!=b});if(c){a.push(b)}core.setFlag("__aei__",a)}};events.prototype.autoEventExecuted=function(b,c){var a=core.getFlag("__aed__",[]);if(c==null){return a.indexOf(b)>=0}else{a=a.filter(function(d){return d!=b});if(c){a.push(b)}core.setFlag("__aed__",a)}};events.prototype.pushEventLoc=function(b,c,a){if(core.status.event.id!="action"){return}core.status.event.data.locStack.push({x:core.status.event.data.x,y:core.status.event.data.y,floorId:core.status.event.data.floorId});core.status.event.data.x=b;core.status.event.data.y=c;core.status.event.data.floorId=a};events.prototype.popEventLoc=function(){if(core.status.event.id!="action"){return}var a=core.status.event.data.locStack.shift();if(a){core.status.event.data.x=a.x;core.status.event.data.y=a.y;core.status.event.data.floorId=a.floorId}};events.prototype.precompile=function(b){var a=this.__precompile_getArray();if(typeof b=="string"){return this.__precompile_text(b)}if(b instanceof Array){for(var c=0;c<b.length;++c){b[c]=this.precompile(b[c])}return b}if(b&&b.type){if(this["_precompile_"+b.type]){b=this["_precompile_"+b.type](b)}if(a.texts.indexOf(b.type)>=0){b.text=this.__precompile_text(b.text)}if(a.locs.indexOf(b.type)>=0){b.loc=this.__precompile_array(b.loc)}if(a.values.indexOf(b.type)>=0){b.value=core.replaceValue(b.value)}if(a.uievents.indexOf(b.type)>=0){b.x=core.replaceValue(b.x);b.y=core.replaceValue(b.y);b.width=core.replaceValue(b.width);b.height=core.replaceValue(b.height)}if(b.type in a.others){a.others[b.type].forEach(function(d){b[d]=core.replaceValue(b[d])})}}return b};events.prototype.__precompile_getArray=function(){var c=["text","autoText","scrollText","tip","textImage","input","input2","choices","confirm","fillText","fillBoldText","drawTextContent"];var a=["show","hide","setBlock","setBlockOpacity","showFloorImg","hideFloorImg","showBgFgMap","hideBgFgMap","setBgFgBlock","animate","setViewport","move","jumoHero","changeFloor","changePos","showTextImage","showGif","openDoor","closeDoor","battle","trigger","insert","setEnemyOnPoint","resetEnemyOnPoint"];var e=["setValue","setEnemy","setEnemyOnPoint","setEquip","setFloor","setGlobalValue",];var d=["clearMap","fillText","fillBoldText","fillRect","strokeRect","fillEllipse","strokeEllipse","fillArc","strokeArc","drawIcon","drawSelector","drawBackground",];var b={fillEllipse:["a","b","angle"],strokeEllipse:["a","b","angle"],fillRect:["radius","angle"],strokeRect:["radius","angle"],fillArc:["r","start","end"],strokeArc:["r","start","end"],drawLine:["x1","y1","x2","y2"],drawArrow:["x1","y1","x2","y2"],drawImage:["x","y","w","h","x1","y1","w1","h1","angle"],drawTextContent:["left","top"],};return{texts:c,locs:a,values:e,uievents:d,others:b}};events.prototype.__precompile_text=function(a){if(typeof a!="string"){return a}return a.replace(/\${(.*?)}/g,function(c,b){return"${"+core.replaceValue(b)+"}"})};events.prototype.__precompile_array=function(b){if(typeof b=="string"){b=core.replaceValue(b);return b}if(b instanceof Array){for(var a=0;a<b.length;++a){b[a]=this.__precompile_array(b[a])}}return b};events.prototype.__action_checkReplaying=function(){if(core.isReplaying()){core.doAction();return true}return false};events.prototype.__action_getLoc=function(a,c,d,b){if(a){c=core.calValue(a[0],b);d=core.calValue(a[1],b)}return[c,d]};events.prototype.__action_getHeroLoc=function(a,b){return this.__action_getLoc(a,core.getHeroLoc("x"),core.getHeroLoc("y"),b)};events.prototype.__action_getLoc2D=function(a,c,d,b){if(!(a&&a[0] instanceof Array)){a=[this.__action_getLoc(a,c,d,b)]}return a};events.prototype.__action_doAsyncFunc=function(b,a){var c=Array.prototype.slice.call(arguments,2);if(b){a.apply(this,c);core.doAction()}else{a.apply(this,c.concat(core.doAction))}};events.prototype._action_text=function(b,d,e,c){if(this.__action_checkReplaying()){return}b.text=core.replaceText(b.text,c);var a=b.code?("__text__"+b.code):null;b.ctx=a;if(core.getContextByName(a)&&!b.showAll){core.ui._animateUI("hide",a,function(){core.ui.drawTextBox(b.text,b);core.ui._animateUI("show",a,function(){if(b.async){core.doAction()}})});return}core.ui.drawTextBox(b.text,b);if(!b.showAll){core.ui._animateUI("show",a,function(){if(b.async){core.doAction()}})}};events.prototype._action_moveTextBox=function(a,c,d,b){if(this.__action_checkReplaying()){return}this.__action_doAsyncFunc(a.async,core.moveTextBox,a.code,this.__action_getLoc(a.loc,c,d,b),a.relative,a.moveMode,a.time)};events.prototype._action_clearTextBox=function(a,c,d,b){if(this.__action_checkReplaying()){return}core.clearTextBox(a.code,core.doAction)};events.prototype._action_autoText=function(a,c,d,b){if(this.__action_checkReplaying()){return}a.text=core.replaceText(a.text,b);core.ui.drawTextBox(a.text);setTimeout(core.doAction,a.time||3000)};events.prototype._action_scrollText=function(a,c,d,b){if(this.__action_checkReplaying()){return}a.text=core.replaceText(a.text,b);this.__action_doAsyncFunc(a.async,core.drawScrollText,a.text,a.time||5000,a.lineHeight||1.4)};events.prototype._action_comment=function(a,c,d,b){core.doAction()};events.prototype._action__label=function(a,c,d,b){core.doAction()};events.prototype._action_setText=function(a,c,d,b){this.setTextAttribute(a);core.doAction()};events.prototype._action_tip=function(a,c,d,b){core.drawTip(core.replaceText(a.text,b),a.icon);core.doAction()};events.prototype._action_show=function(a,c,d,b){a.loc=this.__action_getLoc2D(a.loc,c,d,b);if(a.time>0&&a.floorId==core.status.floorId){this.__action_doAsyncFunc(a.async,core.animateBlock,a.loc,"show",a.time)}else{a.loc.forEach(function(e){core.showBlock(e[0],e[1],a.floorId)});core.doAction()}};events.prototype._action_hide=function(a,c,d,b){a.loc=this.__action_getLoc2D(a.loc,c,d,b);if(a.time>0&&a.floorId==core.status.floorId){this.__action_doAsyncFunc(a.async,core.animateBlock,a.loc,a.remove?"remove":"hide",a.time)}else{a.loc.forEach(function(e){if(a.remove){core.removeBlock(e[0],e[1],a.floorId)}else{core.hideBlock(e[0],e[1],a.floorId)}});core.doAction()}};events.prototype._action_setBlock=function(a,c,d,b){a.loc=this.__action_getLoc2D(a.loc,c,d,b);a.time=a.time||0;a.floorId=a.floorId||core.status.floorId;if(a.time>0&&a.floorId==core.status.floorId){this.__action_doAsyncFunc(a.async,core.animateSetBlocks,a.number,a.loc,a.floorId,a.time)}else{a.loc.forEach(function(e){core.setBlock(a.number,e[0],e[1],a.floorId)});core.doAction()}};events.prototype._action_setBlockOpacity=function(a,c,d,b){a.loc=this.__action_getLoc2D(a.loc,c,d,b);if(a.time>0&&a.floorId==core.status.floorId){this.__action_doAsyncFunc(a.async,core.animateBlock,a.loc,a.opacity,a.time)}else{a.loc.forEach(function(e){core.setBlockOpacity(a.opacity,e[0],e[1],a.floorId)});core.doAction()}};events.prototype._action_setBlockFilter=function(a,c,d,b){a.loc=this.__action_getLoc2D(a.loc,c,d,b);a.loc.forEach(function(e){core.setBlockFilter(a,e[0],e[1],a.floorId)});core.doAction()};events.prototype._action_turnBlock=function(a,c,d,b){a.loc=this.__action_getLoc2D(a.loc,c,d,b);a.loc.forEach(function(e){core.turnBlock(a.direction,e[0],e[1],a.floorId)});core.doAction()};events.prototype._action_showFloorImg=function(a,c,d,b){core.maps.showFloorImage(this.__action_getLoc2D(a.loc,c,d,b),a.floorId,core.doAction)};events.prototype._action_hideFloorImg=function(a,c,d,b){core.maps.hideFloorImage(this.__action_getLoc2D(a.loc,c,d,b),a.floorId,core.doAction)};events.prototype._action_showBgFgMap=function(a,c,d,b){core.maps.showBgFgMap(a.name,this.__action_getLoc2D(a.loc,c,d,b),a.floorId,core.doAction)};events.prototype._action_hideBgFgMap=function(a,c,d,b){core.maps.hideBgFgMap(a.name,this.__action_getLoc2D(a.loc,c,d,b),a.floorId,core.doAction)};events.prototype._action_setBgFgBlock=function(a,c,d,b){a.loc=this.__action_getLoc2D(a.loc,c,d,b);a.loc.forEach(function(e){core.setBgFgBlock(a.name,a.number,e[0],e[1],a.floorId)});core.doAction()};events.prototype._action_follow=function(a,c,d,b){this.follow(a.name);core.doAction()};events.prototype._action_unfollow=function(a,c,d,b){this.unfollow(a.name);core.doAction()};events.prototype._action_animate=function(a,c,d,b){if(a.loc=="hero"){this.__action_doAsyncFunc(a.async,core.drawHeroAnimate,a.name)}else{a.loc=this.__action_getLoc(a.loc,c,d,b);this.__action_doAsyncFunc(a.async,core.drawAnimate,a.name,a.loc[0],a.loc[1],a.alignWindow)}};events.prototype._action_stopAnimate=function(a,c,d,b){core.stopAnimate(null,a.doCallback);core.doAction()};events.prototype._action_setViewport=function(a,c,d,b){if(a.dxy!=null){a.loc=[core.bigmap.offsetX/32+(core.calValue(a.dxy[0],b)||0),core.bigmap.offsetY/32+(core.calValue(a.dxy[1],b)||0)]}else{if(a.loc==null){a.loc=[core.getHeroLoc("x")-core.__HALF_SIZE__,core.getHeroLoc("y")-core.__HALF_SIZE__]}else{a.loc=this.__action_getLoc(a.loc,c,d,b)}}this.__action_doAsyncFunc(a.async,core.moveViewport,a.loc[0],a.loc[1],a.moveMode,a.time)};events.prototype._action_lockViewport=function(a,c,d,b){core.setFlag("__lockViewport__",a.lock||null);core.doAction()};events.prototype._action_move=function(a,d,e,c){var b=this.__action_getLoc(a.loc,d,e,c);this.__action_doAsyncFunc(a.async,core.moveBlock,b[0],b[1],a.steps,a.time,a.keep)};events.prototype._action_moveAction=function(a,e,f,d){if(core.canMoveHero()){var b=core.nextX(),c=core.nextY();if(core.noPass(b,c)){core.insertAction([{type:"trigger",loc:[b,c]}])}else{core.insertAction([{type:"moveHero",steps:["forward"]},{type:"function","function":"function() { core.moveOneStep(core.doAction); }",async:true},{type:"_label"},])}}core.doAction()};events.prototype._action_moveHero=function(a,c,d,b){this.__action_doAsyncFunc(a.async,core.eventMoveHero,a.steps,a.time)};events.prototype._action_jump=function(a,e,f,c){var b=this.__action_getLoc(a.from,e,f,c),d;if(a.dxy){d=[b[0]+(core.calValue(a.dxy[0],c)||0),b[1]+(core.calValue(a.dxy[1],c)||0)]}else{d=this.__action_getLoc(a.to,e,f,c)}this.__action_doAsyncFunc(a.async,core.jumpBlock,b[0],b[1],d[0],d[1],a.time,a.keep)};events.prototype._precompile_jump=function(a){a.from=this.__precompile_array(a.from);a.to=this.__precompile_array(a.to);a.dxy=this.__precompile_array(a.dxy);return a};events.prototype._action_jumpHero=function(a,d,e,c){var b;if(a.dxy){b=[core.getHeroLoc("x")+(core.calValue(a.dxy[0],c)||0),core.getHeroLoc("y")+(core.calValue(a.dxy[1],c)||0)]}else{b=this.__action_getHeroLoc(a.loc,c)}this.__action_doAsyncFunc(a.async,core.jumpHero,b[0],b[1],a.time)};events.prototype._action_changeFloor=function(a,e,f,d){var c=this.__action_getHeroLoc(a.loc,d);var b={x:c[0],y:c[1],direction:a.direction};core.changeFloor(a.floorId,a.stair,b,a.time,core.doAction)};events.prototype._action_changePos=function(a,d,e,c){core.clearMap("hero");if(!a.loc&&a.direction){core.setHeroLoc("direction",core.turnDirection(a.direction),true);core.drawHero();return core.doAction()}var b=this.__action_getHeroLoc(a.loc,c);core.setHeroLoc("x",b[0]);core.setHeroLoc("y",b[1]);if(a.direction){core.setHeroLoc("direction",core.turnDirection(a.direction))}core.drawHero();core.doAction()};events.prototype._action_showImage=function(a,c,d,b){if(core.isReplaying()){a.time=0}this.__action_doAsyncFunc(a.async||a.time==0,core.showImage,a.code,a.image+(a.reverse||""),a.sloc,a.loc,a.opacity,a.time)};events.prototype._precompile_showImage=function(a){a.sloc=this.__precompile_array(a.sloc);a.loc=this.__precompile_array(a.loc);return a};events.prototype._action_showTextImage=function(b,e,f,d){var c=this.__action_getLoc(b.loc,0,0,d);if(core.isReplaying()){b.time=0}b.text=core.replaceText(b.text,d);var a=(Math.random()+"_"+Math.random()).replace(/\./g,"")+".png";core.material.images.images[a]=core.ui.textImage(b.text);this.__action_doAsyncFunc(b.async||b.time==0,core.showImage,b.code,a+(b.reverse||""),null,c,b.opacity,b.time);delete core.material.images.images[a]};events.prototype._action_hideImage=function(a,c,d,b){if(core.isReplaying()){a.time=0}this.__action_doAsyncFunc(a.async||a.time==0,core.hideImage,a.code,a.time)};events.prototype._action_showGif=function(a,d,e,c){var b=this.__action_getLoc(a.loc,0,0,c);this.showGif(a.name,b[0],b[1]);core.doAction()};events.prototype._action_moveImage=function(a,c,d,b){if(this.__action_checkReplaying()){return}this.__action_doAsyncFunc(a.async,core.moveImage,a.code,a.to,a.opacity,a.moveMode,a.time)};events.prototype._precompile_moveImage=function(a){a.to=this.__precompile_array(a.to);return a};events.prototype._action_rotateImage=function(a,c,d,b){if(this.__action_checkReplaying()){return}this.__action_doAsyncFunc(a.async,core.rotateImage,a.code,a.center,a.angle,a.moveMode,a.time)};events.prototype._precompile_rotateImage=function(a){a.center=this.__precompile_array(a.center);return a};events.prototype._action_scaleImage=function(a,c,d,b){if(this.__action_checkReplaying()){return}this.__action_doAsyncFunc(a.async,core.scaleImage,a.code,a.center,a.scale,a.moveMode,a.time)};events.prototype._precompile_scaleImage=function(a){a.center=this.__precompile_array(a.center);return a};events.prototype._action_setCurtain=function(a,c,d,b){if(a.async){core.setCurtain(a.color||core.status.thisMap.color,a.time,a.moveMode);if(a.color==null||a.keep){core.setFlag("__color__",a.color||null)}core.doAction()}else{core.setCurtain(a.color||core.status.thisMap.color,a.time,a.moveMode,function(){if(a.color==null||a.keep){core.setFlag("__color__",a.color||null)}core.doAction()})}};events.prototype._action_screenFlash=function(a,c,d,b){this.__action_doAsyncFunc(a.async,core.screenFlash,a.color,a.time,a.times,a.moveMode)};events.prototype._action_setWeather=function(a,c,d,b){core.setWeather(a.name,a.level);if(a.keep&&["rain","snow","sun","fog","cloud"].indexOf(a.name)>=0){core.setFlag("__weather__",[a.name,a.level])}else{core.removeFlag("__weather__")}core.doAction()};events.prototype._action_openDoor=function(a,e,f,d){var c=this.__action_getLoc(a.loc,e,f,d);var b=a.floorId;if(b==core.status.floorId){this.__action_doAsyncFunc(a.async,core.openDoor,c[0],c[1],a.needKey)}else{core.removeBlock(c[0],c[1],b);core.doAction()}};events.prototype._action_closeDoor=function(a,d,e,c){var b=this.__action_getLoc(a.loc,d,e,c);this.__action_doAsyncFunc(a.async,core.closeDoor,b[0],b[1],a.id)};events.prototype._action_useItem=function(a,c,d,b){if(a.id!="book"&&core.canUseItem(a.id)){core.useItem(a.id,true,core.doAction)}else{core.playSound("操作失败");core.drawTip("当前无法使用"+((core.material.items[a.id]||{}).name||"未知道具"));core.doAction()}};events.prototype._action_loadEquip=function(a,c,d,b){core.loadEquip(a.id);core.doAction()};events.prototype._action_unloadEquip=function(a,c,d,b){core.unloadEquip(a.pos);core.doAction()};events.prototype._action_openShop=function(a,c,d,b){core.setShopVisited(a.id,true);if(a.open){core.openShop(a.id,true)}core.doAction()};events.prototype._action_disableShop=function(a,c,d,b){core.setShopVisited(a.id,false);core.doAction()};events.prototype._action_battle=function(a,d,e,c){if(a.id){this.battle(a.id,null,null,true,core.doAction)}else{if(a.floorId!=core.status.floorId){core.doAction();return}var b=this.__action_getLoc(a.loc,d,e,c);this.battle(null,b[0],b[1],true,core.doAction)}};events.prototype._action_trigger=function(a,d,e,c){var b=this.__action_getLoc(a.loc,d,e,c);this._trigger_inAction(b[0],b[1])};events.prototype._action_insert=function(a,k,l,h){if(a.name){core.insertCommonEvent(a.name,a.args)}else{if(a.args instanceof Array){for(var f=0;f<a.args.length;++f){try{if(a.args[f]!=null){core.setFlag("arg"+(f+1),a.args[f])}}catch(b){main.log(b)}}}var g=this.__action_getLoc(a.loc,k,l,h);core.setFlag("arg0",g);var d=a.floorId;var j=a.which||"events";var c=(core.floors[d][j]||[])[g[0]+","+g[1]];if(c){this.insertAction(c.data||c)}}core.doAction()};events.prototype._action_playBgm=function(a,c,d,b){core.playBgm(a.name,a.startTime||0);core.setFlag("__bgm__",a.keep?a.name:null);core.doAction()};events.prototype._action_pauseBgm=function(a,c,d,b){core.pauseBgm();core.doAction()};events.prototype._action_resumeBgm=function(a,c,d,b){core.resumeBgm(a.resume);core.doAction()};events.prototype._action_loadBgm=function(a,c,d,b){core.loadBgm(a.name);core.doAction()};events.prototype._action_freeBgm=function(a,c,d,b){core.freeBgm(a.name);core.doAction()};events.prototype._action_playSound=function(a,c,d,b){if(a.stop){core.stopSound()}if(a.sync){core.playSound(a.name,a.pitch,core.doAction)}else{core.playSound(a.name,a.pitch);core.doAction()}};events.prototype._action_stopSound=function(a,c,d,b){core.stopSound();core.doAction()};events.prototype._action_setVolume=function(a,c,d,b){a.value=core.clamp(parseInt(a.value)/100,0,1);core.setFlag("__volume__",a.value);this.__action_doAsyncFunc(a.async,core.setVolume,a.value,a.time||0)};events.prototype._action_setBgmSpeed=function(a,c,d,b){core.setBgmSpeed(a.value,a.pitch||false);core.doAction()};events.prototype._action_setValue=function(a,c,d,b){this.setValue(a.name,a.operator,a.value,b);if(!a.norefresh){if(core.status.hero.hp<=0){core.status.hero.hp=0;core.updateStatusBar();core.events.lose()}else{core.updateStatusBar()}}core.doAction()};events.prototype._action_addValue=function(a,c,d,b){a.operator="+=";this._action_setValue(a,c,d,b)};events.prototype._action_setEnemy=function(a,c,d,b){this.setEnemy(a.id,a.name,a.value,a.operator,b,a.norefresh);core.doAction()};events.prototype._action_setEnemyOnPoint=function(a,d,e,c){var b=this.__action_getLoc2D(a.loc,d,e,c);b.forEach(function(f){core.setEnemyOnPoint(f[0],f[1],a.floorId,a.name,a.value,a.operator,c,a.norefresh)});core.doAction()};events.prototype._action_resetEnemyOnPoint=function(a,d,e,c){var b=this.__action_getLoc2D(a.loc,d,e,c);b.forEach(function(f){core.resetEnemyOnPoint(f[0],f[1],a.floorId,a.norefresh)});core.doAction()};events.prototype._precompile_moveEnemyOnPoint=function(a){a.from=this.__precompile_array(a.from);a.to=this.__precompile_array(a.to);a.dxy=this.__precompile_array(a.dxy);return a};events.prototype._action_moveEnemyOnPoint=function(a,e,f,c){var b=this.__action_getLoc(a.from,e,f,c),d;if(a.dxy){d=[b[0]+(core.calValue(a.dxy[0],c)||0),b[1]+(core.calValue(a.dxy[1],c)||0)]}else{d=this.__action_getLoc(a.to,e,f,c)}this.moveEnemyOnPoint(b[0],b[1],d[0],d[1],a.floorId,a.norefresh);core.doAction()};events.prototype._action_setEquip=function(a,c,d,b){core.setEquip(a.id,a.valueType,a.name,a.value,a.operator,b);core.doAction()};events.prototype._action_setFloor=function(a,c,d,b){this.setFloorInfo(a.name,a.value,a.floorId,b);core.doAction()};events.prototype._action_setGlobalAttribute=function(a,c,d,b){this.setGlobalAttribute(a.name,a.value);core.doAction()};events.prototype._action_setGlobalValue=function(a,c,d,b){core.values[a.name]=a.value;core.doAction()};events.prototype._action_setGlobalFlag=function(a,c,d,b){this.setGlobalFlag(a.name,a.value);core.doAction()};events.prototype._action_setNameMap=function(a,c,d,b){this.setNameMap(a.name,a.value);core.doAction()};events.prototype._action_setHeroIcon=function(a,c,d,b){this.setHeroIcon(a.name,a.noDraw);core.doAction()};events.prototype._action_input=function(a,c,d,b){this.__action_getInput(core.replaceText(a.text,b),false,function(e){e=Math.abs(parseInt(e)||0);core.status.route.push("input:"+e);core.setFlag("input",e);core.doAction()})};events.prototype._action_input2=function(a,c,d,b){this.__action_getInput(core.replaceText(a.text,b),true,function(e){e=e||"";core.status.route.push("input2:"+core.encodeBase64(e));core.setFlag("input",e);core.doAction()})};events.prototype.__action_getInput=function(d,f,b){var h,g=f?"input2:":"input:";if(core.isReplaying()){var a=core.status.replay.toReplay.shift();try{if(a.indexOf(g)!=0){console.warn("警告!当前需要一个 "+g+" 项,实际为 "+a);core.status.replay.toReplay.unshift(a);return b(f?"":0)}if(f){h=core.decodeBase64(a.substring(7))}else{h=parseInt(a.substring(6))}b(h)}catch(c){core.control._replay_error(a);return}}else{core.myprompt(core.replaceText(d),null,b)}};events.prototype._action_if=function(a,c,d,b){if(core.calValue(a.condition,b)){core.events.insertAction(a["true"])}else{core.events.insertAction(a["false"])}core.doAction()};events.prototype._precompile_if=function(a){a.condition=core.replaceValue(a.condition);a["true"]=this.precompile(a["true"]);a["false"]=this.precompile(a["false"]);return a};events.prototype._action_switch=function(b,g,h,f){var d=core.calValue(b.condition,f);var e=[];for(var c=0;c<b.caseList.length;c++){if(b.caseList[c]._disabled){continue}var a=b.caseList[c]["case"];if(a=="default"||core.calValue(a,f)===d){core.push(e,b.caseList[c].action);if(!b.caseList[c].nobreak){break}}}core.insertAction(e);core.doAction()};events.prototype._precompile_switch=function(a){a.condition=core.replaceValue(a.condition);for(var b=0;b<a.caseList.length;b++){a.caseList[b]["case"]=core.replaceValue(a.caseList[b]["case"]);a.caseList[b].action=this.precompile(a.caseList[b].action)}return a};events.prototype._action_choices=function(b,f,g,e){b.choices=b.choices.filter(function(i){if(i._disabled){return false}if(i.condition==null||i.condition==""){return true}try{return core.calValue(i.condition,e)}catch(h){return true}});if(b.choices.length==0){return this.doAction()}if(core.isReplaying()){var a=core.status.replay.toReplay.shift();if(a.indexOf("choices:")==0&&!(a=="choices:none"&&!b.timeout)){var d=a.substring(8);if(!this.__action_choices_replaying(b,d)){core.control._replay_error(a);return}}else{if(main.replayChecking){if(a!="choices:none"){core.status.replay.toReplay.unshift(a)}core.events.__action_choices_replaying(b,0)}else{core.myprompt("录像回放出错!当前需要执行选择项但录像中未记录。\n如需修复请输入您要选的项(从0起),点击取消将不会修复。",0,function(h){if(h==null){core.control._replay_error(a);return}if(a!="choices:none"){core.status.replay.toReplay.unshift(a)}core.events.__action_choices_replaying(b,((parseInt(h)||0)+b.choices.length)%b.choices.length)})}}}else{if(b.timeout){core.status.event.interval=setTimeout(function(){core.status.route.push("choices:none");core.setFlag("timeout",0);core.doAction()},b.timeout)}core.status.event.timeout=new Date().getTime()+(b.timeout||0)}for(var c=0;c<b.choices.length;c++){if(typeof b.choices[c]==="string"){b.choices[c]={text:b.choices[c]}}b.choices[c].text=core.replaceText(b.choices[c].text,e)}core.ui.drawChoices(core.replaceText(b.text,e),b.choices,b.width)};events.prototype.__action_choices_replaying=function(a,b){var c=b;if(b!="none"){c=parseInt(b);if(isNaN(c)){return false}if(c<0){c+=a.choices.length}if(c<0){return false}if(c%100>50){c+=a.choices.length}if(c%100>a.choices.length){return false}var d=Math.floor(c/100)||0;core.setFlag("timeout",d);c%=100}else{core.setFlag("timeout",0)}core.status.event.selection=c;setTimeout(function(){core.status.route.push("choices:"+b);if(c!="none"){var e=a.choices[c];if(e.need!=null&&e.need!=""&&!core.calValue(e.need)){core.control._replay_error("无法选择项:"+b);return}else{core.insertAction(e.action)}}core.doAction()},core.status.replay.speed==24?1:750/Math.max(1,core.status.replay.speed));return true};events.prototype._precompile_choices=function(a){if(!(a.choices instanceof Array)){return a}for(var b=0;b<a.choices.length;++b){a.choices[b].condition=core.replaceValue(a.choices[b].condition);a.choices[b].text=this.__precompile_text(a.choices[b].text);a.choices[b].action=this.precompile(a.choices[b].action)}return a};events.prototype._action_confirm=function(b,e,f,d){b.text=core.replaceText(b.text,d);core.status.event.ui={text:b.text,yes:b.yes,no:b.no};if(core.isReplaying()){var a=core.status.replay.toReplay.shift();if(a.indexOf("choices:")==0&&!(a=="choices:none"&&!b.timeout)){var c=a.substring(8);if(c=="none"||((c=parseInt(c))>=0)&&c%100<2){this.__action_confirm_replaying(b,c)}else{core.control._replay_error(a);return}}else{if(a!="choices:none"){core.status.replay.toReplay.unshift(a)}this.__action_confirm_replaying(b,b["default"]?0:1)}}else{core.status.event.selection=b["default"]?0:1;if(b.timeout){core.status.event.interval=setTimeout(function(){core.status.route.push("choices:none");core.setFlag("timeout",0);core.doAction()},b.timeout)}core.status.event.timeout=new Date().getTime()+(b.timeout||0)}core.ui.drawConfirmBox(b.text)};events.prototype.__action_confirm_replaying=function(a,b){if(b!="none"){var c=Math.floor(b/100)||0;core.setFlag("timeout",c);b%=100}else{core.setFlag("timeout",0)}core.status.event.selection=b;setTimeout(function(){core.status.route.push("choices:"+b);if(b!="none"){if(b==0){core.insertAction(a.yes)}else{core.insertAction(a.no)}}core.doAction()},core.status.replay.speed==24?1:750/Math.max(1,core.status.replay.speed))};events.prototype._precompile_confirm=function(a){a.yes=this.precompile(a.yes);a.no=this.precompile(a.no);return a};events.prototype._action_for=function(b,j,k,e){if(!/^temp:[A-Z]$/.test(b.name)){core.insertAction("循环遍历事件只支持临时变量!");return core.doAction()}var c=core.calValue(b.from);var h=core.calValue(b.to);var f=core.calValue(b.step);if(typeof c!="number"||typeof h!="number"||typeof f!="number"){core.insertAction("循环遍历事件要求【起始点】【终止点】【每步】仅能是数字!");return core.doAction()}if((f>0&&c>h)||(f<0&&c<h)){core.doAction();return}var d=b.name.substring(5);core.setFlag("@temp@"+d,c);var i="@temp@for-to@"+d;var g="@temp@for-step@"+d;core.setFlag(i,b.to);core.setFlag(g,b.step);var a="(function () {var to = core.calValue(core.getFlag('"+i+"'));var step = core.calValue(core.getFlag('"+g+"'));if (typeof step != 'number' || typeof to != 'number') return false;if (step == 0) return true;var currentValue = core.getFlag('@temp@"+d+"');currentValue += step;core.setFlag('@temp@"+d+"', currentValue);if (step > 0) { return currentValue <= to; }else { return currentValue >= to; }})()";return this._action_dowhile({condition:a,data:b.data},j,k,e)};events.prototype._precompile_for=function(a){a.from=core.replaceValue(a.from);a.to=core.replaceValue(a.to);a.step=core.replaceValue(a.step);a.data=this.precompile(a.data);return a};events.prototype._action_forEach=function(b,e,f,d){if(!/^temp:[A-Z]$/.test(b.name)){core.insertAction(["循环遍历事件只支持临时变量!"]);return core.doAction()}var c="@temp@forEach@"+b.name.substring(5);core.setFlag(c,core.clone(b.list));var a="(function () {var list = core.getFlag('"+c+"', []);if (list.length == 0) return false;core.setFlag('@temp@'+'"+b.name.substring(5)+"', list.shift());return true;})()";return this._action_while({condition:a,data:b.data},e,f,d)};events.prototype._precompile_forEach=function(a){a.data=this.precompile(a.data);return a};events.prototype._action_while=function(a,d,e,c){if(core.calValue(a.condition,c)){var b=core.clone(a.data);if(!(b instanceof Array)){b=[b]}b.push({type:"_label"});core.unshift(core.status.event.data.list,{todo:b,total:core.clone(b),condition:a.condition})}core.doAction()};events.prototype._precompile_while=function(a){a.condition=core.replaceValue(a.condition);a.data=this.precompile(a.data);return a};events.prototype._action_dowhile=function(a,d,e,c){var b=core.clone(a.data);if(!(b instanceof Array)){b=[b]}b.push({type:"_label"});core.unshift(core.status.event.data.list,{todo:b,total:core.clone(b),condition:a.condition});core.doAction()};events.prototype._precompile_dowhile=function(a){a.condition=core.replaceValue(a.condition);a.data=this.precompile(a.data);return a};events.prototype._action_break=function(a,d,e,c){var b=a.n||1;while(b--){if(core.status.event.data.list.length>1){core.status.event.data.list.shift()}}core.doAction()};events.prototype._action_continue=function(a,d,e,c){var b=a.n||1;while(b-->1){if(core.status.event.data.list.length>1){core.status.event.data.list.shift()}}if(core.status.event.data.list.length>1){if(core.calValue(core.status.event.data.list[0].condition,c)){core.status.event.data.list[0].todo=core.clone(core.status.event.data.list[0].total)}else{core.status.event.data.list.shift()}}core.doAction()};events.prototype._action_win=function(a,c,d,b){this.win(core.replaceText(a.reason,b),a.norank,a.noexit)};events.prototype._action_lose=function(a,c,d,b){this.lose(core.replaceText(a.reason,b))};events.prototype._action_restart=function(a,c,d,b){core.restart()};events.prototype._action_function=function(data,x,y,prefix){var func=data["function"];try{if(typeof func=="string"&&func.indexOf("function")==0){eval("("+func+")()")}}catch(e){main.log(e)}if(!data.async){core.doAction()}};events.prototype._action_update=function(a,c,d,b){core.updateStatusBar(a.doNotCheckAutoEvents);core.doAction()};events.prototype._action_showStatusBar=function(a,c,d,b){core.showStatusBar();core.doAction()};events.prototype._action_hideStatusBar=function(a,c,d,b){core.hideStatusBar(a.toolbox);core.doAction()};events.prototype._action_showHero=function(a,c,d,b){a.opacity=1;return this._action_setHeroOpacity(a,c,d,b)};events.prototype._action_hideHero=function(a,c,d,b){a.opacity=0;return this._action_setHeroOpacity(a,c,d,b)};events.prototype._action_setHeroOpacity=function(a,c,d,b){a.time=a.time||0;if(a.opacity==null){a.opacity=1}if(a.time>0){this.__action_doAsyncFunc(a.async,core.setHeroOpacity,a.opacity,a.moveMode,a.time)}else{core.setFlag("__heroOpacity__",a.opacity);core.drawHero();core.doAction()}};events.prototype._action_vibrate=function(a,c,d,b){this.__action_doAsyncFunc(a.async,core.vibrate,a.direction,a.time,a.speed,a.power)};events.prototype._action_sleep=function(a,c,d,b){core.timeout.sleepTimeout=setTimeout(function(){core.timeout.sleepTimeout=null;core.doAction()},core.isReplaying()?Math.min(a.time,20):a.time)};events.prototype._action_wait=function(b,e,f,c){if(core.isReplaying()){var a=core.status.replay.toReplay.shift();if(a.indexOf("input:")==0&&!(a=="input:none"&&!b.timeout)){if(a=="input:none"){core.status.route.push("input:none");core.setFlag("type",-1);core.setFlag("timeout",0);this.__action_wait_afterGet(b);return core.doAction()}else{var d=parseInt(a.substring(6));core.status.route.push("input:"+d);this.__action_wait_getValue(d);if(this.__action_wait_afterGet(b)||!b.forceChild){return core.doAction()}}}core.control._replay_error(a);return}else{if(b.timeout){core.status.event.interval=setTimeout(function(){core.status.route.push("input:none");core.setFlag("type",-1);core.setFlag("timeout",0);core.events.__action_wait_afterGet(b);core.doAction()},b.timeout)}}core.status.event.timeout=new Date().getTime()+(b.timeout||0)};events.prototype.__action_wait_getValue=function(c){core.setFlag("timeout",Math.floor(c/100000000)||0);c%=100000000;if(c>=1000000){core.setFlag("type",1);var a=parseInt((c-1000000)/1000),b=c%1000;core.setFlag("px",a);core.setFlag("py",b);core.setFlag("x",parseInt(a/32));core.setFlag("y",parseInt(b/32))}else{if(c>=10000){core.setFlag("type",1);var d=parseInt((c-10000)/100),e=c%100;core.setFlag("px",32*d+16);core.setFlag("py",32*e+16);core.setFlag("x",d);core.setFlag("y",e)}else{if(c>0){core.setFlag("type",0);core.setFlag("keycode",c)}}}};events.prototype.__action_wait_afterGet=function(a){if(!a.data){return false}var d=[];var c=false;var b=false;a.data.forEach(function(h){if(h._disabled||c){return}if(h["case"]=="keyboard"&&core.getFlag("type")==0){(h.keycode+"").split(",").forEach(function(e){if(core.getFlag("keycode",0)==e){b=true;core.push(d,h.action);if(h["break"]){c=true}}})}if(h["case"]=="mouse"&&h.px instanceof Array&&h.py instanceof Array&&core.getFlag("type")==1){var k=core.calValue(h.px[0]);var j=core.calValue(h.px[1]);var n=core.calValue(h.py[0]);var m=core.calValue(h.py[1]);var i=core.getFlag("px",0),l=core.getFlag("py",0);if(i>=k&&i<=j&&l>=n&&l<=m){b=true;core.push(d,h.action);if(h["break"]){c=true}}}if(h["case"]=="condition"){var f=false;try{f=core.calValue(h.condition)}catch(g){}if(f){b=true;core.push(d,h.action);if(h["break"]){c=true}}}if(h["case"]=="timeout"&&core.getFlag("type")==-1){b=true;core.push(d,h.action);if(h["break"]){c=true}}});if(b){core.insertAction(d);return true}return false};events.prototype._precompile_wait=function(a){if(a.data){a.data.forEach(function(b){if(b.px!=null){b.px=this.__precompile_array(b.px)}if(b.py!=null){b.py=this.__precompile_array(b.py)}if(b.condition!=null){b.condition=this.__precompile_array(b.condition)}b.action=this.precompile(b.action)},this)}return a};events.prototype._action_waitAsync=function(a,d,e,b){var c=window.setInterval(function(){if(!core.hasAsync()&&(a.excludeAnimates||core.isReplaying()||core.getPlayingAnimates().length==0)&&(!a.includeSounds||core.isReplaying()||core.getPlayingSounds().length==0)){clearInterval(c);core.doAction()}},50/core.status.replay.speed)};events.prototype._action_stopAsync=function(a,c,d,b){core.stopAsync();core.doAction()};events.prototype._action_callBook=function(a,d,f,c){if(core.isReplaying()||!core.hasItem("book")){core.doAction()}else{var b=core.clone(core.status.event.data);core.ui.closePanel();core.openBook();core.status.event.interval=b}};events.prototype._action_callSave=function(a,f,g,d){if(core.isReplaying()||core.hasFlag("__events__")){core.removeFlag("__events__");core.doAction()}else{var b=core.clone(core.status.event.data);core.ui.closePanel();var c=core.hasFlag("__forbidSave__");core.removeFlag("__forbidSave__");core.save();if(c){core.setFlag("__forbidSave__",true)}core.status.event.interval=b}};events.prototype._action_autoSave=function(a,d,e,c){var b=core.hasFlag("__forbidSave__");core.removeFlag("__forbidSave__");core.autosave();if(b){core.setFlag("__forbidSave__",true)}if(!a.nohint){core.drawTip("已自动存档")}core.doAction()};events.prototype._action_forbidSave=function(a,c,d,b){core.setFlag("__forbidSave__",a.forbid||null);core.doAction()};events.prototype._action_callLoad=function(a,d,f,c){if(this.__action_checkReplaying()){return}var b=core.clone(core.status.event.data);core.ui.closePanel();core.load();core.status.event.interval=b};events.prototype._action_exit=function(a,c,d,b){this.setEvents([]);core.doAction()};events.prototype._action_previewUI=function(a,c,d,b){this.insertAction(a.action);core.doAction()};events.prototype._precompile_previewUI=function(a){a.action=this.precompile(a.action);return a};events.prototype.__action_doUIEvent=function(b){this.__action_doUIEvent_doOne(b);var a=core.status.event.data.list[0];while(a.todo.length>0){b=a.todo[0];if(this.__action_doUIEvent_doOne(a.todo[0])){a.todo.shift()}else{break}}core.doAction()};events.prototype.__action_doUIEvent_doOne=function(a){if(core.ui["_uievent_"+a.type]){core.ui["_uievent_"+a.type](a);return true}return false};events.prototype._action_clearMap=function(a,c,d,b){this.__action_doUIEvent(a)};events.prototype._action_fillText=function(a,c,d,b){a.text=core.replaceText(a.text,b);this.__action_doUIEvent(a)};events.prototype._action_fillBoldText=function(a,c,d,b){a.text=core.replaceText(a.text,b);this.__action_doUIEvent(a)};events.prototype._action_fillRect=function(a,c,d,b){this.__action_doUIEvent(a)};events.prototype._action_fillPolygon=function(a,c,d,b){this.__action_doUIEvent(a)};events.prototype._precompile_fillPolygon=function(a){a.nodes=this.__precompile_array(a.nodes);return a};events.prototype._action_strokeRect=function(a,c,d,b){this.__action_doUIEvent(a)};events.prototype._action_strokePolygon=function(a,c,d,b){this.__action_doUIEvent(a)};events.prototype._precompile_strokePolygon=function(a){a.nodes=this.__precompile_array(a.nodes);return a};events.prototype._action_fillEllipse=function(a,c,d,b){this.__action_doUIEvent(a)};events.prototype._action_strokeEllipse=function(a,c,d,b){this.__action_doUIEvent(a)};events.prototype._action_fillArc=function(a,c,d,b){this.__action_doUIEvent(a)};events.prototype._action_strokeArc=function(a,c,d,b){this.__action_doUIEvent(a)};events.prototype._action_drawLine=function(a,c,d,b){this.__action_doUIEvent(a)};events.prototype._action_drawArrow=function(a,c,d,b){this.__action_doUIEvent(a)};events.prototype._action_setAttribute=function(a,c,d,b){this.__action_doUIEvent(a)};events.prototype._action_setFilter=function(a,c,d,b){this.__action_doUIEvent(a)};events.prototype._action_drawImage=function(a,c,d,b){this.__action_doUIEvent(a)};events.prototype._action_drawIcon=function(a,c,d,b){this.__action_doUIEvent(a)};events.prototype._action_drawSelector=function(a,c,d,b){this.__action_doUIEvent(a)};events.prototype._action_drawBackground=function(a,c,d,b){this.__action_doUIEvent(a)};events.prototype._action_drawTextContent=function(a,c,d,b){a.text=core.replaceText(a.text,b);this.__action_doUIEvent(a)};events.prototype._checkStatus=function(c,b,a){if(b&&core.status.event.id==c){core.ui.closePanel();return false}if(b&&core.status.lockControl){return false}if(a&&!core.hasItem(c)){core.playSound("操作失败");core.drawTip("你没有"+core.material.items[c].name,c);return false}if(core.isMoving()){core.playSound("操作失败");core.drawTip("请先停止勇士行动");return false}core.lockControl();core.status.event.id=c;return true};events.prototype.openBook=function(a){if(core.isReplaying()){return}if(core.status.event.id=="book"&&core.events.recoverEvents(core.status.event.interval)){return}if(core.status.event.id=="book"&&core.status.event.ui){core.status.boxAnimateObjs=[];core.ui._drawViewMaps(core.status.event.ui);return}if(core.status.event.id=="viewMaps"){a=false;core.status.event.ui=core.status.event.data}if(!this._checkStatus("book",a,true)){return}core.playSound("打开界面");core.useItem("book",true)};events.prototype.useFly=function(a){if(core.isReplaying()){return}if(core.status.event.id=="viewMaps"){if(!core.hasItem("fly")){core.playSound("操作失败");core.drawTip("你没有"+core.material.items.fly.name,"fly")}else{if(!core.canUseItem("fly")){core.playSound("操作失败");core.drawTip("无法传送到当前层","fly")}else{core.flyTo(core.status.event.data.floorId)}}return}if(!this._checkStatus("fly",a,true)){return}if(core.flags.flyNearStair&&!core.nearStair()){core.playSound("操作失败");core.drawTip("只有在楼梯边才能使用"+core.material.items.fly.name,"fly");core.unlockControl();core.status.event.data=null;core.status.event.id=null;return}if(!core.canUseItem("fly")){core.playSound("操作失败");core.drawTip(core.material.items.fly.name+"好像失效了","fly");core.unlockControl();core.status.event.data=null;core.status.event.id=null;return}core.playSound("打开界面");core.useItem("fly",true);return};events.prototype.flyTo=function(b,a){return this.eventdata.flyTo(b,a)};events.prototype.openEquipbox=function(a){if(core.isReplaying()){return}if(!this._checkStatus("equipbox",a)){return}core.playSound("打开界面");core.ui._drawEquipbox()};events.prototype.openToolbox=function(a){if(core.isReplaying()){return}if(!this._checkStatus("toolbox",a)){return}core.playSound("打开界面");core.ui._drawToolbox()};events.prototype.openQuickShop=function(a){if(core.isReplaying()){return}if(Object.keys(core.status.shops).length==0){core.playSound("操作失败");core.drawTip("本游戏没有快捷商店!");return}if(Object.keys(core.status.shops).length==1){var c=Object.keys(core.status.shops)[0];if(core.status.event.id!=null){return}if(!core.canOpenShop(c)){core.playSound("操作失败");core.drawTip("当前无法打开快捷商店!");return}var b=core.canUseQuickShop(c);if(b!=null){core.playSound("操作失败");core.drawTip(b);return}core.openShop(c,false);return}if(!this._checkStatus("selectShop",a)){return}core.ui._drawQuickShop()};events.prototype.openKeyBoard=function(a){if(core.isReplaying()){return}if(!this._checkStatus("keyBoard",a)){return}core.ui._drawKeyBoard()};events.prototype.save=function(a){if(core.isReplaying()){return}if(core.hasFlag("__forbidSave__")){core.playSound("操作失败");core.drawTip("当前禁止存档");return}if(core.status.event.id=="save"&&core.events.recoverEvents(core.status.event.interval)){return}if(!this._checkStatus("save",a)){return}var d=core.saves.saveIndex;var c=parseInt((d-1)/5),b=d-5*c;core.playSound("打开界面");core.ui._drawSLPanel(10*c+b)};events.prototype.load=function(a){if(core.isReplaying()){return}var d=core.saves.saveIndex;var c=parseInt((d-1)/5),b=d-5*c;if(!core.isPlaying()){core.dom.startPanel.style.display="none";core.clearStatus();core.clearMap("all");core.status.event={id:"load",data:null};core.status.lockControl=true;core.playSound("打开界面");core.ui._drawSLPanel(10*c+b);return}if(core.status.event.id=="load"&&core.events.recoverEvents(core.status.event.interval)){return}if(!this._checkStatus("load",a)){return}core.playSound("打开界面");core.ui._drawSLPanel(10*c+b)};events.prototype.openSettings=function(a){if(core.isReplaying()){return}if(!this._checkStatus("settings",a)){return}core.playSound("打开界面");core.ui._drawSettings()};events.prototype.hasAsync=function(){return Object.keys(core.animateFrame.asyncId).length>0};events.prototype.stopAsync=function(){var a=[];for(var b in core.animateFrame.asyncId){clearInterval(b);a.push(core.animateFrame.asyncId[b])}core.animateFrame.asyncId={};a.forEach(function(c){if(c&&c instanceof Function){c()}})};events.prototype.hasAsyncAnimate=function(){return(core.status.animateObjs||[]).length>0};events.prototype.follow=function(a){a=core.getMappedName(a);if(core.material.images.images[a]){core.status.hero.followers.push({name:a});core.gatherFollowers();core.clearMap("hero");core.drawHero()}core.clearRouteFolding()};events.prototype.unfollow=function(b){if(!b){core.status.hero.followers=[]}else{b=core.getMappedName(b);for(var a=0;a<core.status.hero.followers.length;a++){if(core.status.hero.followers[a].name==b){core.status.hero.followers.splice(a,1);break}}}core.gatherFollowers();core.clearMap("hero");core.drawHero();core.clearRouteFolding()};events.prototype._updateValueByOperator=function(c,b,a){switch(a){case"+=":c=b+c;break;case"-=":c=b-c;break;case"*=":c=b*c;break;case"/=":c=b/c;break;case"**=":c=Math.pow(b,c);break;case"//=":c=Math.trunc(b/c);break;case"%=":c=b%c;break;case"min=":c=Math.min(b,c);break;case"max=":c=Math.max(b,c);break;default:break}return c};events.prototype.setValue=function(a,b,d,c){d=this._updateValueByOperator(core.calValue(d,c),core.calValue(a,c),b);this._setValue_setStatus(a,d);this._setValue_setBuff(a,d);this._setValue_setItem(a,d);this._setValue_setFlag(a,d);this._setValue_setSwitch(a,d,c);this._setValue_setTemp(a,d,c);this._setValue_setGlobal(a,d)};events.prototype._setValue_setStatus=function(a,b){if(a.indexOf("status:")!==0){return}core.setStatus(a.substring(7),b)};events.prototype._setValue_setBuff=function(a,b){if(a.indexOf("buff:")!==0){return}core.setBuff(a.substring(5),b)};events.prototype._setValue_setItem=function(c,d){if(c.indexOf("item:")!==0){return}var b=c.substring(5),a=core.itemCount(b);if(d>a){core.getItem(b,d-a)}else{core.setItem(b,d)}};events.prototype._setValue_setFlag=function(a,b){if(a.indexOf("flag:")!==0){return}core.setFlag(a.substring(5),b)};events.prototype._setValue_setSwitch=function(a,c,b){if(a.indexOf("switch:")!==0){return}core.setFlag((b||":f@x@y")+"@"+a.substring(7),c)};events.prototype._setValue_setTemp=function(a,b){if(a.indexOf("temp:")!==0){return}core.setFlag("@temp@"+a.substring(5),b)};events.prototype._setValue_setGlobal=function(a,b){if(a.indexOf("global:")!==0){return}core.setGlobal(a.substring(7),b)};events.prototype.setEnemy=function(b,c,g,e,f,d){if(!core.hasFlag("enemyInfo")){core.setFlag("enemyInfo",{})}var a=core.getFlag("enemyInfo");if(!a[b]){a[b]={}}if(typeof g==="string"&&c=="name"){g=g.replace(/\r/g,"\\r")}g=this._updateValueByOperator(core.calValue(g,f),(core.material.enemys[b]||{})[c],e);a[b][c]=g;(core.material.enemys[b]||{})[c]=core.clone(g);if(!d){core.updateStatusBar()}};events.prototype.setEnemyOnPoint=function(i,j,c,d,h,f,g,e){c=c||core.status.floorId;var a=core.getBlock(i,j,c);if(a==null){return}if(a.event.cls.indexOf("enemy")!=0){return}var b=core.material.enemys[a.event.id];if(b==null){return}if(typeof h==="string"&&d=="name"){h=h.replaceAll(/\r/g,"\\r")}h=this._updateValueByOperator(core.calValue(h,g),core.getEnemyValue(b,d,i,j,c),f);flags.enemyOnPoint=flags.enemyOnPoint||{};flags.enemyOnPoint[c]=flags.enemyOnPoint[c]||{};flags.enemyOnPoint[c][i+","+j]=flags.enemyOnPoint[c][i+","+j]||{};flags.enemyOnPoint[c][i+","+j][d]=h;if(!e){core.updateStatusBar()}};events.prototype.resetEnemyOnPoint=function(c,d,a,b){delete ((flags.enemyOnPoint||{})[a||core.status.floorId]||{})[c+","+d];if(!b){core.updateStatusBar()}};events.prototype.moveEnemyOnPoint=function(b,c,e,f,a,d){a=a||core.status.floorId;if(((flags.enemyOnPoint||{})[a]||{})[b+","+c]){flags.enemyOnPoint[a][e+","+f]=flags.enemyOnPoint[a][b+","+c];delete flags.enemyOnPoint[a][b+","+c];if(!d){core.updateStatusBar()}}};events.prototype.setFloorInfo=function(b,d,a,c){a=a||core.status.floorId;core.status.maps[a][b]=d;core.updateStatusBar()};events.prototype.setGlobalAttribute=function(name,value){if(typeof value=="string"){if((value.charAt(0)=='"'&&value.charAt(value.length-1)=='"')||(value.charAt(0)=="'"&&value.charAt(value.length-1)=="'")){value=value.substring(1,value.length-1)}if(value.charAt(0)=="["&&value.charAt(value.length-1)=="]"){value=eval(value)}if(/^[0-9 ]+,[0-9 ]+,[0-9 ]+(,[0-9. ]+)?$/.test(value)){value="rgba("+value+")"}}core.status.globalAttribute[name]=value;core.setFlag("globalAttribute",core.status.globalAttribute);core.resize()};events.prototype.setGlobalFlag=function(b,d){var a=core.getFlag("globalFlags",{});if(b.startsWith("s:")){b=b.substring(2);var c=core.flags.statusBarItems.filter(function(e){return e!=b});if(d){c.push(b)}core.flags.statusBarItems=c;a.statusBarItems=core.clone(c)}else{a[b]=core.flags[b]=d}core.setFlag("globalFlags",a);core.resize();if(b=="blurFg"){core.redrawMap()}};events.prototype.setNameMap=function(a,b){if(!core.hasFlag("__nameMap__")){core.setFlag("__nameMap__",{})}flags.__nameMap__[a]=b};events.prototype.setTextAttribute=function(a){if(!core.isPlaying()){return}["position","offset","align","bold","titlefont","textfont","lineHeight","time","letterSpacing","animateTime"].forEach(function(b){if(a[b]!=null){core.status.textAttribute[b]=a[b]}});["background","title","text"].forEach(function(d){if((a[d] instanceof Array)&&a[d].length>=3){if(a[d].length==3){a[d].push(1)}core.status.textAttribute[d]=a[d]}if(d=="background"){var c=core.getMappedName(a[d]);var b=core.material.images.images[c];if(b&&b.width==192&&b.height==128){core.status.textAttribute[d]=c}}});if(main.mode=="play"){core.setFlag("textAttribute",core.status.textAttribute)}};events.prototype.moveTextBox=function(b,f,k,h,n,a){var c=core.getContextByName("__text__"+b);if(!c){if(a){a()}return}var l=parseInt(c.canvas.getAttribute("_text_left"))||0;var m=parseInt(c.canvas.getAttribute("_text_top"))||0;var d=k?f[0]:(f[0]-l);var e=k?f[1]:(f[1]-m);var i=parseInt(c.canvas.getAttribute("_left"))||0;var j=parseInt(c.canvas.getAttribute("_top"))||0;if(!n){core.relocateCanvas(c,i+d,j+e);c.canvas.setAttribute("_text_left",f[0]);c.canvas.setAttribute("_text_top",f[1]);if(a){a()}return}var g={sx:l,sy:m,dx:d,dy:e,ox:i,oy:j,moveMode:h,time:n/Math.max(core.status.replay.speed,1)};this._moveTextBox_moving(c,g,a)};events.prototype._moveTextBox_moving=function(c,e,b){var f=0,g=e.time/10;if(g<=0){g=1}var d=core.applyEasing(e.moveMode);var a=setInterval(function(){f++;var h=e.dx*d(f/g);var i=e.dy*d(f/g);core.relocateCanvas(c,parseInt(e.ox+h),parseInt(e.oy+i));c.canvas.setAttribute("_text_left",e.sx+h);c.canvas.setAttribute("_text_top",e.sy+i);if(f==g){delete core.animateFrame.asyncId[a];clearInterval(a);if(b){b()}}},10);core.animateFrame.lastAsyncId=a;core.animateFrame.asyncId[a]=b};events.prototype.clearTextBox=function(c,b){if(c==null){c=Object.keys(core.dymCanvas).filter(function(e){return e.startsWith("__text__")}).map(function(e){return e.substring("__text__".length)})}if(!(c instanceof Array)){c=[c]}var d=0;var a=function(){if(d==c.length){if(b){b()}return}var e="__text__"+c[d++];if(!core.getContextByName(e)){return a()}core.ui._animateUI("hide",e,function(){core.deleteCanvas(e);a()})};a()};events.prototype.closeDoor=function(i,j,g,d){g=g||"";if((core.material.icons.animates[g]==null&&core.material.icons.npc48[g]==null)||core.getBlock(i,j)!=null){if(d){d()}return}var b=core.getBlockById(g);var f=(b.event||{}).doorInfo;if(!f){if(d){d()}return}core.playSound(f.closeSound);var c=core.getBlockInfo(b);var h=(f.time||160)/4;c.posX=3;core.maps._drawBlockInfo(c,i,j);var e=function(){core.setBlock(g,i,j);core.showBlock(i,j);if(d){d()}};var a=window.setInterval(function(){c.posX--;if(c.posX<0){clearInterval(a);delete core.animateFrame.asyncId[a];e();return}core.maps._drawBlockInfo(c,i,j)},core.status.replay.speed==24?1:h/Math.max(core.status.replay.speed,1));core.animateFrame.lastAsyncId=a;core.animateFrame.asyncId[a]=e};events.prototype.showImage=function(b,e,l,g,j,p,a){var f=null;if(typeof e=="string"){f=e;if(e.endsWith(":x")||e.endsWith(":y")||e.endsWith(":o")){e=e.substring(0,e.length-2)}e=core.getMappedName(e);e=core.material.images.images[e]}if(!e){if(a){a()}return}l=l||[];var n=core.calValue(l[0])||0,o=core.calValue(l[1])||0;var m=core.calValue(l[2]),k=core.calValue(l[3]);if(m==null){m=e.width}if(k==null){k=e.height}g=g||[];var r=core.calValue(g[0])||0,s=core.calValue(g[1])||0;var q=core.calValue(g[2]),d=core.calValue(g[3]);if(q==null){q=m}if(d==null){d=k}var t=b+100;p=p||0;var i="image"+t;var c=core.createCanvas(i,r,s,q,d,t);core.drawImage(c,f==null?e:f,n,o,m,k,0,0,q,d);if(p==0){core.setOpacity(i,j);if(a){a()}return}core.setOpacity(i,0);this.moveImage(b,null,j,null,p,a)};events.prototype.hideImage=function(b,d,a){d=d||0;var c="image"+(b+100);if(d==0||!core.dymCanvas[c]){core.deleteCanvas(c);if(a){a()}return}this.moveImage(b,null,0,null,d,function(){core.deleteCanvas(c);if(a){a()}})};events.prototype.moveImage=function(c,l,j,g,k,a){l=l||[];var h="image"+(c+100);if(!core.dymCanvas[h]){if(a){a()}return}var f=function(p,q){p=core.calValue(p);return p!=null?p:q};var b=core.dymCanvas[h].canvas;var d=parseFloat(b.getAttribute("_left")),e=parseFloat(b.getAttribute("_top")),n=f(l[0],d),o=f(l[1],e);var i=parseFloat(b.style.opacity),m=f(j,i);if(!k){core.relocateCanvas(h,n,o);core.setOpacity(m);if(a){a()}return}this._moveImage_moving(h,{fromX:d,fromY:e,toX:n,toY:o,opacity:i,toOpacity:m,moveMode:g,time:k/Math.max(core.status.replay.speed,1)},a)};events.prototype._moveImage_moving=function(j,i,b){var l=10,m=0,n=parseInt(i.time/l);if(n<=0){n=1}var f=i.fromX,g=i.fromY,p=i.toX,q=i.toY,k=i.opacity,o=i.toOpacity;var d=f,e=g,c=k;var h=core.applyEasing(i.moveMode);var a=setInterval(function(){m++;c=k+(o-k)*h(m/n);d=parseInt(f+(p-f)*h(m/n));e=parseInt(g+(q-g)*h(m/n));core.setOpacity(j,c);core.relocateCanvas(j,d,e);if(m==n){delete core.animateFrame.asyncId[a];clearInterval(a);if(b){b()}}},l);core.animateFrame.lastAsyncId=a;core.animateFrame.asyncId[a]=b};events.prototype.rotateImage=function(g,d,a,i,l,b){d=d||[];var j="image"+(g+100);if(!core.dymCanvas[j]){if(b){b()}return}var c=core.dymCanvas[j].canvas;var e=core.calValue(d[0]),f=core.calValue(d[1]);var h=parseFloat(c.getAttribute("_angle"))||0;if(!l){core.rotateCanvas(j,h+a,e,f);if(b){b()}return}var k={fromAngle:h,angle:a,centerX:e,centerY:f,moveMode:i,time:l/Math.max(core.status.replay.speed,1)};this._rotateImage_rotating(j,k,b)};events.prototype._rotateImage_rotating=function(d,f,b){var e=10,g=0,h=parseInt(f.time/e);if(h<=0){h=1}var c=core.applyEasing(f.moveMode);var a=setInterval(function(){g++;var i=f.fromAngle+f.angle*c(g/h);core.rotateCanvas(d,i,f.centerX,f.centerY);if(g==h){delete core.animateFrame.asyncId[a];clearInterval(a);if(b){b()}}},e);core.animateFrame.lastAsyncId=a;core.animateFrame.asyncId[a]=b};events.prototype.scaleImage=function(e,b,n,k,p,a){b=b||[];var l="image"+(e+100);if(!core.dymCanvas[l]){if(a){a()}return}var f=core.dymCanvas[l];var h=1;if(f.canvas.hasAttribute("_scale")){h=parseFloat(f.canvas.getAttribute("_scale"))}var m=f.canvas.hasAttribute("isHD")?core.domStyle.ratio:1;var q=f.canvas.width/m,j=f.canvas.height/m;var g=parseFloat(f.canvas.getAttribute("_left"));var i=parseFloat(f.canvas.getAttribute("_top"));var c=core.calValue(b[0]),d=core.calValue(b[1]);if(c==null||d==null){c=g+q*h/2;d=i+j*h/2}var o={x:(g-c)/h,y:(i-d)/h,centerX:c,centerY:d,width:q,height:j,currScale:h,scale:n,moveMode:k,time:p};this._scaleImage_scale(f,o,a)};events.prototype._scaleInfo_scale=function(a,c,b){core.resizeCanvas(a,c.width*b,c.height*b,true);core.relocateCanvas(a,c.centerX+c.x*b,c.centerY+c.y*b);a.canvas.setAttribute("_scale",b)};events.prototype._scaleImage_scale=function(c,f,b){if(!f.time){this._scaleInfo_scale(c,f,f.scale);if(b){b()}return}var e=10,g=0,h=parseInt(f.time/e);if(h<=0){h=1}var d=core.applyEasing(f.moveMode);var a=setInterval(function(){g++;var i=f.currScale+(f.scale-f.currScale)*d(g/h);core.events._scaleInfo_scale(c,f,i);if(g==h){delete core.animateFrame.asyncId[a];clearInterval(a);if(b){b()}}},e);core.animateFrame.lastAsyncId=a;core.animateFrame.asyncId[a]=b};events.prototype.showGif=function(c,d,e){c=core.getMappedName(c);var b=core.material.images.images[c];if(b){var a=new Image();a.src=b.src;a.style.position="absolute";a.style.left=d*core.domStyle.scale+"px";a.style.top=e*core.domStyle.scale+"px";a.style.width=b.width*core.domStyle.scale+"px";a.style.height=b.height*core.domStyle.scale+"px";core.dom.gif2.appendChild(a)}else{core.dom.gif2.innerHTML=""}};events.prototype.setVolume=function(i,h,b){var e=function(j){core.musicStatus.designVolume=j;if(core.musicStatus.playingBgm){core.material.bgms[core.musicStatus.playingBgm].volume=core.musicStatus.userVolume*core.musicStatus.designVolume}};if(!h||h<100){e(i);if(b){b()}return}var c=core.musicStatus.designVolume;h/=Math.max(core.status.replay.speed,1);var d=10,f=0,g=parseInt(h/d);if(g<=0){g=1}var a=setInterval(function(){f++;e(c+(i-c)*f/g);if(f>=g){delete core.animateFrame.asyncId[a];clearInterval(a);if(b){b()}}},d);core.animateFrame.lastAsyncId=a;core.animateFrame.asyncId[a]=b};events.prototype.vibrate=function(d,h,g,e,b){if(core.isReplaying()){if(b){b()}return}if(!h){h=1000}g=g||10;e=e||10;var f={duration:parseInt(h/10),speed:g,power:e,direction:1,shake:0};if(d=="random"){d=["horizontal","vertical","diagonal1","diagonal2"][Math.floor(Math.random()*4)]}var c=function(){core.addGameCanvasTranslate(0,0);if(b){b()}};var a=setInterval(function(){core.events._vibrate_update(f);switch(d){case"vertical":core.addGameCanvasTranslate(0,f.shake);break;case"diagonal1":core.addGameCanvasTranslate(f.shake,f.shake);break;case"diagonal2":core.addGameCanvasTranslate(-f.shake,f.shake);break;default:core.addGameCanvasTranslate(f.shake,0)}if(f.duration===0&&f.shake==0){delete core.animateFrame.asyncId[a];clearInterval(a);c()}},10);core.animateFrame.lastAsyncId=a;core.animateFrame.asyncId[a]=c};events.prototype._vibrate_update=function(b){if(b.duration>=1||b.shake!=0){var a=b.speed*b.direction/6;if(b.duration<=1&&b.shake*(b.shake+a)<0){b.shake=0}else{b.shake+=a}if(b.shake>b.power){b.direction=-1}if(b.shake<-b.power){b.direction=1}if(b.duration>=1){b.duration-=1}}};events.prototype.eventMoveHero=function(e,f,b){f=f||core.values.moveSpeed;var d=0,c=(e||[]).map(function(g){return[g.split(":")[0],parseInt(g.split(":")[1]||"1")]}).filter(function(g){return["up","down","left","right","forward","backward","leftup","leftdown","rightup","rightdown","speed"].indexOf(g[0])>=0&&!(g[0]=="speed"&&g[1]<16)});core.status.heroMoving=-1;var a=function(){var h=function(){core.status.heroMoving=0;core.drawHero();if(b){b()}};var g=window.setInterval(function(){if(c.length==0){delete core.animateFrame.asyncId[g];clearInterval(g);h()}else{if(d==0&&c[0][0]=="speed"&&c[0][1]>=16){f=c[0][1];c.shift();clearInterval(g);delete core.animateFrame.asyncId[g];a()}else{if(core.events._eventMoveHero_moving(++d,c)){d=0}}}},core.status.replay.speed==24?1:f/8/core.status.replay.speed);core.animateFrame.lastAsyncId=g;core.animateFrame.asyncId[g]=h};a()};events.prototype._eventMoveHero_moving=function(f,d){var a=d[0];var b=a[0],g=core.getHeroLoc("x"),h=core.getHeroLoc("y");var e=b=="backward"?-1:1;if(b=="forward"||b=="backward"){b=core.getHeroLoc("direction")}var c=b;if(b=="leftup"||b=="leftdown"){c="left"}if(b=="rightup"||b=="rightdown"){c="right"}core.setHeroLoc("direction",b);if(a[1]<=0){core.setHeroLoc("direction",c);d.shift();return true}if(f<=4){core.drawHero("leftFoot",4*e*f)}else{if(f<=8){core.drawHero("rightFoot",4*e*f)}}if(f==8){core.setHeroLoc("x",g+e*core.utils.scan2[b].x,true);core.setHeroLoc("y",h+e*core.utils.scan2[b].y,true);core.updateFollowers();a[1]--;if(a[1]<=0){d.shift()}core.setHeroLoc("direction",c);return true}return false};events.prototype.jumpHero=function(b,c,g,a){var e=core.getHeroLoc("x"),f=core.getHeroLoc("y");if(b==null){b=e}if(c==null){c=f}var e=core.status.hero.loc.x,f=core.status.hero.loc.y;if(!core.isset(b)){b=e}if(!core.isset(c)){c=f}var d=core.maps.__generateJumpInfo(e,f,b,c,g||500);d.icon=core.material.icons.hero[core.getHeroLoc("direction")];d.width=core.material.icons.hero.width||32;d.height=core.material.icons.hero.height;this._jumpHero_doJump(d,a)};events.prototype._jumpHero_doJump=function(d,b){var c=function(){core.setHeroLoc("x",d.ex);core.setHeroLoc("y",d.ey);core.status.heroMoving=0;core.drawHero();if(b){b()}};core.status.heroMoving=-1;var a=window.setInterval(function(){if(d.jump_count>0){core.events._jumpHero_jumping(d)}else{delete core.animateFrame.asyncId[a];clearInterval(a);c()}},d.per_time);core.animateFrame.lastAsyncId=a;core.animateFrame.asyncId[a]=c};events.prototype._jumpHero_jumping=function(b){core.clearMap("hero");core.maps.__updateJumpInfo(b);var f=core.getHeroLoc("x"),g=core.getHeroLoc("y");var c=b.px,d=b.py,e=b.width||32,a=b.height;core.drawHero("stop",{x:c-32*f,y:d-32*g})};events.prototype.setHeroIcon=function(b,c){b=core.getMappedName(b);var a=core.material.images.images[b];if(!a){console.error("找不到图片: "+a);return}if(core.material.images.hero==a){return}core.status.hero.image=b;core.material.images.hero=a;core.material.icons.hero.width=a.width/4;core.material.icons.hero.height=a.height/4;core.control.updateHeroIcon(b);if(!c){core.drawHero()}};events.prototype.checkLvUp=function(){var a=[];while(true){var b=this._checkLvUp_check();if(b==null){break}a=a.concat(b)}if(a.length>0){core.insertAction(a)}};events.prototype._checkLvUp_check=function(){if(core.flags.statusBarItems.indexOf("enableLevelUp")<0||!core.firstData.levelUp||core.status.hero.lv>=core.firstData.levelUp.length){return null}var b=(core.firstData.levelUp[core.status.hero.lv]||{});var a=core.calValue(b.need);if(a==null){return null}if(core.status.hero.exp>=a){core.status.hero.lv++;if(b.clear){core.status.hero.exp-=a}return b.action||[]}return null};events.prototype.tryUseItem=function(a){if(a=="book"){core.ui.closePanel();return core.openBook(false)}if(a=="fly"){core.ui.closePanel();return core.useFly(false)}if(a=="centerFly"){core.ui.closePanel();return core.ui._drawCenterFly()}if(core.canUseItem(a)){core.ui.closePanel();core.useItem(a)}else{core.playSound("操作失败");core.drawTip("当前无法使用"+core.material.items[a].name,a)}};"use strict";function actions(){this._init();this.SIZE=core.__SIZE__;this.HSIZE=core.__HALF_SIZE__;this.LAST=this.SIZE-1;this.CHOICES_LEFT=5;this.CHOICES_RIGHT=this.LAST-this.CHOICES_LEFT}actions.prototype._init=function(){this.actionsdata=functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.actions;this.actions={};this.registerAction("onkeyDown","_sys_checkReplay",this._sys_checkReplay,100);this.registerAction("onkeyDown","_sys_onkeyDown",this._sys_onkeyDown,0);this.registerAction("onkeyUp","_sys_onkeyUp_replay",this._sys_onkeyUp_replay,100);this.registerAction("onkeyUp","_sys_onkeyUp",this._sys_onkeyUp,0);this.registerAction("pressKey","_sys_checkReplay",this._sys_checkReplay,100);this.registerAction("pressKey","_sys_pressKey",this._sys_pressKey,0);this.registerAction("keyDown","_sys_checkReplay",this._sys_checkReplay,100);this.registerAction("keyDown","_sys_keyDown_lockControl",this._sys_keyDown_lockControl,50);this.registerAction("keyDown","_sys_keyDown",this._sys_keyDown,0);this.registerAction("keyUp","_sys_keyUp_replay",this._sys_keyUp_replay,100);this.registerAction("keyUp","_sys_keyUp_lockControl",this._sys_keyUp_lockControl,50);this.registerAction("keyUp","_sys_keyUp",this._sys_keyUp,0);this.registerAction("ondown","_sys_checkReplay",this._sys_checkReplay,100);this.registerAction("ondown","_sys_ondown_lockControl",this._sys_ondown_lockControl,30);this.registerAction("ondown","_sys_ondown",this._sys_ondown,0);this.registerAction("onmove","_sys_checkReplay",this._sys_checkReplay,100);this.registerAction("onmove","_sys_onmove_choices",this._sys_onmove_choices,30);this.registerAction("onmove","_sys_onmove",this._sys_onmove,0);this.registerAction("onup","_sys_checkReplay",this._sys_checkReplay,100);this.registerAction("onup","_sys_onup",this._sys_onup,0);this.registerAction("onmousewheel","_sys_onmousewheel",this._sys_onmousewheel,0);this.registerAction("keyDownCtrl","_sys_keyDownCtrl",this._sys_keyDownCtrl,0);this.registerAction("longClick","_sys_longClick_lockControl",this._sys_longClick_lockControl,50);this.registerAction("onStatusBarClick","_sys_onStatusBarClick",this._sys_onStatusBarClick,0)};actions.prototype.registerAction=function(a,c,b,d){if(!c||!b){return}if(a=="onclick"){a="ondown"}d=d||0;if(!this.actions[a]){this.actions[a]=[]}this.unregisterAction(a,c);this.actions[a].push({action:a,name:c,func:b,priority:d});this.actions[a]=this.actions[a].sort(function(e,f){return f.priority-e.priority})};actions.prototype.unregisterAction=function(a,b){if(a=="onclick"){a="ondown"}if(!this.actions[a]){return}this.actions[a]=this.actions[a].filter(function(c){return c.name!=b})};actions.prototype.doRegisteredAction=function(a){var b=this.actions[a];if(!b){return false}for(var d=0;d<b.length;++d){try{if(core.doFunc.apply(core,[b[d].func,this].concat(Array.prototype.slice.call(arguments,1)))){return true}}catch(c){main.log(c);main.log("ERROR in actions["+b[d].name+"].")}}return false};actions.prototype._checkReplaying=function(){if(core.isReplaying()&&["save","book","book-detail","viewMaps","toolbox","equipbox","text"].indexOf(core.status.event.id)<0){return true}return false};actions.prototype._sys_checkReplay=function(){if(this._checkReplaying()){return true}};actions.prototype.__checkLeftHandPrefer=function(a){if(!core.flags.leftHandPrefer){return a}var b={87:38,83:40,65:37,68:39,73:87,74:65,75:83,76:68,};var c={};for(var d in a){if(!(a[d] instanceof Function)){c[d]=a[d]}}["stopPropagation","stopImmediatePropagation","preventDefault"].forEach(function(e){c[e]=function(){return a[e]()}});c.keyCode=b[a.keyCode]||a.keyCode;return c};actions.prototype.onkeyDown=function(a){this.doRegisteredAction("onkeyDown",this.__checkLeftHandPrefer(a))};actions.prototype._sys_onkeyDown=function(a){core.status.holdingKeys=core.status.holdingKeys||[];var c={37:true,38:true,39:true,40:true}[a.keyCode];if(c&&!core.status.lockControl){for(var b=0;b<core.status.holdingKeys.length;b++){if(core.status.holdingKeys[b]===a.keyCode){return}}if(a.preventDefault){a.preventDefault()}core.status.holdingKeys.push(a.keyCode);this.pressKey(a.keyCode)}else{if(a.keyCode==17){core.status.ctrlDown=true}this.keyDown(a.keyCode)}};actions.prototype.onkeyUp=function(a){this.doRegisteredAction("onkeyUp",this.__checkLeftHandPrefer(a))};actions.prototype._sys_onkeyUp_replay=function(a){if(this._checkReplaying()){if(a.keyCode==27){core.stopReplay()}else{if(a.keyCode==90){core.speedDownReplay()}else{if(a.keyCode==67){core.speedUpReplay()}else{if(a.keyCode==32){core.triggerReplay()}else{if(a.keyCode==65){core.rewindReplay()}else{if(a.keyCode==83){core.control._replay_SL()}else{if(a.keyCode==88){core.control._replay_book()}else{if(a.keyCode==33||a.keyCode==34){core.control._replay_viewMap()}else{if(a.keyCode==78){core.stepReplay()}else{if(a.keyCode==84){core.control._replay_toolbox()}else{if(a.keyCode==81){core.control._replay_equipbox()}else{if(a.keyCode==66){core.ui._drawStatistics()}else{if(a.keyCode>=49&&a.keyCode<=51){core.setReplaySpeed(a.keyCode-48)}else{if(a.keyCode==52){core.setReplaySpeed(6)}else{if(a.keyCode==53){core.setReplaySpeed(12)}else{if(a.keyCode==54){core.setReplaySpeed(24)}}}}}}}}}}}}}}}}return true}};actions.prototype._sys_onkeyUp=function(a){var c={37:true,38:true,39:true,40:true}[a.keyCode];if(c&&!core.status.lockControl){for(var b=0;b<core.status.holdingKeys.length;b++){if(core.status.holdingKeys[b]===a.keyCode){core.status.holdingKeys=core.status.holdingKeys.slice(0,b).concat(core.status.holdingKeys.slice(b+1));if(b===core.status.holdingKeys.length&&core.status.holdingKeys.length!==0){core.pressKey(core.status.holdingKeys.slice(-1)[0])}break}}if(a.preventDefault){a.preventDefault()}this.keyUp(a.keyCode,a.altKey)}else{if(a.keyCode==17){core.status.ctrlDown=false}this.keyUp(a.keyCode,a.altKey)}};actions.prototype.pressKey=function(a){this.doRegisteredAction("pressKey",a)};actions.prototype._sys_pressKey=function(a){if(a===core.status.holdingKeys.slice(-1)[0]){this.keyDown(a);window.setTimeout(function(){core.pressKey(a)},30)}};actions.prototype.keyDown=function(a){this.doRegisteredAction("keyDown",a)};actions.prototype._sys_keyDown_lockControl=function(a){if(!core.status.lockControl){return false}if(a==17){this.keyDownCtrl();return true}switch(core.status.event.id){case"action":this._keyDownAction(a);break;case"book":this._keyDownBook(a);break;case"fly":this._keyDownFly(a);break;case"viewMaps":this._keyDownViewMaps(a);break;case"equipbox":this._keyDownEquipbox(a);break;case"toolbox":this._keyDownToolbox(a);break;case"save":case"load":case"replayLoad":case"replayRemain":case"replaySince":this._keyDownSL(a);break;case"selectShop":case"switchs":case"switchs-sounds":case"switchs-display":case"switchs-action":case"notes":case"settings":case"syncSave":case"syncSelect":case"localSaveSelect":case"storageRemove":case"replay":case"gameInfo":this._keyDownChoices(a);break;case"cursor":this._keyDownCursor(a);break}return true};actions.prototype._sys_keyDown=function(a){if(!core.status.played){return true}switch(a){case 37:core.moveHero("left");break;case 38:core.moveHero("up");break;case 39:core.moveHero("right");break;case 40:core.moveHero("down");break}return true};actions.prototype.keyUp=function(c,a,b){this.doRegisteredAction("keyUp",c,a,b)};actions.prototype._sys_keyUp_replay=function(c,a,b){if(!b&&this._checkReplaying()){return true}};actions.prototype._sys_keyUp_lockControl=function(b,a){if(!core.status.lockControl){return false}var c=function(){return b==27||b==88||b==13||b==32||b==67};core.status.holdingKeys=[];switch(core.status.event.id){case"text":c()&&core.drawText();break;case"confirmBox":this._keyUpConfirmBox(b);break;case"action":this._keyUpAction(b);break;case"about":c()&&core.closePanel();break;case"help":c()&&core.closePanel();break;case"book":this._keyUpBook(b);break;case"book-detail":c()&&this._clickBookDetail();break;case"fly":this._keyUpFly(b);break;case"viewMaps":this._keyUpViewMaps(b);break;case"selectShop":this._keyUpQuickShop(b);break;case"toolbox":this._keyUpToolbox(b);break;case"equipbox":this._keyUpEquipbox(b,a);break;case"save":case"load":case"replayLoad":case"replayRemain":case"replaySince":this._keyUpSL(b);break;case"keyBoard":c()&&core.closePanel();break;case"switchs":this._keyUpSwitchs(b);break;case"switchs-sounds":this._keyUpSwitchs_sounds(b);break;case"switchs-display":this._keyUpSwitchs_display(b);break;case"switchs-action":this._keyUpSwitchs_action(b);break;case"settings":this._keyUpSettings(b);break;case"notes":this._keyUpNotes(b);break;case"syncSave":this._keyUpSyncSave(b);break;case"syncSelect":this._keyUpSyncSelect(b);break;case"localSaveSelect":this._keyUpLocalSaveSelect(b);break;case"storageRemove":this._keyUpStorageRemove(b);break;case"cursor":this._keyUpCursor(b);break;case"replay":this._keyUpReplay(b);break;case"gameInfo":this._keyUpGameInfo(b);break;case"centerFly":this._keyUpCenterFly(b);break}return true};actions.prototype._sys_keyUp=function(b,a){if(!core.status.played){return true}this.actionsdata.onKeyUp(b,a);if(core.status.automaticRoute&&core.status.automaticRoute.autoHeroMove){core.stopAutomaticRoute()}core.status.heroStop=true;return true};actions.prototype.ondown=function(a){var d=parseInt(a.x/a.size),e=parseInt(a.y/a.size);var b=parseInt(a.x/core.domStyle.scale),c=parseInt(a.y/core.domStyle.scale);this.doRegisteredAction("ondown",d,e,b,c)};actions.prototype._sys_ondown_lockControl=function(c,d,a,b){if(core.status.played&&!core.status.lockControl){return false}switch(core.status.event.id){case"centerFly":this._clickCenterFly(c,d,a,b);break;case"book":this._clickBook(c,d,a,b);break;case"book-detail":this._clickBookDetail(c,d,a,b);break;case"fly":this._clickFly(c,d,a,b);break;case"viewMaps":this._clickViewMaps(c,d,a,b);break;case"switchs":this._clickSwitchs(c,d,a,b);break;case"switchs-sounds":this._clickSwitchs_sounds(c,d,a,b);break;case"switchs-display":this._clickSwitchs_display(c,d,a,b);break;case"switchs-action":this._clickSwitchs_action(c,d,a,b);break;case"settings":this._clickSettings(c,d,a,b);break;case"selectShop":this._clickQuickShop(c,d,a,b);break;case"equipbox":this._clickEquipbox(c,d,a,b);break;case"toolbox":this._clickToolbox(c,d,a,b);break;case"save":case"load":case"replayLoad":case"replayRemain":case"replaySince":this._clickSL(c,d,a,b);break;case"confirmBox":this._clickConfirmBox(c,d,a,b);break;case"keyBoard":this._clickKeyBoard(c,d,a,b);break;case"action":this._clickAction(c,d,a,b);break;case"text":core.drawText();break;case"notes":this._clickNotes(c,d,a,b);break;case"syncSave":this._clickSyncSave(c,d,a,b);break;case"syncSelect":this._clickSyncSelect(c,d,a,b);break;case"localSaveSelect":this._clickLocalSaveSelect(c,d,a,b);break;case"storageRemove":this._clickStorageRemove(c,d,a,b);break;case"cursor":this._clickCursor(c,d,a,b);break;case"replay":this._clickReplay(c,d,a,b);break;case"gameInfo":this._clickGameInfo(c,d,a,b);break;case"about":case"help":core.ui.closePanel();break}if(core.timeout.onDownTimeout==null){core.timeout.onDownTimeout=setTimeout(function(){if(core.interval.onDownInterval==null){core.interval.onDownInterval=setInterval(function(){if(!core.actions.longClick(c,d,a,b)){clearInterval(core.interval.onDownInterval);core.interval.onDownInterval=null}},40)}},500)}return true};actions.prototype._sys_ondown=function(d,e,b,c){if(core.status.lockControl){return false}core.status.downTime=new Date();core.deleteCanvas("route");var a={x:parseInt((b+core.bigmap.offsetX)/32),y:parseInt((c+core.bigmap.offsetY)/32)};core.status.stepPostfix=[];core.status.stepPostfix.push(a);core.fillRect("ui",a.x*32+12-core.bigmap.offsetX,a.y*32+12-core.bigmap.offsetY,8,8,"#bfbfbf");clearTimeout(core.timeout.onDownTimeout);core.timeout.onDownTimeout=null;core.status.preview.prepareDragging=false;if(!core.hasFlag("__lockViewport__")&&(core.status.thisMap.width>core.__SIZE__||core.status.thisMap.height>core.__SIZE__)){core.status.preview.prepareDragging=true;core.status.preview.px=b;core.status.preview.py=c;core.timeout.onDownTimeout=setTimeout(function(){core.clearMap("ui");core.status.preview.prepareDragging=false;core.status.preview.enabled=true;core.status.preview.dragging=true;core.drawTip("已进入预览模式,可直接拖动大地图");core.status.stepPostfix=[]},500)}};actions.prototype.onmove=function(a){var d=parseInt(a.x/a.size),e=parseInt(a.y/a.size);var b=parseInt(a.x/core.domStyle.scale),c=parseInt(a.y/core.domStyle.scale);this.doRegisteredAction("onmove",d,e,b,c)};actions.prototype._sys_onmove_choices=function(c,d,a,b){if(!core.status.lockControl){return false}switch(core.status.event.id){case"action":if(core.status.event.data.type=="choices"){this._onMoveChoices(c,d);return true}if(core.status.event.data.type=="confirm"){this._onMoveConfirmBox(c,d,a,b);return true}break;case"selectShop":case"switchs":case"switchs-sounds":case"switchs-display":case"switchs-action":case"notes":case"settings":case"syncSave":case"syncSelect":case"localSaveSelect":case"storageRemove":case"replay":case"gameInfo":this._onMoveChoices(c,d);return true;case"confirmBox":this._onMoveConfirmBox(c,d,a,b);return true;default:break}return false};actions.prototype._sys_onmove=function(i,j,g,h){if(core.status.lockControl){return false}if(core.status.preview.dragging){core.setViewport(core.bigmap.offsetX-g+core.status.preview.px,core.bigmap.offsetY-h+core.status.preview.py);core.status.preview.px=g;core.status.preview.py=h;return true}if(core.status.preview.prepareDragging){if(Math.abs(g-core.status.preview.px)<=20&&Math.abs(h-core.status.preview.py)<=20){return true}else{core.status.preview.prepareDragging=false}}clearTimeout(core.timeout.onDownTimeout);core.timeout.onDownTimeout=null;if((core.status.stepPostfix||[]).length>0){var e={x:parseInt((g+core.bigmap.offsetX)/32),y:parseInt((h+core.bigmap.offsetY)/32)};var f=core.status.stepPostfix[core.status.stepPostfix.length-1];var a=[e.y-f.y,f.x-e.x,f.y-e.y,e.x-f.x];var d=0,c=4;for(var b=0;b<4;b++){if(a[b]>d){c=b;d=a[b]}}e=[{x:0,y:1},{x:-1,y:0},{x:0,y:-1},{x:1,y:0},false][c];if(e){e.x+=f.x;e.y+=f.y;core.status.stepPostfix.push(e);core.fillRect("ui",e.x*32+12-core.bigmap.offsetX,e.y*32+12-core.bigmap.offsetY,8,8,"#bfbfbf")}}return true};actions.prototype.onup=function(a){var d=parseInt(a.x/a.size),e=parseInt(a.y/a.size);var b=parseInt(a.x/core.domStyle.scale),c=parseInt(a.y/core.domStyle.scale);this.doRegisteredAction("onup",d,e,b,c)};actions.prototype._sys_onup=function(j,k,g,h){clearTimeout(core.timeout.onDownTimeout);core.timeout.onDownTimeout=null;clearInterval(core.interval.onDownInterval);core.interval.onDownInterval=null;if(core.isPlaying()){core.status.preview.prepareDragging=false;if(core.status.preview.dragging){core.status.preview.dragging=false;return true}}if((core.status.stepPostfix||[]).length==0){return false}var i=[];var a={"0":{"1":"down","-1":"up"},"-1":{"0":"left"},"1":{"0":"right"}};for(var b=1;b<core.status.stepPostfix.length;b++){var d=core.status.stepPostfix[b-1];var c=core.status.stepPostfix[b];i.push({direction:a[c.x-d.x][c.y-d.y],x:c.x,y:c.y})}var e=core.status.stepPostfix[0].x;var f=core.status.stepPostfix[0].y;core.status.stepPostfix=[];if(!core.status.lockControl){core.clearMap("ui")}if(!core.status.lockControl&&i.length==0&&core.status.downTime!=null&&new Date()-core.status.downTime>=1000){core.actions.longClick(j,k,g,h)}else{core.setAutomaticRoute(e,f,i)}core.status.downTime=null;return true};actions.prototype._getClickLoc=function(f,g){var d={x:0,y:0};var c=32;c=c*core.domStyle.scale;if(core.domStyle.isVertical){d.x=3;d.y=core.dom.statusBar.offsetHeight+3}else{d.x=core.dom.statusBar.offsetWidth+3;d.y=3}var a=core.dom.gameGroup.offsetLeft+d.x;var e=core.dom.gameGroup.offsetTop+d.y;var b={x:Math.max(f-a),y:Math.max(g-e,0),size:c};return b};actions.prototype.onmousewheel=function(a){this.doRegisteredAction("onmousewheel",a)};actions.prototype._sys_onmousewheel=function(a){if(this._checkReplaying()){if(a==1){core.speedUpReplay()}if(a==-1){core.speedDownReplay()}return}if(core.status.lockControl&&core.status.event.id=="fly"){if(a==1){core.ui.drawFly(this._getNextFlyFloor(1))}if(a==-1){core.ui.drawFly(this._getNextFlyFloor(-1))}return}if(core.status.lockControl&&core.status.event.id=="book"){var e=core.ui._drawBook_pageinfo();if(a==1){core.ui.drawBook(core.status.event.data-e.per_page)}if(a==-1){core.ui.drawBook(core.status.event.data+e.per_page)}return}if(core.status.lockControl&&(core.status.event.id=="save"||core.status.event.id=="load")){var c=core.status.event.data.page*10+core.status.event.data.offset;if(a==1){core.ui._drawSLPanel(c-10)}if(a==-1){core.ui._drawSLPanel(c+10)}return}if(core.status.lockControl&&core.status.event.id=="viewMaps"){if(a==1){this._clickViewMaps(this.HSIZE,this.HSIZE-3,core.__PIXELS__/2,core.__PIXELS__/5*1.5)}if(a==-1){this._clickViewMaps(this.HSIZE,this.HSIZE+3,core.__PIXELS__/2,core.__PIXELS__/5*3.5)}return}if(core.status.lockControl&&core.status.event.id=="action"&&core.status.event.data.type=="wait"){var f=Math.max(0,core.status.event.timeout-new Date().getTime())||0;core.setFlag("type",0);var d=a==1?33:34;core.setFlag("keycode",d);core.setFlag("timeout",f);var b=core.events.__action_wait_afterGet(core.status.event.data.current);if(b||!core.status.event.data.current.forceChild){core.status.route.push("input:"+(100000000*f+d));clearTimeout(core.status.event.interval);delete core.status.event.timeout;core.doAction()}return}};actions.prototype.keyDownCtrl=function(){this.doRegisteredAction("keyDownCtrl")};actions.prototype._sys_keyDownCtrl=function(){if(core.status.event.id=="text"){core.drawText();return true}if(core.status.event.id=="action"&&core.status.event.data.type=="text"){core.doAction();return true}if(core.status.event.id=="action"&&core.status.event.data.type=="sleep"&&!core.status.event.data.current.noSkip){if(core.timeout.sleepTimeout&&!core.hasAsync()){clearTimeout(core.timeout.sleepTimeout);core.timeout.sleepTimeout=null;core.doAction()}return true}};actions.prototype.longClick=function(c,d,a,b){if(!core.isPlaying()){return false}return this.doRegisteredAction("longClick",c,d,a,b)};actions.prototype._sys_longClick_lockControl=function(c,d,a,b){if(!core.status.lockControl){return false}if(core.status.event.id=="text"){core.drawText();return true}if(core.status.event.id=="action"&&core.status.event.data.type=="text"){core.doAction();return true}if(core.status.event.id=="fly"){if((c==this.SIZE-2||c==this.SIZE-3)&&(d==this.HSIZE-1||d==this.HSIZE+3)){this._clickFly(c,d);return true}}if(["save","load","replayLoad","replayRemain","replaySince"].indexOf(core.status.event.id)>=0){if([this.HSIZE-2,this.HSIZE-3,this.HSIZE+2,this.HSIZE+3].indexOf(c)>=0&&d==this.LAST){this._clickSL(c,d);return true}}if(core.status.event.id=="action"&&core.status.event.data.type=="sleep"&&!core.status.event.data.current.noSkip){if(core.timeout.sleepTimeout&&!core.hasAsync()){clearTimeout(core.timeout.sleepTimeout);core.timeout.sleepTimeout=null;core.doAction();return true}}return false};actions.prototype.onStatusBarClick=function(a){if(!core.isPlaying()){return false}var b=core.dom.gameGroup.offsetLeft+3;var f=core.dom.gameGroup.offsetTop+3;var c=parseInt((a.clientX-b)/core.domStyle.scale),d=parseInt((a.clientY-f)/core.domStyle.scale);return this.doRegisteredAction("onStatusBarClick",Math.max(c,0),Math.max(d,0))};actions.prototype._sys_onStatusBarClick=function(a,b,c){if(this.actionsdata.onStatusBarClick){return this.actionsdata.onStatusBarClick(a,b,c)}};actions.prototype._getChoicesTopIndex=function(a){return this.HSIZE-parseInt((a-1)/2)+(core.status.event.ui.offset||0)};actions.prototype._selectChoices=function(d,c,a){var e=this._getChoicesTopIndex(d);if(c==13||c==32||c==67){a.apply(this,[this.HSIZE,e+core.status.event.selection])}if(c>=49&&c<=57){var b=c-49;if(b<d){a.apply(this,[this.HSIZE,e+b])}}};actions.prototype._keyDownChoices=function(a){if(a==38){core.status.event.selection--;core.playSound("光标移动");core.ui.drawChoices(core.status.event.ui.text,core.status.event.ui.choices,core.status.event.ui.width)}if(a==40){core.status.event.selection++;core.playSound("光标移动");core.ui.drawChoices(core.status.event.ui.text,core.status.event.ui.choices,core.status.event.ui.width)}};actions.prototype._onMoveChoices=function(d,e){if(d<this.CHOICES_LEFT||d>this.CHOICES_RIGHT){return}var a=core.status.event.ui.choices;var c=this._getChoicesTopIndex(a.length);if(e>=c&&e<c+a.length){var b=e-c;if(b==core.status.event.selection){return}core.status.event.selection=b;core.playSound("光标移动");core.ui.drawChoices(core.status.event.ui.text,core.status.event.ui.choices,core.status.event.ui.width)}};actions.prototype._clickCenterFly=function(c,d){var a=core.status.event.data.posX,b=core.status.event.data.posY;core.ui.closePanel();if(c==a&&d==b){if(core.canUseItem("centerFly")){core.useItem("centerFly")}else{core.playSound("操作失败");core.drawTip("当前不能使用"+core.material.items.centerFly.name,"centerFly")}}};actions.prototype._keyUpCenterFly=function(a){core.ui.closePanel();if(a==51||a==13||a==32||a==67){if(core.canUseItem("centerFly")){core.useItem("centerFly")}else{core.playSound("操作失败");core.drawTip("当前不能使用"+core.material.items.centerFly.name,"centerFly")}}};actions.prototype._clickConfirmBox=function(c,d,a,b){if(a>=core.__PIXELS__/2-70&&a<=core.__PIXELS__/2-10&&b>=core.__PIXELS__/2&&b<=core.__PIXELS__/2+64&&core.status.event.data.yes){core.status.event.data.yes()}if(a>=core.__PIXELS__/2+10&&a<=core.__PIXELS__/2+70&&b>=core.__PIXELS__/2&&b<=core.__PIXELS__/2+64&&core.status.event.data.no){core.status.event.data.no()}};actions.prototype._keyUpConfirmBox=function(a){if(a==37||a==39){core.status.event.selection=1-core.status.event.selection;core.playSound("光标移动");core.ui.drawConfirmBox(core.status.event.ui,core.status.event.data.yes,core.status.event.data.no);return}if(a==13||a==32||a==67){if(core.status.event.selection==0&&core.status.event.data.yes){core.status.event.selection=null;core.status.event.data.yes();return}if(core.status.event.selection==1&&core.status.event.data.no){core.status.event.selection=null;core.status.event.data.no();return}}};actions.prototype._onMoveConfirmBox=function(c,d,a,b){if(b>=core.__PIXELS__/2&&b<=core.__PIXELS__/2+64){if(a>=core.__PIXELS__/2-70&&a<=core.__PIXELS__/2-10){if(core.status.event.selection!=0){core.status.event.selection=0;core.playSound("光标移动");if(core.status.event.id=="action"){core.ui.drawConfirmBox(core.status.event.ui.text)}else{core.ui.drawConfirmBox(core.status.event.ui,core.status.event.data.yes,core.status.event.data.no)}}return}if(a>=core.__PIXELS__/2+10&&a<=core.__PIXELS__/2+70){if(core.status.event.selection!=1){core.status.event.selection=1;core.playSound("光标移动");if(core.status.event.id=="action"){core.ui.drawConfirmBox(core.status.event.ui.text)}else{core.ui.drawConfirmBox(core.status.event.ui,core.status.event.data.yes,core.status.event.data.no)}}return}}};actions.prototype._clickAction_text=function(){if(core.status.event.animateUI){return}var a=core.clone(core.status.event.data.current);if(typeof a=="string"){a={type:"text",text:a}}if(core.status.event.interval!=null){a.showAll=true;core.insertAction(a);core.doAction();return}if(!a.code){core.ui._animateUI("hide",null,core.doAction)}else{core.doAction()}};actions.prototype._clickAction=function(j,k,f,g){if(core.status.event.data.type=="text"){return this._clickAction_text()}if(core.status.event.data.type=="wait"){var h=Math.max(0,core.status.event.timeout-new Date().getTime())||0;core.setFlag("type",1);core.setFlag("x",j);core.setFlag("y",k);core.setFlag("px",f);core.setFlag("py",g);core.setFlag("timeout",h);var d=core.events.__action_wait_afterGet(core.status.event.data.current);if(d||!core.status.event.data.current.forceChild){core.status.route.push("input:"+(100000000*h+1000000+1000*f+g));clearTimeout(core.status.event.interval);delete core.status.event.timeout;core.doAction()}return}if(core.status.event.data.type=="choices"){var c=core.status.event.data.current;var b=c.choices;if(b.length==0){return}if(j>=this.CHOICES_LEFT&&j<=this.CHOICES_RIGHT){var i=this._getChoicesTopIndex(b.length);if(k>=i&&k<i+b.length){var a=b[k-i];if(a.need!=null&&a.need!=""&&!core.calValue(a.need)){core.playSound("操作失败");core.drawTip("无法选择此项");return}clearTimeout(core.status.event.interval);var h=Math.max(0,core.status.event.timeout-new Date().getTime())||0;delete core.status.event.timeout;core.setFlag("timeout",h);var e=k-i;if(e==b.length-1&&core.hasFlag("@temp@shop")){e=-1}core.status.route.push("choices:"+(100*h+e));core.insertAction(a.action);core.doAction()}}return}if(core.status.event.data.type=="confirm"){if((j==this.HSIZE-2||j==this.HSIZE-1)&&k==this.HSIZE+1){clearTimeout(core.status.event.interval);var h=Math.max(0,core.status.event.timeout-new Date().getTime())||0;delete core.status.event.timeout;core.setFlag("timeout",h);core.status.route.push("choices:"+100*h);core.insertAction(core.status.event.ui.yes);core.doAction()}else{if((j==this.HSIZE+2||j==this.HSIZE+1)&&k==this.HSIZE+1){clearTimeout(core.status.event.interval);var h=Math.max(0,core.status.event.timeout-new Date().getTime())||0;delete core.status.event.timeout;core.setFlag("timeout",h);core.status.route.push("choices:"+(100*h+1));core.insertAction(core.status.event.ui.no);core.doAction()}}return}};actions.prototype._keyDownAction=function(a){if(core.status.event.data.type=="choices"){this._keyDownChoices(a);return}if(core.status.event.data.type=="confirm"&&(a==37||a==39)){core.status.event.selection=1-core.status.event.selection;core.playSound("光标移动");core.drawConfirmBox(core.status.event.ui.text);return}};actions.prototype._keyUpAction=function(d){if(core.status.event.data.type=="text"&&(d==13||d==32||d==67)){return this._clickAction_text()}if(core.status.event.data.type=="wait"){var e=Math.max(0,core.status.event.timeout-new Date().getTime())||0;core.setFlag("type",0);core.setFlag("keycode",d);core.setFlag("timeout",e);var c=core.events.__action_wait_afterGet(core.status.event.data.current);if(c||!core.status.event.data.current.forceChild){core.status.route.push("input:"+(100000000*e+d));clearTimeout(core.status.event.interval);delete core.status.event.timeout;core.doAction()}return}if(core.status.event.data.type=="choices"){var b=core.status.event.data.current;var a=b.choices;if(a.length>0){this._selectChoices(a.length,d,this._clickAction)}return}if(core.status.event.data.type=="confirm"&&(d==13||d==32||d==67)){var e=Math.max(0,core.status.event.timeout-new Date().getTime())||0;delete core.status.event.timeout;core.setFlag("timeout",e);core.status.route.push("choices:"+(100*e+core.status.event.selection));if(core.status.event.selection==0){core.insertAction(core.status.event.ui.yes)}else{core.insertAction(core.status.event.ui.no)}core.doAction();return}};actions.prototype._clickBook=function(h,j){var e=core.ui._drawBook_pageinfo();if((h==this.HSIZE-2||h==this.HSIZE-3)&&j==this.LAST){core.playSound("光标移动");core.ui.drawBook(core.status.event.data-e.per_page);return}if((h==this.HSIZE+2||h==this.HSIZE+3)&&j==this.LAST){core.playSound("光标移动");core.ui.drawBook(core.status.event.data+e.per_page);return}if(h>=this.LAST-2&&j==this.LAST){core.playSound("取消");if(core.events.recoverEvents(core.status.event.interval)){return}else{if(core.status.event.ui!=null){core.status.boxAnimateObjs=[];core.ui._drawViewMaps(core.status.event.ui)}else{core.ui.closePanel()}}return}var a=core.status.event.data;if(a!=null&&j<this.LAST){var f=e.per_page,d=parseInt(a/f);var g=this.LAST/f;for(var b=0;b<f;++b){if(j>=g*b&&j<g*(b+1)){var c=f*d+b;core.ui.drawBook(c);core.ui._drawBookDetail(c);break}}return}return};actions.prototype._keyDownBook=function(a){var b=core.ui._drawBook_pageinfo();if(a==37){core.playSound("光标移动");core.ui.drawBook(core.status.event.data-b.per_page)}if(a==38){core.playSound("光标移动");core.ui.drawBook(core.status.event.data-1)}if(a==39){core.playSound("光标移动");core.ui.drawBook(core.status.event.data+b.per_page)}if(a==40){core.playSound("光标移动");core.ui.drawBook(core.status.event.data+1)}if(a==33){core.playSound("光标移动");core.ui.drawBook(core.status.event.data-b.per_page)}if(a==34){core.playSound("光标移动");core.ui.drawBook(core.status.event.data+b.per_page)}return};actions.prototype._keyUpBook=function(b){if(b==27||b==88){core.playSound("取消");if(core.events.recoverEvents(core.status.event.interval)){return}else{if(core.status.event.ui!=null){core.status.boxAnimateObjs=[];core.ui._drawViewMaps(core.status.event.ui)}else{core.ui.closePanel()}}return}if(b==13||b==32||b==67){var a=core.status.event.data;if(a!=null){core.ui._drawBookDetail(a)}return}};actions.prototype._clickBookDetail=function(){core.clearMap("data");core.playSound("取消");core.status.event.id="book"};actions.prototype._clickFly=function(a,b){if((a==this.SIZE-2||a==this.SIZE-3)&&b==this.HSIZE+3){core.playSound("光标移动");core.ui.drawFly(this._getNextFlyFloor(-1))}if((a==this.SIZE-2||a==this.SIZE-3)&&b==this.HSIZE-1){core.playSound("光标移动");core.ui.drawFly(this._getNextFlyFloor(1))}if((a==this.SIZE-2||a==this.SIZE-3)&&b==this.HSIZE+4){core.playSound("光标移动");core.ui.drawFly(this._getNextFlyFloor(-10))}if((a==this.SIZE-2||a==this.SIZE-3)&&b==this.HSIZE-2){core.playSound("光标移动");core.ui.drawFly(this._getNextFlyFloor(10))}if(a>=this.HSIZE-1&&a<=this.HSIZE+1&&b==this.LAST){core.playSound("取消");core.ui.closePanel()}if(a>=0&&a<=this.HSIZE+3&&b>=3&&b<=this.LAST-1){core.flyTo(core.floorIds[core.status.event.data])}return};actions.prototype._keyDownFly=function(a){if(a==37){core.playSound("光标移动");core.ui.drawFly(this._getNextFlyFloor(-10))}else{if(a==38){core.playSound("光标移动");core.ui.drawFly(this._getNextFlyFloor(1))}else{if(a==39){core.playSound("光标移动");core.ui.drawFly(this._getNextFlyFloor(10))}else{if(a==40){core.playSound("光标移动");core.ui.drawFly(this._getNextFlyFloor(-1))}}}}return};actions.prototype._getNextFlyFloor=function(b,d){if(d==null){d=core.status.event.data}if(b==0){return d}var e=Math.sign(b);b=Math.abs(b);var a=d;while(true){d+=e;if(d<0||d>=core.floorIds.length){break}var c=core.floorIds[d];if(core.status.maps[c].canFlyTo&&core.hasVisitedFloor(c)){b--;a=d}if(b==0){break}}return a};actions.prototype._keyUpFly=function(a){if(a==71||a==27||a==88){core.playSound("取消");core.ui.closePanel()}if(a==13||a==32||a==67){this._clickFly(this.HSIZE-1,this.HSIZE-1)}return};actions.prototype._clickViewMaps=function(l,m,j,k){if(core.status.event.data==null){core.ui._drawViewMaps(core.floorIds.indexOf(core.status.floorId));return}var h=core.floorIds.indexOf(core.status.floorId);var e=core.status.event.data.index;var b=core.status.event.data.x,c=core.status.event.data.y;var d=core.floorIds[e],g=core.floors[d].width,f=core.floors[d].height;var i=core.__PIXELS__/5,a=i*3/4;if(j<=a&&k<=a){core.status.event.data.damage=!core.status.event.data.damage;core.playSound("光标移动");core.ui._drawViewMaps(e,b,c);return}if(j<=a&&k>=core.__PIXELS__-a){if(core.markedFloorIds[d]){delete core.markedFloorIds[d]}else{core.markedFloorIds[d]=true}core.playSound("光标移动");core.ui._drawViewMaps(e,b,c);return}if(j>=core.__PIXELS__-a&&k<=a){core.status.event.data.all=!core.status.event.data.all;core.playSound("光标移动");core.ui._drawViewMaps(e,b,c);return}if(j>=i&&j<=core.__PIXELS__-i&&k<=i&&(!core.status.event.data.all&&f>this.SIZE)){core.playSound("光标移动");core.ui._drawViewMaps(e,b,c-1);return}if(j>=i&&j<=core.__PIXELS__-i&&k>=core.__PIXELS__-i&&(!core.status.event.data.all&&f>this.SIZE)){core.playSound("光标移动");core.ui._drawViewMaps(e,b,c+1);return}if(j<=i&&k>=i&&k<=core.__PIXELS__-i){core.playSound("光标移动");core.ui._drawViewMaps(e,b-1,c);return}if(j>=core.__PIXELS__-i&&k>=i&&k<=core.__PIXELS__-i){core.playSound("光标移动");core.ui._drawViewMaps(e,b+1,c);return}if(k<=2*i&&(f==this.SIZE||(j>=i&&j<=core.__PIXELS__-i))){core.playSound("光标移动");e++;while(e<core.floorIds.length&&e!=h&&core.status.maps[core.floorIds[e]].cannotViewMap){e++}if(e<core.floorIds.length){core.ui._drawViewMaps(e)}return}if(k>=3*i&&(f==this.SIZE||(j>=i&&j<=core.__PIXELS__-i))){core.playSound("光标移动");e--;while(e>=0&&e!=h&&core.status.maps[core.floorIds[e]].cannotViewMap){e--}if(e>=0){core.ui._drawViewMaps(e)}return}if(j>=i&&j<=core.__PIXELS__-i&&k>=i*2&&k<=i*3){core.clearMap("data");core.playSound("取消");core.ui.closePanel();return}};actions.prototype._keyDownViewMaps=function(b){if(core.status.event.data==null){return}var a=core.floorIds[core.status.event.data.index],c=core.floors[a].height;if(b==38||b==33){this._clickViewMaps(this.HSIZE,this.HSIZE-3,core.__PIXELS__/2,core.__PIXELS__/5*1.5)}if(b==40||b==34){this._clickViewMaps(this.HSIZE,this.HSIZE+3,core.__PIXELS__/2,core.__PIXELS__/5*3.5)}if(b==87&&c>this.SIZE){this._clickViewMaps(this.HSIZE,0,core.__PIXELS__/2,1)}if(b==65){this._clickViewMaps(0,this.HSIZE,1,core.__PIXELS__/2)}if(b==83&&c>this.SIZE){this._clickViewMaps(this.HSIZE,this.LAST,core.__PIXELS__/2,core.__PIXELS__-1)}if(b==68){this._clickViewMaps(this.LAST,this.HSIZE,core.__PIXELS__,core.__PIXELS__/2-1)}return};actions.prototype._keyUpViewMaps=function(b){if(core.status.event.data==null){core.ui._drawViewMaps(core.floorIds.indexOf(core.status.floorId));return}var a=core.floorIds[core.status.event.data.index];if(b==27||b==13||b==32||(!core.isReplaying()&&b==67)){core.clearMap("data");core.playSound("取消");core.ui.closePanel();return}if(b==86){core.status.event.data.damage=!core.status.event.data.damage;core.playSound("光标移动");core.ui._drawViewMaps(core.status.event.data);return}if(b==90){core.status.event.data.all=!core.status.event.data.all;core.playSound("光标移动");core.ui._drawViewMaps(core.status.event.data);return}if(b==66){if(core.markedFloorIds[a]){delete core.markedFloorIds[a]}else{core.markedFloorIds[a]=true}core.playSound("光标移动");core.ui._drawViewMaps(core.status.event.data);return}if(b==88||(core.isReplaying()&&b==67)){if(core.isReplaying()){core.control._replay_book()}else{core.openBook(false)}return}if(b==71&&!core.isReplaying()){core.useFly(false);return}return};actions.prototype._clickQuickShop=function(e,f){var c=core.listShopIds();if(e>=this.CHOICES_LEFT&&e<=this.CHOICES_RIGHT){var d=this.HSIZE-parseInt(c.length/2)+(core.status.event.ui.offset||0);if(f>=d&&f<d+c.length){var b=c[f-d];if(!core.canOpenShop(b)){core.playSound("操作失败");core.drawTip("当前项尚未开启");return}var a=core.canUseQuickShop(b);if(a==null){core.openShop(c[f-d],false)}else{core.playSound("操作失败");core.drawTip(a)}}else{if(f==d+c.length){core.playSound("取消");core.ui.closePanel()}}return}return};actions.prototype._keyUpQuickShop=function(a){if(a==27||a==75||a==88||a==86){core.playSound("取消");core.ui.closePanel();return}this._selectChoices(core.listShopIds().length+1,a,this._clickQuickShop);return};actions.prototype._clickToolbox=function(g,h){var e=core.getToolboxItems("tools"),a=core.getToolboxItems("constants");if(g>=this.LAST-2&&h==0){core.ui.closePanel();if(core.isReplaying()){core.control._replay_equipbox()}else{core.openEquipbox()}return}if(g>=this.LAST-2&&h==this.LAST){core.playSound("取消");core.ui.closePanel();var d=core.status.route[core.status.route.length-1];if(d.startsWith("equip:")||d.startsWith("unEquip:")){core.status.route.push("no")}core.checkAutoEvents();return}var f=core.status.event.data.toolsPage;var b=core.status.event.data.constantsPage;if(g==this.HSIZE-2||g==this.HSIZE-3){if(h==this.LAST-5&&f>1){core.status.event.data.toolsPage--;core.playSound("光标移动");core.ui._drawToolbox(core.status.event.selection)}if(h==this.LAST&&b>1){core.status.event.data.constantsPage--;core.playSound("光标移动");core.ui._drawToolbox(core.status.event.selection)}}if(g==this.HSIZE+2||g==this.HSIZE+3){if(h==this.LAST-5&&f<Math.ceil(e.length/this.LAST)){core.status.event.data.toolsPage++;core.playSound("光标移动");core.ui._drawToolbox(core.status.event.selection)}if(h==this.LAST&&b<Math.ceil(a.length/this.LAST)){core.status.event.data.constantsPage++;core.playSound("光标移动");core.ui._drawToolbox(core.status.event.selection)}}var c=parseInt(g/2);if(h==this.LAST-8){c+=0}else{if(h==this.LAST-6){c+=this.HSIZE}else{if(h==this.LAST-3){c+=this.LAST}else{if(h==this.LAST-1){c+=this.LAST+this.HSIZE}else{c=-1}}}}if(c>=0){this._clickToolboxIndex(c)}};actions.prototype._clickToolboxIndex=function(b){var f=core.getToolboxItems("tools"),a=core.getToolboxItems("constants");var d=null;var e;if(b<this.LAST){e=b+this.LAST*(core.status.event.data.toolsPage-1);d=f}else{e=b%this.LAST+this.LAST*(core.status.event.data.constantsPage-1);d=a}if(d==null){return}if(e>=d.length){return}var c=d[e];if(c==core.status.event.data.selectId){if(core.isReplaying()){return}core.events.tryUseItem(c)}else{core.playSound("光标移动");core.ui._drawToolbox(b)}};actions.prototype._keyDownToolbox=function(f){if(core.status.event.data==null){return}var g=this.LAST-1;var i=core.getToolboxItems("tools"),a=core.getToolboxItems("constants");var e=core.status.event.selection;var k=core.status.event.data.toolsPage;var c=core.status.event.data.constantsPage;var l=Math.ceil(i.length/this.LAST);var d=Math.ceil(a.length/this.LAST);var j=k<l?g:(i.length+g)%this.LAST;var b=this.LAST+(c<d?g:(a.length+g)%this.LAST);if(f==37){if(e==0){if(k>1){core.status.event.data.toolsPage--;e=g}else{return}}else{if(e==this.LAST){if(c==1){if(l==0){return}core.status.event.data.toolsPage=l;e=(i.length+g)%this.LAST}else{core.status.event.data.constantsPage--;e=2*this.LAST-1}}else{e-=1}}this._clickToolboxIndex(e);return}if(f==38){if(e>=this.LAST&&e<this.LAST+this.HSIZE){if(l==0){return}if(j>=this.HSIZE){e=Math.min(j,e-this.HSIZE)}else{e=Math.min(j,e-this.LAST)}}else{if(e<this.HSIZE){return}else{e-=this.HSIZE}}this._clickToolboxIndex(e);return}if(f==39){if(k<l&&e==g){core.status.event.data.toolsPage++;e=0}else{if(c<d&&e==2*this.LAST-1){core.status.event.data.constantsPage++;e=this.LAST}else{if(e==j){if(d==0){return}core.status.event.data.constantsPage=1;e=this.LAST}else{if(e==b){return}else{e++}}}}this._clickToolboxIndex(e);return}if(f==40){var h=null;if(e<this.HSIZE){if(j>=this.HSIZE){h=Math.min(j,e+this.HSIZE)}else{e+=this.HSIZE}}if(h==null&&e<this.LAST){if(d==0){return}h=Math.min(e+this.HSIZE,b)}if(h==null&&e<this.LAST+this.HSIZE){if(b>=this.LAST+this.HSIZE){h=Math.min(b,e+this.HSIZE)}}if(h!=null){this._clickToolboxIndex(h)}return}};actions.prototype._keyUpToolbox=function(a){if(a==81){core.playSound("确定");core.ui.closePanel();if(core.isReplaying()){core.control._replay_equipbox()}else{core.openEquipbox()}return}if(a==84||a==27||a==88){core.playSound("取消");core.ui.closePanel();var b=core.status.route[core.status.route.length-1];if(b.startsWith("equip:")||b.startsWith("unEquip:")){core.status.route.push("no")}core.checkAutoEvents();return}if(core.status.event.data==null){return}if(a==13||a==32||a==67){this._clickToolboxIndex(core.status.event.selection);return}};actions.prototype._clickEquipbox=function(f,g){if(f>=this.LAST-2&&g==0){core.playSound("确定");core.ui.closePanel();if(core.isReplaying()){core.control._replay_toolbox()}else{core.openToolbox()}return}if(f>=this.LAST-2&&g==this.LAST){core.playSound("取消");core.ui.closePanel();var b=core.status.route[core.status.route.length-1];if(b.startsWith("equip:")||b.startsWith("unEquip:")){core.status.route.push("no")}core.checkAutoEvents();return}if((f==this.HSIZE-2||f==this.HSIZE-3)&&g==this.LAST){if(core.status.event.data.page>1){core.status.event.data.page--;core.playSound("光标移动");core.ui._drawEquipbox(core.status.event.selection)}return}if((f==this.HSIZE+2||f==this.HSIZE+3)&&g==this.LAST){var c=Math.ceil(core.getToolboxItems("equips").length/this.LAST);if(core.status.event.data.page<c){core.status.event.data.page++;core.playSound("光标移动");core.ui._drawEquipbox(core.status.event.selection)}return}var d=this.HSIZE-3,e=this.SIZE/d;if(g==this.LAST-8){for(var a=0;a<d;++a){if(f>=a*e&&f<=(a+1)*e){return this._clickEquipboxIndex(a)}}}else{if(g==this.LAST-6){for(var a=0;a<d;++a){if(f>=a*e&&f<=(a+1)*e){return this._clickEquipboxIndex(d+a)}}}else{if(g==this.LAST-3){this._clickEquipboxIndex(this.LAST+parseInt(f/2))}else{if(g==this.LAST-1){this._clickEquipboxIndex(this.LAST+this.HSIZE+parseInt(f/2))}}}}};actions.prototype._clickEquipboxIndex=function(c){if(c<this.LAST){if(c>=core.status.globalAttribute.equipName.length){return}if(c==core.status.event.selection&&core.status.hero.equipment[c]){if(core.isReplaying()){return}core.unloadEquip(c);core.status.route.push("unEquip:"+c)}else{core.playSound("光标移动")}}else{var b=core.getToolboxItems("equips");if(c==core.status.event.selection){if(core.isReplaying()){return}var a=b[c-this.LAST+(core.status.event.data.page-1)*this.LAST];core.loadEquip(a);core.status.route.push("equip:"+a)}else{core.playSound("光标移动")}}core.ui._drawEquipbox(c)};actions.prototype._keyDownEquipbox=function(c){if(core.status.event.data==null){return}var d=this.LAST-1;var g=this.HSIZE-3;var a=core.status.globalAttribute.equipName.length;var e=core.getToolboxItems("equips");var b=core.status.event.selection;var f=core.status.event.data.page;var i=Math.ceil(e.length/this.LAST);var h=this.LAST+(f<i?d:(e.length+d)%this.LAST);if(c==37){if(b==0){return}if(b==this.LAST){if(f>1){core.status.event.data.page--;core.playSound("光标移动");b=this.LAST+d}else{if(f==1){b=a-1}else{return}}}else{b-=1}this._clickEquipboxIndex(b);return}if(c==38){if(b<g){return}else{if(b<2*g){b-=g}else{if(b<this.LAST+this.HSIZE){b=parseInt((b-this.LAST)/2);if(a>g){b=Math.min(a-1,b+g)}else{b=Math.min(a-1,b)}}else{b-=this.HSIZE}}}this._clickEquipboxIndex(b);return}if(c==39){if(f<i&&b==this.LAST+d){core.status.event.data.page++;core.playSound("光标移动");b=this.LAST}else{if(b==a-1){if(i==0){return}b=this.LAST}else{if(b==h){return}else{b++}}}this._clickEquipboxIndex(b);return}if(c==40){if(b<g){if(a>g){b=Math.min(b+g,a-1)}else{if(i==0){return}b=Math.min(2*b+1+this.LAST,h)}}else{if(b<2*g){if(i==0){return}b=Math.min(2*(b-g)+1+this.LAST,h)}else{if(b<this.LAST+this.HSIZE){b=Math.min(b+this.HSIZE,h)}else{return}}}this._clickEquipboxIndex(b);return}};actions.prototype._keyUpEquipbox=function(b,a){if(a&&b>=48&&b<=57){core.items.quickSaveEquip(b-48);return}if(b==84){core.playSound("确定");core.ui.closePanel();if(core.isReplaying()){core.control._replay_toolbox()}else{core.openToolbox()}return}if(b==81||b==27||b==88){core.playSound("取消");core.ui.closePanel();var c=core.status.route[core.status.route.length-1];if(c.startsWith("equip:")||c.startsWith("unEquip:")){core.status.route.push("no")}core.checkAutoEvents();return}if(!core.status.event.data.selectId){return}if(b==13||b==32||b==67){this._clickEquipboxIndex(core.status.event.selection);return}};actions.prototype._clickSL=function(g,j){var d=core.status.event.data.page,c=core.status.event.data.offset;var b=d*10+c;if((g==this.HSIZE-2||g==this.HSIZE-3)&&j==this.LAST){core.playSound("光标移动");core.ui._drawSLPanel(10*(d-1)+c);return}if((g==this.HSIZE+2||g==this.HSIZE+3)&&j==this.LAST){core.playSound("光标移动");core.ui._drawSLPanel(10*(d+1)+c);return}if(g>=this.LAST-2&&j==this.LAST){core.playSound("取消");if(core.events.recoverEvents(core.status.event.interval)){return}core.ui.closePanel();delete core.status.tempRoute;if(!core.isPlaying()){core.showStartAnimate(true)}return}if(g>=0&&g<=2&&j==this.LAST){if(core.status.event.id=="save"){core.status.event.selection=!core.status.event.selection;core.ui._drawSLPanel(b)}else{core.status.event.data.mode=core.status.event.data.mode=="all"?"fav":"all";if(core.status.event.data.mode=="fav"){core.ui._drawSLPanel(1,true)}else{d=parseInt((core.saves.saveIndex-1)/5);c=core.saves.saveIndex-5*d;core.ui._drawSLPanel(10*d+c,true)}}return}var h=parseInt(this.SIZE/3),i=parseInt(this.SIZE*2/3);var e=0,f=this.HSIZE;if(j>=e&&j<=e+1){if(g>=h&&g<i){return this._clickSL_favorite(d,1)}if(g>=i){return this._clickSL_favorite(d,2)}}if(j>=f&&j<=f+1){if(g<h){return this._clickSL_favorite(d,3)}if(g>=h&&g<i){return this._clickSL_favorite(d,4)}if(g>=i){return this._clickSL_favorite(d,5)}}var a=null;if(j>=e+2&&j<this.HSIZE-1){if(g<h){a="autoSave"}if(g>=h&&g<i){a=5*d+1}if(g>=i){a=5*d+2}}if(j>=f+2&&j<this.SIZE-1){if(g<h){a=5*d+3}if(g>=h&&g<i){a=5*d+4}if(g>=i){a=5*d+5}}if(a!=null){if(core.status.event.selection){if(a=="autoSave"){core.playSound("操作失败");core.drawTip("无法删除自动存档!")}else{core.removeSave(a,function(){core.ui._drawSLPanel(b,true)})}}else{if(core.status.event.data.mode=="fav"&&a!="autoSave"){a=core.saves.favorite[a-1]}core.doSL(a,core.status.event.id)}}};actions.prototype._clickSL_favorite=function(c,b){if(b==0){return}var a=5*c+b;if(core.status.event.data.mode=="fav"){a=core.saves.favorite[a-1];core.myprompt("请输入想要显示的存档名(长度不超过5字符)",null,function(e){if(e&&e.length<=5){core.saves.favoriteName[a]=e;core.control._updateFavoriteSaves();core.ui._drawSLPanel(10*c+b)}else{if(e){alert("无效的输入!")}}})}else{var d=core.saves.favorite.indexOf(a);core.playSound("确定");if(d>=0){core.saves.favorite.splice(d,1);delete core.saves.favoriteName[a]}else{if(core.hasSave(a)){core.saves.favorite.push(a);core.saves.favorite=core.saves.favorite.sort(function(e,f){return e-f});core.drawTip("收藏成功!")}}core.control._updateFavoriteSaves();core.ui._drawSLPanel(10*c+b)}};actions.prototype._keyDownSL=function(b){var d=core.status.event.data.page,c=core.status.event.data.offset;var a=d*10+c;if(b==37){core.playSound("光标移动");if(c==0){core.ui._drawSLPanel(10*(d-1)+5)}else{core.ui._drawSLPanel(a-1)}return}if(b==38){core.playSound("光标移动");if(c<3){core.ui._drawSLPanel(10*(d-1)+c+3)}else{core.ui._drawSLPanel(a-3)}return}if(b==39){core.playSound("光标移动");if(c==5){core.ui._drawSLPanel(10*(d+1)+1)}else{core.ui._drawSLPanel(a+1)}return}if(b==40){core.playSound("光标移动");if(c>=3){core.ui._drawSLPanel(10*(d+1)+c-3)}else{core.ui._drawSLPanel(a+3)}return}if(b==33){core.playSound("光标移动");core.ui._drawSLPanel(10*(d-1)+c);return}if(b==34){core.playSound("光标移动");core.ui._drawSLPanel(10*(d+1)+c);return}};actions.prototype._keyUpSL=function(c){var e=core.status.event.data.page,d=core.status.event.data.offset;var b=e*10+d;if(c==27||c==88||(core.status.event.id=="save"&&c==83)||(core.status.event.id=="load"&&c==68)){this._clickSL(this.LAST,this.LAST);return}if(c>=48&&c<=57){if(c==48){c=58}core.ui._drawSLPanel((c-49)*1000+1);return}if(c==13||c==32||c==67){if(d==0){core.doSL("autoSave",core.status.event.id)}else{var a=5*e+d;if(core.status.event.data.mode=="fav"){a=core.saves.favorite[a-1]}core.doSL(a,core.status.event.id)}return}if(c==69&&core.status.event.id!="save"){this._clickSL(0,this.LAST);return}if(c==46){if(d==0){core.playSound("操作失败");core.drawTip("无法删除自动存档!")}else{var a=5*e+d;if(core.status.event.data.mode=="fav"){a=core.saves.favorite[a-1]}core.removeSave(a,function(){core.ui._drawSLPanel(b,true)})}}if(c==70&&core.status.event.data.mode=="all"){this._clickSL_favorite(e,d)}};actions.prototype._clickSwitchs=function(d,e){var a=core.status.event.ui.choices;var c=this._getChoicesTopIndex(a.length);var b=e-c;if(d<this.CHOICES_LEFT||d>this.CHOICES_RIGHT){return}if(b>=0&&b<a.length){core.status.event.selection=b;switch(b){case 0:core.status.event.selection=0;core.playSound("确定");return core.ui._drawSwitchs_sounds();case 1:core.status.event.selection=0;core.playSound("确定");return core.ui._drawSwitchs_display();case 2:core.status.event.selection=0;core.playSound("确定");return core.ui._drawSwitchs_action();case 3:core.status.event.selection=0;core.playSound("取消");return core.ui._drawSettings()}}};actions.prototype._keyUpSwitchs=function(a){if(a==27||a==88){core.status.event.selection=0;core.playSound("取消");core.ui._drawSettings();return}this._selectChoices(core.status.event.ui.choices.length,a,this._clickSwitchs)};actions.prototype._clickSwitchs_sounds=function(i,j){var a=core.status.event.ui.choices;var g=this._getChoicesTopIndex(a.length);var f=j-g;if(i<this.CHOICES_LEFT||i>this.CHOICES_RIGHT){if(f!=2){return}}if(f>=0&&f<a.length){var h=a[f].width;var c=(core.__PIXELS__-h)/2,e=(core.__PIXELS__+h)/2;var b=parseInt(c/32),d=parseInt(e/32)-1;core.status.event.selection=f;switch(f){case 0:return this._clickSwitchs_sounds_bgm();case 1:return this._clickSwitchs_sounds_se();case 2:if(i==b||i==b+1){return this._clickSwitchs_sounds_userVolume(-1)}if(i==d||i==d+1){return this._clickSwitchs_sounds_userVolume(1)}return;case 3:core.status.event.selection=0;core.playSound("取消");core.ui._drawSwitchs();return}}};actions.prototype._clickSwitchs_sounds_bgm=function(){core.triggerBgm();core.playSound("确定");core.ui._drawSwitchs_sounds()};actions.prototype._clickSwitchs_sounds_se=function(){core.musicStatus.soundStatus=!core.musicStatus.soundStatus;core.setLocalStorage("soundStatus",core.musicStatus.soundStatus);core.playSound("确定");core.ui._drawSwitchs_sounds()};actions.prototype._clickSwitchs_sounds_userVolume=function(a){var b=Math.round(Math.sqrt(100*core.musicStatus.userVolume));if(b==0&&a<0){return}core.musicStatus.userVolume=core.clamp(Math.pow(b+a,2)/100,0,1);if(core.musicStatus.gainNode!=null){core.musicStatus.gainNode.gain.value=core.musicStatus.userVolume}if(core.musicStatus.playingBgm){core.material.bgms[core.musicStatus.playingBgm].volume=core.musicStatus.userVolume*core.musicStatus.designVolume}core.setLocalStorage("userVolume",core.musicStatus.userVolume);core.playSound("确定");core.ui._drawSwitchs_sounds()};actions.prototype._keyUpSwitchs_sounds=function(a){if(a==27||a==88){core.status.event.selection=0;core.playSound("取消");core.ui._drawSwitchs();return}if(a==37){switch(core.status.event.selection){case 2:core.playSound("确定");return this._clickSwitchs_sounds_userVolume(-1)}}else{if(a==39){switch(core.status.event.selection){case 2:core.playSound("确定");return this._clickSwitchs_sounds_userVolume(1)}}}this._selectChoices(core.status.event.ui.choices.length,a,this._clickSwitchs_sounds)};actions.prototype._clickSwitchs_display=function(i,j){var a=core.status.event.ui.choices;var g=this._getChoicesTopIndex(a.length);var f=j-g;if(i<this.CHOICES_LEFT||i>this.CHOICES_RIGHT){if(f!=0){return}}if(f>=0&&f<a.length){var h=a[f].width;var c=(core.__PIXELS__-h)/2,e=(core.__PIXELS__+h)/2;var b=parseInt(c/32),d=parseInt(e/32)-1;core.status.event.selection=f;switch(f){case 0:if(i==b||i==b+1){return this._clickSwitchs_display_setSize(-1)}if(i==d||i==d+1){return this._clickSwitchs_display_setSize(1)}return;case 1:core.playSound("确定");return this._clickSwitchs_display_enableHDCanvas();case 2:core.playSound("确定");return this._clickSwitchs_display_enableEnemyPoint();case 3:core.playSound("确定");return this._clickSwitchs_display_enemyDamage();case 4:core.playSound("确定");return this._clickSwitchs_display_critical();case 5:core.playSound("确定");return this._clickSwitchs_display_extraDamage();case 6:core.playSound("确定");return this._clickSwitchs_display_extraDamageType();case 7:core.status.event.selection=1;core.playSound("取消");core.ui._drawSwitchs();return}}};actions.prototype._clickSwitchs_display_setSize=function(b){core.setDisplayScale(b);var a=Math.max(window.devicePixelRatio||1,core.domStyle.scale);if(a>core.domStyle.ratio){core.drawTip("需刷新页面以调整UI清晰度")}core.ui._drawSwitchs_display()};actions.prototype._clickSwitchs_display_enableHDCanvas=function(){core.flags.enableHDCanvas=!core.flags.enableHDCanvas;core.setLocalStorage("enableHDCanvas",core.flags.enableHDCanvas);core.drawTip("开关高清UI,需刷新页面方可生效");core.ui._drawSwitchs_display()};actions.prototype._clickSwitchs_display_enableEnemyPoint=function(){core.flags.enableEnemyPoint=!core.flags.enableEnemyPoint;core.setLocalStorage("enableEnemyPoint",core.flags.enableEnemyPoint);core.ui._drawSwitchs_display()};actions.prototype._clickSwitchs_display_enemyDamage=function(){core.flags.displayEnemyDamage=!core.flags.displayEnemyDamage;core.updateDamage();core.setLocalStorage("enemyDamage",core.flags.displayEnemyDamage);core.ui._drawSwitchs_display()};actions.prototype._clickSwitchs_display_critical=function(){core.flags.displayCritical=!core.flags.displayCritical;core.updateDamage();core.setLocalStorage("critical",core.flags.displayCritical);core.ui._drawSwitchs_display()};actions.prototype._clickSwitchs_display_extraDamage=function(){core.flags.displayExtraDamage=!core.flags.displayExtraDamage;core.updateDamage();core.setLocalStorage("extraDamage",core.flags.displayExtraDamage);core.ui._drawSwitchs_display()};actions.prototype._clickSwitchs_display_extraDamageType=function(){core.flags.extraDamageType=(core.flags.extraDamageType+1)%3;core.updateDamage();core.setLocalStorage("extraDamageType",core.flags.extraDamageType);core.ui._drawSwitchs_display()};actions.prototype._keyUpSwitchs_display=function(a){if(a==27||a==88){core.status.event.selection=0;core.playSound("取消");core.ui._drawSwitchs();return}if(a==37){switch(core.status.event.selection){case 0:core.playSound("确定");return this._clickSwitchs_display_setSize(-1)}}else{if(a==39){switch(core.status.event.selection){case 0:core.playSound("确定");return this._clickSwitchs_display_setSize(1)}}}this._selectChoices(core.status.event.ui.choices.length,a,this._clickSwitchs_display)};actions.prototype._clickSwitchs_action=function(i,j){var a=core.status.event.ui.choices;var g=this._getChoicesTopIndex(a.length);var f=j-g;if(i<this.CHOICES_LEFT||i>this.CHOICES_RIGHT){if(f!=0&&f!=1){return}}if(f>=0&&f<a.length){var h=a[f].width;var c=(core.__PIXELS__-h)/2,e=(core.__PIXELS__+h)/2;var b=parseInt(c/32),d=parseInt(e/32)-1;core.status.event.selection=f;switch(f){case 0:if(i==b||i==b+1){core.playSound("确定");return this._clickSwitchs_action_moveSpeed(-10)}if(i==d||i==d+1){core.playSound("确定");return this._clickSwitchs_action_moveSpeed(10)}return;case 1:if(i==b||i==b+1){core.playSound("确定");return this._clickSwitchs_action_floorChangeTime(-100)}if(i==d||i==d+1){core.playSound("确定");return this._clickSwitchs_action_floorChangeTime(100)}case 2:core.playSound("确定");return this._clickSwitchs_action_potionNoRouting();case 3:core.playSound("确定");return this._clickSwitchs_action_clickMove();case 4:core.playSound("确定");return this._clickSwitchs_action_leftHandPrefer();case 5:core.status.event.selection=2;core.playSound("取消");core.ui._drawSwitchs();return}}};actions.prototype._clickSwitchs_action_moveSpeed=function(a){core.values.moveSpeed=core.clamp(core.values.moveSpeed+a,50,200);core.setLocalStorage("moveSpeed",core.values.moveSpeed);core.ui._drawSwitchs_action()};actions.prototype._clickSwitchs_action_floorChangeTime=function(a){core.values.floorChangeTime=core.clamp(core.values.floorChangeTime+a,0,2000);core.setLocalStorage("floorChangeTime",core.values.floorChangeTime);core.ui._drawSwitchs_action()};actions.prototype._clickSwitchs_action_potionNoRouting=function(){if(core.hasFlag("__potionNoRouting__")){core.removeFlag("__potionNoRouting__")}else{core.setFlag("__potionNoRouting__",true)}core.ui._drawSwitchs_action()};actions.prototype._clickSwitchs_action_clickMove=function(){if(core.hasFlag("__noClickMove__")){core.removeFlag("__noClickMove__")}else{core.setFlag("__noClickMove__",true)}core.ui._drawSwitchs_action()};actions.prototype._clickSwitchs_action_leftHandPrefer=function(){core.flags.leftHandPrefer=!core.flags.leftHandPrefer;core.setLocalStorage("leftHandPrefer",core.flags.leftHandPrefer);if(core.flags.leftHandPrefer){core.myconfirm("左手模式已开启!\n此模式下WASD将用于移动勇士,IJKL对应于原始的WASD进行存读档等操作。")}core.ui._drawSwitchs_action()};actions.prototype._keyUpSwitchs_action=function(a){if(a==27||a==88){core.status.event.selection=0;core.playSound("取消");core.ui._drawSwitchs();return}if(a==37){switch(core.status.event.selection){case 0:core.playSound("确定");return this._clickSwitchs_action_moveSpeed(-10);case 1:core.playSound("确定");return this._clickSwitchs_action_floorChangeTime(-100)}}else{if(a==39){switch(core.status.event.selection){case 0:core.playSound("确定");return this._clickSwitchs_action_moveSpeed(10);case 1:core.playSound("确定");return this._clickSwitchs_action_floorChangeTime(100)}}}this._selectChoices(core.status.event.ui.choices.length,a,this._clickSwitchs_action)};actions.prototype._clickSettings=function(d,e){if(d<this.CHOICES_LEFT||d>this.CHOICES_RIGHT){return}var a=core.status.event.ui.choices;var c=this._getChoicesTopIndex(a.length);if(e>=c&&e<c+a.length){var b=e-c;core.status.event.selection=b;switch(b){case 0:core.status.event.selection=0;core.playSound("确定");core.ui._drawSwitchs();break;case 1:core.ui._drawKeyBoard();break;case 2:core.clearUI();core.ui._drawViewMaps();break;case 3:core.status.event.selection=0;core.playSound("确定");core.ui._drawNotes();break;case 4:core.status.event.selection=0;core.playSound("确定");core.ui._drawSyncSave();break;case 5:core.status.event.selection=0;core.playSound("确定");core.ui._drawGameInfo();break;case 6:return core.confirmRestart();case 7:core.playSound("取消");core.ui.closePanel();break}}return};actions.prototype._keyUpSettings=function(a){if(a==27||a==88){core.playSound("取消");core.ui.closePanel();return}this._selectChoices(core.status.event.ui.choices.length,a,this._clickSettings)};actions.prototype._clickNotes=function(d,e){if(d<this.CHOICES_LEFT||d>this.CHOICES_RIGHT){return}var a=core.status.event.ui.choices;var c=this._getChoicesTopIndex(a.length);if(e>=c&&e<c+a.length){var b=e-c;core.status.event.selection=b;switch(b){case 0:core.playSound("确定");this._clickNotes_new();break;case 1:this._clickNotes_show();break;case 2:core.playSound("确定");this._clickNotes_edit();break;case 3:core.playSound("确定");this._clickNotes_delete();break;case 4:core.status.event.selection=3;core.playSound("取消");core.ui._drawSettings();break}}};actions.prototype.__clickNotes_replaceText=function(a){a=(a||"").replace(/[\${}]/g,"_").replace(/(\t|\\t)\[.*?\]/g,"").replace("\b","\\b").replace(/\\b\[.*?\]/g,"").replace(/\n|\\n/g," ");if(a.length>45){a=a.substring(0,43)+"..."}return a};actions.prototype._clickNotes_new=function(){core.status.hero.notes=core.status.hero.notes||[];core.myprompt("请输入一段笔记,不超过45字",null,function(a){a=core.actions.__clickNotes_replaceText(a);if(a){core.status.hero.notes.push(a);core.drawText("存档笔记新增成功!")}else{core.ui.closePanel()}})};actions.prototype._clickNotes_show=function(){core.playSound("确定");core.status.hero.notes=core.status.hero.notes||[];var c=[];for(var a=0;a<core.status.hero.notes.length;a+=5){var d=[];for(var b=a;b<a+5&&b<core.status.hero.notes.length;++b){d.push(b+1+". "+this.__clickNotes_replaceText(core.status.hero.notes[b]))}c.push("\t[存档笔记]"+d.join("\n"))}if(c.length==0){c.push("当前没有存档笔记,试着新增一个吧!\n(菜单栏 -> 存档笔记 -> 新增存档笔记)")}core.drawText(c)};actions.prototype._clickNotes_edit=function(){core.status.hero.notes=core.status.hero.notes||[];if(core.status.hero.notes.length==0){core.drawText("当前没有存档笔记,试着新增一个吧!")}else{core.myprompt("请输入要编辑的存档笔记编号(1 - "+core.status.hero.notes.length+")","1",function(a){if(!a){core.ui.closePanel()}var b=parseInt(a)||0;if(!b||b<=0||b>core.status.hero.notes.length){core.drawText("不合法的输入!")}else{core.myprompt("请输入新内容,不超过45字",core.status.hero.notes[b-1],function(c){c=core.actions.__clickNotes_replaceText(c);if(c){core.status.hero.notes[b-1]=c;core.drawText("存档笔记编辑成功!")}else{core.ui.closePanel()}})}})}};actions.prototype._clickNotes_delete=function(){core.status.hero.notes=core.status.hero.notes||[];if(core.status.hero.notes.length==0){core.stopSound();core.playSound("操作失败");core.drawText("当前没有存档笔记,无法删除!")}else{core.myprompt("请输入要删除的所有存档笔记编号,以逗号分隔。不填则代表删除全部笔记。",null,function(a){if(a==null){core.ui.closePanel();return}else{if(!a){core.status.hero.notes=[];core.drawText("所有存档笔记删除成功!")}else{a=a.split(",").map(function(b){return parseInt(b)}).filter(function(b){return b&&b>0&&b<=core.status.hero.notes.length});if(a.length==0){core.drawText("没有要删除的笔记!")}else{a.sort(function(c,d){return d-c}).forEach(function(b){core.status.hero.notes.splice(b-1,1)});core.drawText("已删除 "+a.sort().join(",")+" 号笔记")}}}})}};actions.prototype._keyUpNotes=function(a){if(a==27||a==88){core.status.event.selection=3;core.playSound("取消");core.ui._drawSettings();return}this._selectChoices(core.status.event.ui.choices.length,a,this._clickNotes)};actions.prototype._clickSyncSave=function(d,e){if(d<this.CHOICES_LEFT||d>this.CHOICES_RIGHT){return}var a=core.status.event.ui.choices;var c=this._getChoicesTopIndex(a.length);if(e>=c&&e<c+a.length){var b=e-c;core.status.event.selection=b;switch(b){case 0:core.status.event.selection=0;core.playSound("确定");core.ui._drawSyncSelect();break;case 1:core.playSound("确定");core.syncLoad();break;case 2:core.playSound("确定");core.status.event.selection=0;core.ui._drawLocalSaveSelect();break;case 3:core.playSound("确定");return this._clickSyncSave_readFile();case 4:return this._clickSyncSave_replay();case 5:core.status.event.selection=0;core.playSound("确定");core.ui._drawStorageRemove();break;case 6:core.status.event.selection=4;core.playSound("取消");core.ui._drawSettings();break}}return};actions.prototype._clickSyncSave_readFile=function(){core.readFile(function(a){if(a.name!=core.firstData.name){return alert("存档和游戏不一致!")}if(a.version!=core.firstData.version){return alert("游戏版本不一致!")}if(!a.data){return alert("无效的存档!")}core.control._syncLoad_write(a.data)},null,".h5save")};actions.prototype._clickSyncSave_replay=function(){core.ui._drawReplay()};actions.prototype._keyUpSyncSave=function(a){if(a==27||a==88){core.status.event.selection=4;core.playSound("取消");core.ui._drawSettings();return}this._selectChoices(core.status.event.ui.choices.length,a,this._clickSyncSave)};actions.prototype._clickSyncSelect=function(d,e){if(d<this.CHOICES_LEFT||d>this.CHOICES_RIGHT){return}var a=core.status.event.ui.choices;var c=this._getChoicesTopIndex(a.length);if(e>=c&&e<c+a.length){var b=e-c;core.status.event.selection=b;switch(b){case 0:core.playSound("确定");core.myconfirm("你确定要同步全部存档么?\n这可能在存档较多的时候比较慢。",function(){core.syncSave("all")});break;case 1:core.playSound("确定");core.syncSave();break;case 2:core.status.event.selection=0;core.playSound("取消");core.ui._drawSyncSave();break}}};actions.prototype._keyUpSyncSelect=function(a){if(a==27||a==88){core.status.event.selection=0;core.playSound("取消");core.ui._drawSyncSave();return}this._selectChoices(core.status.event.ui.choices.length,a,this._clickSyncSelect)};actions.prototype._clickLocalSaveSelect=function(e,f){if(e<this.CHOICES_LEFT||e>this.CHOICES_RIGHT){return}var b=core.status.event.ui.choices;var d=this._getChoicesTopIndex(b.length);if(f>=d&&f<d+b.length){var c=f-d;core.status.event.selection=c;if(c<2){var a=function(h){if(h){var g={name:core.firstData.name,version:core.firstData.version,data:h};core.download(core.firstData.name+"_"+core.formatDate2(new Date())+".h5save",LZString.compressToBase64(JSON.stringify(g)))}};if(c==0){core.getAllSaves(a)}else{core.getSave(core.saves.saveIndex,a)}}core.status.event.selection=2;core.playSound("取消");core.ui._drawSyncSave()}};actions.prototype._keyUpLocalSaveSelect=function(a){if(a==27||a==88){core.status.event.selection=2;core.playSound("取消");core.ui._drawSyncSave();return}this._selectChoices(core.status.event.ui.choices.length,a,this._clickLocalSaveSelect)};actions.prototype._clickStorageRemove=function(d,e){if(d<this.CHOICES_LEFT||d>this.CHOICES_RIGHT){return}var a=core.status.event.ui.choices;var c=this._getChoicesTopIndex(a.length);if(e>=c&&e<c+a.length){var b=e-c;core.status.event.selection=b;switch(b){case 0:return this._clickStorageRemove_all();case 1:return this._clickStorageRemove_current();case 2:core.status.event.selection=5;core.playSound("取消");core.ui._drawSyncSave();break}}};actions.prototype._clickStorageRemove_all=function(){core.myconfirm("你确定要清除【全部游戏】的所有本地存档?\n此行为不可逆!!!",function(){core.ui.drawWaiting("正在清空,请稍候...");core.clearLocalForage(function(){core.saves.ids={};core.saves.autosave.data=null;core.saves.autosave.updated=false;core.saves.autosave.now=0;core.saves.cache={};core.ui.closePanel();core.saves.saveIndex=1;core.saves.favorite=[];core.saves.favoriteName={};core.control._updateFavoriteSaves();core.removeLocalStorage("saveIndex");core.drawText("\t[操作成功]你的所有存档已被清空。")})})};actions.prototype._clickStorageRemove_current=function(){core.myconfirm("你确定要清除本游戏的所有本地存档?\n此行为不可逆!!!",function(){var a=function(){core.saves.ids={};core.saves.autosave.data=null;core.saves.autosave.updated=false;core.saves.autosave.now=0;core.ui.closePanel();core.saves.saveIndex=1;core.saves.favorite=[];core.saves.favoriteName={};core.control._updateFavoriteSaves();core.removeLocalStorage("saveIndex");core.drawText("\t[操作成功]当前塔的存档已被清空。")};core.ui.drawWaiting("正在清空,请稍候...");Object.keys(core.saves.ids).forEach(function(b){core.removeLocalForage("save"+b)});core.removeLocalForage("autoSave",a)})};actions.prototype._keyUpStorageRemove=function(a){if(a==27||a==88){core.status.event.selection=5;core.playSound("取消");core.ui._drawSyncSave();return}this._selectChoices(core.status.event.ui.choices.length,a,this._clickStorageRemove)};actions.prototype._clickReplay=function(d,e){if(d<this.CHOICES_LEFT||d>this.CHOICES_RIGHT){return}var a=core.status.event.ui.choices;var c=this._getChoicesTopIndex(a.length);if(e>=c&&e<c+a.length){var b=e-c;core.status.event.selection=b;switch(b){case 0:core.playSound("确定");return this._clickReplay_fromBeginning();case 1:core.playSound("确定");return this._clickReplay_fromLoad();case 2:core.playSound("确定");return this._clickReplay_replayRemain();case 3:core.playSound("确定");return this._clickReplay_replaySince();case 4:core.playSound("确定");return core.chooseReplayFile();case 5:core.playSound("确定");return this._clickReplay_download();case 6:core.playSound("取消");return core.ui.closePanel()}}};actions.prototype._clickReplay_fromBeginning=function(){core.ui.closePanel();core.startGame(core.status.hard,core.getFlag("__seed__"),core.cloneArray(core.status.route))};actions.prototype._clickReplay_fromLoad=function(){core.status.event.id="replayLoad";core.status.event.selection=null;core.clearUI();var c=core.saves.saveIndex;var b=parseInt((c-1)/5),a=c-5*b;core.ui._drawSLPanel(10*b+a)};actions.prototype._clickReplay_replayRemain=function(){core.closePanel();core.drawText(["\t[接续播放录像]该功能允许你播放\r[yellow]两个存档之间的录像\r,常常用于\r[yellow]区域优化\r。\n例如,有若干个区,已经全部通关;之后重打一区并进行了优化,则可以对剩余区域直接播放录像而无需全部重打。\n\n详细使用方法参见露珠录制的视频教程:\n\r[yellow]https://bilibili.com/video/BV1az4y1C78x","\t[步骤1]请选择一个存档。\n\r[yellow]该存档的坐标必须和当前勇士坐标完全相同。\r\n将尝试从此处开始回放。",],function(){core.status.event.id="replayRemain";core.lockControl();var c=core.saves.saveIndex;var b=parseInt((c-1)/5),a=c-5*b;core.ui._drawSLPanel(10*b+a)})};actions.prototype._clickReplay_replaySince=function(){core.closePanel();core.drawText(["\t[播放存档剩余录像]该功能为【接续播放录像】的简化版本,允许你播放\r[yellow]一个存档中剩余的录像\r,常常用于\r[yellow]录像局部优化\r。\n在录像正常播放中,你随时可以暂停并按S键进行存档;此时\r[yellow]剩余录像\r也会被记在存档中(在读档界面用\r[yellow][R]\r标识。)\n之后,你可以选择在路线优化后直接播放该存档的\r[yellow]剩余录像\r,而无需再像接续播放一样选择录像起点和终点。\n\n详细使用方法参见露珠录制的视频教程:\n\r[yellow]https://bilibili.com/video/BV1az4y1C78x","请选择一个存档。\n\n\r[yellow]该存档需为录像播放中存的,且坐标必须和当前勇士坐标完全相同。\r\n将尝试播放此存档的剩余录像。",],function(){core.status.event.id="replaySince";core.lockControl();var c=core.saves.saveIndex;var b=parseInt((c-1)/5),a=c-5*b;core.ui._drawSLPanel(10*b+a)})};actions.prototype._clickReplay_download=function(){core.download(core.firstData.name+"_"+core.formatDate2()+".h5route",LZString.compressToBase64(JSON.stringify({name:core.firstData.name,hard:core.status.hard,seed:core.getFlag("__seed__"),route:core.encodeRoute(core.status.route)})))};actions.prototype._keyUpReplay=function(a){if(a==27||a==88){core.playSound("取消");core.ui.closePanel();return}this._selectChoices(core.status.event.ui.choices.length,a,this._clickReplay)};actions.prototype._clickGameInfo=function(d,e){if(d<this.CHOICES_LEFT||d>this.CHOICES_RIGHT){return}var a=core.status.event.ui.choices;var c=this._getChoicesTopIndex(a.length);if(e>=c&&e<c+a.length){var b=e-c;core.status.event.selection=b;switch(b){case 0:return core.ui._drawStatistics();case 1:return this._clickGameInfo_openProject();case 2:return this._clickGameInfo_openComments();case 3:return core.ui._drawHelp();case 4:return core.ui._drawAbout();case 5:return this._clickGameInfo_download();case 6:core.status.event.selection=5;core.playSound("取消");core.ui._drawSettings();break}}};actions.prototype._clickGameInfo_openProject=function(){if(core.platform.isPC){window.open("editor.html","_blank")}else{core.myconfirm("即将离开本游戏,跳转至工程页面,确认?",function(){window.location.href="editor-mobile.html"})}};actions.prototype._clickGameInfo_openComments=function(){if(core.platform.isPC){window.open("/score.php?name="+core.firstData.name,"_blank")}else{core.myconfirm("即将离开本游戏,跳转至评论页面,确认?",function(){window.location.href="/score.php?name="+core.firstData.name})}};actions.prototype._clickGameInfo_download=function(){if(core.platform.isPC){window.open(core.firstData.name+".zip")}else{window.location.href=core.firstData.name+".zip"}};actions.prototype._keyUpGameInfo=function(a){if(a==27||a==88){core.status.event.selection=5;core.playSound("取消");return core.ui._drawSettings()}this._selectChoices(core.status.event.ui.choices.length,a,this._clickGameInfo)};actions.prototype._clickKeyBoard=function(c,d){var b=this.HSIZE;if(d==b-3&&c>=b-5&&c<=b+5){core.ui.closePanel();core.keyUp(112+c+5-b)}if(d==b-2&&c>=b-5&&c<=b+4){core.ui.closePanel();core.keyUp(c==b+4?48:49+c+5-b)}var a=[["Q","W","E","R","T","Y","U","I","O","P"],["A","S","D","F","G","H","J","K","L"],["Z","X","C","V","B","N","M"],];if(d==b-1&&c>=b-5&&c<=b+4){core.ui.closePanel();core.keyUp(a[0][c+5-b].charCodeAt(0))}if(d==b&&c>=b-5&&c<=b+3){core.ui.closePanel();core.keyUp(a[1][c+5-b].charCodeAt(0))}if(d==b+1&&c>=b-5&&c<=b+1){core.ui.closePanel();core.keyUp(a[2][c+5-b].charCodeAt(0))}if(d==b+2&&c>=b-5&&c<=b+5){core.ui.closePanel();if(c==b-5){core.keyUp(189)}if(c==b-4){core.keyUp(187)}if(c==b-3){core.keyUp(219)}if(c==b-2){core.keyUp(221)}if(c==b-1){core.keyUp(220)}if(c==b){core.keyUp(186)}if(c==b+1){core.keyUp(222)}if(c==b+2){core.keyUp(188)}if(c==b+3){core.keyUp(190)}if(c==b+4){core.keyUp(191)}if(c==b+5){core.keyUp(192)}}if(d==b+3&&c>=b-5&&c<=b+4){core.ui.closePanel();if(c==b-5){core.keyUp(27)}if(c==b-4){core.keyUp(9)}if(c==b-3){core.keyUp(20)}if(c==b-2){core.keyUp(16)}if(c==b-1){core.keyUp(17)}if(c==b){core.keyUp(18)}if(c==b+1){core.keyUp(32)}if(c==b+2){core.keyUp(8)}if(c==b+3){core.keyUp(13)}if(c==b+4){core.keyUp(46)}}if(d==b+4&&c>=b+3&&c<=b+5){core.playSound("取消");core.ui.closePanel()}};actions.prototype._clickCursor=function(c,d,a,b){if(c==core.status.automaticRoute.cursorX&&d==core.status.automaticRoute.cursorY){core.ui.closePanel();this.doRegisteredAction("ondown",c,d,a,b);this.doRegisteredAction("onup",c,d,a,b);return}core.status.automaticRoute.cursorX=c;core.status.automaticRoute.cursorY=d;core.ui._drawCursor()};actions.prototype._keyDownCursor=function(a){if(a==37){core.status.automaticRoute.cursorX--;core.playSound("光标移动");core.ui._drawCursor();return}if(a==38){core.status.automaticRoute.cursorY--;core.playSound("光标移动");core.ui._drawCursor();return}if(a==39){core.status.automaticRoute.cursorX++;core.playSound("光标移动");core.ui._drawCursor();return}if(a==40){core.status.automaticRoute.cursorY++;core.playSound("光标移动");core.ui._drawCursor();return}};actions.prototype._keyUpCursor=function(a){if(a==27||a==88){core.playSound("取消");core.ui.closePanel();return}if(a==13||a==32||a==67||a==69){core.playSound("确定");core.ui.closePanel();var b=core.status.automaticRoute.cursorX;var c=core.status.automaticRoute.cursorY;this.doRegisteredAction("ondown",b,c,32*b+16,32*c+16);this.doRegisteredAction("onup",b,c,32*b+16,32*c+16);return}};"use strict";function data(){this._init()}data.prototype._init=function(){this.firstData=data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.firstData;this.values=data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.values;this.flags=data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.flags};"use strict";function ui(){this._init();this.SIZE=core.__SIZE__;this.HSIZE=core.__HALF_SIZE__;this.LAST=this.SIZE-1;this.PIXEL=core.__PIXELS__;this.HPIXEL=this.PIXEL/2}ui.prototype._init=function(){this.uidata=functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.ui};ui.prototype.getContextByName=function(b){var a=b;if(typeof b=="string"){if(core.canvas[b]){a=core.canvas[b]}else{if(core.dymCanvas[b]){a=core.dymCanvas[b]}}}if(a&&a.canvas){return a}return null};ui.prototype._createUIEvent=function(){if(main.mode=="editor"){return}if(!core.dymCanvas.uievent){core.createCanvas("uievent",0,0,this.PIXEL,this.PIXEL,135)}};ui.prototype.clearMap=function(d,f,g,e,b){if(d=="all"){for(var c in core.canvas){core.canvas[c].clearRect(-32,-32,core.canvas[c].canvas.width+32,core.canvas[c].canvas.height+32)}core.dom.gif.innerHTML="";core.removeGlobalAnimate();core.deleteCanvas(function(h){return h.startsWith("_bigImage_")});core.setWeather(null)}else{var a=this.getContextByName(d);if(a){if(f!=null&&g!=null&&e!=null&&b!=null){a.clearRect(f,g,e,b)}else{a.clearRect(-32,-32,a.canvas.width+32,a.canvas.height+32)}}}};ui.prototype._uievent_clearMap=function(a){if(main.mode!="editor"&&(a.x==null||a.y==null||a.width==null||a.height==null)){this.deleteCanvas("uievent");return}this._createUIEvent();this.clearMap("uievent",core.calValue(a.x),core.calValue(a.y),core.calValue(a.width),core.calValue(a.height))};ui.prototype.fillText=function(h,m,r,s,k,d,g){if(k){core.setFillStyle(h,k)}if(d){core.setFont(h,d)}var b=this.getContextByName(h);if(!b){return}m=(m+"").replace(/\\r/g,"\r");var j=m.replace(/\r(\[.*\])?/g,"");var f=m.indexOf("\r");if(g!=null){this.setFontForMaxWidth(b,f>=0?j:m,g)}if(f>=0){var c=b.fillStyle;var p=core.calWidth(b,j);var n=b.textAlign;if(n=="center"){r-=p/2}else{if(n=="right"){r-=p}}b.textAlign="left";m=m.replace(/\r(?!\[.*\])/g,"\r["+c+"]");var a=m.match(/\r\[.*?\]/g);var o=m.split(/\r\[.*?\]/);var q=0;for(var e=0;e<o.length;e++){var l=o[e];if(a[e-1]){b.fillStyle=a[e-1].slice(2,-1)}b.fillText(l,r+q,s);q+=core.calWidth(b,l,r,s)}b.textAlign=n;b.fillStyle=c}else{b.fillText(m,r,s)}};ui.prototype._uievent_fillText=function(a){this._createUIEvent();this.fillText("uievent",core.replaceText(a.text),core.calValue(a.x),core.calValue(a.y),a.style,a.font,a.maxWidth)};ui.prototype.setFontForMaxWidth=function(e,f,d,b){var a=this.getContextByName(e);if(b){core.setFont(e,b)}var b=a.font,g=/(\d+)px/.exec(b);if(g==null){return}for(var c=parseInt(g[1]);c>=8;c--){a.font=b.replace(/(\d+)px/,c+"px");if(a.measureText(f).width<=d){return}}};ui.prototype.fillBoldText=function(d,g,h,i,f,e,b,c){var a=this.getContextByName(d);if(!a){return}if(b){a.font=b}if(!f){f=a.fillStyle}f=core.arrayToRGBA(f);if(!e){e="#000000"}e=core.arrayToRGBA(e);if(c!=null){this.setFontForMaxWidth(a,g,c)}a.strokeStyle=e;a.lineWidth=2;a.strokeText(g,h,i);a.fillStyle=f;a.fillText(g,h,i)};ui.prototype._uievent_fillBoldText=function(a){this._createUIEvent();this.fillBoldText("uievent",core.replaceText(a.text),core.calValue(a.x),core.calValue(a.y),a.style,a.strokeStyle,a.font)};ui.prototype.fillRect=function(d,g,h,f,c,e,a){if(e){core.setFillStyle(d,e)}var b=this.getContextByName(d);if(b){if(a){b.save();b.translate(g+f/2,h+c/2);b.rotate(a);b.translate(-g-f/2,-h-c/2)}b.fillRect(g,h,f,c);if(a){b.restore()}}};ui.prototype._uievent_fillRect=function(a){this._createUIEvent();if(a.radius){this.fillRoundRect("uievent",core.calValue(a.x),core.calValue(a.y),core.calValue(a.width),core.calValue(a.height),core.calValue(a.radius),a.style,(core.calValue(a.angle)||0)*Math.PI/180)}else{this.fillRect("uievent",core.calValue(a.x),core.calValue(a.y),core.calValue(a.width),core.calValue(a.height),a.style,(core.calValue(a.angle)||0)*Math.PI/180)}};ui.prototype.strokeRect=function(e,h,i,g,c,f,d,a){if(f){core.setStrokeStyle(e,f)}if(d){core.setLineWidth(e,d)}var b=this.getContextByName(e);if(b){if(a){b.save();b.translate(h+g/2,i+c/2);b.rotate(a);b.translate(-h-g/2,-i-c/2)}b.strokeRect(h,i,g,c);if(a){b.restore()}}};ui.prototype._uievent_strokeRect=function(a){this._createUIEvent();if(a.radius){this.strokeRoundRect("uievent",core.calValue(a.x),core.calValue(a.y),core.calValue(a.width),core.calValue(a.height),core.calValue(a.radius),a.style,a.lineWidth,(core.calValue(a.angle)||0)*Math.PI/180)}else{this.strokeRect("uievent",core.calValue(a.x),core.calValue(a.y),core.calValue(a.width),core.calValue(a.height),a.style,a.lineWidth,(core.calValue(a.angle)||0)*Math.PI/180)}};ui.prototype.fillRoundRect=function(d,h,i,g,c,e,f,a){if(f){core.setFillStyle(d,f)}var b=this.getContextByName(d);if(b){if(a){b.save();b.translate(h+g/2,i+c/2);b.rotate(a);b.translate(-h-g/2,-i-c/2)}this._roundRect_buildPath(b,h,i,g,c,e);b.fill();if(a){b.restore()}}};ui.prototype.strokeRoundRect=function(e,i,j,h,c,f,g,d,a){if(g){core.setStrokeStyle(e,g)}if(d){core.setLineWidth(e,d)}var b=this.getContextByName(e);if(b){if(a){b.save();b.translate(i+h/2,j+c/2);b.rotate(a);b.translate(-i-h/2,-j-c/2)}this._roundRect_buildPath(b,i,j,h,c,f);b.stroke();if(a){b.restore()}}};ui.prototype._roundRect_buildPath=function(a,e,f,d,b,c){a.beginPath();a.moveTo(e+c,f);a.lineTo(e+d-c,f);a.quadraticCurveTo(e+d,f,e+d,f+c);a.lineTo(e+d,f+b-c);a.quadraticCurveTo(e+d,f+b,e+d-c,f+b);a.lineTo(e+c,f+b);a.quadraticCurveTo(e,f+b,e,f+b-c);a.lineTo(e,f+c);a.quadraticCurveTo(e,f,e+c,f);a.closePath()};ui.prototype.fillPolygon=function(c,d,e){if(e){core.setFillStyle(c,e)}var a=this.getContextByName(c);if(!a){return}if(!d||d.length<3){return}a.beginPath();for(var b=0;b<d.length;++b){var f=core.calValue(d[b][0]),g=core.calValue(d[b][1]);if(b==0){a.moveTo(f,g)}else{a.lineTo(f,g)}}a.closePath();a.fill()};ui.prototype._uievent_fillPolygon=function(a){this._createUIEvent();this.fillPolygon("uievent",a.nodes,a.style)};ui.prototype.strokePolygon=function(d,e,f,c){if(f){core.setStrokeStyle(d,f)}if(c){core.setLineWidth(d,c)}var a=this.getContextByName(d);if(!a){return}if(!e||e.length<3){return}a.beginPath();for(var b=0;b<e.length;++b){var g=core.calValue(e[b][0]),h=core.calValue(e[b][1]);if(b==0){a.moveTo(g,h)}else{a.lineTo(g,h)}}a.closePath();a.stroke()};ui.prototype._uievent_strokePolygon=function(a){this._createUIEvent();this.strokePolygon("uievent",a.nodes,a.style,a.lineWidth)};ui.prototype.fillEllipse=function(g,i,j,c,e,d,h){if(h){core.setFillStyle(g,h)}var f=this.getContextByName(g);if(!f){return}f.beginPath();f.ellipse(i,j,c,e,d,0,2*Math.PI);f.fill()};ui.prototype.fillCircle=function(a,d,e,b,c){return this.fillEllipse(a,d,e,b,b,0,c)};ui.prototype._uievent_fillEllipse=function(a){this._createUIEvent();this.fillEllipse("uievent",core.calValue(a.x),core.calValue(a.y),core.calValue(a.a),core.calValue(a.b),(core.calValue(a.angle)||0)*Math.PI/180,a.style)};ui.prototype.strokeEllipse=function(h,j,k,c,e,d,i,g){if(i){core.setStrokeStyle(h,i)}if(g){core.setLineWidth(h,g)}var f=this.getContextByName(h);if(!f){return}f.beginPath();f.ellipse(j,k,c,e,d,0,2*Math.PI);f.stroke()};ui.prototype.strokeCircle=function(b,e,f,c,d,a){return this.strokeEllipse(b,e,f,c,c,0,d,a)};ui.prototype._uievent_strokeEllipse=function(a){this._createUIEvent();this.strokeEllipse("uievent",core.calValue(a.x),core.calValue(a.y),core.calValue(a.a),core.calValue(a.b),(core.calValue(a.angle)||0)*Math.PI/180,a.style,a.lineWidth)};ui.prototype.fillArc=function(c,g,h,d,e,b,f){if(f){core.setFillStyle(c,f)}var a=this.getContextByName(c);if(!a){return}a.beginPath();a.moveTo(g,h);a.arc(g,h,d,e,b);a.closePath();a.fill()};ui.prototype._uievent_fillArc=function(a){this._createUIEvent();this.fillArc("uievent",core.calValue(a.x),core.calValue(a.y),core.calValue(a.r),(core.calValue(a.start)||0)*Math.PI/180,(core.calValue(a.end)||0)*Math.PI/180,a.style)};ui.prototype.strokeArc=function(d,h,i,e,f,b,g,c){if(g){core.setStrokeStyle(d,g)}if(c){core.setLineWidth(d,c)}var a=this.getContextByName(d);if(!a){return}a.beginPath();a.arc(h,i,e,f,b);a.stroke()};ui.prototype._uievent_strokeArc=function(a){this._createUIEvent();this.strokeArc("uievent",core.calValue(a.x),core.calValue(a.y),core.calValue(a.r),(core.calValue(a.start)||0)*Math.PI/180,(core.calValue(a.end)||0)*Math.PI/180,a.style,a.lineWidth)};ui.prototype.drawLine=function(c,e,g,f,h,d,b){if(d){core.setStrokeStyle(c,d)}if(b!=null){core.setLineWidth(c,b)}var a=this.getContextByName(c);if(!a){return}a.beginPath();a.moveTo(e,g);a.lineTo(f,h);a.stroke()};ui.prototype._uievent_drawLine=function(a){this._createUIEvent();this.drawLine("uievent",core.calValue(a.x1),core.calValue(a.y1),core.calValue(a.x2),core.calValue(a.y2),a.style,a.lineWidth)};ui.prototype.drawArrow=function(g,i,k,j,l,h,f){if(i==j&&k==l){return}if(h){core.setStrokeStyle(g,h)}if(f!=null){core.setLineWidth(g,f)}var b=this.getContextByName(g);if(!b){return}var e=10;var c=j-i,d=l-k;var a=Math.atan2(d,c);b.beginPath();b.moveTo(i,k);b.lineTo(j,l);b.lineTo(j-e*Math.cos(a-Math.PI/6),l-e*Math.sin(a-Math.PI/6));b.moveTo(j,l);b.lineTo(j-e*Math.cos(a+Math.PI/6),l-e*Math.sin(a+Math.PI/6));b.stroke()};ui.prototype._uievent_drawArrow=function(a){this._createUIEvent();this.drawArrow("uievent",core.calValue(a.x1),core.calValue(a.y1),core.calValue(a.x2),core.calValue(a.y2),a.style,a.lineWidth)};ui.prototype.setFont=function(c,b){var a=this.getContextByName(c);if(a){a.font=b}};ui.prototype.setLineWidth=function(c,b){var a=this.getContextByName(c);if(a){a.lineWidth=b}};ui.prototype.saveCanvas=function(b){var a=this.getContextByName(b);if(a){a.save()}};ui.prototype.loadCanvas=function(b){var a=this.getContextByName(b);if(a){a.restore()}};ui.prototype.setAlpha=function(c,a){var b=this.getContextByName(c);if(!b){return null}var d=b.globalAlpha;b.globalAlpha=a;return d};ui.prototype.setOpacity=function(b,c){var a=this.getContextByName(b);if(a){a.canvas.style.opacity=c}};ui.prototype.setFilter=function(c,b){var a=this.getContextByName(c);if(!a){return}if(!b){a.filter="none"}else{if(typeof b==="string"){a.filter=b}else{var d=[];if(b.blur>0){d.push("blur("+b.blur+"px)")}if(b.hue>0){d.push("hue-rotate("+b.hue+"deg)")}if(b.grayscale>0){d.push("grayscale("+b.grayscale+")")}if(b.invert){d.push("invert(1)")}if(b.shadow>0){d.push("drop-shadow(0 0 "+b.shadow+"px black)")}if(d.length==0){a.filter="none"}else{a.filter=d.join(" ")}}}};ui.prototype.setFillStyle=function(b,c){var a=this.getContextByName(b);if(a){a.fillStyle=core.arrayToRGBA(c)}};ui.prototype.setStrokeStyle=function(b,c){var a=this.getContextByName(b);if(a){a.strokeStyle=core.arrayToRGBA(c)}};ui.prototype.setTextAlign=function(c,a){var b=this.getContextByName(c);if(b){b.textAlign=a}};ui.prototype.setTextBaseline=function(c,a){var b=this.getContextByName(c);if(b){b.textBaseline=a}};ui.prototype._uievent_setAttribute=function(a){this._createUIEvent();if(a.font){this.setFont("uievent",a.font)}if(a.lineWidth){this.setLineWidth("uievent",a.lineWidth)}if(a.alpha!=null){this.setAlpha("uievent",a.alpha)}if(a.fillStyle){this.setFillStyle("uievent",a.fillStyle)}if(a.strokeStyle){this.setStrokeStyle("uievent",a.strokeStyle)}if(a.align){this.setTextAlign("uievent",a.align)}if(a.baseline){this.setTextBaseline("uievent",a.baseline)}if(a.z!=null&&main.mode!="editor"){var b=parseInt(a.z)||135;core.dymCanvas.uievent.canvas.style.zIndex=b;if(core.dymCanvas._uievent_selector){core.dymCanvas._uievent_selector.canvas.style.zIndex=b+1}}};ui.prototype._uievent_setFilter=function(a){this._createUIEvent();this.setFilter("uievent",a)};ui.prototype.calWidth=function(c,d,b){var a=this.getContextByName(c);if(a){if(b){a.font=b}return a.measureText(d).width}return 0};ui.prototype.splitLines=function(g,h,f,c){var b=this.getContextByName(g);if(!b){return[h]}if(c){core.setFont(g,c)}var a=[];var e=0;for(var d=0;d<h.length;d++){if(h.charAt(d)=="\n"){a.push(h.substring(e,d));e=d+1}else{if(h.charAt(d)=="\\"&&h.charAt(d+1)=="n"){a.push(h.substring(e,d));e=d+2}else{var j=h.substring(e,d+1);var k=core.calWidth(g,j);if(f&&k>f){a.push(h.substring(e,d));e=d}}}}a.push(h.substring(e));return a};ui.prototype.drawImage=function(f,e,l,n,j,c,m,o,k,d,a,g){var b=this.getContextByName(f);if(!b){return}if(typeof e=="string"){if(e.endsWith(":x")||e.endsWith(":y")||e.endsWith(":o")){g=e.charAt(e.length-1);e=e.substring(0,e.length-2)}e=core.getMappedName(e);e=core.material.images.images[e];if(!e){return}}var i={x:[-1,1],y:[1,-1],o:[-1,-1]};if(l!=null&&n!=null){if(j==null||c==null){j=e.width;c=e.height}if(m!=null&&o!=null&&k!=null&&d!=null){if(!g&&!a){b.drawImage(e,l,n,j,c,m,o,k,d)}else{b.save();b.translate(m+k/2,o+d/2);if(g){b.scale(i[g][0],i[g][1])}if(a){b.rotate(a)}b.drawImage(e,l,n,j,c,-k/2,-d/2,k,d);b.restore()}return}if(!g&&!a){b.drawImage(e,l,n,j,c)}else{b.save();b.translate(l+j/2,n+c/2);if(g){b.scale(i[g][0],i[g][1])}if(a){b.rotate(a)}b.drawImage(e,-j/2,-c/2,j,c);b.restore()}return}};ui.prototype._uievent_drawImage=function(a){this._createUIEvent();this.drawImage("uievent",a.image+(a.reverse||""),core.calValue(a.x),core.calValue(a.y),core.calValue(a.w),core.calValue(a.h),core.calValue(a.x1),core.calValue(a.y1),core.calValue(a.w1),core.calValue(a.h1),(core.calValue(a.angle)||0)*Math.PI/180)};ui.prototype.drawIcon=function(f,d,i,j,g,c,b){b=b||0;var a=this.getContextByName(f);if(!a){return}var e=core.getBlockInfo(d);if(!e){if(core.statusBar.icons[d] instanceof Image){e={image:core.statusBar.icons[d],posX:0,posY:0,height:32}}else{return}}core.drawImage(a,e.image,32*(e.posX+b),e.height*e.posY,32,e.height,i,j,g||32,c||e.height)};ui.prototype._uievent_drawIcon=function(a){this._createUIEvent();var c;try{c=core.calValue(a.id);if(typeof c!=="string"){c=a.id}}catch(b){c=a.id}this.drawIcon("uievent",c,core.calValue(a.x),core.calValue(a.y),core.calValue(a.width),core.calValue(a.height),a.frame||0)};ui.prototype.closePanel=function(){if(core.status.hero&&core.status.hero.flags){Object.keys(core.status.hero.flags).forEach(function(a){if(a.startsWith("@temp@")||/^arg\d+$/.test(a)){delete core.status.hero.flags[a]}})}this.clearUI();core.maps.generateGroundPattern();core.updateStatusBar(true);core.unlockControl();core.status.event.data=null;core.status.event.id=null;core.status.event.selection=null;core.status.event.ui=null;core.status.event.interval=null;clearInterval(core.interval.onDownInterval);core.interval.onDownInterval="tmp"};ui.prototype.clearUI=function(){core.status.boxAnimateObjs=[];core.deleteCanvas("_selector");main.dom.next.style.display="none";main.dom.next.style.opacity=1;core.clearMap("ui");core.setAlpha("ui",1);core.setOpacity("ui",1);core.deleteCanvas("ui2")};ui.prototype.drawTip=function(f,b,a){f=core.replaceText(f)||"";var e=this._getRealContent(f);var d={text:f,textX:21,width:26+core.calWidth("data",e,"16px Arial"),opacity:0.1,stage:1,frame:a||0,time:0};if(b!=null){var c=core.getBlockInfo(b);if(c==null||!c.image||c.bigImage){if(core.statusBar.icons[b] instanceof Image){c={image:core.statusBar.icons[b],posX:0,posY:0,height:32}}else{c=null}}if(c!=null){d.image=c.image;d.posX=c.posX;d.posY=c.posY;d.height=c.height;d.textX+=24;d.width+=24}}core.animateFrame.tip=d};ui.prototype._drawTip_drawOne=function(a){core.setAlpha("data",a.opacity);core.fillRect("data",5,5,a.width,42,"#000000");if(a.image){core.drawImage("data",a.image,(a.posX+a.frame)*32,a.posY*a.height,32,32,10,10,32,32)}core.fillText("data",a.text,a.textX,33,"#FFFFFF");core.setAlpha("data",1)};ui.prototype.drawText=function(b,a){if(b!=null){return this._drawText_setContent(b,a)}if(core.status.event.data.list.length==0){var a=core.status.event.data.callback;core.ui.closePanel(false);if(a){a()}return}var c=core.status.event.data.list.shift();if(typeof c=="string"){c={text:c}}core.ui.drawTextBox(c.text,c)};ui.prototype._drawText_setContent=function(b,a){if((core.status.event&&core.status.event.id=="action")||(!core.hasFlag("__replayText__")&&core.isReplaying())){core.insertAction(b,null,null,a);return}if(!(b instanceof Array)){b=[b]}core.status.event={id:"text",data:{list:b,callback:a}};core.lockControl();core.waitHeroToStop(core.drawText);return};ui.prototype._getTitleAndIcon=function(c){var h=null,g=null,f=null,e=32,a=1;var b=null,d=null;c=c.replace(/(\t|\\t)\[(([^\],]+),)?([^\],]+)\]/g,function(j,k,l,m,n){if(n){if(n=="hero"){h=core.status.hero.name;g=core.material.images.hero;f=0;var o=core.material.icons.hero.width||32;e=32*core.material.icons.hero.height/o}else{if(n.endsWith(".png")){n=core.getMappedName(n);g=core.material.images.images[n]}else{var i=core.getBlockInfo(n);if(i!=null){if(i.name){h=i.name}b=i.bigImage;d=i.face;g=i.image;f=i.posY;e=b==null?i.height:32;a=i.animate}else{h=n}}}}if(m!=null){h=m;if(h=="null"){h=null}}return""});return{content:c,title:h,image:g,icon:f,height:e,animate:a,bigImage:b,face:d,}};ui.prototype._getPosition=function(a){var c=null,d=null,e=null,b=false;if(core.status.event.id=="action"){d=core.status.event.data.x;e=core.status.event.data.y}if(main.mode!="play"){d=editor.pos.x;e=editor.pos.y}a=a.replace("\b","\\b").replace(/\\b\[(up|center|down|hero|this)(,(hero|null|\d+,\d+|\d+))?]/g,function(g,h,i,j){c=h;if(j=="hero"||h=="hero"&&!j){d=core.getHeroLoc("x");e=core.getHeroLoc("y")}else{if(j=="null"){d=e=null}else{if(j){var k=j.split(",");d=e=null;if(k.length==1){var f=core.status.hero.followers[parseInt(k[0])-1];if(f){d=f.x;e=f.y}}else{d=parseInt(k[0]);e=parseInt(k[1]);b=core.getBlockId(d,e)==null}}}}if(c=="hero"||c=="this"){c=e==null?"center":(e>core.__HALF_SIZE__?"up":"down")}return""});return{content:a,position:c,px:d,py:e,noPeak:b}};ui.prototype._drawWindowSelector=function(a,e,f,d,c){d=Math.round(d),c=Math.round(c);var b=core.ui.createCanvas("_selector",e,f,d,c,165);this._drawSelector(b,a,d,c)};ui.prototype.drawUIEventSelector=function(c,a,g,i,f,e,j){var b="_uievent_selector_"+(c||0);var a=a||core.status.textAttribute.background;if(typeof a!="string"){return}if(main.mode=="editor"){this._drawSelector("uievent",a,f,e,g,i);return}j=j||(core.dymCanvas.uievent?(parseInt(core.dymCanvas.uievent.canvas.style.zIndex)||135)+1:136);var d=core.createCanvas(b,g,i,f,e,j);d.canvas.classList.add("_uievent_selector");this._drawSelector(d,a,f,e)};ui.prototype._uievent_drawSelector=function(a){if(a.image==null){this.clearUIEventSelector(a.code||0)}else{this.drawUIEventSelector(a.code,a.image,core.calValue(a.x),core.calValue(a.y),core.calValue(a.width),core.calValue(a.height))}};ui.prototype.clearUIEventSelector=function(a){if(a==null){core.deleteCanvas(function(b){return b.startsWith("_uievent_selector_")});return}if(a instanceof Array){a.forEach(function(b){core.ui.clearUIEventSelector(b)});return}core.deleteCanvas("_uievent_selector_"+(a||0))};ui.prototype._drawSelector=function(b,a,f,c,d,e){d=d||0;e=e||0;core.drawImage(b,a,130,66,28,28,d+2,e+2,f-4,c-4);core.drawImage(b,a,128,64,2,2,d,e,2,2);core.drawImage(b,a,158,64,2,2,d+f-2,e,2,2);core.drawImage(b,a,128,94,2,2,d,e+c-2,2,2);core.drawImage(b,a,158,94,2,2,d+f-2,e+c-2,2,2);core.drawImage(b,a,130,64,28,2,d+2,e,f-4,2);core.drawImage(b,a,130,94,28,2,d+2,e+c-2,f-4,2);core.drawImage(b,a,128,66,2,28,d,e+2,2,c-4);core.drawImage(b,a,158,66,2,28,d+f-2,e+2,2,c-4)};ui.prototype.drawWindowSkin=function(a,b,k,l,j,f,c,g,i){a=a||core.status.textAttribute.background;core.drawImage(b,a,0,0,128,128,k+2,l+2,j-4,f-4);core.drawImage(b,a,128,0,16,16,k,l,16,16);for(var d=0;d<j-64;d+=32){core.drawImage(b,a,144,0,32,16,k+d+16,l,32,16);core.drawImage(b,a,144,48,32,16,k+d+16,l+f-16,32,16)}core.drawImage(b,a,144,0,j-d-32,16,k+d+16,l,j-d-32,16);core.drawImage(b,a,144,48,j-d-32,16,k+d+16,l+f-16,j-d-32,16);core.drawImage(b,a,176,0,16,16,k+j-16,l,16,16);for(var e=0;e<f-64;e+=32){core.drawImage(b,a,128,16,16,32,k,l+e+16,16,32);core.drawImage(b,a,176,16,16,32,k+j-16,l+e+16,16,32)}core.drawImage(b,a,128,16,16,f-e-32,k,l+e+16,16,f-e-32);core.drawImage(b,a,176,16,16,f-e-32,k+j-16,l+e+16,16,f-e-32);core.drawImage(b,a,128,48,16,16,k,l+f-16,16,16);core.drawImage(b,a,176,48,16,16,k+j-16,l+f-16,16,16);if(g!=null&&i!=null){if(c=="up"){core.drawImage(b,a,128,96,32,32,g,l+f-3,32,32)}else{if(c=="down"){core.drawImage(b,a,160,96,32,32,g,l-29,32,32)}}}};ui.prototype.drawBackground=function(c,h,g,b,d){d=d||{};var e=d.px==null||d.noPeak?null:d.px*32-core.bigmap.offsetX;var f=d.py==null||d.noPeak?null:d.py*32-core.bigmap.offsetY;var i=d.xoffset||0,j=d.yoffset||0;var a=core.status.textAttribute.background;if(this._drawBackground_drawWindowSkin(a,c,h,g,b,d.position,e,f,d.ctx)){return true}if(typeof a=="string"){a=core.initStatus.textAttribute.background}this._drawBackground_drawColor(a,c,h,g,b,d.position,e,f,i,j,d.ctx);return false};ui.prototype._uievent_drawBackground=function(b){this._createUIEvent();var a=b.background||core.status.textAttribute.background;var e=core.calValue(b.x),f=core.calValue(b.y),d=core.calValue(b.width),c=core.calValue(b.height);if(typeof a=="string"){this.drawWindowSkin(a,"uievent",e,f,d,c)}else{if(a instanceof Array){this.fillRect("uievent",e,f,d,c,core.arrayToRGBA(a));this.strokeRect("uievent",e,f,d,c)}}};ui.prototype._drawWindowSkin_getOpacity=function(){return core.getFlag("__winskin_opacity__",0.85)};ui.prototype._drawBackground_drawWindowSkin=function(a,e,j,i,b,f,g,h,c){c=c||"ui";if(typeof a=="string"&&core.material.images.images[a]){var d=core.material.images.images[a];if(d.width==192&&d.height==128){core.setAlpha(c,this._drawWindowSkin_getOpacity());this.drawWindowSkin(d,c,e,j,i-e,b-j,f,g,h);core.setAlpha(c,1);return true}}return false};ui.prototype._drawBackground_drawColor=function(b,e,j,i,c,f,g,h,k,l,d){d=d||"ui";var a=b[3];core.setAlpha(d,a);core.setStrokeStyle(d,core.arrayToRGBA(core.status.globalAttribute.borderColor));core.setFillStyle(d,core.arrayToRGB(b));core.setLineWidth(d,2);d=core.getContextByName(d);d.beginPath();d.moveTo(e,j);if(f=="down"&&g!=null&&h!=null){d.lineTo(g+k,j);d.lineTo(g+16,j-l);d.lineTo(g+32-k,j)}d.lineTo(i,j);d.lineTo(i,c);if(f=="up"&&g!=null&&h!=null){d.lineTo(g+32-k,c);d.lineTo(g+16,c+l);d.lineTo(g+k,c)}d.lineTo(e,c);d.closePath();d.fill();d.stroke();core.setAlpha(d,1)};ui.prototype._calTextBoxWidth=function(c,b,f,e,d){var a=core.splitLines(c,b,null,d);if(a.length==1){var g=core.calWidth(c,a[0])+10;if(g<f*2.3){return core.clamp(g/1.4,f,e)}if(g<e*2.2){return core.clamp(g/2.4,f,e)}return core.clamp(g/3.4,f,e)}else{return core.clamp(a.reduce(function(i,h){return Math.max(i,core.calWidth(c,h)+10)},0),f,e)}};ui.prototype._getDrawableIconInfo=function(b){if(b&&b.indexOf("flag:")===0){b=core.getFlag(b.substring(5),b)}b=core.getIdOfThis(b);var c=null,a=null;["terrains","animates","items","npcs","enemys"].forEach(function(d){if(core.material.icons[d][b]!=null){c=core.material.images[d];a=core.material.icons[d][b]}});if(c==null&&b in core.statusBar.icons){c=core.statusBar.icons[b];a=0}return[c,a]};ui.prototype._buildFont=function(c,a,e,b){var f=core.status.textAttribute||core.initStatus.textAttribute,d=core.status.globalAttribute||core.initStatus.globalAttribute;if(a==null){a=f.bold}return(a?"bold ":"")+(e?"italic ":"")+(c||f.textfont)+"px "+(b||d.font)};ui.prototype.drawTextContent=function(c,b,a){c=core.getContextByName(c);var f=core.status.textAttribute||core.initStatus.textAttribute;var d=core.status.globalAttribute||core.initStatus.globalAttribute;a=core.clone(a||{});a.left=a.left||0;a.right=a.left+(a.maxWidth==null?core.__PIXELS__:a.maxWidth);a.top=a.top||0;a.color=core.arrayToRGBA(a.color||f.text);if(a.bold==null){a.bold=f.bold}a.italic=false;a.align=a.align||f.align||"left";a.fontSize=a.fontSize||f.textfont;a.lineHeight=a.lineHeight||(a.fontSize*1.3);a.defaultFont=a.font=a.font||d.font;a.time=a.time||0;a.letterSpacing=a.letterSpacing==null?(f.letterSpacing||0):a.letterSpacing;a.index=0;a.currcolor=a.color;a.currfont=a.fontSize;a.lineMargin=Math.max(Math.round(a.fontSize/4),a.lineHeight-a.fontSize);a.topMargin=parseInt(a.lineMargin/2);a.lineMaxHeight=a.lineMargin+a.fontSize;a.offsetX=0;a.offsetY=0;a.line=0;a.blocks=[];a.isHD=c!=null&&c.canvas.hasAttribute("isHD");var e=document.createElement("canvas").getContext("2d");if(a.isHD){core.maps._setHDCanvasSize(e,c.canvas.width,c.canvas.height)}else{e.canvas.width=c==null?1:c.canvas.width;e.canvas.height=c==null?1:c.canvas.height}e.textBaseline="top";e.font=this._buildFont(a.fontSize,a.bold,a.italic,a.font);e.fillStyle=a.color;a=this._drawTextContent_draw(c,e,b,a);return a};ui.prototype._uievent_drawTextContent=function(a){this._createUIEvent();a.left=core.calValue(a.left);a.top=core.calValue(a.top);this.drawTextContent("uievent",core.replaceText(a.text),a)};ui.prototype._drawTextContent_draw=function(d,e,c,b){while(this._drawTextContent_next(e,c,b)){}if(d==null){return b}b.index=0;var a=function(){if(b.index>=b.blocks.length){return false}var f=b.blocks[b.index++];if(f!=null){var g=b.isHD?core.domStyle.ratio:1;core.drawImage(d,e.canvas,f.left*g,f.top*g,f.width*g,f.height*g,b.left+f.left+f.marginLeft,b.top+f.top+f.marginTop,f.width,f.height)}return true};if(b.time==0){while(a()){}}else{core.status.event.interval=setInterval(function(){if(!a()){clearInterval(core.status.event.interval);core.status.event.interval=null}},b.time)}return b};ui.prototype._drawTextContent_next=function(e,d,c){if(c.index>=d.length){this._drawTextContent_newLine(e,c);return false}var a=d.charAt(c.index);var b=d.charCodeAt(c.index++);while(b>=55296&&b<=56319){a+=d.charAt(c.index);b=d.charCodeAt(c.index++)}return this._drawTextContent_drawChar(e,d,c,a)};ui.prototype._drawTextContent_drawChar=function(l,f,e,b){var h="))】》>﹞>)]??〕〉}]」}〗』,。?!:;·…,.?!:;、……~&@#~&@#";var g="((【《<﹝<([??〔〈{[「{〖『";if(b=="\n"||(b=="\\"&&f.charAt(e.index)=="n")){this._drawTextContent_newLine(l,e);if(b=="\\"){e.index++}return this._drawTextContent_next(l,f,e)}if(b=="\r"||(b=="\\"&&f.charAt(e.index)=="r")){if(b=="\\"){e.index++}return this._drawTextContent_changeColor(l,f,e)}if(b=="\\"){var a=f.charAt(e.index);if(a=="i"){return this._drawTextContent_drawIcon(l,f,e)}if(a=="c"){return this._drawTextContent_changeFontSize(l,f,e)}if(a=="d"||a=="e"){e.index++;if(a=="d"){e.bold=!e.bold}if(a=="e"){e.italic=!e.italic}l.font=this._buildFont(e.currfont,e.bold,e.italic,e.font);return true}if(a=="g"){return this._drawTextContent_changeFont(l,f,e)}if(a=="z"){return this._drawTextContent_emptyChar(l,f,e)}}var d=core.calWidth(l,b)+e.letterSpacing;if(e.maxWidth!=null){if(e.offsetX+d>e.maxWidth){if(!e.forceChangeLine&&h.indexOf(b)>=0){e.forceChangeLine=true}else{this._drawTextContent_newLine(l,e);e.index-=b.length;return this._drawTextContent_next(l,f,e)}}else{if(g.indexOf(b)>=0&&e.index<f.length){var j=f.charAt(e.index);if(j!="\n"&&!(j=="\\"&&f.charAt(e.index+1)=="n")){var k=core.calWidth(l,j)+e.letterSpacing;if(e.offsetX+d+k>e.maxWidth){this._drawTextContent_newLine(l,e);e.index-=b.length;return this._drawTextContent_next(l,f,e)}}}}}var i=e.offsetX,m=e.offsetY+e.topMargin;core.fillText(l,b,i,m);e.blocks.push({left:e.offsetX,top:e.offsetY,width:d,height:e.currfont+e.lineMargin,line:e.line,marginLeft:0});e.offsetX+=d;return true};ui.prototype._drawTextContent_newLine=function(c,a){var e=a.offsetX,d=a.right-a.left;var b=0;if(a.align=="center"){b=(d-e)/2}else{if(a.align=="right"){b=d-e}}a.blocks.forEach(function(f){if(f==null){return}if(f.line==a.line){f.marginLeft=b;f.marginTop=(a.lineMaxHeight-f.height)/2}});a.offsetX=0;a.offsetY+=a.lineMaxHeight;a.lineMaxHeight=a.currfont+a.lineMargin;a.line++;a.forceChangeLine=false};ui.prototype._drawTextContent_changeColor=function(f,b,a){var c=a.index,d;if(b.charAt(c)=="["&&((d=b.indexOf("]",c))>=0)){var e=b.substring(c+1,d);if(e==""){f.fillStyle=a.color}else{f.fillStyle=e}a.index=d+1}else{f.fillStyle=a.color}return this._drawTextContent_next(f,b,a)};ui.prototype._drawTextContent_changeFontSize=function(f,b,a){a.index++;var c=a.index,d;if(b.charAt(c)=="["&&((d=b.indexOf("]",c))>=0)){var e=b.substring(c+1,d);if(!/^\d+$/.test(e)){a.currfont=a.fontSize}else{a.currfont=parseInt(e)}a.index=d+1}else{a.currfont=a.fontSize}a.lineMaxHeight=Math.max(a.lineMaxHeight,a.currfont+a.lineMargin);f.font=this._buildFont(a.currfont,a.bold,a.italic,a.font);return this._drawTextContent_next(f,b,a)};ui.prototype._drawTextContent_changeFont=function(f,b,a){a.index++;var c=a.index,d;if(b.charAt(c)=="["&&((d=b.indexOf("]",c))>=0)){var e=b.substring(c+1,d);if(e==""){a.font=a.defaultFont}else{a.font=e}a.index=d+1}else{a.font=a.defaultFont}f.font=this._buildFont(a.currfont,a.bold,a.italic,a.font);return this._drawTextContent_next(f,b,a)};ui.prototype._drawTextContent_emptyChar=function(g,b,a){a.index++;var d=a.index,e;if(b.charAt(d)=="["&&((e=b.indexOf("]",d))>=0)){var f=b.substring(d+1,e);if(/^\d+$/.test(f)){var h=parseInt(f);for(var c=0;c<h;++c){a.blocks.push(null)}}else{a.blocks.push(null)}a.index=e+1}else{a.blocks.push(null)}return this._drawTextContent_next(g,b,a)};ui.prototype._drawTextContent_drawIcon=function(j,b,a){var f=a.index,g;if(b.charAt(a.index+1)=="["&&((g=b.indexOf("]",f+1))>=0)){var i=b.substring(f+2,g);var d=core.ui._getDrawableIconInfo(i),e=d[0],c=d[1];if(e==null){return this._drawTextContent_next(j,b,a)}var l=a.currfont+2,h=a.offsetX+2,k=a.offsetY+a.topMargin-1;if(a.maxWidth!=null&&h+l>a.maxWidth){this._drawTextContent_newLine(j,a);a.index--;return this._drawTextContent_next(j,b,a)}core.drawImage(j,e,0,32*c,32,32,h,k,l,l);a.blocks.push({left:h,top:a.offsetY,width:l,height:l+a.lineMargin,line:a.line,marginLeft:0});a.offsetX+=l+6;a.index=g+1;return true}return this._drawTextContent_next(j,b,a)};ui.prototype.getTextContentHeight=function(b,a){return this.drawTextContent(null,b,a).offsetY};ui.prototype._getRealContent=function(a){return a.replace(/(\r|\\(r|c|d|e|g|z))(\[.*?])?/g,"").replace(/(\\i)(\[.*?])?/g,"占1")};ui.prototype._animateUI=function(e,b,a){b=b||"ui";var d=core.status.textAttribute.animateTime||0;if(!core.status.event||!d||core.isReplaying()||(e!="show"&&e!="hide")){if(a){a()}return}clearInterval(core.status.event.animateUI);var c=0;if(e=="show"){c=0}else{if(e=="hide"){c=1}}core.setOpacity(b,c);core.dom.next.style.opacity=c;core.status.event.animateUI=setInterval(function(){if(e=="show"){c+=0.05}else{c-=0.05}core.setOpacity(b,c);core.dom.next.style.opacity=c;if(c>=1||c<=0){clearInterval(core.status.event.animateUI);delete core.status.event.animateUI;if(a){a()}}},d/20)};ui.prototype.drawTextBox=function(c,b){b=b||{};this.clearUI();c=core.replaceText(c);var e=b.ctx||null;if(e&&main.mode=="play"){core.createCanvas(e,0,0,core.__PIXELS__,core.__PIXELS__,141);e=core.getContextByName(e)}var j=core.status.textAttribute;var k=this._getTitleAndIcon(c);var i=this._getPosition(k.content);if(i.position!="up"&&i.position!="down"){i.px=i.py=null}if(!i.position){i.position=j.position}c=this._drawTextBox_drawImages(i.content,b.ctx);if(b.pos){delete i.px;delete i.py;i.pos=b.pos}i.ctx=e;var f=this._drawTextBox_getHorizontalPosition(c,k,i);var l=this._drawTextBox_getVerticalPosition(c,k,i,f.validWidth);i.xoffset=f.xoffset;i.yoffset=l.yoffset-4;if(e&&main.mode=="play"){e.canvas.setAttribute("_text_left",f.left);e.canvas.setAttribute("_text_top",l.top)}var g=this.drawBackground(f.left,l.top,f.right,l.bottom,i);var a=g?this._drawWindowSkin_getOpacity():j.background[3];var d=this._drawTextBox_drawTitleAndIcon(k,f,l,a,b.ctx);var b=this.drawTextContent(b.ctx||"ui",c,{left:f.content_left,top:d,maxWidth:f.validWidth,lineHeight:l.lineHeight,time:(b.showAll||b.async||j.time<=0||core.status.event.id!="action")?0:j.time});if(main.mode=="play"){main.dom.next.style.display="block";main.dom.next.style.borderRightColor=main.dom.next.style.borderBottomColor=core.arrayToRGB(j.text);main.dom.next.style.top=(l.bottom-20)*core.domStyle.scale+"px";var h=(f.left+f.right)/2;if(i.position=="up"&&!i.noPeak&&i.px!=null&&Math.abs(i.px*32+16-h)<50){h=f.right-64}main.dom.next.style.left=h*core.domStyle.scale+"px"}return b};ui.prototype._drawTextBox_drawImages=function(a,b){b=b||"ui";return a.replace(/(\f|\\f)\[(.*?)]/g,function(g,f,e){var d=e.split(",");if(d.length==3){core.drawImage(b,d[0],parseFloat(d[1]),parseFloat(d[2]))}else{if(d.length==5){core.drawImage(b,d[0],parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3]),parseFloat(d[4]))}else{if(d.length>=9){if(d.length>=10){core.setAlpha(b,parseFloat(d[9]))}var c=(parseFloat(d[10])||0)*Math.PI/180;core.drawImage(b,d[0],parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3]),parseFloat(d[4]),parseFloat(d[5]),parseFloat(d[6]),parseFloat(d[7]),parseFloat(d[8]),c);core.setAlpha(b,1)}}}return""})};ui.prototype._drawTextBox_getHorizontalPosition=function(a,k,h){var b=h.ctx||"ui";var i=this._getRealContent(a);var f=25,g=12;if((h.px!=null&&h.py!=null)||h.pos){f=20}if(k.icon!=null){f=62}else{if(k.image){f=90}}var c=7+3*(this.HSIZE-6),j=this.PIXEL-c,m=j-c,l=m-f-g;if((h.px!=null&&h.py!=null)||h.pos){var e=220-f,d=l;if(k.image==null){e=160}if(k.title){e=core.clamp(core.calWidth(b,k.title,this._buildFont(core.status.textAttribute.titlefont,true)),e,d)}if(h.pos){c=core.calValue(h.pos[0])||0;d=Math.max(e,j-c-f-g)}else{c=null}if(h.pos&&h.pos[2]!=null){m=core.calValue(h.pos[2])||0;e=l=m-f-g}else{l=0}if(l<e){l=this._calTextBoxWidth("ui",i,e,d,this._buildFont());m=l+f+g}if(c==null){c=core.clamp(32*h.px+16-m/2-core.bigmap.offsetX,c,j-m)}j=c+m}return{left:c,right:j,width:m,validWidth:l,xoffset:11,content_left:c+f}};ui.prototype._drawTextBox_getVerticalPosition=function(a,f,d,h){var e=core.status.textAttribute||core.initStatus.textAttribute;var c=e.lineHeight||(e.textfont+6);var b=45+this.getTextContentHeight(a,{lineHeight:c,maxWidth:h});if(f.title){b+=e.titlefont+5}if(f.icon!=null){if(f.title){b=Math.max(b,f.height+50)}else{b=Math.max(b,f.height+30)}}else{if(f.image){b=Math.max(b,90)}}var i=16;var g=parseInt((this.PIXEL-b)/2);switch(d.position){case"center":g=parseInt((this.PIXEL-b)/2);break;case"up":if(d.px==null||d.py==null){g=5+e.offset}else{g=32*d.py-b-(f.height-32)-i-core.bigmap.offsetY}break;case"down":if(d.px==null||d.py==null){g=this.PIXEL-b-5-e.offset}else{g=32*d.py+32+i-core.bigmap.offsetY}}if(d.pos){g=core.calValue(d.pos[1])||0}return{top:g,height:b,bottom:g+b,yoffset:i,lineHeight:c}};ui.prototype._drawTextBox_drawTitleAndIcon=function(k,e,l,a,c){c=c||"ui";core.setTextAlign(c,"left");var g=core.status.textAttribute;var b=l.top+15;var f=l.top+15;if(k.title!=null){var j=g.titlefont;b+=j+5;f=l.top+40;core.setFillStyle(c,core.arrayToRGB(g.title));core.setStrokeStyle(c,core.arrayToRGB(g.title));var i=core.calWidth(c,k.title,this._buildFont(j,true));var h=e.content_left;if(g.align=="center"){h=e.left+(e.width-i)/2}else{if(g.align=="right"){h=e.right-i-12}}core.fillText(c,k.title,h,l.top+8+j)}if(k.icon!=null){core.setAlpha(c,a);core.strokeRect(c,e.left+15-1,f-1,34,k.height+2,null,2);core.setAlpha(c,1);core.status.boxAnimateObjs=[];if(k.image==core.material.images.hero){if(core.status.hero.animate){var d=core.getHeroLoc("direction");if(d=="up"){d="down"}core.status.boxAnimateObjs.push({bgx:e.left+15,bgy:f,bgWidth:32,bgHeight:k.height,x:e.left+15,y:f,height:k.height,animate:4,image:k.image,pos:core.material.icons.hero[d].loc*k.height,ctx:c,})}else{core.clearMap(c,e.left+15,f,32,k.height);core.fillRect(c,e.left+15,f,32,k.height,core.material.groundPattern);core.drawImage(c,k.image,0,0,core.material.icons.hero.width||32,core.material.icons.hero.height,e.left+15,f,32,k.height)}}else{if(k.bigImage){core.status.boxAnimateObjs.push({bigImage:k.bigImage,face:k.face,centerX:e.left+15+16,centerY:f+k.height/2,max_width:50,ctx:c})}else{core.status.boxAnimateObjs.push({bgx:e.left+15,bgy:f,bgWidth:32,bgHeight:k.height,x:e.left+15,y:f,height:k.height,animate:k.animate,image:k.image,pos:k.icon*k.height,ctx:c,})}}core.drawBoxAnimate()}if(k.image!=null&&k.icon==null){core.drawImage(c,k.image,0,0,k.image.width,k.image.height,e.left+10,l.top+10,70,70)}return b};ui.prototype._createTextCanvas=function(a,d){var e=this.PIXEL,c=30+this.getTextContentHeight(a,{lineHeight:d});var b=document.createElement("canvas").getContext("2d");b.canvas.width=e;b.canvas.height=c;b.clearRect(0,0,e,c);return b};ui.prototype.drawScrollText=function(b,g,d,a){b=core.replaceText(b||"");d=d||1.4;g=g||5000;this.clearUI();var f=core.status.textAttribute.offset||15;d*=core.status.textAttribute.textfont;var c=this._createTextCanvas(b,d);var e={align:core.status.textAttribute.align,lineHeight:d};if(e.align=="right"){e.left=this.PIXEL-f}else{if(e.align!="center"){e.left=f}}this.drawTextContent(c,b,e);this._drawScrollText_animate(c,g,a)};ui.prototype._drawScrollText_animate=function(c,h,b){h/=Math.max(core.status.replay.speed,1);var f=1,e=c.canvas.height,g=h*f/(this.PIXEL+e);var d=this.PIXEL;core.drawImage("ui",c.canvas,0,d);var a=setInterval(function(){core.clearMap("ui");d-=f;if(d<-e){delete core.animateFrame.asyncId[a];clearInterval(a);if(b){b()}return}core.drawImage("ui",c.canvas,0,d)},g);core.animateFrame.lastAsyncId=a;core.animateFrame.asyncId[a]=b};ui.prototype.textImage=function(a,c){a=core.replaceText(a||"");c=c||1.4;c*=core.status.textAttribute.textfont;var b=this._createTextCanvas(a,c);this.drawTextContent(b,a,{align:core.status.textAttribute.align,lineHeight:c});return b.canvas};ui.prototype.drawChoices=function(b,a,h,c){a=core.clone(a||[]);core.status.event.ui={text:b,choices:a,width:h};this.clearUI();b=core.replaceText(b||"");var f=this._getTitleAndIcon(b);f.content=this._drawTextBox_drawImages(f.content,c);var d=this._drawChoices_getHorizontalPosition(f,a,h,c);var g=this._drawChoices_getVerticalPosition(f,a,d);core.status.event.ui.offset=g.offset;var e=this.drawBackground(d.left,g.top,d.right,g.bottom,{ctx:c});this._drawChoices_drawTitle(f,d,g,c);this._drawChoices_drawChoices(a,e,d,g,c)};ui.prototype._drawChoices_getHorizontalPosition=function(g,a,j,c){c=c||"ui";core.setFont(c,this._buildFont(17,true));var j=this._calTextBoxWidth(c,g.content||"",j||246,this.PIXEL-20);for(var d=0;d<a.length;d++){if(typeof a[d]==="string"){a[d]={text:a[d]}}a[d].text=core.replaceText(a[d].text);a[d].width=core.calWidth(c,core.replaceText(a[d].text));if(a[d].icon!=null){a[d].width+=28}j=Math.max(j,a[d].width+30)}var e=(this.PIXEL-j)/2,f=e+j;var b=e+(g.icon==null?15:60),h=f-b-10;return{left:e,right:f,width:j,content_left:b,validWidth:h}};ui.prototype._drawChoices_getVerticalPosition=function(i,c,f){var g=c.length;var e=32*(g+2),a=this.HPIXEL+e/2;if(g%2==0){a+=16}var h=0;var b=a-e+56;if(i.content){var d=0;if(i.title){d+=25}d+=this.getTextContentHeight(i.content,{lineHeight:20,maxWidth:f.validWidth,fontSize:15,bold:true});e+=d;if(a-e<=32){h=Math.floor(d/64);a+=32*h;b+=32*h}}return{top:a-e,height:e,bottom:a,choice_top:b,offset:h}};ui.prototype._drawChoices_drawTitle=function(e,c,f,b){if(!e.content){return}b=b||"ui";var a=f.top+21;if(e.title!=null){core.setTextAlign(b,"center");a=f.top+41;var d=c.left+c.width/2;if(e.icon!=null){d+=12;core.strokeRect(b,c.left+15-1,f.top+30-1,34,e.height+2,"#DDDDDD",2);core.status.boxAnimateObjs=[];if(e.bigImage){core.status.boxAnimateObjs.push({bigImage:e.bigImage,face:e.face,centerX:c.left+15+16,centerY:f.top+30+e.height/2,max_width:50,ctx:b})}else{core.status.boxAnimateObjs.push({bgx:c.left+15,bgy:f.top+30,bgWidth:32,bgHeight:e.height,x:c.left+15,y:f.top+30,height:e.height,animate:e.animate,image:e.image,pos:e.icon*e.height,ctx:b})}core.drawBoxAnimate()}core.fillText(b,e.title,d,f.top+27,core.arrayToRGBA(core.status.textAttribute.title),this._buildFont(19,true))}core.setTextAlign(b,"left");this.drawTextContent(b,e.content,{left:c.content_left,top:a,maxWidth:c.validWidth,fontSize:15,lineHeight:20,bold:true})};ui.prototype._drawChoices_drawChoices=function(a,k,e,n,c){var d=c!=null;c=c||"ui";core.setTextAlign(c,"center");core.setFont(c,this._buildFont(17,true));for(var f=0;f<a.length;f++){var b=core.arrayToRGBA(a[f].color||core.status.textAttribute.text);if(main.mode=="play"&&a[f].need!=null&&a[f].need!=""&&!core.calValue(a[f].need)){b="#999999"}core.setFillStyle(c,b);var m=this.HPIXEL;if(a[f].icon){var h=this._getDrawableIconInfo(a[f].icon),j=h[0],g=h[1];if(j!=null){core.drawImage(c,j,0,32*g,32,32,this.HPIXEL-a[f].width/2,n.choice_top+32*f-17,22,22);m+=14}}core.fillText(c,a[f].text,m,n.choice_top+32*f,b)}if(a.length>0&&core.status.event.selection!="none"){core.status.event.selection=core.status.event.selection||0;while(core.status.event.selection<0){core.status.event.selection+=a.length}while(core.status.event.selection>=a.length){core.status.event.selection-=a.length}var l=a[core.status.event.selection].width;if(k){if(d){this._drawSelector(c,core.status.textAttribute.background,l+10,28,this.HPIXEL-l/2-5,n.choice_top+32*core.status.event.selection-20)}else{this._drawWindowSelector(core.status.textAttribute.background,this.HPIXEL-l/2-5,n.choice_top+32*core.status.event.selection-20,l+10,28)}}else{core.strokeRoundRect(c,this.HPIXEL-l/2-5,n.choice_top+32*core.status.event.selection-20,l+10,28,6,core.status.globalAttribute.selectColor,2)}}};ui.prototype.drawConfirmBox=function(k,l,g,b){var c=b!=null;b=b||"ui";k=core.replaceText(k||"");if(main.mode=="play"){core.lockControl();if(core.status.event.id!="action"){core.status.event.id="confirmBox";core.status.event.ui=k;core.status.event.data={yes:l,no:g}}}if(core.status.event.selection!=0&&core.status.event.selection!="none"){core.status.event.selection=1}this.clearUI();core.setFont(b,this._buildFont(19,true));var a=k.split("\n");var h=this._drawConfirmBox_getRect(a,b);var e=this.drawBackground(h.left,h.top,h.right,h.bottom,{ctx:b});core.setTextAlign(b,"center");core.setFillStyle(b,core.arrayToRGBA(core.status.textAttribute.text));for(var d in a){core.fillText(b,a[d],this.HPIXEL,h.top+50+d*30)}core.fillText(b,"确定",this.HPIXEL-38,h.bottom-35,null,this._buildFont(17,true));core.fillText(b,"取消",this.HPIXEL+38,h.bottom-35);if(core.status.event.selection!="none"){var f=core.calWidth(b,"确定");var j=this.HPIXEL+(76*core.status.event.selection-38)-parseInt(f/2)-5;if(e){if(c){this._drawSelector(b,core.status.textAttribute.background,f+10,28,j,h.bottom-35-20)}else{this._drawWindowSelector(core.status.textAttribute.background,j,h.bottom-35-20,f+10,28)}}else{core.strokeRoundRect(b,j,h.bottom-35-20,f+10,28,6,core.status.globalAttribute.selectColor,2)}}};ui.prototype._drawConfirmBox_getRect=function(b,c){var e=b.reduce(function(i,h){return Math.max(i,core.calWidth(c,h))},0);var d=Math.min(this.HPIXEL-40-parseInt(e/2),100),f=this.PIXEL-d;var g=this.HPIXEL-68-(b.length-1)*30,a=this.HPIXEL+68;return{top:g,left:d,bottom:a,right:f,width:f-d,height:a-g}};ui.prototype.drawWaiting=function(e){core.lockControl();core.status.event.id="waiting";core.clearUI();e=core.replaceText(e||"");var f=core.calWidth("ui",e,this._buildFont(19,true));var h=Math.max(f+80,220),c=this.HPIXEL-parseInt(h/2),d=c+h;var g=this.HPIXEL-48,b=96,a=g+b;this.drawBackground(c,g,d,a);core.setTextAlign("ui","center");core.fillText("ui",e,this.HPIXEL,g+56,core.arrayToRGBA(core.status.textAttribute.text))};ui.prototype._drawSwitchs=function(){core.status.event.id="switchs";var a=["音效设置","显示设置","操作设置","返回主菜单"];this.drawChoices(null,a)};ui.prototype._drawSwitchs_sounds=function(){core.status.event.id="switchs-sounds";var a=["音乐: "+(core.musicStatus.bgmStatus?"[ON]":"[OFF]"),"音效: "+(core.musicStatus.soundStatus?"[ON]":"[OFF]")," <     音量:"+Math.round(Math.sqrt(100*core.musicStatus.userVolume))+"     > ","返回上一级"];this.drawChoices(null,a)};ui.prototype._drawSwitchs_display=function(){core.status.event.id="switchs-display";var a=[" <   放缩:"+Math.max(core.domStyle.scale,1)+"x   > ","高清画面: "+(core.flags.enableHDCanvas?"[ON]":"[OFF]"),"定点怪显: "+(core.flags.enableEnemyPoint?"[ON]":"[OFF]"),"怪物显伤: "+(core.flags.displayEnemyDamage?"[ON]":"[OFF]"),"临界显伤: "+(core.flags.displayCritical?"[ON]":"[OFF]"),"领域显伤: "+(core.flags.displayExtraDamage?"[ON]":"[OFF]"),"领域模式: "+(core.flags.extraDamageType==2?"[最简]":core.flags.extraDamageType==1?"[半透明]":"[完整]"),"返回上一级",];this.drawChoices(null,a)};ui.prototype._drawSwitchs_action=function(){core.status.event.id="switchs-action";var a=[" <   步时:"+core.values.moveSpeed+"   > "," <   转场:"+core.values.floorChangeTime+"   > ","血瓶绕路: "+(core.hasFlag("__potionNoRouting__")?"[ON]":"[OFF]"),"单击瞬移: "+(!core.hasFlag("__noClickMove__")?"[ON]":"[OFF]"),"左手模式: "+(core.flags.leftHandPrefer?"[ON]":"[OFF]"),"返回上一级",];this.drawChoices(null,a)};ui.prototype._drawSettings=function(){core.status.event.id="settings";this.drawChoices(null,["系统设置","虚拟键盘","浏览地图","存档笔记","同步存档","游戏信息","返回标题","返回游戏"])};ui.prototype._drawNotes=function(){core.status.event.id="notes";core.status.hero.notes=core.status.hero.notes||[];core.lockControl();this.drawChoices("存档笔记允许你写入和查看任何笔记(快捷键M),你可以用做任何标记,比如Boss前的属性、开门和路线选择等。",["新增存档笔记","查看存档笔记","编辑存档笔记","删除存档笔记","返回上一页"])};ui.prototype._drawQuickShop=function(){core.status.event.id="selectShop";var c=core.status.shops,b=core.listShopIds();var a=b.map(function(d){return{text:c[d].textInList,color:core.isShopVisited(d)?null:"#999999"}});a.push("返回游戏");this.drawChoices(null,a)};ui.prototype._drawSyncSave=function(){core.status.event.id="syncSave";this.drawChoices(null,["同步存档到服务器","从服务器加载存档","存档至本地文件","从本地文件读档","回放和下载录像","清空本地存档","返回主菜单"])};ui.prototype._drawSyncSelect=function(){core.status.event.id="syncSelect";this.drawChoices(null,["同步本地所有存档","只同步当前单存档","返回上级菜单"])};ui.prototype._drawLocalSaveSelect=function(){core.status.event.id="localSaveSelect";this.drawChoices(null,["下载所有存档","只下载当前单存档","返回上级菜单"])};ui.prototype._drawStorageRemove=function(){core.status.event.id="storageRemove";this.drawChoices(null,["清空全部塔的存档","只清空当前塔的存档","返回上级菜单"])};ui.prototype._drawReplay=function(){core.lockControl();core.status.event.id="replay";core.playSound("打开界面");this.drawChoices(null,["从头回放录像","从存档开始回放","接续播放剩余录像","播放存档剩余录像","选择录像文件","下载当前录像","返回游戏"])};ui.prototype._drawGameInfo=function(){core.status.event.id="gameInfo";this.drawChoices(null,["数据统计","查看工程","游戏主页","操作帮助","关于游戏","下载离线版本","返回主菜单"])};ui.prototype.drawPagination=function(b,c,d){if(c<=1){return}if(d==null){d=this.LAST}core.setFillStyle("ui","#DDDDDD");var a=core.calWidth("ui",b+" / "+b,this._buildFont(15,true));core.setTextAlign("ui","left");core.fillText("ui",b+" / "+c,parseInt((this.PIXEL-a)/2),d*32+19);core.setTextAlign("ui","center");if(b>1){core.fillText("ui","上一页",this.HPIXEL-80,d*32+19)}if(b<c){core.fillText("ui","下一页",this.HPIXEL+80,d*32+19)}};ui.prototype._drawCursor=function(){var a=core.status.automaticRoute;if(a.cursorX==null){a.cursorX=core.getHeroLoc("x")}if(a.cursorY==null){a.cursorY=core.getHeroLoc("y")}a.cursorX=core.clamp(a.cursorX,0,this.LAST);a.cursorY=core.clamp(a.cursorY,0,this.LAST);core.status.event.id="cursor";core.lockControl();core.clearUI();var b=4;core.strokeRect("ui",32*a.cursorX+b/2,32*a.cursorY+b/2,32-b,32-b,core.status.globalAttribute.selectColor,b)};ui.prototype.drawBook=function(d){var b=core.floorIds[(core.status.event.ui||{}).index]||core.status.floorId;if(b!=core.status.floorId&&core.status.checkBlock){core.status.checkBlock.cache={}}var a=core.enemys.getCurrentEnemys(b);core.clearUI();core.clearMap("data");core.maps.generateGroundPattern(b);this._drawBook_drawBackground();core.setAlpha("ui",1);if(a.length==0){return this._drawBook_drawEmpty()}d=core.clamp(d,0,a.length-1);core.status.event.data=d;var f=this._drawBook_pageinfo();var g=f.per_page,e=parseInt(d/g)+1,j=Math.ceil(a.length/g);var h=(e-1)*g;a=a.slice(h,e*g);for(var c=0;c<a.length;c++){this._drawBook_drawOne(b,c,a[c],f,d==h+c)}core.drawBoxAnimate();this.drawPagination(e,j);core.setTextAlign("ui","center");core.fillText("ui","返回游戏",this.PIXEL-46,this.PIXEL-13,"#DDDDDD",this._buildFont(15,true))};ui.prototype._drawBook_pageinfo=function(){var c=this.HSIZE;var a=12;var b=(this.PIXEL-32-a)/c;return{per_page:c,padding_top:a,per_height:b}};ui.prototype._drawBook_drawBackground=function(){core.setAlpha("ui",1);core.setFillStyle("ui",core.material.groundPattern);core.fillRect("ui",0,0,this.PIXEL,this.PIXEL);core.setAlpha("ui",0.6);core.setFillStyle("ui","#000000");core.fillRect("ui",0,0,this.PIXEL,this.PIXEL)};ui.prototype._drawBook_drawEmpty=function(){core.setTextAlign("ui","center");core.fillText("ui","本层无怪物",this.HPIXEL,this.HPIXEL+14,"#999999",this._buildFont(50,true));core.fillText("ui","返回游戏",this.PIXEL-46,this.PIXEL-13,"#DDDDDD",this._buildFont(15,true))};ui.prototype._drawBook_drawOne=function(b,c,a,f,g){var h=f.per_height*c+f.padding_top;a.floorId=b;this._drawBook_drawBox(c,a,h,f);var d=64,i=this.PIXEL-d;var e=i*10/35;this._drawBook_drawName(c,a,h,d,e);this._drawBook_drawContent(c,a,h,d+e);if(g){core.strokeRoundRect("ui",10,h+1,this.PIXEL-10*2,f.per_height,10,core.status.globalAttribute.selectColor)}};ui.prototype._drawBook_is32x32=function(a){var d=a.height-32;var b=document.createElement("canvas");b.width=32;b.height=d;var c=b.getContext("2d");core.drawImage(c,a.image,0,a.posY*a.height,32,d,0,0,32,d);var e=b.toDataURL();core.clearMap(c);return e==b.toDataURL()};ui.prototype._drawBook_drawBox=function(h,e,k,j){var c=k+(j.per_height-42)/2,b=22;var g=c+5,f=b+5;core.strokeRect("ui",22,c,42,42,"#DDDDDD",2);var a=core.getBlockInfo(e.id);if(a.bigImage){core.status.boxAnimateObjs.push({bigImage:a.bigImage,face:a.face,centerX:b+21,centerY:c+21,max_width:60})}else{if(a.height>=42){var i=core.material.enemys[e.id]||{};if(i.is32x32==null){i.is32x32=this._drawBook_is32x32(a)}if(i.is32x32){core.status.boxAnimateObjs.push({bgx:b,bgy:c,bgWidth:42,bgHeight:42,x:f,y:g,height:32,animate:a.animate,image:a.image,pos:a.posY*a.height+a.height-32})}else{var d=42*32/a.height;core.status.boxAnimateObjs.push({bgx:b,bgy:c,bgWidth:42,bgHeight:42,x:f-5+(42-d)/2,y:g-5,dw:d,dh:42,height:a.height,animate:a.animate,image:a.image,pos:a.posY*a.height})}}else{core.status.boxAnimateObjs.push({bgx:b,bgy:c,bgWidth:42,bgHeight:42,x:f,y:g,height:32,animate:a.animate,image:a.image,pos:a.posY*a.height})}}};ui.prototype._drawBook_drawName=function(b,a,g,c,i){core.setTextAlign("ui","center");if(a.specialText.length==0){core.fillText("ui",a.name,c+i/2,g+35,"#DDDDDD",this._buildFont(17,true),i)}else{core.fillText("ui",a.name,c+i/2,g+28,"#DDDDDD",this._buildFont(17,true),i);switch(a.specialText.length){case 1:core.fillText("ui",a.specialText[0],c+i/2,g+50,core.arrayToRGBA((a.specialColor||[])[0]||"#FF6A6A"),this._buildFont(15,true),i);break;case 2:var f=a.specialText[0]+"  "+a.specialText[1];core.setFontForMaxWidth("ui",f,i,this._buildFont(15,true));var h=core.calWidth("ui",f);var d=core.calWidth("ui",a.specialText[0]);var e=core.calWidth("ui",a.specialText[1]);core.fillText("ui",a.specialText[0],c+(i+d-h)/2,g+50,core.arrayToRGBA((a.specialColor||[])[0]||"#FF6A6A"));core.fillText("ui",a.specialText[1],c+(i+h-e)/2,g+50,core.arrayToRGBA((a.specialColor||[])[1]||"#FF6A6A"));break;default:core.fillText("ui","多属性...",c+i/2,g+50,"#FF6A6A",this._buildFont(15,true),i)}}};ui.prototype._drawBook_drawContent=function(b,a,d,c){var e=this.PIXEL-c;this._drawBook_drawRow1(b,a,d,c,e,d+20);this._drawBook_drawRow2(b,a,d,c,e,d+38);this._drawBook_drawRow3(b,a,d,c,e,d+56)};ui.prototype._drawBook_drawRow1=function(g,e,j,h,k,i){core.setTextAlign("ui","left");var a=this._buildFont(13,true),f=this._buildFont(13,false);var b=h,c=h+k*9/25,d=h+k*17/25;core.fillText("ui",core.getStatusLabel("hp"),b,i,"#DDDDDD",f);core.fillText("ui",core.formatBigNumber(e.hp||0),b+30,i,null,a);core.fillText("ui",core.getStatusLabel("atk"),c,i,null,f);core.fillText("ui",core.formatBigNumber(e.atk||0),c+30,i,null,a);core.fillText("ui",core.getStatusLabel("def"),d,i,null,f);core.fillText("ui",core.formatBigNumber(e.def||0),d+30,i,null,a)};ui.prototype._drawBook_drawRow2=function(h,f,m,i,n,k){core.setTextAlign("ui","left");var a=this._buildFont(13,true),g=this._buildFont(13,false);var b=i,c=i+n*9/25,d=i+n*17/25;var l=[];if(core.flags.statusBarItems.indexOf("enableMoney")>=0){l.push([core.getStatusLabel("money"),core.formatBigNumber(f.money||0)])}if(core.flags.enableAddPoint){l.push([core.getStatusLabel("point"),core.formatBigNumber(f.point||0)])}if(core.flags.statusBarItems.indexOf("enableExp")>=0){l.push([core.getStatusLabel("exp"),core.formatBigNumber(f.exp||0)])}var e=b+(this.PIXEL-b)/2-12;if(l.length>0){var j=l.shift();core.fillText("ui",j[0],b,k,"#DDDDDD",g);core.fillText("ui",j[1],b+30,k,null,a);e=c+(this.PIXEL-c)/2-12}if(l.length>0){var j=l.shift();core.fillText("ui",j[0],c,k,"#DDDDDD",g);core.fillText("ui",j[1],c+30,k,null,a);e=d+(this.PIXEL-d)/2-12}this._drawBook_drawDamage(h,f,e,k)};ui.prototype._drawBook_drawRow3=function(g,e,j,h,k,i){core.setTextAlign("ui","left");var a=this._buildFont(13,true),f=this._buildFont(13,false);var b=h,c=h+k*9/25,d=h+k*17/25;core.fillText("ui","临界",b,i,"#DDDDDD",f);core.fillText("ui",core.formatBigNumber(e.critical||0),b+30,i,null,a);core.fillText("ui","减伤",c,i,null,f);core.fillText("ui",core.formatBigNumber(e.criticalDamage||0),c+30,i,null,a);core.fillText("ui","加防",d,i,null,f);core.fillText("ui",core.formatBigNumber(e.defDamage||0),d+30,i,null,a)};ui.prototype._drawBook_drawDamage=function(d,c,e,f){core.setTextAlign("ui","center");var b=c.damage,a="#FFFF00";if(b==null){b="无法战斗";a="#FF2222"}else{if(b>=core.status.hero.hp){a="#FF2222"}else{if(b>=core.status.hero.hp*2/3){a="#FF9933"}else{if(b<=0){a="#11FF11"}}}b=core.formatBigNumber(b);if(core.enemys.hasSpecial(c,19)){b+="+"}if(core.enemys.hasSpecial(c,21)){b+="-"}if(core.enemys.hasSpecial(c,11)){b+="^"}}if(c.notBomb){b+="[b]"}core.fillText("ui",b,e,f,a,this._buildFont(13,true))};ui.prototype._drawBookDetail=function(f){var g=this._drawBookDetail_getInfo(f),d=g[0];if(!d){return}var b=g[1].join("\n");core.status.event.id="book-detail";core.animateFrame.tip=null;core.clearMap("data");var h=10,l=this.PIXEL-2*h,i=h+l;var c=h+25,k=i-c-13;var e=Math.max(this.getTextContentHeight(b,{fontSize:16,lineHeight:24,maxWidth:k})+58,80),j=(this.PIXEL-e)/2,a=j+e;core.setAlpha("data",0.9);core.fillRect("data",h,j,l,e,"#000000");core.setAlpha("data",1);core.strokeRect("data",h-1,j-1,l+1,e+1,core.arrayToRGBA(core.status.globalAttribute.borderColor),2);core.playSound("确定");this._drawBookDetail_drawContent(d,b,{top:j,content_left:c,bottom:a,validWidth:k})};ui.prototype._drawBookDetail_getInfo=function(e){var d=core.floorIds[(core.status.event.ui||{}).index]||core.status.floorId;if(d!=core.status.floorId&&core.status.checkBlock){core.status.checkBlock.cache={}}var c=core.enemys.getCurrentEnemys(d);if(c.length==0){return[]}e=core.clamp(e,0,c.length-1);var a=c[e],b=a.id;var f=core.enemys.getSpecialHint(b);if(f.length==0){f.push("该怪物无特殊属性。")}if(a.description){f.push(a.description+"\r")}f.push("");this._drawBookDetail_getTexts(a,d,f);return[a,f]};ui.prototype._drawBookDetail_getTexts=function(a,b,c){this._drawBookDetail_origin(a,c);this._drawBookDetail_mofang(a,c);this._drawBookDetail_vampire(a,b,c);this._drawBookDetail_hatred(a,c);this._drawBookDetail_turnAndCriticals(a,b,c)};ui.prototype._drawBookDetail_origin=function(b,d){var c=core.enemys._getCurrentEnemys_getEnemy(b.id);var a=[];if(b.locs!=null&&b.locs.length>=0){d.push("\r[#FF6A6A]\\d怪物坐标:\\d\r[]"+JSON.stringify(b.locs))}["hp","atk","def","point","money","exp"].forEach(function(e){if(b[e]==null||c[e]==null){return}if(b[e]!=c[e]){a.push(core.getStatusLabel(e)+" "+c[e])}});if(a.length>0){d.push("\r[#FF6A6A]\\d原始数值:\\d\r[]"+a.join(";"))}};ui.prototype._drawBookDetail_mofang=function(b,d){if(core.enemys.hasSpecial(b.special,10)){var c=b.hp;var a=core.status.hero.atk-core.status.hero.def;if(a<c&&c<=10000&&c>0){d.push("\r[#FF6A6A]\\d模仿临界计算器:\\d\r[](当前攻防差"+core.formatBigNumber(a)+")");var e=[];this._drawBookDetail_mofang_getArray(c).forEach(function(f){if(e.length<20){e.push(f)}else{if(Math.abs(f[0]-a)<Math.abs(e[0][0]-a)){e.shift();e.push(f)}}});d.push(JSON.stringify(e.map(function(f){return core.formatBigNumber(f[0])+":"+f[1]})))}}};ui.prototype._drawBookDetail_mofang_getArray=function(b){var a=[];var d=0,f=0;for(var c=1;c<b;c++){var e=parseInt((b-1)/c);if(e!=d){if(d!=0){a.push([f,d+"x"])}d=e;f=c}}if(d!=0){a.push([f,"1x"]);a.push([b,"0"])}return a};ui.prototype._drawBookDetail_vampire=function(c,d,h){if(core.enemys.hasSpecial(c.special,11)){var a=core.getDamage(c.id);if(a!=null){var g=1,b=100*a;var f=core.status.hero.hp;while(g<b){var e=Math.floor((g+b)/2);core.status.hero.hp=e;if(core.canBattle(c.id,c.x,c.y,d)){b=e}else{g=e+1}}core.status.hero.hp=g;if(core.canBattle(c.id)){h.push("\r[#FF6A6A]\\d打死该怪物最低需要生命值:\\d\r[]"+core.formatBigNumber(g))}core.status.hero.hp=f}}};ui.prototype._drawBookDetail_hatred=function(a,b){if(core.enemys.hasSpecial(a.special,17)){b.push("\r[#FF6A6A]\\d当前仇恨伤害值:\\d\r[]"+core.getFlag("hatred",0))}};ui.prototype._drawBookDetail_turnAndCriticals=function(c,d,e){var b=core.getDamageInfo(c.id,null,c.x,c.y,d);e.push("\r[#FF6A6A]\\d战斗回合数:\\d\r[]"+((b||{}).turn||0));var a=core.enemys.nextCriticals(c.id,8,c.x,c.y,d).map(function(f){return core.formatBigNumber(f[0])+":"+core.formatBigNumber(f[1])});while(a[0]=="0:0"){a.shift()}e.push("\r[#FF6A6A]\\d临界表:\\d\r[]"+JSON.stringify(a))};ui.prototype._drawBookDetail_drawContent=function(c,a,d){core.setTextAlign("data","left");core.fillText("data",c.name,d.content_left,d.top+30,core.status.globalAttribute.selectColor,this._buildFont(22,true));var b=d.top+44;this.drawTextContent("data",a,{left:d.content_left,top:b,maxWidth:d.validWidth,fontSize:16,lineHeight:24})};ui.prototype.drawFly=function(e){core.status.event.data=e;var a=core.floorIds[e];var h=core.status.maps[a].title;core.clearMap("ui");core.setAlpha("ui",0.85);core.fillRect("ui",0,0,this.PIXEL,this.PIXEL,"#000000");core.setAlpha("ui",1);core.setTextAlign("ui","center");core.fillText("ui","楼层跳跃",this.HPIXEL,60,"#FFFFFF",this._buildFont(28,true));core.fillText("ui","返回游戏",this.HPIXEL,this.PIXEL-13,null,this._buildFont(15,true));core.setTextAlign("ui","right");core.fillText("ui","浏览地图时也",this.PIXEL-10,this.PIXEL-23,"#aaaaaa",this._buildFont(10,false));core.fillText("ui","可楼层跳跃!",this.PIXEL-10,this.PIXEL-11,null,this._buildFont(10,false));core.setTextAlign("ui","center");var d=this.HPIXEL+39;var c=core.splitLines("ui",h,120,this._buildFont(19,true));var g=d-(c.length-1)*11;for(var b in c){core.fillText("ui",c[b],this.PIXEL-60,g,"#FFFFFF");g+=22}if(core.actions._getNextFlyFloor(1)!=e){core.fillText("ui","▲",this.PIXEL-60,d-64,null,this._buildFont(17,false));core.fillText("ui","▲",this.PIXEL-60,d-96);core.fillText("ui","▲",this.PIXEL-60,d-96-7)}if(core.actions._getNextFlyFloor(-1)!=e){core.fillText("ui","▼",this.PIXEL-60,d+64,null,this._buildFont(17,false));core.fillText("ui","▼",this.PIXEL-60,d+96);core.fillText("ui","▼",this.PIXEL-60,d+96+7)}var f=this.PIXEL-143;core.strokeRect("ui",20,100,f,f,"#FFFFFF",2);core.drawThumbnail(a,null,{ctx:"ui",x:20,y:100,size:f,damage:true})};ui.prototype._drawCenterFly=function(){core.lockControl();core.status.event.id="centerFly";var a="rgba(255,0,0,0.5)";if(core.canUseItem("centerFly")){a="rgba(0,255,0,0.5)"}var d=core.bigmap.width-1-core.getHeroLoc("x"),e=core.bigmap.height-1-core.getHeroLoc("y");this.clearUI();core.fillRect("ui",0,0,this.PIXEL,this.PIXEL,"#000000");core.drawThumbnail(null,null,{heroLoc:core.status.hero.loc,heroIcon:core.status.hero.image,ctx:"ui",centerX:d,centerY:e});var b=core.clamp(d-core.__HALF_SIZE__,0,core.bigmap.width-core.__SIZE__),c=core.clamp(e-core.__HALF_SIZE__,0,core.bigmap.height-core.__SIZE__);core.fillRect("ui",(d-b)*32,(e-c)*32,32,32,a);core.status.event.data={x:d,y:e,posX:d-b,posY:e-c};core.playSound("打开界面");core.drawTip("请确认当前"+core.material.items.centerFly.name+"的位置","centerFly");return};ui.prototype._drawViewMaps=function(c,h,i){core.lockControl();core.status.event.id="viewMaps";this.clearUI();if(c==null){return this._drawViewMaps_drawHint()}core.animateFrame.tip=null;core.status.checkBlock.cache={};var a=this._drawViewMaps_buildData(c,h,i);core.fillRect("ui",0,0,this.PIXEL,this.PIXEL,"#000000");core.drawThumbnail(a.floorId,null,{damage:a.damage,ctx:"ui",centerX:a.x,centerY:a.y,all:a.all});core.clearMap("data");core.setTextAlign("data","left");core.setFont("data","16px Arial");var d=core.status.maps[a.floorId].title;if(!a.all&&(a.mw>this.SIZE||a.mh>this.SIZE)){d+=" ["+(a.x-this.HSIZE)+","+(a.y-this.HSIZE)+"]"}if(core.markedFloorIds[a.floorId]){d+=" (已标记)"}var e=16,f=18,g=e+core.calWidth("data",d)+16,b=42;core.fillRect("data",5,5,g,b,"rgba(0,0,0,0.4)");core.fillText("data",d,e+5,f+15,"rgba(255,255,255,0.6)")};ui.prototype._drawViewMaps_drawHint=function(){core.playSound("打开界面");core.fillRect("ui",0,0,this.PIXEL,this.PIXEL,"rgba(0,0,0,0.7)");core.setTextAlign("ui","center");var h=function(l,n,o,k,i,m){core.strokeRect("ui",l+2,n+2,o-4,k-4,i,m)};var e=this.PIXEL/5,a=e*3/4;h(e,0,3*e,e,core.status.globalAttribute.selectColor,4);h(0,e,e,3*e);h(e,4*e,3*e,e);h(4*e,e,e,3*e);h(e,e,3*e,e);h(e,3*e,3*e,e);h(0,0,a,a);h(this.PIXEL-a,0,a,a);h(0,this.PIXEL-a,a,a);core.setTextBaseline("ui","middle");core.fillText("ui","上移地图 [W]",this.HPIXEL,e/2,core.status.globalAttribute.selectColor,"20px Arial");core.fillText("ui","下移地图 [S]",this.HPIXEL,this.PIXEL-e/2);core.fillText("ui","V",a/2,a/2);core.fillText("ui","Z",this.PIXEL-a/2,a/2);core.fillText("ui","B",a/2,this.PIXEL-a/2);var j=this.HPIXEL-66,c=e/2,f=this.PIXEL-c;var d=["左","移","地","图","[A]"],g=["右","移","地","图","[D]"];for(var b=0;b<5;++b){core.fillText("ui",d[b],c,j+32*b);core.fillText("ui",g[b],f,j+32*b)}core.fillText("ui","前张地图 [▲ / PGUP]",this.HPIXEL,e*1.5);core.fillText("ui","后张地图 [▼ / PGDN]",this.HPIXEL,this.PIXEL-e*1.5);core.fillText("ui","退出 [ESC / ENTER]",this.HPIXEL,this.HPIXEL);core.fillText("ui","[X] 可查看"+core.material.items.book.name+"   [G] 可使用"+core.material.items.fly.name,this.HPIXEL,this.HPIXEL+32,null,"12px Arial");core.setTextBaseline("ui","alphabetic")};ui.prototype._drawViewMaps_buildData=function(d,g,h){var b=(core.status.event.data||{}).damage;var a=(core.status.event.data||{all:true}).all;if(d.damage!=null){b=d.damage}if(d.all!=null){a=d.all}if(d.index!=null){g=d.x;h=d.y;d=d.index}d=core.clamp(d,0,core.floorIds.length-1);if(b==null){b=true}var c=core.floorIds[d],f=core.floors[c].width,e=core.floors[c].height;if(g==null){g=parseInt(f/2)}if(h==null){h=parseInt(e/2)}g=core.clamp(g,this.HSIZE,f-this.HSIZE-1);h=core.clamp(h,this.HSIZE,e-this.HSIZE-1);core.status.event.data={index:d,x:g,y:h,floorId:c,mw:f,mh:e,damage:b,all:a};return core.status.event.data};ui.prototype._drawToolbox=function(a){var b=this._drawToolbox_getInfo(a);this._drawToolbox_drawBackground();core.setAlpha("ui",1);core.setStrokeStyle("ui","#DDDDDD");core.canvas.ui.lineWidth=2;core.canvas.ui.strokeWidth=2;core.setTextAlign("ui","right");var c=this.PIXEL-306;this._drawToolbox_drawLine(c,"消耗道具");var d=this.PIXEL-146;this._drawToolbox_drawLine(d,"永久道具");this._drawToolbox_drawDescription(b,c);this._drawToolbox_drawContent(b,c,b.tools,b.toolsPage,true);this.drawPagination(b.toolsPage,b.toolsTotalPage,this.LAST-5);this._drawToolbox_drawContent(b,d,b.constants,b.constantsPage);this.drawPagination(b.constantsPage,b.constantsTotalPage);core.setTextAlign("ui","center");core.fillText("ui","[装备栏]",this.PIXEL-46,25,"#DDDDDD",this._buildFont(15,true));core.fillText("ui","返回游戏",this.PIXEL-46,this.PIXEL-13)};ui.prototype.getToolboxItems=function(a){if(this.uidata.getToolboxItems){return this.uidata.getToolboxItems(a)}return Object.keys(core.status.hero.items[a]||{}).filter(function(b){return !core.material.items[b].hideInToolbox}).sort()};ui.prototype._drawToolbox_getInfo=function(d){if(!core.status.event.data||core.status.event.data.toolsPage==null){core.status.event.data={toolsPage:1,constantsPage:1,selectId:null}}var g=core.getToolboxItems("tools"),a=core.getToolboxItems("constants");var h=core.status.event.data.toolsPage;var b=core.status.event.data.constantsPage;var i=Math.ceil(g.length/this.LAST);var c=Math.ceil(a.length/this.LAST);if(d==null){d=g.length==0&&a.length>0?this.LAST:0}core.status.event.selection=d;var e,f;if(d<this.LAST){e=d+(h-1)*this.LAST;if(e>=g.length){e=Math.max(0,g.length-1)}f=g[e]}else{e=d%this.LAST+(b-1)*this.LAST;if(e>=a.length){e=Math.max(0,a.length-1)}f=a[e]}if(!core.hasItem(f)){f=null}core.status.event.data.selectId=f;return{index:d,tools:g,constants:a,toolsPage:h,constantsPage:b,toolsTotalPage:i,constantsTotalPage:c,selectId:f}};ui.prototype._drawToolbox_drawBackground=function(){core.clearMap("ui");core.setAlpha("ui",0.85);core.fillRect("ui",0,0,this.PIXEL,this.PIXEL,"#000000")};ui.prototype._drawToolbox_drawLine=function(b,a){core.setFillStyle("ui","#DDDDDD");core.canvas.ui.beginPath();core.canvas.ui.moveTo(0,b);core.canvas.ui.lineTo(this.PIXEL,b);core.canvas.ui.stroke();core.canvas.ui.beginPath();core.canvas.ui.moveTo(this.PIXEL,b-1);core.canvas.ui.lineTo(this.PIXEL,b-25);core.canvas.ui.lineTo(this.PIXEL-72,b-25);core.canvas.ui.lineTo(this.PIXEL-102,b-1);core.canvas.ui.fill();core.fillText("ui",a,this.PIXEL-5,b-6,"#333333",this._buildFont(16,true))};ui.prototype._drawToolbox_drawDescription=function(f,h){core.setTextAlign("ui","left");if(!f.selectId){return}var g=core.material.items[f.selectId];var i=g.name||"未知道具";try{i=core.replaceText(i)}catch(b){}core.fillText("ui",i,10,32,core.status.globalAttribute.selectColor,this._buildFont(20,true));var j=g.text||"该道具暂无描述。";try{j=core.replaceText(j)}catch(b){}var d=null;for(var c=17;c>=9;c-=2){var a={left:10,top:46,fontSize:c,maxWidth:this.PIXEL-15,bold:false,color:"white"};d=42+core.getTextContentHeight(j,a);if(d<h||c==9){core.drawTextContent("ui",j,a);break}}if(d<h-33){core.fillText("ui","<继续点击该道具即可进行使用>",10,h-15,"#CCCCCC",this._buildFont(14,false))}};ui.prototype._drawToolbox_drawContent=function(e,h,g,j,a){core.setTextAlign("ui","right");for(var b=0;b<this.LAST;b++){var f=g[this.LAST*(j-1)+b];if(!f){continue}var k=h+54*Math.floor(b/this.HSIZE)+19;var c=core.material.icons.items[f],d=core.material.images.items;core.drawImage("ui",d,0,32*c,32,32,64*(b%this.HSIZE)+21,k,32,32);if(a){core.fillText("ui",core.itemCount(f),64*(b%this.HSIZE)+56,k+33,"#FFFFFF",this._buildFont(14,true))}if(e.selectId==f){core.strokeRoundRect("ui",64*(b%this.HSIZE)+17,k-4,40,40,6,core.status.globalAttribute.selectColor)}}};ui.prototype._drawEquipbox=function(a){var b=this._drawEquipbox_getInfo(a);this._drawToolbox_drawBackground();core.setAlpha("ui",1);core.setStrokeStyle("ui","#DDDDDD");core.canvas.ui.lineWidth=2;core.canvas.ui.strokeWidth=2;core.setTextAlign("ui","right");var c=this.PIXEL-306;this._drawToolbox_drawLine(c,"当前装备");var d=this.PIXEL-146;this._drawToolbox_drawLine(d,"拥有装备");this._drawEquipbox_description(b,c);this._drawEquipbox_drawEquiped(b,c);this._drawToolbox_drawContent(b,d,b.ownEquipment,b.page,true);this.drawPagination(b.page,b.totalPage);core.setTextAlign("ui","center");core.fillText("ui","[道具栏]",this.PIXEL-46,25,"#DDDDDD",this._buildFont(15,true));core.fillText("ui","返回游戏",this.PIXEL-46,this.PIXEL-13)};ui.prototype._drawEquipbox_getInfo=function(d){if(!core.status.event.data||core.status.event.data.page==null){core.status.event.data={page:1,selectId:null}}var a=core.status.globalAttribute.equipName;var c=a.length;if(!core.status.hero.equipment){core.status.hero.equipment=[]}var b=core.status.hero.equipment;var e=core.getToolboxItems("equips");var f=core.status.event.data.page;var h=Math.ceil(e.length/this.LAST);if(d==null){if(c>0&&b[0]){d=0}else{if(e.length>0){d=this.LAST}else{d=0}}}if(d>=this.LAST&&e.length==0){d=0}var g=null;if(d<this.LAST){if(d>=c){d=Math.max(0,c-1)}g=b[d]||null}else{if(f==h){d=Math.min(d,(e.length+this.LAST-1)%this.LAST+this.LAST)}g=e[d-this.LAST+(f-1)*this.LAST];if(!core.hasItem(g)){g=null}}core.status.event.selection=d;core.status.event.data.selectId=g;return{index:d,selectId:g,page:f,totalPage:h,allEquips:a,equipLength:c,equipEquipment:b,ownEquipment:e}};ui.prototype._drawEquipbox_description=function(i,j){core.setTextAlign("ui","left");if(!i.selectId){return}var c=core.material.items[i.selectId];if(!c.equip){c.equip={type:0}}var f=c.equip.type,d;if(typeof f==="string"){d=f||"未知部位";f=core.items.getEquipTypeByName(f)}else{d=i.allEquips[f]||"未知部位"}core.fillText("ui",c.name+"("+d+")",10,32,core.status.globalAttribute.selectColor,this._buildFont(20,true));var k=c.text||"该装备暂无描述。";try{k=core.replaceText(k)}catch(b){}var h=null;for(var g=17;g>=9;g-=2){var a={left:10,top:46,fontSize:g,maxWidth:this.PIXEL-15,bold:false,color:"white"};h=42+core.getTextContentHeight(k,a);if(h<j-30||g==9){core.drawTextContent("ui",k,a);break}}this._drawEquipbox_drawStatusChanged(i,j-15,c,f)};ui.prototype._drawEquipbox_getStatusChanged=function(c,a,b,d){if(c.index<this.LAST){return core.compareEquipment(null,c.selectId)}if(b<0){core.fillText("ui","<当前没有该装备的空位,请先卸下装备>",10,d,"#CCCCCC",this._buildFont(14,false));return null}return core.compareEquipment(c.selectId,c.equipEquipment[b])};ui.prototype._drawEquipbox_drawStatusChanged=function(e,k,c,d){var b=this._drawEquipbox_getStatusChanged(e,c,d,k);if(b==null){return}var i={drawOffset:10,y:k};core.setFont("ui",this._buildFont(14,true));for(var f in core.status.hero){if(typeof core.status.hero[f]!="number"){continue}var h=core.getRealStatus(f);var g=Math.floor((core.getStatus(f)+(b.value[f]||0))*(core.getBuff(f)*100+(b.percentage[f]||0))/100);if(h==g){continue}var j=core.getStatusLabel(f);this._drawEquipbox_drawStatusChanged_draw(j+" ","#CCCCCC",i);var a=g>h?"#00FF00":"#FF0000";h=core.formatBigNumber(h);g=core.formatBigNumber(g);this._drawEquipbox_drawStatusChanged_draw(h+"->","#CCCCCC",i);this._drawEquipbox_drawStatusChanged_draw(g,a,i);i.drawOffset+=8}};ui.prototype._drawEquipbox_drawStatusChanged_draw=function(d,a,c){var b=core.calWidth("ui",d);if(c.drawOffset+b>=core.__PIXELS__){c.y+=19;c.drawOffset=10}core.fillText("ui",d,c.drawOffset,c.y,a);c.drawOffset+=b};ui.prototype._drawEquipbox_drawEquiped=function(d,e){core.setTextAlign("ui","center");var h=this.HSIZE-3,j=Math.floor(this.PIXEL/(h+0.25));for(var b=0;b<d.equipLength;b++){var a=d.equipEquipment[b]||null;var f=j*(b%h)+j*2/3;var g=f-(j-32)/2;var k=e+54*Math.floor(b/h)+19;if(a){var c=core.material.icons.items[a];core.drawImage("ui",core.material.images.items,0,32*c,32,32,f,k,32,32)}core.fillText("ui",d.allEquips[b]||"未知",g,k+27,"#FFFFFF",this._buildFont(16,true));core.strokeRoundRect("ui",f-4,k-4,40,40,6,d.index==b?core.status.globalAttribute.selectColor:"#FFFFFF")}};ui.prototype._drawSLPanel=function(a,g){core.control._loadFavoriteSaves();if(a==null){a=1}if(a<0){a=0}var f=parseInt(a/10),e=a%10;var c=main.savePages||30;if(core.status.event.data&&core.status.event.data.mode=="fav"){c=Math.ceil((core.saves.favorite||[]).length/5)}if(f>=c){f=c-1}if(e>5){e=5}if(core.status.event.data&&core.status.event.data.mode=="fav"&&f==c-1){e=Math.min(e,(core.saves.favorite||[]).length-5*f)}var b=-1;var d="all";if(core.status.event.data){b=core.status.event.data.page;d=core.status.event.data.mode}core.status.event.data={page:f,offset:e,mode:d};core.status.event.ui=core.status.event.ui||[];if(g||f!=b){core.status.event.ui=[];this._drawSLPanel_loadSave(f,function(){core.ui._drawSLPanel_draw(f,c)})}else{this._drawSLPanel_draw(f,c)}};ui.prototype._drawSLPanel_draw=function(c,b){this._drawSLPanel_drawBackground();core.ui.drawPagination(c+1,b);core.setTextAlign("ui","center");var a=this.PIXEL-13;core.fillText("ui","返回游戏",this.PIXEL-48,a,"#DDDDDD",this._buildFont(15,true));if(core.status.event.selection){core.setFillStyle("ui","#FF6A6A")}if(core.status.event.id=="save"){core.fillText("ui","删除模式",48,a)}else{if(core.status.event.data.mode=="all"){core.fillText("ui","[E]显示收藏",52,a)}else{core.fillText("ui","[E]显示全部",52,a)}}this._drawSLPanel_drawRecords()};ui.prototype._drawSLPanel_drawBackground=function(){core.clearMap("ui");core.setAlpha("ui",0.85);core.fillRect("ui",0,0,this.PIXEL,this.PIXEL,"#000000");core.setAlpha("ui",1)};ui.prototype._drawSLPanel_loadSave=function(e,a){var d=[0];for(var b=1;b<=5;++b){var c=5*e+b;if(core.status.event.data.mode=="fav"){c=core.saves.favorite[c-1]}d.push(c)}core.getSaves(d,function(f){for(var g=1;g<d.length;++g){core.status.event.ui[g]=f[g]}core.status.event.ui[0]=f[0]==null?null:f[0][core.saves.autosave.now-1];a()})};ui.prototype._drawSLPanel_drawRecord=function(h,b,k,l,f,a,d){var c=core.status.globalAttribute||core.initStatus.globalAttribute;var g=c.selectColor;if(core.status.event.selection){g="#FF6A6A"}if(!b||!b.floorId){d=false}if(b&&b.__toReplay__){h="[R]"+h}core.fillText("ui",h,k,l,d?c.selectColor:"#FFFFFF",this._buildFont(17,true));core.strokeRect("ui",k-f/2,l+15,f,f,a?g:"#FFFFFF",a?6:2);if(b&&b.floorId){core.setTextAlign("ui","center");var e=core.maps.loadMap(b.maps,b.floorId);core.extractBlocksForUI(e,b.hero.flags);core.drawThumbnail(b.floorId,e.blocks,{heroLoc:b.hero.loc,heroIcon:b.hero.image,flags:b.hero.flags,ctx:"ui",x:k-f/2,y:l+15,size:f,centerX:b.hero.loc.x,centerY:b.hero.loc.y});if(core.isPlaying()&&core.getFlag("hard")!=b.hero.flags.hard){core.fillRect("ui",k-f/2,l+15,f,f,[0,0,0,0.4]);core.fillText("ui",b.hard,k,parseInt(l+22+f/2),b.hero.flags.__hardColor__||"red",this._buildFont(30,true))}if(b.hero.notes&&b.hero.notes.length>0){core.setTextAlign("ui","left");if(b.hero.notes.length>=2){core.fillRect("ui",k-f/2,l+15,f,28,[0,0,0,0.3]);core.fillBoldText("ui",b.hero.notes.length-1+". "+b.hero.notes[b.hero.notes.length-2].substring(0,10),k-f/2+2,l+15+12,"#FFFFFF",null,this._buildFont(10,false));core.fillBoldText("ui",b.hero.notes.length+". "+b.hero.notes[b.hero.notes.length-1].substring(0,10),k-f/2+2,l+15+24)}else{core.fillRect("ui",k-f/2,l+15,f,16,[0,0,0,0.3]);core.fillBoldText("ui",b.hero.notes.length+". "+b.hero.notes[b.hero.notes.length-1].substring(0,10),k-f/2+2,l+15+12,"#FFFFFF",null,this._buildFont(10,false))}}core.setTextAlign("ui","center");var i=core.formatBigNumber(b.hero.hp,true)+"/"+core.formatBigNumber(b.hero.atk,true)+"/"+core.formatBigNumber(b.hero.def,true);var j="/"+core.formatBigNumber(b.hero.mdef,true);if(core.calWidth("ui",i+j,this._buildFont(10,false))<=f){i+=j}core.fillText("ui",i,k,l+30+f,c.selectColor);core.fillText("ui",core.formatDate(new Date(b.time)),k,l+43+f,b.hero.flags.debug?"#FF6A6A":"#FFFFFF")}else{core.fillRect("ui",k-f/2,l+15,f,f,"#333333");core.fillText("ui","空",k,parseInt(l+22+f/2),"#FFFFFF",this._buildFont(30,true))}};ui.prototype._drawSLPanel_drawRecords=function(f){var j=core.status.event.data.page;var h=core.status.event.data.offset;var p=Math.floor(this.PIXEL/6),l=Math.floor(this.PIXEL/3-20);var g=core.status.event.id=="save"?"存档":core.status.event.id=="load"?"读档":"回放";for(var d=0;d<(f||6);d++){var b=core.status.event.ui[d];var e=5*j+d;var c=(d>0&&core.saves.favorite.indexOf(e)>=0)||core.status.event.data.mode=="fav";var m=(c?"★ ":"☆ ")+(core.saves.favoriteName[e]||(g+e));if(d!=0&&core.status.event.data.mode=="fav"){if(!b){break}var k=core.saves.favorite[e-1];m=(core.saves.favoriteName[k]||(g+k))+" ?"}var a=32;var o=parseInt((this.PIXEL-a-2*(a*2+l))/3);var q=o+parseInt(a/2)+8;var r=q+a*2+l+o;if(d<3){this._drawSLPanel_drawRecord(d==0?"自动存档":m,b,(2*d+1)*p,q,l,d==h,c)}else{this._drawSLPanel_drawRecord(m,b,(2*d-5)*p,r,l,d==h,c)}}};ui.prototype._drawKeyBoard=function(){core.lockControl();core.status.event.id="keyBoard";core.clearUI();core.playSound("打开界面");var g=this.SIZE%2==0?16:0;var j=384,b=320;var d=(this.PIXEL-j)/2+g,h=d+j;var i=(this.PIXEL-b)/2+g,a=i+b;var c=this.drawBackground(d,i,h,a);core.setTextAlign("ui","center");core.setFillStyle("ui",core.arrayToRGBA(core.status.textAttribute.title));core.fillText("ui","虚拟键盘",this.HPIXEL+g,i+35,null,this._buildFont(22,true));core.setFont("ui",this._buildFont(17,false));core.setFillStyle("ui",core.arrayToRGBA(core.status.textAttribute.text));var f=this.HPIXEL-89+g;var e=[["F1","F2","F3","F4","F5","F6","F7","F8","F9","10","11"],["1","2","3","4","5","6","7","8","9","0"],["Q","W","E","R","T","Y","U","I","O","P"],["A","S","D","F","G","H","J","K","L"],["Z","X","C","V","B","N","M"],["-","=","[","]","\\",";","'",",",".","/","`"],["ES","TA","CA","SH","CT","AL","SP","BS","EN","DE"]];e.forEach(function(l){for(var k=0;k<l.length;k++){core.fillText("ui",l[k],core.ui.HPIXEL+32*(k-5)+g,f)}f+=32});core.fillText("ui","返回游戏",this.HPIXEL+128+g,f-3,"#FFFFFF",this._buildFont(15,true));if(c){this._drawWindowSelector(core.status.textAttribute.background,this.HPIXEL+92+g,f-22,72,27)}else{core.strokeRoundRect("ui",this.HPIXEL+92+g,f-22,72,27,6,core.status.globalAttribute.selectColor,2)}};ui.prototype.drawStatusBar=function(){this.uidata.drawStatusBar()};ui.prototype._drawStatistics=function(a){core.playSound("打开界面");var b=this._drawStatistics_buildObj();if(typeof a=="string"){a=[a]}(a||core.floorIds).forEach(function(d){core.ui._drawStatistics_floorId(d,b)});var c=core.status.hero.statistics;core.setFlag("__replayText__",true);core.drawText([this._drawStatistics_generateText(b,"全塔",b.total),this._drawStatistics_generateText(b,"当前",b.current),this._drawStatistics_generateText(b,"标记(浏览地图时B键或左下角)",b.marked),"当前总步数:"+core.status.hero.steps+",当前游戏时长:"+core.formatTime(c.currTime)+",总游戏时长"+core.formatTime(c.totalTime)+"。\n瞬间移动次数:"+c.moveDirectly+",共计少走"+c.ignoreSteps+"步。\n\n总计通过血瓶恢复生命值为"+core.formatBigNumber(c.hp)+"点。\n\n总计打死了"+c.battle+"个怪物,得到了"+core.formatBigNumber(c.money)+"金币,"+core.formatBigNumber(c.exp)+"点经验。\n\n受到的总伤害为"+core.formatBigNumber(c.battleDamage+c.poisonDamage+c.extraDamage)+",其中战斗伤害"+core.formatBigNumber(c.battleDamage)+"点"+(core.flags.statusBarItems.indexOf("enableDebuff")>=0?(",中毒伤害"+core.formatBigNumber(c.poisonDamage)+"点"):"")+",领域/夹击/阻击/血网伤害"+core.formatBigNumber(c.extraDamage)+"点。","\t[说明]1. 地图数据统计的效果仅模拟当前立刻获得该道具的效果。\n2. 不会计算“不可被浏览地图”的隐藏层的数据。\n3. 不会计算任何通过事件得到的道具(显示事件、改变图块、或直接增加道具等)。\n4. 在自定义道具(例如其他宝石)后,需在脚本编辑的drawStatistics中注册,不然不会进行统计。\n5. 道具不会统计通过插入事件或useItemEvent实现的效果。\n6. 所有统计信息仅供参考,如有错误,概不负责。"]);core.removeFlag("__replayText__")};ui.prototype._drawStatistics_buildObj=function(){var g=this.uidata.drawStatistics();var d=g.filter(function(h){return h.endsWith("Door")||core.material.items[h]});var b={},a={},c={};d.forEach(function(h){if(h.endsWith("Door")){a[h]="doors"}else{a[h]=core.material.items[h].cls}b[h]=0});var f=["doors","items","tools","constants","equips"];d.sort(function(h,i){var j=f.indexOf(a[h]),k=f.indexOf(a[i]);if(j==k){return g.indexOf(h)-g.indexOf(i)}return j-k});var e={monster:{count:0,money:0,exp:0,point:0,},count:b,add:{hp:0,atk:0,def:0,mdef:0}};return{ids:d,cls:a,ext:c,total:core.clone(e),current:core.clone(e),marked:core.clone(e)}};ui.prototype._drawStatistics_add=function(a,b,d,e,c){b.total[d][e]+=c||0;if(a==core.status.floorId){b.current[d][e]+=c||0}if(core.markedFloorIds[a]){b.marked[d][e]+=c||0}};ui.prototype._drawStatistics_floorId=function(c,d){core.extractBlocks(c);var b=core.status.maps[c],a=b.blocks;if(b.cannotViewMap&&c!=core.status.floorId){return}a.forEach(function(e){if(e.disable){return}var f=e.event;if(f.cls.indexOf("enemy")==0){core.ui._drawStatistics_enemy(c,f.id,d)}else{var g=f.id;if(d.total.count[g]!=null){core.ui._drawStatistics_items(c,b,g,d)}}})};ui.prototype._drawStatistics_enemy=function(b,c,d){var a=core.material.enemys[c];this._drawStatistics_add(b,d,"monster","money",a.money);this._drawStatistics_add(b,d,"monster","exp",a.exp);this._drawStatistics_add(b,d,"monster","point",a.point);this._drawStatistics_add(b,d,"monster","count",1)};ui.prototype._drawStatistics_items=function(floorId,floor,id,obj){var hp=0,atk=0,def=0,mdef=0;if(obj.cls[id]=="items"&&id!="superPotion"){var temp=core.clone(core.status.hero);core.setFlag("__statistics__",true);var ratio=core.status.thisMap.ratio;core.status.thisMap.ratio=core.clone(core.status.maps[floorId].ratio);try{eval(core.material.items[id].itemEffect)}catch(e){}core.status.thisMap.ratio=ratio;hp=core.status.hero.hp-temp.hp;atk=core.status.hero.atk-temp.atk;def=core.status.hero.def-temp.def;mdef=core.status.hero.mdef-temp.mdef;core.status.hero=temp;window.hero=core.status.hero;window.flags=core.status.hero.flags}else{if(obj.cls[id]=="equips"){var values=core.material.items[id].equip||{};atk=values.atk||0;def=values.def||0;mdef=values.mdef||0}}if(id.indexOf("sword")==0||id.indexOf("shield")==0||obj.cls[id]=="equips"){var t="";if(atk>0){t+=atk+core.getStatusLabel("atk")}if(def>0){t+=def+core.getStatusLabel("def")}if(mdef>0){t+=mdef+core.getStatusLabel("mdef")}if(t!=""){obj.ext[id]=t}}this._drawStatistics_add(floorId,obj,"count",id,1);this._drawStatistics_add(floorId,obj,"add","hp",hp);this._drawStatistics_add(floorId,obj,"add","atk",atk);this._drawStatistics_add(floorId,obj,"add","def",def);this._drawStatistics_add(floorId,obj,"add","mdef",mdef)};ui.prototype._drawStatistics_generateText=function(b,e,a){var d=e+"地图中:\n";d+="共有怪物"+a.monster.count+"个";if(core.flags.statusBarItems.indexOf("enableMoney")>=0){d+=",总金币数"+a.monster.money}if(core.flags.statusBarItems.indexOf("enableExp")>=0){d+=",总经验数"+a.monster.exp}if(core.flags.enableAddPoint){d+=",总加点数"+a.monster.point}d+="。\n";var c="";b.ids.forEach(function(f){var h=a.count[f];if(h==0){return}if(b.cls[f]!=c){if(c!=""){d+="。"}d+="\n"}else{d+=","}c=b.cls[f];var g=((core.material.items[f]||(core.getBlockById(f)||{}).event)||{}).name||f;d+=g+h+"个";if(b.ext[f]){d+="("+b.ext[f]+")"}});if(c!=""){d+="。"}d+="\n";d+="共加生命值"+core.formatBigNumber(a.add.hp)+"点,攻击"+core.formatBigNumber(a.add.atk)+"点,防御"+core.formatBigNumber(a.add.def)+"点,护盾"+core.formatBigNumber(a.add.mdef)+"点。";return d};ui.prototype._drawAbout=function(){return this.uidata.drawAbout()};ui.prototype._drawHelp=function(){core.playSound("打开界面");core.clearUI();if(core.material.images.keyboard){core.status.event.id="help";core.lockControl();core.setAlpha("ui",1);core.fillRect("ui",0,0,this.PIXEL,this.PIXEL,"#000000");core.drawImage("ui",core.material.images.keyboard,32*(this.HSIZE-6),32*(this.HSIZE-6))}else{core.drawText(["\t[键盘快捷键列表][CTRL] 跳过对话   [Z] 转向\n[X] "+core.material.items.book.name+"   [G] "+core.material.items.fly.name+"\n[A] 读取自动存档   [W] 撤销读取自动存档\n[S/D] 存读档页面   [SPACE] 轻按\n[V] 快捷商店   [ESC] 系统菜单\n[T] 道具页面   [Q] 装备页面\n[B] 数据统计   [H] 帮助页面\n[R] 回放录像   [E] 显示光标\n[N] 返回标题页面   [P] 游戏主页\n[O] 查看工程   [F7] 打开debug穿墙模式\n[PgUp/PgDn] 浏览地图\n[1~4] 快捷使用破炸飞和其他道具\n[Alt+0~9] 快捷换装","\t[鼠标操作]点状态栏中图标: 进行对应的操作\n点任意块: 寻路并移动\n点任意块并拖动: 指定寻路路线\n双击空地: 瞬间移动\n单击勇士: 转向\n双击勇士: 轻按(仅在轻按开关打开时有效)\n长按任意位置:跳过剧情对话或打开虚拟键盘"])}};ui.prototype.createCanvas=function(b,e,f,d,a,g){if(core.dymCanvas[b]){this.relocateCanvas(b,e,f);this.resizeCanvas(b,d,a);core.dymCanvas[b].canvas.style.zIndex=g;return core.dymCanvas[b]}var c=document.createElement("canvas");c.id=b;c.style.display="block";c.setAttribute("_left",e);c.setAttribute("_top",f);c.style.width=d*core.domStyle.scale+"px";c.style.height=a*core.domStyle.scale+"px";c.style.left=e*core.domStyle.scale+"px";c.style.top=f*core.domStyle.scale+"px";c.style.zIndex=g;c.style.position="absolute";c.style.pointerEvents="none";core.dymCanvas[b]=c.getContext("2d");core.maps._setHDCanvasSize(core.dymCanvas[b],d,a);core.dom.gameDraw.appendChild(c);return core.dymCanvas[b]};ui.prototype.relocateCanvas=function(b,d,e,c){var a=core.getContextByName(b);if(!a){return null}if(d!=null){if(c){d+=parseFloat(a.canvas.getAttribute("_left"))||0}a.canvas.style.left=d*core.domStyle.scale+"px";a.canvas.setAttribute("_left",d)}if(e!=null){if(c){e+=parseFloat(a.canvas.getAttribute("_top"))||0}a.canvas.style.top=e*core.domStyle.scale+"px";a.canvas.setAttribute("_top",e)}return a};ui.prototype.rotateCanvas=function(g,a,c,d){var e=core.getContextByName(g);if(!e){return null}var b=e.canvas;a=a||0;if(c==null||d==null){b.style.transformOrigin=""}else{var f=parseFloat(b.getAttribute("_left"));var h=parseFloat(b.getAttribute("_top"));b.style.transformOrigin=(c-f)*core.domStyle.scale+"px "+(d-h)*core.domStyle.scale+"px"}if(a==0){b.style.transform=""}else{b.style.transform="rotate("+a+"deg)"}b.setAttribute("_angle",a)};ui.prototype.resizeCanvas=function(c,e,b,d){var a=core.getContextByName(c);if(!a){return null}if(e!=null){if(!d){core.maps._setHDCanvasSize(a,e,null)}a.canvas.style.width=e*core.domStyle.scale+"px"}if(b!=null){if(!d){core.maps._setHDCanvasSize(a,null,b)}a.canvas.style.height=b*core.domStyle.scale+"px"}return a};ui.prototype.deleteCanvas=function(a){if(a instanceof Function){Object.keys(core.dymCanvas).forEach(function(b){if(a(b)){core.deleteCanvas(b)}});return}if(!core.dymCanvas[a]){return null}core.dom.gameDraw.removeChild(core.dymCanvas[a].canvas);delete core.dymCanvas[a]};ui.prototype.deleteAllCanvas=function(){return this.deleteCanvas(function(){return true})};"use strict";function extensions(){}extensions.prototype._load=function(a){if(main.replayChecking){return a()}if(!window.fs){this._loadJs("_server/fs.js",function(){core.extensions._listExtensions(a)},a)}else{this._listExtensions(a)}};extensions.prototype._loadJs=function(b,a,c){var d=document.createElement("script");d.src=b+"?v="+main.version;d.onload=a;d.onerror=c;main.dom.body.appendChild(d)};extensions.prototype._listExtensions=function(a){if(!window.fs){return a()}fs.readdir("extensions",function(c,b){if(c||!(b instanceof Array)){return a()}var d=[];b.forEach(function(e){if(/^[\w.-]+\.js$/.test(e)){d.push(e)}});d.sort();core.extensions._loadExtensions(d,a)})};extensions.prototype._loadExtensions=function(c,a){var b=0;var d=function(){if(b==c.length){return a()}core.extensions._loadJs("extensions/"+c[b++],d,d)};d()};"use strict";function core(){this.__SIZE__=13;this.__PIXELS__=this.__SIZE__*32;this.__HALF_SIZE__=Math.floor(this.__SIZE__/2);this.material={animates:{},images:{},bgms:{},sounds:{},items:{},enemys:{},icons:{},ground:null,grundCanvas:null,groundPattern:null,autotileEdges:{},};this.timeout={turnHeroTimeout:null,onDownTimeout:null,sleepTimeout:null,};this.interval={heroMoveInterval:null,onDownInterval:null,};this.animateFrame={totalTime:0,totalTimeStart:0,globalAnimate:false,globalTime:0,selectorTime:0,selectorUp:true,animateTime:0,moveTime:0,lastLegTime:0,leftLeg:true,weather:{time:0,type:null,level:1,nodes:[],data:null,fog:null,cloud:null,sun:null},tip:null,asyncId:{},lastAsyncId:null};this.musicStatus={audioContext:null,bgmStatus:false,soundStatus:true,playingBgm:null,pauseTime:0,lastBgm:null,gainNode:null,playingSounds:{},userVolume:1,designVolume:1,bgmSpeed:100,bgmUsePitch:null,cachedBgms:[],cachedBgmCount:8,};this.platform={isOnline:true,isPC:true,isAndroid:false,isIOS:false,string:"PC",isWeChat:false,isQQ:false,isChrome:false,supportCopy:false,fileInput:null,fileReader:null,successCallback:null,errorCallback:null,};this.domStyle={scale:1,ratio:1,hdCanvas:["damage","ui","data"],availableScale:[],isVertical:false,showStatusBar:true,toolbarBtn:false,};this.bigmap={canvas:["bg","event","event2","fg","damage"],offsetX:0,offsetY:0,posX:0,posY:0,width:this.__SIZE__,height:this.__SIZE__,v2:false,threshold:1024,extend:10,scale:1,tempCanvas:null,cacheCanvas:null,};this.saves={saveIndex:null,ids:{},autosave:{data:null,time:0,updated:false,storage:true,max:20,now:0,},favorite:[],favoriteName:{},cache:{}};this.initStatus={played:false,gameOver:false,hero:{},heroCenter:{px:null,py:null},floorId:null,thisMap:null,maps:null,bgmaps:{},fgmaps:{},mapBlockObjs:{},checkBlock:{},damage:{posX:0,posY:0,data:[],extraData:[],},lockControl:false,heroMoving:0,heroStop:true,automaticRoute:{autoHeroMove:false,autoStep:0,movedStep:0,destStep:0,destX:null,destY:null,offsetX:null,offsetY:null,autoStepRoutes:[],moveStepBeforeStop:[],lastDirection:null,cursorX:null,cursorY:null,moveDirectly:false,},downTime:null,ctrlDown:false,preview:{enabled:false,prepareDragging:false,dragging:false,px:0,py:0,},route:[],replay:{replaying:false,pausing:false,animate:false,failed:false,toReplay:[],totalList:[],speed:1,steps:0,save:[],},routeFolding:{},shops:{},event:{id:null,data:null,selection:null,ui:null,interval:null,},autoEvents:[],textAttribute:{position:"center",offset:0,title:[255,215,0,1],background:[0,0,0,0.85],text:[255,255,255,1],titlefont:22,textfont:16,bold:false,time:0,letterSpacing:0,animateTime:0,},globalAttribute:{equipName:main.equipName||[],statusLeftBackground:main.styles.statusLeftBackground||"url(project/materials/ground.png) repeat",statusTopBackground:main.styles.statusTopBackground||"url(project/materials/ground.png) repeat",toolsBackground:main.styles.toolsBackground||"url(project/materials/ground.png) repeat",borderColor:main.styles.borderColor||[204,204,204,1],statusBarColor:main.styles.statusBarColor||[255,255,255,1],floorChangingStyle:main.styles.floorChangingStyle||"background-color: black; color: white",selectColor:main.styles.selectColor||[255,215,0,1],font:main.styles.font||"Verdana"},curtainColor:null,globalAnimateObjs:[],floorAnimateObjs:[],boxAnimateObjs:[],autotileAnimateObjs:[],globalAnimateStatus:0,animateObjs:[],};this.markedFloorIds={};this.status={};this.dymCanvas={};if(main.mode=="editor"){document.documentElement.style.setProperty("--size",this.__SIZE__);document.documentElement.style.setProperty("--pixel",this.__PIXELS__+"px")}}core.prototype.init=function(b,a){this._forwardFuncs();for(var c in b){core[c]=b[c]}this._init_flags();this._init_platform();this._init_others();this._init_plugins();for(var d in core.canvas){if(core.domStyle.hdCanvas.indexOf(d)>=0){core.maps._setHDCanvasSize(core.canvas[d],core.__PIXELS__,core.__PIXELS__)}else{core.canvas[d].canvas.width=core.__PIXELS__;core.canvas[d].canvas.height=core.__PIXELS__}}core.loader._load(function(){core.extensions._load(function(){core._afterLoadResources(a)})});core.dom.musicBtn.style.display="block";core.dom.enlargeBtn.style.display="block";core.setMusicBtn()};core.prototype._init_flags=function(){core.flags=core.clone(core.data.flags);core.values=core.clone(core.data.values);core.firstData=core.clone(core.data.firstData);this._init_sys_flags();window.on=true;window.off=false;window.ture=true;window.flase=false;core.dom.versionLabel.innerText=core.firstData.version;core.dom.logoLabel.innerText=core.firstData.title;document.title=core.firstData.title+" - HTML5魔塔";document.getElementById("startLogo").innerText=core.firstData.title;(core.firstData.shops||[]).forEach(function(n){core.initStatus.shops[n.id]=n});core.maps._initFloors();core.material.enemys=core.enemys.getEnemys();core.material.items=core.items.getItems();core.material.icons=core.icons.getIcons();for(var h in core.floors){var d=core.floors[h].autoEvent||{};for(var j in d){var k=j.split(","),l=parseInt(k[0]),m=parseInt(k[1]);for(var i in d[j]){var a=core.clone(d[j][i]);if(a&&a.condition&&a.data){a.floorId=h;a.x=l;a.y=m;a.index=i;a.symbol=h+"@"+l+"@"+m+"@"+i;a.condition=core.replaceValue(a.condition);a.data=core.precompile(a.data);core.initStatus.autoEvents.push(a)}}}}for(var g in core.material.items){var e=core.material.items[g];if(e.cls!="equips"||!e.equip){continue}if(!e.equip.equipEvent&&!e.equip.unequipEvent){continue}var f="_equipEvent_"+g;var b={symbol:"_equipEvent_"+g,currentFloor:false,multiExecute:true,condition:"core.hasEquip('"+g+"') && !core.hasFlag('"+f+"')",data:core.precompile([{type:"setValue",name:"flag:"+f,value:"true"}].concat(e.equip.equipEvent||[])),};var c={symbol:"_unequipEvent_"+g,currentFloor:false,multiExecute:true,condition:"!core.hasEquip('"+g+"') && core.hasFlag('"+f+"')",data:core.precompile([{type:"setValue",name:"flag:"+f,value:"null"}].concat(e.equip.unequipEvent||[])),};core.initStatus.autoEvents.push(b);core.initStatus.autoEvents.push(c)}core.initStatus.autoEvents.sort(function(n,o){if(n.floorId==null){return 1}if(o.floorId==null){return -1}if(n.priority!=o.priority){return o.priority-n.priority}if(n.floorId!=o.floorId){return core.floorIds.indexOf(n.floorId)-core.floorIds.indexOf(o.floorId)}if(n.x!=o.x){return n.x-o.x}if(n.y!=o.y){return n.y-o.y}return n.index-o.index})};core.prototype._init_sys_flags=function(){if(core.flags.equipboxButton){core.flags.equipment=true}core.flags.displayEnemyDamage=core.getLocalStorage("enemyDamage",true);core.flags.displayCritical=core.getLocalStorage("critical",true);core.flags.displayExtraDamage=core.getLocalStorage("extraDamage",true);core.flags.enableEnemyPoint=core.getLocalStorage("enableEnemyPoint",core.flags.enableEnemyPoint);core.flags.leftHandPrefer=core.getLocalStorage("leftHandPrefer",false);core.flags.extraDamageType=core.getLocalStorage("extraDamageType",0);core.values.moveSpeed=core.getLocalStorage("moveSpeed",core.values.moveSpeed||100);core.values.floorChangeTime=core.getLocalStorage("floorChangeTime",core.values.floorChangeTime);if(core.values.floorChangeTime==null){core.values.floorChangeTime=500}core.flags.enableHDCanvas=core.getLocalStorage("enableHDCanvas",!core.platform.isIOS)};core.prototype._init_platform=function(){core.platform.isOnline=location.protocol.indexOf("http")==0;if(!core.platform.isOnline){alert("请勿直接打开html文件!使用启动服务或者APP进行离线游戏。")}window.AudioContext=window.AudioContext||window.webkitAudioContext||window.mozAudioContext||window.msAudioContext;core.musicStatus.bgmStatus=core.getLocalStorage("bgmStatus",true);core.musicStatus.soundStatus=core.getLocalStorage("soundStatus",true);core.musicStatus.userVolume=core.getLocalStorage("userVolume",0.7);try{core.musicStatus.audioContext=new window.AudioContext();core.musicStatus.gainNode=core.musicStatus.audioContext.createGain();core.musicStatus.gainNode.gain.value=core.musicStatus.userVolume;core.musicStatus.gainNode.connect(core.musicStatus.audioContext.destination)}catch(b){console.log("该浏览器不支持AudioContext");core.musicStatus.audioContext=null}["Android","iPhone","SymbianOS","Windows Phone","iPad","iPod"].forEach(function(c){if(navigator.userAgent.indexOf(c)>=0){if(c=="iPhone"||c=="iPad"||c=="iPod"){core.platform.isIOS=true}if(c=="Android"){core.platform.isAndroid=true}core.platform.isPC=false}});core.platform.string=core.platform.isPC?"PC":core.platform.isAndroid?"Android":core.platform.isIOS?"iOS":"";core.platform.supportCopy=document.queryCommandSupported&&document.queryCommandSupported("copy");var a=/Chrome\/(\d+)\./i.exec(navigator.userAgent);if(a&&parseInt(a[1])>=50){core.platform.isChrome=true}core.platform.isSafari=/Safari/i.test(navigator.userAgent)&&!/Chrome/i.test(navigator.userAgent);core.platform.isQQ=/QQ/i.test(navigator.userAgent);core.platform.isWeChat=/MicroMessenger/i.test(navigator.userAgent);if(window.FileReader){core.platform.fileReader=new FileReader();core.platform.fileReader.onload=function(){core.readFileContent(core.platform.fileReader.result)};core.platform.fileReader.onerror=function(){if(core.platform.errorCallback){core.platform.errorCallback()}}}core.flags.enableHDCanvas=core.getLocalStorage("enableHDCanvas",!core.platform.isIOS);if(main.mode!="editor"){core.domStyle.scale=core.getLocalStorage("scale",1);if(core.flags.enableHDCanvas){core.domStyle.ratio=Math.max(window.devicePixelRatio||1,core.domStyle.scale)}}};core.prototype._init_others=function(){core.material.groundCanvas=document.createElement("canvas").getContext("2d");core.material.groundCanvas.canvas.width=core.material.groundCanvas.canvas.height=32;core.material.groundPattern=core.material.groundCanvas.createPattern(core.material.groundCanvas.canvas,"repeat");core.bigmap.tempCanvas=document.createElement("canvas").getContext("2d");core.bigmap.cacheCanvas=document.createElement("canvas").getContext("2d");core.loadImage("materials","fog",function(b,a){core.animateFrame.weather.fog=a});core.loadImage("materials","cloud",function(b,a){core.animateFrame.weather.cloud=a});core.loadImage("materials","sun",function(b,a){core.animateFrame.weather.sun=a});core.loadImage("materials","keyboard",function(b,a){core.material.images.keyboard=a});core.saves.saveIndex=core.getLocalStorage("saveIndex",1);core.control.getSaveIndexes(function(a){core.saves.ids=a})};core.prototype._afterLoadResources=function(a){core.initStatus.maps=core.maps._initMaps();core.control._setRequestAnimationFrame();(main.splitImages||[]).forEach(function(e){var d=core.getMappedName(e.name);if(!core.material.images.images[d]){console.warn("找不到图片:"+d+",无法裁剪");return}if(!d.endsWith(".png")){console.warn("无法裁剪非png格式图片:"+d);return}var b=core.splitImage(core.material.images.images[d],e.width,e.height);for(var c=0;c<b.length;++c){core.material.images.images[(e.prefix||"")+c+".png"]=b[c]}});if(core.plugin._afterLoadResources){core.plugin._afterLoadResources()}core.showStartAnimate();if(a){a()}};core.prototype._init_plugins=function(){core.plugin=new function(){};for(var b in plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1){if(plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1[b] instanceof Function){try{plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1[b].apply(core.plugin)}catch(a){main.log(a);main.log("无法初始化插件"+b)}}}core._forwardFunc("plugin")};core.prototype._forwardFuncs=function(){for(var a=0;a<main.loadList.length;++a){var b=main.loadList[a];if(b=="core"){continue}this._forwardFunc(b)}};core.prototype._forwardFunc=function(name,funcname){if(funcname==null){for(funcname in core[name]){if(funcname.charAt(0)!="_"&&core[name][funcname] instanceof Function){this._forwardFunc(name,funcname)}}return}if(core[funcname]){console.error("ERROR: 无法转发 "+name+" 中的函数 "+funcname+" 到 core 中!同名函数已存在。");return}var parameterInfo=/^\s*function\s*[\w_$]*\(([\w_,$\s]*)\)\s*\{/.exec(core[name][funcname].toString());var parameters=(parameterInfo==null?"":parameterInfo[1]).replace(/\s*/g,"").replace(/,/g,", ");eval("core."+funcname+" = function ("+parameters+") {\n\treturn core."+name+"."+funcname+"("+parameters+");\n}");if(name=="plugin"){main.log("插件函数转发:core."+funcname+" = core.plugin."+funcname)}};core.prototype.doFunc=function(b,a){if(typeof b=="string"){b=core.plugin[b];a=core.plugin}return b.apply(a,Array.prototype.slice.call(arguments,2))};var core=new core();

Youez - 2016 - github.com/yon3zu
LinuXploit