warframe-worldstate-parser 2.23.0 → 2.23.1

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.
@@ -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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "warframe-worldstate-parser",
3
- "version": "2.23.0",
3
+ "version": "2.23.1",
4
4
  "description": "An Open parser for Warframe's Worldstate in Javascript",
5
5
  "types": "./types/main.d.ts",
6
6
  "main": "main.js",
@@ -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");