@modlock/modlock 0.1.69 → 0.1.71

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/host.gen.d.ts CHANGED
@@ -1029,7 +1029,15 @@ export interface HeroTarget {
1029
1029
  * upgrades may grow while the restore runs.
1030
1030
  */
1031
1031
  fresh?: boolean;
1032
- /** level sets the hero's level. */
1032
+ /**
1033
+ * level sets the hero's level, and its souls to what that level needs. The
1034
+ * game raises a level once the hero's souls pass the next one and never
1035
+ * lowers one, so a level held with other souls would change within a
1036
+ * second. A hero with more souls than the level's band loses them, from its
1037
+ * wallet first; one with fewer gains wallet souls. A hero whose souls
1038
+ * already fit the level keeps them, and the restore fails if they cannot be
1039
+ * moved there.
1040
+ */
1033
1041
  level?: number;
1034
1042
  /**
1035
1043
  * health and maxHealth set the hero's health and its base maximum. Both
package/index.d.ts CHANGED
@@ -23,7 +23,7 @@ export { type HeroSnapshot, restoreHero } from './restore.js';
23
23
  export { type ReplayedHit, replayDamage } from './replayed-damage.js';
24
24
  export { type CatalogEntry, Dropper, dropperButtons } from './dropper.js';
25
25
  export { decodeSpot, encodeSpot, LoadedSpot, loadSpot, type Placed, type Spot, type SpotObject, triggers, } from './spot.js';
26
- export { type ButtonProps, type Child, type Component, type Edges, type ElementProps, Fragment, type Gradient, type HeroLookName, type HeroProps, hide, hideHud, freeCursor, type HudPart, type ImageProps, type JSX, jsx, jsxs, type LabelProps, type LayoutProps, type Length, type Overflow, type PanelProps, route, type Scaling, type Shadow, sheet, show, type Style, toast, type Transition, type UiElement, } from './ui.js';
26
+ export { type ButtonProps, type Child, type Component, type Edges, type ElementProps, Fragment, type Gradient, type HeroLookName, type HeroProps, hide, hideHud, cursorFree, freeCursor, type HudPart, type ImageProps, type JSX, jsx, jsxs, type LabelProps, type LayoutProps, type Length, type Overflow, type PanelProps, route, type Scaling, type Shadow, sheet, show, type Style, toast, type Transition, type UiElement, } from './ui.js';
27
27
  /** LogPart is a value log writes as text. */
28
28
  export type LogPart = string | number | bigint | boolean | null | undefined;
29
29
  /**
package/index.js CHANGED
@@ -10001,7 +10001,8 @@ var HudPart_Enum = /* @__PURE__ */ createEnumType(
10001
10001
  [5, "HUD_PART_SOULS"],
10002
10002
  [6, "HUD_PART_MINIMAP"],
10003
10003
  [7, "HUD_PART_ABILITIES"],
10004
- [8, "HUD_PART_STATUS"]
10004
+ [8, "HUD_PART_STATUS"],
10005
+ [9, "HUD_PART_STATS"]
10005
10006
  ]
10006
10007
  );
10007
10008
  var Kind_Enum = /* @__PURE__ */ createEnumType(
@@ -10138,7 +10139,8 @@ var Node = /* @__PURE__ */ createMessageType(
10138
10139
  [29, "classes", 9, 1],
10139
10140
  [30, "sheets", 9, 1],
10140
10141
  [31, "free_cursor", 8],
10141
- [32, "item", 13]
10142
+ [32, "item", 13],
10143
+ [33, "free_cursor_asks", 13]
10142
10144
  ],
10143
10145
  {
10144
10146
  decode: (r, end, m) => {
@@ -10282,6 +10284,9 @@ var Node = /* @__PURE__ */ createMessageType(
10282
10284
  case 32:
10283
10285
  m.item = r.uint32();
10284
10286
  break;
10287
+ case 33:
10288
+ m.freeCursorAsks = r.uint32();
10289
+ break;
10285
10290
  default:
10286
10291
  r.skip(t);
10287
10292
  }
@@ -10431,6 +10436,10 @@ var Node = /* @__PURE__ */ createMessageType(
10431
10436
  const v = m.item;
10432
10437
  if (v) w.uint32(256).uint32(v);
10433
10438
  }
10439
+ {
10440
+ const v = m.freeCursorAsks;
10441
+ if (v) w.uint32(264).uint32(v);
10442
+ }
10434
10443
  }
10435
10444
  }
10436
10445
  );
