@wayward/types 2.13.3-beta.dev.20230630.1 → 2.13.3-beta.dev.20230701.1

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.
@@ -83,4 +83,9 @@ export default class PlayerManager extends EventEmitter.Host<IPlayerManagerEvent
83
83
  * Finds the first available player id in the array
84
84
  */
85
85
  private findAvailablePlayerId;
86
+ /**
87
+ * Clears the existing client secret for the player
88
+ * @param playerIdentifier Player identifier
89
+ */
90
+ clearClientSecret(playerIdentifier: string): void;
86
91
  }
@@ -24,6 +24,10 @@ export default class Multiplayer extends EventEmitter.Host<IMultiplayerEvents> {
24
24
  * Otherwise it will be a random guid that persists
25
25
  */
26
26
  private _playerIdentifier;
27
+ /**
28
+ * A secret string that's stored in localStorage that helps authorize players to servers.
29
+ */
30
+ private readonly _clientSecret;
27
31
  /**
28
32
  * Steam id - used for steam networking
29
33
  */
@@ -62,10 +62,18 @@ export interface IMatchmakingIpAddressMessageData extends IMatchmakingMessageDat
62
62
  }
63
63
  export interface IMatchmakingJoinChannelMessageData extends IMatchmakingMessageData {
64
64
  type: MatchmakingMessageDataType.JoinChannel;
65
+ targetMatchmakingIdentifier: string;
65
66
  clientVersion: string;
66
67
  clientBuild: number | undefined;
67
68
  playerIdentifier: string;
68
69
  playerSteamId: string | undefined;
70
+ /**
71
+ * Used by clients to authenticate ownership of their player
72
+ */
73
+ clientSecret: string;
74
+ /**
75
+ * Used by hosts to authenticate ownership of a server/matchmaking channel
76
+ */
69
77
  secret?: string;
70
78
  }
71
79
  export interface IMatchmakingIceCandidateMessageData extends IMatchmakingMessageData {
@@ -19,6 +19,7 @@ export declare abstract class Connection implements IConnection {
19
19
  playerIdentifier: string | undefined;
20
20
  playerSteamId: string | undefined;
21
21
  matchmakingIdentifier: string;
22
+ clientSecret: string;
22
23
  pid?: number;
23
24
  buffer?: Uint8Array;
24
25
  bufferOffset?: number;
@@ -24,6 +24,7 @@ export interface IConnection {
24
24
  name: string;
25
25
  maxMessageSize: number;
26
26
  playerIdentifier: string | undefined;
27
+ clientSecret: string;
27
28
  playerSteamId: string | undefined;
28
29
  matchmakingIdentifier: string;
29
30
  pid?: number;
@@ -9,6 +9,7 @@
9
9
  * https://github.com/WaywardGame/types/wiki
10
10
  */
11
11
  import type ExploredMapClientData from "save/clientStore/clientData/ExploredMap";
12
+ import type MultiplayerClientData from "save/clientStore/clientData/MultiplayerClientData";
12
13
  import type UiData from "save/clientStore/clientData/UiData";
13
14
  export interface IClientStore {
14
15
  get<T extends ClientDataType>(type: T): ClientDataMap<T>;
@@ -16,10 +17,12 @@ export interface IClientStore {
16
17
  export default IClientStore;
17
18
  export declare enum ClientDataType {
18
19
  ExploredMap = 0,
19
- Ui = 1
20
+ Ui = 1,
21
+ Multiplayer = 2
20
22
  }
21
23
  export interface IClientData {
22
24
  [ClientDataType.ExploredMap]: ExploredMapClientData;
23
25
  [ClientDataType.Ui]: UiData;
26
+ [ClientDataType.Multiplayer]: MultiplayerClientData;
24
27
  }
25
28
  export type ClientDataMap<T extends ClientDataType> = IClientData[T];
@@ -0,0 +1,13 @@
1
+ /*!
2
+ * Copyright 2011-2023 Unlok
3
+ * https://www.unlok.ca
4
+ *
5
+ * Credits & Thanks:
6
+ * https://www.unlok.ca/credits-thanks/
7
+ *
8
+ * Wayward is a copyrighted and licensed work. Modification and/or distribution of any source files is prohibited. If you wish to modify the game in any way, please refer to the modding guide:
9
+ * https://github.com/WaywardGame/types/wiki
10
+ */
11
+ export default class MultiplayerClientData {
12
+ clientSecret: string | undefined;
13
+ }
@@ -20,5 +20,4 @@ export default class GlobalMatchmaking extends Server {
20
20
  protected onMessage(connection: shared.ClientConnection, data: ws.Data, ipAddress: string): void;
21
21
  private removeFromChannel;
22
22
  private addToChannel;
23
- private broadcastData;
24
23
  }
@@ -27,6 +27,7 @@ export interface ClientConnection extends ws {
27
27
  identifier: string;
28
28
  version: ServerVersion;
29
29
  channel?: string;
30
+ channelMatchmakingIdentifier?: string;
30
31
  servers?: string[];
31
32
  pendingCheckConnection?: boolean;
32
33
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wayward/types",
3
3
  "description": "TypeScript declarations for Wayward, used for modding.",
4
- "version": "2.13.3-beta.dev.20230630.1",
4
+ "version": "2.13.3-beta.dev.20230701.1",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",