yolkbot 0.1.1-alpha.8 → 0.1.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.
- package/README.md +2 -2
- package/browser/build/global.js +3 -0
- package/browser/build/module.js +3 -0
- package/package.json +11 -27
- package/src/api.js +56 -34
- package/src/bot/GamePlayer.js +18 -16
- package/src/bot.js +92 -38
- package/src/comm/Codes.js +1 -74
- package/src/comm/index.js +1 -1
- package/src/constants/codes.js +45 -0
- package/src/constants/guns.js +18 -2
- package/src/constants/index.js +11 -1
- package/src/constants/items.js +477 -88
- package/src/constants/maps.js +27 -14
- package/src/dispatches/BootPlayerDispatch.js +6 -2
- package/src/dispatches/ChatDispatch.js +7 -2
- package/src/dispatches/GameOptionsDispatch.js +20 -2
- package/src/dispatches/MeleeDispatch.js +6 -4
- package/src/dispatches/PauseDispatch.js +7 -3
- package/src/dispatches/ReloadDispatch.js +5 -2
- package/src/dispatches/ReportPlayerDispatch.js +7 -2
- package/src/dispatches/SaveLoadoutDispatch.js +11 -6
- package/src/dispatches/SpawnDispatch.js +5 -2
- package/src/dispatches/SwapWeaponDispatch.js +7 -2
- package/src/dispatches/SwitchTeamDispatch.js +5 -2
- package/src/dispatches/ThrowGrenadeDispatch.js +6 -2
- package/src/globals.js +15 -0
- package/src/matchmaker.js +13 -9
- package/src/pathing/astar.js +7 -25
- package/src/pathing/binaryheap.js +6 -6
- package/src/pathing/mapnode.js +4 -53
- package/src/socket.js +4 -10
- package/src/types/bot/GamePlayer.d.ts +39 -15
- package/src/types/bot.d.ts +1 -1
- package/src/types/constants/guns.d.ts +8 -0
- package/src/types/constants/index.d.ts +11 -1
- package/src/types/matchmaker.d.ts +8 -2
- package/build/browser.js +0 -8
- package/src/browser.js +0 -15
- package/src/dispatches/LookDispatch2.js +0 -18
- package/src/packet.js +0 -128
package/src/browser.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export { Bot } from './bot.js';
|
|
2
|
-
export { GamePlayer } from './bot/GamePlayer.js';
|
|
3
|
-
|
|
4
|
-
export { Matchmaker } from './matchmaker.js';
|
|
5
|
-
|
|
6
|
-
export { default as Dispatches } from './dispatches/index.js';
|
|
7
|
-
|
|
8
|
-
export * as API from './api.js';
|
|
9
|
-
export * as Comm from './comm/index.js';
|
|
10
|
-
export * as Packet from './packet.js';
|
|
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';
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export class LookDispatch2 {
|
|
2
|
-
check(bot) {
|
|
3
|
-
return bot.me.playing;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
execute(bot) {
|
|
7
|
-
let x = 0;
|
|
8
|
-
|
|
9
|
-
(() => setInterval(() => {
|
|
10
|
-
x += 0.1;
|
|
11
|
-
x %= 2 * Math.PI;
|
|
12
|
-
bot.me.view.yaw = x - Math.PI;
|
|
13
|
-
bot.me.view.pitch = x;
|
|
14
|
-
}, 20))();
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default LookDispatch2;
|
package/src/packet.js
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import CommOut from './comm/CommOut.js';
|
|
2
|
-
import { CommCode } from './comm/Codes.js';
|
|
3
|
-
|
|
4
|
-
class Packet {
|
|
5
|
-
constructor(code, _args) {
|
|
6
|
-
// args = [{type: int8, val: val}, {type: string, val: val}, etc]
|
|
7
|
-
this.out = CommOut.getBuffer();
|
|
8
|
-
this.out.packInt8(code);
|
|
9
|
-
if (_args) {
|
|
10
|
-
for (const arg of _args) {
|
|
11
|
-
switch (arg.type) {
|
|
12
|
-
case 'int8':
|
|
13
|
-
this.out.packInt8(arg.val);
|
|
14
|
-
break;
|
|
15
|
-
case 'int8u':
|
|
16
|
-
this.out.packInt8U(arg.val);
|
|
17
|
-
break;
|
|
18
|
-
case 'string':
|
|
19
|
-
this.out.packString(arg.val);
|
|
20
|
-
break;
|
|
21
|
-
case 'float':
|
|
22
|
-
this.out.packFloat(arg.val);
|
|
23
|
-
break;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
get length() {
|
|
29
|
-
return this.buf.length;
|
|
30
|
-
}
|
|
31
|
-
execute(ws) {
|
|
32
|
-
this.out.send(ws);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function RespawnPacket() {
|
|
37
|
-
return new Packet(CommCode.requestRespawn)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function MeleePacket() {
|
|
41
|
-
return new Packet(CommCode.melee)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function ChatPacket(msg) {
|
|
45
|
-
return new Packet(CommCode.chat, [
|
|
46
|
-
{ type: 'string', val: msg }
|
|
47
|
-
]);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function SwapWeaponPacket(weaponId) {
|
|
51
|
-
return new Packet(CommCode.swapWeapon, [
|
|
52
|
-
{ type: 'int8', val: weaponId }
|
|
53
|
-
]);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function ReportPacket(userId, reasonInt) {
|
|
57
|
-
return new Packet(CommCode.reportPlayer, [
|
|
58
|
-
{ type: 'string', val: userId },
|
|
59
|
-
{ type: 'int8', val: reasonInt }
|
|
60
|
-
]);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function TeamSwitchingTraitorPacket() {
|
|
64
|
-
return new Packet(CommCode.switchTeam);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function GameOptionsPacket(options) {
|
|
68
|
-
const flags =
|
|
69
|
-
(options.locked ? 1 : 0) |
|
|
70
|
-
(options.noTeamChange ? 2 : 0) |
|
|
71
|
-
(options.noTeamShuffle ? 4 : 0);
|
|
72
|
-
|
|
73
|
-
const weapons = [];
|
|
74
|
-
|
|
75
|
-
options.weaponsDisabled.forEach((v) => {
|
|
76
|
-
weapons.push({ type: 'int8', val: v ? 1 : 0 });
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
return new Packet(CommCode.gameOptions, [
|
|
80
|
-
{ type: 'int8', val: options.gravity * 4 },
|
|
81
|
-
{ type: 'int8', val: options.damage * 4 },
|
|
82
|
-
{ type: 'int8', val: options.healthRegen * 4 },
|
|
83
|
-
{ type: 'int8', val: flags },
|
|
84
|
-
...weapons
|
|
85
|
-
]);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function BootPacket(uniqueId) {
|
|
89
|
-
return new Packet(CommCode.bootPlayer, [
|
|
90
|
-
{ type: 'string', val: uniqueId }
|
|
91
|
-
]);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function ChangeCharacterPacket(gunId) {
|
|
95
|
-
return new Packet(CommCode.changeCharacter, [
|
|
96
|
-
{ type: 'int8', val: gunId }
|
|
97
|
-
]);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function PausePacket() {
|
|
101
|
-
return new Packet(CommCode.pause);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function ReloadPacket() {
|
|
105
|
-
return new Packet(CommCode.reload);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function ThrowGrenadePacket(power) {
|
|
109
|
-
return new Packet(CommCode.throwGrenade, [
|
|
110
|
-
{ type: 'float', val: power }
|
|
111
|
-
]);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export default {
|
|
115
|
-
Packet,
|
|
116
|
-
BootPacket,
|
|
117
|
-
ChangeCharacterPacket,
|
|
118
|
-
ChatPacket,
|
|
119
|
-
GameOptionsPacket,
|
|
120
|
-
MeleePacket,
|
|
121
|
-
PausePacket,
|
|
122
|
-
ReloadPacket,
|
|
123
|
-
ReportPacket,
|
|
124
|
-
RespawnPacket,
|
|
125
|
-
SwapWeaponPacket,
|
|
126
|
-
TeamSwitchingTraitorPacket,
|
|
127
|
-
ThrowGrenadePacket
|
|
128
|
-
}
|