UNPKG

fnbr

Version:

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

64 lines 2.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const defaultPartyMeta_json_1 = tslib_1.__importDefault(require("../../../resources/defaultPartyMeta.json")); const PartyMeta_1 = tslib_1.__importDefault(require("./PartyMeta")); /** * Represents the client's party meta */ class ClientPartyMeta extends PartyMeta_1.default { /** * @param party The party * @param schema The schema */ constructor(party, schema) { super({ ...defaultPartyMeta_json_1.default }); this.party = party; this.refreshSquadAssignments(); this.updatePrivacy(); if (schema) this.update(schema, true); } /** * Refreshes the member positions */ refreshSquadAssignments() { let i = 0; const assignments = []; if (this.party.me && !this.party.hiddenMemberIds.has(this.party.me.id)) { assignments.push({ memberId: this.party.client.user.self.id, absoluteMemberIdx: 0, }); i += 1; } this.party.members.forEach((m) => { if (m.id !== this.party.client.user.self.id && !this.party.hiddenMemberIds.has(m.id)) { assignments.push({ memberId: m.id, absoluteMemberIdx: i, }); i += 1; } }); const squadInformation = this.get('Default:SquadInformation_j'); return this.set('Default:SquadInformation_j', { ...squadInformation, SquadInformation: { ...squadInformation.SquadInformation, rawSquadAssignments: assignments, }, }); } updatePrivacy() { this.set('Default:PrivacySettings_j', { PrivacySettings: { partyType: this.party.config.privacy.partyType, partyInviteRestriction: this.party.config.privacy.inviteRestriction, bOnlyLeaderFriendsCanJoin: this.party.config.privacy.onlyLeaderFriendsCanJoin, }, }); } } exports.default = ClientPartyMeta; //# sourceMappingURL=ClientPartyMeta.js.map