test(#539): take the town waypoint from its server UnitAssign anywhere in the capture
Vendor captures 06/07 (merged from feat/vendor-stash) walk away from the waypoint, so the server removes it (0x0A) before the capture ends; the static object position is taken from its UnitAssign instead of the final world state.
This commit is contained in:
parent
17e7a8f2e4
commit
b3452a4dac
|
|
@ -140,7 +140,8 @@ describe('Issue #539: player spawn is rendered at the server position inside the
|
|||
it(`${name}: rendered player == server position, on camp floor`, () => {
|
||||
const text = readFileSync(resolve(FIXTURE_DIR, name), 'utf8')
|
||||
// Independent ground truth: plain protocol replay into a bare ClientWorld.
|
||||
const truth = replayD2CapText(text, { strict: true }).world
|
||||
const truthResult = replayD2CapText(text, { strict: true })
|
||||
const truth = truthResult.world
|
||||
expect(truth.areaId).toBe(ROGUE_ENCAMPMENT)
|
||||
expect(truth.self.x).toBeGreaterThan(0)
|
||||
expect(truth.self.y).toBeGreaterThan(0)
|
||||
|
|
@ -200,7 +201,18 @@ describe('Issue #539: player spawn is rendered at the server position inside the
|
|||
const playerComp = label[(sy - view!.subOriginY) * view!.subWidth + (sx - view!.subOriginX)]!
|
||||
expect(playerComp).toBeGreaterThanOrEqual(0)
|
||||
expect(sizes[playerComp]).toBe(Math.max(...sizes))
|
||||
const waypoints = truth.getUnitsByType('object').filter(o => o.classId === ACT1_TOWN_WAYPOINT_CLASS)
|
||||
// The waypoint is a static object; captures that walk away from it (e.g. 06/07 vendor runs)
|
||||
// see the server remove it (0x0A) before the capture ends, so take its server UnitAssign
|
||||
// from anywhere in the capture rather than the final world state.
|
||||
const waypointIds = new Set<number>()
|
||||
const waypoints: { readonly x: number; readonly y: number }[] = []
|
||||
for (const ev of truthResult.events) {
|
||||
if (ev.type !== 'UnitAssign') continue
|
||||
const u = ev.unit
|
||||
if (u.unitType !== 2 || u.classId !== ACT1_TOWN_WAYPOINT_CLASS || waypointIds.has(u.id)) continue
|
||||
waypointIds.add(u.id)
|
||||
waypoints.push({ x: u.x, y: u.y })
|
||||
}
|
||||
expect(waypoints.length).toBe(1)
|
||||
const wp = waypoints[0]!
|
||||
let waypointReachable = false
|
||||
|
|
|
|||
Loading…
Reference in New Issue