@kingdomsconnected/types 1.5.4 → 1.5.5
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 +132 -2
- package/generated/server-api.d.ts +181 -53
- 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,7 @@ 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.
|
|
902
912
|
*/
|
|
903
913
|
const Hud: {
|
|
904
914
|
/**
|
|
@@ -1010,6 +1020,21 @@ declare global {
|
|
|
1010
1020
|
* @returns True when the HUD took it.
|
|
1011
1021
|
*/
|
|
1012
1022
|
clearNotifications(): boolean;
|
|
1023
|
+
|
|
1024
|
+
/**
|
|
1025
|
+
* Hides or shows one element of the game's HUD at this client, through the switch the game itself keeps for each. It can be called at any time, before the HUD has loaded included: the game re-applies the switch every time the HUD loads, across level loads too. Turning an element on does not force it up; the game still hides it where it would anyway, in dialogue or a menu, say. The player's own setting comes back when the resource that changed it stops.
|
|
1026
|
+
* @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.
|
|
1027
|
+
* @param visible False hides the element, true lets the game show it again.
|
|
1028
|
+
* @returns True when the switch took it; false only before the game has created its HUD switches, which it does at startup.
|
|
1029
|
+
*/
|
|
1030
|
+
setElementVisible(element: string, visible: boolean): boolean;
|
|
1031
|
+
|
|
1032
|
+
/**
|
|
1033
|
+
* Whether one element's switch is on. An element whose switch is on can still be hidden by the game at that moment.
|
|
1034
|
+
* @param element The element, by the game's own name for it, as `setElementVisible` takes it.
|
|
1035
|
+
* @returns True while the element is allowed to show.
|
|
1036
|
+
*/
|
|
1037
|
+
isElementVisible(element: string): boolean;
|
|
1013
1038
|
};
|
|
1014
1039
|
|
|
1015
1040
|
/**
|
|
@@ -1815,7 +1840,7 @@ declare global {
|
|
|
1815
1840
|
*
|
|
1816
1841
|
* 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
1842
|
*
|
|
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.
|
|
1843
|
+
* 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
1844
|
* @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
1845
|
*/
|
|
1821
1846
|
setThirdPerson(options?: { distance?: number; height?: number; shoulder?: number } | null): void;
|
|
@@ -2557,6 +2582,111 @@ declare global {
|
|
|
2557
2582
|
getCatalog(): EmoteCatalogEntry[];
|
|
2558
2583
|
};
|
|
2559
2584
|
|
|
2585
|
+
/**
|
|
2586
|
+
* A picture for the skill-book and map layouts, which place pictures by page rather than inline.
|
|
2587
|
+
*/
|
|
2588
|
+
interface BookPageImage {
|
|
2589
|
+
/**
|
|
2590
|
+
* Zero-based page the picture belongs to.
|
|
2591
|
+
*/
|
|
2592
|
+
page: number;
|
|
2593
|
+
|
|
2594
|
+
/**
|
|
2595
|
+
* Its name under the game's own `Libs/UI/Textures/Books/` Skills or Maps folder, without the `_ui.dds` suffix, e.g. `swords1`.
|
|
2596
|
+
*/
|
|
2597
|
+
image: string;
|
|
2598
|
+
}
|
|
2599
|
+
|
|
2600
|
+
/**
|
|
2601
|
+
* What `Book.open` shows and how it looks.
|
|
2602
|
+
*/
|
|
2603
|
+
interface BookOptions {
|
|
2604
|
+
/**
|
|
2605
|
+
* 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.
|
|
2606
|
+
*/
|
|
2607
|
+
pages: string[];
|
|
2608
|
+
|
|
2609
|
+
/**
|
|
2610
|
+
* The object in the player's hands: a red-covered book (the default), a plain-covered one, or a folded letter.
|
|
2611
|
+
*/
|
|
2612
|
+
style: "book" | "plainBook" | "letter" | undefined;
|
|
2613
|
+
|
|
2614
|
+
/**
|
|
2615
|
+
* 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.
|
|
2616
|
+
*/
|
|
2617
|
+
type: number | undefined;
|
|
2618
|
+
|
|
2619
|
+
/**
|
|
2620
|
+
* How ornate the pages are, 1 plain to 7 embellished. Defaults to 1.
|
|
2621
|
+
*/
|
|
2622
|
+
visual: number | undefined;
|
|
2623
|
+
|
|
2624
|
+
/**
|
|
2625
|
+
* 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.
|
|
2626
|
+
*/
|
|
2627
|
+
legibility: number | undefined;
|
|
2628
|
+
|
|
2629
|
+
/**
|
|
2630
|
+
* 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.
|
|
2631
|
+
*/
|
|
2632
|
+
texture: string | undefined;
|
|
2633
|
+
|
|
2634
|
+
/**
|
|
2635
|
+
* Pictures for the skill-book and map layouts. Inline pictures go in the page text as `<img>` instead.
|
|
2636
|
+
*/
|
|
2637
|
+
images: BookPageImage[] | undefined;
|
|
2638
|
+
}
|
|
2639
|
+
|
|
2640
|
+
/**
|
|
2641
|
+
* Books a resource composes and opens in this player's hands.
|
|
2642
|
+
*
|
|
2643
|
+
* 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.
|
|
2644
|
+
*
|
|
2645
|
+
* 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.
|
|
2646
|
+
*
|
|
2647
|
+
* Pictures a resource ships go through `Book.image`, which returns what an `<img src>` and the `texture` option take.
|
|
2648
|
+
*/
|
|
2649
|
+
const Book: {
|
|
2650
|
+
/**
|
|
2651
|
+
* Opens a book in the player's hands.
|
|
2652
|
+
* @param options The pages and how they look.
|
|
2653
|
+
* @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.
|
|
2654
|
+
*/
|
|
2655
|
+
open(options: BookOptions): number | null;
|
|
2656
|
+
|
|
2657
|
+
/**
|
|
2658
|
+
* Closes the open book the way the player's own exit does.
|
|
2659
|
+
* @returns False when no book is open.
|
|
2660
|
+
*/
|
|
2661
|
+
close(): boolean;
|
|
2662
|
+
|
|
2663
|
+
/**
|
|
2664
|
+
* Changes how legible the open book is, while it is in the player's hands.
|
|
2665
|
+
* @param value 0 fully scrambled to 1 fully legible; clamped.
|
|
2666
|
+
* @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.
|
|
2667
|
+
*/
|
|
2668
|
+
setLegibility(value: number): boolean;
|
|
2669
|
+
|
|
2670
|
+
/**
|
|
2671
|
+
* The id of the book in the player's hands.
|
|
2672
|
+
* @returns Null when there is none.
|
|
2673
|
+
*/
|
|
2674
|
+
getOpenBook(): number | null;
|
|
2675
|
+
|
|
2676
|
+
/**
|
|
2677
|
+
* Why the last `open` returned null.
|
|
2678
|
+
* @returns Empty after one that succeeded.
|
|
2679
|
+
*/
|
|
2680
|
+
getLastError(): string;
|
|
2681
|
+
|
|
2682
|
+
/**
|
|
2683
|
+
* Makes a picture the resource ships reachable from page text.
|
|
2684
|
+
* @param path A `.dds` file the calling resource ships, relative to the resource.
|
|
2685
|
+
* @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.
|
|
2686
|
+
*/
|
|
2687
|
+
image(path: string): string;
|
|
2688
|
+
};
|
|
2689
|
+
|
|
2560
2690
|
/**
|
|
2561
2691
|
* Mutable two-dimensional vector.
|
|
2562
2692
|
*/
|
|
@@ -195,27 +195,27 @@ declare global {
|
|
|
195
195
|
playerPickpocketCaught: [thief: Player, victim: Player];
|
|
196
196
|
|
|
197
197
|
/**
|
|
198
|
-
* A player asks to open an alchemy table. Every handler runs; one returning literal `false` refuses it. An async handler cannot refuse.
|
|
198
|
+
* 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
199
|
*/
|
|
200
200
|
craftingStarting: [player: Player, proposal: CraftStartProposal];
|
|
201
201
|
|
|
202
202
|
/**
|
|
203
|
-
* A batch is brewing.
|
|
203
|
+
* A batch is brewing, or a workpiece took its materials.
|
|
204
204
|
*/
|
|
205
205
|
craftingStarted: [player: Player, event: CraftStartedEvent];
|
|
206
206
|
|
|
207
207
|
/**
|
|
208
|
-
* A batch finished and its result is computed. Every handler runs; one returning literal `false` refuses it: the batch
|
|
208
|
+
* 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
209
|
*/
|
|
210
210
|
craftingCompleting: [player: Player, proposal: CraftCompletionProposal];
|
|
211
211
|
|
|
212
212
|
/**
|
|
213
|
-
* A
|
|
213
|
+
* A result was granted, followed by `craftingEnded`. Raised after the `playerInventoryChanged` it caused.
|
|
214
214
|
*/
|
|
215
215
|
craftingCompleted: [player: Player, event: CraftCompletedEvent];
|
|
216
216
|
|
|
217
217
|
/**
|
|
218
|
-
* A batch is over. Raised after the `playerInventoryChanged` of any refund.
|
|
218
|
+
* A batch or workpiece is over. Raised after the `playerInventoryChanged` of any refund.
|
|
219
219
|
*/
|
|
220
220
|
craftingEnded: [player: Player, event: CraftEndedEvent];
|
|
221
221
|
|
|
@@ -1613,7 +1613,7 @@ declare global {
|
|
|
1613
1613
|
ok: boolean;
|
|
1614
1614
|
|
|
1615
1615
|
/**
|
|
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`).
|
|
1616
|
+
* 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
1617
|
*/
|
|
1618
1618
|
code: string;
|
|
1619
1619
|
|
|
@@ -1662,6 +1662,21 @@ declare global {
|
|
|
1662
1662
|
* 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
1663
|
*/
|
|
1664
1664
|
transfer(source: Player, target: Player, request: { units: InventoryUnit[]; sourceRevision?: number; targetRevision?: number }): InventoryResult;
|
|
1665
|
+
|
|
1666
|
+
/**
|
|
1667
|
+
* 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.
|
|
1668
|
+
* @param metadata The item's properties, as a row's `metadata` holds them.
|
|
1669
|
+
* @returns Null for a class the server does not know, or metadata `Inventory.add` would refuse.
|
|
1670
|
+
*/
|
|
1671
|
+
getItemPrice(item: string, metadata?: Record<string, unknown>): { pristine: number; current: number } | null;
|
|
1672
|
+
|
|
1673
|
+
/**
|
|
1674
|
+
* 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.
|
|
1675
|
+
*
|
|
1676
|
+
* 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.
|
|
1677
|
+
* @returns The GUIDs of every class that now shows this name.
|
|
1678
|
+
*/
|
|
1679
|
+
setItemName(item: string, name: string | null): string[];
|
|
1665
1680
|
};
|
|
1666
1681
|
|
|
1667
1682
|
/**
|
|
@@ -2131,31 +2146,46 @@ declare global {
|
|
|
2131
2146
|
}
|
|
2132
2147
|
|
|
2133
2148
|
/**
|
|
2134
|
-
* A table a player is about to open. Frozen: a handler can refuse it, not change it.
|
|
2149
|
+
* 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
2150
|
*/
|
|
2136
2151
|
interface CraftStartProposal {
|
|
2152
|
+
/**
|
|
2153
|
+
* Which craft.
|
|
2154
|
+
*/
|
|
2155
|
+
kind: 'alchemy' | 'smithing';
|
|
2156
|
+
|
|
2137
2157
|
/**
|
|
2138
2158
|
* Station id, as `Crafting.stations` names it.
|
|
2139
2159
|
*/
|
|
2140
2160
|
station: string;
|
|
2141
2161
|
|
|
2142
2162
|
/**
|
|
2143
|
-
* The player's virtual world; each world has its own
|
|
2163
|
+
* The player's virtual world; each world has its own stations.
|
|
2144
2164
|
*/
|
|
2145
2165
|
virtualWorld: number;
|
|
2146
2166
|
|
|
2147
2167
|
/**
|
|
2148
|
-
*
|
|
2168
|
+
* Smithing only: the recipe id the player chose, as `Crafting.recipes` keys it.
|
|
2169
|
+
*/
|
|
2170
|
+
recipe: string | undefined;
|
|
2171
|
+
|
|
2172
|
+
/**
|
|
2173
|
+
* The batch this one follows at a table the player kept, or empty for a fresh entry. Always empty for smithing.
|
|
2149
2174
|
*/
|
|
2150
2175
|
continuationOf: string;
|
|
2151
2176
|
}
|
|
2152
2177
|
|
|
2153
2178
|
/**
|
|
2154
|
-
* A batch that is now brewing
|
|
2179
|
+
* A batch that is now brewing, or a workpiece whose materials were taken.
|
|
2155
2180
|
*/
|
|
2156
2181
|
interface CraftStartedEvent {
|
|
2157
2182
|
/**
|
|
2158
|
-
*
|
|
2183
|
+
* Which craft.
|
|
2184
|
+
*/
|
|
2185
|
+
kind: 'alchemy' | 'smithing';
|
|
2186
|
+
|
|
2187
|
+
/**
|
|
2188
|
+
* The batch's or workpiece's session id.
|
|
2159
2189
|
*/
|
|
2160
2190
|
session: string;
|
|
2161
2191
|
|
|
@@ -2165,22 +2195,32 @@ declare global {
|
|
|
2165
2195
|
station: string;
|
|
2166
2196
|
|
|
2167
2197
|
/**
|
|
2168
|
-
* The
|
|
2198
|
+
* The station's virtual world.
|
|
2169
2199
|
*/
|
|
2170
2200
|
virtualWorld: number;
|
|
2171
2201
|
|
|
2172
2202
|
/**
|
|
2173
|
-
*
|
|
2203
|
+
* Smithing only: the recipe being worked.
|
|
2204
|
+
*/
|
|
2205
|
+
recipe: string | undefined;
|
|
2206
|
+
|
|
2207
|
+
/**
|
|
2208
|
+
* The previous batch at this table, or empty for the first. Always empty for smithing.
|
|
2174
2209
|
*/
|
|
2175
2210
|
continuationOf: string;
|
|
2176
2211
|
}
|
|
2177
2212
|
|
|
2178
2213
|
/**
|
|
2179
|
-
* What a finished batch is about to grant, computed by the server. Frozen: a handler can refuse it, not change it.
|
|
2214
|
+
* What a finished batch or workpiece is about to grant, computed by the server. Frozen: a handler can refuse it, not change it.
|
|
2180
2215
|
*/
|
|
2181
2216
|
interface CraftCompletionProposal {
|
|
2182
2217
|
/**
|
|
2183
|
-
*
|
|
2218
|
+
* Which craft.
|
|
2219
|
+
*/
|
|
2220
|
+
kind: 'alchemy' | 'smithing';
|
|
2221
|
+
|
|
2222
|
+
/**
|
|
2223
|
+
* The session id.
|
|
2184
2224
|
*/
|
|
2185
2225
|
session: string;
|
|
2186
2226
|
|
|
@@ -2190,22 +2230,22 @@ declare global {
|
|
|
2190
2230
|
station: string;
|
|
2191
2231
|
|
|
2192
2232
|
/**
|
|
2193
|
-
* `failed` brews the game's failed potion.
|
|
2233
|
+
* `failed` brews the game's failed potion. A smithing proposal is always `success`: a failed workpiece grants nothing to review.
|
|
2194
2234
|
*/
|
|
2195
2235
|
outcome: 'success' | 'failed';
|
|
2196
2236
|
|
|
2197
2237
|
/**
|
|
2198
|
-
* The recipe the brew matched, or empty when it matched none.
|
|
2238
|
+
* The recipe the brew matched, or empty when it matched none; the smithing recipe worked.
|
|
2199
2239
|
*/
|
|
2200
2240
|
recipe: string;
|
|
2201
2241
|
|
|
2202
2242
|
/**
|
|
2203
|
-
* The product's native rank.
|
|
2243
|
+
* The product's native rank; for smithing, its item quality tier.
|
|
2204
2244
|
*/
|
|
2205
2245
|
grade: number;
|
|
2206
2246
|
|
|
2207
2247
|
/**
|
|
2208
|
-
* Item class GUID of what would be granted, or empty when
|
|
2248
|
+
* 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
2249
|
*/
|
|
2210
2250
|
product: string;
|
|
2211
2251
|
|
|
@@ -2215,22 +2255,32 @@ declare global {
|
|
|
2215
2255
|
amount: number;
|
|
2216
2256
|
|
|
2217
2257
|
/**
|
|
2218
|
-
* Brewing quality, 0 to 1, after perks and the table-entry bonus.
|
|
2258
|
+
* Brewing quality, 0 to 1, after perks and the table-entry bonus; for smithing, the workpiece quality the player's game reported.
|
|
2219
2259
|
*/
|
|
2220
2260
|
quality: number;
|
|
2221
2261
|
|
|
2222
2262
|
/**
|
|
2223
|
-
* Base alchemy XP; the player's own multipliers apply on top.
|
|
2263
|
+
* Base alchemy or craftsmanship XP; the player's own multipliers apply on top.
|
|
2224
2264
|
*/
|
|
2225
2265
|
xp: number;
|
|
2266
|
+
|
|
2267
|
+
/**
|
|
2268
|
+
* Smithing only: lockpicks granted alongside, drawn by the server from the player's perks.
|
|
2269
|
+
*/
|
|
2270
|
+
lockpicks: number | undefined;
|
|
2226
2271
|
}
|
|
2227
2272
|
|
|
2228
2273
|
/**
|
|
2229
|
-
* A batch whose result was granted: the output is in the inventory and the XP was ordered.
|
|
2274
|
+
* A batch or workpiece whose result was granted: the output is in the inventory and the XP was ordered.
|
|
2230
2275
|
*/
|
|
2231
2276
|
interface CraftCompletedEvent {
|
|
2232
2277
|
/**
|
|
2233
|
-
*
|
|
2278
|
+
* Which craft.
|
|
2279
|
+
*/
|
|
2280
|
+
kind: 'alchemy' | 'smithing';
|
|
2281
|
+
|
|
2282
|
+
/**
|
|
2283
|
+
* The session id.
|
|
2234
2284
|
*/
|
|
2235
2285
|
session: string;
|
|
2236
2286
|
|
|
@@ -2240,7 +2290,7 @@ declare global {
|
|
|
2240
2290
|
station: string;
|
|
2241
2291
|
|
|
2242
2292
|
/**
|
|
2243
|
-
* The
|
|
2293
|
+
* The station's virtual world.
|
|
2244
2294
|
*/
|
|
2245
2295
|
virtualWorld: number;
|
|
2246
2296
|
|
|
@@ -2255,37 +2305,47 @@ declare global {
|
|
|
2255
2305
|
recipe: string;
|
|
2256
2306
|
|
|
2257
2307
|
/**
|
|
2258
|
-
* The product's native rank.
|
|
2308
|
+
* The product's native rank; for smithing, its item quality tier.
|
|
2259
2309
|
*/
|
|
2260
2310
|
grade: number;
|
|
2261
2311
|
|
|
2262
2312
|
/**
|
|
2263
|
-
* Brewing quality, 0 to 1.
|
|
2313
|
+
* Brewing or workpiece quality, 0 to 1.
|
|
2264
2314
|
*/
|
|
2265
2315
|
quality: number;
|
|
2266
2316
|
|
|
2267
2317
|
/**
|
|
2268
|
-
* Base
|
|
2318
|
+
* Base XP ordered.
|
|
2269
2319
|
*/
|
|
2270
2320
|
xp: number;
|
|
2271
2321
|
|
|
2272
2322
|
/**
|
|
2273
|
-
*
|
|
2323
|
+
* Smithing only: lockpicks granted.
|
|
2324
|
+
*/
|
|
2325
|
+
lockpicks: number | undefined;
|
|
2326
|
+
|
|
2327
|
+
/**
|
|
2328
|
+
* The inventory rows that received the output, lockpicks included. Do not grant it again.
|
|
2274
2329
|
*/
|
|
2275
2330
|
outputs: InventoryUnit[];
|
|
2276
2331
|
|
|
2277
2332
|
/**
|
|
2278
|
-
*
|
|
2333
|
+
* Alchemy only: the player's recipe knowledge after this batch, as `Crafting.knowledge` returns it.
|
|
2279
2334
|
*/
|
|
2280
|
-
knowledge: Record<string, number
|
|
2335
|
+
knowledge: Record<string, number> | undefined;
|
|
2281
2336
|
}
|
|
2282
2337
|
|
|
2283
2338
|
/**
|
|
2284
|
-
* A batch that is over, for any reason. A table kept for the next batch is not closed by this.
|
|
2339
|
+
* A batch or workpiece that is over, for any reason. A table kept for the next batch is not closed by this.
|
|
2285
2340
|
*/
|
|
2286
2341
|
interface CraftEndedEvent {
|
|
2287
2342
|
/**
|
|
2288
|
-
*
|
|
2343
|
+
* Which craft.
|
|
2344
|
+
*/
|
|
2345
|
+
kind: 'alchemy' | 'smithing';
|
|
2346
|
+
|
|
2347
|
+
/**
|
|
2348
|
+
* The session id.
|
|
2289
2349
|
*/
|
|
2290
2350
|
session: string;
|
|
2291
2351
|
|
|
@@ -2295,7 +2355,7 @@ declare global {
|
|
|
2295
2355
|
station: string;
|
|
2296
2356
|
|
|
2297
2357
|
/**
|
|
2298
|
-
* The
|
|
2358
|
+
* The station's virtual world.
|
|
2299
2359
|
*/
|
|
2300
2360
|
virtualWorld: number;
|
|
2301
2361
|
|
|
@@ -2305,12 +2365,12 @@ declare global {
|
|
|
2305
2365
|
outcome: 'success' | 'failed' | 'cancelled';
|
|
2306
2366
|
|
|
2307
2367
|
/**
|
|
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.
|
|
2368
|
+
* 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
2369
|
*/
|
|
2310
2370
|
reason: string;
|
|
2311
2371
|
|
|
2312
2372
|
/**
|
|
2313
|
-
* The inventory rows ingredients went back to.
|
|
2373
|
+
* 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
2374
|
*/
|
|
2315
2375
|
refunded: InventoryUnit[];
|
|
2316
2376
|
}
|
|
@@ -2333,6 +2393,11 @@ declare global {
|
|
|
2333
2393
|
* Units required for one attempt.
|
|
2334
2394
|
*/
|
|
2335
2395
|
amount: number;
|
|
2396
|
+
|
|
2397
|
+
/**
|
|
2398
|
+
* 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.
|
|
2399
|
+
*/
|
|
2400
|
+
quest: boolean;
|
|
2336
2401
|
}
|
|
2337
2402
|
|
|
2338
2403
|
/**
|
|
@@ -2436,7 +2501,7 @@ declare global {
|
|
|
2436
2501
|
}
|
|
2437
2502
|
|
|
2438
2503
|
/**
|
|
2439
|
-
* Who holds
|
|
2504
|
+
* Who holds a station. A player keeps an alchemy table between batches until they leave it; a smithery is held for one workpiece.
|
|
2440
2505
|
*/
|
|
2441
2506
|
interface CraftStationOccupant {
|
|
2442
2507
|
/**
|
|
@@ -2455,9 +2520,9 @@ declare global {
|
|
|
2455
2520
|
sessionId: string;
|
|
2456
2521
|
|
|
2457
2522
|
/**
|
|
2458
|
-
* `entering` until the opening animation finishes; `finishing` while a finished batch waits to settle.
|
|
2523
|
+
* `entering` until the opening animation finishes; `finishing` while a finished batch waits to settle; `working` at a smithery.
|
|
2459
2524
|
*/
|
|
2460
|
-
phase: 'entering' | 'brewing' | 'finishing' | 'betweenBatches';
|
|
2525
|
+
phase: 'entering' | 'brewing' | 'finishing' | 'betweenBatches' | 'working';
|
|
2461
2526
|
|
|
2462
2527
|
/**
|
|
2463
2528
|
* Milliseconds until the table is taken back. Each batch has 30 minutes.
|
|
@@ -2466,7 +2531,7 @@ declare global {
|
|
|
2466
2531
|
}
|
|
2467
2532
|
|
|
2468
2533
|
/**
|
|
2469
|
-
* One
|
|
2534
|
+
* One station in one virtual world. A free station may still be unusable in the game, for instance behind a quest layer.
|
|
2470
2535
|
*/
|
|
2471
2536
|
interface CraftStationOccupancy {
|
|
2472
2537
|
/**
|
|
@@ -2491,11 +2556,16 @@ declare global {
|
|
|
2491
2556
|
}
|
|
2492
2557
|
|
|
2493
2558
|
/**
|
|
2494
|
-
* A player's alchemy session
|
|
2559
|
+
* A player's alchemy session or kept table, or their smithing workpiece. A copy: changing it changes nothing.
|
|
2495
2560
|
*/
|
|
2496
2561
|
interface CraftSessionInfo {
|
|
2497
2562
|
/**
|
|
2498
|
-
*
|
|
2563
|
+
* Which craft.
|
|
2564
|
+
*/
|
|
2565
|
+
kind: 'alchemy' | 'smithing';
|
|
2566
|
+
|
|
2567
|
+
/**
|
|
2568
|
+
* The session id.
|
|
2499
2569
|
*/
|
|
2500
2570
|
id: string;
|
|
2501
2571
|
|
|
@@ -2505,24 +2575,34 @@ declare global {
|
|
|
2505
2575
|
station: string;
|
|
2506
2576
|
|
|
2507
2577
|
/**
|
|
2508
|
-
* The
|
|
2578
|
+
* The station's virtual world.
|
|
2509
2579
|
*/
|
|
2510
2580
|
virtualWorld: number;
|
|
2511
2581
|
|
|
2512
2582
|
/**
|
|
2513
|
-
* Where the batch is.
|
|
2583
|
+
* Where the batch is; `working` for a smithing workpiece.
|
|
2584
|
+
*/
|
|
2585
|
+
phase: 'entering' | 'brewing' | 'finishing' | 'betweenBatches' | 'working';
|
|
2586
|
+
|
|
2587
|
+
/**
|
|
2588
|
+
* Alchemy only: native actions accepted so far.
|
|
2514
2589
|
*/
|
|
2515
|
-
|
|
2590
|
+
sequence: number | undefined;
|
|
2516
2591
|
|
|
2517
2592
|
/**
|
|
2518
|
-
*
|
|
2593
|
+
* 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
2594
|
*/
|
|
2520
|
-
|
|
2595
|
+
resources: { id: number; item: string; itemId: string; position: number; base: boolean; milled: boolean; distilled: boolean }[] | undefined;
|
|
2521
2596
|
|
|
2522
2597
|
/**
|
|
2523
|
-
*
|
|
2598
|
+
* Smithing only: the recipe being worked.
|
|
2524
2599
|
*/
|
|
2525
|
-
|
|
2600
|
+
recipe: string | undefined;
|
|
2601
|
+
|
|
2602
|
+
/**
|
|
2603
|
+
* Smithing only: the units taken from the inventory for this workpiece. Quest materials are required but never taken.
|
|
2604
|
+
*/
|
|
2605
|
+
materials: { item: string; amount: number }[] | undefined;
|
|
2526
2606
|
|
|
2527
2607
|
/**
|
|
2528
2608
|
* Milliseconds until the session times out.
|
|
@@ -2531,11 +2611,11 @@ declare global {
|
|
|
2531
2611
|
}
|
|
2532
2612
|
|
|
2533
2613
|
/**
|
|
2534
|
-
* Crafting catalogs,
|
|
2614
|
+
* Crafting catalogs, station occupancy, alchemy and smithing sessions, and alchemy recipe knowledge. Held in memory for each connection; nothing is saved.
|
|
2535
2615
|
*/
|
|
2536
2616
|
const Crafting: {
|
|
2537
2617
|
/**
|
|
2538
|
-
* True
|
|
2618
|
+
* True: alchemy and smithing are both ruled by the server. Omitted kind checks alchemy.
|
|
2539
2619
|
*/
|
|
2540
2620
|
isAvailable(kind?: 'alchemy' | 'smithing'): boolean;
|
|
2541
2621
|
|
|
@@ -2550,17 +2630,17 @@ declare global {
|
|
|
2550
2630
|
recipes(player: Player, kind?: 'alchemy' | 'smithing'): readonly CraftRecipeInfo[];
|
|
2551
2631
|
|
|
2552
2632
|
/**
|
|
2553
|
-
* The player's alchemy session or the table they kept between batches,
|
|
2633
|
+
* The player's alchemy session or the table they kept between batches, else their smithing workpiece, else null.
|
|
2554
2634
|
*/
|
|
2555
2635
|
session(player: Player): CraftSessionInfo | null;
|
|
2556
2636
|
|
|
2557
2637
|
/**
|
|
2558
|
-
* Who holds a
|
|
2638
|
+
* Who holds a station. World defaults to 0. Null for an unknown station.
|
|
2559
2639
|
*/
|
|
2560
2640
|
occupancy(stationId: string, virtualWorld?: number): CraftStationOccupancy | null;
|
|
2561
2641
|
|
|
2562
2642
|
/**
|
|
2563
|
-
* Ends the player's session as leaving the
|
|
2643
|
+
* 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
2644
|
*/
|
|
2565
2645
|
cancel(player: Player): boolean;
|
|
2566
2646
|
|
|
@@ -3464,6 +3544,54 @@ declare global {
|
|
|
3464
3544
|
*/
|
|
3465
3545
|
toString(): string;
|
|
3466
3546
|
|
|
3547
|
+
/**
|
|
3548
|
+
* Checks whether this NPC's nametag is drawn; the same switch as the `nametag` property.
|
|
3549
|
+
* @returns True while the nametag is shown.
|
|
3550
|
+
*/
|
|
3551
|
+
isNametagVisible(): boolean;
|
|
3552
|
+
|
|
3553
|
+
/**
|
|
3554
|
+
* 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.
|
|
3555
|
+
* @param visible True to draw this NPC's nametag for every player, false to hide it.
|
|
3556
|
+
*/
|
|
3557
|
+
setNametagVisible(visible: boolean): void;
|
|
3558
|
+
|
|
3559
|
+
/**
|
|
3560
|
+
* Checks whether the health bar under this NPC's nametag is shown.
|
|
3561
|
+
* @returns True unless the health bar was hidden.
|
|
3562
|
+
*/
|
|
3563
|
+
isNametagHealthVisible(): boolean;
|
|
3564
|
+
|
|
3565
|
+
/**
|
|
3566
|
+
* Shows or hides the health bar under this NPC's nametag, leaving the name itself alone.
|
|
3567
|
+
* @param visible True to show the health bar under this NPC's name, false to hide it.
|
|
3568
|
+
*/
|
|
3569
|
+
setNametagHealthVisible(visible: boolean): void;
|
|
3570
|
+
|
|
3571
|
+
/**
|
|
3572
|
+
* Reads this NPC's nametag text override.
|
|
3573
|
+
* @returns The override, or an empty string when the NPC's `name` is drawn.
|
|
3574
|
+
*/
|
|
3575
|
+
getNametagText(): string;
|
|
3576
|
+
|
|
3577
|
+
/**
|
|
3578
|
+
* Overrides the text drawn on this NPC's nametag without renaming it: `name` still reaches conversation and the soul.
|
|
3579
|
+
* @param text Text to show instead of the NPC's name; empty or omitted restores the name.
|
|
3580
|
+
*/
|
|
3581
|
+
setNametagText(text?: string): void;
|
|
3582
|
+
|
|
3583
|
+
/**
|
|
3584
|
+
* Reads this NPC's nametag color.
|
|
3585
|
+
* @returns Packed 0xAARRGGBB color; opaque white when untinted.
|
|
3586
|
+
*/
|
|
3587
|
+
getNametagColor(): number;
|
|
3588
|
+
|
|
3589
|
+
/**
|
|
3590
|
+
* Tints the text on this NPC's nametag.
|
|
3591
|
+
* @param color Packed 0xAARRGGBB color.
|
|
3592
|
+
*/
|
|
3593
|
+
setNametagColor(color: number): void;
|
|
3594
|
+
|
|
3467
3595
|
/**
|
|
3468
3596
|
* Despawns this NPC everywhere, after emitting npcDestroy.
|
|
3469
3597
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kingdomsconnected/types",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.5",
|
|
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": [
|