yolkbot 0.1.0-alpha.4 → 0.1.0-alpha.6
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 +2 -2
- package/package.json +25 -7
- package/src/api.js +3 -5
- package/src/constants/index.js +2 -0
- package/src/dispatches/index.js +5 -2
- package/src/types/api.d.ts +35 -0
- package/src/types/bot/GamePlayer.d.ts +83 -0
- package/src/types/bot.d.ts +152 -0
- package/src/types/dispatches/BootPlayerDispatch.d.ts +10 -0
- package/src/types/dispatches/ChatDispatch.d.ts +10 -0
- package/src/types/dispatches/FireDispatch.d.ts +8 -0
- package/src/types/dispatches/GameOptionsDispatch.d.ts +8 -0
- package/src/types/dispatches/GoToPlayerDispatch.d.ts +10 -0
- package/src/types/dispatches/GoToSpatulaDispatch.d.ts +8 -0
- package/src/types/dispatches/LookAtDispatch.d.ts +14 -0
- package/src/types/dispatches/LookAtPosDispatch.d.ts +17 -0
- package/src/types/dispatches/MeleeDispatch.d.ts +6 -0
- package/src/types/dispatches/MovementDispatch.d.ts +10 -0
- package/src/types/dispatches/PauseDispatch.d.ts +6 -0
- package/src/types/dispatches/ReloadDispatch.d.ts +6 -0
- package/src/types/dispatches/ReportPlayerDispatch.d.ts +13 -0
- package/src/types/dispatches/SaveLoadoutDispatch.d.ts +32 -0
- package/src/types/dispatches/SpawnDispatch.d.ts +6 -0
- package/src/types/dispatches/SwapWeaponDispatch.d.ts +6 -0
- package/src/types/dispatches/SwitchTeamDispatch.d.ts +6 -0
- package/src/types/dispatches/ThrowGrenadeDispatch.d.ts +7 -0
- package/src/types/dispatches/index.d.ts +130 -0
- package/src/types/matchmaker.d.ts +59 -0
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.0-alpha.
|
|
4
|
+
"version": "0.1.0-alpha.6",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"shell shockers",
|
|
7
7
|
"shellshock.io",
|
|
@@ -31,18 +31,36 @@
|
|
|
31
31
|
"exports": {
|
|
32
32
|
"./package.json": "./package.json",
|
|
33
33
|
".": "./src/index.js",
|
|
34
|
-
"./api":
|
|
35
|
-
|
|
34
|
+
"./api": {
|
|
35
|
+
"import": "./src/api.js",
|
|
36
|
+
"types": "./src/types/api.d.ts"
|
|
37
|
+
},
|
|
38
|
+
"./bot": {
|
|
39
|
+
"import": "./src/bot.js",
|
|
40
|
+
"types": "./src/types/bot.d.ts"
|
|
41
|
+
},
|
|
36
42
|
"./browser": "./build/browser.js",
|
|
37
43
|
"./comm": "./src/comm/index.js",
|
|
38
|
-
"./matchmaker":
|
|
44
|
+
"./matchmaker": {
|
|
45
|
+
"import": "./src/matchmaker.js",
|
|
46
|
+
"types": "./src/types/matchmaker.d.ts"
|
|
47
|
+
},
|
|
39
48
|
"./packets": "./src/packet.js",
|
|
40
49
|
"./constants": "./src/constants/index.js",
|
|
41
50
|
"./constants/*": "./src/constants/*.js",
|
|
42
51
|
"./constants/*.js": "./src/constants/*.js",
|
|
43
|
-
"./dispatch":
|
|
44
|
-
|
|
45
|
-
|
|
52
|
+
"./dispatch": {
|
|
53
|
+
"import": "./src/dispatches/index.js",
|
|
54
|
+
"types": "./src/types/dispatches.d.ts"
|
|
55
|
+
},
|
|
56
|
+
"./dispatch/*": {
|
|
57
|
+
"import": "./src/dispatches/*.js",
|
|
58
|
+
"types": "./src/types/dispatches/*.d.ts"
|
|
59
|
+
},
|
|
60
|
+
"./dispatch/*.js": {
|
|
61
|
+
"import": "./src/dispatches/*.js",
|
|
62
|
+
"types": "./src/types/dispatches/*.d.ts"
|
|
63
|
+
}
|
|
46
64
|
},
|
|
47
65
|
"dependencies": {
|
|
48
66
|
"socks-proxy-agent": "^8.0.5",
|
package/src/api.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import yolkws from './socket.js';
|
|
2
2
|
|
|
3
|
-
import { UserAgent } from '#constants';
|
|
4
|
-
|
|
5
|
-
const firebaseKey = 'AIzaSyDP4SIjKaw6A4c-zvfYxICpbEjn1rRnN50';
|
|
3
|
+
import { FirebaseKey, UserAgent } from '#constants';
|
|
6
4
|
|
|
7
5
|
const queryServices = async (request, proxy = '', instance = 'shellshock.io') => {
|
|
8
6
|
return new Promise((resolve) => {
|
|
@@ -62,7 +60,7 @@ async function loginWithCredentials(email, password, prox = '', instance = 'shel
|
|
|
62
60
|
|
|
63
61
|
while (!SUCCESS) {
|
|
64
62
|
try {
|
|
65
|
-
request = await fetch('https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key=' +
|
|
63
|
+
request = await fetch('https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key=' + FirebaseKey, {
|
|
66
64
|
method: 'POST',
|
|
67
65
|
body: JSON.stringify({
|
|
68
66
|
email: email,
|
|
@@ -108,7 +106,7 @@ async function loginWithCredentials(email, password, prox = '', instance = 'shel
|
|
|
108
106
|
}
|
|
109
107
|
|
|
110
108
|
async function loginAnonymously(prox = '', instance = 'shellshock.io') {
|
|
111
|
-
const request = await fetch('https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=' +
|
|
109
|
+
const request = await fetch('https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=' + FirebaseKey, {
|
|
112
110
|
method: 'POST',
|
|
113
111
|
body: JSON.stringify({ returnSecureToken: true }),
|
|
114
112
|
headers: {
|
package/src/constants/index.js
CHANGED
package/src/dispatches/index.js
CHANGED
|
@@ -15,6 +15,7 @@ import SaveLoadoutDispatch from './SaveLoadoutDispatch.js';
|
|
|
15
15
|
import SpawnDispatch from './SpawnDispatch.js';
|
|
16
16
|
import SwapWeaponDispatch from './SwapWeaponDispatch.js';
|
|
17
17
|
import SwitchTeamDispatch from './SwitchTeamDispatch.js';
|
|
18
|
+
import ThrowGrenadeDispatch from './ThrowGrenadeDispatch.js';
|
|
18
19
|
|
|
19
20
|
export {
|
|
20
21
|
BootPlayerDispatch,
|
|
@@ -33,7 +34,8 @@ export {
|
|
|
33
34
|
SaveLoadoutDispatch,
|
|
34
35
|
SpawnDispatch,
|
|
35
36
|
SwapWeaponDispatch,
|
|
36
|
-
SwitchTeamDispatch
|
|
37
|
+
SwitchTeamDispatch,
|
|
38
|
+
ThrowGrenadeDispatch
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
export default {
|
|
@@ -53,5 +55,6 @@ export default {
|
|
|
53
55
|
SaveLoadoutDispatch,
|
|
54
56
|
SpawnDispatch,
|
|
55
57
|
SwapWeaponDispatch,
|
|
56
|
-
SwitchTeamDispatch
|
|
58
|
+
SwitchTeamDispatch,
|
|
59
|
+
ThrowGrenadeDispatch
|
|
57
60
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { FirebaseKey, UserAgent } from '../constants/index.js';
|
|
2
|
+
|
|
3
|
+
declare module './socket.js' {
|
|
4
|
+
export default class yolkws {
|
|
5
|
+
constructor(url: string, proxy: string);
|
|
6
|
+
onopen: () => void;
|
|
7
|
+
onmessage: (event: { data: string }) => void;
|
|
8
|
+
onerror: () => void;
|
|
9
|
+
onclose: () => void;
|
|
10
|
+
send(data: string): void;
|
|
11
|
+
close(): void;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface QueryRequest {
|
|
16
|
+
cmd: string;
|
|
17
|
+
firebaseToken?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface QueryResponse {
|
|
21
|
+
id?: number;
|
|
22
|
+
firebaseId?: string;
|
|
23
|
+
sessionId?: string;
|
|
24
|
+
session?: number;
|
|
25
|
+
kills?: number;
|
|
26
|
+
deaths?: number;
|
|
27
|
+
currentBalance?: number;
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function queryServices(request: QueryRequest, proxy?: string, instance?: string): Promise<QueryResponse | string>;
|
|
32
|
+
|
|
33
|
+
export function loginWithCredentials(email: string, password: string, prox?: string, instance?: string): Promise<QueryResponse | string>;
|
|
34
|
+
|
|
35
|
+
export function loginAnonymously(prox?: string, instance?: string): Promise<QueryResponse | string>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { GunList } from '#constants';
|
|
2
|
+
import { Cluck9mm } from '../constants/guns.js';
|
|
3
|
+
|
|
4
|
+
export interface Position {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
z: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface View {
|
|
11
|
+
yaw: number;
|
|
12
|
+
pitch: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface Character {
|
|
16
|
+
eggColor: string;
|
|
17
|
+
primaryGun: any;
|
|
18
|
+
secondaryGun: any;
|
|
19
|
+
stamp: any;
|
|
20
|
+
hat: any;
|
|
21
|
+
grenade: any;
|
|
22
|
+
melee: any;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface Buffer {
|
|
26
|
+
[key: number]: any;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface PlayerData {
|
|
30
|
+
name_: string;
|
|
31
|
+
uniqueId_: string;
|
|
32
|
+
playing_: boolean;
|
|
33
|
+
social_: string;
|
|
34
|
+
hideBadge_: boolean;
|
|
35
|
+
x_: number;
|
|
36
|
+
y_: number;
|
|
37
|
+
z_: number;
|
|
38
|
+
yaw_: number;
|
|
39
|
+
pitch_: number;
|
|
40
|
+
shellColor_: string;
|
|
41
|
+
primaryWeaponItem_: any;
|
|
42
|
+
secondaryWeaponItem_: any;
|
|
43
|
+
stampItem_: any;
|
|
44
|
+
hatItem_: any;
|
|
45
|
+
grenadeItem_: any;
|
|
46
|
+
meleeItem_: any;
|
|
47
|
+
weaponIdx_: number;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export class GamePlayer {
|
|
51
|
+
id: string;
|
|
52
|
+
team: string;
|
|
53
|
+
data: PlayerData;
|
|
54
|
+
name: string;
|
|
55
|
+
uniqueId: string;
|
|
56
|
+
playing: boolean;
|
|
57
|
+
social: any;
|
|
58
|
+
showBadge: boolean;
|
|
59
|
+
position: Position;
|
|
60
|
+
jumping: boolean;
|
|
61
|
+
climbing: boolean;
|
|
62
|
+
view: View;
|
|
63
|
+
character: Character;
|
|
64
|
+
activeGun: number;
|
|
65
|
+
selectedGun: number;
|
|
66
|
+
weapons: any[];
|
|
67
|
+
grenades: number;
|
|
68
|
+
buffer: Buffer;
|
|
69
|
+
kills: number;
|
|
70
|
+
hp: number;
|
|
71
|
+
hpShield: number;
|
|
72
|
+
streakRewards: any[];
|
|
73
|
+
randomSeed: number;
|
|
74
|
+
serverStateIdx: number;
|
|
75
|
+
|
|
76
|
+
constructor(id: string, team: string, playerData: PlayerData);
|
|
77
|
+
|
|
78
|
+
dispatch(): void;
|
|
79
|
+
join(): void;
|
|
80
|
+
update(): void;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export default GamePlayer;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { CommCode } from '../comm/Codes.js';
|
|
2
|
+
import { GamePlayer } from '../bot/GamePlayer.js';
|
|
3
|
+
import { Matchmaker } from '../matchmaker.js';
|
|
4
|
+
import { yolkws } from '../socket.js';
|
|
5
|
+
import { NodeList } from '../pathing/mapnode.js';
|
|
6
|
+
import { Maps } from '../constants/maps.js';
|
|
7
|
+
|
|
8
|
+
export interface BotParams {
|
|
9
|
+
name?: string;
|
|
10
|
+
proxy?: string;
|
|
11
|
+
doUpdate?: boolean;
|
|
12
|
+
updateInterval?: number;
|
|
13
|
+
doPing?: boolean;
|
|
14
|
+
pingInterval?: number;
|
|
15
|
+
doPathing?: boolean;
|
|
16
|
+
instance?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface Account {
|
|
20
|
+
firebaseId: string;
|
|
21
|
+
sessionId: string;
|
|
22
|
+
session: string;
|
|
23
|
+
loadout: {
|
|
24
|
+
hatId: number | null;
|
|
25
|
+
meleeId: number;
|
|
26
|
+
stampId: number | null;
|
|
27
|
+
classIdx: number;
|
|
28
|
+
colorIdx: number;
|
|
29
|
+
grenadeId: number;
|
|
30
|
+
primaryId: number[];
|
|
31
|
+
secondaryId: number[];
|
|
32
|
+
stampPositionX: number;
|
|
33
|
+
stampPositionY: number;
|
|
34
|
+
};
|
|
35
|
+
ownedItemIds: number[];
|
|
36
|
+
vip: boolean;
|
|
37
|
+
accountAge: number;
|
|
38
|
+
emailVerified: boolean;
|
|
39
|
+
eggBalance: number;
|
|
40
|
+
rawLoginData: any;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface GameOptions {
|
|
44
|
+
gravity: number;
|
|
45
|
+
damage: number;
|
|
46
|
+
healthRegen: number;
|
|
47
|
+
locked: boolean;
|
|
48
|
+
noTeamChange: boolean;
|
|
49
|
+
noTeamShuffle: boolean;
|
|
50
|
+
weaponsDisabled: boolean[];
|
|
51
|
+
mustUseSecondary: boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface Game {
|
|
55
|
+
raw: any;
|
|
56
|
+
code: string;
|
|
57
|
+
gameModeId: number;
|
|
58
|
+
gameMode: string;
|
|
59
|
+
mapIdx: number;
|
|
60
|
+
map: {
|
|
61
|
+
filename: string;
|
|
62
|
+
hash: string;
|
|
63
|
+
name: string;
|
|
64
|
+
modes: {
|
|
65
|
+
FFA: boolean;
|
|
66
|
+
Teams: boolean;
|
|
67
|
+
Spatula: boolean;
|
|
68
|
+
King: boolean;
|
|
69
|
+
};
|
|
70
|
+
availability: string;
|
|
71
|
+
numPlayers: string;
|
|
72
|
+
raw: any;
|
|
73
|
+
nodes: any;
|
|
74
|
+
};
|
|
75
|
+
playerLimit: number;
|
|
76
|
+
isGameOwner: boolean;
|
|
77
|
+
isPrivate: boolean;
|
|
78
|
+
options: GameOptions;
|
|
79
|
+
collectables: any[][];
|
|
80
|
+
teamScore: number[];
|
|
81
|
+
spatula: {
|
|
82
|
+
coords: { x: number; y: number; z: number };
|
|
83
|
+
controlledBy: number;
|
|
84
|
+
controlledByTeam: number;
|
|
85
|
+
};
|
|
86
|
+
stage: number;
|
|
87
|
+
activeZone: number;
|
|
88
|
+
capturing: number;
|
|
89
|
+
captureProgress: number;
|
|
90
|
+
numCapturing: number;
|
|
91
|
+
stageName: string;
|
|
92
|
+
capturePercent: number;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface Pathing {
|
|
96
|
+
nodeList: NodeList | null;
|
|
97
|
+
followingPath: boolean;
|
|
98
|
+
activePath: any;
|
|
99
|
+
activeNode: any;
|
|
100
|
+
activeNodeIdx: number;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface BotState {
|
|
104
|
+
loggedIn: boolean;
|
|
105
|
+
gameFound: boolean;
|
|
106
|
+
reloading: boolean;
|
|
107
|
+
swappingGun: boolean;
|
|
108
|
+
usingMelee: boolean;
|
|
109
|
+
shotsFired: number;
|
|
110
|
+
joinedGame?: boolean;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export class Bot {
|
|
114
|
+
proxy: string;
|
|
115
|
+
name: string;
|
|
116
|
+
autoPing: boolean;
|
|
117
|
+
autoUpdate: boolean;
|
|
118
|
+
disablePathing: boolean;
|
|
119
|
+
pingInterval: number;
|
|
120
|
+
updateInterval: number;
|
|
121
|
+
instance: string;
|
|
122
|
+
state: BotState;
|
|
123
|
+
players: Record<string, GamePlayer>;
|
|
124
|
+
me: GamePlayer;
|
|
125
|
+
game: Game;
|
|
126
|
+
account: Account;
|
|
127
|
+
gameSocket: yolkws | null;
|
|
128
|
+
ping: number;
|
|
129
|
+
lastPingTime: number;
|
|
130
|
+
lastDeathTime: number;
|
|
131
|
+
lastChatTime: number;
|
|
132
|
+
lastUpdateTime: number;
|
|
133
|
+
nUpdates: number;
|
|
134
|
+
controlKeys: number;
|
|
135
|
+
initTime: number;
|
|
136
|
+
pathing: Pathing;
|
|
137
|
+
matchmaker: Matchmaker | null;
|
|
138
|
+
|
|
139
|
+
constructor(params?: BotParams);
|
|
140
|
+
|
|
141
|
+
login(email: string, pass: string): Promise<Account | false>;
|
|
142
|
+
dispatch(disp: any): void;
|
|
143
|
+
drain(): void;
|
|
144
|
+
initMatchmaker(): Promise<boolean>;
|
|
145
|
+
createPrivateGame(opts: { region: string; mode: string; map: string }): Promise<any>;
|
|
146
|
+
join(data: string | any): Promise<void>;
|
|
147
|
+
update(): void;
|
|
148
|
+
on(event: string, cb: Function): void;
|
|
149
|
+
onAny(cb: Function): void;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export default Bot;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Bot from '../bot';
|
|
2
|
+
|
|
3
|
+
declare class LookAtDispatch {
|
|
4
|
+
idOrName: number | string;
|
|
5
|
+
id?: number;
|
|
6
|
+
name?: string;
|
|
7
|
+
|
|
8
|
+
constructor(idOrName: number | string);
|
|
9
|
+
|
|
10
|
+
check(bot: Bot): boolean;
|
|
11
|
+
execute(bot: Bot): void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default LookAtDispatch;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type Position = {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
z: number;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export declare class LookAtPosDispatch {
|
|
8
|
+
idOrName: any;
|
|
9
|
+
pos: Position;
|
|
10
|
+
|
|
11
|
+
constructor(pos: Position);
|
|
12
|
+
|
|
13
|
+
check(bot: Bot): boolean;
|
|
14
|
+
execute(bot: Bot): void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default LookAtPosDispatch;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export class ReportPlayerDispatch {
|
|
2
|
+
id?: number;
|
|
3
|
+
name?: string;
|
|
4
|
+
reasons: boolean[];
|
|
5
|
+
reasonInt: number;
|
|
6
|
+
|
|
7
|
+
constructor(idOrName: number | string, reasons?: { cheating?: boolean; harassment?: boolean; offensive?: boolean; other?: boolean });
|
|
8
|
+
|
|
9
|
+
check(bot: Bot): boolean;
|
|
10
|
+
execute(bot: Bot): void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default ReportPlayerDispatch;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
type Changes = {
|
|
2
|
+
classIdx?: number;
|
|
3
|
+
hatId?: number;
|
|
4
|
+
stampId?: number;
|
|
5
|
+
grenadeId?: number;
|
|
6
|
+
meleeId?: number;
|
|
7
|
+
colorIdx?: number;
|
|
8
|
+
primaryId?: number[];
|
|
9
|
+
secondaryId?: number[];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
type Opts = {
|
|
13
|
+
gunId?: number;
|
|
14
|
+
hatId?: number;
|
|
15
|
+
stampId?: number;
|
|
16
|
+
grenadeId?: number;
|
|
17
|
+
meleeId?: number;
|
|
18
|
+
eggColor?: number;
|
|
19
|
+
primaryIds?: number[];
|
|
20
|
+
secondaryIds?: number[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export class SaveLoadoutDispatch {
|
|
24
|
+
changes: Changes;
|
|
25
|
+
|
|
26
|
+
constructor(opts: Opts);
|
|
27
|
+
|
|
28
|
+
check(bot: Bot): boolean;
|
|
29
|
+
execute(bot: Bot): void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default SaveLoadoutDispatch;
|