warframe-worldstate-parser 2.22.0 → 2.23.2

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/Sortie.js CHANGED
@@ -78,6 +78,12 @@ class Sortie extends WorldstateObject {
78
78
  */
79
79
  this.faction = translator.sortieFaction(data.Boss, locale);
80
80
 
81
+ /**
82
+ * The sortie's faction
83
+ * @type {string}
84
+ */
85
+ this.factionKey = translator.sortieFaction(data.boss, 'en');
86
+
81
87
  /**
82
88
  * Whether or not this is expired (at time of object creation)
83
89
  * @type {boolean}
@@ -5,7 +5,7 @@ const fetch = require('node-fetch');
5
5
  const WorldstateObject = require('./WorldstateObject');
6
6
 
7
7
  const apiBase = process.env.API_BASE_URL || 'https://api.warframestat.us';
8
- const bountyRewardRegex = /Tier([ABCDE])Table([ABC])Rewards/i;
8
+ const bountyRewardRegex = /(?:Tier([ABCDE])|Narmer)Table([ABC])Rewards/i;
9
9
  const ghoulRewardRegex = /GhoulBountyTable([AB])Rewards/i;
10
10
 
11
11
  /**
@@ -75,17 +75,20 @@ const getBountyRewards = async (i18n, isVault, raw) => {
75
75
  return [];
76
76
  };
77
77
 
78
+ const FIFTY_MINUTES = 3000000;
79
+
78
80
  /**
79
81
  * Represents a syndicate daily mission
80
82
  * @extends {WorldstateObject}
81
83
  */
82
84
  class SyndicateJob extends WorldstateObject {
83
85
  /**
84
- * @param {Object} data The syndicate mission data
85
- * @param {Date} expiry The syndicate job expiration
86
- * @param {Object} deps The dependencies object
87
- * @param {Translator} deps.translator The string translator
88
- * @param {string} deps.locale Locale to use for translations
86
+ * @param {Object} data The syndicate mission data
87
+ * @param {Date} expiry The syndicate job expiration
88
+ * @param {Object} deps The dependencies object
89
+ * @param {Object} timeDate Time/Date functions
90
+ * @param {Translator} translator The string translator
91
+ * @param {string} locale Locale to use for translations
89
92
  */
90
93
  constructor(data, expiry, { translator, timeDate, locale }) {
91
94
  super({ _id: { $oid: data.JobCurrentVersion ? data.JobCurrentVersion.$oid : `${(data.jobType || '').split('/').slice(-1)[0]}${expiry.getTime()}` } }, { timeDate });
@@ -141,6 +144,27 @@ class SyndicateJob extends WorldstateObject {
141
144
  * @type {string|null}
142
145
  */
143
146
  this.locationTag = data.locationTag;
147
+
148
+ /**
149
+ * End time for the syndicate mission.
150
+ * Should be inherited from the Syndicate, but some are timebound.
151
+ * @type {Date}
152
+ */
153
+ this.expiry = expiry;
154
+
155
+ /**
156
+ * What time phase this bounty is bound to
157
+ * @type {string}
158
+ */
159
+ this.timeBound = undefined;
160
+ if (data.jobType && data.jobType.toLowerCase().includes('narmer')) {
161
+ if (data.jobType.toLowerCase().includes('eidolon')) {
162
+ this.timeBound = 'day';
163
+ this.expiry = new Date(this.expiry.getTime() - FIFTY_MINUTES);
164
+ } else {
165
+ this.timeBoound = 'night';
166
+ }
167
+ }
144
168
  }
145
169
  }
146
170
 
@@ -67,6 +67,12 @@ class SyndicateMission extends WorldstateObject {
67
67
  */
68
68
  this.syndicate = translator.syndicate(data.Tag, locale);
69
69
 
70
+ /**
71
+ * The syndicate that is offering the mission
72
+ * @type {string}
73
+ */
74
+ this.syndicateKey = translator.syndicate(data.Tag, 'en');
75
+
70
76
  /**
71
77
  * The nodes on which the missions are taking place
72
78
  * @type {Array.<string>}
package/lib/WorldEvent.js CHANGED
@@ -307,7 +307,7 @@ class WorldEvent extends WorldstateObject {
307
307
  lines.push(`${this.health}% Remaining`);
308
308
  }
309
309
 
310
- if (this.affiliatedWith) {
310
+ if (this.affiliatedWith && this.jobs) {
311
311
  lines.push(`${this.affiliatedWith} will reward you for performing `
312
312
  + `${this.jobs.map((job) => job.type).join(', ')} job${this.jobs.length > 1 ? 's' : ''}`);
313
313
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "warframe-worldstate-parser",
3
- "version": "2.22.0",
3
+ "version": "2.23.2",
4
4
  "description": "An Open parser for Warframe's Worldstate in Javascript",
5
5
  "types": "./types/main.d.ts",
6
6
  "main": "main.js",
@@ -24,11 +24,11 @@
24
24
  "eslint-config-airbnb-base": "^15.0.0",
25
25
  "eslint-plugin-import": "^2.20.1",
26
26
  "greenkeeper-lockfile": "^1.15.1",
27
- "mocha": "^9.0.2",
27
+ "mocha": "^10.0.0",
28
28
  "nyc": "^15.1.0",
29
29
  "precommit-hook": "^3.0.0",
30
- "rewire": "^5.0.0",
31
- "sinon": "^12.0.1",
30
+ "rewire": "^6.0.0",
31
+ "sinon": "^13.0.0",
32
32
  "sinon-chai": "^3.5.0",
33
33
  "typescript": "^4.0.5"
34
34
  },
@@ -1,5 +1,6 @@
1
1
  export = CambionCycle;
2
2
  declare class CambionCycle extends WorldstateObject {
3
+ active: string;
3
4
  /**
4
5
  * Get whether or not the event has expired
5
6
  * @returns {boolean}
@@ -48,6 +48,11 @@ declare class Sortie extends WorldstateObject {
48
48
  * @type {string}
49
49
  */
50
50
  faction: string;
51
+ /**
52
+ * The sortie's faction
53
+ * @type {string}
54
+ */
55
+ factionKey: string;
51
56
  /**
52
57
  * Whether or not this is expired (at time of object creation)
53
58
  * @type {boolean}
@@ -5,16 +5,14 @@ export = SyndicateJob;
5
5
  */
6
6
  declare class SyndicateJob extends WorldstateObject {
7
7
  /**
8
- * @param {Object} data The syndicate mission data
9
- * @param {Date} expiry The syndicate job expiration
10
- * @param {Object} deps The dependencies object
11
- * @param {Translator} deps.translator The string translator
12
- * @param {string} deps.locale Locale to use for translations
8
+ * @param {Object} data The syndicate mission data
9
+ * @param {Date} expiry The syndicate job expiration
10
+ * @param {Object} deps The dependencies object
11
+ * @param {Object} timeDate Time/Date functions
12
+ * @param {Translator} translator The string translator
13
+ * @param {string} locale Locale to use for translations
13
14
  */
14
- constructor(data: any, expiry: Date, { translator, timeDate, locale }: {
15
- translator: Translator;
16
- locale: string;
17
- });
15
+ constructor(data: any, expiry: Date, { translator, timeDate, locale }: any);
18
16
  /**
19
17
  * Array of strings describing rewards
20
18
  * @type {Array.<String>}
@@ -51,5 +49,11 @@ declare class SyndicateJob extends WorldstateObject {
51
49
  * @type {string|null}
52
50
  */
53
51
  locationTag: string | null;
52
+ /**
53
+ * What time phase this bounty is bound to
54
+ * @type {string}
55
+ */
56
+ timeBound: string;
57
+ timeBoound: string;
54
58
  }
55
59
  import WorldstateObject = require("./WorldstateObject");
@@ -35,6 +35,11 @@ declare class SyndicateMission extends WorldstateObject {
35
35
  * @type {string}
36
36
  */
37
37
  syndicate: string;
38
+ /**
39
+ * The syndicate that is offering the mission
40
+ * @type {string}
41
+ */
42
+ syndicateKey: string;
38
43
  /**
39
44
  * The nodes on which the missions are taking place
40
45
  * @type {Array.<string>}