dredless 1.2.2 → 1.3.0

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.
@@ -83,6 +83,8 @@ const {
83
83
  botIdentifierFromState,
84
84
  summarizeShieldGenerator,
85
85
  summarizeShipControl,
86
+ summarizePvpEvent,
87
+ summarizePvpPartyEntry,
86
88
  summarizeShipSize,
87
89
  summarizeShipWorldMetadata,
88
90
  summarizeItemCrate,
@@ -278,6 +280,8 @@ export class ModelState {
278
280
  balls: derived.specialEntities.balls.slice(),
279
281
  recyclers: derived.specialEntities.recyclers.slice(),
280
282
  shipControls: derived.shipControls.slice(),
283
+ pvpEvent: this.pvpEvent(),
284
+ pvpParties: this.pvpParties(),
281
285
  machines: this.#machinesSnapshot(derived.machines),
282
286
  tables: includeTables ? this.tablesSnapshot() : derived.tableSummaries.slice()
283
287
  };
@@ -331,6 +335,29 @@ export class ModelState {
331
335
  return this.#derivedState().shipControls.slice();
332
336
  }
333
337
 
338
+ pvpEvent() {
339
+ const entry = this.table(33).entries().next().value;
340
+ if (!entry) return null;
341
+ let shipsLeft = 0;
342
+ // The HUD excludes ships whose replicated exclusion flag is set.
343
+ for (const ship of this.table(20).values()) {
344
+ if (!ship.q153) shipsLeft += 1;
345
+ }
346
+ return summarizePvpEvent(entry[0], entry[1], shipsLeft);
347
+ }
348
+
349
+ pvpParties() {
350
+ const config = this.table(34).entries().next().value;
351
+ const entries = this.table(35);
352
+ if (!config && entries.size === 0) return null;
353
+ return {
354
+ configEntity: config?.[0] ?? null,
355
+ maxShips: config ? config[1].q20 ?? 0 : 35,
356
+ entries: [...entries].map(([entity, record]) => summarizePvpPartyEntry(entity, record)),
357
+ configState: config ? cloneRecord(config[1]) : null
358
+ };
359
+ }
360
+
334
361
  shipMetadata() {
335
362
  if (this.isOverworld) return null;
336
363
  const lockdownRecord = firstRecord(this.table(11));
@@ -16,6 +16,10 @@ export {
16
16
  type RcdSummary,
17
17
  type BallSummary,
18
18
  type RecyclerSummary,
19
+ type PvpEventSummary,
20
+ type PvpEventBounds,
21
+ type PvpPartiesSummary,
22
+ type PvpPartyEntrySummary,
19
23
  type ModelRecord,
20
24
  type ModelSnapshot,
21
25
  type TransformSummary,
@@ -266,6 +266,8 @@ export class WorldState {
266
266
  balls: model.balls,
267
267
  recyclers: model.recyclers,
268
268
  shipControls: model.shipControls,
269
+ pvpEvent: model.pvpEvent,
270
+ pvpParties: model.pvpParties,
269
271
  commsBubbles: this.commsBubbles.slice(),
270
272
  tiles: includeTiles ? [...this.tiles.values()] : undefined
271
273
  };