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.
- package/dist/browser/dredless.global.js +141 -0
- package/dist/browser/dredless.global.js.map +4 -4
- package/docs/API_REFERENCE.md +1 -0
- package/docs/PROTOCOL.md +27 -0
- package/docs/README.md +2 -1
- package/docs/WORLD_STATE.md +99 -0
- package/package.json +6 -1
- package/src/browser.d.ts +14 -0
- package/src/browser.js +1 -0
- package/src/client/core.js +2 -0
- package/src/client/domains/index.js +63 -0
- package/src/index.d.ts +92 -0
- package/src/index.js +1 -0
- package/src/protocol/index.d.ts +1 -0
- package/src/protocol/index.js +1 -0
- package/src/protocol/outbound/pvp.d.ts +13 -0
- package/src/protocol/outbound/pvp.js +45 -0
- package/src/state/model/decoder.js +48 -0
- package/src/state/model/index.d.ts +4 -0
- package/src/state/model/state.js +27 -0
- package/src/state/world/index.d.ts +4 -0
- package/src/state/world/state.js +2 -0
package/src/state/model/state.js
CHANGED
|
@@ -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));
|
package/src/state/world/state.js
CHANGED
|
@@ -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
|
};
|