@wayward/types 2.13.0-beta.dev.20230511.1 → 2.13.0-beta.dev.20230512.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.
Files changed (21) hide show
  1. package/definitions/game/game/Game.d.ts +1 -1
  2. package/definitions/game/game/entity/npc/npcs/Merchant.d.ts +1 -0
  3. package/definitions/game/game/entity/player/Player.d.ts +7 -0
  4. package/definitions/game/game/mapping/Background.d.ts +1 -1
  5. package/definitions/game/game/mapping/Obfuscation.d.ts +1 -1
  6. package/definitions/game/game/milestones/IMilestone.d.ts +2 -1
  7. package/definitions/game/game/milestones/MilestoneDefinition.d.ts +2 -0
  8. package/definitions/game/game/milestones/MilestoneManager.d.ts +1 -1
  9. package/definitions/game/multiplayer/packets/server/{UpdateDialogInfoPacket.d.ts → UpdateUiInfoPacket.d.ts} +9 -2
  10. package/definitions/game/renderer/fieldOfView/FieldOfView.d.ts +1 -1
  11. package/definitions/game/ui/component/Text.d.ts +3 -2
  12. package/definitions/game/ui/old/screens/InGameScreen.d.ts +2 -0
  13. package/definitions/game/ui/screen/screens/GameScreen.d.ts +5 -1
  14. package/definitions/game/ui/screen/screens/game/component/GameDetails.d.ts +3 -10
  15. package/definitions/game/ui/screen/screens/game/component/PopupOverlay.d.ts +31 -0
  16. package/definitions/game/ui/screen/screens/game/static/stats/IStatDisplayDescription.d.ts +26 -1
  17. package/definitions/game/ui/screen/screens/game/static/stats/Reputation.d.ts +1 -1
  18. package/definitions/game/ui/screen/screens/game/static/stats/StatDisplayDescriptions.d.ts +2 -25
  19. package/definitions/game/ui/screen/screens/game/static/stats/component/Stat.d.ts +5 -2
  20. package/definitions/test/core/applicationInteractions.d.ts +3 -3
  21. package/package.json +1 -1
