UNPKG

fnbr

Version:

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

152 lines 6.54 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const Meta_1 = tslib_1.__importDefault(require("../../util/Meta")); /** * Represents a party member meta */ class PartyMemberMeta extends Meta_1.default { /** * The currently equipped outfit CID */ get outfit() { var _a, _b, _c; return (_c = (_b = (_a = this.get('Default:AthenaCosmeticLoadout_j')) === null || _a === void 0 ? void 0 : _a.AthenaCosmeticLoadout) === null || _b === void 0 ? void 0 : _b.characterPrimaryAssetId) === null || _c === void 0 ? void 0 : _c.replace('AthenaCharacter:', ''); } /** * The currently equipped pickaxe ID */ get pickaxe() { var _a, _b, _c, _d; return (_d = (_c = (_b = (_a = this.get('Default:AthenaCosmeticLoadout_j')) === null || _a === void 0 ? void 0 : _a.AthenaCosmeticLoadout) === null || _b === void 0 ? void 0 : _b.pickaxeDef) === null || _c === void 0 ? void 0 : _c.match(/(?<=\w*\.)\w*/)) === null || _d === void 0 ? void 0 : _d.shift(); } /** * The current emote EID */ get emote() { var _a, _b, _c; const emoteAsset = (_b = (_a = this.get('Default:FrontendEmote_j')) === null || _a === void 0 ? void 0 : _a.FrontendEmote) === null || _b === void 0 ? void 0 : _b.pickable; if (emoteAsset === 'None' || !emoteAsset) return undefined; return (_c = emoteAsset.match(/(?<=\w*\.)\w*/)) === null || _c === void 0 ? void 0 : _c.shift(); } /** * The currently equipped backpack BID */ get backpack() { var _a, _b, _c, _d; return (_d = (_c = (_b = (_a = this.get('Default:AthenaCosmeticLoadout_j')) === null || _a === void 0 ? void 0 : _a.AthenaCosmeticLoadout) === null || _b === void 0 ? void 0 : _b.backpackDef) === null || _c === void 0 ? void 0 : _c.match(/(?<=\w*\.)\w*/)) === null || _d === void 0 ? void 0 : _d.shift(); } /** * The currently equipped shoes */ get shoes() { var _a, _b, _c, _d; return (_d = (_c = (_b = (_a = this.get('Default:AthenaCosmeticLoadout_j')) === null || _a === void 0 ? void 0 : _a.AthenaCosmeticLoadout) === null || _b === void 0 ? void 0 : _b.shoesDef) === null || _c === void 0 ? void 0 : _c.match(/(?<=\w*\.)\w*/)) === null || _d === void 0 ? void 0 : _d.shift(); } /** * Whether the member is ready */ get isReady() { var _a, _b; return ((_b = (_a = this.get('Default:LobbyState_j')) === null || _a === void 0 ? void 0 : _a.LobbyState) === null || _b === void 0 ? void 0 : _b.gameReadiness) === 'Ready'; } /** * Whether the member is sitting out */ get isSittingOut() { var _a, _b; return ((_b = (_a = this.get('Default:LobbyState_j')) === null || _a === void 0 ? void 0 : _a.LobbyState) === null || _b === void 0 ? void 0 : _b.gameReadiness) === 'SittingOut'; } /** * The current input method */ get input() { var _a, _b; return (_b = (_a = this.get('Default:LobbyState_j')) === null || _a === void 0 ? void 0 : _a.LobbyState) === null || _b === void 0 ? void 0 : _b.currentInputType; } /** * The cosmetic variants */ get variants() { var _a, _b; return ((_b = (_a = this.get('Default:AthenaCosmeticLoadoutVariants_j')) === null || _a === void 0 ? void 0 : _a.AthenaCosmeticLoadoutVariants) === null || _b === void 0 ? void 0 : _b.vL) || {}; } /** * The custom data store */ get customDataStore() { var _a; return ((_a = this.get('Default:ArbitraryCustomDataStore_j')) === null || _a === void 0 ? void 0 : _a.ArbitraryCustomDataStore) || []; } /** * The banner info */ get banner() { var _a; return (_a = this.get('Default:AthenaBannerInfo_j')) === null || _a === void 0 ? void 0 : _a.AthenaBannerInfo; } /** * The battle pass info */ get battlepass() { var _a; return (_a = this.get('Default:BattlePassInfo_j')) === null || _a === void 0 ? void 0 : _a.BattlePassInfo; } /** * The platform */ get platform() { var _a, _b, _c, _d; return (_d = (_c = (_b = (_a = this.get('Default:PlatformData_j')) === null || _a === void 0 ? void 0 : _a.PlatformData) === null || _b === void 0 ? void 0 : _b.platform) === null || _c === void 0 ? void 0 : _c.platformDescription) === null || _d === void 0 ? void 0 : _d.name; } /** * The match info */ get match() { var _a, _b, _c, _d; const location = (_b = (_a = this.get('Default:PackedState_j')) === null || _a === void 0 ? void 0 : _a.PackedState) === null || _b === void 0 ? void 0 : _b.location; const hasPreloadedAthena = (_d = (_c = this.get('Default:LobbyState_j')) === null || _c === void 0 ? void 0 : _c.LobbyState) === null || _d === void 0 ? void 0 : _d.hasPreloadedAthena; const playerCount = this.get('Default:NumAthenaPlayersLeft_U'); const matchStartedAt = this.get('Default:UtcTimeStartedMatchAthena_s'); return { hasPreloadedAthena, location, matchStartedAt: matchStartedAt && new Date(matchStartedAt), playerCount, }; } /** * The current island info */ get island() { var _a; return (_a = this.get('Default:CurrentIsland_j')) === null || _a === void 0 ? void 0 : _a.SelectedIsland; } /** * Whether a marker has been set */ get isMarkerSet() { var _a, _b; return !!((_b = (_a = this.get('Default:FrontEndMapMarker_j')) === null || _a === void 0 ? void 0 : _a.FrontEndMapMarker) === null || _b === void 0 ? void 0 : _b.bIsSet); } /** * The marker location [x, y] tuple. [0, 0] if there is no marker set */ get markerLocation() { var _a, _b; const marker = (_b = (_a = this.get('Default:FrontEndMapMarker_j')) === null || _a === void 0 ? void 0 : _a.FrontEndMapMarker) === null || _b === void 0 ? void 0 : _b.markerLocation; if (!marker) return [0, 0]; return [marker.y, marker.x]; } /** * Whether the member owns Save The World */ get hasPurchasedSTW() { var _a; return !!((_a = this.get('Default:PackedState_j').PackedState) === null || _a === void 0 ? void 0 : _a.hasPurchasedSTW); } } exports.default = PartyMemberMeta; //# sourceMappingURL=PartyMemberMeta.js.map