@wayward/types 2.11.1-beta.dev.20211229.1 → 2.11.1-beta.dev.20220101.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.
@@ -165,7 +165,8 @@ export declare class Game extends EventEmitter.Host<IGameEvents> {
165
165
  * This method should be able to be called multiple times in a row and nothing unexpected should occur.
166
166
  * @param saveType Saves the game with the specified save type. Set to false to not save. Defaults to BackToMainMenu.
167
167
  * @param shouldDisconnect Marks if the game should disconnect from multiplayer. Defaults to true.
168
+ * @param hasDisconnected Marks if the game just disconnected from multiplayer. Defaults to false.
168
169
  */
169
- reset(saveType?: SaveType | false, shouldDisconnect?: boolean): Promise<void>;
170
+ reset(saveType?: SaveType | false, shouldDisconnect?: boolean, hasDisconnected?: boolean): Promise<void>;
170
171
  fastForwardIsland(island: Island, ticks: number, multiplayerLoadingDescription?: MultiplayerLoadingDescription): Promise<void>;
171
172
  }
@@ -86,6 +86,11 @@ export default class Island extends EventEmitter.Host<IIslandEvents> implements
86
86
  loadCount: number;
87
87
  seeds: ISeeds;
88
88
  readonly seededRandom: Random<SeededGenerator>;
89
+ /**
90
+ * Random for milestone modifiers. You should only use the one in the default island
91
+ * todo: remove since this is no longer used
92
+ */
93
+ readonly seededMilestoneModifiersRandom: Random<SeededGenerator>;
89
94
  /**
90
95
  * Set of players on this island
91
96
  */
@@ -184,6 +184,10 @@ export interface IItemDescription extends IObjectDescription, IModdable, ITemper
184
184
  plural?: string;
185
185
  hideHelmet?: boolean;
186
186
  worth?: number;
187
+ /**
188
+ * Array of items that the item is "made from" in cases where we can't use the disassembly items to burn into.
189
+ * All items in array are required to have onBurn set in their description to function properly.
190
+ */
187
191
  burnsLike?: ItemType[];
188
192
  spawnableTiles?: TileGroup;
189
193
  gather?: ILiquid;
@@ -128,17 +128,19 @@ declare module Loading {
128
128
  */
129
129
  progress(load: Load, progress: number): any;
130
130
  /**
131
- * Emitted when a thing has finished loading
131
+ * Emitted when a load has finished loading.
132
+ * Either this or "cancel" will be called when a load is done
132
133
  */
133
134
  step(...loaded: Load[]): any;
134
135
  /**
135
- * Emitted when all things have finished loading
136
+ * Emitted when a load has been cancelled.
137
+ * Either this or "step"" will be called when a load is done
136
138
  */
137
- end(...loaded: Load[]): any;
139
+ cancel(load: Load): any;
138
140
  /**
139
- * Emitted when a load has been cancelled
141
+ * Emitted when all things have finished loading
140
142
  */
141
- cancel(load: Load): any;
143
+ end(...loaded: Load[]): any;
142
144
  }
143
145
  const currently: Map<Load, any[]>;