@@ -165,7 +165,7 @@ export declare class Game extends EventEmitter.Host<IGameEvents> {
165
165
  updateGameOptions(gameOptions: IGameOptions): void;
166
166
  initializeGameOptions(seed: string | number, mode?: GameMode, options?: IGameOptions, milestoneModifiers?: Set<Milestone>): void;
167
167
  initializeModifiers(): void;
168
- getMovementTime(delay: Delay | number): IMovementTime;
168
+ getMovementTime(delay: Delay | number, timestamp?: number): IMovementTime;
169
169
  getMovementProgress(timeStamp: number, movementTime: IMovementTime | undefined): number;
170
170
  getSynchronizeState(identifier: string): ISynchronizeState;
171
171
  synchronizeState(synchronizeState: ISynchronizeState): void;
@@ -53,6 +53,7 @@ export default class MerchantNPC extends NPC {
53
53
  protected getDefaultEquipment(equipType: EquipType): Item | ItemType | undefined;
54
54
  protected getDefaultInventory(): Array<Item | ItemType>;
55
55
  protected getDefaultAiType(): AiType;
56
+ protected onSpawn(): void;
56
57
  private canSpawnItem;
57
58
  protected runActions(): boolean;
58
59
  get asMerchant(): MerchantNPC;
@@ -88,7 +88,14 @@ export default class Player extends Human implements IPreSerializeCallback, IUns
88
88
  */
89
89
  prompt(type: Prompt, ...args: any[]): Promise<boolean | InterruptChoice>;
90
90
  updateActionSlots(slots: number[], data: IActionBarSlotData[], enabled?: boolean): void;
91
+ /**
92
+ * Send a packet to the server about the dialog info for the dialog
93
+ */
91
94
  updateDialogInfo(dialogIndex: string | number | undefined): void;
95
+ /**
96
+ * Send a packet to the server about the sort info for the container
97
+ */
98
+ updateContainerSortInfo(dialogIndex: string | number): void;
92
99
  getDialogInfo(dialogIndex: string | number): IDialogInfo | undefined;
93
100
  kill(): void;
94
101
  respawn(reset: boolean): void;
@@ -13,7 +13,7 @@ export type CanvasImage = HTMLImageElement | HTMLCanvasElement | ImageBitmap;
13
13
  export default class MapBackground {
14
14
  private readonly seed?;
15
15
  private readonly canvas;
16
- constructor(radius: number, seed?: number | undefined);
16
+ constructor(radius: number, seed?: Uint16Array | undefined);
17
17
  render(mapImage: CanvasImage, theme: DrawnMapTheme): Promise<HTMLCanvasElement>;
18
18
  private lastTheme?;
19
19
  private renderBackground;
@@ -13,7 +13,7 @@ import type { DrawnMapTheme } from "game/mapping/IMapRender";
13
13
  export default class Obfuscation {
14
14
  private readonly seed?;
15
15
  private readonly canvas;
16
- constructor(radius: number, seed?: number | undefined);
16
+ constructor(radius: number, seed?: Uint16Array | undefined);
17
17
  obfuscate(mapImage: CanvasImage, obfuscation: number, theme: DrawnMapTheme): Promise<HTMLCanvasElement>;
18
18
  private render;
19
19
  }
@@ -59,7 +59,8 @@ export declare enum Milestone {
59
59
  Murderer = 47,
60
60
  Retailer = 48,
61
61
  Masochist = 49,
62
- Versatile = 50
62
+ Versatile = 50,
63
+ InternalStatDiscovery = 51
63
64
  }
64
65
  export type ExcludeInternalMilestones<MILESTONE extends Milestone> = PickValueKeys<typeof Milestone, MILESTONE> extends `Internal${string}` ? never : MILESTONE;
65
66
  export declare enum MilestoneVisibility {
@@ -66,4 +66,6 @@ export default class MilestoneDefinition {
66
66
  setNotDisabledByMods(): this;
67
67
  unlockedHandler?: (tellPlayer: () => void) => any;
68
68
  onUnlocked(handler: (tellPlayer: () => void) => any): this;
69
+ progressHandler?: (newData?: string | number) => any;
70
+ onProgress(handler: (newData?: string | number) => any): this;
69
71
  }
@@ -20,7 +20,7 @@ export interface IMilestoneEvents {
20
20
  * @param value The new value for this milestone
21
21
  * @param max The max value for this milestone
22
22
  */
23
- update(milestone: Milestone, value: number, max: number): void;
23
+ update(milestone: Milestone, value: number, max: number, newData?: string | number): void;
24
24
  }
25
25
  export declare class MilestoneManager extends EventEmitter.Host<IMilestoneEvents> {
26
26
  private readonly game;
@@ -9,10 +9,17 @@
9
9
  * https://github.com/WaywardGame/types/wiki
10
10
  */
11
11
  import PlayerTargetedServerPacket from "multiplayer/packets/PlayerTargetedServerPacket";
12
- import type { IDialogInfo } from "ui/old/IOldUi";
13
- export default class UpdateDialogInfoPacket extends PlayerTargetedServerPacket {
12
+ import type { IContainerSortInfo, IDialogInfo } from "ui/old/IOldUi";
13
+ export declare enum UpdateUiInfoPacketType {
14
+ DialogInfo = 0,
15
+ DialogContainerInfo = 1,
16
+ ContainerSortInfo = 2
17
+ }
18
+ export default class UpdateUiInfoPacket extends PlayerTargetedServerPacket {
19
+ type: UpdateUiInfoPacketType;
14
20
  index: string | number;
15
21
  info: IDialogInfo;
22
+ containerSortInfo: IContainerSortInfo;
16
23
  getDebugInfo(): string;
17
24
  isSyncCheckEnabled(): boolean;
18
25
  isAllowedWhenPaused(): boolean;
@@ -48,7 +48,7 @@ export default class FieldOfView extends EventEmitter.Host<IFieldOfViewEvents> {
48
48
  texLight: WebGLTexture | undefined;
49
49
  texLightOld: WebGLTexture | undefined;
50
50
  private seed;
51
- private transitionFinishTime;
51
+ private transitionMovementTime;
52
52
  private readonly transitioningExploredMap;
53
53
  private lastComputedIslandId;
54
54
  static initializePrograms(webGlContext: WebGlContext): Promise<void>;
@@ -12,6 +12,7 @@ import type { Events, IEventEmitter } from "event/EventEmitter";
12
12
  import type { EmitterOrBus, Event, Handler } from "event/EventManager";
13
13
  import type { IIcon } from "game/inspection/InfoProvider";
14
14
  import UiTranslation from "language/dictionary/UiTranslation";
15
+ import type { TranslationArg } from "language/ITranslation";
15
16
  import type { IBindingsSection } from "language/segment/BindSegment";
16
17
  import type { IColorSection } from "language/segment/ColorSegment";
17
18
  import type { IHeadingSection } from "language/segment/HeadingSegment";
@@ -25,9 +26,9 @@ import type { IInput, Modifier } from "ui/input/IInput";
25
26
  import type Tooltip from "ui/tooltip/Tooltip";
26
27
  import type { IReferenceSection, ISegment, IStringSection } from "utilities/string/Interpolator";
27
28
  export default class Text extends Component {
28
- static resolve(translation: TranslationGenerator | undefined, additionalSegments?: ISegment[], ...args: any[]): IStringSection[];
29
+ static resolve(translation: TranslationGenerator | undefined, additionalSegments?: ISegment[], ...args: TranslationArg[]): IStringSection[];
29
30
  private static areIdenticalSections;
30
- static toString(translation: TranslationGenerator | undefined, additionalSegments?: ISegment[]): string;
31
+ static toString(translation: TranslationGenerator | undefined, additionalSegments?: ISegment[], ...args: TranslationArg[]): string;
31
32
  private segments;
32
33
  private text?;
33
34
  private args?;
@@ -10,6 +10,7 @@
10
10
  */
11
11
  import type Doodad from "game/doodad/Doodad";
12
12
  import type NPC from "game/entity/npc/NPC";
13
+ import type NPCManager from "game/entity/npc/NPCManager";
13
14
  import type { ContainerReference, DisplayableItemType, IContainer, IDismantleComponent } from "game/item/IItem";
14
15
  import { ItemType } from "game/item/IItem";
15
16
  import type { IMoveItemOptions } from "game/item/IItemManager";
@@ -162,6 +163,7 @@ export default class InGameScreen extends BaseScreen {
162
163
  completeAddingMultipleItemsToContainer(container: IContainer, itemsToSync?: Item[]): void;
163
164
  onContainerItemAdd(itemManager: ItemManager, itemsAdded: Item[], container: IContainer, options?: IMoveItemOptions, customOptions?: IOldUiContainerItemAdd): void;
164
165
  protected onContainerItemRemove(itemManager: ItemManager, itemsRemoved: Item[], containerRemovedFrom?: IContainer): void;
166
+ protected onNpcRemove(npcManager: NPCManager, npc: NPC): void;
165
167
  refreshContainerName(container: IContainer, nestedUpdate?: boolean): void;
166
168
  getInventoryItemsInOrder(): any[];
167
169
  saveItemOrder(containerElement: JQuery, activeSort?: boolean): void;
@@ -49,7 +49,9 @@ export default class GameScreen extends Screen {
49
49
  private readonly gameCanvas;
50
50
  private readonly effects;
51
51
  private readonly placeholders;
52
- private readonly islandIntroWrapper;
52
+ private readonly popupOverlayWrapper;
53
+ private islandIntroPopupOverlay?;
54
+ private readonly pausedPopupOverlay;
53
55
  private readonly buttonRespawn;
54
56
  constructor();
55
57
  getQuadrantComponents(): import("@wayward/goodstream").default<QuadrantComponent>;
@@ -57,6 +59,8 @@ export default class GameScreen extends Screen {
57
59
  getQuadrantContainer(): Component<HTMLElement>;
58
60
  isMouseWithin(): Component<HTMLElement> | undefined;
59
61
  mouseStartWasWithin(api: IBindHandlerApi): boolean | undefined;
62
+ private readonly cinematicModeReasons;
63
+ toggleCinematicMode(enabled: boolean, reason: string): this;
60
64
  onGameStart(game: Game, _isLoadingSave: boolean, _playedCount: number): void;
61
65
  onLoadedOnIsland(player: Player, island: Island): void;
62
66
  private showIslandIntro;
@@ -13,28 +13,25 @@ import type Island from "game/island/Island";
13
13
  import Component from "ui/component/Component";
14
14
  import type { IGameIconsHost, IGameModifiersHost } from "ui/component/GameIcons";
15
15
  import GameIcons, { GameModifiers } from "ui/component/GameIcons";
16
- import { Heading } from "ui/component/Text";
16
+ import PopupOverlay from "ui/screen/screens/game/component/PopupOverlay";
17
17
  import type { IGameOptionsIcon } from "ui/screen/screens/menu/menus/pause/GameOptionsIcons";
18
18
  import { GameOptionsIcon } from "ui/screen/screens/menu/menus/pause/GameOptionsIcons";
19
19
  import type Tooltip from "ui/tooltip/Tooltip";
20
- export declare class GameDetails extends Component implements IGameIconsHost, IGameModifiersHost {
20
+ export declare class GameDetails extends PopupOverlay implements IGameIconsHost, IGameModifiersHost {
21
21
  get difficulty(): import("../../../../../game/options/IGameOptions").GameMode;
22
22
  get pvp(): boolean;
23
23
  get mods(): [string, import("ui/util/Misc").ModLoadability][];
24
24
  get friends(): ISteamFriend[];
25
- islandName: IslandName;
26
25
  readonly gameModifiers: GameModifiers;
27
26
  readonly gameIcons: GameIcons;
28
27
  questsWrapper?: Component;
29
28
  private refreshGameIconsTimeout?;
30
29
  private steamworksFriends;
31
30
  constructor(island: Island);
32
- lockHidden(): this;
33
- show(): this;
34
31
  setHasLabels(hasLabels?: boolean): this;
35
32
  setHasQuests(hasQuests?: boolean): this;
36
33
  hasIcons(): boolean;
37
- refresh(): void;
34
+ refresh(): this;
38
35
  getOptionsIconTooltipHandler(icon: GameOptionsIcon, description: IGameOptionsIcon): ((tooltip: Tooltip) => any) | undefined;
39
36
  getOptionsIcons(): [GameOptionsIcon, IGameOptionsIcon][];
40
37
  getChallengeModifiers(): import("../../../../../game/options/modifiers/challenge/IChallenge").Challenge[];
@@ -43,7 +40,3 @@ export declare class GameDetails extends Component implements IGameIconsHost, IG
43
40
  protected refreshGameIcons(): void;
44
41
  private refreshQuests;
45
42
  }
46
- export declare class IslandName extends Heading {
47
- constructor();
48
- setIsland(island: Island): void;
49
- }
@@ -0,0 +1,31 @@
1
+ /*!
2
+ * Copyright 2011-2021 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
+ import Component from "ui/component/Component";
12
+ import type { TranslationGenerator } from "ui/component/IComponent";
13
+ export declare enum PopupOverlayClasses {
14
+ Main = "popup-overlay",
15
+ Title = "popup-overlay-title",
16
+ TitleWord = "popup-overlay-title-word",
17
+ TitleChar = "popup-overlay-title-char"
18
+ }
19
+ export default class PopupOverlay extends Component {
20
+ title?: PopupOverlayTitle;
21
+ constructor();
22
+ private translation?;
23
+ setTitle(title: TranslationGenerator | string): this;
24
+ refresh(): this;
25
+ lockHidden(): this;
26
+ show(): this;
27
+ }
28
+ export declare class PopupOverlayTitle extends Component {
29
+ constructor();
30
+ setText(text: string): void;
31
+ }
@@ -10,7 +10,7 @@
10
10
  */
11
11
  import type { IHasImagePath } from "game/IObject";
12
12
  import type EntityWithStats from "game/entity/EntityWithStats";
13
- import type { IStat, StatDisplayType } from "game/entity/IStats";
13
+ import type { IStat, IStatBase, StatDisplayType } from "game/entity/IStats";
14
14
  import type { Reference } from "game/reference/IReferenceManager";
15
15
  import type { IModdable } from "mod/ModRegistry";
16
16
  import type Component from "ui/component/Component";
@@ -60,3 +60,28 @@ export interface IStatDisplayDescription extends IModdable, IHasImagePath<string
60
60
  subscribeCalculateEquipmentStats?: true;
61
61
  }
62
62
  export declare const STAT_DEFAULT_DISPLAY_ORDER = 100;
63
+ export interface IStatInfo extends Partial<IStatBase> {
64
+ value: number;
65
+ percent: number;
66
+ oldValue?: number;
67
+ }
68
+ /**
69
+ * Returns a `IStatDescription["onChange"]` handler that will check a predicate and run the handler with the result of that predicate.
70
+ * @param predicate A function that takes an `IStatInfo` object and returns whether it "matches".
71
+ * @param handler A function that takes whether the info matches, the `statElement`, the entity, and the `IStatInfo` object and "handles" it.
72
+ */
73
+ export declare function when(predicate: (info: IStatInfo, entity: EntityWithStats) => boolean, handler: (matched: boolean, statElement: Component, entity: EntityWithStats, info: IStatInfo) => any): (statElement: Component, entity: EntityWithStats, stat: IStat, oldValue?: number) => void;
74
+ /**
75
+ * Returns a `when()` handler that will toggle classes on a `statElement` based on whether the `predicate` matched.
76
+ */
77
+ export declare function toggleClasses(...classes: string[]): (matched: boolean, statElement: Component) => void;
78
+ /**
79
+ * Returns a `when()` handler that will discover a stat when the `predicate` matches.
80
+ */
81
+ export declare function discover(matched: boolean, statElement: Component, entity: EntityWithStats, stat: IStatInfo): void;
82
+ /**
83
+ * Shakes the stat element if `shouldShake` is true, otherwise removes the `shake` class.
84
+ *
85
+ * When adding the `shake` class, removes it after 250 ms.
86
+ */
87
+ export declare function shake(shouldShake: boolean, statElement: Component): Promise<void>;
@@ -8,6 +8,6 @@
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
- import type { IStatDisplayDescription } from "ui/screen/screens/game/static/stats/IStatDisplayDescription";
11
+ import { type IStatDisplayDescription } from "ui/screen/screens/game/static/stats/IStatDisplayDescription";
12
12
  declare const reputation: IStatDisplayDescription;
13
13
  export default reputation;
@@ -8,30 +8,7 @@
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
- import type EntityWithStats from "game/entity/EntityWithStats";
12
- import type { IStat, IStatBase } from "game/entity/IStats";
13
11
  import { Stat } from "game/entity/IStats";
14
- import type Component from "ui/component/Component";
15
- import type { IStatDisplayDescription } from "ui/screen/screens/game/static/stats/IStatDisplayDescription";
12
+ import { discover, shake, toggleClasses, when, type IStatDisplayDescription } from "ui/screen/screens/game/static/stats/IStatDisplayDescription";
13
+ export { discover, shake, toggleClasses, when };
16
14
  export declare const statDisplayDescriptions: Map<Stat, IStatDisplayDescription>;
17
- export interface IStatInfo extends Partial<IStatBase> {
18
- value: number;
19
- percent: number;
20
- oldValue?: number;
21
- }
22
- /**
23
- * Returns a `IStatDescription["onChange"]` handler that will check a predicate and run the handler with the result of that predicate.
24
- * @param predicate A function that takes an `IStatInfo` object and returns whether it "matches".
25
- * @param handler A function that takes whether the info matches, the `statElement`, the entity, and the `IStatInfo` object and "handles" it.
26
- */
27
- export declare function when(predicate: (info: IStatInfo) => boolean, handler: (matched: boolean, statElement: Component, entity: EntityWithStats, info: IStatInfo) => any): (statElement: Component, entity: EntityWithStats, stat: IStat, oldValue?: number) => void;
28
- /**
29
- * Returns a `when()` handler that will toggle classes on a `statElement` based on whether the `predicate` matched.
30
- */
31
- export declare function toggleClasses(...classes: string[]): (matched: boolean, statElement: Component) => void;
32
- /**
33
- * Shakes the stat element if `shouldShake` is true, otherwise removes the `shake` class.
34
- *
35
- * When adding the `shake` class, removes it after 250 ms.
36
- */
37
- export declare function shake(shouldShake: boolean, statElement: Component): Promise<void>;
@@ -45,7 +45,8 @@ export declare abstract class StatComponent extends Component {
45
45
  * Returns the display priority for this stat.
46
46
  */
47
47
  getDisplayOrder(): number;
48
- abstract getDisplayElement(): Text;
48
+ abstract getTextElement(): Text;
49
+ abstract getDisplayElement(): Component;
49
50
  /**
50
51
  * Returns the generic string representation of this stat.
51
52
  */
@@ -76,7 +77,8 @@ export declare class Statbar extends StatComponent {
76
77
  private readonly bar;
77
78
  private readonly text;
78
79
  constructor(entity: EntityWithStats, stat: Stat, noEvents?: true);
79
- getDisplayElement(): Text;
80
+ getTextElement(): Text;
81
+ getDisplayElement(): Component<HTMLElement>;
80
82
  getGenericStatValue(stat: IStatMax): IStringSection[];
81
83
  /**
82
84
  * Overrides the superclass method of the same name. Calls the superclass method, then updates the CSS
@@ -88,6 +90,7 @@ export declare class Statbar extends StatComponent {
88
90
  export declare class StatAttribute extends StatComponent {
89
91
  private readonly attribute;
90
92
  constructor(entity: EntityWithStats, stat: Stat, noEvents?: true);
93
+ getTextElement(): Text;
91
94
  getDisplayElement(): Text;
92
95
  }
93
96
  export declare class Statbars extends StatsContainer<Statbar> {
@@ -9,15 +9,15 @@
9
9
  * https://github.com/WaywardGame/types/wiki
10
10
  */
11
11
  /// <reference types="webdriverio/async" />
12
- import type { TestRunContext } from "@wayward/test/testRunner";
13
12
  import type { IInit } from "@wayward/game/Init";
14
13
  import type { Stat } from "@wayward/game/game/entity/IStats";
15
14
  import type { IslandId } from "@wayward/game/game/island/IIsland";
16
15
  import { Direction } from "@wayward/game/utilities/math/Direction";
17
16
  import type { Random } from "@wayward/game/utilities/random/Random";
18
- import { ApplicationLogger } from "@wayward/test/core/applicationLogger";
19
17
  import { ApplicationDom } from "@wayward/test/core/applicationDom";
20
- import type { IWaitUntilGameLoadedOptions, IDedicatedServerGameOptions, INewGameOptions, ITestJoinServerOptions } from "@wayward/test/interfaces";
18
+ import { ApplicationLogger } from "@wayward/test/core/applicationLogger";
19
+ import type { IDedicatedServerGameOptions, INewGameOptions, ITestJoinServerOptions, IWaitUntilGameLoadedOptions } from "@wayward/test/interfaces";
20
+ import type { TestRunContext } from "@wayward/test/testRunner";
21
21
  export default class ApplicationInteractions {
22
22
  protected readonly testContext: TestRunContext;
23
23
  readonly appId: string;
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.0-beta.dev.20230511.1",
4
+ "version": "2.13.0-beta.dev.20230512.1",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",