yolkbot 0.1.1-alpha.2 → 0.1.1-alpha.20

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "yolkbot",
3
3
  "description": "create a shell shockers (self) bot in under 10 lines.",
4
- "version": "0.1.1-alpha.2",
4
+ "version": "0.1.1-alpha.20",
5
5
  "keywords": [
6
6
  "shell shockers",
7
7
  "shellshock.io",
@@ -35,10 +35,6 @@
35
35
  "import": "./src/api.js",
36
36
  "types": "./src/types/api.d.ts"
37
37
  },
38
- "./bot": {
39
- "import": "./src/bot.js",
40
- "types": "./src/types/bot.d.ts"
41
- },
42
38
  "./browser": "./build/browser.js",
43
39
  "./comm": "./src/comm/index.js",
44
40
  "./matchmaker": {
@@ -48,6 +44,18 @@
48
44
  "./packets": "./src/packet.js",
49
45
  "./pathing/*": "./src/pathing/*.js",
50
46
  "./pathing/*.js": "./src/pathing/*.js",
47
+ "./bot": {
48
+ "import": "./src/bot.js",
49
+ "types": "./src/types/bot.d.ts"
50
+ },
51
+ "./bot/*": {
52
+ "import": "./src/bot/*.js",
53
+ "types": "./src/types/bot/*.d.ts"
54
+ },
55
+ "./bot/*.js": {
56
+ "import": "./src/bot/*.js",
57
+ "types": "./src/types/bot/*.d.ts"
58
+ },
51
59
  "./constants": {
52
60
  "import": "./src/constants/index.js",
53
61
  "types": "./src/types/constants/index.d.ts"
package/src/api.js CHANGED
@@ -2,10 +2,10 @@ import axios from 'axios';
2
2
 
3
3
  import yolkws from './socket.js';
4
4
 
5
- import { FirebaseKey, IsBrowser, UserAgent } from '#constants';
5
+ import { FirebaseKey, ProxiesEnabled, UserAgent } from '#constants';
6
6
 
7
7
  let SocksProxyAgent;
8
- if (!IsBrowser) SocksProxyAgent = (await import('smallsocks')).SocksProxyAgent;
8
+ if (ProxiesEnabled) SocksProxyAgent = (await import('smallsocks')).SocksProxyAgent;
9
9
 
10
10
  const queryServices = async (request, proxy = '', instance = 'shellshock.io') => {
11
11
  let ws;
@@ -91,7 +91,7 @@ async function loginWithCredentials(email, password, prox = '', instance = 'shel
91
91
  'user-agent': UserAgent,
92
92
  'x-client-version': 'Chrome/JsCore/9.17.2/FirebaseCore-web'
93
93
  },
94
- httpsAgent: (!IsBrowser && prox) ? new SocksProxyAgent(prox) : false
94
+ httpsAgent: (ProxiesEnabled && prox) ? new SocksProxyAgent(prox) : false
95
95
  })
96
96
  body = request.data
97
97
  token = body.idToken;
@@ -143,7 +143,7 @@ async function loginWithRefreshToken(refreshToken, prox = '', instance = 'shells
143
143
  'user-agent': UserAgent,
144
144
  'x-client-version': 'Chrome/JsCore/9.17.2/FirebaseCore-web'
145
145
  },
146
- httpsAgent: (!IsBrowser && prox) ? new SocksProxyAgent(prox) : false
146
+ httpsAgent: (ProxiesEnabled && prox) ? new SocksProxyAgent(prox) : false
147
147
  })
148
148
  body = request.data
149
149
  token = body.id_token;
@@ -185,7 +185,7 @@ async function loginAnonymously(prox = '', instance = 'shellshock.io') {
185
185
  'user-agent': UserAgent,
186
186
  'x-client-version': 'Chrome/JsCore/9.17.2/FirebaseCore-web'
187
187
  },
188
- httpsAgent: (!IsBrowser && prox) ? new SocksProxyAgent(prox) : false
188
+ httpsAgent: (ProxiesEnabled && prox) ? new SocksProxyAgent(prox) : false
189
189
  });
190
190
 
191
191
  const token = body.idToken;
@@ -1,4 +1,4 @@
1
- import { GunList } from '#constants';
1
+ import { GunList, ShellStreaks, SocialMedias } from '#constants';
2
2
  import { Cluck9mm } from '../constants/guns.js';
