yolkbot 0.1.1-alpha.27 → 0.1.1-alpha.29

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.27",
4
+ "version": "0.1.1-alpha.29",
5
5
  "keywords": [
6
6
  "shell shockers",
7
7
  "shellshock.io",
package/src/bot.js CHANGED
@@ -561,6 +561,7 @@ export class Bot {
561
561
  this.game.socket.onclose = (e) => {
562
562
  // console.log('Game socket closed:', e.code, Object.entries(CloseCode).filter(([, v]) => v == e.code));
563
563
  this.emit('close', e.code);
564
+ this.quit(true, true);
564
565
  }
565
566
  }
566
567
 
@@ -1076,18 +1077,6 @@ export class Bot {
1076
1077
  const serverStateIdx = CommIn.unPackInt8U();
1077
1078
  player.serverStateIdx = serverStateIdx;
1078
1079
 
1079
- /*
1080
- l = Rh.unPackInt8U();
1081
- var I = Rh.unPackInt8U();
1082
- var P = Rh.unPackInt8U();
1083
- p = Rh.unPackFloat();
1084
- _ = Rh.unPackFloat();
1085
- g = Rh.unPackFloat();
1086
- var k = Rh.unPackInt8U();
1087
- var D = Rh.unPackInt8U();
1088
- var O = Rh.unPackInt8U();
1089
- */
1090
-
1091
1080
  const newX = CommIn.unPackFloat();
1092
1081
  const newY = CommIn.unPackFloat();
1093
1082
  const newZ = CommIn.unPackFloat();
@@ -1879,7 +1868,7 @@ export class Bot {
1879
1868
  return result;
1880
1869
  }
1881
1870
 
1882
- quit(noCleanup = false) {
1871
+ quit(noCleanup = false, finishDispatches = false) {
1883
1872
  if (this.intents.includes(this.Intents.PLAYER_HEALTH))
1884
1873
  clearInterval(this.healthIntervalId);
1885
1874
 
@@ -1888,7 +1877,7 @@ export class Bot {
1888
1877
  this.game.socket.close();
1889
1878
  this.matchmaker.close();
1890
1879
 
1891
- this._dispatches = [];
1880
+ if (!finishDispatches) this._dispatches = [];
1892
1881
  this._packetQueue = [];
1893
1882
 
1894
1883
  if (!noCleanup) {
@@ -117,5 +117,5 @@ export const URLRewards = [
117
117
  'WelcomeBack'
118
118
  ]
119
119
 
120
- export const UserAgent =
120
+ export const UserAgent = IsBrowser ? undefined :
121
121
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36'
@@ -18,7 +18,6 @@
18
18
 
19
19
  class NodeList {
20
20
  constructor(raw) {
21
- const now = Date.now();
22
21
  this.list = [];
23
22
  const addedPositions = {};
24
23
 
@@ -69,8 +68,6 @@ class NodeList {
69
68
  }
70
69
  }
71
70
  }
72
-
73
- console.log(`NodeList created in ${Date.now() - now}ms`);
74
71
  }
75
72
 
76
73
  add(node) {
@@ -109,4 +109,4 @@ export declare const Teams: {
109
109
 
110
110
  export declare const URLRewards: string[];
111
111
 
112
- export declare const UserAgent: string;
112
+ export declare const UserAgent: string | undefined;