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,76 +1 @@
1
- export class CommIn {
2
- static buffer;
3
- static idx;
4
- static init(buf) {
5
- this.buffer = new Uint8Array(buf);
6
- this.idx = 0;
7
- }
8
- static isMoreDataAvailable() {
9
- return this.buffer.length - this.idx;
10
- }
11
- static unPackInt8U() {
12
- return this.buffer[this.idx++];
13
- }
14
- static unPackInt8() {
15
- const v = this.unPackInt8U();
16
- return v << 24 >> 24;
17
- }
18
- static unPackInt16U() {
19
- const i2 = this.idx;
20
- this.idx += 2;
21
- return this.buffer[i2] | this.buffer[i2 + 1] << 8;
22
- }
23
- static unPackInt24U() {
24
- const i2 = this.idx;
25
- this.idx += 3;
26
- return this.buffer[i2] | this.buffer[i2 + 1] << 8 | this.buffer[i2 + 2] << 16;
27
- }
28
- static unPackInt32U() {
29
- const i2 = this.idx;
30
- this.idx += 4;
31
- return (this.buffer[i2] | this.buffer[i2 + 1] << 8 | this.buffer[i2 + 2] << 16 | this.buffer[i2 + 3] << 24) >>> 0;
32
- }
33
- static unPackInt16() {
34
- const v = this.unPackInt16U();
35
- return v << 16 >> 16;
36
- }
37
- static unPackInt32() {
38
- const v = this.unPackInt32U();
39
- return v << 0;
40
- }
41
- static unPackRadU() {
42
- return this.unPackInt24U() / 2097152;
43
- }
44
- static unPackRad() {
45
- const v = this.unPackInt16U() / 8192;
46
- return v - Math.PI;
47
- }
48
- static unPackFloat() {
49
- return this.unPackInt16() / 256;
50
- }
51
- static unPackDouble() {
52
- return this.unPackInt32() / 1048576;
53
- }
54
- static unPackString(maxLen) {
55
- maxLen = maxLen || 255;
56
- const len = Math.min(this.unPackInt8U(), maxLen);
57
- return this.unPackStringHelper(len);
58
- }
59
- static unPackLongString(maxLen) {
60
- maxLen = maxLen || 16383;
61
- const len = Math.min(this.unPackInt16U(), maxLen);
62
- return this.unPackStringHelper(len);
63
- }
64
- static unPackStringHelper(len) {
65
- if (this.isMoreDataAvailable() < len * 2)
66
- return "";
67
- const chars = [];
68
- for (let i = 0;i < len; i++) {
69
- const c = this.unPackInt16U();
70
- if (c > 0)
71
- chars.push(String.fromCodePoint(c));
72
- }
73
- return chars.join("");
74
- }
75
- }
76
- export default CommIn;
1
+ export class CommIn{static buffer;static idx;static init(buf){this.buffer=new Uint8Array(buf);this.idx=0}static isMoreDataAvailable(){return this.buffer.length-this.idx}static unPackInt8U(){return this.buffer[this.idx++]}static unPackInt8(){const v=this.unPackInt8U();return v<<24>>24}static unPackInt16U(){const i2=this.idx;this.idx+=2;return this.buffer[i2]|this.buffer[i2+1]<<8}static unPackInt24U(){const i2=this.idx;this.idx+=3;return this.buffer[i2]|this.buffer[i2+1]<<8|this.buffer[i2+2]<<16}static unPackInt32U(){const i2=this.idx;this.idx+=4;return(this.buffer[i2]|this.buffer[i2+1]<<8|this.buffer[i2+2]<<16|this.buffer[i2+3]<<24)>>>0}static unPackInt16(){const v=this.unPackInt16U();return v<<16>>16}static unPackInt32(){const v=this.unPackInt32U();return v<<0}static unPackRadU(){return this.unPackInt24U()/2097152}static unPackRad(){const v=this.unPackInt16U()/8192;return v-Math.PI}static unPackFloat(){return this.unPackInt16()/256}static unPackDouble(){return this.unPackInt32()/1048576}static unPackString(maxLen){maxLen=maxLen||255;const len=Math.min(this.unPackInt8U(),maxLen);return this.unPackStringHelper(len)}static unPackLongString(maxLen){maxLen=maxLen||16383;const len=Math.min(this.unPackInt16U(),maxLen);return this.unPackStringHelper(len)}static unPackStringHelper(len){if(this.isMoreDataAvailable()<len*2)return"";const chars=[];for(let i=0;i<len;i++){const c=this.unPackInt16U();if(c>0)chars.push(String.fromCodePoint(c))}return chars.join("")}}export default CommIn;
@@ -1,60 +1 @@
1
- export class CommOut {
2
- constructor(size = 16384) {
3
- this.idx = 0;
4
- this.arrayBuffer = new ArrayBuffer(size);
5
- this.view = new DataView(this.arrayBuffer);
6
- this.buffer = new Uint8Array(this.arrayBuffer);
7
- }
8
- send(ws2) {
9
- const b2 = new Uint8Array(this.arrayBuffer, 0, this.idx);
10
- ws2.send(b2);
11
- }
12
- packInt8(val) {
13
- this.view.setInt8(this.idx, val);
14
- this.idx++;
15
- }
16
- packInt16(val) {
17
- this.view.setInt16(this.idx, val, true);
18
- this.idx += 2;
19
- }
20
- packInt24(val) {
21
- this.view.setInt16(this.idx, val & 65535, true);
22
- this.view.setInt8(this.idx + 2, val >> 16 & 255);
23
- this.idx += 3;
24
- }
25
- packInt32(val) {
26
- this.view.setInt32(this.idx, val, true);
27
- this.idx += 4;
28
- }
29
- packRadU(val) {
30
- this.packInt24(val * 2097152);
31
- }
32
- packRad(val) {
33
- this.packInt16((val + Math.PI) * 8192);
34
- }
35
- packFloat(val) {
36
- this.packInt16(val * 256);
37
- }
38
- packDouble(val) {
39
- this.packInt32(val * 1048576);
40
- }
41
- packString(str) {
42
- if (typeof str !== "string")
43
- str = "";
44
- if (str.length > 255) {
45
- console.trace("truncated packString to fit int8 (shell protocol); this should not happen (report it on GitHub)");
46
- str = str.slice(0, 255);
47
- }
48
- this.packInt8(str.length);
49
- for (let i = 0;i < str.length; i++)
50
- this.packInt16(str.charCodeAt(i));
51
- }
52
- packLongString(str) {
53
- if (typeof str !== "string")
54
- str = "";
55
- this.packInt16(str.length);
56
- for (let i = 0;i < str.length; i++)
57
- this.packInt16(str.charCodeAt(i));
58
- }
59
- }
60
- export default CommOut;
1
+ export class CommOut{constructor(size=16384){this.idx=0;this.arrayBuffer=new ArrayBuffer(size);this.view=new DataView(this.arrayBuffer);this.buffer=new Uint8Array(this.arrayBuffer)}send(ws2){const b2=new Uint8Array(this.arrayBuffer,0,this.idx);ws2.send(b2)}packInt8(val){this.view.setInt8(this.idx,val);this.idx++}packInt16(val){this.view.setInt16(this.idx,val,true);this.idx+=2}packInt24(val){this.view.setInt16(this.idx,val&65535,true);this.view.setInt8(this.idx+2,val>>16&255);this.idx+=3}packInt32(val){this.view.setInt32(this.idx,val,true);this.idx+=4}packRadU(val){this.packInt24(val*2097152)}packRad(val){this.packInt16((val+Math.PI)*8192)}packFloat(val){this.packInt16(val*256)}packDouble(val){this.packInt32(val*1048576)}packString(str){if(typeof str!=="string")str="";if(str.length>255){console.trace("truncated packString to fit int8 (shell protocol); this should not happen");console.log("report this issue at https://yolkbot.xyz/community");str=str.slice(0,255)}this.packInt8(str.length);for(let i=0;i<str.length;i++)this.packInt16(str.charCodeAt(i))}packLongString(str){if(typeof str!=="string")str="";this.packInt16(str.length);for(let i=0;i<str.length;i++)this.packInt16(str.charCodeAt(i))}}export default CommOut;
@@ -1,27 +1 @@
1
- export const CloseCode = {
2
- gameNotFound: 4000,
3
- gameFull: 4001,
4
- badName: 4002,
5
- mainMenu: 4003,
6
- gameIdleExceeded: 4004,
7
- corruptedLoginData0: 4005,
8
- corruptedLoginData1: 4006,
9
- corruptedLoginData2: 4007,
10
- corruptedLoginData3: 4008,
11
- corruptedLoginData4: 4009,
12
- corruptedLoginData5: 4010,
13
- gameMaxPlayersExceeded: 4011,
14
- gameDestroyUser: 4012,
15
- joinGameOutOfOrder: 4013,
16
- gameShuttingDown: 4014,
17
- readyBeforeReady: 4015,
18
- booted: 4016,
19
- gameErrorOnUserSocket: 4017,
20
- uuidNotFound: 4018,
21
- sessionNotFound: 4019,
22
- clusterFullCpu: 4020,
23
- clusterFullMem: 4021,
24
- noClustersAvailable: 4022,
25
- locked: 4023
26
- };
27
- export default CloseCode;
1
+ export const CloseCode={gameNotFound:4000,gameFull:4001,badName:4002,mainMenu:4003,gameIdleExceeded:4004,corruptedLoginData0:4005,corruptedLoginData1:4006,corruptedLoginData2:4007,corruptedLoginData3:4008,corruptedLoginData4:4009,corruptedLoginData5:4010,gameMaxPlayersExceeded:4011,gameDestroyUser:4012,joinGameOutOfOrder:4013,gameShuttingDown:4014,readyBeforeReady:4015,booted:4016,gameErrorOnUserSocket:4017,uuidNotFound:4018,sessionNotFound:4019,clusterFullCpu:4020,clusterFullMem:4021,noClustersAvailable:4022,locked:4023};export default CloseCode;
@@ -1,53 +1 @@
1
- export const CommCode = {
2
- swapWeapon: 0,
3
- joinGame: 1,
4
- refreshGameState: 2,
5
- spawnItem: 3,
6
- observeGame: 4,
7
- ping: 5,
8
- bootPlayer: 6,
9
- banPlayer: 7,
10
- loginRequired: 8,
11
- gameLocked: 9,
12
- reportPlayer: 10,
13
- switchTeam: 13,
14
- changeCharacter: 14,
15
- pause: 15,
16
- gameOptions: 16,
17
- gameAction: 17,
18
- requestGameOptions: 18,
19
- gameJoined: 19,
20
- socketReady: 20,
21
- addPlayer: 21,
22
- removePlayer: 22,
23
- fire: 23,
24
- melee: 24,
25
- throwGrenade: 25,
26
- eventModifier: 27,
27
- hitThem: 28,
28
- hitMe: 29,
29
- collectItem: 30,
30
- challengeResetInGame: 31,
31
- chat: 34,
32
- syncThem: 35,
33
- die: 37,
34
- beginShellStreak: 38,
35
- endShellStreak: 39,
36
- updateBalance: 42,
37
- reload: 43,
38
- respawn: 44,
39
- respawnDenied: 45,
40
- clientReady: 47,
41
- requestRespawn: 48,
42
- switchTeamFail: 51,
43
- expireUpgrade: 52,
44
- metaGameState: 53,
45
- syncMe: 54,
46
- explode: 55,
47
- keepAlive: 56,
48
- musicInfo: 57,
49
- hitMeHardBoiled: 58,
50
- playerInfo: 59,
51
- challengeCompleted: 60
52
- };
53
- export default CommCode;
1
+ export const CommCode={swapWeapon:0,joinGame:1,refreshGameState:2,spawnItem:3,observeGame:4,ping:5,bootPlayer:6,banPlayer:7,loginRequired:8,gameLocked:9,reportPlayer:10,switchTeam:13,changeCharacter:14,pause:15,gameOptions:16,gameAction:17,requestGameOptions:18,gameJoined:19,socketReady:20,addPlayer:21,removePlayer:22,fire:23,melee:24,throwGrenade:25,eventModifier:27,hitThem:28,hitMe:29,collectItem:30,challengeResetInGame:31,chat:34,syncThem:35,die:37,beginShellStreak:38,endShellStreak:39,updateBalance:42,reload:43,respawn:44,respawnDenied:45,clientReady:47,requestRespawn:48,switchTeamFail:51,expireUpgrade:52,metaGameState:53,syncMe:54,explode:55,keepAlive:56,musicInfo:57,hitMeHardBoiled:58,playerInfo:59,challengeCompleted:60};export default CommCode;