@arkadiuminc/sdk 2.48.0 → 2.50.0
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/pkg/api/features/nakama/nakama-provider.d.ts +4 -5
- package/dist/pkg/api/features/tournaments/index.d.ts +72 -0
- package/dist/pkg/api/features/tournaments/tournaments.test.d.ts +1 -0
- package/dist/pkg/api/features/wallet/index.d.ts +4 -0
- package/dist/pkg/arkadium-arena-sdk.d.ts +3 -1
- package/dist/pkg/arkadium-game-sdk.d.ts +4 -1
- package/package.json +1 -1
|
@@ -7,19 +7,17 @@ import { ApiAccount } from '@heroiclabs/nakama-js/dist/api.gen';
|
|
|
7
7
|
export declare type RpcGetNkUserByEagleIdParams = {
|
|
8
8
|
EagleUserId: string | number;
|
|
9
9
|
};
|
|
10
|
-
export declare type RpcGetNkUserByEagleUserNameParams = {
|
|
11
|
-
EagleUserName: string | number;
|
|
12
|
-
};
|
|
13
10
|
export interface RpcGetNkUserResponse {
|
|
14
11
|
CustomId: string;
|
|
15
12
|
UserId: string;
|
|
16
13
|
UserName: string;
|
|
17
|
-
|
|
14
|
+
Message: string | null;
|
|
18
15
|
}
|
|
19
16
|
export interface NakamaContext {
|
|
20
17
|
client: NakamaClient | null;
|
|
21
18
|
session: NakamaSession | null;
|
|
22
19
|
socket: NakamaSocket | null;
|
|
20
|
+
gameId?: string;
|
|
23
21
|
}
|
|
24
22
|
export declare class NakamaProvider {
|
|
25
23
|
private host;
|
|
@@ -31,17 +29,18 @@ export declare class NakamaProvider {
|
|
|
31
29
|
private env;
|
|
32
30
|
private gameId;
|
|
33
31
|
private _isConnected;
|
|
32
|
+
private _gameCtx;
|
|
34
33
|
private RPC_GET_USER_BY_EAGLE_ID;
|
|
35
34
|
constructor(host: IHost, auth: Auth);
|
|
36
35
|
init(env: ApiEnv): void;
|
|
37
36
|
isSupported(): boolean;
|
|
38
|
-
private getGameId;
|
|
39
37
|
isUserAuthorized(): boolean;
|
|
40
38
|
private getNakamaClient;
|
|
41
39
|
private subscribeToEagleAuthChanges;
|
|
42
40
|
private getNakamaVars;
|
|
43
41
|
private initNakamaSession;
|
|
44
42
|
private initNakamaSessionViaEagle;
|
|
43
|
+
getGameContext(): Promise<NakamaContext>;
|
|
45
44
|
/**
|
|
46
45
|
* this method is called when the user is logged in
|
|
47
46
|
* CAUTION: this method is called from eagle login status change, therefore it can't throw
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { NakamaService } from '../nakama/nakama-service';
|
|
2
|
+
import { NakamaProvider } from '../nakama/nakama-provider';
|
|
3
|
+
import { RpcProvider } from '../../core/rpc';
|
|
4
|
+
|
|
5
|
+
export declare type Tournament = {
|
|
6
|
+
id?: string;
|
|
7
|
+
title?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
duration?: number;
|
|
10
|
+
category?: number;
|
|
11
|
+
sortOrder?: number;
|
|
12
|
+
size?: number;
|
|
13
|
+
maxSize?: number;
|
|
14
|
+
maxNumScore?: number;
|
|
15
|
+
canEnter?: boolean;
|
|
16
|
+
nextReset?: number;
|
|
17
|
+
metadata?: object;
|
|
18
|
+
createTime?: number;
|
|
19
|
+
startTime?: number;
|
|
20
|
+
endTime?: number;
|
|
21
|
+
startActive?: number;
|
|
22
|
+
endActive?: number;
|
|
23
|
+
};
|
|
24
|
+
export declare type TournamentEntry = {
|
|
25
|
+
ownerId?: string;
|
|
26
|
+
rank?: number;
|
|
27
|
+
score?: number;
|
|
28
|
+
subscore?: number;
|
|
29
|
+
/** The username of the score owner, if the owner is a user. */
|
|
30
|
+
username?: string;
|
|
31
|
+
/** The number of submissions to this score record. */
|
|
32
|
+
numScore: number;
|
|
33
|
+
/** The maximum number of score updates allowed by the owner. */
|
|
34
|
+
maxNumScore: number;
|
|
35
|
+
metadata?: object;
|
|
36
|
+
};
|
|
37
|
+
export declare type SubmitTournamentScoreParams = {
|
|
38
|
+
tournamentId: string;
|
|
39
|
+
score: number;
|
|
40
|
+
subscore?: number;
|
|
41
|
+
metadata?: object;
|
|
42
|
+
};
|
|
43
|
+
export declare class TournamentsArena extends NakamaService {
|
|
44
|
+
private RPC_GET_TOURNAMENT_LIST_BY_CONTEXT;
|
|
45
|
+
private RPC_JOIN_TOURNAMENT;
|
|
46
|
+
private RPC_SUBMIT_SCORE_TO_TOURNAMENT;
|
|
47
|
+
constructor(nakamaProvider: NakamaProvider, rpcProvider: RpcProvider);
|
|
48
|
+
protected onSocketConnectionChanged(isConnected: boolean): void;
|
|
49
|
+
getTournaments(): Promise<Tournament[]>;
|
|
50
|
+
hasJoinedTournament(tournamentId: string): Promise<boolean>;
|
|
51
|
+
joinTournament(tournamentId: string): Promise<boolean>;
|
|
52
|
+
canSubmitScoreToTournament(tournamentId: string): Promise<boolean>;
|
|
53
|
+
submitTournamentScore(params: SubmitTournamentScoreParams): Promise<boolean>;
|
|
54
|
+
getTopTournamentEntries(tournamentId: string, top: number): Promise<TournamentEntry[]>;
|
|
55
|
+
getTournamentUserEntry(tournamentId: string): Promise<TournamentEntry | null>;
|
|
56
|
+
getTournamentUsersEntries(tournamentId: string, userIds: string[]): Promise<TournamentEntry[]>;
|
|
57
|
+
getTournamentEntriesAroundUser(tournamentId: string, amount?: number): Promise<TournamentEntry[]>;
|
|
58
|
+
private mapNakamaTournamentEntryToTournamentEntry;
|
|
59
|
+
}
|
|
60
|
+
export declare class TournamentsGame {
|
|
61
|
+
private rpcProvider;
|
|
62
|
+
constructor(rpcProvider: RpcProvider);
|
|
63
|
+
getTournaments(): Promise<Tournament[]>;
|
|
64
|
+
hasJoinedTournament(tournamentId: string): Promise<boolean>;
|
|
65
|
+
joinTournament(tournamentId: string): Promise<boolean>;
|
|
66
|
+
canSubmitScoreToTournament(tournamentId: string): Promise<boolean>;
|
|
67
|
+
submitTournamentScore(params: SubmitTournamentScoreParams): Promise<boolean>;
|
|
68
|
+
getTopTournamentEntries(tournamentId: string, top: number): Promise<TournamentEntry[]>;
|
|
69
|
+
getTournamentUserEntry(tournamentId: string): Promise<TournamentEntry | null>;
|
|
70
|
+
getTournamentUsersEntries(tournamentId: string, userIds: string[]): Promise<TournamentEntry[]>;
|
|
71
|
+
getTournamentEntriesAroundUser(tournamentId: string, amount?: number): Promise<TournamentEntry[]>;
|
|
72
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -14,8 +14,11 @@ export declare class WalletArena implements Wallet {
|
|
|
14
14
|
private virtualItemGateway;
|
|
15
15
|
private currencySku;
|
|
16
16
|
private isInited;
|
|
17
|
+
private _isGemsSupported;
|
|
17
18
|
constructor(backendApi: Backend, lifecycle: GameLifecycleArena, rpcProvider: RpcProvider);
|
|
18
19
|
init(env: ApiEnv): Promise<void>;
|
|
20
|
+
setGemsSupported(isSupported: boolean): void;
|
|
21
|
+
private isGemsSupported;
|
|
19
22
|
/**
|
|
20
23
|
* Allows querying for the wallet balance
|
|
21
24
|
* @returns the amount of gems in the user wallet
|
|
@@ -42,4 +45,5 @@ export declare class WalletGame implements Wallet {
|
|
|
42
45
|
* @returns true if the spending of the gem amount was successful, false otherwise
|
|
43
46
|
*/
|
|
44
47
|
consumeGems(amount: number): Promise<boolean>;
|
|
48
|
+
isGemsSupported(): Promise<boolean>;
|
|
45
49
|
}
|
|
@@ -15,6 +15,7 @@ import { FriendsArena } from './api/features/friends';
|
|
|
15
15
|
import { NotificationsArena } from './api/features/notifications';
|
|
16
16
|
import { ChatArena } from './api/features/chat';
|
|
17
17
|
import { RatingsArena } from './api/features/ratings';
|
|
18
|
+
import { TournamentsArena } from './api/features/tournaments';
|
|
18
19
|
|
|
19
20
|
import * as MockUserUtils from './api/utils/mockUser';
|
|
20
21
|
/** @hidden */
|
|
@@ -35,13 +36,14 @@ export declare class ArkadiumArenaSdk {
|
|
|
35
36
|
notifications: NotificationsArena;
|
|
36
37
|
chats: ChatArena;
|
|
37
38
|
ratings: RatingsArena;
|
|
39
|
+
tournaments: TournamentsArena;
|
|
38
40
|
private currentEnv;
|
|
39
41
|
private currentTarget;
|
|
40
42
|
private gamePingSender;
|
|
41
43
|
private gamePingListener;
|
|
42
44
|
$pingNotification: Observable<number>;
|
|
43
45
|
version: string;
|
|
44
|
-
constructor(backendApi: Backend, host: HostArena, lifecycle: GameLifecycleArena, ads: AdsArena, auth: AuthArena, analytics: AnalyticsApiContract, timeoutTester: TimeoutTesterContract, persistence: PersistenceArena, wallet: WalletArena, debug: DebugProviderArena, supportV1: SupportV1, leaderboard: LeaderboardArena, friends: FriendsArena, notifications: NotificationsArena, chats: ChatArena, ratings: RatingsArena);
|
|
46
|
+
constructor(backendApi: Backend, host: HostArena, lifecycle: GameLifecycleArena, ads: AdsArena, auth: AuthArena, analytics: AnalyticsApiContract, timeoutTester: TimeoutTesterContract, persistence: PersistenceArena, wallet: WalletArena, debug: DebugProviderArena, supportV1: SupportV1, leaderboard: LeaderboardArena, friends: FriendsArena, notifications: NotificationsArena, chats: ChatArena, ratings: RatingsArena, tournaments: TournamentsArena);
|
|
45
47
|
setEnv(e: ApiEnv): void;
|
|
46
48
|
initialize(env: ApiEnv, isGameSide: boolean, sessionStorage?: SessionStorageType | null): Promise<void>;
|
|
47
49
|
private envDiscoverListener;
|
|
@@ -9,6 +9,7 @@ import { PersistenceGame } from './api/features/persistence';
|
|
|
9
9
|
import { Wallet, WalletGame } from './api/features/wallet';
|
|
10
10
|
import { HostGame } from './api/features/host';
|
|
11
11
|
import { LeaderboardGame } from './api/features/leaderboard';
|
|
12
|
+
import { TournamentsGame } from './api/features/tournaments';
|
|
12
13
|
|
|
13
14
|
export declare class ArkadiumGameSdk {
|
|
14
15
|
version: string;
|
|
@@ -26,7 +27,8 @@ export declare class ArkadiumGameSdk {
|
|
|
26
27
|
persistence: PersistenceGame;
|
|
27
28
|
wallet: Wallet;
|
|
28
29
|
leaderboard: LeaderboardGame;
|
|
29
|
-
|
|
30
|
+
tournaments: TournamentsGame;
|
|
31
|
+
constructor({ rpcProvider, backendApi, host, lifecycle, ads, auth, analytics, timeoutTester, persistence, wallet, leaderboard, tournaments }: {
|
|
30
32
|
rpcProvider: RpcProvider;
|
|
31
33
|
backendApi: Backend;
|
|
32
34
|
host: HostGame;
|
|
@@ -38,6 +40,7 @@ export declare class ArkadiumGameSdk {
|
|
|
38
40
|
persistence: PersistenceGame;
|
|
39
41
|
wallet: WalletGame;
|
|
40
42
|
leaderboard: LeaderboardGame;
|
|
43
|
+
tournaments: TournamentsGame;
|
|
41
44
|
});
|
|
42
45
|
initialize(env: ApiEnv, isGameSide: boolean): Promise<void>;
|
|
43
46
|
getEnv(): ApiEnv;
|