@kingdomsconnected/types 1.5.5 → 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.
@@ -909,6 +909,8 @@ declare global {
909
909
 
910
910
  /**
911
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.
912
914
  */
913
915
  const Hud: {
914
916
  /**
@@ -1022,21 +1024,127 @@ declare global {
1022
1024
  clearNotifications(): boolean;
1023
1025
 
1024
1026
  /**
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.
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.
1026
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.
1027
1029
  * @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.
1030
+ * @returns True when the request is retained; application waits for the native HUD when it is not ready yet.
1029
1031
  */
1030
1032
  setElementVisible(element: string, visible: boolean): boolean;
1031
1033
 
1032
1034
  /**
1033
- * Whether one element's switch is on. An element whose switch is on can still be hidden by the game at that moment.
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.
1034
1036
  * @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.
1037
+ * @returns True while multiplayer allows the element to show.
1036
1038
  */
1037
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;
1038
1091
  };
1039
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
+
1040
1148
  /**
1041
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.
1042
1150
  */
@@ -194,6 +194,16 @@ declare global {
194
194
  */
195
195
  playerPickpocketCaught: [thief: Player, victim: Player];
196
196
 
197
+ /**
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
+
197
207
  /**
198
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
  */
@@ -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 they regrow; nothing about them survives a restart.
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
 
@@ -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
 
@@ -2145,6 +2155,46 @@ declare global {
2145
2155
  amount: number;
2146
2156
  }
2147
2157
 
2158
+ /**
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
+
2148
2198
  /**
2149
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.
2150
2200
  */
@@ -4022,6 +4072,60 @@ declare global {
4022
4072
 
4023
4073
  interface GroundItem extends Entity {}
4024
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
+
4025
4129
  /**
4026
4130
  * A plant a player picked and what it is about to give them.
4027
4131
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kingdomsconnected/types",
3
- "version": "1.5.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": [