warframe-worldstate-parser 4.0.1 → 4.2.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/lib/WorldState.js CHANGED
@@ -30,6 +30,8 @@ import SyndicateMission from './models/SyndicateMission.js';
30
30
  import Alert from './models/Alert.js';
31
31
  import WorldEvent from './models/WorldEvent.js';
32
32
  import News from './models/News.js';
33
+ import Kinepage from './models/Kinepage.js';
34
+ import DeepArchimedea from './models/DeepArchidemea.js';
33
35
 
34
36
  const { sortieData } = wsData;
35
37
 
@@ -126,6 +128,7 @@ export class WorldState {
126
128
  throw new TypeError(`json needs to be a string, provided ${typeof json} : ${JSON.stringify(json)}`);
127
129
  }
128
130
  const data = JSON.parse(json);
131
+ const tmp = JSON.parse(data.Tmp);
129
132
 
130
133
  // eslint-disable-next-line no-param-reassign
131
134
  deps = {
@@ -342,7 +345,7 @@ export class WorldState {
342
345
  * Current sentient outposts
343
346
  * @type {SentientOutpost}
344
347
  */
345
- this.sentientOutposts = new SentientOutpost(data.Tmp, deps);
348
+ this.sentientOutposts = new SentientOutpost(tmp.sfn, deps);
346
349
 
347
350
  /**
348
351
  * Steel path offering rotation
@@ -361,6 +364,11 @@ export class WorldState {
361
364
  deps.duviriChoices = parseArray(DuviriChoice, data.EndlessXpChoices, deps);
362
365
 
363
366
  this.duviriCycle = new DuviriCycle(deps);
367
+
368
+ this.kinepage = new Kinepage(tmp.pgr, deps.locale);
369
+
370
+ const { activation, expiry } = this.nightwave.activeChallenges.filter((c) => !c.isDaily)[0];
371
+ this.deepArchimedea = new DeepArchimedea(activation, expiry, tmp.lqo27);
364
372
  }
365
373
  }
366
374
 
@@ -0,0 +1,33 @@
1
+ import { languageDesc, languageString } from 'warframe-worldstate-data/utilities';
2
+
3
+ class DeepArchidemeaMission {
4
+ constructor(mission, deviation, risks, locale) {
5
+ this.mission = mission;
6
+
7
+ this.deviation = {
8
+ key: deviation,
9
+ name: languageString(deviation, locale),
10
+ description: languageDesc(deviation, locale),
11
+ };
12
+
13
+ this.riskVariables = risks.map((i) => {
14
+ return { key: i, name: languageString(i, locale), description: languageDesc(i, locale) };
15
+ });
16
+ }
17
+ }
18
+
19
+ export default class DeepArchimedea {
20
+ constructor(activation, expiry, data, locale = 'en') {
21
+ this.id = `${new Date(activation).getTime()}DeepArchimedea`;
22
+
23
+ this.activation = activation;
24
+
25
+ this.expiry = expiry;
26
+
27
+ this.missions = data.mt.map((m, i) => new DeepArchidemeaMission(m, data.mv[i], data.c[i], locale));
28
+
29
+ this.personalModifiers = data.fv.map((i) => {
30
+ return { key: i, name: languageString(i, locale), description: languageDesc(i, locale) };
31
+ });
32
+ }
33
+ }
@@ -0,0 +1,11 @@
1
+ export default class Kinepage {
2
+ constructor(data, locale = 'en') {
3
+ this.timestamp = new Date(Number(data.ts) * 1000);
4
+
5
+ const translations = Object.fromEntries(Object.entries(data).filter(([key]) => key !== 'ts'));
6
+
7
+ this.message = translations[locale] || data.en;
8
+
9
+ this.translations = Object.fromEntries(Object.entries(translations).filter(([key]) => key !== locale));
10
+ }
11
+ }
@@ -41,10 +41,8 @@ const sat = () => {
41
41
  */
42
42
  export default class SentientOutpost {
43
43
  #node;
44
- constructor(data, { locale, sentientData, logger }) {
45
- if (!data) data = '{"sfn":000}';
46
- const json = JSON.parse(data);
47
- this.#node = json.sfn || '000';
44
+ constructor(sfn, { locale, sentientData, logger }) {
45
+ this.#node = sfn || '000';
48
46
  const id = `CrewBattleNode${this.#node}`;
49
47
  /* istanbul ignore if */
50
48
  if (this.#node === '000') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "warframe-worldstate-parser",
3
- "version": "4.0.1",
3
+ "version": "4.2.0",
4
4
  "description": "An Open parser for Warframe's Worldstate in Javascript",
5
5
  "keywords": [
6
6
  "warframe-worldstate",
@@ -32,7 +32,7 @@
32
32
  "types"
33
33
  ],
34
34
  "peerDependencies": {
35
- "warframe-worldstate-data": ">=2.0.3"
35
+ "warframe-worldstate-data": ">=2.12.2"
36
36
  },
37
37
  "engines": {
38
38
  "node": ">=18.19.0"
@@ -148,6 +148,8 @@ export class WorldState {
148
148
  */
149
149
  steelPath: SteelPathOffering;
150
150
  duviriCycle: DuviriCycle;
151
+ kinepage: Kinepage;
152
+ deepArchimedea: DeepArchimedea;
151
153
  }
152
154
  declare function _default(json: any, deps: any): Promise<WorldState>;
153
155
  export default _default;
@@ -177,3 +179,5 @@ import Nightwave from './models/Nightwave.js';
177
179
  import SentientOutpost from './models/SentientOutpost.js';
178
180
  import SteelPathOffering from './models/SteelPathOffering.js';
179
181
  import DuviriCycle from './models/DuviriCycle.js';
182
+ import Kinepage from './models/Kinepage.js';
183
+ import DeepArchimedea from './models/DeepArchidemea.js';
@@ -0,0 +1,8 @@
1
+ export default class DeepArchimedea {
2
+ constructor(activation: any, expiry: any, data: any, locale?: string);
3
+ id: string;
4
+ activation: any;
5
+ expiry: any;
6
+ missions: any;
7
+ personalModifiers: any;
8
+ }
@@ -0,0 +1,6 @@
1
+ export default class Kinepage {
2
+ constructor(data: any, locale?: string);
3
+ timestamp: Date;
4
+ message: any;
5
+ translations: any;
6
+ }
@@ -19,7 +19,7 @@
19
19
  * @property {Date} previous.expiry When the mission became or becomes inactive
20
20
  */
21
21
  export default class SentientOutpost {
22
- constructor(data: any, { locale, sentientData, logger }: {
22
+ constructor(sfn: any, { locale, sentientData, logger }: {
23
23
  locale: any;
24
24
  sentientData: any;
25
25
  logger: any;