yolkbot 0.1.1-alpha.3 → 0.1.1-alpha.4
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/build/browser.js +6 -6
- package/package.json +1 -1
- package/src/api.js +5 -5
- package/src/bot.js +2 -1
- package/src/constants/index.js +2 -0
- package/src/matchmaker.js +2 -5
- package/src/pathing/mapnode.js +10 -4
- package/src/socket.js +2 -3
- package/src/types/constants/index.d.ts +2 -0
package/package.json
CHANGED
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,
|
|
5
|
+
import { FirebaseKey, ProxiesEnabled, UserAgent } from '#constants';
|
|
6
6
|
|
|
7
7
|
let SocksProxyAgent;
|
|
8
|
-
if (
|
|
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: (
|
|
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: (
|
|
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: (
|
|
188
|
+
httpsAgent: (ProxiesEnabled && prox) ? new SocksProxyAgent(prox) : false
|
|
189
189
|
});
|
|
190
190
|
|
|
191
191
|
const token = body.idToken;
|
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 &&
|
|
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 || [];
|
package/src/constants/index.js
CHANGED
package/src/matchmaker.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { loginAnonymously } from '#api';
|
|
2
|
-
import { GameModes,
|
|
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 &&
|
|
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);
|
package/src/pathing/mapnode.js
CHANGED
|
@@ -20,11 +20,14 @@ class NodeList {
|
|
|
20
20
|
constructor(raw) {
|
|
21
21
|
const now = Date.now();
|
|
22
22
|
this.list = [];
|
|
23
|
-
const addedPositions =
|
|
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
|
|
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
|
-
|
|
36
|
-
|
|
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 (
|
|
8
|
+
if (ProxiesEnabled) SocksProxyAgent = (await import('smallsocks')).SocksProxyAgent;
|
|
10
9
|
|
|
11
10
|
class yolkws extends WS {
|
|
12
11
|
constructor(url, proxy) {
|