UNPKG

fnbr

Version:

A library to interact with Epic Games' Fortnite HTTP and XMPP services

85 lines 4.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const Base_1 = tslib_1.__importDefault(require("../../Base")); /** * Represents a Save The World profile's stats */ class STWStats extends Base_1.default { /** * @param client The main client * @param data The stats data */ constructor(client, data) { var _a, _b, _c, _d, _e, _f; super(client); this.nodeCosts = data.node_costs; this.stwLoadout = { selectedHeroLoadout: data.selected_hero_loadout, modeLoadouts: data.mode_loadouts, activeLoadoutIndex: data.active_loadout_index, }; this.brLoadout = { loadouts: data.loadouts, lastAppliedLoadout: data.last_applied_loadout, useRandomLoadout: data.use_random_loadout, }; this.missionAlertRedemptionRecord = (_a = data.mission_alert_redemption_record.claimData) === null || _a === void 0 ? void 0 : _a.map((d) => ({ missionAlertId: d.missionAlertId, redemptionDateUtc: new Date(d.redemptionDateUtc), evictClaimDataAfterUtc: new Date(d.evictClaimDataAfterUtc), })); this.rewardsClaimedPostMaxLevel = data.rewards_claimed_post_max_level || 0; this.collectionBookMaxXPLevel = (_b = data.collection_book) === null || _b === void 0 ? void 0 : _b.maxBookXpLevelAchieved; this.mfaRewardClaimed = data.mfa_reward_claimed; this.quests = ((_c = data.quest_manager) === null || _c === void 0 ? void 0 : _c.questPoolStats) ? { dailyLoginInterval: new Date(data.quest_manager.dailyLoginInterval), dailyQuestRerolls: data.quest_manager.dailyQuestRerolls, poolStats: { stats: data.quest_manager.questPoolStats.poolStats.map((d) => ({ poolName: d.poolName, nextRefresh: new Date(d.nextRefresh), rerollsRemaining: d.rerollsRemaining, questHistory: d.questHistory, })), dailyLoginInterval: new Date(data.quest_manager.questPoolStats.dailyLoginInterval), lockouts: ((_d = data.quest_manager.questPoolStats.poolLockouts) === null || _d === void 0 ? void 0 : _d.poolLockouts) || [], }, } : undefined; this.legacyResearchPointsSpent = data.legacy_research_points_spent; this.gameplayStats = data.gameplay_stats; this.unslotMtxSpend = data.unslot_mtx_spend; this.clientSettings = data.client_settings; this.researchLevels = typeof ((_e = data.research_levels) === null || _e === void 0 ? void 0 : _e.fortitude) === 'number' ? { fortitude: data.research_levels.fortitude, resistance: data.research_levels.resistance, technology: data.research_levels.technology, offense: data.research_levels.offense, } : undefined; this.level = data.level || 0; this.latentXpMarker = data.latent_xp_marker; this.eventCurrency = data.event_currency; this.inventoryLimitBonus = data.inventory_limit_bonus; this.matchesPlayed = data.matches_played; this.xp = { total: data.xp, overflow: data.xp_overflow, lost: data.xp_lost, }; this.dailyRewards = ((_f = data.daily_rewards) === null || _f === void 0 ? void 0 : _f.lastClaimDate) ? { nextDefaultReward: data.daily_rewards.nextDefaultReward, totalDaysLoggedIn: data.daily_rewards.totalDaysLoggedIn, lastClaimDate: new Date(data.daily_rewards.lastClaimDate), additionalSchedules: data.daily_rewards.additionalSchedules, } : undefined; this.packsGranted = data.packs_granted; } /** * The profile's actual account level (ignoring the max level cap of 310) */ get actualLevel() { return this.level + this.rewardsClaimedPostMaxLevel; } } exports.default = STWStats; //# sourceMappingURL=STWStats.js.map