@wayward/types 2.12.0-beta.dev.20220922.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.
@@ -17,7 +17,7 @@ export interface ICastCanUse extends IActionUsable {
17
17
  ranged: IRanged;
18
18
  itemRange: number;
19
19
  maxFishingRange: number;
20
- gatherableTreasures?: TreasureGathering.IGatherable[];
20
+ canGatherTreasure?: TreasureGathering.ICanGather;
21
21
  }
22
22
  declare const _default: Action<[ActionArgument.ItemInventory], import("../../Human").default, void, ICastCanUse, [import("../../../item/Item").default]>;
23
23
  export default _default;
@@ -28,16 +28,21 @@ declare namespace TreasureGathering {
28
28
  NoTreasure = 1,
29
29
  NoMapsForTreasure = 2
30
30
  }
31
- interface IGatherablesResult {
31
+ interface ICanGather {
32
32
  gatherables?: IGatherable[];
33
33
  result?: GatherablesResult;
34
34
  }
35
- function getGatherable(executor: Human, itemRange: number, requireMap: boolean, maxRange?: number): IGatherablesResult;
35
+ function canGather(executor: Human, itemRange: number, requireMap: boolean, maxRange?: number): ICanGather;
36
36
  enum Result {
37
37
  NoTreasure = 0,
38
38
  NotYet = 1,
39
39
  Gathered = 2
40
40
  }
41
- function gather({ map, mapItem, treasure, position: { x, y, z }, maxRange, toolRange }: IGatherable, action: IActionHandlerApi<Human>, tool?: Item): Result;
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;
42
47
  }
43
48
  export default TreasureGathering;
@@ -276,17 +276,22 @@ declare class UsableAction<REQUIREMENTS extends IUsableActionRequirements = IUsa
276
276
  getIcon(provided: IUsableActionPossibleUsing): IIcon | undefined;
277
277
  getHighlightSelectors(using?: IUsableActionPossibleUsing): HighlightSelector[];
278
278
  private translator?;
279
- getTranslation(using?: IUsableActionUsing<REQUIREMENTS>, which?: ActionTranslation): Translation | undefined;
279
+ getTranslation(using?: IUsableActionPossibleUsing, which?: ActionTranslation, context?: UsableActionTranslationContext): Translation | undefined;
280
280
  getOrder(using?: IUsableActionPossibleUsing): number;
281
281
  }
282
+ export declare enum UsableActionTranslationContext {
283
+ None = 0,
284
+ Use = 1
285
+ }
286
+ export declare type UsableActionTranslationArguments = [using: IUsableActionPossibleUsing, action: UsableAction, context: UsableActionTranslationContext];
282
287
  export declare class UsableActionTranslator {
283
288
  readonly id: ActionId;
284
289
  private nameSupplier?;
285
290
  private descriptionSupplier?;
286
291
  constructor(id: ActionId);
287
- name(supplier: SupplierOr<Translation, [using: IUsableActionPossibleUsing, action: UsableAction]>): this;
288
- description(supplier: SupplierOr<Translation, [using: IUsableActionPossibleUsing, action: UsableAction]>): this;
289
- 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;
290
295
  }
291
296
  export interface IUsableActionFactory<REQUIREMENTS extends IUsableActionRequirements> {
292
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;
@@ -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
  }
