fix(Core/Player): Send player's own auras before all visible objects (#15445)

* fix(Core/Player): Send player's own auras before all visible objects

* cherry-pick commit (c6cd272505)

Co-Authored-By: Mikhail Redko <13364438+r4d1sh@users.noreply.github.com>

* Update Map.cpp

* Update src/server/game/Entities/Player/Player.cpp

* Update src/server/game/Entities/Player/Player.cpp

* Update src/server/game/Maps/Map.cpp

---------

Co-authored-by: Mikhail Redko <13364438+r4d1sh@users.noreply.github.com>
This commit is contained in:
Kitzunu
2023-04-02 20:30:26 +02:00
committed by GitHub
parent e6fb7ff806
commit a0c51a45fb
3 changed files with 16 additions and 6 deletions

View File

@@ -11586,7 +11586,6 @@ void Player::SendInitialPacketsAfterAddToMap()
SendMessageToSet(&data2, true);
}
GetAurasForTarget(this);
SendEnchantmentDurations(); // must be after add to map
SendItemDurations(); // must be after add to map
SendQuestGiverStatusMultiple();
@@ -11967,9 +11966,9 @@ void Player::learnSkillRewardedSpells(uint32 skill_id, uint32 skill_value)
}
}
void Player::GetAurasForTarget(Unit* target) // pussywizard: contact before changing ANYTHING!
void Player::GetAurasForTarget(Unit* target, bool force /*= false*/)
{
if (!target/* || target->GetVisibleAuras()->empty()*/) // speedup things
if (!target || (!force && target->GetVisibleAuras()->empty())) // speedup things
return;
/*! Blizz sends certain movement packets sometimes even before CreateObject

View File

@@ -2183,7 +2183,7 @@ public:
void SendBGWeekendWorldStates();
void SendBattlefieldWorldStates();
void GetAurasForTarget(Unit* target);
void GetAurasForTarget(Unit* target, bool force = false);
PlayerMenu* PlayerTalkClass;
std::vector<ItemSetEffect*> ItemSetEff;

View File

@@ -2525,6 +2525,7 @@ void Map::SendInitSelf(Player* player)
{
LOG_DEBUG("maps", "Creating player data for himself {}", player->GetGUID().ToString());
WorldPacket packet;
UpdateData data;
// attach to player data current transport data
@@ -2534,15 +2535,25 @@ void Map::SendInitSelf(Player* player)
// build data for self presence in world at own client (one time for map)
player->BuildCreateUpdateBlockForPlayer(&data, player);
// build and send self update packet before sending to player his own auras
data.BuildPacket(&packet);
player->SendDirectMessage(&packet);
// send to player his own auras (this is needed here for timely initialization of some fields on client)
player->GetAurasForTarget(player, true);
// clean buffers for further work
packet.clear();
data.Clear();
// build other passengers at transport also (they always visible and marked as visible and will not send at visibility update at add to map
if (Transport* transport = player->GetTransport())
for (Transport::PassengerSet::const_iterator itr = transport->GetPassengers().begin(); itr != transport->GetPassengers().end(); ++itr)
if (player != (*itr) && player->HaveAtClient(*itr))
(*itr)->BuildCreateUpdateBlockForPlayer(&data, player);
WorldPacket packet;
data.BuildPacket(&packet);
player->GetSession()->SendPacket(&packet);
player->SendDirectMessage(&packet);
}
void Map::SendInitTransports(Player* player)