@wayward/types 2.11.0-beta.dev.20211203.1 → 2.11.0-beta.dev.20211204.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.
@@ -426,6 +426,10 @@ export declare type EquipEffects = {
426
426
  [K in keyof IEquipEffects]: AddHead<K, Extract<IEquipEffects[K], any[]>>;
427
427
  }[keyof IEquipEffects];
428
428
  export declare type EquipEffectByType<T extends EquipEffect> = IEquipEffects[T];
429
+ export declare enum ItemWeightChange {
430
+ NewMagicProperty = 0,
431
+ NewWeight = 1
432
+ }
429
433
  export declare enum RecipeLevel {
430
434
  Simple = 0,
431
435
  Intermediate = 1,
@@ -24,7 +24,7 @@ import type { IObject, IObjectOptions } from "game/IObject";
24
24
  import { Quality } from "game/IObject";
25
25
  import type { IslandId } from "game/island/IIsland";
26
26
  import type { ContainerReference, IConstructedInfo, IContainable, IContainer, IItemDescription, IItemDisassembleResult, IItemUsed, IMagicalPropertyInfo, IMoveToTileOptions } from "game/item/IItem";
27
- import { BookType, ItemType, SYMBOL_CONTAINER_CACHED_REFERENCE } from "game/item/IItem";
27
+ import { ItemWeightChange, BookType, ItemType, SYMBOL_CONTAINER_CACHED_REFERENCE } from "game/item/IItem";
28
28
  import type { IPlaceOnTileOptions } from "game/item/IItemManager";
29
29
  import ItemMapManager from "game/item/ItemMapManager";
30
30
  import type { IHasMagic, MagicalSubPropertySubTypes } from "game/magic/MagicalPropertyManager";
@@ -170,6 +170,11 @@ export default class Item extends EventEmitter.Host<IItemEvents> implements IRef
170
170
  clearQuickSlot(): void;
171
171
  isDecayed(): boolean;
172
172
  changeInto(type: ItemType, disableNotify?: boolean, emitTransformation?: boolean): void;
173
+ /**
174
+ * Verifies an item has a proper weight combined with its magical item weight (featherweight) property and changes it if not.
175
+ * @returns A type of change via ItemWeightChange for showing a new magical property was added or a new magical weight was added. If no change happened, it will return undefined.
176
+ */
177
+ verifyMagicalItemWeight(): ItemWeightChange | undefined;
173
178
  /**
174
179
  * Returns and item based on returnOnUseAndDecay.
175
180
  * @param disableNotify Set to true if no notification should be shown for the new item above the player.
@@ -15,7 +15,6 @@ import Human from "game/entity/Human";
15
15
  import type NPC from "game/entity/npc/NPC";
16
16
  import type Player from "game/entity/player/Player";
17
17
  import { Quality } from "game/IObject";
18
- import type Island from "game/island/Island";
19
18
  import type { ContainerReference, IContainable, IContainer, IItemDescription, IItemWeightComponent } from "game/item/IItem";
20
19
  import { ItemType, ItemTypeGroup } from "game/item/IItem";
21
20
  import type { IAddToContainerOptions, IRequirementInfo } from "game/item/IItemManager";
@@ -91,6 +90,7 @@ export default class ItemManager extends ObjectManager<Item, IItemManagerEvents>
91
90
  static isGroup(item: ItemType | ItemTypeGroup): item is ItemTypeGroup;
92
91
  static isInGroup(itemType: ItemType, itemGroup: ItemTypeGroup | ItemType): boolean;
93
92
  static getGroupItems(itemGroup: ItemType | ItemTypeGroup, ancestorGroups?: ItemTypeGroup[]): Set<ItemType>;
93
+ static getPlayerFromInventoryContainer(containable: IContainable): Player | undefined;
94
94
  static getItemTypeGroupName(itemType: ItemType | ItemTypeGroup, article?: boolean, count?: number): Translation;
95
95
  static getGroupDefault(itemGroup: ItemTypeGroup, weightType?: WeightType, ancestorGroups?: ItemTypeGroup[]): ItemType;
96
96
  /**
@@ -160,6 +160,7 @@ export default class ItemManager extends ObjectManager<Item, IItemManagerEvents>
160
160
  getItemTypeGroupName(itemType: ItemType | ItemTypeGroup, article?: boolean, count?: number): Translation;
161
161
  getGroupDefault(itemGroup: ItemTypeGroup, weightType?: WeightType, ancestorGroups?: ItemTypeGroup[]): ItemType;
162
162
  getGroups(itemType: ItemType): ItemTypeGroup[];
163
+ getPlayerFromInventoryContainer(containable: IContainable): Player | undefined;
163
164
  /**
164
165
  * Used to spawn a random item on the current biome type and at a set location (and terrain type) based on spawnOnWorldGen properties in item descriptions.
165
166
  * @param terrainType The terrain type to check.
@@ -225,7 +226,6 @@ export default class ItemManager extends ObjectManager<Item, IItemManagerEvents>
225
226
  getItemsByWeight(a: number, b: number): number;
226
227
  getItemsWeight(items: Item[]): number;
227
228
  copyProperties(item: Item, item2: Item): void;
228
- getPlayerFromInventoryContainer(island: Island, containable: IContainable): Player | undefined;
229
229
  getCraftQualityBonus(item: Item, required?: boolean): number;
230
230
  /**
231
231
  * Checks if the item type or item is filtered from inventory/crafting/container dialogs.
@@ -245,7 +245,7 @@ export default class ItemManager extends ObjectManager<Item, IItemManagerEvents>
245
245
  /**
246
246
  * Note: don't print items to the console because the console will hold the item indefinitely
247
247
  */
248
- loadReference(container: IContainer): boolean;
248
+ loadReference(container: IContainer, loadChildReferences?: boolean): boolean;
249
249
  private removeFromContainerInternal;
250
250
  private updateUiOnItemRemove;
251
251
  private getCraftTierBonus;
@@ -14,7 +14,6 @@ declare module ItemReferenceManager {
14
14
  /**
15
15
  * Don't use this
16
16
  */
17
- function getContainerReferenceSlow(containable: IContainable, includeIsland?: boolean): ContainerReference;
18
17
  function getContainerReferenceInIsland(island: Island, containable: IContainable | undefined, showWarnings?: boolean): ContainerReference;
19
18
  function derefenceContainerReference(containerRef: ContainerReference, island?: Island, showWarnings?: boolean): object | undefined;
20
19
  }
@@ -11,6 +11,7 @@
11
11
  import EventEmitter from "event/EventEmitter";
12
12
  import { DoodadType } from "game/doodad/IDoodad";
13
13
  import type Human from "game/entity/Human";
14
+ import type { IslandId } from "game/island/IIsland";
14
15
  import type Island from "game/island/Island";
15
16
  import type Item from "game/item/Item";
16
17
  import type { IMapGenGenerateOutput } from "game/mapgen/IMapGen";
@@ -113,7 +114,7 @@ export default class DrawnMap extends EventEmitter.Host<IDrawnMapEvents> impleme
113
114
  get position(): Readonly<IVector3>;
114
115
  get radius(): number;
115
116
  private _position;
116
- private islandId;
117
+ islandId: IslandId;
117
118
  private seed?;
118
119
  private readonly discoveredTreasures;
119
120
  readonly type: DrawnMapType;
@@ -44,7 +44,7 @@ interface IReferenceTypeMap {
44
44
  export declare type Referenceable = IReferenceTypeMap[ReferenceableReferenceTypes];
45
45
  export default class ReferenceManager {
46
46
  static isEnumReference(type: ReferenceType): type is EnumReferenceTypes;
47
- static getList(type: ReferenceType, gameIsland?: Island): import("../entity/creature/corpse/CorpseManager").default | import("../entity/creature/CreatureManager").default | import("../doodad/DoodadManager").default | import("../item/ItemManager").default | import("../entity/npc/NPCManager").default | import("../tile/TileEventManager").default | IterableIterator<Island> | Player[] | readonly Milestone[] | readonly ItemType[] | readonly SkillType[] | readonly Stat[];
47
+ static getList(type: ReferenceType, gameIsland?: Island): import("../entity/creature/corpse/CorpseManager").default | import("../entity/creature/CreatureManager").default | import("../doodad/DoodadManager").default | import("../item/ItemManager").default | import("../entity/npc/NPCManager").default | import("../tile/TileEventManager").default | Player[] | readonly Milestone[] | readonly ItemType[] | readonly SkillType[] | IterableIterator<Island> | readonly Stat[];
48
48
  private referenceCursor;
49
49
  create(): number;
50
50
  get(thing: Referenceable): Reference | undefined;
@@ -14,6 +14,7 @@ import StringTokenizer from "save/serializer/StringTokenizer";
14
14
  export default class Serializer implements ISerializer {
15
15
  private readonly options;
16
16
  private readonly stringTokenizer?;
17
+ static convertStringToUint8Array(data: string): Uint8Array;
17
18
  private static array;
18
19
  private static usingArray;
19
20
  private static readonly savedObjectCache;
@@ -80,6 +80,7 @@ export default class CanvasDialog extends Dialog {
80
80
  protected buttonSurface: Component<HTMLElement>;
81
81
  protected drawer: Component<HTMLElement>;
82
82
  constructor(id: DialogId);
83
+ protected onCanvasDialogRemove(): void;
83
84
  setZoomLevels(levels: Iterable<number>): this;
84
85
  get isHovering(): boolean;
85
86
  getMousePosition(): Vector2;
@@ -99,6 +100,7 @@ export default class CanvasDialog extends Dialog {
99
100
  private dragStart;
100
101
  private drag;
101
102
  private dragEnd;
103
+ private removeDragEventListeners;
102
104
  protected onCanvasClick(): void;
103
105
  private getAbsoluteMousePosition;
104
106
  protected rotateClockwise(): void;
@@ -75,6 +75,7 @@ export default class Messages extends QuadrantComponent {
75
75
  onReadNote(player: Player, id: number): void;
76
76
  onFocusChat(): boolean;
77
77
  getDefaultFilterName(filter: MessageFilterDefault): string;
78
+ protected onAppend(): void;
78
79
  protected onChangeQuadrant(): void;
79
80
  /**
80
81
  * Event handler for when the text in the chat box should be sent as a message.
@@ -8,11 +8,17 @@
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 EventEmitter from "event/EventEmitter";
11
12
  import type Screen from "ui/screen/Screen";
12
13
  import { MenuId } from "ui/screen/screens/menu/component/IMenu";
13
14
  import Menu from "ui/screen/screens/menu/component/Menu";
14
15
  import type { MenuById } from "ui/screen/screens/menu/MenuMap";
15
- export default class MenuManager {
16
+ export interface IMenuManagerEvents {
17
+ init(menu: Menu): any;
18
+ show(menu: Menu): any;
19
+ hide(menu: Menu): any;
20
+ }
21
+ export default class MenuManager extends EventEmitter.Host<IMenuManagerEvents> {
16
22
  allowNoMenus: boolean;
17
23
  all: Record<number, Menu>;
18
24
  chain: Menu[];
@@ -39,4 +45,8 @@ export default class MenuManager {
39
45
  * Sets the given menu to be the new top menu. (Removes super-menus, keeps sub-menus)
40
46
  */
41
47
  setTop(menu: Menu): this;
48
+ /**
49
+ * Returns a promise that resolves when the given screen is shown.
50
+ */
51
+ await<MENU extends MenuId>(menuId: MENU): Promise<MenuById[MENU]>;
42
52
  }
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.0-beta.dev.20211203.1",
4
+ "version": "2.11.0-beta.dev.20211204.1",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",