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/bot.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createAccount, loginAnonymously, loginWithCredentials, loginWithRefreshToken, queryServices } from '
|
|
1
|
+
import { createAccount, loginAnonymously, loginWithCredentials, loginWithRefreshToken, queryServices } from './api.js';
|
|
2
2
|
|
|
3
3
|
import CommIn from './comm/CommIn.js';
|
|
4
4
|
import CommOut from './comm/CommOut.js';
|
|
5
|
-
import { CommCode } from './
|
|
5
|
+
import { CommCode } from './constants/codes.js';
|
|
6
6
|
|
|
7
7
|
import GamePlayer from './bot/GamePlayer.js';
|
|
8
8
|
import Matchmaker from './matchmaker.js';
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
PlayTypes,
|
|
24
24
|
ProxiesEnabled,
|
|
25
25
|
ShellStreaks
|
|
26
|
-
} from '
|
|
26
|
+
} from './constants/index.js';
|
|
27
27
|
|
|
28
28
|
import LookAtPosDispatch from './dispatches/LookAtPosDispatch.js';
|
|
29
29
|
import MovementDispatch from './dispatches/MovementDispatch.js';
|
|
@@ -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 = {
|
|
@@ -199,6 +205,9 @@ export class Bot {
|
|
|
199
205
|
// balance is tracked
|
|
200
206
|
eggBalance: 0,
|
|
201
207
|
|
|
208
|
+
// egg org side
|
|
209
|
+
eggOrgSide: 'none',
|
|
210
|
+
|
|
202
211
|
// raw login
|
|
203
212
|
rawLoginData: {}
|
|
204
213
|
};
|
|
@@ -290,6 +299,7 @@ export class Bot {
|
|
|
290
299
|
|
|
291
300
|
this.account.accountAge = loginData.accountAge;
|
|
292
301
|
this.account.eggBalance = loginData.currentBalance;
|
|
302
|
+
this.account.eggOrgSide = loginData.eggOrgNeedsFaction === 'rew_eggfu' ? 'good' : 'evil';
|
|
293
303
|
this.account.emailVerified = loginData.emailVerified;
|
|
294
304
|
this.account.firebaseId = loginData.firebaseId;
|
|
295
305
|
this.account.id = loginData.id;
|
|
@@ -357,7 +367,7 @@ export class Bot {
|
|
|
357
367
|
this.matchmaker.off('msg', listener);
|
|
358
368
|
|
|
359
369
|
this.game.raw = mes;
|
|
360
|
-
this.game.code =
|
|
370
|
+
this.game.code = mes.id;
|
|
361
371
|
|
|
362
372
|
resolve();
|
|
363
373
|
}
|
|
@@ -435,7 +445,7 @@ export class Bot {
|
|
|
435
445
|
this.game.socket.onmessage = (msg) => this._packetQueue.push(msg.data);
|
|
436
446
|
|
|
437
447
|
if (this.autoUpdate)
|
|
438
|
-
setInterval(() => this.update(), this.updateInterval);
|
|
448
|
+
this.updateIntervalId = setInterval(() => this.update(), this.updateInterval);
|
|
439
449
|
|
|
440
450
|
if (this.intents.includes(this.Intents.PING)) {
|
|
441
451
|
const out = CommOut.getBuffer();
|
|
@@ -542,6 +552,11 @@ export class Bot {
|
|
|
542
552
|
const attempt = async () => {
|
|
543
553
|
try {
|
|
544
554
|
this.game.socket = new yolkws(`wss://${this.game.raw.subdomain}.${this.instance}/game/${this.game.raw.id}`, this.proxy);
|
|
555
|
+
this.game.socket.onerror = async (e) => {
|
|
556
|
+
console.error(e);
|
|
557
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
558
|
+
return await attempt();
|
|
559
|
+
}
|
|
545
560
|
} catch {
|
|
546
561
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
547
562
|
await attempt();
|
|
@@ -553,7 +568,7 @@ export class Bot {
|
|
|
553
568
|
this.game.socket.binaryType = 'arraybuffer';
|
|
554
569
|
|
|
555
570
|
this.game.socket.onopen = () => {
|
|
556
|
-
|
|
571
|
+
this.game.socket.onerror = null;
|
|
557
572
|
}
|
|
558
573
|
|
|
559
574
|
this.game.socket.onmessage = this.#onGameMesssage.bind(this);
|
|
@@ -561,6 +576,7 @@ export class Bot {
|
|
|
561
576
|
this.game.socket.onclose = (e) => {
|
|
562
577
|
// console.log('Game socket closed:', e.code, Object.entries(CloseCode).filter(([, v]) => v == e.code));
|
|
563
578
|
this.emit('close', e.code);
|
|
579
|
+
this.quit(true, true);
|
|
564
580
|
}
|
|
565
581
|
}
|
|
566
582
|
|
|
@@ -624,7 +640,7 @@ export class Bot {
|
|
|
624
640
|
}
|
|
625
641
|
|
|
626
642
|
update() {
|
|
627
|
-
if (!this.state.joinedGame) throw new Error('
|
|
643
|
+
if (!this.state.joinedGame) throw new Error('You cannot call update() if the bot is not in a game.');
|
|
628
644
|
|
|
629
645
|
// process pathfinding
|
|
630
646
|
if (this.pathing.followingPath && this.intents.includes(this.Intents.PATHFINDING)) this.#processPathfinding();
|
|
@@ -724,7 +740,7 @@ export class Bot {
|
|
|
724
740
|
|
|
725
741
|
return data;
|
|
726
742
|
} else {
|
|
727
|
-
const data = await (await fetch(`https
|
|
743
|
+
const data = await (await fetch(`https://esm.sh/gh/yolkorg/maps/maps/${name}.json`)).json();
|
|
728
744
|
return data;
|
|
729
745
|
}
|
|
730
746
|
}
|
|
@@ -799,25 +815,21 @@ export class Bot {
|
|
|
799
815
|
|
|
800
816
|
#processAddPlayerPacket() {
|
|
801
817
|
const id_ = CommIn.unPackInt8U();
|
|
802
|
-
const uniqueId = CommIn.unPackString();
|
|
803
|
-
const name = CommIn.unPackString();
|
|
804
|
-
const safename = CommIn.unPackString(); // ??? (a)
|
|
805
|
-
const charClass = CommIn.unPackInt8U();
|
|
806
818
|
const findCosmetics = this.intents.includes(this.Intents.COSMETIC_DATA);
|
|
807
819
|
const playerData = {
|
|
808
820
|
id_: id_,
|
|
809
|
-
uniqueId_:
|
|
810
|
-
name_:
|
|
811
|
-
safename_:
|
|
812
|
-
charClass_:
|
|
821
|
+
uniqueId_: CommIn.unPackString(),
|
|
822
|
+
name_: CommIn.unPackString(),
|
|
823
|
+
safename_: CommIn.unPackString(),
|
|
824
|
+
charClass_: CommIn.unPackInt8U(),
|
|
813
825
|
team_: CommIn.unPackInt8U(),
|
|
814
|
-
primaryWeaponItem_: findItemById(CommIn.unPackInt16U()),
|
|
826
|
+
primaryWeaponItem_: findCosmetics ? findItemById(CommIn.unPackInt16U()) : CommIn.unPackInt16U(),
|
|
815
827
|
secondaryWeaponItem_: findCosmetics ? findItemById(CommIn.unPackInt16U()) : CommIn.unPackInt16U(),
|
|
816
828
|
shellColor_: CommIn.unPackInt8U(),
|
|
817
829
|
hatItem_: findCosmetics ? findItemById(CommIn.unPackInt16U()) : CommIn.unPackInt16U(),
|
|
818
830
|
stampItem_: findCosmetics ? findItemById(CommIn.unPackInt16U()) : CommIn.unPackInt16U(),
|
|
819
|
-
|
|
820
|
-
|
|
831
|
+
_unused: CommIn.unPackInt8(),
|
|
832
|
+
_unused2: CommIn.unPackInt8(),
|
|
821
833
|
grenadeItem_: findCosmetics ? findItemById(CommIn.unPackInt16U()) : CommIn.unPackInt16U(),
|
|
822
834
|
meleeItem_: findCosmetics ? findItemById(CommIn.unPackInt16U()) : CommIn.unPackInt16U(),
|
|
823
835
|
x_: CommIn.unPackFloat(),
|
|
@@ -829,6 +841,7 @@ export class Bot {
|
|
|
829
841
|
yaw_: CommIn.unPackRadU(),
|
|
830
842
|
pitch_: CommIn.unPackRad(),
|
|
831
843
|
score_: CommIn.unPackInt32U(),
|
|
844
|
+
// the following are all stats
|
|
832
845
|
kills_: CommIn.unPackInt16U(),
|
|
833
846
|
deaths_: CommIn.unPackInt16U(),
|
|
834
847
|
streak_: CommIn.unPackInt16U(),
|
|
@@ -836,6 +849,7 @@ export class Bot {
|
|
|
836
849
|
totalDeaths_: CommIn.unPackInt32U(),
|
|
837
850
|
bestGameStreak_: CommIn.unPackInt16U(),
|
|
838
851
|
bestOverallStreak_: CommIn.unPackInt16U(),
|
|
852
|
+
// end stats
|
|
839
853
|
shield_: CommIn.unPackInt8U(),
|
|
840
854
|
hp_: CommIn.unPackInt8U(),
|
|
841
855
|
playing_: CommIn.unPackInt8U(),
|
|
@@ -979,15 +993,15 @@ export class Bot {
|
|
|
979
993
|
|
|
980
994
|
if (killed) {
|
|
981
995
|
killed.playing = false;
|
|
982
|
-
killed.
|
|
996
|
+
killed.streak = 0;
|
|
983
997
|
killed.lastDeathTime = Date.now();
|
|
984
|
-
|
|
998
|
+
killed.hp = 100;
|
|
999
|
+
killed.hpShield = 0;
|
|
985
1000
|
}
|
|
986
1001
|
|
|
987
|
-
if (killer)
|
|
988
|
-
// console.log(`Player ${killer.name} is on a streak of ${killer.kills} kills.`);
|
|
1002
|
+
if (killer) killer.streak++;
|
|
989
1003
|
|
|
990
|
-
this.emit('playerDeath', killed, killer);
|
|
1004
|
+
this.emit('playerDeath', killed, killer);
|
|
991
1005
|
}
|
|
992
1006
|
|
|
993
1007
|
#processFirePacket() {
|
|
@@ -1200,7 +1214,7 @@ export class Bot {
|
|
|
1200
1214
|
}
|
|
1201
1215
|
|
|
1202
1216
|
// secondary, always cluck9mm
|
|
1203
|
-
if (player.weapons[1] && player.weapons[
|
|
1217
|
+
if (player.weapons[1] && player.weapons[1].ammo) {
|
|
1204
1218
|
player.weapons[1].ammo.rounds = player.weapons[1].ammo.capacity;
|
|
1205
1219
|
player.weapons[1].ammo.store = player.weapons[1].ammo.storeMax;
|
|
1206
1220
|
}
|
|
@@ -1302,7 +1316,7 @@ export class Bot {
|
|
|
1302
1316
|
if (action == GameActions.reset) {
|
|
1303
1317
|
// console.log('owner reset game');
|
|
1304
1318
|
|
|
1305
|
-
this.
|
|
1319
|
+
Object.values(this.players).forEach((player) => player.streak = 0);
|
|
1306
1320
|
|
|
1307
1321
|
if (this.game.gameModeId !== GameModes.ffa) this.game.teamScore = [0, 0, 0];
|
|
1308
1322
|
|
|
@@ -1354,7 +1368,7 @@ export class Bot {
|
|
|
1354
1368
|
const oldTeam = player.team;
|
|
1355
1369
|
|
|
1356
1370
|
player.team = toTeam;
|
|
1357
|
-
player.
|
|
1371
|
+
player.streak = 0;
|
|
1358
1372
|
|
|
1359
1373
|
this.emit('playerSwitchTeam', player, oldTeam, toTeam);
|
|
1360
1374
|
}
|
|
@@ -1376,8 +1390,7 @@ export class Bot {
|
|
|
1376
1390
|
|
|
1377
1391
|
const findCosmetics = this.intents.includes(this.Intents.COSMETIC_DATA);
|
|
1378
1392
|
|
|
1379
|
-
const primaryWeaponItem = findItemById(primaryWeaponIdx);
|
|
1380
|
-
|
|
1393
|
+
const primaryWeaponItem = findCosmetics ? findItemById(primaryWeaponIdx) : primaryWeaponIdx;
|
|
1381
1394
|
const secondaryWeaponItem = findCosmetics ? findItemById(secondaryWeaponIdx) : secondaryWeaponIdx;
|
|
1382
1395
|
const hatItem = findCosmetics ? findItemById(hatIdx) : hatIdx;
|
|
1383
1396
|
const stampItem = findCosmetics ? findItemById(stampIdx) : stampIdx;
|
|
@@ -1514,6 +1527,26 @@ export class Bot {
|
|
|
1514
1527
|
if (player.id == this.me.id) this.refreshChallenges();
|
|
1515
1528
|
}
|
|
1516
1529
|
|
|
1530
|
+
// egg org
|
|
1531
|
+
#processClientReadyPacket() {
|
|
1532
|
+
this.#processEggOrgUpdatePacket();
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
// egg org
|
|
1536
|
+
#processEggOrgUpdatePacket() {
|
|
1537
|
+
const str = CommIn.unPackString();
|
|
1538
|
+
|
|
1539
|
+
try {
|
|
1540
|
+
const eggOrgStats = JSON.parse(str);
|
|
1541
|
+
this.game.eggOrg.evil = eggOrgStats[0];
|
|
1542
|
+
this.game.eggOrg.good = eggOrgStats[1];
|
|
1543
|
+
|
|
1544
|
+
this.emit('eggOrgUpdate', this.game.eggOrg);
|
|
1545
|
+
} catch {
|
|
1546
|
+
// hopefully never =D
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1517
1550
|
#handlePacket(packet) {
|
|
1518
1551
|
CommIn.init(packet);
|
|
1519
1552
|
|
|
@@ -1521,6 +1554,7 @@ export class Bot {
|
|
|
1521
1554
|
this.emit('packet', packet);
|
|
1522
1555
|
|
|
1523
1556
|
let lastCommand = 0;
|
|
1557
|
+
let lastCode = 0;
|
|
1524
1558
|
let abort = false;
|
|
1525
1559
|
|
|
1526
1560
|
while (CommIn.isMoreDataAvailable() && !abort) {
|
|
@@ -1627,6 +1661,11 @@ export class Bot {
|
|
|
1627
1661
|
this.#processThrowGrenadePacket();
|
|
1628
1662
|
break;
|
|
1629
1663
|
|
|
1664
|
+
// egg org
|
|
1665
|
+
case CommCode.eggOrgUpdate:
|
|
1666
|
+
this.#processEggOrgUpdatePacket();
|
|
1667
|
+
break;
|
|
1668
|
+
|
|
1630
1669
|
case CommCode.spawnItem:
|
|
1631
1670
|
this.#processSpawnItemPacket();
|
|
1632
1671
|
break;
|
|
@@ -1655,9 +1694,13 @@ export class Bot {
|
|
|
1655
1694
|
this.#processRespawnDeniedPacket();
|
|
1656
1695
|
break;
|
|
1657
1696
|
|
|
1697
|
+
// egg org
|
|
1698
|
+
case CommCode.clientReady:
|
|
1699
|
+
this.#processClientReadyPacket();
|
|
1700
|
+
break;
|
|
1701
|
+
|
|
1658
1702
|
// we do not plan to implement these
|
|
1659
1703
|
// for more info, see comm/codes.js
|
|
1660
|
-
case CommCode.clientReady:
|
|
1661
1704
|
case CommCode.expireUpgrade:
|
|
1662
1705
|
break;
|
|
1663
1706
|
|
|
@@ -1666,13 +1709,14 @@ export class Bot {
|
|
|
1666
1709
|
break;
|
|
1667
1710
|
|
|
1668
1711
|
default:
|
|
1669
|
-
console.error(`handlePacket: I got but did not handle a: ${Object.keys(CommCode).find(k => CommCode[k] === cmd)}`);
|
|
1670
|
-
if (lastCommand) console.error(`handlePacket: It may be a result of the ${lastCommand} command.`);
|
|
1712
|
+
console.error(`handlePacket: I got but did not handle a: ${Object.keys(CommCode).find(k => CommCode[k] === cmd)} ${cmd}`);
|
|
1713
|
+
if (lastCommand) console.error(`handlePacket: It may be a result of the ${lastCommand} command (${lastCode}).`);
|
|
1671
1714
|
abort = true
|
|
1672
1715
|
break;
|
|
1673
1716
|
}
|
|
1674
1717
|
|
|
1675
1718
|
lastCommand = Object.keys(CommCode).find(k => CommCode[k] === cmd);
|
|
1719
|
+
lastCode = cmd;
|
|
1676
1720
|
}
|
|
1677
1721
|
}
|
|
1678
1722
|
|
|
@@ -1683,6 +1727,8 @@ export class Bot {
|
|
|
1683
1727
|
sessionId: this.account.sessionId
|
|
1684
1728
|
});
|
|
1685
1729
|
|
|
1730
|
+
if (typeof response === 'string') return response;
|
|
1731
|
+
|
|
1686
1732
|
this.account.cw.limit = response.limit;
|
|
1687
1733
|
this.account.cw.atLimit = response.limit > 3;
|
|
1688
1734
|
|
|
@@ -1706,6 +1752,8 @@ export class Bot {
|
|
|
1706
1752
|
token: null
|
|
1707
1753
|
}, this.proxy, this.instance);
|
|
1708
1754
|
|
|
1755
|
+
if (typeof response === 'string') return response;
|
|
1756
|
+
|
|
1709
1757
|
if (response.error) {
|
|
1710
1758
|
if (response.error == 'RATELIMITED') {
|
|
1711
1759
|
await this.checkChiknWinner();
|
|
@@ -1740,6 +1788,8 @@ export class Bot {
|
|
|
1740
1788
|
sessionId: this.account.sessionId
|
|
1741
1789
|
});
|
|
1742
1790
|
|
|
1791
|
+
if (typeof response === 'string') return response;
|
|
1792
|
+
|
|
1743
1793
|
if (response.result !== 'SUCCESS') {
|
|
1744
1794
|
console.error('Unknown Chikn Winner reset response', response);
|
|
1745
1795
|
return 'unknown_error';
|
|
@@ -1756,7 +1806,7 @@ export class Bot {
|
|
|
1756
1806
|
return this.pathing.nodeList.hasLineOfSight(this.me.position, target.position);
|
|
1757
1807
|
}
|
|
1758
1808
|
|
|
1759
|
-
getBestTarget() {
|
|
1809
|
+
getBestTarget(customFilter = () => true) {
|
|
1760
1810
|
const options = Object.values(this.players)
|
|
1761
1811
|
.filter((player) => player)
|
|
1762
1812
|
.filter((player) => player !== this.me)
|
|
@@ -1764,7 +1814,8 @@ export class Bot {
|
|
|
1764
1814
|
.filter((player) => player.hp > 0)
|
|
1765
1815
|
.filter((player) => player.name !== this.me.name)
|
|
1766
1816
|
.filter((player) => this.me.team === 0 || player.team !== this.me.team)
|
|
1767
|
-
.filter((player) => this.canSee(player))
|
|
1817
|
+
.filter((player) => this.canSee(player))
|
|
1818
|
+
.filter((player) => !!customFilter(player));
|
|
1768
1819
|
|
|
1769
1820
|
let minDistance = 200;
|
|
1770
1821
|
let targetPlayer = null;
|
|
@@ -1867,15 +1918,18 @@ export class Bot {
|
|
|
1867
1918
|
return result;
|
|
1868
1919
|
}
|
|
1869
1920
|
|
|
1870
|
-
quit(noCleanup = false) {
|
|
1921
|
+
quit(noCleanup = false, finishDispatches = false) {
|
|
1871
1922
|
if (this.intents.includes(this.Intents.PLAYER_HEALTH))
|
|
1872
1923
|
clearInterval(this.healthIntervalId);
|
|
1873
1924
|
|
|
1874
|
-
clearInterval(this.
|
|
1925
|
+
clearInterval(this.updateIntervalId);
|
|
1875
1926
|
|
|
1876
|
-
this.game.socket.close();
|
|
1927
|
+
if (this.game) this.game.socket.close();
|
|
1877
1928
|
this.matchmaker.close();
|
|
1878
1929
|
|
|
1930
|
+
if (!finishDispatches) this._dispatches = [];
|
|
1931
|
+
this._packetQueue = [];
|
|
1932
|
+
|
|
1879
1933
|
if (!noCleanup) {
|
|
1880
1934
|
delete this.account;
|
|
1881
1935
|
delete this.game;
|
package/src/comm/Codes.js
CHANGED
|
@@ -74,76 +74,6 @@ const CommCode = {
|
|
|
74
74
|
|
|
75
75
|
*/
|
|
76
76
|
|
|
77
|
-
const CommCode = {
|
|
78
|
-
swapWeapon: 0,
|
|
79
|
-
joinGame: 0,
|
|
80
|
-
refreshGameState: 0,
|
|
81
|
-
spawnItem: 0,
|
|
82
|
-
observeGame: 0,
|
|
83
|
-
ping: 0,
|
|
84
|
-
bootPlayer: 0,
|
|
85
|
-
banPlayer: 0,
|
|
86
|
-
loginRequired: 0,
|
|
87
|
-
gameLocked: 0,
|
|
88
|
-
reportPlayer: 0,
|
|
89
|
-
banned: 0,
|
|
90
|
-
createPrivateGame: 0,
|
|
91
|
-
switchTeam: 0,
|
|
92
|
-
changeCharacter: 0,
|
|
93
|
-
pause: 0,
|
|
94
|
-
gameOptions: 0,
|
|
95
|
-
gameAction: 0,
|
|
96
|
-
requestGameOptions: 0,
|
|
97
|
-
gameJoined: 0,
|
|
98
|
-
socketReady: 0,
|
|
99
|
-
addPlayer: 0,
|
|
100
|
-
removePlayer: 0,
|
|
101
|
-
fire: 0,
|
|
102
|
-
melee: 0,
|
|
103
|
-
throwGrenade: 0,
|
|
104
|
-
info: 0,
|
|
105
|
-
eventModifier: 0,
|
|
106
|
-
hitThem: 0,
|
|
107
|
-
hitMe: 0,
|
|
108
|
-
collectItem: 0,
|
|
109
|
-
chlgPlayerRerollInGame: 0,
|
|
110
|
-
playerInGameReward: 0,
|
|
111
|
-
playerRewards: 0,
|
|
112
|
-
chat: 0,
|
|
113
|
-
syncThem: 0,
|
|
114
|
-
syncAmmo: 0,
|
|
115
|
-
die: 0,
|
|
116
|
-
beginShellStreak: 0,
|
|
117
|
-
endShellStreak: 0,
|
|
118
|
-
startReload: 0,
|
|
119
|
-
announcement: 0,
|
|
120
|
-
updateBalance: 0,
|
|
121
|
-
reload: 0,
|
|
122
|
-
respawn: 0,
|
|
123
|
-
respawnDenied: 0,
|
|
124
|
-
pong: 0,
|
|
125
|
-
clientReady: 0,
|
|
126
|
-
requestRespawn: 0,
|
|
127
|
-
joinPublicGame: 0,
|
|
128
|
-
joinPrivateGame: 0,
|
|
129
|
-
switchTeamFail: 0,
|
|
130
|
-
expireUpgrade: 0,
|
|
131
|
-
metaGameState: 0,
|
|
132
|
-
syncMe: 0,
|
|
133
|
-
explode: 0,
|
|
134
|
-
keepAlive: 0,
|
|
135
|
-
musicInfo: 0,
|
|
136
|
-
hitMeHardBoiled: 0,
|
|
137
|
-
playerInfo: 0,
|
|
138
|
-
challengeCompleted: 0
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
let ih = 1;
|
|
142
|
-
|
|
143
|
-
Object.keys(CommCode).forEach(e => {
|
|
144
|
-
CommCode[e] = ih++;
|
|
145
|
-
});
|
|
146
|
-
|
|
147
77
|
const CloseCode = {
|
|
148
78
|
gameNotFound: 4000,
|
|
149
79
|
gameFull: 4001,
|
|
@@ -166,7 +96,4 @@ const CloseCode = {
|
|
|
166
96
|
locked: 4023
|
|
167
97
|
}
|
|
168
98
|
|
|
169
|
-
export {
|
|
170
|
-
CommCode,
|
|
171
|
-
CloseCode
|
|
172
|
-
}
|
|
99
|
+
export { CloseCode }
|
package/src/comm/index.js
CHANGED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
export const CommCode = {
|
|
3
|
+
"swapWeapon": 0,
|
|
4
|
+
"joinGame": 1,
|
|
5
|
+
"spawnItem": 3,
|
|
6
|
+
"ping": 5,
|
|
7
|
+
"bootPlayer": 6,
|
|
8
|
+
"reportPlayer": 10,
|
|
9
|
+
"switchTeam": 13,
|
|
10
|
+
"changeCharacter": 14,
|
|
11
|
+
"pause": 15,
|
|
12
|
+
"gameOptions": 16,
|
|
13
|
+
"gameAction": 17,
|
|
14
|
+
"requestGameOptions": 18,
|
|
15
|
+
"gameJoined": 19,
|
|
16
|
+
"socketReady": 20,
|
|
17
|
+
"addPlayer": 21,
|
|
18
|
+
"removePlayer": 22,
|
|
19
|
+
"fire": 23,
|
|
20
|
+
"melee": 24,
|
|
21
|
+
"throwGrenade": 25,
|
|
22
|
+
"eventModifier": 27,
|
|
23
|
+
"hitThem": 28,
|
|
24
|
+
"hitMe": 29,
|
|
25
|
+
"collectItem": 30,
|
|
26
|
+
"chat": 34,
|
|
27
|
+
"syncThem": 35,
|
|
28
|
+
"die": 37,
|
|
29
|
+
"beginShellStreak": 38,
|
|
30
|
+
"endShellStreak": 39,
|
|
31
|
+
"updateBalance": 42,
|
|
32
|
+
"reload": 43,
|
|
33
|
+
"respawn": 44,
|
|
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
|
|
45
|
+
};
|
package/src/constants/guns.js
CHANGED
|
@@ -38,7 +38,9 @@ const Eggk47 = class _Eggk47 extends Gun {
|
|
|
38
38
|
this.shortReloadTime = 160;
|
|
39
39
|
|
|
40
40
|
this.weaponName = 'EggK-47';
|
|
41
|
+
this.internalName = 'Eggk47';
|
|
41
42
|
this.standardMeshName = 'eggk47';
|
|
43
|
+
|
|
42
44
|
this.rof = 3;
|
|
43
45
|
this.recoil = 7;
|
|
44
46
|
this.automatic = true;
|
|
@@ -67,8 +69,10 @@ const DozenGauge = class _DozenGauge extends Gun {
|
|
|
67
69
|
this.longReloadTime = 155;
|
|
68
70
|
this.shortReloadTime = 155;
|
|
69
71
|
|
|
70
|
-
this.weaponName = '
|
|
72
|
+
this.weaponName = 'Scrambler';
|
|
73
|
+
this.internalName = 'Dozen Gauge';
|
|
71
74
|
this.standardMeshName = 'dozenGauge';
|
|
75
|
+
|
|
72
76
|
this.rof = 8;
|
|
73
77
|
this.recoil = 10;
|
|
74
78
|
this.automatic = false;
|
|
@@ -121,8 +125,10 @@ const CSG1 = class _CSG1 extends Gun {
|
|
|
121
125
|
this.shortReloadTime = 165;
|
|
122
126
|
this.highPrecision = true;
|
|
123
127
|
|
|
124
|
-
this.weaponName = '
|
|
128
|
+
this.weaponName = 'Free Ranger';
|
|
129
|
+
this.internalName = 'CSG-1';
|
|
125
130
|
this.standardMeshName = 'csg1';
|
|
131
|
+
|
|
126
132
|
this.rof = 13;
|
|
127
133
|
this.recoil = 13;
|
|
128
134
|
this.automatic = false;
|
|
@@ -159,7 +165,9 @@ const Cluck9mm = class _Cluck9mm extends Gun {
|
|
|
159
165
|
this.shortReloadTime = 160;
|
|
160
166
|
|
|
161
167
|
this.weaponName = 'Cluck 9mm';
|
|
168
|
+
this.internalName = 'Cluck 9mm';
|
|
162
169
|
this.standardMeshName = 'cluck9mm';
|
|
170
|
+
|
|
163
171
|
this.rof = 4;
|
|
164
172
|
this.recoil = 6;
|
|
165
173
|
this.automatic = false;
|
|
@@ -199,7 +207,9 @@ const RPEGG = class _RPEGG extends Gun {
|
|
|
199
207
|
this.shortReloadTime = 170;
|
|
200
208
|
|
|
201
209
|
this.weaponName = 'RPEGG';
|
|
210
|
+
this.internalName = 'Eggsploder';
|
|
202
211
|
this.standardMeshName = 'rpegg';
|
|
212
|
+
|
|
203
213
|
this.rof = 40;
|
|
204
214
|
this.recoil = 60;
|
|
205
215
|
this.automatic = false;
|
|
@@ -236,7 +246,9 @@ const SMG = class _SMG extends Gun {
|
|
|
236
246
|
this.shortReloadTime = 190;
|
|
237
247
|
|
|
238
248
|
this.weaponName = 'Whipper';
|
|
249
|
+
this.internalName = 'SMEGG';
|
|
239
250
|
this.standardMeshName = 'smg';
|
|
251
|
+
|
|
240
252
|
this.rof = 10;
|
|
241
253
|
this.recoil = 7;
|
|
242
254
|
this.automatic = true;
|
|
@@ -276,7 +288,9 @@ const M24 = class _M24 extends Gun {
|
|
|
276
288
|
this.shortReloadTime = 144;
|
|
277
289
|
|
|
278
290
|
this.weaponName = 'Crackshot';
|
|
291
|
+
this.internalName = 'M2DZ';
|
|
279
292
|
this.standardMeshName = 'm24';
|
|
293
|
+
|
|
280
294
|
this.rof = 60;
|
|
281
295
|
this.recoil = 40;
|
|
282
296
|
this.automatic = false;
|
|
@@ -316,7 +330,9 @@ const AUG = class _AUG extends Gun {
|
|
|
316
330
|
this.shortReloadTime = 160;
|
|
317
331
|
|
|
318
332
|
this.weaponName = 'Tri-Hard';
|
|
333
|
+
this.internalName = 'AUG';
|
|
319
334
|
this.standardMeshName = 'aug';
|
|
335
|
+
|
|
320
336
|
this.rof = 15;
|
|
321
337
|
this.recoil = 18;
|
|
322
338
|
this.automatic = false;
|
package/src/constants/index.js
CHANGED
|
@@ -82,6 +82,16 @@ export const ShellStreaks = {
|
|
|
82
82
|
MiniEgg: 32
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
export const SocialMedias = {
|
|
86
|
+
0: 'Facebook',
|
|
87
|
+
1: 'Instagram',
|
|
88
|
+
2: 'Tiktok',
|
|
89
|
+
3: 'Discord',
|
|
90
|
+
4: 'Youtube',
|
|
91
|
+
5: 'Twitter',
|
|
92
|
+
6: 'Twitch'
|
|
93
|
+
}
|
|
94
|
+
|
|
85
95
|
export const SocialRewards = {
|
|
86
96
|
Discord: 'rew_1200',
|
|
87
97
|
Tiktok: 'rew_1208',
|
|
@@ -107,5 +117,5 @@ export const URLRewards = [
|
|
|
107
117
|
'WelcomeBack'
|
|
108
118
|
]
|
|
109
119
|
|
|
110
|
-
export const UserAgent =
|
|
120
|
+
export const UserAgent = IsBrowser ? undefined :
|
|
111
121
|
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36'
|