@wayward/types 2.13.2-beta.dev.20230519.1 → 2.13.2-beta.dev.20230520.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.
@@ -95,8 +95,8 @@ export default class Player extends Human implements IPreSerializeCallback, IUns
95
95
  /**
96
96
  * Send a packet to the server about the sort info for the container
97
97
  */
98
- updateContainerSortInfo(dialogIndex: string | number): void;
99
- getDialogInfo(dialogIndex: string | number): IDialogInfo | undefined;
98
+ updateContainerSortInfo(dialogIndex: string | number | undefined): void;
99
+ getDialogInfo(dialogIndex: string | number | undefined): IDialogInfo | undefined;
100
100
  kill(): void;
101
101
  respawn(reset: boolean): void;
102
102
  /**
@@ -8,6 +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 { Reference } from "game/reference/IReferenceManager";
11
12
  export declare enum OldUiDialogId {
12
13
  Inventory = 0,
13
14
  Crafting = 1,
@@ -24,6 +25,7 @@ export interface IUiScreen {
24
25
  }
25
26
  export interface IDialogInfo {
26
27
  fromReferenceId?: boolean;
28
+ reference?: Reference;
27
29
  id?: string;
28
30
  title?: string;
29
31
  open?: boolean;
@@ -8,8 +8,8 @@
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 Doodad from "game/doodad/Doodad";
12
- import type NPC from "game/entity/npc/NPC";
11
+ import Doodad from "game/doodad/Doodad";
12
+ import NPC from "game/entity/npc/NPC";
13
13
  import type NPCManager from "game/entity/npc/NPCManager";
14
14
  import { Quality } from "game/IObject";
15
15
  import type { ContainerReference, DisplayableItemType, IContainer, IDismantleComponent } from "game/item/IItem";
@@ -17,6 +17,7 @@ import { ItemType } from "game/item/IItem";
17
17
  import type { IMoveItemOptions } from "game/item/IItemManager";
18
18
  import Item from "game/item/Item";
19
19
  import type ItemManager from "game/item/ItemManager";
20
+ import { Reference, ReferenceType } from "game/reference/IReferenceManager";
20
21
  import Message from "language/dictionary/Message";
21
22
  import { SortDirection } from "save/ISaveManager";
22
23
  import Input from "ui/component/Input";
@@ -36,6 +37,9 @@ export declare enum TextElementId {
36
37
  Defense = 2,
37
38
  Reputation = 3
38
39
  }
40
+ export type DialogIndexStrings = "inventory" | "crafting-tabs";
41
+ export type DialogIndex = DialogIndexStrings | Reference<ReferenceType.Item | ReferenceType.Doodad | ReferenceType.NPC>;
42
+ export type DereferencedDialogIndex = DialogIndexStrings | number;
39
43
  declare global {
40
44
  interface JQuery {
41
45
  isVisible(): boolean;
@@ -119,15 +123,19 @@ export default class InGameScreen extends BaseScreen {
119
123
  * Gets dialog index
120
124
  * @param dialogId Dialog id
121
125
  * @param containerReference Container reference when opening a container
122
- * @returns string if it's a named dialog, number if it's a container (reference id), -1 if no dialog index was retrievable
126
+ * @returns string if it's a named dialog, Reference if it's a container, undefined if no dialog index was retrievable
123
127
  */
124
- getDialogIndex(dialogId: OldUiDialogId, containerReference?: ContainerReference): "inventory" | "crafting-tabs" | number;
128
+ getDialogIndex(dialogId: OldUiDialogId, containerReference?: ContainerReference): DialogIndex | undefined;
125
129
  /**
126
130
  * Gets dialog index
127
131
  * @param containerElement Dialog container element
128
- * @returns string if it's a named dialog, number if it's a container (reference id), -1 if no dialog index was retrievable
132
+ * @returns string if it's a named dialog, Reference if it's a container, undefined if no dialog index was retrievable
129
133
  */
130
- getDialogIndexByContainerElement(containerElement: JQuery): "inventory" | "crafting-tabs" | number;
134
+ getDialogIndexByContainerElement(containerElement: JQuery): DialogIndex | undefined;
135
+ /**
136
+ * Dereferences a dialog index into a string, number, or undefined
137
+ */
138
+ private derefenceDialogIndex;
131
139
  setupDialog(dialogId: OldUiDialogId, containerReference?: ContainerReference, highlightItemId?: number): JQueryUI.DialogOptions;
132
140
  highlightItemElementByItemId(itemId: number, highlight: boolean, force?: boolean, skipCount?: boolean): void;
133
141
  highlightItemElementByItemType(itemType: ItemType, highlight: boolean, force?: boolean, skipCount?: boolean): void;
@@ -222,8 +230,8 @@ export default class InGameScreen extends BaseScreen {
222
230
  */
223
231
  updateTablesDirty(which?: "crafting" | "dismantle"): void;
224
232
  createSortMenu(container: JQuery, messageType: Message, containerSortInfo?: IContainerSortInfo): SortRow<number>;
225
- getContainerSortInfo(index: "inventory" | "crafting-tabs" | number): IContainerSortInfo;
226
- getDefaultSortType(index: "inventory" | "crafting-tabs" | number): SortType;
233
+ getContainerSortInfo(dialogIndex: DialogIndex | undefined): IContainerSortInfo;
234
+ getDefaultSortType(index: DereferencedDialogIndex | undefined): SortType;
227
235
  sortItems(containerElement: JQuery, sortType: SortType, direction: SortDirection, messageType?: Message, activeSort?: boolean): void;
228
236
  onUpdateContainer(containerElement: JQuery, activeSort: boolean): void;
229
237
  updateSort(containerElement: JQuery, activeSort: boolean): void;
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.2-beta.dev.20230519.1",
4
+ "version": "2.13.2-beta.dev.20230520.1",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",