warframe-worldstate-parser 4.0.1 → 4.1.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,7 @@ 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';
|
|
33
34
|
|
|
34
35
|
const { sortieData } = wsData;
|
|
35
36
|
|
|
@@ -126,6 +127,7 @@ export class WorldState {
|
|
|
126
127
|
throw new TypeError(`json needs to be a string, provided ${typeof json} : ${JSON.stringify(json)}`);
|
|
127
128
|
}
|
|
128
129
|
const data = JSON.parse(json);
|
|
130
|
+
const tmp = JSON.parse(data.Tmp);
|
|
129
131
|
|
|
130
132
|
// eslint-disable-next-line no-param-reassign
|
|
131
133
|
deps = {
|
|
@@ -342,7 +344,7 @@ export class WorldState {
|
|
|
342
344
|
* Current sentient outposts
|
|
343
345
|
* @type {SentientOutpost}
|
|
344
346
|
*/
|
|
345
|
-
this.sentientOutposts = new SentientOutpost(
|
|
347
|
+
this.sentientOutposts = new SentientOutpost(tmp.sfn, deps);
|
|
346
348
|
|
|
347
349
|
/**
|
|
348
350
|
* Steel path offering rotation
|
|
@@ -361,6 +363,8 @@ export class WorldState {
|
|
|
361
363
|
deps.duviriChoices = parseArray(DuviriChoice, data.EndlessXpChoices, deps);
|
|
362
364
|
|
|
363
365
|
this.duviriCycle = new DuviriCycle(deps);
|
|
366
|
+
|
|
367
|
+
this.kinepage = new Kinepage(tmp.pgr, deps.locale);
|
|
364
368
|
}
|
|
365
369
|
}
|
|
366
370
|
|
|
@@ -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(
|
|
45
|
-
|
|
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
|
@@ -148,6 +148,7 @@ export class WorldState {
|
|
|
148
148
|
*/
|
|
149
149
|
steelPath: SteelPathOffering;
|
|
150
150
|
duviriCycle: DuviriCycle;
|
|
151
|
+
kinepage: Kinepage;
|
|
151
152
|
}
|
|
152
153
|
declare function _default(json: any, deps: any): Promise<WorldState>;
|
|
153
154
|
export default _default;
|
|
@@ -177,3 +178,4 @@ import Nightwave from './models/Nightwave.js';
|
|
|
177
178
|
import SentientOutpost from './models/SentientOutpost.js';
|
|
178
179
|
import SteelPathOffering from './models/SteelPathOffering.js';
|
|
179
180
|
import DuviriCycle from './models/DuviriCycle.js';
|
|
181
|
+
import Kinepage from './models/Kinepage.js';
|
|
@@ -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(
|
|
22
|
+
constructor(sfn: any, { locale, sentientData, logger }: {
|
|
23
23
|
locale: any;
|
|
24
24
|
sentientData: any;
|
|
25
25
|
logger: any;
|