"),e=f("
OK
");d.html(a),c.append(d),c.append(e),f("#DialogUI").append(c),f("#DialogUI").show(),c.fadeIn(300),e.click(function(){f("#DialogUI").hide(),c.remove()}),c.draggable({scroll:!1}),b?$e.positionMouseCenter(c):$e.centerOnScreen(c),$e.monitorPosition(c)}},rf={storageKey:"usersettingsv18",UserSettings:{Region:null,AutoDetect:!0,MaxTankTier:"0",ColorBlind:!1,ColorMe:"#d2b48c",ColorTeam:"#00b3ff",ColorEnemy:"#e90c1c",ColorAlphaMe:.2,ColorAlphaTeam:.8,ColorAlphaEnemy:0,ColorCrosshair:"#11ff00",HelperScaleMe:1.3,HelperScaleTeam:.65,HelperScaleEnemy:.65,HelperControls:!0,HelperSpawn:!0,VolumeMute:!1,VolumeMaster:.75,VolumeGame:.75,VolumeMusic:.5,VolumeAnnouncer:.5,VolumeUI:.5,VolumeMeEngine:.5,VolumeMeShoot:.5,MusicPitch:1,UseRAF:!0,ShowFPS:!0,MaxFPS:180,RenderQuality:1,AdvancedControls:!1,SimulateCarControls:!1,Input_WeaponReload:82,Input_Chat:13,Input_ChatTeam:85,Input_ChatParty:73,Input_ChatQuickView:90,Input_ToggleScoreBoard:9,Input_Forward:87,Input_Backward:83,Input_Left:65,Input_Right:68,Input_Forward2:38,Input_Backward2:40,Input_Left2:37,Input_Right2:39,Input_EnterEject:70,Input_AbilitySlot1:49,Input_AbilitySlot2:50,Input_AbilitySlot3:51,Input_AbilitySlot4:52,Input_AbilitySlot5:53,Input_AbilitySlot6:54},init:function(){for(var a in Dd.PowerUps){this.UserSettings["Input_Ability_"+Dd.PowerUps[a].id]=0}this.loadUserSettings(),Wc=this.UserSettings["RenderQuality"],Dd.Gameloop.LoadFPSSettings(),Dd.InputManager.UpdateOverrideKeys(),Dd.Crosshair.updateColor(),this.initVolumeSettings()},initVolumeSettings:function(){g.volume(0);var a=function(b){if(!b){g.volume(0);var c=!(!(!g.usingWebAudio||g.masterGain&&g.masterGain.gain)||!Dd.started);return void u(function(){a(c)},500)}g.finallyStarted=!0,u(function(){Dd.Audio.Update(),g.usingWebAudio&&(pf.initMusic(),Dd.Audio.Update())},100)};a()},loadUserSettings:function(){if(!this.DefaultUserSettings){var a=JSON.stringify(this.UserSettings);this.DefaultUserSettings=JSON.parse(a)}if("undefined"!=typeof Storage){var a=localStorage.getObject(this.storageKey);if(a)for(var b in a)void 0!==this.UserSettings[b]&&(this.UserSettings[b]=a[b])}},saveUserSettings:function(){"undefined"!=typeof Storage&&localStorage.setObject(this.storageKey,this.UserSettings)}},sf=function(){var b={},c=this.container=new a.UI.Container(294,23);c.anchorRight=0,c.anchorTop=-30;var d=new a.UI.SliceSprite(cf,6,(!0),(!0));d.width=294,d.height=23,d.alpha=.2,d.tint=0,d.anchorRight=0;var e=new a.UI.SliceSprite(new a.Texture.fromFrame("UI/Menu/Wallet/background.png"),24,(!0),(!1));e.width="42%",e.alpha=.25,e.anchorRight=0;var f=new a.UI.SliceSprite(new a.Texture.fromFrame("UI/Menu/Wallet/background.png"),24,(!0),(!1));f.width="73%",f.alpha=.3,f.anchorRight=0;var g=new a.UI.Button({background:a.UI.Sprite.fromFrame("UI/Menu/Wallet/button.png")});g.anchorRight=0,g.on("click",function(){pf.open(),pf.buttons.Shop.button.click(),pf.shopPage.menuButtons["GOLD"].click(),googa("send","event","Shop Menu","Wallet '+' Click")}),c.addChild(d,e,f,g);var h=b[ah.Gold]=new ec(0,ah.Gold,1);h.container.anchorRight=30,h.container.anchorBottom=2,c.addChild(h.container);var i=b[ah.Gems]=new ec(0,ah.Gems,1);i.container.anchorRight=117,i.container.anchorBottom=2,c.addChild(i.container);var j=b[ah.Talent]=new ec(0,ah.Talent,1);j.container.anchorRight=212,j.container.anchorBottom=2,c.addChild(j.container),this.UpdateBalance=function(a,c){var d=b[a];d&&d.updateAmount(c)},this.AddBalance=function(a,c){var d=b[a];d&&d.addAmount(c)}},tf={1:500,2:2e3,3:5e3,4:15e3,5:3e4,6:5e4,7:8e4,8:1e9},uf=function(a){this.index=a,this.xp=0,this.commanderId=-1,this.commanderInventoryId=-1,this.commanderData={},this.firstAbilityId=-1,this.firstAbilityInventoryId=-1,this.secondAbilityId=-1,this.secondAbilityInventoryId=-1,this.classId=-1,this.unlocked=!1,this.stat={experience:0,damage:0,health:0,speed:0,aimSpeed:0,explosiveResistance:0,fireResistance:0,piercingResistance:0,electricResistance:0,chemicalResistance:0},this.levelupStat={experience:0,damage:0,health:0,speed:0,aimSpeed:0,explosiveResistance:0,fireResistance:0,piercingResistance:0,electricResistance:0,chemicalResistance:0},this.resetLevelupStats=function(){for(var a in this.levelupStat)this.levelupStat[a]=0},this.getName=function(){return vf[this.index]},this.getLevel=function(){return _b(this.xp)},this.getLevelXPCurrent=function(){var a=this.getLevel();return a>1?this.xp-tf[a-1]:this.xp},this.getLevelXPMax=function(){var a=this.getLevel();return a>1?tf[a]-tf[a-1]:tf[a]},this.getLevelXPMissing=function(){return this.getLevelXPMax()-this.getLevelXPCurrent()},this.getStatPointCount=function(){var a=0;for(var b in this.stat)a+=this.stat[b];return a},this.getUsedStatPointCount=function(){var a=0;for(var b in this.levelupStat)a+=this.levelupStat[b];return a},this.getTotalStatPointCount=function(){return 3*this.getLevel()-3},this.getAvailableStatPoints=function(){return this.getTotalStatPointCount()-this.getStatPointCount()},this.getRemainingStatPoints=function(){return this.getAvailableStatPoints()-this.getUsedStatPointCount()},this.levelUp=function(){return this.getAvailableStatPoints()>0},this.update=function(a){this.clear(),this.unlocked=!0,this.index=a[0],this.commanderId=a[1],this.commanderInventoryId=a[2],this.commanderData=a[3]&&a[3].length?JSON.parse(a[3]):{},this.firstAbilityId=a[4],this.firstAbilityInventoryId=a[5],this.secondAbilityId=a[6],this.secondAbilityInventoryId=a[7],this.classId=a[8],this.xp=a[9],this.stat.experience=a[10],this.stat.damage=a[11],this.stat.health=a[12],this.stat.speed=a[13],this.stat.aimSpeed=a[14],this.stat.explosiveResistance=a[15],this.stat.fireResistance=a[16],this.stat.piercingResistance=a[17],this.stat.electricResistance=a[18],this.stat.chemicalResistance=a[19]},this.clear=function(){this.unlocked=!1;for(var a in this.stat)this.stat[a]=0,this.levelupStat[a]=0}},vf={0:"ALPHA",1:"BRAVO",2:"CHARLIE",3:"DELTA",4:"ECHO",5:"FOXTROT"},wf=function(){var b=this.container=new a.UI.Button({width:147,height:99,background:a.UI.Sprite.fromFrame("UI/crew/preview_bg.png")});b.background.tint=0,b.background.alpha=.2,b.on("click",function(){return 0===Dd.friendID?void xc.open("You must sign-in to recruit crews"):void f.post("/Shop/StartUnlockCrew").done(function(a){if(a.success){vc.open(a.price,a.currency,"UNLOCK CREW",-1,function(){pf.crews.getCrewCount();f.post("/Shop/UnlockCrew").done(function(a){a.success?(pf.wallet.UpdateBalance(a.currency,a.balance),nc.open("PURCHASE COMPLETE","UNLOCK CREW","OK"),pf.crews.AddCrew(a.data,!0),googa("send","event","Crew Purchase","Success UnlockCrew("+vf[a.data[0]]+")")):(a.message?nc.open("PURCHASE ERROR",a.message,"OK"):nc.open("PURCHASE ERROR","","OK"),googa("send","event","Crew Purchase","Error UnlockCrew"))})})}else{if(a.missing){pc.open(a.missing,a.currency),googa("send","event","Crew Purchase","Not Enough Money")}a.message&&nc.open("ERROR",a.message,"OK")}})}),b.on("hover",function(c){a.UI.Tween.to(b.background,.3,{alpha:c?.25:.2},a.UI.Ease.Circ.CircOut)});var c=new a.UI.DynamicText("RECRUIT CREW",{style:_c});c.top=32,c.horizontalAlign="center",b.addChild(c);var d=new ec(0,ah.Gems,1);d.container.horizontalAlign="center",d.container.y=69,b.addChild(d.container),this.update=function(a){d.container.alpha=0;var b=5e3,c=ah.Gold;4==a?(b=15e3,c=ah.Gold):5==a&&(b=150,c=ah.Gems),d.updateAmount(b),d.updateCurrency(c),u(function(){d.container.width=d.text.width+20,d.container.alpha=1},0)}},xf=function(b){var c=this;this.empty=!0,this.crew=b;var d=this.container=new a.UI.Button({width:147,height:99,background:a.UI.Sprite.fromFrame("UI/crew/preview_bg.png")});d.on("click",function(){pf.openSubMenu(pf.crewPage),pf.crewPage.load(c.crew),xf.setActive(c)}),d.on("hover",function(b){a.UI.Tween.to(d,.3,{alpha:b?1:.9},a.UI.Ease.Circ.CircOut),a.UI.Tween.to(e,.3,{scale:b?1.05:1},a.UI.Ease.Circ.CircOut)}),d.alpha=.9;var e=new a.UI.Container;e.x=74,e.y=50,d.addChild(e);var f=new a.UI.DynamicText(" ",{style:gd});f.top=6,f.left=8,d.addChild(f);var g,h=void 0;this.loadTank=function(b,c){this.empty=!1,f.text=vf[c];var i=tankClass[b];h&&e.container.removeChild(h.container),i?(h=i.PreviewCrew,h||(h=i.PreviewCrew=new S,h.container.scale.set(1==i.WeightClass?.68:2==i.WeightClass?.65:.6)),h.loadClass(b,i.SkinCannon?i.SkinCannon:i.DefaultSkinCannon,i.SkinBody?i.SkinBody:i.DefaultSkinBody),e.container.addChild(h.container),g&&d.removeChild(g)):(g||(g=new a.UI.DynamicText("NO TANK EQUIPPED",{style:gd}),g.horizontalAlign="center",g.verticalAlign="middle",g.alpha=.6),d.addChild(g))},this.setLevel=function(b,c){if(this.levelText||(this.levelText=new a.UI.DynamicText(" ",{style:$c,allowTags:!0}),this.levelText.anchorTop=6,this.levelText.anchorRight=8,d.addChild(this.levelText)),this.levelText.value="
LEVEL "+b,c){if(!this.levelUpBox){this.levelUpBox=new a.UI.SliceSprite(cf,3,(!0),(!0)),this.levelUpBox.tint=0,this.levelUpBox.width=80,this.levelUpBox.height=24,this.levelUpBox.anchorBottom=-1,this.levelUpBox.anchorLeft=5,this.levelUpBox.alpha=0,d.addChild(this.levelUpBox);var e=new a.UI.DynamicText("
LEVEL UP ",{style:ad,allowTags:!0});e.anchorLeft=12,e.anchorTop=3,this.levelUpBox.addChild(e)}a.UI.Tween.to(this.levelUpBox,.3,{alpha:1},a.UI.Ease.Circ.CircOut)}else this.levelUpBox&&a.UI.Tween.to(this.levelUpBox,.3,{alpha:0},a.UI.Ease.Circ.CircOut)},this.setFocus=function(b){d.background.sprite.texture=a.Texture.fromFrame(b?"UI/crew/preview_bg_active.png":"UI/crew/preview_bg.png")},this.abilities=[],this.setAbility=function(b,c){if(0==c||1==c){var e=this.abilities[c];e?e.icon.texture=a.Texture.fromFrame("UI/PowerUp/"+b+".png"):(e=this.abilities[c]={container:new a.UI.Container,icon:a.UI.Sprite.fromFrame("UI/PowerUp/"+b+".png"),shadow:a.UI.Sprite.fromFrame("UI/PowerUp/white.png")},e.container.addChild(e.shadow,e.icon),e.icon.pivot=e.shadow.pivot=.5,e.shadow.tint=0,e.shadow.alpha=1,e.shadow.top=3,e.shadow.left=-1,e.shadow.scale=1.1,e.container.scale=.3,d.addChild(e.container),e.container.anchorBottom=12,e.container.anchorRight=0==c?41:16)}},this.update=function(){this.loadTank(b.classId,b.index),this.setLevel(b.getLevel(),b.getAvailableStatPoints()>0),this.setAbility(-2,0),this.setAbility(-2,1)}};xf.activeCrew=!1,xf.setActive=function(a){xf.activeCrew&&(xf.activeCrew.setFocus(!1),xf.activeCrew=!1),a&&(pf.unselectButtons(),xf.activeCrew=a,xf.activeCrew.setFocus(!0))};var yf,zf,Af,Bf=function(){var b=this,c=0,d=this.container=new a.UI.Container(500,90);d.bottom=-10,d.horizontalAlign="center";for(var e={},f=this.previews={},g=0;g<6;g++)e[g]=new uf(g),f[g]=new xf(e[g]);this.getCrew=function(a){return e[a]},this.getMaxLevel=function(){var a=1;for(var b in e){var c=e[b];
c.unlocked&&(a=k.max(a,c.getLevel()))}return a},this.getCrewCount=function(){var a=0;for(var b in e){e[b].unlocked&&a++}return a};var h=new wf;d.addChild(h.container);var i=function(){var a=10,b=140;c=0;var g=0;for(var i in e){var j=e[i],k=f[i];j.unlocked&&(k.container.anchorLeft=i*(b+a),g=q(i),c++)}c<6?(d.width=(c+1)*(b+a)-a,h.update(c),h.container.interactive=h.container.visible=!0):(d.width=c*(b+a)-a+10,h.container.interactive=h.container.visible=!1),h.container.anchorLeft=(g+1)*(b+a)};this.updatePreview=function(a){f[a].update()};var j=this.AddCrew=function(a,b){var c=a[0],g=e[c];g.update(a),f[c].update(),d.addChild(f[c].container),b&&i(),pf.crewPage.currentCrew==g&&pf.crewPage.refresh()};this.LoadCrews=function(a){this.Clear(),c=a.length;for(var b=0,d=0;d
e&&b.stop()},this.stop=function(){h&&(j.cleanup(),m.cleanup(),l.cleanup(),n.visible=!1,PE.GameLoop.offUpdate(this.update,this),h=!1)},this.start=function(){h&&this.stop(),g.scale=.2*k.random()+.5,d=0,n.visible=!0,n.alpha=.35,o.gotoAndPlay(0),c=!0,j.emit=!0,m.emit=!0,l.emit=!0,PE.GameLoop.onUpdate(this.update,this),h=!0}},Df=function(b){var d=this;this.distance=0,this.angle=0,this.item=null;var e=!1,f=new Oc,g=new Cf,h=this.container=new a.UI.Container,i=new a.UI.Container;i.alpha=0,h.addChild(i);var l=a.UI.Sprite.fromFrame("UI/blank.png");i.addChild(l),h.addChild(g.container),i.pixelPerfect=h.pixelPerfect=l.pixelPerfect=!1,l.pivotY=.6,l.pivotX=.5;var m=new a.UI.DynamicText("0",{style:{tint:"#f5f5f5",fontSize:30,fontFamily:"impact",fontWeight:"bold",stroke:"2"}});m.align="center",m.anchorBottom=-50,m.visible=!1,i.addChild(m);var n=function(a){d.distance?Oc.Forward(d.angle,d.distance,f):f.set(0),h.x=f.x,h.y=f.y,d.angle+=1*a},o=(new j).to(i,0,{alpha:0}).to(l,0,{scale:0}).to(this,.4,{distance:200,ease:Sine.easeOut},.1*b+.3).fromTo(i,.3,{alpha:0},{alpha:1,ease:Sine.easeOut},.1*b+.3).fromTo(l,.3,{scale:0},{scale:.6,ease:Sine.easeOut},.1*b+.3);o.gotoAndStop(0),this.start=function(){e&&this.stop(),u(function(){Dd.Audio.Common.ui_crate_wosh.Play()},1e3*(.1*b+.3)),e=!0,this.angle=k.PI/5*b,o.gotoAndPlay(0),PE.GameLoop.onUpdate(n,this),i.alpha=0,i.visible=!0},this.stop=function(){e&&(d.distance=0,e=!1,PE.GameLoop.offUpdate(n,this),o.stop(),g.stop(),i.alpha=0,d.clearInfos())},this.explode=function(){Dd.Audio.Common.explosion_3_crate.Play(),g.start(),i.visible=!1},this.load=function(a){d.clearInfos(),this.item=a,0===this.item.Type||1===this.item.Type?this.loadItem(this.item):this.loadCurrency(this.item)};var p=function(a,b,c){var d=b/a.width,e=c/a.height,f=Mathf.min(d,e);a.width=k.round(a.width*f),a.height=k.round(a.height*f)};this.loadItem=function(b){var c=eg.items[b.Data],d=a.Texture.fromImage(c.imageURL);l.sprite.texture=d,l.width=d.width,l.height=d.height,p(l,200,200),b.Amount>1?(m.style.tint=16777215,m.visible=!0,m.value="x"+b.Amount):m.visible=!1},this.loadCurrency=function(b){var c=bh[b.Data],d=b.Amount,e=b.Rarity;m.text=d+"",m.visible=!0,"Gems"===c?m.style.tint="#d2fe8a":"Talent"===c?m.style.tint="#e4f7fe":"Gold"===c&&(m.style.tint="#ffdc41");var f="small";3===e?f="medium":4===e?f="large":e>4&&(f="big");var g=a.Texture.fromFrame("CrateCurrency/"+c+"/"+f+".png");l.sprite.texture=g,l.width=g.width,l.height=g.height,p(l,200,200)},this.focus=function(){o.stop(),c.set(i,{alpha:1}),c.to(this,1.5,{distance:0,ease:Sine.easeOut}),c.to(l,1.5,{scale:1,ease:Sine.easeOut}),1===this.item.Type&&this.item.UniqueData&&this.setCommanderInfo(JSON.parse(this.item.UniqueData))},this.clearInfos=function(){q&&(q.visible=!1)};var q,r;this.setCommanderInfo=function(b){if(!q){q=new a.UI.Container(150,90),q.top=-50;var c=a.UI.Sprite.fromFrame("UI/blank.png");c.tint=0,c.anchorLeft=c.anchorRight=c.anchorBottom=c.anchorTop=-10,c.alpha=.5,q.addChild(c);var d=new a.UI.DynamicText(nf("STATS"),{style:jd});d.align="center",q.addChild(d),r=new hh("100%"),r.container.top=20,q.addChild(r.container),h.addChild(q)}r.update(b),q.visible=!0,a.UI.Tween.fromTo(q,3,{alpha:0,left:0},{alpha:1,left:130},a.UI.Ease.Circ.CircOut)},i.alpha=0},Ef=function(b){var d=this,e=!1,f=[],g=[],h=1,i=this.container=new a.UI.Container,j=!1;i.left=i.top="50%",i.alpha=0;var k=this.animation=void 0,l=function(){for(var b=0;b=7&&j&&k.gotoAndPlay(0)}},m=this.reset=function(){k.scale.set(0),i.alpha=0,k.gotoAndStop(0)};this.shake=function(){Dd.Audio.Common.ui_crate_shake.Play(),k.animationSpeed=.8,j=!0,i.interactive=!1,k.gotoAndPlay(0)},this.open=function(){Dd.Audio.Common.ui_crate_shake.FadeOut(.5),Dd.Audio.Common.ui_crate_open.Play(),k.animationSpeed=1,j=!1,i.interactive=!0};var n=function(a){c.to(k.scale,1,{x:h,y:h,ease:Sine.easeOut}),c.to(i,1,{alpha:1,ease:Sine.easeOut}),a()};this.load=function(c){if(e)return m(),void n(c);e=!0;var d=new a.loaders.Loader;d.add("/Content/Crate/"+b+"/spritesheet.json"),d.add("/Content/CreateCurrency/spritesheet.json");for(var g=1;g<=7;g++){var h="Crate_"+b+"/shake-"+g+".png";f.push(h)}for(var g=1;g<=37;g++){var h="Crate_"+b+"/open-"+g+".png";f.push(h)}d.load(function(){l(),m(),n(c)})}},Ff={},Gf=function(){var b=this,d=!1,e=!1,g=this.container=new a.UI.Container("100%","100%"),h=new a.UI.Container;h.left=h.top="50%";var i=new a.UI.Container;i.left=i.top="50%";var j,k,l,m,o,p,q,s,v,w,x,y=void 0,z=!1,A=!1,B=!1,C=2,D=1,E=-1,F=[],G=[],H=function(){d=!0,v=a.UI.Sprite.fromFrame("UI/blank.png"),v.tint=0,v.width=v.height="100%",v.alpha=.5,g.addChild(v),v.interactive=!0;var c=new a.UI.Sprite(df);c.tint=0,c.height=400,c.scaleY=-1,c.pivotY=0,c.width="100%",c.alpha=1,c.bottom=0,g.addChild(c),k=new a.UI.Container,k.verticalAlign="middle",k.horizontalAlign="center",k.scale=1,k.alpha=0,j=new a.particles.Emitter(k.container,[a.Texture.fromFrame("Particles/lightning1.png")],Od),j.particleBlendMode=a.BLEND_MODES.ADD,g.addChild(k,h,i),l=new a.UI.DynamicText("Click the crate, to open it!",{style:md,width:"100%"}),l.style.align="center",l.anchorTop=20,g.addChild(l);for(var e=0;e<10;e++){var f=new Df(e);i.addChild(f.container),F.push(f)}s=new a.UI.Container(410,80),s.horizontalAlign="center",s.anchorBottom=0,o=new lh(200,60,function(){b.close()},new a.UI.DynamicText("CLOSE",{style:id})),o.anchorLeft=0,s.addChild(o),p=new lh(200,60,function(){b.show(E,D)},new a.UI.DynamicText("OPEN NEXT",{style:id})),p.anchorRight=0,s.addChild(p),q=new lh(200,60,function(){pf.open(),pf.buttons.Shop.button.click(),pf.shopPage.menuButtons["CRATES"].click(),googa("send","event","Crate Open","Buy More"),b.close()},new a.UI.DynamicText("BUY MORE",{style:id})),q.anchorRight=0,s.addChild(q),m=new a.UI.Button({background:a.UI.Sprite.fromFrame("UI/blank.png"),width:500,height:500}),m.verticalAlign="middle",m.horizontalAlign="center",m.background.alpha=0,m.width=m.height=400,m.on("click",function(){b.start()}),m.interactive=!1,g.addChild(m,s)},I=function(a){j.update(a),z&&A&&(C-=a,C<=0&&b.fire())},J=this.reset=function(){z=!1,A=!1,B=!1,y&&(y.container.visible=!1),l.value="Click the crate, to open it!",s.width=200,p.interactive=p.visible=!1,q.interactive=q.visible=!1,G=[],k&&c.to(k,1,{alpha:0,ease:Sine.easeOut});for(var a=0;a0;if(L=n.now(),s.width=410,p.visible=p.interactive=a,q.visible=q.interactive=!p.visible,pf.isOpen&&pf.inventoryPage.isOpen&&(pf.inventoryPage.refresh(),pg.selectedItem&&pg.selectedItem.setActive(!1)),v.interactive=o.interactive=o.visible=!0,0===x.Type||1===x.Type){new Zb("New Inventory Item",x.Amount+"x "+eg.items[x.Data].name).addButton("Show Inventory",200,5592405,function(){pf.openSubMenu(pf.inventoryPage)}).show(5e3)}else if(2===x.Type){var b=bh[x.Data];pf.wallet.AddBalance(x.Data,x.Amount),new Zb("Balance Added",x.Amount+" "+b).addButton("OK",200,5592405,function(){}).show(5e3)}};var M=function(a){if(32===a.which){if(p.visible&&p.interactive&&n.now()-L>1500)return void p.click();m.interactive&&m.click()}};this.fire=function(){if(!A)return void(B&&this.openCrate());if(C=1,G.length>1){for(var a=G.random();a.item===x;)a=G.random();if(G.splice(G.indexOf(a),1),a.explode(),1==G.length){G[0].focus(),b.complete()}}}},Hf={container:new a.UI.Container(286,324),interval:15,hover:!1,cooldown:0,banners:[],index:0,current:null,banner_fb:null,banner_twitter:null,banner_premium:null,banner_rewardAd:null,banner_referral:null,banner_signup:null,update:function(b){if(this.hover?this.cooldown=k.max(this.cooldown,3):this.cooldown-=b,this.cooldown<=0&&(this.cooldown=this.interval,this.current&&this.current.stop(),this.index++,this.index>=this.banners.length&&(this.index=0),this.current=this.banners[this.index])){this.current.start();var c=this;u(function(){c.container.addChild(c.current.container),c.current.container.container.hitArea=new a.Rectangle(0,0,286,324)},1e3)}},started:!1,initialized:!1,menueventsBound:!1,start:function(){this.initialized&&(this.hover=!1,this.started||(this.started=!0,PE.GameLoop.onUpdate(this.update,this)))},stop:function(){this.started&&(this.started=!1,PE.GameLoop.offUpdate(this.update,this))},clear:function(){this.banners=[],this.index=-1,this.cooldown=0,this.hover=!1,this.current&&(this.current.stop(),this.current=null)},init:function(){this.initialized=!0,this.clear(),this.menueventsBound||(this.menueventsBound=!0,pf.onOpen(function(){Hf.start()}),pf.onClose(function(){Hf.stop()})),this.banner_rewardAd||(this.banner_rewardAd=new Jf),this.banners.push(this.banner_rewardAd),0==Dd.friendID&&(this.banner_signup||(this.banner_signup=new Lf),this.banners.push(this.banner_signup)),ng.TwitterShareReward&&(this.banner_twitter||(this.banner_twitter=new Mf),this.banners.push(this.banner_twitter)),0==Dd.friendID||ng.Premium||(this.banner_premium||(this.banner_premium=new If),this.banners.push(this.banner_premium)),0==Dd.friendID||ng.FacebookShareReward||ng.TwitterShareReward||(this.banner_referral||(this.banner_referral=new Kf),this.banners.push(this.banner_referral)),this.start()}},If=function(){var b=this.container=new a.UI.Button({background:a.UI.Sprite.fromFrame("UI/banners/bg1.png"),width:286,height:324}),e=new a.UI.Container("100%","100%");b.addChild(e),b.background.alpha=.85;var f=new a.UI.SliceSprite(a.Texture.fromFrame("UI/banners/stroke.png"),5);f.width=f.height="100%",e.addChild(f),f.tint=13739065;var g=new a.UI.DynamicText("GET PREMIUM",{style:yd});g.x=86,g.y=28,e.addChild(g);var h=a.UI.Sprite.fromFrame("UI/Menu/premium.png");h.anchorLeft=8,h.anchorTop=0,h.pivot=.5,e.addChild(h);for(var i=[],k=["Support The Developers","50% Bonus Gold","50% Bonus XP","Host Private Games","No In-Game Advertisement!"],l=0;l0&&i.addBadge(0,ng.PremiumDays),null!==ng.BadgeType&&i.addBadge(ng.BadgeType,ng.BadgeData),c.visible=!0,c.interactiveChildren=!0,a.UI.Tween.to(c,1,{alpha:1},a.UI.Ease.Power2.easeOut)}),Zh.onLogout(function(){b&&a.UI.Tween.to(c,1,{alpha:0,onComplete:function(){Zh.authenticated||(c.visible=!1,c.interactiveChildren=!1)}},a.UI.Ease.Power2.easeOut)})},Pf=function(){var b=-1,c=-1;this.container=new a.UI.Container(175,"80%"),this.container.valign="middle";var d=a.UI.Sprite.fromFrame("UI/grad-horizontal.png");d.width=d.height="100%",d.tint=0,d.alpha=.2;var e=a.UI.Sprite.fromFrame("UI/Rank/Medium/1.png");e.anchorRight=6,e.top=4;var f=new a.UI.DynamicText("",{style:hd});f.top=4;var g=a.UI.Sprite.fromFrame("UI/blank.png");g.alpha=.12,g.width=124;var h=a.UI.Sprite.fromFrame("UI/blank.png");h.tint=14155594,h.alpha=.44,h.height=g.height=14,h.top=g.top=23;var i=new a.UI.DynamicText("",{style:Zc});i.top=42;var j=new a.UI.DynamicText("",{style:Zc});j.style.shadow="#000000 1 1 1 1",j.top=25,j.left=4,this.container.addChild(d,e,g,h,i,f,j),this.updateExperience=function(d){var l=Dd.XPSystem.GetLevel(d);if(c!==l.Level&&(e.sprite.texture=a.Texture.fromFrame("UI/Rank/Medium/"+k.min(240,l.Level)+".png"),f.text="Level "+l.Level,i.text=Dd.XPSystem.GetRankName(l.Level),c=l.Level),b!==d){h.width=g.width*((d-l.StartExperience)/(l.EndExperience-l.StartExperience)),j.text=d.toLocaleString()+" / "+(l.EndExperience+1).toLocaleString(),b=d}j.update()}},Qf=function(){var b=Changelog[0],c=Changelog[1],d=this.container=new a.UI.Container("100%","100%"),e=new a.UI.SliceSprite(cf,3,(!0),(!0),(!0));e.width=e.height="100%",e.alpha=.5,e.tint=10066329;var f=new a.UI.SliceSprite(ef,3);f.tint=0,f.width="100%",f.height=37,f.alpha=.35;var g=new a.UI.DynamicText(nf("CHANGELOG"),{style:kd});g.align="center",g.top=10;var h=a.UI.Sprite.fromFrame("UI/blank.png");h.height=22,h.width="100%",h.top=37,h.tint=9950720,h.alpha=.5;var i=new a.UI.DynamicText(b,{style:hd});i.align="center",i.top=40;var j=new a.UI.DynamicText(c,{style:gd});j.anchorLeft=20,j.top=66,d.addChild(e,f,h,i,j,g)},Rf=function(){var b=this.container=new a.UI.Container("100%","100%"),c=new a.UI.Button({background:a.UI.Sprite.fromFrame("UI/blank.png"),width:282,height:64});c.background.tint=0,c.background.alpha=1,c.horizontalAlign="center",c.anchorBottom=15;var e=new a.UI.DynamicText(nf("COMMUNITY & SUPPORT"),{style:Ad});e.horizontalAlign="center",e.top=10;var f=a.UI.Sprite.fromFrame("UI/Menu/discord.png");f.top=7,f.horizontalAlign="center",c.addChild(f),c.on("hover",function(a){c.background.alpha=a?.7:1}),c.on("click",function(){d.open("https://discord.gg/tankwars","_blank"),googa("send","event","MainMenu","Community - Discord Clicked")}),b.addChild(c,e)},Sf=function(){this.container=new a.UI.Container,this.container.anchorTop=7,this.container.anchorRight=10,this.container.width=286,this.container.height=456;var b=new a.UI.CheckBox({checked:!rf.UserSettings["VolumeMute"],background:a.UI.Sprite.fromFrame("UI/blank.png")});b.background.alpha=b.checked?.49:.15,b.background.tint=b.checked?11727872:16777215,b.width=36,b.height=31,b.top=1;var c=a.UI.Sprite.fromFrame(b.checked?"UI/Menu/Icons/volume.png":"UI/Menu/Icons/volume-mute.png");c.verticalAlign="middle",c.horizontalAlign="center",c.alpha=b.checked?1:.4,b.addChild(c),b.updateState=function(d){c.sprite.texture=a.Texture.fromFrame(d?"UI/Menu/Icons/volume.png":"UI/Menu/Icons/volume-mute.png"),a.UI.Tween.to(this.background,.4,{alpha:d?.49:.15,tint:d?"#b2f400":"#ffffff"},a.UI.Ease.Circ.CircOut),a.UI.Tween.to(c,.4,{alpha:d?1:.4},a.UI.Ease.Circ.CircOut),e.handle.tint=d?10799912:12631224,b.checked=d},b.change=function(a){rf.UserSettings["VolumeMute"]=!a,rf.saveUserSettings(),Dd.Audio.Update(),b.updateState(a)};var d=a.UI.Sprite.fromFrame("UI/blank.png");d.tint=0,d.alpha=.35,d.top=1,d.anchorLeft=36,d.anchorRight=0,d.height=31;var e=new a.UI.Slider({value:100*rf.UserSettings["VolumeMaster"],track:new a.UI.SliceSprite(hf,10,(!0),(!1)),handle:new a.UI.Sprite(gf)});e.track.alpha=.5,e.anchorLeft=46,e.anchorRight=8,e.y=12,e.track.height=10,e.handle.tint=10799912,e.track.anchorLeft=e.track.anchorRight=2,e.handle.tint=b.checked?10799912:12631224,e.on("change",function(a){rf.UserSettings["VolumeMaster"]=a/100,Dd.Audio.Update(),rf.saveUserSettings()}),this.container.addChild(b,d,e);var f=new a.UI.Button({background:new a.UI.SliceSprite(a.Texture.fromFrame("UI/shadow-box.png"),5),text:new a.UI.DynamicText(nf("HOST CUSTOM GAME"),{style:jd}),width:"100%",height:67});f.anchorTop=42,f.background.tint=5658701,f.text.style.tint="#dadada",f.on("hover",function(a){this.background.tint=a?6382426:5658701,this.text.style.tint=a?"#eeefec":"#dadada"}),f.on("click",function(){Nf.openLauncher()}),f.anchorRight=f.anchorLeft=-2,this.container.addChild(f,Hf.container),Hf.container.anchorBottom=0,this.open=function(){e.value=100*rf.UserSettings["VolumeMaster"],b.updateState(!rf.UserSettings["VolumeMute"])}},Tf=function(){var b=this;this.empty=!0,this.friendId=0;var c=" ",d="",e="",f=!1,g=this.container=new a.UI.Container;g.width=g.height=48;var h=new a.UI.Button({background:new a.UI.SliceSprite(kf,4),width:"100%",height:"100%"});h.background.tint=10855845,h.background.alpha=.2,g.addChild(h);var i=new a.UI.DynamicText("Nicolai Mortensen",{style:gd,width:"100%",height:30});i.style.overflowX="hidden",i.style.elipsis=!0,i.style.wrap=!1,i.style.align="center",i.anchorBottom=-30,i.alpha=0,g.addChild(i);var j=new a.UI.Sprite(a.Texture.fromFrame("UI/avatar.png"));j.anchorLeft=j.anchorTop=j.anchorBottom=j.anchorRight=2,h.addChild(j),h.on("hover",function(c){0!==b.friendId&&(a.UI.Tween.to(i,.3,{alpha:c?1:0},a.UI.Ease.Circ.CircOut),a.UI.Tween.to(h.background,.3,{alpha:c?.5:.2},a.UI.Ease.Circ.CircOut))}),new a.UI.Interaction.ClickEvent(h,(!1),(!0)).onClick=function(a){0!==b.friendId&&ci.open(b.friendId)};var k=function(){e!==d&&(e=d,j.sprite.texture=d.length?a.Texture.fromImage(Dc(d)):a.Texture.fromFrame("UI/avatar.png")),i.text=c,j.alpha=0===b.friendId?.3:1,h.interactive=0!==b.friendId,b.empty=0===b.friendId};this.setMember=function(a){b.friendId=a[bi.propertyName.Friend.FriendID],d=a[bi.propertyName.Friend.Avatar],c=a[bi.propertyName.Friend.Name],k()},this.setMe=function(){b.friendId=Zh.data["friendID"],d=Zh.data["avatar"],c=Zh.data["username"],Zh.onData(function(){b.friendId=Zh.data["friendID"],d=Zh.data["avatar"],c=Zh.data["username"],k()}),k()},this.clear=function(){b.friendId=0,d="",c=" ",f=!1,k()},k()},Uf=function(){var b=!1,c=1,d=this.container=new a.UI.Container("100%","0");d.anchorBottom=6,d.anchorLeft=6,d.anchorRight=6,d.alpha=0;var e=a.UI.Sprite.fromFrame("UI/blank.png");e.tint=0,e.alpha=.6,e.width=e.height="100%",d.addChild(e);var f=new a.UI.DynamicText("PARTY",{style:kd});f.anchorTop=8,f.anchorLeft=11,d.addChild(f);var g=new a.UI.Button({background:new a.UI.SliceSprite(kf,4),text:new a.UI.DynamicText("Leave Party",{style:id}),width:90,height:23});g.background.tint=16711680,g.background.alpha=.3,g.anchorTop=7,g.anchorRight=11,d.addChild(g),g.on("hover",function(b){a.UI.Tween.to(g.background,.3,{alpha:b?.5:.3},a.UI.Ease.Circ.CircOut)}),g.on("click",function(){ki.leaveParty()});var h=!1,i=[];this.toggle=function(){b?this.hide():this.show()},this.init=function(){if(!h){h=!0;for(var a=0;a<5;a++){var b=new Tf;i[a]=b,b.container.anchorBottom=15,b.container.anchorLeft=10+53*a,d.addChild(b.container),0===a&&b.setMe()}}};var j=function(){for(var a=1;a<5;a++)if(i[a].empty)return i[a]},k=function(a){for(var b=0;b<5;b++)if(i[b].friendId==a)return i[b]};this.addMember=function(a,b){if(this.show(),!b){var d=j();d&&(d.setMember(a),c++)}},this.removeMember=function(a){if(a==i[0].friendId)return void this.clear();var b=k(a);b&&(b.clear(),c--),c<=1&&this.clear()};var l=new a.UI.DynamicText("LEADER",{style:fd});l.anchorTop=-10,l.align="center",this.setLeader=function(a){var b=k(a);b&&b.container.addChild(l)},this.clearSlots=function(){for(var a=1;a<5;a++)i[a].clear()},this.clear=function(){c=1,this.clearSlots(),this.hide()},this.show=function(){b||(b=!0,this.init(),d.interactive=!0,a.UI.Tween.to(pf.homePage.friends.friendList.container,.3,{anchorBottom:111},a.UI.Ease.Circ.CircOut),a.UI.Tween.to(d,.3,{height:100,alpha:1},a.UI.Ease.Circ.CircOut))},this.hide=function(){b&&(b=!1,d.interactive=!1,a.UI.Tween.to(pf.homePage.friends.friendList.container,.3,{anchorBottom:23},a.UI.Ease.Circ.CircOut),a.UI.Tween.to(d,.3,{height:0,alpha:0},a.UI.Ease.Circ.CircOut))},yf=this},Vf=function(){var b=this.container=new a.UI.Container("100%","100%"),c=new a.UI.Container("100%","100%"),d=new a.UI.DynamicText(" ",{style:ad,allowTags:!0});d.anchorTop=11,d.anchorLeft=9;var e=new a.UI.Button({background:a.UI.Sprite.fromFrame("UI/blank.png"),width:119,height:29,text:new a.UI.DynamicText("+ ADD FRIEND",{style:id})});e.anchorTop=e.anchorRight=6,e.background.tint=3028840,e.background.alpha=.8,e.on("hover",function(b){a.UI.Tween.to(e.background,.15,{tint:b?"#4d527a":"#2e3768"})}),e.on("click",function(){a.UI.Interaction.InputController.blur(),di.open()}),this.friendList=new Xf,c.addChild(d,e,this.friendList.container);var f=a.UI.Sprite.fromFrame("UI/Menu/signinbanner.png");f.anchorTop=f.anchorLeft=6,b.addChild(f,c);var g=function(){f.visible=!Zh.authenticated,c.visible=Zh.authenticated,Zh.authenticated&&(d.value="FRIEND ID: "+Dd.friendID+"")};Zh.onAuthenticated(function(){g()}),Zh.onLogout(function(){g()}),g()},Wf=function(b){this.friend=b;var c=this.container=new a.UI.Container("100%",48);this.container.anchorRight=this.container.anchorLeft=6;var d=new a.UI.Button({background:new a.UI.Sprite(a.Texture.fromFrame("UI/grad-vertical.png")),width:"100%",height:"100%"});d.background.alpha=.07,this.container.addChild(d),d.on("focus",function(){d.blur()}),d.on("hover",function(b){a.UI.Tween.to(d.background,.3,{alpha:b?.2:.07},a.UI.Ease.Circ.CircOut)}),new a.UI.Interaction.ClickEvent(d,(!1),(!0),(!1)).onClick=function(a){ci.open(b.FriendID)},new a.UI.Interaction.ClickEvent(d,(!1),(!1),(!0)).onClick=function(a){b.FriendInvite||ei.startConversation(b,!0)};var e=new a.UI.DynamicText(b.Name,{style:hd}),f=new a.UI.DynamicText("Offline",{style:$c});e.y=5,f.y=24,e.x=f.x=52;var g=new a.UI.SliceSprite(kf,4);g.width=g.height=42,g.left=g.top=3,g.tint=10855845;var h=new a.UI.Sprite(a.Texture.fromFrame("UI/avatar.png"));h.anchorLeft=h.anchorTop=h.anchorBottom=h.anchorRight=2,g.addChild(h),d.addChild(g,e,f);var i,j,k,l=!1,m=function(){if(!l){l=!0,k=new a.UI.Container(120,20),k.anchorBottom=k.anchorRight=5;var d=function(b){a.UI.Tween.to(this,.3,{alpha:b?1:.8},a.UI.Ease.Circ.CircOut)};i=new a.UI.Button({background:new a.UI.SliceSprite(a.Texture.fromFrame("UI/ui-box-4.png"),4),width:59,height:"100%",text:new a.UI.DynamicText("Accept",{style:$c})}),j=new a.UI.Button({background:new a.UI.SliceSprite(a.Texture.fromFrame("UI/ui-box-4.png"),4),width:59,height:"100%",text:new a.UI.DynamicText("Decline",{style:$c})}),j.on("click",function(){$h.friendListEvents.declineFriendRequest(b.FriendID)}),i.on("click",function(){$h.friendListEvents.acceptFriendRequest(b.FriendID)}),i.background.tint=10995035,j.background.tint=13587026,j.alpha=i.alpha=.8,j.on("hover",d),i.on("hover",d),i.anchorRight=0,k.addChild(i,j),c.addChild(k)}k.visible=k.interactive=!0},n=function(){l&&(k.visible=k.interactive=!1)},o="";this.update=function(){o!==b.Avatar&&(o=b.Avatar,h.sprite.texture=b.Avatar&&b.Avatar.length?a.Texture.fromImage(Dc(b.Avatar)):a.Texture.fromFrame("UI/avatar.png")),e.value=b.Name,f.alpha=1,e.alpha=1,g.alpha=1,n(),f.value=b.Status,b.State===_h.Online?(g.tint=6932735,e.style.tint=f.style.tint=6932735):b.State===_h.Ingame?(g.tint=10995034,e.style.tint=f.style.tint=13893481):b.State===_h.Offline?(g.tint=10329501,e.style.tint=f.style.tint=14803425,e.alpha=.7,f.alpha=.5):b.State===_h.Blocked?(g.tint=11024697,e.style.tint=f.style.tint=16736352):b.State===_h.Invite&&(g.tint=16769385,e.style.tint=f.style.tint=16769385,f.alpha=1,e.alpha=.8,g.alpha=.8,m())},b.on("update",this.update),this.update()},Xf=function(){var b=this;this.container=new a.UI.Container("100%","100%"),this.container.anchorTop=39,this.container.anchorLeft=this.container.anchorRight=6,this.container.anchorBottom=23,this.friendItems={};var c=a.UI.Sprite.fromFrame("UI/blank.png");c.tint=0,c.alpha=.4,c.width=c.height="100%",this.container.addChild(c);var d=new Yf;this.container.addChild(d.container),ai.on("init",function(a){d.empty(),b.friendItems={};for(var c=0;c=0;a--)b.removeChild(b.items[a])},this.container.addChild(c,d)},Zf=function(){var b=this.container=new a.UI.Container("100%","100%"),c=new a.UI.SliceSprite(cf,3,(!0),(!0),(!0));c.tint=15592941,c.width="100%",c.height="100%",c.alpha=.7;var e=new a.UI.SliceSprite(ef,3);e.tint=15992320,e.width="100%",e.height=37,e.alpha=.49;var f=a.UI.Sprite.fromFrame("UI/Menu/Icons/leaderboard.png");f.top=8,f.anchorRight=12;var g=new a.UI.DynamicText(nf("LEADERBOARD - CONQUEST WINS"),{style:id});g.left=12,g.top=10;var h=new a.UI.SortableList((!1),0);h.width="100%",h.top=37,h.height=210;for(var i=!1,j=0;jPLAY TANKWARS.IO",{style:bd,allowTags:!0});c.align="center",c.top=15;var d=new a.UI.Container(261,63),e=new a.UI.Container(261,63);d.align=e.align="center",d.top=e.top=45,e.visible=e.interactiveChildren=!1,Dd.onStateChange(function(){var a=Dd.Connection.server.connected&&Dd.joined;d.visible=d.interactiveChildren=!a,e.visible=e.interactiveChildren=a}),Zh.onData(function(){c.value=Zh.authenticated?"PLAY AS "+Zh.data.username:"PLAY TANKWARS.IO"});var f=new a.UI.Button({background:a.UI.Sprite.fromFrame("UI/blank.png"),text:new a.UI.DynamicText("LEAVE GAME",{style:jd}),width:261,height:22});f.on("click",function(){Dd.Connection.server.connected&&Dd.joined?Dd.Connection.invoke("LeaveCheck"):Dd.ClearGame(!1)}),e.addChild(f),f.background.tint=16711680,f.anchorBottom=0;var g=new a.UI.Button({background:a.UI.Sprite.fromFrame("UI/blank.png"),text:new a.UI.DynamicText("CONTINUE PLAYING",{style:kd}),width:261,height:38});g.on("click",function(){Dd.Connection.server.connected&&Dd.joined?pf.close():Dd.ClearGame(!1)}),e.addChild(g),g.background.tint=9811200,g.alpha=f.alpha=.8;var h=function(b){a.UI.Tween.to(this.background,.4,{alpha:b?1:.8},a.UI.Ease.Circ.CircOut)};f.on("hover",h),g.on("hover",h);var i=new a.UI.SliceSprite(mf,18);i.anchorLeft=i.anchorRight=i.anchorTop=i.anchorBottom=-12,i.blendMode=a.BLEND_MODES.ADD,i.tint=13813527,d.addChild(i);var j=function(a){l.isHover||(i.alpha=.4*k.cos(.002*PE.GameLoop.time)+.6)},l=new a.UI.Button({background:a.UI.Sprite.fromFrame("UI/blank.png"),text:new a.UI.DynamicText("PLAY",{style:md}),width:"100%",height:"100%"});d.addChild(l),l.background.tint=9811200,l.on("hover",function(a){a?(i.alpha=1,this.background.tint=10666507):this.background.tint=9811200});var m=[["Conquest",1,"cq.png"],["KingDM",0,"kdm.png"]],n=["AUTO","USE","USW","EU","SEA"];zf=function(a){return t(Dd.retryPlayTimeout),Dd.Connection.server.connected&&!Dd.starting&&Dd.Level.loaded?(void 0===a&&(a=localStorage["gamemodeSelected"]),Dd.Start(a),void pf.close(!0,!0)):void(Dd.retryPlayTimeout=u(function(){zf()},200))},l.on("click",zf),pf.onOpen(function(){PE.GameLoop.onUpdate(j)}),pf.onClose(function(){PE.GameLoop.offUpdate(j)});var o=new a.UI.DynamicText("GAMEMODE",{style:id});o.horizontalAlign="center",o.top=134;var p=this;this.container.addChild(b,c,o,d,e);var q=function(b){a.UI.Tween.to(this.background,.4,{alpha:b?.45:.15},a.UI.Ease.Circ.CircOut),a.UI.Tween.to(this.background,.4,{tint:b?"#26c4ff":"#ffffff"},a.UI.Ease.Circ.CircOut),a.UI.Tween.to(this.inner,.4,{alpha:b?1:.4},a.UI.Ease.Circ.CircOut),b&&(localStorage["gamemodeSelected"]=this.mode,Dd.selectedGM=this.mode,v())},r=localStorage["gamemodeSelected"];void 0===r&&(r=localStorage["gamemodeSelected"]=Dd.GameModes.Default);for(var s=0;s=3&&(g.container.x-=204,g.container.y=63)}this.update=function(a){c.height=pf.crews.getCrew(3).unlocked?100:58;for(var b in e){e[b].update(a)}}},hg={all:1,crates:2,skins:3,commanders:4},ig={newest:1,quality:2},jg={0:{name:"None",text:"Common",textColor:"#ffffff",bgTint:"#ffffff",descriptionBgTint:"#b5b5b5"},1:{name:"Common",text:"Common",textColor:"#dedede",bgTint:"#ffffff",descriptionBgTint:"#b5b5b5"},2:{name:"Uncommon",text:"Uncommon",textColor:"#6e9ae4",bgTint:"#1651b3",descriptionBgTint:"#6e9ae4"},3:{name:"Rare",text:"Rare",textColor:"#b2e965",bgTint:"#92ce20",descriptionBgTint:"#b2e965"},4:{name:"Epic",text:"Epic",textColor:"#e965de",bgTint:"#af20ce",descriptionBgTint:"#e965de"},5:{name:"Legendary",text:"Legendary",textColor:"#ffcc00",bgTint:"#ff9600",descriptionBgTint:"#ffcc00"},6:{name:"Special",text:"Special",textColor:"#e96565",bgTint:"#ce2020",descriptionBgTint:"#e96565"},7:{name:"Crate",text:"Common",textColor:"#ffffff",bgTint:"#ffffff",descriptionBgTint:"#b5b5b5"}},kg={0:{name:"Skin"},1:{name:"Loot Crate"},2:{name:"Consumable"},3:{name:"Commander"},4:{name:"Taunt"}},lg={Skin:0,LootCrate:1,Consumable:2,Commander:3},mg=function(a){this.id=a[0],this.imageURL="/image/item-"+this.id+".png",this.name=a[1],this.description=a[2],this.rarity=a[3],this.type=a[4];var b=void 0;this.getTexture=function(){return b||(b=eg.spritesheet.getTexture(this.imageURL)),b},this.type==lg.Commander&&(this.title=a[5]),this.type==lg.Skin&&(this.classId=a[5])},ng={FacebookShareReward:!1,TwitterShareReward:!1,Premium:!1,PremiumDays:0,BadgeType:null,BadgeData:null,DataLoaded:!1,Clear:function(){this.PremiumDays=0,this.Premium=!1,this.BadgeType=null,this.BadgeData=null,this.FacebookShareReward=!1,this.TwitterShareReward=!1,pf.wallet.UpdateBalance(ah.Gold,0),pf.wallet.UpdateBalance(ah.Talent,0),pf.wallet.UpdateBalance(ah.Gems,0);for(var a in tankClass){var b=tankClass[a];this.UpdateClassInfo(b.ID,b.DefaultSkinBody,-1,b.DefaultSkinCannon,-1,!1)}pf.tanksPage.refresh(),pf.crews.LoadGuestCrews()},Load:function(a,b,c,d,e,f,g,h,i,j){if(this.DataLoaded&&this.Clear(),pf.wallet.UpdateBalance(ah.Gold,c),pf.wallet.UpdateBalance(ah.Talent,d),
pf.wallet.UpdateBalance(ah.Gems,e),this.PremiumDays=f,this.Premium=f>0,this.BadgeType=g,this.BadgeData=h,this.FacebookShareReward=i,this.TwitterShareReward=j,this.DataLoaded=!0,a)for(var k=0;k6)&&(e=1);var f=new a.UI.Button({background:a.UI.Sprite.fromFrame("UI/inventory/item/bg/"+e+".png")});f.width=84,f.height=84;var g=new a.UI.Sprite(d.getTexture());g.x=g.y=42,g.pivot=.5;var h=k.min(60/g.width,60/g.height);g.scale=h;var i=a.UI.Sprite.fromFrame("UI/inventory/item/type/"+d.type+".png");i.anchorBottom=i.anchorRight=6,i.alpha=.5,c.container.addChild(f,g,i),f.background.alpha=.45,f.on("hover",function(b){pg.selectedItem!=c&&(a.UI.Tween.to(this.background,.4,{alpha:b?.75:.45},a.UI.Ease.Circ.CircOut),a.UI.Tween.to(g,.4,{scale:b?1.1*h:h},a.UI.Ease.Circ.CircOut),a.UI.Tween.to(i,.4,{alpha:b?1:.5},a.UI.Ease.Circ.CircOut),b?pf.inventoryPage.setPreview(c,!1):pf.inventoryPage.clearPreview())}),f.on("click",function(){c.setActive(!0)}),this.setActive=function(b){b?(pg.selectedItem&&pg.selectedItem.setActive(!1),pf.inventoryPage.setPreview(this,!0)):(pg.selectedItem=void 0,pf.inventoryPage.clearPreview()),a.UI.Tween.to(f.background,.4,{alpha:b?1:.45},a.UI.Ease.Circ.CircOut),a.UI.Tween.to(g,.4,{scale:b?1.1*h:h},a.UI.Ease.Circ.CircOut),a.UI.Tween.to(i,.4,{alpha:b?1:.5},a.UI.Ease.Circ.CircOut)}},pg=function(){var b,c,d,e,g,h=this,i=1,j=1,l=ig.newest,m=hg.all,n=!1,o={},p={};this.init=function(){n=!0;var b=this.container=new a.UI.Container("100%","100%");b.verticalAlign="middle",b.horizontalAlign="center",b.pivot=.5,pf.container.addChild(b),this.initPreviewContainer(),this.initInventoryContainer(),this.initInventoryMenu()},this.initPreviewContainer=function(){var b=this.previewContainer=new a.UI.Container(295,"100%");b.anchorRight=0,this.container.addChild(b);var c=new a.UI.SliceSprite(cf,3,(!0),(!0),(!0));c.tint=15848359,c.width="100%",c.height="100%",c.alpha=.5,b.addChild(c);var d=this.previewContent=new a.UI.Container;d.anchorLeft=d.anchorRight=d.anchorTop=d.anchorBottom=5,d.visible=!1,b.addChild(d);var e=a.UI.Sprite.fromFrame("UI/blank.png");e.height=182,e.width="100%",e.alpha=.35,d.addChild(e);var g=a.UI.Sprite.fromFrame("UI/grad-vertical.png");g.y=187,g.height=125,g.width="100%",g.alpha=.6,d.addChild(g);var i=new a.UI.DynamicText(" ",{style:jd,allowTags:!0}),n=new a.UI.DynamicText(" ",{style:$c,width:"90%",height:90});i.anchorTop=193,i.anchorLeft=10,n.horizontalAlign="center",n.anchorTop=220;var o=new a.UI.Sprite(a.Texture.EMPTY);o.x=142,o.y=91,o.pivot=.5,d.addChild(o);var p=new a.UI.DynamicText(" ",{style:td,allowTags:!0});p.x=4;var q=new a.UI.DynamicText(" ",{style:td});q.anchorRight=4,d.addChild(q,p,n,i);var r=new hh("95%");r.container.anchorTop=280,r.container.horizontalAlign="center",d.addChild(r.container);var s=function(b,c){var d=new a.UI.Button({background:new a.UI.SliceSprite(a.Texture.fromFrame("UI/Menu/box-border.png"),4),height:36,text:new a.UI.DynamicText(b,{style:hd})});return d.anchorLeft=d.anchorRight=12,d.background.alpha=.5,d.on("click",c),d.on("hover",function(b){a.UI.Tween.to(this.background,.4,{alpha:b?.9:.5},a.UI.Ease.Circ.CircOut)}),d},t=new a.UI.Container("100%",200);t.anchorBottom=0,d.addChild(t);var u=s("SALVAGE ",function(){var a=pg.selectedItem;wc.open(a.item.name,function(){var b={id:a.inventoryId};f.post("/Inventory/Salvage",b).done(function(c){c&&(ng.UnequipInventoryItem(b.id,a.item),pf.wallet.UpdateBalance(ah.Gold,c),a.setActive(!1),h.refresh(),googa("send","event","InventorySalvage",a.item.name),nc.open("SALVAGE DONE","100 Gold has been added to your balance","OK"))})})});u.uiText.horizontalAlign=null,u.background.tint=16711680,u.anchorBottom=10;var v=new ec(100,ah.Gold,1);v.container.anchorBottom=9,u.uiText.anchorLeft=v.container.anchorRight=70,v.text.value="+"+v.text.value,u.addChild(v.container);var w=new gg;w.container.anchorBottom=58,w.container.horizontalAlign="center";var x=new a.UI.Container("100%","100%");x.anchorBottom=0;var y=s("OPEN LOOT CRATE",function(){pf.crateopen.show(pg.selectedItem.itemId,pg.selectedItem.inventoryId)});y.anchorBottom=10,x.addChild(y);var z=new a.UI.Container("100%","100%");z.anchorBottom=50;var A=new a.UI.Container;A.align="center",z.addChild(A);var B=new S;A.container.addChild(B.container);var C=function(a){if(!a)return void alert("error");ng.UpdateClassInfo(a[0],a[1],a[2],a[3],a[4],a[5]),h.updateSkinButtons();var b=pg.selectedItem.data,c=tankClass[b];B.loadClass(b,c.SkinCannon,c.SkinBody,!0)},D=s("EQUIP BOTH",function(){D.postData.id=pg.selectedItem.inventoryId,f.post("/Inventory/EquipSkin",D.postData).done(C)});D.postData={id:-1,body:!0,cannon:!0},D.anchorBottom=50;var E=s("EQUIP BODY",function(){E.postData.id=pg.selectedItem.inventoryId,f.post("/Inventory/EquipSkin",E.postData).done(C)});E.postData={id:-1,body:!0,cannon:!1},E.anchorBottom=10,E.anchorRight=144;var F=s("EQUIP CANNON",function(){F.postData.id=pg.selectedItem.inventoryId,f.post("/Inventory/EquipSkin",F.postData).done(C)});F.postData={id:-1,body:!1,cannon:!0},F.anchorBottom=10,F.anchorLeft=145,z.addChild(D,E,F),this.updateSkinButtons=function(){if(pg.selectedItem){var a=pg.selectedItem.data;if(pg.selectedItem.item.type==lg.Skin&&a){var b=tankClass[a],c=pg.selectedItem.inventoryId==b.BodyInventoryId,d=pg.selectedItem.inventoryId==b.CannonInventoryId;D.background.tint=c&&d?0:16777215,D.postData.body=!(c&&d),D.postData.cannon=!(c&&d),D.text=c&&d?"UNEQUIP BOTH":"EQUIP BOTH",E.background.tint=c?0:16777215,E.postData.body=!c,E.postData.cannon=d,E.text=c?"UNEQUIP BODY":"EQUIP BODY",F.background.tint=d?0:16777215,F.postData.body=c,F.postData.cannon=!d,F.text=d?"UNEQUIP CANNON":"EQUIP CANNON",B.loadClass(a,b.SkinCannon,b.SkinBody,!0)}}},t.addChild(u,x,z,w.container),this.setPreview=function(b,e){var f=!e;if(!f||!pg.selectedItem||pg.selectedItem==b||pg.selectedItem.itemId!=b.itemId){f||(pg.selectedItem=b);var h=b.item,j=jg[h.rarity],l=kg[h.type];p.text=""+j.text.toUpperCase()+" RARITY",q.text=l.name.toUpperCase(),n.text=h.description,i.text=h.type==lg.Commander?h.name+" "+h.title:h.name,a.UI.Tween.to(c,.4,{tint:j.bgTint},a.UI.Ease.Circ.CircOut),a.UI.Tween.to(g,.4,{tint:j.descriptionBgTint},a.UI.Ease.Circ.CircOut);var m=h.getTexture(),s=k.min(190/m.width,157/m.height);o.sprite.texture=m,o.width=m.width,o.height=m.height,o.scale=s,d.interactive=!0,d.visible=!0,t.visible=t.interactive=!!e,w.container.visible=w.container.interactive=h.type==lg.Commander,x.visible=x.interactive=h.type==lg.LootCrate,z.visible=z.interactive=h.type==lg.Skin,u.visible=h.type==lg.Skin||h.type==lg.Commander,r.container.visible=h.type==lg.Commander,h.type==lg.Commander&&r.update(b.data),e&&(h.type==lg.Skin?this.updateSkinButtons():h.type==lg.Commander&&w.update(b))}},this.clearPreview=function(){d.interactive=!1,d.visible=!1,pg.selectedItem&&this.setPreview(pg.selectedItem,!0)},this.refresh=function(){this.loadInventory(j,l,m,!1,!1,!0)}},this.initInventoryContainer=function(){var b=this.inventoryContainer=new a.UI.Container("100%","100%");b.anchorRight=303,b.anchorLeft=0,this.container.addChild(b);var c=new a.UI.SliceSprite(cf,3,(!0),(!0),(!0));c.tint=8947848,c.width="100%",c.height="100%",c.alpha=.5,b.addChild(c),this.itemContainer=new a.UI.Container,this.itemContainer.anchorTop=43,this.itemContainer.anchorLeft=10,this.itemContainer.anchorRight=10,this.itemContainer.anchorBottom=40,b.addChild(this.itemContainer)},this.initInventoryMenu=function(){var i=this.menuContainer=new a.UI.Container("100%",37);i.anchorTop=0,this.inventoryContainer.addChild(i);var k=new a.UI.SliceSprite(cf,3,(!0),(!0));k.tint=0,k.width="100%",k.height="100%",k.alpha=.5,i.addChild(k);var n=function(b,c,d,e,f){var g=new a.UI.CheckBox({checked:!!e,background:a.UI.Sprite.fromFrame("UI/blank.png"),checkgroup:b,value:d});return g.background.alpha=g.checked?.49:.15,g.background.tint=g.checked?2540799:16777215,g.text=new a.UI.DynamicText(c,{style:fd}),g.text.y=5,g.text.horizontalAlign="center",g.text.alpha=g.checked?1:.8,g.addChild(g.text),g.width=76,g.height=21,g.change=function(b){a.UI.Tween.to(this.background,.4,{alpha:b?.45:.15},a.UI.Ease.Circ.CircOut),a.UI.Tween.to(this.background,.4,{tint:b?"#26c4ff":"#ffffff"},a.UI.Ease.Circ.CircOut),a.UI.Tween.to(this.text,.4,{alpha:b?1:.8},a.UI.Ease.Circ.CircOut)},g.on("change",f),g};e=new a.UI.Container("100%",70),e.anchorBottom=0,g=new a.UI.Container("100%",30),this.inventoryContainer.addChild(e,g);for(var o=[{text:"NEWEST",value:ig.newest,checked:!0},{text:"QUALITY",value:ig.quality}],q=0;qn;j=n,void 0!==o&&(l=o),void 0!==p&&(m=p),f.post("/Inventory/GetInventory",{page:j,sort:l,filter:m}).done(function(f){i=f[0],b.setActive(i>1&&j>1),c.setActive(i>1&&j1?.9:.1},a.UI.Ease.Circ.CircOut);for(var l=f[1],m=[],n=0;n=0;g--){var i=this.itemContainer.children[g];i.renderId=q,this.itemContainer.removeChild(i)}for(var g=0;ge.getLevel()?void nc.open("ERROR","Tank requires Crew Level "+d.RequiredCrewLevel,"OK"):(i.interactive=!1,void(h||f.post("/Crew/EquipTank",{classId:d.ID,crewIndex:e.index}).done(function(a){if(i.interactive=!0,a.success)for(var b=0;b"+vf[b]+" LVL "+e.getLevel();var f=tankClass[e.classId];if(!e.unlocked)return void(i.visible=i.interactive=!1);i.visible=i.interactive=!0,e.classId<=0?j.container.visible=!1:(j.container.visible=!0,j.loadClass(f.ID,f.SkinCannon?f.SkinCannon:f.DefaultSkinCannon,f.SkinBody?f.SkinBody:f.DefaultSkinBody));var g=d.RequiredCrewLevel<=e.getLevel();h=c.ID==e.classId,a.UI.Tween.to(i.background,.3,{tint:h?"#aedf29":"#ffffff",alpha:h?.5:.3},a.UI.Ease.Circ.CircOut),a.UI.Tween.to(j.container,.3,{alpha:h?1:.4},a.UI.Ease.Circ.CircOut),a.UI.Tween.to(i,.3,{alpha:g?1:.4},a.UI.Ease.Circ.CircOut)}},sg=function(){var b=this,c=this.container=new a.UI.Container(10,100);c.horizontalAlign="center";var d=this.headline=new a.UI.DynamicText("EQUIP TANK",{style:kd,width:"100%"});d.style.align="center",c.addChild(d);for(var e={},f=0;f<6;f++){var g=e[f]=new rg(f,b);c.addChild(g.container),g.container.x=85*f,g.container.y=27}this.update=function(a){var b=0;for(var d in e)g=e[d],g.update(a),g.container.visible&&(b=g.container.x);c.width=b+80}},tg=function(){var b=this.container=new a.UI.Container(240,50),c=function(){var b=this.container=new a.UI.Container("100%",20),c=a.Texture.fromFrame("UI/check_false.png"),d=a.Texture.fromFrame("UI/check_true.png"),e=new a.UI.Sprite(c);e.y=3;var f=new a.UI.DynamicText("hej",{style:ad});f.anchorLeft=20,b.addChild(e,f),this.update=function(a,b){f.value=a,e.sprite.texture=b?d:c,f.alpha=b?1:.7}},d=new a.UI.DynamicText("Requirements",{style:jd}),e=new c,f=new c;f.container.anchorTop=20,e.container.anchorTop=40,b.addChild(d,e.container,f.container),this.update=function(a){var b=!0;if(a.RequiredTankUnlock>0){e.container.visible=!0;var c=tankClass[a.RequiredTankUnlock];e.update("Unlock "+c.Name,c.owned),c.owned||(b=!1)}else e.container.visible=!1;var d=pf.crews.getMaxLevel(),g=d>=a.RequiredCrewLevel;return f.update("Reach Crew Level "+a.RequiredCrewLevel+(g?"":" (Current: "+d+")"),g),g||(b=!1),b}},ug=function(){var b,c=this.container=new a.UI.Container(523,"100%");c.alpha=0;var d=this,e=a.UI.Sprite.fromFrame("UI/blank.png");e.tint=8354161,e.width="100%",e.height="100%",e.alpha=.7;var g=new a.UI.Sprite(df);g.width="100%",g.height="100%",g.alpha=.3,g.tint=2490144,c.addChild(e,g);var h=new xh;h.container.anchorTop=19,c.addChild(h.container);var i=new vh,j=new vh;i.container.y=19,j.container.y=154,i.container.anchorRight=j.container.anchorRight=10,c.addChild(i.container,j.container);var k=a.UI.Sprite.fromFrame("UI/blank.png");k.tint=0,k.width=248,k.height=111,k.alpha=.15,k.anchorTop=292,k.anchorRight=10,c.addChild(k);var l=new a.UI.DynamicText(" ",{style:ad,width:237,height:100});l.anchorTop=297,l.anchorRight=10,c.addChild(l);var m=new wh;m.container.anchorTop=292,m.container.anchorLeft=10,c.addChild(m.container);var n=new tg;n.container.anchorLeft=13,n.container.anchorTop=410,c.addChild(n.container);var o=new sg;o.container.anchorTop=410,c.addChild(o.container);var p=new a.UI.Container("100%",150);p.anchorBottom=0,c.addChild(p);var q=lh(210,40,function(){f.post("/Shop/StartUnlockTank",{id:b.class.ID}).done(function(a){if(a.success){vc.open(a.price,a.currency,"Unlock "+b.class.Name,-1,function(){googa("send","event","TankPage","Purchase init - "+b.class.Name),f.post("/Shop/UnlockTank",{id:b.class.ID}).done(function(a){a.success?(pf.wallet.UpdateBalance(a.currency,a.balance),nc.open("PURCHASE COMPLETE","Unlock "+b.class.Name,"OK"),b.unlock(),d.load(b,!0),googa("send","event","TankPage","Purchase Success - "+b.class.Name)):(a.message?nc.open("PURCHASE ERROR",a.message,"OK"):nc.open("PURCHASE ERROR","","OK"),googa("send","event","TankPage","Purchase Error - "+b.class.Name))})})}else{if(a.missing){pc.open(a.missing,a.currency),googa("send","event","TankPage","Purchase Missing - "+b.class.Name)}a.message&&(nc.open("ERROR",a.message,"OK"),googa("send","event","TankPage","Purchase Error - "+b.class.Name))}})});q.anchorBottom=13,q.anchorRight=14,p.addChild(q);var r=lh(100,40,function(){d.unfocus()},new a.UI.DynamicText("CLOSE",{style:kd}));r.anchorBottom=13,r.anchorLeft=14,p.addChild(r);var s=new a.UI.DynamicText("UNLOCK",{style:kd});s.y=10,s.x=20,q.addChild(s);var v=new ec(0,ah.Gold,2);v.container.anchorRight=10,v.container.y=36,q.addChild(v.container);var w=new ec(0,ah.Gold,2);w.container.anchorBottom=17,w.container.anchorRight=24,c.addChild(w.container),this.unfocus=function(){c.interactive=!1,b=void 0,d.refresh()},this.load=function(f,k){var r=f.class;o.container.visible=p.visible=n.container.visible=w.container.visible=q.visible=q.interactive=!1;var s=n.update(r);return!s&&k?(k=!1,void d.unfocus()):(k&&(c.interactive=!0,b=f),a.UI.Tween.to(g,.3,{tint:1==r.WeightClass?"#25ff20":2==r.WeightClass?"#5b67ff":3==r.WeightClass?"#ff0000":"#ffa200"},a.UI.Ease.Circ.CircOut),1==r.WeightClass?a.UI.Tween.to(c,.3,{anchorLeft:395},a.UI.Ease.Circ.CircOut):2==r.WeightClass?a.UI.Tween.to(c,.3,{anchorLeft:0},a.UI.Ease.Circ.CircOut):3==r.WeightClass?a.UI.Tween.to(c,.3,{anchorLeft:365},a.UI.Ease.Circ.CircOut):a.UI.Tween.to(c,.3,{anchorLeft:532},a.UI.Ease.Circ.CircOut),l.value=r.Description,h.update(r),m.update(r),i.update(r.PrimaryWeapon,r.PrimaryConfig),j.update(r.SecondaryWeapon,r.SecondaryConfig),a.UI.Tween.to(e,.3,{alpha:k?1:.85},a.UI.Ease.Circ.CircOut),k?(p.visible=!0,r.owned?(o.container.visible=!0,o.headline.visible=!0):(n.container.visible=!0,s?q.container.visible=q.container.interactive=!0:w.container.visible=!0)):r.owned?(o.container.visible=!0,o.headline.visible=!1):(n.container.visible=!0,w.container.visible=!0),o.container.visible&&o.update(r),w.container.visible&&(w.updateAmount(r.UnlockPrice),w.updateCurrency(r.UnlockCurrency)),void(q.container.visible&&(v.updateAmount(r.UnlockPrice),v.updateCurrency(r.UnlockCurrency))))};var x;this.refresh=function(){b||(qg?(x&&t(x),x=void 0,a.UI.Tween.to(c,.3,{alpha:1},a.UI.Ease.Circ.CircOut),d.load(qg)):x=u(function(){d.clear()},250))},this.clear=function(){a.UI.Tween.to(c,.6,{alpha:0})}},vg=function(){var b,c=this,d=!1,e=new a.display.Layer,f=new a.display.Layer,g=new a.display.Layer,h=new a.display.Layer,i=new a.display.Layer,j=new a.display.Layer;this.init=function(){d=!0;var c=this.container=new a.UI.Container("100%","100%");c.verticalAlign="middle",c.horizontalAlign="center",c.pivot=.5,pf.container.addChild(c),tankClass[100].owned=!0,tankClass[200].owned=!0,tankClass[300].owned=!0,this.initTankLayout(),c.container.addChild(e,f,g,h,i,j),l(100,208,516),l(200,600,516),l(300,980,516),b=new ug,c.addChild(b.container),b.container.parentLayer=j},this.initTankLayout=function(){var b=this.inventoryContainer=new a.UI.Container("100%","100%");b.anchorRight=0,b.anchorLeft=0,this.container.addChild(b);var c=68,d=0,e=34,f=new a.UI.SliceSprite(cf,3,(!0),(!0),(!0));f.tint=10066329,f.width="100%",f.height="100%",f.alpha=.5,b.addChild(f);var g=new a.UI.Sprite(ff);g.tint=0,g.width=70,g.height="100%",g.alpha=.6,b.addChild(g);for(var h=!1,j=0;j<8;j++){if(!h){var k=new a.UI.Sprite(ff);k.tint=16777215,k.width="100%",k.height=c,k.alpha=.04,k.anchorBottom=d+c*j,b.addChild(k)}var l=new a.UI.DynamicText(""+(j+1),{style:ld});l.parentLayer=i,l.tint=16777215,l.anchorLeft=28,l.anchorBottom=d+17+c*j,b.addChild(l),h=!h}var k=new a.UI.Sprite(ff);k.tint=0,k.width=70,k.height=e,k.alpha=.5,k.anchorTop=0,b.addChild(k);var l=new a.UI.DynamicText("REQUIRED\nCREW LEVEL",{style:gd});l.parentLayer=i,l.style.lineHeight=12,l.style.align="center",l.width=70,l.tint=16777215,l.anchorTop=4,b.addChild(l);var k=new a.UI.Sprite(ff);k.tint=16777215,k.height=e,k.alpha=.1,k.anchorLeft=70,k.anchorRight=0,k.anchorTop=0,b.addChild(k);for(var j=0;j<3;j++){var m=new a.UI.Sprite(df);m.tint=0==j?2490144:1==j?5990399:2==j?16711680:16753152,m.height=e,m.alpha=.3,m.width=383,m.anchorLeft=70+383*j,m.anchorTop=0,m.anchorBottom=0,m.blendMode=2,b.addChild(m);var l=new a.UI.DynamicText(0==j?"LIGHT TANK":1==j?"MEDIUM TANK":2==j?"HEAVY TANK":"SPECIAL",{style:id});l.parentLayer=i,l.tint=16777215,l.anchorLeft=m.anchorLeft,l.anchorTop=8,l.width=m.width,l.style.align="center",b.addChild(l)}};var k=function(a){var b=[];for(var c in tankClass){tankClass[c].RequiredTankUnlock==a&&b.push(c)}return b},l=function(b,d,g,h){var i=tankClass[b],j=m(b);if(i.PreviewTankTree=j,d+=94*i.TreeOffset,j.container.parentLayer=f,j.container.x=d,j.container.y=g+68-68*i.RequiredCrewLevel,c.container.addChild(j.container),h){var n;if(0!=i.TreeOffset)n=a.UI.Sprite.fromFrame("UI/Menu/Tanks/tree-line-offset.png"),1===i.TreeOffset?(n.scaleX=-1,n.anchorLeft=-5+n.width):n.anchorRight=-5;else{n=a.UI.Sprite.fromFrame("UI/Menu/Tanks/tree-line.png");var o=j.class.RequiredCrewLevel-h.class.RequiredCrewLevel;n.height=16*o+52*(o-1),n.horizontalAlign="center"}n.parentLayer=e,n.bottom=4,j.container.addChild(n)}j.parent=h,j.children=[];for(var p=k(b),q=0;q"+g+". "+m,l.value=n,i.sprite.texture=a.Texture.fromFrame("UI/Rank/Small/"+k.min(240,e)+".png"),h.sprite.texture=c?a.Texture.fromImage("/avatar?path="+c):a.Texture.fromFrame("UI/avatar.png"),d.visible=d.interactive=!0},this.clear=function(){d.visible=d.interactive=!1}},xg=function(){var b=1,c=-1,d=2,e=0,g=this,h=this.container=new a.UI.Container,i=new a.UI.Container;i.anchorTop=i.anchorLeft=i.anchorRight=0,i.anchorBottom=40,h.addChild(i);var j=a.UI.Sprite.fromFrame("UI/blank.png");j.tint=8027265,j.width="100%",j.height="100%",j.alpha=.5,i.addChild(j);var l=new a.UI.Button({width:50,height:35,background:a.UI.Sprite.fromFrame("UI/blank.png"),text:new a.UI.DynamicText("▶",{style:jd})}),m=new a.UI.Button({width:50,height:35,background:a.UI.Sprite.fromFrame("UI/blank.png"),text:new a.UI.DynamicText("◀",{style:jd})});l.anchorBottom=m.anchorBottom=0,l.anchorRight=0,m.anchorRight=55,l.background.tint=m.background.tint=3355443,h.addChild(l,m),l.setState=m.setState=function(a){this.interactive=a,this.alpha=a?1:.3,this.background.tint=a?10695212:3355443},l.on("click",function(){g.nextPage()}),m.on("click",function(){g.prevPage()});for(var n=[],o=!1,p=0;p<10;p++){var q=new wg(o);n.push(q),q.container.y=10*p+"%",i.addChild(q.container),o=!o}this.setPeriod=function(a){a!=d&&(d=a,b=1,this.load())},this.setGamemode=function(a){a!=c&&(c=a,b=1,this.load())},this.setType=function(a){a!=e&&(e=a,b=1,this.load())},this.setPage=function(a){a=k.min(20,k.max(1,a)),a!=b&&(b=a,this.load())},this.nextPage=function(){this.setPage(b+1)},this.prevPage=function(){this.setPage(b-1)},this.setSettings=function(a,f,g,h){d=a,c=g,e=f,b=k.min(20,k.max(1,h)),this.load()};var r=null;this.load=function(){var a={GameMode:c,Type:e,Period:d,Page:b,AmountPerPage:10};r&&r.abort(),r=f.ajax({type:"POST",url:"/leaderboard/",data:a,success:function(b){var c="";switch(a.Type){case 1:c+="Most Wins-";break;case 2:c+="Most Kills-";break;case 3:c+="Best K/D-"}switch(a.GameMode){case-1:c+="All Gamemode-";break;case 0:c+="King DM-";break;case 1:c+="Conquest-"}switch(a.Period){case 0:c+="Today-";break;case 1:c+="This Month-";break;case 2:c+="Alltime-"}googa("send","event","Leaderboard",c+"p"+a.Page);for(var d=0;d=a.AmountPerPage),m.setState(a.Page>1)},dataType:"json"})},this.reset=function(){}},yg=function(){var b=!1;this.openTopLeaderboard=function(){},this.init=function(){b=!0;var c=this.container=new a.UI.Container("100%","100%");c.verticalAlign="middle",c.horizontalAlign="center",c.pivot=.5,pf.container.addChild(c);var d=new a.UI.SliceSprite(cf,3,(!0),(!0),(!0));d.tint=12105912,d.width="100%",d.height="100%",d.alpha=.7,c.addChild(d);var d=new a.UI.SliceSprite(cf,3,(!0),(!0),(!0));d.tint=0,d.width="100%",d.anchorTop=40,d.anchorBottom=0,d.alpha=.3,c.addChild(d);var e=a.UI.Sprite.fromFrame("UI/Menu/Icons/leaderboard.png");e.top=8,e.left=12;var f=new a.UI.DynamicText(nf("LEADERBOARD"),{style:id});f.left=60,f.top=10,c.addChild(e,f);var g=a.UI.Sprite.fromFrame("UI/blank.png");g.width=150,g.height=40,g.y=45,g.x=10,g.tint=8027265,c.addChild(g);var h=new a.UI.DynamicText("Top Level",{style:ld});h.verticalAlign="middle",h.horizontalAlign="center",g.addChild(h);var i=new xg;i.container.anchorTop=90,i.container.anchorLeft=i.container.anchorBottom=10,i.container.width=400,c.addChild(i.container),i.setSettings(2,0,-1,1);var j=new xg;j.container.anchorTop=90,j.container.anchorRight=j.container.anchorBottom=10,j.container.anchorLeft=420,j.setSettings(2,2,-1,1),c.addChild(j.container);var k=new a.UI.Container;k.height=40,k.anchorRight=10,k.anchorLeft=420,k.y=45,c.addChild(k);var l=new Qh([["Most Wins",2,200,!0],["Most Kills",1,200],["Best K/D",3,200],["Win Rate",4,200]],0,function(a){j.setType(a)});c.addChild(l.container),l.container.anchorRight=0,l.marker.tint=10695212;var m=new Qh([["All Time",2,140,!0],["This Month",1,180],["Today",0,120]],0,function(a){j.setPeriod(a)});k.addChild(m.container),m.container.anchorRight=0,m.marker.tint=10695212;var n=new Nh(311,40,18,18,[["All Gamemodes","-1",!0],["King DM","0",!0],["Conquest","1",!0]],function(a){j.setGamemode(a)});n.container.anchorLeft=0,k.addChild(n.container),this.openTopLeaderboard=function(){l.select(3),j.setType(3),m.select(1),j.setPeriod(1),n.select(1),j.setGamemode(1)}},this.open=function(a){b||this.init()},this.close=function(a){}},zg=function(){var b,c,d,e,f,g,h,i=!1,j=!1;this.init=function(){i=!0,c=this.container=new a.UI.Container("100%","100%"),c.verticalAlign="middle",c.horizontalAlign="center",c.pivot=.5,pf.container.addChild(c),d=new a.UI.Container(917,"100%"),d.anchorRight=0,h=new a.UI.SliceSprite(cf,3,(!0),(!0),(!0)),h.tint=15592941,h.width="100%",h.height="100%",h.alpha=.6,g=new a.UI.SliceSprite(ef,3),g.tint=1118481,g.width="100%",g.height=37,g.alpha=.35,f=new a.UI.DynamicText(nf("SETTINGS"),{style:id}),f.left=12,f.top=10,d.addChild(h,g,f),e=new a.UI.Container("100%",540),e.anchorLeft=e.anchorRight=e.anchorBottom=0,d.addChild(e),c.addChild(d),b=this.menu=new Lg,c.addChild(b.container)},this.open=function(a){i||this.init(),j=!0},this.close=function(a){j=!1};var k,l={};this.openSubMenu=function(c){if(j||pf.openSubMenu(pf.settingsPage),!l[c])switch(c){case"GAME":l[c]=new Tg;break;case"CONTROLS":l[c]=new Rg;break;case"AUDIO":l[c]=new Qg;break;case"VIDEO / VISUAL":l[c]=new Ug;break;case"ACCOUNT":l[c]=new Mg;break;default:return;
}if(k){var d=k;d.active=!1,d.container.interactiveChildren=!1,a.UI.Tween.to(d.container,.2,{alpha:0,onComplete:function(){d.active||(d.container.visible=!1)}},a.UI.Ease.Cubic.easeOut)}var g=l[c];g.active=!0,g.container.interactiveChildren=!0,g.container.visible=!0,g.update(),k=g,null===g.container.parent&&(g.container.anchorRight=0,e.addChild(g.container)),f.value=nf(c),a.UI.Tween.fromTo(g.container,.5,{alpha:0,scale:.95},{alpha:1,scale:1},a.UI.Ease.Cubic.easeOut),b.buttons[c].setActive()}},Ag=function(){var b=this.container=new a.UI.Container("100%","100%"),c=new a.UI.ScrollingContainer((!1),(!0),(!0));b.addChild(c),c.height="100%",c.anchorLeft=0,c.anchorRight=12;var d=10,e=[];ScrollBar=new a.UI.ScrollBar({track:new a.UI.SliceSprite(hf,4),handle:new a.UI.SliceSprite(gf,4),vertical:!0,scrollingContainer:c,autohide:!0}),ScrollBar.width=ScrollBar.track.width=ScrollBar.handle.width=12,ScrollBar.anchorTop=5,ScrollBar.anchorBottom=5,ScrollBar.anchorRight=0,ScrollBar.track.tint=2236962,ScrollBar.track.blendMode=0,b.addChild(ScrollBar),this.addChild=function(a,b){e.push(a),a.container.y=d,b||(d+=10+a.container.height),c.addChild(a.container)},this.update=function(){for(var a=0;a "+h.input.value,-1,function(){googa("send","event","Account","Purchase Init - ChangeName"),f.post("/Account/ChangeName",{name:h.input.value}).done(function(a){a.success?(Zh.data.username=a.name,Zh.updateUiValues(),pf.wallet.UpdateBalance(ah.Gems,a.gems),nc.open("NAME CHANGED","New Nickname: "+h.input.value,"OK"),googa("send","event","ChangeName","Success"),h.update()):(nc.open("ERROR CHANGING NAME",a.message,"OK"),googa("send","event","ChangeName","Error - "+a.message))})})}else{qc.open(a.missing),googa("send","event","Account ChangeName","Purchase Missing")}})}),i=new Fg(b,"Mail","",0,Zh.data,"email",0,0,function(){f.post("/Account/ChangeMail",{mail:i.input.value}).done(function(a){a.success?(Zh.data.email=a.mail,Zh.updateUiValues(),nc.open("EMAIL CHANGED","Succesfully changed email to "+a.mail,"OK"),googa("send","event","ChangeEmail","Success"),i.update()):(nc.open("ERROR CHANGING EMAIL",a.message,"OK"),googa("send","event","ChangeEmail","Error - "+a.message))})}),j=new Bg(b,"Allow Friend Requests",Zh.data,"acceptFriendRequests",function(){t(a),a=u(function(a){Zh.data["acceptFriendRequests"]=j.check.checked,$h.SettingsEvents.UpdateUserSetting("acceptFriendRequests",""+Zh.data["acceptFriendRequests"])},1500)});b.addChild(new Ng),c.addChild(new Pg);var k=new Eg(e,"Show Purchace History",200,40,"15%",5,0,.5,function(){Dd.SaleLog.Open()});k.container.anchorLeft=-135;var l=new Eg(e,"Delete stored payment details",240,40,"15%",5,0,.5,function(){f.post("/Shop/ClearCards").done(function(a){nc.open("Clear Payment Details",a?"Success":"Error","OK")})},(!0));l.container.y=k.container.y,l.container.anchorLeft=105;var m=new Eg(e,"Manage newsletter subscription",240,40,"15%",5,0,.5,function(){d.open("/Account/NewsLetter","_blank").focus()},(!0));m.container.y=k.container.y,m.container.anchorLeft=392,new Eg(g,"DELETE ACCOUNT",200,40,"15%",5,16711680,.5,function(){yc.open("DELETE ACCOUNT","You are about to delete your account PERMANENTLY!\nAre you sure about that?","DELETE","ABORT!",!1,!0,function(){pf.buttons.Home.button.click(),$h.SettingsEvents.DeleteUser()},function(){})}).container.anchorLeft=-135;new Dg(g,"* Clicking this button will delete your account permanently!",20,$c);this.addChild(b),this.addChild(c),this.addChild(e),this.addChild(g)},Ng=function(){var b=this,c=[["None","0"],["Facebook","1"],["Steam","2"],["Twitter","4"],["Gravatar","3"]],d=this.container=new a.UI.Container("100%",130),e=a.UI.Sprite.fromFrame("UI/avatar.png");Zh.data["avatar"].length&&(e.sprite.texture=new a.Texture.fromImage("/avatar?path="+Zh.data["avatar"])),e.height=100,e.width=100,e.anchorLeft=205,d.addChild(e);var f=new a.UI.DynamicText("Avatar",{style:id});d.addChild(f),f.y=3,f.x=13;var g={},h=205,i=30;Zh.onData(function(){b.update(),b.updateAvatar()});for(var j=0;j2&&(l=0,k++);this.update=function(){}},Xg=function(b,c,d,e){var f=this,g=this.container=new a.UI.Container("20%",120);this.color=b;var h=this.button=new a.UI.Button({background:a.UI.Sprite.fromFrame("UI/blank.png"),width:20,height:20});h.background.tint=this.color.replace("#","0x"),h.y=c,h.anchorLeft=d,g.addChild(h),h.on("click",function(a){"function"==typeof e&&e(f)})},Yg=function(b){var c=this.container=new a.UI.ScrollingContainer((!1),(!1));c.anchorLeft="60%",c.anchorRight=0,c.height="100%",c.interactive=!1,b.addChild(this,!0);var d=new a.UI.Container;d.verticalAlign="middle",d.horizontalAlign="center",c.addChild(d);var e=a.Sprite.fromFrame("Helpers/ring_transparent.png");e.anchor.set(.5),e.blendMode=a.BLEND_MODES.ADD,d.container.addChild(e);var f=new S;d.container.addChild(f.container),this.update=function(){var a=pf.crews.getCrew(0),b=tankClass[a.classId];f.loadClass(b.ID,b.SkinCannon?b.SkinCannon:b.DefaultSkinCannon,b.SkinBody?b.SkinBody:b.DefaultSkinBody),e.tint=rf.UserSettings["ColorMe"].replace("#","0x"),e.alpha=rf.UserSettings["ColorAlphaMe"],e.scale.set(rf.UserSettings["HelperScaleMe"])}};Ug.prototype=Object.create(Ag),Ug.prototype.constructor=Ug;var Zg=void 0,$g=function(b,c,d,e,f){this.active=!1;var g=this,h=a.UI.Sprite.fromFrame("UI/blank.png");h.width=h.height="100%",h.tint=f?7770392:0,h.alpha=.15;var i=new a.UI.DynamicText(" "+nf(b),{style:kd});i.horizontalAlign="center",i.y=36,i.pivot=.5;var j=a.UI.Sprite.fromFrame("UI/Menu/Shop/Icons/"+d);j.x=e.x,j.y=e.y,i.addChild(j),this.container=new a.UI.Button({background:h}),this.container.width=f?240:190,this.container.height="100%",this.container.on("hover",function(b){a.UI.Tween.to(i,.5,{scale:b?1.1:1},a.UI.Ease.Circ.CircOut),g.active||a.UI.Tween.to(h,.5,{alpha:b?.08:.15},a.UI.Ease.Circ.CircOut)}),this.setActive=function(b){if(b){if(Zg){if(Zg==this)return;Zg.setActive(!1)}Zg=this}a.UI.Tween.to(h,.5,{alpha:b?.3:.15},a.UI.Ease.Circ.CircOut),this.active=b},this.click=function(){this.container.click()},this.container.on("click",function(){g.setActive(!0),c.open(),googa("send","event","ShopMenu",b+" Clicked")}),this.container.addChild(h,i)},_g=function(){this.cratesPage=new hc,this.gemsPage=new ic,this.goldPage=new jc,this.premiumPage=new kc,this.talentPage=new lc,this.offerPage=new dc,this.menuPages=[["CRATES",this.cratesPage,"crate.png",{x:-21,y:-8}],["GEMS",this.gemsPage,"gem.png",{x:-8,y:-10}],["GOLD",this.goldPage,"gold.png",{x:-6,y:-2}],["TALENT",this.talentPage,"talent.png",{x:-8,y:-2}],["PREMIUM",this.premiumPage,"premium.png",{x:-8,y:-8}],["FREE OFFERS",this.offerPage,"offers.png",{x:-13,y:-9}]],this.menuButtons={};var b=!1;this.init=function(){b=!0;var c=this.container=new a.UI.Container("100%","100%");c.verticalAlign="middle",c.horizontalAlign="center",c.pivot=.5,pf.container.addChild(c),this.initShopContainer(),this.initMenu()},this.initMenu=function(){var b=this.previewContainer=new a.UI.Container("100%",69);this.container.addChild(b);var c=new a.UI.SliceSprite(cf,3,(!0),(!0),(!0));c.tint=14606046,c.width="100%",c.height="100%",c.alpha=.4,b.addChild(c);for(var d=0;d"+this.bulletHeadline+"\n");for(var c=0;c• "+this.bulletTexts[c]+"\n";var d=this.bulletText=new a.UI.DynamicText(b,{style:id,allowTags:!0});this.container.addChild(d),d.x=this.bulletX,d.y=this.bulletY;for(var c=0;c0?"#a4ff53":0==g?"#ffffff":"#e66565"},a.UI.Ease.Circ.CircOut),k.value=p(g.toFixed(2))+f)}},this.updateData=function(a,d,e,f){b=a,c=d,n.value=b,m.alpha=f,m.tint=e,l.visible=!0},this.hide=function(){l.visible=!1}},gh=function(b,c,d,e,f,g,h){var i=this.container=new a.UI.Container(c),j=[];this.update=function(a){for(var b=0;bName\n \nTitle",{style:cd,width:"100%",allowTags:!0});g.style.align="center",g.style.lineHeight=16,g.y=140,b.addChild(g),this.update=function(a,b){g.value=""+a.name+"\n"+a.title;var c=a.getTexture();e.texture=c,e.alpha=1,e.scale.set(c.width/138),f.update(b)}},kh=function(b){eh.call(this,b,"COMMANDER",423,327),this.container.anchorBottom=0,this.container.anchorLeft=0,this.bg.tint=9679502;var c=new jh;this.container.addChild(c.container);var d=new ih;d.container.anchorBottom=59,d.container.anchorRight=10,this.container.addChild(d.container);var e=lh(240,41,function(){return Zh.authenticated?(pf.buttons["Inventory"].button.click(),void pf.inventoryPage.loadCommanders()):void xc.open("You must sign-in to change commander")},new a.UI.DynamicText("CHANGE COMMANDER",{style:jd}));e.anchorBottom=10,e.anchorRight=10,this.container.addChild(e);var f=new a.UI.DynamicText(" ",{style:bd,width:215,height:100});f.anchorTop=49,f.anchorRight=30,this.container.addChild(f);var g=new a.UI.DynamicText("NO COMMANDER EQUIPPED",{style:jd,width:"100%"});g.alpha=0,g.style.align="center",g.verticalAlign="middle",this.container.addChild(g);var h=function(b){a.UI.Tween.to(c.container,.3,{alpha:b?1:0},a.UI.Ease.Circ.CircOut),a.UI.Tween.to(d.container,.3,{alpha:b?1:0},a.UI.Ease.Circ.CircOut),a.UI.Tween.to(f,.3,{alpha:b?1:0},a.UI.Ease.Circ.CircOut),a.UI.Tween.to(g,.3,{alpha:b?0:.5},a.UI.Ease.Circ.CircOut)};this.load=function(a){eh.prototype.load.call(this,a),a.commanderId>0?eg.loadItemInfo([a.commanderId],function(){var b=eg.items[a.commanderId];c.update(b,a.commanderData),f.value=b.description,h(!0)}):h(!1)}};kh.prototype=Object.create(eh),kh.prototype.constructor=kh;var lh=function(b,c,d,e,f){var g;return g=new a.UI.Button(e?{background:new a.UI.SliceSprite(a.Texture.fromFrame("UI/Menu/box-border.png"),4),text:e}:{background:new a.UI.SliceSprite(a.Texture.fromFrame("UI/Menu/box-border.png"),4)}),g.height=c,g.width=b,g.background.alpha=f?1:.49,g.on("hover",function(b){a.UI.Tween.to(this.background,.4,{alpha:b?f?.8:.7:f?1:.49},a.UI.Ease.Circ.CircOut)}),g.on("click",function(a){d()}),g},mh=function(b){var c=this.container=new a.UI.Container;c.width=b,c.height=26,c.horizontalAlign="center";var d=600,e=1e3,f=a.UI.Sprite.fromFrame("UI/blank.png");f.height="100%",f.width="100%",f.alpha=.5,f.tint=0,c.addChild(f);var g=a.UI.Sprite.fromFrame("UI/blank.png");g.height="100%",g.alpha=.7,g.tint=15662902,g.width=(d/e*100).toFixed(1)+"%",c.addChild(g);var h=new a.UI.DynamicText(d+" / "+e,{style:vd,width:"100%"});h.anchorTop=3,h.style.align="center",c.addChild(h);var i=new a.UI.DynamicText("LEVEL 1",{style:jd});i.y=26,c.addChild(i);var j=new a.UI.DynamicText("LEVEL 2",{style:jd,width:100});j.y=26,j.anchorRight=0,j.style.align="right",c.addChild(j),this.set=function(a,b,c){d=a,e=b,g.width=(d/e*100).toFixed(1)+"%",h.value=d+" / "+e,i.value="LEVEL "+c,j.value="LEVEL "+(c+1)},this.setMax=function(a){g.width="100%",h.value="MAX",i.value="LEVEL "+(a-1),j.value="LEVEL "+a}},nh=function(){var b=void 0,c=this.container=new a.UI.Container;c.anchorBottom=c.anchorLeft=c.anchorTop=10,c.width=413;var d=a.UI.Sprite.fromFrame("UI/blank.png");d.height="100%",d.width="100%",d.alpha=.3,d.tint=0,c.addChild(d);var e=a.UI.Sprite.fromFrame("UI/blank.png");e.height=124,e.width="100%",e.alpha=.15,e.tint=0,e.anchorTop=50,c.addChild(e);var g=new a.UI.DynamicText("ALPHA CREW",{style:md});g.anchorLeft=14,g.anchorTop=7,c.addChild(g);var h=new a.UI.DynamicText("CREW LEVEL 1",{style:jd,allowTags:!0});h.anchorRight=12,h.anchorBottom=3,c.addChild(h);var i=new mh(388);i.container.anchorTop=57,c.addChild(i.container);var j=lh(244,41,function(){return Zh.authenticated?void f.post("/Crew/StartBuyXP",{crewIndex:b.index}).done(function(a){if(a.success){var c=a.price;vc.open(c,2,c+" CREW XP",-1,function(){googa("send","event","CrewPage","Purchase Init - BuyXP lvl->"+b.getLevel()+1),f.post("/Crew/BuyXP",{crewIndex:b.index}).done(function(a){a.success?(pf.crews.AddCrew(a.data,!0),pf.wallet.UpdateBalance(2,a.talent),nc.open("PURCHASE COMPLETE",c+" CREW XP","OK"),googa("send","event","CrewPage","Purchase Success - BuyXP lvl->"+b.getLevel()+1)):(nc.open("PURCHASE ERROR","","OK"),googa("send","event","CrewPage","Purchase Error - BuyXP lvl->"+b.getLevel()+1))})})}else{sc.open(a.missing),googa("send","event","Crew Purchase Missing","Purchase Missing - BuyXP lvl ->"+b.getLevel()+1)}}):void xc.open("You must sign-in to instant upgrade")});j.anchorTop=112,j.horizontalAlign="center",c.addChild(j);var k=new a.UI.DynamicText("INSTANT LEVEL UP\n "+c+"",k.value="INSTANT LEVEL UP\nLEVEL "+(c+1)+"",j.visible=j.interactive=c<8,l.updateAmount(b.getLevelXPMissing())}},oh=function(b){var c,d=this.container=new a.UI.Container(360,25);d.anchorBottom=-17,d.horizontalAlign="center";var e=new a.UI.SliceSprite(cf,3,(!0),(!0));e.tint=0,e.width=e.height="100%",e.alpha=.8,d.addChild(e);var g=new a.UI.DynamicText("LEVEL UP SKILL POINTS: 5",{style:Zc,allowTags:!0});g.anchorLeft=12,g.anchorTop=4,d.addChild(g);var h=lh(44,15,function(){c.resetLevelupStats(),b.updateStats()},new a.UI.DynamicText("CLEAR",{style:Zc,allowTags:!0}));h.anchorRight=70,h.anchorTop=5;var i=lh(60,15,function(){if(c.getUsedStatPointCount()>0){f.post("/Crew/LevelUp",{crewIndex:c.index,statPoints:[c.levelupStat.experience,c.levelupStat.damage,c.levelupStat.health,c.levelupStat.speed,c.levelupStat.aimSpeed,c.levelupStat.explosiveResistance,c.levelupStat.fireResistance,c.levelupStat.piercingResistance,c.levelupStat.electricResistance,c.levelupStat.chemicalResistance]}).done(function(a){a&&pf.crews.AddCrew(a,!0)})}},new a.UI.DynamicText("CONFIRM",{style:Zc,allowTags:!0}),!0);i.background.tint=13238154,i.anchorRight=7,i.anchorTop=5,d.addChild(h,i),this.update=function(a){c=a,d.visible=d.interactive=c.levelUp(),g.value="LEVEL UP SKILL POINTS: "+c.getRemainingStatPoints()+""}},ph=function(b,c,d,e){var f=void 0,g=this.container=new a.UI.Container(178,30),h=a.UI.Sprite.fromFrame("UI/grad-vertical.png");h.height="100%",h.width="100%",h.alpha=.1,g.addChild(h);var i=new a.UI.DynamicText(b,{style:_c});i.anchorLeft=8,i.anchorTop=1,g.addChild(i);var j=new a.UI.DynamicText("+1%",{style:hd});if(j.anchorRight=7,j.anchorTop=1,g.addChild(j),e){var k=new a.UI.Button({background:a.UI.Sprite.fromFrame("UI/crew/levelbutton.png")});k.anchorLeft=96,k.anchorBottom=2,g.addChild(k),k.on("click",function(){o()<5&&f.getRemainingStatPoints()>0&&(f.levelupStat[c]+=1,e.updateStats())})}for(var l=[],m=0;m<5;m++){var n=a.UI.Sprite.fromFrame("UI/crew/leveldot.png");n.x=17*m+8,n.anchorBottom=4,n.alpha=62,l.push(n),g.addChild(n)}var o=function(){return f.levelupStat?f.stat[c]+f.levelupStat[c]:f.stat[c]},p=function(){for(var b=o(),g=0;g=g+1?a.UI.Tween.to(h,.3,{alpha:.62,tint:"#a4ff53"},a.UI.Ease.Circ.CircOut):b>=g+1?a.UI.Tween.to(h,.3,{alpha:.62,tint:"#f8fb0e"},a.UI.Ease.Circ.CircOut):a.UI.Tween.to(h,.3,{alpha:.2,tint:"#000000"},a.UI.Ease.Circ.CircOut)}e&&(k.visible=k.interactive=f.getRemainingStatPoints()>0),j.value="+"+d*b+"%",a.UI.Tween.to(j.style,.3,{tint:b>0?"#a4ff53":0==b?"#ffffff":"#e66565"},a.UI.Ease.Circ.CircOut)};this.update=function(a){f=a,p()}},qh=function(){var b=this,c=void 0,d=this.container=new a.UI.Container;d.anchorBottom=d.anchorTop=10,d.anchorLeft=435,d.anchorRight=394;var e=a.UI.Sprite.fromFrame("UI/blank.png");e.height="100%",e.width="100%",e.alpha=.12,e.tint=0,d.addChild(e);var g=new a.UI.DynamicText("STAT POINTS",{style:md});g.anchorLeft=14,g.anchorTop=7,d.addChild(g);var h=lh(101,21,function(){f.post("/Crew/StartBuyReset",{crewIndex:c.index}).done(function(a){if(a.success){vc.open(a.price,2,"CREW STATPOINT RESET",-1,function(){googa("send","event","CrewPage","Purchase Init - StatReset lvl "+c.getLevel()),f.post("/Crew/BuyReset",{crewIndex:c.index}).done(function(a){a.success?(pf.crews.AddCrew(a.data,!0),pf.wallet.UpdateBalance(2,a.talent),nc.open("PURCHASE COMPLETE","CREW STATPOINT RESET","OK"),googa("send","event","CrewPage","Purchase Success - StatReset")):(nc.open("PURCHASE ERROR","","OK"),googa("send","event","CrewPage","Purchase Error - StatReset"))})})}else{sc.open(a.missing),googa("send","event","Crew Purchase Missing","StatReset")}})});h.anchorTop=13,h.anchorRight=14,d.addChild(h);var i=new a.UI.DynamicText("RESET",{style:gd});i.anchorLeft=11,i.anchorTop=5,h.addChild(i);var j=new ec(0,ah.Talent,1);j.container.anchorRight=5,j.container.y=20,h.addChild(j.container),j.updateAmount(500);for(var k=[],l=[["Experience","experience",SETTINGS["StatMult_Crew_Experience"]],["Damage/DPS","damage",SETTINGS["StatMult_Crew_Damage"]],["Health","health",SETTINGS["StatMult_Crew_Health"]],["Speed","speed",SETTINGS["StatMult_Crew_Speed"]],["Aim Speed","aimSpeed",SETTINGS["StatMult_Crew_AimSpeed"]],["Explosive Resistance","explosiveResistance",SETTINGS["StatMult_Crew_Resist_Explosive"]],["Fire Resistance","fireResistance",SETTINGS["StatMult_Crew_Resist_Fire"]],["Piercing Resistance","piercingResistance",SETTINGS["StatMult_Crew_Resist_Piercing"]],["Electric Resistance","electricResistance",SETTINGS["StatMult_Crew_Resist_Electric"]]],m=0;m=5&&(n.container.y-=150,n.container.x=199),k.push(n),d.addChild(n.container)}var o=new oh(b);d.addChild(o.container),this.load=function(a){c=a,h.visible=c.getStatPointCount()>0,this.updateStats()},this.updateStats=function(){for(var a=0;a0?1:0,g.alpha=a>0?0:1,!(a<=0)){var h=a,i=b[h];if(!i){var h="default";i=b[h]}var m=c[h];m||(m=c[h]=new gh(i,"100%",0,.09,0,.2,91),m.container.y=28),d!=m&&(d&&f.removeChild(d.container),f.addChild(m.container),d=m);var n=weapon[a],o=n["Stats"][e];j.value=n["Name"].toUpperCase(),k.value=o["Name"],l.value=uh[n.DamageType].toUpperCase(),d.update(o)}}},wh=function(b,c,d){var e=this.container=new a.UI.Container(b?b:250,c?c:111),f=new a.UI.Container("100%",80);f.y=35,f.x=7;var g=a.UI.Sprite.fromFrame("UI/blank.png");g.height="100%",g.width="100%",g.alpha=.2,g.tint=0,e.addChild(g);var h=new a.UI.DynamicText("START ABILITIES",{style:jd});h.x=11,h.y=6,e.addChild(h,f),d&&(h.align=f.align="center");for(var i={},j=0;j<4;j++){var k=i[j]=new rh((!1),.66,new a.UI.DynamicText(" ",{style:vd}));f.addChild(k.container),k.container.x=59*j}this.update=function(a){for(var b=0,c=0;c<4;c++){var d=i[c],e=a.StartAbilities[c];e?(d.container.alpha=1,d.update(e[0],e[1]),b++):d.container.alpha=0}f.width=59*b}},xh=function(){var b=this.container=new a.UI.Container;b.anchorTop=49,b.anchorLeft=10,b.width=319,b.height=268;var c=a.UI.Sprite.fromFrame("UI/blank.png");c.height="100%",c.width="100%",c.alpha=.2,c.tint=0,b.addChild(c);var d=new S,e=new a.UI.Container;e.horizontalAlign="center",e.y=60,e.container.addChild(d.container),b.addChild(e);var f=new a.UI.DynamicText(" ",{style:kd,width:"100%"});f.style.align="center",f.y=120,b.addChild(f);var g=new a.UI.DynamicText(" ",{style:$c,width:"100%"});g.style.align="center",g.style.tint="#c2c2c2",g.y=138,b.addChild(g);var h=[["Health","Stat_Health",10,!0,"%"],["Speed","Stat_Speed",10,!0,"%"],["Acceleration","Stat_Acceleration",10,!0,"%"],["Aim Speed","Stat_AimSpeed",10,!0,"%"],["Turn Speed","Stat_TurnSpeed",10,!0,"%"]],i=[["Explosive","Resist_Explosive",100,!1,"%"],["Fire","Resist_Fire",100,!1,"%"],["Piercing","Resist_Piercing",100,!1,"%"],["Electric","Resist_Electric",100,!1,"%"],["Chemical","Resist_Chemical",100,!1,"%"]],j=new gh(h,160,16777215,.1,16777215,.02,75),k=new gh(i,137,16777215,.1,16777215,.02);j.container.anchorLeft=k.container.anchorRight=7,j.container.y=k.container.y=184,b.addChild(j.container,k.container);var l=new a.UI.DynamicText("BASE STATS",{style:gd});l.anchorBottom=81,l.anchorLeft=13,b.addChild(l);var m=new a.UI.DynamicText("RESISTANCE",{style:gd});m.anchorBottom=81,m.anchorLeft=181,b.addChild(m),this.update=function(a,b,c){f.value=a.Name,g.value=1==a.WeightClass?"Light Tank":2==a.WeightClass?"Medium Tank":"Heavy Tank";var e=c?c:a.SkinCannon,h=b?b:a.SkinBody;d.loadClass(a.ID,e?e:a.DefaultSkinCannon,h?h:a.DefaultSkinBody),j.update(a),k.update(a)}},yh=function(b){eh.call(this,b,"TANK",788,327),this.container.anchorBottom=0,this.container.anchorRight=0,this.bg.tint=12369874;var c=new a.UI.Container("100%","100%");this.container.addChild(c);var d=new a.UI.DynamicText("NO TANK EQUIPPED",{style:jd,width:"100%"});d.alpha=0,d.style.align="center",d.verticalAlign="middle",this.container.addChild(d);var e=new xh;c.addChild(e.container);var f=new vh,g=new vh;f.container.y=49,g.container.y=184,f.container.x=g.container.x=339,c.addChild(f.container,g.container);var h=new a.UI.DynamicText(" ",{style:bd,width:245,height:100});h.anchorTop=49,h.anchorRight=10,c.addChild(h);var i=new wh;i.container.anchorBottom=59,i.container.anchorRight=10,c.addChild(i.container);var j=lh(250,41,function(){return Zh.authenticated?void pf.buttons["Tanks"].button.click():void xc.open("You must sign-in to change tanks")},new a.UI.DynamicText("CHANGE TANK",{style:jd}));j.anchorBottom=10,j.anchorRight=10,this.container.addChild(j);var k=function(b){a.UI.Tween.to(c,.3,{alpha:b?1:0},a.UI.Ease.Circ.CircOut),a.UI.Tween.to(d,.3,{alpha:b?0:.5},a.UI.Ease.Circ.CircOut)};this.load=function(a){eh.prototype.load.call(this,a);var b=tankClass[a.classId];b?(h.value=b.Description,e.update(b),i.update(b),f.update(b.PrimaryWeapon,b.PrimaryConfig),g.update(b.SecondaryWeapon,b.SecondaryConfig),k(!0)):k(!1)}};yh.prototype=Object.create(eh),yh.prototype.constructor=yh;var zh=function(){var b,c,d,e,g,h,i,j=this.container=new a.UI.Container("100%","100%"),k=!1,l=this;this.tanks=[],this.currentFriendID=0,this.badges=[],this.badgeCache={},this.addBadge=function(a,b){var c=this.badgeCache[a];c||(this.badgeCache[a]=c=new Ve[a]),c.load(b),this.badges.indexOf(c)===-1&&(c.container.anchorRight=10+75*this.badges.length,c.container.visible=!0,this.badges.push(c),d.container.addChild(c.container),d.levelContainer.anchorRight=10+75*this.badges.length)},this.clearBadges=function(){for(var a=0;a"+e+"",j.text=c,m.text=Dd.XPSystem.GetRankName(e);var g=ai.getFriend(d),l=d==Zh.data["friendID"];o.visible=o.interactive=!g&&!l,h.sprite.texture=f.length?a.Texture.fromImage("/avatar?path="+f):a.Texture.fromFrame("UI/avatar.png")}},Ch=function(a,b){this.GameMode=b,this.TimePlayed=a["a"]?a["a"]:0,this.Kills=a["b"]?a["b"]:0,this.Deaths=a["c"]?a["c"]:0,this.Assists=a["d"]?a["d"]:0,this.Killsteals=a["e"]?a["e"]:0,this.GamesPlayed=a["f"]?a["f"]:0,this.GamesWon=a["g"]?a["g"]:0,this.FastestWin=a["h"]?a["h"]:0,this.FastestLoss=a["i"]?a["i"]:0,this.PlayersDominated=a["j"]?a["j"]:0,this.PlayersDecimated=a["k"]?a["k"]:0,this.PlayersRevenged=a["l"]?a["l"]:0,this.HealingGiven=a["m"]?a["m"]:0,this.HealingRecieved=a["mm"]?a["mm"]:0,this.DamageGiven=a["n"]?a["n"]:{},this.DamageTaken=a["o"]?a["o"]:{},this.PowerUpDamageGiven=a["p"]?a["p"]:{},this.PowerUpDamageTaken=a["q"]?a["q"]:{},this.PowerUpKills=a["r"]?a["r"]:{},this.PowerUpDeaths=a["s"]?a["s"]:{},this.PowerUpUsed=a["t"]?a["t"]:{},this.PowerUpHitsGiven=a["u"]?a["u"]:{},this.PowerUpHitsTaken=a["v"]?a["v"]:{},this.PowerUpHealingGiven=a["w"]?a["w"]:{},this.PowerUpHealingRecieved=a["x"]?a["x"]:{},this.ClassesUsed=a["y"]?a["y"]:{},this.MultiKills=a["z"]?a["z"]:{},this.GamesLost=this.GamesPlayed-this.GamesWon,this.WinRate=this.GamesPlayed?(this.GamesWon/this.GamesPlayed*100).toFixed(1)+"%":"0%",this.KD=this.Kills,this.KDA=this.Kills,this.Deaths>0&&(this.KD=p((this.Kills/this.Deaths).toFixed(2)),this.KDA=p(((this.Kills+this.Assists)/this.Deaths).toFixed(2))),this.TimeSpentAsKing=a["a0"]?a["a0"]:0,this.PointsCollected=a["b0"]?a["b0"]:0,this.PointsLost=a["c0"]?a["c0"]:0,this.ZonesCaptured=a["a1"]?a["a1"]:0,this.ZonesNeutralized=a["b1"]?a["b1"]:0,this.ZonesDefended=a["c1"]?a["c1"]:0,this.EnemiesKilledInZones=a["d1"]?a["d1"]:0,this.Top10Placements=a["a2"]?a["a2"]:{}},Dh=function(b,c,d,e){var f=this.text=new a.UI.DynamicText(b,{style:$c,width:e,allowTags:!0});f.style.align="center",f.style.wrap=!1,f.style.lineHeight=15,this.update=function(a){var e=""+b+"\n";if("object"==typeof c)for(var g=0;g0&&(e+="/"),e+=a[c[g]];else if(0==d)e+=Fc(a[c]);else if(1==d){var h=q(a[c]);if(0==h)e+="0s";else{var i=k.floor(h/3600);i>0&&(e+=i+"h "),h-=3600*i;var j=k.floor(h/60);(i>0||j>0)&&(e+=j+"m ");var l=h-60*j;e+=l+"s",h-=3600*i}}f.value=e}},Eh=function(b,c){var d=this.container=new a.UI.Container("100%",30);this.max=0;var e=this.bg=a.UI.Sprite.fromFrame("UI/blank.png");e.width=e.height="100%",e.alpha=.1,d.addChild(e);var f=new a.UI.DynamicText(b,{style:hd});f.x=11,f.y=0;var g=new a.UI.DynamicText("Given",{style:gd,allowTags:!0,width:70}),h=new a.UI.DynamicText("Taken",{style:gd,allowTags:!0,width:70});g.style.align="right",h.style.align="right",g.style.y=h.style.y=3,g.anchorRight=75,h.anchorRight=7,g.style.lineHeight=h.style.lineHeight=14,d.addChild(f,g,h);var i=a.UI.Sprite.fromFrame("UI/blank.png"),j=a.UI.Sprite.fromFrame("UI/blank.png");i.height=j.height=5,i.x=j.x=11,i.anchorBottom=8,j.anchorBottom=2,i.tint=11785029,j.tint=12928582,d.addChild(i,j),this.update=function(b){var d=0;for(var e in b.DamageTaken)d=k.max(d,b.DamageTaken[e]);for(var e in b.DamageGiven)d=k.max(d,b.DamageGiven[e]);var f=b["DamageTaken"][c]?b["DamageTaken"][c]:0,l=b["DamageGiven"][c]?b["DamageGiven"][c]:0;this.max=k.max(f,l),h.text="Taken\n"+Fc(f),g.text="Given\n"+Fc(l),a.UI.Tween.to(j,.4,{width:d?k.max(2,f/d*160):2},a.UI.Ease.Cubic.easeOut),a.UI.Tween.to(i,.4,{width:d?k.max(2,l/d*160):2},a.UI.Ease.Cubic.easeOut)}},Fh=function(b,c,d){var e=this.container=new a.UI.Container("100%",21);if(e.y=43+21*d,Gc(d)){var f=this.bg=a.UI.Sprite.fromFrame("UI/blank.png");f.width=f.height="100%",f.alpha=.1,e.addChild(f)}var g=new a.UI.DynamicText(b,{style:hd});g.x=11,g.y=2;var h=new a.UI.DynamicText("test",{style:hd});h.anchorRight=11,e.addChild(g,h),this.update=function(a){h.value=(a.MultiKills[c]?a.MultiKills[c]:0)+""}},Gh=function(b,c,d,e,f){var g=this.container=new a.UI.Container(b,c),h=a.UI.Sprite.fromFrame("UI/blank.png");if(h.width=h.height="100%",h.alpha=e,h.tint=d,g.addChild(h),f){var i=new a.UI.DynamicText(f,{style:kd,width:"100%"});i.y=10,i.style.align="center",g.addChild(i)}var j={},k=[],l=[],m=[];this.addStatItem=function(b,c,d,e,f,h,i,l,m){if(!j[e]&&i){var n=j[e]=a.UI.Sprite.fromFrame("UI/blank.png");n.width="100%",n.height=h,n.alpha=.1,n.y=f,g.addChild(n)}var o=100/m*l,p=f+5,q=0;3==m?(q="18.5%",o*=.74,o+=4):2==m&&(q=70/3+"%",o*=.7,o+=4);var r=new Dh(b,c,d,q);r.text.x=o+"%",r.text.y=p,g.addChild(r.text),k.push(r)},this.addDamageItem=function(a,b){var c=new Eh(a,b);g.addChild(c.container),l.push(c)},this.addStreakItem=function(a,b,c){var d=new Fh(a,b,c);g.addChild(d.container),m.push(d)},this.update=function(b){for(var c=0;cb.max?-1:b.max>a.max?1:0});for(var d=!0,c=0;c"+Fc(d),b.value="Total Damage Given\n"+Fc(e)}},Lh=function(){Gh.call(this,234,264,987394,.4,"KILLSTREAKS"),this.container.x=970,this.container.y=70,this.addStreakItem("( 11+ ) UNSTOPPABLE",11,0),this.addStreakItem("( 10 ) INVINCIBLE",10,1),this.addStreakItem("( 9 ) RAMPAGE",9,2),this.addStreakItem("( 8 ) MASSACRE",8,3),this.addStreakItem("( 7 ) MEGA KILL",7,4),this.addStreakItem("( 6 ) Ultra Kill",6,5),this.addStreakItem("( 5 ) Killing Spree",5,6),this.addStreakItem("( 4 ) Multi Kill",4,7),this.addStreakItem("( 3 ) Triple Kill",3,8),this.addStreakItem("( 2 ) Double Kill",2,9)},Mh=function(){Gh.call(this,295,144,0,.24,"MOST USED TANK"),this.container.x=338,this.container.y=70;var b=new a.UI.Container;b.y=90,b.horizontalAlign="center",this.container.addChild(b);var c=new S;c.container.scale.set(.8),b.container.addChild(c.container);var d=new a.UI.DynamicText(" ",{style:hd,width:"100%"});d.anchorTop=30,d.style.align="center",d.style.tint="#CCCCCC",this.container.addChild(d),this.update=function(a,e){var f=-1,g=-1;for(var h in a.ClassesUsed){var i=a.ClassesUsed[h],j=tankClass[h];j&&i>g&&(g=i,f=h)}if(f!=-1){for(var j=tankClass[f],k=j.DefaultSkinBody,l=j.DefaultSkinCannon,m=0;m=0;t--)!function(){var h=f[t][0],i=f[t][1],j=f[t][2],k=new a.UI.Button({width:b,height:c,background:a.UI.Sprite.fromFrame("UI/blank.png")});k.dropdownValue=i,q[i]=k,k.setActive=function(b,c){b&&(p&&p.setActive(!1,!1),p=this,c&&"function"==typeof g&&g(i)),r.value=h,a.UI.Tween.to(this.background,.4,{tint:b?"#9a9a9a":"#707173"},a.UI.Ease.Cubic.easeOut)},k.on("hover",function(b){this!=p&&a.UI.Tween.to(this.background,.4,{tint:b?"#848484":"#707173"},a.UI.Ease.Cubic.easeOut)}),k.on("click",function(a){this!=p&&this.setActive(!0,!0),m(!1)}),k.background.tint=7369075,k.anchorBottom=s*c,o.addChild(k);var l=new a.UI.DynamicText(h,{style:kd,width:"100%"});l.style.overflowX="hidden",l.style.ellipsis=!0,l.verticalAlign="middle",l.anchorLeft=d,l.anchorRight=e,k.addChild(l),j&&k.setActive(!0,!1),s++}()},Oh=function(b){var c=this,d=this.container=new a.UI.Container(81,94);this.hover=!1,this.used=0,this.id=b.id,d.anchorBottom=0,d.pivot=.5;var e=a.UI.Sprite.fromFrame("UI/blank.png");e.width=e.height="100%",e.tint=4408389,d.addChild(e);var f=new rh((!1),.8);f.container.pivot=.5,f.container.left="50%",f.container.y=16,d.addChild(f.container),f.update(b.id);var g=new a.UI.DynamicText(b.name.toUpperCase(),{style:rd,width:"100%"});g.style.align="center",g.style.overflowX="hidden",g.style.ellipsis=!0,g.style.wrap=!1,g.anchorLeft=g.anchorRight=5,g.y=60,d.addChild(g);var h=new a.UI.DynamicText(" ",{style:Zc,width:150,allowTags:!0});h.style.align="center",h.style.tint="#d9d9d9",h.style.wrap=!1,h.style.lineHeight=14,h.y=78,h.horizontalAlign="center",d.addChild(h),new a.UI.Interaction.ClickEvent(e,(!0)).onHover=function(a,b){c.hover=b,b?c.focus():c.blur()},this.focus=function(){d.parent.addChild(d),a.UI.Tween.to(d,.4,{width:150,height:185},a.UI.Ease.Cubic.easeOut),a.UI.Tween.to(e,.4,{tint:"#5b5b5b"},a.UI.Ease.Cubic.easeOut)},this.blur=function(){a.UI.Tween.to(d,.4,{width:81,height:94},a.UI.Ease.Cubic.easeOut),a.UI.Tween.to(e,.4,{tint:"#434445"},a.UI.Ease.Cubic.easeOut)},this.update=function(a){var c=void 0!==a.PowerUpUsed[b.id]?a.PowerUpUsed[b.id]:0,d=void 0!==a.PowerUpDamageGiven[b.id]?a.PowerUpDamageGiven[b.id]:0,e=void 0!==a.PowerUpDamageTaken[b.id]?a.PowerUpDamageTaken[b.id]:0,f=void 0!==a.PowerUpKills[b.id]?a.PowerUpKills[b.id]:0,g=void 0!==a.PowerUpDeaths[b.id]?a.PowerUpDeaths[b.id]:0,i=void 0!==a.PowerUpHitsGiven[b.id]?a.PowerUpHitsGiven[b.id]:0,j=void 0!==a.PowerUpHitsTaken[b.id]?a.PowerUpHitsTaken[b.id]:0,k=void 0!==a.PowerUpHealingGiven[b.id]?a.PowerUpHealingGiven[b.id]:0,l=void 0!==a.PowerUpHealingRecieved[b.id]?a.PowerUpHealingRecieved[b.id]:0;this.used=c;var m="Used: "+c+"";0==f&&0==g||(m+="\nKills: "+Fc(f)+"",m+="\nDeaths: "+Fc(g)+""),0==d&&0==e||(m+="\nDamage Given: "+Fc(d)+"",m+="\nDamage Taken: "+Fc(e)+""),0==i&&0==j||(m+="\nHits Given: "+Fc(i)+"",m+="\nHits Taken: "+Fc(j)+""),0==k&&0==l||(m+="\nHealing Given: "+Fc(q(k))+"",m+="\nHealing Recieved: "+Fc(q(l))+""),h.text=m}},Ph=function(){var b=this.container=new a.UI.ScrollingContainer({width:"100%",height:150,scrollX:!1,scrollY:!1});b.anchorBottom=0;var c=new a.UI.Container(0,"100%");c.anchorBottom=0,b.addChild(c);var d=[],e=0,f=0,g=0;for(var h in Dd.PowerUps)if(q(h)>=0){var i=Dd.PowerUps[h],j=new Oh(i);j.container.x=f=84*e+40,a.UI.Tween.set(j.container,{x:j.container.x}),c.addChild(j.container),d.push(j),g=e,e++}c.width=84*e-3;var l=new a.Point,m=new a.UI.Interaction.ClickEvent(b,(!0));m.onMove=function(e){b.container.toLocal(Dd.Camera.mousePosition,null,l);var h=k.min(1,k.max(0,l.x/1220)),i=z(0,-(c.width-1220),h);a.UI.Tween.to(c,.4,{x:i},a.UI.Ease.Cubic.easeOut),d[0].hover?a.UI.Tween.to(d[0].container,.4,{x:75-i},a.UI.Ease.Cubic.easeOut):a.UI.Tween.set(d[0].container,{x:40}),d[g].hover?a.UI.Tween.to(d[g].container,.4,{x:f-35-(c.width-1220+i)},a.UI.Ease.Cubic.easeOut):a.UI.Tween.set(d[g].container,{x:f})},m.onHover=function(c,e){b.height=e?210:140,e||(a.UI.Tween.set(d[0].container,{x:40}),a.UI.Tween.set(d[g].container,{x:f}))},this.update=function(b){for(var c=0;cb.used?-1:b.used>a.used?1:a.id>b.id?1:-1});for(var c=0;c0){f.visible=!0;for(var n=tankClass[b.classId],o=n.DefaultSkinBody,p=n.DefaultSkinCannon,m=0;m0?(h.texture=a.Texture.fromImage("/image/item-"+b.commanderId+".png"),h.visible=!0):h.visible=!1,i.update(b.firstAbilityId),i.container.alpha=b.firstAbilityId>=0?1:.2,j.update(b.secondAbilityId),j.container.alpha=b.secondAbilityId>=0?1:.2,e.text=vf[b.index]}},Uh=function(b,c){var d,e=this.container=new a.UI.Container(1220,475);e.anchorBottom=0,b.addChild(e);var g=new a.UI.SliceSprite(cf,3,(!0),(!0),(!0));g.tint=10461087,g.width=g.height="100%",g.alpha=.4,e.addChild(g);var h=new a.UI.Container("100%","97%");h.verticalAlign="middle",h.horizontalAlign="center",e.addChild(h);for(var i={},j=0;j<6;j++){var k=i[j]=new Th;k.container.x=200*j,h.addChild(k.container)}this.open=function(a){d=a,this.loadData(a,function(){})},this.loadData=function(a){for(var b in i)i[b].clear();f.post("/Profile/GetCrewData",{id:a}).done(function(a){for(var b=0;b",a)},pc.prototype.close=function(){mc.prototype.close.call(this)},pc.open=function(a,b){b==ah.Gold?rc.open(a):b==ah.Talent?sc.open(a):b==ah.Gems&&qc.open(a)},qc.prototype=Object.create(pc.prototype),qc.prototype.constructor=qc,qc.notfication=void 0,qc.open=function(a){qc.notfication||(qc.notification=new qc),qc.notification.open(a)},rc.prototype=Object.create(pc.prototype),rc.prototype.constructor=rc,rc.notfication=void 0,rc.open=function(a){rc.notfication||(rc.notification=new rc),rc.notification.open(a)},sc.prototype=Object.create(pc.prototype),sc.prototype.constructor=sc,sc.notfication=void 0,sc.open=function(a){sc.notfication||(sc.notification=new sc),sc.notification.open(a)},tc.prototype=Object.create(mc.prototype),tc.prototype.constructor=tc,tc.prototype.init=function(){mc.prototype.init.call(this);var b=this;this.server="",this.room="",this.mode="",this.password="",this.container.height=325,this.headline=new a.UI.DynamicText("ENTER PASSWORD",{style:nd}),this.headline.style.tint=16568833,this.headline.horizontalAlign="center",this.headline.anchorTop=50,this.subHeadline=new a.UI.DynamicText("This game requires a password!",{style:jd}),this.subHeadline.horizontalAlign="center",this.subHeadline.anchorTop=93,this.confirmButton=new a.UI.Button({background:new a.UI.SliceSprite(lf,7,(!0),(!0)),width:280,height:65}),this.confirmButton_Text=new a.UI.DynamicText("CONNECT",{style:yd}),this.confirmButton.background.alpha=.9,this.confirmButton.background.tint=14090035,this.confirmButton_Text.horizontalAlign="center",this.confirmButton_Text.anchorTop=15,this.confirmButton.addChild(this.confirmButton_Text),this.confirmButton.anchorBottom=45,this.confirmButton.anchorRight=45,this.confirmButton.on("click",function(){b.password=b.passwordInput.value,Dd.Connection.ConnectServer(b.server,b.room,b.mode,b.password),b.close()}),this.confirmButton.on("hover",function(b){a.UI.Tween.to(this.background,.4,{alpha:b?1:.9},a.UI.Ease.Circ.CircOut)}),this.abortButton=new a.UI.Button({background:new a.UI.SliceSprite(lf,7,(!0),(!0)),width:215,height:65}),this.abortButton_Text=new a.UI.DynamicText("CANCEL",{style:yd}),this.abortButton.background.alpha=.9,this.abortButton.background.tint=5592405,this.abortButton_Text.horizontalAlign="center",this.abortButton_Text.anchorTop=15,this.abortButton.addChild(this.abortButton_Text),this.abortButton.anchorBottom=45,this.abortButton.anchorLeft=45,this.abortButton.on("click",function(){b.close()}),this.abortButton.on("hover",function(b){a.UI.Tween.to(this.background,.4,{alpha:b?1:.9},a.UI.Ease.Circ.CircOut)}),this.passwordInput=new a.UI.TextInput({value:"",background:a.UI.Sprite.fromFrame("UI/blank.png"),style:{fontSize:20,fill:"#ffffff"},lineHeight:35,paddingLeft:10}),this.passwordInput.background.alpha=.17,this.passwordInput.width=270,this.passwordInput.height=40,this.passwordInput.align="center",this.passwordInput.top=140,this.passwordInput.on("focusChanged",function(b){a.UI.Tween.to(this.background,.6,{alpha:b?.5:.3},a.UI.Ease.Circ.CircOut)}),this.container.addChild(this.headline,this.subHeadline,this.confirmButton,this.abortButton,this.passwordInput),this.confirmCallbackMethod=function(){},this.abortCallbackMethod=function(){}},tc.prototype.open=function(a,b,c,d){mc.prototype.open.call(this),this.headline.value=d?"WRONG PASSWORD":"ENTER PASSWORD",this.mode=c,this.server=a,this.room=b,this.passwordInput.value="",this.passwordInput.focus()},tc.prototype.close=function(){mc.prototype.close.call(this)},tc.notfication=void 0,tc.open=function(a,b,c,d){tc.notification||(tc.notification=new tc),tc.notification.open(a,b,c,d)},uc.prototype=Object.create(mc.prototype),uc.prototype.constructor=uc,uc.prototype.init=function(){mc.prototype.init.call(this);this.headline=new a.UI.DynamicText("PREMIUM FEATURE",{style:nd}),this.headline.style.tint=16568833,this.headline.horizontalAlign="center",this.headline.anchorTop=40,this.subHeadline=new a.UI.DynamicText("This is a premium feature",{style:jd}),this.subHeadline.horizontalAlign="center",this.subHeadline.anchorTop=83,this.button=new a.UI.Button({background:new a.UI.SliceSprite(lf,7,(!0),(!0)),text:new a.UI.DynamicText("UPGRADE NOW",{style:md}),width:340,height:65}),this.button.background.tint=16769075,this.button_Text=new a.UI.DynamicText(this.buttonText,{style:yd}),this.button.background.alpha=.9,this.button_Text.anchorLeft=30,this.button_Text.anchorTop=15,this.button.addChild(this.button_Text),this.button.anchorBottom=55,this.button.horizontalAlign="center",this.button.on("click",function(){pf.open(),pf.buttons.Shop.button.click(),pf.shopPage.menuButtons["PREMIUM"].click(),googa("send","event","RequirePremium","Upgrade Clicked")}),this.container.addChild(this.headline,this.subHeadline,this.button)},uc.prototype.open=function(a){mc.prototype.open.call(this),this.subHeadline.text=a?a:" "},uc.prototype.close=function(){mc.prototype.close.call(this)},uc.notfication=void 0,uc.open=function(a){uc.notfication||(uc.notification=new uc),uc.notification.open(a)},vc.prototype=Object.create(mc.prototype),vc.prototype.constructor=vc,vc.prototype.init=function(){mc.prototype.init.call(this);var b=this;this.headline=new a.UI.DynamicText("CONFIRM PURCHASE",{style:nd}),this.headline.style.tint=16568833,this.headline.horizontalAlign="center",this.headline.anchorTop=50,this.subHeadline=new a.UI.DynamicText(" ",{style:jd}),this.subHeadline.horizontalAlign="center",this.subHeadline.anchorTop=93,this.button=new a.UI.Button({background:new a.UI.SliceSprite(kf,4,(!0),(!0)),width:340,height:50}),this.button.background.tint=10666022,this.button_Text=new a.UI.DynamicText("CONFIRM",{style:yd}),this.button.background.alpha=.9,this.button_Text.anchorLeft=37,this.button_Text.anchorBottom=9,this.button.addChild(this.button_Text),this.button.anchorBottom=55,this.button.horizontalAlign="center";var c=this.priceBox=new a.UI.SliceSprite(kf,4,(!0),(!0));c.tint=5197647,c.width=150,c.height="100%",c.anchorRight=0,this.button.background.addChild(c),this.button.on("hover",function(b){a.UI.Tween.to(this.background,.4,{alpha:b?1:.9},a.UI.Ease.Circ.CircOut)}),this.button.on("click",function(){b.fn?b.fn():f.post("/Shop/BuyShopItem",{id:b.ProductID}).done(function(a){if(a.success){pf.wallet.UpdateBalance(a.currency,a.balance),d.purchaceResult(a.data)}}),b.close()}),this.container.addChild(this.headline,this.subHeadline,this.button)},vc.prototype.open=function(a,b,c,d,e){mc.prototype.open.call(this),this.fn=!!e&&e,this.subHeadline.text=c,this.ProductID=d,this.price&&this.button.removeChild(this.price),this.price=new ec(a,b).container,this.price.anchorBottom=9,this.price.anchorRight=17,this.button.addChild(this.price),this.button.focus()},vc.prototype.close=function(){mc.prototype.close.call(this)},vc.notfication=void 0,vc.open=function(a,b,c,d,e){vc.notfication||(vc.notification=new vc),vc.notification.open(a,b,c,d,e)},wc.prototype=Object.create(mc.prototype),wc.prototype.constructor=wc,wc.prototype.init=function(){mc.prototype.init.call(this);var b=this;this.headline=new a.UI.DynamicText("SALVAGE (item name)",{style:nd}),this.headline.style.tint=16568833,this.headline.horizontalAlign="center",this.headline.anchorTop=50,this.subHeadline=new a.UI.DynamicText("You will not be able to recover this item!\nAre you sure?",{style:jd,width:"100%"}),this.subHeadline.style.align="center",this.subHeadline.horizontalAlign="center",this.subHeadline.anchorTop=93,this.button=new a.UI.Button({background:new a.UI.SliceSprite(kf,4,(!0),(!0)),width:240,height:50}),this.button.background.tint=10666022,this.button_Text=new a.UI.DynamicText("CONFIRM",{style:yd}),this.button.background.alpha=.9,this.button_Text.anchorLeft=20,this.button_Text.anchorBottom=9,this.button.addChild(this.button_Text),this.button.anchorBottom=55,this.button.anchorRight=95,this.price=new ec(100,ah.Gold),this.price.container.anchorBottom=8,this.price.container.anchorRight=17,this.price.text.value="+"+this.price.text.value,this.button.addChild(this.price.container),this.button.on("hover",function(b){a.UI.Tween.to(this.background,.4,{alpha:b?1:.9},a.UI.Ease.Circ.CircOut)}),this.button.on("click",function(){b.buttonFn(),b.close()}),this.cancel=new a.UI.Button({text:new a.UI.DynamicText("CANCEL",{style:yd}),background:new a.UI.SliceSprite(kf,4,(!0),(!0)),width:150,height:50}),this.cancel.background.tint=5592405,this.cancel.background.alpha=.9,this.cancel.anchorBottom=55,this.cancel.anchorLeft=95,this.cancel.on("hover",function(b){a.UI.Tween.to(this.background,.4,{alpha:b?1:.9},a.UI.Ease.Circ.CircOut)}),this.cancel.on("click",function(){b.close()}),this.container.addChild(this.headline,this.subHeadline,this.cancel,this.button)},wc.prototype.open=function(a,b){mc.prototype.open.call(this),this.buttonFn=b,this.headline.value="SALVAGE ("+a+")",this.button.focus()},wc.prototype.close=function(){mc.prototype.close.call(this)},wc.notfication=void 0,wc.open=function(a,b){wc.notfication||(wc.notification=new wc),wc.notification.open(a,b)},xc.prototype=Object.create(mc.prototype),xc.prototype.constructor=xc,xc.prototype.init=function(){mc.prototype.init.call(this);var b=this,c=new a.UI.Container(600,90);c.anchorBottom=40,c.horizontalAlign="center";var d=a.UI.Sprite.fromFrame("UI/blank.png");d.width=d.height="100%",d.alpha=.2;var e=new a.UI.Button({background:a.UI.Sprite.fromFrame("UI/Menu/Login/facebook.png")}),f=new a.UI.Button({background:a.UI.Sprite.fromFrame("UI/Menu/Login/twitter.png")}),g=new a.UI.Button({background:a.UI.Sprite.fromFrame("UI/Menu/Login/steam.png")}),h=new a.UI.Button({background:a.UI.Sprite.fromFrame("UI/Menu/Login/google.png")}),i=new a.UI.Button({background:a.UI.Sprite.fromFrame("UI/Menu/Login/vkontakte.png")});e.method="facebook",f.method="twitter",g.method="steam",h.method="google",i.method="vkontakte",e.tint=f.tint=g.tint=h.tint=i.tint=15592941,e.y=f.y=g.y=h.y=i.y=37,e.x=16,f.x=140,g.x=248,h.x=358,i.x=468;var j=function(a){this.background.tint=a?16777215:15592941},k=function(a){this.y=a?38:37},l=function(){switch(b.close(),pf.buttons.Home.button.click(),this.method){case"facebook":dg("/Account/ExternalLogin?provider=Facebook","Facebook Login","700","600");break;case"twitter":dg("/Account/ExternalLogin?provider=Twitter","Twitter Login","900","500");break;case"steam":dg("/Account/ExternalLogin?provider=Steam","Steam Login","900","500");break;case"google":dg("/Account/ExternalLogin?provider=Google&returnUrl=/","Google Login","900","500");break;case"vkontakte":dg("/Account/ExternalLogin?provider=VKontakte","VKontakte Login","700","600")}};e.on("hover",j),f.on("hover",j),g.on("hover",j),h.on("hover",j),i.on("hover",j),e.on("press",k),f.on("press",k),g.on("press",k),h.on("press",k),i.on("press",k),e.on("click",l),f.on("click",l),g.on("click",l),h.on("click",l),i.on("click",l),this.headline=new a.UI.DynamicText("SIGN IN",{style:nd}),this.headline.style.tint=16568833,this.headline.horizontalAlign="center",this.headline.anchorTop=40,this.subHeadline=new a.UI.DynamicText(" ",{
style:jd}),this.subHeadline.horizontalAlign="center",this.subHeadline.anchorTop=83,c.addChild(d,e,f,g,h,i),this.container.addChild(this.headline,this.subHeadline,c)},xc.prototype.open=function(a){mc.prototype.open.call(this),this.subHeadline.text=a?a:" "},xc.prototype.close=function(){mc.prototype.close.call(this)},xc.notfication=void 0,xc.open=function(a){xc.notfication||(xc.notification=new xc),xc.notification.open(a)},yc.prototype=Object.create(mc.prototype),yc.prototype.constructor=yc,yc.prototype.init=function(){mc.prototype.init.call(this);var b=this;this.colorRed=16724787,this.colorGreen=14090035,this.headline=new a.UI.DynamicText(" ",{style:nd}),this.headline.style.tint=16568833,this.headline.horizontalAlign="center",this.headline.anchorTop=50,this.subHeadline=new a.UI.DynamicText(" ",{style:jd}),this.subHeadline.horizontalAlign="center",this.subHeadline.anchorTop=93,this.confirmButton=new a.UI.Button({background:new a.UI.SliceSprite(lf,7,(!0),(!0)),width:215,height:65}),this.confirmButton_Text=new a.UI.DynamicText(" ",{style:yd}),this.confirmButton.background.alpha=.9,this.confirmButton_Text.horizontalAlign="center",this.confirmButton_Text.anchorTop=15,this.confirmButton.addChild(this.confirmButton_Text),this.confirmButton.anchorBottom=55,this.confirmButton.anchorLeft=45,this.confirmButton.on("click",function(){"function"==typeof b.confirmCallbackMethod&&b.confirmCallbackMethod(),b.close()}),this.confirmButton.on("hover",function(b){a.UI.Tween.to(this.background,.4,{alpha:b?1:.9},a.UI.Ease.Circ.CircOut)}),this.abortButton=new a.UI.Button({background:new a.UI.SliceSprite(lf,7,(!0),(!0)),width:215,height:65}),this.abortButton_Text=new a.UI.DynamicText(" ",{style:yd}),this.abortButton.background.alpha=.9,this.abortButton_Text.horizontalAlign="center",this.abortButton_Text.anchorTop=15,this.abortButton.addChild(this.abortButton_Text),this.abortButton.anchorBottom=55,this.abortButton.anchorLeft=330,this.abortButton.on("click",function(){"function"==typeof b.abortCallbackMethod&&b.abortCallbackMethod(),b.close()}),this.abortButton.on("hover",function(b){a.UI.Tween.to(this.background,.4,{alpha:b?1:.9},a.UI.Ease.Circ.CircOut)}),this.container.addChild(this.headline,this.subHeadline,this.confirmButton,this.abortButton),this.confirmCallbackMethod=function(){},this.abortCallbackMethod=function(){}},yc.prototype.open=function(a,b,c,d,e,f,g,h){mc.prototype.open.call(this),this.headline.text=""+a,this.subHeadline.text=""+b,null!==e&&(this.confirmButton.background.tint=e?this.colorGreen:this.colorRed),null!==f&&(this.abortButton.background.tint=f?this.colorGreen:this.colorRed),this.confirmButton_Text.text=""+c,this.abortButton_Text.text=""+d,this.confirmCallbackMethod=g,this.abortCallbackMethod=h,this.confirmButton.focus()},yc.prototype.close=function(){mc.prototype.close.call(this)},yc.notfication=void 0,yc.open=function(a,b,c,d,e,f,g,h){yc.notfication||(yc.notification=new yc),yc.notification.open(a,b,c,d,e,f,g,h)};var Yh={1:{name:"Tankwars",modes:{0:"KingDM",1:"Conquest"}}},Zh={propertyName:{UserData:{FriendID:"FriendID",Username:"Username",Email:"Email",Avatar:"Avatar",AvatarType:"AvatarType",AcceptFriendRequests:"AcceptFriendRequests",LoginMethods:"LoginMethods"}},onAuthenticatedFunctions:[],onAuthenticated:function(a){"function"==typeof a&&(this.onAuthenticatedFunctions.push(a),this.authenticated&&a())},onDataFunctions:[],onData:function(a){"function"==typeof a&&this.onDataFunctions.push(a)},onLogoutFunctions:[],onLogout:function(a){"function"==typeof a&&this.onLogoutFunctions.push(a)},authenticated:!1,data:{friendID:"",username:"",email:"",avatar:"",avatarType:0,acceptFriendRequests:!1,loginMethods:{Facebook:!1,Steam:!1,Google:!1,Twitter:!1,VKontakte:!1}},Authenticate:function(a){f.ajax({url:"/Account/handshake",statusCode:{403:function(){Zh.Logout()}}}).done(function(b){var c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],i=b[6],j=b[7],k=b[8],l=b[9],m=b[10],o=b[11],p=b[12],r=b[13],s=b[14],t=b[15],u=b[16];Dd.friendID=c,Dd.friendsReferred=o,Dd.XPSystem.SetExperience(m),Dd.Connection.gameToken=e,Dd.Connection.gameTokenExpiration=n.now()+f,ng.Load(g,h,j,k,l,i,r,s,t,u),a?Dd.initCallback(function(){Dd.Connection.Connect(Dd.selectedGM,1e3)}):Dd.Connection.invoke("IdentityChange",q(c),e),Zh.authenticated=!0,$h.connect(d);for(var v=0;v-1&&ai.blockedFriends.splice(b,1),ai.updateFriendStatus(a),ai.sort()}),a.on("FriendRequestSend",function(a,b){di.confirmRequest(a,b)}),a.on("FriendRequestReceived",function(a){var b=ai.updateFriendStatus(a,!0,!0);pf.isOpen||new Zb("New Friend Invite",b.Name).addButton("Show Friends",200,5592405,function(){pf.openSubMenu(pf.homePage)}).show(5e3)}),a.on("AddNewFriend",function(a){ai.updateFriendStatus(a,!1,!0)}),a.on("DeclineFriendRequest",function(a){ai.removeFriend(a)}),a.on("ReceiveMessage",function(a,b,c,d){ei.receiveMessage(a,b,c,d)}),a.on("FriendSearchResult",function(a){di.loadPeople(a)}),a.on("UserSettingUpdated",function(a,b,c){c&&(Zh.data[a]=b,Zh.updateUiValues())}),a.on("NewUserAvatar",function(a){Zh.data["avatar"]=a,Zh.updateUiValues()}),a.on("RemoveExternalLoginCallback",function(a,b){Zh.data["loginMethods"][a]=!b,b||qf.OK("You must have at least one loginmethod attached to your Account!",!1)}),a.on("NewLoginMethodInformation",function(a){Zh.NewLoginMethodInformation(a)}),a.on("ServerForceLogout",function(){Zh.Logout()}),a.on("ServerNotifyMsg",function(a,b,c){nc.open(a,b,c)}),a.on("ReceivePartyInvite",function(a,b,c,d){li.ReceiveInvite(a,b,c,d)}),a.on("JoinParty",function(a,b,c){ki.initParty(a,b,c)}),a.on("AddPartyMember",function(a){ki.addPartyMember(a,!0)}),a.on("RemovePartyMember",function(a){ki.removePartyMember(a)}),a.on("SetPartyLeader",function(a){ki.setPartyLeader(a)}),a.on("PartyGamePrompt",function(a,b,c,d,e){mi.ReceiveGamePrompt(a,b,c,d,e)}),a.on("JoinChannel",function(a,b,c){ni.initChannel(a,b,c)}),a.on("AddChannelMember",function(a,b){ni.addChannelMember(a,b)}),a.on("RemoveChannelMember",function(a,b){ni.removeChannelMember(a,b)}),a.on("ReceiveChannelMessage",function(a,b,c){ni.receiveMessage(a,b,c)}),this.initialized=!0}},connect:function(a){this.CommunicationToken=a,this.initialize(),this.server.connect(d["CommsServer"])},disconnect:function(){this.server.disconnect()}};$h.friendListEvents={blockFriend:function(a){a&&$h.server.invoke("BlockFriend",q(a))},unblockFriend:function(a){a&&$h.server.invoke("UnblockFriend",q(a))},removeFriend:function(a){a&&$h.server.invoke("RemoveFriend",q(a))},sendMessage:function(a,b){b=b.trim(),a&&""!==b&&$h.server.invoke("SendMessage",q(a),b)},sendFriendRequest:function(a){a&&$h.server.invoke("SendFriendRequest",q(a))},declineFriendRequest:function(a){a&&$h.server.invoke("DeclineFriendRequest",q(a))},acceptFriendRequest:function(a){a&&$h.server.invoke("AcceptFriendRequest",q(a))},findFriends:function(a){a.length>0?$h.server.invoke("FindFriends",a):di.loadPeople([])}},$h.SettingsEvents={UpdateUserSetting:function(a,b){a&&void 0!==b&&$h.server.invoke("UpdateUserSetting",a,b)},RemoveExternalLogin:function(a){a&&$h.server.invoke("RemoveExternalLogin",a)},GetNewLoginMethodInformation:function(){$h.server.invoke("GetNewLoginMethodInformation")},DeleteUser:function(){$h.server.invoke("DeleteUser")}},$h.PartyEvents={SendPartyInvite:function(a){a&&$h.server.invoke("SendPartyInvite",a,$h.CurrentGame)},AcceptPartyInvite:function(a){a&&$h.server.invoke("AcceptPartyInvite",a)},DeclinePartyInvite:function(a){a&&$h.server.invoke("DeclinePartyInvite",a)},LeaveParty:function(a){a&&$h.server.invoke("LeaveParty",a)},SetPartyLeader:function(a,b){a&&b&&$h.server.invoke("SetPartyLeader",a,b)},KickPartyMember:function(a,b){a&&b&&$h.server.invoke("KickPartyMember",a,b)}},$h.ChannelEvents={SendMessage:function(a,b){b&&$h.server.invoke("SendChannelMessage",a,b)}},$h.CurrentGame=1;var _h={None:0,Invite:1,Ingame:2,Online:3,Offline:4,Blocked:5};zc.prototype=Object.create(a.utils.EventEmitter.prototype),zc.prototype.constructor=zc,Ac.prototype=Object.create(a.utils.EventEmitter.prototype),Ac.prototype.constructor=Ac;var ai=new Ac,bi={propertyName:{FriendList:{BlockedFriends:"BlockedFriends",Friends:"Friends",FriendInvites:"FriendInvites"},Friend:{FriendID:"FriendID",Online:"Online",LastOnline:"LastOnline",Name:"Name",Server:"Server",Avatar:"Avatar"}},blockedFriends:[],open:function(){},close:function(){},init:function(){f("#friend_search").on("input",function(a){bi.findFriends(f(this).val())}).on("keyup",function(a){if(27===a.keyCode)return f("#friends").find(".friend").show(),f("#friend_search").val("").blur(),a.preventDefault(),!1}),v(function(){bi.updateLastOnline()},6e4),f("#add_friend").click(function(){di.open()})},arrangeFriends:function(){f("#friends").find(".friend_status_ingame").appendTo("#friends"),f("#friends").find(".friend_status_online").appendTo("#friends"),f("#friends").find(".friend_status_offline").appendTo("#friends"),f("#friends").find(".friend_status_blocked").appendTo("#friends")},CreateFriendHtml:function(a){var b=f(""),c=f("
");c.append("
");var d=f("
");return d.append("
"),d.append("
"),d.append("
"),b.append(c),b.append(d),a?f("#friends").prepend(b):f("#friends").append(b),b.mousedown(function(a){return 2!==a.button||(ci.open(f(this).data("friend_id")),!1)}),b.dblclick(function(){ei.startConversation(b,!0)}),b},initFriendList:function(a){return},addNewFriend:function(a){var b=a[this.propertyName.Friend.FriendID];f("#friendInvite_"+b).remove(),f("#friend_"+b).remove(),friendContainer=this.CreateFriendHtml(!0),friendContainer.attr("id","friend_"+b),this.updateFriendStatus(a),this.arrangeFriends()},declineFriendRequest:function(a){f("#friendInvite_"+a).remove()},deleteFriend:function(a){f("#friend_"+a).remove()},blockFriend:function(a){this.blockedFriends.push(a),f("#friend_"+a).data("friend_blocked",!0),this.updateFriendStatus(!1,!0,a)},AppendFriendRequest:function(a,b){var c=a[this.propertyName.Friend.FriendID],d=a[this.propertyName.Friend.Name],e=a[this.propertyName.Friend.Avatar],g=f("
"),h=f("
");h.append("
");var i=f("
"),j=f("
");j.text(d),i.append(j);var k=f("ACCEPT
"),l=f("DECLINE
");g.append(h).append(i).append(k).append(l),g.attr("id","friendInvite_"+c),f("#friend_invites").append(g),k.click(function(){$h.friendListEvents.acceptFriendRequest(c)}),l.click(function(){$h.friendListEvents.declineFriendRequest(c)}),b&&(g.hide(),g.show(200))},ReceiveFriendRequest:function(a){this.AppendFriendRequest(a,!0)},updateFriendStatus:function(a,b,c){var d;if(a){var e=a[this.propertyName.Friend.FriendID],g=a[this.propertyName.Friend.Online],h=a[this.propertyName.Friend.LastOnline],i=a[this.propertyName.Friend.Name],j=a[this.propertyName.Friend.Server],k=a[this.propertyName.Friend.Avatar];if(d=f("#friend_"+e),!d.length)return this.addNewFriend(a);d.data("friend_id",e),d.data("friend_online",g),d.data("friend_lastonline",h),d.data("friend_name",i),d.data("friend_server",j),d.data("friend_avatar",k)}else{if(void 0===c)return;d=f("#friend_"+c)}var l=this.blockedFriends.indexOf(d.data("friend_id"))!==-1;if(d.data("friend_blocked",l),d.length!==-1)if(d.removeClass("friend_status_ingame"),d.removeClass("friend_status_online"),d.removeClass("friend_status_offline"),d.removeClass("friend_status_blocked"),d.find(".name").text(d.data("friend_name")),d.find(".icon").find("img").attr("src",d.data("friend_avatar")),l)d.data("friend_status_class","friend_status_blocked"),d.addClass("friend_status_blocked"),d.find(".status").text("Blocked"),d.find(".mode").text("");else if(null!==d.data("friend_server")&&d.data("friend_server").length>0){var m=d.data("friend_server").split(","),n=m[0],o=m[1];d.data("friend_status_class","friend_status_ingame"),d.addClass("friend_status_ingame"),d.find(".status").text("In-Game ("+Yh[n].name+")"),d.find(".mode").text(Yh[n].modes[o])}else d.data("friend_online")?(d.data("friend_status_class","friend_status_online"),d.addClass("friend_status_online"),d.find(".status").text("Online"),d.find(".mode").text("")):(d.data("friend_status_class","friend_status_offline"),d.addClass("friend_status_offline"),d.find(".mode").text(""),this.updateLastOnline(d));b&&this.arrangeFriends();var p=ei.checkFriendChatWindow(e);p&&ei.setFriendInfo(d,p),f("#chat_tab_"+e).find(".name").text(i)},updateLastOnline:function(a){if(!a)return void f(".friend").each(function(){bi.updateLastOnline(f(this))});if(!a.data("friend_online")){var b="",c=a.data("friend_lastonline"),d=(new o).getTime(),e=(d-c)/1e3,g=e/60,h=g/60,i=h/24,j=i/7,l=j/30.4167,m=l/12;b=m>2?k.floor(m)+" years ago":m>1?"1 year ago":l>2?k.floor(l)+" months ago":l>1?"1 month ago":j>2?k.floor(j)+" weeks ago":j>1?"1 week ago":i>2?k.floor(i)+" days ago":i>1?"1 day ago":h>2?k.floor(h)+" hours ago":h>1?"1 hour ago":g>2?k.floor(g)+" minutes ago":"1 minute ago",a.find(".status").text("Last Online: "+b)}},findFriends:function(a){f(".friend .info .name:notcontains('"+a+"')").closest(".friend").hide(),f(".friend .info .name:contains('"+a+"')").closest(".friend").show()}},ci={container:f("#friend_context_menu"),isOpen:!1,selectedFriendID:0,options:{MuteGameChat:f(''),UnmuteGameChat:f(''),SendMessage:f(''),ViewProfile:f(''),JoinGame:f(''),InviteParty:f(''),GivePartyLeader:f(''),KickParty:f(''),BlockCommunication:f(''),RemoveFriend:f(''),AddFriend:f(''),Breaker1:f(''),Breaker2:f('')},insertBreaker:function(){this.container.append(f())},mouseDownFn:function(a){if(ci.isOpen){var b=f("#friend_context_menu");b.is(a.target)||0!==b.has(a.target).length||ci.close()}},init:function(){this.options.MuteGameChat.click(function(){oi.add(ci.selectedFriendID),ci.close()}),this.options.UnmuteGameChat.click(function(){oi.remove(ci.selectedFriendID),ci.close()}),this.options.SendMessage.click(function(){pf.isOpen||pf.openMainMenu(),ei.startConversation(ai.getFriend(ci.selectedFriendID),!0),ci.close()}),this.options.ViewProfile.click(function(){pf.isOpen||pf.open(),pf.profilePage.open(ci.selectedFriendID),ci.close()}),this.options.JoinGame.click(function(){pf.isOpen||pf.close();var a=ai.getFriend(ci.selectedFriendID),b=a.Server.split(","),c=b[1],d=b[2],e=b[3];1===q(b[4]);1===q(b[5])?tc.open(d,e,c):Dd.Connection.ConnectServer(d,e,c),ci.close()}),this.options.InviteParty.click(function(){$h.PartyEvents.SendPartyInvite(ci.selectedFriendID),ci.close()}),this.options.GivePartyLeader.click(function(){$h.PartyEvents.SetPartyLeader(ki.id,ci.selectedFriendID),ci.close()}),this.options.KickParty.click(function(){$h.PartyEvents.KickPartyMember(ki.id,ci.selectedFriendID),ci.close()}),this.options.AddFriend.click(function(){$h.friendListEvents.sendFriendRequest(ci.selectedFriendID),ci.close()}),this.options.BlockCommunication.on("click",function(){var a=ai.getFriend(ci.selectedFriendID);a.Blocked?$h.friendListEvents.unblockFriend(a.FriendID):$h.friendListEvents.blockFriend(a.FriendID),ci.close()}),this.options.RemoveFriend.click(function(){var a=ai.getFriend(ci.selectedFriendID);qf.YesNo("Are you sure you want to remove "+a.Name+" from your friends list?",!0,function(){$h.friendListEvents.removeFriend(a.FriendID)}),ci.close()}),this.options.MuteGameChat.appendTo(this.container),this.options.UnmuteGameChat.appendTo(this.container),this.options.SendMessage.appendTo(this.container),this.options.ViewProfile.appendTo(this.container),this.options.AddFriend.appendTo(this.container),this.options.Breaker1.appendTo(this.container),this.options.JoinGame.appendTo(this.container),this.options.InviteParty.appendTo(this.container),this.options.GivePartyLeader.appendTo(this.container),this.options.KickParty.appendTo(this.container),this.options.Breaker2.appendTo(this.container),this.options.BlockCommunication.appendTo(this.container),this.options.RemoveFriend.appendTo(this.container)},open:function(a,b){this.isOpen&&this.close(),r.addEventListener("pointerdown",ci.mouseDownFn),this.options.MuteGameChat.hide(),this.options.UnmuteGameChat.hide(),this.options.SendMessage.hide(),this.options.AddFriend.hide(),this.options.Breaker1.hide(),this.options.JoinGame.hide(),this.options.InviteParty.hide(),this.options.GivePartyLeader.hide(),this.options.KickParty.hide(),this.options.Breaker2.hide(),this.options.BlockCommunication.hide(),this.options.RemoveFriend.hide(),this.selectedFriendID=a;var c=ai.getFriend(a),d=a==Zh.data["friendID"],e=null!=c&&c.FriendInvite,f=null!=c&&!e,g=!!f&&c.Blocked;this.options.BlockCommunication.text(g?"Unblock Communication":"Block Communication");var h=!d&&b&&!oi.contains(this.selectedFriendID),i=!d&&b&&oi.contains(this.selectedFriendID),j=f&&!g,k=j,l=f&&!g&&c.Server&&c.Server.length>0,m=f&&!g&&!ki.Members[this.selectedFriendID],n=ki.isLeader&&ki.Members[this.selectedFriendID],o=n,p=l||m||n||o,q=f,s=!f&&!d&&!e,t=f;h&&this.options.MuteGameChat.show(),i&&this.options.UnmuteGameChat.show(),j&&this.options.SendMessage.show(),k&&this.options.Breaker1.show(),l&&this.options.JoinGame.show(),m&&this.options.InviteParty.show(),n&&this.options.GivePartyLeader.show(),o&&this.options.KickParty.show(),p&&this.options.Breaker2.show(),q&&this.options.BlockCommunication.show(),t&&this.options.RemoveFriend.show(),s&&this.options.AddFriend.show(),this.isOpen=!0,this.container.hide(),$e.positionMouseBottomRight(this.container),this.container.show(150)},close:function(){this.isOpen&&(r.removeEventListener("pointerdown",ci.mouseDownFn),this.isOpen=!1,this.selectedFriendID=0,this.container.hide())}};ci.init();var di={propertyName:{Person:{Username:"Username",FriendID:"FriendID",Avatar:"Avatar",Pending:"Pending",Friends:"Friends"}},container:void 0,resultContainer:void 0,input:void 0,lastKeyword:"",initialized:!1,init:function(){this.container=f("");var a=f("
"),b=f("
FIND A FRIEND
"),c=f("