@wayward/types 2.11.0-beta.dev.20211202.1 → 2.11.0-beta.dev.20211205.2

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 (30) hide show
  1. package/definitions/game/game/entity/Human.d.ts +1 -0
  2. package/definitions/game/game/inspection/InfoProvider.d.ts +2 -0
  3. package/definitions/game/game/inspection/inspections/ItemInspection.d.ts +1 -1
  4. package/definitions/game/game/item/IItem.d.ts +4 -0
  5. package/definitions/game/game/item/Item.d.ts +12 -2
  6. package/definitions/game/game/item/ItemManager.d.ts +4 -4
  7. package/definitions/game/game/item/ItemRecipeRequirementChecker.d.ts +4 -4
  8. package/definitions/game/game/item/ItemReferenceManager.d.ts +0 -1
  9. package/definitions/game/game/mapping/DrawnMap.d.ts +2 -1
  10. package/definitions/game/game/reference/ReferenceManager.d.ts +2 -2
  11. package/definitions/game/language/dictionary/Message.d.ts +885 -884
  12. package/definitions/game/renderer/Renderer.d.ts +1 -1
  13. package/definitions/game/save/serializer/Serializer.d.ts +1 -0
  14. package/definitions/game/ui/input/InputManager.d.ts +7 -0
  15. package/definitions/game/ui/old/screens/InGameScreen.d.ts +1 -1
  16. package/definitions/game/ui/screen/Screen.d.ts +3 -2
  17. package/definitions/game/ui/screen/screens/game/InspectionsTooltipHandler.d.ts +1 -1
  18. package/definitions/game/ui/screen/screens/game/component/CanvasDialog.d.ts +2 -0
  19. package/definitions/game/ui/screen/screens/game/component/GameDetails.d.ts +1 -0
  20. package/definitions/game/ui/screen/screens/game/component/InspectionsList.d.ts +4 -0
  21. package/definitions/game/ui/screen/screens/game/static/Messages.d.ts +1 -0
  22. package/definitions/game/ui/screen/screens/menu/MenuManager.d.ts +11 -1
  23. package/definitions/game/ui/tooltip/TooltipManager.d.ts +1 -1
  24. package/definitions/game/utilities/Log.d.ts +11 -10
  25. package/definitions/game/utilities/Timer.d.ts +25 -0
  26. package/definitions/game/utilities/memory/ILifetime.d.ts +20 -0
  27. package/definitions/game/utilities/memory/IMemoryLeakDetector.d.ts +1 -6
  28. package/definitions/game/utilities/memory/MemoryLeakDetector.d.ts +1 -1
  29. package/package.json +1 -1
  30. package/tsconfig.mod.base.json +2 -1
