@kingdomsconnected/types 1.5.4 → 1.5.6
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/generated/client-api.d.ts +240 -2
- package/generated/server-api.d.ts +287 -55
- package/package.json +1 -1
|
@@ -84,6 +84,16 @@ declare global {
|
|
|
84
84
|
*/
|
|
85
85
|
noclipChanged: [active: boolean, reason: "script" | "mapEditor" | "viewLost" | "sessionOver"];
|
|
86
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Dispatched when a book `Book.open` asked for is in the player's hands and showing its first page, on this machine only.
|
|
89
|
+
*/
|
|
90
|
+
bookOpened: [bookId: number];
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Dispatched when a book leaves the player's hands, on this machine only. `reason` is `player` for the player's own exit (or the game ending the reading itself), `script` for `Book.close`, `failed` for a book that never reached the hands, and `sessionOver` for the session ending. Handler promises are not awaited, and a handler may open the next book straight away.
|
|
94
|
+
*/
|
|
95
|
+
bookClosed: [bookId: number, reason: "player" | "script" | "failed" | "sessionOver"];
|
|
96
|
+
|
|
87
97
|
/**
|
|
88
98
|
* Dispatched after a resource entry point has run and immediately before the resource becomes running.
|
|
89
99
|
*/
|
|
@@ -898,7 +908,9 @@ declare global {
|
|
|
898
908
|
};
|
|
899
909
|
|
|
900
910
|
/**
|
|
901
|
-
* The game's own HUD messages, shown to the player at this machine. Nothing here is replicated: a message everyone should see is sent to everyone, and each client shows it. Every call returns false while there is no HUD, which is the case in the main menu and across a level load.
|
|
911
|
+
* The game's own HUD messages, shown to the player at this machine. Nothing here is replicated: a message everyone should see is sent to everyone, and each client shows it. Every message call returns false while there is no HUD, which is the case in the main menu and across a level load.
|
|
912
|
+
*
|
|
913
|
+
* The screen-effect verbs -- `addScreenEffect` and its siblings -- put full-screen post effects on this player's own picture. They are drawn by the game's renderer rather than the HUD, so they need no HUD and hiding HUD elements leaves them alone.
|
|
902
914
|
*/
|
|
903
915
|
const Hud: {
|
|
904
916
|
/**
|
|
@@ -1010,8 +1022,129 @@ declare global {
|
|
|
1010
1022
|
* @returns True when the HUD took it.
|
|
1011
1023
|
*/
|
|
1012
1024
|
clearNotifications(): boolean;
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* Retains a visibility request for one HUD element, including before the HUD is ready. Hidden clips are suppressed before each HUD render, across movie and level reloads. Turning an element on releases multiplayer suppression; the current native HUD rules still apply. Suppression is released when its owning resource stops or the session ends. No console variables are changed.
|
|
1028
|
+
* @param element The element, by the game's own name for it: `Stats` is the health, stamina and nourishment bars along the bottom. One of `Compass`, `Stats`, `QAMWeapon`, `QAMFood`, `Subtitles`, `InfoText`, `GameLog`, `Hints`, `DialogLeft`, `DialogRight`, `Cursor`, `Crime`, `Wanted`, `PopUpBackground`, `TutorialMessage`, `FancyEvent`, `SkillCheck`, `ItemTransfer`, `Buffs`, `CommonEvent`, `DiceCursor`, `Trespassing`, `RatioStrips`, `ShootingContest`, `Bubbles`, `TutorialInDialog`, `DiceContainer`, `Vignette`, compared exactly.
|
|
1029
|
+
* @param visible False hides the element, true lets the game show it again.
|
|
1030
|
+
* @returns True when the request is retained; application waits for the native HUD when it is not ready yet.
|
|
1031
|
+
*/
|
|
1032
|
+
setElementVisible(element: string, visible: boolean): boolean;
|
|
1033
|
+
|
|
1034
|
+
/**
|
|
1035
|
+
* Whether multiplayer permits the element to show. True when no resource suppresses it; native gameplay rules can still hide it. This is not a pixel-visibility query.
|
|
1036
|
+
* @param element The element, by the game's own name for it, as `setElementVisible` takes it.
|
|
1037
|
+
* @returns True while multiplayer allows the element to show.
|
|
1038
|
+
*/
|
|
1039
|
+
isElementVisible(element: string): boolean;
|
|
1040
|
+
|
|
1041
|
+
/**
|
|
1042
|
+
* Every effect `addScreenEffect` accepts, with each parameter's range, default and neutral value.
|
|
1043
|
+
* @returns The effects, in a fixed order.
|
|
1044
|
+
*/
|
|
1045
|
+
screenEffects(): ScreenEffect[];
|
|
1046
|
+
|
|
1047
|
+
/**
|
|
1048
|
+
* Puts a full-screen effect on this player's own picture -- a colour grade, a blur, ghosting or the game's blood overlay, for intoxication, injury, poison, dreams or a place that should feel wrong -- owned by the calling resource. These are the game's own post-processing passes, driven with the parameters this build actually reads; they are not part of the HUD and showing or hiding HUD elements does not touch them.
|
|
1049
|
+
*
|
|
1050
|
+
* This is presentation, not state. Nothing is replicated, nobody else sees it, and none of it makes a player drunk or hurt: whatever decides that -- usually the server -- keeps it, and a client script asks for the picture to match. Weather and time of day are shared world state and are not touched.
|
|
1051
|
+
*
|
|
1052
|
+
* Effects from every resource combine rather than overwrite each other, on top of the game's own grade -- which already desaturates the screen as health runs low -- rather than in its place: brightness, contrast and saturation multiply, the colour cast and the hue shift add, and blur, ghosting and blood each draw the strongest one asked for. The result does not depend on which resource asked first, and removing one effect leaves the game's grade and every other effect as they were.
|
|
1053
|
+
*
|
|
1054
|
+
* An effect belongs to the resource that created it: only that resource can change or remove it, and it goes when the resource stops, when the session ends or when the level changes. A cinematic that resets the game's post-processing clears the screen until the effect next changes. Up to 64 effects are kept across every resource.
|
|
1055
|
+
* @param effect Which effect, as `screenEffects` names it.
|
|
1056
|
+
* @param params Values for the effect's own parameters, each clamped into its range. A parameter left out takes its default; one the effect does not take is an error.
|
|
1057
|
+
* @param options `fadeInMs` brings it up from nothing; `fadeOutMs` is how long it takes to go, when its duration runs out or when `removeScreenEffect` is called without a fade of its own; `durationMs` ends it on its own after that long, before its fade-out -- 0, the default, keeps it until it is removed. Fades are up to a minute.
|
|
1058
|
+
* @returns A handle for `updateScreenEffect`, `removeScreenEffect` and `isScreenEffectActive`, or 0 when 64 effects are already on screen.
|
|
1059
|
+
*/
|
|
1060
|
+
addScreenEffect(effect: "colorGrade" | "blur" | "ghosting" | "screenBlood", params?: { saturation?: number; brightness?: number; contrast?: number; cyan?: number; magenta?: number; yellow?: number; darkness?: number; hue?: number; amount?: number }, options?: { fadeInMs?: number; fadeOutMs?: number; durationMs?: number }): number;
|
|
1061
|
+
|
|
1062
|
+
/**
|
|
1063
|
+
* Changes an effect while it is on screen -- a drunkenness that deepens with every drink, a wound that worsens.
|
|
1064
|
+
* @param handle What `addScreenEffect` returned.
|
|
1065
|
+
* @param params New values for some of the effect's parameters. The others keep theirs.
|
|
1066
|
+
* @param options `fadeMs` moves the parameters to their new values over that long, from wherever they are now; 0, the default, moves them at once.
|
|
1067
|
+
* @returns False when the handle is gone or belongs to another resource.
|
|
1068
|
+
*/
|
|
1069
|
+
updateScreenEffect(handle: number, params: { saturation?: number; brightness?: number; contrast?: number; cyan?: number; magenta?: number; yellow?: number; darkness?: number; hue?: number; amount?: number }, options?: { fadeMs?: number }): boolean;
|
|
1070
|
+
|
|
1071
|
+
/**
|
|
1072
|
+
* Takes an effect off the screen. An effect already fading out carries on from where it is.
|
|
1073
|
+
* @param handle What `addScreenEffect` returned.
|
|
1074
|
+
* @param options How long it takes to fade out. Left out, it fades over the `fadeOutMs` it was created with; 0 takes it off at once.
|
|
1075
|
+
* @returns False when the handle is gone or belongs to another resource.
|
|
1076
|
+
*/
|
|
1077
|
+
removeScreenEffect(handle: number, options?: { fadeOutMs?: number }): boolean;
|
|
1078
|
+
|
|
1079
|
+
/**
|
|
1080
|
+
* Takes every effect the calling resource owns off the screen at once. Other resources' effects stay.
|
|
1081
|
+
* @returns How many were removed.
|
|
1082
|
+
*/
|
|
1083
|
+
removeAllScreenEffects(): number;
|
|
1084
|
+
|
|
1085
|
+
/**
|
|
1086
|
+
* Whether an effect is still on screen, fading out included.
|
|
1087
|
+
* @param handle What `addScreenEffect` returned.
|
|
1088
|
+
* @returns False once it has been removed and faded, has run its duration out, or was dropped by its resource stopping, the session ending or the level changing.
|
|
1089
|
+
*/
|
|
1090
|
+
isScreenEffectActive(handle: number): boolean;
|
|
1013
1091
|
};
|
|
1014
1092
|
|
|
1093
|
+
/**
|
|
1094
|
+
* One parameter a screen effect takes.
|
|
1095
|
+
*/
|
|
1096
|
+
interface ScreenEffectParam {
|
|
1097
|
+
/**
|
|
1098
|
+
* The key to pass it under in a params bag.
|
|
1099
|
+
*/
|
|
1100
|
+
name: string;
|
|
1101
|
+
|
|
1102
|
+
/**
|
|
1103
|
+
* What it does to the picture.
|
|
1104
|
+
*/
|
|
1105
|
+
description: string;
|
|
1106
|
+
|
|
1107
|
+
/**
|
|
1108
|
+
* The lowest value it takes. Anything lower is clamped.
|
|
1109
|
+
*/
|
|
1110
|
+
min: number;
|
|
1111
|
+
|
|
1112
|
+
/**
|
|
1113
|
+
* The highest value it takes. Anything higher is clamped.
|
|
1114
|
+
*/
|
|
1115
|
+
max: number;
|
|
1116
|
+
|
|
1117
|
+
/**
|
|
1118
|
+
* What `addScreenEffect` uses when the parameter is not given.
|
|
1119
|
+
*/
|
|
1120
|
+
default: number;
|
|
1121
|
+
|
|
1122
|
+
/**
|
|
1123
|
+
* The value at which it leaves the picture alone, which is also where a fade starts and ends.
|
|
1124
|
+
*/
|
|
1125
|
+
neutral: number;
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
/**
|
|
1129
|
+
* One screen effect `Hud.addScreenEffect` accepts.
|
|
1130
|
+
*/
|
|
1131
|
+
interface ScreenEffect {
|
|
1132
|
+
/**
|
|
1133
|
+
* What to pass to `addScreenEffect`.
|
|
1134
|
+
*/
|
|
1135
|
+
name: string;
|
|
1136
|
+
|
|
1137
|
+
/**
|
|
1138
|
+
* What it does, and how several of it combine.
|
|
1139
|
+
*/
|
|
1140
|
+
description: string;
|
|
1141
|
+
|
|
1142
|
+
/**
|
|
1143
|
+
* Every parameter it takes, with its range.
|
|
1144
|
+
*/
|
|
1145
|
+
params: ScreenEffectParam[];
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1015
1148
|
/**
|
|
1016
1149
|
* The game's own sound triggers, played at this machine. A trigger is a name the game's audio data declares -- `a_o_bell_kkut_kostelni`, `c_torch_whoosh1`, `f_ge_cough_woman` -- standing for an FMOD event. The full vocabulary is `Libs/GameAudio/*.xml` in `IPL_GameData.pak`, with the gameplay-facing subset listed in `Libs/Tables/GameAudio/SkaldAtlTrigger.xml`. Nothing here is replicated: a sound everyone should hear is one the server tells every client to play. Every call returns false while the audio system is not up, which is the case before a world is loaded, and for a trigger name the audio data does not declare.
|
|
1017
1150
|
*/
|
|
@@ -1815,7 +1948,7 @@ declare global {
|
|
|
1815
1948
|
*
|
|
1816
1949
|
* This is what a disguised player needs -- `player.setDisguise` hides the body the game's own camera sits in. It is this client's own view, so a gamemode turns it on from a client script, typically on an event the server sends the disguised player.
|
|
1817
1950
|
*
|
|
1818
|
-
* There is one view to draw through: `NoClip` cannot start while this holds it, and while `NoClip` flies this waits. It lasts until the session ends.
|
|
1951
|
+
* There is one view to draw through: `NoClip` cannot start while this holds it, and while `NoClip` flies this waits. The map, the inventory and the other pause-screen pages are filmed by the game's own camera, so this steps aside while one is open and comes back when it closes. It lasts until the session ends.
|
|
1819
1952
|
* @param options Where the camera sits, in metres: `distance` back from the body along where the player looks (3.5 by default, 0.3 to 20), `height` of the point it orbits above the body's feet (1.6, up to 5 either way), and `shoulder` to the right of it, negative for the left (0, up to 3 either way). Null hands the view back to the game's own camera. Called again while on, it only moves the camera.
|
|
1820
1953
|
*/
|
|
1821
1954
|
setThirdPerson(options?: { distance?: number; height?: number; shoulder?: number } | null): void;
|
|
@@ -2557,6 +2690,111 @@ declare global {
|
|
|
2557
2690
|
getCatalog(): EmoteCatalogEntry[];
|
|
2558
2691
|
};
|
|
2559
2692
|
|
|
2693
|
+
/**
|
|
2694
|
+
* A picture for the skill-book and map layouts, which place pictures by page rather than inline.
|
|
2695
|
+
*/
|
|
2696
|
+
interface BookPageImage {
|
|
2697
|
+
/**
|
|
2698
|
+
* Zero-based page the picture belongs to.
|
|
2699
|
+
*/
|
|
2700
|
+
page: number;
|
|
2701
|
+
|
|
2702
|
+
/**
|
|
2703
|
+
* Its name under the game's own `Libs/UI/Textures/Books/` Skills or Maps folder, without the `_ui.dds` suffix, e.g. `swords1`.
|
|
2704
|
+
*/
|
|
2705
|
+
image: string;
|
|
2706
|
+
}
|
|
2707
|
+
|
|
2708
|
+
/**
|
|
2709
|
+
* What `Book.open` shows and how it looks.
|
|
2710
|
+
*/
|
|
2711
|
+
interface BookOptions {
|
|
2712
|
+
/**
|
|
2713
|
+
* One string per page, written in the book movie's own markup: `<title>`, `<subtitle>`, `<heading>`, `<paragraph>`, `<br/>`, `<accent>`, `<inc>X</inc>` for a decorated initial, `<poem>`, `<lpoem>`, `<note>`, `<p align>`, `<font size>`, `<i>` and `<img src='...' width='W' height='H' align='center'/>`. A page break follows every page but the last; `<newpage/>` inside a page breaks it further. The player's own reading skill never scrambles it; `legibility` decides that.
|
|
2714
|
+
*/
|
|
2715
|
+
pages: string[];
|
|
2716
|
+
|
|
2717
|
+
/**
|
|
2718
|
+
* The object in the player's hands: a red-covered book (the default), a plain-covered one, or a folded letter.
|
|
2719
|
+
*/
|
|
2720
|
+
style: "book" | "plainBook" | "letter" | undefined;
|
|
2721
|
+
|
|
2722
|
+
/**
|
|
2723
|
+
* The layout the movie uses, by `document_class` id: 1 book (the default), 2 recipe, 3 skill book, 4 map, 5 letter (the default for `letter`), 6 plan.
|
|
2724
|
+
*/
|
|
2725
|
+
type: number | undefined;
|
|
2726
|
+
|
|
2727
|
+
/**
|
|
2728
|
+
* How ornate the pages are, 1 plain to 7 embellished. Defaults to 1.
|
|
2729
|
+
*/
|
|
2730
|
+
visual: number | undefined;
|
|
2731
|
+
|
|
2732
|
+
/**
|
|
2733
|
+
* How much of the text can be read, 0 to 1; values outside are clamped. Defaults to 1, fully legible. Below 1 the movie swaps letters for look-alike glyphs, the same effect a vanilla book shows a player with low reading skill. It works in tenths: each step brings roughly another tenth of the character classes back, so 0.31 and 0.39 look the same. The substitution is deterministic -- the same text at the same level always reads the same way -- and markup is never touched.
|
|
2734
|
+
*/
|
|
2735
|
+
legibility: number | undefined;
|
|
2736
|
+
|
|
2737
|
+
/**
|
|
2738
|
+
* A picture `Book.image` returned, replacing the carrier's own diffuse texture: the paper and the cover together, which the model maps from one atlas. Paint it over the vanilla atlas to keep the UV layout -- `Objects/manmade/task_specific_props/read_and_write/books/book_alchemy_diff.dds` for the two book styles, `.../scrolls/scroll_diff.dds` for `letter`. The material's diffuse colour multiplies it: `book` darkens it to about 78% and `letter` to about 72%, while `plainBook` shows it as painted. It applies to this book's own copy of the material only, and goes with the book.
|
|
2739
|
+
*/
|
|
2740
|
+
texture: string | undefined;
|
|
2741
|
+
|
|
2742
|
+
/**
|
|
2743
|
+
* Pictures for the skill-book and map layouts. Inline pictures go in the page text as `<img>` instead.
|
|
2744
|
+
*/
|
|
2745
|
+
images: BookPageImage[] | undefined;
|
|
2746
|
+
}
|
|
2747
|
+
|
|
2748
|
+
/**
|
|
2749
|
+
* Books a resource composes and opens in this player's hands.
|
|
2750
|
+
*
|
|
2751
|
+
* A book is shown through the game's own reading: the same book in hand, camera, page-turn animation, prompts and pagination as any book the player reads from their inventory. The player turns pages and leaves it with the game's own keys, and `bookClosed` says when they did.
|
|
2752
|
+
*
|
|
2753
|
+
* Client-only and local: the book exists on this machine alone, and reading it grants nothing -- no XP, no read marker, no quest progress. A server that wants a player to read something sends the pages in its own event.
|
|
2754
|
+
*
|
|
2755
|
+
* Pictures a resource ships go through `Book.image`, which returns what an `<img src>` and the `texture` option take.
|
|
2756
|
+
*/
|
|
2757
|
+
const Book: {
|
|
2758
|
+
/**
|
|
2759
|
+
* Opens a book in the player's hands.
|
|
2760
|
+
* @param options The pages and how they look.
|
|
2761
|
+
* @returns The book's id, which `bookOpened` and `bookClosed` carry; null when the game will not open one now -- no body yet, a book already open, or a place the player cannot read in (on horseback, in combat). `getLastError` says which. Malformed options throw.
|
|
2762
|
+
*/
|
|
2763
|
+
open(options: BookOptions): number | null;
|
|
2764
|
+
|
|
2765
|
+
/**
|
|
2766
|
+
* Closes the open book the way the player's own exit does.
|
|
2767
|
+
* @returns False when no book is open.
|
|
2768
|
+
*/
|
|
2769
|
+
close(): boolean;
|
|
2770
|
+
|
|
2771
|
+
/**
|
|
2772
|
+
* Changes how legible the open book is, while it is in the player's hands.
|
|
2773
|
+
* @param value 0 fully scrambled to 1 fully legible; clamped.
|
|
2774
|
+
* @returns False when no book is in the hands yet (wait for `bookOpened`). The movie applies legibility while laying the text out, so the book is laid out again, which can return it to its first page. Throws for a non-number.
|
|
2775
|
+
*/
|
|
2776
|
+
setLegibility(value: number): boolean;
|
|
2777
|
+
|
|
2778
|
+
/**
|
|
2779
|
+
* The id of the book in the player's hands.
|
|
2780
|
+
* @returns Null when there is none.
|
|
2781
|
+
*/
|
|
2782
|
+
getOpenBook(): number | null;
|
|
2783
|
+
|
|
2784
|
+
/**
|
|
2785
|
+
* Why the last `open` returned null.
|
|
2786
|
+
* @returns Empty after one that succeeded.
|
|
2787
|
+
*/
|
|
2788
|
+
getLastError(): string;
|
|
2789
|
+
|
|
2790
|
+
/**
|
|
2791
|
+
* Makes a picture the resource ships reachable from page text.
|
|
2792
|
+
* @param path A `.dds` file the calling resource ships, relative to the resource.
|
|
2793
|
+
* @returns The value for an `<img src='...'>` attribute. Give the tag a `width` and `height` too: the movie sizes the picture to them and has no size of its own for it. Throws when the file is missing, not a `.dds`, or larger than 16 MiB.
|
|
2794
|
+
*/
|
|
2795
|
+
image(path: string): string;
|
|
2796
|
+
};
|
|
2797
|
+
|
|
2560
2798
|
/**
|
|
2561
2799
|
* Mutable two-dimensional vector.
|
|
2562
2800
|
*/
|
|
@@ -195,27 +195,37 @@ declare global {
|
|
|
195
195
|
playerPickpocketCaught: [thief: Player, victim: Player];
|
|
196
196
|
|
|
197
197
|
/**
|
|
198
|
-
*
|
|
198
|
+
* Dispatched once a match has started and both players have been sent to the table. Which of them throws first is drawn at random.
|
|
199
|
+
*/
|
|
200
|
+
diceMatchStart: [match: number, first: Player, second: Player, targetScore: number];
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Dispatched once a match is over and both players have been told. `winner` is 0 when `first` won, 1 when `second` did, 255 when nobody did. `reason` is `won` (a player banked the target score), `gaveUp` (a player left the table), `left` (a player disconnected), `timedOut` (the player to throw did not move for three minutes), `failed` (a client could not play the table) or `stopped` (`Dice.stop`). A player who has gone since is null. Nothing changes hands on its own: what a match was played for is the gamemode's to settle here.
|
|
204
|
+
*/
|
|
205
|
+
diceMatchEnd: [match: number, first: Player | null, second: Player | null, winner: number, reason: string, firstScore: number, secondScore: number];
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* A player asks to open an alchemy table, or to begin a smithing recipe. Every handler runs; one returning literal `false` refuses it. An async handler cannot refuse.
|
|
199
209
|
*/
|
|
200
210
|
craftingStarting: [player: Player, proposal: CraftStartProposal];
|
|
201
211
|
|
|
202
212
|
/**
|
|
203
|
-
* A batch is brewing.
|
|
213
|
+
* A batch is brewing, or a workpiece took its materials.
|
|
204
214
|
*/
|
|
205
215
|
craftingStarted: [player: Player, event: CraftStartedEvent];
|
|
206
216
|
|
|
207
217
|
/**
|
|
208
|
-
* A batch finished and its result is computed. Every handler runs; one returning literal `false` refuses it: the batch
|
|
218
|
+
* A batch or workpiece finished and its result is computed. Every handler runs; one returning literal `false` refuses it: alchemy ends the batch as failed, what was spent stays spent, and nothing is granted; smithing fails the workpiece, spending its failure share.
|
|
209
219
|
*/
|
|
210
220
|
craftingCompleting: [player: Player, proposal: CraftCompletionProposal];
|
|
211
221
|
|
|
212
222
|
/**
|
|
213
|
-
* A
|
|
223
|
+
* A result was granted, followed by `craftingEnded`. Raised after the `playerInventoryChanged` it caused.
|
|
214
224
|
*/
|
|
215
225
|
craftingCompleted: [player: Player, event: CraftCompletedEvent];
|
|
216
226
|
|
|
217
227
|
/**
|
|
218
|
-
* A batch is over. Raised after the `playerInventoryChanged` of any refund.
|
|
228
|
+
* A batch or workpiece is over. Raised after the `playerInventoryChanged` of any refund.
|
|
219
229
|
*/
|
|
220
230
|
craftingEnded: [player: Player, event: CraftEndedEvent];
|
|
221
231
|
|
|
@@ -375,7 +385,7 @@ declare global {
|
|
|
375
385
|
gatheringHarvest: [player: Player, proposal: GatheringProposal];
|
|
376
386
|
|
|
377
387
|
/**
|
|
378
|
-
* A player was given a herb, after the `playerInventoryChanged` it caused. The plant and the same-kind plants harvested with it are picked for everyone in the virtual world until
|
|
388
|
+
* A player was given a herb, after the `playerInventoryChanged` it caused. The plant and the same-kind plants harvested with it are picked for everyone in the virtual world until timed or scripted regrowth; nothing about them survives a restart.
|
|
379
389
|
*/
|
|
380
390
|
gatheringHarvested: [player: Player, event: GatheringHarvestedEvent];
|
|
381
391
|
|
|
@@ -1613,7 +1623,7 @@ declare global {
|
|
|
1613
1623
|
ok: boolean;
|
|
1614
1624
|
|
|
1615
1625
|
/**
|
|
1616
|
-
* Empty on success, otherwise why not: `inventoryUnavailable`, `invalidRequest`, `staleRevision`, `invalidItem`, `invalidItems`, `invalidAmount`, `unknownItem`, `insufficientItems`, `inventoryCapacity`, `sameInventory`, or a property policy code (`invalidMetadata`, `unknownItemClass`, `invalidQuality`, `immutableItemHealth`, `invalidItemHealth`, `contradictoryItemHealth`, `invalidCreationSentinel`, `unsupportedPoisonProperties`, `unsupportedOnEquipBuffs`).
|
|
1626
|
+
* Empty on success, otherwise why not: `inventoryUnavailable`, `invalidRequest`, `staleRevision`, `invalidItem`, `invalidItems`, `invalidAmount`, `unknownItem`, `insufficientItems`, `inventoryCapacity`, `sameInventory`, or a property policy code (`invalidMetadata`, `unknownItemClass`, `questItem`, `invalidQuality`, `immutableItemHealth`, `invalidItemHealth`, `contradictoryItemHealth`, `invalidCreationSentinel`, `unsupportedPoisonProperties`, `unsupportedOnEquipBuffs`).
|
|
1617
1627
|
*/
|
|
1618
1628
|
code: string;
|
|
1619
1629
|
|
|
@@ -1639,7 +1649,7 @@ declare global {
|
|
|
1639
1649
|
get(player: Player): InventoryState | null;
|
|
1640
1650
|
|
|
1641
1651
|
/**
|
|
1642
|
-
* Gives a player items of a class, 1 to 10000 at a time. Left-out properties mean quality 1 at full condition. The units join the row that already holds this class with these properties, if there is one.
|
|
1652
|
+
* Gives a player items of a class, 1 to 10000 at a time. `item` is the class GUID or the exact name the game's own item tables use, the same spelling `giveItem` takes. Left-out properties mean quality 1 at full condition; `metadata.quality` asks for a higher tier, up to what the class is made in, and `invalidQuality` refuses one past it. The units join the row that already holds this class with these properties, if there is one.
|
|
1643
1653
|
*/
|
|
1644
1654
|
add(player: Player, request: { item: string; amount: number; metadata?: Record<string, unknown>; revision?: number }): InventoryResult;
|
|
1645
1655
|
|
|
@@ -1662,6 +1672,21 @@ declare global {
|
|
|
1662
1672
|
* Moves exact units from one player to another with their properties, all or nothing. They join matching rows in the target, so the target's row ids are the ones in the result's `items`. Whether the two may trade -- distance, consent, price -- is for the script to decide.
|
|
1663
1673
|
*/
|
|
1664
1674
|
transfer(source: Player, target: Player, request: { units: InventoryUnit[]; sourceRevision?: number; targetRevision?: number }): InventoryResult;
|
|
1675
|
+
|
|
1676
|
+
/**
|
|
1677
|
+
* What the game prices one unit of an item at, in money units, worked out the way the game does it. `pristine` is the price at the best health its quality allows, `current` at its own health. Quality changes the price only through that health. The metadata reads as `Inventory.add` reads it -- left out, quality 1 at full condition -- so `Inventory.getItemPrice(row.item, row.metadata)` prices a row. This is the item's own worth: what the game's shopkeepers would ask depends on their terms and the haggling, and a `Vendor` charges whatever its script says.
|
|
1678
|
+
* @param metadata The item's properties, as a row's `metadata` holds them.
|
|
1679
|
+
* @returns Null for a class the server does not know, or metadata `Inventory.add` would refuse.
|
|
1680
|
+
*/
|
|
1681
|
+
getItemPrice(item: string, metadata?: Record<string, unknown>): { pristine: number; current: number } | null;
|
|
1682
|
+
|
|
1683
|
+
/**
|
|
1684
|
+
* Changes what every player's game calls an item, in their inventory, the shops, loot and anywhere else the game names it; null gives the game its own name back. Every player sees it, including those who join later, until the server stops.
|
|
1685
|
+
*
|
|
1686
|
+
* The game does not name classes one by one: many classes show the same name -- every kite shield is a Kite Shield -- and renaming one renames all of them. The result lists them. A name is up to 128 bytes with no control characters, and is not translated.
|
|
1687
|
+
* @returns The GUIDs of every class that now shows this name.
|
|
1688
|
+
*/
|
|
1689
|
+
setItemName(item: string, name: string | null): string[];
|
|
1665
1690
|
};
|
|
1666
1691
|
|
|
1667
1692
|
/**
|
|
@@ -2131,31 +2156,86 @@ declare global {
|
|
|
2131
2156
|
}
|
|
2132
2157
|
|
|
2133
2158
|
/**
|
|
2134
|
-
*
|
|
2159
|
+
* How a dice match is played.
|
|
2160
|
+
*/
|
|
2161
|
+
interface DiceMatchOptions {
|
|
2162
|
+
/**
|
|
2163
|
+
* The score that wins, banked at the end of a turn. 2000 when omitted, at most 100000.
|
|
2164
|
+
*/
|
|
2165
|
+
targetScore: number | undefined;
|
|
2166
|
+
}
|
|
2167
|
+
|
|
2168
|
+
/**
|
|
2169
|
+
* Dice matches between two players on the game's own dice table.
|
|
2170
|
+
*
|
|
2171
|
+
* Both players sit down at the dice table nearest them and play it as they would against an NPC, the other player's body opposite. Every throw is dealt and every move checked by the server, by the game's own scoring rules; badges and dice perks are off, so a match is decided by the dice and the decisions alone.
|
|
2172
|
+
*/
|
|
2173
|
+
const Dice: {
|
|
2174
|
+
/**
|
|
2175
|
+
* Starts a match. Both players must stand together, within a few metres, at a dice table, and neither may be playing already. Throws an Error saying why when it cannot start.
|
|
2176
|
+
* @param first NetworkID of the player on the table's first seat.
|
|
2177
|
+
* @param second NetworkID of the player on the second seat.
|
|
2178
|
+
* @param options The target score. Optional.
|
|
2179
|
+
* @returns The match id.
|
|
2180
|
+
*/
|
|
2181
|
+
start(first: number, second: number, options?: DiceMatchOptions): number;
|
|
2182
|
+
|
|
2183
|
+
/**
|
|
2184
|
+
* Ends a match with nobody winning; both tables close.
|
|
2185
|
+
* @param match The match to end.
|
|
2186
|
+
* @returns False when it had already ended.
|
|
2187
|
+
*/
|
|
2188
|
+
stop(match: number): boolean;
|
|
2189
|
+
|
|
2190
|
+
/**
|
|
2191
|
+
* The match a player is in.
|
|
2192
|
+
* @param player NetworkID of the player to ask about.
|
|
2193
|
+
* @returns The match id, or 0.
|
|
2194
|
+
*/
|
|
2195
|
+
matchOf(player: number): number;
|
|
2196
|
+
};
|
|
2197
|
+
|
|
2198
|
+
/**
|
|
2199
|
+
* A table a player is about to open, or a workpiece about to take its materials. Frozen: a handler can refuse it, not change it.
|
|
2135
2200
|
*/
|
|
2136
2201
|
interface CraftStartProposal {
|
|
2202
|
+
/**
|
|
2203
|
+
* Which craft.
|
|
2204
|
+
*/
|
|
2205
|
+
kind: 'alchemy' | 'smithing';
|
|
2206
|
+
|
|
2137
2207
|
/**
|
|
2138
2208
|
* Station id, as `Crafting.stations` names it.
|
|
2139
2209
|
*/
|
|
2140
2210
|
station: string;
|
|
2141
2211
|
|
|
2142
2212
|
/**
|
|
2143
|
-
* The player's virtual world; each world has its own
|
|
2213
|
+
* The player's virtual world; each world has its own stations.
|
|
2144
2214
|
*/
|
|
2145
2215
|
virtualWorld: number;
|
|
2146
2216
|
|
|
2147
2217
|
/**
|
|
2148
|
-
*
|
|
2218
|
+
* Smithing only: the recipe id the player chose, as `Crafting.recipes` keys it.
|
|
2219
|
+
*/
|
|
2220
|
+
recipe: string | undefined;
|
|
2221
|
+
|
|
2222
|
+
/**
|
|
2223
|
+
* The batch this one follows at a table the player kept, or empty for a fresh entry. Always empty for smithing.
|
|
2149
2224
|
*/
|
|
2150
2225
|
continuationOf: string;
|
|
2151
2226
|
}
|
|
2152
2227
|
|
|
2153
2228
|
/**
|
|
2154
|
-
* A batch that is now brewing
|
|
2229
|
+
* A batch that is now brewing, or a workpiece whose materials were taken.
|
|
2155
2230
|
*/
|
|
2156
2231
|
interface CraftStartedEvent {
|
|
2157
2232
|
/**
|
|
2158
|
-
*
|
|
2233
|
+
* Which craft.
|
|
2234
|
+
*/
|
|
2235
|
+
kind: 'alchemy' | 'smithing';
|
|
2236
|
+
|
|
2237
|
+
/**
|
|
2238
|
+
* The batch's or workpiece's session id.
|
|
2159
2239
|
*/
|
|
2160
2240
|
session: string;
|
|
2161
2241
|
|
|
@@ -2165,22 +2245,32 @@ declare global {
|
|
|
2165
2245
|
station: string;
|
|
2166
2246
|
|
|
2167
2247
|
/**
|
|
2168
|
-
* The
|
|
2248
|
+
* The station's virtual world.
|
|
2169
2249
|
*/
|
|
2170
2250
|
virtualWorld: number;
|
|
2171
2251
|
|
|
2172
2252
|
/**
|
|
2173
|
-
*
|
|
2253
|
+
* Smithing only: the recipe being worked.
|
|
2254
|
+
*/
|
|
2255
|
+
recipe: string | undefined;
|
|
2256
|
+
|
|
2257
|
+
/**
|
|
2258
|
+
* The previous batch at this table, or empty for the first. Always empty for smithing.
|
|
2174
2259
|
*/
|
|
2175
2260
|
continuationOf: string;
|
|
2176
2261
|
}
|
|
2177
2262
|
|
|
2178
2263
|
/**
|
|
2179
|
-
* What a finished batch is about to grant, computed by the server. Frozen: a handler can refuse it, not change it.
|
|
2264
|
+
* What a finished batch or workpiece is about to grant, computed by the server. Frozen: a handler can refuse it, not change it.
|
|
2180
2265
|
*/
|
|
2181
2266
|
interface CraftCompletionProposal {
|
|
2182
2267
|
/**
|
|
2183
|
-
*
|
|
2268
|
+
* Which craft.
|
|
2269
|
+
*/
|
|
2270
|
+
kind: 'alchemy' | 'smithing';
|
|
2271
|
+
|
|
2272
|
+
/**
|
|
2273
|
+
* The session id.
|
|
2184
2274
|
*/
|
|
2185
2275
|
session: string;
|
|
2186
2276
|
|
|
@@ -2190,22 +2280,22 @@ declare global {
|
|
|
2190
2280
|
station: string;
|
|
2191
2281
|
|
|
2192
2282
|
/**
|
|
2193
|
-
* `failed` brews the game's failed potion.
|
|
2283
|
+
* `failed` brews the game's failed potion. A smithing proposal is always `success`: a failed workpiece grants nothing to review.
|
|
2194
2284
|
*/
|
|
2195
2285
|
outcome: 'success' | 'failed';
|
|
2196
2286
|
|
|
2197
2287
|
/**
|
|
2198
|
-
* The recipe the brew matched, or empty when it matched none.
|
|
2288
|
+
* The recipe the brew matched, or empty when it matched none; the smithing recipe worked.
|
|
2199
2289
|
*/
|
|
2200
2290
|
recipe: string;
|
|
2201
2291
|
|
|
2202
2292
|
/**
|
|
2203
|
-
* The product's native rank.
|
|
2293
|
+
* The product's native rank; for smithing, its item quality tier.
|
|
2204
2294
|
*/
|
|
2205
2295
|
grade: number;
|
|
2206
2296
|
|
|
2207
2297
|
/**
|
|
2208
|
-
* Item class GUID of what would be granted, or empty when
|
|
2298
|
+
* Item class GUID of what would be granted, or empty when nothing is: a zero alchemy yield, or a smithing quest product its quest creates.
|
|
2209
2299
|
*/
|
|
2210
2300
|
product: string;
|
|
2211
2301
|
|
|
@@ -2215,22 +2305,32 @@ declare global {
|
|
|
2215
2305
|
amount: number;
|
|
2216
2306
|
|
|
2217
2307
|
/**
|
|
2218
|
-
* Brewing quality, 0 to 1, after perks and the table-entry bonus.
|
|
2308
|
+
* Brewing quality, 0 to 1, after perks and the table-entry bonus; for smithing, the workpiece quality the player's game reported.
|
|
2219
2309
|
*/
|
|
2220
2310
|
quality: number;
|
|
2221
2311
|
|
|
2222
2312
|
/**
|
|
2223
|
-
* Base alchemy XP; the player's own multipliers apply on top.
|
|
2313
|
+
* Base alchemy or craftsmanship XP; the player's own multipliers apply on top.
|
|
2224
2314
|
*/
|
|
2225
2315
|
xp: number;
|
|
2316
|
+
|
|
2317
|
+
/**
|
|
2318
|
+
* Smithing only: lockpicks granted alongside, drawn by the server from the player's perks.
|
|
2319
|
+
*/
|
|
2320
|
+
lockpicks: number | undefined;
|
|
2226
2321
|
}
|
|
2227
2322
|
|
|
2228
2323
|
/**
|
|
2229
|
-
* A batch whose result was granted: the output is in the inventory and the XP was ordered.
|
|
2324
|
+
* A batch or workpiece whose result was granted: the output is in the inventory and the XP was ordered.
|
|
2230
2325
|
*/
|
|
2231
2326
|
interface CraftCompletedEvent {
|
|
2232
2327
|
/**
|
|
2233
|
-
*
|
|
2328
|
+
* Which craft.
|
|
2329
|
+
*/
|
|
2330
|
+
kind: 'alchemy' | 'smithing';
|
|
2331
|
+
|
|
2332
|
+
/**
|
|
2333
|
+
* The session id.
|
|
2234
2334
|
*/
|
|
2235
2335
|
session: string;
|
|
2236
2336
|
|
|
@@ -2240,7 +2340,7 @@ declare global {
|
|
|
2240
2340
|
station: string;
|
|
2241
2341
|
|
|
2242
2342
|
/**
|
|
2243
|
-
* The
|
|
2343
|
+
* The station's virtual world.
|
|
2244
2344
|
*/
|
|
2245
2345
|
virtualWorld: number;
|
|
2246
2346
|
|
|
@@ -2255,37 +2355,47 @@ declare global {
|
|
|
2255
2355
|
recipe: string;
|
|
2256
2356
|
|
|
2257
2357
|
/**
|
|
2258
|
-
* The product's native rank.
|
|
2358
|
+
* The product's native rank; for smithing, its item quality tier.
|
|
2259
2359
|
*/
|
|
2260
2360
|
grade: number;
|
|
2261
2361
|
|
|
2262
2362
|
/**
|
|
2263
|
-
* Brewing quality, 0 to 1.
|
|
2363
|
+
* Brewing or workpiece quality, 0 to 1.
|
|
2264
2364
|
*/
|
|
2265
2365
|
quality: number;
|
|
2266
2366
|
|
|
2267
2367
|
/**
|
|
2268
|
-
* Base
|
|
2368
|
+
* Base XP ordered.
|
|
2269
2369
|
*/
|
|
2270
2370
|
xp: number;
|
|
2271
2371
|
|
|
2272
2372
|
/**
|
|
2273
|
-
*
|
|
2373
|
+
* Smithing only: lockpicks granted.
|
|
2374
|
+
*/
|
|
2375
|
+
lockpicks: number | undefined;
|
|
2376
|
+
|
|
2377
|
+
/**
|
|
2378
|
+
* The inventory rows that received the output, lockpicks included. Do not grant it again.
|
|
2274
2379
|
*/
|
|
2275
2380
|
outputs: InventoryUnit[];
|
|
2276
2381
|
|
|
2277
2382
|
/**
|
|
2278
|
-
*
|
|
2383
|
+
* Alchemy only: the player's recipe knowledge after this batch, as `Crafting.knowledge` returns it.
|
|
2279
2384
|
*/
|
|
2280
|
-
knowledge: Record<string, number
|
|
2385
|
+
knowledge: Record<string, number> | undefined;
|
|
2281
2386
|
}
|
|
2282
2387
|
|
|
2283
2388
|
/**
|
|
2284
|
-
* A batch that is over, for any reason. A table kept for the next batch is not closed by this.
|
|
2389
|
+
* A batch or workpiece that is over, for any reason. A table kept for the next batch is not closed by this.
|
|
2285
2390
|
*/
|
|
2286
2391
|
interface CraftEndedEvent {
|
|
2287
2392
|
/**
|
|
2288
|
-
*
|
|
2393
|
+
* Which craft.
|
|
2394
|
+
*/
|
|
2395
|
+
kind: 'alchemy' | 'smithing';
|
|
2396
|
+
|
|
2397
|
+
/**
|
|
2398
|
+
* The session id.
|
|
2289
2399
|
*/
|
|
2290
2400
|
session: string;
|
|
2291
2401
|
|
|
@@ -2295,7 +2405,7 @@ declare global {
|
|
|
2295
2405
|
station: string;
|
|
2296
2406
|
|
|
2297
2407
|
/**
|
|
2298
|
-
* The
|
|
2408
|
+
* The station's virtual world.
|
|
2299
2409
|
*/
|
|
2300
2410
|
virtualWorld: number;
|
|
2301
2411
|
|
|
@@ -2305,12 +2415,12 @@ declare global {
|
|
|
2305
2415
|
outcome: 'success' | 'failed' | 'cancelled';
|
|
2306
2416
|
|
|
2307
2417
|
/**
|
|
2308
|
-
* Empty for a completed batch. `craftingCompletingRejected` when a handler refused the result; `cancelled` by the player or a script; `disconnected`; `timeout` after 30 minutes; `contextInvalidated` when the player walked away, died or changed world.
|
|
2418
|
+
* Empty for a completed batch or a workpiece the game finished or broke. `craftingCompletingRejected` when a handler refused the result; `cancelled` by the player or a script; `disconnected`; `timeout` after 30 minutes; `contextInvalidated` when the player walked away, died or changed world. Smithing adds `abandoned` (the recipe never reached the anvil), `abandonTooLate`, `invalidQuality` and `inventoryUnavailable`.
|
|
2309
2419
|
*/
|
|
2310
2420
|
reason: string;
|
|
2311
2421
|
|
|
2312
2422
|
/**
|
|
2313
|
-
* The inventory rows ingredients went back to.
|
|
2423
|
+
* The inventory rows ingredients went back to. Alchemy: wholly unmilled bowl, mortar and herb groups come back; everything else put on the table was spent. Smithing: a failed workpiece spends half of each divisible material, rounded down, and a coin decides a single unit; the rest comes back.
|
|
2314
2424
|
*/
|
|
2315
2425
|
refunded: InventoryUnit[];
|
|
2316
2426
|
}
|
|
@@ -2333,6 +2443,11 @@ declare global {
|
|
|
2333
2443
|
* Units required for one attempt.
|
|
2334
2444
|
*/
|
|
2335
2445
|
amount: number;
|
|
2446
|
+
|
|
2447
|
+
/**
|
|
2448
|
+
* A quest item, which only its quest hands out: the game cannot create one, so the inventory refuses it (`questItem`) and Player.giveItem returns false. It must be held to craft, and is never taken.
|
|
2449
|
+
*/
|
|
2450
|
+
quest: boolean;
|
|
2336
2451
|
}
|
|
2337
2452
|
|
|
2338
2453
|
/**
|
|
@@ -2436,7 +2551,7 @@ declare global {
|
|
|
2436
2551
|
}
|
|
2437
2552
|
|
|
2438
2553
|
/**
|
|
2439
|
-
* Who holds
|
|
2554
|
+
* Who holds a station. A player keeps an alchemy table between batches until they leave it; a smithery is held for one workpiece.
|
|
2440
2555
|
*/
|
|
2441
2556
|
interface CraftStationOccupant {
|
|
2442
2557
|
/**
|
|
@@ -2455,9 +2570,9 @@ declare global {
|
|
|
2455
2570
|
sessionId: string;
|
|
2456
2571
|
|
|
2457
2572
|
/**
|
|
2458
|
-
* `entering` until the opening animation finishes; `finishing` while a finished batch waits to settle.
|
|
2573
|
+
* `entering` until the opening animation finishes; `finishing` while a finished batch waits to settle; `working` at a smithery.
|
|
2459
2574
|
*/
|
|
2460
|
-
phase: 'entering' | 'brewing' | 'finishing' | 'betweenBatches';
|
|
2575
|
+
phase: 'entering' | 'brewing' | 'finishing' | 'betweenBatches' | 'working';
|
|
2461
2576
|
|
|
2462
2577
|
/**
|
|
2463
2578
|
* Milliseconds until the table is taken back. Each batch has 30 minutes.
|
|
@@ -2466,7 +2581,7 @@ declare global {
|
|
|
2466
2581
|
}
|
|
2467
2582
|
|
|
2468
2583
|
/**
|
|
2469
|
-
* One
|
|
2584
|
+
* One station in one virtual world. A free station may still be unusable in the game, for instance behind a quest layer.
|
|
2470
2585
|
*/
|
|
2471
2586
|
interface CraftStationOccupancy {
|
|
2472
2587
|
/**
|
|
@@ -2491,11 +2606,16 @@ declare global {
|
|
|
2491
2606
|
}
|
|
2492
2607
|
|
|
2493
2608
|
/**
|
|
2494
|
-
* A player's alchemy session
|
|
2609
|
+
* A player's alchemy session or kept table, or their smithing workpiece. A copy: changing it changes nothing.
|
|
2495
2610
|
*/
|
|
2496
2611
|
interface CraftSessionInfo {
|
|
2497
2612
|
/**
|
|
2498
|
-
*
|
|
2613
|
+
* Which craft.
|
|
2614
|
+
*/
|
|
2615
|
+
kind: 'alchemy' | 'smithing';
|
|
2616
|
+
|
|
2617
|
+
/**
|
|
2618
|
+
* The session id.
|
|
2499
2619
|
*/
|
|
2500
2620
|
id: string;
|
|
2501
2621
|
|
|
@@ -2505,24 +2625,34 @@ declare global {
|
|
|
2505
2625
|
station: string;
|
|
2506
2626
|
|
|
2507
2627
|
/**
|
|
2508
|
-
* The
|
|
2628
|
+
* The station's virtual world.
|
|
2509
2629
|
*/
|
|
2510
2630
|
virtualWorld: number;
|
|
2511
2631
|
|
|
2512
2632
|
/**
|
|
2513
|
-
* Where the batch is.
|
|
2633
|
+
* Where the batch is; `working` for a smithing workpiece.
|
|
2634
|
+
*/
|
|
2635
|
+
phase: 'entering' | 'brewing' | 'finishing' | 'betweenBatches' | 'working';
|
|
2636
|
+
|
|
2637
|
+
/**
|
|
2638
|
+
* Alchemy only: native actions accepted so far.
|
|
2514
2639
|
*/
|
|
2515
|
-
|
|
2640
|
+
sequence: number | undefined;
|
|
2516
2641
|
|
|
2517
2642
|
/**
|
|
2518
|
-
*
|
|
2643
|
+
* Alchemy only: what is on the table: item class, the inventory row it came from (empty for a base liquid), and the native table position.
|
|
2519
2644
|
*/
|
|
2520
|
-
|
|
2645
|
+
resources: { id: number; item: string; itemId: string; position: number; base: boolean; milled: boolean; distilled: boolean }[] | undefined;
|
|
2521
2646
|
|
|
2522
2647
|
/**
|
|
2523
|
-
*
|
|
2648
|
+
* Smithing only: the recipe being worked.
|
|
2524
2649
|
*/
|
|
2525
|
-
|
|
2650
|
+
recipe: string | undefined;
|
|
2651
|
+
|
|
2652
|
+
/**
|
|
2653
|
+
* Smithing only: the units taken from the inventory for this workpiece. Quest materials are required but never taken.
|
|
2654
|
+
*/
|
|
2655
|
+
materials: { item: string; amount: number }[] | undefined;
|
|
2526
2656
|
|
|
2527
2657
|
/**
|
|
2528
2658
|
* Milliseconds until the session times out.
|
|
@@ -2531,11 +2661,11 @@ declare global {
|
|
|
2531
2661
|
}
|
|
2532
2662
|
|
|
2533
2663
|
/**
|
|
2534
|
-
* Crafting catalogs,
|
|
2664
|
+
* Crafting catalogs, station occupancy, alchemy and smithing sessions, and alchemy recipe knowledge. Held in memory for each connection; nothing is saved.
|
|
2535
2665
|
*/
|
|
2536
2666
|
const Crafting: {
|
|
2537
2667
|
/**
|
|
2538
|
-
* True
|
|
2668
|
+
* True: alchemy and smithing are both ruled by the server. Omitted kind checks alchemy.
|
|
2539
2669
|
*/
|
|
2540
2670
|
isAvailable(kind?: 'alchemy' | 'smithing'): boolean;
|
|
2541
2671
|
|
|
@@ -2550,17 +2680,17 @@ declare global {
|
|
|
2550
2680
|
recipes(player: Player, kind?: 'alchemy' | 'smithing'): readonly CraftRecipeInfo[];
|
|
2551
2681
|
|
|
2552
2682
|
/**
|
|
2553
|
-
* The player's alchemy session or the table they kept between batches,
|
|
2683
|
+
* The player's alchemy session or the table they kept between batches, else their smithing workpiece, else null.
|
|
2554
2684
|
*/
|
|
2555
2685
|
session(player: Player): CraftSessionInfo | null;
|
|
2556
2686
|
|
|
2557
2687
|
/**
|
|
2558
|
-
* Who holds a
|
|
2688
|
+
* Who holds a station. World defaults to 0. Null for an unknown station.
|
|
2559
2689
|
*/
|
|
2560
2690
|
occupancy(stationId: string, virtualWorld?: number): CraftStationOccupancy | null;
|
|
2561
2691
|
|
|
2562
2692
|
/**
|
|
2563
|
-
* Ends the player's session as leaving the
|
|
2693
|
+
* Ends the player's session as leaving the station would, and their game closes it. Alchemy: wholly unmilled groups go back to the inventory, the rest is spent. Smithing: the workpiece fails, spending its failure share. `craftingEnded` follows next tick. False when there was nothing to end.
|
|
2564
2694
|
*/
|
|
2565
2695
|
cancel(player: Player): boolean;
|
|
2566
2696
|
|
|
@@ -3464,6 +3594,54 @@ declare global {
|
|
|
3464
3594
|
*/
|
|
3465
3595
|
toString(): string;
|
|
3466
3596
|
|
|
3597
|
+
/**
|
|
3598
|
+
* Checks whether this NPC's nametag is drawn; the same switch as the `nametag` property.
|
|
3599
|
+
* @returns True while the nametag is shown.
|
|
3600
|
+
*/
|
|
3601
|
+
isNametagVisible(): boolean;
|
|
3602
|
+
|
|
3603
|
+
/**
|
|
3604
|
+
* Shows or hides the name over this NPC's head for every player; the same switch as the `nametag` property. Each player can still hide all nametags locally.
|
|
3605
|
+
* @param visible True to draw this NPC's nametag for every player, false to hide it.
|
|
3606
|
+
*/
|
|
3607
|
+
setNametagVisible(visible: boolean): void;
|
|
3608
|
+
|
|
3609
|
+
/**
|
|
3610
|
+
* Checks whether the health bar under this NPC's nametag is shown.
|
|
3611
|
+
* @returns True unless the health bar was hidden.
|
|
3612
|
+
*/
|
|
3613
|
+
isNametagHealthVisible(): boolean;
|
|
3614
|
+
|
|
3615
|
+
/**
|
|
3616
|
+
* Shows or hides the health bar under this NPC's nametag, leaving the name itself alone.
|
|
3617
|
+
* @param visible True to show the health bar under this NPC's name, false to hide it.
|
|
3618
|
+
*/
|
|
3619
|
+
setNametagHealthVisible(visible: boolean): void;
|
|
3620
|
+
|
|
3621
|
+
/**
|
|
3622
|
+
* Reads this NPC's nametag text override.
|
|
3623
|
+
* @returns The override, or an empty string when the NPC's `name` is drawn.
|
|
3624
|
+
*/
|
|
3625
|
+
getNametagText(): string;
|
|
3626
|
+
|
|
3627
|
+
/**
|
|
3628
|
+
* Overrides the text drawn on this NPC's nametag without renaming it: `name` still reaches conversation and the soul.
|
|
3629
|
+
* @param text Text to show instead of the NPC's name; empty or omitted restores the name.
|
|
3630
|
+
*/
|
|
3631
|
+
setNametagText(text?: string): void;
|
|
3632
|
+
|
|
3633
|
+
/**
|
|
3634
|
+
* Reads this NPC's nametag color.
|
|
3635
|
+
* @returns Packed 0xAARRGGBB color; opaque white when untinted.
|
|
3636
|
+
*/
|
|
3637
|
+
getNametagColor(): number;
|
|
3638
|
+
|
|
3639
|
+
/**
|
|
3640
|
+
* Tints the text on this NPC's nametag.
|
|
3641
|
+
* @param color Packed 0xAARRGGBB color.
|
|
3642
|
+
*/
|
|
3643
|
+
setNametagColor(color: number): void;
|
|
3644
|
+
|
|
3467
3645
|
/**
|
|
3468
3646
|
* Despawns this NPC everywhere, after emitting npcDestroy.
|
|
3469
3647
|
*/
|
|
@@ -3894,6 +4072,60 @@ declare global {
|
|
|
3894
4072
|
|
|
3895
4073
|
interface GroundItem extends Entity {}
|
|
3896
4074
|
|
|
4075
|
+
/**
|
|
4076
|
+
* The server-wide override for herb regrowth, measured in game hours.
|
|
4077
|
+
*/
|
|
4078
|
+
interface GatheringRespawnTime {
|
|
4079
|
+
/**
|
|
4080
|
+
* Lower bound, inclusive. Both bounds zero disable timed regrowth.
|
|
4081
|
+
*/
|
|
4082
|
+
minHours: number;
|
|
4083
|
+
|
|
4084
|
+
/**
|
|
4085
|
+
* Upper bound, inclusive. Equal positive bounds give a fixed duration.
|
|
4086
|
+
*/
|
|
4087
|
+
maxHours: number;
|
|
4088
|
+
}
|
|
4089
|
+
|
|
4090
|
+
/**
|
|
4091
|
+
* Controls herb regrowth. Defaults are five times faster than the game's authored species timings. Changes are held in server memory.
|
|
4092
|
+
*/
|
|
4093
|
+
const Gathering: {
|
|
4094
|
+
/**
|
|
4095
|
+
* Current frozen override, or null for the species defaults at one fifth of their authored duration.
|
|
4096
|
+
*/
|
|
4097
|
+
readonly respawnTime: GatheringRespawnTime | null;
|
|
4098
|
+
|
|
4099
|
+
/**
|
|
4100
|
+
* Restarts all active herb deadlines from now and sets the policy for future picks. Samples uniformly per plant. Equal bounds fix the duration; (0, 0) disables timed regrowth while manual respawn remains available. Applies to every virtual world.
|
|
4101
|
+
* @param minHours Minimum game hours, from 0 to maxHours.
|
|
4102
|
+
* @param maxHours Maximum game hours, up to 87600. Positive durations must reach at least one game millisecond.
|
|
4103
|
+
* @returns True on success; false for non-finite, reversed or out-of-range bounds.
|
|
4104
|
+
*/
|
|
4105
|
+
setRespawnTime(minHours: number, maxHours: number): boolean;
|
|
4106
|
+
|
|
4107
|
+
/**
|
|
4108
|
+
* Restores five-times-faster species defaults and restarts all active herb timers from now.
|
|
4109
|
+
*/
|
|
4110
|
+
resetRespawnTime(): void;
|
|
4111
|
+
|
|
4112
|
+
/**
|
|
4113
|
+
* Respawns recorded harvested plants in a sphere, including plants with timed regrowth disabled. Restores client vegetation as well as server availability. Does not create new plants.
|
|
4114
|
+
* @param position Centre of the sphere in world metres; finite coordinates within +/-100000.
|
|
4115
|
+
* @param radius Inclusive 3D radius in metres, from 0 to 100000.
|
|
4116
|
+
* @param virtualWorld Only this virtual world; defaults to 0.
|
|
4117
|
+
* @returns Number of active harvested sources restored. Invalid arguments throw.
|
|
4118
|
+
*/
|
|
4119
|
+
respawn(position: Vector3, radius: number, virtualWorld?: number): number;
|
|
4120
|
+
|
|
4121
|
+
/**
|
|
4122
|
+
* Respawns every recorded harvested plant in one virtual world, including plants with timed regrowth disabled.
|
|
4123
|
+
* @param virtualWorld Only this virtual world; defaults to 0.
|
|
4124
|
+
* @returns Number of active harvested sources restored. Invalid arguments throw.
|
|
4125
|
+
*/
|
|
4126
|
+
respawnAll(virtualWorld?: number): number;
|
|
4127
|
+
};
|
|
4128
|
+
|
|
3897
4129
|
/**
|
|
3898
4130
|
* A plant a player picked and what it is about to give them.
|
|
3899
4131
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kingdomsconnected/types",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.6",
|
|
4
4
|
"description": "TypeScript declarations for the Kingdoms Connected scripting API, one entry per side: @kingdomsconnected/types/server and @kingdomsconnected/types/client",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"keywords": [
|