@wayward/types 2.12.0-beta.dev.20220921.1 → 2.12.0-beta.dev.20220923.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 (23) hide show
  1. package/definitions/game/game/IObject.d.ts +1 -0
  2. package/definitions/game/game/entity/action/actions/Cast.d.ts +5 -2
  3. package/definitions/game/game/entity/action/actions/helper/TreasureGathering.d.ts +48 -0
  4. package/definitions/game/game/entity/action/usable/UsableAction.d.ts +14 -5
  5. package/definitions/game/game/inspection/InfoProviderContext.d.ts +4 -3
  6. package/definitions/game/game/inspection/InspectionTypeMap.d.ts +25 -0
  7. package/definitions/game/game/inspection/InspectionsHandler.d.ts +24 -1
  8. package/definitions/game/game/inspection/infoProviders/item/ItemDetails.d.ts +1 -1
  9. package/definitions/game/game/inspection/infoProviders/stat/AttackInfo.d.ts +1 -1
  10. package/definitions/game/game/inspection/inspections/ActionInspection.d.ts +4 -2
  11. package/definitions/game/game/inspection/inspections/CorpseInspection.d.ts +1 -1
  12. package/definitions/game/game/island/Island.d.ts +5 -1
  13. package/definitions/game/game/item/IItem.d.ts +4 -0
  14. package/definitions/game/game/item/Item.d.ts +2 -2
  15. package/definitions/game/language/dictionary/UiTranslation.d.ts +409 -408
  16. package/definitions/game/ui/component/Button.d.ts +1 -1
  17. package/definitions/game/ui/screen/screens/game/InspectionsTooltipHandler.d.ts +1 -0
  18. package/definitions/game/ui/screen/screens/game/component/Dialog.d.ts +1 -1
  19. package/definitions/game/ui/screen/screens/game/component/InspectionsList.d.ts +3 -0
  20. package/definitions/game/ui/tooltip/Tooltip.d.ts +1 -0
  21. package/definitions/game/utilities/game/TileHelpers.d.ts +3 -4
  22. package/package.json +1 -1
  23. package/definitions/game/game/entity/action/actions/helper/GatherTreasure.d.ts +0 -22
@@ -21,6 +21,7 @@ export interface IObject<T> {
21
21
  renamed?: string | ISerializedTranslation;
22
22
  }
