yolkbot 0.1.3 → 0.1.4-alpha.1

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 (138) hide show
  1. package/browser/build/global.js +1 -1
  2. package/browser/build/module.js +1 -1
  3. package/dist/api.js +3 -0
  4. package/dist/bot/GamePlayer.js +3 -0
  5. package/dist/bot.js +3 -0
  6. package/dist/comm/Codes.js +3 -0
  7. package/dist/comm/CommIn.js +3 -0
  8. package/dist/comm/CommOut.js +3 -0
  9. package/dist/comm/OutBuffer.js +3 -0
  10. package/dist/comm/Pool.js +3 -0
  11. package/dist/comm/index.js +3 -0
  12. package/dist/constants/challenges.js +3 -0
  13. package/dist/constants/changelog.js +3 -0
  14. package/dist/constants/codes.js +3 -0
  15. package/dist/constants/guns.js +3 -0
  16. package/dist/constants/housePromo.js +3 -0
  17. package/dist/constants/index.js +3 -0
  18. package/dist/constants/items.js +3 -0
  19. package/dist/constants/language.js +3 -0
  20. package/dist/constants/maps.js +3 -0
  21. package/dist/constants/shellNews.js +3 -0
  22. package/dist/constants/shellYoutube.js +3 -0
  23. package/dist/constants/shopItems.js +3 -0
  24. package/dist/constants/sounds.js +3 -0
  25. package/dist/dispatches/BootPlayerDispatch.js +3 -0
  26. package/dist/dispatches/ChatDispatch.js +3 -0
  27. package/dist/dispatches/FireDispatch.js +3 -0
  28. package/dist/dispatches/GameOptionsDispatch.js +3 -0
  29. package/dist/dispatches/GoToAmmoDispatch.js +3 -0
  30. package/dist/dispatches/GoToCoopDispatch.js +3 -0
  31. package/dist/dispatches/GoToGrenadeDispatch.js +3 -0
  32. package/dist/dispatches/GoToPlayerDispatch.js +3 -0
  33. package/dist/dispatches/GoToSpatulaDispatch.js +3 -0
  34. package/dist/dispatches/LookAtDispatch.js +3 -0
  35. package/dist/dispatches/LookAtPosDispatch.js +3 -0
  36. package/dist/dispatches/MeleeDispatch.js +3 -0
  37. package/dist/dispatches/MovementDispatch.js +3 -0
  38. package/dist/dispatches/PauseDispatch.js +3 -0
  39. package/dist/dispatches/ReloadDispatch.js +3 -0
  40. package/dist/dispatches/ReportPlayerDispatch.js +3 -0
  41. package/dist/dispatches/SaveLoadoutDispatch.js +3 -0
  42. package/dist/dispatches/SpawnDispatch.js +3 -0
  43. package/dist/dispatches/SwapWeaponDispatch.js +3 -0
  44. package/dist/dispatches/SwitchTeamDispatch.js +3 -0
  45. package/dist/dispatches/ThrowGrenadeDispatch.js +3 -0
  46. package/dist/dispatches/index.js +3 -0
  47. package/dist/globals.js +3 -0
  48. package/dist/index.js +10 -0
  49. package/dist/matchmaker.js +3 -0
  50. package/dist/pathing/astar.js +3 -0
  51. package/dist/pathing/binaryheap.js +3 -0
  52. package/dist/pathing/mapnode.js +3 -0
  53. package/dist/socket.js +3 -0
  54. package/package.json +28 -28
  55. package/src/.DS_Store +0 -0
  56. package/src/api.js +0 -235
  57. package/src/bot/GamePlayer.js +0 -88
  58. package/src/bot.js +0 -1998
  59. package/src/comm/Codes.js +0 -99
  60. package/src/comm/CommIn.js +0 -84
  61. package/src/comm/CommOut.js +0 -16
  62. package/src/comm/OutBuffer.js +0 -60
  63. package/src/comm/Pool.js +0 -55
  64. package/src/comm/index.js +0 -16
  65. package/src/constants/challenges.js +0 -1822
  66. package/src/constants/changelog.js +0 -19
  67. package/src/constants/codes.js +0 -45
  68. package/src/constants/guns.js +0 -368
  69. package/src/constants/housePromo.js +0 -727
  70. package/src/constants/index.js +0 -121
  71. package/src/constants/items.js +0 -42533
  72. package/src/constants/language.js +0 -1669
  73. package/src/constants/maps.js +0 -1095
  74. package/src/constants/shellNews.js +0 -59
  75. package/src/constants/shellYoutube.js +0 -93
  76. package/src/constants/shopItems.js +0 -2032
  77. package/src/constants/sounds.js +0 -1160
  78. package/src/dispatches/BootPlayerDispatch.js +0 -21
  79. package/src/dispatches/ChatDispatch.js +0 -30
  80. package/src/dispatches/FireDispatch.js +0 -20
  81. package/src/dispatches/GameOptionsDispatch.js +0 -46
  82. package/src/dispatches/GoToAmmoDispatch.js +0 -44
  83. package/src/dispatches/GoToCoopDispatch.js +0 -44
  84. package/src/dispatches/GoToGrenadeDispatch.js +0 -44
  85. package/src/dispatches/GoToPlayerDispatch.js +0 -38
  86. package/src/dispatches/GoToSpatulaDispatch.js +0 -32
  87. package/src/dispatches/LookAtDispatch.js +0 -48
  88. package/src/dispatches/LookAtPosDispatch.js +0 -33
  89. package/src/dispatches/MeleeDispatch.js +0 -28
  90. package/src/dispatches/MovementDispatch.js +0 -19
  91. package/src/dispatches/PauseDispatch.js +0 -18
  92. package/src/dispatches/ReloadDispatch.js +0 -36
  93. package/src/dispatches/ReportPlayerDispatch.js +0 -51
  94. package/src/dispatches/SaveLoadoutDispatch.js +0 -119
  95. package/src/dispatches/SpawnDispatch.js +0 -21
  96. package/src/dispatches/SwapWeaponDispatch.js +0 -19
  97. package/src/dispatches/SwitchTeamDispatch.js +0 -34
  98. package/src/dispatches/ThrowGrenadeDispatch.js +0 -26
  99. package/src/dispatches/index.js +0 -69
  100. package/src/globals.js +0 -15
  101. package/src/index.js +0 -14
  102. package/src/matchmaker.js +0 -206
  103. package/src/pathing/astar.js +0 -71
  104. package/src/pathing/binaryheap.js +0 -117
  105. package/src/pathing/mapnode.js +0 -236
  106. package/src/socket.js +0 -19
  107. /package/{src → dist}/types/api.d.ts +0 -0
  108. /package/{src → dist}/types/bot/GamePlayer.d.ts +0 -0
  109. /package/{src → dist}/types/bot.d.ts +0 -0
  110. /package/{src → dist}/types/constants/challenges.d.ts +0 -0
  111. /package/{src → dist}/types/constants/guns.d.ts +0 -0
  112. /package/{src → dist}/types/constants/index.d.ts +0 -0
  113. /package/{src → dist}/types/constants/items.d.ts +0 -0
  114. /package/{src → dist}/types/constants/maps.d.ts +0 -0
  115. /package/{src → dist}/types/dispatches/BootPlayerDispatch.d.ts +0 -0
  116. /package/{src → dist}/types/dispatches/ChatDispatch.d.ts +0 -0
  117. /package/{src → dist}/types/dispatches/FireDispatch.d.ts +0 -0
  118. /package/{src → dist}/types/dispatches/GameOptionsDispatch.d.ts +0 -0
  119. /package/{src → dist}/types/dispatches/GoToAmmoDispatch.d.ts +0 -0
  120. /package/{src → dist}/types/dispatches/GoToCoopDispatch.d.ts +0 -0
  121. /package/{src → dist}/types/dispatches/GoToGrenadeDispatch.d.ts +0 -0
  122. /package/{src → dist}/types/dispatches/GoToPlayerDispatch.d.ts +0 -0
  123. /package/{src → dist}/types/dispatches/GoToSpatulaDispatch.d.ts +0 -0
  124. /package/{src → dist}/types/dispatches/LookAtDispatch.d.ts +0 -0
  125. /package/{src → dist}/types/dispatches/LookAtPosDispatch.d.ts +0 -0
  126. /package/{src → dist}/types/dispatches/MeleeDispatch.d.ts +0 -0
  127. /package/{src → dist}/types/dispatches/MovementDispatch.d.ts +0 -0
  128. /package/{src → dist}/types/dispatches/PauseDispatch.d.ts +0 -0
  129. /package/{src → dist}/types/dispatches/ReloadDispatch.d.ts +0 -0
  130. /package/{src → dist}/types/dispatches/ReportPlayerDispatch.d.ts +0 -0
  131. /package/{src → dist}/types/dispatches/SaveLoadoutDispatch.d.ts +0 -0
  132. /package/{src → dist}/types/dispatches/SpawnDispatch.d.ts +0 -0
  133. /package/{src → dist}/types/dispatches/SwapWeaponDispatch.d.ts +0 -0
  134. /package/{src → dist}/types/dispatches/SwitchTeamDispatch.d.ts +0 -0
  135. /package/{src → dist}/types/dispatches/ThrowGrenadeDispatch.d.ts +0 -0
  136. /package/{src → dist}/types/dispatches/index.d.ts +0 -0
  137. /package/{src → dist}/types/matchmaker.d.ts +0 -0
  138. /package/{src → dist}/types/socket.d.ts +0 -0
