fnbr
Version:
A library to interact with Epic Games' Fortnite HTTP and XMPP services
45 lines • 1.66 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
/* eslint-disable no-restricted-syntax */
const Base_1 = tslib_1.__importDefault(require("../Base"));
/**
* Represents a user's event tokens
*/
class EventTokens extends Base_1.default {
/**
* @param client The main client
* @param data The avatar's data
* @param user The user this avatar belongs to
*/
constructor(client, data, user) {
super(client);
this.tokens = data;
this.user = user;
this.arenaDivisionData = {};
this.geoIdentity = undefined;
for (const token of this.tokens) {
const type = token.split('_')[0];
switch (type) {
case 'ARENA':
{
let [, season, division] = token.split('_');
if (!division) {
division = season;
season = 'S9';
}
const divisionNumber = parseInt(division.replace('Division', ''), 10);
if (!this.arenaDivisionData[season.toLowerCase()] || this.arenaDivisionData[season.toLowerCase()] < divisionNumber) {
this.arenaDivisionData[season.toLowerCase()] = divisionNumber;
}
}
break;
case 'GroupIdentity':
[, , this.geoIdentity] = token.split('_');
break;
}
}
}
}
exports.default = EventTokens;
//# sourceMappingURL=EventTokens.js.map