yolkbot 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/browser/build/global.js +2 -2
  2. package/browser/build/module.js +2 -2
  3. package/dist/api.js +1 -1
  4. package/dist/bot/GamePlayer.js +1 -1
  5. package/dist/bot.js +1 -1
  6. package/dist/comm/CommIn.js +1 -1
  7. package/dist/comm/CommOut.js +1 -1
  8. package/dist/constants/CommCode.js +1 -1
  9. package/dist/constants/guns.js +1 -1
  10. package/dist/dispatches/BanPlayerDispatch.js +1 -1
  11. package/dist/dispatches/BootPlayerDispatch.js +1 -1
  12. package/dist/dispatches/ChatDispatch.js +1 -1
  13. package/dist/dispatches/FireDispatch.js +1 -1
  14. package/dist/dispatches/GameOptionsDispatch.js +1 -1
  15. package/dist/dispatches/GoToAmmoDispatch.js +1 -1
  16. package/dist/dispatches/GoToCoopDispatch.js +1 -1
  17. package/dist/dispatches/GoToGrenadeDispatch.js +1 -1
  18. package/dist/dispatches/GoToPlayerDispatch.js +1 -1
  19. package/dist/dispatches/GoToSpatulaDispatch.js +1 -1
  20. package/dist/dispatches/LookAtDispatch.js +1 -1
  21. package/dist/dispatches/LookAtPosDispatch.js +1 -1
  22. package/dist/dispatches/MeleeDispatch.js +1 -1
  23. package/dist/dispatches/MovementDispatch.js +1 -1
  24. package/dist/dispatches/PauseDispatch.js +1 -1
  25. package/dist/dispatches/ReloadDispatch.js +1 -1
  26. package/dist/dispatches/ReportPlayerDispatch.js +1 -1
  27. package/dist/dispatches/SaveLoadoutDispatch.js +1 -1
  28. package/dist/dispatches/SpawnDispatch.js +1 -1
  29. package/dist/dispatches/SwapWeaponDispatch.js +1 -1
  30. package/dist/dispatches/SwitchTeamDispatch.js +1 -1
  31. package/dist/dispatches/ThrowGrenadeDispatch.js +1 -1
  32. package/dist/matchmaker.js +1 -1
  33. package/dist/pathing/astar.js +1 -1
  34. package/dist/pathing/binaryheap.js +1 -1
  35. package/dist/pathing/mapnode.js +1 -1
  36. package/dist/socket.js +1 -1
  37. package/dist/types/api.d.ts +13 -6
  38. package/dist/types/bot.d.ts +36 -28
  39. package/dist/util.js +1 -1
  40. package/dist/wasm/bytes.js +1 -1
  41. package/dist/wasm/imports.js +2 -2
  42. package/dist/wasm/utils.js +1 -1
  43. package/dist/wasm/wrapper.js +1 -1
  44. package/package.json +7 -7
  45. package/dist/constants/changelog.js +0 -3
  46. package/dist/constants/housePromo.js +0 -3
  47. package/dist/constants/language.js +0 -49
  48. package/dist/constants/notices.js +0 -3
  49. package/dist/constants/shellNews.js +0 -3
  50. package/dist/constants/shellYoutube.js +0 -3
  51. package/dist/constants/shopItems.js +0 -3
  52. package/dist/constants/sounds.js +0 -3
