warframe-worldstate-parser 5.2.12 → 5.2.13

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 (98) hide show
  1. package/dist/{Alert-DmPDiTMU.d.mts → Alert-CXF2Z-1T.d.mts} +4 -4
  2. package/dist/{Archidemea-D87NgPnh.d.mts → Archidemea-Cz5f5mO4.d.mts} +2 -2
  3. package/dist/{Calendar-bmnOPyG8.d.mts → Calendar-DYcJQeUa.d.mts} +1 -1
  4. package/dist/{CambionCycle-BqqaE-K-.d.mts → CambionCycle-BWvDFHKA.d.mts} +2 -2
  5. package/dist/{CetusCycle-eDOf8_NN.d.mts → CetusCycle-yvOEjkgM.d.mts} +1 -1
  6. package/dist/{ChallengeInstance-DB56npsp.d.mts → ChallengeInstance-B_3KnbyT.d.mts} +1 -1
  7. package/dist/{ConclaveChallenge-B4zjsE6H.d.mts → ConclaveChallenge-uZ0oYk9e.d.mts} +2 -2
  8. package/dist/{ConstructionProgress-Y5M4kY6i.d.mts → ConstructionProgress-Df9wkF6v.d.mts} +1 -1
  9. package/dist/{DailyDeal-YPfZAtZm.d.mts → DailyDeal-oEVS6ilW.d.mts} +2 -2
  10. package/dist/{DarkSector-BgUzu7ji.d.mts → DarkSector-CKfnMGsZ.d.mts} +4 -4
  11. package/dist/{DarkSectorBattle-Dv8NzJV7.d.mts → DarkSectorBattle-6Rn7YpT7.d.mts} +1 -1
  12. package/dist/{Dependency-CNDia70k.d.mts → Dependency-CSKUY3rf.d.mts} +1 -1
  13. package/dist/{DuviriChoice-Dzw114Vc.d.mts → DuviriChoice-DYsa_ggn.d.mts} +1 -1
  14. package/dist/{DuviriCycle-RSsB4KI3.d.mts → DuviriCycle-CXL7Lztx.d.mts} +2 -2
  15. package/dist/{EarthCycle-COO7wlLW.d.mts → EarthCycle-LH8s0Lhw.d.mts} +1 -1
  16. package/dist/{Fissure-DMHOvKp4.d.mts → Fissure-C0kjA66u.d.mts} +2 -2
  17. package/dist/{FlashSale-BlLg7pGm.d.mts → FlashSale-CnfQLuVA.d.mts} +2 -2
  18. package/dist/{GlobalUpgrade-8xZ7QLIe.d.mts → GlobalUpgrade-CGIiG66-.d.mts} +2 -2
  19. package/dist/{Invasion-CmYbho4F.d.mts → Invasion-D8U6YHiR.d.mts} +3 -3
  20. package/dist/{Mission-EUB_O6c1.d.mts → Mission-BJlVA-sm.d.mts} +2 -2
  21. package/dist/{News-BAIxF_MP.d.mts → News-CGpkrc6F.d.mts} +1 -1
  22. package/dist/{Nightwave-cYL4PyAv.d.mts → Nightwave-DTQksQJ1.d.mts} +2 -2
  23. package/dist/{NightwaveChallenge-D6Tr17Yw.d.mts → NightwaveChallenge-DAMnDdda.d.mts} +1 -1
  24. package/dist/{PersistentEnemy-DBPQGf3A.d.mts → PersistentEnemy-BndRTL7c.d.mts} +1 -1
  25. package/dist/{Reward-CtK9c0sX.d.mts → Reward-CQ5fnfGv.d.mts} +2 -2
  26. package/dist/{SentientOutpost-uqJtS--v.d.mts → SentientOutpost-DtFyMZgh.d.mts} +1 -1
  27. package/dist/{Simaris-owdTviJJ.d.mts → Simaris-CfajVEDs.d.mts} +1 -1
  28. package/dist/{Sortie-D6nJhiyi.d.mts → Sortie-CcmgVhMp.d.mts} +4 -4
  29. package/dist/{SortieVariant-1fo_ZNCj.d.mts → SortieVariant-Dq1ap8Vj.d.mts} +1 -1
  30. package/dist/{SyndicateJob-nU_LYWIG.d.mts → SyndicateJob-BShg8By1.d.mts} +2 -2
  31. package/dist/{SyndicateMission-DKjOQMTr.d.mts → SyndicateMission-CCyl4jtq.d.mts} +3 -3
  32. package/dist/{VallisCycle-Do8kWk0_.d.mts → VallisCycle-CfUcMlno.d.mts} +1 -1
  33. package/dist/{VoidTrader-LuPERTUa.d.mts → VoidTrader-CyW5f24k.d.mts} +4 -4
  34. package/dist/{VoidTraderItem-83an95lh.d.mts → VoidTraderItem-Bg8_rReH.d.mts} +1 -1
  35. package/dist/{VoidTraderSchedule-DYRSLebw.d.mts → VoidTraderSchedule-D_oo6wbz.d.mts} +1 -1
  36. package/dist/{WeeklyChallenge-C2oTkgtR.d.mts → WeeklyChallenge-y44JasTT.d.mts} +2 -2
  37. package/dist/{WorldEvent-DoHnEWZL.d.mts → WorldEvent-CWpEcJtK.d.mts} +4 -4
  38. package/dist/{ZarimanCycle-BCxG1i_j.d.mts → ZarimanCycle-D7E0AeuR.d.mts} +1 -1
  39. package/dist/lib/Tmp.d.mts +3 -3
  40. package/dist/lib/WorldState.d.mts +275 -41
  41. package/dist/lib/WorldState.mjs +334 -30
  42. package/dist/lib/models/Alert.d.mts +5 -5
  43. package/dist/lib/models/Archidemea.d.mts +3 -3
  44. package/dist/lib/models/Calendar.d.mts +2 -2
  45. package/dist/lib/models/CambionCycle.d.mts +3 -3
  46. package/dist/lib/models/CetusCycle.d.mts +2 -2
  47. package/dist/lib/models/ChallengeInstance.d.mts +2 -2
  48. package/dist/lib/models/ConclaveChallenge.d.mts +3 -3
  49. package/dist/lib/models/ConstructionProgress.d.mts +2 -2
  50. package/dist/lib/models/DailyDeal.d.mts +3 -3
  51. package/dist/lib/models/DarkSector.d.mts +6 -6
  52. package/dist/lib/models/DarkSectorBattle.d.mts +2 -2
  53. package/dist/lib/models/DuviriCycle.d.mts +3 -3
  54. package/dist/lib/models/EarthCycle.d.mts +2 -2
  55. package/dist/lib/models/Fissure.d.mts +3 -3
  56. package/dist/lib/models/FlashSale.d.mts +3 -3
  57. package/dist/lib/models/GlobalUpgrade.d.mts +3 -3
  58. package/dist/lib/models/Invasion.d.mts +4 -4
  59. package/dist/lib/models/Kinepage.d.mts +1 -1
  60. package/dist/lib/models/Kuva.d.mts +2 -2
  61. package/dist/lib/models/MidrathCycle.d.mts +1 -1
  62. package/dist/lib/models/Mission.d.mts +3 -3
  63. package/dist/lib/models/News.d.mts +2 -2
  64. package/dist/lib/models/Nightwave.d.mts +3 -3
  65. package/dist/lib/models/NightwaveChallenge.d.mts +2 -2
  66. package/dist/lib/models/PersistentEnemy.d.mts +2 -2
  67. package/dist/lib/models/Reward.d.mts +2 -2
  68. package/dist/lib/models/SentientOutpost.d.mts +2 -2
  69. package/dist/lib/models/Simaris.d.mts +2 -2
  70. package/dist/lib/models/Sortie.d.mts +6 -6
  71. package/dist/lib/models/SortieVariant.d.mts +2 -2
  72. package/dist/lib/models/SteelPathOffering.d.mts +1 -1
  73. package/dist/lib/models/SyndicateJob.d.mts +3 -3
  74. package/dist/lib/models/SyndicateMission.d.mts +4 -4
  75. package/dist/lib/models/VallisCycle.d.mts +2 -2
  76. package/dist/lib/models/VoidTrader.d.mts +5 -5
  77. package/dist/lib/models/VoidTraderItem.d.mts +2 -2
  78. package/dist/lib/models/VoidTraderSchedule.d.mts +2 -2
  79. package/dist/lib/models/WeeklyChallenge.d.mts +4 -4
  80. package/dist/lib/models/WorldEvent.d.mts +5 -5
  81. package/dist/lib/models/WorldstateObject.d.mts +1 -1
  82. package/dist/lib/models/ZarimanCycle.d.mts +2 -2
  83. package/dist/lib/supporting/Dependency.d.mts +1 -1
  84. package/dist/lib/supporting/DuviriChoice.d.mts +2 -2
  85. package/dist/lib/supporting/ExternalMission.d.mts +1 -1
  86. package/dist/lib/supporting/KuvaLogEntry.d.mts +1 -1
  87. package/dist/lib/supporting/RewardTypes.d.mts +1 -1
  88. package/dist/main.d.mts +41 -41
  89. package/dist/main.mjs +1 -1
  90. package/package.json +1 -1
  91. package/dist/WorldState-CBf4G0xk.d.mts +0 -268
  92. package/dist/WorldState-D6TgRJLd.mjs +0 -336
  93. /package/dist/{ExternalMission-Do2VcpoL.d.mts → ExternalMission-DeoVC7ra.d.mts} +0 -0
  94. /package/dist/{Kinepage-B5KWyc4P.d.mts → Kinepage-yW6FgpW4.d.mts} +0 -0
  95. /package/dist/{KuvaLogEntry-CZ94k8nV.d.mts → KuvaLogEntry-CBItxLlZ.d.mts} +0 -0
  96. /package/dist/{RewardTypes-BjS_ZS-W.d.mts → RewardTypes-nWMw8qZb.d.mts} +0 -0
  97. /package/dist/{SteelPathOffering-BpsSBlnS.d.mts → SteelPathOffering-CHBuC34b.d.mts} +0 -0
  98. /package/dist/{WorldstateObject-D9aUaGek.d.mts → WorldstateObject-C5n5EJvt.d.mts} +0 -0
