Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Fix] Using %T in channel messages on fresh corpse yields mob, not corpse name. #4168

Merged
merged 7 commits into from
Apr 5, 2024

Conversation

noudess
Copy link
Contributor

@noudess noudess commented Mar 7, 2024

The problem:

Kill a PC or NPC. Target the corpse. The client shows the corpse name as xyz's_corpse. But the result of using %T in channels is just the npc or player name without the ''s corpse' addition. If you zone out and back in, then %T works as expected.

I broke down testing this to the two different cases:

MOB:

The only way I could make the client honor %T was to do a corpse->Spawn() after we do AddCorpse to the entity list. AddCorpse ends up setting the new name, but the client doesn't see this without me adding corpse->Spawn(). We do not get (2) corpses, it just seems to fix the (1).

Concerns:

  • If we don't use a backtick in the corpse name, but rather use a tick - the client doesnt fix it. Seems really odd to me. I tested if it was just a matter of changing any character. Nothing I did worked other that using a backtick instead of a tick. Maybe somewhere at some packet levels the tick is getting stripped?

PC:

[ Could not get this to function. The rename worked but caused multiple side effects on the client. Not worth it for just displaying correct name in macros. ]

@neckkola credited for the rename fix. I had uses a spawn packet instead.

@noudess noudess requested review from hgtw and neckkola March 7, 2024 21:28
@noudess noudess marked this pull request as draft March 7, 2024 21:30
zone/corpse.cpp Outdated Show resolved Hide resolved
@neckkola
Copy link
Contributor

neckkola commented Mar 7, 2024

I can take a look in the next few days. See what I can add.

@hgtw
Copy link
Contributor

hgtw commented Mar 8, 2024

Using %T on live behaves the same way. Even if you re-enter the zone it only outputs the name without "corpse" appended. If it used to work I'd suspect some unnecessary spawn packets were removed at some point.

As far as client behavior, %t uses the target's DisplayedName (mq variable naming) which is a cached stripped/cleaned name. Other things like Hail, UI labels, etc trims the raw Name of underscore/numbers and uses that. OP_Death appends 's corpse to the raw name when it does its work of setting the entity to corpse type etc. The corpse string doesn't get appended to DisplayedName here since it breaks the loop when it encounters an apostrophe.

