TrinityCore icon indicating copy to clipboard operation
TrinityCore copied to clipboard

Core/Misc: Sending player's own auras before all visible objects.

Open r4d1sh opened this issue 3 years ago • 6 comments

This should finally solve the problem of naked characters.

Many thanks to xvwyh for explaining cause of this bug

Issues addressed:

Closes #15159

r4d1sh avatar Nov 03 '22 04:11 r4d1sh

was this tested ingame and verified that the fields in the client are initialized ?

jackpoz avatar Nov 26 '22 13:11 jackpoz

31e7516b83aa Does it build, still hard to test and reproduce the issue even before fix.

CraftedRO avatar Nov 27 '22 10:11 CraftedRO

31e7516 Does it build, still hard to test and reproduce the issue even before fix.

it's not hard at all to reproduce. login with multiple characters on same location, don't move them and you will see few naked :)

Aokromes avatar Nov 27 '22 10:11 Aokromes

I would say one will have to debug WoW client to make sure the required fields are initialized

jackpoz avatar Nov 27 '22 15:11 jackpoz

should this PR be marked as Draft as it doesn't solve the issue yet ?

jackpoz avatar Dec 23 '22 13:12 jackpoz

Oi, I wasn't notified of this because I was mentioned via a URL instead of @xvwyh.

@jackpoz, can you test this with characters that have some visible buffs on them? Because: https://github.com/TrinityCore/TrinityCore/blob/b6d59f3f8885a382219a1e78fe85cfca281f1231/src/server/game/Entities/Player/Player.cpp#L23210-L23213 If the player that's logging in (the one that will see everyone else naked) doesn't have any visible auras on them - no packets will be sent and the memory will remain uninitialized. And you are testing with a brand new character that's unlikely to have any buffs. You'd need to add something like

-void Player::SendAurasForTarget(Unit* target) const
+void Player::SendAurasForTarget(Unit* target, bool force) const
 {
-     if (!target || target->GetVisibleAuras().empty())                  // speedup things 
+     if (!target || !force && target->GetVisibleAuras().empty())                  // speedup things 

And call it with force=true on login.

     // send to player his own auras (this is needed here for timely initialization of some fields on client)
-    player->SendAurasForTarget(player);
+    player->SendAurasForTarget(player, true);

Other than that, this PR should be functionally identical to the fix I made to my server. I vouch that it should work, barring any further differences between the codebases. Apologies for not mentioning this in my original message, I'll edit it now.

xvwyh avatar Feb 20 '23 21:02 xvwyh

I'd be grateful if someone could test this. Because I have no idea how to make sure the bug is no longer reproduced.

r4d1sh avatar Feb 20 '23 22:02 r4d1sh

I'd be grateful if someone could test this. Because I have no idea how to make sure the bug is no longer reproduced.

https://github.com/TrinityCore/TrinityCore/pull/28450#issuecomment-1328217322

Aokromes avatar Feb 20 '23 22:02 Aokromes

I'd be grateful if someone could test this. Because I have no idea how to make sure the bug is no longer reproduced.

#28450 (comment)

Ok I use five characters in one place for testing. Two of them were created earlier and three right now. One of them had a visible aura, the rest did not. I made several attempts and every time in all open clients I saw all the characters dressed.

So it seems to me that everything works.

Screenshot

image

r4d1sh avatar Feb 20 '23 23:02 r4d1sh

This actually reminds me of similar bug what other players see different, but with mounted npcs and their relocation https://github.com/TrinityCore/TrinityCore/issues/20136#issuecomment-687663047

Faq avatar Feb 21 '23 07:02 Faq

yea, now problem is solved as I coud test multiple times with same characters and same positions.

CraftedRO avatar Feb 21 '23 11:02 CraftedRO

is this PR ready to be merged then ?

jackpoz avatar Feb 23 '23 10:02 jackpoz

is this PR ready to be merged then ?

Yes

r4d1sh avatar Feb 23 '23 12:02 r4d1sh

Thanks for the PR 🚀 😃

jackpoz avatar Feb 25 '23 13:02 jackpoz