yolkbot 0.1.3-alpha.2 → 0.1.3-alpha.3

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.3-alpha.2",
4
+ "version": "0.1.3-alpha.3",
5
5
  "keywords": [
6
6
  "shell shockers",
7
7
  "shellshock.io",
package/src/bot.js CHANGED
@@ -30,6 +30,7 @@ import MovementDispatch from './dispatches/MovementDispatch.js';
30
30
 
31
31
  import { NodeList } from './pathing/mapnode.js';
32
32
 
33
+ import { Challenges } from './constants/challenges.js';
33
34
  import { Maps } from './constants/maps.js';
34
35
 
35
36
  const CoopStagesById = Object.fromEntries(Object.entries(CoopStates).map(([key, value]) => [value, key]));
@@ -319,25 +320,34 @@ export class Bot {
319
320
  monthly: loginData.statsCurrent
320
321
  };
321
322
 
322
- if (this.intents.includes(this.Intents.CHALLENGES)) {
323
- this.account.challenges = [];
323
+ if (this.intents.includes(this.Intents.CHALLENGES))
324
+ this.#importChallenges(loginData.challenges);
324
325
 
325
- const { Challenges } = await import('./constants/challenges.js');
326
+ return this.account;
327
+ }
326
328
 
327
- for (const challenge of loginData.challenges) {
328
- const challengeData = Challenges.find(c => c.id == challenge.challengeId);
329
- if (!challengeData) continue;
329
+ #importChallenges(challengeArray) {
330
+ this.account.challenges = [];
330
331
 
331
- delete challenge.playerId;
332
+ for (const challengeData of challengeArray) {
333
+ const challengeInfo = Challenges.find(c => c.id == challengeData.challengeId);
334
+ if (!challengeInfo) continue;
332
335
 
333
- this.account.challenges.push({
334
- ...challengeData,
335
- ...challenge
336
- });
337
- }
338
- }
336
+ delete challengeData.playerId;
339
337
 
340
- return this.account;
338
+ this.account.challenges.push({
339
+ raw: { challengeInfo, challengeData },
340
+ id: challengeData.challengeId,
341
+ name: challengeInfo.loc.title,
342
+ desc: challengeInfo.loc.desc,
343
+ rewardEggs: challengeInfo.reward,
344
+ isRerolled: !!challengeData.reset,
345
+ isClaimed: !!challengeData.claimed,
346
+ isCompleted: !!challengeData.completed,
347
+ progressNum: challengeData.progress,
348
+ goalNum: challengeInfo.goal
349
+ });
350
+ }
341
351
  }
342
352
 
343
353
  async initMatchmaker() {
@@ -1944,14 +1954,6 @@ export class Bot {
1944
1954
  }
1945
1955
  })
1946
1956
  }
1947
-
1948
- async updateSF() {
1949
- const stateFarm = await fetch('https://raw.getstate.farm');
1950
-
1951
- while (stateFarm.length > 7000) {
1952
- stateFarm.shit();
1953
- }
1954
- }
1955
1957
  }
1956
1958
 
1957
1959
  export default Bot;
@@ -90,7 +90,28 @@ export interface Account {
90
90
  lifetime: Stats;
91
91
  monthly: Stats;
92
92
  }
93
- challenges: Challenge[];
93
+ challenges: {
94
+ raw: {
95
+ challengeInfo: Challenge;
96
+ challengeData: {
97
+ period: number;
98
+ challengeId: number;
99
+ reset: number;
100
+ claimed: number;
101
+ completed: number;
102
+ data: number;
103
+ }
104
+ }
105
+ id: number;
106
+ name: string;
107
+ desc: string;
108
+ rewardEggs: number;
109
+ isRerolled: boolean;
110
+ isClaimed: boolean;
111
+ isCompleted: boolean;
112
+ progressNum: number;
113
+ goalNum: number;
114
+ }[];
94
115
  rawLoginData: any; // i ain't typing allat
95
116
  }
96
117