yolkbot 1.0.13 → 1.0.14

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.
package/dist/bot.js CHANGED
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import H from"./api.js";import s from"./comm/CommIn.js";import f from"./comm/CommOut.js";import{CloseCode as z}from"./comm/Codes.js";import{CommCode as c}from"./constants/codes.js";import U from"./bot/GamePlayer.js";import W from"./matchmaker.js";import j from"./socket.js";import{ChiknWinnerDailyLimit as q,CollectTypes as x,CoopStates as y,findItemById as d,FramesBetweenSyncs as w,GameActions as T,GameModes as g,GameOptionFlags as E,GunList as K,ItemTypes as $,Movements as G,PlayTypes as Y,ProxiesEnabled as Z,ShellStreaks as m,StateBufferSize as b}from"./constants/index.js";import R from"./dispatches/LookAtPosDispatch.js";import F from"./dispatches/MovementDispatch.js";import{NodeList as Q}from"./pathing/mapnode.js";import{coords as X}from"./wasm/wrapper.js";import{fetchMap as J,initKotcZones as V}from"./util.js";import{Challenges as tt}from"./constants/challenges.js";import{Maps as P}from"./constants/maps.js";const M=Object.fromEntries(Object.entries(y).map(([I,t])=>[t,I])),A=Object.fromEntries(Object.entries(g).map(([I,t])=>[t,I])),B={CHALLENGES:1,STATS:2,PATHFINDING:3,PING:5,COSMETIC_DATA:6,PLAYER_HEALTH:7,PACKET_HOOK:8,LOG_PACKETS:10,NO_LOGIN:11,DEBUG_BUFFER:12,DEBUG_BEST_TARGET:14},S=(I,t)=>(I%t+t)%t;class et{static Intents=B;Intents=B;#e=[];#t={};#i=[];#n;#o;constructor(t={}){t.proxy&&!Z&&this.processError("proxies do not work and hence are not supported in the browser"),this.intents=t.intents||[],this.intents.includes(this.Intents.COSMETIC_DATA)&&(d(1001)||this.processError("you cannot use the COSMETIC_DATA intent inside of the singlefile browser bundles")),this.instance=t.instance||"shellshock.io",this.protocol=t.protocol||"wss",this.proxy=t.proxy||"",this.httpProxy=t.httpProxy||"",this.state={name:"yolkbot",weaponIdx:0,inGame:!1,reloading:!1,swappingGun:!1,usingMelee:!1,stateIdx:0,serverStateIdx:0,shotsFired:0,buffer:[],left:!1,quit:!1},this.players={},this.me=new U({}),this.game={raw:{},code:"",socket:null,gameModeId:0,gameMode:A[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:y.capturing,zoneNumber:0,activeZone:[],capturing:0,captureProgress:0,numCapturing:0,stageName:"",capturePercent:0},this.#o=this.game,this.account={id:0,firebaseId:"",sessionId:"",session:"",email:"",password:"",cw:{atLimit:!1,limit:0,secondsUntilPlay:0,canPlayAgain:Date.now()},loadout:{hatId:null,meleeId:0,stampId:null,classIdx:0,colorIdx:0,grenadeId:0,primaryId:[3100,3600,3400,3800,4e3,4200,4500],secondaryId:new Array(7).fill(3e3),stampPositionX:0,stampPositionY:0},ownedItemIds:[],vip:!1,accountAge:0,emailVerified:!1,eggBalance:0,rawLoginData:{}},this.#n=this.account,this.matchmaker=null,this.api=new H({instance:this.instance,protocol:this.protocol,proxy:this.proxy,httpProxy:this.httpProxy,maxRetries:t?.apiMaxRetries}),this.ping=0,this.lastPingTime=-1,this.lastDeathTime=-1,this.lastChatTime=-1,this.lastUpdateTick=0,this.controlKeys=0,this.pathing={nodeList:null,followingPath:!1,activePath:null,activeNode:null,activeNodeIdx:0},this.hasQuit=!1}dispatch(t){t.check(this)?t.execute(this):this.#e.push(t)}async createAccount(t,e){this.account.email=t,this.account.password=e;const a=await this.api.createAccount(t,e);return this.#s(a)}async login(t,e){this.account.email=t,this.account.password=e;const a=await this.api.loginWithCredentials(t,e);return this.#s(a)}async loginWithRefreshToken(t){const e=await this.api.loginWithRefreshToken(t);return this.#s(e)}async loginAnonymously(){delete this.account.email,delete this.account.password;const t=await this.api.loginAnonymously();return this.#s(t)}#s(t){return typeof t!="object"?(this.emit("authFail",t),!1):t.banRemaining?(this.emit("banned",t.banRemaining),!1):t.playerOutput?(t=t.playerOutput,this.account.rawLoginData=t,this.account.accountAge=t.accountAge,this.account.eggBalance=t.currentBalance,this.account.emailVerified=t.emailVerified,this.account.firebaseId=t.firebaseId,this.account.id=t.id,this.account.loadout=t.loadout,this.account.ownedItemIds=t.ownedItemIds,this.account.session=t.session,this.account.sessionId=t.sessionId,this.account.vip=t.upgradeProductId&&!t.upgradeIsExpired,this.intents.includes(this.Intents.STATS)&&(this.account.stats={lifetime:t.statsLifetime,monthly:t.statsCurrent}),this.intents.includes(this.Intents.CHALLENGES)&&this.#a(t.challenges),this.emit("authSuccess",this.account),this.account):(this.emit("authFail",t),!1)}#a(t){this.account.challenges=[];for(const e of t){const a=tt.find(i=>i.id===e.challengeId);a&&(delete e.playerId,this.account.challenges.push({raw:{challengeInfo:a,challengeData:e},id:e.challengeId,name:a.loc.title,desc:a.loc.desc,rewardEggs:a.reward,isRerolled:!!e.reset,isClaimed:!!e.claimed,isCompleted:!!e.completed,progressNum:e.progress,goalNum:a.goal}))}}async initMatchmaker(){return!this.account.sessionId&&!this.intents.includes(this.Intents.NO_LOGIN)&&!await this.loginAnonymously()?!1:(this.matchmaker||(this.matchmaker=new W({sessionId:this.account.sessionId,proxy:this.proxy,instance:this.instance,protocol:this.protocol,noLogin:this.intents.includes(this.Intents.NO_LOGIN),api:this.api}),this.matchmaker.on("authFail",t=>this.emit("authFail",t)),this.matchmaker.on("error",t=>this.processError(t)),await this.matchmaker.getRegions()),!0)}async#c(t){return await this.initMatchmaker()?(await this.matchmaker.waitForConnect(),await new Promise(e=>{const a=i=>{i.command==="gameFound"&&(this.matchmaker.off("msg",a),this.game.raw=i,this.game.code=i.id,e()),i.error&&i.error==="gameNotFound"&&(this.processError(`Game ${t} not found (likely expired).`),this.leave())};this.matchmaker.on("msg",a),this.matchmaker.send({command:"joinGame",id:t,observe:!1,sessionId:this.account.sessionId})})):!1}async findPublicGame(t){return this.matchmaker||this.initMatchmaker(),this.matchmaker?await this.matchmaker.findPublicGame(t):!1}async createPrivateGame(t={}){if(!await this.initMatchmaker())return!1;if(!t.region&&!this.matchmaker.regionList&&!this.matchmaker.regionList.length)return this.processError("pass a region to createPrivateGame or call getRegions() for a random one");if(t.region||(t.region=this.matchmaker.getRandomRegion()),!t.mode)return this.processError("pass a mode to createPrivateGame");if(typeof g[t.mode]!="number")return this.processError("invalid mode passed to createPrivateGame, see GameModes for a list");t.map||(t.map=P[P.length*Math.random()|0].name);const e=P.find(n=>n.name.toLowerCase()===t.map.toLowerCase()),a=P.indexOf(e);return a===-1?this.processError("invalid map, see the Maps constant for a list"):(await this.matchmaker.waitForConnect(),await new Promise(n=>{const o=r=>{r.command==="gameFound"&&(this.matchmaker.off("msg",o),n(r))};this.matchmaker.on("msg",o),this.matchmaker.send({command:"findGame",region:t.region,playType:Y.createPrivate,gameType:g[t.mode],sessionId:this.account.sessionId,noobLobby:!1,map:a})}))}async join(t,e){if(this.state.name=t||"yolkbot",typeof e=="string"?(e.includes("#")&&(e=e.split("#")[1]),await this.#c(e)):typeof e=="object"&&(this.account.id===0&&await this.loginAnonymously(),this.game.raw=e,this.game.code=this.game.raw.id),!this.game.raw.id)return this.processError("invalid game data passed to <bot>.join");const a=async()=>{try{const i=this.instance.startsWith("localhost:")?this.instance:`${this.game.raw.subdomain}.${this.instance}`;this.game.socket=new j(`${this.protocol}://${i}/game/${this.game.raw.id}`,this.proxy),this.game.socket.onerror=async n=>(this.processError(n),await new Promise(o=>setTimeout(o,100)),await a())}catch{await new Promise(i=>setTimeout(i,100)),await a()}};await a(),this.game.socket.binaryType="arraybuffer",this.game.socket.onopen=()=>this.game.socket.onerror=null,this.game.socket.onmessage=i=>this.processPacket(i.data),this.game.socket.onclose=i=>{this.state.left?this.state.left=!1:(this.emit("close",i.code),this.leave(-1))}}#r(){if(Object.entries(this.me.position).map(e=>Math.floor(e[1])).join(",")===this.pathing.activePath[this.pathing.activePath.length-1].positionStr)this.pathing.followingPath=!1,this.pathing.activePath=null,this.pathing.activeNode=null,this.pathing.activeNodeIdx=0,this.dispatch(new F(0));else{let e;this.pathing.activeNodeIdx<this.pathing.activePath.length-1?(e=this.pathing.activePath[this.pathing.activeNodeIdx+1].flatCenter(),this.dispatch(new R(e))):(e=this.pathing.activePath[this.pathing.activeNodeIdx].flatCenter(),this.dispatch(new R(e)));for(const a of this.pathing.activePath)if(a.flatRadialDistance(this.me.position)<.1&&a.position.y===Math.floor(this.me.position.y)&&this.pathing.activePath.indexOf(a)>=this.pathing.activeNodeIdx){this.pathing.activeNodeIdx=this.pathing.activePath.indexOf(a)+1,this.pathing.activeNode=this.pathing.activePath[this.pathing.activeNodeIdx];break}this.controlKeys&G.FORWARD||this.dispatch(new F(G.FORWARD))}}update(){if(!this.hasQuit){if(this.pathing.followingPath&&this.intents.includes(this.Intents.PATHFINDING)&&this.#r(),this.#e.length>0)for(let t=0;t<this.#e.length;t++){const e=this.#e[t];e.check(this)&&(e.execute(this),this.#e.splice(t,1))}if(this.me.playing){const t=this.state.stateIdx;if(this.intents.includes(this.Intents.DEBUG_BUFFER)&&(console.log("setting buffer for idx",t),console.log("checking...shotsFired",this.state.shotsFired)),this.state.buffer[t]={controlKeys:this.controlKeys,yaw:this.me.view.yaw,pitch:this.me.view.pitch,shotsFired:this.state.shotsFired},this.state.shotsFired=0,this.lastUpdateTick>=2){this.emit("tick");const e=f.getBuffer();e.packInt8(c.syncMe),e.packInt8(this.state.stateIdx),e.packInt8(this.state.serverStateIdx);const a=S(this.state.stateIdx-w+1,b);for(let i=0;i<w;i++){const n=S(a+i,b);this.intents.includes(this.Intents.DEBUG_BUFFER)&&console.log("going with",this.state.stateIdx,a,n,this.state.buffer[n]),e.packInt8(this.state.buffer[n]?.controlKeys||0),e.packInt8(this.state.buffer[n]?.shotsFired||0);const o=this.state.buffer[n]?.yaw||this.me.view.yaw,r=this.state.buffer[n]?.pitch||this.me.view.pitch,u=X(o,r);e.packString(u),e.packInt8(100)}e.send(this.game.socket),this.state.buffer=[],this.lastUpdateTick=0}else this.lastUpdateTick++;this.state.stateIdx=S(this.state.stateIdx+1,b)}if(this.intents.includes(this.Intents.PLAYER_HEALTH))for(const t of Object.values(this.players)){if(t.playing&&t.hp>0){const e=.1*(this.game.isPrivate?this.game.options.healthRegen:1);t.streakRewards.includes(m.OverHeal)?t.hp=Math.max(100,t.hp-e):t.hp=Math.min(100,t.hp+e)}t.spawnShield>0&&(t.spawnShield-=6)}}}on(t,e){Object.keys(this.#t).includes(t)?this.#t[t].push(e):this.#t[t]=[e]}onAny(t){this.#i.push(t)}off(t,e){e?this.#t[t]=this.#t[t].filter(a=>a!==e):this.#t[t]=[]}emit(t,...e){if(!this.hasQuit){if(this.#t[t])for(const a of this.#t[t])a(...e);for(const a of this.#i)a(t,...e)}}#h(){const t=s.unPackInt8U(),e=s.unPackInt8U(),a=s.unPackString().valueOf(),i=this.players[t];this.emit("chat",i,a,e)}#l(){const t=s.unPackInt8U(),e=this.intents.includes(this.Intents.COSMETIC_DATA),a={id:t,uniqueId:s.unPackString(),name:s.unPackString(),safename:s.unPackString(),charClass:s.unPackInt8U(),team:s.unPackInt8U(),primaryWeaponItem:e?d(s.unPackInt16U()):s.unPackInt16U(),secondaryWeaponItem:e?d(s.unPackInt16U()):s.unPackInt16U(),shellColor:s.unPackInt8U(),hatItem:e?d(s.unPackInt16U()):s.unPackInt16U(),stampItem:e?d(s.unPackInt16U()):s.unPackInt16U(),stampPosX:s.unPackInt8(),stampPosY:s.unPackInt8(),grenadeItem:e?d(s.unPackInt16U()):s.unPackInt16U(),meleeItem:e?d(s.unPackInt16U()):s.unPackInt16U(),x:s.unPackFloat(),y:s.unPackFloat(),z:s.unPackFloat(),$dx:s.unPackFloat(),$dy:s.unPackFloat(),$dz:s.unPackFloat(),yaw:s.unPackRadU(),pitch:s.unPackRad(),score:s.unPackInt32U(),kills:s.unPackInt16U(),deaths:s.unPackInt16U(),streak:s.unPackInt16U(),totalKills:s.unPackInt32U(),totalDeaths:s.unPackInt32U(),bestGameStreak:s.unPackInt16U(),bestOverallStreak:s.unPackInt16U(),shield:s.unPackInt8U(),hp:s.unPackInt8U(),playing:s.unPackInt8U(),weaponIdx:s.unPackInt8U(),$controlKeys:s.unPackInt8U(),upgradeProductId:s.unPackInt8U(),activeShellStreaks:s.unPackInt8U(),social:s.unPackLongString(),hideBadge:s.unPackInt8U()};s.unPackInt8U(),s.unPackInt8U(),s.unPackInt8U(),this.players[a.id]||(this.players[a.id]=new U(a)),this.emit("playerJoin",this.players[a.id]),this.me.id===a.id&&(this.me=this.players[a.id],this.emit("botJoined",this.me))}#m(){const t=s.unPackInt8U(),e=s.unPackInt16U(),a=s.unPackFloat(),i=s.unPackFloat(),n=s.unPackFloat(),o=s.unPackInt8U(),r=s.unPackInt8U(),u=s.unPackInt8U(),p=s.unPackInt8U(),k=s.unPackInt8U(),h=this.players[t];h&&(h.playing=!0,h.randomSeed=e,h.weapons[0]&&h.weapons[0].ammo&&(h.weapons[0].ammo.rounds=o),h.weapons[0]&&h.weapons[0].ammo&&(h.weapons[0].ammo.store=r),h.weapons[1]&&h.weapons[1].ammo&&(h.weapons[1].ammo.rounds=u),h.weapons[1]&&h.weapons[1].ammo&&(h.weapons[1].ammo.store=p),h.grenades=k,h.position={x:a,y:i,z:n},h.spawnShield=120,this.emit("playerRespawn",h))}#u(){const t=s.unPackInt8U(),e=s.unPackFloat(),a=s.unPackFloat(),i=s.unPackFloat(),n=s.unPackInt8U(),o=this.players[t];if(!o||o.id===this.me.id){for(let p=0;p<w;p++)s.unPackInt8U(),s.unPackRadU(),s.unPackRad(),s.unPackInt8U();return}for(let p=0;p<w-1;p++)s.unPackInt8U(),s.unPackRadU(),s.unPackRad(),s.unPackInt8U();s.unPackInt8U();const r=s.unPackRadU();o.view.yaw=r;const u=s.unPackRad();o.view.pitch=u,s.unPackInt8U(),o.position.x!==e&&(o.position.x=e),o.position.z!==i&&(o.position.z=i),(!o.jumping||Math.abs(o.position.y-a)>.5&&o.position.y!==a)&&(o.position.y=a),o.climbing!==n&&(o.climbing=n)}#d(){const t=s.unPackInt8U(),e=this.players[t];e&&(e.playing=!1,this.emit("playerPause",e))}#p(){const t=s.unPackInt8U(),e=s.unPackInt8U(),a=this.players[t];a&&(a.activeGun=e,this.emit("playerSwapWeapon",a,e))}#g(){const t=s.unPackInt8U(),e=s.unPackInt8U();s.unPackInt8U(),s.unPackInt8U(),s.unPackInt8U();const a=this.players[t],i=this.players[e];a&&(a.playing=!1,a.streak=0,a.lastDeathTime=Date.now(),a.hp=100,a.spawnShield=0),i&&i.streak++,this.emit("playerDeath",a,i)}#k(){const t=s.unPackInt8U();for(let i=0;i<6;i++)s.unPackFloat();const e=this.players[t];if(!e)return;const a=e.weapons[e.activeGun];a&&a.ammo&&(a.ammo.rounds--,this.emit("playerFire",e,a))}#f(){const t=s.unPackInt16U(),e=s.unPackInt8U(),a=s.unPackFloat(),i=s.unPackFloat(),n=s.unPackFloat();this.game.collectables[e].push({id:t,x:a,y:i,z:n}),this.emit("spawnItem",e,t,{x:a,y:i,z:n})}#I(){const t=s.unPackInt8U(),e=s.unPackInt8U(),a=s.unPackInt8U(),i=s.unPackInt16U(),n=this.players[t];if(this.game.collectables[e]=this.game.collectables[e].filter(o=>o.id!==i),e===x.AMMO){const o=n.weapons[a];o&&o.ammo&&(o.ammo.store=Math.min(o.ammo.storeMax,o.ammo.store+o.ammo.pickup),this.emit("collectAmmo",n,o))}e===x.GRENADE&&(n.grenades++,n.grenades>3&&(n.grenades=3),this.emit("collectGrenade",n))}#P(){const t=s.unPackInt8U(),e=s.unPackInt8U(),a=this.players[t];if(!a)return;const i=a.hp;a.hp=e,this.emit("playerDamaged",a,i,a.hp)}#y(){const t=s.unPackInt8U();s.unPackFloat(),s.unPackFloat();const e=this.me.hp;this.me.hp=t,this.emit("selfDamaged",e,this.me.hp)}#w(){const t=s.unPackInt8U(),e=this.players[t];s.unPackInt8U();const a=s.unPackInt8U(),i=s.unPackFloat(),n=s.unPackFloat(),o=s.unPackFloat();if(s.unPackInt8U(),s.unPackInt8U(),s.unPackInt8U(),!e)return;this.state.serverStateIdx=a;const r=e.position.x,u=e.position.y,p=e.position.z;e.position.x=i,e.position.y=n,e.position.z=o,(r!==i||u!==n||p!==o)&&this.emit("selfMoved",e,{x:r,y:u,z:p},{x:i,y:n,z:o})}#U(){const t=f.getBuffer();t.packInt8(c.eventModifier),t.send(this.game.socket)}#b(){const t=s.unPackInt8U(),e={...this.players[t]};delete this.players[t.toString()],this.emit("playerLeave",e)}#S(){if(this.game.gameModeId===g.spatula){this.game.teamScore[1]=s.unPackInt16U(),this.game.teamScore[2]=s.unPackInt16U();const t={x:s.unPackFloat(),y:s.unPackFloat(),z:s.unPackFloat()},e=s.unPackInt8U(),a=s.unPackInt8U();this.game.spatula={coords:t,controlledBy:e,controlledByTeam:a},this.emit("gameStateChange",this.game)}else this.game.gameModeId===g.kotc?(this.game.stage=s.unPackInt8U(),this.game.zoneNumber=s.unPackInt8U(),this.game.capturing=s.unPackInt8U(),this.game.captureProgress=s.unPackInt16U(),this.game.numCapturing=s.unPackInt8U(),this.game.teamScore[1]=s.unPackInt8U(),this.game.teamScore[2]=s.unPackInt8U(),this.game.stageName=M[this.game.stage],this.game.capturePercent=this.game.captureProgress/1e3,this.game.activeZone=this.game.map.zones?this.game.map.zones[this.game.zoneNumber-1]:null,this.emit("gameStateChange",this.game)):this.game.gameModeId===g.team&&(this.game.teamScore[1]=s.unPackInt16U(),this.game.teamScore[2]=s.unPackInt16U());this.game.gameModeId!==g.spatula&&delete this.game.spatula,this.game.gameModeId!==g.kotc&&(delete this.game.stage,delete this.game.zoneNumber,delete this.game.capturing,delete this.game.captureProgress,delete this.game.numCapturing,delete this.game.stageName,delete this.game.numCapturing,delete this.game.activeZone),this.game.gameModeId===g.ffa&&delete this.game.teamScore}#v(){const t=s.unPackInt8U(),e=s.unPackInt8U(),a=this.players[t];switch(e){case m.HardBoiled:t===this.me.id&&(this.me.shieldHp=100),a.streakRewards.push(m.HardBoiled);break;case m.EggBreaker:a.streakRewards.push(m.EggBreaker);break;case m.Restock:{a.grenades=3,a.weapons[0]&&a.weapons[0].ammo&&(a.weapons[0].ammo.rounds=a.weapons[0].ammo.capacity,a.weapons[0].ammo.store=a.weapons[0].ammo.storeMax),a.weapons[1]&&a.weapons[1].ammo&&(a.weapons[1].ammo.rounds=a.weapons[1].ammo.capacity,a.weapons[1].ammo.store=a.weapons[1].ammo.storeMax);break}case m.OverHeal:a.hp=Math.min(200,a.hp+100),a.streakRewards.push(m.OverHeal);break;case m.DoubleEggs:a.streakRewards.push(m.DoubleEggs);break;case m.MiniEgg:a.streakRewards.push(m.MiniEgg);break}this.emit("playerBeginStreak",a,e)}#C(){const t=s.unPackInt8U(),e=s.unPackInt8U(),a=this.players[t];[m.EggBreaker,m.OverHeal,m.DoubleEggs,m.MiniEgg].includes(e)&&a.streakRewards.includes(e)&&(a.streakRewards=a.streakRewards.filter(n=>n!==e)),this.emit("playerEndStreak",e,a)}#x(){const t=s.unPackInt8U(),e=s.unPackInt8U();s.unPackFloat(),s.unPackFloat(),this.me.shieldHp=t,this.me.hp=e,this.me.shieldHp<=0?(this.me.streakRewards=this.me.streakRewards.filter(a=>a!==m.HardBoiled),this.emit("selfShieldLost")):this.emit("selfShieldHit",this.me.shieldHp)}#T(){const t={...this.game.options};let e=s.unPackInt8U(),a=s.unPackInt8U(),i=s.unPackInt8U();(e<1||e>4)&&(e=4),(a<0||a>8)&&(a=4),i>16&&(i=4),this.game.options.gravity=e/4,this.game.options.damage=a/4,this.game.options.healthRegen=i/4;const n=s.unPackInt8U();return Object.keys(E).forEach(o=>{const r=n&E[o]?1:0;this.game.options[o]=r}),this.game.options.weaponsDisabled=Array.from({length:7},()=>s.unPackInt8U()===1),this.game.options.mustUseSecondary=this.game.options.weaponsDisabled.every(o=>o),this.emit("gameOptionsChange",t,this.game.options),!1}#E(){const t=s.unPackInt8U();t===T.pause&&(this.emit("gameForcePause"),setTimeout(()=>this.me.playing=!1,3e3)),t===T.reset&&(Object.values(this.players).forEach(e=>e.streak=0),this.game.gameModeId!==g.ffa&&(this.game.teamScore=[0,0,0]),this.game.gameModeId===g.spatula&&(this.game.spatula.controlledBy=0,this.game.spatula.controlledByTeam=0,this.game.spatula.coords={x:0,y:0,z:0}),this.game.gameModeId===g.kotc&&(this.game.stage=y.capturing,this.game.zoneNumber=0,this.game.activeZone=null,this.game.capturing=0,this.game.captureProgress=0,this.game.numCapturing=0,this.game.stageName=M[y.capturing],this.game.capturePercent=0),this.emit("gameReset"))}#G(){if(!this.intents.includes(this.Intents.PING))return;const t=this.ping;this.ping=Date.now()-this.lastPingTime,this.emit("pingUpdate",t,this.ping),setTimeout(()=>{const e=f.getBuffer();e.packInt8(c.ping),e.send(this.game.socket),this.lastPingTime=Date.now()},1e3)}#R(){const t=s.unPackInt8U(),e=s.unPackInt8U(),a=this.players[t];if(!a)return;const i=a.team;a.team=e,a.streak=0,this.emit("playerSwitchTeam",a,i,e)}#F(){const t=s.unPackInt8U(),e=s.unPackInt8U(),a=s.unPackInt16U(),i=s.unPackInt16U(),n=s.unPackInt8U(),o=s.unPackInt16U(),r=s.unPackInt16U(),u=s.unPackInt16U(),p=s.unPackInt16U();s.unPackInt8(),s.unPackInt8();const k=this.intents.includes(this.Intents.COSMETIC_DATA),h=k?d(a):a,O=k?d(i):i,L=k?d(o):o,N=k?d(r):r,D=k?d(u):u,_=k?d(p):p,l=this.players[t];if(l){const v={...l.character},C=l.selectedGun;l.character.eggColor=n,l.character.primaryGun=h,l.character.secondaryGun=O,l.character.stamp=N,l.character.hat=L,l.character.grenade=D,l.character.melee=_,l.selectedGun=e,l.weapons[0]=new K[e],C!==l.selectedGun&&this.emit("playerChangeGun",l,C,l.selectedGun),v!==l.character&&this.emit("playerChangeCharacter",l,v,l.character)}}#M(){const t=s.unPackInt32U(),e=this.account.eggBalance;this.account.eggBalance=t,this.emit("balanceUpdate",t-e,t)}#A(){this.me.playing=!1,this.emit("selfRespawnFail")}#B(){const t=s.unPackInt8U(),e=this.players[t];e&&this.emit("playerMelee",e)}#O(){const t=s.unPackInt8U(),e=this.players[t];if(!e)return;const a=e.weapons[e.activeGun];if(a.ammo){const i=Math.min(Math.min(a.ammo.capacity,a.ammo.reload)-a.ammo.rounds,a.ammo.store);a.ammo.rounds+=i,a.ammo.store-=i}this.emit("playerReload",e,a)}#L(){const t=f.getBuffer();t.packInt8(c.gameOptions),t.packInt8(this.game.options.gravity*4),t.packInt8(this.game.options.damage*4),t.packInt8(this.game.options.healthRegen*4);const e=(this.game.options.locked?1:0)|(this.game.options.noTeamChange?2:0)|(this.game.options.noTeamShuffle?4:0);t.packInt8(e),this.game.options.weaponsDisabled.forEach(a=>{t.packInt8(a?1:0)}),t.send(this.game.socket)}#N(){const t=s.unPackInt8U();let e=s.unPackInt16U();const a=s.unPackFloat(),i=s.unPackFloat(),n=s.unPackFloat(),o=s.unPackInt8U(),r=s.unPackFloat();this.intents.includes(this.Intents.COSMETIC_DATA)&&(e=d(e)),t===$.Grenade?this.emit("grenadeExploded",e,{x:a,y:i,z:n},o,r):this.emit("rocketHit",{x:a,y:i,z:n},o,r)}#D(){const t=s.unPackInt8U(),e=s.unPackFloat(),a=s.unPackFloat(),i=s.unPackFloat(),n=s.unPackFloat(),o=s.unPackFloat(),r=s.unPackFloat(),u=this.players[t];u&&(u.grenades--,this.emit("playerThrowGrenade",u,{x:e,y:a,z:i},{x:n,y:o,z:r}))}#_(){const t=s.unPackInt8U(),e=s.unPackInt8U(),a=this.players[t];if(!a)return;if(!this.intents.includes(this.Intents.CHALLENGES))return this.emit("challengeComplete",a,e);const i=this.account.challenges.find(n=>n.id===e);this.emit("challengeComplete",a,i),a.id===this.me.id&&this.refreshChallenges()}#H(){const t=f.getBuffer();t.packInt8(c.joinGame),t.packString(this.state.name),t.packString(this.game.raw.uuid),t.packInt8(0),t.packInt8(this.state.weaponIdx||this.account?.loadout?.classIdx||0),t.packInt32(this.account.session),t.packString(this.account.firebaseId),t.packString(this.account.sessionId),t.send(this.game.socket)}async#z(){if(this.me.id=s.unPackInt8U(),this.me.team=s.unPackInt8U(),this.game.gameModeId=s.unPackInt8U(),this.game.gameMode=A[this.game.gameModeId],this.game.mapIdx=s.unPackInt8U(),this.game.map=P[this.game.mapIdx],this.intents.includes(this.Intents.PATHFINDING)&&(this.game.map.raw=await J(this.game.map.filename,this.game.map.hash),this.pathing.nodeList=new Q(this.game.map.raw),this.game.gameModeId===g.kotc)){const e=this.game.map.raw.data["DYNAMIC.capture-zone.none"];e?this.game.map.zones=V(e):delete this.game.map.zones}this.game.playerLimit=s.unPackInt8U(),this.game.isGameOwner=s.unPackInt8U()===1,this.game.isPrivate=s.unPackInt8U()===1,s.unPackInt8U(),this.state.inGame=!0,this.lastDeathTime=Date.now();const t=f.getBuffer();if(t.packInt8(c.clientReady),t.send(this.game.socket),this.updateIntervalId=setInterval(()=>this.update(),100/3),this.intents.includes(this.Intents.PING)){this.lastPingTime=Date.now();const e=f.getBuffer();e.packInt8(c.ping),e.send(this.game.socket)}this.emit("gameReady")}processPacket(t){s.init(t),this.intents.includes(this.Intents.PACKET_HOOK)&&this.emit("packet",t);let e=0,a=0,i=!1;for(;s.isMoreDataAvailable()&&!i;){const n=s.unPackInt8U();switch(n){case c.syncThem:this.#u();break;case c.fire:this.#k();break;case c.hitThem:this.#P();break;case c.syncMe:this.#w();break;case c.hitMe:this.#y();break;case c.swapWeapon:this.#p();break;case c.collectItem:this.#I();break;case c.respawn:this.#m();break;case c.die:this.#g();break;case c.pause:this.#d();break;case c.chat:this.#h();break;case c.addPlayer:this.#l();break;case c.removePlayer:this.#b();break;case c.eventModifier:this.#U();break;case c.metaGameState:this.#S();break;case c.beginShellStreak:this.#v();break;case c.endShellStreak:this.#C();break;case c.hitMeHardBoiled:this.#x();break;case c.gameOptions:this.#T();break;case c.ping:this.#G();break;case c.switchTeam:this.#R();break;case c.changeCharacter:this.#F();break;case c.reload:this.#O();break;case c.explode:this.#N();break;case c.throwGrenade:this.#D();break;case c.spawnItem:this.#f();break;case c.melee:this.#B();break;case c.updateBalance:this.#M();break;case c.challengeCompleted:this.#_();break;case c.socketReady:this.#H();break;case c.gameJoined:this.#z();break;case c.gameAction:this.#E();break;case c.requestGameOptions:this.#L();break;case c.respawnDenied:this.#A();break;case c.expireUpgrade:case c.clientReady:break;case c.musicInfo:s.unPackLongString();break;default:console.error(`processPacket: I got but couldn't identify a: ${Object.keys(c).find(o=>c[o]===n)} ${n}`),e&&console.error(`processPacket: It may be a result of the ${e} command (${a}).`),i=!0;break}e=Object.keys(c).find(o=>c[o]===n),a=n,this.intents.includes(this.Intents.LOG_PACKETS)&&console.log(`[LOG_PACKETS] Packet ${e}: ${a}`)}}async checkChiknWinner(){const t=await this.api.queryServices({cmd:"chicknWinnerReady",id:this.account.id,sessionId:this.account.sessionId});return typeof t=="string"?t:(this.account.cw.limit=t.limit,this.account.cw.atLimit=t.limit>=4,this.account.cw.secondsUntilPlay=(this.account.cw.atLimit?t.period:t.span)||0,this.account.cw.canPlayAgain=Date.now()+this.account.cw.secondsUntilPlay*1e3,this.account.cw)}async playChiknWinner(t=!0){if(this.account.cw.atLimit||this.account.cw.limit>q)return"hit_daily_limit";if(this.account.cw.canPlayAgain>Date.now()&&t)return"on_cooldown";const e=await this.api.queryServices({cmd:"incentivizedVideoReward",firebaseId:this.account.firebaseId,id:this.account.id,sessionId:this.account.sessionId,token:null});return typeof e=="string"?e:e.error?e.error==="RATELIMITED"||e.error==="RATELMITED"?(await this.checkChiknWinner(),"on_cooldown"):e.error==="SESSION_EXPIRED"?"session_expired":(console.error("Unknown Chikn Winner response, report this on Github:",e),"unknown_error"):e.reward?(this.account.eggBalance+=e.reward.eggsGiven,e.reward.itemIds.forEach(a=>this.account.ownedItemIds.push(a)),await this.checkChiknWinner(),e.reward):(console.error("Unknown Chikn Winner response, report this on Github:",e),"unknown_error")}async resetChiknWinner(){if(this.account.eggBalance<200)return"not_enough_eggs";if(!this.account.cw.atLimit)return"not_at_limit";const t=await this.api.queryServices({cmd:"chwReset",sessionId:this.account.sessionId});return typeof t=="string"?t:t.result!=="SUCCESS"?(console.error("Unknown Chikn Winner reset response, report this on Github:",t),"unknown_error"):(this.account.eggBalance-=200,await this.checkChiknWinner(),this.account.cw)}canSee(t){return this.intents.includes(this.Intents.PATHFINDING)?this.pathing.nodeList.hasLineOfSight(this.me.position,t.position):this.processError("You must have the PATHFINDING intent to use this method.")}getBestTarget(t=()=>!0){const a=Object.values(this.players).filter(n=>n?.playing).filter(n=>n.hp>0).filter(n=>n.id!==this.me.id).filter(n=>this.me.team===0||n.team!==this.me.team).filter(n=>!!t(n)).map(n=>({player:n,distance:Math.sqrt(Math.pow(n.position.x-this.me.position.x,2)+Math.pow(n.position.y-this.me.position.y,2)+Math.pow(n.position.z-this.me.position.z,2))})).sort((n,o)=>n.distance-o.distance);if(!a.length)return this.intents.includes(this.Intents.DEBUG_BEST_TARGET)&&console.log("no targets found"),null;const i=a.find(n=>this.canSee(n.player));return this.intents.includes(this.Intents.DEBUG_BEST_TARGET)&&(console.log("detected ",a.length,"targets"),console.log("closest target: ",a[0].player.name),console.log("all targets (ordered): ",a.map(n=>n.player.name)),console.log("found LoS player?",!!i),i&&console.log("closest LoS player: ",i.player.name)),i?{player:i.player,inLoS:!0}:{player:a[0].player,inLoS:!1}}async refreshChallenges(){const t=await this.api.queryServices({cmd:"challengeGetDaily",sessionId:this.account.sessionId,playerId:this.account.id});return this.#a(t),this.account.challenges}async rerollChallenge(t){const e=await this.api.queryServices({cmd:"challengeRerollSlot",sessionId:this.account.sessionId,slotId:t});return this.#a(e),this.account.challenges}async claimChallenge(t){const e=await this.api.queryServices({cmd:"challengeClaimReward",sessionId:this.account.sessionId,slotId:t});return this.#a(e.challenges),e.reward>0&&(this.account.eggBalance+=e.reward),{eggReward:e.reward,updatedChallenges:this.account.challenges}}async refreshBalance(){const t=await this.api.queryServices({cmd:"checkBalance",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId});return this.account.eggBalance=t.currentBalance,t.currentBalance}async redeemCode(t){const e=await this.api.queryServices({cmd:"redeem",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,id:this.account.id,code:t});return e.result==="SUCCESS"?(this.account.eggBalance=e.eggs_given,e.item_ids.forEach(a=>this.account.ownedItemIds.push(a)),{result:e,eggsGiven:e.eggs_given,itemIds:e.item_ids}):e}async claimURLReward(t){const e=await this.api.queryServices({cmd:"urlRewardParams",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,reward:t});return e.result==="SUCCESS"&&(this.account.eggBalance+=e.eggsGiven,e.itemIds.forEach(a=>this.account.ownedItemIds.push(a))),e}async claimSocialReward(t){const e=await this.api.queryServices({cmd:"reward",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,rewardTag:t});return e.result==="SUCCESS"&&(this.account.eggBalance+=e.eggsGiven,e.itemIds.forEach(a=>this.account.ownedItemIds.push(a))),e}async buyItem(t){const e=await this.api.queryServices({cmd:"buy",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,itemId:t,save:!0});return e.result==="SUCCESS"&&(this.account.eggBalance=e.currentBalance,this.account.ownedItemIds.push(e.itemId)),e}processError(t){if(this.#t.error&&this.#t.error.length)this.emit("error",t);else throw t}leave(t=z.mainMenu){this.hasQuit||(t>-1&&(this.game?.socket?.close(t),this.state.left=!0,this.emit("leave",t)),clearInterval(this.updateIntervalId),this.#e=[],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 U({}),this.game=this.#o,this.ping=0,this.lastPingTime=-1,this.lastDeathTime=-1,this.lastChatTime=-1,this.lastUpdateTick=0,this.controlKeys=0,this.pathing={nodeList:null,followingPath:!1,activePath:null,activeNode:null,activeNodeIdx:0})}logout(){this.account=this.#n}quit(t=!1){this.hasQuit||(this.leave(),this.matchmaker&&(this.matchmaker.close(),t||(this.matchmaker=null)),t||(delete this.account,delete this.api,delete this.game,delete this.me,delete this.players,delete this.state),this.hasQuit=!0)}}var It=et;export{et as Bot,It as default};
3
+ import H from"./api.js";import s from"./comm/CommIn.js";import f from"./comm/CommOut.js";import{CloseCode as z}from"./comm/Codes.js";import{CommCode as c}from"./constants/codes.js";import U from"./bot/GamePlayer.js";import W from"./matchmaker.js";import j from"./socket.js";import{ChiknWinnerDailyLimit as q,CollectTypes as x,CoopStates as y,findItemById as u,FramesBetweenSyncs as w,GameActions as T,GameModes as p,GameOptionFlags as E,GunList as K,ItemTypes as $,Movements as G,PlayTypes as Y,ProxiesEnabled as Z,ShellStreaks as m,StateBufferSize as b}from"./constants/index.js";import F from"./dispatches/LookAtPosDispatch.js";import M from"./dispatches/MovementDispatch.js";import{NodeList as Q}from"./pathing/mapnode.js";import{coords as X}from"./wasm/wrapper.js";import{fetchMap as J,initKotcZones as V}from"./util.js";import{Challenges as tt}from"./constants/challenges.js";import{Maps as P}from"./constants/maps.js";const R=Object.fromEntries(Object.entries(y).map(([I,t])=>[t,I])),A=Object.fromEntries(Object.entries(p).map(([I,t])=>[t,I])),B={CHALLENGES:1,STATS:2,PATHFINDING:3,PING:5,COSMETIC_DATA:6,PLAYER_HEALTH:7,PACKET_HOOK:8,LOG_PACKETS:10,NO_LOGIN:11,DEBUG_BUFFER:12,DEBUG_BEST_TARGET:14},S=(I,t)=>(I%t+t)%t;class et{static Intents=B;Intents=B;#e=[];#t={};#i=[];#n;#o;constructor(t={}){t.proxy&&!Z&&this.processError("proxies do not work and hence are not supported in the browser"),this.intents=t.intents||[],this.intents.includes(this.Intents.COSMETIC_DATA)&&(u(1001)||this.processError("you cannot use the COSMETIC_DATA intent inside of the singlefile browser bundles")),this.instance=t.instance||"shellshock.io",this.protocol=t.protocol||"wss",this.proxy=t.proxy||"",this.httpProxy=t.httpProxy||"",this.state={name:"yolkbot",weaponIdx:0,inGame:!1,yaw:0,pitch:0,controlKeys:0,reloading:!1,swappingGun:!1,usingMelee:!1,stateIdx:0,serverStateIdx:0,shotsFired:0,buffer:[],left:!1,quit:!1},this.players={},this.me=new U({}),this.game={raw:{},code:"",socket:null,gameModeId:0,gameMode:A[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:y.capturing,zoneNumber:0,activeZone:[],capturing:0,captureProgress:0,numCapturing:0,stageName:"",capturePercent:0},this.#o=this.game,this.account={id:0,firebaseId:"",sessionId:"",session:"",email:"",password:"",cw:{atLimit:!1,limit:0,secondsUntilPlay:0,canPlayAgain:Date.now()},loadout:{hatId:null,meleeId:0,stampId:null,classIdx:0,colorIdx:0,grenadeId:0,primaryId:[3100,3600,3400,3800,4e3,4200,4500],secondaryId:new Array(7).fill(3e3),stampPositionX:0,stampPositionY:0},ownedItemIds:[],vip:!1,accountAge:0,emailVerified:!1,eggBalance:0,rawLoginData:{}},this.#n=this.account,this.matchmaker=null,this.api=new H({instance:this.instance,protocol:this.protocol,proxy:this.proxy,httpProxy:this.httpProxy,maxRetries:t?.apiMaxRetries}),this.ping=0,this.lastPingTime=-1,this.lastDeathTime=-1,this.lastChatTime=-1,this.lastUpdateTick=0,this.pathing={nodeList:null,followingPath:!1,activePath:null,activeNode:null,activeNodeIdx:0},this.hasQuit=!1}dispatch(t){t.check(this)?t.execute(this):this.#e.push(t)}async createAccount(t,e){this.account.email=t,this.account.password=e;const a=await this.api.createAccount(t,e);return this.#s(a)}async login(t,e){this.account.email=t,this.account.password=e;const a=await this.api.loginWithCredentials(t,e);return this.#s(a)}async loginWithRefreshToken(t){const e=await this.api.loginWithRefreshToken(t);return this.#s(e)}async loginAnonymously(){delete this.account.email,delete this.account.password;const t=await this.api.loginAnonymously();return this.#s(t)}#s(t){return typeof t!="object"?(this.emit("authFail",t),!1):t.banRemaining?(this.emit("banned",t.banRemaining),!1):t.playerOutput?(t=t.playerOutput,this.account.rawLoginData=t,this.account.accountAge=t.accountAge,this.account.eggBalance=t.currentBalance,this.account.emailVerified=t.emailVerified,this.account.firebaseId=t.firebaseId,this.account.id=t.id,this.account.loadout=t.loadout,this.account.ownedItemIds=t.ownedItemIds,this.account.session=t.session,this.account.sessionId=t.sessionId,this.account.vip=t.upgradeProductId&&!t.upgradeIsExpired,this.intents.includes(this.Intents.STATS)&&(this.account.stats={lifetime:t.statsLifetime,monthly:t.statsCurrent}),this.intents.includes(this.Intents.CHALLENGES)&&this.#a(t.challenges),this.emit("authSuccess",this.account),this.account):(this.emit("authFail",t),!1)}#a(t){this.account.challenges=[];for(const e of t){const a=tt.find(i=>i.id===e.challengeId);a&&(delete e.playerId,this.account.challenges.push({raw:{challengeInfo:a,challengeData:e},id:e.challengeId,name:a.loc.title,desc:a.loc.desc,rewardEggs:a.reward,isRerolled:!!e.reset,isClaimed:!!e.claimed,isCompleted:!!e.completed,progressNum:e.progress,goalNum:a.goal}))}}async initMatchmaker(){return!this.account.sessionId&&!this.intents.includes(this.Intents.NO_LOGIN)&&!await this.loginAnonymously()?!1:(this.matchmaker||(this.matchmaker=new W({sessionId:this.account.sessionId,proxy:this.proxy,instance:this.instance,protocol:this.protocol,noLogin:this.intents.includes(this.Intents.NO_LOGIN),api:this.api}),this.matchmaker.on("authFail",t=>this.emit("authFail",t)),this.matchmaker.on("error",t=>this.processError(t)),await this.matchmaker.getRegions()),!0)}async#c(t){return await this.initMatchmaker()?(await this.matchmaker.waitForConnect(),await new Promise(e=>{const a=i=>{i.command==="gameFound"&&(this.matchmaker.off("msg",a),this.game.raw=i,this.game.code=i.id,e()),i.error&&i.error==="gameNotFound"&&(this.processError(`Game ${t} not found (likely expired).`),this.leave())};this.matchmaker.on("msg",a),this.matchmaker.send({command:"joinGame",id:t,observe:!1,sessionId:this.account.sessionId})})):!1}async findPublicGame(t){return this.matchmaker||this.initMatchmaker(),this.matchmaker?await this.matchmaker.findPublicGame(t):!1}async createPrivateGame(t={}){if(!await this.initMatchmaker())return!1;if(!t.region&&!this.matchmaker.regionList&&!this.matchmaker.regionList.length)return this.processError("pass a region to createPrivateGame or call getRegions() for a random one");if(t.region||(t.region=this.matchmaker.getRandomRegion()),!t.mode)return this.processError("pass a mode to createPrivateGame");if(typeof p[t.mode]!="number")return this.processError("invalid mode passed to createPrivateGame, see GameModes for a list");t.map||(t.map=P[P.length*Math.random()|0].name);const e=P.find(n=>n.name.toLowerCase()===t.map.toLowerCase()),a=P.indexOf(e);return a===-1?this.processError("invalid map, see the Maps constant for a list"):(await this.matchmaker.waitForConnect(),await new Promise(n=>{const o=r=>{r.command==="gameFound"&&(this.matchmaker.off("msg",o),n(r))};this.matchmaker.on("msg",o),this.matchmaker.send({command:"findGame",region:t.region,playType:Y.createPrivate,gameType:p[t.mode],sessionId:this.account.sessionId,noobLobby:!1,map:a})}))}async join(t,e){if(this.state.name=t||"yolkbot",typeof e=="string"?(e.includes("#")&&(e=e.split("#")[1]),await this.#c(e)):typeof e=="object"&&(this.account.id===0&&await this.loginAnonymously(),this.game.raw=e,this.game.code=this.game.raw.id),!this.game.raw.id)return this.processError("invalid game data passed to <bot>.join");const a=async()=>{try{const i=this.instance.startsWith("localhost:")?this.instance:`${this.game.raw.subdomain}.${this.instance}`;this.game.socket=new j(`${this.protocol}://${i}/game/${this.game.raw.id}`,this.proxy),this.game.socket.onerror=async n=>(this.processError(n),await new Promise(o=>setTimeout(o,100)),await a())}catch{await new Promise(i=>setTimeout(i,100)),await a()}};await a(),this.game.socket.binaryType="arraybuffer",this.game.socket.onopen=()=>this.game.socket.onerror=null,this.game.socket.onmessage=i=>this.processPacket(i.data),this.game.socket.onclose=i=>{this.state.left?this.state.left=!1:(this.emit("close",i.code),this.leave(-1))}}#r(){if(Object.entries(this.me.position).map(e=>Math.floor(e[1])).join(",")===this.pathing.activePath[this.pathing.activePath.length-1].positionStr)this.pathing.followingPath=!1,this.pathing.activePath=null,this.pathing.activeNode=null,this.pathing.activeNodeIdx=0,this.dispatch(new M(0));else{let e;this.pathing.activeNodeIdx<this.pathing.activePath.length-1?(e=this.pathing.activePath[this.pathing.activeNodeIdx+1].flatCenter(),this.dispatch(new F(e))):(e=this.pathing.activePath[this.pathing.activeNodeIdx].flatCenter(),this.dispatch(new F(e)));for(const a of this.pathing.activePath)if(a.flatRadialDistance(this.me.position)<.1&&a.position.y===Math.floor(this.me.position.y)&&this.pathing.activePath.indexOf(a)>=this.pathing.activeNodeIdx){this.pathing.activeNodeIdx=this.pathing.activePath.indexOf(a)+1,this.pathing.activeNode=this.pathing.activePath[this.pathing.activeNodeIdx];break}this.state.controlKeys&G.FORWARD||this.dispatch(new M(G.FORWARD))}}update(){if(!this.hasQuit){if(this.pathing.followingPath&&this.intents.includes(this.Intents.PATHFINDING)&&this.#r(),this.#e.length>0)for(let t=0;t<this.#e.length;t++){const e=this.#e[t];e.check(this)&&(e.execute(this),this.#e.splice(t,1))}if(this.me.playing){const t=this.state.stateIdx;if(this.intents.includes(this.Intents.DEBUG_BUFFER)&&(console.log("setting buffer for idx",t),console.log("checking...shotsFired",this.state.shotsFired)),this.state.buffer[t]={controlKeys:this.state.controlKeys,yaw:this.state.yaw,pitch:this.state.pitch,shotsFired:this.state.shotsFired},this.state.shotsFired=0,this.lastUpdateTick>=2){this.emit("tick");const e=f.getBuffer();e.packInt8(c.syncMe),e.packInt8(this.state.stateIdx),e.packInt8(this.state.serverStateIdx);const a=S(this.state.stateIdx-w+1,b);for(let i=0;i<w;i++){const n=S(a+i,b);this.intents.includes(this.Intents.DEBUG_BUFFER)&&console.log("going with",this.state.stateIdx,a,n,this.state.buffer[n]),e.packInt8(this.state.buffer[n]?.controlKeys||0),e.packInt8(this.state.buffer[n]?.shotsFired||0);const o=this.state.buffer[n]?.yaw||this.state.yaw,r=this.state.buffer[n]?.pitch||this.state.pitch,d=X(o,r);e.packString(d),e.packInt8(100)}e.send(this.game.socket),this.state.buffer=[],this.lastUpdateTick=0}else this.lastUpdateTick++;this.state.stateIdx=S(this.state.stateIdx+1,b)}if(this.intents.includes(this.Intents.PLAYER_HEALTH))for(const t of Object.values(this.players)){if(t.playing&&t.hp>0){const e=.1*(this.game.isPrivate?this.game.options.healthRegen:1);t.streakRewards.includes(m.OverHeal)?t.hp=Math.max(100,t.hp-e):t.hp=Math.min(100,t.hp+e)}t.spawnShield>0&&(t.spawnShield-=6)}}}on(t,e){Object.keys(this.#t).includes(t)?this.#t[t].push(e):this.#t[t]=[e]}onAny(t){this.#i.push(t)}off(t,e){e?this.#t[t]=this.#t[t].filter(a=>a!==e):this.#t[t]=[]}emit(t,...e){if(!this.hasQuit){if(this.#t[t])for(const a of this.#t[t])a(...e);for(const a of this.#i)a(t,...e)}}#h(){const t=s.unPackInt8U(),e=s.unPackInt8U(),a=s.unPackString().valueOf(),i=this.players[t];this.emit("chat",i,a,e)}#l(){const t=s.unPackInt8U(),e=this.intents.includes(this.Intents.COSMETIC_DATA),a={id:t,uniqueId:s.unPackString(),name:s.unPackString(),safename:s.unPackString(),charClass:s.unPackInt8U(),team:s.unPackInt8U(),primaryWeaponItem:e?u(s.unPackInt16U()):s.unPackInt16U(),secondaryWeaponItem:e?u(s.unPackInt16U()):s.unPackInt16U(),shellColor:s.unPackInt8U(),hatItem:e?u(s.unPackInt16U()):s.unPackInt16U(),stampItem:e?u(s.unPackInt16U()):s.unPackInt16U(),stampPosX:s.unPackInt8(),stampPosY:s.unPackInt8(),grenadeItem:e?u(s.unPackInt16U()):s.unPackInt16U(),meleeItem:e?u(s.unPackInt16U()):s.unPackInt16U(),x:s.unPackFloat(),y:s.unPackFloat(),z:s.unPackFloat(),$dx:s.unPackFloat(),$dy:s.unPackFloat(),$dz:s.unPackFloat(),yaw:s.unPackRadU(),pitch:s.unPackRad(),score:s.unPackInt32U(),kills:s.unPackInt16U(),deaths:s.unPackInt16U(),streak:s.unPackInt16U(),totalKills:s.unPackInt32U(),totalDeaths:s.unPackInt32U(),bestGameStreak:s.unPackInt16U(),bestOverallStreak:s.unPackInt16U(),shield:s.unPackInt8U(),hp:s.unPackInt8U(),playing:s.unPackInt8U(),weaponIdx:s.unPackInt8U(),$controlKeys:s.unPackInt8U(),upgradeProductId:s.unPackInt8U(),activeShellStreaks:s.unPackInt8U(),social:s.unPackLongString(),hideBadge:s.unPackInt8U()};s.unPackInt8U(),s.unPackInt8U(),s.unPackInt8U(),this.players[a.id]||(this.players[a.id]=new U(a)),this.emit("playerJoin",this.players[a.id]),this.me.id===a.id&&(this.me=this.players[a.id],this.emit("botJoined",this.me))}#m(){const t=s.unPackInt8U(),e=s.unPackInt16U(),a=s.unPackFloat(),i=s.unPackFloat(),n=s.unPackFloat(),o=s.unPackInt8U(),r=s.unPackInt8U(),d=s.unPackInt8U(),k=s.unPackInt8U(),g=s.unPackInt8U(),h=this.players[t];h&&(h.playing=!0,h.randomSeed=e,h.weapons[0]&&h.weapons[0].ammo&&(h.weapons[0].ammo.rounds=o),h.weapons[0]&&h.weapons[0].ammo&&(h.weapons[0].ammo.store=r),h.weapons[1]&&h.weapons[1].ammo&&(h.weapons[1].ammo.rounds=d),h.weapons[1]&&h.weapons[1].ammo&&(h.weapons[1].ammo.store=k),h.grenades=g,h.position={x:a,y:i,z:n},h.spawnShield=120,this.emit("playerRespawn",h))}#u(){const t=s.unPackInt8U(),e=s.unPackFloat(),a=s.unPackFloat(),i=s.unPackFloat(),n=s.unPackInt8U(),o=this.players[t];if(!o||o.id===this.me.id){for(let r=0;r<w;r++)s.unPackInt8U(),s.unPackRadU(),s.unPackRad(),s.unPackInt8U();return}for(let r=0;r<w;r++)s.unPackInt8U(),o.view.yaw=s.unPackRadU(),o.view.pitch=s.unPackRad(),s.unPackInt8U();o.position.x!==e&&(o.position.x=e),o.position.z!==i&&(o.position.z=i),(!o.jumping||Math.abs(o.position.y-a)>.5&&o.position.y!==a)&&(o.position.y=a),o.climbing!==n&&(o.climbing=n)}#d(){const t=s.unPackInt8U(),e=this.players[t];e&&(e.playing=!1,this.emit("playerPause",e))}#p(){const t=s.unPackInt8U(),e=s.unPackInt8U(),a=this.players[t];a&&(a.activeGun=e,this.emit("playerSwapWeapon",a,e))}#g(){const t=s.unPackInt8U(),e=s.unPackInt8U();s.unPackInt8U(),s.unPackInt8U(),s.unPackInt8U();const a=this.players[t],i=this.players[e];a&&(a.playing=!1,a.streak=0,a.lastDeathTime=Date.now(),a.hp=100,a.spawnShield=0),i&&i.streak++,this.emit("playerDeath",a,i)}#k(){const t=s.unPackInt8U();for(let i=0;i<6;i++)s.unPackFloat();const e=this.players[t];if(!e)return;const a=e.weapons[e.activeGun];a&&a.ammo&&(a.ammo.rounds--,this.emit("playerFire",e,a))}#f(){const t=s.unPackInt16U(),e=s.unPackInt8U(),a=s.unPackFloat(),i=s.unPackFloat(),n=s.unPackFloat();this.game.collectables[e].push({id:t,x:a,y:i,z:n}),this.emit("spawnItem",e,t,{x:a,y:i,z:n})}#I(){const t=s.unPackInt8U(),e=s.unPackInt8U(),a=s.unPackInt8U(),i=s.unPackInt16U(),n=this.players[t];if(this.game.collectables[e]=this.game.collectables[e].filter(o=>o.id!==i),e===x.AMMO){const o=n.weapons[a];o&&o.ammo&&(o.ammo.store=Math.min(o.ammo.storeMax,o.ammo.store+o.ammo.pickup),this.emit("collectAmmo",n,o))}e===x.GRENADE&&(n.grenades++,n.grenades>3&&(n.grenades=3),this.emit("collectGrenade",n))}#P(){const t=s.unPackInt8U(),e=s.unPackInt8U(),a=this.players[t];if(!a)return;const i=a.hp;a.hp=e,this.emit("playerDamaged",a,i,a.hp)}#y(){const t=s.unPackInt8U();s.unPackFloat(),s.unPackFloat();const e=this.me.hp;this.me.hp=t,this.emit("selfDamaged",e,this.me.hp)}#w(){const t=s.unPackInt8U(),e=this.players[t];s.unPackInt8U();const a=s.unPackInt8U(),i=s.unPackFloat(),n=s.unPackFloat(),o=s.unPackFloat();if(s.unPackInt8U(),s.unPackInt8U(),s.unPackInt8U(),!e)return;this.state.serverStateIdx=a;const r=e.position.x,d=e.position.y,k=e.position.z;e.position.x=i,e.position.y=n,e.position.z=o,(r!==i||d!==n||k!==o)&&this.emit("selfMoved",e,{x:r,y:d,z:k},{x:i,y:n,z:o})}#U(){const t=f.getBuffer();t.packInt8(c.eventModifier),t.send(this.game.socket)}#b(){const t=s.unPackInt8U(),e={...this.players[t]};delete this.players[t.toString()],this.emit("playerLeave",e)}#S(){if(this.game.gameModeId===p.spatula){this.game.teamScore[1]=s.unPackInt16U(),this.game.teamScore[2]=s.unPackInt16U();const t={x:s.unPackFloat(),y:s.unPackFloat(),z:s.unPackFloat()},e=s.unPackInt8U(),a=s.unPackInt8U();this.game.spatula={coords:t,controlledBy:e,controlledByTeam:a},this.emit("gameStateChange",this.game)}else this.game.gameModeId===p.kotc?(this.game.stage=s.unPackInt8U(),this.game.zoneNumber=s.unPackInt8U(),this.game.capturing=s.unPackInt8U(),this.game.captureProgress=s.unPackInt16U(),this.game.numCapturing=s.unPackInt8U(),this.game.teamScore[1]=s.unPackInt8U(),this.game.teamScore[2]=s.unPackInt8U(),this.game.stageName=R[this.game.stage],this.game.capturePercent=this.game.captureProgress/1e3,this.game.activeZone=this.game.map.zones?this.game.map.zones[this.game.zoneNumber-1]:null,this.emit("gameStateChange",this.game)):this.game.gameModeId===p.team&&(this.game.teamScore[1]=s.unPackInt16U(),this.game.teamScore[2]=s.unPackInt16U());this.game.gameModeId!==p.spatula&&delete this.game.spatula,this.game.gameModeId!==p.kotc&&(delete this.game.stage,delete this.game.zoneNumber,delete this.game.capturing,delete this.game.captureProgress,delete this.game.numCapturing,delete this.game.stageName,delete this.game.numCapturing,delete this.game.activeZone),this.game.gameModeId===p.ffa&&delete this.game.teamScore}#C(){const t=s.unPackInt8U(),e=s.unPackInt8U(),a=this.players[t];switch(e){case m.HardBoiled:t===this.me.id&&(this.me.shieldHp=100),a.streakRewards.push(m.HardBoiled);break;case m.EggBreaker:a.streakRewards.push(m.EggBreaker);break;case m.Restock:{a.grenades=3,a.weapons[0]&&a.weapons[0].ammo&&(a.weapons[0].ammo.rounds=a.weapons[0].ammo.capacity,a.weapons[0].ammo.store=a.weapons[0].ammo.storeMax),a.weapons[1]&&a.weapons[1].ammo&&(a.weapons[1].ammo.rounds=a.weapons[1].ammo.capacity,a.weapons[1].ammo.store=a.weapons[1].ammo.storeMax);break}case m.OverHeal:a.hp=Math.min(200,a.hp+100),a.streakRewards.push(m.OverHeal);break;case m.DoubleEggs:a.streakRewards.push(m.DoubleEggs);break;case m.MiniEgg:a.streakRewards.push(m.MiniEgg);break}this.emit("playerBeginStreak",a,e)}#v(){const t=s.unPackInt8U(),e=s.unPackInt8U(),a=this.players[t];[m.EggBreaker,m.OverHeal,m.DoubleEggs,m.MiniEgg].includes(e)&&a.streakRewards.includes(e)&&(a.streakRewards=a.streakRewards.filter(n=>n!==e)),this.emit("playerEndStreak",e,a)}#x(){const t=s.unPackInt8U(),e=s.unPackInt8U();s.unPackFloat(),s.unPackFloat(),this.me.shieldHp=t,this.me.hp=e,this.me.shieldHp<=0?(this.me.streakRewards=this.me.streakRewards.filter(a=>a!==m.HardBoiled),this.emit("selfShieldLost")):this.emit("selfShieldHit",this.me.shieldHp)}#T(){const t={...this.game.options};let e=s.unPackInt8U(),a=s.unPackInt8U(),i=s.unPackInt8U();(e<1||e>4)&&(e=4),(a<0||a>8)&&(a=4),i>16&&(i=4),this.game.options.gravity=e/4,this.game.options.damage=a/4,this.game.options.healthRegen=i/4;const n=s.unPackInt8U();return Object.keys(E).forEach(o=>{const r=n&E[o]?1:0;this.game.options[o]=r}),this.game.options.weaponsDisabled=Array.from({length:7},()=>s.unPackInt8U()===1),this.game.options.mustUseSecondary=this.game.options.weaponsDisabled.every(o=>o),this.emit("gameOptionsChange",t,this.game.options),!1}#E(){const t=s.unPackInt8U();t===T.pause&&(this.emit("gameForcePause"),setTimeout(()=>this.me.playing=!1,3e3)),t===T.reset&&(Object.values(this.players).forEach(e=>e.streak=0),this.game.gameModeId!==p.ffa&&(this.game.teamScore=[0,0,0]),this.game.gameModeId===p.spatula&&(this.game.spatula.controlledBy=0,this.game.spatula.controlledByTeam=0,this.game.spatula.coords={x:0,y:0,z:0}),this.game.gameModeId===p.kotc&&(this.game.stage=y.capturing,this.game.zoneNumber=0,this.game.activeZone=null,this.game.capturing=0,this.game.captureProgress=0,this.game.numCapturing=0,this.game.stageName=R[y.capturing],this.game.capturePercent=0),this.emit("gameReset"))}#G(){if(!this.intents.includes(this.Intents.PING))return;const t=this.ping;this.ping=Date.now()-this.lastPingTime,this.emit("pingUpdate",t,this.ping),setTimeout(()=>{const e=f.getBuffer();e.packInt8(c.ping),e.send(this.game.socket),this.lastPingTime=Date.now()},1e3)}#F(){const t=s.unPackInt8U(),e=s.unPackInt8U(),a=this.players[t];if(!a)return;const i=a.team;a.team=e,a.streak=0,this.emit("playerSwitchTeam",a,i,e)}#M(){const t=s.unPackInt8U(),e=s.unPackInt8U(),a=s.unPackInt16U(),i=s.unPackInt16U(),n=s.unPackInt8U(),o=s.unPackInt16U(),r=s.unPackInt16U(),d=s.unPackInt16U(),k=s.unPackInt16U();s.unPackInt8(),s.unPackInt8();const g=this.intents.includes(this.Intents.COSMETIC_DATA),h=g?u(a):a,O=g?u(i):i,L=g?u(o):o,N=g?u(r):r,D=g?u(d):d,_=g?u(k):k,l=this.players[t];if(l){const C={...l.character},v=l.selectedGun;l.character.eggColor=n,l.character.primaryGun=h,l.character.secondaryGun=O,l.character.stamp=N,l.character.hat=L,l.character.grenade=D,l.character.melee=_,l.selectedGun=e,l.weapons[0]=new K[e],v!==l.selectedGun&&this.emit("playerChangeGun",l,v,l.selectedGun),C!==l.character&&this.emit("playerChangeCharacter",l,C,l.character)}}#R(){const t=s.unPackInt32U(),e=this.account.eggBalance;this.account.eggBalance=t,this.emit("balanceUpdate",t-e,t)}#A(){this.me.playing=!1,this.emit("selfRespawnFail")}#B(){const t=s.unPackInt8U(),e=this.players[t];e&&this.emit("playerMelee",e)}#O(){const t=s.unPackInt8U(),e=this.players[t];if(!e)return;const a=e.weapons[e.activeGun];if(a.ammo){const i=Math.min(Math.min(a.ammo.capacity,a.ammo.reload)-a.ammo.rounds,a.ammo.store);a.ammo.rounds+=i,a.ammo.store-=i}this.emit("playerReload",e,a)}updateGameOptions(){const t=f.getBuffer();t.packInt8(c.gameOptions),t.packInt8(this.game.options.gravity*4),t.packInt8(this.game.options.damage*4),t.packInt8(this.game.options.healthRegen*4);const e=(this.game.options.locked?1:0)|(this.game.options.noTeamChange?2:0)|(this.game.options.noTeamShuffle?4:0);t.packInt8(e),this.game.options.weaponsDisabled.forEach(a=>{t.packInt8(a?1:0)}),t.send(this.game.socket)}#L(){this.updateGameOptions()}#N(){const t=s.unPackInt8U();let e=s.unPackInt16U();const a=s.unPackFloat(),i=s.unPackFloat(),n=s.unPackFloat(),o=s.unPackInt8U(),r=s.unPackFloat();this.intents.includes(this.Intents.COSMETIC_DATA)&&(e=u(e)),t===$.Grenade?this.emit("grenadeExploded",e,{x:a,y:i,z:n},o,r):this.emit("rocketHit",{x:a,y:i,z:n},o,r)}#D(){const t=s.unPackInt8U(),e=s.unPackFloat(),a=s.unPackFloat(),i=s.unPackFloat(),n=s.unPackFloat(),o=s.unPackFloat(),r=s.unPackFloat(),d=this.players[t];d&&(d.grenades--,this.emit("playerThrowGrenade",d,{x:e,y:a,z:i},{x:n,y:o,z:r}))}#_(){const t=s.unPackInt8U(),e=s.unPackInt8U(),a=this.players[t];if(!a)return;if(!this.intents.includes(this.Intents.CHALLENGES))return this.emit("challengeComplete",a,e);const i=this.account.challenges.find(n=>n.id===e);this.emit("challengeComplete",a,i),a.id===this.me.id&&this.refreshChallenges()}#H(){const t=f.getBuffer();t.packInt8(c.joinGame),t.packString(this.state.name),t.packString(this.game.raw.uuid),t.packInt8(0),t.packInt8(this.state.weaponIdx||this.account?.loadout?.classIdx||0),t.packInt32(this.account.session),t.packString(this.account.firebaseId),t.packString(this.account.sessionId),t.send(this.game.socket)}async#z(){if(this.me.id=s.unPackInt8U(),this.me.team=s.unPackInt8U(),this.game.gameModeId=s.unPackInt8U(),this.game.gameMode=A[this.game.gameModeId],this.game.mapIdx=s.unPackInt8U(),this.game.map=P[this.game.mapIdx],this.intents.includes(this.Intents.PATHFINDING)&&(this.game.map.raw=await J(this.game.map.filename,this.game.map.hash),this.pathing.nodeList=new Q(this.game.map.raw),this.game.gameModeId===p.kotc)){const e=this.game.map.raw.data["DYNAMIC.capture-zone.none"];e?this.game.map.zones=V(e):delete this.game.map.zones}this.game.playerLimit=s.unPackInt8U(),this.game.isGameOwner=s.unPackInt8U()===1,this.game.isPrivate=s.unPackInt8U()===1,s.unPackInt8U(),this.state.inGame=!0,this.lastDeathTime=Date.now();const t=f.getBuffer();if(t.packInt8(c.clientReady),t.send(this.game.socket),this.updateIntervalId=setInterval(()=>this.update(),100/3),this.intents.includes(this.Intents.PING)){this.lastPingTime=Date.now();const e=f.getBuffer();e.packInt8(c.ping),e.send(this.game.socket)}this.emit("gameReady")}processPacket(t){s.init(t),this.intents.includes(this.Intents.PACKET_HOOK)&&this.emit("packet",t);let e=0,a=0,i=!1;for(;s.isMoreDataAvailable()&&!i;){const n=s.unPackInt8U();switch(n){case c.syncThem:this.#u();break;case c.fire:this.#k();break;case c.hitThem:this.#P();break;case c.syncMe:this.#w();break;case c.hitMe:this.#y();break;case c.swapWeapon:this.#p();break;case c.collectItem:this.#I();break;case c.respawn:this.#m();break;case c.die:this.#g();break;case c.pause:this.#d();break;case c.chat:this.#h();break;case c.addPlayer:this.#l();break;case c.removePlayer:this.#b();break;case c.eventModifier:this.#U();break;case c.metaGameState:this.#S();break;case c.beginShellStreak:this.#C();break;case c.endShellStreak:this.#v();break;case c.hitMeHardBoiled:this.#x();break;case c.gameOptions:this.#T();break;case c.ping:this.#G();break;case c.switchTeam:this.#F();break;case c.changeCharacter:this.#M();break;case c.reload:this.#O();break;case c.explode:this.#N();break;case c.throwGrenade:this.#D();break;case c.spawnItem:this.#f();break;case c.melee:this.#B();break;case c.updateBalance:this.#R();break;case c.challengeCompleted:this.#_();break;case c.socketReady:this.#H();break;case c.gameJoined:this.#z();break;case c.gameAction:this.#E();break;case c.requestGameOptions:this.#L();break;case c.respawnDenied:this.#A();break;case c.expireUpgrade:case c.clientReady:break;case c.musicInfo:s.unPackLongString();break;default:console.error(`processPacket: I got but couldn't identify a: ${Object.keys(c).find(o=>c[o]===n)} ${n}`),e&&console.error(`processPacket: It may be a result of the ${e} command (${a}).`),i=!0;break}e=Object.keys(c).find(o=>c[o]===n),a=n,this.intents.includes(this.Intents.LOG_PACKETS)&&console.log(`[LOG_PACKETS] Packet ${e}: ${a}`)}}async checkChiknWinner(){const t=await this.api.queryServices({cmd:"chicknWinnerReady",id:this.account.id,sessionId:this.account.sessionId});return typeof t=="string"?t:(this.account.cw.limit=t.limit,this.account.cw.atLimit=t.limit>=4,this.account.cw.secondsUntilPlay=(this.account.cw.atLimit?t.period:t.span)||0,this.account.cw.canPlayAgain=Date.now()+this.account.cw.secondsUntilPlay*1e3,this.account.cw)}async playChiknWinner(t=!0){if(this.account.cw.atLimit||this.account.cw.limit>q)return"hit_daily_limit";if(this.account.cw.canPlayAgain>Date.now()&&t)return"on_cooldown";const e=await this.api.queryServices({cmd:"incentivizedVideoReward",firebaseId:this.account.firebaseId,id:this.account.id,sessionId:this.account.sessionId,token:null});return typeof e=="string"?e:e.error?e.error==="RATELIMITED"||e.error==="RATELMITED"?(await this.checkChiknWinner(),"on_cooldown"):e.error==="SESSION_EXPIRED"?"session_expired":(console.error("Unknown Chikn Winner response, report this on Github:",e),"unknown_error"):e.reward?(this.account.eggBalance+=e.reward.eggsGiven,e.reward.itemIds.forEach(a=>this.account.ownedItemIds.push(a)),await this.checkChiknWinner(),e.reward):(console.error("Unknown Chikn Winner response, report this on Github:",e),"unknown_error")}async resetChiknWinner(){if(this.account.eggBalance<200)return"not_enough_eggs";if(!this.account.cw.atLimit)return"not_at_limit";const t=await this.api.queryServices({cmd:"chwReset",sessionId:this.account.sessionId});return typeof t=="string"?t:t.result!=="SUCCESS"?(console.error("Unknown Chikn Winner reset response, report this on Github:",t),"unknown_error"):(this.account.eggBalance-=200,await this.checkChiknWinner(),this.account.cw)}canSee(t){return this.intents.includes(this.Intents.PATHFINDING)?this.pathing.nodeList.hasLineOfSight(this.me.position,t.position):this.processError("You must have the PATHFINDING intent to use this method.")}getBestTarget(t=()=>!0){const a=Object.values(this.players).filter(n=>n?.playing).filter(n=>n.hp>0).filter(n=>n.id!==this.me.id).filter(n=>this.me.team===0||n.team!==this.me.team).filter(n=>!!t(n)).map(n=>({player:n,distance:Math.sqrt(Math.pow(n.position.x-this.me.position.x,2)+Math.pow(n.position.y-this.me.position.y,2)+Math.pow(n.position.z-this.me.position.z,2))})).sort((n,o)=>n.distance-o.distance);if(!a.length)return this.intents.includes(this.Intents.DEBUG_BEST_TARGET)&&console.log("no targets found"),null;const i=a.find(n=>this.canSee(n.player));return this.intents.includes(this.Intents.DEBUG_BEST_TARGET)&&(console.log("detected ",a.length,"targets"),console.log("closest target: ",a[0].player.name),console.log("all targets (ordered): ",a.map(n=>n.player.name)),console.log("found LoS player?",!!i),i&&console.log("closest LoS player: ",i.player.name)),i?{player:i.player,inLoS:!0}:{player:a[0].player,inLoS:!1}}async refreshChallenges(){const t=await this.api.queryServices({cmd:"challengeGetDaily",sessionId:this.account.sessionId,playerId:this.account.id});return this.#a(t),this.account.challenges}async rerollChallenge(t){const e=await this.api.queryServices({cmd:"challengeRerollSlot",sessionId:this.account.sessionId,slotId:t});return this.#a(e),this.account.challenges}async claimChallenge(t){const e=await this.api.queryServices({cmd:"challengeClaimReward",sessionId:this.account.sessionId,slotId:t});return this.#a(e.challenges),e.reward>0&&(this.account.eggBalance+=e.reward),{eggReward:e.reward,updatedChallenges:this.account.challenges}}async refreshBalance(){const t=await this.api.queryServices({cmd:"checkBalance",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId});return this.account.eggBalance=t.currentBalance,t.currentBalance}async redeemCode(t){const e=await this.api.queryServices({cmd:"redeem",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,id:this.account.id,code:t});return e.result==="SUCCESS"?(this.account.eggBalance=e.eggs_given,e.item_ids.forEach(a=>this.account.ownedItemIds.push(a)),{result:e,eggsGiven:e.eggs_given,itemIds:e.item_ids}):e}async claimURLReward(t){const e=await this.api.queryServices({cmd:"urlRewardParams",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,reward:t});return e.result==="SUCCESS"&&(this.account.eggBalance+=e.eggsGiven,e.itemIds.forEach(a=>this.account.ownedItemIds.push(a))),e}async claimSocialReward(t){const e=await this.api.queryServices({cmd:"reward",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,rewardTag:t});return e.result==="SUCCESS"&&(this.account.eggBalance+=e.eggsGiven,e.itemIds.forEach(a=>this.account.ownedItemIds.push(a))),e}async buyItem(t){const e=await this.api.queryServices({cmd:"buy",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,itemId:t,save:!0});return e.result==="SUCCESS"&&(this.account.eggBalance=e.currentBalance,this.account.ownedItemIds.push(e.itemId)),e}processError(t){if(this.#t.error&&this.#t.error.length)this.emit("error",t);else throw t}leave(t=z.mainMenu){this.hasQuit||(t>-1&&(this.game?.socket?.close(t),this.state.left=!0,this.emit("leave",t)),clearInterval(this.updateIntervalId),this.#e=[],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 U({}),this.game=this.#o,this.ping=0,this.lastPingTime=-1,this.lastDeathTime=-1,this.lastChatTime=-1,this.lastUpdateTick=0,this.pathing={nodeList:null,followingPath:!1,activePath:null,activeNode:null,activeNodeIdx:0})}logout(){this.account=this.#n}quit(t=!1){this.hasQuit||(this.leave(),this.matchmaker&&(this.matchmaker.close(),t||(this.matchmaker=null)),t||(delete this.account,delete this.api,delete this.game,delete this.me,delete this.players,delete this.state),this.hasQuit=!0)}}var It=et;export{et as Bot,It as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- const t=[{active:!0,link:"https://www.youtube.com/watch?v=-Pj2j-PC020",desc:"",imageExt:"",id:"-Pj2j-PC020",author:"Shell League",title:"CRAZY KotC match Highlights",externalImg:"https://i.ytimg.com/vi/-Pj2j-PC020/hqdefault.jpg"},{active:!0,link:"https://www.youtube.com/watch?v=6z9KKTk4kdw",desc:"",imageExt:"",id:"6z9KKTk4kdw",author:"TheKingmanYT",title:"1v1ing THE GOAT KT_VEI",externalImg:"https://i.ytimg.com/vi/6z9KKTk4kdw/hqdefault.jpg"},{active:!0,link:"https://www.youtube.com/watch?v=Jn1cT1PEi0s",desc:"",imageExt:"",id:"Jn1cT1PEi0s",author:"Meep ",title:"10 Kill Streak /w Ancient Guns! | New Update",externalImg:"https://i.ytimg.com/vi/Jn1cT1PEi0s/hqdefault.jpg"},{active:!0,link:"https://www.youtube.com/watch?v=iKx-xz5T_T8",desc:"",imageExt:"",id:"iKx-xz5T_T8",author:"Bubbleaxe",title:"WALKIN | Montage",externalImg:"https://i.ytimg.com/vi/iKx-xz5T_T8/hqdefault.jpg"},{active:!0,link:"https://www.youtube.com/watch?v=7afD9QxU_vA",desc:"",imageExt:"",id:"7afD9QxU_vA",author:"Godric Gryffindor",title:"I Play a Game of BINGO!",externalImg:"https://i.ytimg.com/vi/7afD9QxU_vA/hqdefault.jpg"},{active:!0,link:"https://www.youtube.com/watch?v=I7MEVsuYVkY",desc:"",imageExt:"",id:"I7MEVsuYVkY",author:"Galactic",title:"Smooth Lofi gameplay w/Phoenix Yt",externalImg:"https://i.ytimg.com/vi/I7MEVsuYVkY/hqdefault.jpg"},{active:!0,link:"https://www.youtube.com/watch?v=LrfhRAK-nDs",desc:"",imageExt:"",id:"LrfhRAK-nDs",author:"Meep ",title:"10 KS w/ Golden Dragon Guns!",externalImg:"https://i.ytimg.com/vi/LrfhRAK-nDs/hqdefault.jpg"},{active:!0,link:"https://www.youtube.com/watch?v=S3pbYxiDl2E",desc:"",imageExt:"",id:"S3pbYxiDl2E",author:"The Rogue Contractor ",title:" \u{1F3AF}Snipes & Clutch Plays & 200 IQ Shots\u{1F525}",externalImg:"https://i.ytimg.com/vi/S3pbYxiDl2E/hqdefault.jpg"},{active:!0,link:"https://www.youtube.com/watch?v=Xs5OLOpfHcc",desc:"",imageExt:"",id:"Xs5OLOpfHcc",author:"Clingzter ",title:"The Eggstra Value Pack is LOADED!!",externalImg:"https://i.ytimg.com/vi/Xs5OLOpfHcc/hqdefault.jpg"}];export{t as ShellYoutube};
3
+ const t=[{active:!0,link:"https://www.youtube.com/watch?v=hp7WXq1PjeM",desc:"",imageExt:"",id:"hp7WXq1PjeM",author:"Godric Gryffindor",title:"Top 5 Most Popular Maps",externalImg:"https://i.ytimg.com/vi/hp7WXq1PjeM/hqdefault.jpg"},{active:!0,link:"https://www.youtube.com/watch?v=-Pj2j-PC020",desc:"",imageExt:"",id:"-Pj2j-PC020",author:"Shell League",title:"CRAZY KotC match Highlights",externalImg:"https://i.ytimg.com/vi/-Pj2j-PC020/hqdefault.jpg"},{active:!0,link:"https://www.youtube.com/watch?v=6z9KKTk4kdw",desc:"",imageExt:"",id:"6z9KKTk4kdw",author:"TheKingmanYT",title:"1v1ing THE GOAT KT_VEI",externalImg:"https://i.ytimg.com/vi/6z9KKTk4kdw/hqdefault.jpg"},{active:!0,link:"https://www.youtube.com/watch?v=Jn1cT1PEi0s",desc:"",imageExt:"",id:"Jn1cT1PEi0s",author:"Meep ",title:"10 Kill Streak /w Ancient Guns! | New Update",externalImg:"https://i.ytimg.com/vi/Jn1cT1PEi0s/hqdefault.jpg"},{active:!0,link:"https://www.youtube.com/watch?v=iKx-xz5T_T8",desc:"",imageExt:"",id:"iKx-xz5T_T8",author:"Bubbleaxe",title:"WALKIN | Montage",externalImg:"https://i.ytimg.com/vi/iKx-xz5T_T8/hqdefault.jpg"},{active:!0,link:"https://www.youtube.com/watch?v=7afD9QxU_vA",desc:"",imageExt:"",id:"7afD9QxU_vA",author:"Godric Gryffindor",title:"I Play a Game of BINGO!",externalImg:"https://i.ytimg.com/vi/7afD9QxU_vA/hqdefault.jpg"},{active:!0,link:"https://www.youtube.com/watch?v=I7MEVsuYVkY",desc:"",imageExt:"",id:"I7MEVsuYVkY",author:"Galactic",title:"Smooth Lofi gameplay w/Phoenix Yt",externalImg:"https://i.ytimg.com/vi/I7MEVsuYVkY/hqdefault.jpg"},{active:!0,link:"https://www.youtube.com/watch?v=LrfhRAK-nDs",desc:"",imageExt:"",id:"LrfhRAK-nDs",author:"Meep ",title:"10 KS w/ Golden Dragon Guns!",externalImg:"https://i.ytimg.com/vi/LrfhRAK-nDs/hqdefault.jpg"},{active:!0,link:"https://www.youtube.com/watch?v=S3pbYxiDl2E",desc:"",imageExt:"",id:"S3pbYxiDl2E",author:"The Rogue Contractor ",title:" \u{1F3AF}Snipes & Clutch Plays & 200 IQ Shots\u{1F525}",externalImg:"https://i.ytimg.com/vi/S3pbYxiDl2E/hqdefault.jpg"},{active:!0,link:"https://www.youtube.com/watch?v=Xs5OLOpfHcc",desc:"",imageExt:"",id:"Xs5OLOpfHcc",author:"Clingzter ",title:"The Eggstra Value Pack is LOADED!!",externalImg:"https://i.ytimg.com/vi/Xs5OLOpfHcc/hqdefault.jpg"}];export{t as ShellYoutube};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import s from"../comm/CommOut.js";import{CommCode as t}from"../constants/codes.js";const i=[0,.25,.5,.75,1,1.25,1.5,1.75,2,2.25,2.5,2.75,3,3.25,3.5,3.75,4];class r{check(e){return!(!e.game.isGameOwner||![.25,.5,.75,1].includes(e.game.options.gravity)||![0,.25,.5,.75,1,1.25,1.5,1.75,2].includes(e.game.options.damage)||!i.includes(e.game.options.healthRegen)||typeof e.game.options.locked!="boolean"||typeof e.game.options.noTeamChange!="boolean"||typeof e.game.options.noTeamShuffle!="boolean"||!Array.isArray(e.game.options.weaponsDisabled)||e.game.options.weaponsDisabled.length!==7||e.game.options.weaponsDisabled.some(n=>typeof n!="boolean"))}execute(e){const n=(e.game.options.locked?1:0)|(e.game.options.noTeamChange?2:0)|(e.game.options.noTeamShuffle?4:0),a=s.getBuffer();a.packInt8(t.gameOptions),a.packInt8(e.game.options.gravity*4),a.packInt8(e.game.options.damage*4),a.packInt8(e.game.options.healthRegen*4),a.packInt8(n),e.game.options.weaponsDisabled.forEach(o=>{a.packInt8(o?1:0)}),a.send(e.game.socket)}}var l=r;export{r as GameOptionsDispatch,l as default};
3
+ const i=Array.from({length:4},(n,e)=>(e+1)*.25),t=Array.from({length:9},(n,e)=>e*.25),h=Array.from({length:17},(n,e)=>e*.25);class o{constructor(e){this.changes=e}#e(e){const a={};return a.gravity=this.changes.gravity||e.game.options.gravity,a.damage=this.changes.damage||e.game.options.damage,a.healthRegen=this.changes.healthRegen||e.game.options.healthRegen,a.locked=this.changes.locked!==void 0?this.changes.locked:e.game.options.locked,a.noTeamChange=this.changes.noTeamChange!==void 0?this.changes.noTeamChange:e.game.options.noTeamChange,a.noTeamShuffle=this.changes.noTeamShuffle!==void 0?this.changes.noTeamShuffle:e.game.options.noTeamShuffle,a.weaponsDisabled=[typeof this.changes.disableEggk<"u"?this.changes.disableEggk:e.game.options.weaponsDisabled[0],typeof this.changes.disableScrambler<"u"?this.changes.disableScrambler:e.game.options.weaponsDisabled[1],typeof this.changes.disableFreeRanger<"u"?this.changes.disableFreeRanger:e.game.options.weaponsDisabled[2],typeof this.changes.disableRPG<"u"?this.changes.disableRPG:e.game.options.weaponsDisabled[3],typeof this.changes.disableWhipper<"u"?this.changes.disableWhipper:e.game.options.weaponsDisabled[4],typeof this.changes.disableCrackshot<"u"?this.changes.disableCrackshot:e.game.options.weaponsDisabled[5],typeof this.changes.disableTriHard<"u"?this.changes.disableTriHard:e.game.options.weaponsDisabled[6]],this.changes.toDisable&&Array.isArray(this.changes.toDisable)&&this.changes.toDisable.forEach(s=>a.weaponsDisabled[s]=!0),this.changes.toEnable&&Array.isArray(this.changes.toEnable)&&this.changes.toEnable.forEach(s=>a.weaponsDisabled[s]=!1),this.changes.rawWeaponsDisabled&&Array.isArray(this.changes.rawWeaponsDisabled)&&this.changes.rawWeaponsDisabled.length===7&&(a.weaponsDisabled=this.changes.rawWeaponsDisabled.map(s=>!!s)),a.mustUseSecondary=a.weaponsDisabled.every(s=>s),a}check(e){if(!e.game.isGameOwner)return!1;const a=this.#e(e);return!(!i.includes(a.gravity)||!t.includes(a.damage)||!h.includes(a.healthRegen)||typeof a.locked!="boolean"||typeof a.noTeamChange!="boolean"||typeof a.noTeamShuffle!="boolean"||!Array.isArray(a.weaponsDisabled)||a.weaponsDisabled.length!==7||a.weaponsDisabled.some(s=>typeof s!="boolean"))}execute(e){e.game.options=this.#e(e),e.updateGameOptions()}}var r=o;export{o as GameOptionsDispatch,r as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- const h=(i,t)=>(i%t+t)%t,r=Math.PI*2,s=i=>Math.round(i*8192)/8192,l=i=>s(h(Math.atan2(-i.x,-i.z),r)),p=i=>s(Math.atan2(i.y,Math.hypot(i.x,i.z)));class y{idOrName;constructor(t){typeof t=="number"?this.id=t:typeof t=="string"&&(this.name=t)}check(t){if(!t.me.playing)return!1;let e;return this.id?e=t.players[this.id.toString()]:this.name&&(e=t.players.find(n=>n.name===this.name)),!!e}execute(t){let e;this.id?e=t.players[this.id.toString()]:this.name&&(e=t.players.find(o=>o.name===this.name));const n={x:e.position.x-t.me.position.x,y:e.position.y-t.me.position.y-.05,z:e.position.z-t.me.position.z},a=l(n),c=p(n);t.me.view.yaw=a,t.me.view.pitch=c}}var f=y;export{y as LookAtDispatch,f as default};
3
+ const o=(a,t)=>(a%t+t)%t,h=Math.PI*2,n=a=>Math.round(a*8192)/8192,p=a=>n(o(Math.atan2(-a.x,-a.z),h)),d=a=>n(Math.atan2(a.y,Math.hypot(a.x,a.z)));class l{idOrName;constructor(t){this.idOrName=t}check(t){return t.me.playing?!!(t.players[this.idOrName.toString()]||t.players.find(i=>i.name===this.idOrName)):!1}execute(t){const e=t.players[this.idOrName.toString()]||t.players.find(r=>r.name===this.idOrName),i={x:e.position.x-t.me.position.x,y:e.position.y-t.me.position.y-.05,z:e.position.z-t.me.position.z},s=p(i),c=d(i);t.state.yaw=s,t.state.pitch=c}}var y=l;export{l as LookAtDispatch,y as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- const a=(s,t)=>(s%t+t)%t,h=Math.PI*2,c=s=>Math.round(s*8192)/8192,n=s=>c(a(Math.atan2(-s.x,-s.z),h)),p=s=>c(Math.atan2(s.y,Math.hypot(s.x,s.z)));class r{constructor(t){this.pos=t}check(t){return t.me.playing&&this.pos&&this.pos.x&&this.pos.y&&this.pos.z}execute(t){const o={x:this.pos.x-t.me.position.x,y:this.pos.y-t.me.position.y,z:this.pos.z-t.me.position.z},i=n(o),e=p(o);t.me.view.yaw=i,t.me.view.pitch=e}}var x=r;export{r as LookAtPosDispatch,x as default};
3
+ const e=(s,t)=>(s%t+t)%t,h=Math.PI*2,c=s=>Math.round(s*8192)/8192,n=s=>c(e(Math.atan2(-s.x,-s.z),h)),p=s=>c(Math.atan2(s.y,Math.hypot(s.x,s.z)));class r{constructor(t){this.pos=t}check(t){return t.me.playing&&this.pos&&this.pos.x&&this.pos.y&&this.pos.z}execute(t){const o={x:this.pos.x-t.me.position.x,y:this.pos.y-t.me.position.y,z:this.pos.z-t.me.position.z},i=n(o),a=p(o);t.state.yaw=i,t.state.pitch=a}}var x=r;export{r as LookAtPosDispatch,x as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import t from"../comm/CommOut.js";import{CommCode as u}from"../constants/codes.js";class a{check(e){return e.me.playing&&!e.state.reloading&&!e.state.swappingGun&&!e.state.usingMelee}execute(e){const s=t.getBuffer();s.packInt8(u.melee),s.send(e.game.socket),e.usingMelee=!0,setTimeout(()=>{e.usingMelee=!1,e.swappingGun=!0,setTimeout(()=>{e.swappingGun=!1},.5*e.me.weapons[0].equipTime)},566.61)}}var p=a;export{a as MeleeDispatch,p as default};
3
+ import t from"../comm/CommOut.js";import{CommCode as u}from"../constants/codes.js";class a{check(e){return e.me.playing&&!e.state.reloading&&!e.state.swappingGun&&!e.state.usingMelee}execute(e){const s=t.getBuffer();s.packInt8(u.melee),s.send(e.game.socket),e.usingMelee=!0,setTimeout(()=>{e.usingMelee=!1,e.swappingGun=!0,setTimeout(()=>{e.swappingGun=!1},.5*e.me.weapons[0].equipTime)},100/3*17)}}var p=a;export{a as MeleeDispatch,p as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- class s{constructor(e){typeof e=="number"?this.controlKeys=e:typeof e==typeof[]&&(this.controlKeys=e.reduce((t,o)=>t|o,0))}check(e){return e.me.playing&&this.controlKeys}execute(e){e.controlKeys=this.controlKeys}}var r=s;export{s as MovementDispatch,r as default};
3
+ class o{constructor(e){typeof e=="number"?this.inputKeys=e:typeof e==typeof[]&&(this.inputKeys=e.reduce((t,s)=>t|s,0))}check(e){return e.me.playing&&this.inputKeys}execute(e){e.state.controlKeys=this.inputKeys}}var i=o;export{o as MovementDispatch,i as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import r from"../comm/CommOut.js";import{CommCode as n}from"../constants/codes.js";class a{constructor(e,t={}){typeof e=="number"?this.id=e:typeof e=="string"&&(this.name=e),this.reasons=[!!t.cheating,!!t.harassment,!!t.offensive,!!t.other],this.reasons.includes(!0)||(this.reasons[3]=!0);for(let s=0;s<this.reasons.length;s++)this.reasons[s]===!0&&(this.reasonInt|=1<<s)}check(e){if(!e.state.inGame)return!1;let t;return this.id?t=e.players[this.id.toString()]:this.name&&(t=e.players.find(s=>s.name===this.name)),!!t}execute(e){let t;this.id?t=e.players[this.id.toString()]:this.name&&(t=e.players.find(i=>i.name===this.name));const s=r.getBuffer();s.packInt8(n.reportPlayer),s.packString(t.uniqueId),s.packInt8(this.reasonInt),s.send(e.game.socket)}}var l=a;export{a as ReportPlayerDispatch,l as default};
3
+ import i from"../comm/CommOut.js";import{CommCode as a}from"../constants/codes.js";class n{constructor(e,r={}){this.idOrName=e,this.reasons=[!!r.cheating,!!r.harassment,!!r.offensive,!!r.other],this.reasons.includes(!0)||(this.reasons[3]=!0);for(let t=0;t<this.reasons.length;t++)this.reasons[t]===!0&&(this.reasonInt|=1<<t)}check(e){return e.state.inGame?!!(e.players[this.idOrName.toString()]||e.players.find(t=>t.name===this.idOrName)):!1}execute(e){const r=e.players[this.idOrName.toString()]||e.players.find(s=>s.name===this.idOrName),t=i.getBuffer();t.packInt8(a.reportPlayer),t.packString(r.uniqueId),t.packInt8(this.reasonInt),t.send(e.game.socket)}}var c=n;export{n as ReportPlayerDispatch,c as default};
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import t from"../comm/CommOut.js";import{CommCode as n}from"../constants/codes.js";class p{check(e){return e.me.playing&&!e.state.reloading&&!e.state.swappingGun&&!e.state.usingMelee}execute(e){e.me.activeGun=+!e.me.activeGun;const a=t.getBuffer();a.packInt8(n.swapWeapon),a.packInt8(e.me.activeGun),a.send(e.game.socket)}}var u=p;export{p as SwapWeaponDispatch,u as default};
3
+ import t from"../comm/CommOut.js";import{CommCode as p}from"../constants/codes.js";class m{constructor(e){this.manualWeapon=e}check(e){return e.me.playing&&!e.state.reloading&&!e.state.swappingGun&&!e.state.usingMelee}execute(e){let n=+!e.me.activeGun;typeof this.manualWeapon=="number"&&(n=this.manualWeapon),e.me.activeGun=n;const a=t.getBuffer();a.packInt8(p.swapWeapon),a.packInt8(e.me.activeGun),a.send(e.game.socket)}}var c=m;export{m as SwapWeaponDispatch,c as default};
@@ -1,7 +1,7 @@
1
1
  import Bot from '../bot';
2
2
 
3
3
  export class MovementDispatch {
4
- controlKeys: number;
4
+ inputKeys: number;
5
5
 
6
6
  constructor(controlKeys: number | number[]);
7
7
 
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
 
3
- import{jsResolve as p,dateToUse as y,getWasm as b}from"./wrapper.js";import{addToExternrefTable as o,getStringFromWasm as d,passStringToWasm as i}from"./utils.js";const w=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>{b().__wbindgen_export_5.get(e.dtor)(e.a,e.b)}),u=(e,_,n,r)=>{const t={a:e,b:_,cnt:1,dtor:n},a=(...l)=>{t.cnt++;const s=t.a;t.a=0;try{return r(s,t.b,...l)}finally{--t.cnt===0?(b().__wbindgen_export_5.get(t.dtor)(s,t.b),w.unregister(t)):t.a=s}};return a.original=t,w.register(a,t,t),a},f=(e,_,n)=>b().closure30_externref_shim(e,_,n),v={},m={document:{body:{},currentScript:{}}},c={textContent:""};let g=5;const I={wbg:{__wbg_addEventListener_90e553fdce254421:(e,_,n,r)=>{const t=d(_,n);v[t]=r},__wbg_appendChild_8204974b7328bf98:()=>{},__wbg_axes_b1da727bd9ea422d:()=>{},__wbg_body_942ea927546a04ba:(...e)=>o(e[0].body),__wbg_call_672a4d21634d4a24:()=>{},__wbg_childNodes_c4423003f3a9441f:()=>[],__wbg_createElement_8c9931a732ee2fea:()=>c,__wbg_document_d249400bd7bd996d:()=>o(m.document),__wbg_from_2a5d3e218e67aa85:(...e)=>Array.from(e[0]),__wbg_getElementById_f827f0d6648718a8:()=>o({}),__wbg_getGamepads_1f997cef580c9088:(...e)=>e[0].getGamepads(),__wbg_get_67b2ba62fc30de12:(...e)=>Reflect.get(e[0],e[1]),__wbg_get_b9b93047fe3cf45b:(...e)=>e[0][e[1]>>>0],__wbg_instanceof_Gamepad_365ec8404255ce00:()=>!0,__wbg_instanceof_HtmlCanvasElement_2ea67072a7624ac5:()=>!0,__wbg_instanceof_Window_def73ea0955fc569:()=>!0,__wbg_isTrusted_cc994b7949c53593:()=>!0,__wbg_item_8be407c958853a13:(...e)=>{const _=e[0][e[1]>>>0];return o(_)},__wbg_length_49b2ba67f0897e97:()=>(g--,g<=0?0:g),__wbg_length_e2d2a49132c1b256:(...e)=>e[0].length,__wbg_movementX_1aa05f864931369b:(...e)=>e[0].movementX,__wbg_movementY_8acfedb38a70e624:(...e)=>e[0].movementY,__wbg_navigator_1577371c070c8947:(...e)=>e[0].navigator,__wbg_new_405e22f390576ce2:()=>new Object,__wbg_newnoargs_105ed471475aaf50:()=>{},__wbg_nodeType_5e1153141daac26a:()=>3,__wbg_now_807e54c39636c349:()=>y||Date.now(),__wbg_set_bb8cecf6a62b9f46:(...e)=>Reflect.set(e[0],e[1],e[2]),__wbg_settextContent_d29397f7b994d314:async(...e)=>{c.textContent=d(e[1],e[2]),p?.(c.textContent)},__wbg_static_accessor_GLOBAL_88a902d13a557d07:()=>{},__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0:()=>{},__wbg_static_accessor_SELF_37c5d418e4bf5819:()=>o(m),__wbg_static_accessor_WINDOW_5de37043a91a9c40:()=>{},__wbg_textContent_215d0f87d539368a:(e,_)=>{const[n,r]=i(_===c?c.textContent:"Blue Wizard Digital"),t=new DataView(b().memory.buffer);t.setInt32(e+4*1,r,!0),t.setInt32(e+4*0,n,!0)},__wbindgen_debug_string:()=>{},__wbindgen_init_externref_table:()=>{},__wbindgen_throw:()=>{},__wbindgen_number_new:e=>e,__wbindgen_string_new:(e,_)=>d(e,_),__wbindgen_string_get:(e,_)=>{const n=d(e,_),[r,t]=i(n),a=new DataView(b().memory.buffer);a.setInt32(e+4*1,t,!0),a.setInt32(e+4*0,r,!0)},__wbindgen_is_undefined:e=>e===void 0?1:0,__wbindgen_boolean_get:e=>{const _=e;return typeof _=="boolean"?_?1:0:2},__wbindgen_closure_wrapper100:(e,_)=>u(e,_,31,f),__wbindgen_closure_wrapper99:(e,_)=>u(e,_,31,f),__wbindgen_number_get:(e,_)=>{const n=_,r=typeof n=="number"?n:void 0,t=new DataView(b().memory.buffer);t.setFloat64(e+8*1,r,!0),t.setInt32(e+4*0,1,!0)}}};export{v as canvasListeners,I as imports,u as makeMutClosure};
3
+ import{jsResolve as p,dateToUse as y,getWasm as b}from"./wrapper.js";import{addToExternrefTable as o,getStringFromWasm as d,passStringToWasm as i}from"./utils.js";const w=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>{b().__wbindgen_export_5.get(e.dtor)(e.a,e.b)}),u=(e,_,n,r)=>{const t={a:e,b:_,cnt:1,dtor:n},a=(...l)=>{t.cnt++;const s=t.a;t.a=0;try{return r(s,t.b,...l)}finally{--t.cnt===0?(b().__wbindgen_export_5.get(t.dtor)(s,t.b),w.unregister(t)):t.a=s}};return a.original=t,w.register(a,t,t),a},f=(e,_,n)=>b().closure30_externref_shim(e,_,n),v={},m={document:{body:{},currentScript:{}}},c={textContent:""};let g=2;const I={wbg:{__wbg_addEventListener_90e553fdce254421:(e,_,n,r)=>{const t=d(_,n);v[t]=r},__wbg_appendChild_8204974b7328bf98:()=>{},__wbg_axes_b1da727bd9ea422d:()=>{},__wbg_body_942ea927546a04ba:(...e)=>o(e[0].body),__wbg_call_672a4d21634d4a24:()=>{},__wbg_childNodes_c4423003f3a9441f:()=>[],__wbg_createElement_8c9931a732ee2fea:()=>c,__wbg_document_d249400bd7bd996d:()=>o(m.document),__wbg_from_2a5d3e218e67aa85:(...e)=>Array.from(e[0]),__wbg_getElementById_f827f0d6648718a8:()=>o({}),__wbg_getGamepads_1f997cef580c9088:(...e)=>e[0].getGamepads(),__wbg_get_67b2ba62fc30de12:(...e)=>Reflect.get(e[0],e[1]),__wbg_get_b9b93047fe3cf45b:(...e)=>e[0][e[1]>>>0],__wbg_instanceof_Gamepad_365ec8404255ce00:()=>!0,__wbg_instanceof_HtmlCanvasElement_2ea67072a7624ac5:()=>!0,__wbg_instanceof_Window_def73ea0955fc569:()=>!0,__wbg_isTrusted_cc994b7949c53593:()=>!0,__wbg_item_8be407c958853a13:(...e)=>{const _=e[0][e[1]>>>0];return o(_)},__wbg_length_49b2ba67f0897e97:()=>(g--,g<=0?0:g),__wbg_length_e2d2a49132c1b256:(...e)=>e[0].length,__wbg_movementX_1aa05f864931369b:(...e)=>e[0].movementX,__wbg_movementY_8acfedb38a70e624:(...e)=>e[0].movementY,__wbg_navigator_1577371c070c8947:(...e)=>e[0].navigator,__wbg_new_405e22f390576ce2:()=>new Object,__wbg_newnoargs_105ed471475aaf50:()=>{},__wbg_nodeType_5e1153141daac26a:()=>3,__wbg_now_807e54c39636c349:()=>y||Date.now(),__wbg_set_bb8cecf6a62b9f46:(...e)=>Reflect.set(e[0],e[1],e[2]),__wbg_settextContent_d29397f7b994d314:async(...e)=>{c.textContent=d(e[1],e[2]),p?.(c.textContent)},__wbg_static_accessor_GLOBAL_88a902d13a557d07:()=>{},__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0:()=>{},__wbg_static_accessor_SELF_37c5d418e4bf5819:()=>o(m),__wbg_static_accessor_WINDOW_5de37043a91a9c40:()=>{},__wbg_textContent_215d0f87d539368a:(e,_)=>{const[n,r]=i(_===c?c.textContent:"Blue Wizard Digital"),t=new DataView(b().memory.buffer);t.setInt32(e+4*1,r,!0),t.setInt32(e+4*0,n,!0)},__wbindgen_debug_string:()=>{},__wbindgen_init_externref_table:()=>{},__wbindgen_throw:()=>{},__wbindgen_number_new:e=>e,__wbindgen_string_new:(e,_)=>d(e,_),__wbindgen_string_get:(e,_)=>{const n=d(e,_),[r,t]=i(n),a=new DataView(b().memory.buffer);a.setInt32(e+4*1,t,!0),a.setInt32(e+4*0,r,!0)},__wbindgen_is_undefined:e=>e===void 0?1:0,__wbindgen_boolean_get:e=>{const _=e;return typeof _=="boolean"?_?1:0:2},__wbindgen_closure_wrapper100:(e,_)=>u(e,_,31,f),__wbindgen_closure_wrapper99:(e,_)=>u(e,_,31,f),__wbindgen_number_get:(e,_)=>{const n=_,r=typeof n=="number"?n:void 0,t=new DataView(b().memory.buffer);t.setFloat64(e+8*1,r,!0),t.setInt32(e+4*0,1,!0)}}};export{v as canvasListeners,I as imports,u as makeMutClosure};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "yolkbot",
3
3
  "description": "create a shell shockers bot in under 10 lines.",
4
- "version": "1.0.13",
4
+ "version": "1.0.14",
5
5
  "keywords": [
6
6
  "shell shockers",
7
7
  "shellshock.io",
@@ -93,13 +93,13 @@
93
93
  },
94
94
  "dependencies": {
95
95
  "smallsocks": "^1.0.2",
96
- "undici": "^7.9.0",
96
+ "undici": "^7.10.0",
97
97
  "ws": "^8.18.2"
98
98
  },
99
99
  "devDependencies": {
100
- "@stylistic/eslint-plugin": "^4.2.0",
100
+ "@stylistic/eslint-plugin": "^4.4.0",
101
101
  "esbuild": "^0.25.4",
102
102
  "eslint": "^9.27.0",
103
- "globals": "^15.15.0"
103
+ "globals": "^16.2.0"
104
104
  }
105
105
  }