yolkbot 0.1.0-alpha.9 → 0.1.0
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 +17 -5
- package/src/api.js +97 -23
- package/src/bot/GamePlayer.js +2 -2
- package/src/bot.js +851 -484
- package/src/comm/Codes.js +73 -0
- package/src/constants/index.js +23 -1
- package/src/constants/items.js +663 -264
- package/src/constants/maps.js +57 -18
- package/src/dispatches/BootPlayerDispatch.js +1 -1
- package/src/dispatches/ChatDispatch.js +1 -1
- package/src/dispatches/GameOptionsDispatch.js +1 -1
- package/src/dispatches/GoToAmmoDispatch.js +44 -0
- package/src/dispatches/GoToCoopDispatch.js +44 -0
- package/src/dispatches/GoToGrenadeDispatch.js +44 -0
- package/src/dispatches/GoToPlayerDispatch.js +5 -1
- package/src/dispatches/GoToSpatulaDispatch.js +5 -1
- package/src/dispatches/MeleeDispatch.js +1 -1
- package/src/dispatches/PauseDispatch.js +1 -1
- package/src/dispatches/ReloadDispatch.js +14 -2
- package/src/dispatches/ReportPlayerDispatch.js +1 -1
- package/src/dispatches/SaveLoadoutDispatch.js +11 -34
- package/src/dispatches/SpawnDispatch.js +1 -1
- package/src/dispatches/SwapWeaponDispatch.js +1 -1
- package/src/dispatches/SwitchTeamDispatch.js +1 -1
- package/src/dispatches/ThrowGrenadeDispatch.js +1 -1
- package/src/dispatches/index.js +9 -0
- package/src/matchmaker.js +11 -2
- package/src/pathing/mapnode.js +83 -250
- package/src/socket.js +1 -1
- package/src/types/api.d.ts +2 -16
- package/src/types/bot/GamePlayer.d.ts +25 -21
- package/src/types/bot.d.ts +78 -54
- package/src/types/constants/guns.d.ts +240 -0
- package/src/types/constants/index.d.ts +100 -0
- package/src/types/constants/items.d.ts +21 -0
- package/src/types/constants/maps.d.ts +15 -0
- package/src/types/dispatches/GoToAmmoDispatch.d.ts +8 -0
- package/src/types/dispatches/GoToCoopDispatch.d.ts +8 -0
- package/src/types/dispatches/GoToGrenadeDispatch.d.ts +8 -0
- package/src/types/dispatches/MovementDispatch.d.ts +2 -0
- package/src/types/dispatches/index.d.ts +45 -1
- package/src/types/matchmaker.d.ts +19 -14
- package/src/types/socket.d.ts +7 -0
- package/src/types/gun.d.ts +0 -131
package/src/constants/maps.js
CHANGED
|
@@ -10,7 +10,7 @@ export const Maps = [
|
|
|
10
10
|
"Spatula": true,
|
|
11
11
|
"King": true
|
|
12
12
|
},
|
|
13
|
-
"availability": "
|
|
13
|
+
"availability": "private",
|
|
14
14
|
"numPlayers": "18"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
@@ -88,7 +88,7 @@ export const Maps = [
|
|
|
88
88
|
"Spatula": true,
|
|
89
89
|
"King": true
|
|
90
90
|
},
|
|
91
|
-
"availability": "
|
|
91
|
+
"availability": "both",
|
|
92
92
|
"numPlayers": "14"
|
|
93
93
|
},
|
|
94
94
|
{
|
|
@@ -127,7 +127,7 @@ export const Maps = [
|
|
|
127
127
|
"Spatula": true,
|
|
128
128
|
"King": true
|
|
129
129
|
},
|
|
130
|
-
"availability": "
|
|
130
|
+
"availability": "both",
|
|
131
131
|
"numPlayers": "18"
|
|
132
132
|
},
|
|
133
133
|
{
|
|
@@ -322,7 +322,7 @@ export const Maps = [
|
|
|
322
322
|
"Spatula": true,
|
|
323
323
|
"King": true
|
|
324
324
|
},
|
|
325
|
-
"availability": "
|
|
325
|
+
"availability": "private",
|
|
326
326
|
"numPlayers": "16"
|
|
327
327
|
},
|
|
328
328
|
{
|
|
@@ -387,7 +387,20 @@ export const Maps = [
|
|
|
387
387
|
"Spatula": true,
|
|
388
388
|
"King": true
|
|
389
389
|
},
|
|
390
|
-
"availability": "
|
|
390
|
+
"availability": "both",
|
|
391
|
+
"numPlayers": "18"
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
"filename": "foundation",
|
|
395
|
+
"hash": "11y636vc64b",
|
|
396
|
+
"name": "Foundation",
|
|
397
|
+
"modes": {
|
|
398
|
+
"FFA": true,
|
|
399
|
+
"Teams": true,
|
|
400
|
+
"Spatula": true,
|
|
401
|
+
"King": true
|
|
402
|
+
},
|
|
403
|
+
"availability": "both",
|
|
391
404
|
"numPlayers": "18"
|
|
392
405
|
},
|
|
393
406
|
{
|
|
@@ -413,7 +426,7 @@ export const Maps = [
|
|
|
413
426
|
"Spatula": true,
|
|
414
427
|
"King": true
|
|
415
428
|
},
|
|
416
|
-
"availability": "
|
|
429
|
+
"availability": "both",
|
|
417
430
|
"numPlayers": "12"
|
|
418
431
|
},
|
|
419
432
|
{
|
|
@@ -452,7 +465,7 @@ export const Maps = [
|
|
|
452
465
|
"Spatula": true,
|
|
453
466
|
"King": true
|
|
454
467
|
},
|
|
455
|
-
"availability": "
|
|
468
|
+
"availability": "private",
|
|
456
469
|
"numPlayers": "18"
|
|
457
470
|
},
|
|
458
471
|
{
|
|
@@ -517,7 +530,7 @@ export const Maps = [
|
|
|
517
530
|
"Spatula": true,
|
|
518
531
|
"King": true
|
|
519
532
|
},
|
|
520
|
-
"availability": "
|
|
533
|
+
"availability": "private",
|
|
521
534
|
"numPlayers": "18"
|
|
522
535
|
},
|
|
523
536
|
{
|
|
@@ -530,7 +543,7 @@ export const Maps = [
|
|
|
530
543
|
"Spatula": true,
|
|
531
544
|
"King": true
|
|
532
545
|
},
|
|
533
|
-
"availability": "
|
|
546
|
+
"availability": "private",
|
|
534
547
|
"numPlayers": "18"
|
|
535
548
|
},
|
|
536
549
|
{
|
|
@@ -556,9 +569,22 @@ export const Maps = [
|
|
|
556
569
|
"Spatula": true,
|
|
557
570
|
"King": true
|
|
558
571
|
},
|
|
559
|
-
"availability": "
|
|
572
|
+
"availability": "private",
|
|
560
573
|
"numPlayers": "18"
|
|
561
574
|
},
|
|
575
|
+
{
|
|
576
|
+
"filename": "metamorph",
|
|
577
|
+
"hash": "hlpma5zbhi",
|
|
578
|
+
"name": "Metamorph",
|
|
579
|
+
"modes": {
|
|
580
|
+
"FFA": true,
|
|
581
|
+
"Teams": true,
|
|
582
|
+
"Spatula": true,
|
|
583
|
+
"King": false
|
|
584
|
+
},
|
|
585
|
+
"availability": "both",
|
|
586
|
+
"numPlayers": "14"
|
|
587
|
+
},
|
|
562
588
|
{
|
|
563
589
|
"filename": "moonbase",
|
|
564
590
|
"hash": "1yzocf1mex3",
|
|
@@ -595,7 +621,7 @@ export const Maps = [
|
|
|
595
621
|
"Spatula": true,
|
|
596
622
|
"King": true
|
|
597
623
|
},
|
|
598
|
-
"availability": "
|
|
624
|
+
"availability": "private",
|
|
599
625
|
"numPlayers": "18"
|
|
600
626
|
},
|
|
601
627
|
{
|
|
@@ -647,7 +673,7 @@ export const Maps = [
|
|
|
647
673
|
"Spatula": true,
|
|
648
674
|
"King": true
|
|
649
675
|
},
|
|
650
|
-
"availability": "
|
|
676
|
+
"availability": "both",
|
|
651
677
|
"numPlayers": "14"
|
|
652
678
|
},
|
|
653
679
|
{
|
|
@@ -738,7 +764,7 @@ export const Maps = [
|
|
|
738
764
|
"Spatula": true,
|
|
739
765
|
"King": true
|
|
740
766
|
},
|
|
741
|
-
"availability": "
|
|
767
|
+
"availability": "both",
|
|
742
768
|
"numPlayers": "14"
|
|
743
769
|
},
|
|
744
770
|
{
|
|
@@ -790,7 +816,7 @@ export const Maps = [
|
|
|
790
816
|
"Spatula": true,
|
|
791
817
|
"King": true
|
|
792
818
|
},
|
|
793
|
-
"availability": "
|
|
819
|
+
"availability": "both",
|
|
794
820
|
"numPlayers": "16"
|
|
795
821
|
},
|
|
796
822
|
{
|
|
@@ -803,7 +829,7 @@ export const Maps = [
|
|
|
803
829
|
"Spatula": true,
|
|
804
830
|
"King": true
|
|
805
831
|
},
|
|
806
|
-
"availability": "
|
|
832
|
+
"availability": "both",
|
|
807
833
|
"numPlayers": "18"
|
|
808
834
|
},
|
|
809
835
|
{
|
|
@@ -868,7 +894,7 @@ export const Maps = [
|
|
|
868
894
|
"Spatula": true,
|
|
869
895
|
"King": true
|
|
870
896
|
},
|
|
871
|
-
"availability": "
|
|
897
|
+
"availability": "private",
|
|
872
898
|
"numPlayers": "12"
|
|
873
899
|
},
|
|
874
900
|
{
|
|
@@ -920,7 +946,7 @@ export const Maps = [
|
|
|
920
946
|
"Spatula": true,
|
|
921
947
|
"King": true
|
|
922
948
|
},
|
|
923
|
-
"availability": "
|
|
949
|
+
"availability": "private",
|
|
924
950
|
"numPlayers": "18"
|
|
925
951
|
},
|
|
926
952
|
{
|
|
@@ -985,9 +1011,22 @@ export const Maps = [
|
|
|
985
1011
|
"Spatula": true,
|
|
986
1012
|
"King": true
|
|
987
1013
|
},
|
|
988
|
-
"availability": "
|
|
1014
|
+
"availability": "both",
|
|
989
1015
|
"numPlayers": "18"
|
|
990
1016
|
},
|
|
1017
|
+
{
|
|
1018
|
+
"filename": "uncovered",
|
|
1019
|
+
"hash": "bxrd0zdvtn",
|
|
1020
|
+
"name": "Uncovered",
|
|
1021
|
+
"modes": {
|
|
1022
|
+
"FFA": true,
|
|
1023
|
+
"Teams": true,
|
|
1024
|
+
"Spatula": true,
|
|
1025
|
+
"King": false
|
|
1026
|
+
},
|
|
1027
|
+
"availability": "both",
|
|
1028
|
+
"numPlayers": "12"
|
|
1029
|
+
},
|
|
991
1030
|
{
|
|
992
1031
|
"filename": "vert",
|
|
993
1032
|
"hash": "25a9ikled77",
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import AStar from '../pathing/astar.js';
|
|
2
|
+
|
|
3
|
+
export class GoToAmmoDispatch {
|
|
4
|
+
check(bot) {
|
|
5
|
+
return bot.me.playing && bot.game.collectables[0].length && bot.intents.includes(bot.Intents.PATHFINDING);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
execute(bot) {
|
|
9
|
+
this.pather = new AStar(bot.pathing.nodeList);
|
|
10
|
+
|
|
11
|
+
let minDistance = 200;
|
|
12
|
+
let closestAmmo = null;
|
|
13
|
+
|
|
14
|
+
for (const ammo of bot.game.collectables[0]) {
|
|
15
|
+
const dx = ammo.x - bot.me.position.x;
|
|
16
|
+
const dy = ammo.y - bot.me.position.y;
|
|
17
|
+
const dz = ammo.z - bot.me.position.z;
|
|
18
|
+
|
|
19
|
+
const distance = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
20
|
+
|
|
21
|
+
if (distance < minDistance) {
|
|
22
|
+
minDistance = distance;
|
|
23
|
+
closestAmmo = ammo;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const position = Object.entries(bot.me.position).map(entry => Math.floor(entry[1]));
|
|
28
|
+
const targetPos = Object.entries(closestAmmo).map(entry => Math.floor(entry[1]));
|
|
29
|
+
|
|
30
|
+
const myNode = bot.pathing.nodeList.at(...position);
|
|
31
|
+
const targetNode = bot.pathing.nodeList.at(...targetPos);
|
|
32
|
+
|
|
33
|
+
bot.pathing.activePath = this.pather.path(myNode, targetNode);
|
|
34
|
+
|
|
35
|
+
if (!bot.pathing.activePath) return console.error('no path found');
|
|
36
|
+
if (bot.pathing.activePath.length < 2) return console.error('path too short');
|
|
37
|
+
|
|
38
|
+
bot.pathing.followingPath = true;
|
|
39
|
+
bot.pathing.activeNode = bot.pathing.activePath[1];
|
|
40
|
+
bot.pathing.activeNodeIdx = 1;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default GoToAmmoDispatch;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import AStar from '../pathing/astar.js';
|
|
2
|
+
|
|
3
|
+
export class GoToCoopDispatch {
|
|
4
|
+
check(bot) {
|
|
5
|
+
return bot.me.playing && bot.game.zoneNumber && bot.game.activeZone && bot.intents.includes(bot.Intents.PATHFINDING);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
execute(bot) {
|
|
9
|
+
this.pather = new AStar(bot.pathing.nodeList);
|
|
10
|
+
|
|
11
|
+
let minDistance = 200;
|
|
12
|
+
let closestZone = null;
|
|
13
|
+
|
|
14
|
+
for (const zone of bot.game.activeZone) {
|
|
15
|
+
const dx = zone.x - bot.me.position.x;
|
|
16
|
+
const dy = zone.y - bot.me.position.y;
|
|
17
|
+
const dz = zone.z - bot.me.position.z;
|
|
18
|
+
|
|
19
|
+
const distance = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
20
|
+
|
|
21
|
+
if (distance < minDistance) {
|
|
22
|
+
minDistance = distance;
|
|
23
|
+
closestZone = zone;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const position = Object.entries(bot.me.position).map(entry => Math.floor(entry[1]));
|
|
28
|
+
const targetPos = Object.entries(closestZone).map(entry => Math.floor(entry[1]));
|
|
29
|
+
|
|
30
|
+
const myNode = bot.pathing.nodeList.at(...position);
|
|
31
|
+
const targetNode = bot.pathing.nodeList.at(...targetPos);
|
|
32
|
+
|
|
33
|
+
bot.pathing.activePath = this.pather.path(myNode, targetNode);
|
|
34
|
+
|
|
35
|
+
if (!bot.pathing.activePath) return console.error('no path found');
|
|
36
|
+
if (bot.pathing.activePath.length < 2) return console.error('path too short');
|
|
37
|
+
|
|
38
|
+
bot.pathing.followingPath = true;
|
|
39
|
+
bot.pathing.activeNode = bot.pathing.activePath[1];
|
|
40
|
+
bot.pathing.activeNodeIdx = 1;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default GoToCoopDispatch;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import AStar from '../pathing/astar.js';
|
|
2
|
+
|
|
3
|
+
export class GoToGrenadeDispatch {
|
|
4
|
+
check(bot) {
|
|
5
|
+
return bot.me.playing && bot.game.collectables[1].length && bot.intents.includes(bot.Intents.PATHFINDING);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
execute(bot) {
|
|
9
|
+
this.pather = new AStar(bot.pathing.nodeList);
|
|
10
|
+
|
|
11
|
+
let minDistance = 200;
|
|
12
|
+
let closestGrenade = null;
|
|
13
|
+
|
|
14
|
+
for (const grenade of bot.game.collectables[1]) {
|
|
15
|
+
const dx = grenade.x - bot.me.position.x;
|
|
16
|
+
const dy = grenade.y - bot.me.position.y;
|
|
17
|
+
const dz = grenade.z - bot.me.position.z;
|
|
18
|
+
|
|
19
|
+
const distance = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
20
|
+
|
|
21
|
+
if (distance < minDistance) {
|
|
22
|
+
minDistance = distance;
|
|
23
|
+
closestGrenade = grenade;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const position = Object.entries(bot.me.position).map(entry => Math.floor(entry[1]));
|
|
28
|
+
const targetPos = Object.entries(closestGrenade).map(entry => Math.floor(entry[1]));
|
|
29
|
+
|
|
30
|
+
const myNode = bot.pathing.nodeList.at(...position);
|
|
31
|
+
const targetNode = bot.pathing.nodeList.at(...targetPos);
|
|
32
|
+
|
|
33
|
+
bot.pathing.activePath = this.pather.path(myNode, targetNode);
|
|
34
|
+
|
|
35
|
+
if (!bot.pathing.activePath) return console.error('no path found');
|
|
36
|
+
if (bot.pathing.activePath.length < 2) return console.error('path too short');
|
|
37
|
+
|
|
38
|
+
bot.pathing.followingPath = true;
|
|
39
|
+
bot.pathing.activeNode = bot.pathing.activePath[1];
|
|
40
|
+
bot.pathing.activeNodeIdx = 1;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default GoToGrenadeDispatch;
|
|
@@ -6,7 +6,11 @@ export class GoToPlayerDispatch {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
check(bot) {
|
|
9
|
-
return bot.me.playing &&
|
|
9
|
+
return bot.me.playing &&
|
|
10
|
+
this.target &&
|
|
11
|
+
this.target.playing &&
|
|
12
|
+
this.target.position &&
|
|
13
|
+
bot.intents.includes(bot.Intents.PATHFINDING);
|
|
10
14
|
}
|
|
11
15
|
|
|
12
16
|
execute(bot) {
|
|
@@ -2,7 +2,11 @@ import AStar from '../pathing/astar.js';
|
|
|
2
2
|
|
|
3
3
|
export class GoToSpatulaDispatch {
|
|
4
4
|
check(bot) {
|
|
5
|
-
return bot.me.playing &&
|
|
5
|
+
return bot.me.playing &&
|
|
6
|
+
bot.game.spatula &&
|
|
7
|
+
bot.game.spatula.coords &&
|
|
8
|
+
bot.game.spatula.coords.x &&
|
|
9
|
+
bot.intents.includes(bot.Intents.PATHFINDING);
|
|
6
10
|
}
|
|
7
11
|
|
|
8
12
|
execute(bot) {
|
|
@@ -6,7 +6,7 @@ export class MeleeDispatch {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
execute(bot) {
|
|
9
|
-
new packet.MeleePacket().execute(bot.
|
|
9
|
+
new packet.MeleePacket().execute(bot.game.socket);
|
|
10
10
|
bot.usingMelee = true;
|
|
11
11
|
|
|
12
12
|
// gameloop every 33.33 (repeating) ms, 17 ticks, so 566.61 is the closest you get
|
|
@@ -6,9 +6,21 @@ export class ReloadDispatch {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
execute(bot) {
|
|
9
|
-
new packet.ReloadPacket().execute(bot.
|
|
9
|
+
new packet.ReloadPacket().execute(bot.game.socket);
|
|
10
10
|
|
|
11
|
-
bot.
|
|
11
|
+
const playerActiveWeapon = bot.me.weapons[bot.me.activeGun];
|
|
12
|
+
|
|
13
|
+
if (playerActiveWeapon.ammo) {
|
|
14
|
+
const newRounds = Math.min(
|
|
15
|
+
Math.min(playerActiveWeapon.ammo.capacity, playerActiveWeapon.ammo.reload) - playerActiveWeapon.ammo.rounds,
|
|
16
|
+
playerActiveWeapon.ammo.store
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
playerActiveWeapon.ammo.rounds += newRounds;
|
|
20
|
+
playerActiveWeapon.ammo.store -= newRounds;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
bot.emit('playerReload', bot.me, playerActiveWeapon);
|
|
12
24
|
|
|
13
25
|
const activeWeapon = bot.me.weapons[bot.me.activeGun];
|
|
14
26
|
const isLongTime = activeWeapon.ammo.rounds < 1;
|
|
@@ -39,7 +39,7 @@ export class ReportPlayerDispatch {
|
|
|
39
39
|
|
|
40
40
|
if (!target) throw new Error('target player for ReportPlayerDispatch not found')
|
|
41
41
|
|
|
42
|
-
new packet.ReportPacket(target, this.reasonInt).execute(bot.
|
|
42
|
+
new packet.ReportPacket(target, this.reasonInt).execute(bot.game.socket);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -90,43 +90,20 @@ export class SaveLoadoutDispatch {
|
|
|
90
90
|
|
|
91
91
|
saveLoadout.then(() => {
|
|
92
92
|
if (bot.state.joinedGame)
|
|
93
|
-
new packet.ChangeCharacterPacket(this.changes?.classIdx || bot.me.selectedGun).execute(bot.
|
|
93
|
+
new packet.ChangeCharacterPacket(this.changes?.classIdx || bot.me.selectedGun).execute(bot.game.socket);
|
|
94
|
+
|
|
95
|
+
const findCosmetics = this.intents.includes(this.Intents.COSMETIC_DATA);
|
|
94
96
|
|
|
95
97
|
// apply changes to the bot
|
|
96
98
|
Object.entries(this.changes).forEach(([changeKey, changeValue]) => {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
case 'stampId':
|
|
107
|
-
bot.me.character.stamp = findItemById(changeValue);
|
|
108
|
-
break;
|
|
109
|
-
|
|
110
|
-
case 'grenadeId':
|
|
111
|
-
bot.me.character.grenade = findItemById(changeValue);
|
|
112
|
-
break;
|
|
113
|
-
|
|
114
|
-
case 'meleeId':
|
|
115
|
-
bot.me.character.melee = findItemById(changeValue);
|
|
116
|
-
break;
|
|
117
|
-
|
|
118
|
-
case 'colorIdx':
|
|
119
|
-
bot.me.character.eggColor = changeValue;
|
|
120
|
-
break;
|
|
121
|
-
|
|
122
|
-
case 'primaryId':
|
|
123
|
-
bot.me.character.primaryGun = findItemById(changeValue[bot.me.selectedGun]);
|
|
124
|
-
break;
|
|
125
|
-
|
|
126
|
-
case 'secondaryId':
|
|
127
|
-
bot.me.character.secondaryGun = findItemById(changeValue[bot.me.selectedGun]);
|
|
128
|
-
break;
|
|
129
|
-
}
|
|
99
|
+
if (changeKey === 'classIdx') bot.me.selectedGun = changeValue;
|
|
100
|
+
else if (changeKey === 'hatId') bot.me.character.hat = findCosmetics ? findItemById(changeValue) : changeValue;
|
|
101
|
+
else if (changeKey === 'stampId') bot.me.character.stamp = findCosmetics ? findItemById(changeValue) : changeValue;
|
|
102
|
+
else if (changeKey === 'grenadeId') bot.me.character.grenade = findCosmetics ? findItemById(changeValue) : changeValue;
|
|
103
|
+
else if (changeKey === 'meleeId') bot.me.character.melee = findCosmetics ? findItemById(changeValue) : changeValue;
|
|
104
|
+
else if (changeKey === 'colorIdx') bot.me.character.eggColor = changeValue;
|
|
105
|
+
else if (changeKey === 'primaryId') bot.me.character.primaryGun = findItemById(changeValue[bot.me.selectedGun]);
|
|
106
|
+
else if (changeKey === 'secondaryId') bot.me.character.secondaryGun = findCosmetics ? findItemById(changeValue[bot.me.selectedGun]) : changeValue;
|
|
130
107
|
})
|
|
131
108
|
})
|
|
132
109
|
}
|
package/src/dispatches/index.js
CHANGED
|
@@ -2,6 +2,9 @@ import BootPlayerDispatch from './BootPlayerDispatch.js';
|
|
|
2
2
|
import ChatDispatch from './ChatDispatch.js';
|
|
3
3
|
import FireDispatch from './FireDispatch.js';
|
|
4
4
|
import GameOptionsDispatch from './GameOptionsDispatch.js';
|
|
5
|
+
import GoToAmmoDispatch from './GoToAmmoDispatch.js';
|
|
6
|
+
import GoToCoopDispatch from './GoToCoopDispatch.js';
|
|
7
|
+
import GoToGrenadeDispatch from './GoToGrenadeDispatch.js';
|
|
5
8
|
import GoToPlayerDispatch from './GoToPlayerDispatch.js';
|
|
6
9
|
import GoToSpatulaDispatch from './GoToSpatulaDispatch.js';
|
|
7
10
|
import LookAtDispatch from './LookAtDispatch.js';
|
|
@@ -22,6 +25,9 @@ export {
|
|
|
22
25
|
ChatDispatch,
|
|
23
26
|
FireDispatch,
|
|
24
27
|
GameOptionsDispatch,
|
|
28
|
+
GoToAmmoDispatch,
|
|
29
|
+
GoToCoopDispatch,
|
|
30
|
+
GoToGrenadeDispatch,
|
|
25
31
|
GoToPlayerDispatch,
|
|
26
32
|
GoToSpatulaDispatch,
|
|
27
33
|
LookAtDispatch,
|
|
@@ -43,6 +49,9 @@ export default {
|
|
|
43
49
|
ChatDispatch,
|
|
44
50
|
FireDispatch,
|
|
45
51
|
GameOptionsDispatch,
|
|
52
|
+
GoToAmmoDispatch,
|
|
53
|
+
GoToCoopDispatch,
|
|
54
|
+
GoToGrenadeDispatch,
|
|
46
55
|
GoToPlayerDispatch,
|
|
47
56
|
GoToSpatulaDispatch,
|
|
48
57
|
LookAtDispatch,
|
package/src/matchmaker.js
CHANGED
|
@@ -33,8 +33,17 @@ export class Matchmaker {
|
|
|
33
33
|
this.#createSocket(params.instance);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
#createSocket(instance) {
|
|
37
|
-
|
|
36
|
+
async #createSocket(instance) {
|
|
37
|
+
const attempt = async () => {
|
|
38
|
+
try {
|
|
39
|
+
this.ws = new yolkws(`wss://${instance}/matchmaker/`, this.proxy);
|
|
40
|
+
} catch {
|
|
41
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
42
|
+
await attempt();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
await attempt();
|
|
38
47
|
|
|
39
48
|
this.ws.onopen = () => {
|
|
40
49
|
this.connected = true;
|