yolkbot 1.4.7 → 1.5.0

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 (129) hide show
  1. package/README.md +1 -1
  2. package/browser/build/global.js +1 -1
  3. package/browser/build/module.js +1 -1
  4. package/dist/api.d.ts +34 -16
  5. package/dist/api.js +164 -121
  6. package/dist/bot/GamePlayer.d.ts +2 -2
  7. package/dist/bot/GamePlayer.js +15 -5
  8. package/dist/bot.d.ts +121 -83
  9. package/dist/bot.js +624 -1077
  10. package/dist/comm/CommIn.js +14 -17
  11. package/dist/comm/CommOut.js +15 -15
  12. package/dist/constants/CommCode.js +1 -1
  13. package/dist/constants/findItemById.js +2 -1
  14. package/dist/constants/guns.d.ts +16 -41
  15. package/dist/constants/guns.js +137 -259
  16. package/dist/constants/index.d.ts +7 -9
  17. package/dist/constants/index.js +15 -13
  18. package/dist/dispatches/BanPlayerDispatch.d.ts +3 -1
  19. package/dist/dispatches/BootPlayerDispatch.d.ts +3 -1
  20. package/dist/dispatches/ChatDispatch.d.ts +3 -1
  21. package/dist/dispatches/ChatDispatch.js +3 -3
  22. package/dist/dispatches/FireDispatch.d.ts +3 -1
  23. package/dist/dispatches/GameOptionsDispatch.d.ts +3 -1
  24. package/dist/dispatches/GoToAmmoDispatch.d.ts +2 -0
  25. package/dist/dispatches/GoToAmmoDispatch.js +15 -16
  26. package/dist/dispatches/GoToCoopDispatch.d.ts +2 -0
  27. package/dist/dispatches/GoToCoopDispatch.js +19 -20
  28. package/dist/dispatches/GoToGrenadeDispatch.d.ts +2 -0
  29. package/dist/dispatches/GoToGrenadeDispatch.js +15 -16
  30. package/dist/dispatches/GoToPlayerDispatch.d.ts +3 -1
  31. package/dist/dispatches/GoToPlayerDispatch.js +16 -21
  32. package/dist/dispatches/GoToSpatulaDispatch.d.ts +2 -0
  33. package/dist/dispatches/GoToSpatulaDispatch.js +11 -14
  34. package/dist/dispatches/LookAtDispatch.d.ts +3 -1
  35. package/dist/dispatches/LookAtDispatch.js +8 -6
  36. package/dist/dispatches/LookAtPosDispatch.d.ts +3 -1
  37. package/dist/dispatches/LookAtPosDispatch.js +1 -1
  38. package/dist/dispatches/MeleeDispatch.d.ts +2 -0
  39. package/dist/dispatches/MeleeDispatch.js +4 -4
  40. package/dist/dispatches/MovementDispatch.d.ts +3 -1
  41. package/dist/dispatches/MovementDispatch.js +1 -1
  42. package/dist/dispatches/PauseDispatch.d.ts +2 -0
  43. package/dist/dispatches/ReloadDispatch.d.ts +2 -0
  44. package/dist/dispatches/ReloadDispatch.js +17 -10
  45. package/dist/dispatches/ReportPlayerDispatch.d.ts +4 -2
  46. package/dist/dispatches/ReportPlayerDispatch.js +8 -6
  47. package/dist/dispatches/ResetGameDispatch.d.ts +2 -0
  48. package/dist/dispatches/SaveLoadoutDispatch.d.ts +4 -2
  49. package/dist/dispatches/SaveLoadoutDispatch.js +9 -8
  50. package/dist/dispatches/SpawnDispatch.d.ts +2 -0
  51. package/dist/dispatches/SpawnDispatch.js +5 -1
  52. package/dist/dispatches/SwapWeaponDispatch.d.ts +3 -1
  53. package/dist/dispatches/SwapWeaponDispatch.js +1 -1
  54. package/dist/dispatches/SwitchTeamDispatch.d.ts +2 -0
  55. package/dist/dispatches/SwitchTeamDispatch.js +2 -1
  56. package/dist/dispatches/ThrowGrenadeDispatch.d.ts +3 -1
  57. package/dist/dispatches/index.d.ts +105 -182
  58. package/dist/dispatches/index.js +24 -25
  59. package/dist/enums.d.ts +154 -0
  60. package/dist/enums.js +114 -0
  61. package/dist/env/fetch.d.ts +15 -0
  62. package/dist/env/fetch.js +113 -79
  63. package/dist/env/globals.d.ts +9 -0
  64. package/dist/env/globals.js +11 -9
  65. package/dist/index.d.ts +31 -0
  66. package/dist/index.js +24 -14
  67. package/dist/packets/addPlayer.js +63 -0
  68. package/dist/packets/beginShellStreak.js +44 -0
  69. package/dist/packets/challengeCompleted.js +16 -0
  70. package/dist/packets/changeCharacter.js +46 -0
  71. package/dist/packets/chat.js +10 -0
  72. package/dist/packets/collectItem.js +26 -0
  73. package/dist/packets/die.js +40 -0
  74. package/dist/packets/endShellStreak.js +21 -0
  75. package/dist/packets/eventModifier.js +8 -0
  76. package/dist/packets/explode.js +19 -0
  77. package/dist/packets/fire.js +21 -0
  78. package/dist/packets/gameAction.js +33 -0
  79. package/dist/packets/gameJoined.js +64 -0
  80. package/dist/packets/gameOptions.js +27 -0
  81. package/dist/packets/hitMe.js +12 -0
  82. package/dist/packets/hitMeHardBoiled.js +18 -0
  83. package/dist/packets/hitThem.js +12 -0
  84. package/dist/packets/melee.js +8 -0
  85. package/dist/packets/metaGameState.js +62 -0
  86. package/dist/packets/pause.js +17 -0
  87. package/dist/packets/ping.js +19 -0
  88. package/dist/packets/playerInfo.js +15 -0
  89. package/dist/packets/reload.js +17 -0
  90. package/dist/packets/removePlayer.js +10 -0
  91. package/dist/packets/respawn.js +31 -0
  92. package/dist/packets/socketReady.js +16 -0
  93. package/dist/packets/spawnItem.js +11 -0
  94. package/dist/packets/swapWeapon.js +11 -0
  95. package/dist/packets/switchTeam.js +13 -0
  96. package/dist/packets/syncMe.js +25 -0
  97. package/dist/packets/syncThem.js +63 -0
  98. package/dist/packets/throwGrenade.js +17 -0
  99. package/dist/packets/updateBalance.js +8 -0
  100. package/dist/pathing/astar.js +33 -20
  101. package/dist/pathing/mapnode.d.ts +3 -1
  102. package/dist/pathing/mapnode.js +170 -65
  103. package/dist/socket.d.ts +21 -6
  104. package/dist/socket.js +48 -38
  105. package/dist/util.d.ts +4 -1
  106. package/dist/util.js +105 -45
  107. package/dist/wasm/bytes.d.ts +1 -1
  108. package/dist/wasm/bytes.js +1 -1
  109. package/dist/wasm/direct.d.ts +1 -1
  110. package/dist/wasm/direct.js +13 -13
  111. package/dist/wasm/legacy.d.ts +7 -6
  112. package/dist/wasm/legacy.js +14 -8
  113. package/package.json +43 -30
  114. package/dist/comm/index.d.ts +0 -12
  115. package/dist/comm/index.js +0 -11
  116. package/dist/constants/changelog.d.ts +0 -7
  117. package/dist/constants/housePromo.d.ts +0 -40
  118. package/dist/constants/language.d.ts +0 -3
  119. package/dist/constants/notices.d.ts +0 -4
  120. package/dist/constants/shellNews.d.ts +0 -12
  121. package/dist/constants/shellYoutube.d.ts +0 -12
  122. package/dist/constants/shopItems.d.ts +0 -15
  123. package/dist/constants/sounds.d.ts +0 -10
  124. package/dist/matchmaker.d.ts +0 -50
  125. package/dist/matchmaker.js +0 -141
  126. package/dist/pathing/binaryheap.d.ts +0 -18
  127. package/dist/pathing/binaryheap.js +0 -79
  128. package/dist/wasm/util.d.ts +0 -9
  129. package/dist/wasm/util.js +0 -19