23
23
  export interface IObjectDescription extends IHasImagePath {
24
+ storeDecay?: boolean;
24
25
  decayMax?: number;
25
26
  skillUse?: SkillType;
26
27
  weightCapacity?: number;
@@ -9,12 +9,15 @@
9
9
  * https://github.com/WaywardGame/types/wiki
10
10
  */
11
11
  import { Action } from "game/entity/action/Action";
12
+ import TreasureGathering from "game/entity/action/actions/helper/TreasureGathering";
12
13
  import type { IActionUsable } from "game/entity/action/IAction";
13
14
  import { ActionArgument } from "game/entity/action/IAction";
14
15
  import type { IRanged } from "game/item/IItem";
15
- import type Item from "game/item/Item";
16
16
  export interface ICastCanUse extends IActionUsable {
17
17
  ranged: IRanged;
18
+ itemRange: number;
19
+ maxFishingRange: number;
20
+ canGatherTreasure?: TreasureGathering.ICanGather;
18
21
  }
19
- declare const _default: Action<[ActionArgument.ItemInventory], import("../../Human").default, void, ICastCanUse, [Item]>;
22
+ declare const _default: Action<[ActionArgument.ItemInventory], import("../../Human").default, void, ICastCanUse, [import("../../../item/Item").default]>;
20
23
  export default _default;
@@ -0,0 +1,48 @@
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 type { IActionHandlerApi } from "game/entity/action/IAction";
12
+ import type Human from "game/entity/Human";
13
+ import type Item from "game/item/Item";
14
+ import type DrawnMap from "game/mapping/DrawnMap";
15
+ import type { ITreasure } from "game/mapping/DrawnMap";
16
+ import type { IVector3 } from "utilities/math/IVector";
17
+ declare namespace TreasureGathering {
18
+ interface IGatherable {
19
+ map: DrawnMap;
20
+ mapItem?: Item;
21
+ toolRange?: number;
22
+ maxRange?: number;
23
+ treasure: ITreasure;
24
+ position: IVector3;
25
+ }
26
+ enum GatherablesResult {
27
+ Blocked = 0,
28
+ NoTreasure = 1,
29
+ NoMapsForTreasure = 2
30
+ }
31
+ interface ICanGather {
32
+ gatherables?: IGatherable[];
33
+ result?: GatherablesResult;
34
+ }
35
+ function canGather(executor: Human, itemRange: number, requireMap: boolean, maxRange?: number): ICanGather;
36
+ enum Result {
37
+ NoTreasure = 0,
38
+ NotYet = 1,
39
+ Gathered = 2
40
+ }
41
+ interface IGatherResult {
42
+ result: Result;
43
+ position?: IVector3;
44
+ treasure?: ITreasure;
45
+ }
46
+ function gather(action: IActionHandlerApi<Human>, itemRange: number, requireMap: boolean, tool?: Item, canGather?: ICanGather): IGatherResult;
47
+ }
48
+ export default TreasureGathering;
@@ -10,7 +10,7 @@
10
10
  */
11
11
  import type Doodad from "game/doodad/Doodad";
12
12
  import type { ActionDisplayLevel, ActionType, IActionNotUsable, IActionUsable } from "game/entity/action/IAction";
13
- import type UsableActionRegistrar from "game/entity/action/usable/UsableActionRegistrar";
13
+ import UsableActionRegistrar from "game/entity/action/usable/UsableActionRegistrar";
14
14
  import type { UsableActionTypePlaceholder } from "game/entity/action/usable/UsableActionType";
15
15
  import { UsableActionType } from "game/entity/action/usable/UsableActionType";
16
16
  import type Creature from "game/entity/creature/Creature";
@@ -107,6 +107,7 @@ export declare type UsableActionIconReference = ActionType | UsableActionType |
107
107
  export declare type ReturnableUsableActionUsability = IActionUsable | IActionNotUsable | boolean;
108
108
  export interface IUsableActionUsable<REQUIREMENTS extends IUsableActionRequirements> extends IActionUsable {
109
109
  using: IUsableActionUsing<REQUIREMENTS>;
110
+ forceDisplay?: true;
110
111
  }
111
112
  export interface IUsableActionNotUsable extends IActionNotUsable {
112
113
  sendMessage(): void;
@@ -220,16 +221,19 @@ export interface IUsableActionDefinitionBase<REQUIREMENTS extends IUsableActionR
220
221
  */
221
222
  onlySlotItemType?: true;
222
223
  tooltip?(tooltip: Tooltip): any;
224
+ forceDisplayWhenEmpty?: true;
223
225
  }
224
226
  export interface IUsableActionDefinitionSubmenu<REQUIREMENTS extends IUsableActionRequirements = IUsableActionRequirements> extends IUsableActionDefinitionBase<REQUIREMENTS> {
225
227
  submenu(registrar: UsableActionRegistrar, using: IUsableActionUsing<REQUIREMENTS>): UsableActionRegistrar | void;
226
228
  execute?: undefined;
227
229
  isUsable?(player: Player, using: IUsableActionUsing<REQUIREMENTS>): ReturnableUsableActionUsability;
228
230
  slottable?: undefined;
231
+ forceDisplayWhenEmpty?: true;
229
232
  }
230
233
  export interface IUsableActionDefinitionExecutable<REQUIREMENTS extends IUsableActionRequirements = IUsableActionRequirements> extends IUsableActionDefinitionBase<REQUIREMENTS> {
231
234
  slottable?: boolean;
232
235
  submenu?: undefined;
236
+ forceDisplayWhenEmpty?: undefined;
233
237
  execute(player: Player, using: IUsableActionUsing<REQUIREMENTS>, context: IUsableActionExecutionContext): any;
234
238
  isUsable?(player: Player, using: IUsableActionUsing<REQUIREMENTS>): ReturnableUsableActionUsability;
235
239
  }
@@ -272,17 +276,22 @@ declare class UsableAction<REQUIREMENTS extends IUsableActionRequirements = IUsa
272
276
  getIcon(provided: IUsableActionPossibleUsing): IIcon | undefined;
273
277
  getHighlightSelectors(using?: IUsableActionPossibleUsing): HighlightSelector[];
274
278
  private translator?;
275
- getTranslation(using?: IUsableActionUsing<REQUIREMENTS>, which?: ActionTranslation): Translation | undefined;
279
+ getTranslation(using?: IUsableActionPossibleUsing, which?: ActionTranslation, context?: UsableActionTranslationContext): Translation | undefined;
276
280
  getOrder(using?: IUsableActionPossibleUsing): number;
277
281
  }
