@wayward/types 2.11.1-beta.dev.20211230.1 → 2.11.1-beta.dev.20211231.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
  */
@@ -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,8 +31,8 @@ export interface IPacket<T = any> {
31
31
  isSyncCheckEnabled(): boolean;
32
32
  isAllowedWhenPaused(): boolean;
33
33
  process(): T;
34
- processData(dataView: DataView): void;
35
- preSerialize(): void;
34
+ processSerializedData(dataView: DataView): void;
35
+ serializeData(): void;
36
36
  }
37
37
  export declare enum NetworkPropertyType {
38
38
  Bool = 0,
@@ -22,8 +22,8 @@ export declare abstract class Packet<T = void> extends IndexedPacket implements
22
22
  isAllowedWhenPaused(): boolean;
23
23
  getSynchronizationCheckData(): ISynchronizationCheckData;
24
24
  getArrayBuffer(id?: number): ArrayBuffer;
25
- preSerialize(): number;
26
- processData(dataView: DataView): void;
25
+ serializeData(): number;
26
+ processSerializedData(dataView: DataView): void;
27
27
  abstract process(): T;
28
28
  send(exclude?: PacketTarget): void;
29
29
  sendTo(to: PacketTarget, force?: boolean): void;
@@ -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, 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";
@@ -27,11 +26,14 @@ export default class ApplicationInteractions {
27
26
  constructor(additionalArgs: string[], random: Random<SeededGenerator>);
28
27
  waitForInitialStartup(expectedInitialScreen: "title" | "mp_gameplay_modifiers"): Promise<void>;
29
28
  waitUntilLoadingIsFinished(expectedMultiplayerMenu?: boolean): Promise<void>;
30
- playDedicatedServer(gameMode?: GameMode): 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>;
@@ -80,7 +86,10 @@ export default class ApplicationInteractions {
80
86
  isOverlayVisible(): Promise<WebdriverIO.Element[] | undefined>;
81
87
  waitUntilTitleScreenIsVisible(): Promise<void>;
82
88
  waitUntilGameEndMenuIsVisible(): Promise<void>;
83
- waitForVisibleButtonThenClick(name: string, timeout?: number): Promise<void>;
89
+ waitForVisibleButtonThenClick(name: string, options?: Partial<{
90
+ clickOnce: boolean;
91
+ timeout: number;
92
+ }>): Promise<void>;
84
93
  increaseStat(stat: Stat, value: number): Promise<void>;
85
94
  randomInput(count: number): Promise<void>;
86
95
  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 { 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,7 +62,7 @@ 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
68
  joinServer(...apps: Application[]): Promise<void>;
@@ -8,12 +8,16 @@
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;
16
19
  }
20
+ export declare type IDedicatedServerGameOptions = ICommonGameOptions;
17
21
  export declare enum GameMode {
18
22
  Hardcore = "Hardcore Mode",
19
23
  Casual = "Casual 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.20211230.1",
4
+ "version": "2.11.1-beta.dev.20211231.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
  }