fnbr
Version:
A library to interact with Epic Games' Fortnite HTTP and XMPP services
38 lines • 1.32 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const Util_1 = require("../../util/Util");
const STWItem_1 = tslib_1.__importDefault(require("./STWItem"));
/**
* Represents a Save The World profile's hero
*/
class STWHero extends STWItem_1.default {
/**
* @param client The main client
* @param id The item ID
* @param data The hero's data
*/
constructor(client, id, data) {
super(client, id, data);
const parsedHero = (0, Util_1.parseSTWHeroTemplateId)(data.templateId);
this.type = parsedHero.type;
this.name = parsedHero.name;
this.tier = parsedHero.tier;
this.rarity = parsedHero.rarity;
this.level = data.attributes.level;
this.maxLevelBonus = data.attributes.max_level_bonus;
this.xp = data.attributes.xp;
this.isSeen = data.attributes.item_seen;
this.isFavorite = data.attributes.favorite;
this.isRefundable = data.attributes.refundable;
}
/**
* The hero's power level.
* Depends on the tier, level, and rarity value
*/
get powerLevel() {
return (0, Util_1.calcSTWNonSurvivorPowerLevel)(this.rarity, this.level, this.tier);
}
}
exports.default = STWHero;
//# sourceMappingURL=STWHero.js.map