@wayward/types 2.14.4-beta.dev.20241228.1 → 2.14.4-beta.dev.20241230.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.
- package/definitions/game/game/Game.d.ts +5 -5
- package/definitions/game/game/IGame.d.ts +15 -0
- package/definitions/game/game/entity/player/Player.d.ts +9 -0
- package/definitions/game/game/island/Island.d.ts +1 -1
- package/definitions/game/game/magic/MagicalPropertyType.d.ts +20 -2
- package/definitions/game/game/options/GameOptions.d.ts +1 -1
- package/definitions/game/multiplayer/IMultiplayer.d.ts +78 -76
- package/definitions/game/multiplayer/SyncRegion.d.ts +22 -0
- package/definitions/game/multiplayer/packets/IPacket.d.ts +3 -1
- package/definitions/game/save/upgrade/UpgradePlayer.d.ts +1 -1
- package/definitions/game/utilities/Version.d.ts +0 -1
- package/definitions/game/utilities/object/PrettyJsonStringify.d.ts +23 -0
- package/definitions/utilities/Errors.d.ts +4 -0
- package/definitions/utilities/random/IRandom.d.ts +1 -1
- package/definitions/utilities/random/Random.d.ts +1 -1
- package/definitions/utilities/random/RandomUtilities.d.ts +2 -2
- package/package.json +1 -1
@@ -10,7 +10,7 @@
|
|
10
10
|
*/
|
11
11
|
import { Uninit } from "@wayward/game/Uninit";
|
12
12
|
import CommandManager from "@wayward/game/command/CommandManager";
|
13
|
-
import type { IGameEvents, IMovementTime, IPlayOptions, ISynchronizeState } from "@wayward/game/game/IGame";
|
13
|
+
import type { IGameEvents, IGameUpgradeState, IMovementTime, IPlayOptions, ISynchronizeState } from "@wayward/game/game/IGame";
|
14
14
|
import { PauseSource, SaveType, TurnMode } from "@wayward/game/game/IGame";
|
15
15
|
import { TickHelper } from "@wayward/game/game/TickHelper";
|
16
16
|
import type { BiomeTypes } from "@wayward/game/game/biome/IBiome";
|
@@ -51,7 +51,6 @@ import type { IVector2 } from "@wayward/game/utilities/math/IVector";
|
|
51
51
|
import { WebWorkerManager } from "@wayward/game/webWorker/WebWorkerManager";
|
52
52
|
import EventEmitter from "@wayward/utilities/event/EventEmitter";
|
53
53
|
import type { Random } from "@wayward/utilities/random/Random";
|
54
|
-
import type { IBuildId } from "@wayward/hosts/shared/globalTypes";
|
55
54
|
export declare class Game extends EventEmitter.Host<IGameEvents> {
|
56
55
|
get isChallenge(): boolean;
|
57
56
|
private difficultyOptions;
|
@@ -71,9 +70,10 @@ export declare class Game extends EventEmitter.Host<IGameEvents> {
|
|
71
70
|
* The version the save was originally created on
|
72
71
|
*/
|
73
72
|
version: Version.String;
|
74
|
-
|
75
|
-
|
76
|
-
|
73
|
+
/**
|
74
|
+
* Set when a game save upgrade is running
|
75
|
+
*/
|
76
|
+
upgradeState?: IGameUpgradeState;
|
77
77
|
readonly interval = 16.6666;
|
78
78
|
readonly autoSave: AutoSave;
|
79
79
|
readonly commandManager: CommandManager;
|
@@ -31,6 +31,7 @@ import type { IReplayLogEntry } from "@wayward/game/replay/IReplayLogEntry";
|
|
31
31
|
import type { IHighscoreOld, IOptions } from "@wayward/game/save/data/ISaveDataGlobal";
|
32
32
|
import type Version from "@wayward/game/utilities/Version";
|
33
33
|
import type { IVector2, IVector3 } from "@wayward/game/utilities/math/IVector";
|
34
|
+
import type { IBuildId } from "@wayward/hosts/shared/globalTypes";
|
34
35
|
import type { IRange } from "@wayward/utilities/math/Range";
|
35
36
|
export interface IGameEvents {
|
36
37
|
/**
|
@@ -303,6 +304,20 @@ export interface IMovementTime {
|
|
303
304
|
start: number;
|
304
305
|
end: number;
|
305
306
|
}
|
307
|
+
export interface IGameUpgradeState {
|
308
|
+
/**
|
309
|
+
* Current state of the upgrade. Set based on what is upgrading at the time.
|
310
|
+
*/
|
311
|
+
state: GameUpgradeState;
|
312
|
+
readonly lastSaveVersion: Version.String;
|
313
|
+
readonly lastSaveBuildTime: number;
|
314
|
+
readonly lastSaveBuildId: IBuildId | undefined;
|
315
|
+
}
|
316
|
+
export declare enum GameUpgradeState {
|
317
|
+
None = 0,
|
318
|
+
Game = 1,
|
319
|
+
Island = 2
|
320
|
+
}
|
306
321
|
export declare const LINE_OF_SIGHT_RADIUS = 15;
|
307
322
|
export declare const LINE_OF_SIGHT_RADIUS_MAX = 20;
|
308
323
|
export declare const LINE_OF_SIGHT_DETAIL = 4;
|
@@ -92,6 +92,15 @@ export default class Player extends Human<undefined, number, ReferenceType.Playe
|
|
92
92
|
*/
|
93
93
|
private onLoadOrUnload;
|
94
94
|
setup(spawnTile: Tile, respawn: boolean): void;
|
95
|
+
private setupEquipment;
|
96
|
+
private setupStats;
|
97
|
+
private setupSkills;
|
98
|
+
private setupRandomInventory;
|
99
|
+
private setupStatuses;
|
100
|
+
private setupItemsFromGroups;
|
101
|
+
private setupAdditionalItemsFromOptions;
|
102
|
+
private setupEquipmentFromOptions;
|
103
|
+
private setupSkillsFromOptions;
|
95
104
|
protected onNoInput(): void;
|
96
105
|
updateTables(source: string, options?: Partial<{
|
97
106
|
allowCaching: boolean;
|
@@ -137,7 +137,7 @@ export default class Island extends EventEmitter.Host<IIslandEvents> implements
|
|
137
137
|
get isFastForwarding(): boolean;
|
138
138
|
constructor(game?: Game, position?: IVector2, seed?: number, mapSize?: number);
|
139
139
|
toString(): string;
|
140
|
-
createStaticRandom(seed?: number): Random<PCGSeededGenerator>;
|
140
|
+
createStaticRandom(seed?: number, advance?: number): Random<PCGSeededGenerator>;
|
141
141
|
private registerMemoryLeakDetector;
|
142
142
|
preSerializeObject(serializer: ISerializer): void;
|
143
143
|
postSerializeObject(serializer: ISerializer): void;
|
@@ -12,7 +12,7 @@ import Deity from "@wayward/game/game/deity/Deity";
|
|
12
12
|
import { DamageType } from "@wayward/game/game/entity/IEntity";
|
13
13
|
import { SkillType } from "@wayward/game/game/entity/IHuman";
|
14
14
|
import { Stat } from "@wayward/game/game/entity/IStats";
|
15
|
-
import type { IItemDescription, IMagicalPropertyInfo } from "@wayward/game/game/item/IItem";
|
15
|
+
import type { IItemDescription, IMagicalPropertyInfo, ItemType } from "@wayward/game/game/item/IItem";
|
16
16
|
import type Item from "@wayward/game/game/item/Item";
|
17
17
|
import type { MagicalPropertyIdentity } from "@wayward/game/game/magic/MagicalPropertyManager";
|
18
18
|
import type { TranslationArg } from "@wayward/game/language/ITranslation";
|
@@ -94,7 +94,7 @@ export interface IMagicalPropertyDescription {
|
|
94
94
|
/**
|
95
95
|
* Generates the magical property value when added.
|
96
96
|
*/
|
97
|
-
getInfo(item: Item, description: IItemDescription): IMagicalPropertyInfo | undefined;
|
97
|
+
getInfo(item: Item | ItemType, description: IItemDescription): IMagicalPropertyInfo | undefined;
|
98
98
|
/**
|
99
99
|
* By default, all magical property types can be inscribed. This allows disabling that feature for this magical property type.
|
100
100
|
*/
|
@@ -111,4 +111,22 @@ export interface MagicalPropertyTypeSubTypeMap {
|
|
111
111
|
[MagicalPropertyType.ElementalDamage]: DamageType;
|
112
112
|
[MagicalPropertyType.StatPotency_EquipmentImproveConsumableStats]: Stat;
|
113
113
|
}
|
114
|
+
export declare namespace MagicalPropertyInfoHelper {
|
115
|
+
/**
|
116
|
+
* Creates a partial `IMagicalPropertyDescription` that generates an integer value from min (inclusive) to max (exclusive),
|
117
|
+
* with an *actual* max for the magical property using `max`. (1 higher)
|
118
|
+
*/
|
119
|
+
function intRange(item: Item | ItemType, min: number, max: number, generatedMax?: number): {
|
120
|
+
min: number;
|
121
|
+
max: number;
|
122
|
+
value: () => number;
|
123
|
+
};
|
124
|
+
function randomInt(item: Item | ItemType, maxExclusive: number): number;
|
125
|
+
function randomInt(item: Item | ItemType, min: number, maxExclusive: number): number;
|
126
|
+
function randomIntInRange(item: Item | ItemType, max: number): number;
|
127
|
+
function randomIntInRange(item: Item | ItemType, min: number, maxInclusive: number): number;
|
128
|
+
function randomFloat(item: Item | ItemType, maxExclusive: number): number;
|
129
|
+
function randomFloat(item: Item | ItemType, min: number, maxExclusive: number): number;
|
130
|
+
function functionRequiringItem<T>(item: Item | ItemType, fn: (item: Item) => T): () => T;
|
131
|
+
}
|
114
132
|
export declare const magicalPropertyDescriptions: PartialRecord<MagicalPropertyType, IMagicalPropertyDescription>;
|
@@ -12,7 +12,7 @@ import type { SkillType } from "@wayward/game/game/entity/IHuman";
|
|
12
12
|
import type { ItemType } from "@wayward/game/game/item/IItem";
|
13
13
|
import type { IGameOptions, IGameOptionsSkill } from "@wayward/game/game/options/IGameOptions";
|
14
14
|
import { GameMode } from "@wayward/game/game/options/IGameOptions";
|
15
|
-
import Version from "@wayward/game/utilities/Version";
|
15
|
+
import type Version from "@wayward/game/utilities/Version";
|
16
16
|
export declare const CREATURE_SPAWN_LIMIT = 15;
|
17
17
|
declare namespace GameOptions {
|
18
18
|
export function getDefault(difficulty?: GameMode, seed?: number): IGameOptions;
|
@@ -37,82 +37,84 @@ export declare enum MultiplayerSyncCheckLevel {
|
|
37
37
|
All = "all"
|
38
38
|
}
|
39
39
|
export declare enum MultiplayerSyncCheck {
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
40
|
+
"END REGION" = 0,
|
41
|
+
"START REGION" = 1,
|
42
|
+
Action = 2,
|
43
|
+
ActionAttack = 3,
|
44
|
+
ActionMove = 4,
|
45
|
+
Alignment = 5,
|
46
|
+
BaseEntityManager = 6,
|
47
|
+
CanASeeB = 7,
|
48
|
+
Container = 8,
|
49
|
+
Creature = 9,
|
50
|
+
CreatureAi = 10,
|
51
|
+
CreatureAiAdd = 11,
|
52
|
+
CreatureAiEmit = 12,
|
53
|
+
CreatureAiMaskAdd = 13,
|
54
|
+
CreatureAiMaskRemove = 14,
|
55
|
+
CreatureAiRemove = 15,
|
56
|
+
CreatureAiSet = 16,
|
57
|
+
CreatureCheckMove = 17,
|
58
|
+
CreatureMovement = 18,
|
59
|
+
CreatureNearestPlayer = 19,
|
60
|
+
CreatureOffer = 20,
|
61
|
+
CreatureStatChange = 21,
|
62
|
+
Damage = 22,
|
63
|
+
Dismantle = 23,
|
64
|
+
Doodad = 24,
|
65
|
+
DoodadManager = 25,
|
66
|
+
EncumberedStatus = 26,
|
67
|
+
Entity = 27,
|
68
|
+
EntityPosition = 28,
|
69
|
+
ExhaustedPreMove = 29,
|
70
|
+
FlowFieldHashCode = 30,
|
71
|
+
FlowFieldPenalty = 31,
|
72
|
+
FlowFieldUpdate = 32,
|
73
|
+
FlowFieldUpdateTile = 33,
|
74
|
+
FlowFieldValue = 34,
|
75
|
+
HandToUse = 35,
|
76
|
+
HealthChange = 36,
|
77
|
+
History = 37,
|
78
|
+
InventoryCount = 38,
|
79
|
+
Island = 39,
|
80
|
+
IslandCivilizationScore = 40,
|
81
|
+
Islands = 41,
|
82
|
+
IsTileEmpty = 42,
|
83
|
+
Item = 43,
|
84
|
+
ItemCraft = 44,
|
85
|
+
ItemDamage = 45,
|
86
|
+
ItemOrder = 46,
|
87
|
+
LastCreationIds = 47,
|
88
|
+
Merchant = 48,
|
89
|
+
MilestoneSeed = 49,
|
90
|
+
Modifier = 50,
|
91
|
+
MoveToTile = 51,
|
92
|
+
NPC = 52,
|
93
|
+
Option = 53,
|
94
|
+
PenaltyFieldHashCode = 54,
|
95
|
+
PlaceOnTile = 55,
|
96
|
+
PlayerManager = 56,
|
97
|
+
Players = 57,
|
98
|
+
PlayerSetup = 58,
|
99
|
+
Random = 59,
|
100
|
+
Seed = 60,
|
101
|
+
SeededGenerator = 61,
|
102
|
+
SetPosition = 62,
|
103
|
+
SetZ = 63,
|
104
|
+
SkillGain = 64,
|
105
|
+
StaminaChanges = 65,
|
106
|
+
StatChange = 66,
|
107
|
+
Stats = 67,
|
108
|
+
Status = 68,
|
109
|
+
StatusChange = 69,
|
110
|
+
TemperatureManager = 70,
|
111
|
+
Temporary = 71,
|
112
|
+
Tick = 72,
|
113
|
+
TileEvent = 73,
|
114
|
+
Time = 74,
|
115
|
+
UpdateDirection = 75,
|
116
|
+
Weight = 76,
|
117
|
+
WorldUpdateTile = 77
|
116
118
|
}
|
117
119
|
export declare const maxPlayers = 32;
|
118
120
|
export declare const packetTickRate = 16.6666;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
/*!
|
2
|
+
* Copyright 2011-2024 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
|
+
type Decorator = (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
12
|
+
/**
|
13
|
+
* **Note:** Do not intentionally throw errors through this decorated function. It does not close the region if an error is thrown.
|
14
|
+
*/
|
15
|
+
export default function SyncRegion(target: any, propertyKey: string, descriptor: PropertyDescriptor): PropertyDescriptor;
|
16
|
+
/**
|
17
|
+
* **Note:** Do not intentionally throw errors through this decorated function. It does not close the region if an error is thrown.
|
18
|
+
*
|
19
|
+
* **Warning:** Do not combine this with other decorators.
|
20
|
+
*/
|
21
|
+
export default function SyncRegion<T>(detailProvider: (target: T) => string): Decorator;
|
22
|
+
export {};
|
@@ -29,8 +29,10 @@ export interface ISyncCheck {
|
|
29
29
|
}
|
30
30
|
export type SyncChecks = ISyncCheck[];
|
31
31
|
export interface IHashedSyncCheck {
|
32
|
-
|
32
|
+
hashServer: number;
|
33
|
+
hashClient: number;
|
33
34
|
syncCheck: SyncChecks;
|
35
|
+
type: "enabled" | "universal";
|
34
36
|
}
|
35
37
|
export interface IPacket<T = any> {
|
36
38
|
getAllowedStates(): ConnectionState;
|
@@ -11,7 +11,7 @@
|
|
11
11
|
import type { Game } from "@wayward/game/game/Game";
|
12
12
|
import type Player from "@wayward/game/game/entity/player/Player";
|
13
13
|
import UpgradesArray from "@wayward/game/save/upgrade/UpgradesArray";
|
14
|
-
import Version from "@wayward/game/utilities/Version";
|
14
|
+
import type Version from "@wayward/game/utilities/Version";
|
15
15
|
export default function upgradePlayer(game: Game, player: Player, saveVersion: Version.Info, isLocalPlayer: boolean): UpgradesArray;
|
16
16
|
/**
|
17
17
|
* Called after loading item & tile references
|
@@ -8,4 +8,27 @@
|
|
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
|
+
/**
|
12
|
+
* Formats a JSON string with custom pretty-printing rules.
|
13
|
+
* This function first stringifies the data with tabs as indentation, then applies several formatting improvements:
|
14
|
+
*
|
15
|
+
* 1. Removes unnecessary tabbing before values in arrays
|
16
|
+
* 2. Reduces multiple spaces between comma-separated values to a single space
|
17
|
+
* 3. Removes unnecessary whitespace after opening brackets
|
18
|
+
* 4. Ensures consistent spacing after commas in arrays and objects
|
19
|
+
*
|
20
|
+
* @param data - The data to be stringified. Can be any JSON-serializable value
|
21
|
+
* @returns A formatted JSON string with customized pretty-printing
|
22
|
+
*
|
23
|
+
* @example
|
24
|
+
* const data = { arr: [1, 2, 3], obj: { a: 1 } };
|
25
|
+
* console.log(prettyJsonStringify(data));
|
26
|
+
* // Output:
|
27
|
+
* // {
|
28
|
+
* // "arr": [1, 2, 3],
|
29
|
+
* // "obj": {
|
30
|
+
* // "a": 1
|
31
|
+
* // }
|
32
|
+
* // }
|
33
|
+
*/
|
11
34
|
export default function prettyJsonStringify(data: any): string;
|
@@ -24,6 +24,10 @@ declare namespace Errors {
|
|
24
24
|
* Returns the Error callsite string for the caller of the current function.
|
25
25
|
*/
|
26
26
|
function caller(skip?: number): string;
|
27
|
+
/**
|
28
|
+
* Returns the filename of the caller of the current function.
|
29
|
+
*/
|
30
|
+
function callerFileBasename(skip?: number): string;
|
27
31
|
}
|
28
32
|
export default Errors;
|
29
33
|
export declare function ensureExhaustive(value: never): never;
|
@@ -97,5 +97,5 @@ export declare class Random<G extends IRandomGenerator = IRandomGenerator> {
|
|
97
97
|
* @returns number between provided min/max, rounded.
|
98
98
|
*/
|
99
99
|
intInRangeExponential(min: number, max: number, steepness?: number): number;
|
100
|
-
advance(): this;
|
100
|
+
advance(times?: number): this;
|
101
101
|
}
|
@@ -21,7 +21,7 @@ export declare function convertStringToSeed(seed: string | number): number;
|
|
21
21
|
/**
|
22
22
|
* Creates a seeded random generator with the latest one available
|
23
23
|
*/
|
24
|
-
export declare function createLatestSeededRandom(requiresSynchronization: RandomSychronizationCheck, seed?: Uint16Array | number): Random<PCGSeededGenerator> | Random<LegacySeededGenerator>;
|
24
|
+
export declare function createLatestSeededRandom(requiresSynchronization: RandomSychronizationCheck, seed?: Uint16Array | number, advance?: number): Random<PCGSeededGenerator> | Random<LegacySeededGenerator>;
|
25
25
|
interface SeededGeneratorMap {
|
26
26
|
[SeedType.PCG]: PCGSeededGenerator;
|
27
27
|
[SeedType.Legacy]: LegacySeededGenerator;
|
@@ -29,7 +29,7 @@ interface SeededGeneratorMap {
|
|
29
29
|
/**
|
30
30
|
* Creates seeded random generator for the given type
|
31
31
|
*/
|
32
|
-
export declare function createSeededRandom<TYPE extends SeedType = SeedType>(seedType: TYPE, requiresSynchronization: RandomSychronizationCheck, seed?: Uint16Array | number): Random<SeededGeneratorMap[TYPE]>;
|
32
|
+
export declare function createSeededRandom<TYPE extends SeedType = SeedType>(seedType: TYPE, requiresSynchronization: RandomSychronizationCheck, seed?: Uint16Array | number, advance?: number): Random<SeededGeneratorMap[TYPE]>;
|
33
33
|
/**
|
34
34
|
* Random without seeds
|
35
35
|
*/
|
package/package.json
CHANGED