warframe-worldstate-parser
Version:
An Open parser for Warframe's Worldstate in Javascript
70 lines (69 loc) • 2.25 kB
JavaScript
import { n as __decorateMetadata, t as __decorate } from "../../decorate-BCC26nnB.mjs";
import { Type } from "class-transformer";
import { IsBoolean, IsDate, IsString } from "class-validator";
import { parseDate } from "warframe-worldstate-data/utilities";
//#region lib/models/DarkSectorBattle.ts
/**
* Represents a battle over a dark sector
*/
var DarkSectorBattle = class {
/**
* The defenders of the dark sector
*/
defender;
/**
* Whether the defenders are an alliance or not
*/
defenderIsAlliance;
/**
* The attackers of the dark sector
*/
attacker;
/**
* Whether the attackers are an alliance or not
*/
attackerIsAlliance;
/**
* The winner of the battle
*/
winner;
/**
* The date and time at which the battle started
*/
start;
/**
* The date and time at which the battle ended
*/
end;
/**
* @param data The battle data
*/
constructor(data) {
this.defender = data.Def;
this.defenderIsAlliance = data.DefAli;
this.attacker = data.Att;
this.attackerIsAlliance = data.AttAli;
const defId = data.DefId.$oid || data.DefId.$id;
const winId = data.WinId.$oid || data.WinId.$id;
this.winner = defId === winId ? this.defender : this.attacker;
this.start = parseDate(data.Start);
this.end = parseDate(data.End);
}
};
__decorate([IsString(), __decorateMetadata("design:type", String)], DarkSectorBattle.prototype, "defender", void 0);
__decorate([IsBoolean(), __decorateMetadata("design:type", Boolean)], DarkSectorBattle.prototype, "defenderIsAlliance", void 0);
__decorate([IsString(), __decorateMetadata("design:type", String)], DarkSectorBattle.prototype, "attacker", void 0);
__decorate([IsBoolean(), __decorateMetadata("design:type", Boolean)], DarkSectorBattle.prototype, "attackerIsAlliance", void 0);
__decorate([IsString(), __decorateMetadata("design:type", String)], DarkSectorBattle.prototype, "winner", void 0);
__decorate([
IsDate(),
Type(() => Date),
__decorateMetadata("design:type", typeof Date === "undefined" ? Object : Date)
], DarkSectorBattle.prototype, "start", void 0);
__decorate([
IsDate(),
Type(() => Date),
__decorateMetadata("design:type", typeof Date === "undefined" ? Object : Date)
], DarkSectorBattle.prototype, "end", void 0);
//#endregion
export { DarkSectorBattle };