@@ -87,6 +87,7 @@ export default abstract class Human extends Entity implements IHasInsulation {
87
87
  updateStatsAndAttributes(): void;
88
88
  staminaReduction(skill?: SkillType, level?: number): void;
89
89
  updateReputation(reputation: number): void;
90
+ capReputation(): void;
90
91
  setPaddling(item: Item | undefined, extinguishTorches?: boolean): void;
91
92
  /**
92
93
  * Extinguishes all torches the player is holding.
@@ -21,6 +21,8 @@ export interface IInfoProviderEvents {
21
21
  * Should be emitted when the info provider is starting to initialize its component.
22
22
  */
23
23
  init(component: Component): any;
24
+ /** Emitted when the info provider finishes initializing */
25
+ initDone(): any;
24
26
  /**
25
27
  * Should be emitted when the info provider has detected an update and its contents will need to be refreshed.
26
28
  */
@@ -32,7 +32,7 @@ export default class ItemInspection extends Inspection<ItemType> {
32
32
  static handles(type: InspectType, item: unknown): any;
33
33
  private static readonly itemTypeHandles;
34
34
  private static readonly dismantleHandles;
35
- readonly item?: Item;
35
+ readonly item?: WeakRef<Item> | undefined;
36
36
  private readonly description?;
37
37
  private readonly isDismantle;
38
38
  private inspectorPosition;
@@ -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";
@@ -92,7 +92,7 @@ export default class Item extends EventEmitter.Host<IItemEvents> implements IRef
92
92
  used?: IItemUsed;
93
93
  weight: number;
94
94
  weightFraction?: number;
95
- quickSlot: number | undefined;
95
+ quickSlot: number[] | undefined;
96
96
  magic: MagicalPropertyManager;
97
97
  map: ItemMapManager;
98
98
  islandId: IslandId;
@@ -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.
@@ -269,6 +274,11 @@ export default class Item extends EventEmitter.Host<IItemEvents> implements IRef
269
274
  * @returns The maximum reinforcement of the item as a number.
270
275
  */
271
276
  getMaxReinforcement(maxDurability: number, actionTier: number): number;
277
+ /**
278
+ * Check if an item will break on damage.
279
+ * @returns True or false if the item will be broken when being damaged.
280
+ */
281
+ willBreakOnDamage(actionType?: ActionType): boolean;
272
282
  onUnserialized(): void;
273
283
  private setupDurabilityHandlers;
274
284
  private checkIfItemsMatch;
@@ -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.
@@ -182,7 +183,7 @@ export default class ItemManager extends ObjectManager<Item, IItemManagerEvents>
182
183
  getNPCWithItemInInventory(containable: IContainable): NPC | undefined;
183
184
  countItemsInContainer(containers: IContainer | IContainer[], itemTypeSearch: ItemType, ignoreItem?: Item): number;
184
185
  countItemsInContainerByGroup(containers: IContainer | IContainer[], itemTypeGroupSearch: ItemTypeGroup, ignoreItem?: Item): number;
185
- getSafeItemInContainerByUse(container: IContainer, action: ActionType, allowProtectedItems?: boolean, canDamageItem?: boolean, consumable?: boolean): Item | undefined;
186
+ getBestSafeItemInContainerByUse(container: IContainer, action: ActionType, allowProtectedItems?: boolean, canDamageItem?: boolean, consumable?: boolean): Item | undefined;
186
187
  getItemInContainer(container: IContainer, itemTypeSearch: ItemType, ignoreItem?: Item, allowProtectedItems?: boolean): Item | undefined;
187
188
  getItemForHuman(human: Human, search: ItemType | ItemTypeGroup, allowProtectedItems?: boolean): Item | undefined;
188
189
  getItemInContainerByGroup(container: IContainer, itemTypeGroupSearch: ItemTypeGroup, ignoreItemId?: number, allowProtectedItems?: boolean): Item | undefined;
@@ -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;
@@ -13,7 +13,6 @@ import type { IContainer, IRecipe, ItemType, ItemTypeGroup } from "game/item/IIt
13
13
  import type Item from "game/item/Item";
14
14
  export default class ItemRecipeRequirementChecker {
15
15
  private readonly human;
16
- private readonly recipe?;
17
16
  private readonly trackItems?;
18
17
  private readonly cacheItems?;
19
18
  private readonly canUseItem?;
@@ -21,13 +20,14 @@ export default class ItemRecipeRequirementChecker {
21
20
  itemComponentsRequired: Item[];
22
21
  itemComponentsConsumed: Item[];
23
22
  itemComponentsCanBurn: boolean;
24
- numComponentsNeeded: number;
23
+ private numComponentsNeeded;
25
24
  private baseComponent;
26
25
  private components;
27
26
  private componentItems;
27
+ private recipe;
28
28
  private adjacentContainers;
29
29
  private readonly itemsToProcess;
30
- constructor(human: Human, recipe?: IRecipe | undefined, trackItems?: boolean | undefined, cacheItems?: boolean | undefined, canUseItem?: ((item: Item, isConsumed: boolean, forItemTypeOrGroup: ItemType | ItemTypeGroup) => boolean) | undefined);
30
+ constructor(human: Human, recipe?: IRecipe, trackItems?: boolean | undefined, cacheItems?: boolean | undefined, canUseItem?: ((item: Item, isConsumed: boolean, forItemTypeOrGroup: ItemType | ItemTypeGroup) => boolean) | undefined);
31
31
  /**
32
32
  * Returns the amount of items needed for the component
33
33
  */
@@ -45,7 +45,7 @@ export default class ItemRecipeRequirementChecker {
45
45
  * @returns true if the recipe's requirements are satisfied
46
46
  */
47
47
  process(): boolean;
48
- setRecipe(recipe: IRecipe): void;
48
+ setRecipe(recipe: IRecipe | undefined): boolean;
49
49
  /**
50
50
  * Looks around adjacent containers
51
51
  * @returns true if the recipe's requirements are satisfied
@@ -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;
@@ -52,7 +52,7 @@ export default class ReferenceManager {
52
52
  resolve<R extends ReferenceType>(id: number, type: R): IReferenceTypeMap[R] | undefined;
53
53
  resolve(id: number, type?: ReferenceType): IReferenceTypeMap[ReferenceType] | undefined;
54
54
  inspect(id: number, type?: ReferenceType, ...args: any[]): import("../inspection/Inspection").default<any> | undefined;
55
- tooltip(id: number, type?: ReferenceType): (tooltip: import("../../ui/tooltip/Tooltip").default) => import("../../ui/tooltip/Tooltip").default | undefined;
55
+ tooltip(id: number, type?: ReferenceType): (tooltip: import("../../ui/tooltip/Tooltip").default) => Promise<void>;
56
56
  getReferenceType(thing: Value<IReferenceTypeMap>): ReferenceType;
57
57
  }
58
58
  export {};