144
146
  class Events extends EventEmitter.Host<ILoadingEvents> {
@@ -161,7 +163,10 @@ declare module Loading {
161
163
  * Returns a promise that will resolve when the load is complete, and reject if the load is cancelled.
162
164
  */
163
165
  function waitFor(load: Load): Promise<void>;
166
+ /**
167
+ * Returns a promise that will resolve when all running loads are complete.
168
+ */
169
+ function waitForAll(): Promise<void>;
164
170
  function progress(load: Load, progress: number): Promise<void>;
165
- function done(): Promise<void>;
166
171
  }
167
172
  export default Loading;
@@ -74,31 +74,32 @@ export declare enum MultiplayerSyncCheck {
74
74
  Merchant = 36,
75
75
  MilestoneSeed = 37,
76
76
  Misc = 38,
77
- MoveToTile = 39,
78
- PenaltyFieldHashCode = 40,
79
- PlaceOnTile = 41,
80
- PlayerManager = 42,
81
- PlayerPositions = 43,
82
- Players = 44,
83
- PlayerSetup = 45,
84
- Random = 46,
85
- Reputation = 47,
86
- Seed = 48,
87
- SeededGenerator = 49,
88
- SkillGain = 50,
89
- StaminaChanges = 51,
90
- StatChange = 52,
91
- Stats = 53,
92
- StatusChange = 54,
93
- StatusEffect = 55,
94
- SyncChecks = 56,
95
- TemperatureManager = 57,
96
- Temporary = 58,
97
- Tick = 59,
98
- TileEvent = 60,
99
- Time = 61,
100
- UpdateDirection = 62,
101
- Weight = 63
77
+ Modifier = 39,
78
+ MoveToTile = 40,
79
+ PenaltyFieldHashCode = 41,
80
+ PlaceOnTile = 42,
81
+ PlayerManager = 43,
82
+ PlayerPositions = 44,
83
+ Players = 45,
84
+ PlayerSetup = 46,
85
+ Random = 47,
86
+ Reputation = 48,
87
+ Seed = 49,
88
+ SeededGenerator = 50,
89
+ SkillGain = 51,
90
+ StaminaChanges = 52,
91
+ StatChange = 53,
92
+ Stats = 54,
93
+ StatusChange = 55,
94
+ StatusEffect = 56,
95
+ SyncChecks = 57,
96
+ TemperatureManager = 58,
97
+ Temporary = 59,
98
+ Tick = 60,
99
+ TileEvent = 61,
100
+ Time = 62,
101
+ UpdateDirection = 63,
102
+ Weight = 64
102
103
  }
103
104
  export declare const maxPlayers = 32;
104
105
  export declare const packetTickRate = 16;
@@ -47,7 +47,6 @@ export declare abstract class Connection implements IConnection {
47
47
  sendKeepAlive(): void;
48
48
  getState(): ConnectionState;
49
49
  setState(state: ConnectionState): void;
50
- serializePacket(packet: IPacket): ArrayBuffer;
51
50
  /**
52
51
  * Queues a packet to be sent soon
53
52
  * Note: packets are serialized when queued
@@ -56,7 +55,7 @@ export declare abstract class Connection implements IConnection {
56
55
  /**
57
56
  * Queues data to be sent soon
58
57
  */
59
- protected queuePacketData(data: ArrayBuffer): void;
58
+ protected queuePacketData(data: ArrayBuffer, packetNumber?: number): void;
60
59
  /**
61
60
  * Clears queued packets
62
61
  */
@@ -73,6 +72,7 @@ export declare abstract class Connection implements IConnection {
73
72
  * Sends queued data to the connection w/ flow control
74
73
  */
75
74
  private _processQueuedData;
75
+ private _serializePacket;
76
76
  abstract readonly maxMessageSize: number;
77
77
  abstract isConnected(): boolean;
78
78
  protected abstract onClosing(): void;
@@ -69,5 +69,6 @@ export interface IConnection {
69
69
  export interface IQueuedData {
70
70
  data: ArrayBuffer;
71
71
  byteOffset: number;
72
+ packetNumber?: number;
72
73
  retries?: number;
73
74
  }
@@ -31,7 +31,8 @@ export interface IPacket<T = any> {
31
31
  isSyncCheckEnabled(): boolean;
32
32
  isAllowedWhenPaused(): boolean;
33
33
  process(): T;
34
- processData(dataView: DataView): void;
34
+ processSerializedData(dataView: DataView): void;
35
+ serializeData(): void;
35
36
  }
36
37
  export declare enum NetworkPropertyType {
37
38
  Bool = 0,
@@ -15,13 +15,15 @@ import type { IPacket, ISynchronizationCheckData } from "multiplayer/packets/IPa
15
15
  export declare abstract class Packet<T = void> extends IndexedPacket implements IPacket<T> {
16
16
  protected synchronizationCheckData: ISynchronizationCheckData;
17
17
  private _arrayBuffer;
18
+ private _serializedDataByteOffset;
18
19
  abstract getDebugInfo(): string;
19
20
  getAllowedStates(): ConnectionState;
20
21
  isSyncCheckEnabled(): boolean;
21
22
  isAllowedWhenPaused(): boolean;
22
23
  getSynchronizationCheckData(): ISynchronizationCheckData;
23
24
  getArrayBuffer(id?: number): ArrayBuffer;
24
- processData(dataView: DataView): void;
25
+ serializeData(): number;
26
+ processSerializedData(dataView: DataView): void;
25
27
  abstract process(): T;
26
28
  send(exclude?: PacketTarget): void;
27
29
  sendTo(to: PacketTarget, force?: boolean): void;
@@ -37,49 +37,50 @@ export declare enum LogSource {
37
37
  ItemReference = 24,
38
38
  ItemStylesheet = 25,
39
39
  Languages = 26,
40
- LocalStorageDataStorage = 27,
41
- MapGen = 28,
42
- Matchmaking = 29,
43
- MatchmakingServer = 30,
44
- MemoryLeakDetector = 31,
45
- Message = 32,
46
- Mod = 33,
47
- Mods = 34,
48
- Multiplayer = 35,
49
- NPC = 36,
50
- NPCManager = 37,
51
- OldUi = 38,
52
- Packet = 39,
53
- Player = 40,
54
- PlayerManager = 41,
55
- Prompts = 42,
56
- Reflow = 43,
57
- Renderer = 44,
58
- ReplayManager = 45,
59
- ResourceLoader = 46,
60
- SaveManager = 47,
61
- Serializer = 48,
62
- Shaders = 49,
63
- SoundEffect = 50,
64
- SpritePack = 51,
65
- SshCommandManager = 52,
66
- SshServer = 53,
67
- Steamworks = 54,
68
- StringTokenizer = 55,
69
- TemperatureManager = 56,
70
- TileEventManager = 57,
71
- TileUpdate = 58,
72
- Timer = 59,
73
- Trello = 60,
74
- Ui = 61,
75
- Utilities = 62,
76
- WebAssembly = 63,
77
- WebGlContext = 64,
78
- WebRTCConnection = 65,
79
- WebSocketConnection = 66,
80
- World = 67,
81
- WorldLayerRenderer = 68,
82
- WorldRenderer = 69
40
+ Loading = 27,
41
+ LocalStorageDataStorage = 28,
42
+ MapGen = 29,
43
+ Matchmaking = 30,
44
+ MatchmakingServer = 31,
45
+ MemoryLeakDetector = 32,
46
+ Message = 33,
47
+ Mod = 34,
48
+ Mods = 35,
49
+ Multiplayer = 36,
50
+ NPC = 37,
51
+ NPCManager = 38,
52
+ OldUi = 39,
53
+ Packet = 40,
54
+ Player = 41,
55
+ PlayerManager = 42,
56
+ Prompts = 43,
57
+ Reflow = 44,
58
+ Renderer = 45,
59
+ ReplayManager = 46,
60
+ ResourceLoader = 47,
61
+ SaveManager = 48,
62
+ Serializer = 49,
63
+ Shaders = 50,
64
+ SoundEffect = 51,
65
+ SpritePack = 52,
66
+ SshCommandManager = 53,
67
+ SshServer = 54,
68
+ Steamworks = 55,
69
+ StringTokenizer = 56,
70
+ TemperatureManager = 57,
71
+ TileEventManager = 58,
72
+ TileUpdate = 59,
73
+ Timer = 60,
74
+ Trello = 61,
75
+ Ui = 62,
76
+ Utilities = 63,
77
+ WebAssembly = 64,
78
+ WebGlContext = 65,
79
+ WebRTCConnection = 66,
80
+ WebSocketConnection = 67,
81
+ World = 68,
82
+ WorldLayerRenderer = 69,
83
+ WorldRenderer = 70
83
84
  }
84
85
  export declare enum LogLineType {
85
86
  Debug = 0,
@@ -132,7 +132,6 @@ export declare module RandomReference {
132
132
  export declare function getRandom(randomInstance: RandomInstance, islandId?: IslandId): Random<SeededGenerator>;
133
133
  export declare function createSeededRandom(seed?: number, addMultiplayerSyncChecks?: boolean): Random<SeededGenerator>;
134
134
  export declare const mapGenRandom: Random<SeededGenerator>;
135
- export declare const randomMilestoneModifiers: Random<SeededGenerator>;
136
135
  export declare const generalRandom: Random<{
137
136
  get: () => number;
138
137
  }>;
@@ -23,7 +23,7 @@ export default class ApplicationDom {
23
23
  clickIfVisibleElement(selector: string): Promise<WebdriverIO.Element | undefined>;
24
24
  getVisibleElements(selector: string): Promise<WebdriverIO.Element[] | undefined>;
25
25
  getVisibleAndClickableElement(selector: string): Promise<WebdriverIO.Element | undefined>;
26
- waitForVisibleThenClick(selector: string, timeout?: number, indent?: boolean): Promise<void>;
26
+ waitForVisibleThenClick(selector: string, timeout?: number, indent?: boolean, clickOnce?: boolean): Promise<void>;
27
27
  waitForVisibleElements(selector: string, timeout?: number): Promise<WebdriverIO.Element[]>;
28
28
  waitForNotVisible(selector: string, timeout?: number): Promise<void>;
29
29
  waitUntil(executor: () => Promise<boolean>, options: webdriverio.WaitUntilOptions): Promise<true | void>;
@@ -12,8 +12,7 @@
12
12
  import type { Stat } from "../../game/game/entity/IStats";
13
13
  import { Direction } from "../../game/utilities/math/Direction";
14
14
  import type { Random, SeededGenerator } from "../../game/utilities/random/Random";
15
- import type { INewGameOptions } from "../interfaces";
16
- import { GameMode } from "../interfaces";
15
+ import type { IDedicatedServerGameOptions, IJoinServerOptions, INewGameOptions } from "../interfaces";
17
16
  import type { IslandId } from "../../game/game/island/IIsland";
18
17
  import ApplicationDom from "./applicationDom";
19
18
  import ApplicationLogger from "./applicationLogger";
@@ -26,12 +25,15 @@ export default class ApplicationInteractions {
26
25
  private readonly savedStates;
27
26
  constructor(additionalArgs: string[], random: Random<SeededGenerator>);
28
27
  waitForInitialStartup(expectedInitialScreen: "title" | "mp_gameplay_modifiers"): Promise<void>;
29
- waitUntilLoadingIsFinished(): Promise<void>;
30
- playDedicatedServer(gameMode?: GameMode): Promise<void>;
28
+ waitUntilLoadingIsFinished(expectedMultiplayerMenu?: boolean): Promise<void>;
29
+ playDedicatedServer(options: IDedicatedServerGameOptions): Promise<void>;
31
30
  playNewGame(options: INewGameOptions): Promise<void>;
31
+ private setupCommonOptions;
32
+ unlockMilestoneModifiers(): Promise<void>;
32
33
  playImportedGame(savePath: string): Promise<void>;
33
34
  playContinueGame(): Promise<void>;
34
35
  quitGame(): Promise<void>;
36
+ clickOptions(): Promise<void>;
35
37
  clickNewGame(): Promise<void>;
36
38
  clickLoadGame(): Promise<void>;
37
39
  clickConfirm(): Promise<void>;
@@ -41,7 +43,11 @@ export default class ApplicationInteractions {
41
43
  clickJoinServer(): Promise<void>;
42
44
  clickDailyChallenge(): Promise<void>;
43
45
  clickBack(timeout?: number): Promise<void>;
44
- clickButton(name: string, timeout?: number): Promise<void>;
46
+ clickButton(name: string, options?: Partial<{
47
+ force: boolean;
48
+ clickOnce: boolean;
49
+ timeout: number;
50
+ }>): Promise<void>;
45
51
  clickYesIfVisible(): Promise<boolean>;
46
52
  clickButtonIfVisible(name: string): Promise<boolean>;
47
53
  clickUnpauseIconIfVisible(): Promise<void>;
@@ -61,8 +67,7 @@ export default class ApplicationInteractions {
61
67
  waitForGameEndScreen(isWinner: boolean): Promise<void>;
62
68
  returnToTitleScreen(): Promise<void>;
63
69
  getServerGameCode(): Promise<string>;
64
- joinMultiplayerServer(gameCode: string): Promise<void>;
65
- joinMultiplayerDedicatedServer(gameCode: string): Promise<void>;
70
+ joinMultiplayerServer(gameCode: string, options: IJoinServerOptions, isDedicatedServer: boolean): Promise<void>;
66
71
  pauseGame(): Promise<void>;
67
72
  unpauseGame(): Promise<void>;
68
73
  moveToIslandId(islandId: IslandId): Promise<void>;
@@ -71,13 +76,19 @@ export default class ApplicationInteractions {
71
76
  saveStateAndVerifyWithPrevious(): Promise<void>;
72
77
  clearSavedStates(): void;
73
78
  waitUntilPauseMenuIsShown(): Promise<void>;
74
- waitUntilGameIsLoaded(isJoiningServer?: boolean): Promise<void>;
79
+ waitUntilGameIsLoaded(options?: Partial<{
80
+ isJoiningServer: boolean;
81
+ isCreatingServer: boolean;
82
+ }>): Promise<void>;
75
83
  isTitleScreenVisible(): Promise<WebdriverIO.Element[] | undefined>;
76
84
  isButtonVisible(text: string): Promise<WebdriverIO.Element[] | undefined>;
77
85
  isOverlayVisible(): Promise<WebdriverIO.Element[] | undefined>;
78
86
  waitUntilTitleScreenIsVisible(): Promise<void>;
79
87
  waitUntilGameEndMenuIsVisible(): Promise<void>;
80
- waitForVisibleButtonThenClick(name: string, timeout?: number): Promise<void>;
88
+ waitForVisibleButtonThenClick(name: string, options?: Partial<{
89
+ clickOnce: boolean;
90
+ timeout: number;
91
+ }>): Promise<void>;
81
92
  increaseStat(stat: Stat, value: number): Promise<void>;
82
93
  randomInput(count: number): Promise<void>;
83
94
  pressKey(key: string, modifier?: string): Promise<void>;
@@ -10,7 +10,7 @@
10
10
  */
11
11
  import type Player from "../../game/game/entity/player/Player";
12
12
  import { Direction } from "../../game/utilities/math/Direction";
13
- import type { GameMode } from "../interfaces";
13
+ import type { IJoinServerOptions, INewGameOptions } from "../interfaces";
14
14
  import type { IDifferences } from "../../game/utilities/object/JsonHelper";
15
15
  import type Application from "./application";
16
16
  import type { ITestState } from "./application";
@@ -62,10 +62,10 @@ export declare class Apps {
62
62
  getLog(): string[];
63
63
  compileDifferences(client: string | number, differences: IDifferences): string;
64
64
  verifyGameStates(): Promise<void>;
65
- createMultiplayerGame(gameMode: GameMode): Promise<void>;
65
+ createMultiplayerGame(options: Omit<INewGameOptions, "playMode">): Promise<void>;
66
66
  setClientJoinIsland(x: number, y: number): Promise<void>;
67
67
  getServerGameCode(): Promise<string>;
68
- joinServer(...apps: Application[]): Promise<void>;
68
+ joinServer(options: IJoinServerOptions, ...apps: Application[]): Promise<void>;
69
69
  leaveServer(...apps: Application[]): Promise<void>;
70
70
  returnToTitleScreen(): Promise<void>;
71
71
  waitUntilLoadingIsFinished(): Promise<void>;
@@ -8,11 +8,19 @@
8
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
9
  * https://github.com/WaywardGame/types/wiki
10
10
  */
11
- export interface INewGameOptions {
11
+ export interface ICommonGameOptions {
12
12
  gameMode: GameMode;
13
+ seed?: string | number;
14
+ enableAllMilestoneModifiers?: boolean;
15
+ }
16
+ export interface INewGameOptions extends ICommonGameOptions {
13
17
  playMode: GamePlayMode;
14
18
  reuseCharacter?: boolean;
15
- seed?: string | number;
19
+ }
20
+ export declare type IDedicatedServerGameOptions = ICommonGameOptions;
21
+ export interface IJoinServerOptions {
22
+ joinProgrammatically: boolean;
23
+ enableAllMilestoneModifiers?: boolean;
16
24
  }
17
25
  export declare enum GameMode {
18
26
  Hardcore = "Hardcore Mode",
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.11.1-beta.dev.20211229.1",
4
+ "version": "2.11.1-beta.dev.20220101.1",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -14,11 +14,11 @@
14
14
  "watch": "tsc --build"
15
15
  },
16
16
  "dependencies": {
17
+ "@types/fs-extra": "^9.0.13",
18
+ "@types/node": "^17.0.5",
17
19
  "@wayward/goodstream": "0.7.1"
18
20
  },
19
21
  "devDependencies": {
20
- "@wayward/game": "^1.0.0",
21
- "@types/node": "^17.0.5",
22
- "@types/fs-extra": "^9.0.13"
22
+ "@wayward/game": "^1.0.0"
23
23
  }
24
24
  }
@@ -12,7 +12,8 @@
12
12
  "removeComments": true,
13
13
  "strict": true,
14
14
  "strictPropertyInitialization": false,
15
- "moduleResolution": "node",
15
+ // classic is required for auto imports to use the shortest path in vscode
16
+ "moduleResolution": "classic",
16
17
  "paths": {
17
18
  "*": [
18
19
  "node_modules/@wayward/types/definitions/game/*"
@@ -22,6 +23,15 @@
22
23
  ],
23
24
  "@hosts/*": [
24
25
  "node_modules/@wayward/types/definitions/hosts/*"
26
+ ],
27
+ // required when using classic module resolution
28
+ "@wayward/goodstream": [
29
+ "node_modules/@wayward/goodstream/Stream",
30
+ "node_modules/@wayward/types/node_modules/@wayward/goodstream/Stream"
31
+ ],
32
+ "@wayward/goodstream/*": [
33
+ "node_modules/@wayward/goodstream/*",
34
+ "node_modules/@wayward/types/node_modules/@wayward/goodstream/*"
25
35
  ]
26
36
  },
27
37
  "types": [],