282
+ export declare enum UsableActionTranslationContext {
283
+ None = 0,
284
+ Use = 1
285
+ }
286
+ export declare type UsableActionTranslationArguments = [using: IUsableActionPossibleUsing, action: UsableAction, context: UsableActionTranslationContext];
278
287
  export declare class UsableActionTranslator {
279
288
  readonly id: ActionId;
280
289
  private nameSupplier?;
281
290
  private descriptionSupplier?;
282
291
  constructor(id: ActionId);
283
- name(supplier: SupplierOr<Translation, [using: IUsableActionPossibleUsing, action: UsableAction]>): this;
284
- description(supplier: SupplierOr<Translation, [using: IUsableActionPossibleUsing, action: UsableAction]>): this;
285
- get(action: UsableAction, using?: IUsableActionPossibleUsing, which?: ActionTranslation): Translation | undefined;
292
+ name(supplier: SupplierOr<Translation, UsableActionTranslationArguments>): this;
293
+ description(supplier: SupplierOr<Translation, UsableActionTranslationArguments>): this;
294
+ get(action: UsableAction, using?: IUsableActionPossibleUsing, which?: ActionTranslation, context?: UsableActionTranslationContext): Translation | undefined;
286
295
  }
287
296
  export interface IUsableActionFactory<REQUIREMENTS extends IUsableActionRequirements> {
288
297
  create: <DEFINITION extends IUsableActionDefinition<REQUIREMENTS>>(action: DEFINITION) => UsableAction<REQUIREMENTS, DEFINITION>;
@@ -11,11 +11,12 @@
11
11
  import type { IInspector, InfoDisplayLevel } from "game/inspection/IInfoProvider";
12
12
  import { TextContext } from "language/ITranslation";
13
13
  export declare class InfoProviderContext {
14
- readonly textContext: TextContext;
15
- readonly maxDisplayLevel: InfoDisplayLevel;
16
14
  static readonly UI: new (inspector: IInspector, maxDisplayLevel: InfoDisplayLevel) => InfoProviderContext;
17
15
  static readonly RAW: new (inspector: IInspector, maxDisplayLevel: InfoDisplayLevel) => InfoProviderContext;
18
- private readonly _inspector;
16
+ protected readonly _inspector: WeakRef<IInspector>;
17
+ readonly textContext: TextContext;
18
+ readonly maxDisplayLevel: InfoDisplayLevel;
19
+ constructor(context: InfoProviderContext);
19
20
  constructor(textContext: TextContext, inspector: IInspector, maxDisplayLevel: InfoDisplayLevel);
20
21
  get inspector(): IInspector | undefined;
21
22
  }
@@ -30,6 +30,30 @@ import StatInspection from "game/inspection/inspections/StatInspection";
30
30
  import TileEventInspection from "game/inspection/inspections/TileEventInspection";
31
31
  import TileInspection from "game/inspection/inspections/TileInspection";
32
32
  import type { IVector3 } from "utilities/math/IVector";
33
+ declare const inspectionTypeMap: {
34
+ 12: typeof ActionInspection;
35
+ 14: typeof CorpseInspection;
36
+ 15: typeof CorpsesInspection;
37
+ 3: typeof CreatureInspection;
38
+ 10: typeof ItemInspection;
39
+ 4: typeof DoodadInspection;
40
+ 7: typeof EquipSlotInspection;
41
+ 6: typeof PlayerInspection;
42
+ 21: typeof IslandInspection;
43
+ 8: typeof ItemInspection;
44
+ 13: typeof ItemsInspection;
45
+ 11: typeof ItemInspection;
46
+ 19: typeof MilestoneInspection;
47
+ 2: typeof NPCInspection;
48
+ 1: typeof PlayerInspection;
49
+ 9: typeof RecipeInspection;
50
+ 0: typeof SelfInspection;
51
+ 18: typeof SkillInspection;
52
+ 20: typeof StatInspection;
53
+ 17: typeof TileInspection;
54
+ 5: typeof TileEventInspection;
55
+ 16: typeof TileEventInspection.Minors;
56
+ };
33
57
  export declare type InspectionClass = Class<Inspection<any>> & {
34
58
  isWorldInspection?(inspectType: InspectType): boolean;
35
59
  getFromTile?(position: IVector3, context: InfoProviderContext, inspectType: InspectType): ArrayOr<Inspection<any>>;
@@ -67,6 +91,7 @@ declare const _default: {
67
91
  16: typeof TileEventInspection.Minors;
68
92
  } & Record<InspectType, InspectionClass>;
69
93
  export default _default;
94
+ export declare type ResolvedInspection<TYPE extends InspectType> = InstanceOf<(typeof inspectionTypeMap)[TYPE]>;
70
95
  export declare module Inspections {
71
96
  function get(...args: any[]): Inspection<any> | undefined;
72
97
  function isWorldInspection(type: InspectType): boolean;
@@ -21,7 +21,30 @@ export default abstract class InspectionsHandler extends EventEmitter.Host<IInsp
21
21
  protected readonly inspectionsMap: Map<InspectType, HashSet<Inspection<any>>>;
22
22
  static makeInspectionsSet(...values: Array<IterableOr<Inspection<any> | undefined>>): HashSet<Inspection<any>>;
23
23
  constructor(context: InfoProviderContext, inspectionsMap?: Map<InspectType, HashSet<Inspection<any>>>);
24
- get(inspectType: InspectType): HashSet<Inspection<any>> | undefined;
24
+ get<TYPE extends InspectType>(inspectType: InspectType): HashSet<InstanceOf<{
25
+ 12: typeof import("./inspections/ActionInspection").default;
26
+ 14: typeof import("./inspections/CorpseInspection").default;
27
+ 15: typeof import("./inspections/CorpsesInspection").default;
28
+ 3: typeof import("./inspections/CreatureInspection").default;
29
+ 10: typeof import("./inspections/ItemInspection").default;
30
+ 4: typeof import("./inspections/DoodadInspection").default;
31
+ 7: typeof import("./inspections/EquipSlotInspection").default;
32
+ 6: typeof import("./inspections/PlayerInspection").default;
33
+ 21: typeof import("./inspections/IslandInspection").default;
34
+ 8: typeof import("./inspections/ItemInspection").default;
35
+ 13: typeof import("./inspections/ItemsInspection").default;
36
+ 11: typeof import("./inspections/ItemInspection").default;
37
+ 19: typeof import("./inspections/MilestoneInspection").default;
38
+ 2: typeof import("./inspections/NPCInspection").default;
39
+ 1: typeof import("./inspections/PlayerInspection").default;
40
+ 9: typeof import("./inspections/RecipeInspection").default;
41
+ 0: typeof import("./inspections/SelfInspection").default;
42
+ 18: typeof import("./inspections/SkillInspection").default;
43
+ 20: typeof import("./inspections/StatInspection").default;
44
+ 17: typeof import("./inspections/TileInspection").default;
45
+ 5: typeof import("./inspections/TileEventInspection").default;
46
+ 16: typeof import("./inspections/TileEventInspection").default.Minors;
47
+ }[TYPE]>> | undefined;
25
48
  set(inspectType: InspectType, inspections: HashSet<Inspection<any>>): Map<InspectType, HashSet<Inspection<any>>>;
26
49
  [Symbol.iterator](): IterableIterator<[InspectType, HashSet<Inspection<any>>]>;
27
50
  types(): import("@wayward/goodstream").default<InspectType>;
@@ -19,7 +19,7 @@ export default class ItemDetailsInfoProvider extends InfoProvider {
19
19
  private readonly description;
20
20
  constructor(item: Item | ItemType);
21
21
  getClass(): string[];
22
- get(): (0 | LabelledValue | import("game/inspection/InfoProvider").SimpleInfoProvider | ItemWorthInfoProvider)[];
22
+ get(): (0 | import("game/inspection/InfoProvider").SimpleInfoProvider | LabelledValue | ItemWorthInfoProvider)[];
23
23
  private getInsulation;
24
24
  private getPreservation;
25
25
  private getGroupings;
@@ -15,7 +15,7 @@ export default class AttackInfo extends InfoProvider {
15
15
  private readonly human?;
16
16
  constructor(human?: Human | undefined);
17
17
  getClass(): string[];
18
- get(): (LabelledValue | import("game/inspection/InfoProvider").SimpleInfoProvider)[];
18
+ get(): (import("game/inspection/InfoProvider").SimpleInfoProvider | LabelledValue)[];
19
19
  private getTactics;
20
20
  private getMainHand;
21
21
  private getOffHand;
@@ -10,9 +10,10 @@
10
10
  */
11
11
  import { ActionType } from "game/entity/action/IAction";
12
12
  import type { IUsableActionPossibleUsing } from "game/entity/action/usable/UsableAction";
13
+ import { UsableActionTranslationContext } from "game/entity/action/usable/UsableAction";
13
14
  import { InspectType } from "game/inspection/IInspection";
14
15
  import { InfoProvider } from "game/inspection/InfoProvider";
15
- import type { InfoProviderContext } from "game/inspection/InfoProviderContext";
16
+ import { InfoProviderContext } from "game/inspection/InfoProviderContext";
16
17
  import Inspection from "game/inspection/Inspection";
17
18
  import type { EnumReferenceResolved } from "game/reference/IReferenceManager";
18
19
  import { ReferenceType } from "game/reference/IReferenceManager";
@@ -24,7 +25,8 @@ export default class ActionInspection extends Inspection<ActionType | string | u
24
25
  private readonly item?;
25
26
  using?: IUsableActionPossibleUsing;
26
27
  constructor(value?: string | EnumReferenceResolved<ReferenceType.Action>, slot?: ActionSlot | undefined);
27
- setUsing(using?: IUsableActionPossibleUsing): void;
28
+ setUsing(using?: IUsableActionPossibleUsing): this;
29
+ setContext(context: UsableActionTranslationContext): this;
28
30
  getId(): string;
29
31
  get(context: InfoProviderContext): ArrayOr<TranslationGenerator | InfoProvider>;
30
32
  private getTranslation;
@@ -19,7 +19,7 @@ export default class CorpseInspection extends Inspection<Corpse> {
19
19
  static getFromTile(position: IVector3): CorpseInspection[];
20
20
  static handles(type: InspectType, corpse: unknown): boolean;
21
21
  constructor(corpse: Corpse);
22
- get(context: InfoProviderContext): (0 | LabelledValue | import("game/inspection/InfoProvider").SimpleInfoProvider)[];
22
+ get(context: InfoProviderContext): (0 | import("game/inspection/InfoProvider").SimpleInfoProvider | LabelledValue)[];
23
23
  private getDecay;
24
24
  private decay;
25
25
  private shouldRefreshDecay;
@@ -159,9 +159,13 @@ export default class Island extends EventEmitter.Host<IIslandEvents> implements
159
159
  getDefaultTerrainType(tile: ITile): TerrainType;
160
160
  checkForHiddenMob(human: Human, x: number, y: number, z: number): void;
161
161
  isMapEdge(x: number, y: number): boolean;
162
+ /**
163
+ * Ensures a point is valid and is not the edge of the map
164
+ */
162
165
  ensureValidPoint<T extends IVector2>(point?: T): T | undefined;
163
166
  getTileFromPoint(point: IVector3): ITile;
164
167
  getTile(x: number, y: number, z: number): ITile;
168
+ getTileSafe(x: number, y: number, z: number): ITile | undefined;
165
169
  setTile(x: number, y: number, z: number, tile: ITile): ITile;
166
170
  setTiles(tiles: ITile[]): void;
167
171
  getOrCreateTile(index: number): ITile;
@@ -312,7 +316,7 @@ export default class Island extends EventEmitter.Host<IIslandEvents> implements
312
316
  /**
313
317
  * @returns a range value for the weapon being shot based on the weapon range and the players skill with that weapon type. This value then becomes the maximum potential range of the current shot.
314
318
  */
315
- rangeFinder(weaponRange: number, playerSkillLevel: number, useMaxRange?: boolean): number;
319
+ rangeFinder(weaponRange: number, playerSkillLevel: number, get?: "random" | "min" | "max"): number;
316
320
  getRandomQuality(bonusQuality?: number): Quality.None | Quality.Superior | Quality.Remarkable | Quality.Exceptional;
317
321
  getQualityDurabilityBonus(quality: Quality, itemDurability: number, getMax?: boolean): number;
318
322
  /**
@@ -249,6 +249,10 @@ export interface IItemDescription extends IObjectDescription, IModdable, ITemper
249
249
  */
250
250
  firedWith?: ItemTypeGroup;
251
251
  vehicle?: IItemVehicle;
252
+ /**
253
+ * If set to true, this item will not grant quality bonuses (durability/quality bonuses) when used in a craft. Aptitude and tiers will still apply.
254
+ */
255
+ noCraftingQualityBonus?: boolean;
252
256
  onEquip?(item: Item): void;
253
257
  onUnequip?(item: Item): void;
254
258
  }
@@ -174,10 +174,10 @@ export default class Item extends EventEmitter.Host<IItemEvents> implements IRef
174
174
  getVisualDecay(): number;
175
175
  private getVisualBarValue;
176
176
  /**
177
- * Returns the maximum decay of an item, or undefined if the item does not have the decayMax property.
177
+ * Returns the maximum decay of an item, or undefined if the item does not have the decayMax or storeDecay property.
178
178
  * @returns A number or undefined.
179
179
  */
180
- canDecay(): number | undefined;
180
+ canDecay(): 1 | undefined;
181
181
  getDecayRate(isClientSide: boolean): number;
182
182
  getPreservationDecayMultiplier(): number;
183
183
  getTemperatureDecayMultiplier(isClientSide: boolean): number;