warframe-worldstate-parser 2.29.0 → 2.31.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
@@ -36,6 +36,7 @@ const CambionCycle = require('./models/CambionCycle');
36
36
  const SteelPathOffering = require('./models/SteelPathOffering');
37
37
  const Dependency = require('./supporting/Dependency'); // eslint-disable-line no-unused-vars
38
38
  const DuviriCycle = require('./models/DuviriCycle');
39
+ const DuviriChoice = require('./supporting/DuviriChoice');
39
40
 
40
41
  // needed for type declarations
41
42
  const MarkdownSettings = require('./supporting/MarkdownSettings');
@@ -74,6 +75,7 @@ const defaultDeps = {
74
75
  mdConfig: new MarkdownSettings(),
75
76
  locale: 'en',
76
77
  logger: console,
78
+ DuviriChoice,
77
79
  };
78
80
 
79
81
  /**
@@ -339,6 +341,8 @@ module.exports = class WorldState {
339
341
  */
340
342
  [this.archonHunt] = parseArray(deps.Sortie, data.LiteSorties, deps);
341
343
 
344
+ deps.duviriChoices = parseArray(deps.DuviriChoice, data.EndlessXpChoices, deps);
345
+
342
346
  this.duviriCycle = new DuviriCycle(deps);
343
347
  }
344
348
  };
@@ -26,7 +26,7 @@ const getStageInfo = () => {
26
26
  * @extends {WorldstateObject}
27
27
  */
28
28
  class DuviriCycle extends WorldstateObject {
29
- constructor({ timeDate, translator }) {
29
+ constructor({ timeDate, translator, duviriChoices }) {
30
30
  super({ _id: { $oid: 'duviriCycle0' } }, { timeDate, translator });
31
31
  const { activation, expiry, state } = getStageInfo();
32
32
 
@@ -45,6 +45,10 @@ class DuviriCycle extends WorldstateObject {
45
45
  * @type {string}
46
46
  */
47
47
  this.state = state;
48
+ /**
49
+ * Choice options for this Cycle
50
+ */
51
+ this.choices = duviriChoices;
48
52
 
49
53
  this.id = `duviriCycle${this.state}${this.expiry.getTime()}`;
50
54
  }
@@ -17,6 +17,7 @@ class VoidTraderItem {
17
17
  * @param {string} deps.locale Locale to use for translations
18
18
  */
19
19
  constructor({ ItemType, PrimePrice, RegularPrice }, { translator, locale }) {
20
+ this.uniqueName = ItemType;
20
21
  this.item = translator.languageString(ItemType, locale);
21
22
  this.ducats = Number.parseInt(PrimePrice, 10);
22
23
  this.credits = Number.parseInt(RegularPrice, 10);
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Single category of duviri choices
5
+ */
6
+ class DuviriChoice {
7
+ constructor(data) {
8
+ switch (data.Category) {
9
+ case 'EXC_NORMAL':
10
+ this.category = 'normal';
11
+ break;
12
+ case 'EXC_HARD':
13
+ this.category = 'hard';
14
+ }
15
+ this.categoryKey = data.Category;
16
+ this.choices = data.Choices;
17
+ }
18
+ }
19
+
20
+ module.exports = DuviriChoice;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "warframe-worldstate-parser",
3
- "version": "2.29.0",
3
+ "version": "2.31.0",
4
4
  "description": "An Open parser for Warframe's Worldstate in Javascript",
5
5
  "types": "./types/main.d.ts",
6
6
  "main": "main.js",
@@ -4,15 +4,20 @@ export = DuviriCycle;
4
4
  * @extends {WorldstateObject}
5
5
  */
6
6
  declare class DuviriCycle extends WorldstateObject {
7
- constructor({ timeDate, translator }: {
7
+ constructor({ timeDate, translator, duviriChoices }: {
8
8
  timeDate: any;
9
9
  translator: any;
10
+ duviriChoices: any;
10
11
  });
11
12
  /**
12
13
  * Current stage key
13
14
  * @type {string}
14
15
  */
15
16
  state: string;
17
+ /**
18
+ * Choice options for this Cycle
19
+ */
20
+ choices: any;
16
21
  id: string;
17
22
  }
18
23
  declare namespace DuviriCycle {
@@ -20,6 +20,7 @@ declare class VoidTraderItem {
20
20
  PrimePrice: string;
21
21
  RegularPrice: string;
22
22
  }, { translator, locale }: Dependency);
23
+ uniqueName: string;
23
24
  item: any;
24
25
  ducats: number;
25
26
  credits: number;
@@ -0,0 +1,10 @@
1
+ export = DuviriChoice;
2
+ /**
3
+ * Single category of duviri choices
4
+ */
5
+ declare class DuviriChoice {
6
+ constructor(data: any);
7
+ category: string;
8
+ categoryKey: any;
9
+ choices: any;
10
+ }