@@ -46,7 +46,7 @@ export default class Button extends Component implements IDisableable {
46
46
  constructor(elementType?: string, listenForEvents?: boolean);
47
47
  setDisplayMode(mode: ButtonClasses.DisplayModeButtonList, zoomClass: ButtonClasses.ListIconsZoom2To3): this;
48
48
  setDisplayMode(mode: ButtonClasses.DisplayModeBlock | ButtonClasses.DisplayModeIcon | ButtonClasses.DisplayModeButtonList | false): this;
49
- setActionless(isActionless?: boolean): this;
49
+ setActionless(isActionless?: boolean, setDisabled?: boolean): this;
50
50
  isButtonList(): boolean;
51
51
  setDisabled(val?: boolean, reason?: string): this;
52
52
  setActive(val?: boolean, reason?: string): this;
@@ -30,6 +30,7 @@ export default abstract class InspectionsTooltipHandler<INSPECTIONS_LIST extends
30
30
  private lastMousePosition?;
31
31
  initializeTooltip(tooltip: Tooltip, ...args: TOOLTIP_ARGS): Promise<void>;
32
32
  remove(tooltip?: IInspectionsTooltipHandlerCurrent<INSPECTIONS_LIST, TOOLTIP_ARGS> | undefined): Promise<void>;
33
+ onInitInspections(handler: (inspections: INSPECTIONS_LIST) => any): void;
33
34
  protected abstract initializeInspections(...args: TOOLTIP_ARGS): INSPECTIONS_LIST | undefined;
34
35
  protected onUpdateTooltipPosition(position: Vector2): void;
35
36
  protected getTooltipClass(): string[];
@@ -140,7 +140,7 @@ export default abstract class Dialog extends Component implements IDialog {
140
140
  */
141
141
  private description;
142
142
  constructor(id: number, subId?: string);
143
- addScrollableWrapper(initializer?: (wrapper: Component) => any): Component<HTMLElement>;
143
+ addScrollableWrapper(type?: "scroll" | "auto", initializer?: (wrapper: Component) => any): Component<HTMLElement>;
144
144
  addSettingsPanel(): Component<HTMLElement>;
145
145
  showSettingsPanel(): this;
146
146
  resetSizeAndPosition(): void;
@@ -14,6 +14,7 @@ import type { InspectType } from "game/inspection/IInspection";
14
14
  import type { InfoProviderContext } from "game/inspection/InfoProviderContext";
15
15
  import type Inspection from "game/inspection/Inspection";
16
16
  import type InspectionsHandler from "game/inspection/InspectionsHandler";
17
+ import type { ResolvedInspection } from "game/inspection/InspectionTypeMap";
17
18
  import Component from "ui/component/Component";
18
19
  import type { TranslationGenerator } from "ui/component/IComponent";
19
20
  import type HashSet from "utilities/collection/set/HashSet";
@@ -22,6 +23,7 @@ export interface ITileInspectionsEvents extends Events<Component> {
22
23
  updateInspectTypeFilter(): any;
23
24
  updateDisplayLevel(): any;
24
25
  }
26
+ export declare type InspectionsHandlerOf<INSPECTIONS_LIST extends InspectionsList> = INSPECTIONS_LIST extends InspectionsList<infer INSPECTIONS_HANDLER> ? INSPECTIONS_HANDLER : never;
25
27
  export default abstract class InspectionsList<INSPECTIONS_HANDLER extends InspectionsHandler = InspectionsHandler> extends Component {
26
28
  protected readonly context: InfoProviderContext;
27
29
  readonly event: IEventEmitter<this, ITileInspectionsEvents>;
@@ -34,6 +36,7 @@ export default abstract class InspectionsList<INSPECTIONS_HANDLER extends Inspec
34
36
  private readonly inspectTypeWrappers;
35
37
  private readonly previouslyRefreshed;
36
38
  constructor(context: InfoProviderContext);
39
+ get<TYPE extends InspectType>(type: TYPE): HashSet<ResolvedInspection<TYPE>> | undefined;
37
40
  setInspectTypeFilter(filter?: (inspectType: InspectType) => boolean): this;
38
41
  refreshInspectTypeFilter(): this;
39
42
  deregister(): void;
@@ -53,6 +53,7 @@ export default class Tooltip extends Component {
53
53
  */
54
54
  setMaxWidth(maxWidth?: number | `${number}vw`): this;
55
55
  setText(translation: GetterOfOr<Translation | UiTranslation>, ...args: any[]): this;
56
+ private delay;
56
57
  setDelay(delay: number): this;
57
58
  getLastBlock(): TooltipBlock;
58
59
  getBlocks(): import("@wayward/goodstream").default<TooltipBlock>;
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.12.0-beta.dev.20220922.1",
4
+ "version": "2.12.0-beta.dev.20220923.1",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",