UNPKG

warframe-worldstate-parser

Version:

An Open parser for Warframe's Worldstate in Javascript

68 lines (67 loc) 1.8 kB
import { n as __decorateMetadata, t as __decorate } from "../../decorate-BCC26nnB.mjs"; import { Mission } from "./Mission.mjs"; import { WorldStateObject } from "./WorldStateObject.mjs"; import { Type } from "class-transformer"; import { IsArray, IsOptional, IsString, ValidateNested } from "class-validator"; import { fromNow, timeDeltaToString } from "warframe-worldstate-data/utilities"; //#region lib/models/Alert.ts /** * Represents an alert * @augments {WorldStateObject} */ var Alert = class extends WorldStateObject { /** * The mission that the players have to complete */ mission; /** * An array containing the types of all of the alert's rewards */ rewardTypes; /** * A tag that DE occasionally provides, such as `LotusGift` */ tag; constructor(data, { locale = "en" } = { locale: "en" }) { super(data); const deps = { locale }; this.mission = new Mission(data.MissionInfo, deps); this.rewardTypes = this.reward?.getTypes()?.length ? this.reward.getTypes() : ["credits"]; this.tag = data.Tag || void 0; } /** * Alert's description */ get description() { return this.mission.description; } /** * Alert rewards */ get reward() { return this.mission.reward; } /** * How much time is left before the alert expires */ get eta() { return timeDeltaToString(fromNow(this.expiry)); } }; __decorate([ ValidateNested(), Type(() => Mission), __decorateMetadata("design:type", typeof Mission === "undefined" ? Object : Mission) ], Alert.prototype, "mission", void 0); __decorate([ IsArray(), IsString({ each: true }), __decorateMetadata("design:type", Array) ], Alert.prototype, "rewardTypes", void 0); __decorate([ IsOptional(), IsString(), __decorateMetadata("design:type", String) ], Alert.prototype, "tag", void 0); //#endregion export { Alert };