@@ -13523,9 +13532,24 @@ function hideHud(player, parts) {
13523
13532
  return draw(player);
13524
13533
  }
13525
13534
  function freeCursor(player, free) {
13526
- views.set(player.slot, { ...view(player), cursor: free });
13535
+ const current = view(player);
13536
+ views.set(player.slot, {
13537
+ ...current,
13538
+ cursor: free,
13539
+ asks: free ? current.asks + 1 : current.asks
13540
+ });
13527
13541
  return draw(player);
13528
13542
  }
13543
+ function cursorFree(player) {
13544
+ const pawn = player.pawn();
13545
+ if (pawn === void 0) return void 0;
13546
+ return readField(
13547
+ pawn.entity,
13548
+ "CCitadelPlayer_MovementServices",
13549
+ "m_bHasFreeCursor",
13550
+ "bool"
13551
+ );
13552
+ }
13529
13553
  function sheet(path) {
13530
13554
  if (!path.endsWith(".css") || !path.split("/").every((part) => sheetPart.test(part) && part !== "..")) {
13531
13555
  return false;
@@ -13611,6 +13635,7 @@ function view(player) {
13611
13635
  root: void 0,
13612
13636
  hud: [],
13613
13637
  cursor: false,
13638
+ asks: 0,
13614
13639
  routes: /* @__PURE__ */ new Map(),
13615
13640
  notices: []
13616
13641
  };
@@ -13623,10 +13648,24 @@ function draw(player) {
13623
13648
  ];
13624
13649
  const previous = screens.get(player.slot);
13625
13650
  const hud = current.hud.map((part) => hudParts[part]);
13626
- const next = render(previous, root, hud, current.cursor, current.routes);
13651
+ const next = render(
13652
+ previous,
13653
+ root,
13654
+ hud,
13655
+ current.cursor,
13656
+ current.asks,
13657
+ current.routes
13658
+ );
13627
13659
  const change2 = diff(previous, next);
13628
13660
  if (change2 && !send(player.slot, change2)) {
13629
- const whole = render(void 0, root, hud, current.cursor, current.routes);
13661
+ const whole = render(
13662
+ void 0,
13663
+ root,
13664
+ hud,
13665
+ current.cursor,
13666
+ current.asks,
13667
+ current.routes
13668
+ );
13630
13669
  if (!send(player.slot, diff(void 0, whole))) {
13631
13670
  screens.delete(player.slot);
13632
13671
  return false;
@@ -13671,7 +13710,7 @@ function notices(stack) {
13671
13710
  return jsx("panel", { style, exit: noticeMotion.exit, children: labels });
13672
13711
  }
13673
13712
  var screens = /* @__PURE__ */ new Map();
13674
- function render(previous, root, hud, cursor, routes) {
13713
+ function render(previous, root, hud, cursor, asks, routes) {
13675
13714
  const layout = new Layout(previous);
13676
13715
  layout.add({
13677
13716
  id: "",
@@ -13679,6 +13718,7 @@ function render(previous, root, hud, cursor, routes) {
13679
13718
  children: place(layout, root, "/"),
13680
13719
  hideHud: [...hud],
13681
13720
  freeCursor: cursor,
13721
+ freeCursorAsks: asks,
13682
13722
  sheets: [...sheets]
13683
13723
  });
13684
13724
  for (const [name, data] of routes) {
@@ -13925,7 +13965,8 @@ var hudParts = {
13925
13965
  souls: 5 /* SOULS */,
13926
13966
  minimap: 6 /* MINIMAP */,
13927
13967
  abilities: 7 /* ABILITIES */,
13928
- status: 8 /* STATUS */
13968
+ status: 8 /* STATUS */,
13969
+ stats: 9 /* STATS */
13929
13970
  };
13930
13971
  var faces = {
13931
13972
  body: 1 /* BODY */,
@@ -16824,6 +16865,7 @@ export {
16824
16865
  createParticle,
16825
16866
  createPickup,
16826
16867
  createText,
16868
+ cursorFree,
16827
16869
  curve_exports as curve,
16828
16870
  damage,
16829
16871
  decodeSpot,
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.69",
11
- "@modlock/darwin-x64": "0.1.69",
12
- "@modlock/linux-arm64": "0.1.69",
13
- "@modlock/linux-x64": "0.1.69",
14
- "@modlock/win32-x64": "0.1.69"
10
+ "@modlock/darwin-arm64": "0.1.71",
11
+ "@modlock/darwin-x64": "0.1.71",
12
+ "@modlock/linux-arm64": "0.1.71",
13
+ "@modlock/linux-x64": "0.1.71",
14
+ "@modlock/win32-x64": "0.1.71"
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.69"
23
+ "version": "0.1.71"
24
24
  }
package/restore.d.ts CHANGED
@@ -11,11 +11,17 @@ export interface HeroSnapshot {
11
11
  /** health and maxHealth are the hero's health and its base maximum. */
12
12
  health: number;
13
13
  maxHealth: number;
14
- /** level is the hero's level. */
14
+ /**
15
+ * level is the hero's level. The restore also sets the hero's souls to what
16
+ * the level needs, since the game raises a level its souls pass and never
17
+ * lowers one: a richer hero loses souls, from its wallet first, and a poorer
18
+ * one gains them.
19
+ */
15
20
  level?: number;
16
21
  /**
17
22
  * souls is the souls the hero holds unspent, once the build is in place.
18
- * The build a snapshot lists is not paid for from them.
23
+ * The build a snapshot lists is not paid for from them. They are set after
24
+ * the level, so souls past the level's band raise the level again.
19
25
  */
20
26
  souls?: number;
21
27
  /** upgradeBonuses are the three stat bonuses purchases add. */
package/ui.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Player, Wheel } from './host.gen.js';
1
+ import { type Player, type Wheel } from './host.gen.js';
2
2
  /**
3
3
  * Length is a size: pixels, a percentage of the parent, 'fit' to size to the
4
4
  * children, or 'fill' to share the space left in the parent's flow.
@@ -161,9 +161,11 @@ export interface Style {
161
161
  * and clock across the top, 'ammo' the clip ring, count and ammo warnings at
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
- * bar. Whatever a part does not name stays, such as the crosshair and chat.
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
167
  */
166
- export type HudPart = 'levelUp' | 'ownHealth' | 'topBar' | 'ammo' | 'souls' | 'minimap' | 'abilities' | 'status';
168
+ export type HudPart = 'levelUp' | 'ownHealth' | 'topBar' | 'ammo' | 'souls' | 'minimap' | 'abilities' | 'status' | 'stats';
167
169
  /** Child is anything an element may hold. Text becomes a label. */
168
170
  export type Child = UiElement | string | number | boolean | null | undefined | readonly Child[];
169
171
  /** Component returns the elements that stand for its props. */
@@ -413,9 +415,19 @@ export declare function hideHud(player: Player, parts: readonly HudPart[]): bool
413
415
  /**
414
416
  * freeCursor shows player's mouse cursor without Tab held while free is true,
415
417
  * so they can click the mod's panels, such as a pick screen; false gives the
416
- * mouse back to aiming.
418
+ * mouse back to aiming. Each call with true shows the cursor again, even when
419
+ * the player put it away with the game's own keys; a screen that changes
420
+ * without a call leaves their choice be. The game does not stop the player's
421
+ * shots, camera or movement while the cursor is up: a screen that must not
422
+ * fire a weapon calls player.blockInput for the buttons it takes.
417
423
  */
418
424
  export declare function freeCursor(player: Player, free: boolean): boolean;
425
+ /**
426
+ * cursorFree reports whether player's mouse cursor is up now, whether the mod
427
+ * freed it with freeCursor or the player did with the game's own keys. It is
428
+ * undefined while the player has no hero to read.
429
+ */
430
+ export declare function cursorFree(player: Player): boolean | undefined;
419
431
  /**
420
432
  * sheet adds the style sheet at path in the mod's content styles directory,
421
433
  * such as 'hud.css', to every interface the mod shows, after the sheets added