yolkbot 1.5.7 → 1.5.9

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 (85) hide show
  1. package/browser/build/global.js +1 -1
  2. package/browser/build/module.js +1 -1
  3. package/dist/api.js +1 -244
  4. package/dist/bot/GamePlayer.js +1 -84
  5. package/dist/bot.js +1 -1226
  6. package/dist/comm/CommIn.js +1 -76
  7. package/dist/comm/CommOut.js +1 -60
  8. package/dist/constants/CloseCode.js +1 -27
  9. package/dist/constants/CommCode.js +1 -53
  10. package/dist/constants/challenges.js +1 -1821
  11. package/dist/constants/findItemById.js +1 -3
  12. package/dist/constants/guns.js +1 -155
  13. package/dist/constants/index.js +1 -141
  14. package/dist/constants/items.js +1 -45979
  15. package/dist/constants/maps.js +1 -1289
  16. package/dist/constants/regions.js +1 -30
  17. package/dist/dispatches/BanPlayerDispatch.js +1 -32
  18. package/dist/dispatches/BootPlayerDispatch.js +1 -21
  19. package/dist/dispatches/ChatDispatch.js +1 -32
  20. package/dist/dispatches/FireDispatch.js +1 -15
  21. package/dist/dispatches/GameOptionsDispatch.js +1 -66
  22. package/dist/dispatches/GoToAmmoDispatch.js +1 -37
  23. package/dist/dispatches/GoToCoopDispatch.js +1 -37
  24. package/dist/dispatches/GoToGrenadeDispatch.js +1 -37
  25. package/dist/dispatches/GoToPlayerDispatch.js +1 -34
  26. package/dist/dispatches/GoToSpatulaDispatch.js +1 -23
  27. package/dist/dispatches/LookAtDispatch.js +1 -37
  28. package/dist/dispatches/LookAtPosDispatch.js +1 -29
  29. package/dist/dispatches/MeleeDispatch.js +1 -26
  30. package/dist/dispatches/MovementDispatch.js +1 -26
  31. package/dist/dispatches/PauseDispatch.js +1 -18
  32. package/dist/dispatches/ReloadDispatch.js +1 -35
  33. package/dist/dispatches/ReportPlayerDispatch.js +1 -44
  34. package/dist/dispatches/ResetGameDispatch.js +1 -19
  35. package/dist/dispatches/SaveLoadoutDispatch.js +1 -106
  36. package/dist/dispatches/SpawnDispatch.js +1 -26
  37. package/dist/dispatches/SwapWeaponDispatch.js +1 -25
  38. package/dist/dispatches/SwitchTeamDispatch.js +1 -34
  39. package/dist/dispatches/ThrowGrenadeDispatch.js +1 -21
  40. package/dist/dispatches/index.js +1 -73
  41. package/dist/enums.js +1 -114
  42. package/dist/env/fetch.js +8 -129
  43. package/dist/env/globals.js +1 -17
  44. package/dist/index.js +1 -22
  45. package/dist/packets/addPlayer.js +1 -63
  46. package/dist/packets/beginShellStreak.js +1 -44
  47. package/dist/packets/challengeCompleted.js +1 -16
  48. package/dist/packets/changeCharacter.js +1 -46
  49. package/dist/packets/chat.js +1 -10
  50. package/dist/packets/collectItem.js +1 -26
  51. package/dist/packets/die.js +1 -40
  52. package/dist/packets/endShellStreak.js +1 -21
  53. package/dist/packets/eventModifier.js +1 -8
  54. package/dist/packets/explode.js +1 -19
  55. package/dist/packets/fire.js +1 -21
  56. package/dist/packets/gameAction.js +1 -33
  57. package/dist/packets/gameJoined.js +1 -64
  58. package/dist/packets/gameOptions.js +1 -27
  59. package/dist/packets/hitMe.js +1 -12
  60. package/dist/packets/hitMeHardBoiled.js +1 -18
  61. package/dist/packets/hitThem.js +1 -12
  62. package/dist/packets/melee.js +1 -8
  63. package/dist/packets/metaGameState.js +1 -62
  64. package/dist/packets/pause.js +1 -17
  65. package/dist/packets/ping.js +1 -19
  66. package/dist/packets/playerInfo.js +1 -15
  67. package/dist/packets/reload.js +1 -17
  68. package/dist/packets/removePlayer.js +1 -10
  69. package/dist/packets/respawn.js +1 -31
  70. package/dist/packets/socketReady.js +1 -16
  71. package/dist/packets/spawnItem.js +1 -11
  72. package/dist/packets/swapWeapon.js +1 -11
  73. package/dist/packets/switchTeam.js +1 -13
  74. package/dist/packets/syncMe.js +1 -25
  75. package/dist/packets/syncThem.js +1 -63
  76. package/dist/packets/throwGrenade.js +1 -17
  77. package/dist/packets/updateBalance.js +1 -8
  78. package/dist/pathing/astar.js +1 -68
  79. package/dist/pathing/mapnode.js +1 -284
  80. package/dist/socket.js +1 -107
  81. package/dist/util.js +1 -128
  82. package/dist/wasm/bytes.js +1 -8
  83. package/dist/wasm/direct.js +1 -84
  84. package/dist/wasm/legacy.js +1 -176
  85. package/package.json +2 -7
