@modlock/modlock 0.1.75 → 0.1.76

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/package.json CHANGED
@@ -7,11 +7,11 @@
7
7
  "license": "MIT",
8
8
  "name": "@modlock/modlock",
9
9
  "optionalDependencies": {
10
- "@modlock/darwin-arm64": "0.1.75",
11
- "@modlock/darwin-x64": "0.1.75",
12
- "@modlock/linux-arm64": "0.1.75",
13
- "@modlock/linux-x64": "0.1.75",
14
- "@modlock/win32-x64": "0.1.75"
10
+ "@modlock/darwin-arm64": "0.1.76",
11
+ "@modlock/darwin-x64": "0.1.76",
12
+ "@modlock/linux-arm64": "0.1.76",
13
+ "@modlock/linux-x64": "0.1.76",
14
+ "@modlock/win32-x64": "0.1.76"
15
15
  },
16
16
  "repository": {
17
17
  "type": "git",
@@ -20,5 +20,5 @@
20
20
  "sideEffects": false,
21
21
  "type": "module",
22
22
  "types": "index.d.ts",
23
- "version": "0.1.75"
23
+ "version": "0.1.76"
24
24
  }
package/ui.d.ts CHANGED
@@ -162,10 +162,13 @@ export interface Style {
162
162
  * the crosshair, 'souls' the souls and level readout, 'minimap' the minimap
163
163
  * with its hints and district name, 'abilities' the ability and active item
164
164
  * bar, 'status' the game's mark in the top-left corner, 'stats' the weapon,
165
- * spirit and vitality stats at the lower left. Whatever a part does not name
166
- * stays, such as the crosshair and chat.
165
+ * spirit and vitality stats at the lower left, 'heroPicker' the screen a
166
+ * player without a hero picks one on, 'brokerCountdown' the countdown in the
167
+ * Broker's window, and 'all' the whole HUD but the mods' own interfaces and
168
+ * the game's tooltips, for a screen that takes the player's whole view.
169
+ * Whatever a part does not name stays, such as the crosshair and chat.
167
170
  */
168
- export type HudPart = 'levelUp' | 'ownHealth' | 'topBar' | 'ammo' | 'souls' | 'minimap' | 'abilities' | 'status' | 'stats';
171
+ export type HudPart = 'levelUp' | 'ownHealth' | 'topBar' | 'ammo' | 'souls' | 'minimap' | 'abilities' | 'status' | 'stats' | 'heroPicker' | 'brokerCountdown' | 'all';
169
172
  /** Child is anything an element may hold. Text becomes a label. */
170
173
  export type Child = UiElement | string | number | boolean | null | undefined | readonly Child[];
171
174
  /** Component returns the elements that stand for its props. */
@@ -199,6 +202,7 @@ export interface Props {
199
202
  readonly hover?: Style;
200
203
  readonly tooltip?: string;
201
204
  readonly item?: string;
205
+ readonly ability?: AbilityTip;
202
206
  readonly hoverSound?: string;
203
207
  readonly children?: Child;
204
208
  readonly src?: string;
@@ -231,8 +235,9 @@ export interface Props {
231
235
  * ElementProps are the props every drawn element takes. hover is the style
232
236
  * drawn over style while the pointer is over the element; tooltip is the text
233
237
  * the game's tooltip shows then, item names an item by class name, such as
234
- * 'upgrade_ability_power_shard', whose shop card shows instead, and
235
- * hoverSound is the game's sound event played as the pointer enters, such as
238
+ * 'upgrade_ability_power_shard', whose shop card shows instead, ability names
239
+ * an ability whose window shows instead of either, and hoverSound is the
240
+ * game's sound event played as the pointer enters, such as
236
241
  * 'UI.MainMenu.Hover'. An element with any of them takes the pointer, so the
237
242
  * game behind it does not.
238
243
  */
@@ -243,6 +248,7 @@ export interface ElementProps {
243
248
  hover?: Style;
244
249
  tooltip?: string;
245
250
  item?: string;
251
+ ability?: AbilityTip;
246
252
  hoverSound?: string;
247
253
  /** enter is the style the element's panel starts from when it first shows. */
248
254
  enter?: Style;
@@ -251,6 +257,16 @@ export interface ElementProps {
251
257
  /** cycle swings the element to another style and back while it shows. */
252
258
  cycle?: Cycle;
253
259
  }
260
+ /**
261
+ * AbilityTip is the game's own window for an ability, in the player's
262
+ * language: name is the ability's class name, such as 'ability_bebop_hook',
263
+ * and player is whose hero the window reads its numbers from, a hero that
264
+ * stands on the map, such as a bot that plays it.
265
+ */
266
+ export interface AbilityTip {
267
+ readonly name: string;
268
+ readonly player: Player;
269
+ }
254
270
  /**
255
271
  * Cycle swings an element from its style to style and back, each way taking
256
272
  * seconds, count times or, without a count, while it shows.
@@ -422,6 +438,47 @@ export declare function hideHud(player: Player, parts: readonly HudPart[]): bool
422
438
  * fire a weapon calls player.blockInput for the buttons it takes.
423
439
  */
424
440
  export declare function freeCursor(player: Player, free: boolean): boolean;
441
+ /** AbilityBarHandler takes a click on the ability in slot, 0 to 3. */
442
+ export type AbilityBarHandler = (player: Player, slot: number) => void;
443
+ /**
444
+ * abilityBarPresses calls onPress with the slot, 0 to 3, each time player
445
+ * clicks the icon or upgrade pips of an ability on the game's own ability bar,
446
+ * as the game does when it trains one with Tab held; without onPress the
447
+ * clicks stop reaching the mod. The game answers a click from the hero's own
448
+ * abilities, and sends nothing for an ability replaceAbility gave, so a mod
449
+ * that replaces abilities answers here, with trainAbility. A click the game
450
+ * answers itself, with upgrade_ability, reaches the mod both ways. Clicks
451
+ * reach the mod only while its screen holds the player's HUD: a player who
452
+ * left, or whose session ended, sends none.
453
+ */
454
+ export declare function abilityBarPresses(player: Player, onPress?: AbilityBarHandler): boolean;
455
+ /** ShownAbility is the ability abilityDisplay shows in one slot. */
456
+ export interface ShownAbility {
457
+ /** name is the ability's class name, whose window the game shows over it. */
458
+ readonly name: string;
459
+ /** image is its picture, a path in the game's content as an image's src. */
460
+ readonly image: string;
461
+ /** upgrades holds its bought tiers as Ability.upgrades: bit 0 unlocks it. */
462
+ readonly upgrades?: number;
463
+ }
464
+ /** AbilityRow is the four abilities, in slot order, shown for one player. */
465
+ export interface AbilityRow {
466
+ readonly player: Player;
467
+ /** abilities holds slots 0 to 3; an undefined slot shows the game's own. */
468
+ readonly abilities: readonly (ShownAbility | undefined)[];
469
+ }
470
+ /**
471
+ * abilityDisplay shows viewer each row's abilities in place of the ones the
472
+ * game shows for that player's hero: on the player's row of the game's Tab
473
+ * screen, and for viewer's own row on viewer's ability bar too, in the game's
474
+ * frame, ring and pips, with the game's ability window over each. The game
475
+ * draws these from the hero's standard abilities, so one replaceAbility gave
476
+ * shows as the ability it replaced. Without rows the game's own come back,
477
+ * as they do when viewer leaves or the session ends. Rows match the Tab
478
+ * screen's by the player's name and else by the hero's, which a bot's row
479
+ * shows, so each row's player should have a hero.
480
+ */
481
+ export declare function abilityDisplay(viewer: Player, rows?: readonly AbilityRow[]): boolean;
425
482
  /**
426
483
  * cursorFree reports whether player's mouse cursor is up now, whether the mod
427
484
  * freed it with freeCursor or the player did with the game's own keys. It is
@@ -452,6 +509,15 @@ export declare function hide(player: Player): boolean;
452
509
  * Notices stack, newest last, slide in, and fade as they expire.
453
510
  */
454
511
  export declare function toast(player: Player, text: string, seconds?: number): boolean;
512
+ /**
513
+ * uiSound plays the game's sound event sound, such as 'UI.ItemDraft.Start', in
514
+ * player's game alone, once; seconds cuts it after that long, keeping only its
515
+ * start. It plays with the next screen the player reads, and not at all if
516
+ * the player reads it only after the mod's next few sounds.
517
+ */
518
+ export declare function uiSound(player: Player, sound: string, options?: {
519
+ readonly seconds?: number;
520
+ }): boolean;
455
521
  /** press runs the handler of the button the player pressed. */
456
522
  export declare function press(player: Player, node: string): void;
457
523
  /**