Skip to content

lod114d: getTradeInfo(1) returns the trade partner's name - #77

Merged
ResurrectedTrader merged 1 commit into
mainfrom
lod114d-trade-partner-name
Oct 7, 2026
Merged

ResurrectedTrader merged 1 commit into
mainfrom
lod114d-trade-partner-name

Conversation

@ResurrectedTrader

Copy link
Copy Markdown
Owner

Summary

getTradeInfo(1) (RecentTradeName) returned the local character's own name as a stand-in. It now reads the partner name the client stores when handling S2C 0x78 (assign player to trade): d2client::gwszRecentTradeName, wchar_t[16] at RVA 0x3C0E84, converted to UTF-8; an empty buffer gives null. The function reads under one GameReadLock.

The reference only has a commented-out pre-1.14d offset, so the address comes from disassembling the 1.14d Game.exe: the 0x78 handler copies the 16-char packet name there and stores the partner id just before it, a getter returns the buffer, and a static initialiser zeroes exactly 32 bytes. It sits 8 bytes past gnRecentTradeId in the same trade-state block.

Script-visible: getTradeInfo(1) returns the most recent trade partner's name (null before any trade this session). Not yet exercised in a live trade.

Verification

  • build.ps1 Release (Win32, the 1.14d DLL): builds
  • build.ps1 test: 169/169 pass
  • build.ps1 check-format: clean

🤖 Generated with Claude Code

GetTradeInfo(RecentTradeName) returned our own name (BnetData
szPlayerName) as a stand-in. It now reads the partner's name the client
stores when handling S2C 0x78 (assign player to trade):
d2client::gwszRecentTradeName, wchar_t[16] at RVA 0x3C0E84, converted to
UTF-8; an empty buffer gives nullopt. The whole function now reads under
a GameReadLock.

reference/d2bs/D2Ptrs.h only carries a commented-out pre-1.14d value for
RecentTradeName, so the address was found by disassembling the 1.14d
Game.exe: the S2C 0x78 handler copies the packet name (16 chars) there
and stores the partner unit id at 0x3C0E60; 0x4B9060 is its getter, and
a static initialiser zeroes exactly 32 bytes. The buffer sits 8 bytes
past gnRecentTradeId, in the same trade state block. Not exercised in a
live trade.

Script-visible behaviour: getTradeInfo(1) returns the name of the player
most recently assigned as trade partner (null before any trade this
session) instead of the local character's name.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@ResurrectedTrader
ResurrectedTrader merged commit e929a2e into main Oct 7, 2026
1 check passed
@ResurrectedTrader
ResurrectedTrader deleted the lod114d-trade-partner-name branch October 7, 2026 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant