@fnlb-project/fnbr 4.1.40 → 4.1.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/resources/BaseItemRating.json +0 -5203
- package/dist/resources/HomebaseRatingMapping.json +0 -255
- package/dist/resources/PowerLevelCurves.d.ts +0 -111
- package/dist/resources/PowerLevelCurves.js +0 -21
- package/dist/resources/PowerLevelCurves.js.map +0 -1
- package/dist/resources/SurvivorItemRating.json +0 -9343
- package/dist/src/managers/STWManager.d.ts +0 -29
- package/dist/src/managers/STWManager.js +0 -80
- package/dist/src/managers/STWManager.js.map +0 -1
- package/dist/src/managers/TournamentManager.d.ts +0 -51
- package/dist/src/managers/TournamentManager.js +0 -179
- package/dist/src/managers/TournamentManager.js.map +0 -1
- package/dist/src/stomp/EOSConnect.d.ts +0 -43
- package/dist/src/stomp/EOSConnect.js +0 -175
- package/dist/src/stomp/EOSConnect.js.map +0 -1
- package/dist/src/structures/EventTokens.d.ts +0 -32
- package/dist/src/structures/EventTokens.js +0 -45
- package/dist/src/structures/EventTokens.js.map +0 -1
- package/dist/src/structures/Tournament.d.ts +0 -86
- package/dist/src/structures/Tournament.js +0 -64
- package/dist/src/structures/Tournament.js.map +0 -1
- package/dist/src/structures/TournamentWindow.d.ts +0 -124
- package/dist/src/structures/TournamentWindow.js +0 -52
- package/dist/src/structures/TournamentWindow.js.map +0 -1
- package/dist/src/structures/stw/STWHero.d.ts +0 -61
- package/dist/src/structures/stw/STWHero.js +0 -38
- package/dist/src/structures/stw/STWHero.js.map +0 -1
- package/dist/src/structures/stw/STWHeroLoadout.d.ts +0 -44
- package/dist/src/structures/stw/STWHeroLoadout.js +0 -34
- package/dist/src/structures/stw/STWHeroLoadout.js.map +0 -1
- package/dist/src/structures/stw/STWItem.d.ts +0 -31
- package/dist/src/structures/stw/STWItem.js +0 -23
- package/dist/src/structures/stw/STWItem.js.map +0 -1
- package/dist/src/structures/stw/STWLocker.d.ts +0 -32
- package/dist/src/structures/stw/STWLocker.js +0 -26
- package/dist/src/structures/stw/STWLocker.js.map +0 -1
- package/dist/src/structures/stw/STWMeleeWeaponSchematic.d.ts +0 -14
- package/dist/src/structures/stw/STWMeleeWeaponSchematic.js +0 -15
- package/dist/src/structures/stw/STWMeleeWeaponSchematic.js.map +0 -1
- package/dist/src/structures/stw/STWNewsMessage.d.ts +0 -42
- package/dist/src/structures/stw/STWNewsMessage.js +0 -27
- package/dist/src/structures/stw/STWNewsMessage.js.map +0 -1
- package/dist/src/structures/stw/STWProfile.d.ts +0 -132
- package/dist/src/structures/stw/STWProfile.js +0 -283
- package/dist/src/structures/stw/STWProfile.js.map +0 -1
- package/dist/src/structures/stw/STWRangedWeaponSchematic.d.ts +0 -14
- package/dist/src/structures/stw/STWRangedWeaponSchematic.js +0 -15
- package/dist/src/structures/stw/STWRangedWeaponSchematic.js.map +0 -1
- package/dist/src/structures/stw/STWResource.d.ts +0 -27
- package/dist/src/structures/stw/STWResource.js +0 -22
- package/dist/src/structures/stw/STWResource.js.map +0 -1
- package/dist/src/structures/stw/STWSchematic.d.ts +0 -72
- package/dist/src/structures/stw/STWSchematic.js +0 -40
- package/dist/src/structures/stw/STWSchematic.js.map +0 -1
- package/dist/src/structures/stw/STWStats.d.ts +0 -103
- package/dist/src/structures/stw/STWStats.js +0 -85
- package/dist/src/structures/stw/STWStats.js.map +0 -1
- package/dist/src/structures/stw/STWSurvivor.d.ts +0 -104
- package/dist/src/structures/stw/STWSurvivor.js +0 -76
- package/dist/src/structures/stw/STWSurvivor.js.map +0 -1
- package/dist/src/structures/stw/STWTeamPerk.d.ts +0 -19
- package/dist/src/structures/stw/STWTeamPerk.js +0 -20
- package/dist/src/structures/stw/STWTeamPerk.js.map +0 -1
- package/dist/src/structures/stw/STWTrapSchematic.d.ts +0 -15
- package/dist/src/structures/stw/STWTrapSchematic.js +0 -16
- package/dist/src/structures/stw/STWTrapSchematic.js.map +0 -1
- package/dist/src/structures/stw/STWWeaponSchematic.d.ts +0 -15
- package/dist/src/structures/stw/STWWeaponSchematic.js +0 -16
- package/dist/src/structures/stw/STWWeaponSchematic.js.map +0 -1
- package/dist/src/util/BinaryWriter.d.ts +0 -79
- package/dist/src/util/BinaryWriter.js +0 -136
- package/dist/src/util/BinaryWriter.js.map +0 -1
- package/dist/src/util/CurveTable.d.ts +0 -24
- package/dist/src/util/CurveTable.js +0 -37
- package/dist/src/util/CurveTable.js.map +0 -1
- /package/dist/src/exceptions/{StompConnectionError.d.ts → STOMPConnectionError.d.ts} +0 -0
- /package/dist/src/exceptions/{StompConnectionError.js → STOMPConnectionError.js} +0 -0
- /package/dist/src/exceptions/{StompConnectionError.js.map → STOMPConnectionError.js.map} +0 -0
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import Base from '../Base';
|
|
2
|
-
import STWProfile from '../structures/stw/STWProfile';
|
|
3
|
-
import STWNewsMessage from '../structures/stw/STWNewsMessage';
|
|
4
|
-
import type { STWWorldInfoData } from '../../resources/structs';
|
|
5
|
-
/**
|
|
6
|
-
* Represents the client's STW manager
|
|
7
|
-
*/
|
|
8
|
-
declare class STWManager extends Base {
|
|
9
|
-
/**
|
|
10
|
-
* Fetches the Save The World profile for a players
|
|
11
|
-
* @param user The id or display name of the user
|
|
12
|
-
* @throws {UserNotFoundError} The user wasn't found
|
|
13
|
-
* @throws {EpicgamesAPIError}
|
|
14
|
-
*/
|
|
15
|
-
getProfile(user: string): Promise<STWProfile>;
|
|
16
|
-
/**
|
|
17
|
-
* Fetches the current Save The World news
|
|
18
|
-
* @param language The language of the news
|
|
19
|
-
* @throws {EpicgamesAPIError}
|
|
20
|
-
*/
|
|
21
|
-
getNews(language?: import("../../resources/structs").Language): Promise<STWNewsMessage[]>;
|
|
22
|
-
/**
|
|
23
|
-
* Fetches the current Save The World world info
|
|
24
|
-
* @param language The language of the world info
|
|
25
|
-
* @throws {EpicgamesAPIError}
|
|
26
|
-
*/
|
|
27
|
-
getWorldInfo(language?: import("../../resources/structs").Language): Promise<STWWorldInfoData>;
|
|
28
|
-
}
|
|
29
|
-
export default STWManager;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const Base_1 = tslib_1.__importDefault(require("../Base"));
|
|
5
|
-
const UserNotFoundError_1 = tslib_1.__importDefault(require("../exceptions/UserNotFoundError"));
|
|
6
|
-
const Endpoints_1 = tslib_1.__importDefault(require("../../resources/Endpoints"));
|
|
7
|
-
const enums_1 = require("../../resources/enums");
|
|
8
|
-
const EpicgamesAPIError_1 = tslib_1.__importDefault(require("../exceptions/EpicgamesAPIError"));
|
|
9
|
-
const STWProfile_1 = tslib_1.__importDefault(require("../structures/stw/STWProfile"));
|
|
10
|
-
const STWNewsMessage_1 = tslib_1.__importDefault(require("../structures/stw/STWNewsMessage"));
|
|
11
|
-
/**
|
|
12
|
-
* Represents the client's STW manager
|
|
13
|
-
*/
|
|
14
|
-
class STWManager extends Base_1.default {
|
|
15
|
-
/**
|
|
16
|
-
* Fetches the Save The World profile for a players
|
|
17
|
-
* @param user The id or display name of the user
|
|
18
|
-
* @throws {UserNotFoundError} The user wasn't found
|
|
19
|
-
* @throws {EpicgamesAPIError}
|
|
20
|
-
*/
|
|
21
|
-
async getProfile(user) {
|
|
22
|
-
const resolvedUser = await this.client.user.fetch(user);
|
|
23
|
-
if (!resolvedUser)
|
|
24
|
-
throw new UserNotFoundError_1.default(user);
|
|
25
|
-
let queryProfileResponse;
|
|
26
|
-
try {
|
|
27
|
-
queryProfileResponse = await this.client.http.epicgamesRequest({
|
|
28
|
-
method: 'POST',
|
|
29
|
-
url: `${Endpoints_1.default.MCP}/${resolvedUser.id}/public/QueryPublicProfile?profileId=campaign`,
|
|
30
|
-
headers: {
|
|
31
|
-
'Content-Type': 'application/json',
|
|
32
|
-
},
|
|
33
|
-
data: {},
|
|
34
|
-
}, enums_1.AuthSessionStoreKey.Fortnite);
|
|
35
|
-
}
|
|
36
|
-
catch (e) {
|
|
37
|
-
if (e instanceof EpicgamesAPIError_1.default && e.code === 'errors.com.epicgames.modules.profiles.profile_not_found') {
|
|
38
|
-
throw new UserNotFoundError_1.default(user);
|
|
39
|
-
}
|
|
40
|
-
throw e;
|
|
41
|
-
}
|
|
42
|
-
return new STWProfile_1.default(this.client, queryProfileResponse.profileChanges[0].profile, resolvedUser);
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Fetches the current Save The World news
|
|
46
|
-
* @param language The language of the news
|
|
47
|
-
* @throws {EpicgamesAPIError}
|
|
48
|
-
*/
|
|
49
|
-
async getNews(language = this.client.config.language) {
|
|
50
|
-
const newsResponse = await this.client.http.epicgamesRequest({
|
|
51
|
-
method: 'GET',
|
|
52
|
-
url: `${Endpoints_1.default.BR_NEWS}/savetheworldnews?lang=${language}`,
|
|
53
|
-
headers: {
|
|
54
|
-
'Accept-Language': language,
|
|
55
|
-
},
|
|
56
|
-
}, enums_1.AuthSessionStoreKey.Fortnite);
|
|
57
|
-
return newsResponse.news.messages.map((m) => new STWNewsMessage_1.default(this.client, m));
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Fetches the current Save The World world info
|
|
61
|
-
* @param language The language of the world info
|
|
62
|
-
* @throws {EpicgamesAPIError}
|
|
63
|
-
*/
|
|
64
|
-
async getWorldInfo(language = this.client.config.language) {
|
|
65
|
-
const worldInfoResponse = await this.client.http.epicgamesRequest({
|
|
66
|
-
method: 'GET',
|
|
67
|
-
url: Endpoints_1.default.STW_WORLD_INFO,
|
|
68
|
-
headers: {
|
|
69
|
-
'Accept-Language': language,
|
|
70
|
-
},
|
|
71
|
-
}, enums_1.AuthSessionStoreKey.Fortnite);
|
|
72
|
-
return {
|
|
73
|
-
theaters: worldInfoResponse.theaters,
|
|
74
|
-
missions: worldInfoResponse.missions,
|
|
75
|
-
missionAlerts: worldInfoResponse.missionAlerts,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
exports.default = STWManager;
|
|
80
|
-
//# sourceMappingURL=STWManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"STWManager.js","sourceRoot":"","sources":["../../../src/managers/STWManager.ts"],"names":[],"mappings":";;;AAAA,2DAA2B;AAC3B,gGAAgE;AAChE,kFAAkD;AAClD,iDAA4D;AAC5D,gGAAgE;AAChE,sFAAsD;AACtD,8FAA8D;AAG9D;;GAEG;AACH,MAAM,UAAW,SAAQ,cAAI;IAC3B;;;;;OAKG;IACI,KAAK,CAAC,UAAU,CAAC,IAAY;QAClC,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACxD,IAAI,CAAC,YAAY;YAAE,MAAM,IAAI,2BAAiB,CAAC,IAAI,CAAC,CAAC;QAErD,IAAI,oBAAoB,CAAC;QACzB,IAAI,CAAC;YACH,oBAAoB,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC;gBAC7D,MAAM,EAAE,MAAM;gBACd,GAAG,EAAE,GAAG,mBAAS,CAAC,GAAG,IAAI,YAAY,CAAC,EAAE,+CAA+C;gBACvF,OAAO,EAAE;oBACP,cAAc,EAAE,kBAAkB;iBACnC;gBACD,IAAI,EAAE,EAAE;aACT,EAAE,2BAAmB,CAAC,QAAQ,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,YAAY,2BAAiB,IAAI,CAAC,CAAC,IAAI,KAAK,yDAAyD,EAAE,CAAC;gBAC3G,MAAM,IAAI,2BAAiB,CAAC,IAAI,CAAC,CAAC;YACpC,CAAC;YAED,MAAM,CAAC,CAAC;QACV,CAAC;QAED,OAAO,IAAI,oBAAU,CAAC,IAAI,CAAC,MAAM,EAAE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../structures/EventTokens';
|
|
3
|
-
import Tournament from '../structures/Tournament';
|
|
4
|
-
import type { FullPlatform, Region, TournamentSessionMetadata } from '../../resources/structs';
|
|
5
|
-
import type { TournamentWindowResults } from '../../resources/httpResponses';
|
|
6
|
-
/**
|
|
7
|
-
* Represent's the client's tournament manager.
|
|
8
|
-
*/
|
|
9
|
-
declare class TournamentManager extends Base {
|
|
10
|
-
/**
|
|
11
|
-
* Downloads a file from the CDN (used for replays)
|
|
12
|
-
* @param url The URL of the file to download
|
|
13
|
-
* @param responseType The response type
|
|
14
|
-
*/
|
|
15
|
-
private downloadReplayCDNFile;
|
|
16
|
-
/**
|
|
17
|
-
* Fetches the event tokens for an account.
|
|
18
|
-
* This can be used to check if a user is eligible to play a certain tournament window
|
|
19
|
-
* or to check a user's arena division in any season
|
|
20
|
-
* @param user The id(s) or display name(s) of the user(s)
|
|
21
|
-
* @throws {UserNotFoundError} The user wasn't found
|
|
22
|
-
* @throws {EpicgamesAPIError}
|
|
23
|
-
*/
|
|
24
|
-
getEventTokens(user: string | string[]): Promise<EventTokens[]>;
|
|
25
|
-
/**
|
|
26
|
-
* Fetches the current and past Battle Royale tournaments
|
|
27
|
-
* @param region The region
|
|
28
|
-
* @param platform The platform
|
|
29
|
-
* @throws {EpicgamesAPIError}
|
|
30
|
-
*/
|
|
31
|
-
get(region?: Region, platform?: FullPlatform): Promise<Tournament[]>;
|
|
32
|
-
getData(): Promise<Tournament[]>;
|
|
33
|
-
/**
|
|
34
|
-
* Fetches a tournament session's metadata
|
|
35
|
-
* @param sessionId The session ID
|
|
36
|
-
* @throws {MatchNotFoundError} The match wasn't found
|
|
37
|
-
* @throws {EpicgamesAPIError}
|
|
38
|
-
* @throws {Error}
|
|
39
|
-
*/
|
|
40
|
-
getSessionMetadata(sessionId: string): Promise<TournamentSessionMetadata>;
|
|
41
|
-
/**
|
|
42
|
-
* Fetches the results for a tournament window
|
|
43
|
-
* @param eventId The tournament's ID
|
|
44
|
-
* @param eventWindowId The tournament window's ID
|
|
45
|
-
* @param showLiveSessions Whether to show live sessions
|
|
46
|
-
* @param page The results page index
|
|
47
|
-
* @throws {EpicgamesAPIError}
|
|
48
|
-
*/
|
|
49
|
-
getWindowResults(eventId: string, eventWindowId: string, showLiveSessions?: boolean, page?: number): Promise<TournamentWindowResults>;
|
|
50
|
-
}
|
|
51
|
-
export default TournamentManager;
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const Endpoints_1 = tslib_1.__importDefault(require("../../resources/Endpoints"));
|
|
5
|
-
const Base_1 = tslib_1.__importDefault(require("../Base"));
|
|
6
|
-
const MatchNotFoundError_1 = tslib_1.__importDefault(require("../exceptions/MatchNotFoundError"));
|
|
7
|
-
const EventTokens_1 = tslib_1.__importDefault(require("../structures/EventTokens"));
|
|
8
|
-
const Tournament_1 = tslib_1.__importDefault(require("../structures/Tournament"));
|
|
9
|
-
const enums_1 = require("../../resources/enums");
|
|
10
|
-
/**
|
|
11
|
-
* Represent's the client's tournament manager.
|
|
12
|
-
*/
|
|
13
|
-
class TournamentManager extends Base_1.default {
|
|
14
|
-
/**
|
|
15
|
-
* Downloads a file from the CDN (used for replays)
|
|
16
|
-
* @param url The URL of the file to download
|
|
17
|
-
* @param responseType The response type
|
|
18
|
-
*/
|
|
19
|
-
async downloadReplayCDNFile(url, responseType) {
|
|
20
|
-
const fileLocationInfo = await this.client.http.epicgamesRequest({
|
|
21
|
-
method: 'GET',
|
|
22
|
-
url,
|
|
23
|
-
}, enums_1.AuthSessionStoreKey.Fortnite);
|
|
24
|
-
const file = await this.client.http.request({
|
|
25
|
-
method: 'GET',
|
|
26
|
-
url: Object.values(fileLocationInfo.files)[0].readLink,
|
|
27
|
-
responseType,
|
|
28
|
-
});
|
|
29
|
-
return file;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Fetches the event tokens for an account.
|
|
33
|
-
* This can be used to check if a user is eligible to play a certain tournament window
|
|
34
|
-
* or to check a user's arena division in any season
|
|
35
|
-
* @param user The id(s) or display name(s) of the user(s)
|
|
36
|
-
* @throws {UserNotFoundError} The user wasn't found
|
|
37
|
-
* @throws {EpicgamesAPIError}
|
|
38
|
-
*/
|
|
39
|
-
async getEventTokens(user) {
|
|
40
|
-
const users = typeof user === 'string' ? [user] : user;
|
|
41
|
-
const resolvedUsers = await this.client.user.fetchMultiple(users);
|
|
42
|
-
const userChunks = resolvedUsers.map((u) => u.id).reduce((resArr, usr, i) => {
|
|
43
|
-
const chunkIndex = Math.floor(i / 16);
|
|
44
|
-
// eslint-disable-next-line no-param-reassign
|
|
45
|
-
if (!resArr[chunkIndex])
|
|
46
|
-
resArr[chunkIndex] = [];
|
|
47
|
-
resArr[chunkIndex].push(usr);
|
|
48
|
-
return resArr;
|
|
49
|
-
}, []);
|
|
50
|
-
const statsResponses = await Promise.all(userChunks.map((c) => this.client.http.epicgamesRequest({
|
|
51
|
-
method: 'GET',
|
|
52
|
-
url: `${Endpoints_1.default.BR_TOURNAMENT_TOKENS}?teamAccountIds=${c.join(',')}`,
|
|
53
|
-
}, enums_1.AuthSessionStoreKey.Fortnite)));
|
|
54
|
-
return statsResponses.map((r) => r.accounts).flat(1)
|
|
55
|
-
.map((r) => new EventTokens_1.default(this.client, r.tokens, resolvedUsers.find((u) => u.id === r.accountId)));
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Fetches the current and past Battle Royale tournaments
|
|
59
|
-
* @param region The region
|
|
60
|
-
* @param platform The platform
|
|
61
|
-
* @throws {EpicgamesAPIError}
|
|
62
|
-
*/
|
|
63
|
-
async get(region = 'EU', platform = 'Windows') {
|
|
64
|
-
const [tournaments, tournamentsInfo] = await Promise.all([
|
|
65
|
-
this.client.http.epicgamesRequest({
|
|
66
|
-
method: 'GET',
|
|
67
|
-
url: `${Endpoints_1.default.BR_TOURNAMENTS_DOWNLOAD}/${this.client.user.self.id}?region=${region}`
|
|
68
|
-
+ `&platform=${platform}&teamAccountIds=${this.client.user.self.id}`,
|
|
69
|
-
}, enums_1.AuthSessionStoreKey.Fortnite),
|
|
70
|
-
this.client.http.epicgamesRequest({
|
|
71
|
-
method: 'GET',
|
|
72
|
-
url: `${Endpoints_1.default.BR_NEWS}/tournamentinformation`,
|
|
73
|
-
}, enums_1.AuthSessionStoreKey.Fortnite),
|
|
74
|
-
]);
|
|
75
|
-
const constuctedTournaments = [];
|
|
76
|
-
tournaments.events.forEach((t) => {
|
|
77
|
-
var _a, _b, _c;
|
|
78
|
-
let tournamentDisplayData = (_b = (_a = tournamentsInfo.tournament_info) === null || _a === void 0 ? void 0 : _a.tournaments) === null || _b === void 0 ? void 0 : _b.find((td) => td.tournament_display_id === t.displayDataId);
|
|
79
|
-
if (!tournamentDisplayData) {
|
|
80
|
-
tournamentDisplayData = (_c = Object.values(tournamentsInfo)
|
|
81
|
-
.find((tdr) => { var _a; return ((_a = tdr.tournament_info) === null || _a === void 0 ? void 0 : _a.tournament_display_id) === t.displayDataId; })) === null || _c === void 0 ? void 0 : _c.tournament_info;
|
|
82
|
-
}
|
|
83
|
-
if (!tournamentDisplayData) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
const templates = [];
|
|
87
|
-
t.eventWindows.forEach((w) => {
|
|
88
|
-
const template = tournaments.templates
|
|
89
|
-
.find((tt) => tt.eventTemplateId === w.eventTemplateId);
|
|
90
|
-
if (template)
|
|
91
|
-
templates.push({ windowId: w.eventWindowId, templateData: template });
|
|
92
|
-
});
|
|
93
|
-
constuctedTournaments.push(new Tournament_1.default(this.client, t, tournamentDisplayData, templates));
|
|
94
|
-
});
|
|
95
|
-
return constuctedTournaments;
|
|
96
|
-
}
|
|
97
|
-
async getData() {
|
|
98
|
-
const tournaments = await this.client.http.epicgamesRequest({
|
|
99
|
-
method: 'GET',
|
|
100
|
-
url: `${Endpoints_1.default.BR_TOURNAMENTS}/${this.client.user.self.id}`,
|
|
101
|
-
}, enums_1.AuthSessionStoreKey.Fortnite);
|
|
102
|
-
const tournamentsInfo = await this.client.http.epicgamesRequest({
|
|
103
|
-
method: 'GET',
|
|
104
|
-
url: `${Endpoints_1.default.BR_NEWS}/tournamentinformation`,
|
|
105
|
-
}, enums_1.AuthSessionStoreKey.Fortnite);
|
|
106
|
-
const constuctedTournaments = [];
|
|
107
|
-
tournaments.events.forEach((t) => {
|
|
108
|
-
var _a, _b, _c;
|
|
109
|
-
let tournamentDisplayData = (_b = (_a = tournamentsInfo.tournament_info) === null || _a === void 0 ? void 0 : _a.tournaments) === null || _b === void 0 ? void 0 : _b.find((td) => td.tournament_display_id === t.displayDataId);
|
|
110
|
-
if (!tournamentDisplayData) {
|
|
111
|
-
tournamentDisplayData = (_c = Object.values(tournamentsInfo)
|
|
112
|
-
.find((tdr) => { var _a; return ((_a = tdr.tournament_info) === null || _a === void 0 ? void 0 : _a.tournament_display_id) === t.displayDataId; })) === null || _c === void 0 ? void 0 : _c.tournament_info;
|
|
113
|
-
}
|
|
114
|
-
if (!tournamentDisplayData) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
const templates = [];
|
|
118
|
-
t.eventWindows.forEach((w) => {
|
|
119
|
-
const template = tournaments.templates
|
|
120
|
-
.find((tt) => tt.eventTemplateId === w.eventTemplateId);
|
|
121
|
-
if (template)
|
|
122
|
-
templates.push({ windowId: w.eventWindowId, templateData: template });
|
|
123
|
-
});
|
|
124
|
-
constuctedTournaments.push(new Tournament_1.default(this.client, t, tournamentDisplayData, templates));
|
|
125
|
-
});
|
|
126
|
-
return constuctedTournaments;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Fetches a tournament session's metadata
|
|
130
|
-
* @param sessionId The session ID
|
|
131
|
-
* @throws {MatchNotFoundError} The match wasn't found
|
|
132
|
-
* @throws {EpicgamesAPIError}
|
|
133
|
-
* @throws {Error}
|
|
134
|
-
*/
|
|
135
|
-
async getSessionMetadata(sessionId) {
|
|
136
|
-
let replayMetadataResponse;
|
|
137
|
-
try {
|
|
138
|
-
replayMetadataResponse = await this.downloadReplayCDNFile(`${Endpoints_1.default.BR_REPLAY_METADATA}%2F${sessionId}.json`, 'json');
|
|
139
|
-
}
|
|
140
|
-
catch (e) {
|
|
141
|
-
if (e instanceof Error) {
|
|
142
|
-
throw new MatchNotFoundError_1.default(sessionId);
|
|
143
|
-
}
|
|
144
|
-
throw e;
|
|
145
|
-
}
|
|
146
|
-
return {
|
|
147
|
-
changelist: replayMetadataResponse.Changelist,
|
|
148
|
-
checkpoints: replayMetadataResponse.Checkpoints,
|
|
149
|
-
dataChunks: replayMetadataResponse.DataChunks,
|
|
150
|
-
desiredDelayInSeconds: replayMetadataResponse.DesiredDelayInSeconds,
|
|
151
|
-
events: replayMetadataResponse.Events,
|
|
152
|
-
friendlyName: replayMetadataResponse.FriendlyName,
|
|
153
|
-
lengthInMS: replayMetadataResponse.LengthInMS,
|
|
154
|
-
networkVersion: replayMetadataResponse.NetworkVersion,
|
|
155
|
-
replayName: replayMetadataResponse.ReplayName,
|
|
156
|
-
timestamp: new Date(replayMetadataResponse.Timestamp),
|
|
157
|
-
isCompressed: replayMetadataResponse.bCompressed,
|
|
158
|
-
isLive: replayMetadataResponse.bIsLive,
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Fetches the results for a tournament window
|
|
163
|
-
* @param eventId The tournament's ID
|
|
164
|
-
* @param eventWindowId The tournament window's ID
|
|
165
|
-
* @param showLiveSessions Whether to show live sessions
|
|
166
|
-
* @param page The results page index
|
|
167
|
-
* @throws {EpicgamesAPIError}
|
|
168
|
-
*/
|
|
169
|
-
async getWindowResults(eventId, eventWindowId, showLiveSessions = false, page = 0) {
|
|
170
|
-
const window = await this.client.http.epicgamesRequest({
|
|
171
|
-
method: 'GET',
|
|
172
|
-
url: `${Endpoints_1.default.BR_TOURNAMENT_WINDOW}/${eventId}/${eventWindowId}/`
|
|
173
|
-
+ `${this.client.user.self.id}?page=${page}&rank=0&teamAccountIds=&appId=Fortnite&showLiveSessions=${showLiveSessions}`,
|
|
174
|
-
}, enums_1.AuthSessionStoreKey.Fortnite);
|
|
175
|
-
return window;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
exports.default = TournamentManager;
|
|
179
|
-
//# sourceMappingURL=TournamentManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TournamentManager.js","sourceRoot":"","sources":["../../../src/managers/TournamentManager.ts"],"names":[],"mappings":";;;AAAA,kFAAkD;AAClD,2DAA2B;AAC3B,kGAAkE;AAClE,oFAAoD;AACpD,kFAAkD;AAClD,iDAA4D;AAS5D;;GAEG;AACH,MAAM,iBAAkB,SAAQ,cAAI;IAClC;;;;OAIG;IACK,KAAK,CAAC,qBAAqB,CAAC,GAAW,EAAE,YAAoC;QACnF,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC;YAC/D,MAAM,EAAE,KAAK;YACb,GAAG;SACJ,EAAE,2BAAmB,CAAC,QAAQ,CAAC,CAAC;QAEjC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;YAC1C,MAAM,EAAE,KAAK;YACb,GAAG,EAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAS,CAAC,QAAQ;YAC/D,YAAY;SACb,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,cAAc,CAAC,IAAuB;QACjD,MAAM,KAAK,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAEvD,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC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2DAA2D,gBAAgB,EAAE;SAC3H,EAAE,2BAAmB,CAAC,QAAQ,CAAC,CAAC;QAEjC,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAED,kBAAe,iBAAiB,CAAC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import Base from '../Base';
|
|
2
|
-
import type Client from '../Client';
|
|
3
|
-
/**
|
|
4
|
-
* Represents the client's EOS Connect STOMP manager (i.e. chat messages)
|
|
5
|
-
*/
|
|
6
|
-
declare class EOSConnect extends Base {
|
|
7
|
-
/**
|
|
8
|
-
* private stomp connection
|
|
9
|
-
*/
|
|
10
|
-
private stompConnection?;
|
|
11
|
-
/**
|
|
12
|
-
* private stomp connection id (i.e. used for eos presence)
|
|
13
|
-
*/
|
|
14
|
-
private stompConnectionId?;
|
|
15
|
-
/**
|
|
16
|
-
* @param client The main client
|
|
17
|
-
*/
|
|
18
|
-
constructor(client: Client);
|
|
19
|
-
/**
|
|
20
|
-
* Whether the internal websocket is connected
|
|
21
|
-
*/
|
|
22
|
-
get isConnected(): boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Returns the eos stomp connection id
|
|
25
|
-
*/
|
|
26
|
-
get connectionId(): string | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* connect to the eos connect stomp server
|
|
29
|
-
*/
|
|
30
|
-
connect(): Promise<unknown>;
|
|
31
|
-
/**
|
|
32
|
-
* Disconnects the stomp websocket client.
|
|
33
|
-
* Also performs a cleanup
|
|
34
|
-
*/
|
|
35
|
-
disconnect(): void;
|
|
36
|
-
/**
|
|
37
|
-
* Sets up the subscription for the deployment
|
|
38
|
-
* @param connectionResolve connect promise resolve
|
|
39
|
-
* @param connectionReject connect promise reject
|
|
40
|
-
*/
|
|
41
|
-
private setupSubscription;
|
|
42
|
-
}
|
|
43
|
-
export default EOSConnect;
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const stompjs_1 = require("@stomp/stompjs");
|
|
5
|
-
const ws_1 = tslib_1.__importDefault(require("ws"));
|
|
6
|
-
const Base_1 = tslib_1.__importDefault(require("../Base"));
|
|
7
|
-
const enums_1 = require("../../resources/enums");
|
|
8
|
-
const AuthenticationMissingError_1 = tslib_1.__importDefault(require("../exceptions/AuthenticationMissingError"));
|
|
9
|
-
const StompConnectionError_1 = tslib_1.__importDefault(require("../exceptions/StompConnectionError"));
|
|
10
|
-
const Endpoints_1 = tslib_1.__importDefault(require("../../resources/Endpoints"));
|
|
11
|
-
const ReceivedFriendMessage_1 = tslib_1.__importDefault(require("../structures/friend/ReceivedFriendMessage"));
|
|
12
|
-
const PartyMessage_1 = tslib_1.__importDefault(require("../structures/party/PartyMessage"));
|
|
13
|
-
/**
|
|
14
|
-
* Represents the client's EOS Connect STOMP manager (i.e. chat messages)
|
|
15
|
-
*/
|
|
16
|
-
class EOSConnect extends Base_1.default {
|
|
17
|
-
/**
|
|
18
|
-
* @param client The main client
|
|
19
|
-
*/
|
|
20
|
-
constructor(client) {
|
|
21
|
-
super(client);
|
|
22
|
-
this.stompConnection = undefined;
|
|
23
|
-
this.stompConnectionId = undefined;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Whether the internal websocket is connected
|
|
27
|
-
*/
|
|
28
|
-
get isConnected() {
|
|
29
|
-
return !!this.stompConnection && this.stompConnection.connected;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Returns the eos stomp connection id
|
|
33
|
-
*/
|
|
34
|
-
get connectionId() {
|
|
35
|
-
return this.stompConnectionId;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* connect to the eos connect stomp server
|
|
39
|
-
*/
|
|
40
|
-
async connect() {
|
|
41
|
-
if (!this.client.auth.sessions.has(enums_1.AuthSessionStoreKey.FortniteEOS)) {
|
|
42
|
-
throw new AuthenticationMissingError_1.default(enums_1.AuthSessionStoreKey.FortniteEOS);
|
|
43
|
-
}
|
|
44
|
-
return new Promise((resolve, reject) => {
|
|
45
|
-
const brokerURL = `wss://${Endpoints_1.default.EOS_STOMP}`;
|
|
46
|
-
this.stompConnection = new stompjs_1.Client({
|
|
47
|
-
brokerURL,
|
|
48
|
-
stompVersions: new stompjs_1.Versions([stompjs_1.Versions.V1_0, stompjs_1.Versions.V1_1, stompjs_1.Versions.V1_2]),
|
|
49
|
-
heartbeatOutgoing: 30000,
|
|
50
|
-
heartbeatIncoming: 0,
|
|
51
|
-
webSocketFactory: () => new ws_1.default(brokerURL, {
|
|
52
|
-
headers: {
|
|
53
|
-
Authorization: `Bearer ${this.client.auth.sessions.get(enums_1.AuthSessionStoreKey.FortniteEOS).accessToken}`,
|
|
54
|
-
'Sec-Websocket-Protocol': 'v10.stomp,v11.stomp,v12.stomp',
|
|
55
|
-
'Epic-Connect-Protocol': 'stomp',
|
|
56
|
-
'Epic-Connect-Device-Id': '',
|
|
57
|
-
},
|
|
58
|
-
}),
|
|
59
|
-
debug: (str) => {
|
|
60
|
-
var _a, _b;
|
|
61
|
-
(_b = (_a = this.client.config).stompEosConnectDebug) === null || _b === void 0 ? void 0 : _b.call(_a, str);
|
|
62
|
-
},
|
|
63
|
-
onConnect: () => {
|
|
64
|
-
this.setupSubscription(resolve, reject);
|
|
65
|
-
},
|
|
66
|
-
onStompError: (frame) => {
|
|
67
|
-
reject(new StompConnectionError_1.default(frame.body, -1));
|
|
68
|
-
},
|
|
69
|
-
onWebSocketError: (event) => {
|
|
70
|
-
const errorEvent = event;
|
|
71
|
-
if (errorEvent.error || errorEvent.message) {
|
|
72
|
-
let error = undefined;
|
|
73
|
-
if (errorEvent.error instanceof Error) {
|
|
74
|
-
error = errorEvent.error;
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
error = new Error(errorEvent.message);
|
|
78
|
-
}
|
|
79
|
-
error.message += ' (eos connect stomp)';
|
|
80
|
-
reject(error);
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
this.client.debug('[STOMP EOS Connect] Connecting...');
|
|
85
|
-
this.stompConnection.activate();
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Disconnects the stomp websocket client.
|
|
90
|
-
* Also performs a cleanup
|
|
91
|
-
*/
|
|
92
|
-
disconnect() {
|
|
93
|
-
if (!this.stompConnection)
|
|
94
|
-
return;
|
|
95
|
-
this.stompConnection.forceDisconnect();
|
|
96
|
-
this.stompConnection.deactivate();
|
|
97
|
-
this.stompConnection = undefined;
|
|
98
|
-
this.stompConnectionId = undefined;
|
|
99
|
-
this.client.debug('[STOMP EOS Connect] Disconnected');
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Sets up the subscription for the deployment
|
|
103
|
-
* @param connectionResolve connect promise resolve
|
|
104
|
-
* @param connectionReject connect promise reject
|
|
105
|
-
*/
|
|
106
|
-
setupSubscription(connectionResolve, connectionReject) {
|
|
107
|
-
this.stompConnection.subscribe(`${this.client.config.eosDeploymentId}/account/${this.client.user.self.id}`, async (message) => {
|
|
108
|
-
var _a, _b, _c;
|
|
109
|
-
if (!((_a = message.headers['content-type']) === null || _a === void 0 ? void 0 : _a.includes('application/json'))) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
const messageData = JSON.parse(message.body);
|
|
113
|
-
(_c = (_b = this.client.config).stompEosConnectDebug) === null || _c === void 0 ? void 0 : _c.call(_b, message.body);
|
|
114
|
-
this.client.debug(`new message '${messageData.type}' - ${message.body}`, 'eos-connect');
|
|
115
|
-
switch (messageData.type) {
|
|
116
|
-
case 'core.connect.v1.connected': {
|
|
117
|
-
this.stompConnectionId = messageData.connectionId;
|
|
118
|
-
this.client.debug(`[STOMP EOS Connect] Connected as ${messageData.connectionId}`);
|
|
119
|
-
connectionResolve(messageData.connectionId);
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
case 'core.connect.v1.connect-failed': {
|
|
123
|
-
this.client.debug(`failed connecting to eos connect: ${messageData.statusCode} - ${messageData.message}`);
|
|
124
|
-
connectionReject(new StompConnectionError_1.default(messageData.message, messageData.statusCode));
|
|
125
|
-
break;
|
|
126
|
-
}
|
|
127
|
-
case 'social.chat.v1.NEW_WHISPER': {
|
|
128
|
-
const { senderId, body, time } = messageData.payload.message;
|
|
129
|
-
const friend = this.client.friend.list.get(senderId);
|
|
130
|
-
if (!friend || senderId === this.client.user.self.id) {
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
const friendMessage = new ReceivedFriendMessage_1.default(this.client, {
|
|
134
|
-
content: body || '',
|
|
135
|
-
author: friend,
|
|
136
|
-
id: messageData.id,
|
|
137
|
-
sentAt: new Date(time),
|
|
138
|
-
});
|
|
139
|
-
this.client.emit('friend:message', friendMessage);
|
|
140
|
-
break;
|
|
141
|
-
}
|
|
142
|
-
case 'social.chat.v1.NEW_MESSAGE': {
|
|
143
|
-
if (messageData.payload.conversation.type !== 'party') {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
await this.client.partyLock.wait();
|
|
147
|
-
const { conversation: { conversationId }, message: { senderId, body, time } } = messageData.payload;
|
|
148
|
-
const partyId = conversationId.replace('p-', '');
|
|
149
|
-
if (!this.client.party
|
|
150
|
-
|| this.client.party.id !== partyId
|
|
151
|
-
|| senderId === this.client.user.self.id) {
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
const authorMember = this.client.party.members.get(senderId);
|
|
155
|
-
if (!authorMember) {
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
const partyMessage = new PartyMessage_1.default(this.client, {
|
|
159
|
-
content: body || '',
|
|
160
|
-
author: authorMember,
|
|
161
|
-
sentAt: new Date(time),
|
|
162
|
-
id: messageData.id,
|
|
163
|
-
party: this.client.party,
|
|
164
|
-
});
|
|
165
|
-
this.client.emit('party:member:message', partyMessage);
|
|
166
|
-
break;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}, {
|
|
170
|
-
id: 'sub-0',
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
exports.default = EOSConnect;
|
|
175
|
-
//# sourceMappingURL=EOSConnect.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EOSConnect.js","sourceRoot":"","sources":["../../../src/stomp/EOSConnect.ts"],"names":[],"mappings":";;;AAAA,4CAAiE;AACjE,oDAAgD;AAChD,2DAA2B;AAC3B,iDAA4D;AAC5D,kHAAkF;AAClF,sGAAsE;AACtE,kFAAkD;AAClD,+GAA+E;AAC/E,4FAA4D;AAK5D;;GAEG;AACH,MAAM,UAAW,SAAQ,cAAI;IAW3B;;OAEG;IACH,YAAY,MAAc;QACxB,KAAK,CAAC,MAAM,CAAC,CAAC;QAEd,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;QACjC,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,IAAW,WAAW;QACpB,OAAO,CAAC,CAAC,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC;IAClE,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,OAAO;QAClB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,2BAAmB,CAAC,WAAW,CAAC,EAAE,CAAC;YACpE,MAAM,IAAI,oCAA0B,CAAC,2BAAmB,CAAC,WAAW,CAAC,CAAC;QACxE,CAAC;QAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,MAAM,SAAS,GAAG,SAAS,mBAAS,CAAC,SAAS,EAAE,CAAC;YAEjD,IAAI,CAAC,eAAe,GAAG,IAAI,gBAAW,CAAC;gBACrC,SAAS;gBACT,a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E,WAAW,CAAC,EAAG;wBACnB,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK;qBACzB,CAAC,CAAC;oBAEH,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,EAAE,YAAY,CAAC,CAAC;oBACvD,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC,EACD;YACE,EAAE,EAAE,OAAO;SACZ,CACF,CAAC;IACJ,CAAC;CACF;AAED,kBAAe,UAAU,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import Base from '../Base';
|
|
2
|
-
import type User from './user/User';
|
|
3
|
-
import type Client from '../Client';
|
|
4
|
-
import type { ArenaDivisionData } from '../../resources/structs';
|
|
5
|
-
/**
|
|
6
|
-
* Represents a user's event tokens
|
|
7
|
-
*/
|
|
8
|
-
declare class EventTokens extends Base {
|
|
9
|
-
/**
|
|
10
|
-
* The user the event tokens belong to
|
|
11
|
-
*/
|
|
12
|
-
user: User;
|
|
13
|
-
/**
|
|
14
|
-
* The raw event tokens
|
|
15
|
-
*/
|
|
16
|
-
tokens: string[];
|
|
17
|
-
/**
|
|
18
|
-
* The user's arena division data
|
|
19
|
-
*/
|
|
20
|
-
arenaDivisionData: ArenaDivisionData;
|
|
21
|
-
/**
|
|
22
|
-
* The user's geo identity
|
|
23
|
-
*/
|
|
24
|
-
geoIdentity?: string;
|
|
25
|
-
/**
|
|
26
|
-
* @param client The main client
|
|
27
|
-
* @param data The avatar's data
|
|
28
|
-
* @param user The user this avatar belongs to
|
|
29
|
-
*/
|
|
30
|
-
constructor(client: Client, data: string[], user: User);
|
|
31
|
-
}
|
|
32
|
-
export default EventTokens;
|