@@ -1,63 +1 @@
1
- import GamePlayer from "../bot/GamePlayer.js";
2
- import CommIn from "../comm/CommIn.js";
3
- import { findItemById } from "../constants/findItemById.js";
4
- import { GameMode } from "../constants/index.js";
5
- import { Intents } from "../enums.js";
6
- const processAddPlayerPacket = (bot) => {
7
- const id = CommIn.unPackInt8U();
8
- const findCosmetics = bot.intents.includes(Intents.COSMETIC_DATA);
9
- const playerData = {
10
- id,
11
- uniqueId: CommIn.unPackString(),
12
- name: CommIn.unPackString(),
13
- safeName: CommIn.unPackString(),
14
- charClass: CommIn.unPackInt8U(),
15
- team: CommIn.unPackInt8U(),
16
- primaryWeaponItem: findCosmetics ? findItemById(CommIn.unPackInt16U()) : CommIn.unPackInt16U(),
17
- secondaryWeaponItem: findCosmetics ? findItemById(CommIn.unPackInt16U()) : CommIn.unPackInt16U(),
18
- shellColor: CommIn.unPackInt8U(),
19
- hatItem: findCosmetics ? findItemById(CommIn.unPackInt16U()) : CommIn.unPackInt16U(),
20
- stampItem: findCosmetics ? findItemById(CommIn.unPackInt16U()) : CommIn.unPackInt16U(),
21
- stampPosX: CommIn.unPackInt8(),
22
- stampPosY: CommIn.unPackInt8(),
23
- grenadeItem: findCosmetics ? findItemById(CommIn.unPackInt16U()) : CommIn.unPackInt16U(),
24
- meleeItem: findCosmetics ? findItemById(CommIn.unPackInt16U()) : CommIn.unPackInt16U(),
25
- x: CommIn.unPackFloat(),
26
- y: CommIn.unPackFloat(),
27
- z: CommIn.unPackFloat(),
28
- $dx: CommIn.unPackFloat(),
29
- $dy: CommIn.unPackFloat(),
30
- $dz: CommIn.unPackFloat(),
31
- yaw: CommIn.unPackRadU(),
32
- pitch: CommIn.unPackRad(),
33
- score: CommIn.unPackInt32U(),
34
- $kills: CommIn.unPackInt16U(),
35
- $deaths: CommIn.unPackInt16U(),
36
- $streak: CommIn.unPackInt16U(),
37
- totalKills: CommIn.unPackInt32U(),
38
- totalDeaths: CommIn.unPackInt32U(),
39
- bestStreak: CommIn.unPackInt16U(),
40
- $bestOverallStreak: CommIn.unPackInt16U(),
41
- shield: CommIn.unPackInt8U(),
42
- hp: CommIn.unPackInt8U(),
43
- playing: CommIn.unPackInt8U(),
44
- weaponIdx: CommIn.unPackInt8U(),
45
- $controlKeys: CommIn.unPackInt8U(),
46
- upgradeProductId: CommIn.unPackInt8U(),
47
- activeShellStreaks: CommIn.unPackInt8U(),
48
- social: CommIn.unPackLongString(),
49
- hideBadge: CommIn.unPackInt8U()
50
- };
51
- bot.game.mapIdx = CommIn.unPackInt8U();
52
- bot.game.isPrivate = CommIn.unPackInt8U() === 1;
53
- bot.game.gameModeId = CommIn.unPackInt8U();
54
- const player = new GamePlayer(playerData, bot.game.gameMode === GameMode.KOTC ? bot.game.kotc.activeZone : null);
55
- if (!bot.players[playerData.id])
56
- bot.players[playerData.id] = player;
57
- bot.$emit("playerJoin", player);
58
- if (bot.me.id === playerData.id) {
59
- bot.me = player;
60
- bot.$emit("botJoin", bot.me);
61
- }
62
- };
63
- export default processAddPlayerPacket;
1
+ import GamePlayer from"../bot/GamePlayer.js";import CommIn from"../comm/CommIn.js";import{findItemById}from"../constants/findItemById.js";import{GameMode}from"../constants/index.js";import{Intents}from"../enums.js";const processAddPlayerPacket=(bot)=>{const id=CommIn.unPackInt8U();const findCosmetics=bot.intents.includes(Intents.COSMETIC_DATA);const playerData={id,uniqueId:CommIn.unPackString(),name:CommIn.unPackString(),safeName:CommIn.unPackString(),charClass:CommIn.unPackInt8U(),team:CommIn.unPackInt8U(),primaryWeaponItem:findCosmetics?findItemById(CommIn.unPackInt16U()):CommIn.unPackInt16U(),secondaryWeaponItem:findCosmetics?findItemById(CommIn.unPackInt16U()):CommIn.unPackInt16U(),shellColor:CommIn.unPackInt8U(),hatItem:findCosmetics?findItemById(CommIn.unPackInt16U()):CommIn.unPackInt16U(),stampItem:findCosmetics?findItemById(CommIn.unPackInt16U()):CommIn.unPackInt16U(),stampPosX:CommIn.unPackInt8(),stampPosY:CommIn.unPackInt8(),grenadeItem:findCosmetics?findItemById(CommIn.unPackInt16U()):CommIn.unPackInt16U(),meleeItem:findCosmetics?findItemById(CommIn.unPackInt16U()):CommIn.unPackInt16U(),x:CommIn.unPackFloat(),y:CommIn.unPackFloat(),z:CommIn.unPackFloat(),$dx:CommIn.unPackFloat(),$dy:CommIn.unPackFloat(),$dz:CommIn.unPackFloat(),yaw:CommIn.unPackRadU(),pitch:CommIn.unPackRad(),score:CommIn.unPackInt32U(),$kills:CommIn.unPackInt16U(),$deaths:CommIn.unPackInt16U(),$streak:CommIn.unPackInt16U(),totalKills:CommIn.unPackInt32U(),totalDeaths:CommIn.unPackInt32U(),bestStreak:CommIn.unPackInt16U(),$bestOverallStreak:CommIn.unPackInt16U(),shield:CommIn.unPackInt8U(),hp:CommIn.unPackInt8U(),playing:CommIn.unPackInt8U(),weaponIdx:CommIn.unPackInt8U(),$controlKeys:CommIn.unPackInt8U(),upgradeProductId:CommIn.unPackInt8U(),activeShellStreaks:CommIn.unPackInt8U(),social:CommIn.unPackLongString(),hideBadge:CommIn.unPackInt8U()};bot.game.mapIdx=CommIn.unPackInt8U();bot.game.isPrivate=CommIn.unPackInt8U()===1;bot.game.gameModeId=CommIn.unPackInt8U();const player=new GamePlayer(playerData,bot.game.gameMode===GameMode.KOTC?bot.game.kotc.activeZone:null);if(!bot.players[playerData.id])bot.players[playerData.id]=player;bot.$emit("playerJoin",player);if(bot.me.id===playerData.id){bot.me=player;bot.$emit("botJoin",bot.me)}};export default processAddPlayerPacket;
@@ -1,44 +1 @@
1
- import CommIn from "../comm/CommIn.js";
2
- import { ShellStreak } from "../constants/index.js";
3
- const processBeginShellStreakPacket = (bot) => {
4
- const id = CommIn.unPackInt8U();
5
- const ksType = CommIn.unPackInt8U();
6
- const player = bot.players[id];
7
- if (!player)
8
- return;
9
- switch (ksType) {
10
- case ShellStreak.HardBoiled:
11
- if (id === bot.me.id)
12
- bot.me.shieldHp = 100;
13
- player.streakRewards.push(ShellStreak.HardBoiled);
14
- break;
15
- case ShellStreak.EggBreaker:
16
- player.streakRewards.push(ShellStreak.EggBreaker);
17
- break;
18
- case ShellStreak.Restock: {
19
- player.grenades = 3;
20
- if (player.weapons[0] && player.weapons[0].ammo) {
21
- player.weapons[0].ammo.rounds = player.weapons[0].ammo.capacity;
22
- player.weapons[0].ammo.store = player.weapons[0].ammo.storeMax;
23
- }
24
- if (player.weapons[1] && player.weapons[1].ammo) {
25
- player.weapons[1].ammo.rounds = player.weapons[1].ammo.capacity;
26
- player.weapons[1].ammo.store = player.weapons[1].ammo.storeMax;
27
- }
28
- break;
29
- }
30
- case ShellStreak.OverHeal:
31
- player.hp = Math.min(200, player.hp + 100);
32
- player.streakRewards.push(ShellStreak.OverHeal);
33
- break;
34
- case ShellStreak.DoubleEggs:
35
- player.streakRewards.push(ShellStreak.DoubleEggs);
36
- break;
37
- case ShellStreak.MiniEgg:
38
- player.scale = 0.5;
39
- player.streakRewards.push(ShellStreak.MiniEgg);
40
- break;
41
- }
42
- bot.$emit("playerBeginStreak", player, ksType);
43
- };
44
- export default processBeginShellStreakPacket;
1
+ import CommIn from"../comm/CommIn.js";import{ShellStreak}from"../constants/index.js";const processBeginShellStreakPacket=(bot)=>{const id=CommIn.unPackInt8U();const ksType=CommIn.unPackInt8U();const 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:{player.grenades=3;if(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)};export default processBeginShellStreakPacket;
@@ -1,16 +1 @@
1
- import CommIn from "../comm/CommIn.js";
2
- import { Intents } from "../enums.js";
3
- const processChallengeCompletedPacket = (bot) => {
4
- const id = CommIn.unPackInt8U();
5
- const challengeId = CommIn.unPackInt8U();
6
- const player = bot.players[id];
7
- if (!player)
8
- return;
9
- if (!bot.intents.includes(Intents.CHALLENGES))
10
- return bot.$emit("challengeComplete", player, challengeId);
11
- const challenge = bot.account.challenges.find((c) => c.id === challengeId);
12
- bot.$emit("challengeComplete", player, challenge);
13
- if (player.id === bot.me.id)
14
- bot.refreshChallenges();
15
- };
16
- export default processChallengeCompletedPacket;
1
+ import CommIn from"../comm/CommIn.js";import{Intents}from"../enums.js";const processChallengeCompletedPacket=(bot)=>{const id=CommIn.unPackInt8U();const challengeId=CommIn.unPackInt8U();const player=bot.players[id];if(!player)return;if(!bot.intents.includes(Intents.CHALLENGES))return bot.$emit("challengeComplete",player,challengeId);const challenge=bot.account.challenges.find((c)=>c.id===challengeId);bot.$emit("challengeComplete",player,challenge);if(player.id===bot.me.id)bot.refreshChallenges()};export default processChallengeCompletedPacket;
@@ -1,46 +1 @@
1
- import CommIn from "../comm/CommIn.js";
2
- import { createGun } from "../util.js";
3
- import { findItemById } from "../constants/findItemById.js";
4
- import { GunList } from "../constants/index.js";
5
- import { Intents } from "../enums.js";
6
- const processChangeCharacterPacket = (bot) => {
7
- const id = CommIn.unPackInt8U();
8
- const weaponIndex = CommIn.unPackInt8U();
9
- const primaryWeaponIdx = CommIn.unPackInt16U();
10
- const secondaryWeaponIdx = CommIn.unPackInt16U();
11
- const shellColor = CommIn.unPackInt8U();
12
- const hatIdx = CommIn.unPackInt16U();
13
- const stampIdx = CommIn.unPackInt16U();
14
- const grenadeIdx = CommIn.unPackInt16U();
15
- const meleeIdx = CommIn.unPackInt16U();
16
- const stampPositionX = CommIn.unPackInt8();
17
- const stampPositionY = CommIn.unPackInt8();
18
- const findCosmetics = bot.intents.includes(Intents.COSMETIC_DATA);
19
- const primaryWeaponItem = findCosmetics ? findItemById(primaryWeaponIdx) : primaryWeaponIdx;
20
- const secondaryWeaponItem = findCosmetics ? findItemById(secondaryWeaponIdx) : secondaryWeaponIdx;
21
- const hatItem = findCosmetics ? findItemById(hatIdx) : hatIdx;
22
- const stampItem = findCosmetics ? findItemById(stampIdx) : stampIdx;
23
- const grenadeItem = findCosmetics ? findItemById(grenadeIdx) : grenadeIdx;
24
- const meleeItem = findCosmetics ? findItemById(meleeIdx) : meleeIdx;
25
- const player = bot.players[id];
26
- if (player) {
27
- const oldCharacter = structuredClone(player.character);
28
- const oldWeaponIdx = player.selectedGun;
29
- player.character.eggColor = shellColor;
30
- player.character.primaryGun = primaryWeaponItem;
31
- player.character.secondaryGun = secondaryWeaponItem;
32
- player.character.stamp = stampItem;
33
- player.character.hat = hatItem;
34
- player.character.grenade = grenadeItem;
35
- player.character.melee = meleeItem;
36
- player.character.stampPos.x = stampPositionX;
37
- player.character.stampPos.y = stampPositionY;
38
- player.selectedGun = weaponIndex;
39
- player.weapons[0] = createGun(GunList[weaponIndex]);
40
- if (oldWeaponIdx !== player.selectedGun)
41
- bot.$emit("playerChangeGun", player, oldWeaponIdx, player.selectedGun);
42
- if (JSON.stringify(oldCharacter) !== JSON.stringify(player.character))
43
- bot.$emit("playerChangeCharacter", player, oldCharacter, player.character);
44
- }
45
- };
46
- export default processChangeCharacterPacket;
1
+ import CommIn from"../comm/CommIn.js";import{createGun}from"../util.js";import{findItemById}from"../constants/findItemById.js";import{GunList}from"../constants/index.js";import{Intents}from"../enums.js";const processChangeCharacterPacket=(bot)=>{const id=CommIn.unPackInt8U();const weaponIndex=CommIn.unPackInt8U();const primaryWeaponIdx=CommIn.unPackInt16U();const secondaryWeaponIdx=CommIn.unPackInt16U();const shellColor=CommIn.unPackInt8U();const hatIdx=CommIn.unPackInt16U();const stampIdx=CommIn.unPackInt16U();const grenadeIdx=CommIn.unPackInt16U();const meleeIdx=CommIn.unPackInt16U();const stampPositionX=CommIn.unPackInt8();const stampPositionY=CommIn.unPackInt8();const findCosmetics=bot.intents.includes(Intents.COSMETIC_DATA);const primaryWeaponItem=findCosmetics?findItemById(primaryWeaponIdx):primaryWeaponIdx;const secondaryWeaponItem=findCosmetics?findItemById(secondaryWeaponIdx):secondaryWeaponIdx;const hatItem=findCosmetics?findItemById(hatIdx):hatIdx;const stampItem=findCosmetics?findItemById(stampIdx):stampIdx;const grenadeItem=findCosmetics?findItemById(grenadeIdx):grenadeIdx;const meleeItem=findCosmetics?findItemById(meleeIdx):meleeIdx;const player=bot.players[id];if(player){const oldCharacter=structuredClone(player.character);const oldWeaponIdx=player.selectedGun;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]);if(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)}};export default processChangeCharacterPacket;
@@ -1,10 +1 @@
1
- import CommIn from "../comm/CommIn.js";
2
- const processChatPacket = (bot) => {
3
- const id = CommIn.unPackInt8U();
4
- const msgFlags = CommIn.unPackInt8U();
5
- const text = CommIn.unPackString();
6
- const player = bot.players[id];
7
- if (player)
8
- bot.$emit("chat", player, text, msgFlags);
9
- };
10
- export default processChatPacket;
1
+ import CommIn from"../comm/CommIn.js";const processChatPacket=(bot)=>{const id=CommIn.unPackInt8U();const msgFlags=CommIn.unPackInt8U();const text=CommIn.unPackString();const player=bot.players[id];if(player)bot.$emit("chat",player,text,msgFlags)};export default processChatPacket;
@@ -1,26 +1 @@
1
- import CommIn from "../comm/CommIn.js";
2
- import { CollectType } from "../constants/index.js";
3
- const processCollectItemPacket = (bot) => {
4
- const playerId = CommIn.unPackInt8U();
5
- const type = CommIn.unPackInt8U();
6
- const applyToWeaponIdx = CommIn.unPackInt8U();
7
- const id = CommIn.unPackInt16U();
8
- const player = bot.players[playerId];
9
- if (!player)
10
- return;
11
- bot.game.collectibles[type] = bot.game.collectibles[type].filter((c) => c.id !== id);
12
- if (type === CollectType.Ammo) {
13
- const playerWeapon = player.weapons[applyToWeaponIdx];
14
- if (playerWeapon && playerWeapon.ammo) {
15
- playerWeapon.ammo.store = Math.min(playerWeapon.ammo.storeMax, playerWeapon.ammo.store + playerWeapon.ammo.pickup);
16
- bot.$emit("playerCollectAmmo", player, playerWeapon, id);
17
- }
18
- }
19
- if (type === CollectType.Grenade) {
20
- player.grenades++;
21
- if (player.grenades > 3)
22
- player.grenades = 3;
23
- bot.$emit("playerCollectGrenade", player, id);
24
- }
25
- };
26
- export default processCollectItemPacket;
1
+ import CommIn from"../comm/CommIn.js";import{CollectType}from"../constants/index.js";const processCollectItemPacket=(bot)=>{const playerId=CommIn.unPackInt8U();const type=CommIn.unPackInt8U();const applyToWeaponIdx=CommIn.unPackInt8U();const id=CommIn.unPackInt16U();const player=bot.players[playerId];if(!player)return;bot.game.collectibles[type]=bot.game.collectibles[type].filter((c)=>c.id!==id);if(type===CollectType.Ammo){const 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){player.grenades++;if(player.grenades>3)player.grenades=3;bot.$emit("playerCollectGrenade",player,id)}};export default processCollectItemPacket;
@@ -1,40 +1 @@
1
- import CommIn from "../comm/CommIn.js";
2
- import { ZoneLeaveReason } from "../enums.js";
3
- const processDiePacket = (bot) => {
4
- const killedId = CommIn.unPackInt8U();
5
- const killerId = CommIn.unPackInt8U();
6
- CommIn.unPackInt8U();
7
- CommIn.unPackInt8U();
8
- const damageCauseInt = CommIn.unPackInt8U();
9
- const killed = bot.players[killedId];
10
- const killer = bot.players[killerId];
11
- const oldKilled = killed ? structuredClone(killed) : null;
12
- if (bot.me && killed) {
13
- if (killed.id === bot.me.id) {
14
- bot.lastDeathTime = Date.now();
15
- if (bot.pathing.activePath) {
16
- bot.pathing.activePath = null;
17
- bot.pathing.activeNode = null;
18
- bot.pathing.activeNodeIdx = 0;
19
- }
20
- bot.state.controlKeys = 0;
21
- }
22
- killed.playing = false;
23
- killed.streak = 0;
24
- killed.hp = 100;
25
- killed.spawnShield = 0;
26
- killed.stats.totalDeaths++;
27
- if (killed.inKotcZone) {
28
- killed.inKotcZone = false;
29
- bot.$emit("playerLeaveZone", killed, ZoneLeaveReason.Killed);
30
- }
31
- }
32
- if (killer) {
33
- killer.streak++;
34
- killer.stats.totalKills++;
35
- if (killer.streak > killer.stats.bestStreak)
36
- killer.stats.bestStreak = killer.streak;
37
- }
38
- bot.$emit("playerDeath", killed, killer, oldKilled, damageCauseInt);
39
- };
40
- export default processDiePacket;
1
+ import CommIn from"../comm/CommIn.js";import{ZoneLeaveReason}from"../enums.js";const processDiePacket=(bot)=>{const killedId=CommIn.unPackInt8U();const killerId=CommIn.unPackInt8U();CommIn.unPackInt8U();CommIn.unPackInt8U();const damageCauseInt=CommIn.unPackInt8U();const killed=bot.players[killedId];const killer=bot.players[killerId];const oldKilled=killed?structuredClone(killed):null;if(bot.me&&killed){if(killed.id===bot.me.id){bot.lastDeathTime=Date.now();if(bot.pathing.activePath){bot.pathing.activePath=null;bot.pathing.activeNode=null;bot.pathing.activeNodeIdx=0}bot.state.controlKeys=0}killed.playing=false;killed.streak=0;killed.hp=100;killed.spawnShield=0;killed.stats.totalDeaths++;if(killed.inKotcZone){killed.inKotcZone=false;bot.$emit("playerLeaveZone",killed,ZoneLeaveReason.Killed)}}if(killer){killer.streak++;killer.stats.totalKills++;if(killer.streak>killer.stats.bestStreak)killer.stats.bestStreak=killer.streak}bot.$emit("playerDeath",killed,killer,oldKilled,damageCauseInt)};export default processDiePacket;
@@ -1,21 +1 @@
1
- import CommIn from "../comm/CommIn.js";
2
- import { ShellStreak } from "../constants/index.js";
3
- const timedStreaks = [
4
- ShellStreak.EggBreaker,
5
- ShellStreak.OverHeal,
6
- ShellStreak.DoubleEggs,
7
- ShellStreak.MiniEgg
8
- ];
9
- const processEndShellStreakPacket = (bot) => {
10
- const id = CommIn.unPackInt8U();
11
- const ksType = CommIn.unPackInt8U();
12
- const player = bot.players[id];
13
- if (!player)
14
- return;
15
- if (timedStreaks.includes(ksType) && player.streakRewards.includes(ksType))
16
- player.streakRewards = player.streakRewards.filter((r) => r !== ksType);
17
- if (ksType === ShellStreak.MiniEgg)
18
- player.scale = 1;
19
- bot.$emit("playerEndStreak", player, ksType);
20
- };
21
- export default processEndShellStreakPacket;
1
+ import CommIn from"../comm/CommIn.js";import{ShellStreak}from"../constants/index.js";const timedStreaks=[ShellStreak.EggBreaker,ShellStreak.OverHeal,ShellStreak.DoubleEggs,ShellStreak.MiniEgg];const processEndShellStreakPacket=(bot)=>{const id=CommIn.unPackInt8U();const ksType=CommIn.unPackInt8U();const 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)};export default processEndShellStreakPacket;
@@ -1,8 +1 @@
1
- import CommOut from "../comm/CommOut.js";
2
- import CommCode from "../constants/CommCode.js";
3
- const processEventModifierPacket = (bot) => {
4
- const out = new CommOut;
5
- out.packInt8(CommCode.eventModifier);
6
- out.send(bot.game.socket);
7
- };
8
- export default processEventModifierPacket;
1
+ import CommOut from"../comm/CommOut.js";import CommCode from"../constants/CommCode.js";const processEventModifierPacket=(bot)=>{const out=new CommOut;out.packInt8(CommCode.eventModifier);out.send(bot.game.socket)};export default processEventModifierPacket;
@@ -1,19 +1 @@
1
- import CommIn from "../comm/CommIn.js";
2
- import { findItemById, ItemType } from "../constants/index.js";
3
- import { Intents } from "../enums.js";
4
- const processExplodePacket = (bot) => {
5
- const itemType = CommIn.unPackInt8U();
6
- let item = CommIn.unPackInt16U();
7
- const x = CommIn.unPackFloat();
8
- const y = CommIn.unPackFloat();
9
- const z = CommIn.unPackFloat();
10
- const damage = CommIn.unPackInt8U();
11
- const radius = CommIn.unPackFloat();
12
- if (bot.intents.includes(Intents.COSMETIC_DATA))
13
- item = findItemById(item);
14
- if (itemType === ItemType.Grenade)
15
- bot.$emit("grenadeExplode", item, { x, y, z }, damage, radius);
16
- else
17
- bot.$emit("rocketHit", { x, y, z }, damage, radius);
18
- };
19
- export default processExplodePacket;
1
+ import CommIn from"../comm/CommIn.js";import{findItemById,ItemType}from"../constants/index.js";import{Intents}from"../enums.js";const processExplodePacket=(bot)=>{const itemType=CommIn.unPackInt8U();let item=CommIn.unPackInt16U();const x=CommIn.unPackFloat();const y=CommIn.unPackFloat();const z=CommIn.unPackFloat();const damage=CommIn.unPackInt8U();const radius=CommIn.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)};export default processExplodePacket;
@@ -1,21 +1 @@
1
- import CommIn from "../comm/CommIn.js";
2
- const processFirePacket = (bot) => {
3
- const id = CommIn.unPackInt8U();
4
- const bullet = {
5
- posX: CommIn.unPackFloat(),
6
- posY: CommIn.unPackFloat(),
7
- posZ: CommIn.unPackFloat(),
8
- dirX: CommIn.unPackFloat(),
9
- dirY: CommIn.unPackFloat(),
10
- dirZ: CommIn.unPackFloat()
11
- };
12
- const player = bot.players[id];
13
- if (!player)
14
- return;
15
- const playerWeapon = player.weapons[player.activeGun];
16
- if (playerWeapon && playerWeapon.ammo) {
17
- playerWeapon.ammo.rounds--;
18
- bot.$emit("playerFire", player, playerWeapon, bullet);
19
- }
20
- };
21
- export default processFirePacket;
1
+ import CommIn from"../comm/CommIn.js";const processFirePacket=(bot)=>{const id=CommIn.unPackInt8U();const bullet={posX:CommIn.unPackFloat(),posY:CommIn.unPackFloat(),posZ:CommIn.unPackFloat(),dirX:CommIn.unPackFloat(),dirY:CommIn.unPackFloat(),dirZ:CommIn.unPackFloat()};const player=bot.players[id];if(!player)return;const playerWeapon=player.weapons[player.activeGun];if(playerWeapon&&playerWeapon.ammo){playerWeapon.ammo.rounds--;bot.$emit("playerFire",player,playerWeapon,bullet)}};export default processFirePacket;
@@ -1,33 +1 @@
1
- import CommIn from "../comm/CommIn.js";
2
- import { CoopState, GameAction, GameMode } from "../constants/index.js";
3
- const processGameActionPacket = (bot) => {
4
- const action = CommIn.unPackInt8U();
5
- if (action === GameAction.Pause) {
6
- bot.$emit("gameForcePause");
7
- setTimeout(() => {
8
- if (bot.me)
9
- bot.me.playing = false;
10
- }, 3000);
11
- }
12
- if (action === GameAction.Reset) {
13
- Object.values(bot.players).forEach((player) => player.streak = 0);
14
- if (bot.game.gameModeId !== GameMode.FFA)
15
- bot.game.teamScore = [0, 0, 0];
16
- if (bot.game.gameModeId === GameMode.Spatula) {
17
- bot.game.spatula.controlledBy = 0;
18
- bot.game.spatula.controlledByTeam = 0;
19
- bot.game.spatula.coords = { x: 0, y: 0, z: 0 };
20
- }
21
- if (bot.game.gameModeId === GameMode.KOTC) {
22
- bot.game.kotc.stage = CoopState.Capturing;
23
- bot.game.kotc.zoneIdx = 0;
24
- bot.game.kotc.activeZone = null;
25
- bot.game.kotc.teamCapturing = 0;
26
- bot.game.kotc.captureProgress = 0;
27
- bot.game.kotc.numCapturing = 0;
28
- bot.game.kotc.capturePercent = 0;
29
- }
30
- bot.$emit("gameReset");
31
- }
32
- };
33
- export default processGameActionPacket;
1
+ import CommIn from"../comm/CommIn.js";import{CoopState,GameAction,GameMode}from"../constants/index.js";const processGameActionPacket=(bot)=>{const action=CommIn.unPackInt8U();if(action===GameAction.Pause){bot.$emit("gameForcePause");setTimeout(()=>{if(bot.me)bot.me.playing=false},3000)}if(action===GameAction.Reset){Object.values(bot.players).forEach((player)=>player.streak=0);if(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.teamCapturing=0;bot.game.kotc.captureProgress=0;bot.game.kotc.numCapturing=0;bot.game.kotc.capturePercent=0}bot.$emit("gameReset")}};export default processGameActionPacket;
@@ -1,64 +1 @@
1
- import CommIn from "../comm/CommIn.js";
2
- import CommOut from "../comm/CommOut.js";
3
- import CommCode from "../constants/CommCode.js";
4
- import AStar from "../pathing/astar.js";
5
- import { NodeList } from "../pathing/mapnode.js";
6
- import { fetchMap, initKotcZones } from "../util.js";
7
- import { GameMode } from "../constants/index.js";
8
- import { Intents } from "../enums.js";
9
- import { Maps } from "../constants/maps.js";
10
- const GameModeById = Object.fromEntries(Object.entries(GameMode).map(([key, value]) => [value, key]));
11
- const processGameJoinedPacket = async (bot) => {
12
- bot.me.id = CommIn.unPackInt8U();
13
- bot.me.team = CommIn.unPackInt8U();
14
- bot.game.gameModeId = CommIn.unPackInt8U();
15
- bot.game.gameMode = GameModeById[bot.game.gameModeId];
16
- bot.game.mapIdx = CommIn.unPackInt8U();
17
- bot.game.map = Maps[bot.game.mapIdx];
18
- bot.game.playerLimit = CommIn.unPackInt8U();
19
- bot.game.isGameOwner = CommIn.unPackInt8U() === 1;
20
- bot.game.isPrivate = CommIn.unPackInt8U() === 1 || bot.game.isGameOwner;
21
- CommIn.unPackInt8U();
22
- if (bot.intents.includes(Intents.LOAD_MAP) || bot.intents.includes(Intents.PATHFINDING)) {
23
- const map = await fetchMap(bot.game.map.filename, bot.game.map.hash);
24
- if (bot.game.map)
25
- bot.game.map.raw = map;
26
- if (bot.game.gameModeId === GameMode.KOTC) {
27
- const meshData = bot.game.map.raw.data["DYNAMIC.capture-zone.none"];
28
- if (meshData) {
29
- bot.game.map.zones = initKotcZones(meshData);
30
- if (!bot.game.kotc.activeZone)
31
- bot.game.kotc.activeZone = bot.game.map.zones[bot.game.kotc.zoneIdx - 1];
32
- } else
33
- delete bot.game.map.zones;
34
- }
35
- if (bot.intents.includes(Intents.PATHFINDING)) {
36
- bot.pathing.nodeList = new NodeList(bot.game.map.raw);
37
- bot.pathing.astar = new AStar(bot.pathing.nodeList);
38
- }
39
- bot.$emit("mapLoad", bot.game.map.raw);
40
- }
41
- bot.state.inGame = true;
42
- bot.lastDeathTime = Date.now();
43
- const out = new CommOut;
44
- out.packInt8(CommCode.clientReady);
45
- out.send(bot.game.socket);
46
- if (!bot.intents.includes(Intents.MANUAL_UPDATE))
47
- bot.updateIntervalId = setInterval(() => bot.update(), 100 / 3);
48
- if (bot.intents.includes(Intents.PING)) {
49
- bot.lastPingTime = Date.now();
50
- const out2 = new CommOut;
51
- out2.packInt8(CommCode.ping);
52
- out2.send(bot.game.socket);
53
- }
54
- if (bot.intents.includes(Intents.NO_AFK_KICK))
55
- bot.afkKickInterval = setInterval(() => {
56
- if (bot.state.inGame && !bot.me.playing && Date.now() - bot.lastDeathTime >= 15000) {
57
- const out3 = new CommOut;
58
- out3.packInt8(CommCode.keepAlive);
59
- out3.send(bot.game.socket);
60
- }
61
- }, 15000);
62
- bot.$emit("gameReady");
63
- };
64
- export default processGameJoinedPacket;
1
+ import CommIn from"../comm/CommIn.js";import CommOut from"../comm/CommOut.js";import CommCode from"../constants/CommCode.js";import AStar from"../pathing/astar.js";import{NodeList}from"../pathing/mapnode.js";import{fetchMap,initKotcZones}from"../util.js";import{GameMode}from"../constants/index.js";import{Intents}from"../enums.js";import{Maps}from"../constants/maps.js";const GameModeById=Object.fromEntries(Object.entries(GameMode).map(([key,value])=>[value,key]));const processGameJoinedPacket=async(bot)=>{bot.me.id=CommIn.unPackInt8U();bot.me.team=CommIn.unPackInt8U();bot.game.gameModeId=CommIn.unPackInt8U();bot.game.gameMode=GameModeById[bot.game.gameModeId];bot.game.mapIdx=CommIn.unPackInt8U();bot.game.map=Maps[bot.game.mapIdx];bot.game.playerLimit=CommIn.unPackInt8U();bot.game.isGameOwner=CommIn.unPackInt8U()===1;bot.game.isPrivate=CommIn.unPackInt8U()===1||bot.game.isGameOwner;CommIn.unPackInt8U();if(bot.intents.includes(Intents.LOAD_MAP)||bot.intents.includes(Intents.PATHFINDING)){const 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){const meshData=bot.game.map.raw.data["DYNAMIC.capture-zone.none"];if(meshData){bot.game.map.zones=initKotcZones(meshData);if(!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=true;bot.lastDeathTime=Date.now();const out=new CommOut;out.packInt8(CommCode.clientReady);out.send(bot.game.socket);if(!bot.intents.includes(Intents.MANUAL_UPDATE))bot.updateIntervalId=setInterval(()=>bot.update(),100/3);if(bot.intents.includes(Intents.PING)){bot.lastPingTime=Date.now();const out2=new CommOut;out2.packInt8(CommCode.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){const out3=new CommOut;out3.packInt8(CommCode.keepAlive);out3.send(bot.game.socket)}},15000);bot.$emit("gameReady")};export default processGameJoinedPacket;
@@ -1,27 +1 @@
1
- import CommIn from "../comm/CommIn.js";
2
- import { GameOptionFlag } from "../constants/index.js";
3
- const CCGameOptionFlag = Object.fromEntries(Object.entries(GameOptionFlag).map(([k, v]) => [k[0].toLowerCase() + k.slice(1), v]));
4
- const processGameOptionsPacket = (bot) => {
5
- const oldOptions = structuredClone(bot.game.options);
6
- let gravity = CommIn.unPackInt8U();
7
- let damage = CommIn.unPackInt8U();
8
- let healthRegen = CommIn.unPackInt8U();
9
- if (gravity < 1 || gravity > 4)
10
- gravity = 4;
11
- if (damage < 0 || damage > 8)
12
- damage = 4;
13
- if (healthRegen > 16)
14
- healthRegen = 4;
15
- bot.game.options.gravity = gravity / 4;
16
- bot.game.options.damage = damage / 4;
17
- bot.game.options.healthRegen = healthRegen / 4;
18
- const rawFlags = CommIn.unPackInt8U();
19
- Object.keys(CCGameOptionFlag).forEach((optionFlagName) => {
20
- const value = rawFlags & CCGameOptionFlag[optionFlagName] ? 1 : 0;
21
- bot.game.options[optionFlagName] = value;
22
- });
23
- bot.game.options.weaponsDisabled = Array.from({ length: 7 }, () => CommIn.unPackInt8U() === 1);
24
- bot.game.options.mustUseSecondary = bot.game.options.weaponsDisabled.every((v) => v);
25
- bot.$emit("gameOptionsChange", oldOptions, bot.game.options);
26
- };
27
- export default processGameOptionsPacket;
1
+ import CommIn from"../comm/CommIn.js";import{GameOptionFlag}from"../constants/index.js";const CCGameOptionFlag=Object.fromEntries(Object.entries(GameOptionFlag).map(([k,v])=>[k[0].toLowerCase()+k.slice(1),v]));const processGameOptionsPacket=(bot)=>{const oldOptions=structuredClone(bot.game.options);let gravity=CommIn.unPackInt8U();let damage=CommIn.unPackInt8U();let healthRegen=CommIn.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;const rawFlags=CommIn.unPackInt8U();Object.keys(CCGameOptionFlag).forEach((optionFlagName)=>{const value=rawFlags&CCGameOptionFlag[optionFlagName]?1:0;bot.game.options[optionFlagName]=value});bot.game.options.weaponsDisabled=Array.from({length:7},()=>CommIn.unPackInt8U()===1);bot.game.options.mustUseSecondary=bot.game.options.weaponsDisabled.every((v)=>v);bot.$emit("gameOptionsChange",oldOptions,bot.game.options)};export default processGameOptionsPacket;
@@ -1,12 +1 @@
1
- import CommIn from "../comm/CommIn.js";
2
- const processHitMePacket = (bot) => {
3
- const hp = CommIn.unPackInt8U();
4
- CommIn.unPackFloat();
5
- CommIn.unPackFloat();
6
- if (bot.me) {
7
- const oldHealth = bot.me.hp;
8
- bot.me.hp = hp;
9
- bot.$emit("playerDamage", bot.me, oldHealth, bot.me.hp);
10
- }
11
- };
12
- export default processHitMePacket;
1
+ import CommIn from"../comm/CommIn.js";const processHitMePacket=(bot)=>{const hp=CommIn.unPackInt8U();CommIn.unPackFloat();CommIn.unPackFloat();if(bot.me){const oldHealth=bot.me.hp;bot.me.hp=hp;bot.$emit("playerDamage",bot.me,oldHealth,bot.me.hp)}};export default processHitMePacket;
@@ -1,18 +1 @@
1
- import CommIn from "../comm/CommIn.js";
2
- import { ShellStreak } from "../constants/index.js";
3
- const processHitMeHardBoiledPacket = (bot) => {
4
- const shieldHealth = CommIn.unPackInt8U();
5
- const playerHealth = CommIn.unPackInt8U();
6
- const dx = CommIn.unPackFloat();
7
- const dz = CommIn.unPackFloat();
8
- if (!bot.me)
9
- return;
10
- bot.me.shieldHp = shieldHealth;
11
- bot.me.hp = playerHealth;
12
- if (bot.me.shieldHp <= 0) {
13
- bot.me.streakRewards = bot.me.streakRewards.filter((r) => r !== ShellStreak.HardBoiled);
14
- bot.$emit("selfShieldLost", bot.me.hp, { dx, dz });
15
- } else
16
- bot.$emit("selfShieldHit", bot.me.shieldHp, bot.me.hp, { dx, dz });
17
- };
18
- export default processHitMeHardBoiledPacket;
1
+ import CommIn from"../comm/CommIn.js";import{ShellStreak}from"../constants/index.js";const processHitMeHardBoiledPacket=(bot)=>{const shieldHealth=CommIn.unPackInt8U();const playerHealth=CommIn.unPackInt8U();const dx=CommIn.unPackFloat();const dz=CommIn.unPackFloat();if(!bot.me)return;bot.me.shieldHp=shieldHealth;bot.me.hp=playerHealth;if(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})};export default processHitMeHardBoiledPacket;
@@ -1,12 +1 @@
1
- import CommIn from "../comm/CommIn.js";
2
- const processHitThemPacket = (bot) => {
3
- const id = CommIn.unPackInt8U();
4
- const hp = CommIn.unPackInt8U();
5
- const player = bot.players[id];
6
- if (!player)
7
- return;
8
- const oldHealth = player.hp;
9
- player.hp = hp;
10
- bot.$emit("playerDamage", player, oldHealth, player.hp);
11
- };
12
- export default processHitThemPacket;
1
+ import CommIn from"../comm/CommIn.js";const processHitThemPacket=(bot)=>{const id=CommIn.unPackInt8U();const hp=CommIn.unPackInt8U();const player=bot.players[id];if(!player)return;const oldHealth=player.hp;player.hp=hp;bot.$emit("playerDamage",player,oldHealth,player.hp)};export default processHitThemPacket;
@@ -1,8 +1 @@
1
- import CommIn from "../comm/CommIn.js";
2
- const processMeleePacket = (bot) => {
3
- const id = CommIn.unPackInt8U();
4
- const player = bot.players[id];
5
- if (player)
6
- bot.$emit("playerMelee", player);
7
- };
8
- export default processMeleePacket;
1
+ import CommIn from"../comm/CommIn.js";const processMeleePacket=(bot)=>{const id=CommIn.unPackInt8U();const player=bot.players[id];if(player)bot.$emit("playerMelee",player)};export default processMeleePacket;
@@ -1,62 +1 @@
1
- import CommIn from "../comm/CommIn.js";
2
- import { GameMode } from "../constants/index.js";
3
- import { ZoneLeaveReason } from "../enums.js";
4
- const processMetaGameStatePacket = (bot) => {
5
- if (bot.game.gameModeId === GameMode.Spatula) {
6
- const oldTeamScores = structuredClone(bot.game.teamScore);
7
- const oldSpatula = structuredClone(bot.game.spatula);
8
- bot.game.teamScore[1] = CommIn.unPackInt16U();
9
- bot.game.teamScore[2] = CommIn.unPackInt16U();
10
- const spatulaCoords = {
11
- x: CommIn.unPackFloat(),
12
- y: CommIn.unPackFloat(),
13
- z: CommIn.unPackFloat()
14
- };
15
- const controlledBy = CommIn.unPackInt8U();
16
- const controlledByTeam = CommIn.unPackInt8U();
17
- bot.game.spatula = { coords: spatulaCoords, controlledBy, controlledByTeam };
18
- bot.$emit("gameStateChange", { teamScore: { before: oldTeamScores, after: bot.game.teamScore }, spatula: { before: oldSpatula, after: bot.game.spatula } });
19
- } else if (bot.game.gameModeId === GameMode.KOTC) {
20
- const oldTeamScores = structuredClone(bot.game.teamScore);
21
- const oldKOTC = structuredClone(bot.game.kotc);
22
- const oldPlayersOnZone = Object.values(bot.players).filter((p) => p.inKotcZone && p.playing);
23
- bot.game.kotc.stage = CommIn.unPackInt8U();
24
- bot.game.kotc.zoneIdx = CommIn.unPackInt8U();
25
- bot.game.kotc.teamCapturing = CommIn.unPackInt8U();
26
- bot.game.kotc.captureProgress = CommIn.unPackInt16U();
27
- bot.game.kotc.numCapturing = CommIn.unPackInt8U();
28
- bot.game.teamScore[1] = CommIn.unPackInt8U();
29
- bot.game.teamScore[2] = CommIn.unPackInt8U();
30
- bot.game.kotc.capturePercent = bot.game.kotc.captureProgress / 1000;
31
- bot.game.kotc.activeZone = bot.game.map?.zones ? bot.game.map.zones[bot.game.kotc.zoneIdx - 1] : null;
32
- if (bot.game.kotc.activeZone)
33
- Object.values(bot.players).forEach((player) => player.updateKotcZone(bot.game.kotc.activeZone));
34
- if (bot.game.kotc.numCapturing <= 0)
35
- Object.values(bot.players).forEach((player) => {
36
- if (player.inKotcZone) {
37
- player.inKotcZone = false;
38
- bot.$emit("playerLeaveZone", player, ZoneLeaveReason.RoundEnded);
39
- }
40
- });
41
- const newPlayersOnZone = Object.values(bot.players).filter((p) => p.inKotcZone && p.playing);
42
- bot.$emit("gameStateChange", {
43
- teamScore: { before: oldTeamScores, after: bot.game.teamScore },
44
- kotc: { before: oldKOTC, after: bot.game.kotc },
45
- playersOnZone: { before: oldPlayersOnZone, after: newPlayersOnZone }
46
- });
47
- } else if (bot.game.gameModeId === GameMode.Team) {
48
- const oldTeamScores = structuredClone(bot.game.teamScore);
49
- bot.game.teamScore[1] = CommIn.unPackInt16U();
50
- bot.game.teamScore[2] = CommIn.unPackInt16U();
51
- bot.$emit("gameStateChange", {
52
- teamScore: { before: oldTeamScores, after: bot.game.teamScore }
53
- });
54
- }
55
- if (bot.game.gameModeId !== GameMode.Spatula)
56
- delete bot.game.spatula;
57
- if (bot.game.gameModeId !== GameMode.KOTC)
58
- delete bot.game.kotc;
59
- if (bot.game.gameModeId === GameMode.FFA)
60
- delete bot.game.teamScore;
61
- };
62
- export default processMetaGameStatePacket;
1
+ import CommIn from"../comm/CommIn.js";import{GameMode}from"../constants/index.js";import{ZoneLeaveReason}from"../enums.js";const processMetaGameStatePacket=(bot)=>{if(bot.game.gameModeId===GameMode.Spatula){const oldTeamScores=structuredClone(bot.game.teamScore);const oldSpatula=structuredClone(bot.game.spatula);bot.game.teamScore[1]=CommIn.unPackInt16U();bot.game.teamScore[2]=CommIn.unPackInt16U();const spatulaCoords={x:CommIn.unPackFloat(),y:CommIn.unPackFloat(),z:CommIn.unPackFloat()};const controlledBy=CommIn.unPackInt8U();const controlledByTeam=CommIn.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){const oldTeamScores=structuredClone(bot.game.teamScore);const oldKOTC=structuredClone(bot.game.kotc);const oldPlayersOnZone=Object.values(bot.players).filter((p)=>p.inKotcZone&&p.playing);bot.game.kotc.stage=CommIn.unPackInt8U();bot.game.kotc.zoneIdx=CommIn.unPackInt8U();bot.game.kotc.teamCapturing=CommIn.unPackInt8U();bot.game.kotc.captureProgress=CommIn.unPackInt16U();bot.game.kotc.numCapturing=CommIn.unPackInt8U();bot.game.teamScore[1]=CommIn.unPackInt8U();bot.game.teamScore[2]=CommIn.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;if(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=false;bot.$emit("playerLeaveZone",player,ZoneLeaveReason.RoundEnded)}});const 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){const oldTeamScores=structuredClone(bot.game.teamScore);bot.game.teamScore[1]=CommIn.unPackInt16U();bot.game.teamScore[2]=CommIn.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};export default processMetaGameStatePacket;
@@ -1,17 +1 @@
1
- import CommIn from "../comm/CommIn.js";
2
- import { ZoneLeaveReason } from "../enums.js";
3
- const processPausePacket = (bot) => {
4
- const id = CommIn.unPackInt8U();
5
- const player = bot.players[id];
6
- if (player) {
7
- player.playing = false;
8
- if (player.streakRewards)
9
- player.streakRewards = [];
10
- bot.$emit("playerPause", player);
11
- if (player.inKotcZone) {
12
- player.inKotcZone = false;
13
- bot.$emit("playerLeaveZone", player, ZoneLeaveReason.Despawned);
14
- }
15
- }
16
- };
17
- export default processPausePacket;
1
+ import CommIn from"../comm/CommIn.js";import{ZoneLeaveReason}from"../enums.js";const processPausePacket=(bot)=>{const id=CommIn.unPackInt8U();const player=bot.players[id];if(player){player.playing=false;if(player.streakRewards)player.streakRewards=[];bot.$emit("playerPause",player);if(player.inKotcZone){player.inKotcZone=false;bot.$emit("playerLeaveZone",player,ZoneLeaveReason.Despawned)}}};export default processPausePacket;