function ImagePreloader(images,call_back) {this.call_back=call_back;this.nLoaded=0;this.nProcessed=0;this.aImages=[];this.nImages=images.length;for(var i=0;i0) {this.preloader=new ImagePreloader(this.imagesToBePreloaded,null);}} d.dataLoaded=function(f) {this.data=underground.loadedDungeons[this.Name];var scriptsLoaded=function() {d.innerDataLoaded();f();} if(underground.offline) {scriptsLoaded();return;} var scriptLoaded=function() {scriptsToLoadCount--;if(scriptsToLoadCount==0) {scriptsLoaded(f);}} var scripts=[];for(var i in this.data.RequiredScriptNames) {var sn=this.data.RequiredScriptNames[i];if(!(sn in underground.loadedScripts)) {scripts.push(underground.settings.jsBase+sn);}} scriptsToLoadCount=scripts.length;if(scriptsToLoadCount>0) {for(var i in scripts) {var sn=scripts[i];loadScript(sn,function(){underground.loadedScripts[sn]=sn;scriptLoaded();});}} else {scriptsLoaded();}} d.loadData=function(f) {if(underground.offline) {this.dataLoaded(f);} else {loadScript(underground.settings.jsBase+'dungeon.city.'+this.Name+'.js',function(){d.dataLoaded(f);});}} d.createDescriptionPage=function() {var p={Name:'$description',Caption:'Описание',NewLineToBR:this.NewLineToBR,ExternalUrl:'',hidden:true};p.Description=this.Description;this.data.Pages.push(p);this.descriptionPageIndex=this.data.Pages.length-1;} d.createSettingsPage=function() {} d.createShopPages=function() {for(var i in this.data.Shops) {this.createShopPage(this.data.Shops[i]);}} d.getShopItemHtml=function(item,imageBasePath) {var img=[imageBasePath,item.Name,'.gif'].join('');this.imagesToBePreloaded.push(img);var html=['','','',item.Caption,''];if(item.Binding>0) {html.push(' ');} if(item.IsGift) {this.imagesToBePreloaded.push('//img.new-combats.tech/i/podarok.gif');html.push(' ');} html=html.concat(['
',item.Description.join(item.NewLineToBR?'
':''),'']);return html.join('');} var showShopPage=function() {var shop=this.Shop;shop.tdId='$shoptd$'+this.Dungeon.Name+'$'+shop.Name;var firstCat=true;var data=[];var chapters=['
');var html=[shop.Description.join(shop.NewLineToBR?'
':''),'
','
'];html=html.concat(chapters);html=html.concat(['']);html=html.concat(data);html.push('
');this.Description=html;} d.createShopPage=function(shop) {var sp={Name:'$shop$'+shop.Name,Caption:shop.Caption,NewLineToBR:false,ExternalUrl:'',Description:[],OnShow:showShopPage,Dungeon:this,Shop:shop};this.data.Pages.push(sp);} var getCollectiveJobData=function(job) {var title=['',job.Caption,''].join('');var desc=job.Description.join('
');var image=job.ImageUrl;var bonus=job.ItemReward;var count=job.DefCount;var maxFactor=1.25;return{title:title,desc:desc,image:image,bonus:bonus,count:count,maxFactor:maxFactor,iw:60,ih:60};} var getCapturedJobData=function(job) {var title=['',job.Caption,''].join('');var desc=job.Description.join('
');var image=job.ImageUrl;var bonus=job.ItemReward;var count=job.DefCount;var maxFactor=1;return{title:title,desc:desc,image:image,bonus:bonus,count:count,maxFactor:maxFactor,iw:60,ih:60};} var getKillingJobData=function(job) {var mob=underground.mobs[job.MobName];var align=job.Unique?9:0;var title=['',mob.Caption,''].join('');var desc=job.Description.join('
');var image=mob.ImageUrl;if(msie&&!msie7) {image=replacestr(image,'/chars/d/','/chars/');image=replacestr(image,'.png','.gif');} var bonus=(mob.Instances.length==1)?mob.Instances[0].Reward:0;var count=job.Unique?1:job.DefCount;var maxFactor=1;return{title:title,desc:desc,image:image,bonus:bonus,count:count,maxFactor:maxFactor,mob:mob,iw:60,ih:110};} var jobDataProviders=[getCollectiveJobData,getCapturedJobData,getKillingJobData];d.getJobHtml=function(i,job,catIndex) {var data=jobDataProviders[catIndex](job);job.divId=['$job$',d.Name,'$cat_',catIndex,'$index_',i].join('');job.descDivId=job.divId+'$desc';job.formDivId=job.divId+'$form';this.imagesToBePreloaded.push(data.image);var html=['
',data.title,'
','
',data.desc,'
','
'];if('mob'in data) {var rewardid=job.divId+'$reward';var handler=['setTimeout("ui_recalculateMobReward(\'',rewardid,'\''];var lastmii=0;for(var mii=0;mii
');html.push('');for(var mii=0;mii');} html.push('
: ']);if(job.Unique) {html=html.concat(['1']);} else {html=html.concat(['']);} html.push(' шт.
');html.push('Вы получите ');html.push(job.Unique?['',data.mob.Instances[0].Reward,''].join(''):(job.DefCount*data.mob.Instances[lastmii].Reward));html.push(' ед. награды.');html.push('
');if(job.Unique) {html.push('
Уникальное задание, выпадает не более одного раза за круг.');}} else {var countid=job.divId+'$count';var rewardid=job.divId+'$reward';var maxcountid=job.divId+'$maxcount';var maxrewardid=job.divId+'$maxreward';var handler=['setTimeout("ui_recalculateUsualReward(\'',countid,'\', \'',rewardid,'\', \'',maxcountid,'\', ',data.bonus,', ',data.maxFactor,', \'',maxrewardid,'\')", 10)'].join('');html=html.concat(['За шт. Вы получите ',job.DefCount*data.bonus,' ед. награды.']);if(data.maxFactor>1) {var maxc=Math.floor(job.DefCount*data.maxFactor);html=html.concat(['
Можно перевыполнить задание, собрав до ',maxc,' шт., и получив до ',maxc*data.bonus,' ед. награды.']);}} html.push('
');return html.join('');} var jobPageShow=function() {var jobs=this.Dungeon.data.Jobs;this.jobTdId='$jobtd$'+this.Dungeon.Name+'$jobs';var html=[];this.jobCats=[{Name:'CollectiveJobs',Caption:'Собирательные задания',Items:jobs.CollectiveJobs},{Name:'CapturedJobs',Caption:'Задания на трофеи',Items:jobs.CapturedJobs},{Name:'KillingJobs',Caption:'Задания на убийство',Items:jobs.KillingJobs}];html.push('

Задания

');html.push('
');var firstCat=true;var chapters=[];var data=[];chapters.push('
');html.push('
');html.push(chapters.join(''));html.push('');html.push(data.join(''));html.push('
');this.Description=html;} d.prepareJobPage=function() {var jobs=this.data.Jobs;if(jobs.CollectiveJobs.length==0&&jobs.CapturedJobs.length==0&&jobs.KillingJobs.length==0) {return;} var sp={Name:'$jobs$',Dungeon:this,Caption:'Задания',NewLineToBR:false,ExternalUrl:'',Description:[],OnShow:jobPageShow};this.data.Pages.push(sp);} d.getFloorTabsHtml=function() {if(!this.IsDungeon)return'';var html=[];html.push('
  • Описание
  • ');html.push('
  • |
  • ');for(var i in this.data.Floors) {var floor=this.data.Floors[i];html.push('');html.push(floor.Caption);html.push('');} html.push('
  • |
  • ');if(msie)html.push(this.getZoomText());html.push(this.getLookText());return html.join('');} d.openDescription=function() {this.openPage(this.descriptionPageIndex);} d.openSettings=function() {} d.getStatistics=function() {var r={};for(var i in this.data.Floors) {var floor=this.data.Floors[i];var fr=floor.getStatistics();for(var n in fr) {if(!(n in r)) {r[n]={};} var frd=fr[n];for(var level in frd) {if(!(level in r[n])) {r[n][level]=0;} r[n][level]+=frd[level];}}} return r;} d.getStatisticsHtml=function() {if(!this.IsDungeon)return'';var stats=this.getStatistics();var html=[];html.push(getStatisticsHtml('Статистика по подземелью',stats,''));return html.join('');} d.needData=function(f) {if(!('data'in this)) {this.loadData(f);} else {f();}} d.hidePages=function() {for(var i in this.data.Pages) {var page=this.data.Pages[i];var e=document.getElementById(page.divId);if(e!=null) {e.style.display='none';}} document.getElementById('ads').style.display='';} d.getPageDivCloserHtml=function() {var html=[];html.push('
    ');return html.join('');} d.getNewPageDivHtml=function(id,content) {var html=[];var closer=this.getPageDivCloserHtml();html.push('
    ');html.push(closer);html.push(content);html.push(closer);html.push('
    ');return html.join('');} d.getChapterHtml=function() {var html=[];rendered=true;this.handleHash2();underground.settings.look=this.data.Floors[this.activeFloorIndex].LookDirection;html.push('
    ');html.push('

    ');html.push(d.Caption);html.push('

    ');html.push('
      ');html.push(this.getFloorTabsHtml());html.push('
    ');html.push('
    ');html.push('
    ');html.push(this.data.getMapHtml());html.push('
    ');html.push('
    ');html.push(this.getStatisticsHtml());html.push('
    ');html.push('
    ');return html.join('');} d.getZoomText=function() {var html=[];html.push('
  • Масштаб: %
  • ');return html.join('');} d.changeFloor=function(floorIndex) {hideMenu();hidePopup2();var oldActiveFloorIndex=this.activeFloorIndex;this.activeFloorIndex=floorIndex;if(!rendered)return;this.data.Floors[oldActiveFloorIndex].highlightPoint(null);underground.settings.look=this.data.Floors[floorIndex].LookDirection;document.getElementById(this.mapLookId).value=underground.settings.lookTexts[underground.settings.look];document.getElementById(this.floorTabsId).innerHTML=this.getFloorTabsHtml();for(var i in this.data.Floors) {var floor=this.data.Floors[i];var dm=(this.activeFloorIndex==i)?'':'none';document.getElementById(floor.mapId).style.display=dm;}} d.checkStatsMob=function(mobName,mobLevel) {this.data.Floors[this.activeFloorIndex].checkStatsMob(mobName,mobLevel);} d.afterConstruction=function() {this.data.afterConstruction();hideHTextsOf(document.getElementById(this.divId));document.getElementById('ads').style.display='';} d.getHash=function() {var hash=this.Name;hash+='.'+(this.activeFloorIndex+1);if('data'in this) {hash+=this.data.Floors[this.activeFloorIndex].getHash();} return hash;} var doNothing=function() {} d.handleHash2=doNothing;d.handleHash=function(suffix) {var floorPart=suffix;var dotIndex=floorPart.indexOf('&');if(dotIndex>=0) {floorPart=floorPart.substr(0,dotIndex);} var floorIndex=parseInt(floorPart)-1;if(floorIndex>=0&&floorIndex');html.push(page.Caption);html.push('');} return html.join('');} d.pagePreloaded=function(content) {this.imagesToBePreloaded=[];var basee=document.getElementById(this.divId);if(basee.insertAdjacentHTML) {basee.insertAdjacentHTML('beforeEnd',content);} else {basee.innerHTML=basee.innerHTML+content;}} d.openPage=function(pageIndex) {this.hidePages();this.imagesToBePreloaded=[];document.getElementById('ads').style.display='none';if(pageIndex<0)return;var page=this.data.Pages[pageIndex];var e=document.getElementById(page.divId);if(e==null) {var sep=(page.NewLineToBR)?'
    ':'';if('OnShow'in page) {page.OnShow();} var content=page.Description.join(sep);if(content==''&&page.ExternalUrl!='') {content=loadXMLDoc2(page.ExternalUrl);} content=this.getNewPageDivHtml(page.divId,content);if(msie&&!msie7&&this.imagesToBePreloaded.length>0) {this.preloader=new ImagePreloader(this.imagesToBePreloaded,function(){d.pagePreloaded(content);});} else {d.pagePreloaded(content);} return;} e.style.display='';} d.getCellContentMenuHtml=function(cellDivId,x,y) {return this.data.Floors[this.activeFloorIndex].getCellContentMenuHtml(cellDivId,x,y);} d.hotSpot=function(cellDivId) {this.data.Floors[this.activeFloorIndex].hotSpot(cellDivId);} d.hideHotSpots=function() {if(this.IsDungeon&&('data'in this)) {this.data.Floors[this.activeFloorIndex].hideHotSpots();}} d.getLookOption=function(index,caption) {var html=[];html.push('');return html.join('');} d.getLookText=function() {if(!this.IsDungeon)return'';var html=[];html.push('
  • Смотрим на ');html.push('
  • ');return html.join('');} d.getProposedZoom=function() {var v=document.getElementById(this.zoomerId).value;var pv=underground.settings.zoom;if(!isNaN(v)) {pv=parseInt(v);if(isNaN(pv))pv=underground.settings.zoom;if(pv<10)pv=10;if(pv>300)pv=300;} if(pv!=v)document.getElementById(this.zoomerId).value=pv;return pv;} d.applyZoom=function(zoomFactor) {if(!('data'in this))return;document.getElementById(this.zoomerId).value=zoomFactor;for(var i in this.data.Floors) {this.data.Floors[i].applyZoom(zoomFactor);}} d.highlightPoint=function(point) {this.data.Floors[this.activeFloorIndex].highlightPoint(point);}} function FloorExtender(d,i,f) {f.dungeon=d;f.index=i;var baseId='dungeon_'+d.Name+'_floor_'+f.Name+'_';f.mapId=baseId+'map';f.mapViewId=baseId+'mapView';f.xaxisId=baseId+'xaxis';f.yaxisId=baseId+'yaxis';f.cellPrefix=baseId+'cell';f.statisticsCheckId=baseId+'statsCheck';f.highlightPointId=baseId+'highlightPoint';f.rightPartId=baseId+'rightPart';f.markers=[];f.highlightPoint=function(point) {var hd=document.getElementById(this.highlightPointId);if(hd==null)return;var hdStyle=hd.style;if(point==null) {hdStyle.visibility='hidden';return;} var pt=underground.getIPoint(point);hdStyle.left=((pt.x+1)*underground.settings.cellWidth-underground.settings.cellLocationShift).toString()+'px';hdStyle.top=((pt.y+1)*underground.settings.cellHeight-underground.settings.cellLocationShift).toString()+'px';hdStyle.visibility='';if(document.body.createTextRange) {var trange=document.body.createTextRange();if(trange.moveToElementText&&trange.scrollIntoView) {trange.moveToElementText(hd);trange.scrollIntoView();}}} f.getLookPoint=function(x,y) {var pt={x:x,y:y};switch(underground.settings.rotation) {case 1:pt.x=y;pt.y=this.Height-x;break;case 2:pt.x=this.Width-x;pt.y=this.Height-y;break;case 3:pt.x=this.Width-y;pt.y=x;break;case 0:break;default:break;} return pt;} f.getLookDim=function() {switch(underground.settings.rotation) {case 0:return{xalpha:true,xinv:false,yinv:false,w:this.Width,h:this.Height};case 3:return{xalpha:false,xinv:false,yinv:true,w:this.Height,h:this.Width};case 1:return{xalpha:false,xinv:true,yinv:false,w:this.Height,h:this.Width};case 2:return{xalpha:true,xinv:true,yinv:true,w:this.Width,h:this.Height};}} f.getMapHtml=function() {var dm=(this.dungeon.ui.activeFloorIndex==this.index)?'':'none';var dim=this.getLookDim();var html=['
    '];if(underground.offline) {html.push('
    ');} html=html.concat(['
    ');html.push('
    ');var xshift=(!msie||msie7)?10:0;var startLetterCode='A'.charCodeAt(0);for(var i=0;i');html.push(vs);html.push('
    ');} html=html.concat(['
    ','
    ']);html.push('
    ');var yshift=(!msie||msie7)?10:0;for(var i=0;i');html.push(vs);html.push('
    ');} html=html.concat(['
    ','']);for(var i in this.Cells) {html.push(this.getCellHtml(this.Cells[i]));} html.push('');for(var i=0;i');if(underground.offline) {html.push('
    ');} html.push('
    ');html.push(this.getRightPartHtml());html.push('
    ');html.push('
    ');html.push(this.getStatisticsHtml());html.push('
    ');html.push('
    ');return html.join('');} f.getRightPartHtml=function() {var html=[];html.push('
    ');this.floorNavId=baseId+'mapsNav';html.push('
    Этажи
    ');for(var i in underground.knownDungeons) {var kd=underground.knownDungeons[i];var floorCount=kd.FloorNames.length;if(floorCount>1) {html.push('
    ');html.push(kd.Caption);html.push('
    ');} else {if(kd==this.dungeon.ui) {html.push('
    ');html.push(kd.Caption);html.push('
    ');} else {html.push('
    ');html.push(kd.Caption);html.push('
    ');}}} html.push('
    Скрыть
    ') html.push('
    ');return html.join('');} f.applyZoom=function(zoomFactor) {document.getElementById(this.mapViewId).style.zoom=(zoomFactor+'%');var dim=this.getLookDim();var pos=(dim.w+2)*underground.settings.cellWidth;pos=Math.floor((pos*zoomFactor)/100);document.getElementById(this.rightPartId).style.left=pos+'px';} f.getStatisticsHtml=function() {var stats=this.getStatistics();return getStatisticsHtml('Статистика по этажу',stats,this.statisticsCheckId);} f.getBorderStyleHtml=function(code,size) {return['border-',code,':',size,'px ',((size<1)?'none':'solid'),' ',this.dungeon.CellBorderColorString,';','padding-',code,':',(2-size),'px;'].join('');} f.getCellDivId=function(x,y) {return[this.cellPrefix,x,'.',y].join('');} f.getCellHtml=function(cell) {cell.divId=this.getCellDivId(cell.X,cell.Y);var pt=this.getLookPoint(cell.X,cell.Y);var st=['background-color:',((cell.BackColorString!='Transparent')?cell.BackColorString:this.dungeon.CellBackgroundColorString),'; position: absolute;border-collapse: collapse;','left:',((pt.x+1)*underground.settings.cellWidth-underground.settings.cellLocationShift),'px;','top:',((pt.y+1)*underground.settings.cellHeight-underground.settings.cellLocationShift),'px;','width:',(underground.settings.cellWidth-underground.settings.cellSizeShift),'px;','height:',(underground.settings.cellHeight-underground.settings.cellSizeShift),'px;',this.getBorderStyleHtml('left',cell.Border.Left),this.getBorderStyleHtml('top',cell.Border.Top),this.getBorderStyleHtml('right',cell.Border.Right),this.getBorderStyleHtml('bottom',cell.Border.Bottom)];var html=['
    ');for(var i in cell.ObjectRefs) {var objref=cell.ObjectRefs[i];objref.divId=cell.divId+'_obj'+i;var oidata=underground.findObjectAndInstance(objref.ObjectName,objref.InstanceName);var o=oidata.obj;st=['position: absolute;z-index:1;','left:',o.ML,'px;','top:',o.MT,'px;','width:',o.MW,'px;','height:',o.MH,'px;'];var popuphtml=';';var mouseouthtml=';';if(oidata.instance.Description.length>0||o.Description.length>0) {popuphtml=['underground.showObjRefPopup(\'',objref.ObjectName,'\', \'',objref.InstanceName,'\')'].join('');mouseouthtml='hidePopup2()';} var image=underground.getCellObjectInstanceImage(o,oidata.instance);if(o.Importance==0) {st.push(underground.decoratedOpacityStyle);} if(oidata.instance.HighlightColorString!='Transparent') {if(msie) {st=st.concat(['filter:glow(color=\'',oidata.instance.HighlightColorString,'\', strength=4);']);} else {st=st.concat(['border: 1px solid ',oidata.instance.HighlightColorString,';']);}} html=html.concat(['');} for(var i in cell.MobRefs) {var mpt=getMobPoint(i,cell.MobRefs.length);st=[];var mobref=cell.MobRefs[i];mobref.divId=cell.divId+'_mob'+i;var midata=underground.findMobAndInstance(mobref.Name,mobref.Level,mobref.Align,mobref.Tag);var image=underground.getMobInstanceImage(midata.mob,midata.mi);html=html.concat(['']);} html.push('
    ');return html.join('');} f.highlightMobs=function(cell,mobName,mobLevel,v) {var color=underground.settings.levelColors[mobLevel];var filterStr=['glow(color=\'',color,'\', strength=5)'].join('');for(var i in cell.MobRefs) {var mobref=cell.MobRefs[i];if(mobref.Name!=mobName||mobref.Level!=mobLevel) {continue;} var div=document.getElementById(mobref.divId);if(v) {if(msie) {div.style.filter=filterStr;} else {div.style.borderStyle='solid';div.style.borderWidth='2px';div.style.borderColor=color;}} else {if(msie) {div.style.filter='';} else {div.style.borderStyle='none';div.style.borderWidth='0px';div.style.borderColor='transparent';}}}} f.checkStatsMob=function(mobName,mobLevel,depth) {var stats=this.getStatistics();if(!(mobName in stats))return;if(mobLevel!=0&&!(mobLevel in stats[mobName]))return;var cid=getStatisticsCheckId(this.statisticsCheckId,mobName,mobLevel);var v=document.getElementById(cid).checked;if(mobLevel==0) {for(var lvl in stats[mobName]) {var chkl=document.getElementById(getStatisticsCheckId(this.statisticsCheckId,mobName,lvl));if(chkl==null)continue;chkl.checked=v;this.checkStatsMob(mobName,lvl,true);} return;} for(var i in this.Cells) {this.highlightMobs(this.Cells[i],mobName,mobLevel,v);} if(depth!=null&&mobLevel!=0) {var ok=true;var gid=getStatisticsCheckId(this.statisticsCheckId,mobName,0);for(var lvl in stats[mobName]) {var id=getStatisticsCheckId(this.statisticsCheckId,mobName,mobLevel);if(!document.getElementById(id).checked) {ok=false;break;}} document.getElementById(gid).checked=ok;}} f.getStatistics=function() {var r={};for(var i in this.Cells) {var cell=this.Cells[i];for(var j in cell.MobRefs) {var mobref=cell.MobRefs[j];if(!(mobref.Name in r)) {r[mobref.Name]={};} if(!(mobref.Level in r[mobref.Name])) {r[mobref.Name][mobref.Level]=0;} r[mobref.Name][mobref.Level]+=mobref.Count;}} return r;} f.showCellMarkerPopup=function(markerIndex) {showPopup('
    Заметки на полях
    '+htmlstring(this.markers[markerIndex].text));} f.getHash=function() {var r=[];for(var i=0;i'].join('');return content;} f.toggleCellMarker=function(cellDivId,x,y) {var markerId=cellDivId+'_marker';var mdiv=document.getElementById(markerId);if(mdiv!=null&&mdiv.style.visibility=='') {for(var i=0;i');html.push(getRowMenuItemHtml('Поставить/снять маркер','ui_toggleCellMarker(\''+cellDivId+'\','+x+','+y+')'));html.push(getRowMenuSeparatorHtml());html.push(getRowMenuItemHtml('Закрыть','hideMenu()'));html.push('');return html.join('');} f.findCellByDivId=function(cellDivId) {for(var i in this.Cells) {var cell=this.Cells[i];if(cell.divId==cellDivId) {return cell;}} return null;} f.findCellByRef=function(cellRef) {for(var i in this.Cells) {var cell=this.Cells[i];if(cell.X==cellRef.X&&cell.Y==cellRef.Y) {return cell;}} return null;} f.hotSpot=function(cellDivId) {var cell=this.findCellByDivId(cellDivId);if(cell==null)return;for(var i in cell.HotSpots) {var hotSpot=cell.HotSpots[i];hotSpot.divId=cellDivId+'_hotSpot'+i;var opac=hotSpot.Opacity;var color=hotSpot.HighlightColorString;var imageUrl=hotSpot.ImageUrl;if(imageUrl=='') {imageUrl=underground.settings.blankImageUrl;} for(var j in hotSpot.CellRefs) {var markerId=hotSpot.divId+'_mark'+j;var marker=document.getElementById(markerId);if(marker!=null) {marker.style.visibility='';continue;} var html=[];var cref=hotSpot.CellRefs[j];var tcell=this.findCellByRef(cref);var te=document.getElementById(tcell.divId);if(te==null)continue;html.push('
    ');html=html.join('');if(te.insertAdjacentHTML) {te.insertAdjacentHTML('beforeEnd',html);} else {te.innerHTML=te.innerHTML+html;}}}} f.hideHotSpots=function() {for(var i in this.Cells) {var cell=this.Cells[i];for(var i in cell.HotSpots) {var hotSpot=cell.HotSpots[i];if(!('divId'in hotSpot))continue;var hotSpotId=hotSpot.divId;for(var j in hotSpot.CellRefs) {var markerId=hotSpot.divId+'_mark'+j;var marker=document.getElementById(markerId);if(marker!=null) {marker.style.visibility='hidden';}}}}}} function LoadedDungeonEntender(d) {d.IsDungeon&=(d.Floors.length>0);for(var i in d.Floors) {var f=d.Floors[i];FloorExtender(d,i,f);} d.getMapHtml=function() {var html=[];for(var i in this.Floors) {var f=d.Floors[i];html.push(f.getMapHtml());} return html.join('');} d.afterConstruction=function() {}} function CustomResource() {this.Description=[];this.NewLineToBR=true;this.activeFloorIndex=0;this.rotation=0;this.FloorCount=1;this.getChapterHtml=function() {return'';} this.afterConstruction=function() {} this.getHash=function() {return this.Name;} this.handleHash=function(suffix) {} this.changeFloor=function(floorIndex) {} this.getUndergroundTabsHtml=function() {return'';} this.hidePages=function() {} this.needData=function(f) {f();} this.getCellContentMenuHtml=function(cellDivId,x,y) {return'';} this.hotSpot=function(cellDivId) {} this.hideHotSpots=function() {} this.getProposedZoom=function() {return underground.settings.zoom;} this.applyZoom=function(zoomFactor) {} this.highlightPoint=function(point) {}} function ExternalResource(url,caption,desc,newLineToBR) {this.Url=url;this.Caption=caption;this.Description=desc;this.NewLineToBR=newLineToBR;this.desc=desc.join(newLineToBR?'
    ':'');} function CustomFloor(d,i,name,description,newLineToBR) {this.dungeon=d;this.index=i;this.Name=name;this.Description=description;this.NewLineToBR=newLineToBR;this.mapId='dungeon_'+d.Name+'_floor_'+this.Name+'_map';this.getMapHtml=function() {var html=[];var dm=(this.dungeon.ui.activeFloorIndex==this.index)?'':'none';html.push('
    ');html.push(this.Description.join(this.NewLineToBR?'
    ':''));html.push('
    ');return html.join('');} this.getStatisticsHtml=function() {return'';} this.getStatistics=function() {return{};} this.getCellContentMenuHtml=function(cellDivId,x,y) {var html=[];html.push('');html.push(getRowMenuItemHtml('Закрыть','hideMenu()'));html.push('
    ');return html.join('');} this.hotSpot=function(cellDivId) {} this.hideHotSpots=function() {} this.getHash=function() {return'';} this.handleHash=function(hash) {}} function WelcomeDungeon() {this.baseConstructor=CustomResource;this.baseConstructor();this.Name='welcome';this.Caption='Стартовая';this.showDescription=function(s) {document.getElementById('welcomeDungeon_descriptionArea').innerHTML=s;} this.getMenuItemHtml=function(d,di,popupFuncName,openFuncName,url) {var target=' target="_blank"';if(url==null){url='javascript:;';target='';} return['
  • ',d.Caption,'
  • '].join('');} this.getChapterHtml=function() {var html=[];html.push('


    Добро пожаловать в ресурс о Подземельях Бойцовского Клуба.

    ');html.push('

    Пожалуйста, выберите одно из подземелий:

    ');html.push('
      ');for(var di in underground.knownDungeons) {var d=underground.knownDungeons[di];if(!d.IsDungeon)continue;html.push(this.getMenuItemHtml(d,di,'underground.showDungeonPopup','underground.openDungeon'));} html.push('
    ');html.push('

    Или один из дополнительных ресурсов:

    ');html.push('
      ');for(var di in underground.resources) {var d=underground.resources[di];html.push(this.getMenuItemHtml(d,di,'underground.showResourcePopup','underground.openResource'));} html.push('
    '); html.push('
     
    ');return html.join('');}} function DiggerConst() {this.baseConstructor=CustomResource;this.baseConstructor();this.Description=['Устали рыться в пергаментах с рецептами, постоянно путаетесь в мешочках с ингредиентами, потеряли ступку с колбами?','Хм, что ж. В помощь юному алхимику подготовлен удобный ресурс, с полной базой рецептов и предметов.','Завтра, включив компьютер, вы будете точно знать, что еще необходимо собрать.'];this.Name='diggerconst';this.Caption='Конструктор диггера';this.tabIndex=0;this.imagesToBePreloaded=[];this.divId='diggerConstructorAll';this.tabsId='diggerConstructorTabs';this.knapsackId='diggerConstructorKnapsack';this.recipesId='diggerConstructorRecipes';this.allRecipes1Id='diggerConstructorAllRecipes1';this.allRecipesView1Id='diggerConstructorAllRecipesView1';this.allRecipesItem1Id='diggerConstructorAllRecipesItem1';this.allRecipes2Id='diggerConstructorAllRecipes2';this.allRecipesView2Id='diggerConstructorAllRecipesView2';this.allRecipesItem2Id='diggerConstructorAllRecipesItem2';this.allItemsId='diggerConstructorAllItems';this.allItemsViewId='diggerConstructorAllItemsView';this.allItemsItemId='diggerConstructorAllItemsItem';this.basketId='diggerConstructorBasket';this.basketItemsViewId='diggerConstructorBasketItemsView';this.basketSummaryId='diggerConstructorBasketSummaryId';this.tabIds=[this.knapsackId,this.recipesId,this.allRecipes1Id,this.allRecipes2Id,this.allItemsId,this.basketId];this.itemViewIds=[null,null,this.allRecipesItem1Id,this.allRecipesItem2Id,this.allItemsItemId,null];this.knapsackViewId='diggerConstructorKnapsackView';this.knapsackImportDialogId='diggerConstructorKnapsackImportDialog';this.knapsackImportDialogTextId='diggerConstructorKnapsackImportDialogText';this.knapsackImportDialogLabelId='diggerConstructorKnapsackImportDialogLabel';this.knapsackAddIngrDialogId='diggerConstructorKnapsackAddIngrDialogId';this.knapsackAddIngrDialogLabelId='diggerConstructorKnapsackAddIngrDialogLabelId';this.knapsackAddIngrDialogIngrId='diggerConstructorKnapsackAddIngrDialogIngrId';this.knapsackAddIngrDialogCountId='diggerConstructorKnapsackAddIngrDialogCountId';this.knapsackTableId='diggerConstructorKnapsackTable';this.availIngrId='diggerConstructor_availIngr';this.availRecipesId='diggerConstructor_availRecipes';this.chosenIngrId='diggerConstructor_chosenIngr';this.chosenRecipesId='diggerConstructor_chosenRecipes';this.isChest=false;this.toInvPhrase='В инвентарь ';this.wearPhrase='надеть ';this.reCount=/^\(X([0-9]+)\)/;this.knapsack={};this.items={};this.components={};this.availi={};this.availr=[];this.choseni={};this.chosenr=[];this.recipes=[];this.basket=[];this.loadCostructorData=function(d) {this.data=d;this.collectDiggerItems();} this.collectDiggerItems=function() {for(var cati=this.data.Categories.length-1;cati>=0;cati--) {var cat=this.data.Categories[cati];cat.hasRecipes=false;for(var i=cat.Items.length-1;i>=0;i--) {var itm=cat.Items[i];itm.Category=cat;cat.hasRecipes|=(itm.Recipes.length>0);this.items[itm.Name]=itm;}} for(var i in this.items) {var itm=this.items[i];for(var ri=itm.Recipes.length-1;ri>=0;ri--) {var r=itm.Recipes[ri];r.Item=itm;this.recipes.push(r);for(var pi=r.RecipeParts.length-1;pi>=0;pi--) {var rp=r.RecipeParts[pi];this.components[rp.Item]=this.items[rp.Item];if(!('usedIn'in this.components[rp.Item])) {this.components[rp.Item].usedIn={};} this.components[rp.Item].usedIn[itm.Name]={recipe:r,count:rp.Count};}}}} this.dataLoaded=function(f) {this.data.ui=this;if(this.imagesToBePreloaded.length>0) {this.preloader=new ImagePreloader(this.imagesToBePreloaded,null);} f();} this.loadData=function(f) {var d=this;var sn='dungeon.constructor.js';if(!underground.offline&&!(sn in underground.loadedScripts)) {loadScript(underground.settings.jsBase+sn,function(){underground.loadedScripts[sn]=sn;d.dataLoaded(f);});} else {d.dataLoaded(f);}} this.needData=function(f) {if(!('data'in this)) {this.loadData(f);} else {f();}} this.finalizeAvailableRecipes=function() {} this.probeRecipe=function(r) {if(r.RecipeParts.length<=0)return;var count=65535;for(var i=r.RecipeParts.length-1;i>=0;i--) {var rp=r.RecipeParts[i];var mater=this.findDiggerItem(rp.Item);if(!mater.IsGift&&(mater.Binding==0)&&((rp.Binding==0||rp.Binding==4))) {continue;} if(!(rp.Item in this.availi))return;var rpCount=this.availi[rp.Item]/rp.Count;if(rpCount0) {this.availr.push({recipe:r,count:count});}} this.prepareAvailableRecipes=function() {this.availi={};this.choseni={};for(var n in this.knapsack) {this.availi[this.knapsack[n].name]=this.knapsack[n].total;} this.finalizeAvailableRecipes();this.availr=[];this.chosenr=[];for(var i=this.recipes.length-1;i>=0;i--) {this.probeRecipe(this.recipes[i]);} this.refreshRecipesTab();} this.changeDiggerTab=function(index) {this.tabIndex=index;var activeDivId=this.tabIds[index];var divs=document.getElementById(this.divId).childNodes;for(var i=0;i');html.push(caption);html.push('');return html.join('');} this.loadKnapsack=function(isChest) {this.isChest=isChest;document.getElementById(this.knapsackImportDialogLabelId).innerHTML=isChest?'сундука':'рюкзака';document.getElementById(this.knapsackImportDialogTextId).value='';document.getElementById(this.knapsackAddIngrDialogId).style.visibility='hidden';document.getElementById(this.knapsackImportDialogId).style.visibility='';} this.loadKnapsackCancel=function() {document.getElementById(this.knapsackImportDialogTextId).value='';document.getElementById(this.knapsackImportDialogId).style.visibility='hidden';} this.loadKnapsackOK=function() {this.parseKnapsackFor(this.isChest,document.getElementById(this.knapsackImportDialogTextId).value);this.loadKnapsackCancel();} this.addToKnapsack=function(isChest) {this.isChest=isChest;document.getElementById(this.knapsackAddIngrDialogLabelId).innerHTML=isChest?'сундук':'рюкзак';document.getElementById(this.knapsackAddIngrDialogCountId).value='1';document.getElementById(this.knapsackImportDialogId).style.visibility='hidden';document.getElementById(this.knapsackAddIngrDialogId).style.visibility='';} this.addKnapsackOK=function() {var so=document.getElementById(this.knapsackAddIngrDialogIngrId);var cov=document.getElementById(this.knapsackAddIngrDialogCountId).value;if(so.selectedIndex>=0&&!isNaN(cov)&&parseInt(cov)>0) {this.addIngr(this.isChest,so.options[so.selectedIndex].value,parseInt(cov));} this.addKnapsackCancel();} this.addKnapsackCancel=function() {document.getElementById(this.knapsackAddIngrDialogId).style.visibility='hidden';} this.getDiggerTabsHtml=function() {var html=[];html.push('
      ');html.push(this.getDiggerTabHtml('Ваш инвентарь',0));html.push(this.getDiggerTabHtml('Подбор рецептов',1));html.push(this.getDiggerTabHtml('Рецепты по месту сбора',2));html.push(this.getDiggerTabHtml('Рецепты по категории предметов',3));html.push(this.getDiggerTabHtml('Все предметы',4));html.push(this.getDiggerTabHtml('Корзина',5));html.push('
    ');return html.join('');} this.findDiggerItem=function(id) {return this.items[id];} this.cleanKnapsackFor=function(isChest,refresh) {var r={};var vn=isChest?'chest':'knapsack';for(var i in this.knapsack) {var itm=this.knapsack[i];itm.total-=itm[vn];itm[vn]=0;if(itm.total==0) {continue;} r[i]=itm;} this.knapsack=r;if(refresh) {this.refreshKnapsackTab();}} this.parserTrim=function(value) {return value.replace(/^\s+|\s*([\+\,>\s;:])\s*|\s+$/g,"$1");} this.refreshKnapsackTab=function() {document.getElementById(this.knapsackViewId).innerHTML=this.getKnapsackTableHtml();} this.parseKnapsackFor=function(isChest,text) {var vn=isChest?'chest':'knapsack';this.cleanKnapsackFor(isChest,false);var lines=text.split("\n");for(var i=0;ithis.knapsack[name][vn])count=this.knapsack[name][vn];if((-count)>this.knapsack[name].total)count=this.knapsack[name].total;this.knapsack[name][vn]+=count;this.knapsack[name].total+=count;if(this.knapsack[name].total<=0) {delete this.knapsack[name];} this.refreshKnapsackTab();} this.findRecipePlace=function(name) {var arp=this.data.RecipePlaces;for(var i=arp.length-1;i>=0;i--) {var rp=arp[i];if(rp.Name==name)return rp;} return null;} this.getItemRecipeHtml=function(recipe) {var html=[];var place=this.findRecipePlace(recipe.PlaceName);if(place==null)return'bad place';var arp=recipe.RecipeParts;html.push('
    ');html.push(place.Caption);html.push('');if(recipe.Price>0) {html.push('
    ');html.push('Стоимость сборки: ');html.push(recipe.Price);html.push(' кр.
    ');} for(var i=0;i');html.push(mater.Caption);html.push(': ');html.push(rp.Count);html.push('шт.');} html.push('
    ');return html.join('');} this.getItemDescHtml=function(name) {var item=this.findDiggerItem(name);var html=[];var img=[item.Category.ImageBasePath,item.Name,'.gif'].join('');html.push('
    ');html.push(item.Caption);if(item.Binding>0) {html.push(' ');} if(item.IsGift) {html.push(' ');} html.push('
    ');html.push('
    ');html.push('');html.push(item.Description.join(item.NewLineToBR?'
    ':''));html.push('
    ');if(('Recipes'in item)&&(item.Recipes.length>0)) {html.push('
    ');for(var ri in item.Recipes) {html.push(this.getItemRecipeHtml(item.Recipes[ri]));} html.push('
    ');} if('usedIn'in item) {html.push('');for(var ui in item.usedIn) {var uitem=this.findDiggerItem(ui);var place=this.findRecipePlace(item.usedIn[ui].recipe.PlaceName);html.push('');} html.push('
    Используется для создания: ');html.push(uitem.Caption);html.push(' в количестве ');html.push(item.usedIn[ui].count);html.push('шт., в ');if(place==null)html.push('bad place');else html.push(place.Caption);html.push('.
    ');} return html.join('');} this.showItemInView=function(name) {var vid=this.itemViewIds[this.tabIndex];if(vid==null)return;var ve=document.getElementById(vid);if(ve==null)return;ve.innerHTML=this.getItemDescHtml(name);} this.showItemPopup=function(name) {var html=[];html.push('
    ');html.push(this.getItemDescHtml(name));html.push('
    ');showPopup(html.join(''));} this.getKnapsackTableHtml=function() {var materCount=0;var html=[];html.push('');for(var materi in this.knapsack) {var materd=this.knapsack[materi];var matern=materd.name;var mater=this.findDiggerItem(matern);html.push('');materCount++;} if(materCount==0) {html.push('');} html.push('
    ');html.push(mater.Caption);html.push('Всего: ');html.push(materd.total);html.push('шт.
    В рюкзаке: ');html.push(materd.knapsack);html.push('шт.');html.push(' +');if(materd.knapsack>0) {html.push(' -');} html.push('В сундуке: ');html.push(materd.chest);html.push('шт.');html.push(' +');if(materd.chest>0) {html.push(' -');} html.push('
    Инвентарь не содержит ингредиентов и других компонентов.
    ');return html.join('');} this.getComponentOptions=function() {var html=[];for(var cati=0;cati');chtml.push(itm.Caption);chtml.push('');} if(chtml.length>0) {html.push('');html.push(chtml.join(''));html.push('');}} return html.join('');} this.getKnapsackTabHtml=function() {var html=[];html.push('
    ');html.push('');html.push('');html.push('
    ');html.push('
    ');html.push(this.getKnapsackTableHtml());html.push('
    ');html.push(' ');html.push(' ');html.push(' ');html.push(' ');html.push(' ');html.push(' ');html.push(' ');html.push('
    ');return html.join('');} this.refreshRecipesTab=function() {document.getElementById(this.availIngrId).innerHTML=this.getIngrTable(this.availi,'Доступные компоненты');document.getElementById(this.availRecipesId).innerHTML=this.getRecipeTable(this.availr,true,'Доступные рецепты');document.getElementById(this.chosenIngrId).innerHTML=this.getIngrTable(this.choseni,'Использованные компоненты');document.getElementById(this.chosenRecipesId).innerHTML=this.getRecipeTable(this.chosenr,false,'Выбранные рецепты');} this.getRecipesTabHtml=function() {var html=[];html.push('');return html.join('');} this.getIngrTable=function(va,title) {var html=[];var count=0;html.push('');if(title!=null) {html.push('');} for(var n in va) {html.push('');html.push(mater.Caption);html.push('');html.push(va[n]);html.push('шт.');count++;} if(count==0) {html.push('');} html.push('
    ');html.push(title);html.push('
    Нет ингредиентов или других компонентов.
    ');return html.join('');} this.getRecipeTable=function(va,additive,title) {var html=[];var count=0;html.push('');if(title!=null) {html.push('');html.push(title);html.push('');} for(var n in va) {html.push('');if(place==null)html.push('bad place');else html.push(place.Caption);html.push(': ');html.push(mater.Caption);html.push('');if(additive!=null) {if(additive==false||additive==true||additive=='4basket') {html.push('');html.push((rd.count<65535)?rd.count:'?');html.push('шт.');} html.push('');} html.push('');count++;} if(count==0) {html.push('');} html.push('
    ');if(additive=='2basket') {html.push('Добавить');} else if(additive=='4basket') {html.push('Убрать');} else if(additive==true) {html.push('Добавить');} else {html.push('Убрать');} html.push('
    Нет рецептов.
    ');return html.join('');} this.getSpliceArray=function(a,index) {var r=[];for(var i=0;i=0) {to[i].count++;} else {to.push({recipe:recipe,count:1});} if(from[index].count==0) {from=this.getSpliceArray(from,index);if(additive)this.availr=from;else this.chosenr=from;} from=additive?this.availi:this.choseni;to=additive?this.choseni:this.availi;for(var i=0;i