warframe-worldstate-parser 4.2.2 → 4.3.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.
package/lib/WorldState.js
CHANGED
|
@@ -32,6 +32,7 @@ import WorldEvent from './models/WorldEvent.js';
|
|
|
32
32
|
import News from './models/News.js';
|
|
33
33
|
import Kinepage from './models/Kinepage.js';
|
|
34
34
|
import DeepArchimedea from './models/DeepArchidemea.js';
|
|
35
|
+
import Calendar from './models/Calendar.js';
|
|
35
36
|
|
|
36
37
|
const { sortieData } = wsData;
|
|
37
38
|
|
|
@@ -376,6 +377,8 @@ export class WorldState {
|
|
|
376
377
|
*/
|
|
377
378
|
this.deepArchimedea = new DeepArchimedea(activation, expiry, tmp.lqo27);
|
|
378
379
|
}
|
|
380
|
+
|
|
381
|
+
this.calendar = parseArray(Calendar, data.KnownCalendarSeasons, deps);
|
|
379
382
|
}
|
|
380
383
|
}
|
|
381
384
|
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {
|
|
2
|
+
languageDesc,
|
|
3
|
+
languageString,
|
|
4
|
+
parseDate,
|
|
5
|
+
translateCalendarEvent,
|
|
6
|
+
translateSeason,
|
|
7
|
+
} from 'warframe-worldstate-data/utilities';
|
|
8
|
+
|
|
9
|
+
const EventTypes = Object.freeze({
|
|
10
|
+
PLOT: 'CET_PLOT',
|
|
11
|
+
REWARD: 'CET_REWARD',
|
|
12
|
+
CHALLENGE: 'CET_CHALLENGE',
|
|
13
|
+
UPGRADE: 'CET_UPGRADE',
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Event data for a 1999 calendar day
|
|
18
|
+
* @param {object} event raw event data
|
|
19
|
+
*/
|
|
20
|
+
class DayEvent {
|
|
21
|
+
constructor(event) {
|
|
22
|
+
this.type = translateCalendarEvent(event.type);
|
|
23
|
+
|
|
24
|
+
if (event.challenge) this.challenge = this.eventDescription(event.challenge);
|
|
25
|
+
|
|
26
|
+
if (event.upgrade) this.upgrade = this.eventDescription(event.upgrade);
|
|
27
|
+
|
|
28
|
+
if (event.reward) this.reward = languageString(event.reward);
|
|
29
|
+
|
|
30
|
+
if (event.type === EventTypes.PLOT) {
|
|
31
|
+
this.dialogueName = event.dialogueName;
|
|
32
|
+
this.dialogueConvo = event.dialogueConvo;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
eventDescription(name) {
|
|
37
|
+
return { title: languageString(name), description: languageDesc(name) };
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default class Calendar {
|
|
42
|
+
constructor(calendar) {
|
|
43
|
+
this.activation = parseDate(calendar.Activation);
|
|
44
|
+
|
|
45
|
+
this.expiry = parseDate(calendar.Expiry);
|
|
46
|
+
|
|
47
|
+
this.days = Array.isArray(calendar.Days)
|
|
48
|
+
? calendar.Days.filter(Boolean).map((d) => ({ ...d, events: d.events.map((e) => new DayEvent(e)) }))
|
|
49
|
+
: [];
|
|
50
|
+
|
|
51
|
+
this.season = translateSeason(calendar.Season);
|
|
52
|
+
|
|
53
|
+
this.yearIteration = calendar.YearIteration;
|
|
54
|
+
|
|
55
|
+
this.version = calendar.Version;
|
|
56
|
+
|
|
57
|
+
this.requirements = calendar.UpgradeAvaliabilityRequirements;
|
|
58
|
+
}
|
|
59
|
+
}
|
package/lib/models/WorldEvent.js
CHANGED
|
@@ -268,6 +268,12 @@ export default class WorldEvent extends WorldstateObject {
|
|
|
268
268
|
if (data.JobAffiliationTag) {
|
|
269
269
|
this.affiliatedWith = syndicate(data.JobAffiliationTag, locale);
|
|
270
270
|
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* The event's tag
|
|
274
|
+
* @type {string}
|
|
275
|
+
*/
|
|
276
|
+
this.tag = data.Tag;
|
|
271
277
|
}
|
|
272
278
|
|
|
273
279
|
/**
|
package/package.json
CHANGED
|
@@ -167,6 +167,11 @@ export default class WorldEvent extends WorldstateObject {
|
|
|
167
167
|
activation: any;
|
|
168
168
|
};
|
|
169
169
|
affiliatedWith: any;
|
|
170
|
+
/**
|
|
171
|
+
* The event's tag
|
|
172
|
+
* @type {string}
|
|
173
|
+
*/
|
|
174
|
+
tag: string;
|
|
170
175
|
/**
|
|
171
176
|
* Get whether the event has expired
|
|
172
177
|
* @returns {boolean} whether the event has expired
|