Repository navigation
lod114d: fill in the gameevent names the 0x5A packet leaves out - #106
Merged
Merged
Conversation
Owner
Author
|
Don't we already have similar code elsewhere? |
Owner
Author
|
If not, feel free to merge |
d2bs's EventMessagesHandler fills in names before it fires gameevent: - a monster or object slayer (mode 6) is named from its txt row; - a player-relation event (mode 7) gets the roster name for param1; - an item-box event (mode 0x0a) with no name becomes "You". d2bsng passed the raw packet strings, so a death message had no killer name. The 0x5A intercept now resolves the names the same way. The one exception is an object slayer: the reference reads objects.txt "Name" as a locale id, but that column holds the name itself, so it is used directly. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The roster walk duplicated Party::FindById / Party::Name; use them. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ResurrectedTrader
force-pushed
the
gameevent-resolve-names
branch
from
October 8, 2026 11:00
e786cb7 to
127f68e
Compare
Owner
Author
|
Partly, yes. The player-relation case (mode 7) walked the roster list by hand, which is what The rest has no equivalent:
Rebased onto main; Release build, tests and format check pass. I'm leaving the merge to you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
d2bs behaviour
EventMessagesHandler(referenceD2NetHandlers.cpp) rewrites the packet's names before it callsGameActionEvent:0x06"name1 slain by name2"param2(slayer unit type) is a monster or an objectname2= the localized name frommonstats.NameStr/objects.Namefor rowparam10x07player relationname1= the roster (PlayerUnitList) name of playerparam10x0a"name1 has items in his box"name1is emptyname1="You"d2bsng before
The 0x5A case in
src/backends/lod114d/hooks/Intercepts.cpppassed the raw packet strings toonGameEvent. For a monster kill the packet carries no killer name, soname2was empty, and the mode 7 / 0x0a names were blank as well.Fix
A
ResolveGameEventNameshelper in the 0x5A intercept applies the same rules as the reference:GetTxtValue("monstats", param1, "NameStr")gives the locale id, whichGetLocaleStringturns into the name.objects.txt'sNamecolumn toFillBaseStatas a 2-byte locale id. That column is a 64-char ASCII string, soFillBaseStatrefuses the size and the reference resolves an uninitialised locale id. This PR uses the object's name string from the same column instead.gpPlayerUnitListunder aGameReadLock.name1becomes"You".The
gameeventparameter docs mention the filled-in names.kolbot usage restored
threads/Party.js:70-72:case 0x06formatsConfig.DeathMessageswith$killer=name2. A monster kill printed an empty killer name.libs/scripts/Follower.js:840matchesname1 === Config.Leaderon every event, so mode 7 events from the leader now match.threads/ToolsThread.js:228handles mode 7 too.Testing
Built (Release, Win32) and ran the test suite. The intercept is not part of the test build, so there is no unit test. Not live-tested in game.
Not in this PR
The reference also exits the game on a mode 7 hostile event when
QuitOnHostileis set. d2bsng stores and shows that setting, but nothing acts on it. That is left for a separate change.