@@ -1,268 +0,0 @@
1
- import { t as Kinepage } from "./Kinepage-B5KWyc4P.mjs";
2
- import { t as Dependency } from "./Dependency-CNDia70k.mjs";
3
- import { n as SentientOutpost } from "./SentientOutpost-uqJtS--v.mjs";
4
- import { r as WorldstateObject, t as BaseContentObject } from "./WorldstateObject-D9aUaGek.mjs";
5
- import { n as RawAlert, t as Alert } from "./Alert-DmPDiTMU.mjs";
6
- import { i as RawArchimedea, t as Archimedea } from "./Archidemea-D87NgPnh.mjs";
7
- import { r as RawCalender, t as Calendar } from "./Calendar-bmnOPyG8.mjs";
8
- import { t as CetusCycle } from "./CetusCycle-eDOf8_NN.mjs";
9
- import { t as CambionCycle } from "./CambionCycle-BqqaE-K-.mjs";
10
- import { n as RawChallenge, t as ConclaveChallenge } from "./ConclaveChallenge-B4zjsE6H.mjs";
11
- import { t as ConstructionProgress } from "./ConstructionProgress-Y5M4kY6i.mjs";
12
- import { n as RawDailyDeal, t as DailyDeal } from "./DailyDeal-YPfZAtZm.mjs";
13
- import { r as RawDarkSector, t as DarkSector } from "./DarkSector-BgUzu7ji.mjs";
14
- import { n as RawChoice } from "./DuviriChoice-Dzw114Vc.mjs";
15
- import { t as DuviriCycle } from "./DuviriCycle-RSsB4KI3.mjs";
16
- import { t as EarthCycle } from "./EarthCycle-COO7wlLW.mjs";
17
- import { n as RawFissure, t as Fissure } from "./Fissure-DMHOvKp4.mjs";
18
- import { n as RawFlashSale, t as FlashSale } from "./FlashSale-BlLg7pGm.mjs";
19
- import { n as RawGlobalUpgrade, t as GlobalUpgrade } from "./GlobalUpgrade-8xZ7QLIe.mjs";
20
- import { r as RawInvasion, t as Invasion } from "./Invasion-CmYbho4F.mjs";
21
- import { n as RawNews, t as News } from "./News-BAIxF_MP.mjs";
22
- import { n as RawNightwave, t as Nightwave } from "./Nightwave-cYL4PyAv.mjs";
23
- import { n as RawPersistentEnemy, t as PersistentEnemy } from "./PersistentEnemy-DBPQGf3A.mjs";
24
- import { n as Simaris, t as LibraryInfo } from "./Simaris-owdTviJJ.mjs";
25
- import { n as Sortie, t as RawSortie } from "./Sortie-D6nJhiyi.mjs";
26
- import { n as SteelPathOfferings } from "./SteelPathOffering-BpsSBlnS.mjs";
27
- import { n as SyndicateMission, t as RawSyndicateMission } from "./SyndicateMission-DKjOQMTr.mjs";
28
- import { t as VallisCycle } from "./VallisCycle-Do8kWk0_.mjs";
29
- import { n as VoidTrader, t as RawVoidTrader } from "./VoidTrader-LuPERTUa.mjs";
30
- import { n as WeeklyChallenge, t as RawWeeklyChallenge } from "./WeeklyChallenge-C2oTkgtR.mjs";
31
- import { a as WorldEvent, i as RawWorldEvent } from "./WorldEvent-DoHnEWZL.mjs";
32
- import { n as ZarimanCycle } from "./ZarimanCycle-BCxG1i_j.mjs";
33
- import { t as ExternalMission } from "./ExternalMission-Do2VcpoL.mjs";
34
-
35
- //#region lib/WorldState.d.ts
36
-
37
- /**
38
- *
39
- * @param ParserClass class for parsing data
40
- * @param dataArray array of raw data
41
- * @param deps shared dependency object
42
- * @param uniqueField field to treat as unique
43
- * @returns array of parsed objects
44
- */
45
- declare function parseArray<T, D extends BaseContentObject>(
46
- // Not all instances of T extend WorldstateObject
47
- ParserClass: new (data: D, deps: Dependency) => T, dataArray: Array<D>, deps: Dependency, uniqueField?: keyof T): T[];
48
- /**
49
- * Parse array of objects that requires async parsing
50
- * @param ParserClass class for parsing data - must expose a static build method
51
- * @param dataArray array of raw data
52
- * @param deps shared dependency object
53
- * @param uniqueField field to treat as unique
54
- * @returns array of parsed objects
55
- */
56
- declare function parseAsyncArray<T extends WorldstateObject, D extends BaseContentObject>(ParserClass: {
57
- build: (data: D, deps: Dependency) => Promise<T>;
58
- }, dataArray: Array<D>, deps: Dependency, uniqueField?: keyof T): Promise<T[]>;
59
- interface InitialWorldState {
60
- Time: number;
61
- BuildLabel: string;
62
- Events: RawNews[];
63
- Goals: RawWorldEvent[];
64
- Alerts: RawAlert[];
65
- Sorties: RawSortie[];
66
- LiteSorties: RawSortie[];
67
- SyndicateMissions: RawSyndicateMission[];
68
- ActiveMissions: RawFissure[];
69
- VoidStorms: RawFissure[];
70
- GlobalUpgrades: RawGlobalUpgrade[];
71
- FlashSales: RawFlashSale[];
72
- Invasions: RawInvasion[];
73
- BadlandNodes: RawDarkSector[];
74
- VoidTraders: RawVoidTrader[];
75
- DailyDeals: RawDailyDeal[];
76
- LibraryInfo?: LibraryInfo;
77
- PVPChallengeInstances: RawChallenge[];
78
- PersistentEnemies: RawPersistentEnemy[];
79
- WeeklyChallenges?: RawWeeklyChallenge;
80
- ProjectPct: number[];
81
- SeasonInfo: RawNightwave;
82
- PrimeVaultTraders: RawVoidTrader[];
83
- EndlessXpChoices: RawChoice[];
84
- KnownCalendarSeasons: RawCalender[];
85
- Conquests: RawArchimedea[];
86
- Tmp: string;
87
- }
88
- /**
89
- * Parses Warframe Worldstate JSON
90
- */
91
- declare class WorldState {
92
- /**
93
- * The date and time at which the World State was generated
94
- */
95
- timestamp: Date;
96
- /**
97
- * Current Warframe version
98
- */
99
- buildLabel: string;
100
- /**
101
- * The in-game news
102
- */
103
- news: News[];
104
- /**
105
- * The current events
106
- */
107
- events: WorldEvent[];
108
- /**
109
- * The current alerts
110
- */
111
- alerts: Alert[];
112
- /**
113
- * The current sortie
114
- */
115
- sortie: Sortie;
116
- /**
117
- * The current syndicate missions
118
- */
119
- syndicateMissions: SyndicateMission[];
120
- /**
121
- * The current fissures: 'ActiveMissions' & 'VoidStorms'
122
- */
123
- fissures: Fissure[];
124
- /**
125
- * The current global upgrades
126
- */
127
- globalUpgrades: GlobalUpgrade[];
128
- /**
129
- * The current flash sales
130
- */
131
- flashSales: FlashSale[];
132
- /**
133
- * The current invasions
134
- */
135
- invasions: Invasion[];
136
- /**
137
- * The state of the dark sectors
138
- */
139
- darkSectors: DarkSector[];
140
- /**
141
- * The state of all Void Traders
142
- */
143
- voidTraders: VoidTrader[];
144
- /**
145
- * The first entry for voidTraders
146
- * @deprecated
147
- */
148
- voidTrader: VoidTrader;
149
- /**
150
- * The current daily deals
151
- */
152
- dailyDeals: DailyDeal[];
153
- /**
154
- * The state of the sanctuary synthesis targets
155
- */
156
- simaris: Simaris;
157
- /**
158
- * The current conclave challenges
159
- */
160
- conclaveChallenges: ConclaveChallenge[];
161
- /**
162
- * The currently active persistent enemies
163
- */
164
- persistentEnemies: PersistentEnemy[];
165
- /**
166
- * The current earth cycle
167
- */
168
- earthCycle: EarthCycle;
169
- /**
170
- * The current Cetus cycle
171
- */
172
- cetusCycle: CetusCycle;
173
- /**
174
- * Cambion Drift Cycle
175
- */
176
- cambionCycle: CambionCycle;
177
- /**
178
- * The current Zariman cycle based off current time
179
- */
180
- zarimanCycle: ZarimanCycle;
181
- /**
182
- * Midrath cycle (soulframe)
183
- * Game seems to desync while you play and appearntly it changes between updates.
184
- */
185
- /**
186
- * Weekly challenges
187
- */
188
- weeklyChallenges?: WeeklyChallenge;
189
- /**
190
- * The Current construction progress for Fomorians/Razorback/etc.
191
- */
192
- constructionProgress: ConstructionProgress;
193
- /**
194
- * The current Orb Vallis cycle state
195
- */
196
- vallisCycle: VallisCycle;
197
- /**
198
- * The current nightwave season
199
- */
200
- nightwave?: Nightwave;
201
- /**
202
- * Kuva missions array
203
- */
204
- kuva?: ExternalMission[];
205
- /**
206
- * Arbitration mission
207
- */
208
- arbitration?: ExternalMission;
209
- /**
210
- * Current sentient outposts
211
- */
212
- sentientOutposts: SentientOutpost;
213
- /**
214
- * Steel path offering rotation
215
- */
216
- steelPath: SteelPathOfferings;
217
- /**
218
- * The current prime resurgence
219
- */
220
- vaultTrader: VoidTrader;
221
- /**
222
- * The current archon hunt
223
- */
224
- archonHunt: Sortie;
225
- /**
226
- * Current Duviri circuit choices
227
- */
228
- duviriCycle: DuviriCycle;
229
- /**
230
- * Current kinepage message
231
- */
232
- kinepage: Kinepage;
233
- /**
234
- * The current Archimedea missions and modifiers
235
- */
236
- archimedeas: Archimedea[];
237
- /**
238
- * The current calendar for 1999
239
- */
240
- calendar: Calendar;
241
- /**
242
- * Faceoff bonus current state
243
- */
244
- faceoffBonus?: {
245
- activation: Date;
246
- expiry: Date;
247
- next: Date;
248
- };
249
- /**
250
- * Warframe's annual Quest to Conquer Cancer donation count and next tier goal
251
- */
252
- questToConquerCancer?: {
253
- count: number;
254
- goal: number;
255
- };
256
- /**
257
- * Generates the worldstate json as a string into usable objects
258
- */
259
- static build(json: string, deps?: Dependency): Promise<WorldState>;
260
- /**
261
- * @param data The worldstate JSON string
262
- * @param deps The options object
263
- */
264
- constructor(data: InitialWorldState, deps?: Dependency);
265
- }
266
- declare const _default: (json: string, deps: Dependency) => Promise<WorldState>;
267
- //#endregion
268
- export { parseAsyncArray as a, parseArray as i, WorldState as n, _default as r, InitialWorldState as t };
@@ -1,336 +0,0 @@
1
- import { t as Alert } from "./Alert-DdertJK5.mjs";
2
- import { t as Archimedea } from "./Archidemea-6_LmmSCn.mjs";
3
- import { t as Calendar } from "./Calendar-BIT29qag.mjs";
4
- import { t as CambionCycle } from "./CambionCycle-zr8UYAii.mjs";
5
- import { t as CetusCycle } from "./CetusCycle-DduQI2fw.mjs";
6
- import { t as ConclaveChallenge } from "./ConclaveChallenge-CXZ5q0ym.mjs";
7
- import { t as ConstructionProgress } from "./ConstructionProgress-hOBhqNeN.mjs";
8
- import { t as DailyDeal } from "./DailyDeal-B_-51xgg.mjs";
9
- import { t as DarkSector } from "./DarkSector-DiE6QETB.mjs";
10
- import { t as DuviriCycle } from "./DuviriCycle-B450OsF9.mjs";
11
- import { t as EarthCycle } from "./EarthCycle-IzR2qmA5.mjs";
12
- import { t as Fissure } from "./Fissure-DJYjBf1K.mjs";
13
- import { t as FlashSale } from "./FlashSale-CQQ51ZyI.mjs";
14
- import { t as GlobalUpgrade } from "./GlobalUpgrade-CECXB3Yf.mjs";
15
- import { t as Invasion } from "./Invasion-e0UPwE-J.mjs";
16
- import { t as Kuva } from "./Kuva-CPoswpEP.mjs";
17
- import { t as News } from "./News-DZVYtsd3.mjs";
18
- import { t as Nightwave } from "./Nightwave-sW1Cry-L.mjs";
19
- import { t as PersistentEnemy } from "./PersistentEnemy-BogypbtV.mjs";
20
- import { t as Simaris } from "./Simaris-Dpbxjfex.mjs";
21
- import { t as Sortie } from "./Sortie-BWrQosyz.mjs";
22
- import { t as SteelPathOfferings } from "./SteelPathOffering-hc8I6jT8.mjs";
23
- import { t as SyndicateMission } from "./SyndicateMission-Dif5Lp-C.mjs";
24
- import { t as VallisCycle } from "./VallisCycle-BUg8cwKo.mjs";
25
- import { t as VoidTrader } from "./VoidTrader-6aBnhs9P.mjs";
26
- import { t as WeeklyChallenge } from "./WeeklyChallenge-BNlgGlbI.mjs";
27
- import { t as WorldEvent } from "./WorldEvent-D5RguRlU.mjs";
28
- import { t as ZarimanCycle } from "./ZarimanCycle-Cq3E8Dp2.mjs";
29
- import { t as DuviriChoice } from "./DuviriChoice-CDdk3VSm.mjs";
30
- import { t as Tmp } from "./Tmp-DuhaXk2g.mjs";
31
- import { createHash } from "node:crypto";
32
- import wsData from "warframe-worldstate-data";
33
- import { parseDate } from "warframe-worldstate-data/utilities";
34
-
35
- //#region lib/WorldState.ts
36
- const { sortie } = wsData;
37
- const safeArray = (arr) => arr ?? [];
38
- const safeObj = (obj) => obj ?? {};
39
- /**
40
- * Default Dependency object
41
- * @type {Dependency}
42
- */
43
- const defaultDeps = {
44
- sortieData: sortie,
45
- locale: "en",
46
- logger: console
47
- };
48
- /**
49
- *
50
- * @param ParserClass class for parsing data
51
- * @param dataArray array of raw data
52
- * @param deps shared dependency object
53
- * @param uniqueField field to treat as unique
54
- * @returns array of parsed objects
55
- */
56
- function parseArray(ParserClass, dataArray, deps, uniqueField) {
57
- const arr = (dataArray || []).map((d) => new ParserClass(d, deps));
58
- if (uniqueField) {
59
- const utemp = {};
60
- arr.sort((a, b) => (a.id || "").localeCompare(b.id || ""));
61
- arr.forEach((obj) => {
62
- const key = String(obj[uniqueField]);
63
- utemp[key] = obj;
64
- });
65
- return Array.from(arr).filter((obj) => {
66
- if (obj?.active && typeof obj.active !== "undefined") return obj.active;
67
- return true;
68
- });
69
- }
70
- return arr;
71
- }
72
- /**
73
- * Parse array of objects that requires async parsing
74
- * @param ParserClass class for parsing data - must expose a static build method
75
- * @param dataArray array of raw data
76
- * @param deps shared dependency object
77
- * @param uniqueField field to treat as unique
78
- * @returns array of parsed objects
79
- */
80
- async function parseAsyncArray(ParserClass, dataArray, deps, uniqueField) {
81
- const arr = [];
82
- for await (const d of dataArray ?? []) arr.push(await ParserClass.build(d, deps));
83
- if (uniqueField) {
84
- const utemp = {};
85
- arr.sort((a, b) => (a.id ?? "").localeCompare(b.id ?? ""));
86
- arr.forEach((obj) => {
87
- const key = String(obj[uniqueField]);
88
- utemp[key] = obj;
89
- });
90
- return Array.from(arr).filter((obj) => {
91
- if (obj?.active && typeof obj.active !== "undefined") return obj.active;
92
- return true;
93
- });
94
- }
95
- return arr;
96
- }
97
- /**
98
- * Parses Warframe Worldstate JSON
99
- */
100
- var WorldState = class WorldState {
101
- /**
102
- * The date and time at which the World State was generated
103
- */
104
- timestamp;
105
- /**
106
- * Current Warframe version
107
- */
108
- buildLabel;
109
- /**
110
- * The in-game news
111
- */
112
- news;
113
- /**
114
- * The current events
115
- */
116
- events;
117
- /**
118
- * The current alerts
119
- */
120
- alerts;
121
- /**
122
- * The current sortie
123
- */
124
- sortie;
125
- /**
126
- * The current syndicate missions
127
- */
128
- syndicateMissions;
129
- /**
130
- * The current fissures: 'ActiveMissions' & 'VoidStorms'
131
- */
132
- fissures;
133
- /**
134
- * The current global upgrades
135
- */
136
- globalUpgrades;
137
- /**
138
- * The current flash sales
139
- */
140
- flashSales;
141
- /**
142
- * The current invasions
143
- */
144
- invasions;
145
- /**
146
- * The state of the dark sectors
147
- */
148
- darkSectors;
149
- /**
150
- * The state of all Void Traders
151
- */
152
- voidTraders;
153
- /**
154
- * The first entry for voidTraders
155
- * @deprecated
156
- */
157
- voidTrader;
158
- /**
159
- * The current daily deals
160
- */
161
- dailyDeals;
162
- /**
163
- * The state of the sanctuary synthesis targets
164
- */
165
- simaris;
166
- /**
167
- * The current conclave challenges
168
- */
169
- conclaveChallenges;
170
- /**
171
- * The currently active persistent enemies
172
- */
173
- persistentEnemies;
174
- /**
175
- * The current earth cycle
176
- */
177
- earthCycle;
178
- /**
179
- * The current Cetus cycle
180
- */
181
- cetusCycle;
182
- /**
183
- * Cambion Drift Cycle
184
- */
185
- cambionCycle;
186
- /**
187
- * The current Zariman cycle based off current time
188
- */
189
- zarimanCycle;
190
- /**
191
- * Midrath cycle (soulframe)
192
- * Game seems to desync while you play and appearntly it changes between updates.
193
- */
194
- /**
195
- * Weekly challenges
196
- */
197
- weeklyChallenges;
198
- /**
199
- * The Current construction progress for Fomorians/Razorback/etc.
200
- */
201
- constructionProgress;
202
- /**
203
- * The current Orb Vallis cycle state
204
- */
205
- vallisCycle;
206
- /**
207
- * The current nightwave season
208
- */
209
- nightwave;
210
- /**
211
- * Kuva missions array
212
- */
213
- kuva;
214
- /**
215
- * Arbitration mission
216
- */
217
- arbitration;
218
- /**
219
- * Current sentient outposts
220
- */
221
- sentientOutposts;
222
- /**
223
- * Steel path offering rotation
224
- */
225
- steelPath;
226
- /**
227
- * The current prime resurgence
228
- */
229
- vaultTrader;
230
- /**
231
- * The current archon hunt
232
- */
233
- archonHunt;
234
- /**
235
- * Current Duviri circuit choices
236
- */
237
- duviriCycle;
238
- /**
239
- * Current kinepage message
240
- */
241
- kinepage;
242
- /**
243
- * The current Archimedea missions and modifiers
244
- */
245
- archimedeas;
246
- /**
247
- * The current calendar for 1999
248
- */
249
- calendar;
250
- /**
251
- * Faceoff bonus current state
252
- */
253
- faceoffBonus;
254
- /**
255
- * Warframe's annual Quest to Conquer Cancer donation count and next tier goal
256
- */
257
- questToConquerCancer;
258
- /**
259
- * Generates the worldstate json as a string into usable objects
260
- */
261
- static async build(json, deps = defaultDeps) {
262
- if (typeof json !== "string") throw new TypeError(`json needs to be a string, provided ${typeof json} : ${JSON.stringify(json)}`);
263
- const data = JSON.parse(json);
264
- const ws = new WorldState(data, deps);
265
- ws.events = await parseAsyncArray(WorldEvent, data.Goals, deps);
266
- ws.syndicateMissions = await parseAsyncArray(SyndicateMission, data.SyndicateMissions, deps, "syndicate");
267
- return ws;
268
- }
269
- /**
270
- * @param data The worldstate JSON string
271
- * @param deps The options object
272
- */
273
- constructor(data, deps = defaultDeps) {
274
- deps = {
275
- ...defaultDeps,
276
- ...deps
277
- };
278
- this.timestamp = /* @__PURE__ */ new Date(data.Time * 1e3);
279
- this.buildLabel = data.BuildLabel;
280
- this.news = parseArray(News, safeArray(data.Events).filter((e) => typeof e.Messages.find((msg) => msg.LanguageCode === deps.locale) !== "undefined"), deps);
281
- this.events = [];
282
- this.alerts = parseArray(Alert, data.Alerts, deps);
283
- [this.sortie] = parseArray(Sortie, data.Sorties, deps);
284
- this.syndicateMissions = [];
285
- this.fissures = parseArray(Fissure, data.ActiveMissions, deps).concat(parseArray(Fissure, data.VoidStorms, deps));
286
- this.globalUpgrades = parseArray(GlobalUpgrade, data.GlobalUpgrades, deps);
287
- this.flashSales = parseArray(FlashSale, data.FlashSales, deps);
288
- this.invasions = parseArray(Invasion, data.Invasions, deps);
289
- this.darkSectors = parseArray(DarkSector, data.BadlandNodes, deps);
290
- this.voidTraders = parseArray(VoidTrader, data.VoidTraders, deps).sort((a, b) => a.activation.getTime() - b.activation.getTime());
291
- [this.voidTrader] = this.voidTraders;
292
- this.dailyDeals = parseArray(DailyDeal, data.DailyDeals, deps);
293
- this.simaris = new Simaris(safeObj(data.LibraryInfo), deps);
294
- this.conclaveChallenges = parseArray(ConclaveChallenge, data.PVPChallengeInstances, deps);
295
- this.persistentEnemies = parseArray(PersistentEnemy, data.PersistentEnemies, deps);
296
- this.earthCycle = new EarthCycle();
297
- const cetusSynd = safeArray(data.SyndicateMissions).filter((syndicate$1) => syndicate$1.Tag === "CetusSyndicate");
298
- const bountyEnd = parseDate(cetusSynd.length > 0 ? cetusSynd[0].Expiry : { $date: { $numberLong: 0 } });
299
- this.cetusCycle = new CetusCycle(bountyEnd);
300
- this.cambionCycle = new CambionCycle(this.cetusCycle);
301
- this.zarimanCycle = new ZarimanCycle(bountyEnd);
302
- this.weeklyChallenges = data.WeeklyChallenges ? new WeeklyChallenge(data.WeeklyChallenges) : void 0;
303
- this.constructionProgress = new ConstructionProgress(data.ProjectPct);
304
- this.vallisCycle = new VallisCycle();
305
- if (data.SeasonInfo) this.nightwave = new Nightwave(data.SeasonInfo, deps);
306
- const externalMissions = new Kuva(deps);
307
- ({kuva: this.kuva, arbitration: this.arbitration} = externalMissions);
308
- if (!this.arbitration || !Object.keys(this.arbitration).length) this.arbitration = {
309
- id: createHash("sha256").update("SolNode000", "utf8").digest("hex"),
310
- node: "SolNode000",
311
- nodeKey: "SolNode000",
312
- activation: /* @__PURE__ */ new Date(0),
313
- expiry: /* @__PURE__ */ new Date(864e13),
314
- enemy: "Tenno",
315
- type: "Unknown",
316
- typeKey: "Unknown",
317
- archwing: false,
318
- sharkwing: false,
319
- expired: true
320
- };
321
- this.steelPath = new SteelPathOfferings(deps);
322
- [this.vaultTrader] = parseArray(VoidTrader, data.PrimeVaultTraders, {
323
- ...deps,
324
- character: "Varzia"
325
- });
326
- [this.archonHunt] = parseArray(Sortie, data.LiteSorties, deps);
327
- this.duviriCycle = new DuviriCycle(parseArray(DuviriChoice, data.EndlessXpChoices, deps));
328
- [this.calendar] = parseArray(Calendar, data.KnownCalendarSeasons, deps);
329
- this.archimedeas = parseArray(Archimedea, data.Conquests, deps);
330
- ({kinepage: this.kinepage, sentientOutposts: this.sentientOutposts, faceoffBonus: this.faceoffBonus, questToConquerCancer: this.questToConquerCancer} = new Tmp(data.Tmp, deps));
331
- }
332
- };
333
- var WorldState_default = async (json, deps) => WorldState.build(json, deps);
334
-
335
- //#endregion
336
- export { parseAsyncArray as i, WorldState_default as n, parseArray as r, WorldState as t };