yolkbot 1.4.5 → 1.4.6

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 (112) hide show
  1. package/browser/build/global.js +1 -1
  2. package/browser/build/module.js +1 -1
  3. package/dist/api.js +200 -1
  4. package/dist/bot/GamePlayer.js +74 -1
  5. package/dist/bot.js +1679 -1
  6. package/dist/comm/CommIn.js +79 -1
  7. package/dist/comm/CommOut.js +60 -1
  8. package/dist/comm/index.js +11 -1
  9. package/dist/constants/CloseCode.js +27 -1
  10. package/dist/constants/CommCode.js +53 -1
  11. package/dist/constants/challenges.js +1821 -1
  12. package/dist/constants/findItemById.js +2 -3
  13. package/dist/constants/guns.js +277 -1
  14. package/dist/constants/index.js +139 -1
  15. package/dist/constants/items.js +45042 -1
  16. package/dist/constants/maps.js +1263 -1
  17. package/dist/constants/regions.js +30 -1
  18. package/dist/dispatches/BanPlayerDispatch.js +32 -1
  19. package/dist/dispatches/BootPlayerDispatch.js +21 -1
  20. package/dist/dispatches/ChatDispatch.js +32 -1
  21. package/dist/dispatches/FireDispatch.js +15 -1
  22. package/dist/dispatches/GameOptionsDispatch.js +66 -1
  23. package/dist/dispatches/GoToAmmoDispatch.js +38 -1
  24. package/dist/dispatches/GoToCoopDispatch.js +38 -1
  25. package/dist/dispatches/GoToGrenadeDispatch.js +38 -1
  26. package/dist/dispatches/GoToPlayerDispatch.js +39 -1
  27. package/dist/dispatches/GoToSpatulaDispatch.js +26 -1
  28. package/dist/dispatches/LookAtDispatch.js +35 -1
  29. package/dist/dispatches/LookAtPosDispatch.js +29 -1
  30. package/dist/dispatches/MeleeDispatch.js +26 -1
  31. package/dist/dispatches/MovementDispatch.js +26 -1
  32. package/dist/dispatches/PauseDispatch.js +18 -1
  33. package/dist/dispatches/ReloadDispatch.js +28 -1
  34. package/dist/dispatches/ReportPlayerDispatch.js +42 -1
  35. package/dist/dispatches/ResetGameDispatch.js +19 -1
  36. package/dist/dispatches/SaveLoadoutDispatch.js +105 -1
  37. package/dist/dispatches/SpawnDispatch.js +22 -1
  38. package/dist/dispatches/SwapWeaponDispatch.js +25 -1
  39. package/dist/dispatches/SwitchTeamDispatch.js +33 -1
  40. package/dist/dispatches/ThrowGrenadeDispatch.js +21 -1
  41. package/dist/dispatches/index.js +74 -1
  42. package/dist/env/fetch.js +97 -10
  43. package/dist/env/globals.js +15 -1
  44. package/dist/index.js +14 -2
  45. package/dist/matchmaker.js +141 -1
  46. package/dist/pathing/astar.js +55 -1
  47. package/dist/pathing/binaryheap.js +79 -1
  48. package/dist/pathing/mapnode.js +179 -1
  49. package/dist/socket.js +97 -1
  50. package/dist/util.js +68 -1
  51. package/dist/wasm/bytes.js +8 -1
  52. package/dist/wasm/direct.js +84 -1
  53. package/dist/wasm/legacy.js +170 -1
  54. package/dist/wasm/util.js +19 -1
  55. package/package.json +38 -39
  56. /package/dist/{types/api.d.ts → api.d.ts} +0 -0
  57. /package/dist/{types/bot → bot}/GamePlayer.d.ts +0 -0
  58. /package/dist/{types/bot.d.ts → bot.d.ts} +0 -0
  59. /package/dist/{types/comm → comm}/CommIn.d.ts +0 -0
  60. /package/dist/{types/comm → comm}/CommOut.d.ts +0 -0
  61. /package/dist/{types/comm → comm}/index.d.ts +0 -0
  62. /package/dist/{types/constants → constants}/CloseCode.d.ts +0 -0
  63. /package/dist/{types/constants → constants}/CommCode.d.ts +0 -0
  64. /package/dist/{types/constants → constants}/challenges.d.ts +0 -0
  65. /package/dist/{types/constants → constants}/changelog.d.ts +0 -0
  66. /package/dist/{types/constants → constants}/findItemById.d.ts +0 -0
  67. /package/dist/{types/constants → constants}/guns.d.ts +0 -0
  68. /package/dist/{types/constants → constants}/housePromo.d.ts +0 -0
  69. /package/dist/{types/constants → constants}/index.d.ts +0 -0
  70. /package/dist/{types/constants → constants}/items.d.ts +0 -0
  71. /package/dist/{types/constants → constants}/language.d.ts +0 -0
  72. /package/dist/{types/constants → constants}/maps.d.ts +0 -0
  73. /package/dist/{types/constants → constants}/notices.d.ts +0 -0
  74. /package/dist/{types/constants → constants}/regions.d.ts +0 -0
  75. /package/dist/{types/constants → constants}/shellNews.d.ts +0 -0
  76. /package/dist/{types/constants → constants}/shellYoutube.d.ts +0 -0
  77. /package/dist/{types/constants → constants}/shopItems.d.ts +0 -0
  78. /package/dist/{types/constants → constants}/sounds.d.ts +0 -0
  79. /package/dist/{types/dispatches → dispatches}/BanPlayerDispatch.d.ts +0 -0
  80. /package/dist/{types/dispatches → dispatches}/BootPlayerDispatch.d.ts +0 -0
  81. /package/dist/{types/dispatches → dispatches}/ChatDispatch.d.ts +0 -0
  82. /package/dist/{types/dispatches → dispatches}/FireDispatch.d.ts +0 -0
  83. /package/dist/{types/dispatches → dispatches}/GameOptionsDispatch.d.ts +0 -0
  84. /package/dist/{types/dispatches → dispatches}/GoToAmmoDispatch.d.ts +0 -0
  85. /package/dist/{types/dispatches → dispatches}/GoToCoopDispatch.d.ts +0 -0
  86. /package/dist/{types/dispatches → dispatches}/GoToGrenadeDispatch.d.ts +0 -0
  87. /package/dist/{types/dispatches → dispatches}/GoToPlayerDispatch.d.ts +0 -0
  88. /package/dist/{types/dispatches → dispatches}/GoToSpatulaDispatch.d.ts +0 -0
  89. /package/dist/{types/dispatches → dispatches}/LookAtDispatch.d.ts +0 -0
  90. /package/dist/{types/dispatches → dispatches}/LookAtPosDispatch.d.ts +0 -0
  91. /package/dist/{types/dispatches → dispatches}/MeleeDispatch.d.ts +0 -0
  92. /package/dist/{types/dispatches → dispatches}/MovementDispatch.d.ts +0 -0
  93. /package/dist/{types/dispatches → dispatches}/PauseDispatch.d.ts +0 -0
  94. /package/dist/{types/dispatches → dispatches}/ReloadDispatch.d.ts +0 -0
  95. /package/dist/{types/dispatches → dispatches}/ReportPlayerDispatch.d.ts +0 -0
  96. /package/dist/{types/dispatches → dispatches}/ResetGameDispatch.d.ts +0 -0
  97. /package/dist/{types/dispatches → dispatches}/SaveLoadoutDispatch.d.ts +0 -0
  98. /package/dist/{types/dispatches → dispatches}/SpawnDispatch.d.ts +0 -0
  99. /package/dist/{types/dispatches → dispatches}/SwapWeaponDispatch.d.ts +0 -0
  100. /package/dist/{types/dispatches → dispatches}/SwitchTeamDispatch.d.ts +0 -0
  101. /package/dist/{types/dispatches → dispatches}/ThrowGrenadeDispatch.d.ts +0 -0
  102. /package/dist/{types/dispatches → dispatches}/index.d.ts +0 -0
  103. /package/dist/{types/matchmaker.d.ts → matchmaker.d.ts} +0 -0
  104. /package/dist/{types/pathing → pathing}/astar.d.ts +0 -0
  105. /package/dist/{types/pathing → pathing}/binaryheap.d.ts +0 -0
  106. /package/dist/{types/pathing → pathing}/mapnode.d.ts +0 -0
  107. /package/dist/{types/socket.d.ts → socket.d.ts} +0 -0
  108. /package/dist/{types/util.d.ts → util.d.ts} +0 -0
  109. /package/dist/{types/wasm → wasm}/bytes.d.ts +0 -0
  110. /package/dist/{types/wasm → wasm}/direct.d.ts +0 -0
  111. /package/dist/{types/wasm → wasm}/legacy.d.ts +0 -0
  112. /package/dist/{types/wasm → wasm}/util.d.ts +0 -0
