fix(client): ground items cannot be picked up and holding Alt does not display ground item labels #555
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
In
play.html, dropped items on the ground (such as scrolls, potions, gold, and equipment dropped by slain monsters) cannot be picked up when clicked, and holdingAltdoes not display ground item name labels.Root Causes
AltKey Swallowed in Capture Phase:src/client/main.tsattacheswindow.addEventListener('keydown'/'keyup', ..., true)in the capture phase.CommandMapper.handleKeyDown(src/client/input/command-mapper.ts) handlese.key === 'Alt', setsthis.altHeld = true, and returnstrue, causingmain.tsto calle.stopImmediatePropagation().HudManager's bubble-phase listener never receivesAlt, andCommandMappernever syncsthis.hudManager.showGroundLabels.layoutGroundItemLabels) Never Rendered or Hit-Tested:layoutGroundItemLabels(src/common/items/ground-items.ts) was imported insrc/client/scene/world-renderer.tsbut never invoked inworld-renderer.tsorhud-manager.ts.Alt(showGroundLabels) nor hovering a ground item renders the 1.13c dark translucent plaque and quality-colored item name (D2Client.dll0x6FB1F4A0) ontohudCanvas.CommandMapper.resolvePointerTargetalso never hit-tests visibleGroundItemLabelBoxrectangles whenAltis held.dist > 4) and Close Up (dist <= 4):0x16(ItemPickup) while out of range (dist > 4):CommandMapper.triggerPrimaryWorldActionemitsMoveToUnit(0x02/0x04) and immediately in the same frame emitsItemPickup(0x16). D2GS (D2Game.dll0x6FC45FB0) rejects0x16when the player is > 4 subtiles away on the server, and no0x16is emitted when the player arrives at the item.-16px Y-offset & small sprite hit-testing mismatch:world-renderer.tsrenders the WebGL scene withcamY = snapshot.playerWorld.y - 16and draws ground items at(worldX - rect.w / 2, worldY - rect.h + groundYOffset), whereasCommandMapper.resolvePointerTargetprojectsscreenToSubtilewithout compensating for the-16px camera Y shift or testing the ground item sprite bounding box.decode0x11ReportKillsetsmode: 0x09instead of12(MONMODE_DEAD),resolvePointerTargetomitsunit.mode === 0(MONMODE_DEATH), andClientWorldinverted0x9Caction === 0x02(ITMODE_DROPPING= 5) vs0x03(ITMODE_ON_GROUND= 3).Expected Behavior (1.13c Ground Truth)
Altdisplays all visible ground item labels (D2Client.dll0x6FB1F4A0) with vertical anti-overlap stacking and 1.13c quality colors; hovering a ground item withoutAltdisplays that item's label.Altis held) or clicking a ground item sprite walks to the item ifdist > 4and sends0x16(PickItem) once within pickup range (dist <= 4), or immediately sends0x16when already withindist <= 4.Resolved and merged into
mainvia PR #560 (commitb839301).Fix Summary
main.tsby directly synchronizingHudManager.showGroundLabelsfromCommandMapper.handleKeyDown/handleKeyUp, with window blur modifier reset.layoutGroundItemLabelsinrenderSceneSourceFrameto populatehudManager.groundItemLabelBoxeswith 1.13c quality hex colors and bilingual (English/Chinese) names. Rendered dark translucent plaques onhudCanvas.CommandMapper.resolvePointerTargetchecksgroundItemLabelBoxesfirst so clicking directly on an item's overhead label immediately targets and picks up the item.dist > 4) dispatchesItemPickup(0x16) as soon as the player walks within 4 subtiles, without getting canceled by mouse-hold ground move ticks.mode: 12(MONMODE_DEAD) instead of 0x09.tests/client/ground-item-pickup-and-alt-labels-555.test.ts(6/6 passing). All 20 client test files (175 tests) and 5 E2E test suites (204 tests) pass with 0 TypeScript errors.