UNPKG

warframe-worldstate-parser

Version:

An Open parser for Warframe's Worldstate in Javascript

95 lines (94 loc) 3.44 kB
import { n as __decorateMetadata, t as __decorate } from "../../decorate-BCC26nnB.mjs"; import { WorldStateObject } from "./WorldStateObject.mjs"; import { IsBoolean, IsString } from "class-validator"; import { fissureModifier, fissureTier, fromNow, missionType, node, nodeEnemy, nodeMissionType, parseDate, timeDeltaToString } from "warframe-worldstate-data/utilities"; //#region lib/models/Fissure.ts /** * Represents a fissure mission * @augments {WorldStateObject} */ var Fissure = class extends WorldStateObject { /** * The node where the fissure has appeared */ node; /** * The fissure mission type */ missionType; /** * The fissure mission type key */ missionTypeKey; /** * The faction controlling the node where the fissure has appeared */ enemy; /** * Faction enum for the faction controlling the node where the fissure has appeared */ enemyKey; /** * The node key where the fissure has appeared */ nodeKey; /** * The fissure's tier */ tier; /** * The fissure's tier as a number */ tierNum; /** * Whether this fissure corresponds to a RailJack Void Storm */ isStorm; /** * Whether this fissure is a Steel Path fissure */ isHard; /** * @param {object} data The fissure data * @param {Dependency} deps The dependencies object * @param {string} deps.locale Locale to use for translations */ constructor(data, { locale = "en" } = { locale: "en" }) { super(data); this.node = node(data.Node, locale); this.missionType = data.MissionType ? missionType(data.MissionType, locale) : nodeMissionType(data.Node, locale); this.missionTypeKey = data.MissionType ? missionType(data.MissionType) : nodeMissionType(data.Node); this.enemy = nodeEnemy(data.Node, locale); this.enemyKey = nodeEnemy(data.Node); this.nodeKey = node(data.Node); this.tier = fissureModifier(data.Modifier || data.ActiveMissionTier, locale); this.tierNum = fissureTier(data.Modifier || data.ActiveMissionTier, locale); this.activation = parseDate(data.Activation); this.expiry = parseDate(data.Expiry); this.isStorm = Boolean(data.ActiveMissionTier); this.isHard = Boolean(data.Hard); } /** * Whether this is expired (at time of object creation) */ get expired() { return fromNow(this.expiry) < 0; } /** * ETA string (at time of object creation) */ get eta() { return timeDeltaToString(fromNow(this.expiry)); } }; __decorate([IsString(), __decorateMetadata("design:type", String)], Fissure.prototype, "node", void 0); __decorate([IsString(), __decorateMetadata("design:type", String)], Fissure.prototype, "missionType", void 0); __decorate([IsString(), __decorateMetadata("design:type", String)], Fissure.prototype, "missionTypeKey", void 0); __decorate([IsString(), __decorateMetadata("design:type", String)], Fissure.prototype, "enemy", void 0); __decorate([IsString(), __decorateMetadata("design:type", String)], Fissure.prototype, "enemyKey", void 0); __decorate([IsString(), __decorateMetadata("design:type", String)], Fissure.prototype, "nodeKey", void 0); __decorate([IsString(), __decorateMetadata("design:type", String)], Fissure.prototype, "tier", void 0); __decorate([IsBoolean(), __decorateMetadata("design:type", Boolean)], Fissure.prototype, "isStorm", void 0); __decorate([IsBoolean(), __decorateMetadata("design:type", Boolean)], Fissure.prototype, "isHard", void 0); //#endregion export { Fissure };