Also for what it's worth live uses an apostrophe e.g., name's_corpse0 (always 0 even if there's multiple corpses of the same name) for the spawn packet when entering a zone that has corpses. This is likely why even re-entering a zone on live doesn't change %T behavior since setting DisplayedName trims anything after encountering the apostrophe.

Sending a spawn packet just to change the name is a bit heavy so it's probably not the right thing to do. If this is really desired I'd recommend adding a rule (since this wouldn't be live like) and just sending a mob rename packet for the corpse. The rule would have to switch server side names to use backticks since apostrophes are trimmed. The spawn packet essentially only does a rename anyway if it detects a player (spawn entity) id already exists in the zone and returns early after setting the name. This wouldn't be as heavy as sending a full spawn packet.

@noudess
Copy link
Contributor Author

noudess commented Mar 8, 2024

Using %T on live behaves the same way. Even if you re-enter the zone it only outputs the name without "corpse" appended. If it used to work I'd suspect some unnecessary spawn packets were removed at some point.

As far as client behavior, %t uses the target's DisplayedName (mq variable naming) which is a cached stripped/cleaned name. Other things like Hail, UI labels, etc trims the raw Name of underscore/numbers and uses that. OP_Death appends 's corpse to the raw name when it does its work of setting the entity to corpse type etc. The corpse string doesn't get appended to DisplayedName here since it breaks the loop when it encounters an apostrophe.

Also for what it's worth live uses an apostrophe e.g., name's_corpse0 (always 0 even if there's multiple corpses of the same name) for the spawn packet when entering a zone that has corpses. This is likely why even re-entering a zone on live doesn't change %T behavior since setting DisplayedName trims anything after encountering the apostrophe.

Sending a spawn packet just to change the name is a bit heavy so it's probably not the right thing to do. If this is really desired I'd recommend adding a rule (since this wouldn't be live like) and just sending a mob rename packet for the corpse. The rule would have to switch server side names to use backticks since apostrophes are trimmed. The spawn packet essentially only does a rename anyway if it detects a player (spawn entity) id already exists in the zone and returns early after setting the name. This wouldn't be as heavy as sending a full spawn packet.

I tried using the OP_MobRename packet in several different ways. None changed the behavior. Only going back to corpse->Spawn() do I get the results I need. I'm happy to discuss how I did it, or try a suggestion beyond those. @hgtw

Regarding the rule, are we sure we want that? I know this worked at some point on live, and on eqemu. I know we strive to be live like, but who would "choose" to not be able to use %T on a corpse for commands and have them work?

I greatly appreciate you looking into this! It explains why the backtick is needed to get the change to take place.

@neckkola
Copy link
Contributor

neckkola commented Mar 8, 2024

I have ran a few tests and have had some success in sending a name update to correct the problem. Will test further and report back. The rename is linked the corpseid in the deathpacket. Travelling today, though will try and get something up for you to test @noudess soon.

@hgtw
Copy link
Contributor

hgtw commented Mar 8, 2024

Are we sure live ever output the corpse suffix with %t? Grepping through some old logs from both 2006 and 2014 I'm seeing cases where a heal hotkey was clearly pressed on someone that just died and it just shows their name without the corpse.

It also looks like an apostrophe has always been used for corpses from hail messages not a backtick so this would make sense if the name has always been stripped of everything after an apostrophe (at least looking at 2003 and 2005 clients). The only thing I see in older logs with a backtick is "Venril`s Corpse" which is probably some old venril sathir`s remains quest npc spawn?

edit: It doesn't bother me if it needs to be a rule or not, someone else can decide. It will probably come down to a difference in using backticks vs apostrophes depending on how the rename testing works out.

@noudess
Copy link
Contributor Author

noudess commented Mar 8, 2024

I have ran a few tests and have had some success in sending a name update to correct the problem. Will test further and report back. The rename is linked the corpseid in the deathpacket. Travelling today, though will try and get something up for you to test @noudess soon.

I saw that the mob version of Kill_Struct did not fill in corpseid, felt odd, but didnt mess with that aspect.

@noudess
Copy link
Contributor Author

noudess commented Mar 8, 2024

Are we sure live ever output the corpse suffix with %t? Grepping through some old logs from both 2006 and 2014 I'm seeing cases where a heal hotkey was clearly pressed on someone that just died and it just shows their name without the corpse.

It also looks like an apostrophe has always been used for corpses from hail messages not a backtick so this would make sense if the name has always been stripped of everything after an apostrophe (at least looking at 2003 and 2005 clients). The only thing I see in older logs with a backtick is "Venrils Corpse" which is probably some old venril sathirs remains quest npc spawn?

edit: It doesn't bother me if it needs to be a rule or not, someone else can decide. It will probably come down to a difference in using backticks vs apostrophes depending on how the rename testing works out.

My recollections from live come from being having dozens of %T macros. Its just instilled in me that I can tell someone else about a corpse in /gui, and I would have noticed if the tells used the real name not the corpse's name. But as well all know memory can be selective, so I only say that I'd bet $1000 on it, but I could lose.

@noudess
Copy link
Contributor Author

noudess commented Mar 8, 2024

Is there any evidence in the client code that BodyType was checked and changed client behaviour (ie not stripping off corpse for corpses)?

@hgtw
Copy link
Contributor

hgtw commented Mar 8, 2024

Is there any evidence in the client code that BodyType was checked and changed client behaviour (ie not stripping off corpse for corpses)?

Only the spawn type is checked to make sure the entity id is not already a corpse when handling the death packet. It also checks for npc vs pc to form the string a little different (if npc it checks if the class is an object and just appends an id instead of "corpse", it also does something with setting any numbers to 0 in the suffix).

I don't see anything else that would not strip off 's_corpse for %T. DisplayedName is just a cached stripped name in rof2. Older clients called stripName when handling %T while rof2 just caches it when changing the name in the death packet and returns the cached version for %T.

There's also a couple places where the client searches entity names for the substr 's corpse as a fallback if it doesn't find by actual name in some group/raid member code and another place it generates locale eqstr messages if the string contains 's corpse. If client corpses on emu have always been sent with a backtick then whatever these fallbacks are for have probably never worked anyway though. I think they're for some role/leadership stuff.

edit: I had it backwards and npcs were the ones sent with backtick, not pcs

@neckkola
Copy link
Contributor

@noudess , I put together this branch for one version of a potential fix. https://github.com/neckkola/Server/tree/%25T_Updates

It uses the MobRename packet to adjust the stored named used in the %T after the death packet is done. Have not done any regression testing so not sure if there are side effects. Interested in your thoughts and approach.

@noudess
Copy link
Contributor Author

noudess commented Mar 11, 2024

@hgtw The patch @neckkola works using rename, but still requires a backtick for the new name. So we can get away from the spawn packet.

PC corpse can be fixed the same way, but it creates a bug when PC loots his own corpse with no drop confirmers on.

Working to decide if we should implement this only for NPCs, can fix PC issues, or just leave this whole issue as is.

@joligario
Copy link
Contributor

joligario commented Mar 11, 2024

image
Currently on PEQ yet
image

@Akkadius
Copy link
Member

@hgtw @noudess @neckkola @joligario what's the status on this guy?

@noudess
Copy link
Contributor Author

noudess commented Mar 25, 2024

@hgtw @noudess @neckkola @joligario what's the status on this guy?

@neckkola is still looking for time to resolve side effect on looting PC corpses.

If it can't be resolved cleanly, we will either discard this PR or go with the "fix" for NPC corpses only.

@noudess noudess marked this pull request as ready for review March 27, 2024 12:42
@noudess
Copy link
Contributor Author

noudess commented Mar 27, 2024

image Currently on PEQ yet image

I believe this to be a separate issue. Maybe @neckkola can answer this one?

@noudess
Copy link
Contributor Author

noudess commented Mar 27, 2024

@neckkola and I both saw too many issues with PC corpse rename. This works fine for NPC corpses, aside from the name looking a little funky. That said, it already was in place for looking at corpses after you zone in (the corpse list uses the backtick already) so this just makes corpses look the same to those already in the zone as opposed to those new people zoning in.

I'm ready for a merge/approval on this change,

@noudess
Copy link
Contributor Author

noudess commented Mar 31, 2024

@neckkola You ok with this PR? Basically your code. Its been working locally.

Copy link
Contributor

@hgtw hgtw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since server side is currently already using a backtick for npc corpses it probably does make sense to update the corpse name here on clients.

I still think we should rule this off at some point to use apostrophes just in the interest of live/client accuracy (and less packets) but if it's always been like this then I don't see it hurting anything.

zone/attack.cpp Outdated Show resolved Hide resolved
zone/attack.cpp Outdated Show resolved Hide resolved
zone/attack.cpp Show resolved Hide resolved
@noudess noudess requested a review from hgtw April 3, 2024 14:09
@noudess
Copy link
Contributor Author

noudess commented Apr 3, 2024

I think this is ready for merge.

@noudess noudess changed the title [Bug Fix] Using %T in channel messages on fresh corpse yields mob/player name, not corpse name. [Bug Fix] Using %T in channel messages on fresh corpse yields mob, not corpse name. Apr 3, 2024
zone/attack.cpp Outdated Show resolved Hide resolved
@noudess noudess requested a review from hgtw April 4, 2024 14:10
@noudess noudess merged commit b1d873d into EQEmu:master Apr 5, 2024
1 check passed
MortimerGreenwald pushed a commit to MortimerGreenwald/Server that referenced this pull request Apr 15, 2024
…t corpse name. (EQEmu#4168)

* [Bug Fix] Using %T in channel messages on fresh corpse yields mob/player name, not corpse name.

* Undo changes to PC corpse.

* Use rename to fix %T usage on client for those in zone

* Fix indentation spacing

* Update to consolidate Rename as suggested.

* Fix for mobs with ` in name

* Fix to use GetName() instead of GetCleanName()
@Akkadius Akkadius mentioned this pull request Apr 15, 2024
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.

None yet

6 participants