@@ -1 +1 @@
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};
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})};console.error("wwws does not support the browser.");var WWWebSocket=null;var iFetch=globalThis.fetch,fetch_default=iFetch;var globals={},isBrowser=typeof window<"u"&&typeof HTMLElement<"u",isWebWorker=typeof self<"u"&&typeof DedicatedWorkerGlobalScope<"u"&&self instanceof DedicatedWorkerGlobalScope,isCloudflareWorker=typeof WebSocketPair<"u"&&typeof Cloudflare<"u",isUnsandboxedElectron=typeof process==="object"&&process.versions?.electron&&process.versions?.node&&typeof window<"u"&&typeof window.require<"u",isNode=typeof process<"u"&&process.moduleLoadList?.length>0,isDeno=typeof Deno<"u",isBun=typeof Bun<"u";if(!isBrowser&&!isCloudflareWorker&&!isWebWorker&&!isUnsandboxedElectron&&!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||isWebWorker;globals.isIsolated=!isNode&&!isDeno&&!isBun&&!isUnsandboxedElectron;globals.fetch=globals.isIsolated?(...args)=>globalThis.fetch(...args):fetch_default;globals.WebSocket=globals.isIsolated?globalThis.WebSocket:WWWebSocket;var globals_default=globals;var exports_constants={};__export(exports_constants,{findItemById:()=>findItemById,UserAgent:()=>UserAgent,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 EggK47={ammo:{capacity:30,reload:30,store:240,pickup:30},longReloadTime:205,shortReloadTime:160,weaponName:"EggK-47",internalName:"Eggk47",standardMeshName:"eggk47",damage:30,range:20,rof:3,totalDamage:30,velocity:1.5},DozenGauge={ammo:{capacity:2,reload:2,store:24,pickup:8},longReloadTime:155,shortReloadTime:155,weaponName:"Scrambler",internalName:"Dozen Gauge",standardMeshName:"dozenGauge",damage:8.5,range:8,rof:8,totalDamage:170,velocity:1},CSG1={ammo:{capacity:15,reload:15,store:60,pickup:15},longReloadTime:225,shortReloadTime:165,weaponName:"Free Ranger",internalName:"CSG-1",standardMeshName:"csg1",damage:105,range:50,rof:13,totalDamage:105,velocity:1.75},Cluck9mm={ammo:{capacity:15,reload:15,store:60,pickup:15},longReloadTime:195,shortReloadTime:160,weaponName:"Cluck 9mm",internalName:"Cluck 9mm",standardMeshName:"cluck9mm",damage:26,range:15,rof:4,totalDamage:26,velocity:1},RPEGG={ammo:{capacity:1,reload:1,store:3,pickup:1},longReloadTime:170,shortReloadTime:170,weaponName:"RPEGG",internalName:"Eggsploder",standardMeshName:"rpegg",damage:140,range:45,rof:40,totalDamage:192.5,velocity:0.4},SMG={ammo:{capacity:40,reload:40,store:200,pickup:40},longReloadTime:225,shortReloadTime:190,weaponName:"Whipper",internalName:"SMEGG",standardMeshName:"smg",damage:23,range:20,rof:2,totalDamage:23,velocity:1.25},M24={ammo:{capacity:1,reload:1,store:12,pickup:4},longReloadTime:144,shortReloadTime:144,weaponName:"Crackshot",internalName:"M2DZ",standardMeshName:"m24",damage:170,range:60,rof:15,totalDamage:170,velocity:2},AUG={ammo:{capacity:24,reload:24,store:150,pickup:24},longReloadTime:205,shortReloadTime:160,weaponName:"Tri-Hard",internalName:"AUG",standardMeshName:"aug",damage:32,range:20,rof:15,totalDamage:34,velocity:1.5};var Items=[];var itemsMap=new Map(Items.map((item)=>[item.id,item])),findItemById=(id)=>itemsMap.get(id);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},miniCodec=(s,k=42)=>s.split("").map((c)=>String.fromCharCode(c.charCodeAt(0)^k)).join(""),FirebaseKey=miniCodec("kcPKySnz\x1Eyc@aK]\x1Ck\x1EI\x07P\\LsRciZHo@D\x1BXxDd\x1F\x1A"),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},latestChromeVersion=143,latestFirefoxVersion=146,agents=[`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${latestChromeVersion}.0.0.0 Safari/537.36`,`Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${latestChromeVersion}.0.0.0 Safari/537.36`,`Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:${latestFirefoxVersion}.0) Gecko/20100101 Firefox/${latestFirefoxVersion}.0`,`Mozilla/5.0 (X11; Linux x86_64; rv:${latestFirefoxVersion}.0) Gecko/20100101 Firefox/${latestFirefoxVersion}.0`,`Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${latestChromeVersion}.0.0.0 Safari/537.36`,`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${latestChromeVersion}.0.0.0 Safari/537.36 Edg/${latestChromeVersion}.0.0.0`,`Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:${latestFirefoxVersion}.0) Gecko/20100101 Firefox/${latestFirefoxVersion}.0`],UserAgent=agents[Math.floor(Math.random()*agents.length)];class yolkws{connected=!1;autoReconnect=!1;url="";proxy="";binaryType="";connectionTimeout=5000;errorLogger=(...args)=>console.error(...args);onopen=()=>{};onmessage=()=>{};onclose=()=>{};onerror=()=>{};constructor(url,params={}){if(typeof params!=="object")params={};if(typeof process>"u"&&params.proxy)throw Error("You cannot pass a proxy to a WebSocket in this environment.");if(this.url=url,this.proxy=params.proxy,typeof params.errorLogger==="function")this.errorLogger=params.errorLogger}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=typeof process>"u"?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","user-agent":UserAgent}}),this.binaryType)this.socket.binaryType=this.binaryType}catch(e){return this.errorLogger(`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),this.errorLogger("WebSocket error",e),resolve(await retryOrQuit())};this.socket.addEventListener("open",async()=>{clearTimeout(timeout),this.connected=!0,this.onopen(),this.socket.removeEventListener("error",errorListener),this.socket.addEventListener("message",(messageEvent)=>this.onmessage(messageEvent)),this.socket.addEventListener("close",(closeEvent)=>!this.autoReconnect&&this.onclose(closeEvent)),this.socket.addEventListener("error",(event)=>this.onerror(event)),resolve(!0)}),this.socket.addEventListener("error",errorListener),this.socket.addEventListener("close",()=>{if(this.connected){if(this.connected=!1,this.autoReconnect)setTimeout(async()=>{if(!await this.tryConnect()){if(this.onclose)this.onclose();this.errorLogger("tryConnect: failed to reconnect to",this.url,"after 5 attempts."),this.errorLogger("tryConnect: please check your internet connection & ensure your IP isn't blocked.")}},250)}})})}send(data){return this.socket?.send(data)}close(data){if(!this.socket)return;if(this.autoReconnect=!1,this.socket.terminate)try{this.socket.terminate()}catch{}else this.socket.close(data)}}var socket_default=yolkws;var exports_enums={};__export(exports_enums,{ZoneLeaveReason:()=>ZoneLeaveReason,RedeemCodeError:()=>RedeemCodeError,PathfindError:()=>PathfindError,MatchmakerError:()=>MatchmakerError,LoginError:()=>LoginError,Intents:()=>Intents,GameJoinError:()=>GameJoinError,GameFindError:()=>GameFindError,CleanupLevel:()=>CleanupLevel,ClaimURLError:()=>ClaimURLError,ClaimSocialError:()=>ClaimSocialError,ChicknWinnerError:()=>ChicknWinnerError,ChallengeRerollError:()=>ChallengeRerollError,ChallengeClaimError:()=>ChallengeClaimError,BuyItemError:()=>BuyItemError,APIError:()=>APIError});var APIError={WebSocketConnectFail:"websocket_connect_fail",MissingParams:"missing_params",NetworkFail:"firebase_network_failed",ServicesClosedEarly:"services_closed_early",InternalError:"unknown_error",FirebaseRateLimited:"firebase_rate_limited"},LoginError={...APIError,AccountBanned:"account_banned"},BuyItemError={SessionExpired:"PLAYER_NOT_FOUND",ItemNotFound:"ITEM_NOT_FOUND",ItemAlreadyOwned:"ALREADY_OWNED",CannotAfford:"INSUFFICIENT_FUNDS",InternalError:"UNKNOWN_ERROR"},ChicknWinnerError={OnCooldown:"on_cooldown",HitDailyLimit:"hit_daily_limit",NotAtDailyLimit:"not_at_limit",NotEnoughResetEggs:"not_enough_eggs",SessionExpired:"session_expired",InternalError:"unknown_error"},GameFindError={MissingParams:"missing_params",InvalidRegion:"region_not_in_list",InvalidMode:"mode_not_in_list",InvalidMap:"map_not_in_list",GameNotFound:"game_not_found",SessionExpired:"session_expired",InternalError:"unknown_error"},GameJoinError={MissingParams:"missing_params",InvalidObject:"invalid_game_object",WebSocketConnectFail:"websocket_connect_fail",GameNotFound:"game_not_found",InternalError:"unknown_error"},MatchmakerError={WebSocketConnectFail:"websocket_connect_fail"},Intents={CHALLENGES:1,BOT_STATS:2,PATHFINDING:3,PING:5,COSMETIC_DATA:6,PLAYER_HEALTH:7,PACKET_HOOK:8,LOG_PACKETS:10,SKIP_LOGIN:11,DEBUG_BUFFER:12,NO_AFK_KICK:16,LOAD_MAP:17,OBSERVE_GAME:18,RENEW_SESSION:21,VIP_HIDE_BADGE:22,SIMULATION:23,MANUAL_UPDATE:24,FASTER_RESPAWN:25},RedeemCodeError={SessionExpired:"PLAYER_NOT_FOUND",CurrentlyRedeemingElsewhere:"CODE_DOUBLE_DOUBLE",AlreadyRedeemed:"CODE_PREV_REDEEMED",InvalidCode:"CODE_NOT_FOUND",Ratelimited:"RATE_LIMIT_REACHED",InternalError:"UNKNOWN_ERROR"},ClaimSocialError={SessionExpired:"reward_expired_session",InvalidReward:"REWARD_NOT_FOUND",AlreadyRedeemed:"REWARD_PREV_GIVEN",InternalError:"unknown_error"},ClaimURLError={SessionExpired:"urlRewardParams_expired_session",InvalidReward:"REWARD_NOT_FOUND",AlreadyRedeemed:"REWARD_PREV_GIVEN",InternalError:"unknown_error"},ChallengeRerollError={SessionExpired:"challengeRerollSlot_expired_session",ChallengeNotFound:"challenge_not_found",ChallengeNotAssigned:"challenge_reroll_not_found",NotEnoughEggs:"insufficient_eggs",InternalError:"unknown_error"},ChallengeClaimError={SessionExpired:"challengeClaimReward_expired_session",ChallengeNotFound:"challenge_claim_not_found",ChallengeNotCompleted:"challenge_not_completed",InternalError:"unknown_error"},PathfindError={NoPathFound:"no_path_found",PathTooShort:"path_too_short"},ZoneLeaveReason={Despawned:"despawned",Killed:"killed",WalkedOut:"exited",RoundEnded:"round_ended"},CleanupLevel={None:0,Partial:1,Full:2};var exports_util={};__export(exports_util,{isDoubleEggWeeknd:()=>isDoubleEggWeeknd,initKotcZones:()=>initKotcZones,fetchMap:()=>fetchMap,createGun:()=>createGun,createError:()=>createError});var createGun=(baseGun)=>{let gun=structuredClone(baseGun);return gun.ammo.rounds=gun.ammo.capacity,gun.ammo.storeMax=gun.ammo.store,gun},createError=(errorEnum)=>({ok:!1,error:errorEnum}),attemptFetch=async(url,options={},retries=3,backoff=300)=>{try{let response=await fetch(url,options);if(!response.ok)throw Error(`failed to fetch map; status: ${response.status}`);return response}catch(error){if(retries>0)return await new Promise((res)=>setTimeout(res,backoff)),attemptFetch(url,options,retries-1,backoff*2);else throw error}},fetchMap=async(name,hash)=>{if(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 safeName=String(name).replace(/[^a-z0-9_-]/gi,"_"),safeHash=String(hash).replace(/[^a-z0-9_-]/gi,"_"),mapFile=join(mapCache,`${safeName}-${safeHash}.json`);if(existsSync(mapFile))return JSON.parse(readFileSync(mapFile,"utf-8"));let data2=await(await attemptFetch(`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 attemptFetch(`https://x.yolkbot.xyz/data/maps/full/${name}.json?${hash}`)).json()},initKotcZones=(meshData)=>{let len=meshData.length;if(!len)return[];let minX=1/0,minY=1/0,minZ=1/0,maxX=-1/0,maxY=-1/0,maxZ=-1/0;for(let i=0;i<len;i++){let{x,y,z}=meshData[i];if(x<minX)minX=x;if(x>maxX)maxX=x;if(y<minY)minY=y;if(y>maxY)maxY=y;if(z<minZ)minZ=z;if(z>maxZ)maxZ=z}let sizeX=maxX-minX+1|0,sizeY=maxY-minY+1|0,sizeZ=maxZ-minZ+1|0,strideY=sizeX,strideZ=sizeX*sizeY,cellIndex=new Int32Array(sizeX*sizeY*sizeZ).fill(-1),zoneIds=new Uint16Array(len),queue=new Uint32Array(len);for(let i=0;i<len;i++){let{x,y,z}=meshData[i];cellIndex[(x-minX|0)+(y-minY|0)*strideY+(z-minZ|0)*strideZ]=i}let zones=[],zoneId=0;for(let i=0;i<len;i++){if(zoneIds[i])continue;let zone=++zoneId,activeZone=[],head=0,tail=0;queue[tail++]=i,zoneIds[i]=zone;while(head<tail){let idx=queue[head++],cell=meshData[idx];cell.zone=zone,activeZone[activeZone.length]=cell;let{x,y,z}=cell,flatIdx=(x-minX|0)+(y-minY|0)*strideY+(z-minZ|0)*strideZ,nIdx;if(x>minX&&(nIdx=cellIndex[flatIdx-1])!==-1&&!zoneIds[nIdx])zoneIds[nIdx]=zone,queue[tail++]=nIdx;if(x<maxX&&(nIdx=cellIndex[flatIdx+1])!==-1&&!zoneIds[nIdx])zoneIds[nIdx]=zone,queue[tail++]=nIdx;if(y>minY&&(nIdx=cellIndex[flatIdx-strideY])!==-1&&!zoneIds[nIdx])zoneIds[nIdx]=zone,queue[tail++]=nIdx;if(y<maxY&&(nIdx=cellIndex[flatIdx+strideY])!==-1&&!zoneIds[nIdx])zoneIds[nIdx]=zone,queue[tail++]=nIdx;if(z>minZ&&(nIdx=cellIndex[flatIdx-strideZ])!==-1&&!zoneIds[nIdx])zoneIds[nIdx]=zone,queue[tail++]=nIdx;if(z<maxZ&&(nIdx=cellIndex[flatIdx+strideZ])!==-1&&!zoneIds[nIdx])zoneIds[nIdx]=zone,queue[tail++]=nIdx}zones[zones.length]=activeZone}return zones},isDoubleEggWeeknd=()=>{let day=new Date().getUTCDay();return day>=5&&new Date().getUTCHours()>=20||day===6||day===0};var baseHeaders={origin:"https://shellshock.io","user-agent":typeof process>"u"?null:UserAgent,"x-client-version":"Chrome/JsCore/9.17.2/FirebaseCore-web","x-firebase-locale":"en"};class API{errorLogger=(...args)=>console.error(...args);constructor(params={}){if(this.proxy=params.proxy,this.instance=params.instance||"shellshock.io",this.protocol=params.protocol||"wss",this.customKey=params.customKey||null,this.connectionTimeout=params.connectionTimeout||5000,typeof params.errorLogger==="function")this.errorLogger=params.errorLogger}queryServices=async(request)=>{let ws=new socket_default(`${this.protocol}://${this.instance}/services/`,{proxy:this.proxy,errorLogger:this.errorLogger});if(ws.connectionTimeout=this.connectionTimeout,!await ws.tryConnect()||ws.socket.readyState!==1)return createError(APIError.WebSocketConnectFail);return new Promise((resolve)=>{let resolved=!1;ws.onmessage=(mes)=>{resolved=!0;try{let resp=JSON.parse(mes.data);resolve({ok:!0,...resp})}catch(e){this.errorLogger("queryServices: error! command:",request.cmd,"and data:",request,e),resolve(createError(APIError.InternalError))}ws.close()},ws.onerror=(error)=>{if(resolved)return;resolved=!0,this.errorLogger("queryServices: websocket error! command:",request.cmd,"and data:",request,"error:",error),resolve(createError(APIError.InternalError))},ws.onclose=()=>{if(resolved)return;resolved=!0,this.errorLogger("queryServices: services closed before sending back message"),this.errorLogger("queryServices: command:",request.cmd,"and data:",request),resolve(createError(APIError.ServicesClosedEarly))},ws.send(JSON.stringify(request))})};#authWithEmailPass=async(email,password,customServicesParams,endpoint)=>{if(!email||!password)return createError(APIError.MissingParams);let body;try{body=await(await globals_default.fetch(`https://identitytoolkit.googleapis.com/v1/accounts:${endpoint}?key=${this.customKey||FirebaseKey}`,{method:"POST",body:JSON.stringify({email,password,returnSecureToken:!0}),headers:{...baseHeaders,"content-type":"application/json"},proxy:this.proxy})).json()}catch(error){if(error.code==="auth/too-many-requests")return createError(APIError.FirebaseRateLimited);else if(error.code==="auth/network-request-failed")return this.errorLogger("authWithEmailPass: network error",body||error),createError(APIError.NetworkFail);else if(error.code==="ERR_BAD_REQUEST")return this.errorLogger("authWithEmailPass: bad request",body||error),createError(APIError.InternalError);else if(error.code==="ECONNREFUSED")return this.errorLogger("authWithEmailPass: connection refused",body||error),createError(APIError.NetworkFail);return this.errorLogger("authWithEmailPass: unknown error:",email,error),createError(APIError.InternalError)}if(!body.idToken)return this.errorLogger("authWithEmailPass: missing idToken",body),createError(APIError.InternalError);this.idToken=body.idToken;let servicesQuery=await this.queryServices({cmd:"auth",firebaseToken:body.idToken,...customServicesParams});return servicesQuery.ok?{firebase:body,...servicesQuery}:servicesQuery};createAccount=(email,password,customServicesParams)=>this.#authWithEmailPass(email,password,customServicesParams,"signUp");loginWithCredentials=(email,password,customServicesParams)=>this.#authWithEmailPass(email,password,customServicesParams,"signInWithPassword");loginWithRefreshToken=async(refreshToken,customServicesParams)=>{if(!refreshToken)return createError(APIError.MissingParams);let formData=new URLSearchParams;formData.append("grant_type","refresh_token"),formData.append("refresh_token",refreshToken);let body;try{body=await(await globals_default.fetch(`https://securetoken.googleapis.com/v1/token?key=${this.customKey||FirebaseKey}`,{method:"POST",body:formData.toString(),headers:{...baseHeaders,"content-type":"application/x-www-form-urlencoded"},proxy:this.proxy})).json()}catch(error){if(error.code==="auth/too-many-requests")return createError(APIError.FirebaseRateLimited);else if(error.code==="auth/network-request-failed")return this.errorLogger("loginWithRefreshToken: network error",body||error),createError(APIError.NetworkFail);else if(error.code==="ECONNREFUSED")return this.errorLogger("loginWithRefreshToken: connection refused",body||error),createError(APIError.NetworkFail);return this.errorLogger("loginWithRefreshToken: unknown error:",body,error),createError(APIError.InternalError)}if(!body.id_token)return this.errorLogger("loginWithRefreshToken: missing idToken",body),createError(APIError.InternalError);this.idToken=body.id_token;let response=await this.queryServices({cmd:"auth",firebaseToken:body.id_token,...customServicesParams});return response.ok?{firebase:body,...response}:response};loginAnonymously=async(customServicesParams)=>{let body;try{body=await(await globals_default.fetch(`https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=${this.customKey||FirebaseKey}`,{method:"POST",body:JSON.stringify({returnSecureToken:!0}),headers:{...baseHeaders,"content-type":"application/json"},proxy:this.proxy})).json()}catch(error){if(error.code==="auth/too-many-requests")return createError(APIError.FirebaseRateLimited);else if(error.code==="ECONNREFUSED")return this.errorLogger("loginAnonymously: connection refused",body||error),createError(APIError.NetworkFail);return this.errorLogger("loginAnonymously: unknown error:",body,error),createError(APIError.InternalError)}if(!body.idToken)return this.errorLogger("loginAnonymously: missing idToken",body),createError(APIError.InternalError);this.idToken=body.idToken;let query=await this.queryServices({cmd:"auth",firebaseToken:body.idToken,...customServicesParams});return query.ok?{firebase:body,...query}:query};sendEmailVerification=async(idToken=this.idToken)=>{if(!idToken)return createError(APIError.MissingParams);let body;try{body=await(await globals_default.fetch(`https://identitytoolkit.googleapis.com/v1/accounts:sendOobCode?key=${this.customKey||FirebaseKey}`,{method:"POST",body:JSON.stringify({requestType:"VERIFY_EMAIL",idToken}),headers:{...baseHeaders,"content-type":"application/json"},proxy:this.proxy})).json()}catch(error){if(error.code==="auth/too-many-requests")return createError(APIError.FirebaseRateLimited);else if(error.code==="auth/network-request-failed")return this.errorLogger("sendEmailVerification: network error",body||error),createError(APIError.NetworkFail);else if(error.code==="ECONNREFUSED")return this.errorLogger("sendEmailVerification: connection refused",body||error),createError(APIError.NetworkFail);return this.errorLogger("sendEmailVerification: unknown error:",idToken,error),createError(APIError.InternalError)}if(body.kind!=="identitytoolkit#GetOobConfirmationCodeResponse")return this.errorLogger("sendEmailVerification: the game sent an invalid response",body),createError(APIError.InternalError);return{ok:!0,email:body.email}};verifyOobCode=async(oobCode)=>{if(!oobCode)return createError(APIError.MissingParams);let body;try{body=await(await globals_default.fetch(`https://www.googleapis.com/identitytoolkit/v3/relyingparty/setAccountInfo?key=${this.customKey||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()}catch(error){if(error.code==="auth/too-many-requests")return createError(APIError.FirebaseRateLimited);else if(error.code==="auth/network-request-failed")return this.errorLogger("verifyOobCode: network error",body||error),createError(APIError.NetworkFail);else if(error.code==="ECONNREFUSED")return this.errorLogger("verifyOobCode: connection refused",body||error),createError(APIError.NetworkFail);return this.errorLogger("verifyOobCode: unknown error:",oobCode,error),createError(APIError.InternalError)}if(!body.emailVerified)return this.errorLogger("verifyOobCode: the game sent an invalid response",body),createError(APIError.InternalError);return{ok:!0,email: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 this.buffer.length-this.idx}static unPackInt8U(){return this.buffer[this.idx++]}static unPackInt8(){return this.unPackInt8U()<<24>>24}static unPackInt16U(){let i2=this.idx;return this.idx+=2,this.buffer[i2]|this.buffer[i2+1]<<8}static unPackInt24U(){let i2=this.idx;return this.idx+=3,this.buffer[i2]|this.buffer[i2+1]<<8|this.buffer[i2+2]<<16}static unPackInt32U(){let i2=this.idx;return this.idx+=4,(this.buffer[i2]|this.buffer[i2+1]<<8|this.buffer[i2+2]<<16|this.buffer[i2+3]<<24)>>>0}static unPackInt16(){return this.unPackInt16U()<<16>>16}static unPackInt32(){return this.unPackInt32U()<<0}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*2)return"";let chars=[];for(let i=0;i<len;i++){let c=this.unPackInt16U();if(c>0)chars.push(String.fromCodePoint(c))}return chars.join("")}}var CommIn_default=CommIn;class CommOut{constructor(size=16384){this.idx=0,this.arrayBuffer=new ArrayBuffer(size),this.view=new DataView(this.arrayBuffer),this.buffer=new Uint8Array(this.arrayBuffer)}send(ws2){let b2=new Uint8Array(this.arrayBuffer,0,this.idx);ws2.send(b2)}packInt8(val){this.view.setInt8(this.idx,val),this.idx++}packInt16(val){this.view.setInt16(this.idx,val,!0),this.idx+=2}packInt24(val){this.view.setInt16(this.idx,val&65535,!0),this.view.setInt8(this.idx+2,val>>16&255),this.idx+=3}packInt32(val){this.view.setInt32(this.idx,val,!0),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="";if(str.length>255)console.trace("truncated packString to fit int8 (shell protocol); this should not happen (report it on GitHub)"),str=str.slice(0,255);this.packInt8(str.length);for(let i=0;i<str.length;i++)this.packInt16(str.charCodeAt(i))}packLongString(str){if(typeof str!=="string")str="";this.packInt16(str.length);for(let i=0;i<str.length;i++)this.packInt16(str.charCodeAt(i))}}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=[],typeof playerData.social==="string"&&playerData.social.length)try{let parsed=JSON.parse(playerData.social);if(Array.isArray(parsed))this.socials=parsed}catch(e){console.error("Error parsing socials:",e),console.error("Report this on Github!")}if(this.socials.forEach((social)=>social.type=RSocialMedia[social.id]),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]=createGun(GunList[this.selectedGun]),this.weapons[1]=createGun(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 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&&Number.isFinite(this.pos.x)&&Number.isFinite(this.pos.y)&&Number.isFinite(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(Array.isArray(inputKeys))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 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(bot){if(typeof this.msg!=="string")return!1;if(this.msg.length<1||this.msg.length>64)return!1;if(!bot.game.isPrivate&&!bot.account.emailVerified&&!bot.account.isAged&&!bot.account.isCG)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;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 GoToAmmoDispatch{validate(bot){return bot.intents.includes(Intents.PATHFINDING)}check(bot){return bot.me.playing&&bot.game.collectibles[0].length}execute(bot){let minDistance=2000,closestAmmo=null;for(let ammo of bot.game.collectibles[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}if(!closestAmmo)return;let myNode=bot.pathing.nodeList.atObject(bot.me.position),targetNode=bot.pathing.nodeList.atObject(closestAmmo),path=bot.pathing.astar.path(myNode,targetNode);if(!path)return bot.$emit("pathfindError",PathfindError.NoPathFound);if(path.length<2)return bot.$emit("pathfindError",PathfindError.PathTooShort);bot.pathing.activePath=path,bot.pathing.activeNode=bot.pathing.activePath[1],bot.pathing.activeNodeIdx=1}}var GoToAmmoDispatch_default=GoToAmmoDispatch;class GoToCoopDispatch{validate(bot){return bot.intents.includes(Intents.PATHFINDING)}check(bot){return bot.me.playing&&bot.game.kotc.zoneIdx&&bot.game.kotc.activeZone}execute(bot){let minDistance=20000,closestZone=null;for(let zoneCoords of bot.game.kotc.activeZone){let dx=zoneCoords.x-bot.me.position.x,dy=zoneCoords.y-bot.me.position.y,dz=zoneCoords.z-bot.me.position.z,distance=Math.sqrt(dx*dx+dy*dy+dz*dz);if(distance<minDistance)minDistance=distance,closestZone=zoneCoords}if(!closestZone)return;let myNode=bot.pathing.nodeList.atObject(bot.me.position),targetNode=bot.pathing.nodeList.atObject(closestZone),path=bot.pathing.astar.path(myNode,targetNode);if(!path)return bot.$emit("pathfindError",PathfindError.NoPathFound);if(path.length<2)return bot.$emit("pathfindError",PathfindError.PathTooShort);bot.pathing.activePath=path,bot.pathing.activeNode=bot.pathing.activePath[1],bot.pathing.activeNodeIdx=1}}var GoToCoopDispatch_default=GoToCoopDispatch;class GoToGrenadeDispatch{validate(bot){return bot.intents.includes(Intents.PATHFINDING)}check(bot){return bot.me.playing&&bot.game.collectibles[1].length}execute(bot){let minDistance=2000,closestGrenade=null;for(let grenade of bot.game.collectibles[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}if(!closestGrenade)return;let myNode=bot.pathing.nodeList.atObject(bot.me.position),targetNode=bot.pathing.nodeList.atObject(closestGrenade),path=bot.pathing.astar.path(myNode,targetNode);if(!path)return bot.$emit("pathfindError",PathfindError.NoPathFound);if(path.length<2)return bot.$emit("pathfindError",PathfindError.PathTooShort);bot.pathing.activePath=path,bot.pathing.activeNode=bot.pathing.activePath[1],bot.pathing.activeNodeIdx=1}}var GoToGrenadeDispatch_default=GoToGrenadeDispatch;class GoToPlayerDispatch{idOrName;constructor(idOrName){this.idOrName=idOrName}$grabPlayer(bot){return bot.players[this.idOrName.toString()]||Object.values(bot.players).find((player)=>player.name===this.idOrName.toString())}validate(bot){return bot.intents.includes(Intents.PATHFINDING)&&(typeof this.idOrName==="string"||typeof this.idOrName==="number")}check(bot){if(!bot.me.playing)return!1;let target=this.$grabPlayer(bot);return target&&target.playing&&target.position&&Number.isFinite(target.position.x)}execute(bot){let target=this.$grabPlayer(bot),myNode=bot.pathing.nodeList.atObject(bot.me.position),targetNode=bot.pathing.nodeList.atObject(target.position),path=bot.pathing.astar.path(myNode,targetNode);if(!path)return bot.$emit("pathfindError",PathfindError.NoPathFound);if(path.length<2)return bot.$emit("pathfindError",PathfindError.PathTooShort);bot.pathing.activePath=path,bot.pathing.activeNode=bot.pathing.activePath[1],bot.pathing.activeNodeIdx=1}}var GoToPlayerDispatch_default=GoToPlayerDispatch;class GoToSpatulaDispatch{validate(bot){return bot.intents.includes(Intents.PATHFINDING)}check(bot){return bot.me.playing&&bot.game.spatula&&bot.game.spatula.coords&&Number.isFinite(bot.game.spatula.coords.x)}execute(bot){let myNode=bot.pathing.nodeList.atObject(bot.me.position),targetNode=bot.pathing.nodeList.atObject(bot.game.spatula.coords),path=bot.pathing.astar.path(myNode,targetNode);if(!path)return bot.$emit("pathfindError",PathfindError.NoPathFound);if(path.length<2)return bot.$emit("pathfindError",PathfindError.PathTooShort);bot.pathing.activePath=path,bot.pathing.activeNode=bot.pathing.activePath[1],bot.pathing.activeNodeIdx=1}}var GoToSpatulaDispatch_default=GoToSpatulaDispatch;var mod2=(n,m)=>(n%m+m)%m,PI22=Math.PI*2,setPrecision2=(value)=>Math.round(value*8192)/8192,calculateYaw2=(pos)=>setPrecision2(mod2(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}$grabPlayer(bot){return bot.players[this.idOrName.toString()]||Object.values(bot.players).find((player)=>player.name===this.idOrName.toString())}validate(){return typeof this.idOrName==="string"||typeof this.idOrName==="number"}check(bot){if(!bot.me.playing)return!1;let target=this.$grabPlayer(bot);return target&&target.playing&&target.position&&Number.isFinite(target.position.x)}execute(bot){let target=this.$grabPlayer(bot),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.state.usingMelee=!0,setTimeout(()=>{bot.state.usingMelee=!1,bot.state.swappingGun=!0,setTimeout(()=>{bot.state.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&&bot.me.weapons[bot.me.activeGun].ammo?.rounds<bot.me.weapons[bot.me.activeGun].ammo?.capacity&&bot.me.weapons[bot.me.activeGun].ammo?.store>0}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],isEmpty=playerActiveWeapon.ammo.rounds<1;bot.$emit("playerStartReload",bot.me,playerActiveWeapon),bot.state.reloading=!0,setTimeout(()=>{if(!bot.me||bot.hasQuit)return;bot.state.reloading=!1;let latestWeapon=bot.me.weapons[bot.me.activeGun];if(latestWeapon.ammo){let maxLoad=Math.min(latestWeapon.ammo.capacity,latestWeapon.ammo.reload),needed=Math.max(0,maxLoad-latestWeapon.ammo.rounds),newRounds=Math.min(needed,latestWeapon.ammo.store);latestWeapon.ammo.rounds+=newRounds,latestWeapon.ammo.store-=newRounds}bot.$emit("playerEndReload",bot.me,latestWeapon)},isEmpty?playerActiveWeapon.longReloadTime:playerActiveWeapon.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}$grabPlayer(bot){return bot.players[this.idOrName.toString()]||Object.values(bot.players).find((player)=>player.name===this.idOrName.toString())}validate(){if(typeof this.idOrName!=="string"&&typeof this.idOrName!=="number")return!1;if(this.reasons.every((reason)=>reason===!1))return!1;return!0}check(bot){if(!bot.state.inGame)return!1;return!!this.$grabPlayer(bot)}execute(bot){let target=this.$grabPlayer(bot),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])=>typeof v<"u"))}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&&typeof this.changes.classIdx<"u"&&this.changes.classIdx!==bot.me.selectedGun)bot.me.weapons[0]=createGun(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(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){let respawnTime=bot.intents.includes(Intents.FASTER_RESPAWN)?5000:6000;if(bot.me.playing)return!1;if(bot.intents.includes(Intents.OBSERVE_GAME))return!1;if(bot.lastDeathTime>0&&bot.lastDeathTime+respawnTime>Date.now())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[0,1].includes(this.manualWeapon)||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(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 DispatchIndex={banPlayer:BanPlayerDispatch_default,bootPlayer:BootPlayerDispatch_default,chat:ChatDispatch_default,fire:FireDispatch_default,gameOptions:GameOptionsDispatch_default,goToAmmo:GoToAmmoDispatch_default,goToCoop:GoToCoopDispatch_default,goToGrenade:GoToGrenadeDispatch_default,goToPlayer:GoToPlayerDispatch_default,goToSpatula:GoToSpatulaDispatch_default,lookAt:LookAtDispatch_default,lookAtPos:LookAtPosDispatch_default,melee:MeleeDispatch_default,move:MovementDispatch_default,pause:PauseDispatch_default,reload:ReloadDispatch_default,reportPlayer:ReportPlayerDispatch_default,resetGame:ResetGameDispatch_default,saveLoadout:SaveLoadoutDispatch_default,spawn:SpawnDispatch_default,swapWeapon:SwapWeaponDispatch_default,switchTeam:SwitchTeamDispatch_default,throwGrenade:ThrowGrenadeDispatch_default},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_direct={};__export(exports_direct,{validate:()=>validate,processJS:()=>processJS,coords:()=>coords});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("3496afa51f2a553ea1fc5211400c000b","hex");return crypto2.createHmac("sha256",salt2).update(input).digest("hex")}let salt=hexToUint8Array("3496afa51f2a553ea1fc5211400c000b"),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("")},tableAt=(addr)=>{return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(addr)},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^4294934528)&65535,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]=tableAt(local_6&63),letters[7]=tableAt(local_3>>>8&63),letters[4]=tableAt(local_01>>>10&63),letters[0]=tableAt((local_4&252)>>>2),letters[5]=tableAt(local_01>>>4&48|local_7>>>4&15),letters[2]=tableAt(local_5>>>6&60|local_6>>>6&3),letters[6]=tableAt((local_3>>>14&3|local_7<<2)&63),letters[1]=tableAt((local_5>>>12&15|local_4<<4)&63),String.fromCharCode(...letters)};var processJS=(input)=>{let inputArray=new Uint8Array([...input].map((c)=>c.charCodeAt(0))),xorKeyStart=88,decoded=new Uint8Array(inputArray.length);for(let i=0;i<inputArray.length;i++)decoded[i]=inputArray[i]^88+i&127;let result="";for(let i=0;i<decoded.length;i+=65536){let chunk=decoded.subarray(i,Math.min(i+65536,decoded.length));result+=String.fromCharCode(...chunk)}return result};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 processAddPlayerPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),findCosmetics=bot.intents.includes(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()};bot.game.mapIdx=CommIn_default.unPackInt8U(),bot.game.isPrivate=CommIn_default.unPackInt8U()===1,bot.game.gameModeId=CommIn_default.unPackInt8U();let player=new GamePlayer_default(playerData,bot.game.gameMode===GameMode.KOTC?bot.game.kotc.activeZone:null);if(!bot.players[playerData.id])bot.players[playerData.id]=player;if(bot.$emit("playerJoin",player),bot.me.id===playerData.id)bot.me=player,bot.$emit("botJoin",bot.me)},addPlayer_default=processAddPlayerPacket;var processBeginShellStreakPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),ksType=CommIn_default.unPackInt8U(),player=bot.players[id];if(!player)return;switch(ksType){case ShellStreak.HardBoiled:if(id===bot.me.id)bot.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}bot.$emit("playerBeginStreak",player,ksType)},beginShellStreak_default=processBeginShellStreakPacket;var processChallengeCompletedPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),challengeId=CommIn_default.unPackInt8U(),player=bot.players[id];if(!player)return;if(!bot.intents.includes(Intents.CHALLENGES))return bot.$emit("challengeComplete",player,challengeId);let challenge=bot.account.challenges.find((c)=>c.id===challengeId);if(bot.$emit("challengeComplete",player,challenge),player.id===bot.me.id)bot.refreshChallenges()},challengeCompleted_default=processChallengeCompletedPacket;var processChangeCharacterPacket=(bot)=>{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=bot.intents.includes(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=bot.players[id];if(player){let oldCharacter=structuredClone(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]=createGun(GunList[weaponIndex]),oldWeaponIdx!==player.selectedGun)bot.$emit("playerChangeGun",player,oldWeaponIdx,player.selectedGun);if(JSON.stringify(oldCharacter)!==JSON.stringify(player.character))bot.$emit("playerChangeCharacter",player,oldCharacter,player.character)}},changeCharacter_default=processChangeCharacterPacket;var processChatPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),msgFlags=CommIn_default.unPackInt8U(),text=CommIn_default.unPackString(),player=bot.players[id];if(player)bot.$emit("chat",player,text,msgFlags)},chat_default=processChatPacket;var processCollectItemPacket=(bot)=>{let playerId=CommIn_default.unPackInt8U(),type=CommIn_default.unPackInt8U(),applyToWeaponIdx=CommIn_default.unPackInt8U(),id=CommIn_default.unPackInt16U(),player=bot.players[playerId];if(!player)return;if(bot.game.collectibles[type]=bot.game.collectibles[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),bot.$emit("playerCollectAmmo",player,playerWeapon,id)}if(type===CollectType.Grenade){if(player.grenades++,player.grenades>3)player.grenades=3;bot.$emit("playerCollectGrenade",player,id)}},collectItem_default=processCollectItemPacket;var processDiePacket=(bot)=>{let killedId=CommIn_default.unPackInt8U(),killerId=CommIn_default.unPackInt8U();CommIn_default.unPackInt8U(),CommIn_default.unPackInt8U();let damageCauseInt=CommIn_default.unPackInt8U(),killed=bot.players[killedId],killer=bot.players[killerId],oldKilled=killed?structuredClone(killed):null;if(bot.me&&killed){if(killed.id===bot.me.id){if(bot.lastDeathTime=Date.now(),bot.pathing.activePath)bot.pathing.activePath=null,bot.pathing.activeNode=null,bot.pathing.activeNodeIdx=0;bot.state.controlKeys=0}if(killed.playing=!1,killed.streak=0,killed.hp=100,killed.spawnShield=0,killed.stats.totalDeaths++,killed.inKotcZone)killed.inKotcZone=!1,bot.$emit("playerLeaveZone",killed,ZoneLeaveReason.Killed)}if(killer){if(killer.streak++,killer.stats.totalKills++,killer.streak>killer.stats.bestStreak)killer.stats.bestStreak=killer.streak}bot.$emit("playerDeath",killed,killer,oldKilled,damageCauseInt)},die_default=processDiePacket;var timedStreaks=[ShellStreak.EggBreaker,ShellStreak.OverHeal,ShellStreak.DoubleEggs,ShellStreak.MiniEgg],processEndShellStreakPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),ksType=CommIn_default.unPackInt8U(),player=bot.players[id];if(!player)return;if(timedStreaks.includes(ksType)&&player.streakRewards.includes(ksType))player.streakRewards=player.streakRewards.filter((r)=>r!==ksType);if(ksType===ShellStreak.MiniEgg)player.scale=1;bot.$emit("playerEndStreak",player,ksType)},endShellStreak_default=processEndShellStreakPacket;var processEventModifierPacket=(bot)=>{let out=new CommOut_default;out.packInt8(CommCode_default.eventModifier),out.send(bot.game.socket)},eventModifier_default=processEventModifierPacket;var processExplodePacket=(bot)=>{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(bot.intents.includes(Intents.COSMETIC_DATA))item=findItemById(item);if(itemType===ItemType.Grenade)bot.$emit("grenadeExplode",item,{x,y,z},damage,radius);else bot.$emit("rocketHit",{x,y,z},damage,radius)},explode_default=processExplodePacket;var processFirePacket=(bot)=>{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=bot.players[id];if(!player)return;let playerWeapon=player.weapons[player.activeGun];if(playerWeapon&&playerWeapon.ammo)playerWeapon.ammo.rounds--,bot.$emit("playerFire",player,playerWeapon,bullet)},fire_default=processFirePacket;var processGameActionPacket=(bot)=>{let action=CommIn_default.unPackInt8U();if(action===GameAction.Pause)bot.$emit("gameForcePause"),setTimeout(()=>{if(bot.me)bot.me.playing=!1},3000);if(action===GameAction.Reset){if(Object.values(bot.players).forEach((player)=>player.streak=0),bot.game.gameModeId!==GameMode.FFA)bot.game.teamScore=[0,0,0];if(bot.game.gameModeId===GameMode.Spatula)bot.game.spatula.controlledBy=0,bot.game.spatula.controlledByTeam=0,bot.game.spatula.coords={x:0,y:0,z:0};if(bot.game.gameModeId===GameMode.KOTC)bot.game.kotc.stage=CoopState.Capturing,bot.game.kotc.zoneIdx=0,bot.game.kotc.activeZone=null,bot.game.kotc.capturing=0,bot.game.kotc.captureProgress=0,bot.game.kotc.numCapturing=0,bot.game.kotc.capturePercent=0;bot.$emit("gameReset")}},gameAction_default=processGameActionPacket;class AStar{constructor(list){this.list=list}heuristic(pos1,pos2){let dx=Math.abs(pos1.x-pos2.x),dy=Math.abs(pos1.y-pos2.y),dz=Math.abs(pos1.z-pos2.z),dxz=Math.max(dx,dz);return dy+dxz}reversePath(node){let path=[];while(node.parent)path.push(node),node=node.parent;return path.reverse(),path}path(start,end){this.list.clean();let openSet=[start],closedSet=new Set;start.h=this.heuristic(start,end),start.g=0,start.f=start.h,start.visited=!0;let current;while(openSet.length>0){let lowestIdx=0,lowestF=openSet[0].f,lowestG=openSet[0].g;for(let i=1;i<openSet.length;i++){let node=openSet[i];if(node.f<lowestF||node.f===lowestF&&node.g>lowestG)lowestF=node.f,lowestG=node.g,lowestIdx=i}if(current=openSet[lowestIdx],current===end)return this.reversePath(current);openSet[lowestIdx]=openSet[openSet.length-1],openSet.pop(),closedSet.add(current);let neighbors=current.links;for(let i=0;i<neighbors.length;i++){let neighbor=neighbors[i];if(closedSet.has(neighbor))continue;let tentativeGScore=current.g+1;if(!neighbor.visited||tentativeGScore<neighbor.g){let isNew=!neighbor.visited;if(neighbor.visited=!0,neighbor.parent=current,neighbor.g=tentativeGScore,neighbor.h=this.heuristic(neighbor,end),neighbor.f=neighbor.g+neighbor.h,isNew)openSet.push(neighbor)}}}return null}}var FORWARD_RY_WEDGE_MAPPING=Object.freeze({0:{x:0,z:-1},1:{x:-1,z:0},2:{x:0,z:1},3:{x:1,z:0}}),positionKey=(x,y,z)=>(x&255)<<16|(y&255)<<8|z&255;class MapNode{constructor(meshType,data){if(this.x=data.x,this.y=data.y,this.z=data.z,this.positionKey=positionKey(this.x,this.y,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.flatCenter={x:this.x+0.5,y:this.y,z:this.z+0.5},this.meshType==="wedge")this.ry=data.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"}isJumpPad(){return this.meshType==="jump-pad"}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&&!(dx===2&&dz===1||dx===1&&dz===2||dx===2&&dz===2)||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;if(dy===0&&belowMe.isFull()&&belowOther.isFull()){if(dx===2&&dz===0||dx===0&&dz===2){let midX=(this.x+node.x)/2,midZ=(this.z+node.z)/2,midNode=list.at(midX,this.y,midZ),midBelow=list.at(midX,this.y-1,midZ),midAbove=list.at(midX,this.y+1,midZ);if(midBelow&&midBelow.isAir()){if(midNode&&midNode.isAir()&&midAbove&&midAbove.isAir()){let startHead=list.at(this.x,this.y+1,this.z),endHead=list.at(node.x,node.y+1,node.z);if(startHead&&startHead.isAir()&&endHead&&endHead.isAir())return!0}}}else if(dx===2&&dz===1||dx===1&&dz===2){let xDir=dx0>0?-1:1,zDir=dz0>0?-1:1,checks=dx===2?[[this.x+xDir,this.y,this.z],[this.x+xDir,this.y,this.z+zDir]]:[[this.x,this.y,this.z+zDir],[this.x+xDir,this.y,this.z+zDir]],allClear=!0;for(let[x,y,z]of checks){let block=list.at(x,y,z),blockBelow=list.at(x,y-1,z),blockAbove=list.at(x,y+1,z);if(!block||!block.isAir()||!blockBelow||!blockBelow.isAir()||!blockAbove||!blockAbove.isAir()){allClear=!1;break}}if(allClear){let startHead=list.at(this.x,this.y+1,this.z),endHead=list.at(node.x,node.y+1,node.z);if(startHead&&startHead.isAir()&&endHead&&endHead.isAir())return!0}}else if(dx===2&&dz===2){let xDir=dx0>0?-1:1,zDir=dz0>0?-1:1,checks=[[this.x+xDir,this.y,this.z+zDir],[this.x+2*xDir,this.y,this.z+zDir],[this.x+2*xDir,this.y,this.z+2*zDir]],allClear=!0;for(let[x,y,z]of checks){let block=list.at(x,y,z),blockBelow=list.at(x,y-1,z),blockAbove=list.at(x,y+1,z);if(!block||!block.isAir()||!blockBelow||!blockBelow.isAir()||!blockAbove||!blockAbove.isAir()){allClear=!1;break}}if(allClear){let startHead=list.at(this.x,this.y+1,this.z),endHead=list.at(node.x,node.y+1,node.z);if(startHead&&startHead.isAir()&&endHead&&endHead.isAir())return!0}}}let meSupported=belowMe.isFull()||this.isStair(),otherSupported=belowOther.isFull()||belowOther.isStair()||node.isStair();if(dy<=2&&meSupported&&otherSupported){if(this.meshType==="none"){if(dy0===1&&node.canWalkThrough())return!0;if(belowMe.canWalkOn()||belowMe.isLadder()||belowMe.isStair()){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}else if(this.meshType==="ladder"){if(dy===1&&node.canWalkThrough())return!0;if(dy===0&&belowMe.canWalkOn())return!0;return node.meshType==="ladder"&&(dy===1||belowMe.canWalkOn()&&belowOther.canWalkOn())}else if(this.meshType==="wedge"){let forward=FORWARD_RY_WEDGE_MAPPING[this.ry],backward={x:-forward.x,z:-forward.z};if(this.x+forward.x===node.x&&this.z+forward.z===node.z){if(this.y+1===node.y&&node.canWalkThrough())return!0;if(this.y===node.y&&node.meshType==="wedge")return!0;if(this.y+1===node.y&&node.meshType==="wedge")return!0}if(this.x+backward.x===node.x&&this.z+backward.z===node.z){if((this.y===node.y||this.y-1===node.y)&&node.canWalkThrough())return!0;if(this.y-1===node.y&&(node.meshType==="wedge"||node.meshType==="none"&&belowOther.isFull()))return!0}if(node.canWalkThrough()&&(belowOther.isFull()||belowOther.isStair()))return!0;if(node.isStair())return!0;return!1}}return!1}flatRadialDistance(position){return Math.hypot(this.flatCenter.x-position.x,this.flatCenter.z-position.z)}}var NEIGHBOR_OFFSETS=[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1],[1,0,1],[1,0,-1],[-1,0,1],[-1,0,-1],[1,1,0],[-1,1,0],[0,1,1],[0,1,-1],[1,-1,0],[-1,-1,0],[0,-1,1],[0,-1,-1],[2,0,0],[-2,0,0],[0,0,2],[0,0,-2],[2,0,1],[2,0,-1],[-2,0,1],[-2,0,-1],[1,0,2],[1,0,-2],[-1,0,2],[-1,0,-2],[2,0,2],[2,0,-2],[-2,0,2],[-2,0,-2]];class NodeList{list=[];nodeMap=null;constructor(raw){let addedPositions=new Set;for(let meshName of Object.keys(raw.data))for(let nodeData of raw.data[meshName])addedPositions.add(positionKey(nodeData.x,nodeData.y,nodeData.z)),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.has(positionKey(x,y,z)))this.list.push(new MapNode("SPECIAL.air.none",{x,y,z}));this.nodeMap=new Map;for(let node of this.list)this.nodeMap.set(node.positionKey,node);for(let node of this.list)for(let[dx,dy,dz]of NEIGHBOR_OFFSETS){let neighborKey=positionKey(node.x+dx,node.y+dy,node.z+dz),neighborNode=this.nodeMap.get(neighborKey);if(neighborNode&&node.canLink(neighborNode,this))node.links.push(neighborNode)}}at(x,y,z){return this.nodeMap?.get(positionKey(x,y,z))}atObject({x,y,z}){return this.nodeMap?.get(positionKey(Math.floor(x),Math.floor(y),Math.floor(z)))}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++){if(this.at(Math.round(x),Math.round(y),Math.round(z))?.isFull())return!1;x+=xStep,y+=yStep,z+=zStep}return!0}}var GameModeById=Object.fromEntries(Object.entries(GameMode).map(([key,value])=>[value,key])),processGameJoinedPacket=async(bot)=>{if(bot.me.id=CommIn_default.unPackInt8U(),bot.me.team=CommIn_default.unPackInt8U(),bot.game.gameModeId=CommIn_default.unPackInt8U(),bot.game.gameMode=GameModeById[bot.game.gameModeId],bot.game.mapIdx=CommIn_default.unPackInt8U(),bot.game.map=Maps[bot.game.mapIdx],bot.game.playerLimit=CommIn_default.unPackInt8U(),bot.game.isGameOwner=CommIn_default.unPackInt8U()===1,bot.game.isPrivate=CommIn_default.unPackInt8U()===1||bot.game.isGameOwner,CommIn_default.unPackInt8U(),bot.intents.includes(Intents.LOAD_MAP)||bot.intents.includes(Intents.PATHFINDING)){let map=await fetchMap(bot.game.map.filename,bot.game.map.hash);if(bot.game.map)bot.game.map.raw=map;if(bot.game.gameModeId===GameMode.KOTC){let meshData=bot.game.map.raw.data["DYNAMIC.capture-zone.none"];if(meshData){if(bot.game.map.zones=initKotcZones(meshData),!bot.game.kotc.activeZone)bot.game.kotc.activeZone=bot.game.map.zones[bot.game.kotc.zoneIdx-1]}else delete bot.game.map.zones}if(bot.intents.includes(Intents.PATHFINDING))bot.pathing.nodeList=new NodeList(bot.game.map.raw),bot.pathing.astar=new AStar(bot.pathing.nodeList);bot.$emit("mapLoad",bot.game.map.raw)}bot.state.inGame=!0,bot.lastDeathTime=Date.now();let out=new CommOut_default;if(out.packInt8(CommCode_default.clientReady),out.send(bot.game.socket),!bot.intents.includes(Intents.MANUAL_UPDATE))bot.updateIntervalId=setInterval(()=>bot.update(),33.333333333333336);if(bot.intents.includes(Intents.PING)){bot.lastPingTime=Date.now();let out2=new CommOut_default;out2.packInt8(CommCode_default.ping),out2.send(bot.game.socket)}if(bot.intents.includes(Intents.NO_AFK_KICK))bot.afkKickInterval=setInterval(()=>{if(bot.state.inGame&&!bot.me.playing&&Date.now()-bot.lastDeathTime>=15000){let out3=new CommOut_default;out3.packInt8(CommCode_default.keepAlive),out3.send(bot.game.socket)}},15000);bot.$emit("gameReady")},gameJoined_default=processGameJoinedPacket;var CCGameOptionFlag=Object.fromEntries(Object.entries(GameOptionFlag).map(([k,v])=>[k[0].toLowerCase()+k.slice(1),v])),processGameOptionsPacket=(bot)=>{let oldOptions=structuredClone(bot.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;bot.game.options.gravity=gravity/4,bot.game.options.damage=damage/4,bot.game.options.healthRegen=healthRegen/4;let rawFlags=CommIn_default.unPackInt8U();Object.keys(CCGameOptionFlag).forEach((optionFlagName)=>{let value=rawFlags&CCGameOptionFlag[optionFlagName]?1:0;bot.game.options[optionFlagName]=value}),bot.game.options.weaponsDisabled=Array.from({length:7},()=>CommIn_default.unPackInt8U()===1),bot.game.options.mustUseSecondary=bot.game.options.weaponsDisabled.every((v)=>v),bot.$emit("gameOptionsChange",oldOptions,bot.game.options)},gameOptions_default=processGameOptionsPacket;var processHitMeHardBoiledPacket=(bot)=>{let shieldHealth=CommIn_default.unPackInt8U(),playerHealth=CommIn_default.unPackInt8U(),dx=CommIn_default.unPackFloat(),dz=CommIn_default.unPackFloat();if(!bot.me)return;if(bot.me.shieldHp=shieldHealth,bot.me.hp=playerHealth,bot.me.shieldHp<=0)bot.me.streakRewards=bot.me.streakRewards.filter((r)=>r!==ShellStreak.HardBoiled),bot.$emit("selfShieldLost",bot.me.hp,{dx,dz});else bot.$emit("selfShieldHit",bot.me.shieldHp,bot.me.hp,{dx,dz})},hitMeHardBoiled_default=processHitMeHardBoiledPacket;var processHitMePacket=(bot)=>{let hp=CommIn_default.unPackInt8U();if(CommIn_default.unPackFloat(),CommIn_default.unPackFloat(),bot.me){let oldHealth=bot.me.hp;bot.me.hp=hp,bot.$emit("playerDamage",bot.me,oldHealth,bot.me.hp)}},hitMe_default=processHitMePacket;var processHitThemPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),hp=CommIn_default.unPackInt8U(),player=bot.players[id];if(!player)return;let oldHealth=player.hp;player.hp=hp,bot.$emit("playerDamage",player,oldHealth,player.hp)},hitThem_default=processHitThemPacket;var processMeleePacket=(bot)=>{let id=CommIn_default.unPackInt8U(),player=bot.players[id];if(player)bot.$emit("playerMelee",player)},melee_default=processMeleePacket;var processMetaGameStatePacket=(bot)=>{if(bot.game.gameModeId===GameMode.Spatula){let oldTeamScores=structuredClone(bot.game.teamScore),oldSpatula=structuredClone(bot.game.spatula);bot.game.teamScore[1]=CommIn_default.unPackInt16U(),bot.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();bot.game.spatula={coords:spatulaCoords,controlledBy,controlledByTeam},bot.$emit("gameStateChange",{teamScore:{before:oldTeamScores,after:bot.game.teamScore},spatula:{before:oldSpatula,after:bot.game.spatula}})}else if(bot.game.gameModeId===GameMode.KOTC){let oldTeamScores=structuredClone(bot.game.teamScore),oldKOTC=structuredClone(bot.game.kotc),oldPlayersOnZone=Object.values(bot.players).filter((p)=>p.inKotcZone&&p.playing);if(bot.game.kotc.stage=CommIn_default.unPackInt8U(),bot.game.kotc.zoneIdx=CommIn_default.unPackInt8U(),bot.game.kotc.capturing=CommIn_default.unPackInt8U(),bot.game.kotc.captureProgress=CommIn_default.unPackInt16U(),bot.game.kotc.numCapturing=CommIn_default.unPackInt8U(),bot.game.teamScore[1]=CommIn_default.unPackInt8U(),bot.game.teamScore[2]=CommIn_default.unPackInt8U(),bot.game.kotc.capturePercent=bot.game.kotc.captureProgress/1000,bot.game.kotc.activeZone=bot.game.map?.zones?bot.game.map.zones[bot.game.kotc.zoneIdx-1]:null,bot.game.kotc.activeZone)Object.values(bot.players).forEach((player)=>player.updateKotcZone(bot.game.kotc.activeZone));if(bot.game.kotc.numCapturing<=0)Object.values(bot.players).forEach((player)=>{if(player.inKotcZone)player.inKotcZone=!1,bot.$emit("playerLeaveZone",player,ZoneLeaveReason.RoundEnded)});let newPlayersOnZone=Object.values(bot.players).filter((p)=>p.inKotcZone&&p.playing);bot.$emit("gameStateChange",{teamScore:{before:oldTeamScores,after:bot.game.teamScore},kotc:{before:oldKOTC,after:bot.game.kotc},playersOnZone:{before:oldPlayersOnZone,after:newPlayersOnZone}})}else if(bot.game.gameModeId===GameMode.Team){let oldTeamScores=structuredClone(bot.game.teamScore);bot.game.teamScore[1]=CommIn_default.unPackInt16U(),bot.game.teamScore[2]=CommIn_default.unPackInt16U(),bot.$emit("gameStateChange",{teamScore:{before:oldTeamScores,after:bot.game.teamScore}})}if(bot.game.gameModeId!==GameMode.Spatula)delete bot.game.spatula;if(bot.game.gameModeId!==GameMode.KOTC)delete bot.game.kotc;if(bot.game.gameModeId===GameMode.FFA)delete bot.game.teamScore},metaGameState_default=processMetaGameStatePacket;var processPausePacket=(bot)=>{let id=CommIn_default.unPackInt8U(),player=bot.players[id];if(player){if(player.playing=!1,player.streakRewards)player.streakRewards=[];if(bot.$emit("playerPause",player),player.inKotcZone)player.inKotcZone=!1,bot.$emit("playerLeaveZone",player,ZoneLeaveReason.Despawned)}},pause_default=processPausePacket;var processPingPacket=(bot)=>{if(!bot.intents.includes(Intents.PING))return;if(bot.pingTimeoutId)clearTimeout(bot.pingTimeoutId);let oldPing=bot.ping??0;bot.ping=bot.lastPingTime?Date.now()-bot.lastPingTime:0,bot.$emit("pingUpdate",oldPing,bot.ping),bot.pingTimeoutId=setTimeout(()=>{let out=new CommOut_default;out.packInt8(CommCode_default.ping),out.send(bot.game.socket),bot.lastPingTime=Date.now()},1000)},ping_default=processPingPacket;var processPlayerInfoPacket=(bot)=>{let playerId=CommIn_default.unPackInt8U(),playerDBId=CommIn_default.unPackString(128),playerIp=CommIn_default.unPackString(32),player=bot.players[playerId];if(!player)return;player.admin={ip:playerIp,dbId:playerDBId},bot.$emit("playerInfo",player,playerIp,playerDBId)},playerInfo_default=processPlayerInfoPacket;var processReloadPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),player=bot.players[id];if(!player)return;let playerActiveWeapon=player.weapons[player.activeGun];if(playerActiveWeapon.ammo){let maxLoad=Math.min(playerActiveWeapon.ammo.capacity,playerActiveWeapon.ammo.reload),needed=Math.max(0,maxLoad-playerActiveWeapon.ammo.rounds),newRounds=Math.min(needed,playerActiveWeapon.ammo.store);playerActiveWeapon.ammo.rounds+=newRounds,playerActiveWeapon.ammo.store-=newRounds}bot.$emit("playerReload",player,playerActiveWeapon)},reload_default=processReloadPacket;var processRemovePlayerPacket=(bot)=>{let id=CommIn_default.unPackInt8U();if(!bot.players[id])return;let removedPlayer=structuredClone(bot.players[id]);delete bot.players[id],bot.$emit("playerLeave",removedPlayer)},removePlayer_default=processRemovePlayerPacket;var processRespawnPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),seed=CommIn_default.unPackInt16U(),x=CommIn_default.unPackFloat(),y=CommIn_default.unPackFloat(),z=CommIn_default.unPackFloat(),primaryRounds=CommIn_default.unPackInt8U(),primaryStore=CommIn_default.unPackInt8U(),secondaryRounds=CommIn_default.unPackInt8U(),secondaryStore=CommIn_default.unPackInt8U(),grenades=CommIn_default.unPackInt8U(),player=bot.players[id];if(player){if(player.playing=!0,player.randomSeed=seed,player.weapons[0]&&player.weapons[0].ammo)player.weapons[0].ammo.rounds=primaryRounds;if(player.weapons[0]&&player.weapons[0].ammo)player.weapons[0].ammo.store=primaryStore;if(player.weapons[1]&&player.weapons[1].ammo)player.weapons[1].ammo.rounds=secondaryRounds;if(player.weapons[1]&&player.weapons[1].ammo)player.weapons[1].ammo.store=secondaryStore;player.grenades=grenades,player.position={x,y,z},player.spawnShield=120,bot.$emit("playerRespawn",player)}},respawn_default=processRespawnPacket;var processSocketReadyPacket=(bot)=>{let out=new CommOut_default;out.packInt8(bot.intents.includes(Intents.OBSERVE_GAME)?CommCode_default.observeGame:CommCode_default.joinGame),out.packString(bot.game.raw.uuid),out.packInt8(+bot.intents.includes(Intents.VIP_HIDE_BADGE)),out.packInt8(bot.state.weaponIdx||bot.account.loadout?.classIdx||0),out.packString(bot.state.name),out.packInt32(bot.account.session),out.packString(bot.account.sessionId),out.packString(bot.account.firebaseId),out.send(bot.game.socket)},socketReady_default=processSocketReadyPacket;var processSpawnItemPacket=(bot)=>{let id=CommIn_default.unPackInt16U(),type=CommIn_default.unPackInt8U(),x=CommIn_default.unPackFloat(),y=CommIn_default.unPackFloat(),z=CommIn_default.unPackFloat();bot.game.collectibles[type].push({id,x,y,z}),bot.$emit("spawnItem",type,{x,y,z},id)},spawnItem_default=processSpawnItemPacket;var processSwitchTeamPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),toTeam=CommIn_default.unPackInt8U(),player=bot.players[id];if(!player)return;let oldTeam=player.team;player.team=toTeam,player.streak=0,bot.$emit("playerSwitchTeam",player,oldTeam,toTeam)},switchTeam_default=processSwitchTeamPacket;var processSyncMePacket=(bot)=>{let id=CommIn_default.unPackInt8U(),player=bot.players[id];CommIn_default.unPackInt8U();let serverStateIdx=CommIn_default.unPackInt8U(),newX=CommIn_default.unPackFloat(),newY=CommIn_default.unPackFloat(),newZ=CommIn_default.unPackFloat();if(bot.me.climbing=!!CommIn_default.unPackInt8U(),CommIn_default.unPackInt8U(),CommIn_default.unPackInt8U(),!player)return;bot.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)bot.$emit("playerMove",player,{x:oldX,y:oldY,z:oldZ},{x:newX,y:newY,z:newZ})},syncMe_default=processSyncMePacket;var processSyncThemPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),x=CommIn_default.unPackFloat(),y=CommIn_default.unPackFloat(),z=CommIn_default.unPackFloat(),climbing=CommIn_default.unPackInt8U(),player=bot.players[id];if(!player||player.id===bot.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();player.jumping=!!(controlKeys&Movement.Jump),player.scoping=!!(controlKeys&Movement.Scope);let oldView=structuredClone(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)bot.$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?structuredClone(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(bot.$emit("playerMove",player,oldPosition,px),bot.game.gameModeId!==GameMode.KOTC)return;let zone=bot.game.kotc.activeZone,wasIn=!!player.inKotcZone;if(!zone&&wasIn){player.inKotcZone=!1,bot.$emit("playerLeaveZone",player,ZoneLeaveReason.RoundEnded);return}player.updateKotcZone(zone);let nowIn=!!player.inKotcZone;if(wasIn!==nowIn)player.inKotcZone=nowIn,bot.$emit(nowIn?"playerEnterZone":"playerLeaveZone",player,nowIn?null:ZoneLeaveReason.WalkedOut)},syncThem_default=processSyncThemPacket;var processThrowGrenadePacket=(bot)=>{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=bot.players[id];if(player){if(player.grenades>0)player.grenades--;bot.$emit("playerThrowGrenade",player,{x,y,z},{x:dx,y:dy,z:dz})}},throwGrenade_default=processThrowGrenadePacket;var processUpdateBalancePacket=(bot)=>{let newBalance=CommIn_default.unPackInt32U(),oldBalance=bot.account.eggBalance;bot.account.eggBalance=newBalance,bot.$emit("balanceUpdate",oldBalance,newBalance)},updateBalance_default=processUpdateBalancePacket;var processSwapWeaponPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),newWeaponId=CommIn_default.unPackInt8U(),player=bot.players[id];if(player)player.activeGun=newWeaponId,bot.$emit("playerSwapWeapon",player,newWeaponId)},swapWeapon_default=processSwapWeaponPacket;var mod3=(n,m)=>(n%m+m)%m;class Bot{intents=[];regionList=[];matchmakerListeners=[];#dispatches=[];#hooks={};#globalHooks=[];#initialAccount;#initialGame;errorLogger=(...args)=>console.error(...args);constructor(params={}){if(params.proxy&&typeof process>"u")throw Error("proxies do not work in this environment");if(this.intents=params.intents||[],this.intents.includes(Intents.COSMETIC_DATA)){if(!findItemById(1001))throw Error("you cannot use the COSMETIC_DATA intent inside of the browser bundles")}if(this.intents.includes(Intents.SIMULATION)&&!this.intents.includes(Intents.PATHFINDING))throw Error("the SIMULATION intent requires the PATHFINDING intent");if(this.instance=params.instance||"shellshock.io",this.protocol=params.protocol||"wss",this.proxy=params.proxy||"",this.connectionTimeout=params.connectionTimeout||5000,typeof params.errorLogger==="function")this.errorLogger=params.errorLogger;if(this.state={name:"yolkbot",weaponIdx:0,useAltGameURL:!1,inGame:!1,chatLines:0,yaw:0,pitch:0,controlKeys:0,onGround:4,dx:0,dy:0,dz:0,reloading:!1,swappingGun:!1,usingMelee:!1,stateIdx:0,serverStateIdx:0,shotsFired:0,buffer:[]},this.players={},this.me=new GamePlayer_default({}),this.game={raw:{},code:"",region:"",socket:null,gameModeId:0,gameMode:"ffa",mapIdx:0,map:{filename:"",hash:"",name:"",modes:{FFA:!1,Teams:!1,Spatula:!1,King:!1},availability:"both",numPlayers:"18",raw:{},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},collectibles:[[],[]],teamScore:[0,0,0],spatula:{coords:{x:0,y:0,z:0},controlledBy:0,controlledByTeam:0},kotc:{stage:CoopState.Capturing,zoneIdx:0,activeZone:[],capturing:0,captureProgress:0,numCapturing:0,capturePercent:0}},this.#initialGame=JSON.parse(JSON.stringify(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,isCG:!1,adminRoles:0,rawLoginData:{},eggBalance:0},this.#initialAccount=JSON.parse(JSON.stringify(this.account)),this.api=new api_default({proxy:this.proxy,protocol:this.protocol,instance:this.instance,connectionTimeout:this.connectionTimeout}),this.ping=0,this.lastPingTime=-1,this.lastDeathTime=-1,this.pathing={nodeList:null,activePath:null,activeNode:null,activeNodeIdx:0},this.hasQuit=!1,this.intents.includes(Intents.NO_AFK_KICK))this.afkKickInterval=0;if(this.intents.includes(Intents.RENEW_SESSION))this.renewSessionInterval=0}dispatch(dispatch,isEmit){if(dispatch.validate(this)){if(dispatch.check(this))dispatch.execute(this);else this.#dispatches.push(dispatch);return!0}return this.errorLogger(`${isEmit?"emit":"dispatch"}: validation failed for dispatch ${dispatch.constructor.name}`),this.errorLogger("this means the dispatch will NEVER RUN!"),this.errorLogger("make sure all parameters are valid and that any player IDs are in the game"),!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(!loginData.ok||!loginData.playerOutput){if(this.$emit("authFail",loginData),loginData.ok&&!loginData.playerOutput)this.errorLogger("processLoginData: missing playerOutput but is ok",loginData);return{...loginData,error:LoginError.InternalError,ok:!1}}if(loginData.banRemaining)return this.$emit("banned",loginData.banRemaining),createError(LoginError.AccountBanned);this.account.firebase=loginData.firebase;let output=loginData.playerOutput;if(this.account.rawLoginData=output,this.account.adminRoles=output.adminRoles||0,this.account.eggBalance=output.currentBalance,this.account.emailVerified=output.emailVerified,this.account.firebaseId=output.firebaseId,this.account.id=output.id,this.account.isAged=new Date(output.dateCreated).getTime()<1714546800000,this.account.isCG=output.cgAccountStatus?.hasAccount,this.account.loadout=output.loadout,this.account.ownedItemIds=output.ownedItemIds,this.account.session=output.session,this.account.sessionId=output.sessionId,this.account.vip=output.active_sub==="IsVIP",this.intents.includes(Intents.BOT_STATS))this.account.stats={lifetime:output.statsLifetime,monthly:output.statsCurrent};if(this.intents.includes(Intents.CHALLENGES))this.#importChallenges(output.challenges);if(this.$emit("authSuccess",this.account),this.intents.includes(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{ok:!0,account: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 createMatchmaker(){let matchmaker=new socket_default(`${this.protocol}://${this.instance}/matchmaker/`,{proxy:this.proxy,errorLogger:this.errorLogger});if(matchmaker.autoReconnect=!0,!await matchmaker.tryConnect())return createError(MatchmakerError.WebSocketConnectFail);this.matchmaker=matchmaker;let uuidTimeouts=[];return this.matchmaker.onmessage=async(e)=>{let data=JSON.parse(e.data);if(data.command==="validateUUID"){let timeout=setTimeout(()=>{console.error("createMatchmaker: the matchmaker did not respond to our validateUUID"),console.error("createMatchmaker: this means yolkbot is broken, please report this on Github"),console.error("createMatchmaker: https://github.com/yolkorg/yolkbot (or join the Discord)")},5000);return uuidTimeouts.push(timeout),this.matchmaker.send(JSON.stringify({command:"validateUUID",hash:await validate(data.uuid)}))}if(uuidTimeouts.length)uuidTimeouts.forEach((t)=>clearTimeout(t)),uuidTimeouts.length=0;this.matchmakerListeners.forEach((listener)=>listener(data))},{ok:!0}}async getRegions(){if(!this.matchmaker){let mmConnection=await this.createMatchmaker();if(!mmConnection.ok)return mmConnection}return new Promise((res)=>{let listener=(data)=>{if(data.command==="regionList")this.matchmakerListeners.splice(this.matchmakerListeners.indexOf(listener),1),this.regionList=data.regionList,res({ok:!0,regionList:this.regionList})};this.matchmakerListeners.push(listener),this.matchmaker.send(JSON.stringify({command:"regionList"}))})}async initSession(){if(!this.account.sessionId&&!this.intents.includes(Intents.SKIP_LOGIN)){let anonLogin=await this.loginAnonymously();if(!anonLogin.ok)return anonLogin}if(!this.matchmaker){let mmConnection=await this.createMatchmaker();if(!mmConnection.ok)return mmConnection}return{ok:!0}}async findPublicGame(region,mode){if(typeof region!=="string")return createError(GameFindError.MissingParams);if(!(this.regionList.length?this.regionList:Regions).find((r)=>r.id===region))return createError(GameFindError.InvalidRegion);let computedModeId;if(typeof mode==="number")if(Object.values(GameMode).indexOf(mode)>-1)computedModeId=mode;else return createError(GameFindError.InvalidMode);else if(typeof mode==="string"){let modeEntry=Object.keys(GameMode).find((key)=>key.toLowerCase()===mode.toLowerCase());if(modeEntry)computedModeId=GameMode[modeEntry];else return createError(GameFindError.InvalidMode)}else return createError(GameFindError.InvalidMode);let initInfo=await this.initSession();if(!initInfo.ok)return initInfo;let game=await new Promise((resolve)=>{let listener=(msg)=>{if(msg.command==="notice")return;if(this.matchmakerListeners.splice(this.matchmakerListeners.indexOf(listener),1),msg.command==="gameFound"){if(msg.useAltGameURL)this.state.useAltGameURL=!0;return resolve(msg)}if(msg.error==="sessionNotFound")return resolve(createError(GameFindError.SessionExpired));this.errorLogger("findPublicGame: unknown matchmaker response",JSON.stringify(msg)),resolve(createError(GameFindError.InternalError))};this.matchmakerListeners.push(listener),this.matchmaker.send(JSON.stringify({command:"findGame",region,playType:PlayType.JoinPublic,gameType:computedModeId,sessionId:this.account.sessionId}))});if(!game.ok)return game;return{ok:!0,raw:game,id:game.id,uuid:game.uuid,region:game.region,private:game.private,subdomain:game.subdomain}}async createPrivateGame(region,mode,map){if(typeof region!=="string")return createError(GameFindError.MissingParams);if(!(this.regionList.length?this.regionList:Regions).find((r)=>r.id===region))return createError(GameFindError.InvalidRegion);let computedModeId;if(typeof mode==="number")if(Object.values(GameMode).indexOf(mode)>-1)computedModeId=mode;else return createError(GameFindError.InvalidMode);else if(typeof mode==="string"){let modeEntry=Object.keys(GameMode).find((key)=>key.toLowerCase()===mode.toLowerCase());if(modeEntry)computedModeId=GameMode[modeEntry];else return createError(GameFindError.InvalidMode)}else return createError(GameFindError.InvalidMode);let mapIdx=Maps.findIndex((m)=>m.name.toLowerCase()===map.toLowerCase());if(mapIdx===-1)return createError(GameFindError.InvalidMap);let initInfo=await this.initSession();if(!initInfo.ok)return initInfo;let game=await new Promise((resolve)=>{let listener=(msg)=>{if(msg.command==="notice")return;if(this.matchmakerListeners.splice(this.matchmakerListeners.indexOf(listener),1),msg.command==="gameFound"){if(msg.useAltGameURL)this.state.useAltGameURL=!0;return resolve(msg)}if(msg.error==="sessionNotFound")return resolve(createError(GameFindError.SessionExpired));this.errorLogger("createPrivateGame: unknown matchmaker response",JSON.stringify(msg)),resolve(createError(GameFindError.InternalError))};this.matchmakerListeners.push(listener),this.matchmaker.send(JSON.stringify({command:"findGame",region,playType:PlayType.CreatePrivate,gameType:computedModeId,sessionId:this.account.sessionId,noobLobby:!1,map:mapIdx}))});if(!game.ok)return game;return{ok:!0,raw:game,id:game.id,uuid:game.uuid,region:game.region,private:game.private,subdomain:game.subdomain}}async join(name,data){if(this.state.name=name||"yolkbot",typeof data==="string"){if(data.includes("#"))data=data.split("#")[1];let initInfo=await this.initSession();if(!initInfo.ok)return initInfo;if(await new Promise((resolve)=>{let listener=(message)=>{if(message.command==="gameFound")this.matchmakerListeners.splice(this.matchmakerListeners.indexOf(listener),1),this.game.raw=message,this.game.code=message.id,this.game.region=message.region,resolve(message.id);if(message.error&&message.error==="gameNotFound")this.matchmakerListeners.splice(this.matchmakerListeners.indexOf(listener),1),resolve("gameNotFound")};this.matchmakerListeners.push(listener),this.matchmaker.send(JSON.stringify({command:"joinGame",id:data,observe:!1,sessionId:this.account.sessionId}))})==="gameNotFound")return createError(GameJoinError.GameNotFound);if(!this.game.raw.id)return this.errorLogger("join: invalid game data received from matchmaker:",this.game.raw),createError(GameJoinError.InternalError)}else if(typeof data==="object"){if(!data.id||!data.subdomain||!data.uuid||!data.region)return createError(GameJoinError.InvalidObject);if(this.account.id===0){let anonAttempt=await this.loginAnonymously();if(!anonAttempt.ok)return anonAttempt}this.game.raw=data,this.game.code=this.game.raw.id,this.game.region=this.game.raw.region}else return createError(GameJoinError.MissingParams);let host=this.state.useAltGameURL||this.instance==="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}`,{proxy:this.proxy,errorLogger:this.errorLogger}),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?.inGame)this.$emit("close",e.code),this.leave(-1)}},!await this.game.socket.tryConnect())return createError(GameJoinError.WebSocketConnectFail);return{ok:!0}}#processMovement(ndx,ndy,ndz){this.state.onGround=Math.max(--this.state.onGround,0),this.me.position.x+=ndx,this.me.position.y+=ndy,this.me.position.z+=ndz;let thisBlockX=Math.floor(this.me.position.x),thisBlockY=Math.floor(this.me.position.y),thisBlockZ=Math.floor(this.me.position.z),blockInMyHitbox=this.pathing.nodeList.at(thisBlockX,thisBlockY,thisBlockZ);if(blockInMyHitbox&&!blockInMyHitbox.isAir()){if(!this.climbing&&blockInMyHitbox.isLadder());}if(this.me.climbing);else if(blockInMyHitbox&&blockInMyHitbox.isJumpPad())this.me.position.y+=0.26,this.me.jumping=!0,this.state.onGround=0}#processPathfinding(){let pathLen=this.pathing.activePath.length,lastNode=this.pathing.activePath[pathLen-1],myPos=this.me.position,myFloorY=Math.floor(myPos.y);if(Math.hypot(myPos.x-lastNode.flatCenter.x,myPos.z-lastNode.flatCenter.z)<0.3)this.pathing.activePath=null,this.pathing.activeNode=null,this.pathing.activeNodeIdx=0,this.dispatch(new MovementDispatch_default(0)),this.$emit("pathfindComplete");else{let shouldJump=!1;if(this.pathing.activeNodeIdx<pathLen-1){let currentNode=this.pathing.activePath[this.pathing.activeNodeIdx],nextNode=this.pathing.activePath[this.pathing.activeNodeIdx+1],dx=Math.abs(currentNode.x-nextNode.x),dz=Math.abs(currentNode.z-nextNode.z);if(dx===2&&dz===0||dx===0&&dz===2||dx===2&&dz===1||dx===1&&dz===2||dx===2&&dz===2){let localX=myPos.x-Math.floor(myPos.x),localZ=myPos.z-Math.floor(myPos.z),headingX=nextNode.x>currentNode.x?1:nextNode.x<currentNode.x?-1:0,headingZ=nextNode.z>currentNode.z?1:nextNode.z<currentNode.z?-1:0,distToEdge=0;if(headingX>0)distToEdge=1-localX;else if(headingX<0)distToEdge=localX;else if(headingZ>0)distToEdge=1-localZ;else if(headingZ<0)distToEdge=localZ;if(distToEdge<=0.04)shouldJump=!0}}if(this.pathing.activeNodeIdx<pathLen){let positionTarget=this.pathing.activePath[this.pathing.activeNodeIdx].flatCenter;if(this.state.onGround)this.dispatch(new LookAtPosDispatch_default(positionTarget))}for(let i=this.pathing.activeNodeIdx;i<pathLen;i++){let node=this.pathing.activePath[i];if(node.flatRadialDistance(myPos)<0.1&&node.y===myFloorY){this.pathing.activeNodeIdx=i+1,this.pathing.activeNode=this.pathing.activePath[this.pathing.activeNodeIdx];break}}let movementKeys=Movement.Forward|(shouldJump?Movement.Jump:0);this.dispatch(new MovementDispatch_default(movementKeys))}}update(){if(this.hasQuit)return;if(this.pathing.activePath&&this.intents.includes(Intents.PATHFINDING))this.#processPathfinding();for(let i=this.#dispatches.length-1;i>=0;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,isBufferDebug=this.intents.includes(Intents.DEBUG_BUFFER);if(isBufferDebug)console.log("setting buffer for idx",currentIdx);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,position:isBufferDebug?{...this.me.position}:{}},this.state.shotsFired=0,this.intents.includes(Intents.SIMULATION)){let dx=0,dy=0,dz=0,state=this.state.buffer[currentIdx];if(state.controlKeys&Movement.Left)dx-=Math.cos(state.yaw),dz+=Math.sin(state.yaw);if(state.controlKeys&Movement.Right)dx+=Math.cos(state.yaw),dz-=Math.sin(state.yaw);if(state.controlKeys&Movement.Forward)if(this.me.climbing)dy+=1;else dx-=Math.sin(state.yaw),dz-=Math.cos(state.yaw);if(state.controlKeys&Movement.Backward)if(this.me.climbing)dy-=1;else dx+=Math.sin(state.yaw),dz+=Math.cos(state.yaw);if(state.controlKeys&Movement.Jump)this.state.controlKeys^=this.state.controlKeys&Movement.Jump;if(this.me.climbing)this.me.jumping=!1,dy+=dy*0.028,this.me.position.y+=dy,dy*=0.5,this.#processMovement(0,dy,0);else{let mag=Math.sqrt(dx*dx+dy*dy+dz*dz);if(mag>0){let normDx=dx/mag,normDz=dz/mag;dx=this.state.dx+normDx*0.025,dz=this.state.dz+normDz*0.025}else dx=this.state.dx,dz=this.state.dz;dy=this.state.dy-this.game.options.gravity*0.012,dy=Math.max(-0.29,dy);let oldX=this.me.position.x,oldY=this.me.position.y,oldZ=this.me.position.z;if(this.#processMovement(dx,dy,dz),dx=this.me.position.x-oldX,dy=this.me.position.y-oldY,dz=this.me.position.z-oldZ,this.state.onGround&&dy>0){let n=1-(mag===0?0:dy/mag)*0.5;dx*=n,dz*=n}}if(dx*=0.64,dz*=0.64,this.me.climbing)dy*=0.64;this.state.dx=dx,this.state.dy=dy,this.state.dz=dz}if(this.state.stateIdx%FramesBetweenSyncs===0){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=mod3(this.state.stateIdx-FramesBetweenSyncs+1,StateBufferSize);if(isBufferDebug)console.log("--- START THIS SYNC LOGGING ---");for(let i=0;i<FramesBetweenSyncs;i++){let idx=mod3(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(isBufferDebug)console.log("adding",this.state.stateIdx,startIdx,idx,frame);out.packInt8(keys),out.packInt8(shots),out.packString(coords(yaw,pitch)),out.packInt8(100)}if(out.send(this.game.socket),isBufferDebug)console.log("--- END SYNC LOGGING ---");this.state.buffer=[]}this.state.stateIdx=mod3(this.state.stateIdx+1,StateBufferSize)}if(!this.intents.includes(Intents.PLAYER_HEALTH))return;let regen=0.1*(this.game.isPrivate?this.game.options.healthRegen:1),players=Object.values(this.players);for(let i=0;i<players.length;i++){let player=players[i];if(player.playing&&player.hp>0){let hasOverHeal=player.streakRewards.includes(ShellStreak.OverHeal);player.hp+=hasOverHeal?-regen:regen,player.hp=hasOverHeal?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]}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)}emit(event,...args){let dispatch=DispatchIndex[event];if(dispatch)this.dispatch(new dispatch(...args),!0);else throw Error(`no event found for "${event}"`)}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)}packetHandlers={[CommCode_default.syncThem]:syncThem_default.bind(null,this),[CommCode_default.fire]:fire_default.bind(null,this),[CommCode_default.hitThem]:hitThem_default.bind(null,this),[CommCode_default.syncMe]:syncMe_default.bind(null,this),[CommCode_default.hitMe]:hitMe_default.bind(null,this),[CommCode_default.swapWeapon]:swapWeapon_default.bind(null,this),[CommCode_default.collectItem]:collectItem_default.bind(null,this),[CommCode_default.respawn]:respawn_default.bind(null,this),[CommCode_default.die]:die_default.bind(null,this),[CommCode_default.pause]:pause_default.bind(null,this),[CommCode_default.chat]:chat_default.bind(null,this),[CommCode_default.addPlayer]:addPlayer_default.bind(null,this),[CommCode_default.removePlayer]:removePlayer_default.bind(null,this),[CommCode_default.eventModifier]:eventModifier_default.bind(null,this),[CommCode_default.metaGameState]:metaGameState_default.bind(null,this),[CommCode_default.beginShellStreak]:beginShellStreak_default.bind(null,this),[CommCode_default.endShellStreak]:endShellStreak_default.bind(null,this),[CommCode_default.hitMeHardBoiled]:hitMeHardBoiled_default.bind(null,this),[CommCode_default.gameOptions]:gameOptions_default.bind(null,this),[CommCode_default.ping]:ping_default.bind(null,this),[CommCode_default.switchTeam]:switchTeam_default.bind(null,this),[CommCode_default.changeCharacter]:changeCharacter_default.bind(null,this),[CommCode_default.reload]:reload_default.bind(null,this),[CommCode_default.explode]:explode_default.bind(null,this),[CommCode_default.throwGrenade]:throwGrenade_default.bind(null,this),[CommCode_default.spawnItem]:spawnItem_default.bind(null,this),[CommCode_default.melee]:melee_default.bind(null,this),[CommCode_default.updateBalance]:updateBalance_default.bind(null,this),[CommCode_default.challengeCompleted]:challengeCompleted_default.bind(null,this),[CommCode_default.gameAction]:gameAction_default.bind(null,this),[CommCode_default.socketReady]:socketReady_default.bind(null,this),[CommCode_default.gameJoined]:gameJoined_default.bind(null,this),[CommCode_default.playerInfo]:playerInfo_default.bind(null,this),[CommCode_default.respawnDenied]:()=>{this.me.playing=!1,this.$emit("respawnDenied")},[CommCode_default.requestGameOptions]:()=>{this.game.isPrivate=!0,this.updateGameOptions()},[CommCode_default.expireUpgrade]:()=>{},[CommCode_default.clientReady]:()=>{},[CommCode_default.musicInfo]:()=>CommIn_default.unPackLongString()};processPacket(packet){if(this.hasQuit)return;if(CommIn_default.init(packet),this.intents.includes(Intents.PACKET_HOOK))this.$emit("packet",packet);let lastCommand=0,lastCode=0;while(CommIn_default.isMoreDataAvailable()){let cmd=CommIn_default.unPackInt8U(),handler=this.packetHandlers[cmd];if(handler)handler();else{if(console.error(`processPacket: got but couldn't identify: ${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}).`);break}if(lastCommand=Object.keys(CommCode_default).find((k)=>CommCode_default[k]===cmd),lastCode=cmd,this.intents.includes(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(!response.ok)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,{ok:!0,cw:this.account.cw}}async playChiknWinner(doPrematureCooldownCheck=!0){if(this.account.cw.atLimit||this.account.cw.limit>ChiknWinnerDailyLimit)return createError(ChicknWinnerError.HitDailyLimit);if(this.account.cw.canPlayAgain>Date.now()&&doPrematureCooldownCheck)return createError(ChicknWinnerError.OnCooldown);let response=await this.api.queryServices({cmd:"incentivizedVideoReward",firebaseId:this.account.firebaseId,id:this.account.id,sessionId:this.account.sessionId,token:null});if(!response.ok)return response;if(response.error){if(response.error==="RATELIMITED"||response.error==="RATELMITED")return await this.checkChiknWinner(),createError(ChicknWinnerError.OnCooldown);else if(response.error==="SESSION_EXPIRED")return this.$emit("sessionExpired"),createError(ChicknWinnerError.SessionExpired);return this.errorLogger("unknown Chikn Winner response, report this on Github:",response),createError(ChicknWinnerError.InternalError)}if(response.reward)return this.account.eggBalance+=response.reward.eggsGiven,response.reward.itemIds.forEach((id)=>this.account.ownedItemIds.push(id)),await this.checkChiknWinner(),{ok:!0,...response.reward};return this.errorLogger("unknown Chikn Winner response, report this on Github:",response),createError(ChicknWinnerError.InternalError)}async resetChiknWinner(){if(this.account.eggBalance<200)return createError(ChicknWinnerError.NotEnoughResetEggs);if(!this.account.cw.atLimit)return createError(ChicknWinnerError.NotAtDailyLimit);let response=await this.api.queryServices({cmd:"chwReset",sessionId:this.account.sessionId});if(!response.ok)return response;if(response.result!=="SUCCESS")return this.errorLogger("unknown Chikn Winner reset response, report this on Github:",response),createError(ChicknWinnerError.InternalError);return this.account.eggBalance-=200,await this.checkChiknWinner(),{ok:!0,cw:this.account.cw}}canSee(target){if(!this.intents.includes(Intents.PATHFINDING))throw Error("canSee: you need enable the PATHFINDING intent");return this.pathing.nodeList.hasLineOfSight(this.me.position,target.position)}getBestTarget(){let distancePlayers=Object.values(this.players).filter((player)=>player?.playing).filter((player)=>player.hp>0).filter((player)=>player.id!==this.me.id).filter((player)=>this.me.team===0||player.team!==this.me.team).map((player)=>({player,distance:(player.position.x-this.me.position.x)**2+5*(player.position.y-this.me.position.y)**2+(player.position.z-this.me.position.z)**2})).sort((a,b)=>a.distance-b.distance);if(distancePlayers.length)return distancePlayers[0].player;else return null}async refreshChallenges(){let result=await this.api.queryServices({cmd:"challengeGetDaily",sessionId:this.account.sessionId,playerId:this.account.id});if(!result.ok)return result;return this.#importChallenges(result),{ok:!0,challenges:this.account.challenges}}async rerollChallenge(challengeId){let result=await this.api.queryServices({cmd:"challengeRerollSlot",sessionId:this.account.sessionId,slotId:challengeId});if(!result.ok)return result;if(result["0"])return this.#importChallenges(Object.values(result)),{ok:!0,challenges:this.account.challenges};if(Object.values(ChallengeRerollError).includes(result.error))return{ok:!1,error:result.error};return this.errorLogger("rerollChallenge: unknown error response",result),{ok:!1,error:ChallengeRerollError.InternalError}}async claimChallenge(challengeId){let result=await this.api.queryServices({cmd:"challengeClaimReward",sessionId:this.account.sessionId,slotId:challengeId});if(!result.ok)return result;if(result.reward){if(this.#importChallenges(result.challenges),result.reward>0)this.account.eggBalance+=result.reward;return{ok:!0,eggReward:result.reward,updatedChallenges:this.account.challenges}}if(Object.values(ChallengeClaimError).includes(result.error))return{ok:!1,error:result.error};return this.errorLogger("claimChallenge: unknown error response",result),{ok:!1,error:ChallengeClaimError.InternalError}}async refreshBalance(){let result=await this.api.queryServices({cmd:"checkBalance",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId});if(!result.ok)return result;return this.account.eggBalance=result.currentBalance,{ok:!0,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(!result.ok)return result;if(result.result==="SUCCESS")return this.account.eggBalance+=result.eggs_given,result.item_ids.forEach((id)=>this.account.ownedItemIds.push(id)),{ok:!0,eggsGiven:result.eggs_given,itemIds:result.item_ids};if(Object.values(RedeemCodeError).includes(result.result))return{ok:!1,error:result.result};return this.errorLogger("redeemCode: unknown error response",result),{ok:!1,error:RedeemCodeError.InternalError}}async claimURLReward(reward){let result=await this.api.queryServices({cmd:"urlRewardParams",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,reward});if(!result.ok)return result;if(result.result==="SUCCESS")return this.account.eggBalance+=result.eggsGiven,result.itemIds.forEach((id)=>this.account.ownedItemIds.push(id)),{ok:!0,eggsGiven:result.eggsGiven,itemIds:result.itemIds};if(Object.values(ClaimURLError).includes(result.result))return{ok:!1,error:result.result};return this.errorLogger("claimURLReward: unknown error response",result),{ok:!1,error:ClaimURLError.InternalError}}async claimSocialReward(rewardTag){let result=await this.api.queryServices({cmd:"reward",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,rewardTag});if(!result.ok)return result;if(result.result==="SUCCESS")return this.account.eggBalance+=result.eggsGiven,result.itemIds.forEach((id)=>this.account.ownedItemIds.push(id)),{ok:!0,eggsGiven:result.eggsGiven,itemIds:result.itemIds};if(Object.values(ClaimSocialError).includes(result.result))return{ok:!1,error:result.result};return this.errorLogger("claimSocialReward: unknown error response",result),{ok:!1,error:ClaimSocialError.InternalError}}async buyItem(itemId){let result=await this.api.queryServices({cmd:"buy",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,itemId,save:!0});if(!result.ok)return result;if(result.result==="SUCCESS")return this.account.eggBalance=result.currentBalance,this.account.ownedItemIds.push(result.itemId),{ok:!0,itemId:result.itemId,currentBalance:result.currentBalance};if(Object.values(BuyItemError).includes(result.result))return{ok:!1,error:result.result};return this.errorLogger("buyItem: unknown error response",result),{ok:!1,error:BuyItemError.InternalError}}leave(code=CloseCode_default.mainMenu){if(this.hasQuit)return;if(this.state.inGame=!1,code>-1)this.game?.socket?.close(code),this.$emit("leave",code);if(this.updateIntervalId)clearInterval(this.updateIntervalId);if(this.pingTimeoutId)clearTimeout(this.pingTimeoutId);this.#dispatches=[],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.pathing={nodeList:null,activePath:null,activeNode:null,activeNodeIdx:0}}logout(){if(this.account=this.#initialAccount,this.intents.includes(Intents.RENEW_SESSION))clearInterval(this.renewSessionInterval)}quit(cleanupLevel=CleanupLevel.Partial){if(this.hasQuit)return;if(this.hasQuit=!0,this.leave(),this.matchmaker){try{this.matchmaker.close()}catch{}if(cleanupLevel>=CleanupLevel.Partial)this.matchmaker=null}if(this.intents.includes(Intents.NO_AFK_KICK))clearInterval(this.afkKickInterval);if(this.intents.includes(Intents.RENEW_SESSION))clearInterval(this.renewSessionInterval);if(this.pingTimeoutId)clearTimeout(this.pingTimeoutId);if(cleanupLevel>=CleanupLevel.Partial){if(this.api=null,this.packetHandlers=null,this.pathing=null,this.#initialAccount={},this.#initialGame={},this.#hooks={},this.#globalHooks=[],this.#dispatches=[],this.matchmakerListeners=[],cleanupLevel>=CleanupLevel.Full)this.account=null,this.game=null,this.me=null,this.players=null,this.state=null}}}var bot_default=Bot;var Comm={CommIn,CommOut},src_default=bot_default;export{yolkws,exports_util as util,iFetch,globals,src_default as default,exports_direct as WASM,Regions,Maps,Items,exports_guns as Guns,GamePlayer,exports_enums as Enums,dispatches_default as Dispatches,exports_constants as Constants,CommCode,Comm,CloseCode,Challenges,Bot,API};