warframe-worldstate-parser
Version:
An Open parser for Warframe's Worldstate in Javascript
125 lines (124 loc) • 3.52 kB
TypeScript
/**
* An invasion participant
* @typedef {object} InvasionParticipant
* @property {string} reward Reward for supporting this participant in the invasion
* @property {string} faction Faction of this participant (localized)
* @property {string} factionKey Faction of this participant (always English)
*/
/**
* Represents an invasion
*/
export default class Invasion extends WorldstateObject {
/**
* @param {object} data The invasion data
* @param {Dependency} deps The dependencies object
* @param {string} deps.locale Locale to use for translations
*/
constructor(data: object, { locale }?: Dependency);
/**
* The node where the invasion is taking place
* @type {string}
*/
node: string;
/**
* The node key where the invasion is taking place
* @type {string}
*/
nodeKey: string;
/**
* The invasion's description
* @type {string}
*/
desc: string;
/**
* The attacking faction
* @type {string}
*/
attackingFaction: string;
/**
* Invasion attacker
* @type {InvasionParticipant}
*/
attacker: InvasionParticipant;
/**
* Invasion defender
* @type {InvasionParticipant}
*/
defender: InvasionParticipant;
/**
* Whether this invasion is against the infestation
* @type {boolean}
*/
vsInfestation: boolean;
/**
* The signed count of completed runs. Supporting the attackers makes the count go up,
* supporting the defenders makes it go down
* @type {number}
*/
count: number;
/**
* The number of runs that one side needs to win
* @type {number}
*/
requiredRuns: number;
/**
* The invasion's completion percentage. Defenders win if it gets to 0
* Grineer vs. Corpus invasions start at 50, Infested invasions start at 100
* @type {number}
*/
completion: number;
/**
* Whether the invasion has finished
* @type {boolean}
*/
completed: boolean;
/**
* ETA string (at time of object creation)
* @type {string}
*/
eta: string;
/**
* An array containing the types of all of the invasions's rewards
* @type {Array.<string>}
*/
rewardTypes: Array<string>;
/**
* Whether or not the attackers are winning.
* This is always false when the infestation is attacking
* @returns {boolean} whether the attacker is winning
*/
isAttackerWinning(): boolean;
/**
* Get an estimation of how much time is left before the invasion ends in milliseconds
* @returns {number} remaining time in ms
*/
getRemainingTime(): number;
/**
* Get a string estimating how much time is left before the invasion ends
* @returns {string} time delta string from now to the end
*/
getETAString(): string;
/**
* Get the types of the items being rewarded in the invasion
* @returns {Array<string>} types of items being rewarded
*/
getRewardTypes(): Array<string>;
}
/**
* An invasion participant
*/
export type InvasionParticipant = {
/**
* Reward for supporting this participant in the invasion
*/
reward: string;
/**
* Faction of this participant (localized)
*/
faction: string;
/**
* Faction of this participant (always English)
*/
factionKey: string;
};
import WorldstateObject from './WorldstateObject.js';