yolkbot 0.1.2-alpha.6 → 0.1.2-alpha.7

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "yolkbot",
3
3
  "description": "create a shell shockers bot in under 10 lines.",
4
- "version": "0.1.2-alpha.6",
4
+ "version": "0.1.2-alpha.7",
5
5
  "keywords": [
6
6
  "shell shockers",
7
7
  "shellshock.io",
package/src/bot.js CHANGED
@@ -69,8 +69,9 @@ export class Bot {
69
69
 
70
70
  // private information NOT FOR OTHER PLAYERS!!
71
71
  this.state = {
72
- // kept for specifying socket open sequence
72
+ // kept for specifying various params
73
73
  name: '',
74
+ weaponIdx: 0,
74
75
 
75
76
  // tracking for dispatch checks
76
77
  reloading: false,
@@ -1469,7 +1470,7 @@ export class Bot {
1469
1470
  out.packString(this.game.raw.uuid);
1470
1471
 
1471
1472
  out.packInt8(0); // hidebadge
1472
- out.packInt8(0); // weapon idx
1473
+ out.packInt8(this.state.weaponIdx || 0); // weapon idx
1473
1474
 
1474
1475
  out.packInt32(this.account.session);
1475
1476
  out.packString(this.account.firebaseId);
@@ -1496,6 +1497,7 @@ export class Bot {
1496
1497
  this.game.isPrivate = CommIn.unPackInt8U() == 1;
1497
1498
 
1498
1499
  // console.log('Successfully joined game.');
1500
+
1499
1501
  this.state.joinedGame = true;
1500
1502
  this.lastDeathTime = Date.now();
1501
1503
 
@@ -1503,7 +1505,7 @@ export class Bot {
1503
1505
  const out = CommOut.getBuffer();
1504
1506
  out.packInt8(CommCode.clientReady);
1505
1507
  out.send(this.game.socket);
1506
-
1508
+
1507
1509
  this.game.socket.onmessage = (msg) => this._packetQueue.push(msg.data);
1508
1510
  }
1509
1511
 
@@ -70,10 +70,12 @@ export class SaveLoadoutDispatch {
70
70
  }
71
71
 
72
72
  execute(bot) {
73
- if (this.changes.classIdx && this.changes.classIdx !== bot.me.selectedGun) {
73
+ if (bot.me && this.changes.classIdx && this.changes.classIdx !== bot.me.selectedGun) {
74
74
  bot.me.weapons[0] = new GunList[this.changes.classIdx]();
75
75
  }
76
76
 
77
+ bot.state.weaponIdx = this.changes.classIdx || bot.state.weaponIdx;
78
+
77
79
  const loadout = {
78
80
  ...bot.account.loadout,
79
81
  ...this.changes
@@ -89,7 +91,7 @@ export class SaveLoadoutDispatch {
89
91
 
90
92
  bot.account.loadout = loadout;
91
93
 
92
- saveLoadout.then(() => {
94
+ if (bot.me) saveLoadout.then(() => {
93
95
  if (bot.state.joinedGame) {
94
96
  const out = CommOut.getBuffer();
95
97
  out.packInt8(CommCode.changeCharacter);