package/dist/api.js CHANGED
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import n from"./globals.js";import d from"./socket.js";import{FirebaseKey as c,UserAgent as l}from"./constants/index.js";const h={origin:"https://shellshock.io","user-agent":l,"x-client-version":"Chrome/JsCore/9.17.2/FirebaseCore-web","x-firebase-locale":"en"};class p{constructor(e={}){this.instance=e.instance||"shellshock.io",this.protocol=e.protocol||"wss",this.httpProxy=e.httpProxy||e.proxy?.replace(/socks([4|5|4a|5h]+):\/\//g,"https://")||"",this.socksProxy=e.proxy,this.maxRetries=e.maxRetries||5,this.suppressErrors=e.suppressErrors||!1}queryServices=async e=>{const r=new d(`${this.protocol}://${this.instance}/services/`,this.socksProxy);return await r.tryConnect(-2)?new Promise(s=>{let o=!1;r.onmessage=i=>{o=!0;try{const a=JSON.parse(i.data);s(a)}catch{this.suppressErrors||(console.error("queryServices: Bad API JSON response with call: "+e.cmd+" and data:",JSON.stringify(e)),console.error("queryServices: Full data sent: ",JSON.stringify(e))),s("bad_json")}r.close()},r.onerror=()=>!o&&s("unknown_socket_error"),r.onclose=()=>!o&&s("services_closed_early"),r.send(JSON.stringify(e))}):"websocket_connect_fail"};#e=async(e,r,t)=>{if(!e||!r)return"firebase_no_credentials";let s,o;try{s=await(await n.fetch(`https://identitytoolkit.googleapis.com/v1/accounts:${t}?key=${c}`,{method:"POST",body:JSON.stringify({email:e,password:r,returnSecureToken:!0}),headers:{...h,"content-type":"application/json"},dispatcher:this.httpProxy?new n.ProxyAgent(this.httpProxy):void 0})).json(),o=s.idToken}catch(a){return a.code==="auth/network-request-failed"?(this.suppressErrors||console.error("loginWithCredentials: Network req failed (auth/network-request-failed)"),"firebase_network_failed"):a.code==="auth/missing-email"?"firebase_no_credentials":a.code==="ERR_BAD_REQUEST"?(this.suppressErrors||console.error("loginWithCredentials: Error:",e,r),this.suppressErrors||console.error("loginWithCredentials: Error:",a.response?.data||a),"firebase_bad_request"):(this.suppressErrors||console.error("loginWithCredentials: Error:",e,r,a),"firebase_unknown_error")}if(!o)return this.suppressErrors||console.error("loginWithCredentials: the game sent no idToken",s),"firebase_no_token";this.idToken=o;const i=await this.queryServices({cmd:"auth",firebaseToken:o});return typeof i=="object"?{firebase:s,...i}:i};createAccount=async(e,r)=>await this.#e(e,r,"signUp");loginWithCredentials=async(e,r)=>await this.#e(e,r,"signInWithPassword");loginWithRefreshToken=async e=>{if(!e)return"firebase_no_credentials";const r=new URLSearchParams;r.append("grant_type","refresh_token"),r.append("refresh_token",e);let t,s;try{t=await(await n.fetch(`https://securetoken.googleapis.com/v1/token?key=${c}`,{method:"POST",body:r,headers:{...h,"content-type":"application/x-www-form-urlencoded"},dispatcher:this.httpProxy?new n.ProxyAgent(this.httpProxy):void 0})).json(),s=t.id_token}catch(i){return i.code==="auth/network-request-failed"?(this.suppressErrors||console.error("loginWithRefreshToken: Network req failed (auth/network-request-failed)"),"firebase_network_failed"):i.code==="auth/missing-email"?"firebase_no_credentials":(this.suppressErrors||console.error("loginWithRefreshToken: Error:",i,e),"firebase_unknown_error")}if(!s)return this.suppressErrors||console.error("loginWithRefreshToken: the game sent no idToken",t),"firebase_no_token";this.idToken=s;const o=await this.queryServices({cmd:"auth",firebaseToken:s});return typeof o=="object"?{firebase:t,...o}:o};loginAnonymously=async()=>{const r=await(await n.fetch("https://identitytoolkit.googleapis.com/v1/accounts:signUp?key="+c,{method:"POST",body:JSON.stringify({returnSecureToken:!0}),headers:{...h,"content-type":"application/json"},dispatcher:this.httpProxy?new n.ProxyAgent(this.httpProxy):void 0})).json(),t=r.idToken;if(!t)return this.suppressErrors||console.error("loginAnonymously: the game sent no idToken",r),"firebase_no_token";this.idToken=t;const s=await this.queryServices({cmd:"auth",firebaseToken:t});return typeof s=="object"?{firebase:r,...s}:s};sendEmailVerification=async(e=this.idToken)=>{if(!e)return"no_idtoken_passed";const t=await(await n.fetch("https://identitytoolkit.googleapis.com/v1/accounts:sendOobCode?key="+c,{method:"POST",body:JSON.stringify({requestType:"VERIFY_EMAIL",idToken:e}),headers:{...h,"content-type":"application/json"},dispatcher:this.httpProxy?new n.ProxyAgent(this.httpProxy):void 0})).json();return t.kind!=="identitytoolkit#GetOobConfirmationCodeResponse"?(this.suppressErrors||console.error("sendEmailVerification: the game sent an invalid response",t),"firebase_invalid_response"):t.email};verifyOobCode=async e=>{if(!e)return"no_oob_code_passed";const t=await(await n.fetch("https://www.googleapis.com/identitytoolkit/v3/relyingparty/setAccountInfo?key="+c,{method:"POST",body:JSON.stringify({oobCode:e}),headers:{...h,"x-client-version":"Chrome/JsCore/3.7.5/FirebaseCore-web",referer:"https://shellshockio-181719.firebaseapp.com/","content-type":"application/json"},dispatcher:this.httpProxy?new n.ProxyAgent(this.httpProxy):void 0})).json();return t.emailVerified?t.email:(this.suppressErrors||console.error("verifyOobCode: the game sent an invalid response",t),"firebase_invalid_response")}}var g=p;export{p as API,g as default};
3
+ var p=Object.defineProperty;var n=(l,e)=>p(l,"name",{value:e,configurable:!0});import a from"./globals.js";import f from"./socket.js";import{FirebaseKey as h,UserAgent as u}from"./constants/index.js";const d={origin:"https://shellshock.io","user-agent":u,"x-client-version":"Chrome/JsCore/9.17.2/FirebaseCore-web","x-firebase-locale":"en"};class y{static{n(this,"API")}constructor(e={}){this.instance=e.instance||"shellshock.io",this.protocol=e.protocol||"wss",this.httpProxy=e.httpProxy||e.proxy?.replace(/socks([4|5|4a|5h]+):\/\//g,"https://")||void 0,this.socksProxy=e.proxy,this.maxRetries=e.maxRetries||5,this.suppressErrors=e.suppressErrors||!1}queryServices=n(async e=>{const r=new f(`${this.protocol}://${this.instance}/services/`,this.socksProxy);return!await r.tryConnect(-2)||r.socket.readyState<1?"websocket_connect_fail":new Promise(s=>{let o=!1;r.onmessage=i=>{o=!0;try{const c=JSON.parse(i.data);s(c)}catch{this.suppressErrors||(console.error("queryServices: Bad API JSON response with call: "+e.cmd+" and data:",JSON.stringify(e)),console.error("queryServices: Full data sent: ",JSON.stringify(e))),s("bad_json")}r.close()},r.onerror=()=>!o&&s("unknown_socket_error"),r.onclose=()=>!o&&s("services_closed_early"),r.send(JSON.stringify(e))})},"queryServices");#e=n(async(e,r,t)=>{if(!e||!r)return"firebase_no_credentials";let s,o;try{s=await(await a.fetch(`https://identitytoolkit.googleapis.com/v1/accounts:${t}?key=${h}`,{method:"POST",body:JSON.stringify({email:e,password:r,returnSecureToken:!0}),headers:{...d,"content-type":"application/json"},dispatcher:this.httpProxy?new a.ProxyAgent(this.httpProxy):void 0})).json(),o=s.idToken}catch(c){return c.code==="auth/network-request-failed"?(this.suppressErrors||console.error("loginWithCredentials: Network req failed (auth/network-request-failed)"),"firebase_network_failed"):c.code==="auth/missing-email"?"firebase_no_credentials":c.code==="ERR_BAD_REQUEST"?(this.suppressErrors||console.error("loginWithCredentials: Error:",e,r),this.suppressErrors||console.error("loginWithCredentials: Error:",s||c),"firebase_bad_request"):(this.suppressErrors||console.error("loginWithCredentials: Error:",e,r,c),"firebase_unknown_error")}if(!o)return this.suppressErrors||console.error("loginWithCredentials: the game sent no idToken",s),"firebase_no_token";this.idToken=o;const i=await this.queryServices({cmd:"auth",firebaseToken:o});return typeof i=="object"?{firebase:s,...i}:i},"#authWithEmailPass");createAccount=n(async(e,r)=>await this.#e(e,r,"signUp"),"createAccount");loginWithCredentials=n(async(e,r)=>await this.#e(e,r,"signInWithPassword"),"loginWithCredentials");loginWithRefreshToken=n(async e=>{if(!e)return"firebase_no_credentials";const r=new URLSearchParams;r.append("grant_type","refresh_token"),r.append("refresh_token",e);let t,s;try{t=await(await a.fetch(`https://securetoken.googleapis.com/v1/token?key=${h}`,{method:"POST",body:r,headers:{...d,"content-type":"application/x-www-form-urlencoded"},dispatcher:this.httpProxy?new a.ProxyAgent(this.httpProxy):void 0})).json(),s=t.id_token}catch(i){return i.code==="auth/network-request-failed"?(this.suppressErrors||console.error("loginWithRefreshToken: Network req failed (auth/network-request-failed)"),"firebase_network_failed"):i.code==="auth/missing-email"?"firebase_no_credentials":(this.suppressErrors||console.error("loginWithRefreshToken: Error:",i,e),"firebase_unknown_error")}if(!s)return this.suppressErrors||console.error("loginWithRefreshToken: the game sent no idToken",t),"firebase_no_token";this.idToken=s;const o=await this.queryServices({cmd:"auth",firebaseToken:s});return typeof o=="object"?{firebase:t,...o}:o},"loginWithRefreshToken");loginAnonymously=n(async()=>{const r=await(await a.fetch("https://identitytoolkit.googleapis.com/v1/accounts:signUp?key="+h,{method:"POST",body:JSON.stringify({returnSecureToken:!0}),headers:{...d,"content-type":"application/json"},dispatcher:this.httpProxy?new a.ProxyAgent(this.httpProxy):void 0})).json(),t=r.idToken;if(!t)return this.suppressErrors||console.error("loginAnonymously: the game sent no idToken",r),"firebase_no_token";this.idToken=t;const s=await this.queryServices({cmd:"auth",firebaseToken:t});return typeof s=="object"?{firebase:r,...s}:s},"loginAnonymously");sendEmailVerification=n(async(e=this.idToken)=>{if(!e)return"no_idtoken_passed";const t=await(await a.fetch("https://identitytoolkit.googleapis.com/v1/accounts:sendOobCode?key="+h,{method:"POST",body:JSON.stringify({requestType:"VERIFY_EMAIL",idToken:e}),headers:{...d,"content-type":"application/json"},dispatcher:this.httpProxy?new a.ProxyAgent(this.httpProxy):void 0})).json();return t.kind!=="identitytoolkit#GetOobConfirmationCodeResponse"?(this.suppressErrors||console.error("sendEmailVerification: the game sent an invalid response",t),"firebase_invalid_response"):{email:t.email}},"sendEmailVerification");verifyOobCode=n(async e=>{if(!e)return"no_oob_code_passed";const t=await(await a.fetch("https://www.googleapis.com/identitytoolkit/v3/relyingparty/setAccountInfo?key="+h,{method:"POST",body:JSON.stringify({oobCode:e}),headers:{...d,"x-client-version":"Chrome/JsCore/3.7.5/FirebaseCore-web",referer:"https://shellshockio-181719.firebaseapp.com/","content-type":"application/json"},dispatcher:this.httpProxy?new a.ProxyAgent(this.httpProxy):void 0})).json();return t.emailVerified?t.email:(this.suppressErrors||console.error("verifyOobCode: the game sent an invalid response",t),"firebase_invalid_response")},"verifyOobCode")}var w=y;export{y as API,w as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import{GunList as m,Movement as h,ShellStreak as n,SocialMedia as d}from"../constants/index.js";import{Cluck9mm as u}from"../constants/guns.js";const f=Object.fromEntries(Object.entries(d).map(([o,s])=>[s,o.toLowerCase()]));class l{constructor(s,t=null){this.id=s.id,this.uniqueId=s.uniqueId,this.name=s.name,this.safeName=s.safeName,this.team=s.team,this.playing=s.playing,this.socials=s.social&&JSON.parse(s.social),this.socials&&this.socials.forEach(i=>i.type=f[i.id]),this.isVip=s.upgradeProductId>0,this.showBadge=!s.hideBadge||!1,this.streak=s.score,this.streakRewards=Object.values(n).filter(i=>s.activeShellStreaks&i),this.scale=this.streakRewards.includes(n.MiniEgg)?.5:1,this.position={x:s.x,y:s.y,z:s.z},this.jumping=s.$controlKeys&h.Jump,this.scoping=s.$controlKeys&h.Scope,this.climbing=!1,this.view={yaw:s.yaw,pitch:s.pitch},this.updateKotcZone(t),this.character={eggColor:s.shellColor,primaryGun:s.primaryWeaponItem,secondaryGun:s.secondaryWeaponItem,stamp:s.stampItem,hat:s.hatItem,grenade:s.grenadeItem,melee:s.meleeItem,stampPos:{x:s.stampPosX,y:s.stampPosY}},this.stats={totalKills:s.totalKills,totalDeaths:s.totalDeaths,bestStreak:s.bestStreak},this.activeGun=s.weaponIdx,this.selectedGun=s.charClass,this.weapons=[],this.character.primaryGun&&(this.weapons[0]=new m[this.selectedGun],this.weapons[1]=new u),this.grenades=1,this.hp=s.hp,this.hpShield=0,this.spawnShield=s.shield,this.randomSeed=0}updateKotcZone(s){if(!s)return this.inKotcZone=!1;const t=Math.floor(this.position.x),i=Math.floor(this.position.y),c=Math.floor(this.position.z);this.inKotcZone=s.some(e=>e.x===t&&e.y===i&&e.z===c)&&this.playing}}var w=l;export{l as GamePlayer,w as default};
3
+ var d=Object.defineProperty;var h=(t,s)=>d(t,"name",{value:s,configurable:!0});import{GunList as u,Movement as n,ShellStreak as c,SocialMedia as f}from"../constants/index.js";import{Cluck9mm as l}from"../constants/guns.js";const r=Object.fromEntries(Object.entries(f).map(([t,s])=>[s,t.toLowerCase()]));class g{static{h(this,"GamePlayer")}constructor(s,e=null){this.id=s.id,this.uniqueId=s.uniqueId,this.name=s.name,this.safeName=s.safeName,this.team=s.team,this.playing=s.playing,this.socials=s.social&&JSON.parse(s.social),this.socials&&this.socials.forEach(i=>i.type=r[i.id]),this.isVip=s.upgradeProductId>0,this.showBadge=!s.hideBadge||!1,this.streak=s.score,this.streakRewards=Object.values(c).filter(i=>s.activeShellStreaks&i),this.scale=this.streakRewards.includes(c.MiniEgg)?.5:1,this.position={x:s.x,y:s.y,z:s.z},this.jumping=s.$controlKeys&n.Jump,this.scoping=s.$controlKeys&n.Scope,this.climbing=!1,this.view={yaw:s.yaw,pitch:s.pitch},this.updateKotcZone(e),this.character={eggColor:s.shellColor,primaryGun:s.primaryWeaponItem,secondaryGun:s.secondaryWeaponItem,stamp:s.stampItem,hat:s.hatItem,grenade:s.grenadeItem,melee:s.meleeItem,stampPos:{x:s.stampPosX,y:s.stampPosY}},this.stats={totalKills:s.totalKills,totalDeaths:s.totalDeaths,bestStreak:s.bestStreak},this.activeGun=s.weaponIdx,this.selectedGun=s.charClass,this.weapons=[],this.character.primaryGun&&(this.weapons[0]=new u[this.selectedGun],this.weapons[1]=new l),this.grenades=1,this.hp=s.hp,this.hpShield=0,this.spawnShield=s.shield,this.randomSeed=0}updateKotcZone(s){if(!s)return this.inKotcZone=!1;const e=Math.floor(this.position.x),i=Math.floor(this.position.y),m=Math.floor(this.position.z);this.inKotcZone=s.some(o=>o.x===e&&o.y===i&&o.z===m)&&this.playing}}var x=g;export{g as GamePlayer,x as default};
package/dist/bot.js CHANGED
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import W from"./api.js";import a from"./comm/CommIn.js";import f from"./comm/CommOut.js";import j from"./constants/CloseCode.js";import c from"./constants/CommCode.js";import E from"./bot/GamePlayer.js";import Z from"./matchmaker.js";import $ from"./socket.js";import{ChiknWinnerDailyLimit as q,CollectType as F,CoopState as G,findItemById as p,FramesBetweenSyncs as C,GameAction as R,GameMode as u,GameOptionFlag as Y,GunList as X,ItemType as J,Movement as U,PlayType as M,ProxiesEnabled as V,ShellStreak as d,StateBufferSize as x}from"./constants/index.js";import N from"./dispatches/LookAtPosDispatch.js";import A from"./dispatches/MovementDispatch.js";import{NodeList as Q}from"./pathing/mapnode.js";import{coords as tt}from"./wasm/wrapper.js";import{fetchMap as et,initKotcZones as st}from"./util.js";import{Challenges as at}from"./constants/challenges.js";import{Maps as L}from"./constants/maps.js";import{Regions as B}from"./constants/regions.js";const D=Object.fromEntries(Object.entries(u).map(([P,e])=>[e,P])),K=Object.fromEntries(Object.entries(Y).map(([P,e])=>[P[0].toLowerCase()+P.slice(1),e])),H={CHALLENGES:1,BOT_STATS:2,PATHFINDING:3,PING:5,COSMETIC_DATA:6,PLAYER_HEALTH:7,PACKET_HOOK:8,LOG_PACKETS:10,NO_LOGIN:11,DEBUG_BUFFER:12,DEBUG_BEST_TARGET:14,NO_AFK_KICK:16,LOAD_MAP:17,OBSERVE_GAME:18,NO_REGION_CHECK:19,NO_EXIT_ON_ERROR:20,RENEW_SESSION:21},T=(P,e)=>(P%e+e)%e;class it{static Intents=H;Intents=H;#s=[];#t={};#i=[];#e;#n;constructor(e={}){e.proxy&&!V&&this.processError("proxies do not work and hence are not supported in the browser"),this.intents=e.intents||[],this.intents.includes(this.Intents.COSMETIC_DATA)&&(p(1001)||this.processError("you cannot use the COSMETIC_DATA intent inside of the singlefile browser bundles")),this.instance=e.instance||"shellshock.io",this.protocol=e.protocol||"wss",this.proxy=e.proxy||"",this.httpProxy=e.httpProxy||"",this.state={name:"yolkbot",weaponIdx:0,inGame:!1,chatLines:0,yaw:0,pitch:0,controlKeys:0,reloading:!1,swappingGun:!1,usingMelee:!1,stateIdx:0,serverStateIdx:0,shotsFired:0,buffer:[],left:!1},this.players={},this.me=new E({}),this.game={raw:{},code:"",socket:null,gameModeId:0,gameMode:D[0],mapIdx:0,map:{filename:"",hash:"",name:"",modes:{FFA:!1,Teams:!1,Spatula:!1,King:!1},availability:"both",numPlayers:"18",raw:{},nodes:{},zones:[]},playerLimit:0,isGameOwner:!1,isPrivate:!0,options:{gravity:1,damage:1,healthRegen:1,locked:!1,noTeamChange:!1,noTeamShuffle:!1,weaponsDisabled:Array(7).fill(!1),mustUseSecondary:!1},collectables:[[],[]],teamScore:[0,0,0],spatula:{coords:{x:0,y:0,z:0},controlledBy:0,controlledByTeam:0},stage:G.Capturing,zoneNumber:0,activeZone:[],capturing:0,captureProgress:0,numCapturing:0,capturePercent:0},this.#n=this.game,this.account={id:0,firebase:{idToken:"",refreshToken:"",expiresIn:"3600",localId:""},firebaseId:"",sessionId:"",session:"",email:"",password:"",cw:{atLimit:!1,limit:0,secondsUntilPlay:0,canPlayAgain:Date.now()},loadout:{hatId:null,meleeId:0,stampId:null,classIdx:0,colorIdx:0,grenadeId:0,primaryId:[3100,3600,3400,3800,4e3,4200,4500],secondaryId:new Array(7).fill(3e3),stampPositionX:0,stampPositionY:0},ownedItemIds:[],vip:!1,emailVerified:!1,isAged:!1,eggBalance:0,adminRoles:0,rawLoginData:{},isDoubleEggWeeknd:()=>{const t=new Date().getUTCDay(),s=new Date().getUTCHours();return t>=5&&s>=20||t===6||t===0}},this.#e=this.account,this.matchmaker=null,this.api=new W({instance:this.instance,protocol:this.protocol,proxy:this.proxy,httpProxy:this.httpProxy,maxRetries:e?.apiMaxRetries}),this.ping=0,this.lastPingTime=-1,this.lastDeathTime=-1,this.lastUpdateTick=0,this.pathing={nodeList:null,followingPath:!1,activePath:null,activeNode:null,activeNodeIdx:0},this.hasQuit=!1,this.intents.includes(this.Intents.NO_AFK_KICK)&&(this.afkKickInterval=0),this.intents.includes(this.Intents.RENEW_SESSION)&&(this.renewSessionInterval=0)}dispatch(e){return e.validate(this)?(e.check(this)?e.execute(this):this.#s.push(e),!0):!1}async createAccount(e,t){this.account=this.#e,this.account.email=e,this.account.password=t;const s=await this.api.createAccount(e,t);return this.processLoginData(s)}async login(e,t){this.account=this.#e,this.account.email=e,this.account.password=t;const s=await this.api.loginWithCredentials(e,t);return this.processLoginData(s)}async loginWithRefreshToken(e){this.account=this.#e;const t=await this.api.loginWithRefreshToken(e);return this.processLoginData(t)}async loginAnonymously(){this.account=this.#e;const e=await this.api.loginAnonymously();return this.processLoginData(e)}processLoginData(e){return typeof e!="object"?(this.emit("authFail",e),e):e.banRemaining?(this.emit("banned",e.banRemaining),"account_banned"):e.playerOutput?(this.account.firebase=e.firebase||{},e=e.playerOutput,this.account.rawLoginData=e,this.account.adminRoles=e.adminRoles||0,this.account.eggBalance=e.currentBalance,this.account.emailVerified=e.emailVerified,this.account.firebaseId=e.firebaseId,this.account.id=e.id,this.account.isAged=new Date(e.dateCreated).getTime()<17145468e5,this.account.loadout=e.loadout,this.account.ownedItemIds=e.ownedItemIds,this.account.session=e.session,this.account.sessionId=e.sessionId,this.account.vip=e.active_sub==="IsVIP",this.intents.includes(this.Intents.BOT_STATS)&&(this.account.stats={lifetime:e.statsLifetime,monthly:e.statsCurrent}),this.intents.includes(this.Intents.CHALLENGES)&&this.#a(e.challenges),this.emit("authSuccess",this.account),this.intents.includes(this.Intents.RENEW_SESSION)&&(this.renewSessionInterval=setInterval(async()=>{if(!this.account?.sessionId)return clearInterval(this.renewSessionInterval);(await this.api.queryServices({cmd:"renewSession",sessionId:this.account.sessionId})).data!=="renewed"&&this.emit("sessionExpired")},6e5)),this.account):(this.emit("authFail",e),e)}#a(e){this.account.challenges=[];for(const t of e){const s=at.find(i=>i.id===t.challengeId);s&&(delete t.playerId,this.account.challenges.push({raw:{challengeInfo:s,challengeData:t},id:t.challengeId,name:s.loc.title,desc:s.loc.desc,rewardEggs:s.reward,isRerolled:!!t.reset,isClaimed:!!t.claimed,isCompleted:!!t.completed,progressNum:t.progress,goalNum:s.goal}))}}async initMatchmaker(){if(!this.account.sessionId&&!this.intents.includes(this.Intents.NO_LOGIN)){const e=await this.loginAnonymously();if(typeof e!="object")return e}if(!this.matchmaker){if(this.matchmaker=new Z({sessionId:this.account.sessionId,proxy:this.proxy,instance:this.instance,protocol:this.protocol,noLogin:this.intents.includes(this.Intents.NO_LOGIN),api:this.api}),!await this.matchmaker.ws.tryConnect())return"matchmaker_tryconnect_failed";this.matchmaker.on("authFail",t=>this.emit("authFail",t)),this.matchmaker.on("error",t=>this.processError(t))}return!0}async findPublicGame(e,t){return typeof e!="string"?"no_region_passed":!B.find(i=>i.id===e)&&!this.intents.includes(this.Intents.NO_REGION_CHECK)?"invalid_region_passed":typeof t!="number"?"no_mode_passed":Object.values(u).indexOf(t)===-1?"invalid_mode_passed":await this.initMatchmaker()?await new Promise(i=>{const o=n=>{if(n.command!=="notice"){if(this.matchmaker.off("msg",o),n.command==="gameFound")return i(n);if(n.error==="sessionNotFound")return i("internal_session_error");this.processError("unknown matchmaker response "+JSON.stringify(n))}};this.matchmaker.on("msg",o),this.matchmaker.send({command:"findGame",region:e,playType:M.JoinPublic,gameType:t,sessionId:this.account.sessionId})}):"matchmaker_init_fail"}async createPrivateGame(e,t,s){if(typeof e!="string")return"no_region_passed";if(!B.find(n=>n.id===e)&&!this.intents.includes(this.Intents.NO_REGION_CHECK))return"invalid_region_passed";if(typeof t!="number")return"no_mode_passed";if(Object.values(u).indexOf(t)===-1)return"invalid_mode_passed";if(typeof s!="string")return"no_map_passed";const i=L.findIndex(n=>n.name.toLowerCase()===s.toLowerCase());return i===-1?"invalid_map_passed":await this.initMatchmaker()?await new Promise(n=>{const r=h=>{if(h.command!=="notice"){if(this.matchmaker.off("msg",r),h.command==="gameFound")return n(h);if(h.error==="sessionNotFound")return n("internal_session_error");this.processError("unknown matchmaker response "+JSON.stringify(h))}};this.matchmaker.on("msg",r),this.matchmaker.send({command:"findGame",region:e,playType:M.CreatePrivate,gameType:t,sessionId:this.account.sessionId,noobLobby:!1,map:i})}):"matchmaker_init_fail"}async join(e,t){if(this.state.name=e||"yolkbot",typeof t=="string"){if(t.includes("#")&&(t=t.split("#")[1]),!await this.initMatchmaker())return"matchmakerInitFail";const o=await new Promise(n=>{const r=h=>{if(h.command==="gameFound"&&(this.matchmaker.off("msg",r),this.game.raw=h,this.game.code=h.id,n(h.id)),h.error&&h.error==="gameNotFound")return this.processError(`game "${t}" not found, it may have expired.`),this.leave(),"gameNotFound"};this.matchmaker.on("msg",r),this.matchmaker.send({command:"joinGame",id:t,observe:!1,sessionId:this.account.sessionId})});if(o==="matchmakerInitFail")return this.processError("failed to create matchmaker, you may be ratelimited (try a vpn?)");if(o==="gameNotFound")return this.processError("game not found, it may have expired or been deleted");if(!this.game.raw.id)return this.processError("an internal error occured while joining the game, please report this to developers")}if(typeof t=="object"){if(this.account.id===0&&await this.loginAnonymously(),this.game.raw=t,this.game.code=this.game.raw.id,!this.game.raw.id)return this.processError("invalid game object passed to join (missing id)");if(!this.game.raw.subdomain)return this.processError("invalid game object passed to join (missing subdomain)");if(!this.game.raw.uuid)return this.processError("invalid game object passed to join (missing uuid)")}const s=this.game.raw.host||(this.instance.startsWith("localhost:")?this.instance:`${this.game.raw.subdomain}.${this.instance}`);if(this.game.socket=new $(`${this.protocol}://${s}/game/${this.game.raw.id}`,this.proxy),this.game.socket.binaryType="arraybuffer",!await this.game.socket.tryConnect())return this.processError("WebSocket did not connect...");this.game.socket.onmessage=o=>this.processPacket(o.data),this.game.socket.onclose=o=>{this.state.left?this.state.left=!1:(this.emit("close",o.code),this.leave(-1))}}#o(){if(Object.entries(this.me.position).map(t=>Math.floor(t[1])).join(",")===this.pathing.activePath[this.pathing.activePath.length-1].positionStr)this.pathing.followingPath=!1,this.pathing.activePath=null,this.pathing.activeNode=null,this.pathing.activeNodeIdx=0,this.dispatch(new A(0));else{let t;this.pathing.activeNodeIdx<this.pathing.activePath.length-1?(t=this.pathing.activePath[this.pathing.activeNodeIdx+1].flatCenter(),this.dispatch(new N(t))):(t=this.pathing.activePath[this.pathing.activeNodeIdx].flatCenter(),this.dispatch(new N(t)));for(const s of this.pathing.activePath)if(s.flatRadialDistance(this.me.position)<.1&&s.position.y===Math.floor(this.me.position.y)&&this.pathing.activePath.indexOf(s)>=this.pathing.activeNodeIdx){this.pathing.activeNodeIdx=this.pathing.activePath.indexOf(s)+1,this.pathing.activeNode=this.pathing.activePath[this.pathing.activeNodeIdx];break}this.state.controlKeys&U.Forward||this.dispatch(new A(U.Forward))}}update(){if(this.hasQuit)return;this.pathing.followingPath&&this.intents.includes(this.Intents.PATHFINDING)&&this.#o();for(let t=0;t<this.#s.length;t++){const s=this.#s[t];s.check(this)&&(s.execute(this),this.#s.splice(t,1))}if(this.state.chatLines=Math.max(0,this.state.chatLines-1/(30*4)),this.me.playing){const t=this.state.stateIdx;if(this.intents.includes(this.Intents.DEBUG_BUFFER)&&(console.log("setting buffer for idx",t),console.log("checking...shotsFired",this.state.shotsFired)),this.me.jumping=!!(this.state.controlKeys&U.Jump),this.state.buffer[t]={controlKeys:this.state.controlKeys,yaw:this.state.yaw,pitch:this.state.pitch,shotsFired:this.state.shotsFired},this.state.shotsFired=0,this.lastUpdateTick>=2){this.emit("tick");const s=new f;s.packInt8(c.syncMe),s.packInt8(this.state.stateIdx),s.packInt8(this.state.serverStateIdx);const i=T(this.state.stateIdx-C+1,x);for(let o=0;o<C;o++){const n=T(i+o,x),r=this.state.buffer[n]||{},h=r.controlKeys||0,g=r.shotsFired||0,I=r.yaw??this.state.yaw,l=r.pitch??this.state.pitch;this.intents.includes(this.Intents.DEBUG_BUFFER)&&console.log("going with",this.state.stateIdx,i,n,r),s.packInt8(h),s.packInt8(g),s.packString(tt(I,l)),s.packInt8(100)}s.send(this.game.socket),this.state.buffer=[],this.lastUpdateTick=0}else this.lastUpdateTick++;this.state.stateIdx=T(this.state.stateIdx+1,x)}if(!this.intents.includes(this.Intents.PLAYER_HEALTH))return;const e=.1*(this.game.isPrivate?this.game.options.healthRegen:1);for(const t of Object.values(this.players)){if(t.playing&&t.hp>0){const s=t.streakRewards.includes(d.OverHeal);t.hp+=s?-e:e,t.hp=s?Math.max(100,t.hp):Math.min(100,t.hp)}t.spawnShield>0&&(t.spawnShield-=6)}}on(e,t){Object.keys(this.#t).includes(e)?this.#t[e].push(t):this.#t[e]=[t]}once(e,t){const s=(...i)=>{t(...i),this.off(e,s)};this.on(e,s)}onAny(e){this.#i.push(e)}off(e,t){t?this.#t[e]=this.#t[e].filter(s=>s!==t):this.#t[e]=[]}emit(e,...t){if(!this.hasQuit){if(this.#t[e])for(const s of this.#t[e])s(...t);for(const s of this.#i)s(e,...t)}}#c(){const e=a.unPackInt8U(),t=a.unPackInt8U(),s=a.unPackString().valueOf(),i=this.players[e];this.emit("chat",i,s,t)}#r(){const e=a.unPackInt8U(),t=this.intents.includes(this.Intents.COSMETIC_DATA),s={id:e,uniqueId:a.unPackString(),name:a.unPackString(),safeName:a.unPackString(),charClass:a.unPackInt8U(),team:a.unPackInt8U(),primaryWeaponItem:t?p(a.unPackInt16U()):a.unPackInt16U(),secondaryWeaponItem:t?p(a.unPackInt16U()):a.unPackInt16U(),shellColor:a.unPackInt8U(),hatItem:t?p(a.unPackInt16U()):a.unPackInt16U(),stampItem:t?p(a.unPackInt16U()):a.unPackInt16U(),stampPosX:a.unPackInt8(),stampPosY:a.unPackInt8(),grenadeItem:t?p(a.unPackInt16U()):a.unPackInt16U(),meleeItem:t?p(a.unPackInt16U()):a.unPackInt16U(),x:a.unPackFloat(),y:a.unPackFloat(),z:a.unPackFloat(),$dx:a.unPackFloat(),$dy:a.unPackFloat(),$dz:a.unPackFloat(),yaw:a.unPackRadU(),pitch:a.unPackRad(),score:a.unPackInt32U(),$kills:a.unPackInt16U(),$deaths:a.unPackInt16U(),$streak:a.unPackInt16U(),totalKills:a.unPackInt32U(),totalDeaths:a.unPackInt32U(),bestStreak:a.unPackInt16U(),$bestOverallStreak:a.unPackInt16U(),shield:a.unPackInt8U(),hp:a.unPackInt8U(),playing:a.unPackInt8U(),weaponIdx:a.unPackInt8U(),$controlKeys:a.unPackInt8U(),upgradeProductId:a.unPackInt8U(),activeShellStreaks:a.unPackInt8U(),social:a.unPackLongString(),hideBadge:a.unPackInt8U()};this.game.mapIdx=a.unPackInt8U(),this.game.isPrivate=a.unPackInt8U()===1,this.game.gameModeId=a.unPackInt8U();const i=new E(s,this.game.gameMode===u.KOTC?this.game.activeZone:null);this.players[s.id]||(this.players[s.id]=i),this.emit("playerJoin",i),this.me.id===s.id&&(this.me=i,this.emit("botJoin",this.me))}#h(){const e=a.unPackInt8U(),t=a.unPackInt16U(),s=a.unPackFloat(),i=a.unPackFloat(),o=a.unPackFloat(),n=a.unPackInt8U(),r=a.unPackInt8U(),h=a.unPackInt8U(),g=a.unPackInt8U(),I=a.unPackInt8U(),l=this.players[e];l&&(l.playing=!0,l.randomSeed=t,l.weapons[0]&&l.weapons[0].ammo&&(l.weapons[0].ammo.rounds=n),l.weapons[0]&&l.weapons[0].ammo&&(l.weapons[0].ammo.store=r),l.weapons[1]&&l.weapons[1].ammo&&(l.weapons[1].ammo.rounds=h),l.weapons[1]&&l.weapons[1].ammo&&(l.weapons[1].ammo.store=g),l.grenades=I,l.position={x:s,y:i,z:o},l.spawnShield=120,this.emit("playerRespawn",l))}#l(){const e=a.unPackInt8U(),t=a.unPackFloat(),s=a.unPackFloat(),i=a.unPackFloat(),o=a.unPackInt8U(),n=this.players[e];if(!n||n.id===this.me.id){for(let y=0;y<C;y++)a.unPackInt8U(),a.unPackRadU(),a.unPackRad(),a.unPackInt8U();return}for(let y=0;y<C;y++){const v=a.unPackInt8U();v&U.Jump?n.jumping=!0:n.jumping=!1,v&U.Scope?n.scoping=!0:n.scoping=!1;const b={...n.view};n.view.yaw=a.unPackRadU(),n.view.pitch=a.unPackRad(),(n.view.yaw!==b.yaw||n.view.pitch!==b.pitch)&&this.emit("playerRotate",n,b,n.view),n.scale=a.unPackInt8U()}const r=n.position,h=r.x!==t||r.y!==s||r.z!==i,g=n.climbing!==o,I=h||g,l=I?{...r}:null;if(r.x!==t&&(r.x=t),r.z!==i&&(r.z=i),(!n.jumping||Math.abs(r.y-s)>.5)&&(r.y=s),g&&(n.climbing=o),!I||(this.emit("playerMove",n,l,r),this.game.gameModeId!==u.KOTC))return;const k=this.game.activeZone,S=!!n.inKotcZone;if(!k&&S){n.inKotcZone=!1,this.emit("playerLeaveZone",n);return}n.updateKotcZone(k);const w=!!n.inKotcZone;S!==w&&(n.inKotcZone=w,this.emit(w?"playerEnterZone":"playerLeaveZone",n))}#m(){const e=a.unPackInt8U(),t=this.players[e];t&&(t.playing=!1,t.streakRewards&&(t.streakRewards=[]),this.emit("playerPause",t),t.inKotcZone&&(t.inKotcZone=!1,this.emit("playerLeaveZone",t)))}#d(){const e=a.unPackInt8U(),t=a.unPackInt8U(),s=this.players[e];s&&(s.activeGun=t,this.emit("playerSwapWeapon",s,t))}#u(){const e=a.unPackInt8U(),t=a.unPackInt8U();a.unPackInt8U(),a.unPackInt8U(),a.unPackInt8U();const s=this.players[e],i=this.players[t];s&&(s.id===this.me.id&&(this.lastDeathTime=Date.now()),s.playing=!1,s.streak=0,s.hp=100,s.spawnShield=0,s.stats.totalDeaths++,s.inKotcZone=!1,this.emit("playerLeaveZone",s)),i&&(i.streak++,i.stats.totalKills++,i.streak>i.stats.bestStreak&&(i.stats.bestStreak=i.streak)),this.emit("playerDeath",s,i)}#p(){const e=a.unPackInt8U(),t={posX:a.unPackFloat(),posY:a.unPackFloat(),posZ:a.unPackFloat(),dirX:a.unPackFloat(),dirY:a.unPackFloat(),dirZ:a.unPackFloat()},s=this.players[e];if(!s)return;const i=s.weapons[s.activeGun];i&&i.ammo&&(i.ammo.rounds--,this.emit("playerFire",s,i,t))}#g(){const e=a.unPackInt16U(),t=a.unPackInt8U(),s=a.unPackFloat(),i=a.unPackFloat(),o=a.unPackFloat();this.game.collectables[t].push({id:e,x:s,y:i,z:o}),this.emit("spawnItem",t,{x:s,y:i,z:o})}#k(){const e=a.unPackInt8U(),t=a.unPackInt8U(),s=a.unPackInt8U(),i=a.unPackInt16U(),o=this.players[e];if(o){if(this.game.collectables[t]=this.game.collectables[t].filter(n=>n.id!==i),t===F.Ammo){const n=o.weapons[s];n&&n.ammo&&(n.ammo.store=Math.min(n.ammo.storeMax,n.ammo.store+n.ammo.pickup),this.emit("collectAmmo",o,n))}t===F.Grenade&&(o.grenades++,o.grenades>3&&(o.grenades=3),this.emit("collectGrenade",o))}}#I(){const e=a.unPackInt8U(),t=a.unPackInt8U(),s=this.players[e];if(!s)return;const i=s.hp;s.hp=t,this.emit("playerDamage",s,i,s.hp)}#f(){const e=a.unPackInt8U();a.unPackFloat(),a.unPackFloat();const t=this.me.hp;this.me.hp=e,this.emit("playerDamage",this.me,t,this.me.hp)}#P(){const e=a.unPackInt8U(),t=this.players[e];a.unPackInt8U();const s=a.unPackInt8U(),i=a.unPackFloat(),o=a.unPackFloat(),n=a.unPackFloat();if(this.me.climbing=!!a.unPackInt8U(),a.unPackInt8U(),a.unPackInt8U(),!t)return;this.state.serverStateIdx=s;const r=t.position.x,h=t.position.y,g=t.position.z;t.position.x=i,t.position.y=o,t.position.z=n,(r!==i||h!==o||g!==n)&&this.emit("playerMove",t,{x:r,y:h,z:g},{x:i,y:o,z:n})}#y(){const e=new f;e.packInt8(c.eventModifier),e.send(this.game.socket)}#w(){const e=a.unPackInt8U(),t={...this.players[e]};delete this.players[e.toString()],this.emit("playerLeave",t)}#b(){if(this.game.gameModeId===u.Spatula){const e={...this.game};this.game.teamScore[1]=a.unPackInt16U(),this.game.teamScore[2]=a.unPackInt16U();const t={x:a.unPackFloat(),y:a.unPackFloat(),z:a.unPackFloat()},s=a.unPackInt8U(),i=a.unPackInt8U();this.game.spatula={coords:t,controlledBy:s,controlledByTeam:i},this.emit("gameStateChange",e,this.game)}else if(this.game.gameModeId===u.KOTC){const e={...this.game};this.game.stage=a.unPackInt8U(),this.game.zoneNumber=a.unPackInt8U(),this.game.capturing=a.unPackInt8U(),this.game.captureProgress=a.unPackInt16U(),this.game.numCapturing=a.unPackInt8U(),this.game.teamScore[1]=a.unPackInt8U(),this.game.teamScore[2]=a.unPackInt8U(),this.game.capturePercent=this.game.captureProgress/1e3,this.game.activeZone=this.game.map.zones?this.game.map.zones[this.game.zoneNumber-1]:null;const t=Object.values(this.players).filter(s=>s.inKotcZone&&s.playing);this.game.activeZone&&Object.values(this.players).forEach(s=>s.updateKotcZone(this.game.activeZone)),this.game.numCapturing<=0&&Object.values(this.players).forEach(s=>{s.inKotcZone=!1,this.emit("playerLeaveZone",s)}),this.emit("gameStateChange",e,this.game,t)}else this.game.gameModeId===u.Team&&(this.game.teamScore[1]=a.unPackInt16U(),this.game.teamScore[2]=a.unPackInt16U());this.game.gameModeId!==u.Spatula&&delete this.game.spatula,this.game.gameModeId!==u.KOTC&&(delete this.game.stage,delete this.game.zoneNumber,delete this.game.capturing,delete this.game.captureProgress,delete this.game.numCapturing,delete this.game.numCapturing,delete this.game.activeZone),this.game.gameModeId===u.FFA&&delete this.game.teamScore}#U(){const e=a.unPackInt8U(),t=a.unPackInt8U(),s=this.players[e];if(s){switch(t){case d.HardBoiled:e===this.me.id&&(this.me.shieldHp=100),s.streakRewards.push(d.HardBoiled);break;case d.EggBreaker:s.streakRewards.push(d.EggBreaker);break;case d.Restock:{s.grenades=3,s.weapons[0]&&s.weapons[0].ammo&&(s.weapons[0].ammo.rounds=s.weapons[0].ammo.capacity,s.weapons[0].ammo.store=s.weapons[0].ammo.storeMax),s.weapons[1]&&s.weapons[1].ammo&&(s.weapons[1].ammo.rounds=s.weapons[1].ammo.capacity,s.weapons[1].ammo.store=s.weapons[1].ammo.storeMax);break}case d.OverHeal:s.hp=Math.min(200,s.hp+100),s.streakRewards.push(d.OverHeal);break;case d.DoubleEggs:s.streakRewards.push(d.DoubleEggs);break;case d.MiniEgg:s.scale=.5,s.streakRewards.push(d.MiniEgg);break}this.emit("playerBeginStreak",s,t)}}#S(){const e=a.unPackInt8U(),t=a.unPackInt8U(),s=this.players[e];if(!s)return;[d.EggBreaker,d.OverHeal,d.DoubleEggs,d.MiniEgg].includes(t)&&s.streakRewards.includes(t)&&(s.streakRewards=s.streakRewards.filter(o=>o!==t)),t===d.MiniEgg&&(s.scale=1),this.emit("playerEndStreak",s,t)}#v(){const e=a.unPackInt8U(),t=a.unPackInt8U(),s=a.unPackFloat(),i=a.unPackFloat();this.me&&(this.me.shieldHp=e,this.me.hp=t,this.me.shieldHp<=0?(this.me.streakRewards=this.me.streakRewards.filter(o=>o!==d.HardBoiled),this.emit("selfShieldLost",this.me.hp,{dx:s,dz:i})):this.emit("selfShieldHit",this.me.shieldHp,this.me.hp,{dx:s,dz:i}))}#C(){const e={...this.game.options};let t=a.unPackInt8U(),s=a.unPackInt8U(),i=a.unPackInt8U();(t<1||t>4)&&(t=4),(s<0||s>8)&&(s=4),i>16&&(i=4),this.game.options.gravity=t/4,this.game.options.damage=s/4,this.game.options.healthRegen=i/4;const o=a.unPackInt8U();Object.keys(K).forEach(n=>{const r=o&K[n]?1:0;this.game.options[n]=r}),this.game.options.weaponsDisabled=Array.from({length:7},()=>a.unPackInt8U()===1),this.game.options.mustUseSecondary=this.game.options.weaponsDisabled.every(n=>n),this.emit("gameOptionsChange",e,this.game.options)}#E(){const e=a.unPackInt8U();e===R.Pause&&(this.emit("gameForcePause"),setTimeout(()=>this.me.playing=!1,3e3)),e===R.Reset&&(Object.values(this.players).forEach(t=>t.streak=0),this.game.gameModeId!==u.FFA&&(this.game.teamScore=[0,0,0]),this.game.gameModeId===u.Spatula&&(this.game.spatula.controlledBy=0,this.game.spatula.controlledByTeam=0,this.game.spatula.coords={x:0,y:0,z:0}),this.game.gameModeId===u.KOTC&&(this.game.stage=G.Capturing,this.game.zoneNumber=0,this.game.activeZone=null,this.game.capturing=0,this.game.captureProgress=0,this.game.numCapturing=0,this.game.capturePercent=0),this.emit("gameReset"))}#x(){if(!this.intents.includes(this.Intents.PING))return;const e=this.ping;this.ping=Date.now()-this.lastPingTime,this.emit("pingUpdate",e,this.ping),setTimeout(()=>{const t=new f;t.packInt8(c.ping),t.send(this.game.socket),this.lastPingTime=Date.now()},1e3)}#T(){const e=a.unPackInt8U(),t=a.unPackInt8U(),s=this.players[e];if(!s)return;const i=s.team;s.team=t,s.streak=0,this.emit("playerSwitchTeam",s,i,t)}#_(){const e=a.unPackInt8U(),t=a.unPackInt8U(),s=a.unPackInt16U(),i=a.unPackInt16U(),o=a.unPackInt8U(),n=a.unPackInt16U(),r=a.unPackInt16U(),h=a.unPackInt16U(),g=a.unPackInt16U(),I=a.unPackInt8(),l=a.unPackInt8(),k=this.intents.includes(this.Intents.COSMETIC_DATA),S=k?p(s):s,w=k?p(i):i,y=k?p(n):n,v=k?p(r):r,b=k?p(h):h,z=k?p(g):g,m=this.players[e];if(m){const _={...m.character},O=m.selectedGun;m.character.eggColor=o,m.character.primaryGun=S,m.character.secondaryGun=w,m.character.stamp=v,m.character.hat=y,m.character.grenade=b,m.character.melee=z,m.character.stampPos.x=I,m.character.stampPos.y=l,m.selectedGun=t,m.weapons[0]=new X[t],O!==m.selectedGun&&this.emit("playerChangeGun",m,O,m.selectedGun),_!==m.character&&this.emit("playerChangeCharacter",m,_,m.character)}}#O(){const e=a.unPackInt32U(),t=this.account.eggBalance;this.account.eggBalance=e,this.emit("balanceUpdate",t,e)}#F(){this.me.playing=!1,this.emit("respawnDenied")}#G(){const e=a.unPackInt8U(),t=this.players[e];t&&this.emit("playerMelee",t)}#R(){const e=a.unPackInt8U(),t=this.players[e];if(!t)return;const s=t.weapons[t.activeGun];if(s.ammo){const i=Math.min(Math.min(s.ammo.capacity,s.ammo.reload)-s.ammo.rounds,s.ammo.store);s.ammo.rounds+=i,s.ammo.store-=i}this.emit("playerReload",t,s)}updateGameOptions(){const e=new f;e.packInt8(c.gameOptions),e.packInt8(this.game.options.gravity*4),e.packInt8(this.game.options.damage*4),e.packInt8(this.game.options.healthRegen*4);const t=(this.game.options.locked?1:0)|(this.game.options.noTeamChange?2:0)|(this.game.options.noTeamShuffle?4:0);e.packInt8(t),this.game.options.weaponsDisabled.forEach(s=>{e.packInt8(s?1:0)}),e.send(this.game.socket)}#M(){this.game.isPrivate=!0,this.updateGameOptions()}#N(){const e=a.unPackInt8U();let t=a.unPackInt16U();const s=a.unPackFloat(),i=a.unPackFloat(),o=a.unPackFloat(),n=a.unPackInt8U(),r=a.unPackFloat();this.intents.includes(this.Intents.COSMETIC_DATA)&&(t=p(t)),e===J.Grenade?this.emit("grenadeExplode",t,{x:s,y:i,z:o},n,r):this.emit("rocketHit",{x:s,y:i,z:o},n,r)}#A(){const e=a.unPackInt8U(),t=a.unPackFloat(),s=a.unPackFloat(),i=a.unPackFloat(),o=a.unPackFloat(),n=a.unPackFloat(),r=a.unPackFloat(),h=this.players[e];h&&(h.grenades--,this.emit("playerThrowGrenade",h,{x:t,y:s,z:i},{x:o,y:n,z:r}))}#L(){const e=a.unPackInt8U(),t=a.unPackInt8U(),s=this.players[e];if(!s)return;if(!this.intents.includes(this.Intents.CHALLENGES))return this.emit("challengeComplete",s,t);const i=this.account.challenges.find(o=>o.id===t);this.emit("challengeComplete",s,i),s.id===this.me.id&&this.refreshChallenges()}#B(){const e=new f;e.packInt8(this.intents.includes(this.Intents.OBSERVE_GAME)?c.observeGame:c.joinGame),e.packString(this.state.name),e.packString(this.game.raw.uuid),e.packInt8(0),e.packInt8(this.state.weaponIdx||this.account?.loadout?.classIdx||0),e.packInt32(this.account.session),e.packString(this.account.firebaseId),e.packString(this.account.sessionId),e.send(this.game.socket)}async#D(){if(this.me.id=a.unPackInt8U(),this.me.team=a.unPackInt8U(),this.game.gameModeId=a.unPackInt8U(),this.game.gameMode=D[this.game.gameModeId],this.game.mapIdx=a.unPackInt8U(),this.game.map=L[this.game.mapIdx],this.game.playerLimit=a.unPackInt8U(),this.game.isGameOwner=a.unPackInt8U()===1,this.game.isPrivate=a.unPackInt8U()===1||this.game.isGameOwner,a.unPackInt8U(),this.intents.includes(this.Intents.LOAD_MAP)||this.intents.includes(this.Intents.PATHFINDING)){if(this.game.map.raw=await et(this.game.map.filename,this.game.map.hash),this.emit("mapLoad",this.game.map.raw),this.game.gameModeId===u.KOTC){const t=this.game.map.raw.data["DYNAMIC.capture-zone.none"];t?(this.game.map.zones=st(t),this.game.activeZone||(this.game.activeZone=this.game.map.zones[this.game.zoneNumber-1])):delete this.game.map.zones}this.intents.includes(this.Intents.PATHFINDING)&&(this.pathing.nodeList=new Q(this.game.map.raw))}this.state.inGame=!0,this.lastDeathTime=Date.now();const e=new f;if(e.packInt8(c.clientReady),e.send(this.game.socket),this.updateIntervalId=setInterval(()=>this.update(),100/3),this.intents.includes(this.Intents.PING)){this.lastPingTime=Date.now();const t=new f;t.packInt8(c.ping),t.send(this.game.socket)}this.intents.includes(this.Intents.NO_AFK_KICK)&&(this.afkKickInterval=setInterval(()=>{if(this.state.inGame&&!this.me.playing&&Date.now()-this.lastDeathTime>=15e3){const t=new f;t.packInt8(c.keepAlive),t.send(this.game.socket)}},15e3)),this.emit("gameReady")}#K(){const e=a.unPackInt8U(),t=a.unPackString(128),s=a.unPackString(32),i=this.players[e];i&&(i.admin={ip:s,dbId:t},this.emit("playerInfo",i,s,t))}processPacket(e){a.init(e),this.intents.includes(this.Intents.PACKET_HOOK)&&this.emit("packet",e);let t=0,s=0,i=!1;for(;a.isMoreDataAvailable()&&!i;){const o=a.unPackInt8U();switch(o){case c.syncThem:this.#l();break;case c.fire:this.#p();break;case c.hitThem:this.#I();break;case c.syncMe:this.#P();break;case c.hitMe:this.#f();break;case c.swapWeapon:this.#d();break;case c.collectItem:this.#k();break;case c.respawn:this.#h();break;case c.die:this.#u();break;case c.pause:this.#m();break;case c.chat:this.#c();break;case c.addPlayer:this.#r();break;case c.removePlayer:this.#w();break;case c.eventModifier:this.#y();break;case c.metaGameState:this.#b();break;case c.beginShellStreak:this.#U();break;case c.endShellStreak:this.#S();break;case c.hitMeHardBoiled:this.#v();break;case c.gameOptions:this.#C();break;case c.ping:this.#x();break;case c.switchTeam:this.#T();break;case c.changeCharacter:this.#_();break;case c.reload:this.#R();break;case c.explode:this.#N();break;case c.throwGrenade:this.#A();break;case c.spawnItem:this.#g();break;case c.melee:this.#G();break;case c.updateBalance:this.#O();break;case c.challengeCompleted:this.#L();break;case c.socketReady:this.#B();break;case c.gameJoined:this.#D();break;case c.gameAction:this.#E();break;case c.requestGameOptions:this.#M();break;case c.respawnDenied:this.#F();break;case c.playerInfo:this.#K();break;case c.expireUpgrade:case c.clientReady:break;case c.musicInfo:a.unPackLongString();break;default:console.error(`processPacket: I got but couldn't identify a: ${Object.keys(c).find(n=>c[n]===o)} ${o}`),t&&console.error(`processPacket: It may be a result of the ${t} command (${s}).`),i=!0;break}t=Object.keys(c).find(n=>c[n]===o),s=o,this.intents.includes(this.Intents.LOG_PACKETS)&&console.log(`[LOG_PACKETS] Packet ${t}: ${s}`)}}async checkChiknWinner(){const e=await this.api.queryServices({cmd:"chicknWinnerReady",id:this.account.id,sessionId:this.account.sessionId});return typeof e=="string"?e:(this.account.cw.limit=e.limit,this.account.cw.atLimit=e.limit>=4,this.account.cw.secondsUntilPlay=(this.account.cw.atLimit?e.period:e.span)||0,this.account.cw.canPlayAgain=Date.now()+this.account.cw.secondsUntilPlay*1e3,this.account.cw)}async playChiknWinner(e=!0){if(this.account.cw.atLimit||this.account.cw.limit>q)return"hit_daily_limit";if(this.account.cw.canPlayAgain>Date.now()&&e)return"on_cooldown";const t=await this.api.queryServices({cmd:"incentivizedVideoReward",firebaseId:this.account.firebaseId,id:this.account.id,sessionId:this.account.sessionId,token:null});return typeof t=="string"?t:t.error?t.error==="RATELIMITED"||t.error==="RATELMITED"?(await this.checkChiknWinner(),"on_cooldown"):t.error==="SESSION_EXPIRED"?"session_expired":(console.error("Unknown Chikn Winner response, report this on Github:",t),"unknown_error"):t.reward?(this.account.eggBalance+=t.reward.eggsGiven,t.reward.itemIds.forEach(s=>this.account.ownedItemIds.push(s)),await this.checkChiknWinner(),t.reward):(console.error("Unknown Chikn Winner response, report this on Github:",t),"unknown_error")}async resetChiknWinner(){if(this.account.eggBalance<200)return"not_enough_eggs";if(!this.account.cw.atLimit)return"not_at_limit";const e=await this.api.queryServices({cmd:"chwReset",sessionId:this.account.sessionId});return typeof e=="string"?e:e.result!=="SUCCESS"?(console.error("Unknown Chikn Winner reset response, report this on Github:",e),"unknown_error"):(this.account.eggBalance-=200,await this.checkChiknWinner(),this.account.cw)}canSee(e){return this.intents.includes(this.Intents.PATHFINDING)?this.pathing.nodeList.hasLineOfSight(this.me.position,e.position):this.processError("You must have the PATHFINDING intent to use this method.")}getBestTarget(e=()=>!0){const s=Object.values(this.players).filter(o=>o?.playing).filter(o=>o.hp>0).filter(o=>o.id!==this.me.id).filter(o=>this.me.team===0||o.team!==this.me.team).filter(o=>!!e(o)).map(o=>({player:o,distance:Math.sqrt(Math.pow(o.position.x-this.me.position.x,2)+Math.pow(o.position.y-this.me.position.y,2)+Math.pow(o.position.z-this.me.position.z,2))})).sort((o,n)=>o.distance-n.distance);if(!s.length)return this.intents.includes(this.Intents.DEBUG_BEST_TARGET)&&console.log("no targets found"),null;const i=s.find(o=>this.canSee(o.player));return this.intents.includes(this.Intents.DEBUG_BEST_TARGET)&&(console.log("detected ",s.length,"targets"),console.log("closest target: ",s[0].player.name),console.log("all targets (ordered): ",s.map(o=>o.player.name)),console.log("found LoS player?",!!i),i&&console.log("closest LoS player: ",i.player.name)),i?{player:i.player,inLoS:!0}:{player:s[0].player,inLoS:!1}}async refreshChallenges(){const e=await this.api.queryServices({cmd:"challengeGetDaily",sessionId:this.account.sessionId,playerId:this.account.id});return this.#a(e),this.account.challenges}async rerollChallenge(e){const t=await this.api.queryServices({cmd:"challengeRerollSlot",sessionId:this.account.sessionId,slotId:e});return this.#a(t),this.account.challenges}async claimChallenge(e){const t=await this.api.queryServices({cmd:"challengeClaimReward",sessionId:this.account.sessionId,slotId:e});return this.#a(t.challenges),t.reward>0&&(this.account.eggBalance+=t.reward),{eggReward:t.reward,updatedChallenges:this.account.challenges}}async refreshBalance(){const e=await this.api.queryServices({cmd:"checkBalance",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId});return this.account.eggBalance=e.currentBalance,e.currentBalance}async redeemCode(e){const t=await this.api.queryServices({cmd:"redeem",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,id:this.account.id,code:e});return t.result==="SUCCESS"?(this.account.eggBalance=t.eggs_given,t.item_ids.forEach(s=>this.account.ownedItemIds.push(s)),{result:t,eggsGiven:t.eggs_given,itemIds:t.item_ids}):t}async claimURLReward(e){const t=await this.api.queryServices({cmd:"urlRewardParams",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,reward:e});return t.result==="SUCCESS"&&(this.account.eggBalance+=t.eggsGiven,t.itemIds.forEach(s=>this.account.ownedItemIds.push(s))),t}async claimSocialReward(e){const t=await this.api.queryServices({cmd:"reward",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,rewardTag:e});return t.result==="SUCCESS"&&(this.account.eggBalance+=t.eggsGiven,t.itemIds.forEach(s=>this.account.ownedItemIds.push(s))),t}async buyItem(e){const t=await this.api.queryServices({cmd:"buy",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,itemId:e,save:!0});return t.result==="SUCCESS"&&(this.account.eggBalance=t.currentBalance,this.account.ownedItemIds.push(t.itemId)),t}processError(e){this.#t.error&&this.#t.error.length?this.emit("error",e):(console.error(e),this.intents.includes(this.Intents.NO_EXIT_ON_ERROR)||process.exit(1))}leave(e=j.mainMenu){this.hasQuit||(e>-1&&(this.game?.socket?.close(e),this.state.left=!0,this.emit("leave",e)),clearInterval(this.updateIntervalId),this.#s=[],this.state.inGame=!1,this.state.chatLines=0,this.state.reloading=!1,this.state.swappingGun=!1,this.state.usingMelee=!1,this.state.stateIdx=0,this.state.serverStateIdx=0,this.state.shotsFired=0,this.state.buffer=[],this.players={},this.me=new E({}),this.game=this.#n,this.ping=0,this.lastPingTime=-1,this.lastDeathTime=-1,this.lastUpdateTick=0,this.pathing={nodeList:null,followingPath:!1,activePath:null,activeNode:null,activeNodeIdx:0})}logout(){this.account=this.#e,this.intents.includes(this.Intents.RENEW_SESSION)&&clearInterval(this.renewSessionInterval)}quit(e=!1){this.hasQuit||(this.leave(),this.matchmaker&&(this.matchmaker.close(),e||delete this.matchmaker),e||(delete this.account,delete this.api,delete this.game,delete this.me,delete this.pathing,delete this.players,delete this.state,this.#e={},this.#n={},this.#t={},this.#i=[],this.#s=[]),this.intents.includes(this.Intents.NO_AFK_KICK)&&clearInterval(this.afkKickInterval),this.intents.includes(this.Intents.RENEW_SESSION)&&clearInterval(this.renewSessionInterval),this.hasQuit=!0)}}var bt=it;export{it as Bot,bt as default};
3
+ var j=Object.defineProperty;var P=(k,e)=>j(k,"name",{value:e,configurable:!0});import Z from"./api.js";import s from"./comm/CommIn.js";import y from"./comm/CommOut.js";import $ from"./constants/CloseCode.js";import c from"./constants/CommCode.js";import _ from"./bot/GamePlayer.js";import q from"./matchmaker.js";import Y from"./socket.js";import{ChiknWinnerDailyLimit as V,CollectType as R,CoopState as G,findItemById as p,FramesBetweenSyncs as E,GameAction as N,GameMode as d,GameOptionFlag as X,GunList as J,ItemType as Q,Movement as S,PlayType as A,ProxiesEnabled as tt,ShellStreak as u,StateBufferSize as x}from"./constants/index.js";import M from"./dispatches/LookAtPosDispatch.js";import L from"./dispatches/MovementDispatch.js";import{NodeList as et}from"./pathing/mapnode.js";import{coords as st}from"./wasm/wrapper.js";import{fetchMap as at,initKotcZones as it}from"./util.js";import{Challenges as nt}from"./constants/challenges.js";import{Maps as B}from"./constants/maps.js";import{Regions as D}from"./constants/regions.js";const K=Object.fromEntries(Object.entries(d).map(([k,e])=>[e,k])),H=Object.fromEntries(Object.entries(X).map(([k,e])=>[k[0].toLowerCase()+k.slice(1),e])),z={CHALLENGES:1,BOT_STATS:2,PATHFINDING:3,PING:5,COSMETIC_DATA:6,PLAYER_HEALTH:7,PACKET_HOOK:8,LOG_PACKETS:10,NO_LOGIN:11,DEBUG_BUFFER:12,NO_AFK_KICK:16,LOAD_MAP:17,OBSERVE_GAME:18,NO_REGION_CHECK:19,NO_EXIT_ON_ERROR:20,RENEW_SESSION:21,VIP_HIDE_BADGE:22},O=P((k,e)=>(k%e+e)%e,"mod");class ot{static{P(this,"Bot")}static Intents=z;Intents=z;#s=[];#t={};#i=[];#e;#n;constructor(e={}){(e.proxy||e.httpProxy)&&!tt&&this.processError("proxies do not work and hence are not supported in the browser"),this.intents=e.intents||[],this.intents.includes(this.Intents.COSMETIC_DATA)&&(p(1001)||this.processError("you cannot use the COSMETIC_DATA intent inside of the singlefile browser bundles")),this.instance=e.instance||"shellshock.io",this.protocol=e.protocol||"wss",this.proxy=e.proxy||"",this.httpProxy=e.httpProxy||"",this.state={name:"yolkbot",weaponIdx:0,inGame:!1,chatLines:0,yaw:0,pitch:0,controlKeys:0,reloading:!1,swappingGun:!1,usingMelee:!1,stateIdx:0,serverStateIdx:0,shotsFired:0,buffer:[],left:!1},this.players={},this.me=new _({}),this.game={raw:{},code:"",socket:null,gameModeId:0,gameMode:K[0],mapIdx:0,map:{filename:"",hash:"",name:"",modes:{FFA:!1,Teams:!1,Spatula:!1,King:!1},availability:"both",numPlayers:"18",raw:{},nodes:{},zones:[]},playerLimit:0,isGameOwner:!1,isPrivate:!0,options:{gravity:1,damage:1,healthRegen:1,locked:!1,noTeamChange:!1,noTeamShuffle:!1,weaponsDisabled:Array(7).fill(!1),mustUseSecondary:!1},collectables:[[],[]],teamScore:[0,0,0],spatula:{coords:{x:0,y:0,z:0},controlledBy:0,controlledByTeam:0},stage:G.Capturing,zoneNumber:0,activeZone:[],capturing:0,captureProgress:0,numCapturing:0,capturePercent:0},this.#n=this.game,this.account={id:0,firebase:{idToken:"",refreshToken:"",expiresIn:"3600",localId:""},firebaseId:"",sessionId:"",session:"",email:"",password:"",cw:{atLimit:!1,limit:0,secondsUntilPlay:0,canPlayAgain:Date.now()},loadout:{hatId:null,meleeId:0,stampId:null,classIdx:0,colorIdx:0,grenadeId:0,primaryId:[3100,3600,3400,3800,4e3,4200,4500],secondaryId:new Array(7).fill(3e3),stampPositionX:0,stampPositionY:0},ownedItemIds:[],vip:!1,emailVerified:!1,isAged:!1,eggBalance:0,adminRoles:0,rawLoginData:{},isDoubleEggWeeknd:P(()=>{const t=new Date().getUTCDay(),a=new Date().getUTCHours();return t>=5&&a>=20||t===6||t===0},"isDoubleEggWeeknd")},this.#e=this.account,this.matchmaker=null,this.api=new Z({instance:this.instance,protocol:this.protocol,proxy:this.proxy,httpProxy:this.httpProxy,maxRetries:e?.apiMaxRetries}),this.ping=0,this.lastPingTime=-1,this.lastDeathTime=-1,this.lastUpdateTick=0,this.pathing={nodeList:null,followingPath:!1,activePath:null,activeNode:null,activeNodeIdx:0},this.hasQuit=!1,this.intents.includes(this.Intents.NO_AFK_KICK)&&(this.afkKickInterval=0),this.intents.includes(this.Intents.RENEW_SESSION)&&(this.renewSessionInterval=0)}dispatch(e){return e.validate(this)?(e.check(this)?e.execute(this):this.#s.push(e),!0):!1}async createAccount(e,t){this.account=this.#e,this.account.email=e,this.account.password=t;const a=await this.api.createAccount(e,t);return this.processLoginData(a)}async login(e,t){this.account=this.#e,this.account.email=e,this.account.password=t;const a=await this.api.loginWithCredentials(e,t);return this.processLoginData(a)}async loginWithRefreshToken(e){this.account=this.#e;const t=await this.api.loginWithRefreshToken(e);return this.processLoginData(t)}async loginAnonymously(){this.account=this.#e;const e=await this.api.loginAnonymously();return this.processLoginData(e)}processLoginData(e){return typeof e!="object"?(this.emit("authFail",e),e):e.banRemaining?(this.emit("banned",e.banRemaining),"account_banned"):e.playerOutput?(this.account.firebase=e.firebase||{},e=e.playerOutput,this.account.rawLoginData=e,this.account.adminRoles=e.adminRoles||0,this.account.eggBalance=e.currentBalance,this.account.emailVerified=e.emailVerified,this.account.firebaseId=e.firebaseId,this.account.id=e.id,this.account.isAged=new Date(e.dateCreated).getTime()<17145468e5,this.account.loadout=e.loadout,this.account.ownedItemIds=e.ownedItemIds,this.account.session=e.session,this.account.sessionId=e.sessionId,this.account.vip=e.active_sub==="IsVIP",this.intents.includes(this.Intents.BOT_STATS)&&(this.account.stats={lifetime:e.statsLifetime,monthly:e.statsCurrent}),this.intents.includes(this.Intents.CHALLENGES)&&this.#a(e.challenges),this.emit("authSuccess",this.account),this.intents.includes(this.Intents.RENEW_SESSION)&&(this.renewSessionInterval=setInterval(async()=>{if(!this.account?.sessionId)return clearInterval(this.renewSessionInterval);(await this.api.queryServices({cmd:"renewSession",sessionId:this.account.sessionId})).data!=="renewed"&&this.emit("sessionExpired")},6e5)),this.account):(this.emit("authFail",e),e)}#a(e){this.account.challenges=[];for(const t of e){const a=nt.find(i=>i.id===t.challengeId);a&&(delete t.playerId,this.account.challenges.push({raw:{challengeInfo:a,challengeData:t},id:t.challengeId,name:a.loc.title,desc:a.loc.desc,rewardEggs:a.reward,isRerolled:!!t.reset,isClaimed:!!t.claimed,isCompleted:!!t.completed,progressNum:t.progress,goalNum:a.goal}))}}async initMatchmaker(){if(!this.account.sessionId&&!this.intents.includes(this.Intents.NO_LOGIN)){const e=await this.loginAnonymously();if(typeof e!="object")return e}if(!this.matchmaker){if(this.matchmaker=new q({sessionId:this.account.sessionId,proxy:this.proxy,instance:this.instance,protocol:this.protocol,noLogin:this.intents.includes(this.Intents.NO_LOGIN),api:this.api}),!await this.matchmaker.ws.tryConnect())return"matchmaker_tryconnect_failed";this.matchmaker.on("authFail",t=>this.emit("authFail",t)),this.matchmaker.on("error",t=>this.processError(t))}return!0}async findPublicGame(e,t){return typeof e!="string"?"no_region_passed":!D.find(i=>i.id===e)&&!this.intents.includes(this.Intents.NO_REGION_CHECK)?"invalid_region_passed":typeof t!="number"?"no_mode_passed":Object.values(d).indexOf(t)===-1?"invalid_mode_passed":await this.initMatchmaker()?await new Promise(i=>{const o=P(n=>{if(n.command!=="notice"){if(this.matchmaker.off("msg",o),n.command==="gameFound")return i(n);if(n.error==="sessionNotFound")return i("internal_session_error");this.processError("unknown matchmaker response "+JSON.stringify(n))}},"listener");this.matchmaker.on("msg",o),this.matchmaker.send({command:"findGame",region:e,playType:A.JoinPublic,gameType:t,sessionId:this.account.sessionId})}):"matchmaker_init_fail"}async createPrivateGame(e,t,a){if(typeof e!="string")return"no_region_passed";if(!D.find(n=>n.id===e)&&!this.intents.includes(this.Intents.NO_REGION_CHECK))return"invalid_region_passed";if(typeof t!="number")return"no_mode_passed";if(Object.values(d).indexOf(t)===-1)return"invalid_mode_passed";if(typeof a!="string")return"no_map_passed";const i=B.findIndex(n=>n.name.toLowerCase()===a.toLowerCase());return i===-1?"invalid_map_passed":await this.initMatchmaker()?await new Promise(n=>{const r=P(h=>{if(h.command!=="notice"){if(this.matchmaker.off("msg",r),h.command==="gameFound")return n(h);if(h.error==="sessionNotFound")return n("internal_session_error");this.processError("unknown matchmaker response "+JSON.stringify(h))}},"listener");this.matchmaker.on("msg",r),this.matchmaker.send({command:"findGame",region:e,playType:A.CreatePrivate,gameType:t,sessionId:this.account.sessionId,noobLobby:!1,map:i})}):"matchmaker_init_fail"}async join(e,t){if(this.state.name=e||"yolkbot",typeof t=="string"){if(t.includes("#")&&(t=t.split("#")[1]),!await this.initMatchmaker())return"matchmaker_init_fail";if(await new Promise(n=>{const r=P(h=>{if(h.command==="gameFound"&&(this.matchmaker.off("msg",r),this.game.raw=h,this.game.code=h.id,n(h.id)),h.error&&h.error==="gameNotFound")return this.processError(`game "${t}" not found, it may have expired.`),this.leave(),"gameNotFound"},"listener");this.matchmaker.on("msg",r),this.matchmaker.send({command:"joinGame",id:t,observe:!1,sessionId:this.account.sessionId})})==="gameNotFound")return"game_not_found";if(!this.game.raw.id)return this.processError("an internal error occured while joining the game, please report this to developers")}if(typeof t=="object"&&(this.account.id===0&&await this.loginAnonymously(),this.game.raw=t,this.game.code=this.game.raw.id,!this.game.raw.id||!this.game.raw.subdomain||!this.game.raw.uuid))return"invalid_game_object";const a=this.game.raw.host||(this.instance.startsWith("localhost:")?this.instance:`${this.game.raw.subdomain}.${this.instance}`);return this.game.socket=new Y(`${this.protocol}://${a}/game/${this.game.raw.id}`,this.proxy),this.game.socket.binaryType="arraybuffer",await this.game.socket.tryConnect()?(this.game.socket.onmessage=o=>this.processPacket(o.data),this.game.socket.onclose=o=>{this.state.left?this.state.left=!1:(this.emit("close",o.code),this.leave(-1))},!0):"websocket_tryconnect_fail"}#o(){if(Object.entries(this.me.position).map(t=>Math.floor(t[1])).join(",")===this.pathing.activePath[this.pathing.activePath.length-1].positionStr)this.pathing.followingPath=!1,this.pathing.activePath=null,this.pathing.activeNode=null,this.pathing.activeNodeIdx=0,this.dispatch(new L(0));else{let t;this.pathing.activeNodeIdx<this.pathing.activePath.length-1?(t=this.pathing.activePath[this.pathing.activeNodeIdx+1].flatCenter(),this.dispatch(new M(t))):(t=this.pathing.activePath[this.pathing.activeNodeIdx].flatCenter(),this.dispatch(new M(t)));for(const a of this.pathing.activePath)if(a.flatRadialDistance(this.me.position)<.1&&a.position.y===Math.floor(this.me.position.y)&&this.pathing.activePath.indexOf(a)>=this.pathing.activeNodeIdx){this.pathing.activeNodeIdx=this.pathing.activePath.indexOf(a)+1,this.pathing.activeNode=this.pathing.activePath[this.pathing.activeNodeIdx];break}this.state.controlKeys&S.Forward||this.dispatch(new L(S.Forward))}}update(){if(this.hasQuit)return;this.pathing.followingPath&&this.intents.includes(this.Intents.PATHFINDING)&&this.#o();for(let t=0;t<this.#s.length;t++){const a=this.#s[t];a.check(this)&&(a.execute(this),this.#s.splice(t,1))}if(this.state.chatLines=Math.max(0,this.state.chatLines-1/(30*4)),this.me.playing){const t=this.state.stateIdx;if(this.intents.includes(this.Intents.DEBUG_BUFFER)&&(console.log("setting buffer for idx",t),console.log("checking...shotsFired",this.state.shotsFired)),this.me.jumping=!!(this.state.controlKeys&S.Jump),this.state.buffer[t]={controlKeys:this.state.controlKeys,yaw:this.state.yaw,pitch:this.state.pitch,shotsFired:this.state.shotsFired},this.state.shotsFired=0,this.lastUpdateTick>=2){this.emit("tick");const a=new y;a.packInt8(c.syncMe),a.packInt8(this.state.stateIdx),a.packInt8(this.state.serverStateIdx);const i=O(this.state.stateIdx-E+1,x);for(let o=0;o<E;o++){const n=O(i+o,x),r=this.state.buffer[n]||{},h=r.controlKeys||0,g=r.shotsFired||0,f=r.yaw??this.state.yaw,l=r.pitch??this.state.pitch;this.intents.includes(this.Intents.DEBUG_BUFFER)&&console.log("going with",this.state.stateIdx,i,n,r),a.packInt8(h),a.packInt8(g),a.packString(st(f,l)),a.packInt8(100)}a.send(this.game.socket),this.state.buffer=[],this.lastUpdateTick=0}else this.lastUpdateTick++;this.state.stateIdx=O(this.state.stateIdx+1,x)}if(!this.intents.includes(this.Intents.PLAYER_HEALTH))return;const e=.1*(this.game.isPrivate?this.game.options.healthRegen:1);for(const t of Object.values(this.players)){if(t.playing&&t.hp>0){const a=t.streakRewards.includes(u.OverHeal);t.hp+=a?-e:e,t.hp=a?Math.max(100,t.hp):Math.min(100,t.hp)}t.spawnShield>0&&(t.spawnShield-=6)}}on(e,t){Object.keys(this.#t).includes(e)?this.#t[e].push(t):this.#t[e]=[t]}once(e,t){const a=P((...i)=>{t(...i),this.off(e,a)},"onceCb");this.on(e,a)}onAny(e){this.#i.push(e)}off(e,t){t?this.#t[e]=this.#t[e].filter(a=>a!==t):this.#t[e]=[]}emit(e,...t){if(!this.hasQuit){if(this.#t[e])for(const a of this.#t[e])a(...t);for(const a of this.#i)a(e,...t)}}#c(){const e=s.unPackInt8U(),t=s.unPackInt8U(),a=s.unPackString().valueOf(),i=this.players[e];this.emit("chat",i,a,t)}#r(){const e=s.unPackInt8U(),t=this.intents.includes(this.Intents.COSMETIC_DATA),a={id:e,uniqueId:s.unPackString(),name:s.unPackString(),safeName:s.unPackString(),charClass:s.unPackInt8U(),team:s.unPackInt8U(),primaryWeaponItem:t?p(s.unPackInt16U()):s.unPackInt16U(),secondaryWeaponItem:t?p(s.unPackInt16U()):s.unPackInt16U(),shellColor:s.unPackInt8U(),hatItem:t?p(s.unPackInt16U()):s.unPackInt16U(),stampItem:t?p(s.unPackInt16U()):s.unPackInt16U(),stampPosX:s.unPackInt8(),stampPosY:s.unPackInt8(),grenadeItem:t?p(s.unPackInt16U()):s.unPackInt16U(),meleeItem:t?p(s.unPackInt16U()):s.unPackInt16U(),x:s.unPackFloat(),y:s.unPackFloat(),z:s.unPackFloat(),$dx:s.unPackFloat(),$dy:s.unPackFloat(),$dz:s.unPackFloat(),yaw:s.unPackRadU(),pitch:s.unPackRad(),score:s.unPackInt32U(),$kills:s.unPackInt16U(),$deaths:s.unPackInt16U(),$streak:s.unPackInt16U(),totalKills:s.unPackInt32U(),totalDeaths:s.unPackInt32U(),bestStreak:s.unPackInt16U(),$bestOverallStreak:s.unPackInt16U(),shield:s.unPackInt8U(),hp:s.unPackInt8U(),playing:s.unPackInt8U(),weaponIdx:s.unPackInt8U(),$controlKeys:s.unPackInt8U(),upgradeProductId:s.unPackInt8U(),activeShellStreaks:s.unPackInt8U(),social:s.unPackLongString(),hideBadge:s.unPackInt8U()};this.game.mapIdx=s.unPackInt8U(),this.game.isPrivate=s.unPackInt8U()===1,this.game.gameModeId=s.unPackInt8U();const i=new _(a,this.game.gameMode===d.KOTC?this.game.activeZone:null);this.players[a.id]||(this.players[a.id]=i),this.emit("playerJoin",i),this.me.id===a.id&&(this.me=i,this.emit("botJoin",this.me))}#h(){const e=s.unPackInt8U(),t=s.unPackInt16U(),a=s.unPackFloat(),i=s.unPackFloat(),o=s.unPackFloat(),n=s.unPackInt8U(),r=s.unPackInt8U(),h=s.unPackInt8U(),g=s.unPackInt8U(),f=s.unPackInt8U(),l=this.players[e];l&&(l.playing=!0,l.randomSeed=t,l.weapons[0]&&l.weapons[0].ammo&&(l.weapons[0].ammo.rounds=n),l.weapons[0]&&l.weapons[0].ammo&&(l.weapons[0].ammo.store=r),l.weapons[1]&&l.weapons[1].ammo&&(l.weapons[1].ammo.rounds=h),l.weapons[1]&&l.weapons[1].ammo&&(l.weapons[1].ammo.store=g),l.grenades=f,l.position={x:a,y:i,z:o},l.spawnShield=120,this.emit("playerRespawn",l))}#l(){const e=s.unPackInt8U(),t=s.unPackFloat(),a=s.unPackFloat(),i=s.unPackFloat(),o=s.unPackInt8U(),n=this.players[e];if(!n||n.id===this.me.id){for(let w=0;w<E;w++)s.unPackInt8U(),s.unPackRadU(),s.unPackRad(),s.unPackInt8U();return}for(let w=0;w<E;w++){const C=s.unPackInt8U();C&S.Jump?n.jumping=!0:n.jumping=!1,C&S.Scope?n.scoping=!0:n.scoping=!1;const U={...n.view};n.view.yaw=s.unPackRadU(),n.view.pitch=s.unPackRad(),(n.view.yaw!==U.yaw||n.view.pitch!==U.pitch)&&this.emit("playerRotate",n,U,n.view),n.scale=s.unPackInt8U()}const r=n.position,h=r.x!==t||r.y!==a||r.z!==i,g=n.climbing!==o,f=h||g,l=f?{...r}:null;if(r.x!==t&&(r.x=t),r.z!==i&&(r.z=i),(!n.jumping||Math.abs(r.y-a)>.5)&&(r.y=a),g&&(n.climbing=o),!f||(this.emit("playerMove",n,l,r),this.game.gameModeId!==d.KOTC))return;const I=this.game.activeZone,v=!!n.inKotcZone;if(!I&&v){n.inKotcZone=!1,this.emit("playerLeaveZone",n);return}n.updateKotcZone(I);const b=!!n.inKotcZone;v!==b&&(n.inKotcZone=b,this.emit(b?"playerEnterZone":"playerLeaveZone",n))}#m(){const e=s.unPackInt8U(),t=this.players[e];t&&(t.playing=!1,t.streakRewards&&(t.streakRewards=[]),this.emit("playerPause",t),t.inKotcZone&&(t.inKotcZone=!1,this.emit("playerLeaveZone",t)))}#u(){const e=s.unPackInt8U(),t=s.unPackInt8U(),a=this.players[e];a&&(a.activeGun=t,this.emit("playerSwapWeapon",a,t))}#d(){const e=s.unPackInt8U(),t=s.unPackInt8U();s.unPackInt8U(),s.unPackInt8U(),s.unPackInt8U();const a=this.players[e],i=this.players[t];a&&(a.id===this.me.id&&(this.lastDeathTime=Date.now()),a.playing=!1,a.streak=0,a.hp=100,a.spawnShield=0,a.stats.totalDeaths++,a.inKotcZone=!1,this.emit("playerLeaveZone",a)),i&&(i.streak++,i.stats.totalKills++,i.streak>i.stats.bestStreak&&(i.stats.bestStreak=i.streak)),this.emit("playerDeath",a,i)}#p(){const e=s.unPackInt8U(),t={posX:s.unPackFloat(),posY:s.unPackFloat(),posZ:s.unPackFloat(),dirX:s.unPackFloat(),dirY:s.unPackFloat(),dirZ:s.unPackFloat()},a=this.players[e];if(!a)return;const i=a.weapons[a.activeGun];i&&i.ammo&&(i.ammo.rounds--,this.emit("playerFire",a,i,t))}#g(){const e=s.unPackInt16U(),t=s.unPackInt8U(),a=s.unPackFloat(),i=s.unPackFloat(),o=s.unPackFloat();this.game.collectables[t].push({id:e,x:a,y:i,z:o}),this.emit("spawnItem",t,{x:a,y:i,z:o},e)}#k(){const e=s.unPackInt8U(),t=s.unPackInt8U(),a=s.unPackInt8U(),i=s.unPackInt16U(),o=this.players[e];if(o){if(this.game.collectables[t]=this.game.collectables[t].filter(n=>n.id!==i),t===R.Ammo){const n=o.weapons[a];n&&n.ammo&&(n.ammo.store=Math.min(n.ammo.storeMax,n.ammo.store+n.ammo.pickup),this.emit("playerCollectAmmo",o,n,i))}t===R.Grenade&&(o.grenades++,o.grenades>3&&(o.grenades=3),this.emit("playerCollectGrenade",o,i))}}#I(){const e=s.unPackInt8U(),t=s.unPackInt8U(),a=this.players[e];if(!a)return;const i=a.hp;a.hp=t,this.emit("playerDamage",a,i,a.hp)}#f(){const e=s.unPackInt8U();s.unPackFloat(),s.unPackFloat();const t=this.me.hp;this.me.hp=e,this.emit("playerDamage",this.me,t,this.me.hp)}#P(){const e=s.unPackInt8U(),t=this.players[e];s.unPackInt8U();const a=s.unPackInt8U(),i=s.unPackFloat(),o=s.unPackFloat(),n=s.unPackFloat();if(this.me.climbing=!!s.unPackInt8U(),s.unPackInt8U(),s.unPackInt8U(),!t)return;this.state.serverStateIdx=a;const r=t.position.x,h=t.position.y,g=t.position.z;t.position.x=i,t.position.y=o,t.position.z=n,(r!==i||h!==o||g!==n)&&this.emit("playerMove",t,{x:r,y:h,z:g},{x:i,y:o,z:n})}#y(){const e=new y;e.packInt8(c.eventModifier),e.send(this.game.socket)}#w(){const e=s.unPackInt8U(),t={...this.players[e]};delete this.players[e.toString()],this.emit("playerLeave",t)}#b(){if(this.game.gameModeId===d.Spatula){const e={...this.game};this.game.teamScore[1]=s.unPackInt16U(),this.game.teamScore[2]=s.unPackInt16U();const t={x:s.unPackFloat(),y:s.unPackFloat(),z:s.unPackFloat()},a=s.unPackInt8U(),i=s.unPackInt8U();this.game.spatula={coords:t,controlledBy:a,controlledByTeam:i},this.emit("gameStateChange",e,this.game)}else if(this.game.gameModeId===d.KOTC){const e={...this.game};this.game.stage=s.unPackInt8U(),this.game.zoneNumber=s.unPackInt8U(),this.game.capturing=s.unPackInt8U(),this.game.captureProgress=s.unPackInt16U(),this.game.numCapturing=s.unPackInt8U(),this.game.teamScore[1]=s.unPackInt8U(),this.game.teamScore[2]=s.unPackInt8U(),this.game.capturePercent=this.game.captureProgress/1e3,this.game.activeZone=this.game.map.zones?this.game.map.zones[this.game.zoneNumber-1]:null;const t=Object.values(this.players).filter(a=>a.inKotcZone&&a.playing);this.game.activeZone&&Object.values(this.players).forEach(a=>a.updateKotcZone(this.game.activeZone)),this.game.numCapturing<=0&&Object.values(this.players).forEach(a=>{a.inKotcZone=!1,this.emit("playerLeaveZone",a)}),this.emit("gameStateChange",e,this.game,t)}else this.game.gameModeId===d.Team&&(this.game.teamScore[1]=s.unPackInt16U(),this.game.teamScore[2]=s.unPackInt16U());this.game.gameModeId!==d.Spatula&&delete this.game.spatula,this.game.gameModeId!==d.KOTC&&(delete this.game.stage,delete this.game.zoneNumber,delete this.game.capturing,delete this.game.captureProgress,delete this.game.numCapturing,delete this.game.numCapturing,delete this.game.activeZone),this.game.gameModeId===d.FFA&&delete this.game.teamScore}#U(){const e=s.unPackInt8U(),t=s.unPackInt8U(),a=this.players[e];if(a){switch(t){case u.HardBoiled:e===this.me.id&&(this.me.shieldHp=100),a.streakRewards.push(u.HardBoiled);break;case u.EggBreaker:a.streakRewards.push(u.EggBreaker);break;case u.Restock:{a.grenades=3,a.weapons[0]&&a.weapons[0].ammo&&(a.weapons[0].ammo.rounds=a.weapons[0].ammo.capacity,a.weapons[0].ammo.store=a.weapons[0].ammo.storeMax),a.weapons[1]&&a.weapons[1].ammo&&(a.weapons[1].ammo.rounds=a.weapons[1].ammo.capacity,a.weapons[1].ammo.store=a.weapons[1].ammo.storeMax);break}case u.OverHeal:a.hp=Math.min(200,a.hp+100),a.streakRewards.push(u.OverHeal);break;case u.DoubleEggs:a.streakRewards.push(u.DoubleEggs);break;case u.MiniEgg:a.scale=.5,a.streakRewards.push(u.MiniEgg);break}this.emit("playerBeginStreak",a,t)}}#S(){const e=s.unPackInt8U(),t=s.unPackInt8U(),a=this.players[e];if(!a)return;[u.EggBreaker,u.OverHeal,u.DoubleEggs,u.MiniEgg].includes(t)&&a.streakRewards.includes(t)&&(a.streakRewards=a.streakRewards.filter(o=>o!==t)),t===u.MiniEgg&&(a.scale=1),this.emit("playerEndStreak",a,t)}#v(){const e=s.unPackInt8U(),t=s.unPackInt8U(),a=s.unPackFloat(),i=s.unPackFloat();this.me&&(this.me.shieldHp=e,this.me.hp=t,this.me.shieldHp<=0?(this.me.streakRewards=this.me.streakRewards.filter(o=>o!==u.HardBoiled),this.emit("selfShieldLost",this.me.hp,{dx:a,dz:i})):this.emit("selfShieldHit",this.me.shieldHp,this.me.hp,{dx:a,dz:i}))}#C(){const e={...this.game.options};let t=s.unPackInt8U(),a=s.unPackInt8U(),i=s.unPackInt8U();(t<1||t>4)&&(t=4),(a<0||a>8)&&(a=4),i>16&&(i=4),this.game.options.gravity=t/4,this.game.options.damage=a/4,this.game.options.healthRegen=i/4;const o=s.unPackInt8U();Object.keys(H).forEach(n=>{const r=o&H[n]?1:0;this.game.options[n]=r}),this.game.options.weaponsDisabled=Array.from({length:7},()=>s.unPackInt8U()===1),this.game.options.mustUseSecondary=this.game.options.weaponsDisabled.every(n=>n),this.emit("gameOptionsChange",e,this.game.options)}#E(){const e=s.unPackInt8U();e===N.Pause&&(this.emit("gameForcePause"),setTimeout(()=>this.me.playing=!1,3e3)),e===N.Reset&&(Object.values(this.players).forEach(t=>t.streak=0),this.game.gameModeId!==d.FFA&&(this.game.teamScore=[0,0,0]),this.game.gameModeId===d.Spatula&&(this.game.spatula.controlledBy=0,this.game.spatula.controlledByTeam=0,this.game.spatula.coords={x:0,y:0,z:0}),this.game.gameModeId===d.KOTC&&(this.game.stage=G.Capturing,this.game.zoneNumber=0,this.game.activeZone=null,this.game.capturing=0,this.game.captureProgress=0,this.game.numCapturing=0,this.game.capturePercent=0),this.emit("gameReset"))}#_(){if(!this.intents.includes(this.Intents.PING))return;const e=this.ping;this.ping=Date.now()-this.lastPingTime,this.emit("pingUpdate",e,this.ping),setTimeout(()=>{const t=new y;t.packInt8(c.ping),t.send(this.game.socket),this.lastPingTime=Date.now()},1e3)}#x(){const e=s.unPackInt8U(),t=s.unPackInt8U(),a=this.players[e];if(!a)return;const i=a.team;a.team=t,a.streak=0,this.emit("playerSwitchTeam",a,i,t)}#O(){const e=s.unPackInt8U(),t=s.unPackInt8U(),a=s.unPackInt16U(),i=s.unPackInt16U(),o=s.unPackInt8U(),n=s.unPackInt16U(),r=s.unPackInt16U(),h=s.unPackInt16U(),g=s.unPackInt16U(),f=s.unPackInt8(),l=s.unPackInt8(),I=this.intents.includes(this.Intents.COSMETIC_DATA),v=I?p(a):a,b=I?p(i):i,w=I?p(n):n,C=I?p(r):r,U=I?p(h):h,W=I?p(g):g,m=this.players[e];if(m){const T={...m.character},F=m.selectedGun;m.character.eggColor=o,m.character.primaryGun=v,m.character.secondaryGun=b,m.character.stamp=C,m.character.hat=w,m.character.grenade=U,m.character.melee=W,m.character.stampPos.x=f,m.character.stampPos.y=l,m.selectedGun=t,m.weapons[0]=new J[t],F!==m.selectedGun&&this.emit("playerChangeGun",m,F,m.selectedGun),T!==m.character&&this.emit("playerChangeCharacter",m,T,m.character)}}#T(){const e=s.unPackInt32U(),t=this.account.eggBalance;this.account.eggBalance=e,this.emit("balanceUpdate",t,e)}#F(){this.me.playing=!1,this.emit("respawnDenied")}#R(){const e=s.unPackInt8U(),t=this.players[e];t&&this.emit("playerMelee",t)}#G(){const e=s.unPackInt8U(),t=this.players[e];if(!t)return;const a=t.weapons[t.activeGun];if(a.ammo){const i=Math.min(Math.min(a.ammo.capacity,a.ammo.reload)-a.ammo.rounds,a.ammo.store);a.ammo.rounds+=i,a.ammo.store-=i}this.emit("playerReload",t,a)}updateGameOptions(){const e=new y;e.packInt8(c.gameOptions),e.packInt8(this.game.options.gravity*4),e.packInt8(this.game.options.damage*4),e.packInt8(this.game.options.healthRegen*4);const t=(this.game.options.locked?1:0)|(this.game.options.noTeamChange?2:0)|(this.game.options.noTeamShuffle?4:0);e.packInt8(t),this.game.options.weaponsDisabled.forEach(a=>{e.packInt8(a?1:0)}),e.send(this.game.socket)}#N(){this.game.isPrivate=!0,this.updateGameOptions()}#A(){const e=s.unPackInt8U();let t=s.unPackInt16U();const a=s.unPackFloat(),i=s.unPackFloat(),o=s.unPackFloat(),n=s.unPackInt8U(),r=s.unPackFloat();this.intents.includes(this.Intents.COSMETIC_DATA)&&(t=p(t)),e===Q.Grenade?this.emit("grenadeExplode",t,{x:a,y:i,z:o},n,r):this.emit("rocketHit",{x:a,y:i,z:o},n,r)}#M(){const e=s.unPackInt8U(),t=s.unPackFloat(),a=s.unPackFloat(),i=s.unPackFloat(),o=s.unPackFloat(),n=s.unPackFloat(),r=s.unPackFloat(),h=this.players[e];h&&(h.grenades--,this.emit("playerThrowGrenade",h,{x:t,y:a,z:i},{x:o,y:n,z:r}))}#L(){const e=s.unPackInt8U(),t=s.unPackInt8U(),a=this.players[e];if(!a)return;if(!this.intents.includes(this.Intents.CHALLENGES))return this.emit("challengeComplete",a,t);const i=this.account.challenges.find(o=>o.id===t);this.emit("challengeComplete",a,i),a.id===this.me.id&&this.refreshChallenges()}#B(){const e=new y;e.packInt8(this.intents.includes(this.Intents.OBSERVE_GAME)?c.observeGame:c.joinGame),e.packString(this.game.raw.uuid),e.packInt8(+this.intents.includes(this.Intents.VIP_HIDE_BADGE)),e.packInt8(this.state.weaponIdx||this.account?.loadout?.classIdx||0),e.packString(this.state.name),e.packInt32(this.account.session),e.packString(this.account.sessionId),e.packString(this.account.firebaseId),e.send(this.game.socket)}async#D(){if(this.me.id=s.unPackInt8U(),this.me.team=s.unPackInt8U(),this.game.gameModeId=s.unPackInt8U(),this.game.gameMode=K[this.game.gameModeId],this.game.mapIdx=s.unPackInt8U(),this.game.map=B[this.game.mapIdx],this.game.playerLimit=s.unPackInt8U(),this.game.isGameOwner=s.unPackInt8U()===1,this.game.isPrivate=s.unPackInt8U()===1||this.game.isGameOwner,s.unPackInt8U(),this.intents.includes(this.Intents.LOAD_MAP)||this.intents.includes(this.Intents.PATHFINDING)){if(this.game.map.raw=await at(this.game.map.filename,this.game.map.hash),this.emit("mapLoad",this.game.map.raw),this.game.gameModeId===d.KOTC){const t=this.game.map.raw.data["DYNAMIC.capture-zone.none"];t?(this.game.map.zones=it(t),this.game.activeZone||(this.game.activeZone=this.game.map.zones[this.game.zoneNumber-1])):delete this.game.map.zones}this.intents.includes(this.Intents.PATHFINDING)&&(this.pathing.nodeList=new et(this.game.map.raw))}this.state.inGame=!0,this.lastDeathTime=Date.now();const e=new y;if(e.packInt8(c.clientReady),e.send(this.game.socket),this.updateIntervalId=setInterval(()=>this.update(),100/3),this.intents.includes(this.Intents.PING)){this.lastPingTime=Date.now();const t=new y;t.packInt8(c.ping),t.send(this.game.socket)}this.intents.includes(this.Intents.NO_AFK_KICK)&&(this.afkKickInterval=setInterval(()=>{if(this.state.inGame&&!this.me.playing&&Date.now()-this.lastDeathTime>=15e3){const t=new y;t.packInt8(c.keepAlive),t.send(this.game.socket)}},15e3)),this.emit("gameReady")}#K(){const e=s.unPackInt8U(),t=s.unPackString(128),a=s.unPackString(32),i=this.players[e];i&&(i.admin={ip:a,dbId:t},this.emit("playerInfo",i,a,t))}processPacket(e){s.init(e),this.intents.includes(this.Intents.PACKET_HOOK)&&this.emit("packet",e);let t=0,a=0,i=!1;for(;s.isMoreDataAvailable()&&!i;){const o=s.unPackInt8U();switch(o){case c.syncThem:this.#l();break;case c.fire:this.#p();break;case c.hitThem:this.#I();break;case c.syncMe:this.#P();break;case c.hitMe:this.#f();break;case c.swapWeapon:this.#u();break;case c.collectItem:this.#k();break;case c.respawn:this.#h();break;case c.die:this.#d();break;case c.pause:this.#m();break;case c.chat:this.#c();break;case c.addPlayer:this.#r();break;case c.removePlayer:this.#w();break;case c.eventModifier:this.#y();break;case c.metaGameState:this.#b();break;case c.beginShellStreak:this.#U();break;case c.endShellStreak:this.#S();break;case c.hitMeHardBoiled:this.#v();break;case c.gameOptions:this.#C();break;case c.ping:this.#_();break;case c.switchTeam:this.#x();break;case c.changeCharacter:this.#O();break;case c.reload:this.#G();break;case c.explode:this.#A();break;case c.throwGrenade:this.#M();break;case c.spawnItem:this.#g();break;case c.melee:this.#R();break;case c.updateBalance:this.#T();break;case c.challengeCompleted:this.#L();break;case c.socketReady:this.#B();break;case c.gameJoined:this.#D();break;case c.gameAction:this.#E();break;case c.requestGameOptions:this.#N();break;case c.respawnDenied:this.#F();break;case c.playerInfo:this.#K();break;case c.expireUpgrade:case c.clientReady:break;case c.musicInfo:s.unPackLongString();break;default:console.error(`processPacket: I got but couldn't identify a: ${Object.keys(c).find(n=>c[n]===o)} ${o}`),t&&console.error(`processPacket: It may be a result of the ${t} command (${a}).`),i=!0;break}t=Object.keys(c).find(n=>c[n]===o),a=o,this.intents.includes(this.Intents.LOG_PACKETS)&&console.log(`[LOG_PACKETS] Packet ${t}: ${a}`)}}async checkChiknWinner(){const e=await this.api.queryServices({cmd:"chicknWinnerReady",id:this.account.id,sessionId:this.account.sessionId});return typeof e=="string"?e:(this.account.cw.limit=e.limit,this.account.cw.atLimit=e.limit>=4,this.account.cw.secondsUntilPlay=(this.account.cw.atLimit?e.period:e.span)||0,this.account.cw.canPlayAgain=Date.now()+this.account.cw.secondsUntilPlay*1e3,this.account.cw)}async playChiknWinner(e=!0){if(this.account.cw.atLimit||this.account.cw.limit>V)return"hit_daily_limit";if(this.account.cw.canPlayAgain>Date.now()&&e)return"on_cooldown";const t=await this.api.queryServices({cmd:"incentivizedVideoReward",firebaseId:this.account.firebaseId,id:this.account.id,sessionId:this.account.sessionId,token:null});return typeof t=="string"?t:t.error?t.error==="RATELIMITED"||t.error==="RATELMITED"?(await this.checkChiknWinner(),"on_cooldown"):t.error==="SESSION_EXPIRED"?(this.emit("sessionExpired"),"session_expired"):(console.error("Unknown Chikn Winner response, report this on Github:",t),"unknown_error"):t.reward?(this.account.eggBalance+=t.reward.eggsGiven,t.reward.itemIds.forEach(a=>this.account.ownedItemIds.push(a)),await this.checkChiknWinner(),t.reward):(console.error("Unknown Chikn Winner response, report this on Github:",t),"unknown_error")}async resetChiknWinner(){if(this.account.eggBalance<200)return"not_enough_eggs";if(!this.account.cw.atLimit)return"not_at_limit";const e=await this.api.queryServices({cmd:"chwReset",sessionId:this.account.sessionId});return typeof e=="string"?e:e.result!=="SUCCESS"?(console.error("Unknown Chikn Winner reset response, report this on Github:",e),"unknown_error"):(this.account.eggBalance-=200,await this.checkChiknWinner(),this.account.cw)}canSee(e){return this.intents.includes(this.Intents.PATHFINDING)?this.pathing.nodeList.hasLineOfSight(this.me.position,e.position):this.processError("You must have the PATHFINDING intent to use this method.")}async refreshChallenges(){const e=await this.api.queryServices({cmd:"challengeGetDaily",sessionId:this.account.sessionId,playerId:this.account.id});return typeof e=="string"?e:(this.#a(e),this.account.challenges)}async rerollChallenge(e){const t=await this.api.queryServices({cmd:"challengeRerollSlot",sessionId:this.account.sessionId,slotId:e});return typeof t=="string"?t:(this.#a(t),this.account.challenges)}async claimChallenge(e){const t=await this.api.queryServices({cmd:"challengeClaimReward",sessionId:this.account.sessionId,slotId:e});return typeof t=="string"?t:(this.#a(t.challenges),t.reward>0&&(this.account.eggBalance+=t.reward),{eggReward:t.reward,updatedChallenges:this.account.challenges})}async refreshBalance(){const e=await this.api.queryServices({cmd:"checkBalance",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId});return typeof e=="string"?e:(this.account.eggBalance=e.currentBalance,e.currentBalance)}async redeemCode(e){const t=await this.api.queryServices({cmd:"redeem",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,id:this.account.id,code:e});return typeof t=="string"?t:t.result==="SUCCESS"?(this.account.eggBalance=t.eggs_given,t.item_ids.forEach(a=>this.account.ownedItemIds.push(a)),{result:t,eggsGiven:t.eggs_given,itemIds:t.item_ids}):t}async claimURLReward(e){const t=await this.api.queryServices({cmd:"urlRewardParams",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,reward:e});return typeof t=="string"||t.result==="SUCCESS"&&(this.account.eggBalance+=t.eggsGiven,t.itemIds.forEach(a=>this.account.ownedItemIds.push(a))),t}async claimSocialReward(e){const t=await this.api.queryServices({cmd:"reward",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,rewardTag:e});return typeof t=="string"||t.result==="SUCCESS"&&(this.account.eggBalance+=t.eggsGiven,t.itemIds.forEach(a=>this.account.ownedItemIds.push(a))),t}async buyItem(e){const t=await this.api.queryServices({cmd:"buy",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,itemId:e,save:!0});return typeof t=="string"||t.result==="SUCCESS"&&(this.account.eggBalance=t.currentBalance,this.account.ownedItemIds.push(t.itemId)),t}processError(e){this.#t.error&&this.#t.error.length?this.emit("error",e):(console.error(e),this.intents.includes(this.Intents.NO_EXIT_ON_ERROR)||process.exit(1))}leave(e=$.mainMenu){this.hasQuit||(e>-1&&(this.game?.socket?.close(e),this.state.left=!0,this.emit("leave",e)),clearInterval(this.updateIntervalId),this.#s=[],this.state.inGame=!1,this.state.chatLines=0,this.state.reloading=!1,this.state.swappingGun=!1,this.state.usingMelee=!1,this.state.stateIdx=0,this.state.serverStateIdx=0,this.state.shotsFired=0,this.state.buffer=[],this.players={},this.me=new _({}),this.game=this.#n,this.ping=0,this.lastPingTime=-1,this.lastDeathTime=-1,this.lastUpdateTick=0,this.pathing={nodeList:null,followingPath:!1,activePath:null,activeNode:null,activeNodeIdx:0})}logout(){this.account=this.#e,this.intents.includes(this.Intents.RENEW_SESSION)&&clearInterval(this.renewSessionInterval)}quit(e=!1){this.hasQuit||(this.leave(),this.matchmaker&&(this.matchmaker.close(),e||delete this.matchmaker),e||(delete this.account,delete this.api,delete this.game,delete this.me,delete this.pathing,delete this.players,delete this.state,this.#e={},this.#n={},this.#t={},this.#i=[],this.#s=[]),this.intents.includes(this.Intents.NO_AFK_KICK)&&clearInterval(this.afkKickInterval),this.intents.includes(this.Intents.RENEW_SESSION)&&clearInterval(this.renewSessionInterval),this.hasQuit=!0)}}var vt=ot;export{ot as Bot,vt as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- class a{static buffer;static idx;static init(t){this.buffer=new Uint8Array(t),this.idx=0}static isMoreDataAvailable(){return Math.max(0,this.buffer.length-this.idx)}static unPackInt8U(){const t=this.idx;return this.idx++,this.buffer[t]}static unPackInt8(){return(this.unPackInt8U()+128)%256-128}static unPackInt16U(){const t=this.idx;return this.idx+=2,this.buffer[t]+this.buffer[t+1]*256}static unPackInt24U(){const t=this.idx;return this.idx+=3,this.buffer[t]+this.buffer[t+1]*256+this.buffer[t+2]*65536}static unPackInt32U(){const t=this.idx;return this.idx+=4,this.buffer[t]+this.buffer[t+1]*256+this.buffer[t+2]*65536+this.buffer[t+3]*16777216}static unPackInt16(){return(this.unPackInt16U()+32768)%65536-32768}static unPackInt32(){return(this.unPackInt32U()+2147483648)%4294967296-2147483648}static unPackRadU(){return this.unPackInt24U()/2097152}static unPackRad(){return this.unPackInt16U()/8192-Math.PI}static unPackFloat(){return this.unPackInt16()/256}static unPackDouble(){return this.unPackInt32()/1048576}static unPackString(t){t=t||255;const i=Math.min(this.unPackInt8U(),t);return this.unPackStringHelper(i)}static unPackLongString(t){t=t||16383;const i=Math.min(this.unPackInt16U(),t);return this.unPackStringHelper(i)}static unPackStringHelper(t){if(this.isMoreDataAvailable()<t)return 0;let n="";for(let s=0;s<t;s++){const r=this.unPackInt16U();r>0&&(n+=String.fromCodePoint(r))}return n}}var u=a;export{a as CommIn,u as default};
3
+ var u=Object.defineProperty;var c=(n,t)=>u(n,"name",{value:t,configurable:!0});class e{static{c(this,"CommIn")}static buffer;static idx;static init(t){this.buffer=new Uint8Array(t),this.idx=0}static isMoreDataAvailable(){return Math.max(0,this.buffer.length-this.idx)}static unPackInt8U(){const t=this.idx;return this.idx++,this.buffer[t]}static unPackInt8(){return(this.unPackInt8U()+128)%256-128}static unPackInt16U(){const t=this.idx;return this.idx+=2,this.buffer[t]+this.buffer[t+1]*256}static unPackInt24U(){const t=this.idx;return this.idx+=3,this.buffer[t]+this.buffer[t+1]*256+this.buffer[t+2]*65536}static unPackInt32U(){const t=this.idx;return this.idx+=4,this.buffer[t]+this.buffer[t+1]*256+this.buffer[t+2]*65536+this.buffer[t+3]*16777216}static unPackInt16(){return(this.unPackInt16U()+32768)%65536-32768}static unPackInt32(){return(this.unPackInt32U()+2147483648)%4294967296-2147483648}static unPackRadU(){return this.unPackInt24U()/2097152}static unPackRad(){return this.unPackInt16U()/8192-Math.PI}static unPackFloat(){return this.unPackInt16()/256}static unPackDouble(){return this.unPackInt32()/1048576}static unPackString(t){t=t||255;const i=Math.min(this.unPackInt8U(),t);return this.unPackStringHelper(i)}static unPackLongString(t){t=t||16383;const i=Math.min(this.unPackInt16U(),t);return this.unPackStringHelper(i)}static unPackStringHelper(t){if(this.isMoreDataAvailable()<t)return 0;let s="";for(let r=0;r<t;r++){const a=this.unPackInt16U();a>0&&(s+=String.fromCodePoint(a))}return s}}var f=e;export{e as CommIn,f as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- class h{constructor(t=16384){this.idx=0,this.arrayBuffer=new ArrayBuffer(t),this.buffer=new Uint8Array(this.arrayBuffer,0,t)}send(t){const i=new Uint8Array(this.arrayBuffer,0,this.idx);t.send(i)}packInt8(t){this.buffer[this.idx]=t&255,this.idx++}packInt16(t){this.buffer[this.idx]=t&255,this.buffer[this.idx+1]=t>>8&255,this.idx+=2}packInt24(t){this.buffer[this.idx]=t&255,this.buffer[this.idx+1]=t>>8&255,this.buffer[this.idx+2]=t>>16&255,this.idx+=3}packInt32(t){this.buffer[this.idx]=t&255,this.buffer[this.idx+1]=t>>8&255,this.buffer[this.idx+2]=t>>16&255,this.buffer[this.idx+3]=t>>24&255,this.idx+=4}packRadU(t){this.packInt24(t*2097152)}packRad(t){this.packInt16((t+Math.PI)*8192)}packFloat(t){this.packInt16(t*256)}packDouble(t){this.packInt32(t*1048576)}packString(t){typeof t!="string"&&(t=""),this.packInt8(t.length);for(let i=0;i<t.length;i++)this.packInt16(t.charCodeAt(i))}packLongString(t){typeof t!="string"&&(t=""),this.packInt16(t.length);for(let i=0;i<t.length;i++)this.packInt16(t.charCodeAt(i))}}var s=h;export{h as CommOut,s as default};
3
+ var s=Object.defineProperty;var f=(h,t)=>s(h,"name",{value:t,configurable:!0});class e{static{f(this,"CommOut")}constructor(t=16384){this.idx=0,this.arrayBuffer=new ArrayBuffer(t),this.buffer=new Uint8Array(this.arrayBuffer,0,t)}send(t){const i=new Uint8Array(this.arrayBuffer,0,this.idx);t.send(i)}packInt8(t){this.buffer[this.idx]=t&255,this.idx++}packInt16(t){this.buffer[this.idx]=t&255,this.buffer[this.idx+1]=t>>8&255,this.idx+=2}packInt24(t){this.buffer[this.idx]=t&255,this.buffer[this.idx+1]=t>>8&255,this.buffer[this.idx+2]=t>>16&255,this.idx+=3}packInt32(t){this.buffer[this.idx]=t&255,this.buffer[this.idx+1]=t>>8&255,this.buffer[this.idx+2]=t>>16&255,this.buffer[this.idx+3]=t>>24&255,this.idx+=4}packRadU(t){this.packInt24(t*2097152)}packRad(t){this.packInt16((t+Math.PI)*8192)}packFloat(t){this.packInt16(t*256)}packDouble(t){this.packInt32(t*1048576)}packString(t){typeof t!="string"&&(t=""),this.packInt8(t.length);for(let i=0;i<t.length;i++)this.packInt16(t.charCodeAt(i))}packLongString(t){typeof t!="string"&&(t=""),this.packInt16(t.length);for(let i=0;i<t.length;i++)this.packInt16(t.charCodeAt(i))}}var n=e;export{e as CommOut,n as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- const e={swapWeapon:0,joinGame:1,refreshGameState:2,spawnItem:3,observeGame:4,ping:5,bootPlayer:6,banPlayer:7,loginRequired:8,gameLocked:9,switchTeam:13,changeCharacter:14,pause:15,gameOptions:16,gameAction:17,requestGameOptions:18,gameJoined:19,socketReady:20,addPlayer:21,removePlayer:22,fire:23,melee:24,throwGrenade:25,eventModifier:27,hitThem:28,hitMe:29,collectItem:30,challengeResetInGame:31,chat:34,syncThem:35,die:37,beginShellStreak:38,endShellStreak:39,updateBalance:42,reload:43,respawn:44,respawnDenied:45,clientReady:47,requestRespawn:48,switchTeamFail:51,expireUpgrade:52,metaGameState:53,syncMe:54,explode:55,keepAlive:56,musicInfo:57,hitMeHardBoiled:58,playerInfo:59,challengeCompleted:60};var a=e;export{e as CommCode,a as default};
3
+ const e={swapWeapon:0,joinGame:1,refreshGameState:2,spawnItem:3,observeGame:4,ping:5,bootPlayer:6,banPlayer:7,loginRequired:8,gameLocked:9,reportPlayer:10,switchTeam:13,changeCharacter:14,pause:15,gameOptions:16,gameAction:17,requestGameOptions:18,gameJoined:19,socketReady:20,addPlayer:21,removePlayer:22,fire:23,melee:24,throwGrenade:25,eventModifier:27,hitThem:28,hitMe:29,collectItem:30,challengeResetInGame:31,chat:34,syncThem:35,die:37,beginShellStreak:38,endShellStreak:39,updateBalance:42,reload:43,respawn:44,respawnDenied:45,clientReady:47,requestRespawn:48,switchTeamFail:51,expireUpgrade:52,metaGameState:53,syncMe:54,explode:55,keepAlive:56,musicInfo:57,hitMeHardBoiled:58,playerInfo:59,challengeCompleted:60};var a=e;export{a as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- const t=class{constructor(){this.adsMod=.5,this.burst=0,this.burstRof=0,this.movementAccuracyMod=1,this.radius=0,this.reloadBloom=!0,this.reloadTimeMod=1,this.tracer=0}},a=class extends t{constructor(){super(),this.ammo={rounds:30,capacity:30,reload:30,store:240,storeMax:240,pickup:30},this.longReloadTime=205,this.shortReloadTime=160,this.weaponName="EggK-47",this.internalName="Eggk47",this.standardMeshName="eggk47",this.automatic=!0,this.damage=30,this.range=20,this.recoil=7,this.rof=3,this.totalDamage=30,this.velocity=1.5,this.accuracyMin=.15,this.accuracyMax=.03,this.accuracyLoss=.05,this.accuracyRecover=.025,this.tracer=1}},i=class extends t{constructor(){super(),this.ammo={rounds:2,capacity:2,reload:2,store:24,storeMax:24,pickup:8},this.longReloadTime=155,this.shortReloadTime=155,this.weaponName="Scrambler",this.internalName="Dozen Gauge",this.standardMeshName="dozenGauge",this.automatic=!1,this.damage=8.5,this.range=8,this.recoil=10,this.rof=8,this.totalDamage=170,this.velocity=1,this.accuracyMin=.16,this.accuracyMax=.13,this.accuracyLoss=.17,this.accuracyRecover=.02,this.adsMod=.6,this.movementAccuracyMod=.2,this.tracer=0}},e=class extends t{constructor(){super(),this.ammo={rounds:15,capacity:15,reload:15,store:60,storeMax:60,pickup:15},this.longReloadTime=225,this.shortReloadTime=165,this.weaponName="Free Ranger",this.internalName="CSG-1",this.standardMeshName="csg1",this.automatic=!1,this.damage=105,this.range=50,this.recoil=13,this.rof=13,this.totalDamage=105,this.velocity=1.75,this.accuracyMin=.3,this.accuracyMax=.004,this.accuracyLoss=.3,this.accuracyRecover=.025,this.tracer=0}},c=class extends t{constructor(){super(),this.ammo={rounds:15,capacity:15,reload:15,store:60,storeMax:60,pickup:15},this.longReloadTime=195,this.shortReloadTime=160,this.weaponName="Cluck 9mm",this.internalName="Cluck 9mm",this.standardMeshName="cluck9mm",this.automatic=!1,this.damage=26,this.range=15,this.recoil=6,this.rof=4,this.totalDamage=26,this.velocity=1,this.accuracyMin=.15,this.accuracyMax=.035,this.accuracyLoss=.09,this.accuracyRecover=.08,this.adsMod=.8,this.movementAccuracyMod=.6,this.tracer=0}},o=class extends t{constructor(){super(),this.ammo={rounds:1,capacity:1,reload:1,store:3,storeMax:3,pickup:1},this.longReloadTime=170,this.shortReloadTime=170,this.weaponName="RPEGG",this.internalName="Eggsploder",this.standardMeshName="rpegg",this.automatic=!1,this.damage=140,this.range=45,this.recoil=60,this.rof=40,this.totalDamage=192.5,this.velocity=.4,this.accuracyMin=.3,this.accuracyMax=.015,this.accuracyLoss=.3,this.accuracyRecover=.02,this.radius=2.75}},r=class extends t{constructor(){super(),this.ammo={rounds:40,capacity:40,reload:40,store:200,storeMax:200,pickup:40},this.longReloadTime=225,this.shortReloadTime=190,this.weaponName="Whipper",this.internalName="SMEGG",this.standardMeshName="smg",this.automatic=!0,this.damage=23,this.range=20,this.recoil=7,this.rof=2,this.totalDamage=23,this.velocity=1.25,this.accuracyMin=.19,this.accuracyMax=.06,this.accuracyLoss=.045,this.accuracyRecover=.05,this.adsMod=.6,this.movementAccuracyMod=.7,this.tracer=2}},h=class extends t{constructor(){super(),this.ammo={rounds:1,capacity:1,reload:1,store:12,storeMax:12,pickup:4},this.longReloadTime=144,this.shortReloadTime=144,this.weaponName="Crackshot",this.internalName="M2DZ",this.standardMeshName="m24",this.automatic=!0,this.damage=170,this.range=60,this.recoil=20,this.rof=15,this.totalDamage=170,this.velocity=2,this.accuracyMin=.35,this.accuracyMax=0,this.accuracyLoss=.1,this.accuracyRecover=.023,this.movementAccuracyMod=1.3,this.reloadBloom=!1,this.reloadTimeMod=.8,this.tracer=0}},m=class extends t{constructor(){super(),this.ammo={rounds:24,capacity:24,reload:24,store:150,storeMax:150,pickup:24},this.longReloadTime=205,this.shortReloadTime=160,this.weaponName="Tri-Hard",this.internalName="AUG",this.standardMeshName="aug",this.automatic=!1,this.damage=32,this.range=20,this.recoil=18,this.rof=15,this.totalDamage=34,this.velocity=1.5,this.accuracyMin=.15,this.accuracyMax=.03,this.accuracyLoss=.037,this.accuracyRecover=.03,this.adsMod=.6,this.burst=3,this.burstRof=3,this.movementAccuracyMod=.8,this.movementInstability=2,this.tracer=0}};export{m as AUG,e as CSG1,c as Cluck9mm,i as DozenGauge,a as Eggk47,h as M24,o as RPEGG,r as SMG};
3
+ var e=Object.defineProperty;var t=(s,i)=>e(s,"name",{value:i,configurable:!0});const a=class{static{t(this,"BaseGun")}constructor(){this.adsMod=.5,this.burst=0,this.burstRof=0,this.movementAccuracyMod=1,this.radius=0,this.reloadBloom=!0,this.reloadTimeMod=1,this.tracer=0}},c=class extends a{static{t(this,"_Eggk47")}constructor(){super(),this.ammo={rounds:30,capacity:30,reload:30,store:240,storeMax:240,pickup:30},this.longReloadTime=205,this.shortReloadTime=160,this.weaponName="EggK-47",this.internalName="Eggk47",this.standardMeshName="eggk47",this.automatic=!0,this.damage=30,this.range=20,this.recoil=7,this.rof=3,this.totalDamage=30,this.velocity=1.5,this.accuracyMin=.15,this.accuracyMax=.03,this.accuracyLoss=.05,this.accuracyRecover=.025,this.tracer=1}},o=class extends a{static{t(this,"_DozenGauge")}constructor(){super(),this.ammo={rounds:2,capacity:2,reload:2,store:24,storeMax:24,pickup:8},this.longReloadTime=155,this.shortReloadTime=155,this.weaponName="Scrambler",this.internalName="Dozen Gauge",this.standardMeshName="dozenGauge",this.automatic=!1,this.damage=8.5,this.range=8,this.recoil=10,this.rof=8,this.totalDamage=170,this.velocity=1,this.accuracyMin=.16,this.accuracyMax=.13,this.accuracyLoss=.17,this.accuracyRecover=.02,this.adsMod=.6,this.movementAccuracyMod=.2,this.tracer=0}},r=class extends a{static{t(this,"_CSG1")}constructor(){super(),this.ammo={rounds:15,capacity:15,reload:15,store:60,storeMax:60,pickup:15},this.longReloadTime=225,this.shortReloadTime=165,this.weaponName="Free Ranger",this.internalName="CSG-1",this.standardMeshName="csg1",this.automatic=!1,this.damage=105,this.range=50,this.recoil=13,this.rof=13,this.totalDamage=105,this.velocity=1.75,this.accuracyMin=.3,this.accuracyMax=.004,this.accuracyLoss=.3,this.accuracyRecover=.025,this.tracer=0}},h=class extends a{static{t(this,"_Cluck9mm")}constructor(){super(),this.ammo={rounds:15,capacity:15,reload:15,store:60,storeMax:60,pickup:15},this.longReloadTime=195,this.shortReloadTime=160,this.weaponName="Cluck 9mm",this.internalName="Cluck 9mm",this.standardMeshName="cluck9mm",this.automatic=!1,this.damage=26,this.range=15,this.recoil=6,this.rof=4,this.totalDamage=26,this.velocity=1,this.accuracyMin=.15,this.accuracyMax=.035,this.accuracyLoss=.09,this.accuracyRecover=.08,this.adsMod=.8,this.movementAccuracyMod=.6,this.tracer=0}},m=class extends a{static{t(this,"_RPEGG")}constructor(){super(),this.ammo={rounds:1,capacity:1,reload:1,store:3,storeMax:3,pickup:1},this.longReloadTime=170,this.shortReloadTime=170,this.weaponName="RPEGG",this.internalName="Eggsploder",this.standardMeshName="rpegg",this.automatic=!1,this.damage=140,this.range=45,this.recoil=60,this.rof=40,this.totalDamage=192.5,this.velocity=.4,this.accuracyMin=.3,this.accuracyMax=.015,this.accuracyLoss=.3,this.accuracyRecover=.02,this.radius=2.75}},n=class extends a{static{t(this,"_SMG")}constructor(){super(),this.ammo={rounds:40,capacity:40,reload:40,store:200,storeMax:200,pickup:40},this.longReloadTime=225,this.shortReloadTime=190,this.weaponName="Whipper",this.internalName="SMEGG",this.standardMeshName="smg",this.automatic=!0,this.damage=23,this.range=20,this.recoil=7,this.rof=2,this.totalDamage=23,this.velocity=1.25,this.accuracyMin=.19,this.accuracyMax=.06,this.accuracyLoss=.045,this.accuracyRecover=.05,this.adsMod=.6,this.movementAccuracyMod=.7,this.tracer=2}},u=class extends a{static{t(this,"_M24")}constructor(){super(),this.ammo={rounds:1,capacity:1,reload:1,store:12,storeMax:12,pickup:4},this.longReloadTime=144,this.shortReloadTime=144,this.weaponName="Crackshot",this.internalName="M2DZ",this.standardMeshName="m24",this.automatic=!0,this.damage=170,this.range=60,this.recoil=20,this.rof=15,this.totalDamage=170,this.velocity=2,this.accuracyMin=.35,this.accuracyMax=0,this.accuracyLoss=.1,this.accuracyRecover=.023,this.movementAccuracyMod=1.3,this.reloadBloom=!1,this.reloadTimeMod=.8,this.tracer=0}},l=class extends a{static{t(this,"_AUG")}constructor(){super(),this.ammo={rounds:24,capacity:24,reload:24,store:150,storeMax:150,pickup:24},this.longReloadTime=205,this.shortReloadTime=160,this.weaponName="Tri-Hard",this.internalName="AUG",this.standardMeshName="aug",this.automatic=!1,this.damage=32,this.range=20,this.recoil=18,this.rof=15,this.totalDamage=34,this.velocity=1.5,this.accuracyMin=.15,this.accuracyMax=.03,this.accuracyLoss=.037,this.accuracyRecover=.03,this.adsMod=.6,this.burst=3,this.burstRof=3,this.movementAccuracyMod=.8,this.movementInstability=2,this.tracer=0}};export{l as AUG,r as CSG1,h as Cluck9mm,o as DozenGauge,c as Eggk47,u as M24,m as RPEGG,n as SMG};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import n from"../comm/CommOut.js";import i from"../constants/CommCode.js";import{BanDuration as o}from"../constants/index.js";class a{constructor(e,t,r=""){this.uniqueId=e,this.duration=t,this.reason=r}validate(e){return!(typeof this.uniqueId!="string"||typeof this.reason!="string"||typeof this.duration!="number"||!Object.values(o).some(t=>this.duration===t)||!(e.account.adminRoles&4))}check(){return!0}execute(e){const t=new n;t.packInt8(i.banPlayer),t.packString(this.uniqueId),t.packString(this.reason),t.packInt8(this.duration),t.send(e.game.socket)}}var f=a;export{a as BanPlayerDispatch,f as default};
3
+ var o=Object.defineProperty;var n=(r,e)=>o(r,"name",{value:e,configurable:!0});import a from"../comm/CommOut.js";import s from"../constants/CommCode.js";import{BanDuration as u}from"../constants/index.js";class c{static{n(this,"BanPlayerDispatch")}constructor(e,t,i=""){this.uniqueId=e,this.duration=t,this.reason=i}validate(e){return!(typeof this.uniqueId!="string"||typeof this.reason!="string"||typeof this.duration!="number"||!Object.values(u).some(t=>this.duration===t)||!(e.account.adminRoles&4))}check(){return!0}execute(e){const t=new a;t.packInt8(s.banPlayer),t.packString(this.uniqueId),t.packString(this.reason),t.packInt8(this.duration),t.send(e.game.socket)}}var h=c;export{c as BanPlayerDispatch,h as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import r from"../comm/CommOut.js";import u from"../constants/CommCode.js";class o{constructor(e){this.uniqueId=e}validate(e){return typeof this.uniqueId=="string"&&e.game.isGameOwner&&Object.values(e.players).find(t=>t.uniqueId===this.uniqueId)}check(){return!0}execute(e){const t=new r;t.packInt8(u.bootPlayer),t.packString(this.uniqueId),t.send(e.game.socket)}}var a=o;export{o as BootPlayerDispatch,a as default};
3
+ var o=Object.defineProperty;var u=(r,e)=>o(r,"name",{value:e,configurable:!0});import i from"../comm/CommOut.js";import n from"../constants/CommCode.js";class s{static{u(this,"BootPlayerDispatch")}constructor(e){this.uniqueId=e}validate(e){return typeof this.uniqueId=="string"&&e.game.isGameOwner&&Object.values(e.players).find(t=>t.uniqueId===this.uniqueId)}check(){return!0}execute(e){const t=new i;t.packInt8(n.bootPlayer),t.packString(this.uniqueId),t.send(e.game.socket)}}var d=s;export{s as BootPlayerDispatch,d as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import s from"../comm/CommOut.js";import a from"../constants/CommCode.js";class r{constructor(e){this.msg=e}validate(){return!(typeof this.msg!="string"||this.msg.length<1||this.msg.length>64)}check(e){return!(!e.state.inGame||!e.game.isPrivate&&!e.account.adminRoles&&e.state.chatLines>=2||!e.game.isPrivate&&!e.account.emailVerified&&!e.account.isAged)}execute(e){e.state.chatLines++;const t=new s;t.packInt8(a.chat),t.packString(this.msg),t.send(e.game.socket)}}var m=r;export{r as ChatDispatch,m as default};
3
+ var r=Object.defineProperty;var a=(s,e)=>r(s,"name",{value:e,configurable:!0});import i from"../comm/CommOut.js";import n from"../constants/CommCode.js";class c{static{a(this,"ChatDispatch")}constructor(e){this.msg=e}validate(){return!(typeof this.msg!="string"||this.msg.length<1||this.msg.length>64)}check(e){return!(!e.state?.inGame||!e.game.isPrivate&&!e.account.adminRoles&&e.state.chatLines>=2||!e.game.isPrivate&&!e.account.emailVerified&&!e.account.isAged)}execute(e){e.state.chatLines++;const t=new i;t.packInt8(n.chat),t.packString(this.msg),t.send(e.game.socket)}}var g=c;export{c as ChatDispatch,g as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- class t{constructor(e){this.amount=e||1}validate(){return this.amount>=1}check(e){return e.me.playing&&!e.state.reloading&&!e.state.swappingGun&&!e.state.usingMelee&&e.me.weapons[e.me.activeGun].ammo.rounds>=this.amount}execute(e){e.state.shotsFired+=this.amount||1}}var s=t;export{t as FireDispatch,s as default};
3
+ var s=Object.defineProperty;var a=(t,e)=>s(t,"name",{value:e,configurable:!0});class n{static{a(this,"FireDispatch")}constructor(e){this.amount=e||1}validate(){return this.amount>=1}check(e){return e.me.playing&&!e.state.reloading&&!e.state.swappingGun&&!e.state.usingMelee&&e.me.weapons[e.me.activeGun].ammo.rounds>=this.amount}execute(e){e.state.shotsFired+=this.amount||1}}var u=n;export{n as FireDispatch,u as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- const t=Array.from({length:4},(i,e)=>(e+1)*.25),o=Array.from({length:9},(i,e)=>e*.25),h=Array.from({length:17},(i,e)=>e*.25),s=(i,e)=>typeof i<"u"?i:e;class r{constructor(e){this.changes=e}#e(e){const a={};return a.gravity=s(this.changes.gravity,e.game.options.gravity),a.damage=s(this.changes.damage,e.game.options.damage),a.healthRegen=s(this.changes.healthRegen,e.game.options.healthRegen),a.locked=s(this.changes.locked,e.game.options.locked),a.noTeamChange=s(this.changes.noTeamChange,e.game.options.noTeamChange),a.noTeamShuffle=s(this.changes.noTeamShuffle,e.game.options.noTeamShuffle),a.weaponsDisabled=[s(this.changes.disableEggk,e.game.options.weaponsDisabled[0]),s(this.changes.disableScrambler,e.game.options.weaponsDisabled[1]),s(this.changes.disableFreeRanger,e.game.options.weaponsDisabled[2]),s(this.changes.disableRPG,e.game.options.weaponsDisabled[3]),s(this.changes.disableWhipper,e.game.options.weaponsDisabled[4]),s(this.changes.disableCrackshot,e.game.options.weaponsDisabled[5]),s(this.changes.disableTriHard,e.game.options.weaponsDisabled[6])],this.changes.toDisable&&Array.isArray(this.changes.toDisable)&&this.changes.toDisable.forEach(n=>a.weaponsDisabled[n]=!0),this.changes.toEnable&&Array.isArray(this.changes.toEnable)&&this.changes.toEnable.forEach(n=>a.weaponsDisabled[n]=!1),this.changes.rawWeaponsDisabled&&Array.isArray(this.changes.rawWeaponsDisabled)&&this.changes.rawWeaponsDisabled.length===7&&(a.weaponsDisabled=this.changes.rawWeaponsDisabled.map(n=>!!n)),a.mustUseSecondary=a.weaponsDisabled.every(n=>n),a}validate(e){const a=this.#e(e);return!(!t.includes(a.gravity)||!o.includes(a.damage)||!h.includes(a.healthRegen)||typeof a.locked!="boolean"||typeof a.noTeamChange!="boolean"||typeof a.noTeamShuffle!="boolean"||!Array.isArray(a.weaponsDisabled)||a.weaponsDisabled.length!==7||a.weaponsDisabled.some(n=>typeof n!="boolean"))}check(e){return e.game.isGameOwner}execute(e){e.game.options=this.#e(e),e.updateGameOptions()}}var l=r;export{r as GameOptionsDispatch,l as default};
3
+ var o=Object.defineProperty;var t=(i,e)=>o(i,"name",{value:e,configurable:!0});const h=Array.from({length:4},(i,e)=>(e+1)*.25),r=Array.from({length:9},(i,e)=>e*.25),l=Array.from({length:17},(i,e)=>e*.25),s=t((i,e)=>typeof i<"u"?i:e,"whichever");class g{static{t(this,"GameOptionsDispatch")}constructor(e){this.changes=e}#e(e){const a={};return a.gravity=s(this.changes.gravity,e.game.options.gravity),a.damage=s(this.changes.damage,e.game.options.damage),a.healthRegen=s(this.changes.healthRegen,e.game.options.healthRegen),a.locked=s(this.changes.locked,e.game.options.locked),a.noTeamChange=s(this.changes.noTeamChange,e.game.options.noTeamChange),a.noTeamShuffle=s(this.changes.noTeamShuffle,e.game.options.noTeamShuffle),a.weaponsDisabled=[s(this.changes.disableEggk,e.game.options.weaponsDisabled[0]),s(this.changes.disableScrambler,e.game.options.weaponsDisabled[1]),s(this.changes.disableFreeRanger,e.game.options.weaponsDisabled[2]),s(this.changes.disableRPG,e.game.options.weaponsDisabled[3]),s(this.changes.disableWhipper,e.game.options.weaponsDisabled[4]),s(this.changes.disableCrackshot,e.game.options.weaponsDisabled[5]),s(this.changes.disableTriHard,e.game.options.weaponsDisabled[6])],this.changes.toDisable&&Array.isArray(this.changes.toDisable)&&this.changes.toDisable.forEach(n=>a.weaponsDisabled[n]=!0),this.changes.toEnable&&Array.isArray(this.changes.toEnable)&&this.changes.toEnable.forEach(n=>a.weaponsDisabled[n]=!1),this.changes.rawWeaponsDisabled&&Array.isArray(this.changes.rawWeaponsDisabled)&&this.changes.rawWeaponsDisabled.length===7&&(a.weaponsDisabled=this.changes.rawWeaponsDisabled.map(n=>!!n)),a.mustUseSecondary=a.weaponsDisabled.every(n=>n),a}validate(e){const a=this.#e(e);return!(!h.includes(a.gravity)||!r.includes(a.damage)||!l.includes(a.healthRegen)||typeof a.locked!="boolean"||typeof a.noTeamChange!="boolean"||typeof a.noTeamShuffle!="boolean"||!Array.isArray(a.weaponsDisabled)||a.weaponsDisabled.length!==7||a.weaponsDisabled.some(n=>typeof n!="boolean"))}check(e){return e.game.isGameOwner}execute(e){e.game.options=this.#e(e),e.updateGameOptions()}}var p=g;export{g as GameOptionsDispatch,p as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import m from"../pathing/astar.js";class g{validate(t){return t.intents.includes(t.Intents.PATHFINDING)}check(t){return t.me.playing&&t.game.collectables[0].length}execute(t){this.pather=new m(t.pathing.nodeList);let a=200,n=null;for(const e of t.game.collectables[0]){const i=e.x-t.me.position.x,s=e.y-t.me.position.y,o=e.z-t.me.position.z,r=Math.sqrt(i*i+s*s+o*o);r<a&&(a=r,n=e)}const c=Object.entries(t.me.position).map(e=>Math.floor(e[1])),h=Object.entries(n).map(e=>Math.floor(e[1])),p=t.pathing.nodeList.at(...c),l=t.pathing.nodeList.at(...h);if(t.pathing.activePath=this.pather.path(p,l),!t.pathing.activePath)return t.processError("no path found");if(t.pathing.activePath.length<2)return t.processError("path too short");t.pathing.followingPath=!0,t.pathing.activeNode=t.pathing.activePath[1],t.pathing.activeNodeIdx=1}}var u=g;export{g as GoToAmmoDispatch,u as default};
3
+ var d=Object.defineProperty;var h=(a,t)=>d(a,"name",{value:t,configurable:!0});import f from"../pathing/astar.js";class u{static{h(this,"GoToAmmoDispatch")}validate(t){return t.intents.includes(t.Intents.PATHFINDING)}check(t){return t.me.playing&&t.game.collectables[0].length}execute(t){this.pather=new f(t.pathing.nodeList);let n=200,i=null;for(const e of t.game.collectables[0]){const s=e.x-t.me.position.x,o=e.y-t.me.position.y,r=e.z-t.me.position.z,c=Math.sqrt(s*s+o*o+r*r);c<n&&(n=c,i=e)}const p=Object.entries(t.me.position).map(e=>Math.floor(e[1])),l=Object.entries(i).map(e=>Math.floor(e[1])),m=t.pathing.nodeList.at(...p),g=t.pathing.nodeList.at(...l);if(t.pathing.activePath=this.pather.path(m,g),!t.pathing.activePath)return t.processError("no path found");if(t.pathing.activePath.length<2)return t.processError("path too short");t.pathing.followingPath=!0,t.pathing.activeNode=t.pathing.activePath[1],t.pathing.activeNodeIdx=1}}var P=u;export{u as GoToAmmoDispatch,P as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import d from"../pathing/astar.js";class l{validate(t){return t.intents.includes(t.Intents.PATHFINDING)}check(t){return t.me.playing&&t.game.zoneNumber&&t.game.activeZone}execute(t){this.pather=new d(t.pathing.nodeList);let n=200,a=null;for(const e of t.game.activeZone){const i=e.x-t.me.position.x,o=e.y-t.me.position.y,s=e.z-t.me.position.z,r=Math.sqrt(i*i+o*o+s*s);r<n&&(n=r,a=e)}const c=Object.entries(t.me.position).map(e=>Math.floor(e[1])),p=Object.entries(a).map(e=>Math.floor(e[1])),h=t.pathing.nodeList.at(...c),g=t.pathing.nodeList.at(...p);if(t.pathing.activePath=this.pather.path(h,g),!t.pathing.activePath)return t.processError("no path found");if(t.pathing.activePath.length<2)return t.processError("path too short");t.pathing.followingPath=!0,t.pathing.activeNode=t.pathing.activePath[1],t.pathing.activeNodeIdx=1}}var u=l;export{l as GoToCoopDispatch,u as default};
3
+ var m=Object.defineProperty;var p=(n,t)=>m(n,"name",{value:t,configurable:!0});import f from"../pathing/astar.js";class u{static{p(this,"GoToCoopDispatch")}validate(t){return t.intents.includes(t.Intents.PATHFINDING)}check(t){return t.me.playing&&t.game.zoneNumber&&t.game.activeZone}execute(t){this.pather=new f(t.pathing.nodeList);let a=200,i=null;for(const e of t.game.activeZone){const o=e.x-t.me.position.x,s=e.y-t.me.position.y,r=e.z-t.me.position.z,c=Math.sqrt(o*o+s*s+r*r);c<a&&(a=c,i=e)}const h=Object.entries(t.me.position).map(e=>Math.floor(e[1])),g=Object.entries(i).map(e=>Math.floor(e[1])),d=t.pathing.nodeList.at(...h),l=t.pathing.nodeList.at(...g);if(t.pathing.activePath=this.pather.path(d,l),!t.pathing.activePath)return t.processError("no path found");if(t.pathing.activePath.length<2)return t.processError("path too short");t.pathing.followingPath=!0,t.pathing.activeNode=t.pathing.activePath[1],t.pathing.activeNodeIdx=1}}var N=u;export{u as GoToCoopDispatch,N as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import d from"../pathing/astar.js";class g{validate(t){return t.intents.includes(t.Intents.PATHFINDING)}check(t){return t.me.playing&&t.game.collectables[1].length}execute(t){this.pather=new d(t.pathing.nodeList);let n=200,a=null;for(const e of t.game.collectables[1]){const i=e.x-t.me.position.x,s=e.y-t.me.position.y,r=e.z-t.me.position.z,o=Math.sqrt(i*i+s*s+r*r);o<n&&(n=o,a=e)}const c=Object.entries(t.me.position).map(e=>Math.floor(e[1])),h=Object.entries(a).map(e=>Math.floor(e[1])),p=t.pathing.nodeList.at(...c),l=t.pathing.nodeList.at(...h);if(t.pathing.activePath=this.pather.path(p,l),!t.pathing.activePath)return t.processError("no path found");if(t.pathing.activePath.length<2)return t.processError("path too short");t.pathing.followingPath=!0,t.pathing.activeNode=t.pathing.activePath[1],t.pathing.activeNodeIdx=1}}var u=g;export{g as GoToGrenadeDispatch,u as default};
3
+ var m=Object.defineProperty;var h=(n,t)=>m(n,"name",{value:t,configurable:!0});import f from"../pathing/astar.js";class u{static{h(this,"GoToGrenadeDispatch")}validate(t){return t.intents.includes(t.Intents.PATHFINDING)}check(t){return t.me.playing&&t.game.collectables[1].length}execute(t){this.pather=new f(t.pathing.nodeList);let a=200,i=null;for(const e of t.game.collectables[1]){const s=e.x-t.me.position.x,r=e.y-t.me.position.y,o=e.z-t.me.position.z,c=Math.sqrt(s*s+r*r+o*o);c<a&&(a=c,i=e)}const p=Object.entries(t.me.position).map(e=>Math.floor(e[1])),l=Object.entries(i).map(e=>Math.floor(e[1])),d=t.pathing.nodeList.at(...p),g=t.pathing.nodeList.at(...l);if(t.pathing.activePath=this.pather.path(d,g),!t.pathing.activePath)return t.processError("no path found");if(t.pathing.activePath.length<2)return t.processError("path too short");t.pathing.followingPath=!0,t.pathing.activeNode=t.pathing.activePath[1],t.pathing.activeNodeIdx=1}}var P=u;export{u as GoToGrenadeDispatch,P as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import h from"../pathing/astar.js";class p{idOrName;constructor(t){this.idOrName=t}validate(t){return!t.intents.includes(t.Intents.PATHFINDING)||!this.idOrName?!1:!!(t.players[this.idOrName.toString()]||t.players.find(i=>i.name===this.idOrName))}check(t){if(!t.me.playing)return!1;const e=t.players[this.idOrName.toString()]||t.players.find(i=>i.name===this.idOrName);return e&&e.playing&&e.position&&e.position.x}execute(t){this.pather=new h(t.pathing.nodeList);const e=t.players[this.idOrName.toString()]||t.players.find(a=>a.name===this.idOrName),i=Object.entries(t.me.position).map(a=>Math.floor(a[1])),r=Object.entries(e.position).map(a=>Math.floor(a[1])),n=t.pathing.nodeList.at(...i),s=t.pathing.nodeList.at(...r);if(t.pathing.activePath=this.pather.path(n,s),!t.pathing.activePath)return t.processError("no path found");if(t.pathing.activePath.length<2)return t.processError("path too short");t.pathing.followingPath=!0,t.pathing.activeNode=t.pathing.activePath[1],t.pathing.activeNodeIdx=1}}var d=p;export{p as GoToPlayerDispatch,d as default};
3
+ var o=Object.defineProperty;var n=(r,t)=>o(r,"name",{value:t,configurable:!0});import c from"../pathing/astar.js";class d{static{n(this,"GoToPlayerDispatch")}idOrName;constructor(t){this.idOrName=t}validate(t){return!t.intents.includes(t.Intents.PATHFINDING)||!this.idOrName?!1:!!(t.players[this.idOrName.toString()]||t.players.find(i=>i.name===this.idOrName))}check(t){if(!t.me.playing)return!1;const e=t.players[this.idOrName.toString()]||t.players.find(i=>i.name===this.idOrName);return e&&e.playing&&e.position&&e.position.x}execute(t){this.pather=new c(t.pathing.nodeList);const e=t.players[this.idOrName.toString()]||t.players.find(a=>a.name===this.idOrName),i=Object.entries(t.me.position).map(a=>Math.floor(a[1])),s=Object.entries(e.position).map(a=>Math.floor(a[1])),h=t.pathing.nodeList.at(...i),p=t.pathing.nodeList.at(...s);if(t.pathing.activePath=this.pather.path(h,p),!t.pathing.activePath)return t.processError("no path found");if(t.pathing.activePath.length<2)return t.processError("path too short");t.pathing.followingPath=!0,t.pathing.activeNode=t.pathing.activePath[1],t.pathing.activeNodeIdx=1}}var m=d;export{d as GoToPlayerDispatch,m as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import s from"../pathing/astar.js";class p{validate(t){return t.intents.includes(t.Intents.PATHFINDING)}check(t){return t.me.playing&&t.game.spatula&&t.game.spatula.coords&&t.game.spatula.coords.x}execute(t){this.pather=new s(t.pathing.nodeList);const e=Object.entries(t.me.position).map(a=>Math.floor(a[1])),i=Object.entries(t.game.spatula.coords).map(a=>Math.floor(a[1])),n=t.pathing.nodeList.at(...e),r=t.pathing.nodeList.at(...i);if(t.pathing.activePath=this.pather.path(n,r),!t.pathing.activePath)return t.processError("no path found");if(t.pathing.activePath.length<2)return t.processError("path too short");t.pathing.followingPath=!0,t.pathing.activeNode=t.pathing.activePath[1],t.pathing.activeNodeIdx=1}}var c=p;export{p as GoToSpatulaDispatch,c as default};
3
+ var h=Object.defineProperty;var i=(e,t)=>h(e,"name",{value:t,configurable:!0});import o from"../pathing/astar.js";class c{static{i(this,"GoToSpatulaDispatch")}validate(t){return t.intents.includes(t.Intents.PATHFINDING)}check(t){return t.me.playing&&t.game.spatula&&t.game.spatula.coords&&t.game.spatula.coords.x}execute(t){this.pather=new o(t.pathing.nodeList);const n=Object.entries(t.me.position).map(a=>Math.floor(a[1])),r=Object.entries(t.game.spatula.coords).map(a=>Math.floor(a[1])),s=t.pathing.nodeList.at(...n),p=t.pathing.nodeList.at(...r);if(t.pathing.activePath=this.pather.path(s,p),!t.pathing.activePath)return t.processError("no path found");if(t.pathing.activePath.length<2)return t.processError("path too short");t.pathing.followingPath=!0,t.pathing.activeNode=t.pathing.activePath[1],t.pathing.activeNodeIdx=1}}var l=c;export{c as GoToSpatulaDispatch,l as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- const c=(i,t)=>(i%t+t)%t,p=Math.PI*2,n=i=>Math.round(i*8192)/8192,h=i=>n(c(Math.atan2(-i.x,-i.z),p)),d=i=>n(Math.atan2(i.y,Math.hypot(i.x,i.z)));class l{idOrName;constructor(t){this.idOrName=t}validate(t){return!!(t.players[this.idOrName.toString()]||t.players.find(e=>e.name===this.idOrName))}check(t){if(!t.me.playing)return!1;const a=t.players[this.idOrName.toString()]||t.players.find(e=>e.name===this.idOrName);return a&&a.playing&&a.position&&a.position.x}execute(t){const a=t.players[this.idOrName.toString()]||t.players.find(o=>o.name===this.idOrName),e={x:a.position.x-t.me.position.x,y:a.position.y-t.me.position.y-.05,z:a.position.z-t.me.position.z},s=h(e),r=d(e);t.state.yaw=s,t.state.pitch=r}}var y=l;export{l as LookAtDispatch,y as default};
3
+ var p=Object.defineProperty;var n=(i,t)=>p(i,"name",{value:t,configurable:!0});const h=n((i,t)=>(i%t+t)%t,"mod"),d=Math.PI*2,s=n(i=>Math.round(i*8192)/8192,"setPrecision"),l=n(i=>s(h(Math.atan2(-i.x,-i.z),d)),"calculateYaw"),y=n(i=>s(Math.atan2(i.y,Math.hypot(i.x,i.z))),"calculatePitch");class m{static{n(this,"LookAtDispatch")}idOrName;constructor(t){this.idOrName=t}validate(t){return!!(t.players[this.idOrName.toString()]||t.players.find(e=>e.name===this.idOrName))}check(t){if(!t.me.playing)return!1;const a=t.players[this.idOrName.toString()]||t.players.find(e=>e.name===this.idOrName);return a&&a.playing&&a.position&&a.position.x}execute(t){const a=t.players[this.idOrName.toString()]||t.players.find(c=>c.name===this.idOrName),e={x:a.position.x-t.me.position.x,y:a.position.y-t.me.position.y-.05,z:a.position.z-t.me.position.z},r=l(e),o=y(e);t.state.yaw=r,t.state.pitch=o}}var u=m;export{m as LookAtDispatch,u as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- const e=(s,t)=>(s%t+t)%t,n=Math.PI*2,c=s=>Math.round(s*8192)/8192,h=s=>c(e(Math.atan2(-s.x,-s.z),n)),p=s=>c(Math.atan2(s.y,Math.hypot(s.x,s.z)));class r{constructor(t){this.pos=t}validate(){return this.pos&&this.pos.x&&this.pos.y&&this.pos.z}check(t){return t.me.playing}execute(t){const o={x:this.pos.x-t.me.position.x,y:this.pos.y-t.me.position.y,z:this.pos.z-t.me.position.z},a=h(o),i=p(o);t.state.yaw=a,t.state.pitch=i}}var x=r;export{r as LookAtPosDispatch,x as default};
3
+ var n=Object.defineProperty;var o=(s,t)=>n(s,"name",{value:t,configurable:!0});const h=o((s,t)=>(s%t+t)%t,"mod"),p=Math.PI*2,a=o(s=>Math.round(s*8192)/8192,"setPrecision"),r=o(s=>a(h(Math.atan2(-s.x,-s.z),p)),"calculateYaw"),x=o(s=>a(Math.atan2(s.y,Math.hypot(s.x,s.z))),"calculatePitch");class y{static{o(this,"LookAtPosDispatch")}constructor(t){this.pos=t}validate(){return this.pos&&this.pos.x&&this.pos.y&&this.pos.z}check(t){return t.me.playing}execute(t){const c={x:this.pos.x-t.me.position.x,y:this.pos.y-t.me.position.y,z:this.pos.z-t.me.position.z},i=r(c),e=x(c);t.state.yaw=i,t.state.pitch=e}}var u=y;export{y as LookAtPosDispatch,u as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import s from"../comm/CommOut.js";import u from"../constants/CommCode.js";import{GunEquipTime as n}from"../constants/index.js";class a{validate(){return!0}check(e){return e.me.playing&&!e.state.reloading&&!e.state.swappingGun&&!e.state.usingMelee}execute(e){const t=new s;t.packInt8(u.melee),t.send(e.game.socket),e.usingMelee=!0,setTimeout(()=>{e.usingMelee=!1,e.swappingGun=!0,setTimeout(()=>{e.swappingGun=!1},.5*n)},100/3*17)}}var l=a;export{a as MeleeDispatch,l as default};
3
+ var n=Object.defineProperty;var u=(t,e)=>n(t,"name",{value:e,configurable:!0});import a from"../comm/CommOut.js";import i from"../constants/CommCode.js";import{GunEquipTime as m}from"../constants/index.js";class r{static{u(this,"MeleeDispatch")}validate(){return!0}check(e){return e.me.playing&&!e.state.reloading&&!e.state.swappingGun&&!e.state.usingMelee}execute(e){const s=new a;s.packInt8(i.melee),s.send(e.game.socket),e.usingMelee=!0,setTimeout(()=>{e.usingMelee=!1,e.swappingGun=!0,setTimeout(()=>{e.swappingGun=!1},.5*m)},100/3*17)}}var c=r;export{r as MeleeDispatch,c as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import{Movement as t}from"../constants/index.js";class s{constructor(e){typeof e=="number"?this.inputKeys=e:typeof e==typeof[]&&(this.inputKeys=e.reduce((i,r)=>i|r,0))}validate(){return!(typeof this.inputKeys!="number"||this.inputKeys&t.Forward&&this.inputKeys&t.Backward||this.inputKeys&t.Left&&this.inputKeys&t.Right)}check(e){return e.me.playing}execute(e){e.state.controlKeys=this.inputKeys}}var o=s;export{s as MovementDispatch,o as default};
3
+ var n=Object.defineProperty;var r=(i,e)=>n(i,"name",{value:e,configurable:!0});import{Movement as t}from"../constants/index.js";class o{static{r(this,"MovementDispatch")}constructor(e){typeof e=="number"?this.inputKeys=e:typeof e==typeof[]&&(this.inputKeys=e.reduce((s,f)=>s|f,0))}validate(){return!(typeof this.inputKeys!="number"||this.inputKeys&t.Forward&&this.inputKeys&t.Backward||this.inputKeys&t.Left&&this.inputKeys&t.Right)}check(e){return e.me.playing}execute(e){e.state.controlKeys=this.inputKeys}}var a=o;export{o as MovementDispatch,a as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import a from"../comm/CommOut.js";import m from"../constants/CommCode.js";class o{validate(){return!0}check(e){return e.me.playing}execute(e){const t=new a;t.packInt8(m.pause),t.send(e.game.socket),setTimeout(()=>e.me.playing=!1,3e3)}}var p=o;export{o as PauseDispatch,p as default};
3
+ var o=Object.defineProperty;var m=(t,e)=>o(t,"name",{value:e,configurable:!0});import r from"../comm/CommOut.js";import s from"../constants/CommCode.js";class u{static{m(this,"PauseDispatch")}validate(){return!0}check(e){return e.me.playing}execute(e){const a=new r;a.packInt8(s.pause),a.send(e.game.socket),setTimeout(()=>e.me.playing=!1,3e3)}}var i=u;export{u as PauseDispatch,i as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import s from"../comm/CommOut.js";import r from"../constants/CommCode.js";class i{validate(){return!0}check(e){return e.me.playing&&!e.state.reloading&&!e.state.swappingGun&&!e.state.usingMelee}execute(e){const o=new s;o.packInt8(r.reload),o.send(e.game.socket);const a=e.me.weapons[e.me.activeGun];if(a.ammo){const t=Math.min(Math.min(a.ammo.capacity,a.ammo.reload)-a.ammo.rounds,a.ammo.store);a.ammo.rounds+=t,a.ammo.store-=t}e.emit("playerReload",e.me,a);const m=e.me.weapons[e.me.activeGun],n=m.ammo.rounds<1;e.state.reloading=!0,setTimeout(()=>e.state.reloading=!1,n?m.longReloadTime:m.shortReloadTime)}}var u=i;export{i as ReloadDispatch,u as default};
3
+ var i=Object.defineProperty;var s=(o,e)=>i(o,"name",{value:e,configurable:!0});import c from"../comm/CommOut.js";import l from"../constants/CommCode.js";class d{static{s(this,"ReloadDispatch")}validate(){return!0}check(e){return e.me.playing&&!e.state.reloading&&!e.state.swappingGun&&!e.state.usingMelee}execute(e){const t=new c;t.packInt8(l.reload),t.send(e.game.socket);const a=e.me.weapons[e.me.activeGun];if(a.ammo){const n=Math.min(Math.min(a.ammo.capacity,a.ammo.reload)-a.ammo.rounds,a.ammo.store);a.ammo.rounds+=n,a.ammo.store-=n}e.emit("playerReload",e.me,a);const m=e.me.weapons[e.me.activeGun],r=m.ammo.rounds<1;e.state.reloading=!0,setTimeout(()=>e.state.reloading=!1,r?m.longReloadTime:m.shortReloadTime)}}var f=d;export{d as ReloadDispatch,f as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import a from"../comm/CommOut.js";import i from"../constants/CommCode.js";class n{constructor(r,e={}){this.idOrName=r,this.reasons=[!!e.cheating,!!e.harassment,!!e.offensive,!!e.other],this.reasons.includes(!0)||(this.reasons[3]=!0);for(let t=0;t<this.reasons.length;t++)this.reasons[t]===!0&&(this.reasonInt|=1<<t)}validate(){return!(this.reasons.every(e=>e===!1)||!(bot.players[this.idOrName.toString()]||bot.players.find(e=>e.name===this.idOrName)))}check(r){return r.state.inGame?!!(r.players[this.idOrName.toString()]||r.players.find(t=>t.name===this.idOrName)):!1}execute(r){const e=r.players[this.idOrName.toString()]||r.players.find(s=>s.name===this.idOrName),t=new a;t.packInt8(i.reportPlayer),t.packString(e.uniqueId),t.packInt8(this.reasonInt),t.send(r.game.socket)}}var f=n;export{n as ReportPlayerDispatch,f as default};
3
+ var n=Object.defineProperty;var a=(s,e)=>n(s,"name",{value:e,configurable:!0});import o from"../comm/CommOut.js";import h from"../constants/CommCode.js";class m{static{a(this,"ReportPlayerDispatch")}constructor(e,t={}){this.idOrName=e,this.reasons=[!!t.cheating,!!t.harassment,!!t.offensive,!!t.other],this.reasons.includes(!0)||(this.reasons[3]=!0);for(let r=0;r<this.reasons.length;r++)this.reasons[r]===!0&&(this.reasonInt|=1<<r)}validate(){return!(this.reasons.every(t=>t===!1)||!(bot.players[this.idOrName.toString()]||bot.players.find(t=>t.name===this.idOrName)))}check(e){return e.state.inGame?!!(e.players[this.idOrName.toString()]||e.players.find(r=>r.name===this.idOrName)):!1}execute(e){const t=e.players[this.idOrName.toString()]||e.players.find(i=>i.name===this.idOrName),r=new o;r.packInt8(h.reportPlayer),r.packString(t.uniqueId),r.packInt8(this.reasonInt),r.send(e.game.socket)}}var u=m;export{m as ReportPlayerDispatch,u as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import l from"../comm/CommOut.js";import o from"../constants/CommCode.js";import{findItemById as t,GunList as f,ItemType as m}from"../constants/index.js";const i=n=>t(n)&&t(n).unlock==="default",I=(n,e)=>t(n)&&t(n).item_type_id===e;class u{constructor(e){this.changes={classIdx:e.gunId,hatId:e.hatId,stampId:e.stampId,grenadeId:e.grenadeId,meleeId:e.meleeId,colorIdx:e.eggColor,primaryId:e.primaryIds,secondaryId:e.secondaryIds},this.changes=Object.fromEntries(Object.entries(this.changes).filter(([,s])=>!!s))}validate(e){const s=this.changes;if(s.colorIdx&&s.colorIdx>=7&&!e.account.vip||s.colorIdx&&s.colorIdx>=14||I(s.hatId,m.Hat)&&!i(s.hatId)&&!e.account.ownedItemIds.includes(s.hatId)||I(s.stampId,m.Stamp)&&!i(s.stampId)&&!e.account.ownedItemIds.includes(s.stampId)||I(s.grenadeId,m.Grenade)&&!i(s.grenadeId)&&!e.account.ownedItemIds.includes(s.grenadeId)||I(s.meleeId,m.Melee)&&!i(s.meleeId)&&!e.account.ownedItemIds.includes(s.meleeId)||typeof s.classIdx=="number"&&s.classIdx>6||s.classIdx<0)return!1;if(this.changes.primaryId)for(let c=0;c<7;c++){const d=this.changes.primaryId[c];if(!I(d,ItemTypes.Primary)||!i(d)&&!e.account.ownedItemIds.includes(d))return!1}if(this.changes.secondaryId)for(let c=0;c<7;c++){const d=this.changes.secondaryId[c];if(!I(d,ItemTypes.Secondary)||!i(d)&&!e.account.ownedItemIds.includes(d))return!1}return!0}check(e){return!e.me.playing}execute(e){e.me&&this.changes.classIdx&&this.changes.classIdx!==e.me.selectedGun&&(e.me.weapons[0]=new f[this.changes.classIdx]),e.state.weaponIdx=this.changes.classIdx||e.state.weaponIdx;const s={...e.account.loadout,...this.changes},c=e.api.queryServices({cmd:"saveLoadout",save:!0,firebaseId:e.account.firebaseId,sessionId:e.account.sessionId,loadout:s});e.account.loadout=s,e.me&&c.then(()=>{if(e.state.inGame){const r=new l;r.packInt8(o.changeCharacter),r.packInt8(this.changes?.classIdx||e.me.selectedGun),r.send(e.game.socket)}const d=e.intents.includes(e.Intents.COSMETIC_DATA);Object.entries(this.changes).forEach(([r,a])=>{r==="classIdx"?e.me.selectedGun=a:r==="hatId"?e.me.character.hat=d?t(a):a:r==="stampId"?e.me.character.stamp=d?t(a):a:r==="grenadeId"?e.me.character.grenade=d?t(a):a:r==="meleeId"?e.me.character.melee=d?t(a):a:r==="colorIdx"?e.me.character.eggColor=a:r==="primaryId"?e.me.character.primaryGun=d?t(a[e.me.selectedGun]):a:r==="secondaryId"&&(e.me.character.secondaryGun=d?t(a[e.me.selectedGun]):a)})})}}var y=u;export{u as SaveLoadoutDispatch,y as default};
3
+ var o=Object.defineProperty;var m=(n,e)=>o(n,"name",{value:e,configurable:!0});import f from"../comm/CommOut.js";import u from"../constants/CommCode.js";import{findItemById as t,GunList as h,ItemType as l}from"../constants/index.js";const i=m(n=>t(n)&&t(n).unlock==="default","isDefault"),I=m((n,e)=>t(n)&&t(n).item_type_id===e,"isType");class p{static{m(this,"SaveLoadoutDispatch")}constructor(e){this.changes={classIdx:e.gunId,hatId:e.hatId,stampId:e.stampId,grenadeId:e.grenadeId,meleeId:e.meleeId,colorIdx:e.eggColor,primaryId:e.primaryIds,secondaryId:e.secondaryIds},this.changes=Object.fromEntries(Object.entries(this.changes).filter(([,s])=>!!s))}validate(e){const s=this.changes;if(s.colorIdx&&s.colorIdx>=7&&!e.account.vip||s.colorIdx&&s.colorIdx>=14||I(s.hatId,l.Hat)&&!i(s.hatId)&&!e.account.ownedItemIds.includes(s.hatId)||I(s.stampId,l.Stamp)&&!i(s.stampId)&&!e.account.ownedItemIds.includes(s.stampId)||I(s.grenadeId,l.Grenade)&&!i(s.grenadeId)&&!e.account.ownedItemIds.includes(s.grenadeId)||I(s.meleeId,l.Melee)&&!i(s.meleeId)&&!e.account.ownedItemIds.includes(s.meleeId)||typeof s.classIdx=="number"&&s.classIdx>6||s.classIdx<0)return!1;if(this.changes.primaryId)for(let c=0;c<7;c++){const d=this.changes.primaryId[c];if(!I(d,ItemTypes.Primary)||!i(d)&&!e.account.ownedItemIds.includes(d))return!1}if(this.changes.secondaryId)for(let c=0;c<7;c++){const d=this.changes.secondaryId[c];if(!I(d,ItemTypes.Secondary)||!i(d)&&!e.account.ownedItemIds.includes(d))return!1}return!0}check(e){return!e.me.playing}execute(e){e.me&&this.changes.classIdx&&this.changes.classIdx!==e.me.selectedGun&&(e.me.weapons[0]=new h[this.changes.classIdx]),e.state.weaponIdx=this.changes.classIdx||e.state.weaponIdx;const s={...e.account.loadout,...this.changes},c=e.api.queryServices({cmd:"saveLoadout",save:!0,firebaseId:e.account.firebaseId,sessionId:e.account.sessionId,loadout:s});e.account.loadout=s,e.me&&c.then(()=>{if(e.state.inGame){const r=new f;r.packInt8(u.changeCharacter),r.packInt8(this.changes?.classIdx||e.me.selectedGun),r.send(e.game.socket)}const d=e.intents.includes(e.Intents.COSMETIC_DATA);Object.entries(this.changes).forEach(([r,a])=>{r==="classIdx"?e.me.selectedGun=a:r==="hatId"?e.me.character.hat=d?t(a):a:r==="stampId"?e.me.character.stamp=d?t(a):a:r==="grenadeId"?e.me.character.grenade=d?t(a):a:r==="meleeId"?e.me.character.melee=d?t(a):a:r==="colorIdx"?e.me.character.eggColor=a:r==="primaryId"?e.me.character.primaryGun=d?t(a[e.me.selectedGun]):a:r==="secondaryId"&&(e.me.character.secondaryGun=d?t(a[e.me.selectedGun]):a)})})}}var G=p;export{p as SaveLoadoutDispatch,G as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import r from"../comm/CommOut.js";import n from"../constants/CommCode.js";class a{validate(){return!0}check(e){return!(e.me.playing||e.lastDeathTime+6e3<Date.now()||e.intents.includes(e.Intents.OBSERVE_GAME))}execute(e){const t=new r;t.packInt8(n.requestRespawn),t.send(e.game.socket),e.state.buffer=[]}}var i=a;export{a as SpawnDispatch,i as default};
3
+ var a=Object.defineProperty;var n=(t,e)=>a(t,"name",{value:e,configurable:!0});import s from"../comm/CommOut.js";import u from"../constants/CommCode.js";class f{static{n(this,"SpawnDispatch")}validate(){return!0}check(e){return!(e.me.playing||e.lastDeathTime+6e3<Date.now()||e.intents.includes(e.Intents.OBSERVE_GAME))}execute(e){const r=new s;r.packInt8(u.requestRespawn),r.send(e.game.socket),e.state.buffer=[]}}var l=f;export{f as SpawnDispatch,l as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import t from"../comm/CommOut.js";import p from"../constants/CommCode.js";class m{constructor(e){this.manualWeapon=e}validate(){return typeof this.manualWeapon=="number"||this.manualWeapon===void 0}check(e){return e.me.playing&&!e.state.reloading&&!e.state.swappingGun&&!e.state.usingMelee}execute(e){let n=+!e.me.activeGun;typeof this.manualWeapon=="number"&&(n=this.manualWeapon),e.me.activeGun=n;const a=new t;a.packInt8(p.swapWeapon),a.packInt8(e.me.activeGun),a.send(e.game.socket)}}var i=m;export{m as SwapWeaponDispatch,i as default};
3
+ var m=Object.defineProperty;var p=(n,e)=>m(n,"name",{value:e,configurable:!0});import o from"../comm/CommOut.js";import u from"../constants/CommCode.js";class s{static{p(this,"SwapWeaponDispatch")}constructor(e){this.manualWeapon=e}validate(){return typeof this.manualWeapon=="number"||this.manualWeapon===void 0}check(e){return e.me.playing&&!e.state.reloading&&!e.state.swappingGun&&!e.state.usingMelee}execute(e){let t=+!e.me.activeGun;typeof this.manualWeapon=="number"&&(t=this.manualWeapon),e.me.activeGun=t;const a=new o;a.packInt8(u.swapWeapon),a.packInt8(e.me.activeGun),a.send(e.game.socket)}}var l=s;export{s as SwapWeaponDispatch,l as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import m from"../comm/CommOut.js";import i from"../constants/CommCode.js";class l{validate(){return!0}check(e){if(!e.state.inGame||e.me.playing||e.game.gameModeId===0||e.intents.includes(e.Intents.OBSERVE_GAME))return!1;if(e.game.isPrivate)return!e.game.options.noTeamChange;const t=e.players,r=e.me.team,n=t.filter(a=>a.team===r).length,s=t.filter(a=>a.team!==r).length;return!(s>n||n===s)}execute(e){const t=new m;t.packInt8(i.switchTeam),t.send(e.game.socket)}}var o=l;export{l as SwitchTeamDispatch,o as default};
3
+ var l=Object.defineProperty;var i=(r,e)=>l(r,"name",{value:e,configurable:!0});import f from"../comm/CommOut.js";import u from"../constants/CommCode.js";class c{static{i(this,"SwitchTeamDispatch")}validate(){return!0}check(e){if(!e.state.inGame||e.me.playing||e.game.gameModeId===0||e.intents.includes(e.Intents.OBSERVE_GAME))return!1;if(e.game.isPrivate)return!e.game.options.noTeamChange;const t=e.players,n=e.me.team,s=t.filter(a=>a.team===n).length,m=t.filter(a=>a.team!==n).length;return!(m>s||s===m)}execute(e){const t=new f;t.packInt8(u.switchTeam),t.send(e.game.socket)}}var g=c;export{c as SwitchTeamDispatch,g as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import r from"../comm/CommOut.js";import o from"../constants/CommCode.js";class a{constructor(e=1){this.power=e}validate(){return typeof this.power=="number"&&this.power>=0&&this.power<=1}check(e){return e.me.playing&&!e.state.reloading&&!e.state.swappingGun&&!e.state.usingMelee}execute(e){const t=new r;t.packInt8(o.throwGrenade),t.packFloat(this.power),t.send(e.game.socket)}}var i=a;export{a as ThrowGrenadeDispatch,i as default};
3
+ var a=Object.defineProperty;var o=(r,e)=>a(r,"name",{value:e,configurable:!0});import s from"../comm/CommOut.js";import p from"../constants/CommCode.js";class n{static{o(this,"ThrowGrenadeDispatch")}constructor(e=1){this.power=e}validate(){return typeof this.power=="number"&&this.power>=0&&this.power<=1}check(e){return e.me.playing&&!e.state.reloading&&!e.state.swappingGun&&!e.state.usingMelee}execute(e){const t=new s;t.packInt8(p.throwGrenade),t.packFloat(this.power),t.send(e.game.socket)}}var u=n;export{n as ThrowGrenadeDispatch,u as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import r from"./api.js";import{ProxiesEnabled as h}from"./constants/index.js";import{validate as c}from"./wasm/wrapper.js";import f from"./socket.js";class d{connected=!1;onceConnected=[];regionList=[];proxy=null;sessionId="";onListeners=new Map;onceListeners=new Map;#e=!1;#t=!1;constructor(s={}){this.#e=s.noExitOnError||!1,s.instance||(s.instance="shellshock.io"),s.protocol||(s.protocol="wss"),s.api?this.api=s.api:this.api=new r({instance:s.instance,protocol:s.protocol,proxy:s.proxy}),s.sessionId||s.noLogin?this.sessionId=s.sessionId:this.#n(),s.proxy&&!h?this.#i("proxies do not work and hence are not supported in the browser"):s.proxy&&(this.proxy=s.proxy),this.#o(s.instance,s.protocol,s.noLogin)}async#o(s,i,e){if(this.ws=new f(`${i}://${s}/matchmaker/`,this.proxy),!await this.ws.tryConnect())return this.#i("WebSocket did not connect...");this.ws.onmessage=o=>{const n=JSON.parse(o.data);if(n.command==="validateUUID")return this.ws.send(JSON.stringify({command:"validateUUID",hash:c(n.uuid)}));this.#s("msg",n)},this.ws.onclose=()=>{this.connected=!1,this.#t||this.#o(s,i,e)},this.connected=!0,(this.sessionId||e)&&this.onceConnected.forEach(o=>o())}async#n(){const s=await this.api.loginAnonymously();(!s||typeof s=="string")&&this.#s("authFail",s),this.sessionId=s.sessionId,this.connected&&this.onceConnected.forEach(i=>i())}send(s){this.ws.send(JSON.stringify(s))}async waitForConnect(){return new Promise(s=>{this.connected?s():this.onceConnected.push(s)})}async getRegions(){await this.waitForConnect();const s=this;return new Promise(i=>{const e=t=>{t.command==="regionList"&&(this.regionList=t.regionList,this.off("msg",e),i(t.regionList))};this.on("msg",e),this.ws.onerror=t=>s.#i("failed to get regions",t),this.ws.send(JSON.stringify({command:"regionList"}))})}close(){this.#t=!0,this.connected=!1,this.ws.close()}on(s,i){this.onListeners.has(s)||this.onListeners.set(s,[]),this.onListeners.get(s).push(i)}once(s,i){this.onceListeners.has(s)||this.onceListeners.set(s,[]),this.onceListeners.get(s).push(i)}off(s,i){this.onListeners.has(s)&&this.onListeners.set(s,this.onListeners.get(s).filter(e=>e!==i)),this.onceListeners.has(s)&&this.onceListeners.set(s,this.onceListeners.get(s).filter(e=>e!==i))}#s(s,...i){this.onListeners.has(s)&&this.onListeners.get(s).forEach(e=>e(...i)),this.onceListeners.has(s)&&(this.onceListeners.get(s).forEach(e=>e(...i)),this.onceListeners.delete(s))}#i(s){this.onListeners.has("error")?this.#s("error",s):(console.error(s),this.#e||process.exit(1))}}var y=d;export{d as Matchmaker,y as default};
3
+ var c=Object.defineProperty;var r=(h,s)=>c(h,"name",{value:s,configurable:!0});import f from"./api.js";import{ProxiesEnabled as d}from"./constants/index.js";import{validate as l}from"./wasm/wrapper.js";import a from"./socket.js";class L{static{r(this,"Matchmaker")}connected=!1;onceConnected=[];regionList=[];proxy=null;sessionId="";onListeners=new Map;onceListeners=new Map;#e=!1;#t=!1;constructor(s={}){this.#e=s.noExitOnError||!1,s.instance||(s.instance="shellshock.io"),s.protocol||(s.protocol="wss"),s.api?this.api=s.api:this.api=new f({instance:s.instance,protocol:s.protocol,proxy:s.proxy}),s.sessionId||s.noLogin?this.sessionId=s.sessionId:this.#n(),s.proxy&&!d?this.#i("proxies do not work and hence are not supported in the browser"):s.proxy&&(this.proxy=s.proxy),this.#o(s.instance,s.protocol,s.noLogin)}async#o(s,i,e){if(this.ws=new a(`${i}://${s}/matchmaker/`,this.proxy),!await this.ws.tryConnect())return this.#i("WebSocket did not connect...");this.ws.onmessage=o=>{const n=JSON.parse(o.data);if(n.command==="validateUUID")return this.ws.send(JSON.stringify({command:"validateUUID",hash:l(n.uuid)}));this.#s("msg",n)},this.ws.onclose=()=>{this.connected=!1,this.#t||this.#o(s,i,e)},this.connected=!0,(this.sessionId||e)&&this.onceConnected.forEach(o=>o())}async#n(){const s=await this.api.loginAnonymously();(!s||typeof s=="string")&&this.#s("authFail",s),this.sessionId=s.sessionId,this.connected&&this.onceConnected.forEach(i=>i())}send(s){this.ws.send(JSON.stringify(s))}async waitForConnect(){return new Promise(s=>{this.connected?s():this.onceConnected.push(s)})}async getRegions(){await this.waitForConnect();const s=this;return new Promise(i=>{const e=r(t=>{t.command==="regionList"&&(this.regionList=t.regionList,this.off("msg",e),i(t.regionList))},"listener");this.on("msg",e),this.ws.onerror=t=>s.#i("failed to get regions",t),this.ws.send(JSON.stringify({command:"regionList"}))})}close(){this.#t=!0,this.connected=!1,this.ws.close()}on(s,i){this.onListeners.has(s)||this.onListeners.set(s,[]),this.onListeners.get(s).push(i)}once(s,i){this.onceListeners.has(s)||this.onceListeners.set(s,[]),this.onceListeners.get(s).push(i)}off(s,i){this.onListeners.has(s)&&this.onListeners.set(s,this.onListeners.get(s).filter(e=>e!==i)),this.onceListeners.has(s)&&this.onceListeners.set(s,this.onceListeners.get(s).filter(e=>e!==i))}#s(s,...i){this.onListeners.has(s)&&this.onListeners.get(s).forEach(e=>e(...i)),this.onceListeners.has(s)&&(this.onceListeners.get(s).forEach(e=>e(...i)),this.onceListeners.delete(s))}#i(s){this.onListeners.has("error")?this.#s("error",s):(console.error(s),this.#e||process.exit(1))}}var x=L;export{L as Matchmaker,x as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import{BinaryHeap as u}from"./binaryheap.js";class a{constructor(e){this.list=e}heuristic(e,i){return Math.abs(e.x-i.x)+Math.abs(e.y-i.y)+Math.abs(e.z-i.z)}reversePath(e){const i=[];for(;e.parent;)i.push(e),e=e.parent;return i.reverse(),i}path(e,i){this.list.clean();const r=new u(s=>s.f),n=[];for(e.h=this.heuristic(e,i),e.g=0,e.f=e.g+e.h,r.push(e);r.size()!==0;){const s=r.pop();if(s===i)return this.reversePath(s);n.push(s);const c=s.links;for(let h=0;h<c.length;h++){const t=c[h];if(n.includes(t))continue;const o=s.g+1,l=t.visited;(!l||o<t.g)&&(t.visited=!0,t.parent=s,t.g=o,t.h=this.heuristic(t.position,i.position),t.f=t.g+t.h,l?r.rescoreElement(t):r.push(t))}}return null}}export{a as default};
3
+ var p=Object.defineProperty;var a=(n,e)=>p(n,"name",{value:e,configurable:!0});import{BinaryHeap as f}from"./binaryheap.js";class g{static{a(this,"AStar")}constructor(e){this.list=e}heuristic(e,i){return Math.abs(e.x-i.x)+Math.abs(e.y-i.y)+Math.abs(e.z-i.z)}reversePath(e){const i=[];for(;e.parent;)i.push(e),e=e.parent;return i.reverse(),i}path(e,i){this.list.clean();const r=new f(s=>s.f),c=[];for(e.h=this.heuristic(e,i),e.g=0,e.f=e.g+e.h,r.push(e);r.size()!==0;){const s=r.pop();if(s===i)return this.reversePath(s);c.push(s);const o=s.links;for(let h=0;h<o.length;h++){const t=o[h];if(c.includes(t))continue;const l=s.g+1,u=t.visited;(!u||l<t.g)&&(t.visited=!0,t.parent=s,t.g=l,t.h=this.heuristic(t.position,i.position),t.f=t.g+t.h,u?r.rescoreElement(t):r.push(t))}}return null}}export{g as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- class r{constructor(t){this.content=[],this.scoreFunction=t}push(t){this.content.push(t),this.bubbleUp(this.content.length-1)}rescoreElement(t){this.sinkDown(this.content.indexOf(t))}pop(){const t=this.content[0],e=this.content.pop();return this.content.length>0&&(this.content[0]=e,this.sinkDown(0)),t}remove(t){const e=this.content.length;for(let n=0;n<e;n++){if(this.content[n]!==t)continue;const i=this.content.pop();if(n===e-1)break;this.content[n]=i,this.bubbleUp(n),this.sinkDown(n);break}}size(){return this.content.length}bubbleUp(t){const e=this.content[t],n=this.scoreFunction(e);for(;t>0;){const i=Math.floor((t+1)/2)-1,o=this.content[i];if(n>=this.scoreFunction(o))break;this.content[i]=e,this.content[t]=o,t=i}}includes(t){return this.content.includes(t)}sinkDown(t){const e=this.content.length,n=this.content[t],i=this.scoreFunction(n);for(;;){const o=(t+1)*2,c=o-1;let s=null,h;if(c<e){const l=this.content[c];h=this.scoreFunction(l),h<i&&(s=c)}if(o<e){const l=this.content[o];this.scoreFunction(l)<(s===null?i:h)&&(s=o)}if(s===null)break;this.content[t]=this.content[s],this.content[s]=n,t=s}}}var b=r;export{r as BinaryHeap,b as default};
3
+ var b=Object.defineProperty;var u=(r,t)=>b(r,"name",{value:t,configurable:!0});class p{static{u(this,"BinaryHeap")}constructor(t){this.content=[],this.scoreFunction=t}push(t){this.content.push(t),this.bubbleUp(this.content.length-1)}rescoreElement(t){this.sinkDown(this.content.indexOf(t))}pop(){const t=this.content[0],e=this.content.pop();return this.content.length>0&&(this.content[0]=e,this.sinkDown(0)),t}remove(t){const e=this.content.length;for(let n=0;n<e;n++){if(this.content[n]!==t)continue;const i=this.content.pop();if(n===e-1)break;this.content[n]=i,this.bubbleUp(n),this.sinkDown(n);break}}size(){return this.content.length}bubbleUp(t){const e=this.content[t],n=this.scoreFunction(e);for(;t>0;){const i=Math.floor((t+1)/2)-1,o=this.content[i];if(n>=this.scoreFunction(o))break;this.content[i]=e,this.content[t]=o,t=i}}includes(t){return this.content.includes(t)}sinkDown(t){const e=this.content.length,n=this.content[t],i=this.scoreFunction(n);for(;;){const o=(t+1)*2,c=o-1;let s=null,h;if(c<e){const l=this.content[c];h=this.scoreFunction(l),h<i&&(s=c)}if(o<e){const l=this.content[o];this.scoreFunction(l)<(s===null?i:h)&&(s=o)}if(s===null)break;this.content[t]=this.content[s],this.content[s]=n,t=s}}}var a=p;export{p as BinaryHeap,a as default};