warframe-worldstate-parser
Version:
An Open parser for Warframe's Worldstate in Javascript
212 lines (211 loc) • 6.67 kB
JavaScript
import { n as __decorateMetadata, t as __decorate } from "../../decorate-BCC26nnB.mjs";
import { Reward } from "./Reward.mjs";
import { Type } from "class-transformer";
import { IsArray, IsBoolean, IsInt, IsOptional, IsString, Min, ValidateNested } from "class-validator";
import { faction, insist, languageString, missionType, node } from "warframe-worldstate-data/utilities";
//#region lib/models/Mission.ts
/**
* Represents an in-game mission
*/
var Mission = class {
/**
* The mission's description
*/
description;
/**
* The node where the mission takes place
*/
node;
/**
* Unlocalized node
*/
nodeKey;
/**
* The mission's type
*/
type;
/**
* The mission's type
*/
typeKey;
/**
* The factions that the players must fight in the mission
*/
faction;
/**
* The factions that the players must fight in the mission
*/
factionKey;
/**
* The mission's reward
*/
reward;
/**
* The minimum level of the enemies in the mission
*/
minEnemyLevel;
/**
* The maximum level of the enemies in the mission
*/
maxEnemyLevel;
/**
* The number of waves that the players need to complete (undefined if not applicable)
*/
maxWaveNum;
/**
* The Mission's nightmare boolean
*/
nightmare;
/**
* The Mission's archwing requirement
*/
archwingRequired;
/**
* The Mission's sharkwing requirement
*/
isSharkwing;
/**
* Override for the map on this mission
*/
levelOverride;
/**
* Enemy specification for the mission
*/
enemySpec;
/**
* Array of strings denoting extra spawners for a mission
*/
advancedSpawners;
/**
* Items required to enter the mission
*/
requiredItems;
/**
* Whether or not the required items are consumed
*/
consumeRequiredItems;
/**
* Target for the mission
*/
target;
/**
* Whether or not leaders are always allowed
*/
leadersAlwaysAllowed;
/**
* A tag for the event that this corresponds to
*/
goalTag;
/**
* Affectors for this mission
*/
levelAuras;
/**
* Only weapon allowed for the mission
*/
exclusiveWeapon;
/**
* @param data The mission data
* @param locale Locale to use for translations
*/
constructor(data, { locale = "en" } = { locale: "en" }) {
const deps = { locale };
insist({ ...data });
this.description = languageString(data.descText, locale);
this.node = node(data.node || data.location, locale);
this.nodeKey = node(data.node || data.location, "en");
this.type = missionType(data.missionType, locale);
this.typeKey = missionType(data.missionType, "en");
this.faction = faction(data.faction, locale);
this.factionKey = faction(data.faction, "en");
this.reward = data.missionReward ? new Reward(data.missionReward, deps) : void 0;
this.minEnemyLevel = data.minEnemyLevel;
this.maxEnemyLevel = data.maxEnemyLevel;
this.maxWaveNum = data.maxWaveNum;
this.nightmare = data.nightmare || false;
this.archwingRequired = data.archwingRequired || false;
this.isSharkwing = data.isSharkwingMission || false;
this.levelOverride = languageString(data.levelOverride, locale);
this.enemySpec = languageString(data.enemySpec, locale);
this.advancedSpawners = (data.advancedSpawners || []).map((spawner) => languageString(spawner, locale));
this.requiredItems = (data.requiredItems || []).map((reqItem) => languageString(reqItem, locale));
this.consumeRequiredItems = data.consumeRequiredItems;
this.target = data.vipAgent ? languageString(data.vipAgent, locale) : void 0;
this.leadersAlwaysAllowed = data.leadersAlwaysAllowed;
this.goalTag = data.goalTag;
this.levelAuras = (data.levelAuras || []).map((aura) => languageString(aura, locale));
this.exclusiveWeapon = languageString(data.exclusiveWeapon, locale);
}
};
__decorate([IsString(), __decorateMetadata("design:type", String)], Mission.prototype, "description", void 0);
__decorate([IsString(), __decorateMetadata("design:type", String)], Mission.prototype, "node", void 0);
__decorate([IsString(), __decorateMetadata("design:type", String)], Mission.prototype, "nodeKey", void 0);
__decorate([IsString(), __decorateMetadata("design:type", String)], Mission.prototype, "type", void 0);
__decorate([IsString(), __decorateMetadata("design:type", String)], Mission.prototype, "typeKey", void 0);
__decorate([IsString(), __decorateMetadata("design:type", String)], Mission.prototype, "faction", void 0);
__decorate([IsString(), __decorateMetadata("design:type", String)], Mission.prototype, "factionKey", void 0);
__decorate([
IsOptional(),
ValidateNested(),
Type(() => Reward),
__decorateMetadata("design:type", typeof Reward === "undefined" ? Object : Reward)
], Mission.prototype, "reward", void 0);
__decorate([
IsInt(),
Min(0),
__decorateMetadata("design:type", Number)
], Mission.prototype, "minEnemyLevel", void 0);
__decorate([
IsInt(),
Min(0),
__decorateMetadata("design:type", Number)
], Mission.prototype, "maxEnemyLevel", void 0);
__decorate([
IsOptional(),
IsInt(),
Min(0),
__decorateMetadata("design:type", Number)
], Mission.prototype, "maxWaveNum", void 0);
__decorate([IsBoolean(), __decorateMetadata("design:type", Boolean)], Mission.prototype, "nightmare", void 0);
__decorate([IsBoolean(), __decorateMetadata("design:type", Boolean)], Mission.prototype, "archwingRequired", void 0);
__decorate([IsBoolean(), __decorateMetadata("design:type", Boolean)], Mission.prototype, "isSharkwing", void 0);
__decorate([IsString(), __decorateMetadata("design:type", String)], Mission.prototype, "levelOverride", void 0);
__decorate([IsString(), __decorateMetadata("design:type", String)], Mission.prototype, "enemySpec", void 0);
__decorate([
IsArray(),
IsString({ each: true }),
__decorateMetadata("design:type", Array)
], Mission.prototype, "advancedSpawners", void 0);
__decorate([
IsArray(),
IsString({ each: true }),
__decorateMetadata("design:type", Array)
], Mission.prototype, "requiredItems", void 0);
__decorate([
IsOptional(),
IsBoolean(),
__decorateMetadata("design:type", Boolean)
], Mission.prototype, "consumeRequiredItems", void 0);
__decorate([
IsOptional(),
IsString(),
__decorateMetadata("design:type", String)
], Mission.prototype, "target", void 0);
__decorate([
IsOptional(),
IsBoolean(),
__decorateMetadata("design:type", Boolean)
], Mission.prototype, "leadersAlwaysAllowed", void 0);
__decorate([
IsOptional(),
IsString(),
__decorateMetadata("design:type", String)
], Mission.prototype, "goalTag", void 0);
__decorate([
IsArray(),
IsString({ each: true }),
__decorateMetadata("design:type", Array)
], Mission.prototype, "levelAuras", void 0);
__decorate([IsString(), __decorateMetadata("design:type", String)], Mission.prototype, "exclusiveWeapon", void 0);
//#endregion
export { Mission };