yolkbot 0.1.1-alpha.33 → 0.1.1-alpha.35
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/browser/build/global.js +1 -1
- package/browser/build/module.js +1 -1
- package/package.json +1 -1
- package/src/bot.js +37 -2
- package/src/constants/codes.js +31 -26
package/package.json
CHANGED
package/src/bot.js
CHANGED
|
@@ -149,7 +149,13 @@ export class Bot {
|
|
|
149
149
|
captureProgress: 0,
|
|
150
150
|
numCapturing: 0,
|
|
151
151
|
stageName: '',
|
|
152
|
-
capturePercent: 0.0
|
|
152
|
+
capturePercent: 0.0,
|
|
153
|
+
|
|
154
|
+
// egg org
|
|
155
|
+
eggOrg: {
|
|
156
|
+
evil: 0,
|
|
157
|
+
good: 0
|
|
158
|
+
}
|
|
153
159
|
}
|
|
154
160
|
|
|
155
161
|
this.account = {
|
|
@@ -1512,6 +1518,26 @@ export class Bot {
|
|
|
1512
1518
|
if (player.id == this.me.id) this.refreshChallenges();
|
|
1513
1519
|
}
|
|
1514
1520
|
|
|
1521
|
+
// egg org
|
|
1522
|
+
#processClientReadyPacket() {
|
|
1523
|
+
this.#processEggOrgUpdatePacket();
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
// egg org
|
|
1527
|
+
#processEggOrgUpdatePacket() {
|
|
1528
|
+
const str = CommIn.unPackString();
|
|
1529
|
+
|
|
1530
|
+
try {
|
|
1531
|
+
const eggOrgStats = JSON.parse(str);
|
|
1532
|
+
this.game.eggOrg.evil = eggOrgStats[0];
|
|
1533
|
+
this.game.eggOrg.good = eggOrgStats[1];
|
|
1534
|
+
|
|
1535
|
+
this.emit('eggOrgUpdate', this.game.eggOrg);
|
|
1536
|
+
} catch {
|
|
1537
|
+
// hopefully never =D
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1515
1541
|
#handlePacket(packet) {
|
|
1516
1542
|
CommIn.init(packet);
|
|
1517
1543
|
|
|
@@ -1626,6 +1652,11 @@ export class Bot {
|
|
|
1626
1652
|
this.#processThrowGrenadePacket();
|
|
1627
1653
|
break;
|
|
1628
1654
|
|
|
1655
|
+
// egg org
|
|
1656
|
+
case CommCode.eggOrgUpdate:
|
|
1657
|
+
this.#processEggOrgUpdatePacket();
|
|
1658
|
+
break;
|
|
1659
|
+
|
|
1629
1660
|
case CommCode.spawnItem:
|
|
1630
1661
|
this.#processSpawnItemPacket();
|
|
1631
1662
|
break;
|
|
@@ -1654,9 +1685,13 @@ export class Bot {
|
|
|
1654
1685
|
this.#processRespawnDeniedPacket();
|
|
1655
1686
|
break;
|
|
1656
1687
|
|
|
1688
|
+
// egg org
|
|
1689
|
+
case CommCode.clientReady:
|
|
1690
|
+
this.#processClientReadyPacket();
|
|
1691
|
+
break;
|
|
1692
|
+
|
|
1657
1693
|
// we do not plan to implement these
|
|
1658
1694
|
// for more info, see comm/codes.js
|
|
1659
|
-
case CommCode.clientReady:
|
|
1660
1695
|
case CommCode.expireUpgrade:
|
|
1661
1696
|
break;
|
|
1662
1697
|
|
package/src/constants/codes.js
CHANGED
|
@@ -1,40 +1,45 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
export const CommCode = {
|
|
3
|
-
"syncMe": 54,
|
|
4
3
|
"swapWeapon": 0,
|
|
4
|
+
"joinGame": 1,
|
|
5
|
+
"spawnItem": 3,
|
|
6
|
+
"ping": 5,
|
|
7
|
+
"bootPlayer": 6,
|
|
8
|
+
"reportPlayer": 10,
|
|
9
|
+
"switchTeam": 13,
|
|
10
|
+
"changeCharacter": 14,
|
|
5
11
|
"pause": 15,
|
|
6
|
-
"eventModifier": 27,
|
|
7
12
|
"gameOptions": 16,
|
|
8
|
-
"reload": 43,
|
|
9
|
-
"changeCharacter": 14,
|
|
10
|
-
"melee": 24,
|
|
11
|
-
"updateBalance": 42,
|
|
12
13
|
"gameAction": 17,
|
|
13
14
|
"requestGameOptions": 18,
|
|
14
|
-
"musicInfo": 57,
|
|
15
|
-
"challengeCompleted": 60,
|
|
16
|
-
"throwGrenade": 25,
|
|
17
|
-
"switchTeam": 13,
|
|
18
|
-
"ping": 5,
|
|
19
|
-
"endShellStreak": 39,
|
|
20
|
-
"metaGameState": 53,
|
|
21
|
-
"die": 37,
|
|
22
|
-
"socketReady": 20,
|
|
23
|
-
"joinGame": 1,
|
|
24
15
|
"gameJoined": 19,
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
16
|
+
"socketReady": 20,
|
|
17
|
+
"addPlayer": 21,
|
|
18
|
+
"removePlayer": 22,
|
|
19
|
+
"fire": 23,
|
|
20
|
+
"melee": 24,
|
|
21
|
+
"throwGrenade": 25,
|
|
22
|
+
"eventModifier": 27,
|
|
28
23
|
"hitThem": 28,
|
|
29
|
-
"spawnItem": 3,
|
|
30
|
-
"collectItem": 30,
|
|
31
|
-
"beginShellStreak": 38,
|
|
32
24
|
"hitMe": 29,
|
|
33
|
-
"
|
|
25
|
+
"collectItem": 30,
|
|
34
26
|
"chat": 34,
|
|
35
|
-
"removePlayer": 22,
|
|
36
|
-
"respawnDenied": 45,
|
|
37
27
|
"syncThem": 35,
|
|
28
|
+
"die": 37,
|
|
29
|
+
"beginShellStreak": 38,
|
|
30
|
+
"endShellStreak": 39,
|
|
31
|
+
"updateBalance": 42,
|
|
32
|
+
"reload": 43,
|
|
38
33
|
"respawn": 44,
|
|
39
|
-
"
|
|
34
|
+
"respawnDenied": 45,
|
|
35
|
+
"clientReady": 47,
|
|
36
|
+
"requestRespawn": 48,
|
|
37
|
+
"metaGameState": 53,
|
|
38
|
+
"syncMe": 54,
|
|
39
|
+
"explode": 55,
|
|
40
|
+
"keepAlive": 56,
|
|
41
|
+
"musicInfo": 57,
|
|
42
|
+
"hitMeHardBoiled": 58,
|
|
43
|
+
"challengeCompleted": 60,
|
|
44
|
+
"eggOrgUpdate": 61
|
|
40
45
|
};
|