warframe-worldstate-parser
Version:
An Open parser for Warframe's Worldstate in Javascript
64 lines (63 loc) • 2.26 kB
JavaScript
import { n as __decorateMetadata, t as __decorate } from "../../decorate-BCC26nnB.mjs";
import { WorldStateObject } from "./WorldStateObject.mjs";
import { IsBoolean, IsInt, IsString, Min } from "class-validator";
import { languageDesc, languageString } from "warframe-worldstate-data/utilities";
//#region lib/models/NightwaveChallenge.ts
const repBase = 1e3;
/**
* Represents an alert
* @augments {WorldStateObject}
*/
var NightwaveChallenge = class extends WorldStateObject {
/**
* Whether or not this is a daily challenge
*/
isDaily;
/**
* Whether or not the challenge is an elite challenge
*/
isElite;
/**
* The descriptor for this challenge
*/
desc;
/**
* The title for this challenge
*/
title;
/**
* Reputation reward for ranking up in the Nightwave
*/
reputation;
/**
* Whether this challenge is permanent
*/
isPermanent;
/**
* @param data The alert data
* @param deps The dependencies object
* @param deps.locale Locale to use for translations
*/
constructor(data, { locale } = { locale: "en" }) {
super(data);
this.isDaily = data.Daily || false;
this.isElite = /hard/gi.test(data.Challenge);
this.desc = languageDesc(data.Challenge, locale);
this.title = languageString(data.Challenge, locale);
this.id = `${this.expiry.getTime()}${data.Challenge.split("/").slice(-1)[0].toLowerCase()}`;
this.reputation = repBase + (!this.isDaily ? 3500 : 0) + (this.isElite ? 2500 : 0);
this.isPermanent = Boolean(data?.Permanent);
}
};
__decorate([IsBoolean(), __decorateMetadata("design:type", Boolean)], NightwaveChallenge.prototype, "isDaily", void 0);
__decorate([IsBoolean(), __decorateMetadata("design:type", Boolean)], NightwaveChallenge.prototype, "isElite", void 0);
__decorate([IsString(), __decorateMetadata("design:type", String)], NightwaveChallenge.prototype, "desc", void 0);
__decorate([IsString(), __decorateMetadata("design:type", String)], NightwaveChallenge.prototype, "title", void 0);
__decorate([
IsInt(),
Min(0),
__decorateMetadata("design:type", Number)
], NightwaveChallenge.prototype, "reputation", void 0);
__decorate([IsBoolean(), __decorateMetadata("design:type", Boolean)], NightwaveChallenge.prototype, "isPermanent", void 0);
//#endregion
export { NightwaveChallenge };