3
3
 
4
4
  export class GamePlayer {
@@ -6,28 +6,31 @@ export class GamePlayer {
6
6
  this.id = id;
7
7
  this.team = team;
8
8
 
9
- this.data = playerData;
9
+ this.raw = playerData;
10
10
 
11
11
  this.name = playerData.name_;
12
12
  this.uniqueId = playerData.uniqueId_;
13
13
 
14
14
  this.playing = playerData.playing_;
15
15
 
16
- this.social = playerData.social_ && JSON.parse(playerData.social_);
16
+ this.socials = playerData.social_ && JSON.parse(playerData.social_);
17
+ if (this.socials) this.socials.forEach((social) => social.type = SocialMedias[social.id]);
18
+
19
+ this.isVip = playerData.upgradeProductId_ > 0;
17
20
  this.showBadge = !playerData.hideBadge_ || false;
18
21
 
19
22
  this.position = {
20
- x: this.data.x_,
21
- y: this.data.y_,
22
- z: this.data.z_
23
+ x: playerData.x_,
24
+ y: playerData.y_,
25
+ z: playerData.z_
23
26
  };
24
27
 
25
28
  this.jumping = false;
26
29
  this.climbing = false;
27
30
 
28
31
  this.view = {
29
- yaw: this.data.yaw_,
30
- pitch: this.data.pitch_
32
+ yaw: playerData.yaw_,
33
+ pitch: playerData.pitch_
31
34
  };
32
35
 
33
36
  this.character = {
@@ -40,15 +43,14 @@ export class GamePlayer {
40
43
  melee: playerData.meleeItem_
41
44
  }
42
45
 
43
- this.activeGun = this.data.weaponIdx_;
46
+ this.activeGun = playerData.weaponIdx_;
44
47
  this.selectedGun = 0;
45
48
  this.weapons = [{}, {}];
46
49
 
47
50
  if (this.character.primaryGun) {
48
- const weaponClass = GunList[this.character.primaryGun.exclusive_for_class];
49
- this.selectedGun = this.character.primaryGun.exclusive_for_class;
51
+ this.selectedGun = playerData.charClass_;
50
52
 
51
- this.weapons[0] = new weaponClass();
53
+ this.weapons[0] = new GunList[this.selectedGun]();
52
54
  this.weapons[1] = new Cluck9mm();
53
55
  }
54
56
 
@@ -60,11 +62,11 @@ export class GamePlayer {
60
62
  2: {}
61
63
  };
62
64
 
63
- this.kills = 0;
64
- this.hp = 100;
65
+ this.streak = playerData.score_;
66
+ this.hp = playerData.hp_;
65
67
 
66
- this.hpShield = 0;
67
- this.streakRewards = [];
68
+ this.hpShield = playerData.shield_;
69
+ this.streakRewards = Object.values(ShellStreaks).filter(streak => playerData.activeShellStreaks_ & streak);
68
70
 
69
71
  this.randomSeed = 0;
70
72
  this.serverStateIdx = 0;
package/src/bot.js CHANGED
@@ -21,6 +21,7 @@ import {
21
21
  ItemTypes,
22
22
  Movements,
23
23
  PlayTypes,
24
+ ProxiesEnabled,
24
25
  ShellStreaks
25
26
  } from '#constants';
26
27
 
@@ -50,7 +51,7 @@ export class Bot {
50
51
  Intents = intents;
51
52
 
52
53
  constructor(params = {}) {
53
- if (params.proxy && IsBrowser)
54
+ if (params.proxy && !ProxiesEnabled)
54
55
  throw new Error('proxies do not work and hence are not supported in the browser');
55
56
 
56
57
  this.intents = params.intents || [];
@@ -434,7 +435,7 @@ export class Bot {
434
435
  this.game.socket.onmessage = (msg) => this._packetQueue.push(msg.data);
435
436
 
436
437
  if (this.autoUpdate)
437
- setInterval(() => this.update(), this.updateInterval);
438
+ this.updateIntervalId = setInterval(() => this.update(), this.updateInterval);
438
439
 
439
440
  if (this.intents.includes(this.Intents.PING)) {
440
441
  const out = CommOut.getBuffer();
@@ -723,7 +724,7 @@ export class Bot {
723
724
 
724
725
  return data;
725
726
  } else {
726
- const data = await (await fetch(`https://${this.instance}/maps/${name}.json?${hash}`)).json();
727
+ const data = await (await fetch(`https://esm.sh/gh/yolkorg/maps/maps/${name}.json`)).json();
727
728
  return data;
728
729
  }
729
730
  }
@@ -798,25 +799,21 @@ export class Bot {
798
799
 
799
800
  #processAddPlayerPacket() {
800
801
  const id_ = CommIn.unPackInt8U();
801
- const uniqueId = CommIn.unPackString();
802
- const name = CommIn.unPackString();
803
- const safename = CommIn.unPackString(); // ??? (a)
804
- const charClass = CommIn.unPackInt8U();
805
802
  const findCosmetics = this.intents.includes(this.Intents.COSMETIC_DATA);
806
803
  const playerData = {
807
804
  id_: id_,
808
- uniqueId_: uniqueId,
809
- name_: name,
810
- safename_: safename,
811
- charClass_: charClass,
805
+ uniqueId_: CommIn.unPackString(),
806
+ name_: CommIn.unPackString(),
807
+ safename_: CommIn.unPackString(),
808
+ charClass_: CommIn.unPackInt8U(),
812
809
  team_: CommIn.unPackInt8U(),
813
- primaryWeaponItem_: findItemById(CommIn.unPackInt16U()),
810
+ primaryWeaponItem_: findCosmetics ? findItemById(CommIn.unPackInt16U()) : CommIn.unPackInt16U(),
814
811
  secondaryWeaponItem_: findCosmetics ? findItemById(CommIn.unPackInt16U()) : CommIn.unPackInt16U(),
815
812
  shellColor_: CommIn.unPackInt8U(),
816
813
  hatItem_: findCosmetics ? findItemById(CommIn.unPackInt16U()) : CommIn.unPackInt16U(),
817
814
  stampItem_: findCosmetics ? findItemById(CommIn.unPackInt16U()) : CommIn.unPackInt16U(),
818
- unknownInt8: CommIn.unPackInt8(), // c
819
- otherUnknownInt8: CommIn.unPackInt8(),
815
+ _unused: CommIn.unPackInt8(),
816
+ _unused2: CommIn.unPackInt8(),
820
817
  grenadeItem_: findCosmetics ? findItemById(CommIn.unPackInt16U()) : CommIn.unPackInt16U(),
821
818
  meleeItem_: findCosmetics ? findItemById(CommIn.unPackInt16U()) : CommIn.unPackInt16U(),
822
819
  x_: CommIn.unPackFloat(),
@@ -828,6 +825,7 @@ export class Bot {
828
825
  yaw_: CommIn.unPackRadU(),
829
826
  pitch_: CommIn.unPackRad(),
830
827
  score_: CommIn.unPackInt32U(),
828
+ // the following are all stats
831
829
  kills_: CommIn.unPackInt16U(),
832
830
  deaths_: CommIn.unPackInt16U(),
833
831
  streak_: CommIn.unPackInt16U(),
@@ -835,6 +833,7 @@ export class Bot {
835
833
  totalDeaths_: CommIn.unPackInt32U(),
836
834
  bestGameStreak_: CommIn.unPackInt16U(),
837
835
  bestOverallStreak_: CommIn.unPackInt16U(),
836
+ // end stats
838
837
  shield_: CommIn.unPackInt8U(),
839
838
  hp_: CommIn.unPackInt8U(),
840
839
  playing_: CommIn.unPackInt8U(),
@@ -899,7 +898,15 @@ export class Bot {
899
898
  const climbing = CommIn.unPackInt8U();
900
899
 
901
900
  const player = this.players[id];
902
- if (!player) return;
901
+ if (!player || player.id == this.me.id) {
902
+ for (let i2 = 0; i2 < 3 /* FramesBetweenSyncs */; i2++) {
903
+ CommIn.unPackInt8U();
904
+ CommIn.unPackRadU();
905
+ CommIn.unPackRad();
906
+ CommIn.unPackInt8U();
907
+ }
908
+ return;
909
+ }
903
910
 
904
911
  if (player.position.x !== x) player.position.x = x;
905
912
  if (player.position.z !== z) player.position.z = z;
@@ -912,24 +919,13 @@ export class Bot {
912
919
  if (this.intents.includes(this.Intents.BUFFERS)) {
913
920
  if (!player.buffer) return;
914
921
 
915
- if (player.id == this.me.id) {
916
- for (let i2 = 0; i2 < 3 /* FramesBetweenSyncs */; i2++) {
917
- CommIn.unPackInt8U();
918
- CommIn.unPackRadU();
919
- CommIn.unPackRad();
920
- CommIn.unPackInt8U();
921
- }
922
- return;
923
- }
924
-
925
- let yaw, pitch;
926
922
  for (let i2 = 0; i2 < 3; i2++) {
927
923
  player.buffer[i2].controlKeys = CommIn.unPackInt8U();
928
924
 
929
- yaw = CommIn.unPackRadU();
925
+ const yaw = CommIn.unPackRadU();
930
926
  if (!isNaN(yaw)) player.buffer[i2].yaw_ = yaw
931
927
 
932
- pitch = CommIn.unPackRad();
928
+ const pitch = CommIn.unPackRad();
933
929
  if (!isNaN(pitch)) player.buffer[i2].pitch_ = pitch
934
930
 
935
931
  CommIn.unPackInt8U();
@@ -1378,8 +1374,7 @@ export class Bot {
1378
1374
 
1379
1375
  const findCosmetics = this.intents.includes(this.Intents.COSMETIC_DATA);
1380
1376
 
1381
- const primaryWeaponItem = findItemById(primaryWeaponIdx);
1382
-
1377
+ const primaryWeaponItem = findCosmetics ? findItemById(primaryWeaponIdx) : primaryWeaponIdx;
1383
1378
  const secondaryWeaponItem = findCosmetics ? findItemById(secondaryWeaponIdx) : secondaryWeaponIdx;
1384
1379
  const hatItem = findCosmetics ? findItemById(hatIdx) : hatIdx;
1385
1380
  const stampItem = findCosmetics ? findItemById(stampIdx) : stampIdx;
@@ -1758,7 +1753,7 @@ export class Bot {
1758
1753
  return this.pathing.nodeList.hasLineOfSight(this.me.position, target.position);
1759
1754
  }
1760
1755
 
1761
- getBestTarget() {
1756
+ getBestTarget(customFilter) {
1762
1757
  const options = Object.values(this.players)
1763
1758
  .filter((player) => player)
1764
1759
  .filter((player) => player !== this.me)
@@ -1766,7 +1761,8 @@ export class Bot {
1766
1761
  .filter((player) => player.hp > 0)
1767
1762
  .filter((player) => player.name !== this.me.name)
1768
1763
  .filter((player) => this.me.team === 0 || player.team !== this.me.team)
1769
- .filter((player) => this.canSee(player));
1764
+ .filter((player) => this.canSee(player))
1765
+ .filter((player) => !!customFilter(player));
1770
1766
 
1771
1767
  let minDistance = 200;
1772
1768
  let targetPlayer = null;
@@ -1873,7 +1869,7 @@ export class Bot {
1873
1869
  if (this.intents.includes(this.Intents.PLAYER_HEALTH))
1874
1870
  clearInterval(this.healthIntervalId);
1875
1871
 
1876
- clearInterval(this.updateInterval);
1872
+ clearInterval(this.updateIntervalId);
1877
1873
 
1878
1874
  this.game.socket.close();
1879
1875
  this.matchmaker.close();
package/src/browser.js CHANGED
@@ -1,15 +1,43 @@
1
- export { Bot } from './bot.js';
2
- export { GamePlayer } from './bot/GamePlayer.js';
1
+ import { Bot } from './bot.js';
2
+ import { GamePlayer } from './bot/GamePlayer.js';
3
3
 
4
- export { Matchmaker } from './matchmaker.js';
4
+ import { Matchmaker } from './matchmaker.js';
5
5
 
6
- export { default as Dispatches } from './dispatches/index.js';
6
+ import { default as Dispatches } from './dispatches/index.js';
7
7
 
8
- export * as API from './api.js';
9
- export * as Comm from './comm/index.js';
10
- export * as Packet from './packet.js';
8
+ import * as API from './api.js';
9
+ import * as Comm from './comm/index.js';
10
+ import * as Packet from './packet.js';
11
11
 
12
- export * as Constants from './constants/index.js';
13
- export * as Guns from './constants/guns.js';
14
- export { Items } from './constants/items.js';
15
- export { Maps } from './constants/maps.js';
12
+ import * as Constants from './constants/index.js';
13
+ import * as Guns from './constants/guns.js';
14
+ import { Items } from './constants/items.js';
15
+ import { Maps } from './constants/maps.js';
16
+
17
+ const yolkbot = {
18
+ Bot,
19
+ GamePlayer,
20
+ Matchmaker,
21
+ Dispatches,
22
+ API,
23
+ Comm,
24
+ Packet,
25
+ Constants,
26
+ Guns,
27
+ Items,
28
+ Maps
29
+ };
30
+
31
+ window.yolkbot = yolkbot;
32
+
33
+ export { Bot };
34
+ export { GamePlayer };
35
+ export { Matchmaker };
36
+ export { Dispatches };
37
+ export { API };
38
+ export { Comm };
39
+ export { Packet };
40
+ export { Constants };
41
+ export { Guns };
42
+ export { Items };
43
+ export { Maps };
@@ -38,7 +38,9 @@ const Eggk47 = class _Eggk47 extends Gun {
38
38
  this.shortReloadTime = 160;
39
39
 
40
40
  this.weaponName = 'EggK-47';
41
+ this.internalName = 'Eggk47';
41
42
  this.standardMeshName = 'eggk47';
43
+
42
44
  this.rof = 3;
43
45
  this.recoil = 7;
44
46
  this.automatic = true;
@@ -67,8 +69,10 @@ const DozenGauge = class _DozenGauge extends Gun {
67
69
  this.longReloadTime = 155;
68
70
  this.shortReloadTime = 155;
69
71
 
70
- this.weaponName = 'Dozen Gauge';
72
+ this.weaponName = 'Scrambler';
73
+ this.internalName = 'Dozen Gauge';
71
74
  this.standardMeshName = 'dozenGauge';
75
+
72
76
  this.rof = 8;
73
77
  this.recoil = 10;
74
78
  this.automatic = false;
@@ -121,8 +125,10 @@ const CSG1 = class _CSG1 extends Gun {
121
125
  this.shortReloadTime = 165;
122
126
  this.highPrecision = true;
123
127
 
124
- this.weaponName = 'CSG-1';
128
+ this.weaponName = 'Free Ranger';
129
+ this.internalName = 'CSG-1';
125
130
  this.standardMeshName = 'csg1';
131
+
126
132
  this.rof = 13;
127
133
  this.recoil = 13;
128
134
  this.automatic = false;
@@ -159,7 +165,9 @@ const Cluck9mm = class _Cluck9mm extends Gun {
159
165
  this.shortReloadTime = 160;
160
166
 
161
167
  this.weaponName = 'Cluck 9mm';
168
+ this.internalName = 'Cluck 9mm';
162
169
  this.standardMeshName = 'cluck9mm';
170
+
163
171
  this.rof = 4;
164
172
  this.recoil = 6;
165
173
  this.automatic = false;
@@ -199,7 +207,9 @@ const RPEGG = class _RPEGG extends Gun {
199
207
  this.shortReloadTime = 170;
200
208
 
201
209
  this.weaponName = 'RPEGG';
210
+ this.internalName = 'Eggsploder';
202
211
  this.standardMeshName = 'rpegg';
212
+
203
213
  this.rof = 40;
204
214
  this.recoil = 60;
205
215
  this.automatic = false;
@@ -236,7 +246,9 @@ const SMG = class _SMG extends Gun {
236
246
  this.shortReloadTime = 190;
237
247
 
238
248
  this.weaponName = 'Whipper';
249
+ this.internalName = 'SMEGG';
239
250
  this.standardMeshName = 'smg';
251
+
240
252
  this.rof = 10;
241
253
  this.recoil = 7;
242
254
  this.automatic = true;
@@ -276,7 +288,9 @@ const M24 = class _M24 extends Gun {
276
288
  this.shortReloadTime = 144;
277
289
 
278
290
  this.weaponName = 'Crackshot';
291
+ this.internalName = 'M2DZ';
279
292
  this.standardMeshName = 'm24';
293
+
280
294
  this.rof = 60;
281
295
  this.recoil = 40;
282
296
  this.automatic = false;
@@ -316,7 +330,9 @@ const AUG = class _AUG extends Gun {
316
330
  this.shortReloadTime = 160;
317
331
 
318
332
  this.weaponName = 'Tri-Hard';
333
+ this.internalName = 'AUG';
319
334
  this.standardMeshName = 'aug';
335
+
320
336
  this.rof = 15;
321
337
  this.recoil = 18;
322
338
  this.automatic = false;
@@ -71,6 +71,8 @@ export const PlayTypes = {
71
71
  joinPrivate: 2
72
72
  }
73
73
 
74
+ export const ProxiesEnabled = !IsBrowser && typeof Bun == 'undefined';
75
+
74
76
  export const ShellStreaks = {
75
77
  HardBoiled: 1,
76
78
  EggBreaker: 2,
@@ -80,6 +82,16 @@ export const ShellStreaks = {
80
82
  MiniEgg: 32
81
83
  }
82
84
 
85
+ export const SocialMedias = {
86
+ 0: 'Facebook',
87
+ 1: 'Instagram',
88
+ 2: 'Tiktok',
89
+ 3: 'Discord',
90
+ 4: 'Youtube',
91
+ 5: 'Twitter',
92
+ 6: 'Twitch'
93
+ }
94
+
83
95
  export const SocialRewards = {
84
96
  Discord: 'rew_1200',
85
97
  Tiktok: 'rew_1208',
@@ -102,7 +102,7 @@ export class SaveLoadoutDispatch {
102
102
  else if (changeKey === 'grenadeId') bot.me.character.grenade = findCosmetics ? findItemById(changeValue) : changeValue;
103
103
  else if (changeKey === 'meleeId') bot.me.character.melee = findCosmetics ? findItemById(changeValue) : changeValue;
104
104
  else if (changeKey === 'colorIdx') bot.me.character.eggColor = changeValue;
105
- else if (changeKey === 'primaryId') bot.me.character.primaryGun = findItemById(changeValue[bot.me.selectedGun]);
105
+ else if (changeKey === 'primaryId') bot.me.character.primaryGun = findCosmetics ? findItemById(changeValue[bot.me.selectedGun]) : changeValue;
106
106
  else if (changeKey === 'secondaryId') bot.me.character.secondaryGun = findCosmetics ? findItemById(changeValue[bot.me.selectedGun]) : changeValue;
107
107
  })
108
108
  })
package/src/matchmaker.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { loginAnonymously } from '#api';
2
- import { GameModes, IsBrowser, PlayTypes } from '#constants';
2
+ import { GameModes, PlayTypes, ProxiesEnabled } from '#constants';
3
3
 
4
4
  import yolkws from './socket.js';
5
5
 
@@ -21,13 +21,10 @@ export class Matchmaker {
21
21
  constructor(params = {}) {
22
22
  if (!params.instance) params.instance = 'shellshock.io';
23
23
 
24
- if (params.proxy && IsBrowser)
25
- throw new Error('proxies do not work and hence are not supported in the browser');
26
-
27
24
  if (params.sessionId) this.sessionId = params.sessionId;
28
25
  else this.#createSessionId(params.instance);
29
26
 
30
- if (params.proxy && IsBrowser) throw new Error('proxies do not work and hence are not supported in the browser');
27
+ if (params.proxy && !ProxiesEnabled) throw new Error('proxies do not work and hence are not supported in the browser');
31
28
  else if (params.proxy) this.proxy = params.proxy;
32
29
 
33
30
  this.#createSocket(params.instance);
@@ -20,11 +20,14 @@ class NodeList {
20
20
  constructor(raw) {
21
21
  const now = Date.now();
22
22
  this.list = [];
23
- const addedPositions = new Set();
23
+ const addedPositions = {};
24
24
 
25
25
  for (const meshName of Object.keys(raw.data)) {
26
26
  for (const nodeData of raw.data[meshName]) {
27
- addedPositions.add(`${nodeData.x},${nodeData.y},${nodeData.z}`);
27
+ addedPositions[(
28
+ (nodeData.x << 16) |
29
+ (nodeData.y << 8) |
30
+ (nodeData.z))] = true;
28
31
  this.add(new MapNode(meshName, nodeData));
29
32
  }
30
33
  }
@@ -32,8 +35,11 @@ class NodeList {
32
35
  for (let x = 0; x < raw.width; x++) {
33
36
  for (let y = 0; y < raw.height; y++) {
34
37
  for (let z = 0; z < raw.depth; z++) {
35
- const posKey = `${x},${y},${z}`;
36
- if (!addedPositions.has(posKey)) {
38
+ if (!addedPositions[(
39
+ (x << 16) |
40
+ (y << 8) |
41
+ (z)
42
+ )]) {
37
43
  this.add(new MapNode('SPECIAL.__yolkbot_air__.none', { x: x, y: y, z: z }));
38
44
  }
39
45
  }
package/src/socket.js CHANGED
@@ -1,12 +1,11 @@
1
1
  import NodeWebSocket from 'ws';
2
2
 
3
- import { IsBrowser, UserAgent } from '#constants';
3
+ import { IsBrowser, ProxiesEnabled, UserAgent } from '#constants';
4
4
 
5
- // eslint-disable-next-line no-undef
6
5
  const WS = IsBrowser ? window.WebSocket : NodeWebSocket;
7
6
 
8
7
  let SocksProxyAgent;
9
- if (!IsBrowser) SocksProxyAgent = (await import('smallsocks')).SocksProxyAgent;
8
+ if (ProxiesEnabled) SocksProxyAgent = (await import('smallsocks')).SocksProxyAgent;
10
9
 
11
10
  class yolkws extends WS {
12
11
  constructor(url, proxy) {
@@ -14,7 +14,7 @@ export interface View {
14
14
 
15
15
  export interface Character {
16
16
  eggColor: string;
17
- primaryGun: Item;
17
+ primaryGun: Item | number;
18
18
  secondaryGun: Item | number;
19
19
  stamp: Item | number;
20
20
  hat: Item | number;
@@ -29,28 +29,51 @@ export interface Buffer {
29
29
  }
30
30
 
31
31
  export interface PlayerData {
32
- name_: string;
32
+ id_: string;
33
33
  uniqueId_: string;
34
- playing_: boolean;
35
- social_: string;
36
- hideBadge_: boolean;
34
+ name_: string;
35
+ safename_: string;
36
+ charClass_: number;
37
+ team_: 0 | 1 | 2;
38
+ primaryWeaponItem_: Item | number;
39
+ secondaryWeaponItem_: Item | number;
40
+ shellColor_: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13;
41
+ hatItem_: Item | number;
42
+ stampItem_: Item | number;
43
+ _unused: number;
44
+ _unused2: number;
45
+ grenadeItem_: Item | number;
46
+ meleeItem_: Item | number;
37
47
  x_: number;
38
48
  y_: number;
39
49
  z_: number;
50
+ dx_: number;
51
+ dy_: number;
52
+ dz_: number;
40
53
  yaw_: number;
41
54
  pitch_: number;
42
- shellColor_: string;
43
- primaryWeaponItem_: Item;
44
- secondaryWeaponItem_: Item | number;
45
- stampItem_: Item | number;
46
- hatItem_: Item | number;
47
- grenadeItem_: Item | number;
48
- meleeItem_: Item | number;
55
+ score_: number;
56
+ kills_: number;
57
+ deaths_: number;
58
+ streak_: number;
59
+ totalKills_: number;
60
+ totalDeaths_: number;
61
+ bestGameStreak_: number;
62
+ bestOverallStreak_: number;
63
+ shield_: number;
64
+ hp_: number;
65
+ playing_: boolean;
49
66
  weaponIdx_: number;
67
+ controlKeys_: number;
68
+ upgradeProductId_: number;
69
+ activeShellStreaks_: number;
70
+ social_: string;
71
+ hideBadge_: boolean;
50
72
  }
51
73
 
52
74
  export interface Social {
53
75
  id: number;
76
+ type: 'Facebook' | 'Instagram' | 'Tiktok' | 'Discord' | 'Youtube' | 'Twitter' | 'Twitch';
54
77
  url: string;
55
78
  active: boolean;
56
79
  }
@@ -58,11 +81,12 @@ export interface Social {
58
81
  export class GamePlayer {
59
82
  id: string;
60
83
  team: 0 | 1 | 2;
61
- data: PlayerData;
84
+ raw: PlayerData;
62
85
  name: string;
63
86
  uniqueId: string;
64
87
  playing: boolean;
65
- social: Social[];
88
+ socials: Social[];
89
+ isVip: boolean;
66
90
  showBadge: boolean;
67
91
  position: Position;
68
92
  jumping: boolean;
@@ -74,7 +98,7 @@ export class GamePlayer {
74
98
  weapons: AnyGun[];
75
99
  grenades: number;
76
100
  buffer: Buffer;
77
- kills: number;
101
+ streak: number;
78
102
  hp: number;
79
103
  hpShield: number;
80
104
  streakRewards: number[];