warframe-worldstate-parser 2.23.2 → 2.25.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.
Files changed (65) hide show
  1. package/lib/Alert.js +8 -8
  2. package/lib/CambionCycle.js +1 -5
  3. package/lib/CetusCycle.js +3 -3
  4. package/lib/ChallengeInstance.js +6 -6
  5. package/lib/ConclaveChallenge.js +2 -5
  6. package/lib/ConstructionProgress.js +4 -2
  7. package/lib/DailyDeal.js +1 -3
  8. package/lib/DarkSector.js +11 -8
  9. package/lib/EarthCycle.js +4 -4
  10. package/lib/Fissure.js +18 -10
  11. package/lib/FlashSale.js +2 -7
  12. package/lib/GlobalUpgrade.js +5 -5
  13. package/lib/Invasion.js +11 -10
  14. package/lib/Kuva.js +16 -10
  15. package/lib/Mission.js +31 -21
  16. package/lib/News.js +13 -15
  17. package/lib/Nightwave.js +7 -4
  18. package/lib/NightwaveChallenge.js +2 -4
  19. package/lib/PersistentEnemy.js +1 -3
  20. package/lib/Reward.js +64 -60
  21. package/lib/SentientOutpost.js +7 -8
  22. package/lib/Simaris.js +5 -3
  23. package/lib/Sortie.js +22 -16
  24. package/lib/SortieVariant.js +17 -18
  25. package/lib/SteelPathOffering.js +1 -0
  26. package/lib/SyndicateJob.js +20 -11
  27. package/lib/SyndicateMission.js +6 -6
  28. package/lib/VallisCycle.js +2 -2
  29. package/lib/VoidTrader.js +9 -13
  30. package/lib/WeeklyChallenge.js +4 -3
  31. package/lib/WorldEvent.js +23 -29
  32. package/lib/WorldState.js +50 -28
  33. package/lib/WorldstateObject.js +35 -12
  34. package/lib/ZarimanCycle.js +141 -0
  35. package/lib/timeDate.js +13 -12
  36. package/lib/translation.js +47 -38
  37. package/package.json +3 -118
  38. package/types/lib/Alert.d.ts +1 -1
  39. package/types/lib/CambionCycle.d.ts +9 -0
  40. package/types/lib/CetusCycle.d.ts +1 -0
  41. package/types/lib/ConclaveChallenge.d.ts +1 -1
  42. package/types/lib/DailyDeal.d.ts +1 -1
  43. package/types/lib/DarkSector.d.ts +1 -1
  44. package/types/lib/EarthCycle.d.ts +1 -0
  45. package/types/lib/Fissure.d.ts +11 -10
  46. package/types/lib/FlashSale.d.ts +1 -1
  47. package/types/lib/GlobalUpgrade.d.ts +1 -1
  48. package/types/lib/Invasion.d.ts +4 -4
  49. package/types/lib/Kuva.d.ts +1 -6
  50. package/types/lib/Mission.d.ts +11 -4
  51. package/types/lib/News.d.ts +4 -4
  52. package/types/lib/Nightwave.d.ts +2 -1
  53. package/types/lib/NightwaveChallenge.d.ts +7 -1
  54. package/types/lib/PersistentEnemy.d.ts +1 -1
  55. package/types/lib/SentientOutpost.d.ts +1 -1
  56. package/types/lib/Sortie.d.ts +10 -16
  57. package/types/lib/SortieVariant.d.ts +14 -20
  58. package/types/lib/SyndicateMission.d.ts +6 -1
  59. package/types/lib/VallisCycle.d.ts +1 -0
  60. package/types/lib/VoidTrader.d.ts +1 -1
  61. package/types/lib/WorldEvent.d.ts +3 -3
  62. package/types/lib/WorldState.d.ts +5 -1
  63. package/types/lib/WorldstateObject.d.ts +43 -11
  64. package/types/lib/ZarimanCycle.d.ts +56 -0
  65. package/types/main.d.ts +1 -1