@@ -1 +1 @@
1
- var qe=Object.defineProperty;var tt=(t,e)=>{for(var s in e)qe(t,s,{get:e[s],enumerable:!0,configurable:!0,set:(i)=>e[s]=()=>i})};var Ue=globalThis.fetch,Tt=Ue;console.error("wwws does not support the browser.");var Et=null;var W={},Z=typeof window<"u"&&typeof HTMLElement<"u",et=typeof WebSocketPair<"u"&&typeof Cloudflare<"u",Pt=typeof process<"u"&&process.moduleLoadList?.length>0,Nt=typeof Deno<"u",Gt=typeof process<"u"&&!!process.versions?.bun;if(!Z&&!et&&!Pt&&!Nt&&!Gt)throw Error("yolkbot doesn't know how to run in this environment. Please open an issue on GitHub with information on where you run yolkbot.");W.isBrowser=Z;W.isIsolated=!Pt&&!Nt&&!Gt;W.fetch=Z||et?globalThis.fetch:Tt;W.WebSocket=Z||et?globalThis.WebSocket:Et;var w=W;var Rt={};tt(Rt,{findItemById:()=>l,UserAgent:()=>$,URLRewards:()=>Ke,Team:()=>Je,StateBufferSize:()=>j,SocialReward:()=>Be,SocialMedia:()=>dt,ShellStreak:()=>g,PlayType:()=>X,Movement:()=>S,ItemType:()=>P,GunList:()=>_,GunEquipTime:()=>pt,GameOptionFlag:()=>mt,GameMode:()=>M,GameAction:()=>L,FramesBetweenSyncs:()=>C,FirebaseKey:()=>R,CoopState:()=>Q,CollectType:()=>Y,ChiknWinnerDailyLimit:()=>ft,ChatFlag:()=>$e,ChallengeType:()=>je,ChallengeSubType:()=>We,BanDuration:()=>ut});var Ot={};tt(Ot,{SMG:()=>ct,RPEGG:()=>nt,M24:()=>ht,Eggk47:()=>st,DozenGauge:()=>it,Cluck9mm:()=>rt,CSG1:()=>ot,AUG:()=>at});var G=class{constructor(){this.adsMod=0.5,this.burst=0,this.burstRof=0,this.movementAccuracyMod=1,this.radius=0,this.reloadBloom=!0,this.reloadTimeMod=1,this.tracer=0}},st=class extends G{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=0.15,this.accuracyMax=0.03,this.accuracyLoss=0.05,this.accuracyRecover=0.025,this.tracer=1}},it=class extends G{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=0.16,this.accuracyMax=0.13,this.accuracyLoss=0.17,this.accuracyRecover=0.02,this.adsMod=0.6,this.movementAccuracyMod=0.2,this.tracer=0}},ot=class extends G{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=0.3,this.accuracyMax=0.004,this.accuracyLoss=0.3,this.accuracyRecover=0.025,this.tracer=0}},rt=class extends G{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=0.15,this.accuracyMax=0.035,this.accuracyLoss=0.09,this.accuracyRecover=0.08,this.adsMod=0.8,this.movementAccuracyMod=0.6,this.tracer=0}},nt=class extends G{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=0.4,this.accuracyMin=0.3,this.accuracyMax=0.015,this.accuracyLoss=0.3,this.accuracyRecover=0.02,this.radius=2.75}},ct=class extends G{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=0.19,this.accuracyMax=0.06,this.accuracyLoss=0.045,this.accuracyRecover=0.05,this.adsMod=0.6,this.movementAccuracyMod=0.7,this.tracer=2}},ht=class extends G{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=0.35,this.accuracyMax=0,this.accuracyLoss=0.1,this.accuracyRecover=0.023,this.movementAccuracyMod=1.3,this.reloadBloom=!1,this.reloadTimeMod=0.8,this.tracer=0}},at=class extends G{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=0.15,this.accuracyMax=0.03,this.accuracyLoss=0.037,this.accuracyRecover=0.03,this.adsMod=0.6,this.burst=3,this.burstRof=3,this.movementAccuracyMod=0.8,this.movementInstability=2,this.tracer=0}};var l=()=>null;var ut={FiveMinutes:0,FifteenMinutes:1,OneHour:2},We={Killstreak:0,KillWithWeapon:1,MovementDistance:3,Jumping:4,TimePlayed:6,TimeAlive:7,KillWithCondition:8,TotalKills:10,SpatulaKills:10,Collecting:18,FromTheCoop:20,SpecialOffensive:21,WinKOTC:23,KillWithSpatula:23},je={Kill:0,Damage:1,Death:2,Movement:3,Collect:4,Time:5,KOTC:6,Spatula:7},$e={None:0,Pinned:2,Team:4,Mod:254,Server:255},ft=3,Y={Ammo:0,Grenade:1},Q={Start:0,Score:1,Win:2,Capturing:3,Contested:4,Takeover:5,Abandoned:6,Unclaimed:7},R="AIzaSyDP4SIjKaw6A4c-zvfYxICpbEjn1rRnN50",C=3,L={Reset:1,Pause:2},M={FFA:0,Team:1,Spatula:2,KOTC:3},mt={Locked:1,NoTeamChange:2,NoTeamShuffle:4},pt=13,_=[st,it,ot,nt,ct,ht,at],P={Hat:1,Stamp:2,Primary:3,Secondary:4,Grenade:6,Melee:7},S={Forward:1,Backward:2,Left:4,Right:8,Jump:16,Fire:32,Melee:64,Scope:128},X={JoinPublic:0,CreatePrivate:1,JoinPrivate:2},g={HardBoiled:1,EggBreaker:2,Restock:4,OverHeal:8,DoubleEggs:16,MiniEgg:32},dt={Facebook:0,Instagram:1,Tiktok:2,Discord:3,Youtube:4,Twitter:5,Twitch:6},Be={Discord:"rew_1200",Tiktok:"rew_1208",Instagram:"rew_1219",Steam:"rew_1223",Facebook:"rew_1227",Twitter:"rew_1234",Twitch:"rew_twitch_social"},j=256,Je={Blue:1,Red:2},Ke=["giveBasketBrosReward","mercZoneFinalGift","midMonthGiveMeEggs","newYolkerSignupReward","newYolkerItemReward","newYolkerWelcomeBack","WelcomeBack"],$=w.isBrowser?null:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36";class _t{url="";proxy="";binaryType="";maxRetries=5;connectionTimeout=5000;constructor(t,e){if(w.isBrowser&&e)throw Error("You cannot pass a proxy to a WebSocket in a browser.");this.url=t,this.proxy=e}async tryConnect(t=1){let e=new URL(this.url),s=async()=>{if(t===5)return!1;return await this.tryConnect(t+1)};try{if(this.socket=w.isBrowser?new w.WebSocket(this.url):new w.WebSocket(this.url,{proxy:this.proxy||null,headers:{"accept-encoding":"gzip, deflate, br, zstd","accept-language":"en-US,en;q=0.9","cache-control":"no-cache",connection:"Upgrade",origin:e.origin.replace("ws","http"),pragma:"no-cache","sec-websocket-extensions":"permessage-deflate; client_max_window_bits","user-agent":$}}),this.binaryType)this.socket.binaryType=this.binaryType}catch(i){return console.error(`Failed to connect on try ${t}, trying again...`,i),await s()}if(this.onBeforeConnect)this.onBeforeConnect();return new Promise((i)=>{let r=setTimeout(async()=>{this.socket.close(),i(await s())},this.connectionTimeout),n=async(c)=>{clearTimeout(r),console.error("WebSocket error",c),i(await s())};this.socket.addEventListener("open",async()=>{clearTimeout(r),this.socket.removeEventListener("error",n),i(!0)}),this.socket.addEventListener("error",n)})}get onmessage(){return this.socket?.onmessage}set onmessage(t){if(this.socket)this.socket.onmessage=t;else console.error("set onmessage before socket existed")}get onclose(){return this.socket?.onclose}set onclose(t){if(this.socket)this.socket.onclose=t;else console.error("set onclose before socket existed")}get onerror(){return this.socket?.onerror}set onerror(t){if(this.socket)this.socket.onerror=t;else console.error("set onclose before socket existed")}send(t){return this.socket?.send(t)}close(t){return this.socket?.close(t)}}var F=_t;var B={origin:"https://shellshock.io","user-agent":$,"x-client-version":"Chrome/JsCore/9.17.2/FirebaseCore-web","x-firebase-locale":"en"};class lt{constructor(t={}){this.proxy=t.proxy,this.instance=t.instance||"shellshock.io",this.protocol=t.protocol||"wss",this.maxRetries=t.maxRetries||5,this.suppressErrors=t.suppressErrors||!1,this.connectionTimeout=t.connectionTimeout||5000}queryServices=async(t)=>{let e=new F(`${this.protocol}://${this.instance}/services/`,this.proxy);if(e.connectionTimeout=this.connectionTimeout,!await e.tryConnect(-2)||e.socket.readyState!==1)return"websocket_connect_fail";return new Promise((i)=>{let r=!1;e.onmessage=(n)=>{r=!0;try{let c=JSON.parse(n.data);i(c)}catch{if(!this.suppressErrors)console.error("queryServices: Bad API JSON response with call:",t.cmd,"and data:",JSON.stringify(t)),console.error("queryServices: Full data sent:",JSON.stringify(t));i("bad_json")}e.close()},e.onerror=()=>!r&&i("unknown_socket_error"),e.onclose=()=>!r&&i("services_closed_early"),e.send(JSON.stringify(t))})};#t=async(t,e,s)=>{if(!t||!e)return"firebase_no_credentials";let i,r;try{i=await(await w.fetch(`https://identitytoolkit.googleapis.com/v1/accounts:${s}?key=${R}`,{method:"POST",body:JSON.stringify({email:t,password:e,returnSecureToken:!0}),headers:{...B,"content-type":"application/json"},proxy:this.proxy})).json(),r=i.idToken}catch(c){if(c.code==="auth/network-request-failed"){if(!this.suppressErrors)console.error("loginWithCredentials: Network req failed (auth/network-request-failed)");return"firebase_network_failed"}else if(c.code==="auth/missing-email")return"firebase_no_credentials";else if(c.code==="ERR_BAD_REQUEST"){if(!this.suppressErrors)console.error("loginWithCredentials: Error:",t,e);if(!this.suppressErrors)console.error("loginWithCredentials: Error:",i||c);return"firebase_bad_request"}if(!this.suppressErrors)console.error("loginWithCredentials: Error:",t,e,c);return"firebase_unknown_error"}if(!r){if(!this.suppressErrors)console.error("loginWithCredentials: the game sent no idToken",i);return"firebase_no_token"}this.idToken=r;let n=await this.queryServices({cmd:"auth",firebaseToken:r});return typeof n==="object"?{firebase:i,...n}:n};createAccount=async(t,e)=>await this.#t(t,e,"signUp");loginWithCredentials=async(t,e)=>await this.#t(t,e,"signInWithPassword");loginWithRefreshToken=async(t)=>{if(!t)return"firebase_no_credentials";let e=new URLSearchParams;e.append("grant_type","refresh_token"),e.append("refresh_token",t);let s,i;try{s=await(await w.fetch(`https://securetoken.googleapis.com/v1/token?key=${R}`,{method:"POST",body:e,headers:{...B,"content-type":"application/x-www-form-urlencoded"},proxy:this.proxy})).json(),i=s.id_token}catch(n){if(n.code==="auth/network-request-failed"){if(!this.suppressErrors)console.error("loginWithRefreshToken: Network req failed (auth/network-request-failed)");return"firebase_network_failed"}else if(n.code==="auth/missing-email")return"firebase_no_credentials";if(!this.suppressErrors)console.error("loginWithRefreshToken: Error:",n,t);return"firebase_unknown_error"}if(!i){if(!this.suppressErrors)console.error("loginWithRefreshToken: the game sent no idToken",s);return"firebase_no_token"}this.idToken=i;let r=await this.queryServices({cmd:"auth",firebaseToken:i});return typeof r==="object"?{firebase:s,...r}:r};loginAnonymously=async()=>{let e=await(await w.fetch(`https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=${R}`,{method:"POST",body:JSON.stringify({returnSecureToken:!0}),headers:{...B,"content-type":"application/json"},proxy:this.proxy})).json(),s=e.idToken;if(!s){if(!this.suppressErrors)console.error("loginAnonymously: the game sent no idToken",e);return"firebase_no_token"}this.idToken=s;let i=await this.queryServices({cmd:"auth",firebaseToken:s});return typeof i==="object"?{firebase:e,...i}:i};sendEmailVerification=async(t=this.idToken)=>{if(!t)return"no_idtoken_passed";let s=await(await w.fetch(`https://identitytoolkit.googleapis.com/v1/accounts:sendOobCode?key=${R}`,{method:"POST",body:JSON.stringify({requestType:"VERIFY_EMAIL",idToken:t}),headers:{...B,"content-type":"application/json"},proxy:this.proxy})).json();if(s.kind!=="identitytoolkit#GetOobConfirmationCodeResponse"){if(!this.suppressErrors)console.error("sendEmailVerification: the game sent an invalid response",s);return"firebase_invalid_response"}return{email:s.email}};verifyOobCode=async(t)=>{if(!t)return"no_oob_code_passed";let s=await(await w.fetch(`https://www.googleapis.com/identitytoolkit/v3/relyingparty/setAccountInfo?key=${R}`,{method:"POST",body:JSON.stringify({oobCode:t}),headers:{...B,"x-client-version":"Chrome/JsCore/3.7.5/FirebaseCore-web",referer:"https://shellshockio-181719.firebaseapp.com/","content-type":"application/json"},proxy:this.proxy})).json();if(!s.emailVerified){if(!this.suppressErrors)console.error("verifyOobCode: the game sent an invalid response",s);return"firebase_invalid_response"}return s.email}}var I=lt;class At{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(){let t=this.idx;return this.idx++,this.buffer[t]}static unPackInt8(){return(this.unPackInt8U()+128)%256-128}static unPackInt16U(){let t=this.idx;return this.idx+=2,this.buffer[t]+this.buffer[t+1]*256}static unPackInt24U(){let t=this.idx;return this.idx+=3,this.buffer[t]+this.buffer[t+1]*256+this.buffer[t+2]*65536}static unPackInt32U(){let 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;let e=Math.min(this.unPackInt8U(),t);return this.unPackStringHelper(e)}static unPackLongString(t){t=t||16383;let e=Math.min(this.unPackInt16U(),t);return this.unPackStringHelper(e)}static unPackStringHelper(t){if(this.isMoreDataAvailable()<t)return 0;let s="";for(let i=0;i<t;i++){let r=this.unPackInt16U();if(r>0)s+=String.fromCodePoint(r)}return s}}var o=At;class vt{constructor(t=16384){this.idx=0,this.arrayBuffer=new ArrayBuffer(t),this.buffer=new Uint8Array(this.arrayBuffer,0,t)}send(t){let e=new Uint8Array(this.arrayBuffer,0,this.idx);t.send(e)}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){if(typeof t!=="string")t="";this.packInt8(t.length);for(let e=0;e<t.length;e++)this.packInt16(t.charCodeAt(e))}packLongString(t){if(typeof t!=="string")t="";this.packInt16(t.length);for(let e=0;e<t.length;e++)this.packInt16(t.charCodeAt(e))}}var p=vt;var He={gameNotFound:4000,gameFull:4001,badName:4002,mainMenu:4003,gameIdleExceeded:4004,corruptedLoginData0:4005,corruptedLoginData1:4006,corruptedLoginData2:4007,corruptedLoginData3:4008,corruptedLoginData4:4009,corruptedLoginData5:4010,gameMaxPlayersExceeded:4011,gameDestroyUser:4012,joinGameOutOfOrder:4013,gameShuttingDown:4014,readyBeforeReady:4015,booted:4016,gameErrorOnUserSocket:4017,uuidNotFound:4018,sessionNotFound:4019,clusterFullCpu:4020,clusterFullMem:4021,noClustersAvailable:4022,locked:4023},D=He;var Ze={},a=Ze;var Ye=Object.fromEntries(Object.entries(dt).map(([t,e])=>[e,t.toLowerCase()]));class gt{constructor(t,e=null){if(this.id=t.id,this.uniqueId=t.uniqueId,this.name=t.name,this.safeName=t.safeName,this.team=t.team,this.playing=t.playing,this.socials=t.social&&JSON.parse(t.social),this.socials)this.socials.forEach((s)=>s.type=Ye[s.id]);if(this.isVip=t.upgradeProductId>0,this.showBadge=!t.hideBadge||!1,this.streak=t.score,this.streakRewards=Object.values(g).filter((s)=>t.activeShellStreaks&s),this.scale=this.streakRewards.includes(g.MiniEgg)?0.5:1,this.position={x:t.x,y:t.y,z:t.z},this.jumping=t.$controlKeys&S.Jump,this.scoping=t.$controlKeys&S.Scope,this.climbing=!1,this.view={yaw:t.yaw,pitch:t.pitch},this.updateKotcZone(e),this.character={eggColor:t.shellColor,primaryGun:t.primaryWeaponItem,secondaryGun:t.secondaryWeaponItem,stamp:t.stampItem,hat:t.hatItem,grenade:t.grenadeItem,melee:t.meleeItem,stampPos:{x:t.stampPosX,y:t.stampPosY}},this.stats={totalKills:t.totalKills,totalDeaths:t.totalDeaths,bestStreak:t.bestStreak},this.activeGun=t.weaponIdx,this.selectedGun=t.charClass,this.weapons=[],this.character.primaryGun)this.weapons[0]=new _[this.selectedGun],this.weapons[1]=new rt;this.grenades=1,this.hp=t.hp,this.hpShield=0,this.spawnShield=t.shield,this.randomSeed=0}updateKotcZone(t){if(!t)return this.inKotcZone=!1;let e=Math.floor(this.position.x),s=Math.floor(this.position.y),i=Math.floor(this.position.z);this.inKotcZone=t.some((r)=>r.x===e&&r.y===s&&r.z===i)&&this.playing}}var V=gt;var Qe=(t)=>new Uint8Array(t.match(/.{2}/g).map((e)=>parseInt(e,16))),Xe=new TextEncoder,Ct=async(t)=>{if(typeof process<"u"&&typeof process.getBuiltinModule==="function"){let r=process.getBuiltinModule("node:crypto"),n=Buffer.from("3496afb51f42553e31635211400c000b","hex");return r.createHmac("sha256",n).update(t).digest("hex")}let e=Qe("3496afb51f42553e31635211400c000b"),s=await crypto.subtle.importKey("raw",e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),i=await crypto.subtle.sign("HMAC",s,Xe.encode(t));return Array.from(new Uint8Array(i)).map((r)=>r.toString(16).padStart(2,"0")).join("")},O=(t)=>{return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(t-1050359)},Lt=(t,e)=>{let s=Math.round(t/(Math.PI*2)*65535),i=0,r=Math.round((e+1.5)/3*32767),n=s<0?0:s;s=n>65535?65535:n;let c=Math.trunc(s);if(c<0)c=0;if(c>4294967295)c=4294967295;c=s>=0?c:0,c=s>65535?0:c;let h=c;i^=h;let m=r<0?0:r;s=m,m=s>32767?32767:s,s=m;let f=Math.trunc(s);if(f<0)f=0;if(f>4294967295)f=4294967295;f=s>=0?f:0,f=s>65535?0:f;let u=f,d=u,k=i^d,E=k&255,N=i<<8,A=(i&65280)>>>8;u=(N|A)>>>0;let H=E^u;k=k<<8|(k&65280)>>>8,h^=d,d=k^h&255,h=h<<8|(h&65280)>>>8,i=h^i&255;let z=[];return z[3]=O(1050359+(d&63)),z[7]=O(1050359+(u>>>8&63)),z[4]=O(1050359+(k>>>10&63)),z[0]=O(1050359+((i&252)>>>2)),z[5]=O(1050359+(k>>>4&48|H>>>4&15)),z[2]=O(1050359+(h>>>6&60|d>>>6&3)),z[6]=O(1050359+((u>>>14&3|H<<2)&63)),z[1]=O(1050359+((h>>>12&15|i<<4)&63)),String.fromCharCode(...z)};class xt{connected=!1;onceConnected=[];regionList=[];proxy=null;sessionId="";onListeners=new Map;onceListeners=new Map;#t=!1;#e=!1;constructor(t={}){if(this.#t=t.noExitOnError||!1,!t.instance)t.instance="shellshock.io";if(!t.protocol)t.protocol="wss";if(t.api)this.api=t.api;else this.api=new I({proxy:t.proxy,protocol:t.protocol,instance:t.instance,connectionTimeout:t.connectionTimeout});if(t.sessionId||t.noLogin)this.sessionId=t.sessionId;else this.#s();if(t.proxy&&w.isBrowser)this.#i("proxies do not work and hence are not supported in the browser");else if(t.proxy)this.proxy=t.proxy;this.#r(t.instance,t.protocol,t.noLogin,t.connectionTimeout)}async#r(t,e,s,i){if(this.ws=new F(`${e}://${t}/matchmaker/`,this.proxy),this.ws.connectionTimeout=i||5000,!await this.ws.tryConnect())return this.#i("WebSocket did not connect...");if(this.ws.onmessage=async(n)=>{let c=JSON.parse(n.data);if(c.command==="validateUUID")return this.ws.send(JSON.stringify({command:"validateUUID",hash:await Ct(c.uuid)}));this.#o("msg",c)},this.ws.onclose=()=>{if(this.connected=!1,!this.#e)this.#r(t,e,s,i)},this.connected=!0,this.sessionId||s)this.onceConnected.forEach((n)=>n())}async#s(){let t=await this.api.loginAnonymously();if(!t||typeof t==="string")this.#o("authFail",t);if(this.sessionId=t.sessionId,this.connected)this.onceConnected.forEach((e)=>e())}send(t){this.ws.send(JSON.stringify(t))}async waitForConnect(){return new Promise((t)=>{if(this.connected)t();else this.onceConnected.push(t)})}async getRegions(){await this.waitForConnect();let t=this;return new Promise((e)=>{let s=(i)=>{if(i.command==="regionList")this.regionList=i.regionList,this.off("msg",s),e(i.regionList)};this.on("msg",s),this.ws.onerror=(i)=>t.#i("failed to get regions",i),this.ws.send(JSON.stringify({command:"regionList"}))})}close(){this.#e=!0,this.connected=!1,this.ws.close()}on(t,e){if(!this.onListeners.has(t))this.onListeners.set(t,[]);this.onListeners.get(t).push(e)}once(t,e){if(!this.onceListeners.has(t))this.onceListeners.set(t,[]);this.onceListeners.get(t).push(e)}off(t,e){if(this.onListeners.has(t))this.onListeners.set(t,this.onListeners.get(t).filter((s)=>s!==e));if(this.onceListeners.has(t))this.onceListeners.set(t,this.onceListeners.get(t).filter((s)=>s!==e))}#o(t,...e){if(this.onListeners.has(t))this.onListeners.get(t).forEach((s)=>s(...e));if(this.onceListeners.has(t))this.onceListeners.get(t).forEach((s)=>s(...e)),this.onceListeners.delete(t)}#i(t){if(this.onListeners.has("error"))this.#o("error",t);else if(this.#t)console.error(t);else throw Error(t)}}var Ft=xt;var Ie=(t,e)=>(t%e+e)%e,De=Math.PI*2,qt=(t)=>Math.round(t*8192)/8192,Ve=(t)=>qt(Ie(Math.atan2(-t.x,-t.z),De)),be=(t)=>qt(Math.atan2(t.y,Math.hypot(t.x,t.z)));class Ut{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){let e={x:this.pos.x-t.me.position.x,y:this.pos.y-t.me.position.y,z:this.pos.z-t.me.position.z},s=Ve(e),i=be(e);t.state.yaw=s,t.state.pitch=i}}var J=Ut;class Wt{constructor(t){if(typeof t==="number")this.inputKeys=t;else if(typeof t==="object")this.inputKeys=t.reduce((e,s)=>e|s,0)}validate(){if(typeof this.inputKeys!=="number")return!1;if(this.inputKeys&S.Forward&&this.inputKeys&S.Backward)return!1;if(this.inputKeys&S.Left&&this.inputKeys&S.Right)return!1;return!0}check(t){return t.me.playing}execute(t){t.state.controlKeys=this.inputKeys}}var K=Wt;class wt{constructor(t,e){if(this.x=e.x,this.y=e.y,this.z=e.z,this.positionStr=`${this.x},${this.y},${this.z}`,this.position={x:this.x,y:this.y,z:this.z},this.meshType=t.split(".").pop(),this.f=0,this.g=0,this.h=0,this.visited=null,this.parent=null,this.closed=null,this.links=[],this.isStair())if(e.ry)this.ry=e.ry;else this.ry=0}isFull(){return this.meshType==="full"}canWalkThrough(){return this.meshType==="none"||this.meshType==="ladder"}canWalkOn(){return this.meshType==="full"}isLadder(){return this.meshType==="ladder"}isStair(){return this.meshType==="wedge"}isAir(){return this.meshType==="none"}canLink(t,e){let s=this.x-t.x,i=this.z-t.z,r=this.y-t.y,n=Math.abs(s),c=Math.abs(r),h=Math.abs(i);if(n+c+h===0||n+h>1||this.isFull()||t.isFull())return!1;let m=e.at(this.x,this.y-1,this.z),f=e.at(t.x,t.y-1,t.z);if(!m||!f)return!1;let u={0:{x:0,z:-1},1:{x:-1,z:0},2:{x:0,z:1},3:{x:1,z:0}};switch(this.meshType){case"none":if(r===1&&t.canWalkThrough())return!0;if(m.canWalkOn()||m.isLadder()){if(t.meshType==="none"||t.meshType==="ladder"&&c===0||t.meshType==="wedge"&&r===0&&s===-u[t.ry].x&&i===-u[t.ry].z)return!0}return!1;case"ladder":if(c===1&&t.canWalkThrough())return!0;if(c===0&&m.canWalkOn())return!0;if(t.meshType==="ladder"&&(c===1||m.canWalkOn()&&f.canWalkOn()))return!0;return!1;case"wedge":if(this.x+u[this.ry].x===t.x&&this.z+u[this.ry].z===t.z&&this.y+1===t.y)return!0;if(this.x-u[this.ry].x===t.x&&this.z-u[this.ry].z===t.z&&(this.y===t.y||this.y-1===t.y))return!0;return!1;default:return!1}}flatCenter(){return{x:this.x+0.5,y:this.y+0,z:this.z+0.5}}flatRadialDistance(t){let e=this.flatCenter();return Math.hypot(e.x-t.x,e.z-t.z)}}class kt{list=[];constructor(t){let e={};for(let i of Object.keys(t.data))for(let r of t.data[i])e[r.x<<16|r.y<<8|r.z]=!0,this.list.push(new wt(i,r));for(let i=0;i<t.width;i++)for(let r=0;r<t.height;r++)for(let n=0;n<t.depth;n++)if(!e[i<<16|r<<8|n])this.list.push(new wt("SPECIAL.air.none",{x:i,y:r,z:n}));let s=new Map;for(let i of this.list)s.set(i.positionStr,i);for(let i of this.list){let r=[{x:i.x+1,y:i.y,z:i.z},{x:i.x-1,y:i.y,z:i.z},{x:i.x,y:i.y+1,z:i.z},{x:i.x,y:i.y-1,z:i.z},{x:i.x,y:i.y,z:i.z+1},{x:i.x,y:i.y,z:i.z-1}];for(let n of r){let c=`${n.x},${n.y},${n.z}`,h=s.get(c);if(h&&i.canLink(h,this))i.links.push(h)}}}at(t,e,s){if(!this.nodeMap){this.nodeMap=new Map;for(let r of this.list){let n=`${r.x},${r.y},${r.z}`;this.nodeMap.set(n,r)}}let i=`${t},${e},${s}`;return this.nodeMap.get(i)}clean(){for(let t of this.list)t.f=0,t.g=0,t.h=0,t.visited=null,t.parent=null,t.closed=null}hasLineOfSight(t,e){let s=e.x-t.x,i=e.y-t.y,r=e.z-t.z,n=Math.max(Math.abs(s),Math.abs(i),Math.abs(r)),c=s/n,h=i/n,m=r/n,f=t.x,u=t.y,d=t.z;for(let k=0;k<=n;k++){let E=this.at(Math.round(f),Math.round(u),Math.round(d));if(E&&E.isFull())return!1;f+=c,u+=h,d+=m}return!0}}var jt=async(t,e)=>{if(!w.isIsolated&&typeof process<"u"){let{existsSync:i,mkdirSync:r,readFileSync:n,writeFileSync:c}=process.getBuiltinModule("node:fs"),{join:h}=process.getBuiltinModule("node:path"),{homedir:m}=process.getBuiltinModule("node:os"),f=h(m(),".yolkbot");if(!i(f))r(f);let u=h(f,"maps");if(!i(u))r(u);let d=h(u,`${t}-${e}.json`);if(i(d))return JSON.parse(n(d,"utf-8"));let k=await(await fetch(`https://esm.sh/gh/yolkorg/maps/maps/${t}.json?${e}`)).json();return c(d,JSON.stringify(k,null,4),{flag:"w+"}),k}return await(await fetch(`https://esm.sh/gh/yolkorg/maps/maps/${t}.json?${e}`)).json()},$t=(t)=>{let e=0,s={},i=[];for(let c of t){if(!s[c.x])s[c.x]={};if(!s[c.x][c.y])s[c.x][c.y]={};s[c.x][c.y][c.z]={zone:null}}let r=[{x:-1,z:0},{x:1,z:0},{x:0,z:-1},{x:0,z:1}],n=(c,h,m)=>s[c]&&s[c][h]&&s[c][h][m]?s[c][h][m]:null;for(let c of t)if(!s[c.x][c.y][c.z].zone){c.zone=++e,s[c.x][c.y][c.z].zone=c.zone;let h=[c],m;do{m=0;for(let f of t)if(!s[f.x][f.y][f.z].zone)for(let u of r){let d=n(f.x+u.x,f.y,f.z+u.z);if(d&&d.zone===c.zone){m++,f.zone=c.zone,s[f.x][f.y][f.z].zone=c.zone,h.push(f);break}}}while(m>0);i.push(h)}return i};var Bt=[];var b=[];var Mt=[];var Jt=Object.fromEntries(Object.entries(M).map(([t,e])=>[e,t])),Kt=Object.fromEntries(Object.entries(mt).map(([t,e])=>[t[0].toLowerCase()+t.slice(1),e])),Ht={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},St=(t,e)=>(t%e+e)%e;class Zt{static Intents=Ht;Intents=Ht;#t=[];#e={};#r=[];#s;#o;constructor(t={}){if(t.proxy&&w.isBrowser)this.processError("proxies do not work and hence are not supported in the browser");if(this.intents=t.intents||[],this.intents.includes(this.Intents.COSMETIC_DATA)){if(!l(1001))this.processError("you cannot use the COSMETIC_DATA intent inside of the singlefile browser bundles")}if(this.instance=t.instance||"shellshock.io",this.protocol=t.protocol||"wss",this.proxy=t.proxy||"",this.connectionTimeout=t.connectionTimeout||5000,this.state={name:"yolkbot",weaponIdx:0,useAltGameURL:!1,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 V({}),this.game={raw:{},code:"",socket:null,gameModeId:0,gameMode:Jt[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:Q.Capturing,zoneNumber:0,activeZone:[],capturing:0,captureProgress:0,numCapturing:0,capturePercent:0},this.#o=this.game,this.account={id:0,firebase:{idToken:"",refreshToken:"",expiresIn:"3600",localId:""},firebaseId:"",sessionId:"",session:0,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,4000,4200,4500],secondaryId:[,,,,,,,].fill(3000),stampPositionX:0,stampPositionY:0},ownedItemIds:[],vip:!1,emailVerified:!1,isAged:!1,eggBalance:0,adminRoles:0,rawLoginData:{},isDoubleEggWeeknd:()=>{let e=new Date().getUTCDay(),s=new Date().getUTCHours();return e>=5&&s>=20||e===6||e===0}},this.#s=this.account,this.matchmaker=null,this.api=new I({proxy:this.proxy,protocol:this.protocol,instance:this.instance,maxRetries:t?.apiMaxRetries,connectionTimeout:this.connectionTimeout}),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;if(this.intents.includes(this.Intents.RENEW_SESSION))this.renewSessionInterval=0}dispatch(t){if(t.validate(this)){if(t.check(this))t.execute(this);else this.#t.push(t);return!0}return!1}async createAccount(t,e){this.account=this.#s,this.account.email=t,this.account.password=e;let s=await this.api.createAccount(t,e);return this.processLoginData(s)}async login(t,e){this.account=this.#s,this.account.email=t,this.account.password=e;let s=await this.api.loginWithCredentials(t,e);return this.processLoginData(s)}async loginWithRefreshToken(t){this.account=this.#s;let e=await this.api.loginWithRefreshToken(t);return this.processLoginData(e)}async loginAnonymously(){this.account=this.#s;let t=await this.api.loginAnonymously();return this.processLoginData(t)}processLoginData(t){if(typeof t!=="object")return this.emit("authFail",t),t;if(t.banRemaining)return this.emit("banned",t.banRemaining),"account_banned";if(!t.playerOutput)return this.emit("authFail",t),t;if(this.account.firebase=t.firebase||{},t=t.playerOutput,this.account.rawLoginData=t,this.account.adminRoles=t.adminRoles||0,this.account.eggBalance=t.currentBalance,this.account.emailVerified=t.emailVerified,this.account.firebaseId=t.firebaseId,this.account.id=t.id,this.account.isAged=new Date(t.dateCreated).getTime()<1714546800000,this.account.loadout=t.loadout,this.account.ownedItemIds=t.ownedItemIds,this.account.session=t.session,this.account.sessionId=t.sessionId,this.account.vip=t.active_sub==="IsVIP",this.intents.includes(this.Intents.BOT_STATS))this.account.stats={lifetime:t.statsLifetime,monthly:t.statsCurrent};if(this.intents.includes(this.Intents.CHALLENGES))this.#i(t.challenges);if(this.emit("authSuccess",this.account),this.intents.includes(this.Intents.RENEW_SESSION))this.renewSessionInterval=setInterval(async()=>{if(!this.account?.sessionId)return clearInterval(this.renewSessionInterval);if((await this.api.queryServices({cmd:"renewSession",sessionId:this.account.sessionId})).data!=="renewed")this.emit("sessionExpired")},600000);return this.account}#i(t){this.account.challenges=[];for(let e of t){let s=Bt.find((i)=>i.id===e.challengeId);if(!s)continue;delete e.playerId,this.account.challenges.push({raw:{challengeInfo:s,challengeData:e},id:e.challengeId,name:s.loc.title,desc:s.loc.desc,rewardEggs:s.reward,isRerolled:!!e.reset,isClaimed:!!e.claimed,isCompleted:!!e.completed,progressNum:e.progress,goalNum:s.goal})}}async initMatchmaker(){if(!this.account.sessionId&&!this.intents.includes(this.Intents.NO_LOGIN)){let t=await this.loginAnonymously();if(typeof t!=="object")return t}if(!this.matchmaker){if(this.matchmaker=new Ft({api:this.api,proxy:this.proxy,protocol:this.protocol,instance:this.instance,sessionId:this.account.sessionId,connectionTimeout:this.connectionTimeout,noLogin:this.intents.includes(this.Intents.NO_LOGIN)}),!await this.matchmaker.ws.tryConnect())return"matchmaker_tryconnect_failed";this.matchmaker.on("authFail",(e)=>this.emit("authFail",e)),this.matchmaker.on("error",(e)=>this.processError(e))}return!0}async findPublicGame(t,e){if(typeof t!=="string")return"no_region_passed";if(!Mt.find((i)=>i.id===t)&&!this.intents.includes(this.Intents.NO_REGION_CHECK))return"invalid_region_passed";if(typeof e!=="number")return"no_mode_passed";if(Object.values(M).indexOf(e)===-1)return"invalid_mode_passed";if(!await this.initMatchmaker())return"matchmaker_init_fail";return await new Promise((i)=>{let r=(n)=>{if(n.command==="notice")return;if(this.matchmaker.off("msg",r),n.command==="gameFound"){if(n.useAltGameURL)this.state.useAltGameURL=!0;return i(n)}if(n.error==="sessionNotFound")return i("internal_session_error");this.processError("unknown matchmaker response",JSON.stringify(n))};this.matchmaker.on("msg",r),this.matchmaker.send({command:"findGame",region:t,playType:X.JoinPublic,gameType:e,sessionId:this.account.sessionId})})}async createPrivateGame(t,e,s){if(typeof t!=="string")return"no_region_passed";if(!Mt.find((n)=>n.id===t)&&!this.intents.includes(this.Intents.NO_REGION_CHECK))return"invalid_region_passed";if(typeof e!=="number")return"no_mode_passed";if(Object.values(M).indexOf(e)===-1)return"invalid_mode_passed";if(typeof s!=="string")return"no_map_passed";let i=b.findIndex((n)=>n.name.toLowerCase()===s.toLowerCase());if(i===-1)return"invalid_map_passed";if(!await this.initMatchmaker())return"matchmaker_init_fail";return await new Promise((n)=>{let c=(h)=>{if(h.command==="notice")return;if(this.matchmaker.off("msg",c),h.command==="gameFound"){if(h.useAltGameURL)this.state.useAltGameURL=!0;return n(h)}if(h.error==="sessionNotFound")return n("internal_session_error");this.processError("unknown matchmaker response",JSON.stringify(h))};this.matchmaker.on("msg",c),this.matchmaker.send({command:"findGame",region:t,playType:X.CreatePrivate,gameType:e,sessionId:this.account.sessionId,noobLobby:!1,map:i})})}async join(t,e){if(this.state.name=t||"yolkbot",typeof e==="string"){if(e.includes("#"))e=e.split("#")[1];if(!await this.initMatchmaker())return"matchmaker_init_fail";if(await new Promise((n)=>{let c=(h)=>{if(h.command==="gameFound")this.matchmaker.off("msg",c),this.game.raw=h,this.game.code=h.id,n(h.id);if(h.error&&h.error==="gameNotFound")return this.processError(`game "${e}" not found, it may have expired.`),this.leave(),"gameNotFound"};this.matchmaker.on("msg",c),this.matchmaker.send({command:"joinGame",id:e,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 e==="object"){if(this.account.id===0)await this.loginAnonymously();if(this.game.raw=e,this.game.code=this.game.raw.id,!this.game.raw.id)return"invalid_game_object";if(!this.game.raw.subdomain)return"invalid_game_object";if(!this.game.raw.uuid)return"invalid_game_object"}let s=this.state.useAltGameURL?`${this.instance}/servers/${this.game.raw.subdomain}`:`${this.game.raw.subdomain}.${this.instance}`;if(this.game.socket=new F(`${this.protocol}://${s}/game/${this.game.raw.id}`,this.proxy),this.game.socket.binaryType="arraybuffer",this.game.socket.connectionTimeout=this.connectionTimeout,this.game.socket.onBeforeConnect=()=>{this.game.socket.onmessage=(r)=>this.processPacket(r.data),this.game.socket.onclose=(r)=>{if(this.state.left)this.state.left=!1;else this.emit("close",r.code),this.leave(-1)}},!await this.game.socket.tryConnect())return"websocket_tryconnect_fail";return!0}#n(){if(Object.entries(this.me.position).map((e)=>Math.floor(e[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 K(0));else{let e;if(this.pathing.activeNodeIdx<this.pathing.activePath.length-1)e=this.pathing.activePath[this.pathing.activeNodeIdx+1].flatCenter(),this.dispatch(new J(e));else e=this.pathing.activePath[this.pathing.activeNodeIdx].flatCenter(),this.dispatch(new J(e));for(let s of this.pathing.activePath)if(s.flatRadialDistance(this.me.position)<0.1&&s.position.y===Math.floor(this.me.position.y)){if(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}}if(!(this.state.controlKeys&S.Forward))this.dispatch(new K(S.Forward))}}update(){if(this.hasQuit)return;if(this.pathing.followingPath&&this.intents.includes(this.Intents.PATHFINDING))this.#n();for(let e=0;e<this.#t.length;e++){let s=this.#t[e];if(s.check(this))s.execute(this),this.#t.splice(e,1)}if(this.state.chatLines=Math.max(0,this.state.chatLines-0.008333333333333333),this.me.playing){let e=this.state.stateIdx;if(this.intents.includes(this.Intents.DEBUG_BUFFER))console.log("setting buffer for idx",e),console.log("checking...shotsFired",this.state.shotsFired);if(this.me.jumping=!!(this.state.controlKeys&S.Jump),this.state.buffer[e]={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");let s=new p;s.packInt8(a.syncMe),s.packInt8(this.state.stateIdx),s.packInt8(this.state.serverStateIdx);let i=St(this.state.stateIdx-C+1,j);for(let r=0;r<C;r++){let n=St(i+r,j),c=this.state.buffer[n]||{},h=c.controlKeys||0,m=c.shotsFired||0,f=c.yaw??this.state.yaw,u=c.pitch??this.state.pitch;if(this.intents.includes(this.Intents.DEBUG_BUFFER))console.log("going with",this.state.stateIdx,i,n,c);s.packInt8(h),s.packInt8(m),s.packString(Lt(f,u)),s.packInt8(100)}s.send(this.game.socket),this.state.buffer=[],this.lastUpdateTick=0}else this.lastUpdateTick++;this.state.stateIdx=St(this.state.stateIdx+1,j)}if(!this.intents.includes(this.Intents.PLAYER_HEALTH))return;let t=0.1*(this.game.isPrivate?this.game.options.healthRegen:1);for(let e of Object.values(this.players)){if(e.playing&&e.hp>0){let s=e.streakRewards.includes(g.OverHeal);e.hp+=s?-t:t,e.hp=s?Math.max(100,e.hp):Math.min(100,e.hp)}if(e.spawnShield>0)e.spawnShield-=6}}on(t,e){if(Object.keys(this.#e).includes(t))this.#e[t].push(e);else this.#e[t]=[e]}once(t,e){let s=(...i)=>{e(...i),this.off(t,s)};this.on(t,s)}onAny(t){this.#r.push(t)}off(t,e){if(e)this.#e[t]=this.#e[t].filter((s)=>s!==e);else this.#e[t]=[]}emit(t,...e){if(this.hasQuit)return;if(this.#e[t])for(let s of this.#e[t])s(...e);for(let s of this.#r)s(t,...e)}#c(){let t=o.unPackInt8U(),e=o.unPackInt8U(),s=o.unPackString().valueOf(),i=this.players[t];this.emit("chat",i,s,e)}#h(){let t=o.unPackInt8U(),e=this.intents.includes(this.Intents.COSMETIC_DATA),s={id:t,uniqueId:o.unPackString(),name:o.unPackString(),safeName:o.unPackString(),charClass:o.unPackInt8U(),team:o.unPackInt8U(),primaryWeaponItem:e?l(o.unPackInt16U()):o.unPackInt16U(),secondaryWeaponItem:e?l(o.unPackInt16U()):o.unPackInt16U(),shellColor:o.unPackInt8U(),hatItem:e?l(o.unPackInt16U()):o.unPackInt16U(),stampItem:e?l(o.unPackInt16U()):o.unPackInt16U(),stampPosX:o.unPackInt8(),stampPosY:o.unPackInt8(),grenadeItem:e?l(o.unPackInt16U()):o.unPackInt16U(),meleeItem:e?l(o.unPackInt16U()):o.unPackInt16U(),x:o.unPackFloat(),y:o.unPackFloat(),z:o.unPackFloat(),$dx:o.unPackFloat(),$dy:o.unPackFloat(),$dz:o.unPackFloat(),yaw:o.unPackRadU(),pitch:o.unPackRad(),score:o.unPackInt32U(),$kills:o.unPackInt16U(),$deaths:o.unPackInt16U(),$streak:o.unPackInt16U(),totalKills:o.unPackInt32U(),totalDeaths:o.unPackInt32U(),bestStreak:o.unPackInt16U(),$bestOverallStreak:o.unPackInt16U(),shield:o.unPackInt8U(),hp:o.unPackInt8U(),playing:o.unPackInt8U(),weaponIdx:o.unPackInt8U(),$controlKeys:o.unPackInt8U(),upgradeProductId:o.unPackInt8U(),activeShellStreaks:o.unPackInt8U(),social:o.unPackLongString(),hideBadge:o.unPackInt8U()};this.game.mapIdx=o.unPackInt8U(),this.game.isPrivate=o.unPackInt8U()===1,this.game.gameModeId=o.unPackInt8U();let i=new V(s,this.game.gameMode===M.KOTC?this.game.activeZone:null);if(!this.players[s.id])this.players[s.id]=i;if(this.emit("playerJoin",i),this.me.id===s.id)this.me=i,this.emit("botJoin",this.me)}#a(){let t=o.unPackInt8U(),e=o.unPackInt16U(),s=o.unPackFloat(),i=o.unPackFloat(),r=o.unPackFloat(),n=o.unPackInt8U(),c=o.unPackInt8U(),h=o.unPackInt8U(),m=o.unPackInt8U(),f=o.unPackInt8U(),u=this.players[t];if(u){if(u.playing=!0,u.randomSeed=e,u.weapons[0]&&u.weapons[0].ammo)u.weapons[0].ammo.rounds=n;if(u.weapons[0]&&u.weapons[0].ammo)u.weapons[0].ammo.store=c;if(u.weapons[1]&&u.weapons[1].ammo)u.weapons[1].ammo.rounds=h;if(u.weapons[1]&&u.weapons[1].ammo)u.weapons[1].ammo.store=m;u.grenades=f,u.position={x:s,y:i,z:r},u.spawnShield=120,this.emit("playerRespawn",u)}}#u(){let t=o.unPackInt8U(),e=o.unPackFloat(),s=o.unPackFloat(),i=o.unPackFloat(),r=o.unPackInt8U(),n=this.players[t];if(!n||n.id===this.me.id){for(let N=0;N<C;N++)o.unPackInt8U(),o.unPackRadU(),o.unPackRad(),o.unPackInt8U();return}for(let N=0;N<C;N++){let A=o.unPackInt8U();if(A&S.Jump)n.jumping=!0;else n.jumping=!1;if(A&S.Scope)n.scoping=!0;else n.scoping=!1;let v={...n.view};if(n.view.yaw=o.unPackRadU(),n.view.pitch=o.unPackRad(),n.view.yaw!==v.yaw||n.view.pitch!==v.pitch)this.emit("playerRotate",n,v,n.view);n.scale=o.unPackInt8U()}let c=n.position,h=c.x!==e||c.y!==s||c.z!==i,m=n.climbing!==r,f=h||m,u=f?{...c}:null;if(c.x!==e)c.x=e;if(c.z!==i)c.z=i;if(!n.jumping||Math.abs(c.y-s)>0.5)c.y=s;if(m)n.climbing=r;if(!f)return;if(this.emit("playerMove",n,u,c),this.game.gameModeId!==M.KOTC)return;let d=this.game.activeZone,k=!!n.inKotcZone;if(!d&&k){n.inKotcZone=!1,this.emit("playerLeaveZone",n);return}n.updateKotcZone(d);let E=!!n.inKotcZone;if(k!==E)n.inKotcZone=E,this.emit(E?"playerEnterZone":"playerLeaveZone",n)}#f(){let t=o.unPackInt8U(),e=this.players[t];if(e){if(e.playing=!1,e.streakRewards)e.streakRewards=[];if(this.emit("playerPause",e),e.inKotcZone)e.inKotcZone=!1,this.emit("playerLeaveZone",e)}}#m(){let t=o.unPackInt8U(),e=o.unPackInt8U(),s=this.players[t];if(s)s.activeGun=e,this.emit("playerSwapWeapon",s,e)}#p(){let t=o.unPackInt8U(),e=o.unPackInt8U();o.unPackInt8U(),o.unPackInt8U();let s=o.unPackInt8U(),i=this.players[t],r=this.players[e],n=i?{...i}:null;if(i){if(i.id===this.me.id)this.lastDeathTime=Date.now();i.playing=!1,i.streak=0,i.hp=100,i.spawnShield=0,i.stats.totalDeaths++,i.inKotcZone=!1,this.emit("playerLeaveZone",i)}if(r){if(r.streak++,r.stats.totalKills++,r.streak>r.stats.bestStreak)r.stats.bestStreak=r.streak}this.emit("playerDeath",i,r,n,s)}#d(){let t=o.unPackInt8U(),e={posX:o.unPackFloat(),posY:o.unPackFloat(),posZ:o.unPackFloat(),dirX:o.unPackFloat(),dirY:o.unPackFloat(),dirZ:o.unPackFloat()},s=this.players[t];if(!s)return;let i=s.weapons[s.activeGun];if(i&&i.ammo)i.ammo.rounds--,this.emit("playerFire",s,i,e)}#l(){let t=o.unPackInt16U(),e=o.unPackInt8U(),s=o.unPackFloat(),i=o.unPackFloat(),r=o.unPackFloat();this.game.collectables[e].push({id:t,x:s,y:i,z:r}),this.emit("spawnItem",e,{x:s,y:i,z:r},t)}#g(){let t=o.unPackInt8U(),e=o.unPackInt8U(),s=o.unPackInt8U(),i=o.unPackInt16U(),r=this.players[t];if(!r)return;if(this.game.collectables[e]=this.game.collectables[e].filter((n)=>n.id!==i),e===Y.Ammo){let n=r.weapons[s];if(n&&n.ammo)n.ammo.store=Math.min(n.ammo.storeMax,n.ammo.store+n.ammo.pickup),this.emit("playerCollectAmmo",r,n,i)}if(e===Y.Grenade){if(r.grenades++,r.grenades>3)r.grenades=3;this.emit("playerCollectGrenade",r,i)}}#x(){let t=o.unPackInt8U(),e=o.unPackInt8U(),s=this.players[t];if(!s)return;let i=s.hp;s.hp=e,this.emit("playerDamage",s,i,s.hp)}#w(){let t=o.unPackInt8U();o.unPackFloat(),o.unPackFloat();let e=this.me.hp;this.me.hp=t,this.emit("playerDamage",this.me,e,this.me.hp)}#k(){let t=o.unPackInt8U(),e=this.players[t];o.unPackInt8U();let s=o.unPackInt8U(),i=o.unPackFloat(),r=o.unPackFloat(),n=o.unPackFloat();if(this.me.climbing=!!o.unPackInt8U(),o.unPackInt8U(),o.unPackInt8U(),!e)return;this.state.serverStateIdx=s;let c=e.position.x,h=e.position.y,m=e.position.z;if(e.position.x=i,e.position.y=r,e.position.z=n,c!==i||h!==r||m!==n)this.emit("playerMove",e,{x:c,y:h,z:m},{x:i,y:r,z:n})}#M(){let t=new p;t.packInt8(a.eventModifier),t.send(this.game.socket)}#S(){let t=o.unPackInt8U(),e={...this.players[t]};delete this.players[t],this.emit("playerLeave",e)}#y(){if(this.game.gameModeId===M.Spatula){let t={...this.game};this.game.teamScore[1]=o.unPackInt16U(),this.game.teamScore[2]=o.unPackInt16U();let e={x:o.unPackFloat(),y:o.unPackFloat(),z:o.unPackFloat()},s=o.unPackInt8U(),i=o.unPackInt8U();this.game.spatula={coords:e,controlledBy:s,controlledByTeam:i},this.emit("gameStateChange",t,this.game)}else if(this.game.gameModeId===M.KOTC){let t={...this.game};this.game.stage=o.unPackInt8U(),this.game.zoneNumber=o.unPackInt8U(),this.game.capturing=o.unPackInt8U(),this.game.captureProgress=o.unPackInt16U(),this.game.numCapturing=o.unPackInt8U(),this.game.teamScore[1]=o.unPackInt8U(),this.game.teamScore[2]=o.unPackInt8U(),this.game.capturePercent=this.game.captureProgress/1000,this.game.activeZone=this.game.map.zones?this.game.map.zones[this.game.zoneNumber-1]:null;let e=Object.values(this.players).filter((s)=>s.inKotcZone&&s.playing);if(this.game.activeZone)Object.values(this.players).forEach((s)=>s.updateKotcZone(this.game.activeZone));if(this.game.numCapturing<=0)Object.values(this.players).forEach((s)=>{s.inKotcZone=!1,this.emit("playerLeaveZone",s)});this.emit("gameStateChange",t,this.game,e)}else if(this.game.gameModeId===M.Team)this.game.teamScore[1]=o.unPackInt16U(),this.game.teamScore[2]=o.unPackInt16U();if(this.game.gameModeId!==M.Spatula)delete this.game.spatula;if(this.game.gameModeId!==M.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;if(this.game.gameModeId===M.FFA)delete this.game.teamScore}#z(){let t=o.unPackInt8U(),e=o.unPackInt8U(),s=this.players[t];if(!s)return;switch(e){case g.HardBoiled:if(t===this.me.id)this.me.shieldHp=100;s.streakRewards.push(g.HardBoiled);break;case g.EggBreaker:s.streakRewards.push(g.EggBreaker);break;case g.Restock:{if(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;if(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 g.OverHeal:s.hp=Math.min(200,s.hp+100),s.streakRewards.push(g.OverHeal);break;case g.DoubleEggs:s.streakRewards.push(g.DoubleEggs);break;case g.MiniEgg:s.scale=0.5,s.streakRewards.push(g.MiniEgg);break}this.emit("playerBeginStreak",s,e)}#T(){let t=o.unPackInt8U(),e=o.unPackInt8U(),s=this.players[t];if(!s)return;if([g.EggBreaker,g.OverHeal,g.DoubleEggs,g.MiniEgg].includes(e)&&s.streakRewards.includes(e))s.streakRewards=s.streakRewards.filter((r)=>r!==e);if(e===g.MiniEgg)s.scale=1;this.emit("playerEndStreak",s,e)}#E(){let t=o.unPackInt8U(),e=o.unPackInt8U(),s=o.unPackFloat(),i=o.unPackFloat();if(!this.me)return;if(this.me.shieldHp=t,this.me.hp=e,this.me.shieldHp<=0)this.me.streakRewards=this.me.streakRewards.filter((r)=>r!==g.HardBoiled),this.emit("selfShieldLost",this.me.hp,{dx:s,dz:i});else this.emit("selfShieldHit",this.me.shieldHp,this.me.hp,{dx:s,dz:i})}#P(){let t={...this.game.options},e=o.unPackInt8U(),s=o.unPackInt8U(),i=o.unPackInt8U();if(e<1||e>4)e=4;if(s<0||s>8)s=4;if(i>16)i=4;this.game.options.gravity=e/4,this.game.options.damage=s/4,this.game.options.healthRegen=i/4;let r=o.unPackInt8U();Object.keys(Kt).forEach((n)=>{let c=r&Kt[n]?1:0;this.game.options[n]=c}),this.game.options.weaponsDisabled=Array.from({length:7},()=>o.unPackInt8U()===1),this.game.options.mustUseSecondary=this.game.options.weaponsDisabled.every((n)=>n),this.emit("gameOptionsChange",t,this.game.options)}#N(){let t=o.unPackInt8U();if(t===L.Pause)this.emit("gameForcePause"),setTimeout(()=>this.me.playing=!1,3000);if(t===L.Reset){if(Object.values(this.players).forEach((e)=>e.streak=0),this.game.gameModeId!==M.FFA)this.game.teamScore=[0,0,0];if(this.game.gameModeId===M.Spatula)this.game.spatula.controlledBy=0,this.game.spatula.controlledByTeam=0,this.game.spatula.coords={x:0,y:0,z:0};if(this.game.gameModeId===M.KOTC)this.game.stage=Q.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")}}#G(){if(!this.intents.includes(this.Intents.PING))return;let t=this.ping;this.ping=Date.now()-this.lastPingTime,this.emit("pingUpdate",t,this.ping),setTimeout(()=>{let e=new p;e.packInt8(a.ping),e.send(this.game.socket),this.lastPingTime=Date.now()},1000)}#O(){let t=o.unPackInt8U(),e=o.unPackInt8U(),s=this.players[t];if(!s)return;let i=s.team;s.team=e,s.streak=0,this.emit("playerSwitchTeam",s,i,e)}#R(){let t=o.unPackInt8U(),e=o.unPackInt8U(),s=o.unPackInt16U(),i=o.unPackInt16U(),r=o.unPackInt8U(),n=o.unPackInt16U(),c=o.unPackInt16U(),h=o.unPackInt16U(),m=o.unPackInt16U(),f=o.unPackInt8(),u=o.unPackInt8(),d=this.intents.includes(this.Intents.COSMETIC_DATA),k=d?l(s):s,E=d?l(i):i,N=d?l(n):n,A=d?l(c):c,v=d?l(h):h,H=d?l(m):m,x=this.players[t];if(x){let z={...x.character},zt=x.selectedGun;if(x.character.eggColor=r,x.character.primaryGun=k,x.character.secondaryGun=E,x.character.stamp=A,x.character.hat=N,x.character.grenade=v,x.character.melee=H,x.character.stampPos.x=f,x.character.stampPos.y=u,x.selectedGun=e,x.weapons[0]=new _[e],zt!==x.selectedGun)this.emit("playerChangeGun",x,zt,x.selectedGun);if(z!==x.character)this.emit("playerChangeCharacter",x,z,x.character)}}#_(){let t=o.unPackInt32U(),e=this.account.eggBalance;this.account.eggBalance=t,this.emit("balanceUpdate",e,t)}#A(){this.me.playing=!1,this.emit("respawnDenied")}#v(){let t=o.unPackInt8U(),e=this.players[t];if(e)this.emit("playerMelee",e)}#C(){let t=o.unPackInt8U(),e=this.players[t];if(!e)return;let s=e.weapons[e.activeGun];if(s.ammo){let 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",e,s)}updateGameOptions(){let t=new p;t.packInt8(a.gameOptions),t.packInt8(this.game.options.gravity*4),t.packInt8(this.game.options.damage*4),t.packInt8(this.game.options.healthRegen*4);let e=(this.game.options.locked?1:0)|(this.game.options.noTeamChange?2:0)|(this.game.options.noTeamShuffle?4:0);t.packInt8(e),this.game.options.weaponsDisabled.forEach((s)=>{t.packInt8(s?1:0)}),t.send(this.game.socket)}#L(){this.game.isPrivate=!0,this.updateGameOptions()}#F(){let t=o.unPackInt8U(),e=o.unPackInt16U(),s=o.unPackFloat(),i=o.unPackFloat(),r=o.unPackFloat(),n=o.unPackInt8U(),c=o.unPackFloat();if(this.intents.includes(this.Intents.COSMETIC_DATA))e=l(e);if(t===P.Grenade)this.emit("grenadeExplode",e,{x:s,y:i,z:r},n,c);else this.emit("rocketHit",{x:s,y:i,z:r},n,c)}#q(){let t=o.unPackInt8U(),e=o.unPackFloat(),s=o.unPackFloat(),i=o.unPackFloat(),r=o.unPackFloat(),n=o.unPackFloat(),c=o.unPackFloat(),h=this.players[t];if(h)h.grenades--,this.emit("playerThrowGrenade",h,{x:e,y:s,z:i},{x:r,y:n,z:c})}#U(){let t=o.unPackInt8U(),e=o.unPackInt8U(),s=this.players[t];if(!s)return;if(!this.intents.includes(this.Intents.CHALLENGES))return this.emit("challengeComplete",s,e);let i=this.account.challenges.find((r)=>r.id===e);if(this.emit("challengeComplete",s,i),s.id===this.me.id)this.refreshChallenges()}#W(){let t=new p;t.packInt8(this.intents.includes(this.Intents.OBSERVE_GAME)?a.observeGame:a.joinGame),t.packString(this.game.raw.uuid),t.packInt8(+this.intents.includes(this.Intents.VIP_HIDE_BADGE)),t.packInt8(this.state.weaponIdx||this.account?.loadout?.classIdx||0),t.packString(this.state.name),t.packInt32(this.account.session),t.packString(this.account.sessionId),t.packString(this.account.firebaseId),t.send(this.game.socket)}async#j(){if(this.me.id=o.unPackInt8U(),this.me.team=o.unPackInt8U(),this.game.gameModeId=o.unPackInt8U(),this.game.gameMode=Jt[this.game.gameModeId],this.game.mapIdx=o.unPackInt8U(),this.game.map=b[this.game.mapIdx],this.game.playerLimit=o.unPackInt8U(),this.game.isGameOwner=o.unPackInt8U()===1,this.game.isPrivate=o.unPackInt8U()===1||this.game.isGameOwner,o.unPackInt8U(),this.intents.includes(this.Intents.LOAD_MAP)||this.intents.includes(this.Intents.PATHFINDING)){if(this.game.map.raw=await jt(this.game.map.filename,this.game.map.hash),this.emit("mapLoad",this.game.map.raw),this.game.gameModeId===M.KOTC){let e=this.game.map.raw.data["DYNAMIC.capture-zone.none"];if(e){if(this.game.map.zones=$t(e),!this.game.activeZone)this.game.activeZone=this.game.map.zones[this.game.zoneNumber-1]}else delete this.game.map.zones}if(this.intents.includes(this.Intents.PATHFINDING))this.pathing.nodeList=new kt(this.game.map.raw)}this.state.inGame=!0,this.lastDeathTime=Date.now();let t=new p;if(t.packInt8(a.clientReady),t.send(this.game.socket),this.updateIntervalId=setInterval(()=>this.update(),33.333333333333336),this.intents.includes(this.Intents.PING)){this.lastPingTime=Date.now();let e=new p;e.packInt8(a.ping),e.send(this.game.socket)}if(this.intents.includes(this.Intents.NO_AFK_KICK))this.afkKickInterval=setInterval(()=>{if(this.state.inGame&&!this.me.playing&&Date.now()-this.lastDeathTime>=15000){let e=new p;e.packInt8(a.keepAlive),e.send(this.game.socket)}},15000);this.emit("gameReady")}#$(){let t=o.unPackInt8U(),e=o.unPackString(128),s=o.unPackString(32),i=this.players[t];if(!i)return;i.admin={ip:s,dbId:e},this.emit("playerInfo",i,s,e)}packetHandlers={[a.syncThem]:()=>this.#u(),[a.fire]:()=>this.#d(),[a.hitThem]:()=>this.#x(),[a.syncMe]:()=>this.#k(),[a.hitMe]:()=>this.#w(),[a.swapWeapon]:()=>this.#m(),[a.collectItem]:()=>this.#g(),[a.respawn]:()=>this.#a(),[a.die]:()=>this.#p(),[a.pause]:()=>this.#f(),[a.chat]:()=>this.#c(),[a.addPlayer]:()=>this.#h(),[a.removePlayer]:()=>this.#S(),[a.eventModifier]:()=>this.#M(),[a.metaGameState]:()=>this.#y(),[a.beginShellStreak]:()=>this.#z(),[a.endShellStreak]:()=>this.#T(),[a.hitMeHardBoiled]:()=>this.#E(),[a.gameOptions]:()=>this.#P(),[a.ping]:()=>this.#G(),[a.switchTeam]:()=>this.#O(),[a.changeCharacter]:()=>this.#R(),[a.reload]:()=>this.#C(),[a.explode]:()=>this.#F(),[a.throwGrenade]:()=>this.#q(),[a.spawnItem]:()=>this.#l(),[a.melee]:()=>this.#v(),[a.updateBalance]:()=>this.#_(),[a.challengeCompleted]:()=>this.#U(),[a.socketReady]:()=>this.#W(),[a.gameJoined]:()=>this.#j(),[a.gameAction]:()=>this.#N(),[a.requestGameOptions]:()=>this.#L(),[a.respawnDenied]:()=>this.#A(),[a.playerInfo]:()=>this.#$(),[a.expireUpgrade]:()=>{},[a.clientReady]:()=>{},[a.musicInfo]:()=>o.unPackLongString()};processPacket(t){if(o.init(t),this.intents.includes(this.Intents.PACKET_HOOK))this.emit("packet",t);let e=0,s=0,i=!1;while(o.isMoreDataAvailable()&&!i){let r=o.unPackInt8U(),n=this.packetHandlers[r];if(n)n();else{if(console.error(`processPacket: I got but couldn't identify a: ${Object.keys(a).find((c)=>a[c]===r)} ${r}`),e)console.error(`processPacket: It may be a result of the ${e} command (${s}).`);i=!0;break}if(e=Object.keys(a).find((c)=>a[c]===r),s=r,this.intents.includes(this.Intents.LOG_PACKETS))console.log(`[LOG_PACKETS] Packet ${e}: ${s}`)}}async checkChiknWinner(){let t=await this.api.queryServices({cmd:"chicknWinnerReady",id:this.account.id,sessionId:this.account.sessionId});if(typeof t==="string")return t;return this.account.cw.limit=t.limit,this.account.cw.atLimit=t.limit>=4,this.account.cw.secondsUntilPlay=(this.account.cw.atLimit?t.period:t.span)||0,this.account.cw.canPlayAgain=Date.now()+this.account.cw.secondsUntilPlay*1000,this.account.cw}async playChiknWinner(t=!0){if(this.account.cw.atLimit||this.account.cw.limit>ft)return"hit_daily_limit";if(this.account.cw.canPlayAgain>Date.now()&&t)return"on_cooldown";let e=await this.api.queryServices({cmd:"incentivizedVideoReward",firebaseId:this.account.firebaseId,id:this.account.id,sessionId:this.account.sessionId,token:null});if(typeof e==="string")return e;if(e.error){if(e.error==="RATELIMITED"||e.error==="RATELMITED")return await this.checkChiknWinner(),"on_cooldown";else if(e.error==="SESSION_EXPIRED")return this.emit("sessionExpired"),"session_expired";return console.error("Unknown Chikn Winner response, report this on Github:",e),"unknown_error"}if(e.reward)return this.account.eggBalance+=e.reward.eggsGiven,e.reward.itemIds.forEach((s)=>this.account.ownedItemIds.push(s)),await this.checkChiknWinner(),e.reward;return console.error("Unknown Chikn Winner response, report this on Github:",e),"unknown_error"}async resetChiknWinner(){if(this.account.eggBalance<200)return"not_enough_eggs";if(!this.account.cw.atLimit)return"not_at_limit";let t=await this.api.queryServices({cmd:"chwReset",sessionId:this.account.sessionId});if(typeof t==="string")return t;if(t.result!=="SUCCESS")return console.error("Unknown Chikn Winner reset response, report this on Github:",t),"unknown_error";return this.account.eggBalance-=200,await this.checkChiknWinner(),this.account.cw}canSee(t){if(!this.intents.includes(this.Intents.PATHFINDING))return this.processError("You must have the PATHFINDING intent to use this method.");return this.pathing.nodeList.hasLineOfSight(this.me.position,t.position)}async refreshChallenges(){let t=await this.api.queryServices({cmd:"challengeGetDaily",sessionId:this.account.sessionId,playerId:this.account.id});if(typeof t==="string")return t;return this.#i(t),this.account.challenges}async rerollChallenge(t){let e=await this.api.queryServices({cmd:"challengeRerollSlot",sessionId:this.account.sessionId,slotId:t});if(typeof e==="string")return e;return this.#i(e),this.account.challenges}async claimChallenge(t){let e=await this.api.queryServices({cmd:"challengeClaimReward",sessionId:this.account.sessionId,slotId:t});if(typeof e==="string")return e;if(this.#i(e.challenges),e.reward>0)this.account.eggBalance+=e.reward;return{eggReward:e.reward,updatedChallenges:this.account.challenges}}async refreshBalance(){let t=await this.api.queryServices({cmd:"checkBalance",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId});if(typeof t==="string")return t;return this.account.eggBalance=t.currentBalance,t.currentBalance}async redeemCode(t){let e=await this.api.queryServices({cmd:"redeem",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,id:this.account.id,code:t});if(typeof e==="string")return e;if(e.result==="SUCCESS")return this.account.eggBalance=e.eggs_given,e.item_ids.forEach((s)=>this.account.ownedItemIds.push(s)),{result:e,eggsGiven:e.eggs_given,itemIds:e.item_ids};return e}async claimURLReward(t){let e=await this.api.queryServices({cmd:"urlRewardParams",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,reward:t});if(typeof e==="string")return e;if(e.result==="SUCCESS")this.account.eggBalance+=e.eggsGiven,e.itemIds.forEach((s)=>this.account.ownedItemIds.push(s));return e}async claimSocialReward(t){let e=await this.api.queryServices({cmd:"reward",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,rewardTag:t});if(typeof e==="string")return e;if(e.result==="SUCCESS")this.account.eggBalance+=e.eggsGiven,e.itemIds.forEach((s)=>this.account.ownedItemIds.push(s));return e}async buyItem(t){let e=await this.api.queryServices({cmd:"buy",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,itemId:t,save:!0});if(typeof e==="string")return e;if(e.result==="SUCCESS")this.account.eggBalance=e.currentBalance,this.account.ownedItemIds.push(e.itemId);return e}processError(...t){let e=t.join(" ");if(this.#e.error&&this.#e.error.length)this.emit("error",e);else if(this.intents.includes(this.Intents.NO_EXIT_ON_ERROR))console.error(e);else throw Error(e)}leave(t=D.mainMenu){if(this.hasQuit)return;if(t>-1)this.game?.socket?.close(t),this.state.left=!0,this.emit("leave",t);clearInterval(this.updateIntervalId),this.#t=[],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 V({}),this.game=this.#o,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(){if(this.account=this.#s,this.intents.includes(this.Intents.RENEW_SESSION))clearInterval(this.renewSessionInterval)}quit(t=!1){if(this.hasQuit)return;if(this.leave(),this.matchmaker){if(this.matchmaker.close(),!t)delete this.matchmaker}if(!t)delete this.account,delete this.api,delete this.game,delete this.me,delete this.pathing,delete this.players,delete this.state,this.#s={},this.#o={},this.#e={},this.#r=[],this.#t=[];if(this.intents.includes(this.Intents.NO_AFK_KICK))clearInterval(this.afkKickInterval);if(this.intents.includes(this.Intents.RENEW_SESSION))clearInterval(this.renewSessionInterval);this.hasQuit=!0}}class Yt{constructor(t,e,s=""){this.uniqueId=t,this.duration=e,this.reason=s}validate(t){if(typeof this.uniqueId!=="string"||typeof this.reason!=="string")return!1;if(typeof this.duration!=="number"||!Object.values(ut).some((e)=>this.duration===e))return!1;if(!(t.account.adminRoles&4))return!1;return!0}check(){return!0}execute(t){let e=new p;e.packInt8(a.banPlayer),e.packString(this.uniqueId),e.packString(this.reason),e.packInt8(this.duration),e.send(t.game.socket)}}var Qt=Yt;class Xt{constructor(t){this.uniqueId=t}validate(t){return typeof this.uniqueId==="string"&&t.game.isGameOwner&&Object.values(t.players).find((e)=>e.uniqueId===this.uniqueId)}check(){return!0}execute(t){let e=new p;e.packInt8(a.bootPlayer),e.packString(this.uniqueId),e.send(t.game.socket)}}var It=Xt;class Dt{constructor(t){this.msg=t}validate(){if(typeof this.msg!=="string")return!1;if(this.msg.length<1||this.msg.length>64)return!1;return!0}check(t){if(!t.state?.inGame)return!1;if(!t.game.isPrivate&&!t.account.adminRoles&&t.state.chatLines>=2)return!1;if(!t.game.isPrivate&&!t.account.emailVerified&&!t.account.isAged)return!1;return!0}execute(t){t.state.chatLines++;let e=new p;e.packInt8(a.chat),e.packString(this.msg),e.send(t.game.socket)}}var Vt=Dt;class bt{constructor(t){this.amount=t||1}validate(){return this.amount>=1}check(t){return t.me.playing&&!t.state.reloading&&!t.state.swappingGun&&!t.state.usingMelee&&t.me.weapons[t.me.activeGun].ammo.rounds>=this.amount}execute(t){t.state.shotsFired+=this.amount||1}}var te=bt;var ts=Array.from({length:4},(t,e)=>(e+1)*0.25),es=Array.from({length:9},(t,e)=>e*0.25),ss=Array.from({length:17},(t,e)=>e*0.25),y=(t,e)=>typeof t>"u"?e:t;class ee{constructor(t){this.changes=t}#t(t){let e={};if(e.gravity=y(this.changes.gravity,t.game.options.gravity),e.damage=y(this.changes.damage,t.game.options.damage),e.healthRegen=y(this.changes.healthRegen,t.game.options.healthRegen),e.locked=y(this.changes.locked,t.game.options.locked),e.noTeamChange=y(this.changes.noTeamChange,t.game.options.noTeamChange),e.noTeamShuffle=y(this.changes.noTeamShuffle,t.game.options.noTeamShuffle),e.weaponsDisabled=[y(this.changes.disableEggk,t.game.options.weaponsDisabled[0]),y(this.changes.disableScrambler,t.game.options.weaponsDisabled[1]),y(this.changes.disableFreeRanger,t.game.options.weaponsDisabled[2]),y(this.changes.disableRPG,t.game.options.weaponsDisabled[3]),y(this.changes.disableWhipper,t.game.options.weaponsDisabled[4]),y(this.changes.disableCrackshot,t.game.options.weaponsDisabled[5]),y(this.changes.disableTriHard,t.game.options.weaponsDisabled[6])],this.changes.toDisable&&Array.isArray(this.changes.toDisable))this.changes.toDisable.forEach((s)=>e.weaponsDisabled[s]=!0);if(this.changes.toEnable&&Array.isArray(this.changes.toEnable))this.changes.toEnable.forEach((s)=>e.weaponsDisabled[s]=!1);if(this.changes.rawWeaponsDisabled&&Array.isArray(this.changes.rawWeaponsDisabled)&&this.changes.rawWeaponsDisabled.length===7)e.weaponsDisabled=this.changes.rawWeaponsDisabled.map((s)=>!!s);return e.mustUseSecondary=e.weaponsDisabled.every((s)=>s),e}validate(t){let e=this.#t(t);if(!ts.includes(e.gravity))return!1;if(!es.includes(e.damage))return!1;if(!ss.includes(e.healthRegen))return!1;if(typeof e.locked!=="boolean")return!1;if(typeof e.noTeamChange!=="boolean")return!1;if(typeof e.noTeamShuffle!=="boolean")return!1;if(!Array.isArray(e.weaponsDisabled))return!1;if(e.weaponsDisabled.length!==7)return!1;if(e.weaponsDisabled.some((s)=>typeof s!=="boolean"))return!1;return!0}check(t){return t.game.isGameOwner}execute(t){t.game.options=this.#t(t),t.updateGameOptions()}}var se=ee;class yt{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(){let t=this.content[0],e=this.content.pop();if(this.content.length>0)this.content[0]=e,this.sinkDown(0);return t}remove(t){let e=this.content.length;for(let s=0;s<e;s++){if(this.content[s]!==t)continue;let i=this.content.pop();if(s===e-1)break;this.content[s]=i,this.bubbleUp(s),this.sinkDown(s);break}}size(){return this.content.length}bubbleUp(t){let e=this.content[t],s=this.scoreFunction(e);while(t>0){let i=Math.floor((t+1)/2)-1,r=this.content[i];if(s>=this.scoreFunction(r))break;this.content[i]=e,this.content[t]=r,t=i}}includes(t){return this.content.includes(t)}sinkDown(t){let e=this.content.length,s=this.content[t],i=this.scoreFunction(s);while(!0){let r=(t+1)*2,n=r-1,c=null,h;if(n<e){let m=this.content[n];if(h=this.scoreFunction(m),h<i)c=n}if(r<e){let m=this.content[r];if(this.scoreFunction(m)<(c===null?i:h))c=r}if(c===null)break;this.content[t]=this.content[c],this.content[c]=s,t=c}}}class T{constructor(t){this.list=t}heuristic(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)+Math.abs(t.z-e.z)}reversePath(t){let e=[];while(t.parent)e.push(t),t=t.parent;return e.reverse(),e}path(t,e){this.list.clean();let s=new yt((r)=>r.f),i=[];t.h=this.heuristic(t,e),t.g=0,t.f=t.g+t.h,s.push(t);while(s.size()!==0){let r=s.pop();if(r===e)return this.reversePath(r);i.push(r);let n=r.links;for(let c=0;c<n.length;c++){let h=n[c];if(i.includes(h))continue;let m=r.g+1,f=h.visited;if(!f||m<h.g)if(h.visited=!0,h.parent=r,h.g=m,h.h=this.heuristic(h.position,e.position),h.f=h.g+h.h,f)s.rescoreElement(h);else s.push(h)}}return null}}class ie{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 T(t.pathing.nodeList);let e=200,s=null;for(let h of t.game.collectables[0]){let m=h.x-t.me.position.x,f=h.y-t.me.position.y,u=h.z-t.me.position.z,d=Math.sqrt(m*m+f*f+u*u);if(d<e)e=d,s=h}let i=Object.entries(t.me.position).map((h)=>Math.floor(h[1])),r=Object.entries(s).map((h)=>Math.floor(h[1])),n=t.pathing.nodeList.at(...i),c=t.pathing.nodeList.at(...r);if(t.pathing.activePath=this.pather.path(n,c),!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 oe=ie;class re{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 T(t.pathing.nodeList);let e=200,s=null;for(let h of t.game.activeZone){let m=h.x-t.me.position.x,f=h.y-t.me.position.y,u=h.z-t.me.position.z,d=Math.sqrt(m*m+f*f+u*u);if(d<e)e=d,s=h}let i=Object.entries(t.me.position).map((h)=>Math.floor(h[1])),r=Object.entries(s).map((h)=>Math.floor(h[1])),n=t.pathing.nodeList.at(...i),c=t.pathing.nodeList.at(...r);if(t.pathing.activePath=this.pather.path(n,c),!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 ne=re;class ce{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 T(t.pathing.nodeList);let e=200,s=null;for(let h of t.game.collectables[1]){let m=h.x-t.me.position.x,f=h.y-t.me.position.y,u=h.z-t.me.position.z,d=Math.sqrt(m*m+f*f+u*u);if(d<e)e=d,s=h}let i=Object.entries(t.me.position).map((h)=>Math.floor(h[1])),r=Object.entries(s).map((h)=>Math.floor(h[1])),n=t.pathing.nodeList.at(...i),c=t.pathing.nodeList.at(...r);if(t.pathing.activePath=this.pather.path(n,c),!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 he=ce;class ae{idOrName;constructor(t){this.idOrName=t}validate(t){if(!t.intents.includes(t.Intents.PATHFINDING))return!1;if(!this.idOrName)return!1;return!!(t.players[this.idOrName.toString()]||t.players.find((s)=>s.name===this.idOrName))}check(t){if(!t.me.playing)return!1;let e=t.players[this.idOrName.toString()]||t.players.find((s)=>s.name===this.idOrName);return e&&e.playing&&e.position&&e.position.x}execute(t){this.pather=new T(t.pathing.nodeList);let e=t.players[this.idOrName.toString()]||t.players.find((c)=>c.name===this.idOrName),s=Object.entries(t.me.position).map((c)=>Math.floor(c[1])),i=Object.entries(e.position).map((c)=>Math.floor(c[1])),r=t.pathing.nodeList.at(...s),n=t.pathing.nodeList.at(...i);if(t.pathing.activePath=this.pather.path(r,n),!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 ue=ae;class fe{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 T(t.pathing.nodeList);let e=Object.entries(t.me.position).map((n)=>Math.floor(n[1])),s=Object.entries(t.game.spatula.coords).map((n)=>Math.floor(n[1])),i=t.pathing.nodeList.at(...e),r=t.pathing.nodeList.at(...s);if(t.pathing.activePath=this.pather.path(i,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 me=fe;var is=(t,e)=>(t%e+e)%e,os=Math.PI*2,pe=(t)=>Math.round(t*8192)/8192,rs=(t)=>pe(is(Math.atan2(-t.x,-t.z),os)),ns=(t)=>pe(Math.atan2(t.y,Math.hypot(t.x,t.z)));class de{idOrName;constructor(t){this.idOrName=t}validate(t){return!!(t.players[this.idOrName.toString()]||t.players.find((s)=>s.name===this.idOrName))}check(t){if(!t.me.playing)return!1;let e=t.players[this.idOrName.toString()]||t.players.find((s)=>s.name===this.idOrName);return e&&e.playing&&e.position&&e.position.x}execute(t){let e=t.players[this.idOrName.toString()]||t.players.find((n)=>n.name===this.idOrName),s={x:e.position.x-t.me.position.x,y:e.position.y-t.me.position.y-0.05,z:e.position.z-t.me.position.z},i=rs(s),r=ns(s);t.state.yaw=i,t.state.pitch=r}}var le=de;class ge{validate(){return!0}check(t){return t.me.playing&&!t.state.reloading&&!t.state.swappingGun&&!t.state.usingMelee}execute(t){let e=new p;e.packInt8(a.melee),e.send(t.game.socket),t.usingMelee=!0,setTimeout(()=>{t.usingMelee=!1,t.swappingGun=!0,setTimeout(()=>{t.swappingGun=!1},0.5*pt)},566.6666666666667)}}var xe=ge;class we{validate(){return!0}check(t){return t.me.playing}execute(t){let e=new p;e.packInt8(a.pause),e.send(t.game.socket),setTimeout(()=>t.me.playing=!1,3000)}}var ke=we;class Me{validate(){return!0}check(t){return t.me.playing&&!t.state.reloading&&!t.state.swappingGun&&!t.state.usingMelee}execute(t){let e=new p;e.packInt8(a.reload),e.send(t.game.socket);let s=t.me.weapons[t.me.activeGun];if(s.ammo){let n=Math.min(Math.min(s.ammo.capacity,s.ammo.reload)-s.ammo.rounds,s.ammo.store);s.ammo.rounds+=n,s.ammo.store-=n}t.emit("playerReload",t.me,s);let i=t.me.weapons[t.me.activeGun],r=i.ammo.rounds<1;t.state.reloading=!0,setTimeout(()=>t.state.reloading=!1,r?i.longReloadTime:i.shortReloadTime)}}var Se=Me;class ye{constructor(t,e={}){if(this.idOrName=t,this.reasons=[!!e.cheating,!!e.harassment,!!e.offensive,!!e.other],!this.reasons.includes(!0))this.reasons[3]=!0;for(let s=0;s<this.reasons.length;s++)if(this.reasons[s]===!0)this.reasonInt|=1<<s}validate(t){if(this.reasons.every((s)=>s===!1))return!1;if(!(t.players[this.idOrName.toString()]||t.players.find((s)=>s.name===this.idOrName)))return!1;return!0}check(t){if(!t.state.inGame)return!1;return!!(t.players[this.idOrName.toString()]||t.players.find((s)=>s.name===this.idOrName))}execute(t){let e=t.players[this.idOrName.toString()]||t.players.find((i)=>i.name===this.idOrName),s=new p;s.packInt8(a.reportPlayer),s.packString(e.uniqueId),s.packInt8(this.reasonInt),s.send(t.game.socket)}}var ze=ye;class Te{validate(){return!0}check(t){return t.game.isGameOwner}execute(t){let e=new p;e.packInt8(a.gameAction),e.packInt8(L.Reset),e.send(t.game.socket)}}var Ee=Te;var q=(t)=>l(t)&&l(t).unlock==="default",U=(t,e)=>l(t)&&l(t).item_type_id===e;class Pe{constructor(t){this.changes={classIdx:t.gunId,hatId:t.hatId,stampId:t.stampId,grenadeId:t.grenadeId,meleeId:t.meleeId,colorIdx:t.eggColor,primaryId:t.primaryIds,secondaryId:t.secondaryIds},this.changes=Object.fromEntries(Object.entries(this.changes).filter(([,e])=>!!e))}validate(t){let e=this.changes;if(e.colorIdx&&e.colorIdx>=7&&!t.account.vip)return!1;if(e.colorIdx&&e.colorIdx>=14)return!1;if(U(e.hatId,P.Hat)&&!q(e.hatId)&&!t.account.ownedItemIds.includes(e.hatId))return!1;if(U(e.stampId,P.Stamp)&&!q(e.stampId)&&!t.account.ownedItemIds.includes(e.stampId))return!1;if(U(e.grenadeId,P.Grenade)&&!q(e.grenadeId)&&!t.account.ownedItemIds.includes(e.grenadeId))return!1;if(U(e.meleeId,P.Melee)&&!q(e.meleeId)&&!t.account.ownedItemIds.includes(e.meleeId))return!1;if(typeof e.classIdx==="number"&&e.classIdx>6||e.classIdx<0)return!1;if(this.changes.primaryId)for(let s=0;s<7;s++){let i=this.changes.primaryId[s];if(!U(i,P.Primary)||!q(i)&&!t.account.ownedItemIds.includes(i))return!1}if(this.changes.secondaryId)for(let s=0;s<7;s++){let i=this.changes.secondaryId[s];if(!U(i,P.Secondary)||!q(i)&&!t.account.ownedItemIds.includes(i))return!1}return!0}check(t){return!t.me.playing}execute(t){if(t.me&&this.changes.classIdx&&this.changes.classIdx!==t.me.selectedGun)t.me.weapons[0]=new _[this.changes.classIdx];t.state.weaponIdx=this.changes.classIdx||t.state.weaponIdx;let e={...t.account.loadout,...this.changes},s=t.api.queryServices({cmd:"saveLoadout",save:!0,firebaseId:t.account.firebaseId,sessionId:t.account.sessionId,loadout:e});if(t.account.loadout=e,t.me)s.then(()=>{if(t.state.inGame){let r=new p;r.packInt8(a.changeCharacter),r.packInt8(this.changes?.classIdx||t.me.selectedGun),r.send(t.game.socket)}let i=t.intents.includes(t.Intents.COSMETIC_DATA);Object.entries(this.changes).forEach(([r,n])=>{if(r==="classIdx")t.me.selectedGun=n;else if(r==="hatId")t.me.character.hat=i?l(n):n;else if(r==="stampId")t.me.character.stamp=i?l(n):n;else if(r==="grenadeId")t.me.character.grenade=i?l(n):n;else if(r==="meleeId")t.me.character.melee=i?l(n):n;else if(r==="colorIdx")t.me.character.eggColor=n;else if(r==="primaryId")t.me.character.primaryGun=i?l(n[t.me.selectedGun]):n;else if(r==="secondaryId")t.me.character.secondaryGun=i?l(n[t.me.selectedGun]):n})})}}var Ne=Pe;class Ge{validate(){return!0}check(t){if(t.me.playing)return!1;if(t.lastDeathTime+6000<Date.now())return!1;if(t.intents.includes(t.Intents.OBSERVE_GAME))return!1;return!0}execute(t){let e=new p;e.packInt8(a.requestRespawn),e.send(t.game.socket),t.state.buffer=[]}}var Oe=Ge;class Re{constructor(t){this.manualWeapon=t}validate(){return typeof this.manualWeapon==="number"||typeof this.manualWeapon>"u"}check(t){return t.me.playing&&!t.state.reloading&&!t.state.swappingGun&&!t.state.usingMelee}execute(t){let e=+!t.me.activeGun;if(typeof this.manualWeapon==="number")e=this.manualWeapon;t.me.activeGun=e;let s=new p;s.packInt8(a.swapWeapon),s.packInt8(t.me.activeGun),s.send(t.game.socket)}}var _e=Re;class Ae{validate(){return!0}check(t){if(!t.state.inGame||t.me.playing)return!1;if(t.game.gameModeId===0)return!1;if(t.intents.includes(t.Intents.OBSERVE_GAME))return!1;if(t.game.isPrivate)return!t.game.options.noTeamChange;let e=t.players,s=t.me.team,i=e.filter((n)=>n.team===s).length,r=e.filter((n)=>n.team!==s).length;if(r>i)return!1;if(i===r)return!1;return!0}execute(t){let e=new p;e.packInt8(a.switchTeam),e.send(t.game.socket)}}var ve=Ae;class Ce{constructor(t=1){this.power=t}validate(){return typeof this.power==="number"&&this.power>=0&&this.power<=1}check(t){return t.me.playing&&!t.state.reloading&&!t.state.swappingGun&&!t.state.usingMelee}execute(t){let e=new p;e.packInt8(a.throwGrenade),e.packFloat(this.power),e.send(t.game.socket)}}var Le=Ce;var cs={BanPlayerDispatch:Qt,BootPlayerDispatch:It,ChatDispatch:Vt,FireDispatch:te,GameOptionsDispatch:se,GoToAmmoDispatch:oe,GoToCoopDispatch:ne,GoToGrenadeDispatch:he,GoToPlayerDispatch:ue,GoToSpatulaDispatch:me,LookAtDispatch:le,LookAtPosDispatch:J,MeleeDispatch:xe,MovementDispatch:K,PauseDispatch:ke,ReloadDispatch:Se,ReportPlayerDispatch:ze,ResetGameDispatch:Ee,SaveLoadoutDispatch:Ne,SpawnDispatch:Oe,SwapWeaponDispatch:_e,SwitchTeamDispatch:ve,ThrowGrenadeDispatch:Le};var Fe={};tt(Fe,{CommOut:()=>p,CommIn:()=>o,CommCode:()=>a,CloseCode:()=>D});export{xt as Matchmaker,b as Maps,Ot as Guns,gt as GamePlayer,cs as Dispatches,Rt as Constants,Fe as Comm,Zt as Bot,lt as API};
1
+ var __defProp=Object.defineProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0,configurable:!0,set:(newValue)=>all[name]=()=>newValue})};var iFetch=globalThis.fetch,fetch_default=iFetch;console.error("wwws does not support the browser.");var WWWebSocket=null;var globals={},isBrowser=typeof window<"u"&&typeof HTMLElement<"u",isWorker=typeof WebSocketPair<"u"&&typeof Cloudflare<"u",isNode=typeof process<"u"&&process.moduleLoadList?.length>0,isDeno=typeof Deno<"u",isBun=typeof process<"u"&&!!process.versions?.bun;if(!isBrowser&&!isWorker&&!isNode&&!isDeno&&!isBun)throw Error("yolkbot doesn't know how to run in this environment. Please open an issue on GitHub with information on where you run yolkbot.");globals.isBrowser=isBrowser;globals.isIsolated=!isNode&&!isDeno&&!isBun;globals.fetch=isBrowser||isWorker?(...args)=>globalThis.fetch(...args):fetch_default;globals.WebSocket=isBrowser||isWorker?globalThis.WebSocket:WWWebSocket;var globals_default=globals;var exports_constants={};__export(exports_constants,{findItemById:()=>findItemById,UserAgent:()=>UserAgent,URLRewards:()=>URLRewards,Team:()=>Team,StateBufferSize:()=>StateBufferSize,SocialReward:()=>SocialReward,SocialMedia:()=>SocialMedia,ShellStreak:()=>ShellStreak,PlayType:()=>PlayType,Movement:()=>Movement,ItemType:()=>ItemType,GunList:()=>GunList,GunEquipTime:()=>GunEquipTime,GameOptionFlag:()=>GameOptionFlag,GameMode:()=>GameMode,GameAction:()=>GameAction,FramesBetweenSyncs:()=>FramesBetweenSyncs,FirebaseKey:()=>FirebaseKey,CoopState:()=>CoopState,CollectType:()=>CollectType,ChiknWinnerDailyLimit:()=>ChiknWinnerDailyLimit,ChatFlag:()=>ChatFlag,ChallengeType:()=>ChallengeType,ChallengeSubType:()=>ChallengeSubType,BanDuration:()=>BanDuration});var exports_guns={};__export(exports_guns,{SMG:()=>SMG,RPEGG:()=>RPEGG,M24:()=>M24,Eggk47:()=>Eggk47,DozenGauge:()=>DozenGauge,Cluck9mm:()=>Cluck9mm,CSG1:()=>CSG1,AUG:()=>AUG});var BaseGun=class{constructor(){this.adsMod=0.5,this.burst=0,this.burstRof=0,this.movementAccuracyMod=1,this.radius=0,this.reloadBloom=!0,this.reloadTimeMod=1,this.tracer=0}},Eggk47=class extends BaseGun{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=0.15,this.accuracyMax=0.03,this.accuracyLoss=0.05,this.accuracyRecover=0.025,this.tracer=1}},DozenGauge=class extends BaseGun{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=0.16,this.accuracyMax=0.13,this.accuracyLoss=0.17,this.accuracyRecover=0.02,this.adsMod=0.6,this.movementAccuracyMod=0.2,this.tracer=0}},CSG1=class extends BaseGun{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=0.3,this.accuracyMax=0.004,this.accuracyLoss=0.3,this.accuracyRecover=0.025,this.tracer=0}},Cluck9mm=class extends BaseGun{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=0.15,this.accuracyMax=0.035,this.accuracyLoss=0.09,this.accuracyRecover=0.08,this.adsMod=0.8,this.movementAccuracyMod=0.6,this.tracer=0}},RPEGG=class extends BaseGun{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=0.4,this.accuracyMin=0.3,this.accuracyMax=0.015,this.accuracyLoss=0.3,this.accuracyRecover=0.02,this.radius=2.75}},SMG=class extends BaseGun{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=0.19,this.accuracyMax=0.06,this.accuracyLoss=0.045,this.accuracyRecover=0.05,this.adsMod=0.6,this.movementAccuracyMod=0.7,this.tracer=2}},M24=class extends BaseGun{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=0.35,this.accuracyMax=0,this.accuracyLoss=0.1,this.accuracyRecover=0.023,this.movementAccuracyMod=1.3,this.reloadBloom=!1,this.reloadTimeMod=0.8,this.tracer=0}},AUG=class extends BaseGun{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=0.15,this.accuracyMax=0.03,this.accuracyLoss=0.037,this.accuracyRecover=0.03,this.adsMod=0.6,this.burst=3,this.burstRof=3,this.movementAccuracyMod=0.8,this.movementInstability=2,this.tracer=0}};var findItemById=()=>null;var BanDuration={FiveMinutes:0,FifteenMinutes:1,OneHour:2},ChallengeSubType={Killstreak:0,KillWithWeapon:1,MovementDistance:3,Jumping:4,TimePlayed:6,TimeAlive:7,KillWithCondition:8,TotalKills:10,SpatulaKills:10,Collecting:18,FromTheCoop:20,SpecialOffensive:21,WinKOTC:23,KillWithSpatula:23},ChallengeType={Kill:0,Damage:1,Death:2,Movement:3,Collect:4,Time:5,KOTC:6,Spatula:7},ChatFlag={None:0,Pinned:2,Team:4,Mod:254,Server:255},ChiknWinnerDailyLimit=3,CollectType={Ammo:0,Grenade:1},CoopState={Start:0,Score:1,Win:2,Capturing:3,Contested:4,Takeover:5,Abandoned:6,Unclaimed:7},FirebaseKey="AIzaSyDP4SIjKaw6A4c-zvfYxICpbEjn1rRnN50",FramesBetweenSyncs=3,GameAction={Reset:1,Pause:2},GameMode={FFA:0,Team:1,Spatula:2,KOTC:3},GameOptionFlag={Locked:1,NoTeamChange:2,NoTeamShuffle:4},GunEquipTime=13,GunList=[Eggk47,DozenGauge,CSG1,RPEGG,SMG,M24,AUG],ItemType={Hat:1,Stamp:2,Primary:3,Secondary:4,Grenade:6,Melee:7},Movement={Forward:1,Backward:2,Left:4,Right:8,Jump:16,Fire:32,Melee:64,Scope:128},PlayType={JoinPublic:0,CreatePrivate:1,JoinPrivate:2},ShellStreak={HardBoiled:1,EggBreaker:2,Restock:4,OverHeal:8,DoubleEggs:16,MiniEgg:32},SocialMedia={Facebook:0,Instagram:1,Tiktok:2,Discord:3,Youtube:4,Twitter:5,Twitch:6},SocialReward={Discord:"rew_1200",Tiktok:"rew_1208",Instagram:"rew_1219",Steam:"rew_1223",Facebook:"rew_1227",Twitter:"rew_1234",Twitch:"rew_twitch_social"},StateBufferSize=256,Team={Blue:1,Red:2},URLRewards=["giveBasketBrosReward","mercZoneFinalGift","midMonthGiveMeEggs","newYolkerSignupReward","newYolkerItemReward","newYolkerWelcomeBack","WelcomeBack"],UserAgent=globals_default.isBrowser?null:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36";class yolkws{url="";proxy="";binaryType="";maxRetries=5;connectionTimeout=5000;constructor(url,proxy){if(globals_default.isBrowser&&proxy)throw Error("You cannot pass a proxy to a WebSocket in a browser.");this.url=url,this.proxy=proxy}async tryConnect(tries=1){let url=new URL(this.url),retryOrQuit=async()=>{if(tries===5)return!1;return await this.tryConnect(tries+1)};try{if(this.socket=globals_default.isBrowser?new globals_default.WebSocket(this.url):new globals_default.WebSocket(this.url,{proxy:this.proxy||null,headers:{"accept-encoding":"gzip, deflate, br, zstd","accept-language":"en-US,en;q=0.9","cache-control":"no-cache",connection:"Upgrade",origin:url.origin.replace("ws","http"),pragma:"no-cache","sec-websocket-extensions":"permessage-deflate; client_max_window_bits","user-agent":UserAgent}}),this.binaryType)this.socket.binaryType=this.binaryType}catch(e){return console.error(`Failed to connect on try ${tries}, trying again...`,e),await retryOrQuit()}if(this.onBeforeConnect)this.onBeforeConnect();return new Promise((resolve)=>{let timeout=setTimeout(async()=>{this.socket.close(),resolve(await retryOrQuit())},this.connectionTimeout),errorListener=async(e)=>{clearTimeout(timeout),console.error("WebSocket error",e),resolve(await retryOrQuit())};this.socket.addEventListener("open",async()=>{clearTimeout(timeout),this.socket.removeEventListener("error",errorListener),resolve(!0)}),this.socket.addEventListener("error",errorListener)})}get onmessage(){return this.socket?.onmessage}set onmessage(handler){if(this.socket)this.socket.onmessage=handler;else console.error("set onmessage before socket existed")}get onclose(){return this.socket?.onclose}set onclose(handler){if(this.socket)this.socket.onclose=handler;else console.error("set onclose before socket existed")}get onerror(){return this.socket?.onerror}set onerror(handler){if(this.socket)this.socket.onerror=handler;else console.error("set onclose before socket existed")}send(data){return this.socket?.send(data)}close(data){return this.socket?.close(data)}}var socket_default=yolkws;var baseHeaders={origin:"https://shellshock.io","user-agent":UserAgent,"x-client-version":"Chrome/JsCore/9.17.2/FirebaseCore-web","x-firebase-locale":"en"};class API{constructor(params={}){this.proxy=params.proxy,this.instance=params.instance||"shellshock.io",this.protocol=params.protocol||"wss",this.maxRetries=params.maxRetries||5,this.suppressErrors=params.suppressErrors||!1,this.connectionTimeout=params.connectionTimeout||5000}queryServices=async(request)=>{let ws=new socket_default(`${this.protocol}://${this.instance}/services/`,this.proxy);if(ws.connectionTimeout=this.connectionTimeout,!await ws.tryConnect(-2)||ws.socket.readyState!==1)return"websocket_connect_fail";return new Promise((resolve)=>{let resolved=!1;ws.onmessage=(mes)=>{resolved=!0;try{let resp=JSON.parse(mes.data);resolve(resp)}catch{if(!this.suppressErrors)console.error("queryServices: Bad API JSON response with call:",request.cmd,"and data:",JSON.stringify(request)),console.error("queryServices: Full data sent:",JSON.stringify(request));resolve("bad_json")}ws.close()},ws.onerror=()=>!resolved&&resolve("unknown_socket_error"),ws.onclose=()=>!resolved&&resolve("services_closed_early"),ws.send(JSON.stringify(request))})};#authWithEmailPass=async(email,password,endpoint)=>{if(!email||!password)return"firebase_no_credentials";let body,firebaseToken;try{body=await(await globals_default.fetch(`https://identitytoolkit.googleapis.com/v1/accounts:${endpoint}?key=${FirebaseKey}`,{method:"POST",body:JSON.stringify({email,password,returnSecureToken:!0}),headers:{...baseHeaders,"content-type":"application/json"},proxy:this.proxy})).json(),firebaseToken=body.idToken}catch(error){if(error.code==="auth/network-request-failed"){if(!this.suppressErrors)console.error("loginWithCredentials: Network req failed (auth/network-request-failed)");return"firebase_network_failed"}else if(error.code==="auth/missing-email")return"firebase_no_credentials";else if(error.code==="ERR_BAD_REQUEST"){if(!this.suppressErrors)console.error("loginWithCredentials: Error:",email,password);if(!this.suppressErrors)console.error("loginWithCredentials: Error:",body||error);return"firebase_bad_request"}if(!this.suppressErrors)console.error("loginWithCredentials: Error:",email,password,error);return"firebase_unknown_error"}if(!firebaseToken){if(!this.suppressErrors)console.error("loginWithCredentials: the game sent no idToken",body);return"firebase_no_token"}this.idToken=firebaseToken;let servicesQuery=await this.queryServices({cmd:"auth",firebaseToken});return typeof servicesQuery==="object"?{firebase:body,...servicesQuery}:servicesQuery};createAccount=async(email,password)=>await this.#authWithEmailPass(email,password,"signUp");loginWithCredentials=async(email,password)=>await this.#authWithEmailPass(email,password,"signInWithPassword");loginWithRefreshToken=async(refreshToken)=>{if(!refreshToken)return"firebase_no_credentials";let formData=new URLSearchParams;formData.append("grant_type","refresh_token"),formData.append("refresh_token",refreshToken);let body,token;try{body=await(await globals_default.fetch(`https://securetoken.googleapis.com/v1/token?key=${FirebaseKey}`,{method:"POST",body:formData,headers:{...baseHeaders,"content-type":"application/x-www-form-urlencoded"},proxy:this.proxy})).json(),token=body.id_token}catch(error){if(error.code==="auth/network-request-failed"){if(!this.suppressErrors)console.error("loginWithRefreshToken: Network req failed (auth/network-request-failed)");return"firebase_network_failed"}else if(error.code==="auth/missing-email")return"firebase_no_credentials";if(!this.suppressErrors)console.error("loginWithRefreshToken: Error:",error,refreshToken);return"firebase_unknown_error"}if(!token){if(!this.suppressErrors)console.error("loginWithRefreshToken: the game sent no idToken",body);return"firebase_no_token"}this.idToken=token;let response=await this.queryServices({cmd:"auth",firebaseToken:token});return typeof response==="object"?{firebase:body,...response}:response};loginAnonymously=async()=>{let body=await(await globals_default.fetch(`https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=${FirebaseKey}`,{method:"POST",body:JSON.stringify({returnSecureToken:!0}),headers:{...baseHeaders,"content-type":"application/json"},proxy:this.proxy})).json(),firebaseToken=body.idToken;if(!firebaseToken){if(!this.suppressErrors)console.error("loginAnonymously: the game sent no idToken",body);return"firebase_no_token"}this.idToken=firebaseToken;let query=await this.queryServices({cmd:"auth",firebaseToken});return typeof query==="object"?{firebase:body,...query}:query};sendEmailVerification=async(idToken=this.idToken)=>{if(!idToken)return"no_idtoken_passed";let body=await(await globals_default.fetch(`https://identitytoolkit.googleapis.com/v1/accounts:sendOobCode?key=${FirebaseKey}`,{method:"POST",body:JSON.stringify({requestType:"VERIFY_EMAIL",idToken}),headers:{...baseHeaders,"content-type":"application/json"},proxy:this.proxy})).json();if(body.kind!=="identitytoolkit#GetOobConfirmationCodeResponse"){if(!this.suppressErrors)console.error("sendEmailVerification: the game sent an invalid response",body);return"firebase_invalid_response"}return{email:body.email}};verifyOobCode=async(oobCode)=>{if(!oobCode)return"no_oob_code_passed";let body=await(await globals_default.fetch(`https://www.googleapis.com/identitytoolkit/v3/relyingparty/setAccountInfo?key=${FirebaseKey}`,{method:"POST",body:JSON.stringify({oobCode}),headers:{...baseHeaders,"x-client-version":"Chrome/JsCore/3.7.5/FirebaseCore-web",referer:"https://shellshockio-181719.firebaseapp.com/","content-type":"application/json"},proxy:this.proxy})).json();if(!body.emailVerified){if(!this.suppressErrors)console.error("verifyOobCode: the game sent an invalid response",body);return"firebase_invalid_response"}return body.email}}var api_default=API;class CommIn{static buffer;static idx;static init(buf){this.buffer=new Uint8Array(buf),this.idx=0}static isMoreDataAvailable(){return Math.max(0,this.buffer.length-this.idx)}static unPackInt8U(){let i2=this.idx;return this.idx++,this.buffer[i2]}static unPackInt8(){return(this.unPackInt8U()+128)%256-128}static unPackInt16U(){let i2=this.idx;return this.idx+=2,this.buffer[i2]+this.buffer[i2+1]*256}static unPackInt24U(){let i2=this.idx;return this.idx+=3,this.buffer[i2]+this.buffer[i2+1]*256+this.buffer[i2+2]*65536}static unPackInt32U(){let i2=this.idx;return this.idx+=4,this.buffer[i2]+this.buffer[i2+1]*256+this.buffer[i2+2]*65536+this.buffer[i2+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(maxLen){maxLen=maxLen||255;let len=Math.min(this.unPackInt8U(),maxLen);return this.unPackStringHelper(len)}static unPackLongString(maxLen){maxLen=maxLen||16383;let len=Math.min(this.unPackInt16U(),maxLen);return this.unPackStringHelper(len)}static unPackStringHelper(len){if(this.isMoreDataAvailable()<len)return 0;let str="";for(let i2=0;i2<len;i2++){let c=this.unPackInt16U();if(c>0)str+=String.fromCodePoint(c)}return str}}var CommIn_default=CommIn;class CommOut{constructor(size=16384){this.idx=0,this.arrayBuffer=new ArrayBuffer(size),this.buffer=new Uint8Array(this.arrayBuffer,0,size)}send(ws2){let b2=new Uint8Array(this.arrayBuffer,0,this.idx);ws2.send(b2)}packInt8(val){this.buffer[this.idx]=val&255,this.idx++}packInt16(val){this.buffer[this.idx]=val&255,this.buffer[this.idx+1]=val>>8&255,this.idx+=2}packInt24(val){this.buffer[this.idx]=val&255,this.buffer[this.idx+1]=val>>8&255,this.buffer[this.idx+2]=val>>16&255,this.idx+=3}packInt32(val){this.buffer[this.idx]=val&255,this.buffer[this.idx+1]=val>>8&255,this.buffer[this.idx+2]=val>>16&255,this.buffer[this.idx+3]=val>>24&255,this.idx+=4}packRadU(val){this.packInt24(val*2097152)}packRad(val){this.packInt16((val+Math.PI)*8192)}packFloat(val){this.packInt16(val*256)}packDouble(val){this.packInt32(val*1048576)}packString(str){if(typeof str!=="string")str="";this.packInt8(str.length);for(let i2=0;i2<str.length;i2++)this.packInt16(str.charCodeAt(i2))}packLongString(str){if(typeof str!=="string")str="";this.packInt16(str.length);for(let i2=0;i2<str.length;i2++)this.packInt16(str.charCodeAt(i2))}}var CommOut_default=CommOut;var CloseCode={gameNotFound:4000,gameFull:4001,badName:4002,mainMenu:4003,gameIdleExceeded:4004,corruptedLoginData0:4005,corruptedLoginData1:4006,corruptedLoginData2:4007,corruptedLoginData3:4008,corruptedLoginData4:4009,corruptedLoginData5:4010,gameMaxPlayersExceeded:4011,gameDestroyUser:4012,joinGameOutOfOrder:4013,gameShuttingDown:4014,readyBeforeReady:4015,booted:4016,gameErrorOnUserSocket:4017,uuidNotFound:4018,sessionNotFound:4019,clusterFullCpu:4020,clusterFullMem:4021,noClustersAvailable:4022,locked:4023},CloseCode_default=CloseCode;var CommCode={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},CommCode_default=CommCode;var RSocialMedia=Object.fromEntries(Object.entries(SocialMedia).map(([key,value])=>[value,key.toLowerCase()]));class GamePlayer{constructor(playerData,activeZone=null){if(this.id=playerData.id,this.uniqueId=playerData.uniqueId,this.name=playerData.name,this.safeName=playerData.safeName,this.team=playerData.team,this.playing=playerData.playing,this.socials=playerData.social&&JSON.parse(playerData.social),this.socials)this.socials.forEach((social)=>social.type=RSocialMedia[social.id]);if(this.isVip=playerData.upgradeProductId>0,this.showBadge=!playerData.hideBadge||!1,this.streak=playerData.score,this.streakRewards=Object.values(ShellStreak).filter((streak)=>playerData.activeShellStreaks&streak),this.scale=this.streakRewards.includes(ShellStreak.MiniEgg)?0.5:1,this.position={x:playerData.x,y:playerData.y,z:playerData.z},this.jumping=playerData.$controlKeys&Movement.Jump,this.scoping=playerData.$controlKeys&Movement.Scope,this.climbing=!1,this.view={yaw:playerData.yaw,pitch:playerData.pitch},this.updateKotcZone(activeZone),this.character={eggColor:playerData.shellColor,primaryGun:playerData.primaryWeaponItem,secondaryGun:playerData.secondaryWeaponItem,stamp:playerData.stampItem,hat:playerData.hatItem,grenade:playerData.grenadeItem,melee:playerData.meleeItem,stampPos:{x:playerData.stampPosX,y:playerData.stampPosY}},this.stats={totalKills:playerData.totalKills,totalDeaths:playerData.totalDeaths,bestStreak:playerData.bestStreak},this.activeGun=playerData.weaponIdx,this.selectedGun=playerData.charClass,this.weapons=[],this.character.primaryGun)this.weapons[0]=new GunList[this.selectedGun],this.weapons[1]=new Cluck9mm;this.grenades=1,this.hp=playerData.hp,this.hpShield=0,this.spawnShield=playerData.shield,this.randomSeed=0}updateKotcZone(activeZone){if(!activeZone)return this.inKotcZone=!1;let fx=Math.floor(this.position.x),fy=Math.floor(this.position.y),fz=Math.floor(this.position.z);this.inKotcZone=activeZone.some((coordSets)=>coordSets.x===fx&&coordSets.y===fy&&coordSets.z===fz)&&this.playing}}var GamePlayer_default=GamePlayer;var hexToUint8Array=(hex)=>new Uint8Array(hex.match(/.{2}/g).map((b)=>parseInt(b,16))),encoder=new TextEncoder,validate=async(input)=>{if(typeof process<"u"&&typeof process.getBuiltinModule==="function"){let crypto2=process.getBuiltinModule("node:crypto"),salt2=Buffer.from("3496afb51f42553e31635211400c000b","hex");return crypto2.createHmac("sha256",salt2).update(input).digest("hex")}let salt=hexToUint8Array("3496afb51f42553e31635211400c000b"),key=await crypto.subtle.importKey("raw",salt,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),signature=await crypto.subtle.sign("HMAC",key,encoder.encode(input));return Array.from(new Uint8Array(signature)).map((b)=>b.toString(16).padStart(2,"0")).join("")},mockLoadi8U=(addr)=>{return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(addr-1050359)},coords=(yaw11,pitch10)=>{let local_9=Math.round(yaw11/(Math.PI*2)*65535),local_4=0,local_12=Math.round((pitch10+1.5)/3*32767),temp_yaw=local_9<0?0:local_9;local_9=temp_yaw>65535?65535:temp_yaw;let yaw_i32=Math.trunc(local_9);if(yaw_i32<0)yaw_i32=0;if(yaw_i32>4294967295)yaw_i32=4294967295;yaw_i32=local_9>=0?yaw_i32:0,yaw_i32=local_9>65535?0:yaw_i32;let local_5=yaw_i32;local_4^=local_5;let temp_pitch=local_12<0?0:local_12;local_9=temp_pitch,temp_pitch=local_9>32767?32767:local_9,local_9=temp_pitch;let pitch_i32=Math.trunc(local_9);if(pitch_i32<0)pitch_i32=0;if(pitch_i32>4294967295)pitch_i32=4294967295;pitch_i32=local_9>=0?pitch_i32:0,pitch_i32=local_9>65535?0:pitch_i32;let local_3=pitch_i32,local_6=local_3,local_01=local_4^local_6,pitch_low_byte=local_01&255,yaw_shifted=local_4<<8,yaw_byte_high=(local_4&65280)>>>8;local_3=(yaw_shifted|yaw_byte_high)>>>0;let local_7=pitch_low_byte^local_3;local_01=local_01<<8|(local_01&65280)>>>8,local_5^=local_6,local_6=local_01^local_5&255,local_5=local_5<<8|(local_5&65280)>>>8,local_4=local_5^local_4&255;let letters=[];return letters[3]=mockLoadi8U(1050359+(local_6&63)),letters[7]=mockLoadi8U(1050359+(local_3>>>8&63)),letters[4]=mockLoadi8U(1050359+(local_01>>>10&63)),letters[0]=mockLoadi8U(1050359+((local_4&252)>>>2)),letters[5]=mockLoadi8U(1050359+(local_01>>>4&48|local_7>>>4&15)),letters[2]=mockLoadi8U(1050359+(local_5>>>6&60|local_6>>>6&3)),letters[6]=mockLoadi8U(1050359+((local_3>>>14&3|local_7<<2)&63)),letters[1]=mockLoadi8U(1050359+((local_5>>>12&15|local_4<<4)&63)),String.fromCharCode(...letters)};class Matchmaker{connected=!1;onceConnected=[];regionList=[];proxy=null;sessionId="";onListeners=new Map;onceListeners=new Map;#noExitOnError=!1;#forceClose=!1;constructor(params={}){if(this.#noExitOnError=params.noExitOnError||!1,!params.instance)params.instance="shellshock.io";if(!params.protocol)params.protocol="wss";if(params.api)this.api=params.api;else this.api=new api_default({proxy:params.proxy,protocol:params.protocol,instance:params.instance,connectionTimeout:params.connectionTimeout});if(params.sessionId||params.noLogin)this.sessionId=params.sessionId;else this.#createSessionId();if(params.proxy&&globals_default.isBrowser)this.#processError("proxies do not work and hence are not supported in the browser");else if(params.proxy)this.proxy=params.proxy;this.#createSocket(params.instance,params.protocol,params.noLogin,params.connectionTimeout)}async#createSocket(instance,protocol,noLogin,connectionTimeout){if(this.ws=new socket_default(`${protocol}://${instance}/matchmaker/`,this.proxy),this.ws.connectionTimeout=connectionTimeout||5000,!await this.ws.tryConnect())return this.#processError("WebSocket did not connect...");if(this.ws.onmessage=async(e)=>{let data=JSON.parse(e.data);if(data.command==="validateUUID")return this.ws.send(JSON.stringify({command:"validateUUID",hash:await validate(data.uuid)}));this.#emit("msg",data)},this.ws.onclose=()=>{if(this.connected=!1,!this.#forceClose)this.#createSocket(instance,protocol,noLogin,connectionTimeout)},this.connected=!0,this.sessionId||noLogin)this.onceConnected.forEach((func)=>func())}async#createSessionId(){let anonLogin=await this.api.loginAnonymously();if(!anonLogin||typeof anonLogin==="string")this.#emit("authFail",anonLogin);if(this.sessionId=anonLogin.sessionId,this.connected)this.onceConnected.forEach((func)=>func())}send(msg){this.ws.send(JSON.stringify(msg))}async waitForConnect(){return new Promise((res)=>{if(this.connected)res();else this.onceConnected.push(res)})}async getRegions(){await this.waitForConnect();let that=this;return new Promise((res)=>{let listener=(data2)=>{if(data2.command==="regionList")this.regionList=data2.regionList,this.off("msg",listener),res(data2.regionList)};this.on("msg",listener),this.ws.onerror=(e2)=>that.#processError("failed to get regions",e2),this.ws.send(JSON.stringify({command:"regionList"}))})}close(){this.#forceClose=!0,this.connected=!1,this.ws.close()}on(event,callback){if(!this.onListeners.has(event))this.onListeners.set(event,[]);this.onListeners.get(event).push(callback)}once(event,callback){if(!this.onceListeners.has(event))this.onceListeners.set(event,[]);this.onceListeners.get(event).push(callback)}off(event,callback){if(this.onListeners.has(event))this.onListeners.set(event,this.onListeners.get(event).filter((func)=>func!==callback));if(this.onceListeners.has(event))this.onceListeners.set(event,this.onceListeners.get(event).filter((func)=>func!==callback))}#emit(event,...args){if(this.onListeners.has(event))this.onListeners.get(event).forEach((func)=>func(...args));if(this.onceListeners.has(event))this.onceListeners.get(event).forEach((func)=>func(...args)),this.onceListeners.delete(event)}#processError(error){if(this.onListeners.has("error"))this.#emit("error",error);else if(this.#noExitOnError)console.error(error);else throw Error(error)}}var matchmaker_default=Matchmaker;var mod=(n,m)=>(n%m+m)%m,PI2=Math.PI*2,setPrecision=(value)=>Math.round(value*8192)/8192,calculateYaw=(pos)=>setPrecision(mod(Math.atan2(-pos.x,-pos.z),PI2)),calculatePitch=(pos)=>setPrecision(Math.atan2(pos.y,Math.hypot(pos.x,pos.z)));class LookAtPosDispatch{constructor(pos){this.pos=pos}validate(){return this.pos&&this.pos.x&&this.pos.y&&this.pos.z}check(bot){return bot.me.playing}execute(bot){let directionVector={x:this.pos.x-bot.me.position.x,y:this.pos.y-bot.me.position.y,z:this.pos.z-bot.me.position.z},yaw=calculateYaw(directionVector),pitch=calculatePitch(directionVector);bot.state.yaw=yaw,bot.state.pitch=pitch}}var LookAtPosDispatch_default=LookAtPosDispatch;class MovementDispatch{constructor(inputKeys){if(typeof inputKeys==="number")this.inputKeys=inputKeys;else if(typeof inputKeys==="object")this.inputKeys=inputKeys.reduce((a,b)=>a|b,0)}validate(){if(typeof this.inputKeys!=="number")return!1;if(this.inputKeys&Movement.Forward&&this.inputKeys&Movement.Backward)return!1;if(this.inputKeys&Movement.Left&&this.inputKeys&Movement.Right)return!1;return!0}check(bot){return bot.me.playing}execute(bot){bot.state.controlKeys=this.inputKeys}}var MovementDispatch_default=MovementDispatch;class MapNode{constructor(meshType,data){if(this.x=data.x,this.y=data.y,this.z=data.z,this.positionStr=`${this.x},${this.y},${this.z}`,this.position={x:this.x,y:this.y,z:this.z},this.meshType=meshType.split(".").pop(),this.f=0,this.g=0,this.h=0,this.visited=null,this.parent=null,this.closed=null,this.links=[],this.isStair())if(data.ry)this.ry=data.ry;else this.ry=0}isFull(){return this.meshType==="full"}canWalkThrough(){return this.meshType==="none"||this.meshType==="ladder"}canWalkOn(){return this.meshType==="full"}isLadder(){return this.meshType==="ladder"}isStair(){return this.meshType==="wedge"}isAir(){return this.meshType==="none"}canLink(node,list){let dx0=this.x-node.x,dz0=this.z-node.z,dy0=this.y-node.y,dx=Math.abs(dx0),dy=Math.abs(dy0),dz=Math.abs(dz0);if(dx+dy+dz===0||dx+dz>1||this.isFull()||node.isFull())return!1;let belowMe=list.at(this.x,this.y-1,this.z),belowOther=list.at(node.x,node.y-1,node.z);if(!belowMe||!belowOther)return!1;let FORWARD_RY_WEDGE_MAPPING={0:{x:0,z:-1},1:{x:-1,z:0},2:{x:0,z:1},3:{x:1,z:0}};switch(this.meshType){case"none":if(dy0===1&&node.canWalkThrough())return!0;if(belowMe.canWalkOn()||belowMe.isLadder()){if(node.meshType==="none"||node.meshType==="ladder"&&dy===0||node.meshType==="wedge"&&dy0===0&&dx0===-FORWARD_RY_WEDGE_MAPPING[node.ry].x&&dz0===-FORWARD_RY_WEDGE_MAPPING[node.ry].z)return!0}return!1;case"ladder":if(dy===1&&node.canWalkThrough())return!0;if(dy===0&&belowMe.canWalkOn())return!0;if(node.meshType==="ladder"&&(dy===1||belowMe.canWalkOn()&&belowOther.canWalkOn()))return!0;return!1;case"wedge":if(this.x+FORWARD_RY_WEDGE_MAPPING[this.ry].x===node.x&&this.z+FORWARD_RY_WEDGE_MAPPING[this.ry].z===node.z&&this.y+1===node.y)return!0;if(this.x-FORWARD_RY_WEDGE_MAPPING[this.ry].x===node.x&&this.z-FORWARD_RY_WEDGE_MAPPING[this.ry].z===node.z&&(this.y===node.y||this.y-1===node.y))return!0;return!1;default:return!1}}flatCenter(){return{x:this.x+0.5,y:this.y+0,z:this.z+0.5}}flatRadialDistance(position){let pos=this.flatCenter();return Math.hypot(pos.x-position.x,pos.z-position.z)}}class NodeList{list=[];constructor(raw){let addedPositions={};for(let meshName of Object.keys(raw.data))for(let nodeData of raw.data[meshName])addedPositions[nodeData.x<<16|nodeData.y<<8|nodeData.z]=!0,this.list.push(new MapNode(meshName,nodeData));for(let x=0;x<raw.width;x++)for(let y=0;y<raw.height;y++)for(let z=0;z<raw.depth;z++)if(!addedPositions[x<<16|y<<8|z])this.list.push(new MapNode("SPECIAL.air.none",{x,y,z}));let nodeMap=new Map;for(let node of this.list)nodeMap.set(node.positionStr,node);for(let node of this.list){let neighbors=[{x:node.x+1,y:node.y,z:node.z},{x:node.x-1,y:node.y,z:node.z},{x:node.x,y:node.y+1,z:node.z},{x:node.x,y:node.y-1,z:node.z},{x:node.x,y:node.y,z:node.z+1},{x:node.x,y:node.y,z:node.z-1}];for(let neighborPos of neighbors){let neighborKey=`${neighborPos.x},${neighborPos.y},${neighborPos.z}`,neighborNode=nodeMap.get(neighborKey);if(neighborNode&&node.canLink(neighborNode,this))node.links.push(neighborNode)}}}at(x,y,z){if(!this.nodeMap){this.nodeMap=new Map;for(let node of this.list){let key2=`${node.x},${node.y},${node.z}`;this.nodeMap.set(key2,node)}}let key=`${x},${y},${z}`;return this.nodeMap.get(key)}clean(){for(let node of this.list)node.f=0,node.g=0,node.h=0,node.visited=null,node.parent=null,node.closed=null}hasLineOfSight(bot,target){let dx=target.x-bot.x,dy=target.y-bot.y,dz=target.z-bot.z,steps=Math.max(Math.abs(dx),Math.abs(dy),Math.abs(dz)),xStep=dx/steps,yStep=dy/steps,zStep=dz/steps,x=bot.x,y=bot.y,z=bot.z;for(let i=0;i<=steps;i++){let node=this.at(Math.round(x),Math.round(y),Math.round(z));if(node&&node.isFull())return!1;x+=xStep,y+=yStep,z+=zStep}return!0}}var fetchMap=async(name,hash)=>{if(!globals_default.isIsolated&&typeof process<"u"){let{existsSync,mkdirSync,readFileSync,writeFileSync}=process.getBuiltinModule("node:fs"),{join}=process.getBuiltinModule("node:path"),{homedir}=process.getBuiltinModule("node:os"),yolkbotCache=join(homedir(),".yolkbot");if(!existsSync(yolkbotCache))mkdirSync(yolkbotCache);let mapCache=join(yolkbotCache,"maps");if(!existsSync(mapCache))mkdirSync(mapCache);let mapFile=join(mapCache,`${name}-${hash}.json`);if(existsSync(mapFile))return JSON.parse(readFileSync(mapFile,"utf-8"));let data2=await(await fetch(`https://x.yolkbot.xyz/data/maps/full/${name}.json?${hash}`)).json();return writeFileSync(mapFile,JSON.stringify(data2,null,4),{flag:"w+"}),data2}return await(await fetch(`https://esm.sh/gh/yolkorg/maps/maps/${name}.json?${hash}`)).json()},initKotcZones=(meshData)=>{let numCaptureZones=0,mapData={},zones=[];for(let cell of meshData){if(!mapData[cell.x])mapData[cell.x]={};if(!mapData[cell.x][cell.y])mapData[cell.x][cell.y]={};mapData[cell.x][cell.y][cell.z]={zone:null}}let offsets=[{x:-1,z:0},{x:1,z:0},{x:0,z:-1},{x:0,z:1}],getMapCellAt=(x,y,z)=>mapData[x]&&mapData[x][y]&&mapData[x][y][z]?mapData[x][y][z]:null;for(let cellA of meshData)if(!mapData[cellA.x][cellA.y][cellA.z].zone){cellA.zone=++numCaptureZones,mapData[cellA.x][cellA.y][cellA.z].zone=cellA.zone;let currentZone=[cellA],hits;do{hits=0;for(let cellB of meshData)if(!mapData[cellB.x][cellB.y][cellB.z].zone)for(let o of offsets){let cell=getMapCellAt(cellB.x+o.x,cellB.y,cellB.z+o.z);if(cell&&cell.zone===cellA.zone){hits++,cellB.zone=cellA.zone,mapData[cellB.x][cellB.y][cellB.z].zone=cellA.zone,currentZone.push(cellB);break}}}while(hits>0);zones.push(currentZone)}return zones};var Challenges=[{id:1,loc_ref:"chlg_kill_streak_five",type:0,subType:0,period:0,goal:1,reward:100,conditional:0,value:"5",valueTwo:null,tier:2,loc:{title:"Master Chef",desc:"Get a 5 killstreak"}},{id:2,loc_ref:"chlg_kill_streak_ten",type:0,subType:0,period:0,goal:1,reward:200,conditional:0,value:"10",valueTwo:null,tier:2,loc:{title:"Butcher",desc:"Get a 10 killstreak"}},{id:3,loc_ref:"chlg_kill_streak_fifteen",type:0,subType:0,period:0,goal:1,reward:500,conditional:0,value:"15",valueTwo:null,tier:3,loc:{title:"Eggsassin",desc:"Get a 15 killstreak"}},{id:4,loc_ref:"chlg_kill_streak_twenty",type:0,subType:0,period:0,goal:1,reward:1000,conditional:0,value:"20",valueTwo:null,tier:3,loc:{title:"Eggsecutioner",desc:"Get a 20 killstreak"}},{id:5,loc_ref:"chlg_kill_streak_fifty",type:0,subType:0,period:0,goal:1,reward:5000,conditional:0,value:"50",valueTwo:null,tier:3,loc:{title:"Shell Smasher",desc:"Get a 50 killstreak"}},{id:6,loc_ref:"chlg_kill_kills_ten",type:0,subType:10,period:0,goal:10,reward:100,conditional:null,value:null,valueTwo:null,tier:0,loc:{title:"Shell Shocker",desc:"Get 10 total kills"}},{id:7,loc_ref:"chlg_kill_kills_twenty",type:0,subType:10,period:0,goal:20,reward:200,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Yolk Drinker",desc:"Get 20 total kills"}},{id:8,loc_ref:"chlg_kill_kills_fifty",type:0,subType:10,period:0,goal:50,reward:500,conditional:null,value:null,valueTwo:null,tier:2,loc:{title:"Clutch Master",desc:"Get 50 total kills"}},{id:9,loc_ref:"chlg_kill_kills_hundred",type:0,subType:10,period:0,goal:100,reward:1000,conditional:null,value:null,valueTwo:null,tier:3,loc:{title:"Eggsterminator",desc:"Get 100 total kills"}},{id:10,loc_ref:"chlg_kill_kills_two_fifty",type:0,subType:10,period:0,goal:250,reward:2500,conditional:null,value:null,valueTwo:null,tier:3,loc:{title:"Ovum Overlord",desc:"Get 250 total kills"}},{id:11,loc_ref:"chlg_kill_timePlayed_two",type:0,subType:6,period:0,goal:1,reward:100,conditional:null,value:"2",valueTwo:"60",tier:0,loc:{title:"Back to Back",desc:"Spawn and get 2 kills in 1 min"}},{id:12,loc_ref:"chlg_kill_timePlayed_four",type:0,subType:6,period:0,goal:1,reward:500,conditional:null,value:"4",valueTwo:"60",tier:2,loc:{title:"C-C-C-COMBO",desc:"Spawn and get 4 kills in 1 min"}},{id:13,loc_ref:"chlg_kill_timePlayed_seven",type:0,subType:6,period:0,goal:1,reward:1000,conditional:null,value:"7",valueTwo:"60",tier:3,loc:{title:"Eggcellerator",desc:"Spawn and get 7 kills in 1 min"}},{id:14,loc_ref:"chlg_kill_timePlayed_ten",type:0,subType:6,period:0,goal:1,reward:2500,conditional:null,value:"10",valueTwo:"60",tier:3,loc:{title:"Need for Speed",desc:"Spawn and get 10 kills in 1 min"}},{id:15,loc_ref:"chlg_kill_con_kill_one_shot",type:0,subType:8,period:0,goal:1,reward:100,conditional:11,value:"1",valueTwo:"1",tier:1,loc:{title:"Bullseye",desc:"Kill an egg with 1 shot"}},{id:16,loc_ref:"chlg_kill_con_kill_hp_ten",type:0,subType:8,period:0,goal:1,reward:500,conditional:12,value:"1",valueTwo:"10",tier:1,loc:{title:"Cutting it Close",desc:"Get a kill with less than 10 HP"}},{id:17,loc_ref:"chlg_kill_con_kill_five_streak",type:0,subType:8,period:0,goal:1,reward:1000,conditional:0,value:"0",valueTwo:"5",tier:2,loc:{title:"Soft Boiled",desc:"Kill an egg on a 5+ streak"}},{id:18,loc_ref:"chlg_kill_con_kill_ten_streak",type:0,subType:8,period:0,goal:1,reward:2500,conditional:0,value:"0",valueTwo:"10",tier:3,loc:{title:"Breaker-breaker",desc:"Kill an egg on a 10+ streak"}},{id:19,loc_ref:"chlg_kill_con_kill_scoped",type:0,subType:8,period:0,goal:1,reward:200,conditional:13,value:null,valueTwo:null,tier:2,loc:{title:"Eye 2 Eye",desc:"Snipe a zoomed-in sniper"}},{id:20,loc_ref:"chlg_kill_con_two_kills_one_shot",type:0,subType:8,period:0,goal:1,reward:200,conditional:16,value:"2",valueTwo:null,tier:2,loc:{title:"Collateral Damage",desc:"Kill two eggs at once"}},{id:21,loc_ref:"chlg_kill_con_reloading",type:0,subType:8,period:0,goal:1,reward:100,conditional:17,value:null,valueTwo:null,tier:1,loc:{title:"Owned",desc:"Kill an egg while they reload"}},{id:22,loc_ref:"chlg_kill_con_kill_scoped_melee",type:0,subType:8,period:0,goal:1,reward:200,conditional:13,value:null,valueTwo:"9",tier:2,loc:{title:"Behind You!",desc:"Melee kill a zoomed-in egg"}},{id:23,loc_ref:"chlg_kill_con_kill_two_grenade",type:0,subType:8,period:0,goal:1,reward:200,conditional:16,value:"2",valueTwo:"8",tier:2,loc:{title:"2 Birds 1 Stone",desc:"Kill 2 eggs with 1 Grenade"}},{id:24,loc_ref:"chlg_kill_con_kill_three_grenade",type:0,subType:8,period:0,goal:1,reward:1000,conditional:16,value:"3",valueTwo:"8",tier:3,loc:{title:"M-M-M-Multikill",desc:"Kill 3 eggs with 1 Grenade"}},{id:25,loc_ref:"chlg_kill_con_kill_two_rpegg",type:0,subType:8,period:0,goal:1,reward:200,conditional:16,value:"2",valueTwo:"4",tier:2,loc:{title:"Splash Damage",desc:"Kill 2 eggs with 1 RPEGG shot"}},{id:26,loc_ref:"chlg_kill_con_kill_three_rpegg",type:0,subType:8,period:0,goal:1,reward:1000,conditional:16,value:"3",valueTwo:"4",tier:3,loc:{title:"Big Boomer",desc:"Kill 3 eggs with 1 RPEGG shot"}},{id:27,loc_ref:"chlg_kill_weaponType_Cluck9mm_five",type:0,subType:1,period:0,goal:5,reward:200,conditional:null,value:null,valueTwo:"3",tier:1,loc:{title:"Pew Pew",desc:"Get 5 Cluck 9mm kills"}},{id:28,loc_ref:"chlg_kill_weaponType_Cluck9mm_ten",type:0,subType:1,period:0,goal:10,reward:500,conditional:null,value:null,valueTwo:"3",tier:1,loc:{title:"Trigger Happy",desc:"Get 10 Cluck 9mm kills"}},{id:29,loc_ref:"chlg_kill_weaponType_Cluck9mm_twenty",type:0,subType:1,period:0,goal:20,reward:1000,conditional:null,value:null,valueTwo:"3",tier:2,loc:{title:"Sidearm Specialist",desc:"Get 20 Cluck 9mm kills"}},{id:30,loc_ref:"chlg_kill_weaponType_Cluck9mm_fifty",type:0,subType:1,period:0,goal:50,reward:2500,conditional:null,value:null,valueTwo:"3",tier:3,loc:{title:"9mm Master",desc:"Get 50 Cluck 9mm kills"}},{id:31,loc_ref:"chlg_kill_weaponType_Scrambler_five",type:0,subType:1,period:0,goal:5,reward:100,conditional:null,value:null,valueTwo:"1",tier:1,loc:{title:"Scrambled Eggs",desc:"Get 5 Scrambler kills"}},{id:32,loc_ref:"chlg_kill_weaponType_Scrambler_ten",type:0,subType:1,period:0,goal:10,reward:200,conditional:null,value:null,valueTwo:"1",tier:1,loc:{title:"Hunting Wabbits",desc:"Get 10 Scrambler kills"}},{id:33,loc_ref:"chlg_kill_weaponType_Scrambler_twenty",type:0,subType:1,period:0,goal:20,reward:500,conditional:null,value:null,valueTwo:"1",tier:2,loc:{title:"Boomstick",desc:"Get 20 Scrambler kills"}},{id:34,loc_ref:"chlg_kill_weaponType_Scrambler_fifty",type:0,subType:1,period:0,goal:50,reward:1000,conditional:null,value:null,valueTwo:"1",tier:3,loc:{title:"Splat-o-matic",desc:"Get 50 Scrambler kills"}},{id:35,loc_ref:"chlg_kill_weaponType_Rpegg_five",type:0,subType:1,period:0,goal:5,reward:100,conditional:null,value:null,valueTwo:"4",tier:2,loc:{title:"Eggsploder",desc:"Get 5 RPEGG kills"}},{id:36,loc_ref:"chlg_kill_weaponType_Rpegg_ten",type:0,subType:1,period:0,goal:10,reward:200,conditional:null,value:null,valueTwo:"4",tier:2,loc:{title:"Arm Cannons",desc:"Get 10 RPEGG kills"}},{id:37,loc_ref:"chlg_kill_weaponType_Rpegg_twenty",type:0,subType:1,period:0,goal:20,reward:500,conditional:null,value:null,valueTwo:"4",tier:2,loc:{title:"Bazooka Joe",desc:"Get 20 RPEGG kills"}},{id:38,loc_ref:"chlg_kill_weaponType_Rpegg_fifty",type:0,subType:1,period:0,goal:50,reward:1000,conditional:null,value:null,valueTwo:"4",tier:3,loc:{title:"Master Eggsploder",desc:"Get 50 RPEGG kills"}},{id:39,loc_ref:"chlg_kill_weaponType_Whipper_five",type:0,subType:1,period:0,goal:5,reward:100,conditional:null,value:null,valueTwo:"5",tier:1,loc:{title:"Whip it Good",desc:"Get 5 Whipper kills"}},{id:40,loc_ref:"chlg_kill_weaponType_Whipper_ten",type:0,subType:1,period:0,goal:10,reward:200,conditional:null,value:null,valueTwo:"5",tier:1,loc:{title:"Cool Whip",desc:"Get 10 Whipper kills"}},{id:41,loc_ref:"chlg_kill_weaponType_Whipper_twenty",type:0,subType:1,period:0,goal:20,reward:500,conditional:null,value:null,valueTwo:"5",tier:2,loc:{title:"Whip it REAL Good",desc:"Get 20 Whipper kills"}},{id:42,loc_ref:"chlg_kill_weaponType_Whipper_fifty",type:0,subType:1,period:0,goal:50,reward:1000,conditional:null,value:null,valueTwo:"5",tier:3,loc:{title:"Whip up a Storm",desc:"Get 50 Whipper kills"}},{id:43,loc_ref:"chlg_kill_weaponType_Eggk47_five",type:0,subType:1,period:0,goal:5,reward:100,conditional:null,value:null,valueTwo:"0",tier:0,loc:{title:"Lock & Load",desc:"Get 5 EggK-47 kills"}},{id:44,loc_ref:"chlg_kill_weaponType_Eggk47_ten",type:0,subType:1,period:0,goal:10,reward:200,conditional:null,value:null,valueTwo:"0",tier:1,loc:{title:"Almost a Dozen",desc:"Get 10 EggK-47 kills"}},{id:45,loc_ref:"chlg_kill_weaponType_Eggk47_twenty",type:0,subType:1,period:0,goal:20,reward:500,conditional:null,value:null,valueTwo:"0",tier:2,loc:{title:"Spray Down",desc:"Get 20 EggK-47 kills"}},{id:46,loc_ref:"chlg_kill_weaponType_Eggk47_fifty",type:0,subType:1,period:0,goal:50,reward:1000,conditional:null,value:null,valueTwo:"0",tier:3,loc:{title:"Eggk-47 Eggspert",desc:"Get 50 EggK-47 kills"}},{id:47,loc_ref:"chlg_kill_weaponType_FreeRanger_five",type:0,subType:1,period:0,goal:5,reward:100,conditional:null,value:null,valueTwo:"2",tier:1,loc:{title:"Poacher",desc:"Get 5 Free Ranger kills"}},{id:48,loc_ref:"chlg_kill_weaponType_FreeRanger_ten",type:0,subType:1,period:0,goal:10,reward:200,conditional:null,value:null,valueTwo:"2",tier:1,loc:{title:"Bounty Hunter",desc:"Get 10 Free Ranger kills"}},{id:49,loc_ref:"chlg_kill_weaponType_FreeRanger_twenty",type:0,subType:1,period:0,goal:20,reward:500,conditional:null,value:null,valueTwo:"2",tier:2,loc:{title:"Hired Gun",desc:"Get 20 Free Ranger kills"}},{id:50,loc_ref:"chlg_kill_weaponType_FreeRanger_fifty",type:0,subType:1,period:0,goal:50,reward:1000,conditional:null,value:null,valueTwo:"2",tier:3,loc:{title:"Big-Game Hunter",desc:"Get 50 Free Ranger kills"}},{id:51,loc_ref:"chlg_kill_weaponType_Crackshot_five",type:0,subType:1,period:0,goal:5,reward:100,conditional:null,value:null,valueTwo:"6",tier:1,loc:{title:"Sniper",desc:"Get 5 Crackshot kills"}},{id:52,loc_ref:"chlg_kill_weaponType_Crackshot_ten",type:0,subType:1,period:0,goal:10,reward:200,conditional:null,value:null,valueTwo:"6",tier:1,loc:{title:"Sharpshooter",desc:"Get 10 Crackshot kills"}},{id:53,loc_ref:"chlg_kill_weaponType_Crackshot_twenty",type:0,subType:1,period:0,goal:20,reward:500,conditional:null,value:null,valueTwo:"6",tier:2,loc:{title:"Marksman",desc:"Get 20 Crackshot kills"}},{id:54,loc_ref:"chlg_kill_weaponType_Crackshot_fifty",type:0,subType:1,period:0,goal:50,reward:1000,conditional:null,value:null,valueTwo:"6",tier:3,loc:{title:"Cracked",desc:"Get 50 Crackshot kills"}},{id:55,loc_ref:"chlg_kill_weaponType_TriHard_five",type:0,subType:1,period:0,goal:5,reward:100,conditional:null,value:null,valueTwo:"7",tier:1,loc:{title:"Tri-Hard",desc:"Get 5 Tri-Hard kills"}},{id:56,loc_ref:"chlg_kill_weaponType_TriHard_ten",type:0,subType:1,period:0,goal:10,reward:200,conditional:null,value:null,valueTwo:"7",tier:1,loc:{title:"Tri-Harder",desc:"Get 10 Tri-Hard kills"}},{id:57,loc_ref:"chlg_kill_weaponType_TriHard_twenty",type:0,subType:1,period:0,goal:20,reward:500,conditional:null,value:null,valueTwo:"7",tier:2,loc:{title:"Tri-Even-Harder",desc:"Get 20 Tri-Hard kills"}},{id:58,loc_ref:"chlg_kill_weaponType_TriHard_fifty",type:0,subType:1,period:0,goal:50,reward:1000,conditional:null,value:null,valueTwo:"7",tier:3,loc:{title:"Tri-Hardest",desc:"Get 50 Tri-Hard kills"}},{id:59,loc_ref:"chlg_kill_weaponType_Melee_five",type:0,subType:1,period:0,goal:5,reward:200,conditional:null,value:null,valueTwo:"9",tier:2,loc:{title:"Whisky Business",desc:"Get 5 Melee kills"}},{id:60,loc_ref:"chlg_kill_weaponType_Melee_ten",type:0,subType:1,period:0,goal:10,reward:500,conditional:null,value:null,valueTwo:"9",tier:2,loc:{title:"Slap the Bass",desc:"Get 10 Melee kills"}},{id:61,loc_ref:"chlg_kill_weaponType_Melee_twenty",type:0,subType:1,period:0,goal:20,reward:1000,conditional:null,value:null,valueTwo:"9",tier:3,loc:{title:"Whack & Slash",desc:"Get 20 Melee kills"}},{id:62,loc_ref:"chlg_kill_weaponType_Melee_fifty",type:0,subType:1,period:0,goal:50,reward:2500,conditional:null,value:null,valueTwo:"9",tier:3,loc:{title:"Melee Master",desc:"Get 50 Melee kills"}},{id:63,loc_ref:"chlg_damage_five_hundred",type:1,subType:null,period:0,goal:500,reward:100,conditional:null,value:null,valueTwo:null,tier:0,loc:{title:"Shattered Shells",desc:"Deal 500 damage"}},{id:64,loc_ref:"chlg_damage_one_thousand",type:1,subType:null,period:0,goal:1000,reward:100,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Decimator",desc:"Deal 1000 damage"}},{id:65,loc_ref:"chlg_damage_twenty_five_hundred",type:1,subType:null,period:0,goal:2500,reward:200,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Tormentor",desc:"Deal 2500 damage"}},{id:66,loc_ref:"chlg_damage_five_thousand",type:1,subType:null,period:0,goal:5000,reward:500,conditional:null,value:null,valueTwo:null,tier:2,loc:{title:"Devastator",desc:"Deal 5000 damage"}},{id:67,loc_ref:"chlg_damage_ten_thousand",type:1,subType:null,period:0,goal:1e4,reward:1000,conditional:null,value:null,valueTwo:null,tier:3,loc:{title:"Boomsauce",desc:"Deal 10000 damage"}},{id:68,loc_ref:"chlg_damage_twenty_five_thousand",type:1,subType:null,period:0,goal:25000,reward:2500,conditional:null,value:null,valueTwo:null,tier:3,loc:{title:"Maximum Damage",desc:"Deal 25000 damage"}},{id:69,loc_ref:"chlg_deaths_ten",type:2,subType:null,period:0,goal:10,reward:100,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Cracked",desc:"Die 10 times"}},{id:70,loc_ref:"chlg_deaths_twenty",type:2,subType:null,period:0,goal:20,reward:200,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Fried",desc:"Die 20 times"}},{id:71,loc_ref:"chlg_deaths_fifty",type:2,subType:null,period:0,goal:50,reward:500,conditional:null,value:null,valueTwo:null,tier:2,loc:{title:"Death Wish",desc:"Die 50 times"}},{id:72,loc_ref:"chlg_movement_distance_five_hunderd",type:3,subType:3,period:0,goal:500,reward:100,conditional:null,value:null,valueTwo:null,tier:0,loc:{title:"Runny Egg",desc:"Travel 500m"}},{id:73,loc_ref:"chlg_movement_distance_one_thousand",type:3,subType:3,period:0,goal:1000,reward:500,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Poultry in Motion",desc:"Travel 1000m"}},{id:74,loc_ref:"chlg_movement_distance_five_thousand",type:3,subType:3,period:0,goal:5000,reward:2500,conditional:null,value:null,valueTwo:null,tier:2,loc:{title:"Gaming Marathon",desc:"Travel 5000m"}},{id:75,loc_ref:"chlg_movement_jump_one_hundred",type:3,subType:4,period:0,goal:100,reward:100,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Jumpman",desc:"Jump 100 times"}},{id:76,loc_ref:"chlg_movement_jump_five_hundred",type:3,subType:4,period:0,goal:500,reward:500,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Bouncing Bomb",desc:"Jump 500 times"}},{id:77,loc_ref:"chlg_kill_jump_one",type:0,subType:4,period:0,goal:1,reward:200,conditional:null,value:null,valueTwo:null,tier:2,loc:{title:"Aerial Assault",desc:"Get a kill while jumping"}},{id:78,loc_ref:"chlg_kill_jump_five",type:0,subType:4,period:0,goal:5,reward:1000,conditional:null,value:null,valueTwo:null,tier:3,loc:{title:"Do a Barrel Roll",desc:"Get 5 kills while airborne"}},{id:79,loc_ref:"chlg_kill_jump_victim_jump",type:0,subType:4,period:0,goal:1,reward:2500,conditional:4,value:null,valueTwo:null,tier:3,loc:{title:"Aerial Acrobatics",desc:"Kill an egg while both airborne"}},{id:80,loc_ref:"chlg_movement_collect_ammo_ten",type:4,subType:18,period:0,goal:10,reward:100,conditional:16,value:"0",valueTwo:null,tier:1,loc:{title:"We Need Supplies!",desc:"Collect 10 ammo boxes"}},{id:81,loc_ref:"chlg_movement_collect_ammo_twenty_five",type:4,subType:18,period:0,goal:25,reward:500,conditional:16,value:"0",valueTwo:null,tier:2,loc:{title:"Quartermaster",desc:"Collect 25 ammo boxes"}},{id:82,loc_ref:"chlg_movement_collect_ammo_fifty",type:4,subType:18,period:0,goal:50,reward:1000,conditional:16,value:"0",valueTwo:null,tier:3,loc:{title:"Locked & Loaded",desc:"Collect 50 ammo boxes"}},{id:83,loc_ref:"chlg_movement_collect_grenade_ten",type:4,subType:18,period:0,goal:10,reward:100,conditional:17,value:"1",valueTwo:null,tier:1,loc:{title:"Explosives expert",desc:"Collect 10 grenades"}},{id:84,loc_ref:"chlg_movement_collect_grenade_twenty_five",type:4,subType:18,period:0,goal:25,reward:500,conditional:17,value:"1",valueTwo:null,tier:2,loc:{title:"Bombardier",desc:"Collect 25 grenades"}},{id:85,loc_ref:"chlg_movement_collect_grenade_fifty",type:4,subType:18,period:0,goal:50,reward:1000,conditional:17,value:"1",valueTwo:null,tier:3,loc:{title:"Explosive Temper",desc:"Collect 50 grenades"}},{id:86,loc_ref:"chlg_timed_timeAlive_thirty",type:5,subType:7,period:0,goal:1,reward:100,conditional:7,value:"30",valueTwo:null,tier:1,loc:{title:"Running Scared",desc:"Stay alive for 30 sec"}},{id:87,loc_ref:"chlg_timed_timeAlive_sixty",type:5,subType:7,period:0,goal:1,reward:200,conditional:7,value:"60",valueTwo:null,tier:2,loc:{title:"Hard to Beat",desc:"Stay alive for 1 min"}},{id:88,loc_ref:"chlg_timed_timeAlive_three_hundred",type:5,subType:7,period:0,goal:1,reward:2500,conditional:7,value:"300",valueTwo:null,tier:3,loc:{title:"Happily Ever After",desc:"Stay alive for 5 min"}},{id:90,loc_ref:"chlg_timed_timePlayed_three_hundred",type:5,subType:6,period:0,goal:300,reward:200,conditional:6,value:"300",valueTwo:null,tier:0,loc:{title:"Shell Shocked!",desc:"Play for 5 min"}},{id:91,loc_ref:"chlg_timed_timePlayed_nine_hundred",type:5,subType:6,period:0,goal:900,reward:500,conditional:6,value:"900",valueTwo:null,tier:1,loc:{title:"Not so Noob",desc:"Play for 15 min"}},{id:92,loc_ref:"chlg_timed_timePlayed_eighteen_hundred",type:5,subType:6,period:0,goal:1800,reward:1000,conditional:6,value:"1800",valueTwo:null,tier:2,loc:{title:"Oval Office",desc:"Play for 30 min"}},{id:93,loc_ref:"chlg_timed_timePlayed_thirty_six_hundred",type:5,subType:6,period:0,goal:3600,reward:2500,conditional:6,value:"3600",valueTwo:null,tier:3,loc:{title:"On That Grind",desc:"Play for 60 min"}},{id:94,loc_ref:"chlg_kotc_capturing_timeAlive_twenty",type:6,subType:20,period:0,goal:1,reward:100,conditional:7,value:"10",valueTwo:null,tier:1,loc:{title:"Hold the Fort",desc:"Stand on Coop for 10 sec"}},{id:95,loc_ref:"chlg_kotc_capture",type:6,subType:21,period:0,goal:1,reward:100,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Coop King",desc:"Capture a Coop"}},{id:96,loc_ref:"chlg_kotc_win_one",type:6,subType:23,period:0,goal:1,reward:200,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"King of the Coop",desc:"Win a KotC match"}},{id:97,loc_ref:"chlg_kotc_win_three",type:6,subType:23,period:0,goal:3,reward:500,conditional:null,value:null,valueTwo:null,tier:2,loc:{title:"Team Sports",desc:"Win 3 KotC matches"}},{id:98,loc_ref:"chlg_kotc_win_five",type:6,subType:23,period:0,goal:5,reward:1000,conditional:null,value:null,valueTwo:null,tier:3,loc:{title:"Rule the Roost",desc:"Win 5 KotC matches"}},{id:99,loc_ref:"chlg_kotc_win_ten",type:6,subType:23,period:0,goal:10,reward:2500,conditional:null,value:null,valueTwo:null,tier:3,loc:{title:"Coop Commander",desc:"Win 10 KotC matches"}},{id:100,loc_ref:"chlg_kotc_coop_kill",type:6,subType:20,period:0,goal:1,reward:200,conditional:10,value:null,valueTwo:null,tier:1,loc:{title:"Defender",desc:"Kill an egg from the Coop"}},{id:101,loc_ref:"chlg_kotc_coop_kill_victim_capturing",type:6,subType:20,period:0,goal:1,reward:200,conditional:10,value:"18",valueTwo:null,tier:1,loc:{title:"Offender",desc:"Kill an egg on a Coop"}},{id:102,loc_ref:"chlg_cts_pick_up",type:7,subType:21,period:0,goal:1,reward:200,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Fry Cook",desc:"CTS: Pick up the Spatula"}},{id:103,loc_ref:"chlg_cts_capture_timeAlive_thirty",type:7,subType:21,period:0,goal:1,reward:500,conditional:7,value:"30",valueTwo:null,tier:2,loc:{title:"Keepaway",desc:"CTS: Hold the Spatula for 30s"}},{id:104,loc_ref:"chlg_cts_win_ten",type:7,subType:23,period:0,goal:20,reward:1000,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Sunny Side Up!",desc:"CTS: Gain 20+ kills holding the spatula"}},{id:105,loc_ref:"chlg_cts_win_twenty_five",type:7,subType:23,period:0,goal:50,reward:4000,conditional:null,value:null,valueTwo:null,tier:2,loc:{title:"Flippin 'em",desc:"CTS: Gain 50+ kills holding the spatula"}},{id:106,loc_ref:"chlg_cts_win_fifty",type:7,subType:23,period:0,goal:100,reward:1e4,conditional:null,value:null,valueTwo:null,tier:3,loc:{title:"Makin' Bacon",desc:"CTS: Gain 100+ kills holding the spatula"}},{id:107,loc_ref:"chlg_cts_kills_victim_spatula",type:7,subType:10,period:0,goal:1,reward:200,conditional:null,value:null,valueTwo:null,tier:2,loc:{title:"Kill the Cook",desc:"CTS: Kill the Spatula holder"}},{id:108,loc_ref:"chlg_cts_kills_killstreak_five",type:7,subType:10,period:0,goal:1,reward:500,conditional:0,value:"5",valueTwo:null,tier:3,loc:{title:"Flippin' Dangerous",desc:"CTS: Get a 5 KS with the spatula"}}];var Maps=[{filename:"abduction",hash:"198kee3770y",name:"Abduction",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"aqueduct",hash:"11dp765kifr",name:"Aqueduct",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"backstage",hash:"9dsromfqr1",name:"Backstage",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"14"},{filename:"bastion",hash:"uuwh7401no",name:"Bastion",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"bedrock",hash:"yqbkimntiu",name:"Bedrock",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"12"},{filename:"biohazard",hash:"kzarr9ebqx",name:"BioHazard",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"18"},{filename:"blender",hash:"1vvfxp9rt8u",name:"Blender",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"14"},{filename:"blue",hash:"2e7izzo70bk",name:"Blue",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"14"},{filename:"bridge",hash:"20vcy8e1ev0",name:"Bridge",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"6"},{filename:"canyon",hash:"2avqtv9ygk1",name:"Canyon",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"cash",hash:"1427gfre8ma",name:"Cash",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"castle",hash:"2d2tcz2mw7e",name:"Castle",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"castleArena",hash:"9dhs3kms6l",name:"Castle Arena",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"8"},{filename:"catacombs",hash:"2el91jtcun0",name:"Catacombs",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"chickenItza",hash:"hyjqbat0i3",name:"Chicken Itza",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"cluckgrounds",hash:"1h9z3hj51g5",name:"Cluckgrounds",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"16"},{filename:"cobalt",hash:"1c9fg9re2mf",name:"Cobalt",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"creak",hash:"l2pzui2f6o",name:"Creak",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"crossed",hash:"ead3tcf30r",name:"Crossed",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"crowsnest",hash:"1ze2s5zr9bm",name:"Crowsnest",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"8"},{filename:"deathpit",hash:"1cc9cvjf607",name:"Death Pit",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"dirt",hash:"1u3k5nfvwuh",name:"Dirt",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"dirt2",hash:"494aka3mb4",name:"Dirt 2",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"dirtbase",hash:"6e9r2y7dxk",name:"Dirt Base",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"10"},{filename:"downfall",hash:"26g5aj8aruc",name:"Downfall",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"18"},{filename:"duelPyramid",hash:"vmg0rj2e3b",name:"Duel Pyramid",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"6"},{filename:"eggcrates",hash:"j0i36e808n",name:"Eggcrates",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"6"},{filename:"enchanted",hash:"1igxtcyetaw",name:"Enchanted",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"16"},{filename:"exposure",hash:"15hv3cme1fh",name:"Exposure",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"facility",hash:"18djbmo35ru",name:"Facility",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"feedlot",hash:"iuj8rc7kyh",name:"Feedlot",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"16"},{filename:"field",hash:"e4aszuch87",name:"Field",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"10"},{filename:"flux",hash:"2e9jbskip5u",name:"Flux",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"fortFlip",hash:"1w1b6dkalc2",name:"Fort Flip",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"foundation",hash:"11y636vc64b",name:"Foundation",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"fourQuarters",hash:"1a0w7vbz8is",name:"Four Quarters",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"10"},{filename:"greenhouse",hash:"ffvpjhqou6",name:"Greenhouse",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"growler",hash:"1izyni7tb1e",name:"Growler",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"haunted",hash:"2dma8z1jdev",name:"Haunted",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"16"},{filename:"helix",hash:"i2sl4vsg3h",name:"Helix",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"hydro",hash:"8znnxbxfss",name:"Hydro",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"icebox",hash:"f0fagzp3rq",name:"Ice Box",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"indigo",hash:"1vrzzn6ym9q",name:"Indigo",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"inmates",hash:"19wzahko4nm",name:"Inmates",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"jailbreak",hash:"2a3blmd9hf4",name:"Jail Break",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"14"},{filename:"jinx",hash:"24u6pohagnj",name:"Jinx",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"junction",hash:"bkca8j2ppd",name:"Junction",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"kingsCourt",hash:"aq1t2lsjza",name:"King's Court",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"lunarmodule",hash:"1448aqjdqvl",name:"Lunar Module",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"mansion",hash:"nqhtvwj3fo",name:"Mansion",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"mazerunner",hash:"j16i30k9dz",name:"Maze Runner",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"metamorph",hash:"l9o69l8e1b",name:"Metamorph",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"14"},{filename:"moonbase",hash:"1yzocf1mex3",name:"Moonbase",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"moonbasec",hash:"1ky3sogeibd",name:"Moonbase Eggsmas",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"mudGulch",hash:"kto278skze",name:"Mud Gulch",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"14"},{filename:"nextdoor",hash:"s2i5za1kx9",name:"Nextdoor",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"orbital",hash:"76g9ms7t5o",name:"Orbital",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"outer",hash:"w1biqokp89",name:"Outer Reach",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"overcooked",hash:"29ca98hgdeh",name:"Overcooked",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"palaceSiege",hash:"1enghs5hsxe",name:"Palace Siege",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"14"},{filename:"parkour1",hash:"1fwysuizmoy",name:"Parkour - Easy",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"18"},{filename:"parkour2",hash:"25n7k671t0e",name:"Parkour - Medium",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"18"},{filename:"parkour3",hash:"pm58s3bnil",name:"Parkour - Hard",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"12"},{filename:"quarry",hash:"2crjk106pa",name:"Quarry",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"14"},{filename:"queenscourt",hash:"raudy4h9pv",name:"Queen's Court",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"raceway",hash:"1a3eo6xaoju",name:"Raceway",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"rameses",hash:"177jt4j8so9",name:"Rameses",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"16"},{filename:"rats",hash:"13r2oqql8se",name:"Rats",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"relic",hash:"lxzknz53a2",name:"Relic",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"rivals",hash:"26fkvcef2h6",name:"Rivals",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"6"},{filename:"road",hash:"2h312vlocd",name:"Road",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"14"},{filename:"ruins",hash:"3ycs8z9bcu",name:"Ruins",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"scales",hash:"101v5lpkv1s",name:"Scales",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"shadyglen",hash:"2d0d4bj7aq3",name:"Shady Glen",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"shellville",hash:"fdgmkbfe7n",name:"Shellville",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"16"},{filename:"shipyard",hash:"1n1sptszksq",name:"Shipyard",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"skyScratcher",hash:"1th1c8epp95",name:"Sky Scratcher",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"spaceFactory",hash:"10802a2az0f",name:"Space Factory",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"10"},{filename:"spacearena",hash:"k9zf5lqzze",name:"Space Arena",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"14"},{filename:"sparta",hash:"274wwdyll9w",name:"Sparta",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"spellbound",hash:"1curtd0i4ls",name:"Spellbound",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"stage",hash:"1zn44r9jb3t",name:"Stage",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"starship",hash:"27xerc3smw5",name:"Starship",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"staxarena",hash:"1jid8ffda0z",name:"Stax Arena",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"6"},{filename:"teggtris",hash:"1y4rswkkv3l",name:"Teggtris",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"temple",hash:"bp6twwct9v",name:"Temple",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"18"},{filename:"timetwist",hash:"1ad75xyk2rv",name:"Timetwist",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"trainyard",hash:"2e1w70fjqet",name:"Trainyard",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"treefort",hash:"14a9akanqms",name:"Tree Fort",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"6"},{filename:"twoTowers",hash:"2asidv5c0ff",name:"Two Towers",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"uncovered",hash:"bxrd0zdvtn",name:"Uncovered",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"12"},{filename:"vert",hash:"25a9ikled77",name:"Vert",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"wimble",hash:"13smnxheae1",name:"Wimble",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"wonderland",hash:"5n6ixyepvy",name:"Wonderland",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"wreckage",hash:"nkiu4z6uj1",name:"Wreckage",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"yolkido",hash:"pttsmqw7xj",name:"Yolkido Garrison",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"zoomies",hash:"3vitx32ce8",name:"Zoomies",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"}];var Regions=[{id:"germany",sub:"egs-static-live-germany-287o43bv"},{id:"santiago",sub:"egs-static-live-santiago-1s5w3cdc"},{id:"singapore",sub:"egs-static-live-singapore-5r545eei"},{id:"sydney",sub:"egs-static-live-sydney-302pa99o"},{id:"uscentral",sub:"egs-static-live-uscentral-451sa2ap"},{id:"useast",sub:"egs-static-live-useast-191w3fe4"},{id:"uswest",sub:"egs-static-live-uswest-192r5xds"}];var GameModeById=Object.fromEntries(Object.entries(GameMode).map(([key,value])=>[value,key])),CCGameOptionFlag=Object.fromEntries(Object.entries(GameOptionFlag).map(([k,v])=>[k[0].toLowerCase()+k.slice(1),v])),intents={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},mod2=(n,m)=>(n%m+m)%m;class Bot{static Intents=intents;Intents=intents;#dispatches=[];#hooks={};#globalHooks=[];#initialAccount;#initialGame;constructor(params={}){if(params.proxy&&globals_default.isBrowser)this.processError("proxies do not work and hence are not supported in the browser");if(this.intents=params.intents||[],this.intents.includes(this.Intents.COSMETIC_DATA)){if(!findItemById(1001))this.processError("you cannot use the COSMETIC_DATA intent inside of the singlefile browser bundles")}if(this.instance=params.instance||"shellshock.io",this.protocol=params.protocol||"wss",this.proxy=params.proxy||"",this.connectionTimeout=params.connectionTimeout||5000,this.state={name:"yolkbot",weaponIdx:0,useAltGameURL:!1,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 GamePlayer_default({}),this.game={raw:{},code:"",socket:null,gameModeId:0,gameMode:GameModeById[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:CoopState.Capturing,zoneNumber:0,activeZone:[],capturing:0,captureProgress:0,numCapturing:0,capturePercent:0},this.#initialGame=this.game,this.account={id:0,firebase:{idToken:"",refreshToken:"",expiresIn:"3600",localId:""},firebaseId:"",sessionId:"",session:0,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,4000,4200,4500],secondaryId:[,,,,,,,].fill(3000),stampPositionX:0,stampPositionY:0},ownedItemIds:[],vip:!1,emailVerified:!1,isAged:!1,eggBalance:0,adminRoles:0,rawLoginData:{},isDoubleEggWeeknd:()=>{let day=new Date().getUTCDay(),hours=new Date().getUTCHours();return day>=5&&hours>=20||day===6||day===0}},this.#initialAccount=this.account,this.matchmaker=null,this.api=new api_default({proxy:this.proxy,protocol:this.protocol,instance:this.instance,maxRetries:params?.apiMaxRetries,connectionTimeout:this.connectionTimeout}),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;if(this.intents.includes(this.Intents.RENEW_SESSION))this.renewSessionInterval=0}dispatch(dispatch){if(dispatch.validate(this)){if(dispatch.check(this))dispatch.execute(this);else this.#dispatches.push(dispatch);return!0}return!1}async createAccount(email,pass){this.account=this.#initialAccount,this.account.email=email,this.account.password=pass;let loginData=await this.api.createAccount(email,pass);return this.processLoginData(loginData)}async login(email,pass){this.account=this.#initialAccount,this.account.email=email,this.account.password=pass;let loginData=await this.api.loginWithCredentials(email,pass);return this.processLoginData(loginData)}async loginWithRefreshToken(refreshToken){this.account=this.#initialAccount;let loginData=await this.api.loginWithRefreshToken(refreshToken);return this.processLoginData(loginData)}async loginAnonymously(){this.account=this.#initialAccount;let loginData=await this.api.loginAnonymously();return this.processLoginData(loginData)}processLoginData(loginData){if(typeof loginData!=="object")return this.emit("authFail",loginData),loginData;if(loginData.banRemaining)return this.emit("banned",loginData.banRemaining),"account_banned";if(!loginData.playerOutput)return this.emit("authFail",loginData),loginData;if(this.account.firebase=loginData.firebase||{},loginData=loginData.playerOutput,this.account.rawLoginData=loginData,this.account.adminRoles=loginData.adminRoles||0,this.account.eggBalance=loginData.currentBalance,this.account.emailVerified=loginData.emailVerified,this.account.firebaseId=loginData.firebaseId,this.account.id=loginData.id,this.account.isAged=new Date(loginData.dateCreated).getTime()<1714546800000,this.account.loadout=loginData.loadout,this.account.ownedItemIds=loginData.ownedItemIds,this.account.session=loginData.session,this.account.sessionId=loginData.sessionId,this.account.vip=loginData.active_sub==="IsVIP",this.intents.includes(this.Intents.BOT_STATS))this.account.stats={lifetime:loginData.statsLifetime,monthly:loginData.statsCurrent};if(this.intents.includes(this.Intents.CHALLENGES))this.#importChallenges(loginData.challenges);if(this.emit("authSuccess",this.account),this.intents.includes(this.Intents.RENEW_SESSION))this.renewSessionInterval=setInterval(async()=>{if(!this.account?.sessionId)return clearInterval(this.renewSessionInterval);if((await this.api.queryServices({cmd:"renewSession",sessionId:this.account.sessionId})).data!=="renewed")this.emit("sessionExpired")},600000);return this.account}#importChallenges(challengeArray){this.account.challenges=[];for(let challengeData of challengeArray){let challengeInfo=Challenges.find((c)=>c.id===challengeData.challengeId);if(!challengeInfo)continue;delete challengeData.playerId,this.account.challenges.push({raw:{challengeInfo,challengeData},id:challengeData.challengeId,name:challengeInfo.loc.title,desc:challengeInfo.loc.desc,rewardEggs:challengeInfo.reward,isRerolled:!!challengeData.reset,isClaimed:!!challengeData.claimed,isCompleted:!!challengeData.completed,progressNum:challengeData.progress,goalNum:challengeInfo.goal})}}async initMatchmaker(){if(!this.account.sessionId&&!this.intents.includes(this.Intents.NO_LOGIN)){let anonLogin=await this.loginAnonymously();if(typeof anonLogin!=="object")return anonLogin}if(!this.matchmaker){if(this.matchmaker=new matchmaker_default({api:this.api,proxy:this.proxy,protocol:this.protocol,instance:this.instance,sessionId:this.account.sessionId,connectionTimeout:this.connectionTimeout,noLogin:this.intents.includes(this.Intents.NO_LOGIN)}),!await this.matchmaker.ws.tryConnect())return"matchmaker_tryconnect_failed";this.matchmaker.on("authFail",(data)=>this.emit("authFail",data)),this.matchmaker.on("error",(data)=>this.processError(data))}return!0}async findPublicGame(region,modeId){if(typeof region!=="string")return"no_region_passed";if(!Regions.find((r)=>r.id===region)&&!this.intents.includes(this.Intents.NO_REGION_CHECK))return"invalid_region_passed";if(typeof modeId!=="number")return"no_mode_passed";if(Object.values(GameMode).indexOf(modeId)===-1)return"invalid_mode_passed";if(!await this.initMatchmaker())return"matchmaker_init_fail";return await new Promise((resolve)=>{let listener=(msg)=>{if(msg.command==="notice")return;if(this.matchmaker.off("msg",listener),msg.command==="gameFound"){if(msg.useAltGameURL)this.state.useAltGameURL=!0;return resolve(msg)}if(msg.error==="sessionNotFound")return resolve("internal_session_error");this.processError("unknown matchmaker response",JSON.stringify(msg))};this.matchmaker.on("msg",listener),this.matchmaker.send({command:"findGame",region,playType:PlayType.JoinPublic,gameType:modeId,sessionId:this.account.sessionId})})}async createPrivateGame(region,modeId,map){if(typeof region!=="string")return"no_region_passed";if(!Regions.find((r)=>r.id===region)&&!this.intents.includes(this.Intents.NO_REGION_CHECK))return"invalid_region_passed";if(typeof modeId!=="number")return"no_mode_passed";if(Object.values(GameMode).indexOf(modeId)===-1)return"invalid_mode_passed";if(typeof map!=="string")return"no_map_passed";let mapIdx=Maps.findIndex((m)=>m.name.toLowerCase()===map.toLowerCase());if(mapIdx===-1)return"invalid_map_passed";if(!await this.initMatchmaker())return"matchmaker_init_fail";return await new Promise((resolve)=>{let listener=(msg)=>{if(msg.command==="notice")return;if(this.matchmaker.off("msg",listener),msg.command==="gameFound"){if(msg.useAltGameURL)this.state.useAltGameURL=!0;return resolve(msg)}if(msg.error==="sessionNotFound")return resolve("internal_session_error");this.processError("unknown matchmaker response",JSON.stringify(msg))};this.matchmaker.on("msg",listener),this.matchmaker.send({command:"findGame",region,playType:PlayType.CreatePrivate,gameType:modeId,sessionId:this.account.sessionId,noobLobby:!1,map:mapIdx})})}async join(name,data){if(this.state.name=name||"yolkbot",typeof data==="string"){if(data.includes("#"))data=data.split("#")[1];if(!await this.initMatchmaker())return"matchmaker_init_fail";if(await new Promise((resolve)=>{let listener=(message)=>{if(message.command==="gameFound")this.matchmaker.off("msg",listener),this.game.raw=message,this.game.code=message.id,resolve(message.id);if(message.error&&message.error==="gameNotFound")return this.processError(`game "${data}" not found, it may have expired.`),this.leave(),"gameNotFound"};this.matchmaker.on("msg",listener),this.matchmaker.send({command:"joinGame",id:data,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 data==="object"){if(this.account.id===0)await this.loginAnonymously();if(this.game.raw=data,this.game.code=this.game.raw.id,!this.game.raw.id)return"invalid_game_object";if(!this.game.raw.subdomain)return"invalid_game_object";if(!this.game.raw.uuid)return"invalid_game_object";if(data.useAltGameURL)this.state.useAltGameURL=!0}let host=this.state.useAltGameURL||this.host==="proxy.yolkbot.xyz"?`${this.instance}/servers/${this.game.raw.subdomain}`:`${this.game.raw.subdomain}.${this.instance}`;if(this.game.socket=new socket_default(`${this.protocol}://${host}/game/${this.game.raw.id}`,this.proxy),this.game.socket.binaryType="arraybuffer",this.game.socket.connectionTimeout=this.connectionTimeout,this.game.socket.onBeforeConnect=()=>{this.game.socket.onmessage=(msg)=>this.processPacket(msg.data),this.game.socket.onclose=(e)=>{if(this.state.left)this.state.left=!1;else this.emit("close",e.code),this.leave(-1)}},!await this.game.socket.tryConnect())return"websocket_tryconnect_fail";return!0}#processPathfinding(){if(Object.entries(this.me.position).map((entry)=>Math.floor(entry[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 MovementDispatch_default(0));else{let positionTarget;if(this.pathing.activeNodeIdx<this.pathing.activePath.length-1)positionTarget=this.pathing.activePath[this.pathing.activeNodeIdx+1].flatCenter(),this.dispatch(new LookAtPosDispatch_default(positionTarget));else positionTarget=this.pathing.activePath[this.pathing.activeNodeIdx].flatCenter(),this.dispatch(new LookAtPosDispatch_default(positionTarget));for(let node of this.pathing.activePath)if(node.flatRadialDistance(this.me.position)<0.1&&node.position.y===Math.floor(this.me.position.y)){if(this.pathing.activePath.indexOf(node)>=this.pathing.activeNodeIdx){this.pathing.activeNodeIdx=this.pathing.activePath.indexOf(node)+1,this.pathing.activeNode=this.pathing.activePath[this.pathing.activeNodeIdx];break}}if(!(this.state.controlKeys&Movement.Forward))this.dispatch(new MovementDispatch_default(Movement.Forward))}}update(){if(this.hasQuit)return;if(this.pathing.followingPath&&this.intents.includes(this.Intents.PATHFINDING))this.#processPathfinding();for(let i=0;i<this.#dispatches.length;i++){let disp=this.#dispatches[i];if(disp.check(this))disp.execute(this),this.#dispatches.splice(i,1)}if(this.state.chatLines=Math.max(0,this.state.chatLines-0.008333333333333333),this.me.playing){let currentIdx=this.state.stateIdx;if(this.intents.includes(this.Intents.DEBUG_BUFFER))console.log("setting buffer for idx",currentIdx),console.log("checking...shotsFired",this.state.shotsFired);if(this.me.jumping=!!(this.state.controlKeys&Movement.Jump),this.state.buffer[currentIdx]={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");let out=new CommOut_default;out.packInt8(CommCode_default.syncMe),out.packInt8(this.state.stateIdx),out.packInt8(this.state.serverStateIdx);let startIdx=mod2(this.state.stateIdx-FramesBetweenSyncs+1,StateBufferSize);for(let i=0;i<FramesBetweenSyncs;i++){let idx=mod2(startIdx+i,StateBufferSize),frame=this.state.buffer[idx]||{},keys=frame.controlKeys||0,shots=frame.shotsFired||0,yaw=frame.yaw??this.state.yaw,pitch=frame.pitch??this.state.pitch;if(this.intents.includes(this.Intents.DEBUG_BUFFER))console.log("going with",this.state.stateIdx,startIdx,idx,frame);out.packInt8(keys),out.packInt8(shots),out.packString(coords(yaw,pitch)),out.packInt8(100)}out.send(this.game.socket),this.state.buffer=[],this.lastUpdateTick=0}else this.lastUpdateTick++;this.state.stateIdx=mod2(this.state.stateIdx+1,StateBufferSize)}if(!this.intents.includes(this.Intents.PLAYER_HEALTH))return;let regen=0.1*(this.game.isPrivate?this.game.options.healthRegen:1);for(let player of Object.values(this.players)){if(player.playing&&player.hp>0){let overHeal=player.streakRewards.includes(ShellStreak.OverHeal);player.hp+=overHeal?-regen:regen,player.hp=overHeal?Math.max(100,player.hp):Math.min(100,player.hp)}if(player.spawnShield>0)player.spawnShield-=6}}on(event,cb){if(Object.keys(this.#hooks).includes(event))this.#hooks[event].push(cb);else this.#hooks[event]=[cb]}once(event,cb){let onceCb=(...args)=>{cb(...args),this.off(event,onceCb)};this.on(event,onceCb)}onAny(cb){this.#globalHooks.push(cb)}off(event,cb){if(cb)this.#hooks[event]=this.#hooks[event].filter((hook)=>hook!==cb);else this.#hooks[event]=[]}emit(event,...args){if(this.hasQuit)return;if(this.#hooks[event])for(let cb of this.#hooks[event])cb(...args);for(let cb of this.#globalHooks)cb(event,...args)}#processChatPacket(){let id=CommIn_default.unPackInt8U(),msgFlags=CommIn_default.unPackInt8U(),text=CommIn_default.unPackString().valueOf(),player=this.players[id];this.emit("chat",player,text,msgFlags)}#processAddPlayerPacket(){let id=CommIn_default.unPackInt8U(),findCosmetics=this.intents.includes(this.Intents.COSMETIC_DATA),playerData={id,uniqueId:CommIn_default.unPackString(),name:CommIn_default.unPackString(),safeName:CommIn_default.unPackString(),charClass:CommIn_default.unPackInt8U(),team:CommIn_default.unPackInt8U(),primaryWeaponItem:findCosmetics?findItemById(CommIn_default.unPackInt16U()):CommIn_default.unPackInt16U(),secondaryWeaponItem:findCosmetics?findItemById(CommIn_default.unPackInt16U()):CommIn_default.unPackInt16U(),shellColor:CommIn_default.unPackInt8U(),hatItem:findCosmetics?findItemById(CommIn_default.unPackInt16U()):CommIn_default.unPackInt16U(),stampItem:findCosmetics?findItemById(CommIn_default.unPackInt16U()):CommIn_default.unPackInt16U(),stampPosX:CommIn_default.unPackInt8(),stampPosY:CommIn_default.unPackInt8(),grenadeItem:findCosmetics?findItemById(CommIn_default.unPackInt16U()):CommIn_default.unPackInt16U(),meleeItem:findCosmetics?findItemById(CommIn_default.unPackInt16U()):CommIn_default.unPackInt16U(),x:CommIn_default.unPackFloat(),y:CommIn_default.unPackFloat(),z:CommIn_default.unPackFloat(),$dx:CommIn_default.unPackFloat(),$dy:CommIn_default.unPackFloat(),$dz:CommIn_default.unPackFloat(),yaw:CommIn_default.unPackRadU(),pitch:CommIn_default.unPackRad(),score:CommIn_default.unPackInt32U(),$kills:CommIn_default.unPackInt16U(),$deaths:CommIn_default.unPackInt16U(),$streak:CommIn_default.unPackInt16U(),totalKills:CommIn_default.unPackInt32U(),totalDeaths:CommIn_default.unPackInt32U(),bestStreak:CommIn_default.unPackInt16U(),$bestOverallStreak:CommIn_default.unPackInt16U(),shield:CommIn_default.unPackInt8U(),hp:CommIn_default.unPackInt8U(),playing:CommIn_default.unPackInt8U(),weaponIdx:CommIn_default.unPackInt8U(),$controlKeys:CommIn_default.unPackInt8U(),upgradeProductId:CommIn_default.unPackInt8U(),activeShellStreaks:CommIn_default.unPackInt8U(),social:CommIn_default.unPackLongString(),hideBadge:CommIn_default.unPackInt8U()};this.game.mapIdx=CommIn_default.unPackInt8U(),this.game.isPrivate=CommIn_default.unPackInt8U()===1,this.game.gameModeId=CommIn_default.unPackInt8U();let player=new GamePlayer_default(playerData,this.game.gameMode===GameMode.KOTC?this.game.activeZone:null);if(!this.players[playerData.id])this.players[playerData.id]=player;if(this.emit("playerJoin",player),this.me.id===playerData.id)this.me=player,this.emit("botJoin",this.me)}#processRespawnPacket(){let id=CommIn_default.unPackInt8U(),seed=CommIn_default.unPackInt16U(),x=CommIn_default.unPackFloat(),y=CommIn_default.unPackFloat(),z=CommIn_default.unPackFloat(),rounds0=CommIn_default.unPackInt8U(),store0=CommIn_default.unPackInt8U(),rounds1=CommIn_default.unPackInt8U(),store1=CommIn_default.unPackInt8U(),grenades=CommIn_default.unPackInt8U(),player=this.players[id];if(player){if(player.playing=!0,player.randomSeed=seed,player.weapons[0]&&player.weapons[0].ammo)player.weapons[0].ammo.rounds=rounds0;if(player.weapons[0]&&player.weapons[0].ammo)player.weapons[0].ammo.store=store0;if(player.weapons[1]&&player.weapons[1].ammo)player.weapons[1].ammo.rounds=rounds1;if(player.weapons[1]&&player.weapons[1].ammo)player.weapons[1].ammo.store=store1;player.grenades=grenades,player.position={x,y,z},player.spawnShield=120,this.emit("playerRespawn",player)}}#processSyncThemPacket(){let id=CommIn_default.unPackInt8U(),x=CommIn_default.unPackFloat(),y=CommIn_default.unPackFloat(),z=CommIn_default.unPackFloat(),climbing=CommIn_default.unPackInt8U(),player=this.players[id];if(!player||player.id===this.me.id){for(let i2=0;i2<FramesBetweenSyncs;i2++)CommIn_default.unPackInt8U(),CommIn_default.unPackRadU(),CommIn_default.unPackRad(),CommIn_default.unPackInt8U();return}for(let i2=0;i2<FramesBetweenSyncs;i2++){let controlKeys=CommIn_default.unPackInt8U();if(controlKeys&Movement.Jump)player.jumping=!0;else player.jumping=!1;if(controlKeys&Movement.Scope)player.scoping=!0;else player.scoping=!1;let oldView={...player.view};if(player.view.yaw=CommIn_default.unPackRadU(),player.view.pitch=CommIn_default.unPackRad(),player.view.yaw!==oldView.yaw||player.view.pitch!==oldView.pitch)this.emit("playerRotate",player,oldView,player.view);player.scale=CommIn_default.unPackInt8U()}let px=player.position,posChanged=px.x!==x||px.y!==y||px.z!==z,climbingChanged=player.climbing!==climbing,didChange=posChanged||climbingChanged,oldPosition=didChange?{...px}:null;if(px.x!==x)px.x=x;if(px.z!==z)px.z=z;if(!player.jumping||Math.abs(px.y-y)>0.5)px.y=y;if(climbingChanged)player.climbing=climbing;if(!didChange)return;if(this.emit("playerMove",player,oldPosition,px),this.game.gameModeId!==GameMode.KOTC)return;let zone=this.game.activeZone,wasIn=!!player.inKotcZone;if(!zone&&wasIn){player.inKotcZone=!1,this.emit("playerLeaveZone",player);return}player.updateKotcZone(zone);let nowIn=!!player.inKotcZone;if(wasIn!==nowIn)player.inKotcZone=nowIn,this.emit(nowIn?"playerEnterZone":"playerLeaveZone",player)}#processPausePacket(){let id=CommIn_default.unPackInt8U(),player=this.players[id];if(player){if(player.playing=!1,player.streakRewards)player.streakRewards=[];if(this.emit("playerPause",player),player.inKotcZone)player.inKotcZone=!1,this.emit("playerLeaveZone",player)}}#processSwapWeaponPacket(){let id=CommIn_default.unPackInt8U(),newWeaponId=CommIn_default.unPackInt8U(),player=this.players[id];if(player)player.activeGun=newWeaponId,this.emit("playerSwapWeapon",player,newWeaponId)}#processDeathPacket(){let killedId=CommIn_default.unPackInt8U(),killerId=CommIn_default.unPackInt8U();CommIn_default.unPackInt8U(),CommIn_default.unPackInt8U();let damageCauseInt=CommIn_default.unPackInt8U(),killed=this.players[killedId],killer=this.players[killerId],oldKilled=killed?{...killed}:null;if(killed){if(killed.id===this.me.id)this.lastDeathTime=Date.now();killed.playing=!1,killed.streak=0,killed.hp=100,killed.spawnShield=0,killed.stats.totalDeaths++,killed.inKotcZone=!1,this.emit("playerLeaveZone",killed)}if(killer){if(killer.streak++,killer.stats.totalKills++,killer.streak>killer.stats.bestStreak)killer.stats.bestStreak=killer.streak}this.emit("playerDeath",killed,killer,oldKilled,damageCauseInt)}#processFirePacket(){let id=CommIn_default.unPackInt8U(),bullet={posX:CommIn_default.unPackFloat(),posY:CommIn_default.unPackFloat(),posZ:CommIn_default.unPackFloat(),dirX:CommIn_default.unPackFloat(),dirY:CommIn_default.unPackFloat(),dirZ:CommIn_default.unPackFloat()},player=this.players[id];if(!player)return;let playerWeapon=player.weapons[player.activeGun];if(playerWeapon&&playerWeapon.ammo)playerWeapon.ammo.rounds--,this.emit("playerFire",player,playerWeapon,bullet)}#processSpawnItemPacket(){let id=CommIn_default.unPackInt16U(),type=CommIn_default.unPackInt8U(),x=CommIn_default.unPackFloat(),y=CommIn_default.unPackFloat(),z=CommIn_default.unPackFloat();this.game.collectables[type].push({id,x,y,z}),this.emit("spawnItem",type,{x,y,z},id)}#processCollectPacket(){let playerId=CommIn_default.unPackInt8U(),type=CommIn_default.unPackInt8U(),applyToWeaponIdx=CommIn_default.unPackInt8U(),id=CommIn_default.unPackInt16U(),player=this.players[playerId];if(!player)return;if(this.game.collectables[type]=this.game.collectables[type].filter((c)=>c.id!==id),type===CollectType.Ammo){let playerWeapon=player.weapons[applyToWeaponIdx];if(playerWeapon&&playerWeapon.ammo)playerWeapon.ammo.store=Math.min(playerWeapon.ammo.storeMax,playerWeapon.ammo.store+playerWeapon.ammo.pickup),this.emit("playerCollectAmmo",player,playerWeapon,id)}if(type===CollectType.Grenade){if(player.grenades++,player.grenades>3)player.grenades=3;this.emit("playerCollectGrenade",player,id)}}#processHitThemPacket(){let id=CommIn_default.unPackInt8U(),hp=CommIn_default.unPackInt8U(),player=this.players[id];if(!player)return;let oldHealth=player.hp;player.hp=hp,this.emit("playerDamage",player,oldHealth,player.hp)}#processHitMePacket(){let hp=CommIn_default.unPackInt8U();CommIn_default.unPackFloat(),CommIn_default.unPackFloat();let oldHealth=this.me.hp;this.me.hp=hp,this.emit("playerDamage",this.me,oldHealth,this.me.hp)}#processSyncMePacket(){let id=CommIn_default.unPackInt8U(),player=this.players[id];CommIn_default.unPackInt8U();let serverStateIdx=CommIn_default.unPackInt8U(),newX=CommIn_default.unPackFloat(),newY=CommIn_default.unPackFloat(),newZ=CommIn_default.unPackFloat();if(this.me.climbing=!!CommIn_default.unPackInt8U(),CommIn_default.unPackInt8U(),CommIn_default.unPackInt8U(),!player)return;this.state.serverStateIdx=serverStateIdx;let oldX=player.position.x,oldY=player.position.y,oldZ=player.position.z;if(player.position.x=newX,player.position.y=newY,player.position.z=newZ,oldX!==newX||oldY!==newY||oldZ!==newZ)this.emit("playerMove",player,{x:oldX,y:oldY,z:oldZ},{x:newX,y:newY,z:newZ})}#processEventModifierPacket(){let out=new CommOut_default;out.packInt8(CommCode_default.eventModifier),out.send(this.game.socket)}#processRemovePlayerPacket(){let id=CommIn_default.unPackInt8U(),removedPlayer={...this.players[id]};delete this.players[id],this.emit("playerLeave",removedPlayer)}#processGameStatePacket(){if(this.game.gameModeId===GameMode.Spatula){let oldGame={...this.game};this.game.teamScore[1]=CommIn_default.unPackInt16U(),this.game.teamScore[2]=CommIn_default.unPackInt16U();let spatulaCoords={x:CommIn_default.unPackFloat(),y:CommIn_default.unPackFloat(),z:CommIn_default.unPackFloat()},controlledBy=CommIn_default.unPackInt8U(),controlledByTeam=CommIn_default.unPackInt8U();this.game.spatula={coords:spatulaCoords,controlledBy,controlledByTeam},this.emit("gameStateChange",oldGame,this.game)}else if(this.game.gameModeId===GameMode.KOTC){let oldGame={...this.game};this.game.stage=CommIn_default.unPackInt8U(),this.game.zoneNumber=CommIn_default.unPackInt8U(),this.game.capturing=CommIn_default.unPackInt8U(),this.game.captureProgress=CommIn_default.unPackInt16U(),this.game.numCapturing=CommIn_default.unPackInt8U(),this.game.teamScore[1]=CommIn_default.unPackInt8U(),this.game.teamScore[2]=CommIn_default.unPackInt8U(),this.game.capturePercent=this.game.captureProgress/1000,this.game.activeZone=this.game.map.zones?this.game.map.zones[this.game.zoneNumber-1]:null;let oldPlayersOnZone=Object.values(this.players).filter((p)=>p.inKotcZone&&p.playing);if(this.game.activeZone)Object.values(this.players).forEach((player)=>player.updateKotcZone(this.game.activeZone));if(this.game.numCapturing<=0)Object.values(this.players).forEach((player)=>{player.inKotcZone=!1,this.emit("playerLeaveZone",player)});this.emit("gameStateChange",oldGame,this.game,oldPlayersOnZone)}else if(this.game.gameModeId===GameMode.Team)this.game.teamScore[1]=CommIn_default.unPackInt16U(),this.game.teamScore[2]=CommIn_default.unPackInt16U();if(this.game.gameModeId!==GameMode.Spatula)delete this.game.spatula;if(this.game.gameModeId!==GameMode.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;if(this.game.gameModeId===GameMode.FFA)delete this.game.teamScore}#processBeginStreakPacket(){let id=CommIn_default.unPackInt8U(),ksType=CommIn_default.unPackInt8U(),player=this.players[id];if(!player)return;switch(ksType){case ShellStreak.HardBoiled:if(id===this.me.id)this.me.shieldHp=100;player.streakRewards.push(ShellStreak.HardBoiled);break;case ShellStreak.EggBreaker:player.streakRewards.push(ShellStreak.EggBreaker);break;case ShellStreak.Restock:{if(player.grenades=3,player.weapons[0]&&player.weapons[0].ammo)player.weapons[0].ammo.rounds=player.weapons[0].ammo.capacity,player.weapons[0].ammo.store=player.weapons[0].ammo.storeMax;if(player.weapons[1]&&player.weapons[1].ammo)player.weapons[1].ammo.rounds=player.weapons[1].ammo.capacity,player.weapons[1].ammo.store=player.weapons[1].ammo.storeMax;break}case ShellStreak.OverHeal:player.hp=Math.min(200,player.hp+100),player.streakRewards.push(ShellStreak.OverHeal);break;case ShellStreak.DoubleEggs:player.streakRewards.push(ShellStreak.DoubleEggs);break;case ShellStreak.MiniEgg:player.scale=0.5,player.streakRewards.push(ShellStreak.MiniEgg);break}this.emit("playerBeginStreak",player,ksType)}#processEndStreakPacket(){let id=CommIn_default.unPackInt8U(),ksType=CommIn_default.unPackInt8U(),player=this.players[id];if(!player)return;if([ShellStreak.EggBreaker,ShellStreak.OverHeal,ShellStreak.DoubleEggs,ShellStreak.MiniEgg].includes(ksType)&&player.streakRewards.includes(ksType))player.streakRewards=player.streakRewards.filter((r)=>r!==ksType);if(ksType===ShellStreak.MiniEgg)player.scale=1;this.emit("playerEndStreak",player,ksType)}#processHitShieldPacket(){let shieldHealth=CommIn_default.unPackInt8U(),playerHealth=CommIn_default.unPackInt8U(),dx=CommIn_default.unPackFloat(),dz=CommIn_default.unPackFloat();if(!this.me)return;if(this.me.shieldHp=shieldHealth,this.me.hp=playerHealth,this.me.shieldHp<=0)this.me.streakRewards=this.me.streakRewards.filter((r)=>r!==ShellStreak.HardBoiled),this.emit("selfShieldLost",this.me.hp,{dx,dz});else this.emit("selfShieldHit",this.me.shieldHp,this.me.hp,{dx,dz})}#processGameOptionsPacket(){let oldOptions={...this.game.options},gravity=CommIn_default.unPackInt8U(),damage=CommIn_default.unPackInt8U(),healthRegen=CommIn_default.unPackInt8U();if(gravity<1||gravity>4)gravity=4;if(damage<0||damage>8)damage=4;if(healthRegen>16)healthRegen=4;this.game.options.gravity=gravity/4,this.game.options.damage=damage/4,this.game.options.healthRegen=healthRegen/4;let rawFlags=CommIn_default.unPackInt8U();Object.keys(CCGameOptionFlag).forEach((optionFlagName)=>{let value=rawFlags&CCGameOptionFlag[optionFlagName]?1:0;this.game.options[optionFlagName]=value}),this.game.options.weaponsDisabled=Array.from({length:7},()=>CommIn_default.unPackInt8U()===1),this.game.options.mustUseSecondary=this.game.options.weaponsDisabled.every((v)=>v),this.emit("gameOptionsChange",oldOptions,this.game.options)}#processGameActionPacket(){let action=CommIn_default.unPackInt8U();if(action===GameAction.Pause)this.emit("gameForcePause"),setTimeout(()=>this.me.playing=!1,3000);if(action===GameAction.Reset){if(Object.values(this.players).forEach((player)=>player.streak=0),this.game.gameModeId!==GameMode.FFA)this.game.teamScore=[0,0,0];if(this.game.gameModeId===GameMode.Spatula)this.game.spatula.controlledBy=0,this.game.spatula.controlledByTeam=0,this.game.spatula.coords={x:0,y:0,z:0};if(this.game.gameModeId===GameMode.KOTC)this.game.stage=CoopState.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")}}#processPingPacket(){if(!this.intents.includes(this.Intents.PING))return;let oldPing=this.ping;this.ping=Date.now()-this.lastPingTime,this.emit("pingUpdate",oldPing,this.ping),setTimeout(()=>{let out=new CommOut_default;out.packInt8(CommCode_default.ping),out.send(this.game.socket),this.lastPingTime=Date.now()},1000)}#processSwitchTeamPacket(){let id=CommIn_default.unPackInt8U(),toTeam=CommIn_default.unPackInt8U(),player=this.players[id];if(!player)return;let oldTeam=player.team;player.team=toTeam,player.streak=0,this.emit("playerSwitchTeam",player,oldTeam,toTeam)}#processChangeCharacterPacket(){let id=CommIn_default.unPackInt8U(),weaponIndex=CommIn_default.unPackInt8U(),primaryWeaponIdx=CommIn_default.unPackInt16U(),secondaryWeaponIdx=CommIn_default.unPackInt16U(),shellColor=CommIn_default.unPackInt8U(),hatIdx=CommIn_default.unPackInt16U(),stampIdx=CommIn_default.unPackInt16U(),grenadeIdx=CommIn_default.unPackInt16U(),meleeIdx=CommIn_default.unPackInt16U(),stampPositionX=CommIn_default.unPackInt8(),stampPositionY=CommIn_default.unPackInt8(),findCosmetics=this.intents.includes(this.Intents.COSMETIC_DATA),primaryWeaponItem=findCosmetics?findItemById(primaryWeaponIdx):primaryWeaponIdx,secondaryWeaponItem=findCosmetics?findItemById(secondaryWeaponIdx):secondaryWeaponIdx,hatItem=findCosmetics?findItemById(hatIdx):hatIdx,stampItem=findCosmetics?findItemById(stampIdx):stampIdx,grenadeItem=findCosmetics?findItemById(grenadeIdx):grenadeIdx,meleeItem=findCosmetics?findItemById(meleeIdx):meleeIdx,player=this.players[id];if(player){let oldCharacter={...player.character},oldWeaponIdx=player.selectedGun;if(player.character.eggColor=shellColor,player.character.primaryGun=primaryWeaponItem,player.character.secondaryGun=secondaryWeaponItem,player.character.stamp=stampItem,player.character.hat=hatItem,player.character.grenade=grenadeItem,player.character.melee=meleeItem,player.character.stampPos.x=stampPositionX,player.character.stampPos.y=stampPositionY,player.selectedGun=weaponIndex,player.weapons[0]=new GunList[weaponIndex],oldWeaponIdx!==player.selectedGun)this.emit("playerChangeGun",player,oldWeaponIdx,player.selectedGun);if(oldCharacter!==player.character)this.emit("playerChangeCharacter",player,oldCharacter,player.character)}}#processUpdateBalancePacket(){let newBalance=CommIn_default.unPackInt32U(),oldBalance=this.account.eggBalance;this.account.eggBalance=newBalance,this.emit("balanceUpdate",oldBalance,newBalance)}#processRespawnDeniedPacket(){this.me.playing=!1,this.emit("respawnDenied")}#processMeleePacket(){let id=CommIn_default.unPackInt8U(),player=this.players[id];if(player)this.emit("playerMelee",player)}#processReloadPacket(){let id=CommIn_default.unPackInt8U(),player=this.players[id];if(!player)return;let playerActiveWeapon=player.weapons[player.activeGun];if(playerActiveWeapon.ammo){let newRounds=Math.min(Math.min(playerActiveWeapon.ammo.capacity,playerActiveWeapon.ammo.reload)-playerActiveWeapon.ammo.rounds,playerActiveWeapon.ammo.store);playerActiveWeapon.ammo.rounds+=newRounds,playerActiveWeapon.ammo.store-=newRounds}this.emit("playerReload",player,playerActiveWeapon)}updateGameOptions(){let out=new CommOut_default;out.packInt8(CommCode_default.gameOptions),out.packInt8(this.game.options.gravity*4),out.packInt8(this.game.options.damage*4),out.packInt8(this.game.options.healthRegen*4);let flags=(this.game.options.locked?1:0)|(this.game.options.noTeamChange?2:0)|(this.game.options.noTeamShuffle?4:0);out.packInt8(flags),this.game.options.weaponsDisabled.forEach((v)=>{out.packInt8(v?1:0)}),out.send(this.game.socket)}#processGameRequestOptionsPacket(){this.game.isPrivate=!0,this.updateGameOptions()}#processExplodePacket(){let itemType=CommIn_default.unPackInt8U(),item=CommIn_default.unPackInt16U(),x=CommIn_default.unPackFloat(),y=CommIn_default.unPackFloat(),z=CommIn_default.unPackFloat(),damage=CommIn_default.unPackInt8U(),radius=CommIn_default.unPackFloat();if(this.intents.includes(this.Intents.COSMETIC_DATA))item=findItemById(item);if(itemType===ItemType.Grenade)this.emit("grenadeExplode",item,{x,y,z},damage,radius);else this.emit("rocketHit",{x,y,z},damage,radius)}#processThrowGrenadePacket(){let id=CommIn_default.unPackInt8U(),x=CommIn_default.unPackFloat(),y=CommIn_default.unPackFloat(),z=CommIn_default.unPackFloat(),dx=CommIn_default.unPackFloat(),dy=CommIn_default.unPackFloat(),dz=CommIn_default.unPackFloat(),player=this.players[id];if(player)player.grenades--,this.emit("playerThrowGrenade",player,{x,y,z},{x:dx,y:dy,z:dz})}#processChallengeCompletePacket(){let id=CommIn_default.unPackInt8U(),challengeId=CommIn_default.unPackInt8U(),player=this.players[id];if(!player)return;if(!this.intents.includes(this.Intents.CHALLENGES))return this.emit("challengeComplete",player,challengeId);let challenge=this.account.challenges.find((c)=>c.id===challengeId);if(this.emit("challengeComplete",player,challenge),player.id===this.me.id)this.refreshChallenges()}#processSocketReadyPacket(){let out=new CommOut_default;out.packInt8(this.intents.includes(this.Intents.OBSERVE_GAME)?CommCode_default.observeGame:CommCode_default.joinGame),out.packString(this.game.raw.uuid),out.packInt8(+this.intents.includes(this.Intents.VIP_HIDE_BADGE)),out.packInt8(this.state.weaponIdx||this.account?.loadout?.classIdx||0),out.packString(this.state.name),out.packInt32(this.account.session),out.packString(this.account.sessionId),out.packString(this.account.firebaseId),out.send(this.game.socket)}async#processGameJoinedPacket(){if(this.me.id=CommIn_default.unPackInt8U(),this.me.team=CommIn_default.unPackInt8U(),this.game.gameModeId=CommIn_default.unPackInt8U(),this.game.gameMode=GameModeById[this.game.gameModeId],this.game.mapIdx=CommIn_default.unPackInt8U(),this.game.map=Maps[this.game.mapIdx],this.game.playerLimit=CommIn_default.unPackInt8U(),this.game.isGameOwner=CommIn_default.unPackInt8U()===1,this.game.isPrivate=CommIn_default.unPackInt8U()===1||this.game.isGameOwner,CommIn_default.unPackInt8U(),this.intents.includes(this.Intents.LOAD_MAP)||this.intents.includes(this.Intents.PATHFINDING)){if(this.game.map.raw=await fetchMap(this.game.map.filename,this.game.map.hash),this.emit("mapLoad",this.game.map.raw),this.game.gameModeId===GameMode.KOTC){let meshData=this.game.map.raw.data["DYNAMIC.capture-zone.none"];if(meshData){if(this.game.map.zones=initKotcZones(meshData),!this.game.activeZone)this.game.activeZone=this.game.map.zones[this.game.zoneNumber-1]}else delete this.game.map.zones}if(this.intents.includes(this.Intents.PATHFINDING))this.pathing.nodeList=new NodeList(this.game.map.raw)}this.state.inGame=!0,this.lastDeathTime=Date.now();let out=new CommOut_default;if(out.packInt8(CommCode_default.clientReady),out.send(this.game.socket),this.updateIntervalId=setInterval(()=>this.update(),33.333333333333336),this.intents.includes(this.Intents.PING)){this.lastPingTime=Date.now();let out2=new CommOut_default;out2.packInt8(CommCode_default.ping),out2.send(this.game.socket)}if(this.intents.includes(this.Intents.NO_AFK_KICK))this.afkKickInterval=setInterval(()=>{if(this.state.inGame&&!this.me.playing&&Date.now()-this.lastDeathTime>=15000){let out3=new CommOut_default;out3.packInt8(CommCode_default.keepAlive),out3.send(this.game.socket)}},15000);this.emit("gameReady")}#processPlayerInfoPacket(){let playerId=CommIn_default.unPackInt8U(),playerDBId=CommIn_default.unPackString(128),playerIp=CommIn_default.unPackString(32),player=this.players[playerId];if(!player)return;player.admin={ip:playerIp,dbId:playerDBId},this.emit("playerInfo",player,playerIp,playerDBId)}packetHandlers={[CommCode_default.syncThem]:()=>this.#processSyncThemPacket(),[CommCode_default.fire]:()=>this.#processFirePacket(),[CommCode_default.hitThem]:()=>this.#processHitThemPacket(),[CommCode_default.syncMe]:()=>this.#processSyncMePacket(),[CommCode_default.hitMe]:()=>this.#processHitMePacket(),[CommCode_default.swapWeapon]:()=>this.#processSwapWeaponPacket(),[CommCode_default.collectItem]:()=>this.#processCollectPacket(),[CommCode_default.respawn]:()=>this.#processRespawnPacket(),[CommCode_default.die]:()=>this.#processDeathPacket(),[CommCode_default.pause]:()=>this.#processPausePacket(),[CommCode_default.chat]:()=>this.#processChatPacket(),[CommCode_default.addPlayer]:()=>this.#processAddPlayerPacket(),[CommCode_default.removePlayer]:()=>this.#processRemovePlayerPacket(),[CommCode_default.eventModifier]:()=>this.#processEventModifierPacket(),[CommCode_default.metaGameState]:()=>this.#processGameStatePacket(),[CommCode_default.beginShellStreak]:()=>this.#processBeginStreakPacket(),[CommCode_default.endShellStreak]:()=>this.#processEndStreakPacket(),[CommCode_default.hitMeHardBoiled]:()=>this.#processHitShieldPacket(),[CommCode_default.gameOptions]:()=>this.#processGameOptionsPacket(),[CommCode_default.ping]:()=>this.#processPingPacket(),[CommCode_default.switchTeam]:()=>this.#processSwitchTeamPacket(),[CommCode_default.changeCharacter]:()=>this.#processChangeCharacterPacket(),[CommCode_default.reload]:()=>this.#processReloadPacket(),[CommCode_default.explode]:()=>this.#processExplodePacket(),[CommCode_default.throwGrenade]:()=>this.#processThrowGrenadePacket(),[CommCode_default.spawnItem]:()=>this.#processSpawnItemPacket(),[CommCode_default.melee]:()=>this.#processMeleePacket(),[CommCode_default.updateBalance]:()=>this.#processUpdateBalancePacket(),[CommCode_default.challengeCompleted]:()=>this.#processChallengeCompletePacket(),[CommCode_default.socketReady]:()=>this.#processSocketReadyPacket(),[CommCode_default.gameJoined]:()=>this.#processGameJoinedPacket(),[CommCode_default.gameAction]:()=>this.#processGameActionPacket(),[CommCode_default.requestGameOptions]:()=>this.#processGameRequestOptionsPacket(),[CommCode_default.respawnDenied]:()=>this.#processRespawnDeniedPacket(),[CommCode_default.playerInfo]:()=>this.#processPlayerInfoPacket(),[CommCode_default.expireUpgrade]:()=>{},[CommCode_default.clientReady]:()=>{},[CommCode_default.musicInfo]:()=>CommIn_default.unPackLongString()};processPacket(packet){if(CommIn_default.init(packet),this.intents.includes(this.Intents.PACKET_HOOK))this.emit("packet",packet);let lastCommand=0,lastCode=0,abort=!1;while(CommIn_default.isMoreDataAvailable()&&!abort){let cmd=CommIn_default.unPackInt8U(),handler=this.packetHandlers[cmd];if(handler)handler();else{if(console.error(`processPacket: I got but couldn't identify a: ${Object.keys(CommCode_default).find((k)=>CommCode_default[k]===cmd)} ${cmd}`),lastCommand)console.error(`processPacket: It may be a result of the ${lastCommand} command (${lastCode}).`);abort=!0;break}if(lastCommand=Object.keys(CommCode_default).find((k)=>CommCode_default[k]===cmd),lastCode=cmd,this.intents.includes(this.Intents.LOG_PACKETS))console.log(`[LOG_PACKETS] Packet ${lastCommand}: ${lastCode}`)}}async checkChiknWinner(){let response=await this.api.queryServices({cmd:"chicknWinnerReady",id:this.account.id,sessionId:this.account.sessionId});if(typeof response==="string")return response;return this.account.cw.limit=response.limit,this.account.cw.atLimit=response.limit>=4,this.account.cw.secondsUntilPlay=(this.account.cw.atLimit?response.period:response.span)||0,this.account.cw.canPlayAgain=Date.now()+this.account.cw.secondsUntilPlay*1000,this.account.cw}async playChiknWinner(doPrematureCooldownCheck=!0){if(this.account.cw.atLimit||this.account.cw.limit>ChiknWinnerDailyLimit)return"hit_daily_limit";if(this.account.cw.canPlayAgain>Date.now()&&doPrematureCooldownCheck)return"on_cooldown";let response=await this.api.queryServices({cmd:"incentivizedVideoReward",firebaseId:this.account.firebaseId,id:this.account.id,sessionId:this.account.sessionId,token:null});if(typeof response==="string")return response;if(response.error){if(response.error==="RATELIMITED"||response.error==="RATELMITED")return await this.checkChiknWinner(),"on_cooldown";else if(response.error==="SESSION_EXPIRED")return this.emit("sessionExpired"),"session_expired";return console.error("Unknown Chikn Winner response, report this on Github:",response),"unknown_error"}if(response.reward)return this.account.eggBalance+=response.reward.eggsGiven,response.reward.itemIds.forEach((id)=>this.account.ownedItemIds.push(id)),await this.checkChiknWinner(),response.reward;return console.error("Unknown Chikn Winner response, report this on Github:",response),"unknown_error"}async resetChiknWinner(){if(this.account.eggBalance<200)return"not_enough_eggs";if(!this.account.cw.atLimit)return"not_at_limit";let response=await this.api.queryServices({cmd:"chwReset",sessionId:this.account.sessionId});if(typeof response==="string")return response;if(response.result!=="SUCCESS")return console.error("Unknown Chikn Winner reset response, report this on Github:",response),"unknown_error";return this.account.eggBalance-=200,await this.checkChiknWinner(),this.account.cw}canSee(target){if(!this.intents.includes(this.Intents.PATHFINDING))return this.processError("You must have the PATHFINDING intent to use this method.");return this.pathing.nodeList.hasLineOfSight(this.me.position,target.position)}async refreshChallenges(){let result=await this.api.queryServices({cmd:"challengeGetDaily",sessionId:this.account.sessionId,playerId:this.account.id});if(typeof result==="string")return result;return this.#importChallenges(result),this.account.challenges}async rerollChallenge(challengeId){let result=await this.api.queryServices({cmd:"challengeRerollSlot",sessionId:this.account.sessionId,slotId:challengeId});if(typeof result==="string")return result;return this.#importChallenges(result),this.account.challenges}async claimChallenge(challengeId){let result=await this.api.queryServices({cmd:"challengeClaimReward",sessionId:this.account.sessionId,slotId:challengeId});if(typeof result==="string")return result;if(this.#importChallenges(result.challenges),result.reward>0)this.account.eggBalance+=result.reward;return{eggReward:result.reward,updatedChallenges:this.account.challenges}}async refreshBalance(){let result=await this.api.queryServices({cmd:"checkBalance",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId});if(typeof result==="string")return result;return this.account.eggBalance=result.currentBalance,result.currentBalance}async redeemCode(code){let result=await this.api.queryServices({cmd:"redeem",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,id:this.account.id,code});if(typeof result==="string")return result;if(result.result==="SUCCESS")return this.account.eggBalance=result.eggs_given,result.item_ids.forEach((id)=>this.account.ownedItemIds.push(id)),{result,eggsGiven:result.eggs_given,itemIds:result.item_ids};return result}async claimURLReward(reward){let result=await this.api.queryServices({cmd:"urlRewardParams",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,reward});if(typeof result==="string")return result;if(result.result==="SUCCESS")this.account.eggBalance+=result.eggsGiven,result.itemIds.forEach((id)=>this.account.ownedItemIds.push(id));return result}async claimSocialReward(rewardTag){let result=await this.api.queryServices({cmd:"reward",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,rewardTag});if(typeof result==="string")return result;if(result.result==="SUCCESS")this.account.eggBalance+=result.eggsGiven,result.itemIds.forEach((id)=>this.account.ownedItemIds.push(id));return result}async buyItem(itemId){let result=await this.api.queryServices({cmd:"buy",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,itemId,save:!0});if(typeof result==="string")return result;if(result.result==="SUCCESS")this.account.eggBalance=result.currentBalance,this.account.ownedItemIds.push(result.itemId);return result}processError(...params){let error=params.join(" ");if(this.#hooks.error&&this.#hooks.error.length)this.emit("error",error);else if(this.intents.includes(this.Intents.NO_EXIT_ON_ERROR))console.error(error);else throw Error(error)}leave(code=CloseCode_default.mainMenu){if(this.hasQuit)return;if(code>-1)this.game?.socket?.close(code),this.state.left=!0,this.emit("leave",code);clearInterval(this.updateIntervalId),this.#dispatches=[],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 GamePlayer_default({}),this.game=this.#initialGame,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(){if(this.account=this.#initialAccount,this.intents.includes(this.Intents.RENEW_SESSION))clearInterval(this.renewSessionInterval)}quit(noCleanup=!1){if(this.hasQuit)return;if(this.leave(),this.matchmaker){if(this.matchmaker.close(),!noCleanup)delete this.matchmaker}if(!noCleanup)delete this.account,delete this.api,delete this.game,delete this.me,delete this.pathing,delete this.players,delete this.state,this.#initialAccount={},this.#initialGame={},this.#hooks={},this.#globalHooks=[],this.#dispatches=[];if(this.intents.includes(this.Intents.NO_AFK_KICK))clearInterval(this.afkKickInterval);if(this.intents.includes(this.Intents.RENEW_SESSION))clearInterval(this.renewSessionInterval);this.hasQuit=!0}}class BanPlayerDispatch{constructor(uniqueId,duration,reason=""){this.uniqueId=uniqueId,this.duration=duration,this.reason=reason}validate(bot){if(typeof this.uniqueId!=="string"||typeof this.reason!=="string")return!1;if(typeof this.duration!=="number"||!Object.values(BanDuration).some((d)=>this.duration===d))return!1;if(!(bot.account.adminRoles&4))return!1;return!0}check(){return!0}execute(bot){let out=new CommOut_default;out.packInt8(CommCode_default.banPlayer),out.packString(this.uniqueId),out.packString(this.reason),out.packInt8(this.duration),out.send(bot.game.socket)}}var BanPlayerDispatch_default=BanPlayerDispatch;class BootPlayerDispatch{constructor(uniqueId){this.uniqueId=uniqueId}validate(bot){return typeof this.uniqueId==="string"&&bot.game.isGameOwner&&Object.values(bot.players).find((player)=>player.uniqueId===this.uniqueId)}check(){return!0}execute(bot){let out=new CommOut_default;out.packInt8(CommCode_default.bootPlayer),out.packString(this.uniqueId),out.send(bot.game.socket)}}var BootPlayerDispatch_default=BootPlayerDispatch;class ChatDispatch{constructor(msg){this.msg=msg}validate(){if(typeof this.msg!=="string")return!1;if(this.msg.length<1||this.msg.length>64)return!1;return!0}check(bot){if(!bot.state?.inGame)return!1;if(!bot.game.isPrivate&&!bot.account.adminRoles&&bot.state.chatLines>=2)return!1;if(!bot.game.isPrivate&&!bot.account.emailVerified&&!bot.account.isAged)return!1;return!0}execute(bot){bot.state.chatLines++;let out=new CommOut_default;out.packInt8(CommCode_default.chat),out.packString(this.msg),out.send(bot.game.socket)}}var ChatDispatch_default=ChatDispatch;class FireDispatch{constructor(amount){this.amount=amount||1}validate(){return this.amount>=1}check(bot){return bot.me.playing&&!bot.state.reloading&&!bot.state.swappingGun&&!bot.state.usingMelee&&bot.me.weapons[bot.me.activeGun].ammo.rounds>=this.amount}execute(bot){bot.state.shotsFired+=this.amount||1}}var FireDispatch_default=FireDispatch;var gravityScale=Array.from({length:4},(_,i)=>(i+1)*0.25),damageScale=Array.from({length:9},(_,i)=>i*0.25),regenScale=Array.from({length:17},(_,i)=>i*0.25),whichever=(arg1,arg2)=>typeof arg1>"u"?arg2:arg1;class GameOptionsDispatch{constructor(changes){this.changes=changes}#constructFinalOutput(bot){let output={};if(output.gravity=whichever(this.changes.gravity,bot.game.options.gravity),output.damage=whichever(this.changes.damage,bot.game.options.damage),output.healthRegen=whichever(this.changes.healthRegen,bot.game.options.healthRegen),output.locked=whichever(this.changes.locked,bot.game.options.locked),output.noTeamChange=whichever(this.changes.noTeamChange,bot.game.options.noTeamChange),output.noTeamShuffle=whichever(this.changes.noTeamShuffle,bot.game.options.noTeamShuffle),output.weaponsDisabled=[whichever(this.changes.disableEggk,bot.game.options.weaponsDisabled[0]),whichever(this.changes.disableScrambler,bot.game.options.weaponsDisabled[1]),whichever(this.changes.disableFreeRanger,bot.game.options.weaponsDisabled[2]),whichever(this.changes.disableRPG,bot.game.options.weaponsDisabled[3]),whichever(this.changes.disableWhipper,bot.game.options.weaponsDisabled[4]),whichever(this.changes.disableCrackshot,bot.game.options.weaponsDisabled[5]),whichever(this.changes.disableTriHard,bot.game.options.weaponsDisabled[6])],this.changes.toDisable&&Array.isArray(this.changes.toDisable))this.changes.toDisable.forEach((idx)=>output.weaponsDisabled[idx]=!0);if(this.changes.toEnable&&Array.isArray(this.changes.toEnable))this.changes.toEnable.forEach((idx)=>output.weaponsDisabled[idx]=!1);if(this.changes.rawWeaponsDisabled&&Array.isArray(this.changes.rawWeaponsDisabled)&&this.changes.rawWeaponsDisabled.length===7)output.weaponsDisabled=this.changes.rawWeaponsDisabled.map((v)=>!!v);return output.mustUseSecondary=output.weaponsDisabled.every((v)=>v),output}validate(bot){let wouldBe=this.#constructFinalOutput(bot);if(!gravityScale.includes(wouldBe.gravity))return!1;if(!damageScale.includes(wouldBe.damage))return!1;if(!regenScale.includes(wouldBe.healthRegen))return!1;if(typeof wouldBe.locked!=="number"&&typeof wouldBe.locked!=="boolean")return!1;if(typeof wouldBe.noTeamChange!=="number"&&typeof wouldBe.noTeamChange!=="boolean")return!1;if(typeof wouldBe.noTeamShuffle!=="number"&&typeof wouldBe.noTeamShuffle!=="boolean")return!1;if(!Array.isArray(wouldBe.weaponsDisabled))return!1;if(wouldBe.weaponsDisabled.length!==7)return!1;if(wouldBe.weaponsDisabled.some((weapon)=>typeof weapon!=="number"&&typeof weapon!=="boolean"))return!1;return!0}check(bot){return bot.game.isGameOwner}execute(bot){bot.game.options=this.#constructFinalOutput(bot),bot.updateGameOptions()}}var GameOptionsDispatch_default=GameOptionsDispatch;class BinaryHeap{constructor(scoreFunction){this.content=[],this.scoreFunction=scoreFunction}push(element){this.content.push(element),this.bubbleUp(this.content.length-1)}rescoreElement(node){this.sinkDown(this.content.indexOf(node))}pop(){let result=this.content[0],end=this.content.pop();if(this.content.length>0)this.content[0]=end,this.sinkDown(0);return result}remove(node){let length=this.content.length;for(let i=0;i<length;i++){if(this.content[i]!==node)continue;let end=this.content.pop();if(i===length-1)break;this.content[i]=end,this.bubbleUp(i),this.sinkDown(i);break}}size(){return this.content.length}bubbleUp(n){let element=this.content[n],score=this.scoreFunction(element);while(n>0){let parentN=Math.floor((n+1)/2)-1,parent=this.content[parentN];if(score>=this.scoreFunction(parent))break;this.content[parentN]=element,this.content[n]=parent,n=parentN}}includes(n){return this.content.includes(n)}sinkDown(n){let length=this.content.length,element=this.content[n],elemScore=this.scoreFunction(element);while(!0){let child2N=(n+1)*2,child1N=child2N-1,swap=null,child1Score;if(child1N<length){let child1=this.content[child1N];if(child1Score=this.scoreFunction(child1),child1Score<elemScore)swap=child1N}if(child2N<length){let child2=this.content[child2N];if(this.scoreFunction(child2)<(swap===null?elemScore:child1Score))swap=child2N}if(swap===null)break;this.content[n]=this.content[swap],this.content[swap]=element,n=swap}}}class AStar{constructor(list){this.list=list}heuristic(pos1,pos2){return Math.abs(pos1.x-pos2.x)+Math.abs(pos1.y-pos2.y)+Math.abs(pos1.z-pos2.z)}reversePath(node){let path=[];while(node.parent)path.push(node),node=node.parent;return path.reverse(),path}path(start,end){this.list.clean();let heap=new BinaryHeap((node)=>node.f),closedSet=[];start.h=this.heuristic(start,end),start.g=0,start.f=start.g+start.h,heap.push(start);while(heap.size()!==0){let current=heap.pop();if(current===end)return this.reversePath(current);closedSet.push(current);let neighbors=current.links;for(let i=0;i<neighbors.length;i++){let neighbor=neighbors[i];if(closedSet.includes(neighbor))continue;let tentativeGScore=current.g+1,visited=neighbor.visited;if(!visited||tentativeGScore<neighbor.g)if(neighbor.visited=!0,neighbor.parent=current,neighbor.g=tentativeGScore,neighbor.h=this.heuristic(neighbor.position,end.position),neighbor.f=neighbor.g+neighbor.h,visited)heap.rescoreElement(neighbor);else heap.push(neighbor)}}return null}}class GoToAmmoDispatch{validate(bot){return bot.intents.includes(bot.Intents.PATHFINDING)}check(bot){return bot.me.playing&&bot.game.collectables[0].length}execute(bot){this.pather=new AStar(bot.pathing.nodeList);let minDistance=200,closestAmmo=null;for(let ammo of bot.game.collectables[0]){let dx=ammo.x-bot.me.position.x,dy=ammo.y-bot.me.position.y,dz=ammo.z-bot.me.position.z,distance=Math.sqrt(dx*dx+dy*dy+dz*dz);if(distance<minDistance)minDistance=distance,closestAmmo=ammo}let position=Object.entries(bot.me.position).map((entry)=>Math.floor(entry[1])),targetPos=Object.entries(closestAmmo).map((entry)=>Math.floor(entry[1])),myNode=bot.pathing.nodeList.at(...position),targetNode=bot.pathing.nodeList.at(...targetPos);if(bot.pathing.activePath=this.pather.path(myNode,targetNode),!bot.pathing.activePath)return bot.processError("no path found");if(bot.pathing.activePath.length<2)return bot.processError("path too short");bot.pathing.followingPath=!0,bot.pathing.activeNode=bot.pathing.activePath[1],bot.pathing.activeNodeIdx=1}}var GoToAmmoDispatch_default=GoToAmmoDispatch;class GoToCoopDispatch{validate(bot){return bot.intents.includes(bot.Intents.PATHFINDING)}check(bot){return bot.me.playing&&bot.game.zoneNumber&&bot.game.activeZone}execute(bot){this.pather=new AStar(bot.pathing.nodeList);let minDistance=200,closestZone=null;for(let zone of bot.game.activeZone){let dx=zone.x-bot.me.position.x,dy=zone.y-bot.me.position.y,dz=zone.z-bot.me.position.z,distance=Math.sqrt(dx*dx+dy*dy+dz*dz);if(distance<minDistance)minDistance=distance,closestZone=zone}let position=Object.entries(bot.me.position).map((entry)=>Math.floor(entry[1])),targetPos=Object.entries(closestZone).map((entry)=>Math.floor(entry[1])),myNode=bot.pathing.nodeList.at(...position),targetNode=bot.pathing.nodeList.at(...targetPos);if(bot.pathing.activePath=this.pather.path(myNode,targetNode),!bot.pathing.activePath)return bot.processError("no path found");if(bot.pathing.activePath.length<2)return bot.processError("path too short");bot.pathing.followingPath=!0,bot.pathing.activeNode=bot.pathing.activePath[1],bot.pathing.activeNodeIdx=1}}var GoToCoopDispatch_default=GoToCoopDispatch;class GoToGrenadeDispatch{validate(bot){return bot.intents.includes(bot.Intents.PATHFINDING)}check(bot){return bot.me.playing&&bot.game.collectables[1].length}execute(bot){this.pather=new AStar(bot.pathing.nodeList);let minDistance=200,closestGrenade=null;for(let grenade of bot.game.collectables[1]){let dx=grenade.x-bot.me.position.x,dy=grenade.y-bot.me.position.y,dz=grenade.z-bot.me.position.z,distance=Math.sqrt(dx*dx+dy*dy+dz*dz);if(distance<minDistance)minDistance=distance,closestGrenade=grenade}let position=Object.entries(bot.me.position).map((entry)=>Math.floor(entry[1])),targetPos=Object.entries(closestGrenade).map((entry)=>Math.floor(entry[1])),myNode=bot.pathing.nodeList.at(...position),targetNode=bot.pathing.nodeList.at(...targetPos);if(bot.pathing.activePath=this.pather.path(myNode,targetNode),!bot.pathing.activePath)return bot.processError("no path found");if(bot.pathing.activePath.length<2)return bot.processError("path too short");bot.pathing.followingPath=!0,bot.pathing.activeNode=bot.pathing.activePath[1],bot.pathing.activeNodeIdx=1}}var GoToGrenadeDispatch_default=GoToGrenadeDispatch;class GoToPlayerDispatch{idOrName;constructor(idOrName){this.idOrName=idOrName}validate(bot){if(!bot.intents.includes(bot.Intents.PATHFINDING))return!1;if(!this.idOrName)return!1;return!!(bot.players[this.idOrName.toString()]||bot.players.find((player)=>player.name===this.idOrName))}check(bot){if(!bot.me.playing)return!1;let target=bot.players[this.idOrName.toString()]||bot.players.find((player)=>player.name===this.idOrName);return target&&target.playing&&target.position&&target.position.x}execute(bot){this.pather=new AStar(bot.pathing.nodeList);let target=bot.players[this.idOrName.toString()]||bot.players.find((player)=>player.name===this.idOrName),position=Object.entries(bot.me.position).map((entry)=>Math.floor(entry[1])),targetPos=Object.entries(target.position).map((entry)=>Math.floor(entry[1])),myNode=bot.pathing.nodeList.at(...position),targetNode=bot.pathing.nodeList.at(...targetPos);if(bot.pathing.activePath=this.pather.path(myNode,targetNode),!bot.pathing.activePath)return bot.processError("no path found");if(bot.pathing.activePath.length<2)return bot.processError("path too short");bot.pathing.followingPath=!0,bot.pathing.activeNode=bot.pathing.activePath[1],bot.pathing.activeNodeIdx=1}}var GoToPlayerDispatch_default=GoToPlayerDispatch;class GoToSpatulaDispatch{validate(bot){return bot.intents.includes(bot.Intents.PATHFINDING)}check(bot){return bot.me.playing&&bot.game.spatula&&bot.game.spatula.coords&&bot.game.spatula.coords.x}execute(bot){this.pather=new AStar(bot.pathing.nodeList);let position=Object.entries(bot.me.position).map((entry)=>Math.floor(entry[1])),targetPos=Object.entries(bot.game.spatula.coords).map((entry)=>Math.floor(entry[1])),myNode=bot.pathing.nodeList.at(...position),targetNode=bot.pathing.nodeList.at(...targetPos);if(bot.pathing.activePath=this.pather.path(myNode,targetNode),!bot.pathing.activePath)return bot.processError("no path found");if(bot.pathing.activePath.length<2)return bot.processError("path too short");bot.pathing.followingPath=!0,bot.pathing.activeNode=bot.pathing.activePath[1],bot.pathing.activeNodeIdx=1}}var GoToSpatulaDispatch_default=GoToSpatulaDispatch;var mod3=(n,m)=>(n%m+m)%m,PI22=Math.PI*2,setPrecision2=(value)=>Math.round(value*8192)/8192,calculateYaw2=(pos)=>setPrecision2(mod3(Math.atan2(-pos.x,-pos.z),PI22)),calculatePitch2=(pos)=>setPrecision2(Math.atan2(pos.y,Math.hypot(pos.x,pos.z)));class LookAtDispatch{idOrName;constructor(idOrName){this.idOrName=idOrName}validate(bot){return!!(bot.players[this.idOrName.toString()]||bot.players.find((player)=>player.name===this.idOrName))}check(bot){if(!bot.me.playing)return!1;let target=bot.players[this.idOrName.toString()]||bot.players.find((player)=>player.name===this.idOrName);return target&&target.playing&&target.position&&target.position.x}execute(bot){let target=bot.players[this.idOrName.toString()]||bot.players.find((player)=>player.name===this.idOrName),directionVector={x:target.position.x-bot.me.position.x,y:target.position.y-bot.me.position.y-0.05,z:target.position.z-bot.me.position.z},yaw=calculateYaw2(directionVector),pitch=calculatePitch2(directionVector);bot.state.yaw=yaw,bot.state.pitch=pitch}}var LookAtDispatch_default=LookAtDispatch;class MeleeDispatch{validate(){return!0}check(bot){return bot.me.playing&&!bot.state.reloading&&!bot.state.swappingGun&&!bot.state.usingMelee}execute(bot){let out=new CommOut_default;out.packInt8(CommCode_default.melee),out.send(bot.game.socket),bot.usingMelee=!0,setTimeout(()=>{bot.usingMelee=!1,bot.swappingGun=!0,setTimeout(()=>{bot.swappingGun=!1},0.5*GunEquipTime)},566.6666666666667)}}var MeleeDispatch_default=MeleeDispatch;class PauseDispatch{validate(){return!0}check(bot){return bot.me.playing}execute(bot){let out=new CommOut_default;out.packInt8(CommCode_default.pause),out.send(bot.game.socket),setTimeout(()=>bot.me.playing=!1,3000)}}var PauseDispatch_default=PauseDispatch;class ReloadDispatch{validate(){return!0}check(bot){return bot.me.playing&&!bot.state.reloading&&!bot.state.swappingGun&&!bot.state.usingMelee}execute(bot){let out=new CommOut_default;out.packInt8(CommCode_default.reload),out.send(bot.game.socket);let playerActiveWeapon=bot.me.weapons[bot.me.activeGun];if(playerActiveWeapon.ammo){let newRounds=Math.min(Math.min(playerActiveWeapon.ammo.capacity,playerActiveWeapon.ammo.reload)-playerActiveWeapon.ammo.rounds,playerActiveWeapon.ammo.store);playerActiveWeapon.ammo.rounds+=newRounds,playerActiveWeapon.ammo.store-=newRounds}bot.emit("playerReload",bot.me,playerActiveWeapon);let activeWeapon=bot.me.weapons[bot.me.activeGun],isLongTime=activeWeapon.ammo.rounds<1;bot.state.reloading=!0,setTimeout(()=>bot.state.reloading=!1,isLongTime?activeWeapon.longReloadTime:activeWeapon.shortReloadTime)}}var ReloadDispatch_default=ReloadDispatch;class ReportPlayerDispatch{constructor(idOrName,reasons={}){if(this.idOrName=idOrName,this.reasons=[!!reasons.cheating,!!reasons.harassment,!!reasons.offensive,!!reasons.other],!this.reasons.includes(!0))this.reasons[3]=!0;for(let i=0;i<this.reasons.length;i++)if(this.reasons[i]===!0)this.reasonInt|=1<<i}validate(bot){if(this.reasons.every((reason)=>reason===!1))return!1;if(!(bot.players[this.idOrName.toString()]||bot.players.find((player)=>player.name===this.idOrName)))return!1;return!0}check(bot){if(!bot.state.inGame)return!1;return!!(bot.players[this.idOrName.toString()]||bot.players.find((player)=>player.name===this.idOrName))}execute(bot){let target=bot.players[this.idOrName.toString()]||bot.players.find((player)=>player.name===this.idOrName),out=new CommOut_default;out.packInt8(CommCode_default.reportPlayer),out.packString(target.uniqueId),out.packInt8(this.reasonInt),out.send(bot.game.socket)}}var ReportPlayerDispatch_default=ReportPlayerDispatch;class ResetGameDispatch{validate(){return!0}check(bot){return bot.game.isGameOwner}execute(bot){let out=new CommOut_default;out.packInt8(CommCode_default.gameAction),out.packInt8(GameAction.Reset),out.send(bot.game.socket)}}var ResetGameDispatch_default=ResetGameDispatch;var isDefault=(itemId)=>findItemById(itemId)&&findItemById(itemId).unlock==="default",isType=(itemId,type)=>findItemById(itemId)&&findItemById(itemId).item_type_id===type;class SaveLoadoutDispatch{constructor(opts){this.changes={classIdx:opts.gunId,hatId:opts.hatId,stampId:opts.stampId,grenadeId:opts.grenadeId,meleeId:opts.meleeId,colorIdx:opts.eggColor,primaryId:opts.primaryIds,secondaryId:opts.secondaryIds},this.changes=Object.fromEntries(Object.entries(this.changes).filter(([,v])=>!!v))}validate(bot){let load=this.changes;if(load.colorIdx&&load.colorIdx>=7&&!bot.account.vip)return!1;if(load.colorIdx&&load.colorIdx>=14)return!1;if(isType(load.hatId,ItemType.Hat)&&!isDefault(load.hatId)&&!bot.account.ownedItemIds.includes(load.hatId))return!1;if(isType(load.stampId,ItemType.Stamp)&&!isDefault(load.stampId)&&!bot.account.ownedItemIds.includes(load.stampId))return!1;if(isType(load.grenadeId,ItemType.Grenade)&&!isDefault(load.grenadeId)&&!bot.account.ownedItemIds.includes(load.grenadeId))return!1;if(isType(load.meleeId,ItemType.Melee)&&!isDefault(load.meleeId)&&!bot.account.ownedItemIds.includes(load.meleeId))return!1;if(typeof load.classIdx==="number"&&load.classIdx>6||load.classIdx<0)return!1;if(this.changes.primaryId)for(let i=0;i<7;i++){let testingId=this.changes.primaryId[i];if(!isType(testingId,ItemType.Primary)||!isDefault(testingId)&&!bot.account.ownedItemIds.includes(testingId))return!1}if(this.changes.secondaryId)for(let i=0;i<7;i++){let testingId=this.changes.secondaryId[i];if(!isType(testingId,ItemType.Secondary)||!isDefault(testingId)&&!bot.account.ownedItemIds.includes(testingId))return!1}return!0}check(bot){return!bot.me.playing}execute(bot){if(bot.me&&this.changes.classIdx&&this.changes.classIdx!==bot.me.selectedGun)bot.me.weapons[0]=new GunList[this.changes.classIdx];bot.state.weaponIdx=this.changes.classIdx||bot.state.weaponIdx;let loadout={...bot.account.loadout,...this.changes},saveLoadout=bot.api.queryServices({cmd:"saveLoadout",save:!0,firebaseId:bot.account.firebaseId,sessionId:bot.account.sessionId,loadout});if(bot.account.loadout=loadout,bot.me)saveLoadout.then(()=>{if(bot.state.inGame){let out=new CommOut_default;out.packInt8(CommCode_default.changeCharacter),out.packInt8(this.changes?.classIdx||bot.me.selectedGun),out.send(bot.game.socket)}let findCosmetics=bot.intents.includes(bot.Intents.COSMETIC_DATA);Object.entries(this.changes).forEach(([changeKey,changeValue])=>{if(changeKey==="classIdx")bot.me.selectedGun=changeValue;else if(changeKey==="hatId")bot.me.character.hat=findCosmetics?findItemById(changeValue):changeValue;else if(changeKey==="stampId")bot.me.character.stamp=findCosmetics?findItemById(changeValue):changeValue;else if(changeKey==="grenadeId")bot.me.character.grenade=findCosmetics?findItemById(changeValue):changeValue;else if(changeKey==="meleeId")bot.me.character.melee=findCosmetics?findItemById(changeValue):changeValue;else if(changeKey==="colorIdx")bot.me.character.eggColor=changeValue;else if(changeKey==="primaryId")bot.me.character.primaryGun=findCosmetics?findItemById(changeValue[bot.me.selectedGun]):changeValue;else if(changeKey==="secondaryId")bot.me.character.secondaryGun=findCosmetics?findItemById(changeValue[bot.me.selectedGun]):changeValue})})}}var SaveLoadoutDispatch_default=SaveLoadoutDispatch;class SpawnDispatch{validate(){return!0}check(bot){if(bot.me.playing)return!1;if(bot.intents.includes(bot.Intents.OBSERVE_GAME))return!1;return!0}execute(bot){let out=new CommOut_default;out.packInt8(CommCode_default.requestRespawn),out.send(bot.game.socket),bot.state.buffer=[]}}var SpawnDispatch_default=SpawnDispatch;class SwapWeaponDispatch{constructor(manualWeapon){this.manualWeapon=manualWeapon}validate(){return typeof this.manualWeapon==="number"||typeof this.manualWeapon>"u"}check(bot){return bot.me.playing&&!bot.state.reloading&&!bot.state.swappingGun&&!bot.state.usingMelee}execute(bot){let chosenWeapon=+!bot.me.activeGun;if(typeof this.manualWeapon==="number")chosenWeapon=this.manualWeapon;bot.me.activeGun=chosenWeapon;let out=new CommOut_default;out.packInt8(CommCode_default.swapWeapon),out.packInt8(bot.me.activeGun),out.send(bot.game.socket)}}var SwapWeaponDispatch_default=SwapWeaponDispatch;class SwitchTeamDispatch{validate(){return!0}check(bot){if(!bot.state.inGame||bot.me.playing)return!1;if(bot.game.gameModeId===0)return!1;if(bot.intents.includes(bot.Intents.OBSERVE_GAME))return!1;if(bot.game.isPrivate)return!bot.game.options.noTeamChange;let players=bot.players,myTeam=bot.me.team,playersWithMyTeam=players.filter((player)=>player.team===myTeam).length,playersWithOtherTeam=players.filter((player)=>player.team!==myTeam).length;if(playersWithOtherTeam>playersWithMyTeam)return!1;if(playersWithMyTeam===playersWithOtherTeam)return!1;return!0}execute(bot){let out=new CommOut_default;out.packInt8(CommCode_default.switchTeam),out.send(bot.game.socket)}}var SwitchTeamDispatch_default=SwitchTeamDispatch;class ThrowGrenadeDispatch{constructor(power=1){this.power=power}validate(){return typeof this.power==="number"&&this.power>=0&&this.power<=1}check(bot){return bot.me.playing&&!bot.state.reloading&&!bot.state.swappingGun&&!bot.state.usingMelee}execute(bot){let out=new CommOut_default;out.packInt8(CommCode_default.throwGrenade),out.packFloat(this.power),out.send(bot.game.socket)}}var ThrowGrenadeDispatch_default=ThrowGrenadeDispatch;var dispatches_default={BanPlayerDispatch:BanPlayerDispatch_default,BootPlayerDispatch:BootPlayerDispatch_default,ChatDispatch:ChatDispatch_default,FireDispatch:FireDispatch_default,GameOptionsDispatch:GameOptionsDispatch_default,GoToAmmoDispatch:GoToAmmoDispatch_default,GoToCoopDispatch:GoToCoopDispatch_default,GoToGrenadeDispatch:GoToGrenadeDispatch_default,GoToPlayerDispatch:GoToPlayerDispatch_default,GoToSpatulaDispatch:GoToSpatulaDispatch_default,LookAtDispatch:LookAtDispatch_default,LookAtPosDispatch:LookAtPosDispatch_default,MeleeDispatch:MeleeDispatch_default,MovementDispatch:MovementDispatch_default,PauseDispatch:PauseDispatch_default,ReloadDispatch:ReloadDispatch_default,ReportPlayerDispatch:ReportPlayerDispatch_default,ResetGameDispatch:ResetGameDispatch_default,SaveLoadoutDispatch:SaveLoadoutDispatch_default,SpawnDispatch:SpawnDispatch_default,SwapWeaponDispatch:SwapWeaponDispatch_default,SwitchTeamDispatch:SwitchTeamDispatch_default,ThrowGrenadeDispatch:ThrowGrenadeDispatch_default};var exports_comm={};__export(exports_comm,{CommOut:()=>CommOut_default,CommIn:()=>CommIn_default,CommCode:()=>CommCode_default,CloseCode:()=>CloseCode_default});export{Matchmaker,Maps,exports_guns as Guns,GamePlayer,dispatches_default as Dispatches,exports_constants as Constants,exports_comm as Comm,Bot,API};