package/src/comm/Codes.js DELETED
@@ -1,99 +0,0 @@
1
- /*
2
- const CommCode = {
3
- announcement: 10, // unused
4
- updateBalance: 11,
5
- reload: 12,
6
- respawn: 13,
7
- respawnDenied: 14,
8
- pong: 15, // unused
9
- clientReady: 16, // don't use INCOMING, since it's mostly used to prep the UI - still sent outgoing
10
- requestRespawn: 17,
11
- joinPublicGame: 18, // unused
12
- joinPrivateGame: 19, // unused
13
- switchTeamFail: 20,
14
- expireUpgrade: 21, // don't use, related to forcing the user to see ads
15
- swapWeapon: 22,
16
- joinGame: 23,
17
- refreshGameState: 24, // don't use, related to the game pausing when you unfocused
18
- spawnItem: 25,
19
- observeGame: 26, // don't use, for mods
20
- ping: 27,
21
- bootPlayer: 28,
22
- banPlayer: 29, // don't use, for mods
23
- loginRequired: 30, // implemented in frontend but unused??
24
- metaGameState: 31,
25
- syncMe: 32,
26
- explode: 33,
27
- keepAlive: 34, // don't use, for spectator mode
28
- musicInfo: 35, // don't use, likely for UI purposes
29
- hitMeHardBoiled: 36,
30
- playerInfo: 37, // don't use, for admins
31
- challengeCompleted: 38, // don't use, see issue #37 on the github
32
- gameLocked: 39, // unused???, closecode gamelocked is used afaik
33
- reportPlayer: 40,
34
- banned: 41, // unused
35
- createPrivateGame: 42, // unused
36
- switchTeam: 43, // don't use outgoing, because unlike official client, we don't assume the team is switched
37
- changeCharacter: 44,
38
- pause: 45,
39
- gameOptions: 46,
40
- gameAction: 47,
41
- requestGameOptions: 48,
42
- gameJoined: 49,
43
- socketReady: 50,
44
- addPlayer: 51,
45
- removePlayer: 52,
46
- fire: 53,
47
- melee: 54,
48
- throwGrenade: 55,
49
- info: 56, // unused
50
- eventModifier: 57,
51
- hitThem: 58,
52
- hitMe: 59,
53
- collectItem: 60,
54
- chlgPlayerRerollInGame: 61, // don't use, see issue #37 on the github
55
- playerInGameReward: 62, // unused
56
-
57
- // this is possibly the most comedic thing i've ever seen
58
- // they started coding the commcode incoming by creating commin
59
- // then, they declared a random variable that got broken because
60
- // you're not supposed to declare variables in switch statements
61
- // and then unpacked something and then never used it
62
- // and then seemed to just leave it there!!
63
- // top 10 bwd // https://i.imgur.com/a1WNR7Y.png
64
- playerRewards: 63,
65
-
66
- chat: 64,
67
- syncThem: 65,
68
- syncAmmo: 66, // unused
69
- die: 67, // unused
70
- beginShellStreak: 68,
71
- endShellStreak: 69,
72
- startReload: 70 // unused
73
- }
74
-
75
- */
76
-
77
- const CloseCode = {
78
- gameNotFound: 4000,
79
- gameFull: 4001,
80
- badName: 4002,
81
- mainMenu: 4003,
82
- gameIdleExceeded: 4004,
83
- corruptedLoginData: 4010,
84
- gameMaxPlayersExceeded: 4011,
85
- gameDestroyUser: 4012,
86
- joinGameOutOfOrder: 4013,
87
- gameShuttingDown: 4014,
88
- readyBeforeReady: 4015,
89
- booted: 4016,
90
- gameErrorOnUserSocket: 4017,
91
- uuidNotFound: 4018,
92
- sessionNotFound: 4019,
93
- clusterFullCpu: 4020,
94
- clusterFullMem: 4021,
95
- noClustersAvailable: 4022,
96
- locked: 4023
97
- }
98
-
99
- export { CloseCode }
@@ -1,84 +0,0 @@
1
- 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 Math.max(0, this.buffer.length - this.idx);
10
- }
11
- static peekInt8U() {
12
- return this.buffer[this.idx];
13
- }
14
- static unPackInt8U() {
15
- const i2 = this.idx;
16
- this.idx++;
17
- return this.buffer[i2];
18
- }
19
- static unPackInt8() {
20
- const v = this.unPackInt8U();
21
- return (v + 128) % 256 - 128;
22
- }
23
- static unPackInt16U() {
24
- const i2 = this.idx;
25
- this.idx += 2;
26
- return this.buffer[i2] + this.buffer[i2 + 1] * 256;
27
- }
28
- static unPackInt24U() {
29
- const i2 = this.idx;
30
- this.idx += 3;
31
- return this.buffer[i2] + this.buffer[i2 + 1] * 256 + this.buffer[i2 + 2] * 65536;
32
- }
33
- static unPackInt32U() {
34
- const i2 = this.idx;
35
- this.idx += 4;
36
- return this.buffer[i2] + this.buffer[i2 + 1] * 256 + this.buffer[i2 + 2] * 65536 + this.buffer[i2 + 3] * 16777216;
37
- }
38
- static unPackInt16() {
39
- const v = this.unPackInt16U();
40
- return (v + 32768) % 65536 - 32768;
41
- }
42
- static unPackInt32() {
43
- const v = this.unPackInt32U();
44
- return (v + 2147483648) % 4294967296 - 2147483648;
45
- }
46
- // Unsigned radians (0 to 6.2831)
47
- static unPackRadU() {
48
- return this.unPackInt24U() / 2097152;
49
- }
50
- // Signed radians (-3.1416 to 3.1416)
51
- static unPackRad() {
52
- const v = this.unPackInt16U() / 8192;
53
- return v - Math.PI;
54
- }
55
- // Float value packing (-327.68 to 327.67)
56
- static unPackFloat() {
57
- return this.unPackInt16() / 256;
58
- }
59
- static unPackDouble() {
60
- return this.unPackInt32() / 1048576;
61
- }
62
- static unPackString(maxLen) {
63
- maxLen = maxLen || 255;
64
- const len = Math.min(this.unPackInt8U(), maxLen);
65
- return this.unPackStringHelper(len);
66
- }
67
- static unPackLongString(maxLen) {
68
- maxLen = maxLen || 16383;
69
- const len = Math.min(this.unPackInt16U(), maxLen);
70
- return this.unPackStringHelper(len);
71
- }
72
- static unPackStringHelper(len) {
73
- const remainder = this.isMoreDataAvailable();
74
- if (remainder < len) return 0;
75
- let str = new String();
76
- for (let i2 = 0; i2 < len; i2++) {
77
- const c = this.unPackInt16U();
78
- if (c > 0) str += String.fromCodePoint(c);
79
- }
80
- return str;
81
- }
82
- }
83
-
84
- export default CommIn;
@@ -1,16 +0,0 @@
1
- import OutBuffer from './OutBuffer.js';
2
- import Pool from './Pool.js';
3
-
4
- class CommOut {
5
- static buffer = null;
6
- static bufferPool = new Pool(() => {
7
- return new OutBuffer(16384);
8
- }, 2);
9
- static getBuffer() {
10
- const b2 = this.bufferPool.retrieve();
11
- b2.idx = 0;
12
- return b2;
13
- }
14
- }
15
-
16
- export default CommOut;
@@ -1,60 +0,0 @@
1
- import CommOut from './CommOut.js';
2
-
3
- class OutBuffer {
4
- constructor(size) {
5
- this.idx = 0;
6
- this.arrayBuffer = new ArrayBuffer(size);
7
- this.buffer = new Uint8Array(this.arrayBuffer, 0, size);
8
- }
9
- send(ws2) {
10
- const b2 = new Uint8Array(this.arrayBuffer, 0, this.idx);
11
- ws2.send(b2);
12
- CommOut.bufferPool.recycle(this);
13
- }
14
- packInt8(val) {
15
- this.buffer[this.idx] = val & 255;
16
- this.idx++;
17
- }
18
- packInt16(val) {
19
- this.buffer[this.idx] = val & 255;
20
- this.buffer[this.idx + 1] = val >> 8 & 255;
21
- this.idx += 2;
22
- }
23
- packInt24(val) {
24
- this.buffer[this.idx] = val & 255;
25
- this.buffer[this.idx + 1] = val >> 8 & 255;
26
- this.buffer[this.idx + 2] = val >> 16 & 255;
27
- this.idx += 3;
28
- }
29
- packInt32(val) {
30
- this.buffer[this.idx] = val & 255;
31
- this.buffer[this.idx + 1] = val >> 8 & 255;
32
- this.buffer[this.idx + 2] = val >> 16 & 255;
33
- this.buffer[this.idx + 3] = val >> 24 & 255;
34
- this.idx += 4;
35
- }
36
- packRadU(val) {
37
- this.packInt24(val * 2097152);
38
- }
39
- packRad(val) {
40
- this.packInt16((val + Math.PI) * 8192);
41
- }
42
- packFloat(val) {
43
- this.packInt16(val * 256);
44
- }
45
- packDouble(val) {
46
- this.packInt32(val * 1048576);
47
- }
48
- packString(str, doMalicious = false) {
49
- if (typeof str !== 'string') str = '';
50
- this.packInt8(doMalicious ? 254 : str.length);
51
- for (let i2 = 0; i2 < str.length; i2++) this.packInt16(str.charCodeAt(i2));
52
- }
53
- packLongString(str) {
54
- if (typeof str !== 'string') str = '';
55
- this.packInt16(str.length);
56
- for (let i2 = 0; i2 < str.length; i2++) this.packInt16(str.charCodeAt(i2));
57
- }
58
- }
59
-
60
- export default OutBuffer;
package/src/comm/Pool.js DELETED
@@ -1,55 +0,0 @@
1
- class Pool {
2
- constructor(constructorFn, size) {
3
- this.size = 0;
4
- this.originalSize = size;
5
- this.constructorFn = constructorFn;
6
- this.objects = [];
7
- this.idx = 0;
8
- this.numActive = 0;
9
- this.expand(size);
10
- }
11
- expand(num) {
12
- for (let i2 = 0; i2 < num; i2++) {
13
- const obj = this.constructorFn();
14
- obj.id = i2 + this.size;
15
- obj.active = false;
16
- this.objects.push(obj);
17
- }
18
- this.size += num;
19
- }
20
- retrieve(id) {
21
- if (id != void 0) {
22
- while (id >= this.size) this.expand(this.originalSize);
23
-
24
- this.numActive++;
25
- this.objects[id].active = true;
26
- return this.objects[id];
27
- }
28
- let i2 = this.idx;
29
- do {
30
- i2 = (i2 + 1) % this.size;
31
- const obj = this.objects[i2];
32
- if (!obj.active) {
33
- this.idx = i2;
34
- this.numActive++;
35
- obj.active = true;
36
- return obj;
37
- }
38
- } while (i2 != this.idx);
39
- this.expand(this.originalSize);
40
- // console.log('Expanding pool for: ' + this.objects[0].constructor.name + ' to: ' + this.size);
41
- return this.retrieve();
42
- }
43
- recycle(obj) {
44
- obj.active = false;
45
- this.numActive--;
46
- }
47
- forEachActive(fn) {
48
- for (let i2 = 0; i2 < this.size; i2++) {
49
- const obj = this.objects[i2];
50
- if (obj.active === true) fn(obj, i2);
51
- }
52
- }
53
- }
54
-
55
- export default Pool;
package/src/comm/index.js DELETED
@@ -1,16 +0,0 @@
1
- import CommIn from './CommIn.js';
2
- import CommOut from './CommOut.js';
3
- import OutBuffer from './OutBuffer.js';
4
- import Pool from './Pool.js';
5
-
6
- import { CommCode } from '../constants/codes.js';
7
- import { CloseCode } from './Codes.js';
8
-
9
- export {
10
- CommIn,
11
- CommOut,
12
- OutBuffer,
13
- Pool,
14
- CommCode,
15
- CloseCode
16
- };