package/lib/Alert.js CHANGED
@@ -16,13 +16,16 @@ class Alert extends WorldstateObject {
16
16
  * @param {Reward} Reward The Reward parser
17
17
  * @param {string} locale Locale to use for translations
18
18
  */
19
- constructor(data, {
20
- mdConfig, translator, timeDate, Mission, Reward, locale,
21
- }) {
19
+ constructor(data, { mdConfig, translator, timeDate, Mission, Reward, locale }) {
22
20
  super(data, { timeDate });
23
21
 
24
22
  const deps = {
25
- mdConfig, translator, timeDate, Mission, Reward, locale,
23
+ mdConfig,
24
+ translator,
25
+ timeDate,
26
+ Mission,
27
+ Reward,
28
+ locale,
26
29
  };
27
30
 
28
31
  /**
@@ -103,10 +106,7 @@ class Alert extends WorldstateObject {
103
106
  * @returns {string}
104
107
  */
105
108
  toString() {
106
- const lines = [
107
- this.mission.toString(),
108
- this.getETAString(),
109
- ];
109
+ const lines = [this.mission.toString(), this.getETAString()];
110
110
 
111
111
  return `${this.mdConfig.codeMulti}${lines.join(this.mdConfig.lineEnd)}${this.mdConfig.blockEnd}`;
112
112
  }
@@ -16,11 +16,7 @@ module.exports = class CambionCycle extends WorldstateObject {
16
16
  constructor(cetusCycle, { timeDate }) {
17
17
  super({ _id: { $oid: 'cambionCycle0' } }, { timeDate });
18
18
 
19
- ({
20
- activation: this.activation,
21
- expiry: this.expiry,
22
- timeLeft: this.timeLeft,
23
- } = cetusCycle);
19
+ ({ activation: this.activation, expiry: this.expiry, timeLeft: this.timeLeft } = cetusCycle);
24
20
 
25
21
  this.active = cetusCycle.isDay ? 'fass' : 'vome';
26
22
 
package/lib/CetusCycle.js CHANGED
@@ -93,7 +93,7 @@ class CetusCycle extends WorldstateObject {
93
93
 
94
94
  this.id = `cetusCycle${this.expiry.getTime()}`;
95
95
 
96
- this.shortString = `${this.timeLeft.replace(/\s\d*s/ig, '')} to ${this.isDay ? 'Night' : 'Day'}`;
96
+ this.shortString = `${this.timeLeft.replace(/\s\d*s/gi, '')} to ${this.isDay ? 'Night' : 'Day'}`;
97
97
  }
98
98
 
99
99
  /**
@@ -114,8 +114,8 @@ class CetusCycle extends WorldstateObject {
114
114
 
115
115
  const secondsRemainingInCycle = dayTime ? secondsToNightEnd - nightTime : secondsToNightEnd;
116
116
  millisLeft = secondsRemainingInCycle * 1000;
117
- const minutesCoef = (1000 * 60);
118
- const expiry = new Date(Math.round((now + millisLeft) / (minutesCoef)) * minutesCoef);
117
+ const minutesCoef = 1000 * 60;
118
+ const expiry = new Date(Math.round((now + millisLeft) / minutesCoef) * minutesCoef);
119
119
  const state = dayTime ? 'day' : 'night';
120
120
 
121
121
  return {
@@ -39,17 +39,17 @@ class ChallengeInstance {
39
39
  * Required damage type
40
40
  * @type {String|undefined}
41
41
  */
42
- this.damageType = data.DamageType
43
- ? translator.languageString(data.DamageType, locale)
44
- : undefined;
42
+ this.damageType = data.DamageType ? translator.languageString(data.DamageType, locale) : undefined;
45
43
 
46
44
  /**
47
45
  * Target to fulfill challenge
48
46
  * @type {string}
49
47
  */
50
- this.target = data.VictimType && data.VictimType[0]
51
- ? translator.languageString(data.VictimType[0], locale)
52
- : data.Script._faction;
48
+ this.target =
49
+ data.VictimType && data.VictimType[0]
50
+ ? translator.languageString(data.VictimType[0], locale)
51
+ : // eslint-disable-next-line no-underscore-dangle
52
+ data.Script._faction;
53
53
  }
54
54
 
55
55
  toString() {
@@ -15,9 +15,7 @@ class ConclaveChallenge extends WorldstateObject {
15
15
  * @param {TimeDateFunctions} deps.timeDate The time and date functions
16
16
  * @param {string} deps.locale Locale to use for translations
17
17
  */
18
- constructor(data, {
19
- mdConfig, translator, timeDate, locale,
20
- }) {
18
+ constructor(data, { mdConfig, translator, timeDate, locale }) {
21
19
  super(data, { timeDate });
22
20
 
23
21
  /**
@@ -114,8 +112,7 @@ class ConclaveChallenge extends WorldstateObject {
114
112
  */
115
113
  this.standing = undefined;
116
114
 
117
- const challenge = translator
118
- .conclaveChallenge(data.challengeTypeRefID, locale);
115
+ const challenge = translator.conclaveChallenge(data.challengeTypeRefID, locale);
119
116
 
120
117
  ({ title: this.title, description: this.description, standing: this.standing } = challenge);
121
118
 
@@ -33,8 +33,10 @@ class ConstructionProgress extends WorldstateObject {
33
33
  * @returns {string}
34
34
  */
35
35
  toString() {
36
- return `${this.mdConfig.codeMulti}Fomorian: ${this.fomorianProgress}%${this.mdConfig.lineEnd}Razorback: `
37
- + `${this.razorbackProgress}%${this.mdConfig.lineEnd}Unknown: ${this.unknownProgress}%${this.mdConfig.blockEnd}`;
36
+ return (
37
+ `${this.mdConfig.codeMulti}Fomorian: ${this.fomorianProgress}%${this.mdConfig.lineEnd}Razorback: ` +
38
+ `${this.razorbackProgress}%${this.mdConfig.lineEnd}Unknown: ${this.unknownProgress}%${this.mdConfig.blockEnd}`
39
+ );
38
40
  }
39
41
  }
40
42
 
package/lib/DailyDeal.js CHANGED
@@ -12,9 +12,7 @@ class DailyDeal {
12
12
  * @param {TimeDateFunctions} deps.timeDate The time and date functions
13
13
  * @param {string} deps.locale Locale to use for translations
14
14
  */
15
- constructor(data, {
16
- mdConfig, translator, timeDate, locale,
17
- }) {
15
+ constructor(data, { mdConfig, translator, timeDate, locale }) {
18
16
  /**
19
17
  * The markdown settings
20
18
  * @type {MarkdownSettings}
package/lib/DarkSector.js CHANGED
@@ -18,13 +18,17 @@ class DarkSector extends WorldstateObject {
18
18
  * @param {Reward} deps.Reward The reward parser
19
19
  * @param {string} deps.locale Locale to use for translations
20
20
  */
21
- constructor(data, {
22
- mdConfig, translator, timeDate, Mission, DarkSectorBattle, Reward, locale,
23
- }) {
21
+ constructor(data, { mdConfig, translator, timeDate, Mission, DarkSectorBattle, Reward, locale }) {
24
22
  super(data, { timeDate });
25
23
 
26
24
  const deps = {
27
- translator, Mission, DarkSectorBattle, mdConfig, Reward, timeDate, locale,
25
+ translator,
26
+ Mission,
27
+ DarkSectorBattle,
28
+ mdConfig,
29
+ Reward,
30
+ timeDate,
31
+ locale,
28
32
  };
29
33
 
30
34
  /**
@@ -80,7 +84,8 @@ class DarkSector extends WorldstateObject {
80
84
  * @type {Date}
81
85
  */
82
86
  this.defenderDeployemntActivation = data.DefenderInfo.DeploymentActivationTime
83
- ? timeDate.parseDate(data.DefenderInfo.DeploymentActivationTime) : 0;
87
+ ? timeDate.parseDate(data.DefenderInfo.DeploymentActivationTime)
88
+ : 0;
84
89
 
85
90
  /**
86
91
  * The solar rail type
@@ -116,9 +121,7 @@ class DarkSector extends WorldstateObject {
116
121
  * The dark sector's mission
117
122
  * @type {?Mission}
118
123
  */
119
- this.mission = data.DefenderInfo.MissionInfo
120
- ? new Mission(data.DefenderInfo.MissionInfo, deps)
121
- : undefined;
124
+ this.mission = data.DefenderInfo.MissionInfo ? new Mission(data.DefenderInfo.MissionInfo, deps) : undefined;
122
125
 
123
126
  this.battlePayReserve = data.DefenderInfo.BattlePayReserve;
124
127
 
package/lib/EarthCycle.js CHANGED
@@ -9,10 +9,10 @@ function getCurrentEarthCycle() {
9
9
 
10
10
  let secondsLeft = 14400 - (cycleSeconds % 14400);
11
11
  const millisLeft = secondsLeft * 1000;
12
- const expiry = new Date(now + (secondsLeft * 1000));
12
+ const expiry = new Date(now + secondsLeft * 1000);
13
13
 
14
- const minutesCoef = (1000 * 60);
15
- const rounded = new Date(Math.round((now + millisLeft) / (minutesCoef)) * minutesCoef);
14
+ const minutesCoef = 1000 * 60;
15
+ const rounded = new Date(Math.round((now + millisLeft) / minutesCoef) * minutesCoef);
16
16
 
17
17
  const timePieces = [];
18
18
  if (secondsLeft > 3600) {
@@ -32,7 +32,7 @@ function getCurrentEarthCycle() {
32
32
  expiresIn: millisLeft,
33
33
  rounded,
34
34
  state: dayTime ? 'day' : 'night',
35
- start: new Date(expiry.getTime() - (1000 * 60 * 60 * 4)), // start is 4h before end
35
+ start: new Date(expiry.getTime() - 1000 * 60 * 60 * 4), // start is 4h before end
36
36
  };
37
37
  }
38
38
 
package/lib/Fissure.js CHANGED
@@ -2,11 +2,15 @@
2
2
 
3
3
  const WorldstateObject = require('./WorldstateObject');
4
4
 
5
+ /**
6
+ * @typedef {Object} ContentFissure
7
+ * @property
8
+ */
5
9
  /**
6
10
  * Represents a fissure mission
7
11
  * @extends {WorldstateObject}
8
12
  */
9
- class Fissure extends WorldstateObject {
13
+ module.exports = class Fissure extends WorldstateObject {
10
14
  /**
11
15
  * @param {Object} data The fissure data
12
16
  * @param {Object} deps The dependencies object
@@ -60,9 +64,9 @@ class Fissure extends WorldstateObject {
60
64
  this.enemyKey = translator.nodeEnemy(data.Node);
61
65
 
62
66
  /**
63
- * The node key where the fissure has appeared
64
- * @type {string}
65
- */
67
+ * The node key where the fissure has appeared
68
+ * @type {string}
69
+ */
66
70
  this.nodeKey = translator.node(data.Node);
67
71
 
68
72
  /**
@@ -90,7 +94,7 @@ class Fissure extends WorldstateObject {
90
94
  this.expiry = timeDate.parseDate(data.Expiry);
91
95
 
92
96
  /**
93
- * Whether or not this is expired (at time of object creation)
97
+ * Whether this is expired (at time of object creation)
94
98
  * @type {boolean}
95
99
  */
96
100
  this.expired = this.getExpired();
@@ -102,14 +106,20 @@ class Fissure extends WorldstateObject {
102
106
  this.eta = this.getETAString();
103
107
 
104
108
  /**
105
- * Whether or not this fissure corresponds to a RailJack Void Storm
109
+ * Whether this fissure corresponds to a RailJack Void Storm
106
110
  * @type {Boolean}
107
111
  */
108
112
  this.isStorm = !!data.ActiveMissionTier;
113
+
114
+ /**
115
+ * Whether this fissure is a Steel Path fissure
116
+ * @type {boolean}
117
+ */
118
+ this.isHard = !!data.Hard;
109
119
  }
110
120
 
111
121
  /**
112
- * Get whether or not this deal has expired
122
+ * Get whether this deal has expired
113
123
  * @returns {boolean}
114
124
  */
115
125
  getExpired() {
@@ -131,6 +141,4 @@ class Fissure extends WorldstateObject {
131
141
  toString() {
132
142
  return `[${this.getETAString()}] ${this.tier} fissure at ${this.node} - ${this.enemy} ${this.missionType}`;
133
143
  }
134
- }
135
-
136
- module.exports = Fissure;
144
+ };
package/lib/FlashSale.js CHANGED
@@ -12,9 +12,7 @@ class FlashSale {
12
12
  * @param {TimeDateFunctions} deps.timeDate The time and date functions
13
13
  * @param {string} deps.locale Locale to use for translations
14
14
  */
15
- constructor(data, {
16
- translator, mdConfig, timeDate, locale,
17
- }) {
15
+ constructor(data, { translator, mdConfig, timeDate, locale }) {
18
16
  /**
19
17
  * The markdown settings
20
18
  * @type {MarkdownSettings}
@@ -126,10 +124,7 @@ class FlashSale {
126
124
  * @returns {string}
127
125
  */
128
126
  toString() {
129
- const lines = [
130
- `${this.item}, ${this.premiumOverride}p`,
131
- `Expires in ${this.getETAString()}`,
132
- ];
127
+ const lines = [`${this.item}, ${this.premiumOverride}p`, `Expires in ${this.getETAString()}`];
133
128
 
134
129
  if (this.discount) {
135
130
  lines.unshift(`${this.discount}% off!`);
@@ -12,9 +12,7 @@ class GlobalUpgrade {
12
12
  * @param {MarkdownSettings} deps.mdConfig The markdown settings
13
13
  * @param {string} deps.locale Locale to use for translations
14
14
  */
15
- constructor(data, {
16
- translator, timeDate, mdConfig, locale,
17
- }) {
15
+ constructor(data, { translator, timeDate, mdConfig, locale }) {
18
16
  /**
19
17
  * The time and date functions
20
18
  * @type {TimeDateFunctions}
@@ -116,8 +114,10 @@ class GlobalUpgrade {
116
114
  * @returns {string}
117
115
  */
118
116
  toString() {
119
- return `${this.mdConfig.codeMulti}[${this.getETAString()}] ${this.upgrade}`
120
- + `${this.operation} ${this.upgradeOperationValue}${this.mdConfig.blockEnd}`;
117
+ return (
118
+ `${this.mdConfig.codeMulti}[${this.getETAString()}] ${this.upgrade}` +
119
+ `${this.operation} ${this.upgradeOperationValue}${this.mdConfig.blockEnd}`
120
+ );
121
121
  }
122
122
  }
123
123
 
package/lib/Invasion.js CHANGED
@@ -23,13 +23,15 @@ class Invasion extends WorldstateObject {
23
23
  * @param {Reward} deps.Reward The Reward parser
24
24
  * @param {string} deps.locale Locale to use for translations
25
25
  */
26
- constructor(data, {
27
- mdConfig, translator, timeDate, Reward, locale,
28
- }) {
26
+ constructor(data, { mdConfig, translator, timeDate, Reward, locale }) {
29
27
  super(data, { timeDate });
30
28
 
31
29
  const opts = {
32
- mdConfig, translator, timeDate, Reward, locale,
30
+ mdConfig,
31
+ translator,
32
+ timeDate,
33
+ Reward,
34
+ locale,
33
35
  };
34
36
 
35
37
  /**
@@ -55,9 +57,9 @@ class Invasion extends WorldstateObject {
55
57
  this.node = translator.node(data.Node, locale);
56
58
 
57
59
  /**
58
- * The node key where the invasion is taking place
59
- * @type {string}
60
- */
60
+ * The node key where the invasion is taking place
61
+ * @type {string}
62
+ */
61
63
  this.nodeKey = translator.node(data.Node);
62
64
 
63
65
  /**
@@ -140,7 +142,7 @@ class Invasion extends WorldstateObject {
140
142
  * Grineer vs. Corpus invasions start at 50, Infested invasions start at 100
141
143
  * @type {number}
142
144
  */
143
- this.completion = (1 + (data.Count / data.Goal)) * (this.vsInfestation ? 100 : 50);
145
+ this.completion = (1 + data.Count / data.Goal) * (this.vsInfestation ? 100 : 50);
144
146
 
145
147
  /**
146
148
  * Whether the invasion has finished
@@ -211,8 +213,7 @@ class Invasion extends WorldstateObject {
211
213
  ];
212
214
  } else {
213
215
  lines = [
214
- `${this.attackingFaction} (${this.attackerReward}) vs. `
215
- + `${this.defendingFaction} (${this.defenderReward})`,
216
+ `${this.attackingFaction} (${this.attackerReward}) vs. ${this.defendingFaction} (${this.defenderReward})`,
216
217
  `${this.node} - ${this.desc}`,
217
218
  `${Math.round(this.completion * 100) / 100}% - ETA: ${this.getETAString()}`,
218
219
  ];
package/lib/Kuva.js CHANGED
@@ -48,6 +48,8 @@ const scrub = (mission) => {
48
48
  /* eslint-enable no-param-reassign */
49
49
  };
50
50
 
51
+ const hash = (str) => require('crypto').createHash('sha256').update(str, 'utf8').digest('hex');
52
+
51
53
  /**
52
54
  * Parse kuva & arbitration data
53
55
  * @param {Object} data Data to split for kuva/arbitration
@@ -64,12 +66,20 @@ const parse = (data, translator, locale) => {
64
66
  expiry: new Date(mission.end),
65
67
  ...mission.solnodedata,
66
68
  node: translator.node(mission.solnode, locale),
69
+ nodeKey: translator.node(mission.solnode, 'en'),
67
70
  type: translator.nodeMissionType(mission.solnode, locale),
71
+ typeKey: translator.nodeMissionType(mission.solnode, 'en'),
68
72
  };
69
73
  truncateTime(p);
70
- if ((p.activation < now && now < p.expiry)
71
- && new Date(p.activation.getTime() + HOURS_2) > now
72
- && new Date(p.expiry.getTime() - HOURS_2) < now) {
74
+ p.id = hash(JSON.stringify(p));
75
+ p.expired = Date.now() - p.expiry.getTime() < 0;
76
+
77
+ if (
78
+ p.activation < now &&
79
+ now < p.expiry &&
80
+ new Date(p.activation.getTime() + HOURS_2) > now &&
81
+ new Date(p.expiry.getTime() - HOURS_2) < now
82
+ ) {
73
83
  if (mission.missiontype === 'EliteAlertMission') {
74
84
  // if the diff is less than 2 hours?
75
85
  parsed.arbitration = p;
@@ -88,10 +98,8 @@ const parse = (data, translator, locale) => {
88
98
  * @property {ExternalMission[]} kuva currently active kuva missions
89
99
  * @property {ExternalMission} arbitration current arbitration
90
100
  */
91
- class Kuva {
92
- constructor({
93
- kuvaData, translator, locale, logger,
94
- }) {
101
+ module.exports = class Kuva {
102
+ constructor({ kuvaData, translator, locale, logger }) {
95
103
  /**
96
104
  * The translation functions
97
105
  * @type {Translator}
@@ -116,6 +124,4 @@ class Kuva {
116
124
  ({ kuva: this.kuva, arbitration: this.arbitration } = parsed);
117
125
  }
118
126
  }
119
- }
120
-
121
- module.exports = Kuva;
127
+ };
package/lib/Mission.js CHANGED
@@ -3,7 +3,7 @@
3
3
  /**
4
4
  * Represents an in-game mission
5
5
  */
6
- class Mission {
6
+ module.exports = class Mission {
7
7
  /**
8
8
  * @param {Object} data The mission data
9
9
  * @param {Object} deps The dependencies object
@@ -12,11 +12,12 @@ class Mission {
12
12
  * @param {Reward} deps.Reward The Reward parser
13
13
  * @param {string} deps.locale Locale to use for translations
14
14
  */
15
- constructor(data, {
16
- mdConfig, translator, Reward, locale,
17
- }) {
15
+ constructor(data, { mdConfig, translator, Reward, locale }) {
18
16
  const deps = {
19
- mdConfig, translator, Reward, locale,
17
+ mdConfig,
18
+ translator,
19
+ Reward,
20
+ locale,
20
21
  };
21
22
 
22
23
  /**
@@ -37,7 +38,13 @@ class Mission {
37
38
  * The node where the mission takes place
38
39
  * @type {string}
39
40
  */
40
- this.node = translator.node(data.location, locale);
41
+ this.node = translator.node(data.location || data.node, locale);
42
+
43
+ /**
44
+ * Unlocalized {@link mission#node}
45
+ * @type {string}
46
+ */
47
+ this.nodeKey = translator.node(data.location || data.node, 'en');
41
48
 
42
49
  /**
43
50
  * The mission's type
@@ -45,19 +52,29 @@ class Mission {
45
52
  */
46
53
  this.type = translator.missionType(data.missionType, locale);
47
54
 
55
+ /**
56
+ * The mission's type
57
+ * @type {string}
58
+ */
59
+ this.typeKey = translator.missionType(data.missionType, 'en');
60
+
48
61
  /**
49
62
  * The factions that the players must fight in the mission
50
63
  * @type {string}
51
64
  */
52
65
  this.faction = translator.faction(data.faction, locale);
53
66
 
67
+ /**
68
+ * The factions that the players must fight in the mission
69
+ * @type {string}
70
+ */
71
+ this.faction = translator.faction(data.faction, 'en');
72
+
54
73
  /**
55
74
  * The mission's reward
56
75
  * @type {?Reward}
57
76
  */
58
- this.reward = data.missionReward
59
- ? new Reward(data.missionReward, deps)
60
- : undefined;
77
+ this.reward = data.missionReward ? new Reward(data.missionReward, deps) : undefined;
61
78
 
62
79
  /**
63
80
  * The minimum level of the enemies in the mission
@@ -111,15 +128,13 @@ class Mission {
111
128
  * Array of strings denoting extra spawners for a mission
112
129
  * @type {string[]}
113
130
  */
114
- this.advancedSpawners = (data.advancedSpawners || [])
115
- .map((spawner) => translator.languageString(spawner, locale));
131
+ this.advancedSpawners = (data.advancedSpawners || []).map((spawner) => translator.languageString(spawner, locale));
116
132
 
117
133
  /**
118
134
  * Items required to enter the mission
119
135
  * @type {string[]}
120
136
  */
121
- this.requiredItems = (data.requiredItems || [])
122
- .map((reqItem) => translator.languageString(reqItem, locale));
137
+ this.requiredItems = (data.requiredItems || []).map((reqItem) => translator.languageString(reqItem, locale));
123
138
 
124
139
  /**
125
140
  * Whether or not the required items are consumed
@@ -149,8 +164,7 @@ class Mission {
149
164
  * Affectors for this mission
150
165
  * @type {string[]}
151
166
  */
152
- this.levelAuras = (data.levelAuras || [])
153
- .map((aura) => translator.languageString(aura, locale));
167
+ this.levelAuras = (data.levelAuras || []).map((aura) => translator.languageString(aura, locale));
154
168
 
155
169
  /**
156
170
  * Only weapon allowed for the mission
@@ -164,9 +178,7 @@ class Mission {
164
178
  * @returns {string}
165
179
  */
166
180
  toString() {
167
- const lines = [
168
- this.reward.toString(),
169
- ];
181
+ const lines = [this.reward.toString()];
170
182
 
171
183
  lines.push(`${this.faction} (${this.type})`);
172
184
  lines.push(this.node);
@@ -174,6 +186,4 @@ class Mission {
174
186
 
175
187
  return lines.join(this.mdConfig.lineEnd);
176
188
  }
177
- }
178
-
179
- module.exports = Mission;
189
+ };
package/lib/News.js CHANGED
@@ -48,7 +48,7 @@ class News extends WorldstateObject {
48
48
  * @type {string}
49
49
  */
50
50
  this.link = data.Prop;
51
- if ((!this.link || !this.link.length) && (data.Links && data.Links.length)) {
51
+ if ((!this.link || !this.link.length) && data.Links && data.Links.length) {
52
52
  this.link = (data.Links.find((l) => l.LanguageCode === locale) || { Link: 'https://www.warframe.com/' }).Link;
53
53
  }
54
54
 
@@ -58,7 +58,7 @@ class News extends WorldstateObject {
58
58
  */
59
59
  this.imageLink = (data.ImageUrl || 'https://i.imgur.com/CNrsc7V.png')
60
60
  .replace('https://forums.warframe.com/applications/core/interface/imageproxy/imageproxy.php?img=', '')
61
- .replace(/&key=\w*/ig, '')
61
+ .replace(/&key=\w*/gi, '')
62
62
  .replace('http://', 'https://');
63
63
 
64
64
  /**
@@ -77,17 +77,13 @@ class News extends WorldstateObject {
77
77
  * The date at which the event starts
78
78
  * @type {?Date}
79
79
  */
80
- this.startDate = data.EventStartDate
81
- ? timeDate.parseDate(data.EventStartDate)
82
- : undefined;
80
+ this.startDate = data.EventStartDate ? timeDate.parseDate(data.EventStartDate) : undefined;
83
81
 
84
82
  /**
85
83
  * The date at which the event ends
86
84
  * @type {?Date}
87
85
  */
88
- this.endDate = data.EventEndDate
89
- ? timeDate.parseDate(data.EventEndDate)
90
- : undefined;
86
+ this.endDate = data.EventEndDate ? timeDate.parseDate(data.EventEndDate) : undefined;
91
87
 
92
88
  /**
93
89
  * ETA string (at time of object creation)
@@ -172,17 +168,19 @@ class News extends WorldstateObject {
172
168
  * @returns {string}
173
169
  */
174
170
  toString() {
175
- return `[${this.getETAString()}] ${this.mdConfig.linkBegin}${this.message}`
176
- + `${this.mdConfig.linkMid}${this.link}${this.mdConfig.linkEnd}`;
171
+ return (
172
+ `[${this.getETAString()}] ${this.mdConfig.linkBegin}${this.message}` +
173
+ `${this.mdConfig.linkMid}${this.link}${this.mdConfig.linkEnd}`
174
+ );
177
175
  }
178
176
 
179
177
  /**
180
- * The title of the news item in the specified language
181
- * @param {string} langCode Ex. 'es', 'de', 'fr'
182
- * @returns {string}
183
- */
178
+ * The title of the news item in the specified language
179
+ * @param {string} langCode Ex. 'es', 'de', 'fr'
180
+ * @returns {string}
181
+ */
184
182
  getTitle(langCode) {
185
- return (langCode in this.translations) ? this.translations[langCode] : this.message;
183
+ return langCode in this.translations ? this.translations[langCode] : this.message;
186
184
  }
187
185
  }
188
186
 
package/lib/Nightwave.js CHANGED
@@ -18,15 +18,18 @@ class Nightwave extends WorldstateObject {
18
18
  * @param {Reward} deps.Reward The Reward parser
19
19
  * @param {string} deps.locale Locale to use for translations
20
20
  */
21
- constructor(data, {
22
- mdConfig, translator, timeDate, Mission, Reward, locale,
23
- }) {
21
+ constructor(data, { mdConfig, translator, timeDate, Mission, Reward, locale }) {
24
22
  super(data, { timeDate });
25
23
 
26
24
  this.id = `nightwave${new Date(this.expiry).getTime()}`;
27
25
 
28
26
  const deps = {
29
- mdConfig, translator, timeDate, Mission, Reward, locale,
27
+ mdConfig,
28
+ translator,
29
+ timeDate,
30
+ Mission,
31
+ Reward,
32
+ locale,
30
33
  };
31
34
 
32
35
  /**
@@ -16,9 +16,7 @@ class NightwaveChallenge extends WorldstateObject {
16
16
  * @param {TimeDateFunctions} deps.timeDate The time and date functions
17
17
  * @param {string} deps.locale Locale to use for translations
18
18
  */
19
- constructor(data, {
20
- translator, timeDate, locale,
21
- }) {
19
+ constructor(data, { translator, timeDate, locale }) {
22
20
  super(data, { timeDate });
23
21
 
24
22
  /**
@@ -31,7 +29,7 @@ class NightwaveChallenge extends WorldstateObject {
31
29
  * Whether or not the challenge is an elite challenge
32
30
  * @type {Boolean}
33
31
  */
34
- this.isElite = /hard/ig.test(data.Challenge);
32
+ this.isElite = /hard/gi.test(data.Challenge);
35
33
 
36
34
  /**
37
35
  * The descriptor for this challenge
@@ -13,9 +13,7 @@ class PersistentEnemy extends WorldstateObject {
13
13
  * @param {Translator} deps.translator The string translator
14
14
  * @param {string} deps.locale Locale to use for translations
15
15
  */
16
- constructor(data, {
17
- mdConfig, translator, timeDate, locale,
18
- }) {
16
+ constructor(data, { mdConfig, translator, timeDate, locale }) {
19
17
  super(data, { timeDate });
20
18
 
21
19
  /**