@modlock/modlock 0.1.88 → 0.1.90

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/index.js CHANGED
@@ -16106,23 +16106,22 @@ var Entry = class {
16106
16106
  constructor(delay, run) {
16107
16107
  this.delay = delay;
16108
16108
  this.run = run;
16109
- this.at = now === void 0 ? void 0 : now + delay;
16110
16109
  }
16111
16110
  delay;
16112
16111
  run;
16113
16112
  finished = false;
16114
- /** at is the game time the entry next runs, unset until the clock is known. */
16115
- at;
16116
- /** start counts the first delay from the frame at seconds, once. */
16117
- start(seconds) {
16118
- this.at ??= seconds + this.delay;
16119
- }
16113
+ /** at is the game time the entry next runs. */
16114
+ at = 0;
16115
+ /** order breaks ties in at, so timers due together run in schedule order. */
16116
+ order = 0;
16120
16117
  cancel() {
16121
16118
  this.finished = true;
16122
16119
  }
16123
16120
  };
16124
16121
  var now;
16125
- var entries = [];
16122
+ var waiting2 = [];
16123
+ var heap = [];
16124
+ var scheduled = 0;
16126
16125
  function after(seconds, fn) {
16127
16126
  return schedule(seconds, () => {
16128
16127
  fn();
@@ -16141,23 +16140,34 @@ function sequence(fn) {
16141
16140
  }
16142
16141
  function schedule(delay, run) {
16143
16142
  const entry2 = new Entry(delay, run);
16144
- entries.push(entry2);
16143
+ if (now === void 0) {
16144
+ waiting2.push(entry2);
16145
+ } else {
16146
+ push(entry2, now + delay);
16147
+ }
16145
16148
  return entry2;
16146
16149
  }
16147
16150
  function advance(seconds) {
16148
16151
  if (now !== void 0 && seconds < now) {
16149
16152
  const shift = seconds - now;
16150
- for (const entry2 of entries) {
16151
- if (entry2.at !== void 0) {
16152
- entry2.at += shift;
16153
- }
16153
+ for (const entry2 of heap) {
16154
+ entry2.at += shift;
16154
16155
  }
16155
16156
  }
16156
16157
  now = seconds;
16157
- for (const entry2 of entries) {
16158
- entry2.start(seconds);
16158
+ if (waiting2.length !== 0) {
16159
+ for (const entry2 of waiting2) {
16160
+ push(entry2, seconds + entry2.delay);
16161
+ }
16162
+ waiting2 = [];
16163
+ }
16164
+ const due = [];
16165
+ for (let top = heap[0]; top !== void 0 && top.at <= seconds; top = heap[0]) {
16166
+ pop();
16167
+ if (!top.finished) {
16168
+ due.push(top);
16169
+ }
16159
16170
  }
16160
- const due = entries.filter((entry2) => !entry2.finished && entry2.at <= seconds).sort((a, b) => a.at - b.at);
16161
16171
  for (const entry2 of due) {
16162
16172
  if (entry2.finished) {
16163
16173
  continue;
@@ -16166,20 +16176,60 @@ function advance(seconds) {
16166
16176
  const wait = entry2.run();
16167
16177
  if (wait === void 0) {
16168
16178
  entry2.finished = true;
16169
- } else {
16179
+ } else if (!entry2.finished) {
16170
16180
  const next = entry2.at + wait;
16171
- entry2.at = next > seconds ? next : seconds + wait;
16181
+ push(entry2, next > seconds ? next : seconds + wait);
16172
16182
  }
16173
16183
  } catch (error) {
16174
16184
  entry2.finished = true;
16175
16185
  log(`timer failed: ${String(error)}`);
16176
16186
  }
16177
16187
  }
16178
- entries = entries.filter((entry2) => !entry2.finished);
16188
+ }
16189
+ function push(entry2, at3) {
16190
+ entry2.at = at3;
16191
+ entry2.order = scheduled++;
16192
+ heap.push(entry2);
16193
+ let index = heap.length - 1;
16194
+ for (; ; ) {
16195
+ const parent = index - 1 >> 1;
16196
+ const above = heap[parent];
16197
+ if (index === 0 || above === void 0 || !before(entry2, above)) {
16198
+ break;
16199
+ }
16200
+ heap[index] = above;
16201
+ index = parent;
16202
+ }
16203
+ heap[index] = entry2;
16204
+ }
16205
+ function pop() {
16206
+ const last = heap.pop();
16207
+ if (last === void 0 || heap.length === 0) {
16208
+ return;
16209
+ }
16210
+ let index = 0;
16211
+ for (; ; ) {
16212
+ let child = 2 * index + 1;
16213
+ let below = heap[child];
16214
+ const right = heap[child + 1];
16215
+ if (below !== void 0 && right !== void 0 && before(right, below)) {
16216
+ child++;
16217
+ below = right;
16218
+ }
16219
+ if (below === void 0 || !before(below, last)) {
16220
+ break;
16221
+ }
16222
+ heap[index] = below;
16223
+ index = child;
16224
+ }
16225
+ heap[index] = last;
16226
+ }
16227
+ function before(a, b) {
16228
+ return a.at < b.at || a.at === b.at && a.order < b.order;
16179
16229
  }
16180
16230
 
16181
16231
  // js/src/service-later.ts
16182
- var waiting2 = /* @__PURE__ */ new Map();
16232
+ var waiting3 = /* @__PURE__ */ new Map();
16183
16233
  function callServiceLater(service3, method, payload, done, timeoutMilliseconds = 0) {
16184
16234
  const call2 = startServiceCall(service3, method, payload, timeoutMilliseconds);
16185
16235
  if (call2 === void 0) {
@@ -16193,14 +16243,14 @@ function callServiceLater(service3, method, payload, done, timeoutMilliseconds =
16193
16243
  );
16194
16244
  return;
16195
16245
  }
16196
- waiting2.set(call2, done);
16246
+ waiting3.set(call2, done);
16197
16247
  }
16198
16248
  function endServiceCall(event) {
16199
- const done = waiting2.get(event.call);
16249
+ const done = waiting3.get(event.call);
16200
16250
  if (!done) {
16201
16251
  return;
16202
16252
  }
16203
- waiting2.delete(event.call);
16253
+ waiting3.delete(event.call);
16204
16254
  if (event.failure && event.failure !== "none") {
16205
16255
  done(void 0, event.error, event.failure);
16206
16256
  return;
@@ -16208,1973 +16258,2270 @@ function endServiceCall(event) {
16208
16258
  done(event.payload);
16209
16259
  }
16210
16260
 
16211
- // js/src/item-id.ts
16212
- function itemId(name) {
16213
- const m = 1540483477;
16214
- const data = new TextEncoder().encode(name);
16215
- const byte = (at3) => data[at3] ?? 0;
16216
- let h = (826366246 ^ data.length) >>> 0;
16217
- let i = 0;
16218
- for (; data.length - i >= 4; i += 4) {
16219
- let k = (byte(i) | byte(i + 1) << 8 | byte(i + 2) << 16 | byte(i + 3) << 24) >>> 0;
16220
- k = Math.imul(k, m) >>> 0;
16221
- k = (k ^ k >>> 24) >>> 0;
16222
- k = Math.imul(k, m) >>> 0;
16223
- h = Math.imul(h, m) >>> 0;
16224
- h = (h ^ k) >>> 0;
16225
- }
16226
- const rest = data.length - i;
16227
- if (rest >= 3) h = (h ^ byte(i + 2) << 16) >>> 0;
16228
- if (rest >= 2) h = (h ^ byte(i + 1) << 8) >>> 0;
16229
- if (rest >= 1) {
16230
- h = (h ^ byte(i)) >>> 0;
16231
- h = Math.imul(h, m) >>> 0;
16232
- }
16233
- h = (h ^ h >>> 13) >>> 0;
16234
- h = Math.imul(h, m) >>> 0;
16235
- return (h ^ h >>> 15) >>> 0;
16261
+ // js/src/format.ts
16262
+ var format_exports = {};
16263
+ __export(format_exports, {
16264
+ clip: () => clip,
16265
+ clock: () => clock,
16266
+ count: () => count,
16267
+ grouped: () => grouped,
16268
+ ordinal: () => ordinal,
16269
+ percent: () => percent,
16270
+ stopwatch: () => stopwatch
16271
+ });
16272
+ function clock(seconds) {
16273
+ const whole = Math.max(0, Math.ceil(seconds));
16274
+ return `${Math.floor(whole / 60)}:${String(whole % 60).padStart(2, "0")}`;
16236
16275
  }
16237
-
16238
- // js/src/ui.ts
16239
- function jsx(type, props, key) {
16240
- const named = key === void 0 ? void 0 : String(key);
16241
- if (typeof type === "function") {
16242
- return { type: fragment, props: { children: type(props) }, key: named };
16243
- }
16244
- return { type, props, key: named };
16276
+ function stopwatch(seconds) {
16277
+ const hundredths = Math.max(0, Math.floor(seconds * 100));
16278
+ const minutes = Math.floor(hundredths / 6e3);
16279
+ const rest = hundredths % 6e3 / 100;
16280
+ return `${minutes}:${rest.toFixed(2).padStart(5, "0")}`;
16245
16281
  }
16246
- var fragment = "fragment";
16247
- var jsxs = jsx;
16248
- function Fragment(props) {
16249
- return props.children;
16282
+ function percent(part, whole) {
16283
+ if (!(whole > 0)) {
16284
+ return "-";
16285
+ }
16286
+ return `${Math.round(Math.max(0, Math.min(part / whole, 1)) * 100)}%`;
16250
16287
  }
16251
- function show(player, root) {
16252
- views.set(player.slot, { ...view(player), root });
16253
- return draw(player);
16288
+ function grouped(value) {
16289
+ return String(Math.round(value)).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
16254
16290
  }
16255
- function hideHud(player, parts) {
16256
- views.set(player.slot, { ...view(player), hud: parts });
16257
- return draw(player);
16291
+ function ordinal(place2) {
16292
+ const tens = place2 % 100;
16293
+ const suffix = tens >= 11 && tens <= 13 ? "th" : ["th", "st", "nd", "rd"][place2 % 10] ?? "th";
16294
+ return `${place2}${suffix}`;
16258
16295
  }
16259
- function freeCursor(player, free) {
16260
- const current = view(player);
16261
- views.set(player.slot, {
16262
- ...current,
16263
- cursor: free,
16264
- asks: free ? current.asks + 1 : current.asks
16265
- });
16266
- return draw(player);
16296
+ function count(number, thing, plural = `${thing}s`) {
16297
+ return `${grouped(number)} ${number === 1 ? thing : plural}`;
16267
16298
  }
16268
- function abilityBarPresses(player, onPress) {
16269
- views.set(player.slot, {
16270
- ...view(player),
16271
- bar: onPress ? { handler: onPress } : void 0
16272
- });
16273
- return draw(player);
16299
+ function clip(text2, width) {
16300
+ if (text2.length <= width) return text2;
16301
+ const cut = text2.slice(0, width - 1);
16302
+ const space = cut.lastIndexOf(" ");
16303
+ return `${(space > 0 ? cut.slice(0, space) : cut).trimEnd()}\u2026`;
16274
16304
  }
16275
- function abilityDisplay(viewer, rows = []) {
16276
- views.set(viewer.slot, { ...view(viewer), display: rows.slice(0, 64) });
16277
- return draw(viewer);
16305
+
16306
+ // js/src/theme.ts
16307
+ var theme_exports = {};
16308
+ __export(theme_exports, {
16309
+ emptyPip: () => emptyPip,
16310
+ fpsReadoutBottom: () => fpsReadoutBottom,
16311
+ motion: () => motion,
16312
+ objectiveBarBottom: () => objectiveBarBottom,
16313
+ pillEdge: () => pillEdge,
16314
+ pipRings: () => pipRings,
16315
+ pipShapes: () => pipShapes,
16316
+ plate: () => plate,
16317
+ shades: () => shades,
16318
+ sizes: () => sizes,
16319
+ sounds: () => sounds,
16320
+ teamBarBottom: () => teamBarBottom,
16321
+ teamTones: () => teamTones,
16322
+ tones: () => tones,
16323
+ types: () => types
16324
+ });
16325
+ var tones = {
16326
+ text: "#ffefd7",
16327
+ muted: "#bfb3a1",
16328
+ // The accent marks the player's own choices.
16329
+ accent: "#fd736d",
16330
+ // Text on an accent fill.
16331
+ onAccent: "#070709",
16332
+ amber: "#d4860b",
16333
+ sapphire: "#4d75c3",
16334
+ // The gas of a closing arena.
16335
+ gas: "#3ee08f",
16336
+ // Done, under par, ready and live: a step darker than gas, so status text
16337
+ // and tags sit calmer on the plates.
16338
+ success: "#36c47f",
16339
+ danger: "#ff410d",
16340
+ gold: "#ebc934"
16341
+ };
16342
+ var teamTones = {
16343
+ 2: "amber",
16344
+ 3: "sapphire"
16345
+ };
16346
+ var shades = {
16347
+ /** offWhite at about half strength: idle navigation and secondary text. */
16348
+ quiet: "#ffefd78c",
16349
+ /** offWhite at the popup button's 44%: idle pill borders. */
16350
+ faint: "#ffefd770",
16351
+ /** offWhite at about 40%: counts, placeholders and offline players. */
16352
+ dim: "#6b675d",
16353
+ /** offWhite at 13%: hairlines between sections and plate edges. */
16354
+ hairline: "#2b2a24",
16355
+ /** offBlack: text on light fills, and the backdrop's hue. */
16356
+ ink: "#10130d",
16357
+ /** The menu backdrop: an opaque offBlack that hides the stock menu. */
16358
+ backdrop: "#0b0d09",
16359
+ /** The backdrop at 95%, under a panel the player reads over the game. */
16360
+ veil: "#0b0d09f2",
16361
+ /** offWhite at 4%: a plate on the backdrop. */
16362
+ plate: "#151611",
16363
+ /** offWhite at 8%: a row or stat inside a plate. */
16364
+ raised: "#1e1f19",
16365
+ /** offWhite at 13%: a hovered or joined row. */
16366
+ lit: "#2b2a24",
16367
+ /** The full-strength fill of a lit primary button. */
16368
+ white: "#ffffff",
16369
+ /** No fill or border, where a state turns one off. */
16370
+ clear: "#00000000"
16371
+ };
16372
+ var sizes = {
16373
+ /** control is the height of panel buttons and fields. */
16374
+ control: 32,
16375
+ /** rowControl is the height of a button inside a list row. */
16376
+ rowControl: 28,
16377
+ /** row is the height of one list row. */
16378
+ row: 32,
16379
+ /** radius rounds buttons, fields and tags. */
16380
+ radius: 4,
16381
+ /** panelRadius rounds panels. */
16382
+ panelRadius: 8
16383
+ };
16384
+ var types = {
16385
+ display: { face: "block", size: 46, uppercase: true },
16386
+ title: { face: "block", size: 26, uppercase: true },
16387
+ body: { face: "body", size: 17, uppercase: false },
16388
+ label: { face: "block", size: 15, uppercase: true },
16389
+ caption: { face: "body", size: 14, uppercase: false }
16390
+ };
16391
+ var plate = {
16392
+ color: "#000000e0",
16393
+ radius: 5,
16394
+ /** padding is [vertical, horizontal] in pixels. */
16395
+ padding: [10, 18]
16396
+ };
16397
+ var pillEdge = "#ffefd71a";
16398
+ var pipShapes = {
16399
+ round: { width: 18, height: 18, radius: 9 },
16400
+ tick: { width: 7, height: 18, radius: 2 }
16401
+ };
16402
+ var pipRings = { empty: "#ffefd72e", filled: "#10130de6" };
16403
+ var emptyPip = "#00000000";
16404
+ var teamBarBottom = 84;
16405
+ var objectiveBarBottom = 220;
16406
+ var fpsReadoutBottom = 68;
16407
+ var sounds = {
16408
+ hover: "UI.MainMenu.Hover",
16409
+ press: "UI.MainMenu.Activate"
16410
+ };
16411
+ var motion = { hover: 0.15, meter: 0.25 };
16412
+
16413
+ // js/src/hud.ts
16414
+ function element(type, style, children, key) {
16415
+ return { type, props: { style, children }, key };
16278
16416
  }
16279
- function displayRows(viewer, rows) {
16280
- if (rows.length === 0) return [];
16281
- const names = new Map(players().map((c) => [c.player.slot, c.name]));
16282
- return rows.map((row2) => {
16283
- const hero = row2.player.pawn()?.hero;
16284
- return {
16285
- player: row2.player.slot,
16286
- // A Steam name is at most 32 characters, within the host's 128 bytes.
16287
- name: (names.get(row2.player.slot) ?? "").slice(0, 32),
16288
- hero: heroes.find((each) => each.id === hero)?.name ?? "",
16289
- own: row2.player.slot === viewer.slot,
16290
- abilities: row2.abilities.slice(0, 4).map((shown) => ({
16291
- ability: shown?.name ? itemId(shown.name) : 0,
16292
- image: shown?.image ?? "",
16293
- upgrades: shown?.upgrades ?? 0
16294
- }))
16295
- };
16296
- });
16417
+ function arriving(component, from) {
16418
+ return {
16419
+ ...component,
16420
+ props: {
16421
+ ...component.props,
16422
+ style: {
16423
+ transition: { seconds: 0.25, easing: "out" },
16424
+ ...component.props.style
16425
+ },
16426
+ enter: { opacity: 0, ...from },
16427
+ exit: { opacity: 0 }
16428
+ }
16429
+ };
16297
16430
  }
16298
- var abilityBarNode = /^ability:([0-3])$/;
16299
- function cursorFree(player) {
16300
- const pawn = player.pawn();
16301
- if (pawn === void 0) return void 0;
16302
- return readField(
16303
- pawn.entity,
16304
- "CCitadelPlayer_MovementServices",
16305
- "m_bHasFreeCursor",
16306
- "bool"
16431
+ function Text(props) {
16432
+ const type = types[props.role];
16433
+ return element(
16434
+ "label",
16435
+ {
16436
+ face: type.face,
16437
+ fontSize: type.size,
16438
+ uppercase: type.uppercase,
16439
+ shadow: !props.plated,
16440
+ color: tones[props.tone ?? (props.role === "label" ? "muted" : "text")],
16441
+ horizontalAlign: "center",
16442
+ textAlign: "center",
16443
+ ...props.style
16444
+ },
16445
+ props.children
16307
16446
  );
16308
16447
  }
16309
- function sheet(path) {
16310
- if (!path.endsWith(".css") || !path.split("/").every((part) => sheetPart.test(part) && part !== "..")) {
16311
- return false;
16312
- }
16313
- if (sheets.includes(path)) {
16314
- return true;
16315
- }
16316
- sheets.push(path);
16317
- for (const current of views.values()) {
16318
- draw(current.player);
16319
- }
16320
- return true;
16448
+ function Plate(props) {
16449
+ return element(
16450
+ "panel",
16451
+ {
16452
+ flow: props.flow ?? "down",
16453
+ horizontalAlign: "center",
16454
+ background: plate.color,
16455
+ borderRadius: plate.radius,
16456
+ padding: plate.padding,
16457
+ ...props.style
16458
+ },
16459
+ props.children
16460
+ );
16321
16461
  }
16322
- var sheetPart = /^[\w.-]+$/;
16323
- var sheets = [];
16324
- function route(player, name, value) {
16325
- const routes = new Map(view(player).routes);
16326
- const encoded = value === void 0 ? void 0 : JSON.stringify(value);
16327
- if (!routeName.test(name) || value !== void 0 && encoded === void 0) {
16328
- return false;
16329
- }
16330
- if (encoded === void 0) {
16331
- routes.delete(name);
16332
- } else {
16333
- routes.set(name, encoded);
16334
- }
16335
- views.set(player.slot, { ...view(player), routes });
16336
- return draw(player);
16462
+ function Pill(props) {
16463
+ return element(
16464
+ "panel",
16465
+ {
16466
+ flow: props.flow ?? "right",
16467
+ horizontalAlign: "center",
16468
+ background: plate.color,
16469
+ borderRadius: 50,
16470
+ borderWidth: 2,
16471
+ borderColor: pillEdge,
16472
+ padding: [3, 6],
16473
+ ...props.style
16474
+ },
16475
+ props.children
16476
+ );
16337
16477
  }
16338
- var routeName = /^[\w.-]+$/;
16339
- function hide(player) {
16340
- views.delete(player.slot);
16341
- screens.delete(player.slot);
16342
- return send(player.slot, { reset: true });
16478
+ function Pips(props) {
16479
+ const shape = pipShapes[props.shape ?? "round"];
16480
+ const lit = (index) => props.mirror ? index >= props.total - props.filled : index < props.filled;
16481
+ return element(
16482
+ "panel",
16483
+ { flow: "right", verticalAlign: "center", ...props.style },
16484
+ Array.from(
16485
+ { length: props.total },
16486
+ (_, index) => element(
16487
+ "panel",
16488
+ {
16489
+ width: shape.width,
16490
+ height: shape.height,
16491
+ borderRadius: shape.radius,
16492
+ margin: [0, 2],
16493
+ background: lit(index) ? tones[props.tone] : emptyPip,
16494
+ borderWidth: 2,
16495
+ borderColor: lit(index) ? pipRings.filled : pipRings.empty
16496
+ },
16497
+ void 0,
16498
+ `pip-${index}`
16499
+ )
16500
+ )
16501
+ );
16343
16502
  }
16344
- function toast(player, text2, seconds = 4) {
16345
- const current = view(player);
16346
- const notice = { id: nextNotice++, text: text2, until: now2 + seconds };
16347
- views.set(player.slot, {
16348
- ...current,
16349
- notices: [...current.notices, notice].slice(-maxNotices)
16503
+ function Tag(props) {
16504
+ const filled = props.fill === "filled";
16505
+ return element(
16506
+ "label",
16507
+ {
16508
+ face: "block",
16509
+ fontSize: 12,
16510
+ letterSpacing: 1,
16511
+ uppercase: true,
16512
+ color: filled ? tones.onAccent : tones[props.tone],
16513
+ background: filled ? tones[props.tone] : void 0,
16514
+ borderWidth: 1,
16515
+ borderColor: tones[props.tone],
16516
+ borderRadius: sizes.radius,
16517
+ padding: [4, 8],
16518
+ verticalAlign: "center",
16519
+ ...props.style
16520
+ },
16521
+ props.children
16522
+ );
16523
+ }
16524
+ function Banner(props) {
16525
+ const banner = element(
16526
+ "panel",
16527
+ {
16528
+ flow: "down",
16529
+ horizontalAlign: "center",
16530
+ margin: [20, 0, 0, 0],
16531
+ ...props.style
16532
+ },
16533
+ [
16534
+ Text({ role: "title", tone: props.tone, children: props.title }),
16535
+ props.detail && Text({ role: "caption", tone: "muted", children: props.detail })
16536
+ ]
16537
+ );
16538
+ return arriving(banner, { scale: 0.92 });
16539
+ }
16540
+ function TopStrip(props) {
16541
+ const block2 = [
16542
+ props.heading && Text({
16543
+ role: "label",
16544
+ style: { letterSpacing: 1 },
16545
+ children: props.heading
16546
+ }),
16547
+ Pill({ style: { margin: [4, 0, 0, 0] }, children: props.children })
16548
+ ];
16549
+ const line2 = props.line && Text({
16550
+ role: "label",
16551
+ tone: props.lineTone ?? "text",
16552
+ style: { margin: [4, 0, 0, 0], fontSize: 18, letterSpacing: 1 },
16553
+ children: props.line
16350
16554
  });
16351
- return draw(player);
16555
+ const column = (top, children) => element(
16556
+ "panel",
16557
+ { flow: "down", horizontalAlign: "center", margin: [top, 0, 0, 0] },
16558
+ children
16559
+ );
16560
+ if (!props.keepTeamBar) return column(14, [...block2, line2]);
16561
+ return element("panel", { width: "fill", height: "fill" }, [
16562
+ column(teamBarBottom, block2),
16563
+ line2 && column(objectiveBarBottom, line2)
16564
+ ]);
16352
16565
  }
16353
- function uiSound(player, sound, options = {}) {
16354
- const current = view(player);
16355
- const cue = { number: nextCue++, sound, seconds: options.seconds ?? 0 };
16356
- views.set(player.slot, {
16357
- ...current,
16358
- cues: [...current.cues, cue].slice(-maxCues)
16566
+ function Score2(props) {
16567
+ const [near, far] = props.tones ?? ["accent", "text"];
16568
+ const side = (points, tone) => Text({
16569
+ role: "title",
16570
+ tone,
16571
+ plated: true,
16572
+ style: { margin: [0, 10], horizontalAlign: void 0 },
16573
+ children: `${points}`
16359
16574
  });
16360
- return draw(player);
16575
+ return element("panel", { flow: "right", verticalAlign: "center" }, [
16576
+ side(props.points[0], near),
16577
+ Text({
16578
+ role: "title",
16579
+ tone: "muted",
16580
+ plated: true,
16581
+ style: { horizontalAlign: void 0 },
16582
+ children: ":"
16583
+ }),
16584
+ side(props.points[1], far)
16585
+ ]);
16361
16586
  }
16362
- function press(player, node, action = "", payload = "") {
16363
- if (action !== "") {
16364
- const pressed2 = screens.get(player.slot)?.actions.get(node);
16365
- if (pressed2) {
16366
- let value = void 0;
16367
- try {
16368
- value = payload === "" ? void 0 : JSON.parse(payload);
16369
- } catch {
16370
- value = void 0;
16371
- }
16372
- pressed2.handler(player, action, value);
16373
- }
16374
- return;
16375
- }
16376
- const bar = abilityBarNode.exec(node);
16377
- if (bar) {
16378
- views.get(player.slot)?.bar?.handler(player, Number(bar[1]));
16379
- return;
16380
- }
16381
- const pressed = screens.get(player.slot)?.presses.get(node);
16382
- if (pressed) {
16383
- pressed.handler(player);
16384
- }
16587
+ var rosterRows = 6;
16588
+ var rosterName = 24;
16589
+ var portraitSize = 44;
16590
+ var badgeSize = 18;
16591
+ var portraits = new Map(heroes.map((hero) => [hero.id, hero.portrait]));
16592
+ function rosterKey(rows) {
16593
+ return rows.slice(0, rosterRows).map(
16594
+ (row2) => `${row2.self ? "*" : ""}${row2.selected ? "+" : ""}${row2.onPress ? ">" : ""}${row2.name} ${row2.hero} ${row2.activity} ${row2.steamId ?? ""}`
16595
+ ).join("\n");
16385
16596
  }
16386
- function change(player, node, value) {
16387
- if (typeof value === "object" && value !== null) {
16388
- screens.get(player.slot)?.wheels.get(node)?.handler(player, value);
16389
- return;
16390
- }
16391
- const changed = screens.get(player.slot)?.changes.get(node);
16392
- if (changed) {
16393
- changed.handler(player, value);
16394
- }
16597
+ function Roster(props) {
16598
+ if (props.rows.length === 0) return null;
16599
+ return element(
16600
+ "panel",
16601
+ {
16602
+ width: "fit",
16603
+ height: "fit",
16604
+ flow: "down",
16605
+ horizontalAlign: "right",
16606
+ verticalAlign: "top",
16607
+ margin: [props.top ?? fpsReadoutBottom, 24, 0, 0]
16608
+ },
16609
+ props.rows.slice(0, rosterRows).map(rosterRow)
16610
+ );
16395
16611
  }
16396
- function tick(seconds) {
16397
- now2 = seconds;
16398
- for (const current of views.values()) {
16399
- if (current.notices.length === 0) {
16400
- continue;
16401
- }
16402
- current.notices = current.notices.filter((notice) => notice.until > now2);
16403
- draw(current.player);
16404
- }
16405
- }
16406
- var views = /* @__PURE__ */ new Map();
16407
- var now2 = 0;
16408
- var nextNotice = 0;
16409
- var nextCue = 1;
16410
- var maxCues = 8;
16411
- var maxNotices = 4;
16412
- var noticeMotion = {
16413
- enter: { opacity: 0, translate: [-16, 0] },
16414
- exit: { opacity: 0 },
16415
- transition: { seconds: 0.25, easing: "out" }
16416
- };
16417
- function view(player) {
16418
- return views.get(player.slot) ?? {
16419
- player,
16420
- root: void 0,
16421
- hud: [],
16422
- cursor: false,
16423
- asks: 0,
16424
- routes: /* @__PURE__ */ new Map(),
16425
- cues: [],
16426
- bar: void 0,
16427
- display: [],
16428
- notices: []
16429
- };
16430
- }
16431
- function draw(player) {
16432
- const current = view(player);
16433
- const root = [
16434
- current.root,
16435
- current.notices.length !== 0 && notices(current.notices)
16436
- ];
16437
- const previous = screens.get(player.slot);
16438
- const hud = current.hud.map((part) => hudParts[part]);
16439
- const display = displayRows(player, current.display);
16440
- const next = render(
16441
- previous,
16442
- root,
16443
- hud,
16444
- current.cursor,
16445
- current.asks,
16446
- current.routes,
16447
- current.cues,
16448
- current.bar !== void 0,
16449
- display
16612
+ function rosterRow(row2, index) {
16613
+ const right = { horizontalAlign: "right", textAlign: "right" };
16614
+ const text2 = element(
16615
+ "panel",
16616
+ { flow: "down", verticalAlign: "center", margin: [0, 12, 0, 0] },
16617
+ [
16618
+ Text({
16619
+ role: "label",
16620
+ tone: "text",
16621
+ style: right,
16622
+ children: clip(row2.name.toUpperCase(), rosterName)
16623
+ }),
16624
+ Text({
16625
+ role: "caption",
16626
+ tone: "muted",
16627
+ style: { ...right, margin: [1, 0, 0, 0] },
16628
+ children: row2.activity
16629
+ })
16630
+ ]
16631
+ );
16632
+ const src = portraits.get(row2.hero);
16633
+ const badge = row2.steamId === void 0 ? false : avatarBadge(row2.steamId);
16634
+ const image = src === void 0 ? false : portraitImage(src);
16635
+ const portrait = element(
16636
+ "panel",
16637
+ {
16638
+ width: portraitSize,
16639
+ height: portraitSize,
16640
+ padding: 1,
16641
+ verticalAlign: "center",
16642
+ background: row2.self || row2.selected ? tones.accent : shades.dim
16643
+ },
16644
+ element(
16645
+ "panel",
16646
+ { width: "100%", height: "100%", background: shades.raised },
16647
+ [image, badge]
16648
+ )
16450
16649
  );
16451
- const change2 = diff(previous, next);
16452
- if (change2 && !send(player.slot, change2)) {
16453
- const whole = render(
16454
- void 0,
16455
- root,
16456
- hud,
16457
- current.cursor,
16458
- current.asks,
16459
- current.routes,
16460
- current.cues,
16461
- current.bar !== void 0,
16462
- display
16463
- );
16464
- if (!send(player.slot, diff(void 0, whole))) {
16465
- screens.delete(player.slot);
16466
- return false;
16467
- }
16468
- screens.set(player.slot, whole);
16469
- return true;
16470
- }
16471
- screens.set(player.slot, next);
16472
- return true;
16473
- }
16474
- function notices(stack) {
16475
16650
  const style = {
16476
- width: "fit",
16477
- height: "fit",
16478
- flow: "down",
16479
- horizontalAlign: "left",
16480
- verticalAlign: "bottom",
16481
- margin: [0, 0, 260, 24],
16482
- transition: noticeMotion.transition
16651
+ flow: "right",
16652
+ horizontalAlign: "right",
16653
+ margin: [0, 0, 8, 0]
16483
16654
  };
16484
- const labels = stack.map(
16485
- (notice) => jsx(
16486
- "label",
16487
- {
16488
- style: {
16489
- horizontalAlign: "left",
16490
- margin: [4, 0, 0, 0],
16491
- padding: [5, 10],
16492
- background: "#101418d8",
16493
- color: "#f2f2f2",
16494
- fontSize: 16,
16495
- borderRadius: 4,
16496
- transition: noticeMotion.transition
16497
- },
16498
- enter: noticeMotion.enter,
16499
- exit: noticeMotion.exit,
16500
- children: notice.text
16655
+ const line2 = row2.onPress ? {
16656
+ type: "button",
16657
+ props: {
16658
+ style: {
16659
+ ...style,
16660
+ borderRadius: sizes.radius,
16661
+ transition: motion.hover
16501
16662
  },
16502
- notice.id
16503
- )
16504
- );
16505
- return jsx("panel", { style, exit: noticeMotion.exit, children: labels });
16663
+ hover: { background: shades.raised },
16664
+ hoverSound: sounds.hover,
16665
+ sound: sounds.press,
16666
+ onPress: row2.onPress,
16667
+ children: [text2, portrait]
16668
+ },
16669
+ key: `row-${index}`
16670
+ } : element("panel", style, [text2, portrait], `row-${index}`);
16671
+ return arriving(line2, { translate: [16, 0] });
16506
16672
  }
16507
- var screens = /* @__PURE__ */ new Map();
16508
- function render(previous, root, hud, cursor, asks, routes, cues, bar, display) {
16509
- const layout = new Layout(previous);
16510
- layout.add({
16511
- id: "",
16512
- kind: 0 /* PANEL */,
16513
- children: place(layout, root, "/"),
16514
- hideHud: [...hud],
16515
- freeCursor: cursor,
16516
- freeCursorAsks: asks,
16517
- sheets: [...sheets],
16518
- cues: [...cues],
16519
- abilityBarPresses: bar,
16520
- abilityDisplay: [...display]
16521
- });
16522
- for (const [name, data] of routes) {
16523
- layout.add({ id: `route:${name}`, kind: 5 /* ROUTE */, route: name, data });
16524
- }
16525
- return layout.screen;
16673
+ function portraitImage(src) {
16674
+ return {
16675
+ type: "image",
16676
+ props: { src, style: { width: "100%", height: "100%" } }
16677
+ };
16526
16678
  }
16527
- var Layout = class {
16528
- screen;
16529
- previous;
16530
- /** The layout continues previous's id counter and keeps its ids. */
16531
- constructor(previous) {
16532
- this.previous = previous;
16533
- this.screen = {
16534
- nodes: /* @__PURE__ */ new Map(),
16535
- ids: /* @__PURE__ */ new Map(),
16536
- presses: /* @__PURE__ */ new Map(),
16537
- changes: /* @__PURE__ */ new Map(),
16538
- actions: /* @__PURE__ */ new Map(),
16539
- wheels: /* @__PURE__ */ new Map(),
16540
- next: previous?.next ?? 0
16541
- };
16542
- }
16543
- /** add records a node. */
16544
- add(node) {
16545
- const value = node.steamId === void 0 ? node : { ...node, steamId: String(node.steamId) };
16546
- const encoded = JSON.stringify(value);
16547
- this.screen.nodes.set(node.id, { node, encoded });
16548
- }
16549
- /** id returns the node id for the element at place. */
16550
- id(place2) {
16551
- let found = this.previous?.ids.get(place2);
16552
- if (found === void 0) {
16553
- found = (this.screen.next++).toString(36);
16679
+ function avatarBadge(steamId) {
16680
+ return {
16681
+ type: "avatar",
16682
+ props: {
16683
+ steamId,
16684
+ style: {
16685
+ width: badgeSize,
16686
+ height: badgeSize,
16687
+ horizontalAlign: "left",
16688
+ verticalAlign: "bottom",
16689
+ borderRadius: badgeSize / 2,
16690
+ borderWidth: 1,
16691
+ borderColor: shades.dim
16692
+ }
16554
16693
  }
16555
- this.screen.ids.set(place2, found);
16556
- return found;
16694
+ };
16695
+ }
16696
+ var actionLooks = {
16697
+ primary: {
16698
+ idle: { background: tones.text },
16699
+ hover: { background: shades.white },
16700
+ text: shades.ink
16701
+ },
16702
+ secondary: {
16703
+ idle: {
16704
+ background: shades.raised,
16705
+ borderWidth: 1,
16706
+ borderColor: shades.faint
16707
+ },
16708
+ hover: { background: shades.lit, borderColor: tones.text },
16709
+ text: tones.text
16710
+ },
16711
+ quiet: {
16712
+ idle: { background: shades.clear },
16713
+ hover: { background: shades.raised },
16714
+ text: shades.quiet
16557
16715
  }
16558
16716
  };
16559
- function place(layout, child, at3) {
16560
- if (child === null || child === void 0 || typeof child === "boolean") {
16561
- return [];
16562
- }
16563
- if (isList(child)) {
16564
- return child.flatMap((item2, index) => {
16565
- const key = isElement(item2) ? item2.key : void 0;
16566
- return place(
16567
- layout,
16568
- item2,
16569
- key === void 0 ? `${at3},${index}` : `${at3},=${key}`
16570
- );
16571
- });
16572
- }
16573
- if (!isElement(child)) {
16574
- const node2 = {
16575
- id: layout.id(at3),
16576
- kind: 1 /* LABEL */,
16577
- text: String(child)
16578
- };
16579
- layout.add(node2);
16580
- return [node2.id];
16581
- }
16582
- if (child.type === fragment) {
16583
- return place(layout, child.props.children, `${at3}>`);
16584
- }
16585
- const props = child.props;
16586
- const node = {
16587
- id: layout.id(at3),
16588
- style: wireStyle(props.style),
16589
- hover: wireStyle(props.hover),
16590
- tooltip: props.tooltip,
16591
- item: props.item ? itemId(props.item) : void 0,
16592
- ability: props.ability?.name ? itemId(props.ability.name) : void 0,
16593
- abilityPlayer: props.ability?.name ? props.ability.player.slot : void 0,
16594
- hoverSound: props.hoverSound,
16595
- enter: wireStyle(props.enter),
16596
- exit: wireStyle(props.exit),
16597
- cycle: cycle(props.cycle),
16598
- classes: classes(props.class)
16717
+ function Action(props) {
16718
+ const look = actionLooks[props.kind ?? "secondary"];
16719
+ const label = element(
16720
+ "label",
16721
+ {
16722
+ face: "block",
16723
+ fontSize: 16,
16724
+ uppercase: true,
16725
+ letterSpacing: 1,
16726
+ color: look.text,
16727
+ horizontalAlign: "center",
16728
+ verticalAlign: "center",
16729
+ noWrap: true
16730
+ },
16731
+ props.children
16732
+ );
16733
+ return {
16734
+ type: "button",
16735
+ props: {
16736
+ style: {
16737
+ height: sizes.control,
16738
+ padding: [0, 14],
16739
+ borderRadius: sizes.radius,
16740
+ transition: motion.hover,
16741
+ ...look.idle,
16742
+ ...props.disabled ? { opacity: 0.4 } : {},
16743
+ ...props.style
16744
+ },
16745
+ hover: props.disabled ? void 0 : look.hover,
16746
+ hoverSound: props.disabled ? void 0 : sounds.hover,
16747
+ sound: sounds.press,
16748
+ disabled: props.disabled,
16749
+ onPress: props.onPress,
16750
+ children: label
16751
+ }
16599
16752
  };
16600
- switch (child.type) {
16601
- case "label":
16602
- node.kind = 1 /* LABEL */;
16603
- node.text = text(props.children);
16604
- node.token = props.token;
16605
- node.variables = variables(props.variables);
16606
- break;
16607
- case "avatar":
16608
- node.kind = 8 /* AVATAR */;
16609
- node.steamId = props.steamId;
16610
- break;
16611
- case "entry":
16612
- case "slider":
16613
- case "toggle":
16614
- case "dropdown":
16615
- input(layout, node, child.type, props);
16616
- break;
16617
- case "image":
16618
- node.kind = 2 /* IMAGE */;
16619
- node.image = props.src ?? "";
16620
- node.scaling = scaling(props.scaling);
16621
- break;
16622
- case "hero":
16623
- node.kind = 6 /* HERO_IMAGE */;
16624
- node.hero = props.hero;
16625
- node.heroLook = props.look === void 0 ? void 0 : looks[props.look];
16626
- node.scaling = scaling(props.scaling);
16627
- break;
16628
- case "button":
16629
- node.kind = 3 /* BUTTON */;
16630
- node.sound = props.sound;
16631
- node.disabled = props.disabled;
16632
- if (props.onPress && !props.disabled) {
16633
- layout.screen.presses.set(node.id, { handler: props.onPress });
16634
- }
16635
- node.children = place(layout, props.children, `${at3}/`);
16636
- break;
16637
- case "layout":
16638
- node.kind = 4 /* LAYOUT */;
16639
- node.layout = props.src ?? "";
16640
- node.data = props.data === void 0 ? "" : JSON.stringify(props.data) ?? "";
16641
- if (props.onAction) {
16642
- layout.screen.actions.set(node.id, { handler: props.onAction });
16643
- }
16644
- break;
16645
- default:
16646
- node.kind = 0 /* PANEL */;
16647
- node.children = place(layout, props.children, `${at3}/`);
16648
- }
16649
- layout.add(node);
16650
- return [node.id];
16651
16753
  }
16652
- function classes(names) {
16653
- const list = (names ?? "").split(" ").filter((name) => name !== "");
16654
- return list.length === 0 ? void 0 : list;
16754
+ function Meter(props) {
16755
+ const height = props.height ?? 8;
16756
+ const value = Math.min(1, Math.max(0, props.value));
16757
+ return element(
16758
+ "panel",
16759
+ {
16760
+ width: props.width ?? 160,
16761
+ height,
16762
+ background: shades.raised,
16763
+ borderRadius: height / 2,
16764
+ overflow: "clip",
16765
+ ...props.style
16766
+ },
16767
+ // The fill scales rather than resizes, so it eases without layout work.
16768
+ element("panel", {
16769
+ width: "100%",
16770
+ height: "100%",
16771
+ background: tones[props.tone ?? "accent"],
16772
+ scale: [value, 1],
16773
+ origin: [0, 50],
16774
+ transition: motion.meter
16775
+ })
16776
+ );
16655
16777
  }
16656
- function input(layout, node, kind, props) {
16657
- node.kind = 7 /* INPUT */;
16658
- node.disabled = props.disabled;
16659
- if (props.onChange && !props.disabled) {
16660
- layout.screen.changes.set(node.id, { handler: props.onChange });
16661
- }
16662
- switch (kind) {
16663
- case "entry":
16664
- node.input = {
16665
- case: "textEntry",
16666
- value: {
16667
- text: String(props.value ?? ""),
16668
- placeholder: props.placeholder,
16669
- maxLength: props.maxLength
16670
- }
16671
- };
16672
- break;
16673
- case "slider":
16674
- if (props.onWheel && !props.disabled) {
16675
- layout.screen.wheels.set(node.id, { handler: props.onWheel });
16676
- }
16677
- node.input = {
16678
- case: "slider",
16679
- value: {
16680
- value: Number(props.value ?? 0),
16681
- min: props.min,
16682
- max: props.max,
16683
- step: props.step,
16684
- wheel: !!props.onWheel && !props.disabled
16685
- }
16686
- };
16687
- break;
16688
- case "toggle":
16689
- node.text = text(props.children);
16690
- node.input = { case: "toggle", value: { on: props.on } };
16691
- break;
16692
- case "dropdown":
16693
- node.input = {
16694
- case: "dropdown",
16695
- value: {
16696
- options: [...props.options ?? []],
16697
- selected: props.selected
16698
- }
16778
+
16779
+ // js/src/chat.ts
16780
+ var lineWidth = 40;
16781
+ var lines = /* @__PURE__ */ new Map();
16782
+ var shown;
16783
+ function showChatLines(options = {}) {
16784
+ shown = options;
16785
+ }
16786
+ function chatShown() {
16787
+ return shown !== void 0;
16788
+ }
16789
+ function hearChat(line2, now4) {
16790
+ if (!shown) return false;
16791
+ const text2 = line2.text.trim();
16792
+ if (text2 === "" || text2.startsWith("/")) return false;
16793
+ const team = line2.all ? 0 : line2.player.pawn()?.team ?? 0;
16794
+ lines.set(line2.player.slot, {
16795
+ speaker: line2.player,
16796
+ text: `\u201C${clip(text2, lineWidth)}\u201D`,
16797
+ team,
16798
+ until: now4 + (shown.seconds ?? 6)
16799
+ });
16800
+ return true;
16801
+ }
16802
+ function expireChat(now4) {
16803
+ let expired = false;
16804
+ for (const [slot, line2] of lines) {
16805
+ if (now4 >= line2.until) {
16806
+ lines.delete(slot);
16807
+ expired = true;
16808
+ }
16809
+ }
16810
+ return expired;
16811
+ }
16812
+ function forgetChat(slot) {
16813
+ return lines.delete(slot);
16814
+ }
16815
+ function chatLines(viewer) {
16816
+ if (lines.size === 0) return void 0;
16817
+ const team = viewer.pawn()?.team ?? 0;
16818
+ const readable = [];
16819
+ for (const line2 of lines.values()) {
16820
+ if (line2.team === 0 || line2.team === team) readable.push(line2);
16821
+ }
16822
+ readable.sort((a, b) => b.until - a.until);
16823
+ return Roster({
16824
+ top: shown?.top,
16825
+ rows: readable.map((line2) => {
16826
+ const speaker = connection(line2.speaker);
16827
+ return {
16828
+ name: speaker?.name ?? "",
16829
+ hero: line2.speaker.pawn()?.hero ?? 0,
16830
+ activity: line2.text,
16831
+ steamId: speaker && !speaker.bot ? speaker.steamId : void 0
16699
16832
  };
16700
- }
16833
+ })
16834
+ });
16701
16835
  }
16702
- function variables(value) {
16703
- if (!value) {
16704
- return void 0;
16705
- }
16706
- const encoded = {};
16707
- for (const [name, filled] of Object.entries(value)) {
16708
- encoded[name] = String(filled);
16836
+
16837
+ // js/src/bystander.ts
16838
+ var bystanderStates = [
16839
+ "MODIFIER_STATE_IMMOBILIZED",
16840
+ "MODIFIER_STATE_DISARMED",
16841
+ "MODIFIER_STATE_MELEE_DISABLED",
16842
+ "MODIFIER_STATE_SILENCED",
16843
+ "MODIFIER_STATE_INVULNERABLE",
16844
+ "MODIFIER_STATE_TECH_UNTARGETABLE_BY_ENEMIES",
16845
+ "MODIFIER_STATE_TECH_UNTARGETABLE_BY_TEAMMATES",
16846
+ "MODIFIER_STATE_DISPLACEMENT_IMMUNE",
16847
+ "MODIFIER_STATE_IGNORE_BULLETS",
16848
+ "MODIFIER_STATE_IGNORE_MELEE",
16849
+ "MODIFIER_STATE_IN_ABILITY_DISABLE_ZOOM"
16850
+ ];
16851
+ function holdBystander(entity, active = true) {
16852
+ let held = true;
16853
+ for (const state of bystanderStates) {
16854
+ held = holdModifierState(entity, state, active) && held;
16709
16855
  }
16710
- return encoded;
16856
+ return held;
16711
16857
  }
16712
- function cycle(value) {
16713
- if (!value) {
16714
- return void 0;
16715
- }
16716
- return {
16717
- style: wireStyle(value.style),
16718
- seconds: value.seconds,
16719
- count: value.count
16858
+ var parkedStates = [
16859
+ "MODIFIER_STATE_DO_NOT_DRAW_MODEL",
16860
+ "MODIFIER_STATE_UNIT_STATUS_HIDDEN",
16861
+ "MODIFIER_STATE_INVISIBLE_ON_MINIMAP",
16862
+ "MODIFIER_STATE_IGNORE_OUT_OF_PLAY_AREA_CHECK"
16863
+ ];
16864
+ var parkHeight = 4e3;
16865
+ function spectateFrom(player, position, facing, park) {
16866
+ const pawn = player.pawn();
16867
+ if (pawn === void 0 || pawn.hero === 0) return void 0;
16868
+ const stood = pawn.position;
16869
+ const faced = pawn.eyeAngles;
16870
+ hideParked(pawn.entity, true);
16871
+ player.teleport(park ?? { ...stood, z: stood.z + parkHeight }, faced, {
16872
+ x: 0,
16873
+ y: 0,
16874
+ z: 0
16875
+ });
16876
+ player.freeze(true);
16877
+ player.freeCamera(position, facing);
16878
+ return (restore = true) => {
16879
+ player.unwatch();
16880
+ player.freeze(false);
16881
+ if (restore) player.teleport(stood, faced, { x: 0, y: 0, z: 0 });
16882
+ hideParked(pawn.entity, false);
16720
16883
  };
16721
16884
  }
16722
- function diff(previous, next) {
16723
- const set = [...next.nodes.values()].filter(
16724
- ({ node, encoded }) => previous?.nodes.get(node.id)?.encoded !== encoded
16725
- ).map(({ node }) => node);
16726
- const removed = [...previous?.nodes.keys() ?? []].filter(
16727
- (id) => !next.nodes.has(id)
16728
- );
16729
- if (previous && set.length === 0 && removed.length === 0) {
16730
- return void 0;
16731
- }
16732
- return { reset: !previous, set, removed };
16733
- }
16734
- function send(slot, change2) {
16735
- return call("Ui", UiRequest.toBinary({ player: slot, change: change2 })) !== void 0;
16736
- }
16737
- function isElement(child) {
16738
- return typeof child === "object" && child !== null && !Array.isArray(child);
16739
- }
16740
- function isList(child) {
16741
- return Array.isArray(child);
16885
+ function hideParked(entity, active) {
16886
+ holdBystander(entity, active);
16887
+ for (const state of parkedStates) holdModifierState(entity, state, active);
16742
16888
  }
16743
- function text(children) {
16744
- if (children === null || children === void 0 || typeof children === "boolean") {
16745
- return "";
16889
+
16890
+ // js/src/strays.ts
16891
+ var strayGraceSeconds = 3;
16892
+ var strayRespawnTime = 1e9;
16893
+ var strayBlow = 1e6;
16894
+ var Strays = class {
16895
+ /** since maps each stray pawn to when it was first seen with no player. */
16896
+ since = /* @__PURE__ */ new Map();
16897
+ /**
16898
+ * gone holds the controller handles strays name that no longer resolve. A
16899
+ * handle carries its entity's serial, so it never resolves again, and each
16900
+ * failed read logs on the host: a sweep reads it once.
16901
+ */
16902
+ gone = /* @__PURE__ */ new Set();
16903
+ sweptAt = -Infinity;
16904
+ /**
16905
+ * sweep lays down each hero pawn that has belonged to no player for
16906
+ * strayGraceSeconds, at most once a second. The game sets a dead pawn's
16907
+ * respawn when it dies, so the hold repeats on each sweep.
16908
+ */
16909
+ sweep(now4) {
16910
+ if (now4 - this.sweptAt < 1) {
16911
+ return;
16912
+ }
16913
+ this.sweptAt = now4;
16914
+ const held = /* @__PURE__ */ new Set();
16915
+ for (const { player } of players()) {
16916
+ const pawn = player.pawn();
16917
+ if (pawn) {
16918
+ held.add(pawn.entity);
16919
+ }
16920
+ }
16921
+ const since = /* @__PURE__ */ new Map();
16922
+ const gone = /* @__PURE__ */ new Set();
16923
+ for (const entity of findEntities("player")) {
16924
+ if (held.has(entity) || ownHero(entity, this.gone, gone)) {
16925
+ continue;
16926
+ }
16927
+ const first = this.since.get(entity) ?? now4;
16928
+ since.set(entity, first);
16929
+ if (now4 - first >= strayGraceSeconds) {
16930
+ layDown(entity);
16931
+ }
16932
+ }
16933
+ this.since = since;
16934
+ this.gone = gone;
16746
16935
  }
16747
- if (isList(children)) {
16748
- return children.map(text).join("");
16936
+ };
16937
+ function ownHero(entity, known2, seen) {
16938
+ const controller = readField(
16939
+ entity,
16940
+ "CBasePlayerPawn",
16941
+ "m_hController",
16942
+ "handle"
16943
+ );
16944
+ if (typeof controller !== "number") {
16945
+ return false;
16749
16946
  }
16750
- return isElement(children) ? "" : String(children);
16947
+ if (known2.has(controller)) {
16948
+ seen.add(controller);
16949
+ return false;
16950
+ }
16951
+ const connected = readField(
16952
+ controller,
16953
+ "CBasePlayerController",
16954
+ "m_iConnected",
16955
+ "int32"
16956
+ );
16957
+ if (connected === 3 || connected === 4) {
16958
+ return false;
16959
+ }
16960
+ const hero = readField(
16961
+ controller,
16962
+ "CCitadelPlayerController",
16963
+ "m_hHeroPawn",
16964
+ "handle"
16965
+ );
16966
+ if (connected === void 0 && hero === void 0) {
16967
+ seen.add(controller);
16968
+ }
16969
+ return hero === entity;
16751
16970
  }
16752
- var aligns = {
16753
- left: 0 /* START */,
16754
- top: 0 /* START */,
16755
- center: 1 /* CENTER */,
16756
- right: 2 /* END */,
16757
- bottom: 2 /* END */
16758
- };
16759
- function align(value) {
16760
- return value === void 0 ? void 0 : aligns[value];
16971
+ function layDown(entity) {
16972
+ holdBystander(entity, false);
16973
+ const health = readField(entity, "CBaseEntity", "m_iHealth", "int32");
16974
+ if (typeof health === "number" && health > 0) {
16975
+ damage({ victim: entity, amount: strayBlow });
16976
+ log(`laid down a stray hero pawn ${entity}`);
16977
+ }
16978
+ writeField(
16979
+ entity,
16980
+ "CCitadelPlayerPawn",
16981
+ "m_flRespawnTime",
16982
+ "float32",
16983
+ strayRespawnTime
16984
+ );
16761
16985
  }
16762
- var hudParts = {
16763
- levelUp: 1 /* LEVEL_UP */,
16764
- ownHealth: 2 /* OWN_HEALTH */,
16765
- topBar: 3 /* TOP_BAR */,
16766
- ammo: 4 /* AMMO */,
16767
- souls: 5 /* SOULS */,
16768
- minimap: 6 /* MINIMAP */,
16769
- abilities: 7 /* ABILITIES */,
16770
- status: 8 /* STATUS */,
16771
- stats: 9 /* STATS */,
16772
- heroPicker: 10 /* HERO_PICKER */,
16773
- brokerCountdown: 11 /* BROKER_COUNTDOWN */,
16774
- all: 12 /* ALL */
16775
- };
16776
- var faces = {
16777
- body: 1 /* BODY */,
16778
- block: 2 /* BLOCK */,
16779
- serif: 3 /* SERIF */
16780
- };
16781
- var looks = {
16782
- small: 0 /* SMALL */,
16783
- card: 1 /* CARD */,
16784
- icon: 2 /* ICON */,
16785
- vertical: 3 /* VERTICAL */,
16786
- topBar: 4 /* TOP_BAR */,
16787
- minimap: 5 /* MINIMAP */
16788
- };
16789
- var scalings = {
16790
- fit: 1 /* FIT */,
16791
- cover: 2 /* COVER */,
16792
- stretch: 3 /* STRETCH */,
16793
- fitWidth: 4 /* FIT_WIDTH */,
16794
- fitHeight: 5 /* FIT_HEIGHT */,
16795
- none: 6 /* NONE */
16986
+
16987
+ // js/src/stragglers.ts
16988
+ var stragglerConnectSeconds = 120;
16989
+ var Stragglers = class {
16990
+ connectSeconds;
16991
+ strays;
16992
+ /** joining maps each connecting human's slot to its generation and when it was first seen. */
16993
+ joining = /* @__PURE__ */ new Map();
16994
+ /** kicked holds the generation each slot had when this kicked it. */
16995
+ kicked = /* @__PURE__ */ new Map();
16996
+ sweptAt = -Infinity;
16997
+ constructor(options = {}) {
16998
+ this.connectSeconds = options.connectSeconds ?? stragglerConnectSeconds;
16999
+ this.strays = options.heroes === false ? void 0 : new Strays();
17000
+ }
17001
+ /**
17002
+ * sweep kicks each human connecting for longer than connectSeconds, once
17003
+ * per connection, and lays down heroes no player holds, at most once a
17004
+ * second.
17005
+ */
17006
+ sweep(now4) {
17007
+ this.strays?.sweep(now4);
17008
+ if (now4 - this.sweptAt < 1) {
17009
+ return;
17010
+ }
17011
+ this.sweptAt = now4;
17012
+ if (this.connectSeconds <= 0) {
17013
+ return;
17014
+ }
17015
+ const joining = /* @__PURE__ */ new Map();
17016
+ for (const connection2 of players()) {
17017
+ if (connection2.bot || connection2.ready) {
17018
+ continue;
17019
+ }
17020
+ const slot = connection2.player.slot;
17021
+ const seen = this.joining.get(slot);
17022
+ const since = seen?.generation === connection2.generation ? seen.since : now4;
17023
+ joining.set(slot, { generation: connection2.generation, since });
17024
+ if (now4 - since < this.connectSeconds) {
17025
+ continue;
17026
+ }
17027
+ if (this.kicked.get(slot) === connection2.generation) {
17028
+ continue;
17029
+ }
17030
+ this.kicked.set(slot, connection2.generation);
17031
+ const name = connection2.name;
17032
+ if (name === "" || name.includes('"')) {
17033
+ log(`slot ${slot} stuck joining, but its name cannot be kicked`);
17034
+ continue;
17035
+ }
17036
+ log(`kicked ${name}: still joining after ${this.connectSeconds} s`);
17037
+ serverCommand(`kick "${name}"`);
17038
+ }
17039
+ this.joining = joining;
17040
+ }
16796
17041
  };
16797
- function scaling(value) {
16798
- return value === void 0 ? void 0 : scalings[value];
17042
+
17043
+ // js/src/item-id.ts
17044
+ function itemId(name) {
17045
+ const m = 1540483477;
17046
+ const data = new TextEncoder().encode(name);
17047
+ const byte = (at3) => data[at3] ?? 0;
17048
+ let h = (826366246 ^ data.length) >>> 0;
17049
+ let i = 0;
17050
+ for (; data.length - i >= 4; i += 4) {
17051
+ let k = (byte(i) | byte(i + 1) << 8 | byte(i + 2) << 16 | byte(i + 3) << 24) >>> 0;
17052
+ k = Math.imul(k, m) >>> 0;
17053
+ k = (k ^ k >>> 24) >>> 0;
17054
+ k = Math.imul(k, m) >>> 0;
17055
+ h = Math.imul(h, m) >>> 0;
17056
+ h = (h ^ k) >>> 0;
17057
+ }
17058
+ const rest = data.length - i;
17059
+ if (rest >= 3) h = (h ^ byte(i + 2) << 16) >>> 0;
17060
+ if (rest >= 2) h = (h ^ byte(i + 1) << 8) >>> 0;
17061
+ if (rest >= 1) {
17062
+ h = (h ^ byte(i)) >>> 0;
17063
+ h = Math.imul(h, m) >>> 0;
17064
+ }
17065
+ h = (h ^ h >>> 13) >>> 0;
17066
+ h = Math.imul(h, m) >>> 0;
17067
+ return (h ^ h >>> 15) >>> 0;
16799
17068
  }
16800
- var flows = {
16801
- down: 1 /* DOWN */,
16802
- right: 2 /* RIGHT */,
16803
- downWrap: 3 /* DOWN_WRAP */,
16804
- rightWrap: 4 /* RIGHT_WRAP */
16805
- };
16806
- var overflows = {
16807
- squish: 1 /* SQUISH */,
16808
- clip: 2 /* CLIP */,
16809
- scroll: 3 /* SCROLL */,
16810
- show: 4 /* SHOW */
16811
- };
16812
- function overflow(value) {
16813
- return value === void 0 ? void 0 : overflows[value];
17069
+
17070
+ // js/src/ui.ts
17071
+ function jsx(type, props, key) {
17072
+ const named = key === void 0 ? void 0 : String(key);
17073
+ if (typeof type === "function") {
17074
+ return { type: fragment, props: { children: type(props) }, key: named };
17075
+ }
17076
+ return { type, props, key: named };
16814
17077
  }
16815
- var shapes = {
16816
- down: 0 /* DOWN */,
16817
- right: 1 /* RIGHT */,
16818
- up: 2 /* UP */,
16819
- left: 3 /* LEFT */,
16820
- radial: 4 /* RADIAL */
16821
- };
16822
- var weights = {
16823
- thin: 1 /* THIN */,
16824
- light: 2 /* LIGHT */,
16825
- normal: 3 /* NORMAL */,
16826
- medium: 4 /* MEDIUM */,
16827
- semiBold: 5 /* SEMI_BOLD */,
16828
- bold: 6 /* BOLD */,
16829
- black: 7 /* BLACK */
16830
- };
16831
- var textOverflows = {
16832
- ellipsis: 1 /* ELLIPSIS */,
16833
- shrink: 2 /* SHRINK */,
16834
- clip: 3 /* CLIP */
16835
- };
16836
- var decorations = {
16837
- underline: 1 /* UNDERLINE */,
16838
- strike: 2 /* STRIKE */
16839
- };
16840
- var easings = {
16841
- out: 0 /* EASE_OUT */,
16842
- in: 1 /* EASE_IN */,
16843
- inOut: 2 /* EASE_IN_OUT */,
16844
- linear: 3 /* LINEAR */
16845
- };
16846
- function wireStyle(style) {
16847
- if (!style) {
16848
- return void 0;
16849
- }
16850
- return {
16851
- width: length(style.width),
16852
- height: length(style.height),
16853
- flow: style.flow === void 0 ? void 0 : flows[style.flow],
16854
- horizontalAlign: align(style.horizontalAlign),
16855
- verticalAlign: align(style.verticalAlign),
16856
- margin: edges(style.margin),
16857
- padding: edges(style.padding),
16858
- background: color(style.background),
16859
- color: color(style.color),
16860
- fontSize: style.fontSize,
16861
- bold: style.bold,
16862
- textAlign: align(style.textAlign),
16863
- borderRadius: style.borderRadius,
16864
- opacity: style.opacity,
16865
- face: style.face === void 0 ? void 0 : faces[style.face],
16866
- uppercase: style.uppercase,
16867
- letterSpacing: style.letterSpacing,
16868
- shadow: style.shadow,
16869
- borderWidth: style.borderWidth,
16870
- borderColor: color(style.borderColor),
16871
- x: length(style.x),
16872
- y: length(style.y),
16873
- minWidth: length(style.minWidth),
16874
- maxWidth: length(style.maxWidth),
16875
- minHeight: length(style.minHeight),
16876
- maxHeight: length(style.maxHeight),
16877
- zIndex: style.zIndex,
16878
- overflowX: overflow(style.overflowX ?? style.overflow),
16879
- overflowY: overflow(style.overflowY ?? style.overflow),
16880
- gradient: gradient(style.gradient),
16881
- boxShadow: shadow(style.boxShadow),
16882
- textShadow: shadow(style.textShadow),
16883
- tint: color(style.tint),
16884
- saturation: style.saturation,
16885
- brightness: style.brightness,
16886
- contrast: style.contrast,
16887
- blur: style.blur,
16888
- italic: style.italic,
16889
- weight: style.weight === void 0 ? void 0 : weights[style.weight],
16890
- lineHeight: style.lineHeight,
16891
- noWrap: style.noWrap,
16892
- textOverflow: style.textOverflow === void 0 ? void 0 : textOverflows[style.textOverflow],
16893
- decoration: style.decoration === void 0 ? void 0 : decorations[style.decoration],
16894
- transform: transform(style),
16895
- transition: transition(style.transition)
16896
- };
17078
+ var fragment = "fragment";
17079
+ var jsxs = jsx;
17080
+ function Fragment(props) {
17081
+ return props.children;
16897
17082
  }
16898
- function gradient(value) {
16899
- if (!value) {
16900
- return void 0;
16901
- }
16902
- const last = Math.max(1, value.colors.length - 1);
16903
- return {
16904
- shape: value.shape === void 0 ? void 0 : shapes[value.shape],
16905
- stops: value.colors.map((each, index) => ({
16906
- at: value.at?.[index] ?? index / last,
16907
- color: color(each)
16908
- }))
16909
- };
17083
+ function show(player, root) {
17084
+ views.set(player.slot, { ...view(player), root });
17085
+ return draw(player);
16910
17086
  }
16911
- function shadow(value) {
16912
- if (!value) {
16913
- return void 0;
16914
- }
16915
- return {
16916
- x: value.x,
16917
- y: value.y,
16918
- blur: value.blur,
16919
- spread: value.spread,
16920
- color: color(value.color),
16921
- inset: value.inset
16922
- };
17087
+ function hideHud(player, parts) {
17088
+ views.set(player.slot, { ...view(player), hud: parts });
17089
+ return draw(player);
16923
17090
  }
16924
- function transform(style) {
16925
- const { translate, scale: scale2, rotate, origin } = style;
16926
- if (!translate && scale2 === void 0 && rotate === void 0 && !origin) {
16927
- return void 0;
16928
- }
16929
- const scales = typeof scale2 === "number" ? [scale2, scale2] : scale2;
16930
- return {
16931
- translateX: translate?.[0],
16932
- translateY: translate?.[1],
16933
- scaleX: scales?.[0],
16934
- scaleY: scales?.[1],
16935
- rotate,
16936
- originX: origin?.[0],
16937
- originY: origin?.[1]
16938
- };
17091
+ function hideHudForAll(parts) {
17092
+ everyoneHud = parts;
17093
+ drawAll();
16939
17094
  }
16940
- function transition(value) {
16941
- if (value === void 0) {
16942
- return void 0;
16943
- }
16944
- if (typeof value === "number") {
16945
- return { seconds: value };
16946
- }
16947
- return {
16948
- seconds: value.seconds,
16949
- delay: value.delay,
16950
- easing: value.easing === void 0 ? void 0 : easings[value.easing]
16951
- };
17095
+ function freeCursor(player, free) {
17096
+ const current = view(player);
17097
+ views.set(player.slot, {
17098
+ ...current,
17099
+ cursor: free,
17100
+ asks: free ? current.asks + 1 : current.asks
17101
+ });
17102
+ return draw(player);
16952
17103
  }
16953
- function length(value) {
16954
- if (value === void 0) {
16955
- return void 0;
16956
- }
16957
- if (typeof value === "number") {
16958
- return { value: { case: "pixels", value } };
17104
+ function abilityBarPresses(player, onPress) {
17105
+ views.set(player.slot, {
17106
+ ...view(player),
17107
+ bar: onPress ? { handler: onPress } : void 0
17108
+ });
17109
+ return draw(player);
17110
+ }
17111
+ function abilityDisplay(viewer, rows = []) {
17112
+ views.set(viewer.slot, { ...view(viewer), display: rows.slice(0, 64) });
17113
+ return draw(viewer);
17114
+ }
17115
+ function displayRows(viewer, rows) {
17116
+ if (rows.length === 0) return [];
17117
+ const names = new Map(players().map((c) => [c.player.slot, c.name]));
17118
+ return rows.map((row2) => {
17119
+ const hero = row2.player.pawn()?.hero;
17120
+ return {
17121
+ player: row2.player.slot,
17122
+ // A Steam name is at most 32 characters, within the host's 128 bytes.
17123
+ name: (names.get(row2.player.slot) ?? "").slice(0, 32),
17124
+ hero: heroes.find((each) => each.id === hero)?.name ?? "",
17125
+ own: row2.player.slot === viewer.slot,
17126
+ abilities: row2.abilities.slice(0, 4).map((shown2) => ({
17127
+ ability: shown2?.name ? itemId(shown2.name) : 0,
17128
+ image: shown2?.image ?? "",
17129
+ upgrades: shown2?.upgrades ?? 0
17130
+ }))
17131
+ };
17132
+ });
17133
+ }
17134
+ var abilityBarNode = /^ability:([0-3])$/;
17135
+ function cursorFree(player) {
17136
+ const pawn = player.pawn();
17137
+ if (pawn === void 0) return void 0;
17138
+ return readField(
17139
+ pawn.entity,
17140
+ "CCitadelPlayer_MovementServices",
17141
+ "m_bHasFreeCursor",
17142
+ "bool"
17143
+ );
17144
+ }
17145
+ function sheet(path) {
17146
+ if (!path.endsWith(".css") || !path.split("/").every((part) => sheetPart.test(part) && part !== "..")) {
17147
+ return false;
16959
17148
  }
16960
- if (value === "fit") {
16961
- return { value: { case: "fitChildren", value: true } };
17149
+ if (sheets.includes(path)) {
17150
+ return true;
16962
17151
  }
16963
- if (value === "fill") {
16964
- return { value: { case: "fill", value: 1 } };
17152
+ sheets.push(path);
17153
+ for (const current of views.values()) {
17154
+ draw(current.player);
16965
17155
  }
16966
- return { value: { case: "percent", value: Number.parseFloat(value) } };
17156
+ return true;
16967
17157
  }
16968
- function edges(value) {
16969
- if (value === void 0) {
16970
- return void 0;
16971
- }
16972
- if (typeof value === "number") {
16973
- return { top: value, right: value, bottom: value, left: value };
17158
+ var sheetPart = /^[\w.-]+$/;
17159
+ var sheets = [];
17160
+ function route(player, name, value) {
17161
+ const routes = new Map(view(player).routes);
17162
+ const encoded = value === void 0 ? void 0 : JSON.stringify(value);
17163
+ if (!routeName.test(name) || value !== void 0 && encoded === void 0) {
17164
+ return false;
16974
17165
  }
16975
- if (value.length === 2) {
16976
- return { top: value[0], right: value[1], bottom: value[0], left: value[1] };
17166
+ if (encoded === void 0) {
17167
+ routes.delete(name);
17168
+ } else {
17169
+ routes.set(name, encoded);
16977
17170
  }
16978
- return { top: value[0], right: value[1], bottom: value[2], left: value[3] };
17171
+ views.set(player.slot, { ...view(player), routes });
17172
+ return draw(player);
16979
17173
  }
16980
- function color(value) {
16981
- const hex = value?.replace(/^#/, "");
16982
- if (!hex || !/^[0-9a-f]{6}([0-9a-f]{2})?$/i.test(hex)) {
16983
- return void 0;
16984
- }
16985
- return Number.parseInt(hex.length === 6 ? `${hex}ff` : hex, 16) >>> 0;
17174
+ var routeName = /^[\w.-]+$/;
17175
+ function hide(player) {
17176
+ views.delete(player.slot);
17177
+ screens.delete(player.slot);
17178
+ if (!send(player.slot, { reset: true })) return false;
17179
+ return everyoneHud.length === 0 || draw(player);
16986
17180
  }
16987
-
16988
- // js/src/vector.ts
16989
- var vector_exports = {};
16990
- __export(vector_exports, {
16991
- add: () => add,
16992
- aimAt: () => aimAt,
16993
- at: () => at,
16994
- distance: () => distance,
16995
- dot: () => dot,
16996
- flatDistance: () => flatDistance,
16997
- forward: () => forward,
16998
- length: () => length2,
16999
- lerp: () => lerp2,
17000
- level: () => level,
17001
- normalize: () => normalize,
17002
- scale: () => scale,
17003
- sub: () => sub,
17004
- toward: () => toward,
17005
- yawToward: () => yawToward
17006
- });
17007
- function at(x, y, z) {
17008
- return { x, y, z };
17181
+ function joined(player) {
17182
+ if (everyoneHud.length !== 0) draw(player);
17009
17183
  }
17010
- function add(a, b) {
17011
- return { x: a.x + b.x, y: a.y + b.y, z: a.z + b.z };
17184
+ function left(player) {
17185
+ views.delete(player.slot);
17186
+ screens.delete(player.slot);
17187
+ if (forgetChat(player.slot)) drawAll();
17012
17188
  }
17013
- function sub(a, b) {
17014
- return { x: a.x - b.x, y: a.y - b.y, z: a.z - b.z };
17189
+ function heard(line2) {
17190
+ if (hearChat(line2, now2)) drawAll();
17015
17191
  }
17016
- function scale(a, s) {
17017
- return { x: a.x * s, y: a.y * s, z: a.z * s };
17018
- }
17019
- function dot(a, b) {
17020
- return a.x * b.x + a.y * b.y + a.z * b.z;
17192
+ function toast(player, text2, seconds = 4) {
17193
+ const current = view(player);
17194
+ const notice = { id: nextNotice++, text: text2, until: now2 + seconds };
17195
+ views.set(player.slot, {
17196
+ ...current,
17197
+ notices: [...current.notices, notice].slice(-maxNotices)
17198
+ });
17199
+ return draw(player);
17021
17200
  }
17022
- function length2(a) {
17023
- return Math.hypot(a.x, a.y, a.z);
17201
+ function uiSound(player, sound, options = {}) {
17202
+ const current = view(player);
17203
+ const cue = { number: nextCue++, sound, seconds: options.seconds ?? 0 };
17204
+ views.set(player.slot, {
17205
+ ...current,
17206
+ cues: [...current.cues, cue].slice(-maxCues)
17207
+ });
17208
+ return draw(player);
17024
17209
  }
17025
- function normalize(a) {
17026
- const size = length2(a);
17027
- return size > 0 ? scale(a, 1 / size) : { x: 1, y: 0, z: 0 };
17210
+ function press(player, node, action = "", payload = "") {
17211
+ if (action !== "") {
17212
+ const pressed2 = screens.get(player.slot)?.actions.get(node);
17213
+ if (pressed2) {
17214
+ let value = void 0;
17215
+ try {
17216
+ value = payload === "" ? void 0 : JSON.parse(payload);
17217
+ } catch {
17218
+ value = void 0;
17219
+ }
17220
+ pressed2.handler(player, action, value);
17221
+ }
17222
+ return;
17223
+ }
17224
+ const bar = abilityBarNode.exec(node);
17225
+ if (bar) {
17226
+ views.get(player.slot)?.bar?.handler(player, Number(bar[1]));
17227
+ return;
17228
+ }
17229
+ const pressed = screens.get(player.slot)?.presses.get(node);
17230
+ if (pressed) {
17231
+ pressed.handler(player);
17232
+ }
17028
17233
  }
17029
- function lerp2(a, b, t) {
17030
- return {
17031
- x: a.x + (b.x - a.x) * t,
17032
- y: a.y + (b.y - a.y) * t,
17033
- z: a.z + (b.z - a.z) * t
17034
- };
17234
+ function change(player, node, value) {
17235
+ if (typeof value === "object" && value !== null) {
17236
+ screens.get(player.slot)?.wheels.get(node)?.handler(player, value);
17237
+ return;
17238
+ }
17239
+ const changed = screens.get(player.slot)?.changes.get(node);
17240
+ if (changed) {
17241
+ changed.handler(player, value);
17242
+ }
17035
17243
  }
17036
- function distance(a, b) {
17037
- return Math.hypot(a.x - b.x, a.y - b.y, a.z - b.z);
17244
+ function tick(seconds) {
17245
+ now2 = seconds;
17246
+ if (expireChat(now2)) drawAll();
17247
+ for (const current of views.values()) {
17248
+ if (!current.notices.some((notice) => notice.until <= now2)) {
17249
+ continue;
17250
+ }
17251
+ current.notices = current.notices.filter((notice) => notice.until > now2);
17252
+ draw(current.player);
17253
+ }
17038
17254
  }
17039
- function flatDistance(a, b) {
17040
- return Math.hypot(a.x - b.x, a.y - b.y);
17255
+ var views = /* @__PURE__ */ new Map();
17256
+ var everyoneHud = [];
17257
+ var now2 = 0;
17258
+ var nextNotice = 0;
17259
+ var nextCue = 1;
17260
+ var maxCues = 8;
17261
+ var maxNotices = 4;
17262
+ var noticeMotion = {
17263
+ enter: { opacity: 0, translate: [-16, 0] },
17264
+ exit: { opacity: 0 },
17265
+ transition: { seconds: 0.25, easing: "out" }
17266
+ };
17267
+ function view(player) {
17268
+ return views.get(player.slot) ?? {
17269
+ player,
17270
+ root: void 0,
17271
+ hud: [],
17272
+ cursor: false,
17273
+ asks: 0,
17274
+ routes: /* @__PURE__ */ new Map(),
17275
+ cues: [],
17276
+ bar: void 0,
17277
+ display: [],
17278
+ notices: []
17279
+ };
17041
17280
  }
17042
- function toward(from, to) {
17043
- const span = distance(from, to);
17044
- return span > 0 ? scale(sub(to, from), 1 / span) : { x: 0, y: 0, z: 0 };
17281
+ function draw(player) {
17282
+ const current = view(player);
17283
+ const root = [
17284
+ current.root,
17285
+ chatLines(player),
17286
+ current.notices.length !== 0 && notices(current.notices)
17287
+ ];
17288
+ const previous = screens.get(player.slot);
17289
+ const hud = hiddenParts(current.hud);
17290
+ const display = displayRows(player, current.display);
17291
+ const next = render(
17292
+ previous,
17293
+ root,
17294
+ hud,
17295
+ current.cursor,
17296
+ current.asks,
17297
+ current.routes,
17298
+ current.cues,
17299
+ current.bar !== void 0,
17300
+ display
17301
+ );
17302
+ const change2 = diff(previous, next);
17303
+ if (change2 && !send(player.slot, change2)) {
17304
+ const whole = render(
17305
+ void 0,
17306
+ root,
17307
+ hud,
17308
+ current.cursor,
17309
+ current.asks,
17310
+ current.routes,
17311
+ current.cues,
17312
+ current.bar !== void 0,
17313
+ display
17314
+ );
17315
+ if (!send(player.slot, diff(void 0, whole))) {
17316
+ screens.delete(player.slot);
17317
+ return false;
17318
+ }
17319
+ screens.set(player.slot, whole);
17320
+ return true;
17321
+ }
17322
+ screens.set(player.slot, next);
17323
+ return true;
17045
17324
  }
17046
- function yawToward(from, to) {
17047
- return Math.atan2(to.y - from.y, to.x - from.x) * 180 / Math.PI;
17325
+ function drawAll() {
17326
+ for (const { player } of players()) {
17327
+ draw(player);
17328
+ }
17048
17329
  }
17049
- function level(yaw) {
17050
- return { pitch: 0, yaw, roll: 0 };
17330
+ function hiddenParts(own) {
17331
+ const parts = [];
17332
+ for (const part of everyoneHud) parts.push(hudParts[part]);
17333
+ for (const part of own) {
17334
+ const wire = hudParts[part];
17335
+ if (!parts.includes(wire)) parts.push(wire);
17336
+ }
17337
+ return parts;
17051
17338
  }
17052
- function aimAt(from, to) {
17053
- const across = flatDistance(from, to);
17054
- return {
17055
- pitch: -Math.atan2(to.z - from.z, across) * 180 / Math.PI,
17056
- yaw: yawToward(from, to),
17057
- roll: 0
17339
+ function notices(stack) {
17340
+ const style = {
17341
+ width: "fit",
17342
+ height: "fit",
17343
+ flow: "down",
17344
+ horizontalAlign: "left",
17345
+ verticalAlign: "bottom",
17346
+ margin: [0, 0, 260, 24],
17347
+ transition: noticeMotion.transition
17058
17348
  };
17349
+ const labels = stack.map(
17350
+ (notice) => jsx(
17351
+ "label",
17352
+ {
17353
+ style: {
17354
+ horizontalAlign: "left",
17355
+ margin: [4, 0, 0, 0],
17356
+ padding: [5, 10],
17357
+ background: "#101418d8",
17358
+ color: "#f2f2f2",
17359
+ fontSize: 16,
17360
+ borderRadius: 4,
17361
+ transition: noticeMotion.transition
17362
+ },
17363
+ enter: noticeMotion.enter,
17364
+ exit: noticeMotion.exit,
17365
+ children: notice.text
17366
+ },
17367
+ notice.id
17368
+ )
17369
+ );
17370
+ return jsx("panel", { style, exit: noticeMotion.exit, children: labels });
17059
17371
  }
17060
- function forward(angles2) {
17061
- const pitch = angles2.pitch * Math.PI / 180;
17062
- const yaw = angles2.yaw * Math.PI / 180;
17063
- return {
17064
- x: Math.cos(pitch) * Math.cos(yaw),
17065
- y: Math.cos(pitch) * Math.sin(yaw),
17066
- z: -Math.sin(pitch)
17067
- };
17372
+ var screens = /* @__PURE__ */ new Map();
17373
+ function render(previous, root, hud, cursor, asks, routes, cues, bar, display) {
17374
+ const layout = new Layout(previous);
17375
+ layout.add({
17376
+ id: "",
17377
+ kind: 0 /* PANEL */,
17378
+ children: place(layout, root, "/"),
17379
+ hideHud: [...hud],
17380
+ freeCursor: cursor,
17381
+ freeCursorAsks: asks,
17382
+ sheets: [...sheets],
17383
+ cues: [...cues],
17384
+ abilityBarPresses: bar,
17385
+ abilityDisplay: [...display]
17386
+ });
17387
+ for (const [name, data] of routes) {
17388
+ layout.add({ id: `route:${name}`, kind: 5 /* ROUTE */, route: name, data });
17389
+ }
17390
+ return layout.screen;
17068
17391
  }
17069
-
17070
- // js/src/bits.ts
17071
- var Buttons = {
17072
- /** attack is the primary fire button. */
17073
- attack: 1n,
17074
- /**
17075
- * jump is the jump key, Space by default (IN_MANTLE). Blocking it stops the
17076
- * native jump and mantle; the jumping client still predicts the jump and is
17077
- * corrected.
17078
- */
17079
- jump: 1n << 48n,
17080
- /** crouch is the crouch key, Ctrl by default. */
17081
- crouch: 1n << 2n,
17082
- /** dash is the dash key, Shift by default. */
17083
- dash: 1n << 16n,
17084
- /** use is the interact key. */
17085
- use: 1n << 5n,
17086
- /** altFire is the zoom and alternate fire button, right mouse by default. */
17087
- altFire: 1n << 11n,
17088
- /** reload is the reload key. */
17089
- reload: 1n << 13n,
17090
- /** melee is the light melee key, Q by default. */
17091
- melee: 1n << 32n,
17092
- /** ability1 to ability3 are the hero's first three ability keys. */
17093
- ability1: 1n << 33n,
17094
- ability2: 1n << 34n,
17095
- ability3: 1n << 35n,
17096
- /** ultimate is the hero's ultimate ability key, the fourth. */
17097
- ultimate: 1n << 36n,
17098
- /** parry is the melee parry button. */
17099
- parry: 1n << 42n
17100
- };
17101
- var Layers = {
17102
- /** solid is the world and solid objects. */
17103
- solid: 1n << 0n,
17104
- /** hitbox is the hit boxes of heroes and units. */
17105
- hitbox: 1n << 1n,
17106
- /** trigger is invisible volumes that react to touch. */
17107
- trigger: 1n << 2n,
17108
- /** playerClip is walls that only stop heroes. */
17109
- playerClip: 1n << 4n,
17110
- /** player is player-controlled heroes. */
17111
- player: 1n << 18n,
17112
- /** npc is units that are not players. */
17113
- npc: 1n << 19n,
17114
- /** staticLevel is the map's built geometry, foliage included. */
17115
- staticLevel: 1n << 30n,
17116
- /** hero, trooper and building are those units' bodies. */
17117
- hero: 1n << 37n,
17118
- trooper: 1n << 38n,
17119
- building: 1n << 40n
17120
- };
17121
-
17122
- // js/src/curve.ts
17123
- var curve_exports = {};
17124
- __export(curve_exports, {
17125
- chain: () => chain,
17126
- durationOf: () => durationOf,
17127
- ease: () => ease,
17128
- hold: () => hold,
17129
- keyframes: () => keyframes,
17130
- line: () => line,
17131
- orbit: () => orbit,
17132
- pingPong: () => pingPong,
17133
- repeat: () => repeat,
17134
- reverse: () => reverse,
17135
- shaped: () => shaped,
17136
- through: () => through,
17137
- valueAt: () => valueAt,
17138
- wave: () => wave
17139
- });
17140
- var ease = {
17141
- /** linear moves at an even pace. */
17142
- linear: shaped((t) => t, {}),
17143
- /** bias is the game's bias curve; see LerpShape. */
17144
- bias: (b) => shaped((t) => bias(t, b), { bias: b }),
17145
- /** gain is the game's gain curve; see LerpShape. */
17146
- gain: (g) => shaped((t) => gain(t, g), { gain: g }),
17147
- /** in starts slow and speeds up. */
17148
- in: shaped((t) => t * t * t),
17149
- /** out starts fast and slows to a stop. */
17150
- out: shaped((t) => 1 - (1 - t) ** 3),
17151
- /** inOut starts and ends slow. */
17152
- inOut: shaped((t) => t < 0.5 ? 4 * t * t * t : 1 - (2 - 2 * t) ** 3 / 2),
17153
- /** sine starts and ends slow, more gently than inOut. */
17154
- sine: shaped((t) => (1 - Math.cos(Math.PI * t)) / 2),
17155
- /** back passes its end a little and settles back onto it. */
17156
- back: shaped((t) => 1 + 2.70158 * (t - 1) ** 3 + 1.70158 * (t - 1) ** 2),
17157
- /** elastic overshoots its end and rings down onto it. */
17158
- elastic: shaped(
17159
- (t) => t <= 0 || t >= 1 ? t : 2 ** (-10 * t) * Math.sin((t * 10 - 0.75) * 2 * Math.PI / 3) + 1
17160
- ),
17161
- /** bounce drops onto its end and bounces to rest. */
17162
- bounce: shaped((t) => {
17163
- const k = 7.5625;
17164
- if (t < 1 / 2.75) return k * t * t;
17165
- if (t < 2 / 2.75) return k * (t - 1.5 / 2.75) ** 2 + 0.75;
17166
- if (t < 2.5 / 2.75) return k * (t - 2.25 / 2.75) ** 2 + 0.9375;
17167
- return k * (t - 2.625 / 2.75) ** 2 + 0.984375;
17168
- })
17169
- };
17170
- function shaped(at3, lerp3) {
17171
- return { at: at3, lerp: lerp3 };
17172
- }
17173
- function line(from, to, duration, shape = ease.linear) {
17174
- return [{ duration, lerp: shape.lerp, at: (u) => mix(from, to, shape.at(u)) }];
17175
- }
17176
- function hold(value, duration) {
17177
- return [{ duration, lerp: {}, at: () => value }];
17178
- }
17179
- function keyframes(keys, options = {}) {
17180
- const spans = [];
17181
- const [first] = keys;
17182
- if (first && first.at > 0) spans.push(...hold(first.value, first.at));
17183
- keys.forEach((to, i) => {
17184
- const from = keys[i - 1];
17185
- if (!from || to.at <= from.at) return;
17186
- const duration = to.at - from.at;
17187
- const shape = to.ease ?? ease.linear;
17188
- if (!options.smooth) {
17189
- spans.push(...line(from.value, to.value, duration, shape));
17190
- return;
17392
+ var Layout = class {
17393
+ screen;
17394
+ previous;
17395
+ /** The layout continues previous's id counter and keeps its ids. */
17396
+ constructor(previous) {
17397
+ this.previous = previous;
17398
+ this.screen = {
17399
+ nodes: /* @__PURE__ */ new Map(),
17400
+ ids: /* @__PURE__ */ new Map(),
17401
+ presses: /* @__PURE__ */ new Map(),
17402
+ changes: /* @__PURE__ */ new Map(),
17403
+ actions: /* @__PURE__ */ new Map(),
17404
+ wheels: /* @__PURE__ */ new Map(),
17405
+ next: previous?.next ?? 0
17406
+ };
17407
+ }
17408
+ /** add records a node. */
17409
+ add(node) {
17410
+ const value = node.steamId === void 0 ? node : { ...node, steamId: String(node.steamId) };
17411
+ const encoded = JSON.stringify(value);
17412
+ this.screen.nodes.set(node.id, { node, encoded });
17413
+ }
17414
+ /** id returns the node id for the element at place. */
17415
+ id(place2) {
17416
+ let found = this.previous?.ids.get(place2);
17417
+ if (found === void 0) {
17418
+ found = (this.screen.next++).toString(36);
17191
17419
  }
17192
- const before = keys[i - 2]?.value ?? from.value;
17193
- const after2 = keys[i + 1]?.value ?? to.value;
17194
- spans.push({
17195
- duration,
17196
- at: (u) => spline(before, from.value, to.value, after2, shape.at(u))
17420
+ this.screen.ids.set(place2, found);
17421
+ return found;
17422
+ }
17423
+ };
17424
+ function place(layout, child, at3) {
17425
+ if (child === null || child === void 0 || typeof child === "boolean") {
17426
+ return [];
17427
+ }
17428
+ if (isList(child)) {
17429
+ return child.flatMap((item2, index) => {
17430
+ const key = isElement(item2) ? item2.key : void 0;
17431
+ return place(
17432
+ layout,
17433
+ item2,
17434
+ key === void 0 ? `${at3},${index}` : `${at3},=${key}`
17435
+ );
17197
17436
  });
17198
- });
17199
- return spans;
17200
- }
17201
- function through(points, options) {
17202
- let at3 = 0;
17203
- let last = points[0];
17204
- const keys = points.map((value) => {
17205
- if (last !== void 0) at3 += distance2(last, value) / options.speed;
17206
- last = value;
17207
- return { at: at3, value, ease: options.ease };
17208
- });
17209
- return keyframes(keys, options);
17210
- }
17211
- function orbit(options) {
17212
- const { center, radius, duration } = options;
17213
- const turns = options.turns ?? 1;
17214
- const start2 = (options.start ?? 0) * Math.PI / 180;
17215
- const rise = options.rise ?? 0;
17216
- const shape = options.ease ?? ease.linear;
17217
- return [
17218
- {
17219
- duration,
17220
- at: (u) => {
17221
- const t = shape.at(u);
17222
- const angle = start2 + t * turns * 2 * Math.PI;
17223
- return {
17224
- x: center.x + radius * Math.cos(angle),
17225
- y: center.y + radius * Math.sin(angle),
17226
- z: center.z + rise * t
17227
- };
17228
- }
17229
- }
17230
- ];
17231
- }
17232
- function wave(options) {
17233
- const { amplitude, frequency, duration, decay } = options;
17234
- return [
17235
- {
17236
- duration,
17237
- at: (u) => amplitude * (decay ? 1 - u : 1) * Math.sin(2 * Math.PI * frequency * duration * u)
17238
- }
17239
- ];
17240
- }
17241
- function chain(...curves) {
17242
- return curves.flat();
17243
- }
17244
- function reverse(curve) {
17245
- return curve.map((span) => ({
17246
- duration: span.duration,
17247
- lerp: span.lerp?.bias === void 0 ? span.lerp : void 0,
17248
- at: (u) => span.at(1 - u)
17249
- })).reverse();
17250
- }
17251
- function repeat(curve, times) {
17252
- return Array.from({ length: Math.max(0, times) }, () => curve).flat();
17253
- }
17254
- function pingPong(curve) {
17255
- return chain(curve, reverse(curve));
17256
- }
17257
- function durationOf(curve) {
17258
- return curve.reduce((sum, span) => sum + Math.max(0, span.duration), 0);
17259
- }
17260
- function valueAt(curve, seconds) {
17261
- let left2 = seconds;
17262
- for (const span of curve) {
17263
- if (span.duration <= 0) continue;
17264
- if (left2 <= span.duration) return span.at(Math.max(0, left2) / span.duration);
17265
- left2 -= span.duration;
17266
17437
  }
17267
- return curve.at(-1)?.at(1);
17268
- }
17269
- function bias(t, b) {
17270
- return t ** (Math.log(b) / Math.log(0.5));
17271
- }
17272
- function gain(t, g) {
17273
- return t < 0.5 ? bias(2 * t, 1 - g) / 2 : 1 - bias(2 - 2 * t, 1 - g) / 2;
17274
- }
17275
- function mix(a, b, t) {
17276
- if (typeof a === "number" && typeof b === "number") return a + (b - a) * t;
17277
- const [p, q] = [vector2(a), vector2(b)];
17278
- return {
17279
- x: p.x + (q.x - p.x) * t,
17280
- y: p.y + (q.y - p.y) * t,
17281
- z: p.z + (q.z - p.z) * t
17282
- };
17283
- }
17284
- function spline(p0, p1, p2, p3, t) {
17285
- const f = (a2, b2, c2, d2) => 0.5 * (2 * b2 + (c2 - a2) * t + (2 * a2 - 5 * b2 + 4 * c2 - d2) * t * t + (3 * b2 - a2 - 3 * c2 + d2) * t * t * t);
17286
- if (typeof p0 === "number" && typeof p1 === "number" && typeof p2 === "number" && typeof p3 === "number") {
17287
- return f(p0, p1, p2, p3);
17438
+ if (!isElement(child)) {
17439
+ const node2 = {
17440
+ id: layout.id(at3),
17441
+ kind: 1 /* LABEL */,
17442
+ text: String(child)
17443
+ };
17444
+ layout.add(node2);
17445
+ return [node2.id];
17288
17446
  }
17289
- const [a, b, c, d] = [vector2(p0), vector2(p1), vector2(p2), vector2(p3)];
17290
- return {
17291
- x: f(a.x, b.x, c.x, d.x),
17292
- y: f(a.y, b.y, c.y, d.y),
17293
- z: f(a.z, b.z, c.z, d.z)
17447
+ if (child.type === fragment) {
17448
+ return place(layout, child.props.children, `${at3}>`);
17449
+ }
17450
+ const props = child.props;
17451
+ const node = {
17452
+ id: layout.id(at3),
17453
+ style: wireStyle(props.style),
17454
+ hover: wireStyle(props.hover),
17455
+ tooltip: props.tooltip,
17456
+ item: props.item ? itemId(props.item) : void 0,
17457
+ ability: props.ability?.name ? itemId(props.ability.name) : void 0,
17458
+ abilityPlayer: props.ability?.name ? props.ability.player.slot : void 0,
17459
+ hoverSound: props.hoverSound,
17460
+ enter: wireStyle(props.enter),
17461
+ exit: wireStyle(props.exit),
17462
+ cycle: cycle(props.cycle),
17463
+ classes: classes(props.class)
17294
17464
  };
17465
+ switch (child.type) {
17466
+ case "label":
17467
+ node.kind = 1 /* LABEL */;
17468
+ node.text = text(props.children);
17469
+ node.token = props.token;
17470
+ node.variables = variables(props.variables);
17471
+ break;
17472
+ case "avatar":
17473
+ node.kind = 8 /* AVATAR */;
17474
+ node.steamId = props.steamId;
17475
+ break;
17476
+ case "entry":
17477
+ case "slider":
17478
+ case "toggle":
17479
+ case "dropdown":
17480
+ input(layout, node, child.type, props);
17481
+ break;
17482
+ case "image":
17483
+ node.kind = 2 /* IMAGE */;
17484
+ node.image = props.src ?? "";
17485
+ node.scaling = scaling(props.scaling);
17486
+ break;
17487
+ case "hero":
17488
+ node.kind = 6 /* HERO_IMAGE */;
17489
+ node.hero = props.hero;
17490
+ node.heroLook = props.look === void 0 ? void 0 : looks[props.look];
17491
+ node.scaling = scaling(props.scaling);
17492
+ break;
17493
+ case "button":
17494
+ node.kind = 3 /* BUTTON */;
17495
+ node.sound = props.sound;
17496
+ node.disabled = props.disabled;
17497
+ if (props.onPress && !props.disabled) {
17498
+ layout.screen.presses.set(node.id, { handler: props.onPress });
17499
+ }
17500
+ node.children = place(layout, props.children, `${at3}/`);
17501
+ break;
17502
+ case "layout":
17503
+ node.kind = 4 /* LAYOUT */;
17504
+ node.layout = props.src ?? "";
17505
+ node.data = props.data === void 0 ? "" : JSON.stringify(props.data) ?? "";
17506
+ if (props.onAction) {
17507
+ layout.screen.actions.set(node.id, { handler: props.onAction });
17508
+ }
17509
+ break;
17510
+ default:
17511
+ node.kind = 0 /* PANEL */;
17512
+ node.children = place(layout, props.children, `${at3}/`);
17513
+ }
17514
+ layout.add(node);
17515
+ return [node.id];
17295
17516
  }
17296
- function distance2(a, b) {
17297
- if (typeof a === "number" && typeof b === "number") return Math.abs(b - a);
17298
- const [p, q] = [vector2(a), vector2(b)];
17299
- return Math.hypot(q.x - p.x, q.y - p.y, q.z - p.z);
17300
- }
17301
- function vector2(value) {
17302
- return typeof value === "number" ? { x: value, y: 0, z: 0 } : value;
17303
- }
17304
-
17305
- // js/src/camera.ts
17306
- function setOrbitCamera(player, enabled) {
17307
- const pawn = player.pawn();
17308
- if (!pawn?.entity) return false;
17309
- const flag = writeField(
17310
- pawn.entity,
17311
- "CCitadelPlayerPawn",
17312
- "m_bInHideoutZone",
17313
- "bool",
17314
- enabled
17315
- );
17316
- const zoom = holdModifierState(
17317
- pawn.entity,
17318
- "MODIFIER_STATE_HIDEOUT_ZONE",
17319
- enabled
17320
- );
17321
- if (enabled) return flag && zoom;
17322
- const orbit2 = fireInput(pawn.entity, "RemoveModifier", {
17323
- text: "modifier_citadel_orbit_camera"
17324
- });
17325
- return flag && zoom && orbit2;
17326
- }
17327
- var moves = 0;
17328
- function playCamera(player, options) {
17329
- const tracks = [];
17330
- for (const [param, curve] of Object.entries(options.tracks)) {
17331
- if (curve) tracks.push({ param, curve });
17517
+ function classes(names) {
17518
+ const list = (names ?? "").split(" ").filter((name) => name !== "");
17519
+ return list.length === 0 ? void 0 : list;
17520
+ }
17521
+ function input(layout, node, kind, props) {
17522
+ node.kind = 7 /* INPUT */;
17523
+ node.disabled = props.disabled;
17524
+ if (props.onChange && !props.disabled) {
17525
+ layout.screen.changes.set(node.id, { handler: props.onChange });
17526
+ }
17527
+ switch (kind) {
17528
+ case "entry":
17529
+ node.input = {
17530
+ case: "textEntry",
17531
+ value: {
17532
+ text: String(props.value ?? ""),
17533
+ placeholder: props.placeholder,
17534
+ maxLength: props.maxLength
17535
+ }
17536
+ };
17537
+ break;
17538
+ case "slider":
17539
+ if (props.onWheel && !props.disabled) {
17540
+ layout.screen.wheels.set(node.id, { handler: props.onWheel });
17541
+ }
17542
+ node.input = {
17543
+ case: "slider",
17544
+ value: {
17545
+ value: Number(props.value ?? 0),
17546
+ min: props.min,
17547
+ max: props.max,
17548
+ step: props.step,
17549
+ wheel: !!props.onWheel && !props.disabled
17550
+ }
17551
+ };
17552
+ break;
17553
+ case "toggle":
17554
+ node.text = text(props.children);
17555
+ node.input = { case: "toggle", value: { on: props.on } };
17556
+ break;
17557
+ case "dropdown":
17558
+ node.input = {
17559
+ case: "dropdown",
17560
+ value: {
17561
+ options: [...props.options ?? []],
17562
+ selected: props.selected
17563
+ }
17564
+ };
17332
17565
  }
17333
- return playTracks(player, options, tracks);
17334
17566
  }
17335
- function playTracks(player, options, tracks) {
17336
- const context = options.context ?? `modlock.camera.${++moves}`;
17337
- const length3 = Math.max(0, ...tracks.map((track) => durationOf(track.curve)));
17338
- const send2 = (delay) => tracks.every(
17339
- ({ param, curve }) => sendCurve(player, { ...options, context, param, delay }, curve)
17340
- );
17341
- let timer;
17342
- const stop = () => {
17343
- timer?.cancel();
17344
- return player.clearCamera(context);
17345
- };
17346
- let sent = send2(options.delay);
17347
- if (sent && options.loop && length3 > 0) {
17348
- sent = send2(void 0);
17349
- timer = every(length3, () => {
17350
- if (!send2(void 0)) stop();
17351
- });
17567
+ function variables(value) {
17568
+ if (!value) {
17569
+ return void 0;
17352
17570
  }
17353
- if (!sent) {
17354
- stop();
17571
+ const encoded = {};
17572
+ for (const [name, filled] of Object.entries(value)) {
17573
+ encoded[name] = String(filled);
17574
+ }
17575
+ return encoded;
17576
+ }
17577
+ function cycle(value) {
17578
+ if (!value) {
17355
17579
  return void 0;
17356
17580
  }
17357
17581
  return {
17358
- context,
17359
- duration: options.loop ? Infinity : (options.delay ?? 0) + length3,
17360
- cancel: stop
17582
+ style: wireStyle(value.style),
17583
+ seconds: value.seconds,
17584
+ count: value.count
17361
17585
  };
17362
17586
  }
17363
- function cameraPulse(player, options) {
17364
- const { param, by, ease: shape = ease.linear } = options;
17365
- const rest = zero2(by);
17366
- const curve = chain(
17367
- line(rest, by, options.in, shape),
17368
- hold(by, options.hold),
17369
- reverse(line(rest, by, options.out, shape))
17587
+ function diff(previous, next) {
17588
+ const set = [...next.nodes.values()].filter(
17589
+ ({ node, encoded }) => previous?.nodes.get(node.id)?.encoded !== encoded
17590
+ ).map(({ node }) => node);
17591
+ const removed = [...previous?.nodes.keys() ?? []].filter(
17592
+ (id) => !next.nodes.has(id)
17370
17593
  );
17371
- return playTracks(player, { ...options, relative: true }, [{ param, curve }]);
17372
- }
17373
- function cameraShake(player, options) {
17374
- const { amplitude, duration } = options;
17375
- const curve = wave({
17376
- amplitude,
17377
- duration,
17378
- frequency: options.frequency ?? 8,
17379
- decay: true
17380
- });
17381
- const param = options.param ?? "horizontalOffset";
17382
- return playTracks(player, { ...options, relative: true }, [{ param, curve }]);
17383
- }
17384
- function sendCurve(player, options, curve) {
17385
- const { context, param, relative, priority, target } = options;
17386
- const rate = options.rate ?? 30;
17387
- let delay = options.delay;
17388
- const lerp3 = (start2, end, duration, shape = {}) => {
17389
- const sent = player.moveCamera({
17390
- context,
17391
- param,
17392
- motion: { lerp: { start: start2, end, duration, ...shape } },
17393
- delay,
17394
- relative,
17395
- priority,
17396
- target
17397
- });
17398
- delay = void 0;
17399
- return sent;
17400
- };
17401
- return curve.every((span) => {
17402
- if (span.duration <= 0) return true;
17403
- if (span.lerp) {
17404
- return lerp3(span.at(0), span.at(1), span.duration, span.lerp);
17405
- }
17406
- const steps = Math.max(1, Math.ceil(span.duration * rate));
17407
- for (let i = 0; i < steps; i++) {
17408
- const sent = lerp3(
17409
- span.at(i / steps),
17410
- span.at((i + 1) / steps),
17411
- span.duration / steps
17412
- );
17413
- if (!sent) return false;
17414
- }
17415
- return true;
17416
- });
17594
+ if (previous && set.length === 0 && removed.length === 0) {
17595
+ return void 0;
17596
+ }
17597
+ return { reset: !previous, set, removed };
17417
17598
  }
17418
- function zero2(value) {
17419
- return typeof value === "number" ? 0 : { x: 0, y: 0, z: 0 };
17599
+ function send(slot, change2) {
17600
+ return call("Ui", UiRequest.toBinary({ player: slot, change: change2 })) !== void 0;
17420
17601
  }
17421
-
17422
- // js/src/format.ts
17423
- var format_exports = {};
17424
- __export(format_exports, {
17425
- clip: () => clip,
17426
- clock: () => clock,
17427
- count: () => count,
17428
- grouped: () => grouped,
17429
- ordinal: () => ordinal,
17430
- percent: () => percent,
17431
- stopwatch: () => stopwatch
17432
- });
17433
- function clock(seconds) {
17434
- const whole = Math.max(0, Math.ceil(seconds));
17435
- return `${Math.floor(whole / 60)}:${String(whole % 60).padStart(2, "0")}`;
17602
+ function isElement(child) {
17603
+ return typeof child === "object" && child !== null && !Array.isArray(child);
17436
17604
  }
17437
- function stopwatch(seconds) {
17438
- const hundredths = Math.max(0, Math.floor(seconds * 100));
17439
- const minutes = Math.floor(hundredths / 6e3);
17440
- const rest = hundredths % 6e3 / 100;
17441
- return `${minutes}:${rest.toFixed(2).padStart(5, "0")}`;
17605
+ function isList(child) {
17606
+ return Array.isArray(child);
17442
17607
  }
17443
- function percent(part, whole) {
17444
- if (!(whole > 0)) {
17445
- return "-";
17608
+ function text(children) {
17609
+ if (children === null || children === void 0 || typeof children === "boolean") {
17610
+ return "";
17446
17611
  }
17447
- return `${Math.round(Math.max(0, Math.min(part / whole, 1)) * 100)}%`;
17612
+ if (isList(children)) {
17613
+ return children.map(text).join("");
17614
+ }
17615
+ return isElement(children) ? "" : String(children);
17448
17616
  }
17449
- function grouped(value) {
17450
- return String(Math.round(value)).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
17617
+ var aligns = {
17618
+ left: 0 /* START */,
17619
+ top: 0 /* START */,
17620
+ center: 1 /* CENTER */,
17621
+ right: 2 /* END */,
17622
+ bottom: 2 /* END */
17623
+ };
17624
+ function align(value) {
17625
+ return value === void 0 ? void 0 : aligns[value];
17451
17626
  }
17452
- function ordinal(place2) {
17453
- const tens = place2 % 100;
17454
- const suffix = tens >= 11 && tens <= 13 ? "th" : ["th", "st", "nd", "rd"][place2 % 10] ?? "th";
17455
- return `${place2}${suffix}`;
17627
+ var hudParts = {
17628
+ levelUp: 1 /* LEVEL_UP */,
17629
+ ownHealth: 2 /* OWN_HEALTH */,
17630
+ topBar: 3 /* TOP_BAR */,
17631
+ ammo: 4 /* AMMO */,
17632
+ souls: 5 /* SOULS */,
17633
+ minimap: 6 /* MINIMAP */,
17634
+ abilities: 7 /* ABILITIES */,
17635
+ status: 8 /* STATUS */,
17636
+ stats: 9 /* STATS */,
17637
+ heroPicker: 10 /* HERO_PICKER */,
17638
+ brokerCountdown: 11 /* BROKER_COUNTDOWN */,
17639
+ all: 12 /* ALL */
17640
+ };
17641
+ var faces = {
17642
+ body: 1 /* BODY */,
17643
+ block: 2 /* BLOCK */,
17644
+ serif: 3 /* SERIF */
17645
+ };
17646
+ var looks = {
17647
+ small: 0 /* SMALL */,
17648
+ card: 1 /* CARD */,
17649
+ icon: 2 /* ICON */,
17650
+ vertical: 3 /* VERTICAL */,
17651
+ topBar: 4 /* TOP_BAR */,
17652
+ minimap: 5 /* MINIMAP */
17653
+ };
17654
+ var scalings = {
17655
+ fit: 1 /* FIT */,
17656
+ cover: 2 /* COVER */,
17657
+ stretch: 3 /* STRETCH */,
17658
+ fitWidth: 4 /* FIT_WIDTH */,
17659
+ fitHeight: 5 /* FIT_HEIGHT */,
17660
+ none: 6 /* NONE */
17661
+ };
17662
+ function scaling(value) {
17663
+ return value === void 0 ? void 0 : scalings[value];
17456
17664
  }
17457
- function count(number, thing, plural = `${thing}s`) {
17458
- return `${grouped(number)} ${number === 1 ? thing : plural}`;
17665
+ var flows = {
17666
+ down: 1 /* DOWN */,
17667
+ right: 2 /* RIGHT */,
17668
+ downWrap: 3 /* DOWN_WRAP */,
17669
+ rightWrap: 4 /* RIGHT_WRAP */
17670
+ };
17671
+ var overflows = {
17672
+ squish: 1 /* SQUISH */,
17673
+ clip: 2 /* CLIP */,
17674
+ scroll: 3 /* SCROLL */,
17675
+ show: 4 /* SHOW */
17676
+ };
17677
+ function overflow(value) {
17678
+ return value === void 0 ? void 0 : overflows[value];
17459
17679
  }
17460
- function clip(text2, width) {
17461
- if (text2.length <= width) return text2;
17462
- const cut = text2.slice(0, width - 1);
17463
- const space = cut.lastIndexOf(" ");
17464
- return `${(space > 0 ? cut.slice(0, space) : cut).trimEnd()}\u2026`;
17680
+ var shapes = {
17681
+ down: 0 /* DOWN */,
17682
+ right: 1 /* RIGHT */,
17683
+ up: 2 /* UP */,
17684
+ left: 3 /* LEFT */,
17685
+ radial: 4 /* RADIAL */
17686
+ };
17687
+ var weights = {
17688
+ thin: 1 /* THIN */,
17689
+ light: 2 /* LIGHT */,
17690
+ normal: 3 /* NORMAL */,
17691
+ medium: 4 /* MEDIUM */,
17692
+ semiBold: 5 /* SEMI_BOLD */,
17693
+ bold: 6 /* BOLD */,
17694
+ black: 7 /* BLACK */
17695
+ };
17696
+ var textOverflows = {
17697
+ ellipsis: 1 /* ELLIPSIS */,
17698
+ shrink: 2 /* SHRINK */,
17699
+ clip: 3 /* CLIP */
17700
+ };
17701
+ var decorations = {
17702
+ underline: 1 /* UNDERLINE */,
17703
+ strike: 2 /* STRIKE */
17704
+ };
17705
+ var easings = {
17706
+ out: 0 /* EASE_OUT */,
17707
+ in: 1 /* EASE_IN */,
17708
+ inOut: 2 /* EASE_IN_OUT */,
17709
+ linear: 3 /* LINEAR */
17710
+ };
17711
+ function wireStyle(style) {
17712
+ if (!style) {
17713
+ return void 0;
17714
+ }
17715
+ return {
17716
+ width: length(style.width),
17717
+ height: length(style.height),
17718
+ flow: style.flow === void 0 ? void 0 : flows[style.flow],
17719
+ horizontalAlign: align(style.horizontalAlign),
17720
+ verticalAlign: align(style.verticalAlign),
17721
+ margin: edges(style.margin),
17722
+ padding: edges(style.padding),
17723
+ background: color(style.background),
17724
+ color: color(style.color),
17725
+ fontSize: style.fontSize,
17726
+ bold: style.bold,
17727
+ textAlign: align(style.textAlign),
17728
+ borderRadius: style.borderRadius,
17729
+ opacity: style.opacity,
17730
+ face: style.face === void 0 ? void 0 : faces[style.face],
17731
+ uppercase: style.uppercase,
17732
+ letterSpacing: style.letterSpacing,
17733
+ shadow: style.shadow,
17734
+ borderWidth: style.borderWidth,
17735
+ borderColor: color(style.borderColor),
17736
+ x: length(style.x),
17737
+ y: length(style.y),
17738
+ minWidth: length(style.minWidth),
17739
+ maxWidth: length(style.maxWidth),
17740
+ minHeight: length(style.minHeight),
17741
+ maxHeight: length(style.maxHeight),
17742
+ zIndex: style.zIndex,
17743
+ overflowX: overflow(style.overflowX ?? style.overflow),
17744
+ overflowY: overflow(style.overflowY ?? style.overflow),
17745
+ gradient: gradient(style.gradient),
17746
+ boxShadow: shadow(style.boxShadow),
17747
+ textShadow: shadow(style.textShadow),
17748
+ tint: color(style.tint),
17749
+ saturation: style.saturation,
17750
+ brightness: style.brightness,
17751
+ contrast: style.contrast,
17752
+ blur: style.blur,
17753
+ italic: style.italic,
17754
+ weight: style.weight === void 0 ? void 0 : weights[style.weight],
17755
+ lineHeight: style.lineHeight,
17756
+ noWrap: style.noWrap,
17757
+ textOverflow: style.textOverflow === void 0 ? void 0 : textOverflows[style.textOverflow],
17758
+ decoration: style.decoration === void 0 ? void 0 : decorations[style.decoration],
17759
+ transform: transform(style),
17760
+ transition: transition(style.transition)
17761
+ };
17762
+ }
17763
+ function gradient(value) {
17764
+ if (!value) {
17765
+ return void 0;
17766
+ }
17767
+ const last = Math.max(1, value.colors.length - 1);
17768
+ return {
17769
+ shape: value.shape === void 0 ? void 0 : shapes[value.shape],
17770
+ stops: value.colors.map((each, index) => ({
17771
+ at: value.at?.[index] ?? index / last,
17772
+ color: color(each)
17773
+ }))
17774
+ };
17775
+ }
17776
+ function shadow(value) {
17777
+ if (!value) {
17778
+ return void 0;
17779
+ }
17780
+ return {
17781
+ x: value.x,
17782
+ y: value.y,
17783
+ blur: value.blur,
17784
+ spread: value.spread,
17785
+ color: color(value.color),
17786
+ inset: value.inset
17787
+ };
17788
+ }
17789
+ function transform(style) {
17790
+ const { translate, scale: scale2, rotate, origin } = style;
17791
+ if (!translate && scale2 === void 0 && rotate === void 0 && !origin) {
17792
+ return void 0;
17793
+ }
17794
+ const scales = typeof scale2 === "number" ? [scale2, scale2] : scale2;
17795
+ return {
17796
+ translateX: translate?.[0],
17797
+ translateY: translate?.[1],
17798
+ scaleX: scales?.[0],
17799
+ scaleY: scales?.[1],
17800
+ rotate,
17801
+ originX: origin?.[0],
17802
+ originY: origin?.[1]
17803
+ };
17804
+ }
17805
+ function transition(value) {
17806
+ if (value === void 0) {
17807
+ return void 0;
17808
+ }
17809
+ if (typeof value === "number") {
17810
+ return { seconds: value };
17811
+ }
17812
+ return {
17813
+ seconds: value.seconds,
17814
+ delay: value.delay,
17815
+ easing: value.easing === void 0 ? void 0 : easings[value.easing]
17816
+ };
17817
+ }
17818
+ function length(value) {
17819
+ if (value === void 0) {
17820
+ return void 0;
17821
+ }
17822
+ if (typeof value === "number") {
17823
+ return { value: { case: "pixels", value } };
17824
+ }
17825
+ if (value === "fit") {
17826
+ return { value: { case: "fitChildren", value: true } };
17827
+ }
17828
+ if (value === "fill") {
17829
+ return { value: { case: "fill", value: 1 } };
17830
+ }
17831
+ return { value: { case: "percent", value: Number.parseFloat(value) } };
17832
+ }
17833
+ function edges(value) {
17834
+ if (value === void 0) {
17835
+ return void 0;
17836
+ }
17837
+ if (typeof value === "number") {
17838
+ return { top: value, right: value, bottom: value, left: value };
17839
+ }
17840
+ if (value.length === 2) {
17841
+ return { top: value[0], right: value[1], bottom: value[0], left: value[1] };
17842
+ }
17843
+ return { top: value[0], right: value[1], bottom: value[2], left: value[3] };
17844
+ }
17845
+ function color(value) {
17846
+ const hex = value?.replace(/^#/, "");
17847
+ if (!hex || !/^[0-9a-f]{6}([0-9a-f]{2})?$/i.test(hex)) {
17848
+ return void 0;
17849
+ }
17850
+ return Number.parseInt(hex.length === 6 ? `${hex}ff` : hex, 16) >>> 0;
17465
17851
  }
17466
17852
 
17467
- // js/src/items.gen.ts
17468
- var itemTable = [
17469
- { name: "upgrade_ability_power_shard", id: 630839635, slot: "spirit", tier: 4, active: true, imbue: true, icon: "file://{images}/upgrades/mods_tech/echo_shard.psd" },
17470
- { name: "upgrade_ability_refresher", id: 677738769, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/refresher_module.psd" },
17471
- { name: "upgrade_absorbing_armor", id: 3028234315, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/arcane_medallion.psd" },
17472
- { name: "upgrade_acolytes_glove", id: 465043967, slot: "spirit", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/acolytes_glove.psd" },
17473
- { name: "upgrade_active_reload", id: 381961617, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_utility/deployable_bullet_shield.psd" },
17474
- { name: "upgrade_aerial_assault", id: 271801138, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_utility/springy_boots.psd" },
17475
- { name: "upgrade_aoe_root", id: 1152158042, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/area_immobilize.psd" },
17476
- { name: "upgrade_aprounds", id: 673001892, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/armor_breaking_bullets.psd" },
17477
- { name: "upgrade_arcane_extension", id: 2951612397, slot: "spirit", tier: 2, active: false, imbue: true, icon: "file://{images}/upgrades/mods_tech/duration_extender.psd" },
17478
- { name: "upgrade_arcane_surge", id: 1150006784, slot: "spirit", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/arcane_surge.psd" },
17479
- { name: "upgrade_arctic_blast", id: 3812615317, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_utility/ice_blast.psd" },
17480
- { name: "upgrade_auto_cleanse", id: 951866250, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/items/vitality/indomitable.psd" },
17481
- { name: "upgrade_banshee_slugs", id: 3884003354, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/banshee_slugs.psd" },
17482
- { name: "upgrade_berserker", id: 1414319208, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/berserker.psd" },
17483
- { name: "upgrade_blitz_bullets", id: 4104549924, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/fire_rate_plus.psd" },
17484
- { name: "upgrade_boundless_spirit", id: 2519598785, slot: "spirit", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/boundless_spirit.psd" },
17485
- { name: "upgrade_boxing_glove", id: 1252627263, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/boxing_glove.psd" },
17486
- { name: "upgrade_bullet_armor_reduction_aura", id: 2481177645, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_armor_reduction_aura.psd" },
17487
- { name: "upgrade_bullet_resist_shredder", id: 2971868509, slot: "spirit", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/bullet_resist_shredder.psd" },
17488
- { name: "upgrade_bulletshredimbue", id: 3294954488, slot: "weapon", tier: 3, active: false, imbue: true, icon: "file://{images}/upgrades/mods_weapon/fire_rate_plus.psd" },
17489
- { name: "upgrade_burst_fire", id: 2739107182, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/fire_rate_plus_plus.psd" },
17490
- { name: "upgrade_capacitor", id: 710436191, slot: "weapon", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/electrified_bullets.psd" },
17491
- { name: "upgrade_cardio_calibrator", id: 2447176615, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_utility/sprint_booster.psd" },
17492
- { name: "upgrade_celestial_guidance", id: 3729138568, slot: "vitality", tier: 5, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/debuff_reducer.psd" },
17493
- { name: "upgrade_chain_lightning", id: 811521119, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/electrified_bullets.psd" },
17494
- { name: "upgrade_cheat_death", id: 3361811174, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/torment_aura.psd" },
17495
- { name: "upgrade_chonky", id: 3585132399, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/revitalizer.psd" },
17496
- { name: "upgrade_clip_size", id: 1548066885, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/clip_size.psd" },
17497
- { name: "upgrade_cloaking_device_active", id: 1798666702, slot: "weapon", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_utility/cloaking_device.psd" },
17498
- { name: "upgrade_close_quarter_combat", id: 2095565695, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/point_blank.psd" },
17499
- { name: "upgrade_close_range", id: 1342610602, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/close_range.psd" },
17500
- { name: "upgrade_cold_front", id: 1976391348, slot: "spirit", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_utility/ice_blast.psd" },
17501
- { name: "upgrade_colossus", id: 2407781327, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/colossus.psd" },
17502
- { name: "upgrade_containment", id: 1813726886, slot: "spirit", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/immobilize.psd" },
17503
- { name: "upgrade_cooldown_reduction", id: 3261353684, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/spiritual_flow.psd" },
17504
- { name: "upgrade_counterspell", id: 1414025773, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/hud/modifiers/icon_parry.svg" },
17505
- { name: "upgrade_crackshot", id: 395867183, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/explosive_bullets.psd" },
17506
- { name: "upgrade_critshot", id: 1396247347, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/crit_damage.psd" },
17507
- { name: "upgrade_crushing_fists", id: 800008313, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/melee_charge.psd" },
17508
- { name: "upgrade_damage_recycler", id: 865846625, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/leech.psd" },
17509
- { name: "upgrade_debuff_reducer", id: 1047818222, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/debuff_reducer.psd" },
17510
- { name: "upgrade_deflecting_armor", id: 3491236900, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/arcane_medallion.psd" },
17511
- { name: "upgrade_disarm", id: 2645639421, slot: "spirit", tier: 1, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/disarm.psd" },
17512
- { name: "upgrade_discord", id: 2417568017, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/rupture.psd" },
17513
- { name: "upgrade_divine_barrier", id: 1662311306, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/savior.psd" },
17514
- { name: "upgrade_diviners_kevlar", id: 2820116164, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_shield.psd" },
17515
- { name: "upgrade_dps_aura", id: 2108215830, slot: "weapon", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/bullet_damage_aura.psd" },
17516
- { name: "upgrade_eldritch_shot", id: 3568217437, slot: "weapon", tier: 5, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/explosive_bullets.psd" },
17517
- { name: "upgrade_endurance", id: 2829638276, slot: "vitality", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/endurance.psd" },
17518
- { name: "upgrade_escalating_exposure", id: 3005970438, slot: "spirit", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/escalating_exposure.psd" },
17519
- { name: "upgrade_ethereal_bullets", id: 3919289022, slot: "spirit", tier: 4, active: false, imbue: true, icon: "file://{images}/upgrades/mods_weapon/fire_rate_plus.psd" },
17520
- { name: "upgrade_extra_charge", id: 3776945997, slot: "spirit", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/extra_charge.psd" },
17521
- { name: "upgrade_fervor", id: 339443430, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/fervor.psd" },
17522
- { name: "upgrade_fleetfoot_boots", id: 3403085434, slot: "weapon", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/fleetfoot_boots.psd" },
17523
- { name: "upgrade_focus_lens", id: 2142980412, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/focused_silence.psd" },
17524
- { name: "upgrade_fury_trance", id: 1409190604, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/vampiric_burst.psd" },
17525
- { name: "upgrade_glass_cannon", id: 365620721, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/glass_cannon.psd" },
17526
- { name: "upgrade_glitch", id: 2617435668, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/glitch.psd" },
17527
- { name: "upgrade_goose_egg", id: 2462046703, slot: "spirit", tier: 1, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/tech_damage.psd" },
17528
- { name: "upgrade_greater_withering_whip", id: 2061878743, slot: "spirit", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/disarm.psd" },
17529
- { name: "upgrade_grit", id: 1672893796, slot: "vitality", tier: 1, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_shield.psd" },
17530
- { name: "upgrade_guardian_ward", id: 857669956, slot: "vitality", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/savior.psd" },
17531
- { name: "upgrade_headhunter", id: 4053935515, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/headhunter.psd" },
17532
- { name: "upgrade_headshot_booster", id: 2010028405, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/headshot_booster.psd" },
17533
- { name: "upgrade_headshot_booster2", id: 1770441818, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/headshot_booster.psd" },
17534
- { name: "upgrade_healbane", id: 2603935618, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/healbane.psd" },
17535
- { name: "upgrade_healbuff", id: 1427630806, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/aura_icon.psd" },
17536
- { name: "upgrade_healing_booster", id: 2566692615, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/healing_booster.psd" },
17537
- { name: "upgrade_health", id: 3633614685, slot: "vitality", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/health.psd" },
17538
- { name: "upgrade_health_nova", id: 2956256701, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_utility/health_nova.psd" },
17539
- { name: "upgrade_health_regen_aura", id: 3321728133, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/health_regen_aura.psd" },
17540
- { name: "upgrade_health_stealing_magic", id: 876563814, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/health_stealing_tech.psd" },
17541
- { name: "upgrade_health_stimpak", id: 1710079648, slot: "vitality", tier: 1, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/stimpak.psd" },
17542
- { name: "upgrade_high_velocity_mag", id: 3077079169, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/high_velocity_mag.psd" },
17543
- { name: "upgrade_hollow_point_rounds", id: 2678489038, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/hollow_point.psd" },
17544
- { name: "upgrade_icarus_wings", id: 1736094134, slot: "vitality", tier: 5, active: false, imbue: false, icon: "file://{images}/upgrades/mods_utility/sprint_booster.psd" },
17545
- { name: "upgrade_imbued_duration_extender", id: 2717651715, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/arcane_persistance.psd" },
17546
- { name: "upgrade_improved_bullet_armor", id: 3140772621, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/improved_bullet_armor.psd" },
17547
- { name: "upgrade_improved_spirit", id: 968099481, slot: "spirit", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/tech_damage.psd" },
17548
- { name: "upgrade_improved_stamina", id: 4139877411, slot: "vitality", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/improved_stamina.psd" },
17549
- { name: "upgrade_infinite_rounds", id: 3269957497, slot: "weapon", tier: 5, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/armor_breaking_bullets.psd" },
17550
- { name: "upgrade_infuser", id: 1797283378, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/infuser.psd" },
17551
- { name: "upgrade_inhibitor", id: 2037039379, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/inhibitor.psd" },
17552
- { name: "upgrade_intensifying_clip", id: 2407033488, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/auto_reloader.psd" },
17553
- { name: "upgrade_juggernaut", id: 1250307611, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/items/vitality/juggernaut.psd" },
17554
- { name: "upgrade_kinetic_sash", id: 3977876567, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/kinetic_sash.psd" },
17555
- { name: "upgrade_lifestrike_gauntlets", id: 1437614329, slot: "vitality", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/lifestrike_gauntlets.psd" },
17556
- { name: "upgrade_long_range", id: 3331811235, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/long_range.psd" },
17557
- { name: "upgrade_magic_burst", id: 1998374645, slot: "spirit", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/magic_burst.psd" },
17558
- { name: "upgrade_magic_carpet", id: 2800629741, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/hud/abilities/kelvin/ice_path.psd" },
17559
- { name: "upgrade_magic_reach", id: 754480263, slot: "spirit", tier: 1, active: false, imbue: true, icon: "file://{images}/upgrades/mods_tech/tech_range.psd" },
17560
- { name: "upgrade_magic_shield", id: 3970837787, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/tech_shield_pulse.psd" },
17561
- { name: "upgrade_magic_shock", id: 2121044373, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/magic_shock.psd" },
17562
- { name: "upgrade_magic_slow", id: 1102081447, slot: "spirit", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/slowing_tech.psd" },
17563
- { name: "upgrade_magic_storm", id: 1292979587, slot: "spirit", tier: 3, active: false, imbue: true, icon: "file://{images}/upgrades/mods_tech/magic_storm.psd" },
17564
- { name: "upgrade_magic_tempo", id: 380806748, slot: "spirit", tier: 2, active: false, imbue: true, icon: "file://{images}/upgrades/mods_utility/advanced_recharge.psd" },
17565
- { name: "upgrade_magic_vulnerability", id: 2081037738, slot: "spirit", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/tech_vulnerability.psd" },
17566
- { name: "upgrade_medic_bullets", id: 3862866912, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/medic_bullets.psd" },
17567
- { name: "upgrade_melee_charge", id: 26002154, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/melee_charge.psd" },
17568
- { name: "upgrade_melee_rebuttal", id: 4204808176, slot: "vitality", tier: 1, active: false, imbue: false, icon: "file://{images}/hud/modifiers/icon_parry.svg" },
17569
- { name: "upgrade_metal_skin", id: 1378931225, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/metal_skin.psd" },
17570
- { name: "upgrade_mystic_regeneration", id: 1439347412, slot: "spirit", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/endurance.psd" },
17571
- { name: "upgrade_mystic_reverb", id: 3577481646, slot: "spirit", tier: 4, active: false, imbue: true, icon: "file://{images}/upgrades/mods_tech/magic_reverb.psd" },
17572
- { name: "upgrade_mystical_piano", id: 2054088113, slot: "spirit", tier: 5, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/knockdown.psd" },
17573
- { name: "upgrade_non_player_bonus", id: 1009965641, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/reaper_rounds.psd" },
17574
- { name: "upgrade_nullification_aura", id: 3949773228, slot: "vitality", tier: 5, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_armor_reduction_aura.psd" },
17575
- { name: "upgrade_omnicharge_pendant", id: 424779525, slot: "spirit", tier: 5, active: false, imbue: true, icon: "file://{images}/upgrades/mods_tech/rapid_recharge.psd" },
17576
- { name: "upgrade_personal_rejuvenator", id: 2329546537, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/rebirth.psd" },
17577
- { name: "upgrade_phantom_strike", id: 1371725689, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/phantom_strike.psd" },
17578
- { name: "upgrade_prism_blast", id: 1132564516, slot: "spirit", tier: 5, active: true, imbue: false, icon: "file://{images}/items/spirit/ethereal_shift.psd" },
17579
- { name: "upgrade_pristine_emblem", id: 2064029594, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/pristine_emblem.psd" },
17580
- { name: "upgrade_proc_silence", id: 1113837674, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/emp_bullets.psd" },
17581
- { name: "upgrade_quick_silver", id: 84321454, slot: "spirit", tier: 2, active: false, imbue: true, icon: "file://{images}/upgrades/mods_weapon/fire_rate_plus.psd" },
17582
- { name: "upgrade_rapid_recharge", id: 787198704, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/rapid_recharge.psd" },
17583
- { name: "upgrade_rapid_rounds", id: 668299740, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/rapid_rounds.psd" },
17584
- { name: "upgrade_rebirth", id: 4003032160, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/rebirth.psd" },
17585
- { name: "upgrade_rechargingbullets", id: 1763073141, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/arcane_medallion.psd" },
17586
- { name: "upgrade_reduce_debuff_duration", id: 3731635960, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/debuff_remover.psd" },
17587
- { name: "upgrade_regenerating_bullet_shield", id: 1235347618, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_shield.psd" },
17588
- { name: "upgrade_reinforcing_casings", id: 2463960640, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_armor_plus.psd" },
17589
- { name: "upgrade_rescue_beam", id: 1804594021, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/medic_beam.psd" },
17590
- { name: "upgrade_resonant_healing", id: 2947183272, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/boundless_spirit.psd" },
17591
- { name: "upgrade_restorative_locket", id: 2059712766, slot: "vitality", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/restorative_locket.psd" },
17592
- { name: "upgrade_return_fire", id: 3361075077, slot: "vitality", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/return_fire.psd" },
17593
- { name: "upgrade_ricochet", id: 2480592370, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/ricochet.psd" },
17594
- { name: "upgrade_rocket_booster", id: 600033864, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/hud/abilities/lash/lash_death_slam.psd" },
17595
- { name: "upgrade_rocket_boots", id: 3830846077, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_utility/springy_boots.psd" },
17596
- { name: "upgrade_rupture", id: 3144988365, slot: "spirit", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/rupture.psd" },
17597
- { name: "upgrade_self_bubble", id: 2533252781, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/items/spirit/ethereal_shift.psd" },
17598
- { name: "upgrade_sharpshooter", id: 2152872419, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/longshot.psd" },
17599
- { name: "upgrade_shrink_ray", id: 4121584236, slot: "spirit", tier: 5, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/stimpak.psd" },
17600
- { name: "upgrade_siphon_bullets", id: 1282141666, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/siphon_bullets.psd" },
17601
- { name: "upgrade_slowing_bullets", id: 393974127, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/slowing_bullets.psd" },
17602
- { name: "upgrade_soaring_spirit", id: 7409189, slot: "spirit", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/soaring_spirit.psd" },
17603
- { name: "upgrade_spellslinger_headshots", id: 4075861416, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/spellslinger_headshots.psd" },
17604
- { name: "upgrade_spirit_bubble", id: 112198670, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_shield.psd" },
17605
- { name: "upgrade_spirit_burn", id: 343572757, slot: "spirit", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/escalating_exposure.psd" },
17606
- { name: "upgrade_spirit_sap", id: 1219329868, slot: "spirit", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/focused_silence.psd" },
17607
- { name: "upgrade_spirit_snatch", id: 3190916303, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/spirit_snatch.psd" },
17608
- { name: "upgrade_split_shot", id: 3647584222, slot: "weapon", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/titanic_magazine.psd" },
17609
- { name: "upgrade_sprint_booster", id: 3399065363, slot: "vitality", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_utility/sprint_booster.psd" },
17610
- { name: "upgrade_superior_stamina", id: 334300056, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/superior_stamina.psd" },
17611
- { name: "upgrade_suppressor", id: 1925087134, slot: "spirit", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/weapon_jammer.psd" },
17612
- { name: "upgrade_surging_power", id: 1055679805, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/vampiric_burst.psd" },
17613
- { name: "upgrade_target_stun", id: 1254091416, slot: "spirit", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/knockdown.psd" },
17614
- { name: "upgrade_targeted_silence", id: 619484391, slot: "spirit", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/targeted_silence.psd" },
17615
- { name: "upgrade_tech_damage_pulse", id: 395944548, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/torment_aura.psd" },
17616
- { name: "upgrade_tech_defense_shredders", id: 1144549437, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/tech_resist_shredder.psd" },
17617
- { name: "upgrade_tech_overflow", id: 2226497419, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/magic_overflow.psd" },
17618
- { name: "upgrade_tech_purge", id: 2163598980, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/tech_purge.psd" },
17619
- { name: "upgrade_tech_range", id: 1193964439, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/spiritual_dominion.psd" },
17620
- { name: "upgrade_thermal_detonator", id: 1932939246, slot: "weapon", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/thermal_detonator.psd" },
17621
- { name: "upgrade_titan_round", id: 2356412290, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/titanic_magazine.psd" },
17622
- { name: "upgrade_toxic_bullets", id: 3696726732, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/serrated_bullets.psd" },
17623
- { name: "upgrade_trophy_collector", id: 3074274290, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_utility/sprint_booster.psd" },
17624
- { name: "upgrade_ultimate_burst", id: 493591231, slot: "spirit", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/adrenaline_rush.psd" },
17625
- { name: "upgrade_unstoppable", id: 3357231760, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/unstoppable.psd" },
17626
- { name: "upgrade_vampire", id: 499683006, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/health_stealing_bullets.psd" },
17627
- { name: "upgrade_veil_walker", id: 865958998, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_utility/veil_walker.psd" },
17628
- { name: "upgrade_vex_barrier", id: 1644605047, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/last_stand.psd" },
17629
- { name: "upgrade_warp_stone", id: 3270001687, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/warp_stone.psd" },
17630
- { name: "upgrade_weapon_shielding", id: 805079544, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_shield.psd" },
17631
- { name: "upgrade_weighted_shots", id: 3791587546, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/improved_bullet_armor.psd" },
17632
- { name: "upgrade_withering_whip", id: 2922054143, slot: "spirit", tier: 1, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/slowing_tech.psd" }
17633
- ];
17634
-
17635
- // js/src/items.ts
17636
- var items = itemTable;
17637
- function item(name) {
17638
- return byName.get(name);
17853
+ // js/src/vector.ts
17854
+ var vector_exports = {};
17855
+ __export(vector_exports, {
17856
+ add: () => add,
17857
+ aimAt: () => aimAt,
17858
+ at: () => at,
17859
+ distance: () => distance,
17860
+ dot: () => dot,
17861
+ flatDistance: () => flatDistance,
17862
+ forward: () => forward,
17863
+ length: () => length2,
17864
+ lerp: () => lerp2,
17865
+ level: () => level,
17866
+ normalize: () => normalize,
17867
+ scale: () => scale,
17868
+ sub: () => sub,
17869
+ toward: () => toward,
17870
+ yawToward: () => yawToward
17871
+ });
17872
+ function at(x, y, z) {
17873
+ return { x, y, z };
17874
+ }
17875
+ function add(a, b) {
17876
+ return { x: a.x + b.x, y: a.y + b.y, z: a.z + b.z };
17877
+ }
17878
+ function sub(a, b) {
17879
+ return { x: a.x - b.x, y: a.y - b.y, z: a.z - b.z };
17880
+ }
17881
+ function scale(a, s) {
17882
+ return { x: a.x * s, y: a.y * s, z: a.z * s };
17883
+ }
17884
+ function dot(a, b) {
17885
+ return a.x * b.x + a.y * b.y + a.z * b.z;
17886
+ }
17887
+ function length2(a) {
17888
+ return Math.hypot(a.x, a.y, a.z);
17889
+ }
17890
+ function normalize(a) {
17891
+ const size = length2(a);
17892
+ return size > 0 ? scale(a, 1 / size) : { x: 1, y: 0, z: 0 };
17893
+ }
17894
+ function lerp2(a, b, t) {
17895
+ return {
17896
+ x: a.x + (b.x - a.x) * t,
17897
+ y: a.y + (b.y - a.y) * t,
17898
+ z: a.z + (b.z - a.z) * t
17899
+ };
17900
+ }
17901
+ function distance(a, b) {
17902
+ return Math.hypot(a.x - b.x, a.y - b.y, a.z - b.z);
17903
+ }
17904
+ function flatDistance(a, b) {
17905
+ return Math.hypot(a.x - b.x, a.y - b.y);
17906
+ }
17907
+ function toward(from, to) {
17908
+ const span = distance(from, to);
17909
+ return span > 0 ? scale(sub(to, from), 1 / span) : { x: 0, y: 0, z: 0 };
17910
+ }
17911
+ function yawToward(from, to) {
17912
+ return Math.atan2(to.y - from.y, to.x - from.x) * 180 / Math.PI;
17913
+ }
17914
+ function level(yaw) {
17915
+ return { pitch: 0, yaw, roll: 0 };
17916
+ }
17917
+ function aimAt(from, to) {
17918
+ const across = flatDistance(from, to);
17919
+ return {
17920
+ pitch: -Math.atan2(to.z - from.z, across) * 180 / Math.PI,
17921
+ yaw: yawToward(from, to),
17922
+ roll: 0
17923
+ };
17924
+ }
17925
+ function forward(angles2) {
17926
+ const pitch = angles2.pitch * Math.PI / 180;
17927
+ const yaw = angles2.yaw * Math.PI / 180;
17928
+ return {
17929
+ x: Math.cos(pitch) * Math.cos(yaw),
17930
+ y: Math.cos(pitch) * Math.sin(yaw),
17931
+ z: -Math.sin(pitch)
17932
+ };
17639
17933
  }
17640
- var byName = new Map(items.map((each) => [each.name, each]));
17641
17934
 
17642
- // js/src/hook.ts
17643
- var hookAbility = "citadel_ability_hook";
17644
- var hookUpgrades = 15;
17645
- var Hook = class {
17646
- constructor(read, cooldownSeconds = 0) {
17647
- this.read = read;
17648
- this.cooldownSeconds = cooldownSeconds;
17649
- }
17650
- read;
17651
- cooldownSeconds;
17652
- /** thrownAt is the start of the latest cooldown counted as a throw. */
17653
- thrownAt = 0;
17654
- /** reset forgets the throws counted so far, for a thrower in a new world. */
17655
- reset() {
17656
- this.thrownAt = 0;
17657
- }
17935
+ // js/src/bits.ts
17936
+ var Buttons = {
17937
+ /** attack is the primary fire button. */
17938
+ attack: 1n,
17658
17939
  /**
17659
- * update reads the thrower's hook at game time now, keeps it fully upgraded
17660
- * and sets the length of any cooldown a throw started. It reports nothing
17661
- * for a hero without the hook. A caller that already read this frame's
17662
- * abilities passes them to avoid another read.
17940
+ * jump is the jump key, Space by default (IN_MANTLE). Blocking it stops the
17941
+ * native jump and mantle; the jumping client still predicts the jump and is
17942
+ * corrected.
17663
17943
  */
17664
- update(player, now4, abilities = player.abilities()) {
17665
- const ability = abilities.find((a) => a.name === hookAbility);
17666
- if (!ability) {
17667
- return void 0;
17668
- }
17669
- const victim = this.victim(ability.entity);
17670
- if ((ability.upgrades & hookUpgrades) !== hookUpgrades) {
17671
- player.setAbility({ ability: hookAbility, upgrades: hookUpgrades });
17672
- }
17673
- if (ability.cooldownEnd <= now4) {
17674
- return { victim, thrown: false };
17675
- }
17676
- const thrown = ability.cooldownStart > this.thrownAt;
17677
- if (thrown) {
17678
- this.thrownAt = ability.cooldownStart;
17679
- }
17680
- this.setCooldown(player, ability);
17681
- return { victim, thrown };
17682
- }
17683
- /** victim is the hero the hook entity holds, or undefined while it holds none. */
17684
- victim(hookEntity) {
17685
- const victim = this.read(
17686
- hookEntity,
17687
- "CCitadel_Ability_Hook",
17688
- "m_hHookVictim",
17689
- "handle"
17690
- );
17691
- return typeof victim === "number" ? victim : void 0;
17692
- }
17693
- /** setCooldown ends the cooldown cooldownSeconds after the hook's throw. */
17694
- setCooldown(player, ability) {
17695
- if (this.cooldownSeconds <= 0) {
17696
- player.refreshAbility(hookAbility);
17697
- return;
17698
- }
17699
- const cooldownEnd = ability.cooldownStart + this.cooldownSeconds;
17700
- if (cooldownEnd !== ability.cooldownEnd) {
17701
- player.setAbility({ ability: hookAbility, cooldownEnd });
17702
- }
17703
- }
17704
- };
17705
-
17706
- // js/src/theme.ts
17707
- var theme_exports = {};
17708
- __export(theme_exports, {
17709
- emptyPip: () => emptyPip,
17710
- fpsReadoutBottom: () => fpsReadoutBottom,
17711
- motion: () => motion,
17712
- objectiveBarBottom: () => objectiveBarBottom,
17713
- pillEdge: () => pillEdge,
17714
- pipRings: () => pipRings,
17715
- pipShapes: () => pipShapes,
17716
- plate: () => plate,
17717
- shades: () => shades,
17718
- sizes: () => sizes,
17719
- sounds: () => sounds,
17720
- teamBarBottom: () => teamBarBottom,
17721
- teamTones: () => teamTones,
17722
- tones: () => tones,
17723
- types: () => types
17724
- });
17725
- var tones = {
17726
- text: "#ffefd7",
17727
- muted: "#bfb3a1",
17728
- // The accent marks the player's own choices.
17729
- accent: "#fd736d",
17730
- // Text on an accent fill.
17731
- onAccent: "#070709",
17732
- amber: "#d4860b",
17733
- sapphire: "#4d75c3",
17734
- // The gas of a closing arena.
17735
- gas: "#3ee08f",
17736
- // Done, under par, ready and live: a step darker than gas, so status text
17737
- // and tags sit calmer on the plates.
17738
- success: "#36c47f",
17739
- danger: "#ff410d",
17740
- gold: "#ebc934"
17741
- };
17742
- var teamTones = {
17743
- 2: "amber",
17744
- 3: "sapphire"
17745
- };
17746
- var shades = {
17747
- /** offWhite at about half strength: idle navigation and secondary text. */
17748
- quiet: "#ffefd78c",
17749
- /** offWhite at the popup button's 44%: idle pill borders. */
17750
- faint: "#ffefd770",
17751
- /** offWhite at about 40%: counts, placeholders and offline players. */
17752
- dim: "#6b675d",
17753
- /** offWhite at 13%: hairlines between sections and plate edges. */
17754
- hairline: "#2b2a24",
17755
- /** offBlack: text on light fills, and the backdrop's hue. */
17756
- ink: "#10130d",
17757
- /** The menu backdrop: an opaque offBlack that hides the stock menu. */
17758
- backdrop: "#0b0d09",
17759
- /** The backdrop at 95%, under a panel the player reads over the game. */
17760
- veil: "#0b0d09f2",
17761
- /** offWhite at 4%: a plate on the backdrop. */
17762
- plate: "#151611",
17763
- /** offWhite at 8%: a row or stat inside a plate. */
17764
- raised: "#1e1f19",
17765
- /** offWhite at 13%: a hovered or joined row. */
17766
- lit: "#2b2a24",
17767
- /** The full-strength fill of a lit primary button. */
17768
- white: "#ffffff",
17769
- /** No fill or border, where a state turns one off. */
17770
- clear: "#00000000"
17771
- };
17772
- var sizes = {
17773
- /** control is the height of panel buttons and fields. */
17774
- control: 32,
17775
- /** rowControl is the height of a button inside a list row. */
17776
- rowControl: 28,
17777
- /** row is the height of one list row. */
17778
- row: 32,
17779
- /** radius rounds buttons, fields and tags. */
17780
- radius: 4,
17781
- /** panelRadius rounds panels. */
17782
- panelRadius: 8
17783
- };
17784
- var types = {
17785
- display: { face: "block", size: 46, uppercase: true },
17786
- title: { face: "block", size: 26, uppercase: true },
17787
- body: { face: "body", size: 17, uppercase: false },
17788
- label: { face: "block", size: 15, uppercase: true },
17789
- caption: { face: "body", size: 14, uppercase: false }
17790
- };
17791
- var plate = {
17792
- color: "#000000e0",
17793
- radius: 5,
17794
- /** padding is [vertical, horizontal] in pixels. */
17795
- padding: [10, 18]
17944
+ jump: 1n << 48n,
17945
+ /** crouch is the crouch key, Ctrl by default. */
17946
+ crouch: 1n << 2n,
17947
+ /** dash is the dash key, Shift by default. */
17948
+ dash: 1n << 16n,
17949
+ /** use is the interact key. */
17950
+ use: 1n << 5n,
17951
+ /** altFire is the zoom and alternate fire button, right mouse by default. */
17952
+ altFire: 1n << 11n,
17953
+ /** reload is the reload key. */
17954
+ reload: 1n << 13n,
17955
+ /** melee is the light melee key, Q by default. */
17956
+ melee: 1n << 32n,
17957
+ /** ability1 to ability3 are the hero's first three ability keys. */
17958
+ ability1: 1n << 33n,
17959
+ ability2: 1n << 34n,
17960
+ ability3: 1n << 35n,
17961
+ /** ultimate is the hero's ultimate ability key, the fourth. */
17962
+ ultimate: 1n << 36n,
17963
+ /** parry is the melee parry button. */
17964
+ parry: 1n << 42n
17796
17965
  };
17797
- var pillEdge = "#ffefd71a";
17798
- var pipShapes = {
17799
- round: { width: 18, height: 18, radius: 9 },
17800
- tick: { width: 7, height: 18, radius: 2 }
17966
+ var Layers = {
17967
+ /** solid is the world and solid objects. */
17968
+ solid: 1n << 0n,
17969
+ /** hitbox is the hit boxes of heroes and units. */
17970
+ hitbox: 1n << 1n,
17971
+ /** trigger is invisible volumes that react to touch. */
17972
+ trigger: 1n << 2n,
17973
+ /** playerClip is walls that only stop heroes. */
17974
+ playerClip: 1n << 4n,
17975
+ /** player is player-controlled heroes. */
17976
+ player: 1n << 18n,
17977
+ /** npc is units that are not players. */
17978
+ npc: 1n << 19n,
17979
+ /** staticLevel is the map's built geometry, foliage included. */
17980
+ staticLevel: 1n << 30n,
17981
+ /** hero, trooper and building are those units' bodies. */
17982
+ hero: 1n << 37n,
17983
+ trooper: 1n << 38n,
17984
+ building: 1n << 40n
17801
17985
  };
17802
- var pipRings = { empty: "#ffefd72e", filled: "#10130de6" };
17803
- var emptyPip = "#00000000";
17804
- var teamBarBottom = 84;
17805
- var objectiveBarBottom = 220;
17806
- var fpsReadoutBottom = 68;
17807
- var sounds = {
17808
- hover: "UI.MainMenu.Hover",
17809
- press: "UI.MainMenu.Activate"
17986
+
17987
+ // js/src/curve.ts
17988
+ var curve_exports = {};
17989
+ __export(curve_exports, {
17990
+ chain: () => chain,
17991
+ durationOf: () => durationOf,
17992
+ ease: () => ease,
17993
+ hold: () => hold,
17994
+ keyframes: () => keyframes,
17995
+ line: () => line,
17996
+ orbit: () => orbit,
17997
+ pingPong: () => pingPong,
17998
+ repeat: () => repeat,
17999
+ reverse: () => reverse,
18000
+ shaped: () => shaped,
18001
+ through: () => through,
18002
+ valueAt: () => valueAt,
18003
+ wave: () => wave
18004
+ });
18005
+ var ease = {
18006
+ /** linear moves at an even pace. */
18007
+ linear: shaped((t) => t, {}),
18008
+ /** bias is the game's bias curve; see LerpShape. */
18009
+ bias: (b) => shaped((t) => bias(t, b), { bias: b }),
18010
+ /** gain is the game's gain curve; see LerpShape. */
18011
+ gain: (g) => shaped((t) => gain(t, g), { gain: g }),
18012
+ /** in starts slow and speeds up. */
18013
+ in: shaped((t) => t * t * t),
18014
+ /** out starts fast and slows to a stop. */
18015
+ out: shaped((t) => 1 - (1 - t) ** 3),
18016
+ /** inOut starts and ends slow. */
18017
+ inOut: shaped((t) => t < 0.5 ? 4 * t * t * t : 1 - (2 - 2 * t) ** 3 / 2),
18018
+ /** sine starts and ends slow, more gently than inOut. */
18019
+ sine: shaped((t) => (1 - Math.cos(Math.PI * t)) / 2),
18020
+ /** back passes its end a little and settles back onto it. */
18021
+ back: shaped((t) => 1 + 2.70158 * (t - 1) ** 3 + 1.70158 * (t - 1) ** 2),
18022
+ /** elastic overshoots its end and rings down onto it. */
18023
+ elastic: shaped(
18024
+ (t) => t <= 0 || t >= 1 ? t : 2 ** (-10 * t) * Math.sin((t * 10 - 0.75) * 2 * Math.PI / 3) + 1
18025
+ ),
18026
+ /** bounce drops onto its end and bounces to rest. */
18027
+ bounce: shaped((t) => {
18028
+ const k = 7.5625;
18029
+ if (t < 1 / 2.75) return k * t * t;
18030
+ if (t < 2 / 2.75) return k * (t - 1.5 / 2.75) ** 2 + 0.75;
18031
+ if (t < 2.5 / 2.75) return k * (t - 2.25 / 2.75) ** 2 + 0.9375;
18032
+ return k * (t - 2.625 / 2.75) ** 2 + 0.984375;
18033
+ })
17810
18034
  };
17811
- var motion = { hover: 0.15, meter: 0.25 };
17812
-
17813
- // js/src/hud.ts
17814
- function element(type, style, children, key) {
17815
- return { type, props: { style, children }, key };
18035
+ function shaped(at3, lerp3) {
18036
+ return { at: at3, lerp: lerp3 };
17816
18037
  }
17817
- function arriving(component, from) {
17818
- return {
17819
- ...component,
17820
- props: {
17821
- ...component.props,
17822
- style: {
17823
- transition: { seconds: 0.25, easing: "out" },
17824
- ...component.props.style
17825
- },
17826
- enter: { opacity: 0, ...from },
17827
- exit: { opacity: 0 }
18038
+ function line(from, to, duration, shape = ease.linear) {
18039
+ return [{ duration, lerp: shape.lerp, at: (u) => mix(from, to, shape.at(u)) }];
18040
+ }
18041
+ function hold(value, duration) {
18042
+ return [{ duration, lerp: {}, at: () => value }];
18043
+ }
18044
+ function keyframes(keys, options = {}) {
18045
+ const spans = [];
18046
+ const [first] = keys;
18047
+ if (first && first.at > 0) spans.push(...hold(first.value, first.at));
18048
+ keys.forEach((to, i) => {
18049
+ const from = keys[i - 1];
18050
+ if (!from || to.at <= from.at) return;
18051
+ const duration = to.at - from.at;
18052
+ const shape = to.ease ?? ease.linear;
18053
+ if (!options.smooth) {
18054
+ spans.push(...line(from.value, to.value, duration, shape));
18055
+ return;
17828
18056
  }
17829
- };
18057
+ const before2 = keys[i - 2]?.value ?? from.value;
18058
+ const after2 = keys[i + 1]?.value ?? to.value;
18059
+ spans.push({
18060
+ duration,
18061
+ at: (u) => spline(before2, from.value, to.value, after2, shape.at(u))
18062
+ });
18063
+ });
18064
+ return spans;
17830
18065
  }
17831
- function Text(props) {
17832
- const type = types[props.role];
17833
- return element(
17834
- "label",
17835
- {
17836
- face: type.face,
17837
- fontSize: type.size,
17838
- uppercase: type.uppercase,
17839
- shadow: !props.plated,
17840
- color: tones[props.tone ?? (props.role === "label" ? "muted" : "text")],
17841
- horizontalAlign: "center",
17842
- textAlign: "center",
17843
- ...props.style
17844
- },
17845
- props.children
17846
- );
18066
+ function through(points, options) {
18067
+ let at3 = 0;
18068
+ let last = points[0];
18069
+ const keys = points.map((value) => {
18070
+ if (last !== void 0) at3 += distance2(last, value) / options.speed;
18071
+ last = value;
18072
+ return { at: at3, value, ease: options.ease };
18073
+ });
18074
+ return keyframes(keys, options);
17847
18075
  }
17848
- function Plate(props) {
17849
- return element(
17850
- "panel",
18076
+ function orbit(options) {
18077
+ const { center, radius, duration } = options;
18078
+ const turns = options.turns ?? 1;
18079
+ const start2 = (options.start ?? 0) * Math.PI / 180;
18080
+ const rise = options.rise ?? 0;
18081
+ const shape = options.ease ?? ease.linear;
18082
+ return [
17851
18083
  {
17852
- flow: props.flow ?? "down",
17853
- horizontalAlign: "center",
17854
- background: plate.color,
17855
- borderRadius: plate.radius,
17856
- padding: plate.padding,
17857
- ...props.style
17858
- },
17859
- props.children
17860
- );
18084
+ duration,
18085
+ at: (u) => {
18086
+ const t = shape.at(u);
18087
+ const angle = start2 + t * turns * 2 * Math.PI;
18088
+ return {
18089
+ x: center.x + radius * Math.cos(angle),
18090
+ y: center.y + radius * Math.sin(angle),
18091
+ z: center.z + rise * t
18092
+ };
18093
+ }
18094
+ }
18095
+ ];
17861
18096
  }
17862
- function Pill(props) {
17863
- return element(
17864
- "panel",
18097
+ function wave(options) {
18098
+ const { amplitude, frequency, duration, decay } = options;
18099
+ return [
17865
18100
  {
17866
- flow: props.flow ?? "right",
17867
- horizontalAlign: "center",
17868
- background: plate.color,
17869
- borderRadius: 50,
17870
- borderWidth: 2,
17871
- borderColor: pillEdge,
17872
- padding: [3, 6],
17873
- ...props.style
17874
- },
17875
- props.children
17876
- );
18101
+ duration,
18102
+ at: (u) => amplitude * (decay ? 1 - u : 1) * Math.sin(2 * Math.PI * frequency * duration * u)
18103
+ }
18104
+ ];
17877
18105
  }
17878
- function Pips(props) {
17879
- const shape = pipShapes[props.shape ?? "round"];
17880
- const lit = (index) => props.mirror ? index >= props.total - props.filled : index < props.filled;
17881
- return element(
17882
- "panel",
17883
- { flow: "right", verticalAlign: "center", ...props.style },
17884
- Array.from(
17885
- { length: props.total },
17886
- (_, index) => element(
17887
- "panel",
17888
- {
17889
- width: shape.width,
17890
- height: shape.height,
17891
- borderRadius: shape.radius,
17892
- margin: [0, 2],
17893
- background: lit(index) ? tones[props.tone] : emptyPip,
17894
- borderWidth: 2,
17895
- borderColor: lit(index) ? pipRings.filled : pipRings.empty
17896
- },
17897
- void 0,
17898
- `pip-${index}`
17899
- )
17900
- )
17901
- );
18106
+ function chain(...curves) {
18107
+ return curves.flat();
17902
18108
  }
17903
- function Tag(props) {
17904
- const filled = props.fill === "filled";
17905
- return element(
17906
- "label",
17907
- {
17908
- face: "block",
17909
- fontSize: 12,
17910
- letterSpacing: 1,
17911
- uppercase: true,
17912
- color: filled ? tones.onAccent : tones[props.tone],
17913
- background: filled ? tones[props.tone] : void 0,
17914
- borderWidth: 1,
17915
- borderColor: tones[props.tone],
17916
- borderRadius: sizes.radius,
17917
- padding: [4, 8],
17918
- verticalAlign: "center",
17919
- ...props.style
17920
- },
17921
- props.children
17922
- );
18109
+ function reverse(curve) {
18110
+ return curve.map((span) => ({
18111
+ duration: span.duration,
18112
+ lerp: span.lerp?.bias === void 0 ? span.lerp : void 0,
18113
+ at: (u) => span.at(1 - u)
18114
+ })).reverse();
18115
+ }
18116
+ function repeat(curve, times) {
18117
+ return Array.from({ length: Math.max(0, times) }, () => curve).flat();
18118
+ }
18119
+ function pingPong(curve) {
18120
+ return chain(curve, reverse(curve));
18121
+ }
18122
+ function durationOf(curve) {
18123
+ return curve.reduce((sum, span) => sum + Math.max(0, span.duration), 0);
18124
+ }
18125
+ function valueAt(curve, seconds) {
18126
+ let left3 = seconds;
18127
+ for (const span of curve) {
18128
+ if (span.duration <= 0) continue;
18129
+ if (left3 <= span.duration) return span.at(Math.max(0, left3) / span.duration);
18130
+ left3 -= span.duration;
18131
+ }
18132
+ return curve.at(-1)?.at(1);
18133
+ }
18134
+ function bias(t, b) {
18135
+ return t ** (Math.log(b) / Math.log(0.5));
18136
+ }
18137
+ function gain(t, g) {
18138
+ return t < 0.5 ? bias(2 * t, 1 - g) / 2 : 1 - bias(2 - 2 * t, 1 - g) / 2;
18139
+ }
18140
+ function mix(a, b, t) {
18141
+ if (typeof a === "number" && typeof b === "number") return a + (b - a) * t;
18142
+ const [p, q] = [vector2(a), vector2(b)];
18143
+ return {
18144
+ x: p.x + (q.x - p.x) * t,
18145
+ y: p.y + (q.y - p.y) * t,
18146
+ z: p.z + (q.z - p.z) * t
18147
+ };
18148
+ }
18149
+ function spline(p0, p1, p2, p3, t) {
18150
+ const f = (a2, b2, c2, d2) => 0.5 * (2 * b2 + (c2 - a2) * t + (2 * a2 - 5 * b2 + 4 * c2 - d2) * t * t + (3 * b2 - a2 - 3 * c2 + d2) * t * t * t);
18151
+ if (typeof p0 === "number" && typeof p1 === "number" && typeof p2 === "number" && typeof p3 === "number") {
18152
+ return f(p0, p1, p2, p3);
18153
+ }
18154
+ const [a, b, c, d] = [vector2(p0), vector2(p1), vector2(p2), vector2(p3)];
18155
+ return {
18156
+ x: f(a.x, b.x, c.x, d.x),
18157
+ y: f(a.y, b.y, c.y, d.y),
18158
+ z: f(a.z, b.z, c.z, d.z)
18159
+ };
17923
18160
  }
17924
- function Banner(props) {
17925
- const banner = element(
17926
- "panel",
17927
- {
17928
- flow: "down",
17929
- horizontalAlign: "center",
17930
- margin: [20, 0, 0, 0],
17931
- ...props.style
17932
- },
17933
- [
17934
- Text({ role: "title", tone: props.tone, children: props.title }),
17935
- props.detail && Text({ role: "caption", tone: "muted", children: props.detail })
17936
- ]
17937
- );
17938
- return arriving(banner, { scale: 0.92 });
18161
+ function distance2(a, b) {
18162
+ if (typeof a === "number" && typeof b === "number") return Math.abs(b - a);
18163
+ const [p, q] = [vector2(a), vector2(b)];
18164
+ return Math.hypot(q.x - p.x, q.y - p.y, q.z - p.z);
17939
18165
  }
17940
- function TopStrip(props) {
17941
- const block2 = [
17942
- props.heading && Text({
17943
- role: "label",
17944
- style: { letterSpacing: 1 },
17945
- children: props.heading
17946
- }),
17947
- Pill({ style: { margin: [4, 0, 0, 0] }, children: props.children })
17948
- ];
17949
- const line2 = props.line && Text({
17950
- role: "label",
17951
- tone: props.lineTone ?? "text",
17952
- style: { margin: [4, 0, 0, 0], fontSize: 18, letterSpacing: 1 },
17953
- children: props.line
17954
- });
17955
- const column = (top, children) => element(
17956
- "panel",
17957
- { flow: "down", horizontalAlign: "center", margin: [top, 0, 0, 0] },
17958
- children
17959
- );
17960
- if (!props.keepTeamBar) return column(14, [...block2, line2]);
17961
- return element("panel", { width: "fill", height: "fill" }, [
17962
- column(teamBarBottom, block2),
17963
- line2 && column(objectiveBarBottom, line2)
17964
- ]);
18166
+ function vector2(value) {
18167
+ return typeof value === "number" ? { x: value, y: 0, z: 0 } : value;
17965
18168
  }
17966
- function Score2(props) {
17967
- const [near, far] = props.tones ?? ["accent", "text"];
17968
- const side = (points, tone) => Text({
17969
- role: "title",
17970
- tone,
17971
- plated: true,
17972
- style: { margin: [0, 10], horizontalAlign: void 0 },
17973
- children: `${points}`
18169
+
18170
+ // js/src/camera.ts
18171
+ function setOrbitCamera(player, enabled) {
18172
+ const pawn = player.pawn();
18173
+ if (!pawn?.entity) return false;
18174
+ const flag = writeField(
18175
+ pawn.entity,
18176
+ "CCitadelPlayerPawn",
18177
+ "m_bInHideoutZone",
18178
+ "bool",
18179
+ enabled
18180
+ );
18181
+ const zoom = holdModifierState(
18182
+ pawn.entity,
18183
+ "MODIFIER_STATE_HIDEOUT_ZONE",
18184
+ enabled
18185
+ );
18186
+ if (enabled) return flag && zoom;
18187
+ const orbit2 = fireInput(pawn.entity, "RemoveModifier", {
18188
+ text: "modifier_citadel_orbit_camera"
17974
18189
  });
17975
- return element("panel", { flow: "right", verticalAlign: "center" }, [
17976
- side(props.points[0], near),
17977
- Text({
17978
- role: "title",
17979
- tone: "muted",
17980
- plated: true,
17981
- style: { horizontalAlign: void 0 },
17982
- children: ":"
17983
- }),
17984
- side(props.points[1], far)
17985
- ]);
18190
+ return flag && zoom && orbit2;
17986
18191
  }
17987
- var rosterRows = 6;
17988
- var rosterName = 24;
17989
- var portraitSize = 44;
17990
- var badgeSize = 18;
17991
- var portraits = new Map(heroes.map((hero) => [hero.id, hero.portrait]));
17992
- function rosterKey(rows) {
17993
- return rows.slice(0, rosterRows).map(
17994
- (row2) => `${row2.self ? "*" : ""}${row2.selected ? "+" : ""}${row2.onPress ? ">" : ""}${row2.name} ${row2.hero} ${row2.activity} ${row2.steamId ?? ""}`
17995
- ).join("\n");
18192
+ var moves = 0;
18193
+ function playCamera(player, options) {
18194
+ const tracks = [];
18195
+ for (const [param, curve] of Object.entries(options.tracks)) {
18196
+ if (curve) tracks.push({ param, curve });
18197
+ }
18198
+ return playTracks(player, options, tracks);
17996
18199
  }
17997
- function Roster(props) {
17998
- if (props.rows.length === 0) return null;
17999
- return element(
18000
- "panel",
18001
- {
18002
- width: "fit",
18003
- height: "fit",
18004
- flow: "down",
18005
- horizontalAlign: "right",
18006
- verticalAlign: "top",
18007
- margin: [props.top ?? fpsReadoutBottom, 24, 0, 0]
18008
- },
18009
- props.rows.slice(0, rosterRows).map(rosterRow)
18200
+ function playTracks(player, options, tracks) {
18201
+ const context = options.context ?? `modlock.camera.${++moves}`;
18202
+ const length3 = Math.max(0, ...tracks.map((track) => durationOf(track.curve)));
18203
+ const send2 = (delay) => tracks.every(
18204
+ ({ param, curve }) => sendCurve(player, { ...options, context, param, delay }, curve)
18010
18205
  );
18206
+ let timer;
18207
+ const stop = () => {
18208
+ timer?.cancel();
18209
+ return player.clearCamera(context);
18210
+ };
18211
+ let sent = send2(options.delay);
18212
+ if (sent && options.loop && length3 > 0) {
18213
+ sent = send2(void 0);
18214
+ timer = every(length3, () => {
18215
+ if (!send2(void 0)) stop();
18216
+ });
18217
+ }
18218
+ if (!sent) {
18219
+ stop();
18220
+ return void 0;
18221
+ }
18222
+ return {
18223
+ context,
18224
+ duration: options.loop ? Infinity : (options.delay ?? 0) + length3,
18225
+ cancel: stop
18226
+ };
18011
18227
  }
18012
- function rosterRow(row2, index) {
18013
- const right = { horizontalAlign: "right", textAlign: "right" };
18014
- const text2 = element(
18015
- "panel",
18016
- { flow: "down", verticalAlign: "center", margin: [0, 12, 0, 0] },
18017
- [
18018
- Text({
18019
- role: "label",
18020
- tone: "text",
18021
- style: right,
18022
- children: clip(row2.name.toUpperCase(), rosterName)
18023
- }),
18024
- Text({
18025
- role: "caption",
18026
- tone: "muted",
18027
- style: { ...right, margin: [1, 0, 0, 0] },
18028
- children: row2.activity
18029
- })
18030
- ]
18031
- );
18032
- const src = portraits.get(row2.hero);
18033
- const badge = row2.steamId === void 0 ? false : avatarBadge(row2.steamId);
18034
- const image = src === void 0 ? false : portraitImage(src);
18035
- const portrait = element(
18036
- "panel",
18037
- {
18038
- width: portraitSize,
18039
- height: portraitSize,
18040
- padding: 1,
18041
- verticalAlign: "center",
18042
- background: row2.self || row2.selected ? tones.accent : shades.dim
18043
- },
18044
- element(
18045
- "panel",
18046
- { width: "100%", height: "100%", background: shades.raised },
18047
- [image, badge]
18048
- )
18228
+ function cameraPulse(player, options) {
18229
+ const { param, by, ease: shape = ease.linear } = options;
18230
+ const rest = zero2(by);
18231
+ const curve = chain(
18232
+ line(rest, by, options.in, shape),
18233
+ hold(by, options.hold),
18234
+ reverse(line(rest, by, options.out, shape))
18049
18235
  );
18050
- const style = {
18051
- flow: "right",
18052
- horizontalAlign: "right",
18053
- margin: [0, 0, 8, 0]
18236
+ return playTracks(player, { ...options, relative: true }, [{ param, curve }]);
18237
+ }
18238
+ function cameraShake(player, options) {
18239
+ const { amplitude, duration } = options;
18240
+ const curve = wave({
18241
+ amplitude,
18242
+ duration,
18243
+ frequency: options.frequency ?? 8,
18244
+ decay: true
18245
+ });
18246
+ const param = options.param ?? "horizontalOffset";
18247
+ return playTracks(player, { ...options, relative: true }, [{ param, curve }]);
18248
+ }
18249
+ function sendCurve(player, options, curve) {
18250
+ const { context, param, relative, priority, target } = options;
18251
+ const rate = options.rate ?? 30;
18252
+ let delay = options.delay;
18253
+ const lerp3 = (start2, end, duration, shape = {}) => {
18254
+ const sent = player.moveCamera({
18255
+ context,
18256
+ param,
18257
+ motion: { lerp: { start: start2, end, duration, ...shape } },
18258
+ delay,
18259
+ relative,
18260
+ priority,
18261
+ target
18262
+ });
18263
+ delay = void 0;
18264
+ return sent;
18054
18265
  };
18055
- const line2 = row2.onPress ? {
18056
- type: "button",
18057
- props: {
18058
- style: {
18059
- ...style,
18060
- borderRadius: sizes.radius,
18061
- transition: motion.hover
18062
- },
18063
- hover: { background: shades.raised },
18064
- hoverSound: sounds.hover,
18065
- sound: sounds.press,
18066
- onPress: row2.onPress,
18067
- children: [text2, portrait]
18068
- },
18069
- key: `row-${index}`
18070
- } : element("panel", style, [text2, portrait], `row-${index}`);
18071
- return arriving(line2, { translate: [16, 0] });
18266
+ return curve.every((span) => {
18267
+ if (span.duration <= 0) return true;
18268
+ if (span.lerp) {
18269
+ return lerp3(span.at(0), span.at(1), span.duration, span.lerp);
18270
+ }
18271
+ const steps = Math.max(1, Math.ceil(span.duration * rate));
18272
+ for (let i = 0; i < steps; i++) {
18273
+ const sent = lerp3(
18274
+ span.at(i / steps),
18275
+ span.at((i + 1) / steps),
18276
+ span.duration / steps
18277
+ );
18278
+ if (!sent) return false;
18279
+ }
18280
+ return true;
18281
+ });
18282
+ }
18283
+ function zero2(value) {
18284
+ return typeof value === "number" ? 0 : { x: 0, y: 0, z: 0 };
18072
18285
  }
18073
- function portraitImage(src) {
18074
- return {
18075
- type: "image",
18076
- props: { src, style: { width: "100%", height: "100%" } }
18077
- };
18286
+
18287
+ // js/src/items.gen.ts
18288
+ var itemTable = [
18289
+ { name: "upgrade_ability_power_shard", id: 630839635, slot: "spirit", tier: 4, active: true, imbue: true, icon: "file://{images}/upgrades/mods_tech/echo_shard.psd" },
18290
+ { name: "upgrade_ability_refresher", id: 677738769, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/refresher_module.psd" },
18291
+ { name: "upgrade_absorbing_armor", id: 3028234315, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/arcane_medallion.psd" },
18292
+ { name: "upgrade_acolytes_glove", id: 465043967, slot: "spirit", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/acolytes_glove.psd" },
18293
+ { name: "upgrade_active_reload", id: 381961617, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_utility/deployable_bullet_shield.psd" },
18294
+ { name: "upgrade_aerial_assault", id: 271801138, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_utility/springy_boots.psd" },
18295
+ { name: "upgrade_aoe_root", id: 1152158042, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/area_immobilize.psd" },
18296
+ { name: "upgrade_aprounds", id: 673001892, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/armor_breaking_bullets.psd" },
18297
+ { name: "upgrade_arcane_extension", id: 2951612397, slot: "spirit", tier: 2, active: false, imbue: true, icon: "file://{images}/upgrades/mods_tech/duration_extender.psd" },
18298
+ { name: "upgrade_arcane_surge", id: 1150006784, slot: "spirit", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/arcane_surge.psd" },
18299
+ { name: "upgrade_arctic_blast", id: 3812615317, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_utility/ice_blast.psd" },
18300
+ { name: "upgrade_auto_cleanse", id: 951866250, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/items/vitality/indomitable.psd" },
18301
+ { name: "upgrade_banshee_slugs", id: 3884003354, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/banshee_slugs.psd" },
18302
+ { name: "upgrade_berserker", id: 1414319208, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/berserker.psd" },
18303
+ { name: "upgrade_blitz_bullets", id: 4104549924, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/fire_rate_plus.psd" },
18304
+ { name: "upgrade_boundless_spirit", id: 2519598785, slot: "spirit", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/boundless_spirit.psd" },
18305
+ { name: "upgrade_boxing_glove", id: 1252627263, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/boxing_glove.psd" },
18306
+ { name: "upgrade_bullet_armor_reduction_aura", id: 2481177645, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_armor_reduction_aura.psd" },
18307
+ { name: "upgrade_bullet_resist_shredder", id: 2971868509, slot: "spirit", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/bullet_resist_shredder.psd" },
18308
+ { name: "upgrade_bulletshredimbue", id: 3294954488, slot: "weapon", tier: 3, active: false, imbue: true, icon: "file://{images}/upgrades/mods_weapon/fire_rate_plus.psd" },
18309
+ { name: "upgrade_burst_fire", id: 2739107182, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/fire_rate_plus_plus.psd" },
18310
+ { name: "upgrade_capacitor", id: 710436191, slot: "weapon", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/electrified_bullets.psd" },
18311
+ { name: "upgrade_cardio_calibrator", id: 2447176615, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_utility/sprint_booster.psd" },
18312
+ { name: "upgrade_celestial_guidance", id: 3729138568, slot: "vitality", tier: 5, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/debuff_reducer.psd" },
18313
+ { name: "upgrade_chain_lightning", id: 811521119, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/electrified_bullets.psd" },
18314
+ { name: "upgrade_cheat_death", id: 3361811174, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/torment_aura.psd" },
18315
+ { name: "upgrade_chonky", id: 3585132399, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/revitalizer.psd" },
18316
+ { name: "upgrade_clip_size", id: 1548066885, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/clip_size.psd" },
18317
+ { name: "upgrade_cloaking_device_active", id: 1798666702, slot: "weapon", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_utility/cloaking_device.psd" },
18318
+ { name: "upgrade_close_quarter_combat", id: 2095565695, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/point_blank.psd" },
18319
+ { name: "upgrade_close_range", id: 1342610602, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/close_range.psd" },
18320
+ { name: "upgrade_cold_front", id: 1976391348, slot: "spirit", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_utility/ice_blast.psd" },
18321
+ { name: "upgrade_colossus", id: 2407781327, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/colossus.psd" },
18322
+ { name: "upgrade_containment", id: 1813726886, slot: "spirit", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/immobilize.psd" },
18323
+ { name: "upgrade_cooldown_reduction", id: 3261353684, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/spiritual_flow.psd" },
18324
+ { name: "upgrade_counterspell", id: 1414025773, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/hud/modifiers/icon_parry.svg" },
18325
+ { name: "upgrade_crackshot", id: 395867183, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/explosive_bullets.psd" },
18326
+ { name: "upgrade_critshot", id: 1396247347, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/crit_damage.psd" },
18327
+ { name: "upgrade_crushing_fists", id: 800008313, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/melee_charge.psd" },
18328
+ { name: "upgrade_damage_recycler", id: 865846625, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/leech.psd" },
18329
+ { name: "upgrade_debuff_reducer", id: 1047818222, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/debuff_reducer.psd" },
18330
+ { name: "upgrade_deflecting_armor", id: 3491236900, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/arcane_medallion.psd" },
18331
+ { name: "upgrade_disarm", id: 2645639421, slot: "spirit", tier: 1, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/disarm.psd" },
18332
+ { name: "upgrade_discord", id: 2417568017, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/rupture.psd" },
18333
+ { name: "upgrade_divine_barrier", id: 1662311306, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/savior.psd" },
18334
+ { name: "upgrade_diviners_kevlar", id: 2820116164, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_shield.psd" },
18335
+ { name: "upgrade_dps_aura", id: 2108215830, slot: "weapon", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/bullet_damage_aura.psd" },
18336
+ { name: "upgrade_eldritch_shot", id: 3568217437, slot: "weapon", tier: 5, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/explosive_bullets.psd" },
18337
+ { name: "upgrade_endurance", id: 2829638276, slot: "vitality", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/endurance.psd" },
18338
+ { name: "upgrade_escalating_exposure", id: 3005970438, slot: "spirit", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/escalating_exposure.psd" },
18339
+ { name: "upgrade_ethereal_bullets", id: 3919289022, slot: "spirit", tier: 4, active: false, imbue: true, icon: "file://{images}/upgrades/mods_weapon/fire_rate_plus.psd" },
18340
+ { name: "upgrade_extra_charge", id: 3776945997, slot: "spirit", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/extra_charge.psd" },
18341
+ { name: "upgrade_fervor", id: 339443430, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/fervor.psd" },
18342
+ { name: "upgrade_fleetfoot_boots", id: 3403085434, slot: "weapon", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/fleetfoot_boots.psd" },
18343
+ { name: "upgrade_focus_lens", id: 2142980412, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/focused_silence.psd" },
18344
+ { name: "upgrade_fury_trance", id: 1409190604, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/vampiric_burst.psd" },
18345
+ { name: "upgrade_glass_cannon", id: 365620721, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/glass_cannon.psd" },
18346
+ { name: "upgrade_glitch", id: 2617435668, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/glitch.psd" },
18347
+ { name: "upgrade_goose_egg", id: 2462046703, slot: "spirit", tier: 1, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/tech_damage.psd" },
18348
+ { name: "upgrade_greater_withering_whip", id: 2061878743, slot: "spirit", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/disarm.psd" },
18349
+ { name: "upgrade_grit", id: 1672893796, slot: "vitality", tier: 1, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_shield.psd" },
18350
+ { name: "upgrade_guardian_ward", id: 857669956, slot: "vitality", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/savior.psd" },
18351
+ { name: "upgrade_headhunter", id: 4053935515, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/headhunter.psd" },
18352
+ { name: "upgrade_headshot_booster", id: 2010028405, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/headshot_booster.psd" },
18353
+ { name: "upgrade_headshot_booster2", id: 1770441818, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/headshot_booster.psd" },
18354
+ { name: "upgrade_healbane", id: 2603935618, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/healbane.psd" },
18355
+ { name: "upgrade_healbuff", id: 1427630806, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/aura_icon.psd" },
18356
+ { name: "upgrade_healing_booster", id: 2566692615, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/healing_booster.psd" },
18357
+ { name: "upgrade_health", id: 3633614685, slot: "vitality", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/health.psd" },
18358
+ { name: "upgrade_health_nova", id: 2956256701, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_utility/health_nova.psd" },
18359
+ { name: "upgrade_health_regen_aura", id: 3321728133, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/health_regen_aura.psd" },
18360
+ { name: "upgrade_health_stealing_magic", id: 876563814, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/health_stealing_tech.psd" },
18361
+ { name: "upgrade_health_stimpak", id: 1710079648, slot: "vitality", tier: 1, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/stimpak.psd" },
18362
+ { name: "upgrade_high_velocity_mag", id: 3077079169, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/high_velocity_mag.psd" },
18363
+ { name: "upgrade_hollow_point_rounds", id: 2678489038, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/hollow_point.psd" },
18364
+ { name: "upgrade_icarus_wings", id: 1736094134, slot: "vitality", tier: 5, active: false, imbue: false, icon: "file://{images}/upgrades/mods_utility/sprint_booster.psd" },
18365
+ { name: "upgrade_imbued_duration_extender", id: 2717651715, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/arcane_persistance.psd" },
18366
+ { name: "upgrade_improved_bullet_armor", id: 3140772621, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/improved_bullet_armor.psd" },
18367
+ { name: "upgrade_improved_spirit", id: 968099481, slot: "spirit", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/tech_damage.psd" },
18368
+ { name: "upgrade_improved_stamina", id: 4139877411, slot: "vitality", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/improved_stamina.psd" },
18369
+ { name: "upgrade_infinite_rounds", id: 3269957497, slot: "weapon", tier: 5, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/armor_breaking_bullets.psd" },
18370
+ { name: "upgrade_infuser", id: 1797283378, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/infuser.psd" },
18371
+ { name: "upgrade_inhibitor", id: 2037039379, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/inhibitor.psd" },
18372
+ { name: "upgrade_intensifying_clip", id: 2407033488, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/auto_reloader.psd" },
18373
+ { name: "upgrade_juggernaut", id: 1250307611, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/items/vitality/juggernaut.psd" },
18374
+ { name: "upgrade_kinetic_sash", id: 3977876567, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/kinetic_sash.psd" },
18375
+ { name: "upgrade_lifestrike_gauntlets", id: 1437614329, slot: "vitality", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/lifestrike_gauntlets.psd" },
18376
+ { name: "upgrade_long_range", id: 3331811235, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/long_range.psd" },
18377
+ { name: "upgrade_magic_burst", id: 1998374645, slot: "spirit", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/magic_burst.psd" },
18378
+ { name: "upgrade_magic_carpet", id: 2800629741, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/hud/abilities/kelvin/ice_path.psd" },
18379
+ { name: "upgrade_magic_reach", id: 754480263, slot: "spirit", tier: 1, active: false, imbue: true, icon: "file://{images}/upgrades/mods_tech/tech_range.psd" },
18380
+ { name: "upgrade_magic_shield", id: 3970837787, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/tech_shield_pulse.psd" },
18381
+ { name: "upgrade_magic_shock", id: 2121044373, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/magic_shock.psd" },
18382
+ { name: "upgrade_magic_slow", id: 1102081447, slot: "spirit", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/slowing_tech.psd" },
18383
+ { name: "upgrade_magic_storm", id: 1292979587, slot: "spirit", tier: 3, active: false, imbue: true, icon: "file://{images}/upgrades/mods_tech/magic_storm.psd" },
18384
+ { name: "upgrade_magic_tempo", id: 380806748, slot: "spirit", tier: 2, active: false, imbue: true, icon: "file://{images}/upgrades/mods_utility/advanced_recharge.psd" },
18385
+ { name: "upgrade_magic_vulnerability", id: 2081037738, slot: "spirit", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/tech_vulnerability.psd" },
18386
+ { name: "upgrade_medic_bullets", id: 3862866912, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/medic_bullets.psd" },
18387
+ { name: "upgrade_melee_charge", id: 26002154, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/melee_charge.psd" },
18388
+ { name: "upgrade_melee_rebuttal", id: 4204808176, slot: "vitality", tier: 1, active: false, imbue: false, icon: "file://{images}/hud/modifiers/icon_parry.svg" },
18389
+ { name: "upgrade_metal_skin", id: 1378931225, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/metal_skin.psd" },
18390
+ { name: "upgrade_mystic_regeneration", id: 1439347412, slot: "spirit", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/endurance.psd" },
18391
+ { name: "upgrade_mystic_reverb", id: 3577481646, slot: "spirit", tier: 4, active: false, imbue: true, icon: "file://{images}/upgrades/mods_tech/magic_reverb.psd" },
18392
+ { name: "upgrade_mystical_piano", id: 2054088113, slot: "spirit", tier: 5, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/knockdown.psd" },
18393
+ { name: "upgrade_non_player_bonus", id: 1009965641, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/reaper_rounds.psd" },
18394
+ { name: "upgrade_nullification_aura", id: 3949773228, slot: "vitality", tier: 5, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_armor_reduction_aura.psd" },
18395
+ { name: "upgrade_omnicharge_pendant", id: 424779525, slot: "spirit", tier: 5, active: false, imbue: true, icon: "file://{images}/upgrades/mods_tech/rapid_recharge.psd" },
18396
+ { name: "upgrade_personal_rejuvenator", id: 2329546537, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/rebirth.psd" },
18397
+ { name: "upgrade_phantom_strike", id: 1371725689, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/phantom_strike.psd" },
18398
+ { name: "upgrade_prism_blast", id: 1132564516, slot: "spirit", tier: 5, active: true, imbue: false, icon: "file://{images}/items/spirit/ethereal_shift.psd" },
18399
+ { name: "upgrade_pristine_emblem", id: 2064029594, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/pristine_emblem.psd" },
18400
+ { name: "upgrade_proc_silence", id: 1113837674, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/emp_bullets.psd" },
18401
+ { name: "upgrade_quick_silver", id: 84321454, slot: "spirit", tier: 2, active: false, imbue: true, icon: "file://{images}/upgrades/mods_weapon/fire_rate_plus.psd" },
18402
+ { name: "upgrade_rapid_recharge", id: 787198704, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/rapid_recharge.psd" },
18403
+ { name: "upgrade_rapid_rounds", id: 668299740, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/rapid_rounds.psd" },
18404
+ { name: "upgrade_rebirth", id: 4003032160, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/rebirth.psd" },
18405
+ { name: "upgrade_rechargingbullets", id: 1763073141, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/arcane_medallion.psd" },
18406
+ { name: "upgrade_reduce_debuff_duration", id: 3731635960, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/debuff_remover.psd" },
18407
+ { name: "upgrade_regenerating_bullet_shield", id: 1235347618, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_shield.psd" },
18408
+ { name: "upgrade_reinforcing_casings", id: 2463960640, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_armor_plus.psd" },
18409
+ { name: "upgrade_rescue_beam", id: 1804594021, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/medic_beam.psd" },
18410
+ { name: "upgrade_resonant_healing", id: 2947183272, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/boundless_spirit.psd" },
18411
+ { name: "upgrade_restorative_locket", id: 2059712766, slot: "vitality", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/restorative_locket.psd" },
18412
+ { name: "upgrade_return_fire", id: 3361075077, slot: "vitality", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/return_fire.psd" },
18413
+ { name: "upgrade_ricochet", id: 2480592370, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/ricochet.psd" },
18414
+ { name: "upgrade_rocket_booster", id: 600033864, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/hud/abilities/lash/lash_death_slam.psd" },
18415
+ { name: "upgrade_rocket_boots", id: 3830846077, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_utility/springy_boots.psd" },
18416
+ { name: "upgrade_rupture", id: 3144988365, slot: "spirit", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/rupture.psd" },
18417
+ { name: "upgrade_self_bubble", id: 2533252781, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/items/spirit/ethereal_shift.psd" },
18418
+ { name: "upgrade_sharpshooter", id: 2152872419, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/longshot.psd" },
18419
+ { name: "upgrade_shrink_ray", id: 4121584236, slot: "spirit", tier: 5, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/stimpak.psd" },
18420
+ { name: "upgrade_siphon_bullets", id: 1282141666, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/siphon_bullets.psd" },
18421
+ { name: "upgrade_slowing_bullets", id: 393974127, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/slowing_bullets.psd" },
18422
+ { name: "upgrade_soaring_spirit", id: 7409189, slot: "spirit", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/soaring_spirit.psd" },
18423
+ { name: "upgrade_spellslinger_headshots", id: 4075861416, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/spellslinger_headshots.psd" },
18424
+ { name: "upgrade_spirit_bubble", id: 112198670, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_shield.psd" },
18425
+ { name: "upgrade_spirit_burn", id: 343572757, slot: "spirit", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/escalating_exposure.psd" },
18426
+ { name: "upgrade_spirit_sap", id: 1219329868, slot: "spirit", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/focused_silence.psd" },
18427
+ { name: "upgrade_spirit_snatch", id: 3190916303, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/spirit_snatch.psd" },
18428
+ { name: "upgrade_split_shot", id: 3647584222, slot: "weapon", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/titanic_magazine.psd" },
18429
+ { name: "upgrade_sprint_booster", id: 3399065363, slot: "vitality", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_utility/sprint_booster.psd" },
18430
+ { name: "upgrade_superior_stamina", id: 334300056, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/superior_stamina.psd" },
18431
+ { name: "upgrade_suppressor", id: 1925087134, slot: "spirit", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/weapon_jammer.psd" },
18432
+ { name: "upgrade_surging_power", id: 1055679805, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/vampiric_burst.psd" },
18433
+ { name: "upgrade_target_stun", id: 1254091416, slot: "spirit", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/knockdown.psd" },
18434
+ { name: "upgrade_targeted_silence", id: 619484391, slot: "spirit", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/targeted_silence.psd" },
18435
+ { name: "upgrade_tech_damage_pulse", id: 395944548, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/torment_aura.psd" },
18436
+ { name: "upgrade_tech_defense_shredders", id: 1144549437, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/tech_resist_shredder.psd" },
18437
+ { name: "upgrade_tech_overflow", id: 2226497419, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/magic_overflow.psd" },
18438
+ { name: "upgrade_tech_purge", id: 2163598980, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/tech_purge.psd" },
18439
+ { name: "upgrade_tech_range", id: 1193964439, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/spiritual_dominion.psd" },
18440
+ { name: "upgrade_thermal_detonator", id: 1932939246, slot: "weapon", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/thermal_detonator.psd" },
18441
+ { name: "upgrade_titan_round", id: 2356412290, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/titanic_magazine.psd" },
18442
+ { name: "upgrade_toxic_bullets", id: 3696726732, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/serrated_bullets.psd" },
18443
+ { name: "upgrade_trophy_collector", id: 3074274290, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_utility/sprint_booster.psd" },
18444
+ { name: "upgrade_ultimate_burst", id: 493591231, slot: "spirit", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/adrenaline_rush.psd" },
18445
+ { name: "upgrade_unstoppable", id: 3357231760, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/unstoppable.psd" },
18446
+ { name: "upgrade_vampire", id: 499683006, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/health_stealing_bullets.psd" },
18447
+ { name: "upgrade_veil_walker", id: 865958998, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_utility/veil_walker.psd" },
18448
+ { name: "upgrade_vex_barrier", id: 1644605047, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/last_stand.psd" },
18449
+ { name: "upgrade_warp_stone", id: 3270001687, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/warp_stone.psd" },
18450
+ { name: "upgrade_weapon_shielding", id: 805079544, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_shield.psd" },
18451
+ { name: "upgrade_weighted_shots", id: 3791587546, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/improved_bullet_armor.psd" },
18452
+ { name: "upgrade_withering_whip", id: 2922054143, slot: "spirit", tier: 1, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/slowing_tech.psd" }
18453
+ ];
18454
+
18455
+ // js/src/items.ts
18456
+ var items = itemTable;
18457
+ function item(name) {
18458
+ return byName.get(name);
18078
18459
  }
18079
- function avatarBadge(steamId) {
18080
- return {
18081
- type: "avatar",
18082
- props: {
18083
- steamId,
18084
- style: {
18085
- width: badgeSize,
18086
- height: badgeSize,
18087
- horizontalAlign: "left",
18088
- verticalAlign: "bottom",
18089
- borderRadius: badgeSize / 2,
18090
- borderWidth: 1,
18091
- borderColor: shades.dim
18092
- }
18460
+ var byName = new Map(items.map((each) => [each.name, each]));
18461
+
18462
+ // js/src/hook.ts
18463
+ var hookAbility = "citadel_ability_hook";
18464
+ var hookUpgrades = 15;
18465
+ var Hook = class {
18466
+ constructor(read, cooldownSeconds = 0) {
18467
+ this.read = read;
18468
+ this.cooldownSeconds = cooldownSeconds;
18469
+ }
18470
+ read;
18471
+ cooldownSeconds;
18472
+ /** thrownAt is the start of the latest cooldown counted as a throw. */
18473
+ thrownAt = 0;
18474
+ /** reset forgets the throws counted so far, for a thrower in a new world. */
18475
+ reset() {
18476
+ this.thrownAt = 0;
18477
+ }
18478
+ /**
18479
+ * update reads the thrower's hook at game time now, keeps it fully upgraded
18480
+ * and sets the length of any cooldown a throw started. It reports nothing
18481
+ * for a hero without the hook. A caller that already read this frame's
18482
+ * abilities passes them to avoid another read.
18483
+ */
18484
+ update(player, now4, abilities = player.abilities()) {
18485
+ const ability = abilities.find((a) => a.name === hookAbility);
18486
+ if (!ability) {
18487
+ return void 0;
18093
18488
  }
18094
- };
18095
- }
18096
- var actionLooks = {
18097
- primary: {
18098
- idle: { background: tones.text },
18099
- hover: { background: shades.white },
18100
- text: shades.ink
18101
- },
18102
- secondary: {
18103
- idle: {
18104
- background: shades.raised,
18105
- borderWidth: 1,
18106
- borderColor: shades.faint
18107
- },
18108
- hover: { background: shades.lit, borderColor: tones.text },
18109
- text: tones.text
18110
- },
18111
- quiet: {
18112
- idle: { background: shades.clear },
18113
- hover: { background: shades.raised },
18114
- text: shades.quiet
18489
+ const victim = this.victim(ability.entity);
18490
+ if ((ability.upgrades & hookUpgrades) !== hookUpgrades) {
18491
+ player.setAbility({ ability: hookAbility, upgrades: hookUpgrades });
18492
+ }
18493
+ if (ability.cooldownEnd <= now4) {
18494
+ return { victim, thrown: false };
18495
+ }
18496
+ const thrown = ability.cooldownStart > this.thrownAt;
18497
+ if (thrown) {
18498
+ this.thrownAt = ability.cooldownStart;
18499
+ }
18500
+ this.setCooldown(player, ability);
18501
+ return { victim, thrown };
18502
+ }
18503
+ /** victim is the hero the hook entity holds, or undefined while it holds none. */
18504
+ victim(hookEntity) {
18505
+ const victim = this.read(
18506
+ hookEntity,
18507
+ "CCitadel_Ability_Hook",
18508
+ "m_hHookVictim",
18509
+ "handle"
18510
+ );
18511
+ return typeof victim === "number" ? victim : void 0;
18115
18512
  }
18116
- };
18117
- function Action(props) {
18118
- const look = actionLooks[props.kind ?? "secondary"];
18119
- const label = element(
18120
- "label",
18121
- {
18122
- face: "block",
18123
- fontSize: 16,
18124
- uppercase: true,
18125
- letterSpacing: 1,
18126
- color: look.text,
18127
- horizontalAlign: "center",
18128
- verticalAlign: "center",
18129
- noWrap: true
18130
- },
18131
- props.children
18132
- );
18133
- return {
18134
- type: "button",
18135
- props: {
18136
- style: {
18137
- height: sizes.control,
18138
- padding: [0, 14],
18139
- borderRadius: sizes.radius,
18140
- transition: motion.hover,
18141
- ...look.idle,
18142
- ...props.disabled ? { opacity: 0.4 } : {},
18143
- ...props.style
18144
- },
18145
- hover: props.disabled ? void 0 : look.hover,
18146
- hoverSound: props.disabled ? void 0 : sounds.hover,
18147
- sound: sounds.press,
18148
- disabled: props.disabled,
18149
- onPress: props.onPress,
18150
- children: label
18513
+ /** setCooldown ends the cooldown cooldownSeconds after the hook's throw. */
18514
+ setCooldown(player, ability) {
18515
+ if (this.cooldownSeconds <= 0) {
18516
+ player.refreshAbility(hookAbility);
18517
+ return;
18151
18518
  }
18152
- };
18153
- }
18154
- function Meter(props) {
18155
- const height = props.height ?? 8;
18156
- const value = Math.min(1, Math.max(0, props.value));
18157
- return element(
18158
- "panel",
18159
- {
18160
- width: props.width ?? 160,
18161
- height,
18162
- background: shades.raised,
18163
- borderRadius: height / 2,
18164
- overflow: "clip",
18165
- ...props.style
18166
- },
18167
- // The fill scales rather than resizes, so it eases without layout work.
18168
- element("panel", {
18169
- width: "100%",
18170
- height: "100%",
18171
- background: tones[props.tone ?? "accent"],
18172
- scale: [value, 1],
18173
- origin: [0, 50],
18174
- transition: motion.meter
18175
- })
18176
- );
18177
- }
18519
+ const cooldownEnd = ability.cooldownStart + this.cooldownSeconds;
18520
+ if (cooldownEnd !== ability.cooldownEnd) {
18521
+ player.setAbility({ ability: hookAbility, cooldownEnd });
18522
+ }
18523
+ }
18524
+ };
18178
18525
 
18179
18526
  // js/src/frameclock.ts
18180
18527
  var now3 = () => performance.now();
@@ -18378,7 +18725,7 @@ function strip(plane, { text: text2, side, up, pitch, color: color2, made }) {
18378
18725
  const yaw = plane.yaw * 180 / Math.PI - 90;
18379
18726
  for (const dx of [-1, 1]) {
18380
18727
  for (const dy of [-1, 1]) {
18381
- const shown = createText({
18728
+ const shown2 = createText({
18382
18729
  text: text2,
18383
18730
  position: at2(
18384
18731
  plane,
@@ -18393,7 +18740,7 @@ function strip(plane, { text: text2, side, up, pitch, color: color2, made }) {
18393
18740
  align: pitch === 90 ? "left" : "center",
18394
18741
  verticalAlign: "center"
18395
18742
  });
18396
- if (shown) made.objects.push(shown);
18743
+ if (shown2) made.objects.push(shown2);
18397
18744
  }
18398
18745
  }
18399
18746
  }
@@ -18550,188 +18897,13 @@ function leaderboard(players2, standing, rows, viewer) {
18550
18897
  const ranked = [...players2].sort(
18551
18898
  (a, b) => standing(b).wins - standing(a).wins || standing(b).rating - standing(a).rating
18552
18899
  );
18553
- const shown = ranked.slice(0, rows);
18554
- if (viewer !== void 0 && shown.length > 0 && players2.includes(viewer) && !shown.includes(viewer)) {
18555
- shown[shown.length - 1] = viewer;
18556
- }
18557
- return shown;
18558
- }
18559
-
18560
- // js/src/bystander.ts
18561
- var bystanderStates = [
18562
- "MODIFIER_STATE_IMMOBILIZED",
18563
- "MODIFIER_STATE_DISARMED",
18564
- "MODIFIER_STATE_MELEE_DISABLED",
18565
- "MODIFIER_STATE_SILENCED",
18566
- "MODIFIER_STATE_INVULNERABLE",
18567
- "MODIFIER_STATE_TECH_UNTARGETABLE_BY_ENEMIES",
18568
- "MODIFIER_STATE_TECH_UNTARGETABLE_BY_TEAMMATES",
18569
- "MODIFIER_STATE_DISPLACEMENT_IMMUNE",
18570
- "MODIFIER_STATE_IGNORE_BULLETS",
18571
- "MODIFIER_STATE_IGNORE_MELEE",
18572
- "MODIFIER_STATE_IN_ABILITY_DISABLE_ZOOM"
18573
- ];
18574
- function holdBystander(entity, active = true) {
18575
- let held = true;
18576
- for (const state of bystanderStates) {
18577
- held = holdModifierState(entity, state, active) && held;
18578
- }
18579
- return held;
18580
- }
18581
-
18582
- // js/src/strays.ts
18583
- var strayGraceSeconds = 3;
18584
- var strayRespawnTime = 1e9;
18585
- var strayBlow = 1e6;
18586
- var Strays = class {
18587
- /** since maps each stray pawn to when it was first seen with no player. */
18588
- since = /* @__PURE__ */ new Map();
18589
- /**
18590
- * gone holds the controller handles strays name that no longer resolve. A
18591
- * handle carries its entity's serial, so it never resolves again, and each
18592
- * failed read logs on the host: a sweep reads it once.
18593
- */
18594
- gone = /* @__PURE__ */ new Set();
18595
- sweptAt = -Infinity;
18596
- /**
18597
- * sweep lays down each hero pawn that has belonged to no player for
18598
- * strayGraceSeconds, at most once a second. The game sets a dead pawn's
18599
- * respawn when it dies, so the hold repeats on each sweep.
18600
- */
18601
- sweep(now4) {
18602
- if (now4 - this.sweptAt < 1) {
18603
- return;
18604
- }
18605
- this.sweptAt = now4;
18606
- const held = /* @__PURE__ */ new Set();
18607
- for (const { player } of players()) {
18608
- const pawn = player.pawn();
18609
- if (pawn) {
18610
- held.add(pawn.entity);
18611
- }
18612
- }
18613
- const since = /* @__PURE__ */ new Map();
18614
- const gone = /* @__PURE__ */ new Set();
18615
- for (const entity of findEntities("player")) {
18616
- if (held.has(entity) || ownHero(entity, this.gone, gone)) {
18617
- continue;
18618
- }
18619
- const first = this.since.get(entity) ?? now4;
18620
- since.set(entity, first);
18621
- if (now4 - first >= strayGraceSeconds) {
18622
- layDown(entity);
18623
- }
18624
- }
18625
- this.since = since;
18626
- this.gone = gone;
18627
- }
18628
- };
18629
- function ownHero(entity, known2, seen) {
18630
- const controller = readField(
18631
- entity,
18632
- "CBasePlayerPawn",
18633
- "m_hController",
18634
- "handle"
18635
- );
18636
- if (typeof controller !== "number") {
18637
- return false;
18638
- }
18639
- if (known2.has(controller)) {
18640
- seen.add(controller);
18641
- return false;
18642
- }
18643
- const connected = readField(
18644
- controller,
18645
- "CBasePlayerController",
18646
- "m_iConnected",
18647
- "int32"
18648
- );
18649
- if (connected === 3 || connected === 4) {
18650
- return false;
18651
- }
18652
- const hero = readField(
18653
- controller,
18654
- "CCitadelPlayerController",
18655
- "m_hHeroPawn",
18656
- "handle"
18657
- );
18658
- if (connected === void 0 && hero === void 0) {
18659
- seen.add(controller);
18660
- }
18661
- return hero === entity;
18662
- }
18663
- function layDown(entity) {
18664
- holdBystander(entity, false);
18665
- const health = readField(entity, "CBaseEntity", "m_iHealth", "int32");
18666
- if (typeof health === "number" && health > 0) {
18667
- damage({ victim: entity, amount: strayBlow });
18668
- log(`laid down a stray hero pawn ${entity}`);
18900
+ const shown2 = ranked.slice(0, rows);
18901
+ if (viewer !== void 0 && shown2.length > 0 && players2.includes(viewer) && !shown2.includes(viewer)) {
18902
+ shown2[shown2.length - 1] = viewer;
18669
18903
  }
18670
- writeField(
18671
- entity,
18672
- "CCitadelPlayerPawn",
18673
- "m_flRespawnTime",
18674
- "float32",
18675
- strayRespawnTime
18676
- );
18904
+ return shown2;
18677
18905
  }
18678
18906
 
18679
- // js/src/stragglers.ts
18680
- var stragglerConnectSeconds = 120;
18681
- var Stragglers = class {
18682
- connectSeconds;
18683
- strays;
18684
- /** joining maps each connecting human's slot to its generation and when it was first seen. */
18685
- joining = /* @__PURE__ */ new Map();
18686
- /** kicked holds the generation each slot had when this kicked it. */
18687
- kicked = /* @__PURE__ */ new Map();
18688
- sweptAt = -Infinity;
18689
- constructor(options = {}) {
18690
- this.connectSeconds = options.connectSeconds ?? stragglerConnectSeconds;
18691
- this.strays = options.heroes === false ? void 0 : new Strays();
18692
- }
18693
- /**
18694
- * sweep kicks each human connecting for longer than connectSeconds, once
18695
- * per connection, and lays down heroes no player holds, at most once a
18696
- * second.
18697
- */
18698
- sweep(now4) {
18699
- this.strays?.sweep(now4);
18700
- if (now4 - this.sweptAt < 1) {
18701
- return;
18702
- }
18703
- this.sweptAt = now4;
18704
- if (this.connectSeconds <= 0) {
18705
- return;
18706
- }
18707
- const joining = /* @__PURE__ */ new Map();
18708
- for (const connection2 of players()) {
18709
- if (connection2.bot || connection2.ready) {
18710
- continue;
18711
- }
18712
- const slot = connection2.player.slot;
18713
- const seen = this.joining.get(slot);
18714
- const since = seen?.generation === connection2.generation ? seen.since : now4;
18715
- joining.set(slot, { generation: connection2.generation, since });
18716
- if (now4 - since < this.connectSeconds) {
18717
- continue;
18718
- }
18719
- if (this.kicked.get(slot) === connection2.generation) {
18720
- continue;
18721
- }
18722
- this.kicked.set(slot, connection2.generation);
18723
- const name = connection2.name;
18724
- if (name === "" || name.includes('"')) {
18725
- log(`slot ${slot} stuck joining, but its name cannot be kicked`);
18726
- continue;
18727
- }
18728
- log(`kicked ${name}: still joining after ${this.connectSeconds} s`);
18729
- serverCommand(`kick "${name}"`);
18730
- }
18731
- this.joining = joining;
18732
- }
18733
- };
18734
-
18735
18907
  // js/src/probe.ts
18736
18908
  var ProbeRun = class {
18737
18909
  /**
@@ -19988,13 +20160,13 @@ var UpdateReply = /* @__PURE__ */ createMessageType(
19988
20160
 
19989
20161
  // js/src/persist.ts
19990
20162
  var service = "persist";
19991
- var entries2 = /* @__PURE__ */ new WeakMap();
20163
+ var entries = /* @__PURE__ */ new WeakMap();
19992
20164
  var requests = 0;
19993
20165
  function entry(player, type) {
19994
- let records = entries2.get(player);
20166
+ let records = entries.get(player);
19995
20167
  if (!records) {
19996
20168
  records = /* @__PURE__ */ new Map();
19997
- entries2.set(player, records);
20169
+ entries.set(player, records);
19998
20170
  }
19999
20171
  let known2 = records.get(type);
20000
20172
  if (!known2) {
@@ -20012,7 +20184,7 @@ function start(known2) {
20012
20184
  known2.started = ++requests;
20013
20185
  return known2.started;
20014
20186
  }
20015
- var left = "the player left; their Player no longer names a connection, and the slot may hold another player";
20187
+ var left2 = "the player left; their Player no longer names a connection, and the slot may hold another player";
20016
20188
  function generation(player) {
20017
20189
  const held = connection(player);
20018
20190
  if (held === void 0 || held.player !== player || !held.generation) {
@@ -20024,7 +20196,7 @@ function load(player, type, known2) {
20024
20196
  const request = start(known2);
20025
20197
  const live2 = generation(player);
20026
20198
  if (live2 === void 0) {
20027
- settle2(known2, request, unavailable(type, left));
20199
+ settle2(known2, request, unavailable(type, left2));
20028
20200
  return;
20029
20201
  }
20030
20202
  callServiceLater(
@@ -20073,7 +20245,7 @@ var persist = {
20073
20245
  const request = start(known2);
20074
20246
  const live2 = generation(player);
20075
20247
  if (live2 === void 0) {
20076
- settle2(known2, request, unavailable(type, left));
20248
+ settle2(known2, request, unavailable(type, left2));
20077
20249
  continue;
20078
20250
  }
20079
20251
  pending.push({ player, known: known2, request, generation: live2 });
@@ -20129,8 +20301,8 @@ var persist = {
20129
20301
  }
20130
20302
  const live2 = generation(player);
20131
20303
  if (live2 === void 0) {
20132
- log(`persist ${type} update: ${left}`);
20133
- done?.(void 0, left);
20304
+ log(`persist ${type} update: ${left2}`);
20305
+ done?.(void 0, left2);
20134
20306
  return;
20135
20307
  }
20136
20308
  const known2 = entry(player, type);
@@ -20951,6 +21123,9 @@ function respawned(player) {
20951
21123
  handler(player, pawn);
20952
21124
  }
20953
21125
  }
21126
+ function sweepStragglers(options = {}) {
21127
+ stragglers ??= new Stragglers(options);
21128
+ }
20954
21129
  function onFrame(handler) {
20955
21130
  frames.push(handler);
20956
21131
  }
@@ -21040,6 +21215,7 @@ var launches = [];
21040
21215
  var impacts = [];
21041
21216
  var landeds = [];
21042
21217
  var settingChanges = [];
21218
+ var stragglers;
21043
21219
  var handlers = {
21044
21220
  start(event) {
21045
21221
  for (const handler of starts) {
@@ -21049,8 +21225,8 @@ var handlers = {
21049
21225
  frames: true,
21050
21226
  damage: damages.length !== 0,
21051
21227
  damaged: damageds.length !== 0,
21052
- chat: chats.length !== 0,
21053
- joins: joins.length !== 0 || leaves.length !== 0,
21228
+ chat: chats.length !== 0 || chatShown(),
21229
+ joins: true,
21054
21230
  casts: abilityCasts.length !== 0,
21055
21231
  kills: kills.length !== 0,
21056
21232
  heals: heals.length !== 0,
@@ -21069,6 +21245,7 @@ var handlers = {
21069
21245
  tick(event.timeSeconds);
21070
21246
  advance(event.timeSeconds);
21071
21247
  advancePuppets(event.timeSeconds);
21248
+ stragglers?.sweep(event.timeSeconds);
21072
21249
  frameCount++;
21073
21250
  for (const handler of frames) {
21074
21251
  handler(event);
@@ -21087,6 +21264,7 @@ var handlers = {
21087
21264
  },
21088
21265
  chat(event) {
21089
21266
  after(0, () => {
21267
+ heard(event);
21090
21268
  for (const handler of chats) {
21091
21269
  handler(event);
21092
21270
  }
@@ -21210,14 +21388,18 @@ var handlers = {
21210
21388
  },
21211
21389
  // A join and a leave run at once, so the leaving player's hero still reads.
21212
21390
  playerJoined(event) {
21391
+ joined(event.connection.player);
21213
21392
  for (const handler of joins) {
21214
21393
  handler(event);
21215
21394
  }
21216
21395
  },
21396
+ // The library forgets what it showed a player who left once the mod has
21397
+ // heard the leave.
21217
21398
  playerLeft(event) {
21218
21399
  for (const handler of leaves) {
21219
21400
  handler(event);
21220
21401
  }
21402
+ if (event.disconnected) left(event.connection.player);
21221
21403
  }
21222
21404
  };
21223
21405
  serveEvents((call2) => serveMod(handlers, call2));
@@ -21311,6 +21493,7 @@ export {
21311
21493
  heroes,
21312
21494
  hide,
21313
21495
  hideHud,
21496
+ hideHudForAll,
21314
21497
  holdBystander,
21315
21498
  holdEntityModifier,
21316
21499
  holdMatchClock,
@@ -21356,6 +21539,8 @@ export {
21356
21539
  onSpawn,
21357
21540
  onStart,
21358
21541
  onWorld,
21542
+ parkHeight,
21543
+ parkedStates,
21359
21544
  pause,
21360
21545
  persist,
21361
21546
  playCamera,
@@ -21396,16 +21581,19 @@ export {
21396
21581
  settle,
21397
21582
  sheet,
21398
21583
  show,
21584
+ showChatLines,
21399
21585
  showEntityOnlyTo,
21400
21586
  showEntityToAll,
21401
21587
  silenceVoice,
21402
21588
  spawnNpc,
21589
+ spectateFrom,
21403
21590
  startRift,
21404
21591
  startServiceCall,
21405
21592
  startingRating,
21406
21593
  stopSound,
21407
21594
  stragglerConnectSeconds,
21408
21595
  strayGraceSeconds,
21596
+ sweepStragglers,
21409
21597
  theme_exports as theme,
21410
21598
  ticksPerSecond,
21411
21599
  toast,