fix(client): ground items cannot be picked up and holding Alt does not display ground item labels (#555) #560

Merged
troytt merged 1 commits from fix/issue-555-ground-item-pickup-and-alt-labels into main 2026-10-02 10:26:12 +00:00
Owner

Summary

Fixes #555: Ground items on the ground cannot be picked up, and holding Alt does not display ground item names/labels.

Root Causes

  1. Alt Key Capture & Swallowing:
    • In src/client/main.ts, a capture-phase key listener called e.stopImmediatePropagation() when CommandMapper.handleKeyDown returned true for Alt, preventing HudManager's bubble listener from receiving Alt.
    • Fixed by syncing this.hudManager.showGroundLabels = true/false directly from CommandMapper.handleKeyDown / handleKeyUp, and adding resetModifiers() on window blur.
  2. Ground Item Labels Not Laid Out or Rendered:
    • layoutGroundItemLabels was never called in the render loop.
    • Fixed by calculating ground item screen positions, laying them out via layoutGroundItemLabels, and drawing the dark translucent label plaques with 1.13c quality colors (gold, unique, set, rare, magic, normal) and bilingual English/Chinese text.
  3. Ground Item Hit-Testing & Pickup Range:
    • In CommandMapper.resolvePointerTarget, prioritize hit-testing hudManager.groundItemLabelBoxes so clicking anywhere on the overhead label box immediately targets and picks up that item.
    • Added -16px camera Y-offset compensation for sprite hit-testing and ignored dead monsters (mode: 0 or mode: 12).
    • Implemented deferred arrival pickup: when clicking an item at dist > 4, CommandMapper.tick() watches pendingItemPickupId and automatically dispatches ItemPickup (0x16) as soon as the player walks within 4 subtiles.
  4. ReportKill Mode:
    • In src/netproto/d2gs/s2c/units.ts, mapped 0x11 ReportKill monster kills to mode: 12 (MONMODE_DEAD) instead of raw 0x09.

Verification

  • Added tests/client/ground-item-pickup-and-alt-labels-555.test.ts (6/6 passing).
  • All 20 client test files (175 tests) passing.
  • All 5 E2E test suites (204 tests) passing.
  • 0 TypeScript typecheck errors across all projects.
## Summary Fixes #555: Ground items on the ground cannot be picked up, and holding Alt does not display ground item names/labels. ### Root Causes 1. **Alt Key Capture & Swallowing**: - In `src/client/main.ts`, a capture-phase key listener called `e.stopImmediatePropagation()` when `CommandMapper.handleKeyDown` returned true for Alt, preventing `HudManager`'s bubble listener from receiving Alt. - Fixed by syncing `this.hudManager.showGroundLabels = true/false` directly from `CommandMapper.handleKeyDown` / `handleKeyUp`, and adding `resetModifiers()` on window blur. 2. **Ground Item Labels Not Laid Out or Rendered**: - `layoutGroundItemLabels` was never called in the render loop. - Fixed by calculating ground item screen positions, laying them out via `layoutGroundItemLabels`, and drawing the dark translucent label plaques with 1.13c quality colors (gold, unique, set, rare, magic, normal) and bilingual English/Chinese text. 3. **Ground Item Hit-Testing & Pickup Range**: - In `CommandMapper.resolvePointerTarget`, prioritize hit-testing `hudManager.groundItemLabelBoxes` so clicking anywhere on the overhead label box immediately targets and picks up that item. - Added -16px camera Y-offset compensation for sprite hit-testing and ignored dead monsters (`mode: 0` or `mode: 12`). - Implemented deferred arrival pickup: when clicking an item at `dist > 4`, `CommandMapper.tick()` watches `pendingItemPickupId` and automatically dispatches `ItemPickup` (0x16) as soon as the player walks within 4 subtiles. 4. **ReportKill Mode**: - In `src/netproto/d2gs/s2c/units.ts`, mapped 0x11 ReportKill monster kills to `mode: 12` (MONMODE_DEAD) instead of raw 0x09. ### Verification - Added `tests/client/ground-item-pickup-and-alt-labels-555.test.ts` (6/6 passing). - All 20 client test files (175 tests) passing. - All 5 E2E test suites (204 tests) passing. - 0 TypeScript typecheck errors across all projects.
troytt added 1 commit 2026-10-02 10:26:05 +00:00
troytt merged commit b839301aae into main 2026-10-02 10:26:12 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: troytt/diablo2-web#560
No description provided.