!function(e){function t(i){if(a[i])return a[i].exports;var n=a[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var a={};t.m=e,t.c=a,t.i=function(e){return e},t.d=function(e,a,i){t.o(e,a)||Object.defineProperty(e,a,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var a=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(a,"a",a),a},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=17)}([function(e,t){var a=[];e.exports={scaleUV:function(e,t,a,i){for(var n=new THREE.Vector2(t,a).multiplyScalar(i),s=0;s 3 GROUP BY c.clan_name"},{name:"CLAN NET WORTH",table:"KARNAE_CLANS",values:["clan_name","player_kredits"],valuesN:["NAME","NET WORTH"],cond:"player_kredits",custom:"SELECT c.clan_name, SUM(p.player_kredits) player_kredits FROM karnage_clans c, karnage_players p WHERE p.player_clan = c.clan_name GROUP BY c.clan_name"},{name:"CLAN TIME PLAYED",table:"KARNAE_CLANS",values:["clan_name","player_score","player_time_played"],valuesN:["NAME","SCORE","TIME PLAYED"],cond:"player_time_played",custom:"SELECT c.clan_name, SUM(p.player_score) player_score, SUM(p.player_time_played) player_time_played FROM karnage_clans c, karnage_players p WHERE p.player_clan = c.clan_name GROUP BY c.clan_name"},{name:"GLOBAL",getTotals:!0}]},function(e,t){e.exports.pickups=[{name:"Health Pack",materialID:"health_pickup_1",respawn:3e4,scale:3.4,rotSpd:.003,picked:function(e){return e.changeHealth(50*e.pickupMult)}},{name:"Armor Pack",materialID:"armor_pickup_1",respawn:3e4,scale:3.4,rotSpd:.003,picked:function(e){return e.changeArmor(25*e.pickupMult)}},{name:"Ammo Pack",materialID:"ammo_pickup_1",respawn:3e4,scale:3.4,rotSpd:.003,picked:function(e){return e.getAmmo(.2*e.pickupMult)}},{name:"Mega Armor Pack",materialID:"mega_armor_pickup_1",respawn:6e4,scale:3.8,rotSpd:.0025,picked:function(e){return e.changeArmor(200)}}],e.exports.getPickupStates=function(e){for(var t=null,a=0;a=t.width*i&&(c=l,d+=i,h=0)}return r}},function(e,t){e.exports={materials:[],textureLoader:new THREE.TextureLoader,createMaterials:function(e,t){for(var a=e.length,i=0;i=--a&&t()}):a--;else a--;0>=a&&t()}},makeFromType:function(e){return e?1==e?new THREE.MeshBasicMaterial({shading:THREE.FlatShading,vertexColors:THREE.VertexColors,fog:!1}):2==e?new THREE.MeshBasicMaterial({depthWrite:!1,transparent:!0,blending:THREE.AdditiveBlending,fog:!1}):3==e?new THREE.MeshBasicMaterial({depthWrite:!1,transparent:!0}):4==e?new THREE.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,transparent:!0}):void 0:new THREE.MeshLambertMaterial({shading:THREE.FlatShading,vertexColors:THREE.VertexColors})},loadTexture:function(e,t,a,i,n){this.textureLoader.load(".././img/"+e+".png",function(e){e.wrapS=e.wrapT=THREE.RepeatWrapping,t&&e.repeat.set(t[0],t[1]),e.minFilter=e.magFilter=THREE.NearestFilter,0==i?(a.map&&a.map.dispose(),a.map=e,a.map.needsUpdate=!0):1==i&&(a.emissiveMap&&a.emissiveMap.dispose(),a.emissive=new THREE.Color(16777215),a.emissiveIntensity=1.5,a.emissiveMap=e,a.emissiveMap.needsUpdate=!0),a.needsUpdate=!0,n()})},getMaterial:function(e){return this.materials[e]}}},function(e,t,a){var i=a(0),n=[];e.exports={generateWeaponModel:function(e){var t=new THREE.Geometry,a=-e.bodyScales[1]/2,n=i.generateCube(0,a,0,e.bodyScales[2],e.bodyScales[0],e.bodyScales[1],[1,1,1,0,1,1],null,e.colors[0],!0);t.merge(n.geometry,n.matrix);var s=i.generateCube(e.bodyScales[0]*e.magScales[3]-e.magScales[0]/2,a-e.magScales[1],0,e.magScales[2],e.magScales[0],e.magScales[1],[1,1,1,0,1,1],null,e.colors[1],!0);if(t.merge(s.geometry,s.matrix),e.gripScales.length){var o=i.generateCube(e.bodyScales[0]/2+e.gripScales[0]/2,a,0,e.gripScales[2],e.gripScales[0],e.gripScales[1],[1,1,1,0,1,1],null,e.colors[2],!0);t.merge(o.geometry,o.matrix)}if(e.scopeScales.length){var r=i.generateCube(e.bodyScales[0]*e.scopeScales[3],a+e.bodyScales[1],0,e.scopeScales[2],e.scopeScales[0],e.scopeScales[1],[1,1,1,0,1,1],null,e.colors[1],!0);t.merge(r.geometry,r.matrix)}return t},generateLimb:function(e,t,a,s,o,r,l,c){c=c||1;var d=e+"_"+t+"_"+a+"_"+s+"_"+o+"_"+r+"_"+c,h=n[d];if(!h){h=new THREE.Geometry;var m=i.generateCube(e,0,0,t,t,a,[1,1,1,0,1,1],null,o);m.position.y+=a,m.rotation.x+=Math.PI,m.updateMatrix();var p=i.generateCube(m.position.x,0,0,1.01*t*c,1.01*t*c,s,[1,1,1,1,1,1],null,r);p.position.y+=a,p.rotation.x+=Math.PI,p.updateMatrix(),h.merge(m.geometry,m.matrix),h.merge(p.geometry,p.matrix),n[d]=h}var u=new THREE.Mesh(h,l);return u.position.y+=a,u}}},function(e,t){e.exports=[{name:"Free For All",maps:[0,1,2,3,4,5],time:18e4,teams:1,players:8,stats:["score","kills","deaths","rkd"]},{name:"Team Deathmatch",maps:[0,1,2,3,4,5],time:18e4,teams:2,players:8,stats:["score","kills","deaths","rkd"]},{name:"1v1 Comp",maps:[0,1,2,4,5],time:18e4,teams:1,players:2,stats:["score","kills","deaths","rkd"]}]},function(e,t){var a=new THREE.PlaneGeometry(1,1);a.rotateX(-Math.PI/2),e.exports=function(e){this.particles=[],this.update=function(e){for(var t=0;t=this.lifeTime&&(this.lifeTime=0,this.visible=!1)}},this.particles.push(c),l=c,t.add(c)),o+=Math.PI,l.position.x=i,l.position.z=s,l.position.y=n,l.dir=o,l.scale.x=r.height||.001,l.scale.z=r.width||.001,l.aspectRatio=l.scale.x/l.scale.z,l.scaleAnim=r.scaleAnim||0,l.skipFirst=!0,l.lifeTime=r.lifeTime,l.rotation.y=o,l.rotation.z=Math.PI,l.rotation.x=Math.PI,r.alignToBase&&(l.position.x+=r.height/2*Math.cos(o),l.position.z+=r.height/2*Math.sin(o)),l.material=e.getMaterial(r.materialID),l.visible=!0}}},function(e,t){e.exports=[{name:"None"},{name:"Health Regen",healthRegen:.13},{name:"Better Pickups",pickupMult:1.5},{name:"Rapid Fire",fireRateDiv:.18},{name:"Increase Max Armor",maxArmor:100},{name:"More Crits",critDiv:.5}]},function(e,t){e.exports=function(e,t,a,i,n,s,o,r){this.id=e,this.sid=t,this.inputs=[],this.history=[],this.pings=[],this.inputsToSend=[],this.avgPing=0,this.account=null,this.failedLogins=0,this.failedEmails=0,this.registrations=0,this.timePlayed=0,this.muteCounter=1,this.sentMessages=[],this.rank=0,this.init=function(e){e=e||{},this.team=e.t||null,this.inputs.length=0,this.currentInput=null,this.inputsToSend.length=0,this.sentMessages.length=0,this.history.length=0,this.deltaCounter=0,this.deltaCheck=a.deltaCheck,this.susCount=0,this.packetMissCount=0,this.lastPing=o?Date.now():0,this.kickTimer=0,this.inputNumber=0,this.animTime=0,this.animate=!1,this.moving=!1,this.active=!0,this.onTile=!0,this.inTile=!0,this.interpolate=!1,this.alive=!0,this.jumpDelta=0,this.lastDoer=null,this.lastDoerCounter=0,this.jumpCountdown=a.jumpCountdown,this.speed=a.moveSpeed,this.jumpSpeed=a.jumpSpeed,this.healthRegen=0,this.pickupMult=0,this.critDiv=1,this.healthDrain=0,this.exploDiv=0,this.fireRateDiv=0,this.name="",this.x=e.x||0,this.z=e.z||0,this.y=e.y||0,this.lastY=this.y,this.dir=0,this.dst=0,this.movDir=0,this.targetMovDir=0,this.movDst=0,this.cWeapon=0,this.projectileIndex=0},this.setName=function(e){e&&i.isString(e)?(this.name=e.substring(0,a.nameMaxLength),this.name=this.name.replace(/<|>/g,"").replace(/[^\x00-\x7F]/g,""),this.name.replace(/\s/g,"").length<=0&&(this.name="UNKNOWN")):this.name="UNKNOWN"},this.setCamos=function(e){if(this.account){this.camos=e||[];for(var t=0;t=2e3&&this.kill(!0);this.inputs.length=0;for(var n=this.history.length-1;n>=0;n--)t-this.history[n].t>=a.maxCompensationRewind&&this.history.splice(n,1);this.history.push({t:t,x:this.x,y:this.y,z:this.z}),this.lastDoerCounter&&(this.lastDoerCounter-=e,this.lastDoerCounter<=0&&(this.lastDoerCounter=0,this.lastDoer=null)),(!this.regenCounter||this.regenCounter<=0)&&(this.healthRegen&&this.healththis.maxArmor&&this.changeArmor(-a.overDrain,!0),this.health>this.maxHealth&&this.changeHealth(-a.overDrain,!1,!0),this.regenCounter=1e3),this.regenCounter-=e}},this.getHistoryObj=function(e){for(var t=this.history[0],a=Math.abs(e-t.t),i=0;i=Math.PI/2)this.movDir=this.targetMovDir;else if(this.movDir!=this.targetMovDir){var l=(this.movDir-this.targetMovDir+r)%r,c=Math.min(Math.abs(l-r),l,a.legTurnSpeed*e.dt),d=l-Math.PI>=0?1:-1;this.movDir+=d*c+r,this.movDir%=r}var h=this.onTile?1:1.3,m=Math.sqrt(e.xt*e.xt+e.zt*e.zt);if(0!=m&&(e.xt/=m,e.zt/=m),e.xt&&(this.x+=e.xt*this.speed*e.dt*h),e.zt&&(this.z+=e.zt*this.speed*e.dt*h),this.lastY=this.y,this.onTile&&(this.jumpCountdown-=e.dt,this.jumpCountdown<0&&(this.jumpCountdown=0)),e.jp&&this.jump(),this.jumpDelta>0&&(this.jumpDelta-=a.jumpDecel*e.dt,this.y+=this.jumpDelta*e.dt),this.onTile&&0==this.y||(this.y-=a.fallSpeed*e.dt),o&&this.y<=a.deathY)return void this.kill();if(this.doMapCollisions(n),!t){for(var p=0;pt.y&&this.x+this.s>=t.x-t.s&&this.x-this.s<=t.x+t.s&&this.z+this.s>=t.z-t.s&&this.z-this.s<=t.z+t.s){if(this.y=t.y+t.h)this.y=t.y+t.h;else{var i=0,n=0;i=this.x=t.y+t.h&&this.y<=t.y+t.h+t.pickup.s&&this.x+this.s>=t.x-t.pickup.s&&this.x-this.s<=t.x+t.pickup.s&&this.z+this.s>=t.z-t.pickup.s&&this.z-this.s<=t.z+t.pickup.s&&t.pickup.picked(this)&&(t.pickup.active=!1,o.to(this.room.id).emit("8",a,!1),t.pickup.respawnTimer=t.pickup.respawn)}t=null}},this.jump=function(){this.onTile&&this.jumpCountdown<=0&&(this.jumpCountdown=a.jumpCountdown,this.jumpDelta=this.jumpSpeed)},this.swapWeapon=function(e){this.cWeapon!=e&&this.weapons[e]&&(this.cWeapon=e,o||updateWeaponDisplay())},this.shoot=function(e){var t=this.weapons[this.cWeapon];if(!t.rateCount&&t.ammo>0){t.rateCount=t.rate,t.critCount&&--t.critCount<=0&&(t.critCount=t.crit/this.critDiv,t.doCrit=!0);for(var a=t.bps||1,n=this.x+this.s*t.offsets[0]*Math.sin(this.dir),o=this.z+this.s*t.offsets[0]*Math.cos(this.dir),r=this.y+this.h*t.offsets[1],l=0;l=this.weapons[t].maxAmmo&&a++;if(t==a)return!1;for(t=0;tthis.weapons[e].maxAmmo&&(this.weapons[e].ammo=this.weapons[e].maxAmmo),this.weapons[e].ammo<0&&(this.weapons[e].ammo=0),o||e!=this.cWeapon||r()},this.getHit=function(e,t,i,n,s){var r=n||e.dmg;if(o)if(i!=this&&(this.lastDoer=i,this.lastDoerCounter=a.lastDoerCounter),this.armor>0&&!i.ignoreArmor){var l=r/1.5,c=this.armor-l;c>0?(this.changeArmor(-l),this.changeHealth(-r/3,s)):(this.changeHealth(-(this.armor/3+(r-this.armor)),s),this.changeArmor(-this.armor))}else this.changeHealth(-r,s)},this.scorePoints=function(e){this.score+=e,this.updateStat("score"),this.room.isPrivate||this.updateAccStat("score",e)},this.canDamage=function(e){return!this.team||e.team!=this.team},this.changeHealth=function(e,t,a){return!!e&&(this.health+=e,this.health=Math.round(this.health),a&&this.health300&&(this.health=300),o&&(o.to(this.id).emit("7",[this.health,this.armor]),o.to(this.room.id).emit("h",this.sid,this.health),e>0?o.to(this.id).emit("d",Math.ceil(e),Math.round(this.x),Math.round(this.y+this.h),Math.round(this.z)):this.lastDoer&&!a&&o.to(this.lastDoer.id).emit("d",Math.ceil(e),Math.round(this.x),Math.round(this.y+this.h),Math.round(this.z),t)),this.health<=0&&(this.health=0,this.kill()),!0)},this.changeArmor=function(e,t){return!!e&&(this.armor+=e,this.armor=Math.round(this.armor),t&&this.armor300&&(this.armor=300),o&&(o.to(this.room.id).emit("v",this.sid,"armor",this.armor),o.to(this.id).emit("7",[this.health,this.armor]),e>0&&o.to(this.id).emit("11","+"+Math.ceil(e)+" ARMOR")),!0)},this.kill=function(e){this.alive&&(this.alive=!1,o&&(e||(this.deaths++,this.updateStat("rkd"),this.updateStat("deaths"),this.room.isPrivate||this.updateAccStat("deaths",1)),this.savePlayTime(),o.to(this.room.id).emit("4",this.sid,null,!1,!!this.lastDoer&&this.lastDoer.name,e),this.lastDoer&&(this.lastDoer.kills++,this.lastDoer.updateStat("rkd"),this.lastDoer.updateStat("kills"),this.room.isPrivate||this.lastDoer.updateAccStat("kills",1),this.lastDoer.alive&&o.to(this.lastDoer.id).emit("12"),this.lastDoer.scorePoints(a.scorePerKill),this.lastDoer=null)))}}},function(e,t){e.exports=function(e){this.add=function(t){e.push(t)},this.remove=function(t){0<=(t=e.indexOf(t))&&e.splice(t,1)},this.getIndexBySid=function(t){for(var a=0;a=m-p&&a<=m+p){var u;u=n||s?e.LineInSquare(t,i,n,s,h.gX?h.gX():h.x,h.gZ?h.gZ():h.z,o.s*c):t>=h.x-h.s&&t<=h.x+h.s&&i>=h.z-h.s&&i<=h.z+h.s,u&&l.push({obj:o,x:u[0]||t,z:u[1]||i})}},this.destroyProjectileBySid=function(e){for(var t=0;tx.obj.y+x.obj.h)c.yVel*=-.6,c.xSpeed*=.6,c.zSpeed*=.6,n?c.y=x.obj.y+x.obj.h+.3:c.position.y=x.obj.y+x.obj.h+.3;else{var M=0,E=0;M=x.x=h.spreads.length&&(h.spreadIndex=0)),h.bSpeed)g=-g+Math.PI,m.projectileIndex++,m.projectileIndex>=100&&(m.projectileIndex=0),o.createProjectile(h,m,e.roundTo(s,1),e.roundTo(c,1),e.roundTo(r,1),e.roundTo(g,3),0,m.projectileIndex),n.to(m.room.id).emit("6",[m.sid,h.id,e.roundTo(s,1),e.roundTo(c,1),e.roundTo(r,1),e.roundTo(g,3),m.projectileIndex]);else{g-=Math.PI/2,l.length=0;for(var y,f=t.gunRange*Math.sin(g),v=t.gunRange*Math.cos(g),w=a||m.room.map,x=0;x0&&y.history.length&&(M=y.getHistoryObj(p-(E+t.interpolationLag))),o.checkObject(s,r,c,f,v,y,M,l,t.hitboxSize,2.4));var T=s+f,b=c+v,S=0;if(l.length){var L=o.getNearestHit(s,c);l[L].obj.getHit&&(h.doCrit?l[L].obj.getHit(h,g,m,h.dmg*t.critDamage,!0):l[L].obj.getHit(h,g,m)),T=l[L].x,b=l[L].z,S=l[L].obj.getHit?2:1}if(!n)return{h:S,x:T,z:b};n.to(m.room.id).emit("6",[m.sid,h.id,S,e.roundTo(s,1),e.roundTo(c,1),e.roundTo(T,1),e.roundTo(r,1),e.roundTo(b,1),u])}}}},function(e,t){e.exports.supplies=[{name:"Standard Supply",desc:"Standard supply crates contain all item types with a normal chance for rare items",itemCount:10,rarityVal:100,price:10},{name:"Elite Supply",desc:"elite supply crates contain all item types with a high chance for rare items",itemCount:10,rarityVal:10,price:30}],e.exports.clanItems=[{name:"Startup",desc:"allows you to create a basic clan with limited members and features",buyLimit:1,price:200},{name:"Enterprise",desc:"allows you to create a clan with unlimited members and extra features",buyLimit:1,price:1e3}]},function(e,t){e.exports=function(e,t,a){this.element=document.getElementById("temp-renderer"),this.element.style.position="absolute",this.element.style.zIndex=50,this.element.style.background="grey";var i=new THREE.WebGLRenderer({canvas:this.element,preserveDrawingBuffer:!0,alpha:!0});i.setClearColor(0,0),this.scene=new THREE.Scene,this.camera=new THREE.OrthographicCamera(0,0,0,0,0,1e3),this.scene.add(this.camera),this.resetScene=function(){for(var e=this.scene.children.length-1;0<=e;e--)this.scene.children[e]!==this.camera&&this.scene.children.splice(e,1);this.camera.position.z=20},this.renderScene=function(e,t){i.setSize(e,t);var a=e/t;return this.camera.left=-13*a/2,this.camera.right=13*a/2,this.camera.top=6.5,this.camera.bottom=-6.5,this.camera.updateProjectionMatrix(),i.setScissorTest(!1),i.clear(),i.render(this.scene,this.camera),this.element.toDataURL()},this.renderCamo=function(i,n,s,o){var r=e[i.weaponID],l=this;t.textureLoader.load(i.img,function(e){l.resetScene();var c=a[i.id];e.wrapS=e.wrapT=THREE.RepeatWrapping,e.magFilter=e.minFilter=THREE.NearestFilter,c=c.glow?new THREE.MeshLambertMaterial({vertexColors:THREE.VertexColors,shading:THREE.FlatShading,emissiveMap:e,emissive:16777215,emissiveIntensity:2}):new THREE.MeshLambertMaterial({shading:THREE.FlatShading,map:e}),r.computeBoundingBox(),e=-r.boundingBox.min.y,c=new THREE.Mesh(r,c),c.position.y=e,l.scene.add(c),e=new THREE.PlaneGeometry(25,25,25),c=t.getMaterial("entity_shadow").clone(),c.opacity=.3,c.side=THREE.DoubleSide,e=new THREE.Mesh(e,c),e.rotation.x=Math.PI/2,l.scene.add(e),e=new THREE.AmbientLight(16777215,.5),l.scene.add(e),e=new THREE.DirectionalLight(16777215,.7),e.position.set(-10,10,3),l.scene.add(e),l.camera.position.set(-10,10,20).normalize().multiplyScalar(20),l.camera.lookAt(new THREE.Vector3(0,4,0)),o(l.renderScene(n,s))})}}},function(e,t){e.exports.data=[{id:0,name:"assault rifle",dmg:22,ammo:60,crit:5,spreads:[0,.01,-.01,0,-.02],rate:100,bMaterial:"bullet_1",bLength:22,colors:[6380116,4472892,7755853],holdPos:[.2,0],bodyScales:[7.8,2,1.8],magScales:[1.5,3.4,3.4,.15],scopeScales:[],gripScales:[1,1.8,2.8],offsets:[-.5,.65,2.6]},{id:1,name:"sniper rifle",dmg:100,ammo:15,crit:5,spreads:[0],rate:1e3,bMaterial:"bullet_1",bLength:30,colors:[6380116,4472892,6169856],holdPos:[.3,.1],bodyScales:[11,2,2],magScales:[1.5,3,2,.4],scopeScales:[4,1.8,1.8,.2],gripScales:[2,1.8,1.8],offsets:[-.5,.65,3]},{id:2,name:"minigun",dmg:6,ammo:200,crit:5,spreads:[0,.02,-.012,-.022,.01,.016],rate:80,bMaterial:"bullet_1",bLength:20,colors:[4472892,3025705],holdPos:[0,0],bodyScales:[10,3,3],magScales:[4,4.5,4.5,.5],scopeScales:[],gripScales:[],offsets:[-.5,.65,2]},{id:3,name:"pistol",dmg:20,ammo:100,crit:10,spreads:[0,.008,-.005],rate:200,bMaterial:"bullet_1",bLength:20,colors:[6380116,7755853],holdPos:[.2,.2],bodyScales:[5.5,1.7,1.7],magScales:[1.3,2.4,1.6,.5],scopeScales:[],gripScales:[],offsets:[-.5,.65,6]},{id:4,name:"shotgun",dmg:35,ammo:30,crit:10,spreads:[0,.035,-.035],bps:3,rate:450,bMaterial:"bullet_1",bLength:20,colors:[8816262,7755853,7755853],holdPos:[.2,0],bodyScales:[8,2,2],magScales:[4,2,3,.3],scopeScales:[],gripScales:[1,1.8,2.8],offsets:[-.5,.6,2.5]},{id:5,name:"revolver",dmg:65,ammo:50,crit:10,spreads:[0,.008,-.005],rate:300,bMaterial:"bullet_1",bLength:22,colors:[12237498,6380116],holdPos:[.35,.35],bodyScales:[5,1.6,1.6],magScales:[1.3,2.4,1.6,.5],scopeScales:[],gripScales:[],offsets:[-.5,.65,6]},{id:6,name:"grenade launcher",dmg:110,ammo:5,bSpeed:.41,bYVel:.14,bBounce:!0,bLife:1e3,expRange:85,spreads:[0,-.01,.008,.01],rate:1e3,bMaterial:"bullet_2",bLength:8,bWidth:16,colors:[6380116,4472892,7755853],holdPos:[.2,0],bodyScales:[9,2.5,2.5],magScales:[4,2,5,.3],scopeScales:[],gripScales:[1,1.8,2.8],offsets:[-.5,.6,2.5]},{id:7,name:"nade thrower",dmg:100,ammo:25,bSpeed:.5,bYVel:.06,bBounce:!0,bLife:800,expRange:80,spreads:[0,-.015,.008,.02],rate:600,bMaterial:"bullet_2",bLength:8,bWidth:16,colors:[7169374,4472892,4472892],holdPos:[.2,0],bodyScales:[9.5,2.5,2.5],magScales:[4,2,5,.3],scopeScales:[],gripScales:[1,1.8,2.8],offsets:[-.5,.6,2.5]}],e.exports.cloneWeapons=function(e){for(var a,i=[],n=0;n0;ka.style.display=e?"block":"none"}function p(e,t){!e&&Ai||(Ea.innerHTML="",Ua.style.display=!t&&e||!Dn?"none":"block",ia.style.display=e?"none":"block",Ma.style.display=e?"block":"none",e&&u(t))}function u(e){if(!Gi){if(!e)return;Gi=hn[e.mode]}for(var t="CLANNAME",a=0;a"+Gi.stats[a][0].toUpperCase()+"":""+Gi.stats[a].toUpperCase()+"";e&&(t+="KREDIT"),t+="";var i,n=0,s=e?e.players:kn;e||(s=s.sort(UTILS.sortByScore));for(var o=Yi?Yi.team:"red",r=Yi?Yi.sid:-1,a=0;a"+(s[a].clan||"NONE")+"",i=s[a].sid==r?"rgba(255,255,255,0.9)":s[a].team&&o==s[a].team?"#7af431":"#f43131",t+=""+s[a].name+"";for(var l=0;l"+s[a][Gi.stats[l]]+"";e&&(t+=""+s[a].tmpRew+" KR"),t+="",n++}Ta.innerHTML=t}function g(e,t){e=e||window.innerWidth,t=t||window.innerHeight;var a=3e3,i=e+t,n=i/a*1.1;qt.style.transform="perspective(1px) translate(0, -50%) scale("+n+")"}function y(e){Ft=!1,Ot.close(),h(e||"kicked.")}function f(){Ot.on("0",F),Ot.on("1",W),Ot.on("2",vt),Ot.on("3",G),Ot.on("4",K),Ot.on("5",y),Ot.on("6",dt),Ot.on("dp",ct),Ot.on("d",ht),Ot.on("ex",st),Ot.on("7",Fe),Ot.on("v",We),Ot.on("av",Ge),Ot.on("8",et),Ot.on("9",Ke),Ot.on("11",je),Ot.on("12",Ne),Ot.on("h",pt),Ot.on("t",Ue),Ot.on("p",v),Ot.on("endR",B),Ot.on("strR",j),Ot.on("endTm",N),Ot.on("db",w),Ot.on("ch",L),Ot.on("pi",Ce),Ot.on("hr",he),Ot.on("cln",Ee),Ot.on("invc",Me),Ot.on("lcln",xe),Ot.on("inves",we),Ot.on("ldrb",De)}function v(e){on=e||on,Ot.emit("p")}function w(e,t,a){nn=!1,"register"==e?ba.innerHTML=t:"login"==e&&(a?(o("krng_lgkauth",a.key),o("krng_lgknm",a.acc.name),Ga=a.acc,Q(),pe()):ba.innerHTML=t,Ui&&(Ui=!1,d(!0)))}function x(e,t){nn||(nn=!0,Ot.emit("db",e,t),"register"!=e&&"login"!=e||(ba.innerHTML="please wait..."))}function M(){x("register",[Sa.value,La.value,ka.value])}function E(){x("login",[Sa.value,Ia.value])}function T(){x("logout"),r("krng_lgkauth"),r("krng_lgknm"),Ga=null,Sa.value="",Ia.value="",pe()}function b(){return Dn&&Aa===document.activeElement}function S(){Ot.emit("ch",Aa.value),k()}function L(e,t,a,i){if(Dn){var n=document.createElement("li"),s="White",o=Yi?Yi.team:"red";for(e||(s=o==a?"Green":"Red"),n.className="chat"+s,n.innerHTML=t?(t||"")+':'+i+"":''+i+"";Ba.clientHeight>130;)Ba.removeChild(Ba.childNodes[0]);Ba.appendChild(n)}}function k(){Aa.style.display="none",Aa.value="",za.style.display="inline-block",window.focus(),document.activeElement&&document.activeElement.blur()}function I(){ia.oncontextmenu=function(){return!1},ai=l("krng_antial"),Za=document.createElement("div"),document.body.appendChild(Za),Ka=new THREE.PerspectiveCamera(35,Math.min(window.innerWidth/window.innerHeight,ii),1,2e3),Ya=new THREE.Scene,Rn.scene=Ya,Xa=new THREE.WebGLRenderer({canvas:ni,antialias:ai}),Xa.setPixelRatio(window.devicePixelRatio),Xa.setSize(window.innerWidth,window.innerHeight),Za.appendChild(Xa.domElement),window.addEventListener("resize",function(){ei=window.innerWidth,ti=window.innerHeight,Ka.aspect=Math.min(window.innerWidth/window.innerHeight,ii),Ka.updateProjectionMatrix(),Xa.setSize(window.innerWidth,window.innerHeight),g(window.innerWidth,window.innerHeight)},!1),Xa.setClearColor(bi[0]),Ja=new THREE.AmbientLight(Ti[0]),Ya.add(Ja),qa=new THREE.DirectionalLight(Ti[0],.65),qa.position.set(0,1,0),Ya.add(qa),Ya.fog=new THREE.Fog(bi[0],0,Lt.fogDist),$a=new ExplosionManager,Ya.add($a),H(),re(),le(),ce(),be(),ea.value=l("brwl_nm")||"",pa.style.display="inline-block",ua.style.display="inline-block",adHolder.style.display="inline-block",Y();var e=l("brwl_cls");Z(null!==e&&""!=e?parseInt(e):0),ee();var t=l("brwl_prk");te(null!==t&&""!=t?parseInt(t):0);for(var a=0;a<10;++a)ot();for(var a=0;a=49&&t<=57?Yi.swapWeapon(t-49):t==si?p(!0):69==t?Ve(1):81==t&&Ve(-1)))};window.addEventListener("keydown",e);var t=function(e){var t=e.which||e.keyCode||0;b()?t==wi&&S():xi[t]&&(xi[t]=0,t!=gi&&t!=wi||!Dn?t==si&&!Ai&&Yi&&Yi.alive&&p(!1):(Aa.style.display="inline-block",za.style.display="none",Aa.focus()))};window.addEventListener("keyup",t);var a=function(e){yi=e.clientX/window.innerWidth*2-1,fi=e.clientY/window.innerHeight*2-1};window.addEventListener("mousemove",a);var i=function(e){vi=1};window.addEventListener("mousedown",i);var n=function(e){vi=0};window.addEventListener("mouseup",n);var s=function(e){if(Yi&&Yi.alive&&!Ai){var t=e.wheelDelta?e.wheelDelta:-e.detail;t<0?Ve(1):t>0&&Ve(-1)}};window.addEventListener("mousewheel",s),window.addEventListener("DOMMouseScroll",s)}function R(e){Di.innerHTML=e}function _(e){e&&e.modCreator?Na.innerHTML="Game by Sidney de Vries | Mod by "+e.modCreator:Na.innerHTML="Game by Sidney de Vries",gameNameLarge.innerHTML=e&&e.modName?e.modName:"KARNAGE ONLINE"}function C(e){e?(e.ambientLight&&(Ja.color.set(new THREE.Color(e.ambientLight)),qa.color.set(new THREE.Color(e.ambientLight))),e.fogColor&&(Ya.fog=new THREE.Fog(new THREE.Color(e.fogColor),0,Lt.fogDist))):Qe(Jn)}function D(e){if(an=!e,e)Ei.createMaterials(Si,function(){R("Mod packs reset")}),_(),C(),Hi&&Hi.parentNode.removeChild(Hi);else{R("Success! mod pack loaded");for(var t=0;t-1?_(JSON.parse(e.replace(/(\r\n|\n|\r)/gm,""))):t.typeName.indexOf("shaders")>-1?C(JSON.parse(e.replace(/(\r\n|\n|\r)/gm,""))):t.typeName.indexOf("cssmod")>-1&&(Hi=document.createElement("style"),Hi.type="text/css",Hi.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(Hi))}catch(e){}Qa.close()}}function s(){this.numFiles,this.progress,this.reader,this.init=function(e,t){this.numFiles=t,this.progress=0,this.reader=e},this.close=function(){this.reader&&(this.progress++,this.numFiles===this.progress&&(D(),this.reader.close(),this.reader=void 0,ki=o,sn=!1))}}if(!sn){var o="";if(t)return void D(!0);if(""==(e=e.replace(/\s/g,"")))return void R("Please enter a valid mod key");if(sn=!0,UTILS.isBasicURL(e)?(o=e,o.match(/^https?:\/\//i)||(o="http://"+o)):o="https://dl.dropboxusercontent.com/s/"+e+"/karnagemod.zip",ki==o)return sn=!1,void R("Mod already loaded");sn&&R("Loading..."),Qa||(Qa=new s);var r="";zip.createReader(new zip.HttpReader(o),function(e){e.getEntries(function(t){if(t.length){Qa.init(e,t.length);for(var s=0;s ON "+cn.data[e.mapIndex].name.toUpperCase()+"",Ue(e.t)),t||c(!1)}function W(e,t){if(!Ai){var a=Hn.getIndexBySid(e.sid);if(a<0&&(Hn.add(new At(0,e.sid,Lt,UTILS,jt,Rn,!1,Ye)),a=kn.length-1),e.alive&&(kn[a].init(e),kn[a].camos=e.cM,kn[a].name=e.n,kn[a].rank=e.r,kn[a].clan=e.cln,kn[a].clanValue=e.clnV,kn[a].setClass(fn,e.c),kn[a].setPerk(yn,e.p),kn[a].armor=e.a||0,kn[a].health=e.h||kn[a].maxHealth,kn[a].cWeapon=e.cW,t&&(Yi=kn[a]),qe(kn[a],!0),t?(bn=0,Sn=0,ze(),Oe(),Be(),tt(Yi),Ze(Yi)):kn[a].setAsLocalOther(),kn[a].hidden=!0),kn[a].name=e.n,kn[a].active=!0,e.st)for(var i=0;i=0&&(qe(kn[t],!1),kn.splice(t,1))}function K(e,t,a,i,n){var s;if((s=void 0!==t&&null!==t?t:Hn.getIndexBySid(e))>=0&&(qe(kn[s],!1),kn[s].kill(),Yi&&Yi.sid==e&&!a))if(V(),pe(),ia.style.display="none",n)d(!0);else{ga.innerHTML="YOU DIED";var o=ti/8;Xe(ga,o,1.2*o,400,Lt.deathFadeTime,200,!0,function(){d(!0)});var o=ti/24;ya.innerHTML=i?"KILLED BY "+i:"COMMITTED SUICIDE",Xe(ya,o,o,1,.8*Lt.deathFadeTime,100,!0)}}function Y(){for(var e="",t=0;t"+fn[t].name+"";Xi=e,X()}function X(){for(var e=0;e"+_n[a]+" "+mn[fn[e].weapons[a]].name.capitalizeFirst()+"";fn[e].trait&&(t+="
trait "+fn[e].trait.name.capitalizeFirst()+"
"),fn[e].desc=t}}function Z(e,t){Mn=e,ae(),o("brwl_cls",Mn)}function q(e){na.innerHTML="Select Variant";var t="
Default
";if(Ga){for(var a,i,n=[],s=0;s"+n[s].name+" x"+Ga.items[a].count+""}document.getElementById("loadoutHolder").innerHTML=t}function J(e,t){En[e]=t,o("krng_wpn_"+e,t),ae()}function Q(){for(var e=0;e"+yn[t].name+"";Cn=e}function te(e){Tn=e,yn[Tn]||(Tn=0),ae(),o("brwl_prk",Tn)}function ae(){na.innerHTML="Loadout";var e=fn[Mn].desc;e+=ie("passive",yn[Tn].name,"showPerksList()"),me(0,e)}function ie(e,t,a){return"
"+e+" "+t+"
"}function ne(){na.innerHTML="Select Class",document.getElementById("loadoutHolder").innerHTML=Xi}function se(){na.innerHTML="Select Passive Ability",document.getElementById("loadoutHolder").innerHTML=Cn}function oe(e){jn[e].indx||(jn[e].indx=0),jn[e].indx++,jn[e].indx>=jn[e].vals.length&&(jn[e].indx=0),jn[e].set(jn[e].indx),o("sttings_karnage_"+jn[e].name,jn[e].indx),le()}function re(){for(var e,t=0;thost "+hn[t].name+"";e+="
ready to host
",va.innerHTML=e,Zi=document.getElementById("hostInfoTxt")}function de(e){Zi.innerHTML="please wait...",Ot.emit("hg",e)}function he(e){e?(Zi.innerHTML="match hosted on ",window.history.replaceState("karnage host","Karnage Online",e),j(),kn.length=0,Yi=null):Zi.innerHTML="error. match could not be hosted"}function me(e,t){na.innerHTML=Vn[e].capitalizeFirst();for(var a=0;a",t+="
name "+Ga.name+"
",t+="
rank "+Ga.rank+"
",t+="
score "+Ga.score+"
",t+="
kills "+Ga.kills+"
",t+="
deaths "+Ga.deaths+"
",t+="
kdr "+Ga.kdr+"
",t+="
Account Info
",t+="
account age "+UTILS.getHumanReadableTime(Date.now()-Ga.createDate)+"
",t+="
time played "+UTILS.getHumanReadableTime(Ga.timePlayed)+"
",t+="
games played "+Ga.gamesPlayed+"
",t+="
logout",e.innerHTML=t}else ba.style.display="block",ba.innerHTML="you must use a VALID EMAIL to register";Ha.style.display=Ga?"none":"block",_a.style.display=Ga?"block":"none",Le(),ue()}function ue(){var e="";if(Ga)if(Ga.clan){for(var t=0,a=0,i=0;iname "+Ga.clan.clan_name+"",e+="
members "+Ga.clan.clan_members.length+"
",e+="
kdr "+s+"
",e+="
value "+(Ga.clan.clan_kredits?Ga.clan.clan_kredits.toFixed(2):"0.00")+" KR
",e+="",e+="
INVEST
",Ga.clan.clan_owner==Ga.id?(e+="
Manage
",e+="
invite new members
",e+="",e+="
INVITE
"):e+="",e+="
Members Invested
";for(var i=0;i"+n.PLAYER_NAME+" "+UTILS.roundTo(n.PLAYER_KILLS/Math.max(1,n.PLAYER_DEATHS),2)+" KDR"+n.PLAYER_INVESTED+" KR"}e+=Ga.clan.clan_owner==Ga.id?"
delete clan":"
leave clan"}else e+="
create or join a clan
",e+="",e+="
CREATE
JOIN
";else e+="must be logged in to create or manage clans";wa.innerHTML=e,qi=document.getElementById("clanInfoHeader")}function ge(e){var t=document.getElementById("clanNameInput").value;!t||t.replace(/\s/g,"").length<=0?qi.innerHTML="please enter a name":(qi.innerHTML="please wait...",Ot.emit("cln",t,e))}function ye(){1==confirm("Are you sure?")&&Ot.emit("lcln")}function fe(){var e=document.getElementById("clanInviteInput").value;!e||e.replace(/\s/g,"").length<=0?qi.innerHTML="please enter a name":(qi.innerHTML="please wait...",Ot.emit("invc",e))}function ve(){var e=document.getElementById("clanInvestInput").value;UTILS.isInt(e)&&Ot.emit("inves",e)}function we(e){Ga&&Ga.clan&&(Ga.clan.clan_kredits=e,ue(),Le())}function xe(){Ga&&(Ga.clan=null,ue())}function Me(e){qi.innerHTML=e?e:"success! invite sent"}function Ee(e,t){e?qi.innerHTML=e:(Ga.clan=t,ue())}function Te(e){for(var t=0;t"+On[t].name+"";xa.innerHTML+=e}function Se(e){return e<100?"#000000":e<5e3?"#7af431":e<1e4?"#ffec15":e<25e3?"#e58619":e<5e4?"#039cdc":e<75e3?"#e81414":e<1e5?"#d10a8b":"#ff15e1"}function Le(){Ga?(Ra.innerHTML="purchase upgrades and items with the kredits you earned",Ca.innerHTML="kredits "+Ga.kredits.toFixed(2)+" KR"):(Ra.innerHTML="you must create an account to purchase items",Ca.innerHTML="");for(var e="",t=0;t"+wn[t].name.toLowerCase()+""+wn[t].price.toFixed(2)+" KR";Da.innerHTML=e}function ke(){qt.style.display="block",Jt.style.display="none"}function Ie(e){var t=wn[e];qt.style.display="none",Jt.style.display="block";var a="
"+t.name+" Crate
";a+="
"+t.desc+"
",a+=Ga?Ga.kredits>=t.price?"
"+t.price.toFixed(2)+" KR
":"
"+t.price.toFixed(2)+" KR
":"
must be logged in
",a+="
CANCEL
",a+="
PURCHASE
",$t.innerHTML=a}function He(e){qt.style.display="none",Jt.style.display="block";var t="
"+xn[e].name+" Contract
";t+="
"+xn[e].desc+"
",t+="
"+xn[e].price.toFixed(2)+" KR
",t+="
CANCEL
",t+="
PURCHASE
",$t.innerHTML=t}function Re(e){return Ga&&Ga.kredits>=e}function _e(e,t){if(Re(wn[t].price)){var a=e.parentElement;a.parentElement,a.removeChild(e),a.removeChild(a.getElementsByClassName("loginButton")[0]),a.innerHTML="

purchasing...

",Ot.emit("pi",0,t)}}function Ce(e,t){var a=e[t].id+"_"+e[t].weaponID;Ga.items[a]?Ga.items[a].count++:Ga.items[a]=e[t];for(var i=0;i",i+="
Accounts: "+a.accounts+"
",i+="
Kills: "+a.kills+"
",i+="
Deaths: "+a.deaths+"
",i+="
Global Kredits: "+UTILS.roundTo(a.kredits*Lt.kreditsToUSD,2)+" KR - "+UTILS.roundTo(a.kredits*Lt.kreditsToUSD,2)+" US
",i+="
Time Played: "+UTILS.getHumanReadableTime(a.time)+"
",i+="";else{i="";for(var n=Fn[e].values.length,s=0;s"+Fn[e].valuesN[s]+"";i+="";for(var o=1,s=0;s";for(var r=0;r"+a[s+r]+" KR - "+UTILS.roundTo(a[s+r]*Lt.kreditsToUSD,2)+" US":"player_time_played"==Fn[e].values[r]?"":"":"";i+="",s+=n,o++}i+="
"+UTILS.getHumanReadableTime(a[s+r])+""+a[s+r]+""+o+". "+a[s+r]+"
"}Wn[e]=i}Fa.innerHTML=i}function Pe(e){qt.style.display=e?"none":"block",Va.style.display=e?"block":"none"}function Ae(e){Wn[e]||(Wn[e]="loading...",Ot&&Ot.emit("ldrb",e));for(var t=0;t
AP",sa.innerHTML="HP
"+Yi.health}function Be(){da.innerHTML="SCORE "+Yi.score}function Ue(e){aa.innerHTML=e}function Ne(){if(!Ai){ga.innerHTML=Yn[Math.min(bn,Yn.length-1)],bn++;var e=ti/10;Xe(ga,e,1.21*e,200,Lt.killStreakTimer,100,!0,function(){bn=0}),e=ti/23,ya.innerHTML="+"+Lt.scorePerKill*bn+" POINTS",Xe(ya,e,1.333*e,280,Lt.killStreakTimer,100,!0)}}function je(e){ma.innerHTML=e,Xe(ma,21,28,200,1600,200,!0)}function Ve(e){Yi.cWeapon+=1*e,Yi.cWeapon>=Yi.weapons.length&&(Yi.cWeapon=0),Yi.cWeapon<0&&(Yi.cWeapon=Yi.weapons.length-1),Oe()}function Oe(){for(var e="",t="",a=0;a
"+Yi.weapons[a].name.toUpperCase()+"
":"
"+Yi.weapons[a].name.toUpperCase()+"
",t+="
"+(a+1)+"
";ra.innerHTML=e,la.innerHTML=t,Ye(),mt(Yi.sid,Yi.cWeapon)}function Fe(e){Yi.health=e[0],Yi.armor=e[1],ze()}function We(e,t,a){var i=Hn.getIndexBySid(e);i>=0&&kn[i].active&&(kn[i][t]=a),Yi&&Yi.sid==Yi.sid&&"score"==t&&Be()}function Ge(e,t){Ga&&void 0!==Ga[e]&&(Ga[e]=t)}function Ke(e){Yi&&Yi.alive&&Yi.getAmmo(e)}function Ye(){ca.innerHTML=Yi.weapons[Yi.cWeapon].ammo+" / "+Yi.weapons[Yi.cWeapon].maxAmmo+""}function Xe(e,t,a,i,n,s,o,r){for(var l,c=0;c=0&&Bn&&!Un,Bn&&!Un&&(e.nameMesh.position.x=e.x,e.nameMesh.position.z=e.z-9,e.nameMesh.position.y=e.y+e.h+12,e.nameMesh.lookAt(Ka.position),e.nameMesh.rotation.z=0)),e.healthMesh&&(e.healthMesh.visible=e.alive&&e.y>=0,e.healthMesh.position.x=e.x,e.healthMesh.position.z=e.z-5,e.healthMesh.position.y=e.y+e.h+10,e.healthMesh.lookAt(Ka.position),e.healthMesh.rotation.z=0))}function qe(e,t){if(e.meshes){for(var a=0;a=0){var L=vn[e.camos[a]],k=Ei.textureLoader.load("img/camos/camo_"+e.camos[a]+".png");k.wrapS=k.wrapT=THREE.RepeatWrapping,k.magFilter=k.minFilter=THREE.NearestFilter,S=new THREE.Mesh(o,new THREE.MultiMaterial([Ei.getMaterial("player"),L.glow?new THREE.MeshLambertMaterial({vertexColors:THREE.VertexColors,shading:THREE.FlatShading,emissiveMap:k,emissive:16777215,emissiveIntensity:2}):new THREE.MeshLambertMaterial({shading:THREE.FlatShading,map:k})])),S.moveCamo=L.moving}else S=new THREE.Mesh(o,Ei.getMaterial("player"));S.dontMakeVisible=!0,e.weaponMeshes.push(S),e.meshes.push(S)}for(var a=0;ah.t&&(o.faces[0].vertexColors[0]=qn,o.faces[0].vertexColors[2]=qn,o.faces[1].vertexColors[2]=qn),h.tln>h.t&&(o.faces[0].vertexColors[0]=qn),h.trn>h.t&&(o.faces[0].vertexColors[2]=qn,o.faces[1].vertexColors[2]=qn),h.bln>h.t&&(o.faces[0].vertexColors[1]=qn,o.faces[1].vertexColors[0]=qn),h.brn>h.t&&(o.faces[1].vertexColors[1]=qn),h.rn>h.t&&(o.faces[0].vertexColors[2]=qn,o.faces[1].vertexColors[2]=qn,o.faces[1].vertexColors[1]=qn),h.ln>h.t&&(o.faces[0].vertexColors[0]=qn,o.faces[0].vertexColors[1]=qn,o.faces[1].vertexColors[0]=qn),h.bn>h.t&&(o.faces[0].vertexColors[1]=qn,o.faces[1].vertexColors[0]=qn,o.faces[1].vertexColors[1]=qn),2!=h.t?p[1].merge(o,m):(p[2].merge(o,m),l.position.x=h.x,l.position.z=h.z,l.position.y=h.y+.1,l.scale.x=Lt.tileScale-2*Lt.roofPadding,l.scale.z=Lt.tileScale-2*Lt.roofPadding,h.rn==h.t&&(l.scale.x+=Lt.roofPadding,l.position.x+=Lt.roofPadding/2),h.ln==h.t&&(l.scale.x+=Lt.roofPadding,l.position.x-=Lt.roofPadding/2),l.updateMatrix(),p[4].merge(l.geometry,l.matrix),h.tn==h.t&&(l.position.x=h.x,l.scale.x=Lt.tileScale-2*Lt.roofPadding,l.scale.z=Lt.roofPadding,l.position.z=h.z-(Lt.tileScale/2-Lt.roofPadding/2),h.trn==h.t&&h.rn==h.t&&(l.scale.x+=Lt.roofPadding,l.position.x+=Lt.roofPadding/2),h.tln==h.t&&h.ln==h.t&&(l.scale.x+=Lt.roofPadding,l.position.x-=Lt.roofPadding/2),l.updateMatrix(),p[4].merge(l.geometry,l.matrix)),h.bn==h.t&&(l.position.x=h.x,l.scale.x=Lt.tileScale-2*Lt.roofPadding,l.scale.z=Lt.roofPadding,l.position.z=h.z+(Lt.tileScale/2-Lt.roofPadding/2),h.brn==h.t&&h.rn==h.t&&(l.scale.x+=Lt.roofPadding,l.position.x+=Lt.roofPadding/2),h.bln==h.t&&h.ln==h.t&&(l.scale.x+=Lt.roofPadding,l.position.x-=Lt.roofPadding/2),l.updateMatrix(),p[4].merge(l.geometry,l.matrix))),h.pickup&&(h.pickup.mesh=kt.generateCube(h.x,h.y+h.h+Lt.pickupYOffset,h.z,2*h.pickup.s,2*h.pickup.s,2*h.pickup.s,[1,1,1,0,1,1],Ei.getMaterial(h.pickup.materialID)),it(h.pickup),a&&a[i]&&et(i,!1),Ya.add(h.pickup.mesh))}var g=cn.data[Jn].type,y=new THREE.Geometry,f=[Ei.getMaterial("wall_1"),Ei.getMaterial("floor_1"),Ei.getMaterial("roof_1"),Ei.getMaterial("base_"+g),Ei.getMaterial("roof_2")];Fi||(Fi=new THREE.Mesh(Mi,Ei.getMaterial("end_1")),Fi.rotation.x=-Math.PI/2,Fi.scale.x=1400,Fi.scale.y=1400,Fi.position.y=5.5-Lt.tileScale,Ya.add(Fi)),Fi.material=Ei.getMaterial("end_"+g),Qe(g);for(var i=0;i=0&&(mn[e[1]].bSpeed?Rn.createProjectile(mn[e[1]],null,e[2],e[3],e[4],e[5],0,e[0]+"_"+e[6]):Yi.sid!=e[0]&<(e[3],e[4],e[6],e[5],e[7],e[2],mn[e[1]],e[8]))}}function ht(e,t,a,i,n){Nn&&(e<0?showAnimatedText(Mi,Ya,t,a,i,-e,7,1.5+-e/110,n?"#F4EE31":"#fff"):showAnimatedText(Mi,Ya,t,a,i,e,7,1.5+e/110,"#7af431"))}function mt(e,t){var a;if(Yi&&e==Yi.sid)a=Yi;else{var i=Hn.getIndexBySid(e);i>=0&&(a=kn[i])}if(a&&a.alive)for(var n=0;n=0&&ut(kn[a],t)}function ut(e,t){e.health=t,e.alive&&e.healthMesh&&(e.healthMesh.scale.x=Math.min(e.maxHealth,t)/e.maxHealth*20,e.healthMesh.scale.y=Lt.healthBarHeight)}function gt(e){35!=e.fov&&(e.fov=35,e.updateProjectionMatrix()),e.scale.x=1,e.scale.y=1,e.scale.z=1}function yt(e){b()&&xi!=[]&&(xi=[]),Pn&&(os-=e)<=0&&(os=Lt.statsUpdateRate,Pa.innerHTML=Math.round(1e3/e)+" FPS",Pa.innerHTML+="
"+on+" PING"),e>50&&(e=50);var t=e;if(Ai&&(e*=zi/Lt.gameOverFadeTime,zi&&(zi-=t)<=0&&(zi=0,U())),Ft){Yi&&Yi.alive&&at(),Yi&&Yi.alive&&(!Ai||zi)&&(Ki=Ln[Yi.inputNumber],Ki||(Ln[Yi.inputNumber]={},Ki=Ln[Yi.inputNumber]),Ki.forces=null,Ki.xt=0,Ki.zt=0,Ki.dt=e,Ki.jp=0,Ki.md=vi&&Yi.weapons[Yi.cWeapon].ammo>0?1:0,Ki.cw=Yi.cWeapon,(xi[oi]||xi[ri])&&(Ki.xt-=1),(xi[li]||xi[ci])&&(Ki.xt+=1),(xi[di]||xi[hi])&&(Ki.zt-=1),(xi[mi]||xi[pi])&&(Ki.zt+=1),xi[ui]&&(Ki.jp=1),Lt.gpadX&&(Ki.xt=Lt.gpadX),Lt.gpadZ&&(Ki.zt=Lt.gpadZ),Ki.sn=Yi.inputNumber++,Ki.dr=UTILS.roundTo(rn,3),Ai||Yi.inputsToSend.push(Ki.sn,Ki.dt,Ki.xt,Ki.zt,Ki.jp,Ki.md,Ki.dr,Ki.cw),Yi.processInput(Ki,!1,dn.tiles),Ai||(Yi.inputs.push(Ki),ft()));for(var a=Vi-1e3/Lt.serverUpdate,i=0;i=Pi.t1){var n=Pi.t2-Pi.t1,s=a-Pi.t1,o=s/n;Pi.x=Math.lerp(Pi.xt1,Pi.xt2,o),Pi.z=Math.lerp(Pi.zt1,Pi.zt2,o),Pi.y=Math.lerp(Pi.yt1,Pi.yt2,o),Pi.dir=Math.lerpAngle(Pi.dt2,Pi.dt1,o)}else Pi.x=Pi.xt2,Pi.z=Pi.zt2,Pi.y=Pi.yt2,Pi.dir=Pi.dt2;if(!Ai||zi)if(Pi.animate){Pi.animTime+=e;var r=.024*Pi.speed*Pi.animTime*(2*Math.PI),l=Pi.leftLeg.rotation.x-Math.PI;Pi.leftLeg.rotation.x=Math.cos(r+Math.PI)+Math.PI,Pi.rightLeg.rotation.x=Math.cos(r)+Math.PI,!Pi.moving&&(l<0&&Pi.leftLeg.rotation.x-Math.PI>0||l>0&&Pi.leftLeg.rotation.x-Math.PI<0)&&(Pi.leftLeg.rotation.x=Math.PI,Pi.rightLeg.rotation.x=Math.PI,Pi.animate=!1)}else Pi.leftLeg.rotation.x=Math.PI,Pi.rightLeg.rotation.x=Math.PI,Pi.movDir=Pi.dir;Pi.weaponMeshes[Pi.cWeapon].moveCamo&&Pi.weaponMeshes[Pi.cWeapon].material.materials[1].emissiveMap&&(Pi.weaponMeshes[Pi.cWeapon].material.materials[1].emissiveMap.offset.x-=.001*e),Ze(Pi)}Yi&&Yi.alive&&(Yi.viewDist!=fn[Yi.classIndex].viewDist&&(Yi.viewDist=fn[Yi.classIndex].viewDist),Ze(Yi),Ai&&!e||tt(Yi,e)),es>0&&(es*=.005)<=.1&&(es=0),$a.update(e/1e3),Rn.updateProjectiles(e);for(var i=0;i=Pi.maxSize?(Pi.scaleSpeed*=-1,Pi.currentSize=Pi.maxSize):Pi.currentSize<=Pi.startSize&&(Pi.scaleSpeed=0,Pi.currentSize=Pi.startSize)),Pi.fadeDelay-=t,Pi.fadeDelay<=0&&(Pi.alpha-=Pi.fadeSpeed*t,Pi.alpha<=0&&(Pi.active=!1,Pi.alpha=0,Pi.callback&&Pi.callback()),Pi.doFade&&(Pi.div.style.opacity=Pi.alpha,Pi.div.style.filter="alpha(opacity="+100*Pi.alpha+")")),Pi.div.style.fontSize=Pi.currentSize+"px");updateAnimatedTexts(Ka,e),Fi&&Fi.material&&(Fi.material.map.offset.y+=9e-5*e),Wi&&Wi.material&&(Wi.material.map.offset.y+=6e-5*e)}}function ft(){rs--,Yi&&Yi.alive&&Vi-rs>=1e3/Lt.clientSendRate&&(Ot.emit("1",Yi.inputsToSend),Yi.inputsToSend.length=0,rs=Vi)}function vt(e,t){if(e&&!Ai&&Wa){for(var a,i,n=Vi,s=0;s=0){if(i=kn[a],Yi&&Yi.sid==e[s]){i.jumpDelta=t[1],i.jumpCountdown=t[2],i.x=e[s+1],i.z=e[s+2],i.y=e[s+3];for(var o=0;o1?1:a,e+(t-e)*a},Math.modFix=function(e,t){return(e%t+t)%t},Math.lerpAngle=function(e,t,a){Math.abs(t-e)>Wt&&(e>t?t+=Gt:e+=Gt);var i=t+(e-t)*a;return i>=0&&i<=Gt?i:i%Gt},String.prototype.capitalizeFirst=function(){return this.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()})};var Kt;"undefined"!=typeof Storage&&(Kt=!0);var Yt=document.getElementById("blocker"),Xt=document.getElementById("mainMenuContainer"),Zt=document.getElementById("menuCardHolder"),qt=document.getElementById("centerMenuContainer"),Jt=document.getElementById("storeModalContainer"),$t=document.getElementById("storeModal"),Qt=document.getElementById("loadingContainer"),ea=document.getElementById("nameInput"),ta=document.getElementById("roundOverContainer"),aa=document.getElementById("timeDisplay"),ia=document.getElementById("gameHudContainer"),na=(document.getElementById("graphicsDiv"),document.getElementById("setupHeader")),sa=(document.getElementById("classDesc"),document.getElementById("healthDisplay")),oa=document.getElementById("armorDisplay"),ra=document.getElementById("weaponsDisplay"),la=document.getElementById("weaponIndexDisplay"),ca=document.getElementById("ammoDisplay"),da=document.getElementById("scoreDisplay"),ha=document.getElementById("modeDisplay"),ma=document.getElementById("pickupContainer"),pa=document.getElementById("setupHolder"),ua=document.getElementById("menuHolder"),ga=document.getElementById("scoreMessage"),ya=document.getElementById("scoreMessageAmnt"),fa=document.getElementById("optionsHolder"),va=document.getElementById("hostHolder"),wa=document.getElementById("clanHolder"),xa=document.getElementById("guideHolder"),Ma=document.getElementById("leaderboardContainer"),Ea=document.getElementById("leaderboardHeader"),Ta=document.getElementById("leaderboard"),ba=document.getElementById("accountInfoHeader"),Sa=document.getElementById("lgnUserName"),La=document.getElementById("lgnUserEmail"),ka=document.getElementById("lgnUserEmail2"),Ia=document.getElementById("lgnUserPass"),Ha=document.getElementById("accountLogRegHolder"),Ra=document.getElementById("storeInfoHeader"),_a=(document.getElementById("storeHolder"),document.getElementById("accountMainHolder")),Ca=document.getElementById("storeKreditCount"),Da=document.getElementById("storeItemsHolder"),Pa=document.getElementById("performanceHolder"),Aa=document.getElementById("chatInput"),za=(document.getElementById("chatInputHolder"),document.getElementById("chatInputPlaceholder")),Ba=document.getElementById("chatList"),Ua=document.getElementById("chatHolder"),Na=document.getElementById("creditDiv"),ja=document.getElementById("linksContainer1"),Va=document.getElementById("leaderboardModalContainer"),Oa=document.getElementById("leaderTabs"),Fa=document.getElementById("leaderTableContainer");ea.addEventListener("keyup",function(e){e.preventDefault(),13==e.keyCode&&z()}),g();var Wa=!0;window.onload=function(){n(function(e){e?(Ft=!1,pa.style.display="none",ua.style.display="none",adHolder.style.display="none",h(e),ia.style.display="none",Ua.style.display="none",Ma.style.display="none"):(Ft=!0,xt())});var e="";Fa.innerHTML="connecting...";for(var t=0;t"+Fn[t].name+"";Oa.innerHTML=e},window.onfocus=function(){Wa=!0,xi=[],Oi=Date.now(),Ft&&(Yi&&Yi.alive&&(Yi.inputs.length=0,Yi.inputNumber=0,Ai||tt(Yi)),Ai&&U())},window.onblur=function(){Wa=!1,xi=[]};var Ga=null;Aa.onblur=function(e){k()};var Ka,Ya,Xa,Za,qa,Ja,$a,Qa,ei=window.innerWidth,ti=window.innerHeight,ai=!1,ii=3,ni=document.createElement("canvas"),si=16,oi=65,ri=37,li=68,ci=39,di=87,hi=38,mi=83,pi=40,ui=32,gi=84,yi=0,fi=0,vi=0,wi=13,xi=[],Mi=(new THREE.AudioLoader,new THREE.PlaneGeometry(1,1)),Ei=Rt,Ti=[16744537,11851899],bi=[3549738,2831914],Si=[{id:"default",type:0,color:16777215},{id:"smoke_1",textures:["shaders/smoke_1"],repeat:[5,5],type:2},{id:"end_1",textures:["tiles/lava_1"],repeat:[21,21],fog:!1,type:2},{id:"floor_1",textures:["tiles/ground_1"],repeat:[1,1],type:0},{id:"roof_1",textures:["tiles/roof_1"],repeat:[1,1],type:0},{id:"roof_2",type:0},{id:"wall_1",textures:["tiles/wall_1"],repeat:[1,1],type:0},{id:"base_1",textures:["tiles/base_1","tiles/base_1_em"],repeat:[1,1],type:0},{id:"player",type:0,color:16777215},{id:"health_pickup_1",textures:["pickups/crate","pickups/health"],type:0},{id:"armor_pickup_1",textures:["pickups/crate","pickups/armor"],type:0},{id:"ammo_pickup_1",textures:["pickups/crate","pickups/ammu"],type:0},{id:"mega_armor_pickup_1",textures:["pickups/crate","pickups/marmor"],type:0},{id:"bullet_1",textures:["bullets/bullet_1"],type:2},{id:"bullet_2",textures:["bullets/bullet_2"],type:2},{id:"bullet_trail",textures:["shaders/linear_1"],color:16777215,type:2},{id:"muzzle_1",textures:["particles/muzzleFlash_1"],type:2},{id:"wallhit_1",textures:["particles/wallhit_1"],type:2},{id:"entity_shadow",textures:["shaders/radial_1"],type:3},{id:"health_bar_0",color:8057905,type:4},{id:"health_bar_1",color:16003377,type:4}],Li="",ki="",Ii=location.hash.replace("#","");zip.workerScriptsPath="js/libs/";var Hi,Ri={},_i=document.getElementById("modKeyInput"),Ci=document.getElementById("loadModBtn"),Di=document.getElementById("modInfoText");Ci.onclick=function(){P(_i.value)},document.getElementById("resetModBtn").onclick=function(){P(null,!0)};var Pi,Ai,zi,Bi,Ui,Ni,ji,Vi,Oi,Fi,Wi,Gi,Ki,Yi,Xi,Zi,qi,Ji,$i,Qi,en,tn=new THREE.Vector3(0,0,0),an=!1,nn=!1,sn=!1,on=0,rn=0,ln=0,cn=Ht,dn={},hn=Ct,mn=jt.data,pn=[],un=[],gn=[],yn=Pt,fn=St,vn=It.camos,wn=Ut.supplies,xn=Ut.clanItems,Mn=0,En={},Tn=0,bn=0,Sn=0,Ln=[],kn=[],In=new Dt(Ei),Hn=new zt(kn),Rn=new Bt(UTILS,Lt,dn,kn,!1,Ei),_n=["primary","secondary","special"],Cn="",Dn=!0,Pn=!0,An=!0,zn=!0,Bn=!0,Un=!1,Nn=!0,jn=[{name:"quality",indx:2,vals:["Retro","Low","Medium","High"],set:function(e){Un=!1,0==e?(Un=!0,Xa.setPixelRatio(window.devicePixelRatio/6)):1==e?Xa.setPixelRatio(window.devicePixelRatio/3):2==e?Xa.setPixelRatio(window.devicePixelRatio/1.6):Xa.setPixelRatio(window.devicePixelRatio)}},{name:"antialiasing *",vals:["Off","On"],dontSetOnLoad:!0,set:function(e){o("krng_antial",1==e)}},{name:"show chat",vals:["On","Off"],set:function(e){Dn=!e,Ua.style.display=Dn&&Yi?"block":"none"}},{name:"show performance",vals:["Off","On"],set:function(e){Pn=e,Pa.style.display=e?"block":"none"}},{name:"player names",vals:["On","Off"],set:function(e){Bn=!e}},{name:"show damage",vals:["On","Off"],set:function(e){Nn=!e}},{name:"bullet trails",vals:["On","Off"],set:function(e){An=!e}},{name:"music",vals:["On","Off"],set:function(e){}},{name:"sounds",vals:["On","Off"],set:function(e){}},{name:"entity shadows",vals:["On","Off"],set:function(e){if(zn=!e,dn&&dn.tiles)for(var t=0;t.5&&(this.offset=this.offsetForItem(this.wonItem+.5,s,r,n,o),this.spinVelocity=0),0===this.spinAcceleration&&this.stopping){var l=6,c=Math.random(),d=this.offset+this.offsetForItem(this.wonItem+c,s,r,n,o),h=l*o-d;this.spinAcceleration=this.calculateAcceleration(h,this.getSpinVelocity())}if(this.spinVelocity>0)this.spinVelocity+=this.spinAcceleration*t,this.offset+=this.getSpinVelocity()*t,this.offset=Math.modFix(this.offset,o);else{for(var m=this.offsetForItem(this.wonItem+.5,s,r,n,o),p=[m,m+o,m-o],u=Number.MAX_VALUE,g=0;g