warframe-worldstate-parser 2.32.0 → 3.0.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/README.md +1 -0
- package/lib/WorldState.js +60 -94
- package/lib/models/Alert.js +18 -44
- package/lib/models/CambionCycle.js +8 -12
- package/lib/models/CetusCycle.js +34 -54
- package/lib/models/ChallengeInstance.js +11 -14
- package/lib/models/ConclaveChallenge.js +24 -44
- package/lib/models/ConstructionProgress.js +10 -22
- package/lib/models/DailyDeal.js +15 -34
- package/lib/models/DarkSector.js +14 -25
- package/lib/models/DarkSectorBattle.js +6 -8
- package/lib/models/DuviriCycle.js +9 -10
- package/lib/models/EarthCycle.js +36 -35
- package/lib/models/Fissure.js +36 -44
- package/lib/models/FlashSale.js +17 -37
- package/lib/models/GlobalUpgrade.js +23 -41
- package/lib/models/Invasion.js +37 -79
- package/lib/models/Kuva.js +20 -26
- package/lib/models/Mission.js +28 -38
- package/lib/models/News.js +34 -54
- package/lib/models/Nightwave.js +22 -48
- package/lib/models/NightwaveChallenge.js +15 -19
- package/lib/models/PersistentEnemy.js +21 -30
- package/lib/models/Reward.js +18 -20
- package/lib/models/SentientOutpost.js +11 -12
- package/lib/models/Simaris.js +9 -21
- package/lib/models/Sortie.js +36 -54
- package/lib/models/SortieVariant.js +23 -25
- package/lib/models/SteelPathOffering.js +26 -9
- package/lib/models/SyndicateJob.js +20 -30
- package/lib/models/SyndicateMission.js +22 -52
- package/lib/models/VallisCycle.js +37 -45
- package/lib/models/VoidTrader.js +35 -54
- package/lib/models/VoidTraderItem.js +5 -8
- package/lib/models/VoidTraderSchedule.js +7 -6
- package/lib/models/WeeklyChallenge.js +9 -17
- package/lib/models/WorldEvent.js +49 -74
- package/lib/models/WorldstateObject.js +23 -34
- package/lib/models/ZarimanCycle.js +34 -54
- package/lib/supporting/Dependency.js +2 -11
- package/lib/supporting/DuviriChoice.js +1 -5
- package/lib/supporting/ExternalMission.js +2 -6
- package/lib/supporting/MarkdownSettings.js +15 -19
- package/lib/supporting/RewardData.js +4 -6
- package/lib/supporting/RewardTypes.js +2 -4
- package/lib/utilities/integrity.js +11 -0
- package/lib/utilities/timeDate.js +16 -18
- package/lib/utilities/translation.js +188 -56
- package/main.js +2 -2
- package/package.json +3 -5
- package/types/lib/WorldState.d.ts +39 -28
- package/types/lib/models/Alert.d.ts +13 -24
- package/types/lib/models/CambionCycle.d.ts +5 -10
- package/types/lib/models/CetusCycle.d.ts +8 -26
- package/types/lib/models/ChallengeInstance.d.ts +7 -9
- package/types/lib/models/ConclaveChallenge.d.ts +11 -24
- package/types/lib/models/ConstructionProgress.d.ts +5 -16
- package/types/lib/models/DailyDeal.d.ts +7 -26
- package/types/lib/models/DarkSector.d.ts +11 -22
- package/types/lib/models/DarkSectorBattle.d.ts +3 -6
- package/types/lib/models/DuviriCycle.d.ts +5 -11
- package/types/lib/models/EarthCycle.d.ts +40 -17
- package/types/lib/models/Fissure.d.ts +10 -17
- package/types/lib/models/FlashSale.d.ts +8 -29
- package/types/lib/models/GlobalUpgrade.d.ts +8 -27
- package/types/lib/models/Invasion.d.ts +18 -53
- package/types/lib/models/Kuva.d.ts +10 -21
- package/types/lib/models/Mission.d.ts +11 -23
- package/types/lib/models/News.d.ts +18 -31
- package/types/lib/models/Nightwave.d.ts +12 -29
- package/types/lib/models/NightwaveChallenge.d.ts +10 -15
- package/types/lib/models/PersistentEnemy.d.ts +9 -20
- package/types/lib/models/Reward.d.ts +34 -18
- package/types/lib/models/SentientOutpost.d.ts +9 -13
- package/types/lib/models/Simaris.d.ts +6 -17
- package/types/lib/models/Sortie.d.ts +16 -25
- package/types/lib/models/SortieVariant.d.ts +13 -15
- package/types/lib/models/SteelPathOffering.d.ts +5 -8
- package/types/lib/models/SyndicateJob.d.ts +13 -14
- package/types/lib/models/SyndicateMission.d.ts +9 -22
- package/types/lib/models/VallisCycle.d.ts +28 -18
- package/types/lib/models/VoidTrader.d.ts +8 -21
- package/types/lib/models/VoidTraderItem.d.ts +4 -6
- package/types/lib/models/VoidTraderSchedule.d.ts +5 -8
- package/types/lib/models/WeeklyChallenge.d.ts +5 -14
- package/types/lib/models/WorldEvent.d.ts +38 -52
- package/types/lib/models/WorldstateObject.d.ts +46 -24
- package/types/lib/models/ZarimanCycle.d.ts +9 -27
- package/types/lib/supporting/Dependency.d.ts +2 -8
- package/types/lib/supporting/DuviriChoice.d.ts +1 -2
- package/types/lib/supporting/ExternalMission.d.ts +3 -7
- package/types/lib/supporting/MarkdownSettings.d.ts +29 -15
- package/types/lib/supporting/RewardData.d.ts +8 -2
- package/types/lib/supporting/RewardTypes.d.ts +2 -2
- package/types/lib/utilities/integrity.d.ts +1 -0
- package/types/lib/utilities/timeDate.d.ts +19 -12
- package/types/lib/utilities/translation.d.ts +188 -23
- package/types/main.d.ts +2 -4
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* External mission data retrieved from https://10o.io/kuvalog.json
|
|
5
|
-
* @typedef {
|
|
3
|
+
* @typedef {object} ExternalMission
|
|
6
4
|
* @property {Date} activation start time
|
|
7
5
|
* @property {Date} expiry end timer
|
|
8
6
|
* @property {string} node formatted node name with planet
|
|
@@ -12,6 +10,4 @@
|
|
|
12
10
|
* @property {boolean} sharkwing whether or not the tile requires
|
|
13
11
|
* sumbersible archwing
|
|
14
12
|
*/
|
|
15
|
-
class ExternalMission {}
|
|
16
|
-
|
|
17
|
-
module.exports = ExternalMission;
|
|
13
|
+
export default class ExternalMission {}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* A collection of strings that are used by the parser to produce markdown-formatted text
|
|
5
3
|
* @property {string} lineEnd - Line return character
|
|
@@ -15,20 +13,18 @@
|
|
|
15
13
|
* @property {string} codeLine - String for denoting in-line code
|
|
16
14
|
* @property {string} codeBlock - String for denoting multi-line code blocks
|
|
17
15
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
};
|
|
16
|
+
export default class MarkdownSettings {
|
|
17
|
+
static lineEnd = '\n';
|
|
18
|
+
static blockEnd = '\n```';
|
|
19
|
+
static doubleReturn = '\n\n';
|
|
20
|
+
static linkBegin = '[';
|
|
21
|
+
static linkMid = '](';
|
|
22
|
+
static linkEnd = ')';
|
|
23
|
+
static bold = '**';
|
|
24
|
+
static italic = '*';
|
|
25
|
+
static underline = '__';
|
|
26
|
+
static strike = '~~';
|
|
27
|
+
static codeLine = '`';
|
|
28
|
+
static codeBlock = '```';
|
|
29
|
+
static spoiler = '||';
|
|
30
|
+
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const resources = [
|
|
1
|
+
export const resources = [
|
|
4
2
|
'Alloy Plate',
|
|
5
3
|
'Argon Crystal',
|
|
6
4
|
'Circuits',
|
|
@@ -22,7 +20,7 @@ const resources = [
|
|
|
22
20
|
];
|
|
23
21
|
|
|
24
22
|
// Aura names
|
|
25
|
-
const auras = [
|
|
23
|
+
export const auras = [
|
|
26
24
|
'Brief Respite',
|
|
27
25
|
'Corrosive Projection',
|
|
28
26
|
'Dead Eye',
|
|
@@ -50,7 +48,7 @@ const auras = [
|
|
|
50
48
|
];
|
|
51
49
|
|
|
52
50
|
// Nightmare mod names
|
|
53
|
-
const nightmare = [
|
|
51
|
+
export const nightmare = [
|
|
54
52
|
'Accelerated Blast',
|
|
55
53
|
'Animal Instinct',
|
|
56
54
|
'Armored Agility',
|
|
@@ -72,7 +70,7 @@ const nightmare = [
|
|
|
72
70
|
'Vigor',
|
|
73
71
|
];
|
|
74
72
|
|
|
75
|
-
|
|
73
|
+
export default {
|
|
76
74
|
nightmare,
|
|
77
75
|
auras,
|
|
78
76
|
resources,
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const { auras, nightmare, resources } = require('./RewardData');
|
|
1
|
+
import { auras, nightmare, resources } from './RewardData.js';
|
|
4
2
|
|
|
5
3
|
/**
|
|
6
4
|
* All possible RewardTypes
|
|
7
5
|
* @type {Array.<RewardType>}
|
|
8
6
|
*/
|
|
9
|
-
|
|
7
|
+
export default [
|
|
10
8
|
{
|
|
11
9
|
name: 'vauban',
|
|
12
10
|
description: 'Vauban parts',
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
2
|
+
export const insist = (thing, ...args) => {
|
|
3
|
+
if (!thing || !Object.keys(thing).length) {
|
|
4
|
+
throw new TypeError(`The provided data does not have the required properties.`);
|
|
5
|
+
}
|
|
6
|
+
args.forEach((arg) => {
|
|
7
|
+
if (!thing[arg]) {
|
|
8
|
+
throw new TypeError(`The provided data does not have the required properties.`);
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
const epochZero = {
|
|
4
2
|
$date: {
|
|
5
3
|
$numberLong: 0,
|
|
@@ -8,9 +6,9 @@ const epochZero = {
|
|
|
8
6
|
|
|
9
7
|
/**
|
|
10
8
|
* @param {number} millis The number of milliseconds in the time delta
|
|
11
|
-
* @returns {string}
|
|
9
|
+
* @returns {string} formatted time delta
|
|
12
10
|
*/
|
|
13
|
-
function timeDeltaToString(millis) {
|
|
11
|
+
export function timeDeltaToString(millis) {
|
|
14
12
|
if (typeof millis !== 'number') {
|
|
15
13
|
throw new TypeError('millis should be a number');
|
|
16
14
|
}
|
|
@@ -43,29 +41,29 @@ function timeDeltaToString(millis) {
|
|
|
43
41
|
/**
|
|
44
42
|
* Returns the number of milliseconds between now and a given date
|
|
45
43
|
* @param {Date} d The date from which the current time will be subtracted
|
|
46
|
-
* @param {
|
|
47
|
-
* @returns {number}
|
|
44
|
+
* @param {Function} [now] A function that returns the current UNIX time in milliseconds
|
|
45
|
+
* @returns {number} The number of milliseconds after the given date to now
|
|
48
46
|
*/
|
|
49
|
-
function fromNow(d, now = Date.now) {
|
|
47
|
+
export function fromNow(d, now = Date.now) {
|
|
50
48
|
return d.getTime() - now();
|
|
51
49
|
}
|
|
52
50
|
|
|
53
51
|
/**
|
|
54
52
|
* Returns the number of milliseconds between a given date and now
|
|
55
53
|
* @param {Date} d The date that the current time will be subtracted from
|
|
56
|
-
* @param {
|
|
57
|
-
* @returns {number}
|
|
54
|
+
* @param {Function} [now] A function that returns the current UNIX time in milliseconds
|
|
55
|
+
* @returns {number} The number of milliseconds after now to the given date
|
|
58
56
|
*/
|
|
59
|
-
function toNow(d, now = Date.now) {
|
|
57
|
+
export function toNow(d, now = Date.now) {
|
|
60
58
|
return now() - d.getTime();
|
|
61
59
|
}
|
|
62
60
|
|
|
63
61
|
/**
|
|
64
62
|
* Returns a new Date constructed from a worldState date object
|
|
65
|
-
* @param {
|
|
66
|
-
* @returns {Date}
|
|
63
|
+
* @param {object} d The worldState date object
|
|
64
|
+
* @returns {Date} parsed date from DE date format
|
|
67
65
|
*/
|
|
68
|
-
function parseDate(d) {
|
|
66
|
+
export function parseDate(d) {
|
|
69
67
|
const safeD = d || epochZero;
|
|
70
68
|
const dt = safeD.$date || epochZero.$date;
|
|
71
69
|
return new Date(safeD.$date ? Number(dt.$numberLong) : 1000 * d.sec);
|
|
@@ -73,14 +71,14 @@ function parseDate(d) {
|
|
|
73
71
|
|
|
74
72
|
/**
|
|
75
73
|
* An object containing functions to format dates and times
|
|
76
|
-
* @typedef {
|
|
77
|
-
* @property {
|
|
78
|
-
* @property {
|
|
74
|
+
* @typedef {Record<string, Function>} TimeDateFunctions
|
|
75
|
+
* @property {Function} timeDeltaToString - Converts a time difference to a string
|
|
76
|
+
* @property {Function} fromNow - Returns the number of milliseconds between now and
|
|
79
77
|
* a given date
|
|
80
|
-
* @property {
|
|
78
|
+
* @property {Function} toNow - Returns the number of milliseconds between a given
|
|
81
79
|
* date and now
|
|
82
80
|
*/
|
|
83
|
-
|
|
81
|
+
export default {
|
|
84
82
|
timeDeltaToString,
|
|
85
83
|
fromNow,
|
|
86
84
|
toNow,
|
|
@@ -1,28 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
import data from 'warframe-worldstate-data';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Rough Titlecase!
|
|
5
|
+
* @param {string} str string to be titlecased
|
|
6
|
+
* @returns {string} titlecased string
|
|
7
|
+
*/
|
|
8
|
+
export function toTitleCase(str) {
|
|
6
9
|
return str.replace(/\w\S*/g, (txt) => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase());
|
|
7
10
|
}
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Utility function to split the resource name and return somewhat human-readable string
|
|
14
|
+
* @param {string} str localization resource key
|
|
15
|
+
* @returns {string} human-readable string
|
|
16
|
+
*/
|
|
17
|
+
export function splitResourceName(str) {
|
|
10
18
|
return str
|
|
11
19
|
.split(/([A-Z]?[^A-Z]*)/g)
|
|
12
|
-
.filter(
|
|
20
|
+
.filter(Boolean)
|
|
13
21
|
.join(' ');
|
|
14
22
|
}
|
|
15
23
|
|
|
16
24
|
const i18n = (locale = 'en') => data[locale] || data;
|
|
17
25
|
|
|
18
|
-
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @param {string} key - The data key
|
|
29
|
+
* @param {string} dataOverride locale for use with translation
|
|
30
|
+
* @returns {string} faction name
|
|
31
|
+
*/
|
|
32
|
+
export function faction(key, dataOverride) {
|
|
19
33
|
if (key in i18n(dataOverride).factions) {
|
|
20
34
|
return i18n(dataOverride).factions[key].value;
|
|
21
35
|
}
|
|
22
36
|
return key;
|
|
23
37
|
}
|
|
24
38
|
|
|
25
|
-
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @param {string} key - The data key
|
|
42
|
+
* @param {string} dataOverride locale for use with translation
|
|
43
|
+
* @returns {string} node name
|
|
44
|
+
*/
|
|
45
|
+
export function node(key, dataOverride) {
|
|
26
46
|
if (key in i18n(dataOverride).solNodes) {
|
|
27
47
|
return i18n(dataOverride).solNodes[key].value;
|
|
28
48
|
}
|
|
@@ -32,7 +52,13 @@ function node(key, dataOverride) {
|
|
|
32
52
|
return key;
|
|
33
53
|
}
|
|
34
54
|
|
|
35
|
-
|
|
55
|
+
/**
|
|
56
|
+
*
|
|
57
|
+
* @param {string} key - The data key
|
|
58
|
+
* @param {string} dataOverride locale for use with translation
|
|
59
|
+
* @returns {string} mission type of the node
|
|
60
|
+
*/
|
|
61
|
+
export function nodeMissionType(key, dataOverride) {
|
|
36
62
|
if (key in i18n(dataOverride).solNodes) {
|
|
37
63
|
return i18n(dataOverride).solNodes[key].type;
|
|
38
64
|
}
|
|
@@ -42,7 +68,13 @@ function nodeMissionType(key, dataOverride) {
|
|
|
42
68
|
return key;
|
|
43
69
|
}
|
|
44
70
|
|
|
45
|
-
|
|
71
|
+
/**
|
|
72
|
+
*
|
|
73
|
+
* @param {string} key - The data key
|
|
74
|
+
* @param {string} dataOverride locale for use with translation
|
|
75
|
+
* @returns {string} faction that controls the node
|
|
76
|
+
*/
|
|
77
|
+
export function nodeEnemy(key, dataOverride) {
|
|
46
78
|
if (key in i18n(dataOverride).solNodes) {
|
|
47
79
|
return i18n(dataOverride).solNodes[key].enemy;
|
|
48
80
|
}
|
|
@@ -52,7 +84,13 @@ function nodeEnemy(key, dataOverride) {
|
|
|
52
84
|
return key;
|
|
53
85
|
}
|
|
54
86
|
|
|
55
|
-
|
|
87
|
+
/**
|
|
88
|
+
*
|
|
89
|
+
* @param {string} key - The data key
|
|
90
|
+
* @param {string} dataOverride locale for use with translation
|
|
91
|
+
* @returns {string} localization for language string
|
|
92
|
+
*/
|
|
93
|
+
export function languageString(key, dataOverride) {
|
|
56
94
|
const lowerKey = String(key).toLowerCase();
|
|
57
95
|
if (lowerKey in i18n(dataOverride).languages) {
|
|
58
96
|
return i18n(dataOverride).languages[lowerKey].value;
|
|
@@ -66,7 +104,13 @@ function languageString(key, dataOverride) {
|
|
|
66
104
|
return key;
|
|
67
105
|
}
|
|
68
106
|
|
|
69
|
-
|
|
107
|
+
/**
|
|
108
|
+
*
|
|
109
|
+
* @param {string} key - The data key
|
|
110
|
+
* @param {string} dataOverride locale for use with translation
|
|
111
|
+
* @returns {string} localization for language description
|
|
112
|
+
*/
|
|
113
|
+
export function languageDesc(key, dataOverride) {
|
|
70
114
|
const lowerKey = String(key).toLowerCase();
|
|
71
115
|
if (lowerKey in i18n(dataOverride).languages) {
|
|
72
116
|
return i18n(dataOverride).languages[lowerKey].desc;
|
|
@@ -80,7 +124,13 @@ function languageDesc(key, dataOverride) {
|
|
|
80
124
|
return key;
|
|
81
125
|
}
|
|
82
126
|
|
|
83
|
-
|
|
127
|
+
/**
|
|
128
|
+
*
|
|
129
|
+
* @param {string} key - The data key
|
|
130
|
+
* @param {string} dataOverride locale for use with translation
|
|
131
|
+
* @returns {string} translation for mission type
|
|
132
|
+
*/
|
|
133
|
+
export function missionType(key, dataOverride) {
|
|
84
134
|
if (key in i18n(dataOverride).missionTypes) {
|
|
85
135
|
return i18n(dataOverride).missionTypes[key].value;
|
|
86
136
|
}
|
|
@@ -90,105 +140,182 @@ function missionType(key, dataOverride) {
|
|
|
90
140
|
return key;
|
|
91
141
|
}
|
|
92
142
|
|
|
93
|
-
|
|
143
|
+
/**
|
|
144
|
+
*
|
|
145
|
+
* @param {string} key - The data key
|
|
146
|
+
* @param {string} dataOverride locale for use with translation
|
|
147
|
+
* @returns {string} conclave mode
|
|
148
|
+
*/
|
|
149
|
+
export function conclaveMode(key, dataOverride) {
|
|
94
150
|
if (key in i18n(dataOverride).conclave.modes) {
|
|
95
151
|
return i18n(dataOverride).conclave.modes[key].value;
|
|
96
152
|
}
|
|
97
153
|
return key;
|
|
98
154
|
}
|
|
99
155
|
|
|
100
|
-
|
|
156
|
+
/**
|
|
157
|
+
*
|
|
158
|
+
* @param {string} key - The data key
|
|
159
|
+
* @param {string} dataOverride locale for use with translation
|
|
160
|
+
* @returns {string} conclave category
|
|
161
|
+
*/
|
|
162
|
+
export function conclaveCategory(key, dataOverride) {
|
|
101
163
|
if (key in i18n(dataOverride).conclave.categories) {
|
|
102
164
|
return i18n(dataOverride).conclave.categories[key].value;
|
|
103
165
|
}
|
|
104
166
|
return key;
|
|
105
167
|
}
|
|
106
168
|
|
|
107
|
-
|
|
169
|
+
/**
|
|
170
|
+
*
|
|
171
|
+
* @param {string} key - The data key
|
|
172
|
+
* @param {string} dataOverride locale for use with translation
|
|
173
|
+
* @returns {string} fissure modifier data
|
|
174
|
+
*/
|
|
175
|
+
export function fissureModifier(key, dataOverride) {
|
|
108
176
|
if (key in i18n(dataOverride).fissureModifiers) {
|
|
109
177
|
return i18n(dataOverride).fissureModifiers[key].value;
|
|
110
178
|
}
|
|
111
179
|
return key;
|
|
112
180
|
}
|
|
113
181
|
|
|
114
|
-
|
|
182
|
+
/**
|
|
183
|
+
*
|
|
184
|
+
* @param {string} key - The data key
|
|
185
|
+
* @param {string} dataOverride locale for use with translation
|
|
186
|
+
* @returns {number | string} fissure tier
|
|
187
|
+
*/
|
|
188
|
+
export function fissureTier(key, dataOverride) {
|
|
115
189
|
if (key in i18n(dataOverride).fissureModifiers) {
|
|
116
190
|
return i18n(dataOverride).fissureModifiers[key].num;
|
|
117
191
|
}
|
|
118
192
|
return key;
|
|
119
193
|
}
|
|
120
194
|
|
|
121
|
-
|
|
195
|
+
/**
|
|
196
|
+
*
|
|
197
|
+
* @param {string} key - The data key
|
|
198
|
+
* @param {string} dataOverride locale for use with translation
|
|
199
|
+
* @returns {string} syndicate name
|
|
200
|
+
*/
|
|
201
|
+
export function syndicate(key, dataOverride) {
|
|
122
202
|
if (key in i18n(dataOverride).syndicates) {
|
|
123
203
|
return i18n(dataOverride).syndicates[key].name;
|
|
124
204
|
}
|
|
125
205
|
return key;
|
|
126
206
|
}
|
|
127
207
|
|
|
128
|
-
|
|
208
|
+
/**
|
|
209
|
+
*
|
|
210
|
+
* @param {string} key - The data key
|
|
211
|
+
* @param {string} dataOverride locale for use with translation
|
|
212
|
+
* @returns {string} upgrade type
|
|
213
|
+
*/
|
|
214
|
+
export function upgrade(key, dataOverride) {
|
|
129
215
|
if (key in i18n(dataOverride).upgradeTypes) {
|
|
130
216
|
return i18n(dataOverride).upgradeTypes[key].value;
|
|
131
217
|
}
|
|
132
218
|
return key;
|
|
133
219
|
}
|
|
134
220
|
|
|
135
|
-
|
|
221
|
+
/**
|
|
222
|
+
*
|
|
223
|
+
* @param {string} key - The data key
|
|
224
|
+
* @param {string} dataOverride locale for use with translation
|
|
225
|
+
* @returns {string} mathematical operation value
|
|
226
|
+
*/
|
|
227
|
+
export function operation(key, dataOverride) {
|
|
136
228
|
if (key in i18n(dataOverride).operationTypes) {
|
|
137
229
|
return i18n(dataOverride).operationTypes[key].value;
|
|
138
230
|
}
|
|
139
231
|
return key;
|
|
140
232
|
}
|
|
141
233
|
|
|
142
|
-
|
|
234
|
+
/**
|
|
235
|
+
*
|
|
236
|
+
* @param {string} key - The data key
|
|
237
|
+
* @param {string} dataOverride locale for use with translation
|
|
238
|
+
* @returns {string} symbol of mathematical operation
|
|
239
|
+
*/
|
|
240
|
+
export function operationSymbol(key, dataOverride) {
|
|
143
241
|
if (key in i18n(dataOverride).operationTypes) {
|
|
144
242
|
return i18n(dataOverride).operationTypes[key].symbol;
|
|
145
243
|
}
|
|
146
244
|
return key;
|
|
147
245
|
}
|
|
148
246
|
|
|
149
|
-
|
|
247
|
+
/**
|
|
248
|
+
* @param {string} key - The data key
|
|
249
|
+
* @param {string} dataOverride locale for use with translation
|
|
250
|
+
* @returns {string} sortie boss name
|
|
251
|
+
*/
|
|
252
|
+
export function sortieBoss(key, dataOverride) {
|
|
150
253
|
if (key in i18n(dataOverride).sortie.bosses) {
|
|
151
254
|
return i18n(dataOverride).sortie.bosses[key].name;
|
|
152
255
|
}
|
|
153
256
|
return key;
|
|
154
257
|
}
|
|
155
258
|
|
|
156
|
-
|
|
259
|
+
/**
|
|
260
|
+
* @param {string} key - The data key
|
|
261
|
+
* @param {string} dataOverride locale for use with translation
|
|
262
|
+
* @returns {string} faction for a sortie based on the boss
|
|
263
|
+
*/
|
|
264
|
+
export function sortieFaction(key, dataOverride) {
|
|
157
265
|
if (key in i18n(dataOverride).sortie.bosses) {
|
|
158
266
|
return i18n(dataOverride).sortie.bosses[key].faction;
|
|
159
267
|
}
|
|
160
268
|
return key;
|
|
161
269
|
}
|
|
162
270
|
|
|
163
|
-
|
|
271
|
+
/**
|
|
272
|
+
*
|
|
273
|
+
* @param {string} key - The data key
|
|
274
|
+
* @param {string} dataOverride locale for use with translation
|
|
275
|
+
* @returns {string} sortie modifier data
|
|
276
|
+
*/
|
|
277
|
+
export function sortieModifier(key, dataOverride) {
|
|
164
278
|
if (key in i18n(dataOverride).sortie.modifierTypes) {
|
|
165
279
|
return i18n(dataOverride).sortie.modifierTypes[key];
|
|
166
280
|
}
|
|
167
281
|
return key;
|
|
168
282
|
}
|
|
169
283
|
|
|
170
|
-
|
|
284
|
+
/**
|
|
285
|
+
* @param {string} key - The data key
|
|
286
|
+
* @param {string} dataOverride locale for use with translation
|
|
287
|
+
* @returns {string} sortie modifier description
|
|
288
|
+
*/
|
|
289
|
+
export function sortieModDesc(key, dataOverride) {
|
|
171
290
|
if (i18n(dataOverride).sortie.modifierDescriptions && key in i18n(dataOverride).sortie.modifierDescriptions) {
|
|
172
291
|
return i18n(dataOverride).sortie.modifierDescriptions[key];
|
|
173
292
|
}
|
|
174
293
|
return key;
|
|
175
294
|
}
|
|
176
295
|
|
|
177
|
-
|
|
296
|
+
/**
|
|
297
|
+
* Retrieve the localized region for a given key
|
|
298
|
+
* @param {string} key - The region key
|
|
299
|
+
* @param {string} dataOverride - The locale to use for translations
|
|
300
|
+
* @returns {string} localized region name
|
|
301
|
+
*/
|
|
302
|
+
export function region(key, dataOverride) {
|
|
178
303
|
if (key && i18n(dataOverride).persistentEnemy.regions[key]) {
|
|
179
304
|
return i18n(dataOverride).persistentEnemy.regions[key];
|
|
180
305
|
}
|
|
181
306
|
return key;
|
|
182
307
|
}
|
|
183
308
|
|
|
184
|
-
|
|
309
|
+
/**
|
|
310
|
+
* Retrieve conclave challenge name for the given key and locale
|
|
311
|
+
* @param {string} key key to retrieve
|
|
312
|
+
* @param {string} dataOverride locale key override
|
|
313
|
+
* @returns {string} - The conclave challenge name for the given key
|
|
314
|
+
*/
|
|
315
|
+
export function conclaveChallenge(key, dataOverride) {
|
|
185
316
|
const splitKey = String(key).split('/').slice(-1)[0];
|
|
186
317
|
|
|
187
|
-
if (
|
|
188
|
-
i18n(dataOverride).conclave &&
|
|
189
|
-
i18n(dataOverride).conclave.challenges &&
|
|
190
|
-
i18n(dataOverride).conclave.challenges[splitKey]
|
|
191
|
-
) {
|
|
318
|
+
if (i18n(dataOverride).conclave?.challenges?.[splitKey]) {
|
|
192
319
|
return i18n(dataOverride).conclave.challenges[splitKey];
|
|
193
320
|
}
|
|
194
321
|
return {
|
|
@@ -198,36 +325,41 @@ function conclaveChallenge(key, dataOverride) {
|
|
|
198
325
|
};
|
|
199
326
|
}
|
|
200
327
|
|
|
201
|
-
|
|
328
|
+
/**
|
|
329
|
+
* Get the steel path data for given key
|
|
330
|
+
* @param {string} dataOverride - The locale to use for translations
|
|
331
|
+
* @returns {string} - The steel path data for the given key
|
|
332
|
+
*/
|
|
333
|
+
export function steelPath(dataOverride) {
|
|
202
334
|
return (i18n(dataOverride) || /* istanbul ignore next */ data).steelPath;
|
|
203
335
|
}
|
|
204
336
|
|
|
205
337
|
/**
|
|
206
338
|
* An object containing functions to convert in-game names to their localizations
|
|
207
|
-
* @typedef {Record<string,
|
|
208
|
-
* @property {
|
|
209
|
-
* @property {
|
|
210
|
-
* @property {
|
|
211
|
-
* @property {
|
|
212
|
-
* @property {
|
|
213
|
-
* @property {
|
|
339
|
+
* @typedef {Record<string, Function>} Translator
|
|
340
|
+
* @property {Function} faction - Converts faction names
|
|
341
|
+
* @property {Function} node - Converts star map node names
|
|
342
|
+
* @property {Function} nodeMissionType - Returns the mission type of given node
|
|
343
|
+
* @property {Function} nodeEnemy - Returns the faction that controls a given node
|
|
344
|
+
* @property {Function} languageString - Converts generic language strings
|
|
345
|
+
* @property {Function} languageDesc - Converts generic language strings
|
|
214
346
|
* and retrieves the description
|
|
215
|
-
* @property {
|
|
216
|
-
* @property {
|
|
217
|
-
* @property {
|
|
218
|
-
* @property {
|
|
219
|
-
* @property {
|
|
220
|
-
* @property {
|
|
221
|
-
* @property {
|
|
222
|
-
* @property {
|
|
223
|
-
* @property {
|
|
224
|
-
* @property {
|
|
225
|
-
* @property {
|
|
226
|
-
* @property {
|
|
227
|
-
* @property {
|
|
228
|
-
* @property {
|
|
229
|
-
*/
|
|
230
|
-
|
|
347
|
+
* @property {Function} missionType - Converts mission types
|
|
348
|
+
* @property {Function} conclaveMode - Converts conclave modes
|
|
349
|
+
* @property {Function} conclaveCategory - Converts conclave challenge categories
|
|
350
|
+
* @property {Function} fissureModifier - Converts fissure mission modifiers
|
|
351
|
+
* @property {Function} syndicate - Converts syndicate names
|
|
352
|
+
* @property {Function} upgrade - Converts upgrade types
|
|
353
|
+
* @property {Function} operation - Converts operation types
|
|
354
|
+
* @property {Function} sortieBoss - Converts sortie boss names
|
|
355
|
+
* @property {Function} sortieModifier - Converts sortie modifier types
|
|
356
|
+
* @property {Function} sortieModDesc - Converts sortie modifier type descriptions
|
|
357
|
+
* @property {Function} region - Converts persistent enemy region indicies
|
|
358
|
+
* @property {Function} conclaveChallenge - Convert conclave identifiers into standing data
|
|
359
|
+
* @property {Function} steelPath - Retrieve Steel Path rotation data for locale
|
|
360
|
+
* @property {Function} toTitleCase - Format provided string as titlecase
|
|
361
|
+
*/
|
|
362
|
+
export default {
|
|
231
363
|
faction,
|
|
232
364
|
node,
|
|
233
365
|
nodeMissionType,
|
package/main.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import WorldState from './lib/WorldState.js';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export default WorldState;
|
package/package.json
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "warframe-worldstate-parser",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "An Open parser for Warframe's Worldstate in Javascript",
|
|
5
5
|
"types": "./types/main.d.ts",
|
|
6
6
|
"main": "main.js",
|
|
7
|
-
"dependencies": {
|
|
8
|
-
"node-fetch": "^2.6.1"
|
|
9
|
-
},
|
|
10
7
|
"peerDependencies": {
|
|
11
8
|
"warframe-worldstate-data": ">=1.0"
|
|
12
9
|
},
|
|
@@ -32,5 +29,6 @@
|
|
|
32
29
|
"bugs": {
|
|
33
30
|
"url": "https://github.com/wfcd/warframe-worldstate-parser/issues"
|
|
34
31
|
},
|
|
35
|
-
"homepage": "https://github.com/wfcd/warframe-worldstate-parser#readme"
|
|
32
|
+
"homepage": "https://github.com/wfcd/warframe-worldstate-parser#readme",
|
|
33
|
+
"type": "module"
|
|
36
34
|
}
|