Core/PacketIO: Handle CMSG_REQUEST_PET_INFO, so pet/vehicle/charm/possess bar shows after a client /reload (#7)

* Core/PacketIO: Handle CMSG_REQUEST_PET_INFO, so pet/vehicle/charm/possess bar shows after a client /reload

* Core/Handlers: added additional checks for PetSpellInitialize() call in HandleRequestPetInfoOpcode and apply codestyle standards
This commit is contained in:
Artamedes authored and Ovah committed 2019-10-08 16:53:55 +02:00
1 parent 3640c11096
commit 87c6cc19e5
2 files changed
+24 -8

No files matched your search

-8
View File
@@ -1482,14 +1482,6 @@ void WorldSession::HandleMoveSetCanFlyAckOpcode(WorldPacket& recvData)
_player->m_unitMovedByMe->m_movementInfo.flags = movementInfo.GetMovementFlags();
}
void WorldSession::HandleRequestPetInfoOpcode(WorldPacket& /*recvData */)
{
/*
TC_LOG_DEBUG("network", "WORLD: CMSG_REQUEST_PET_INFO");
recvData.hexlike();
*/
}
void WorldSession::HandleSetTaxiBenchmarkOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_SET_TAXI_BENCHMARK_MODE");
+24
View File
@@ -972,3 +972,27 @@ void WorldSession::SendPetAdded(int32 petSlot, int32 petNumber, int32 creatureID
SendPacket(&data);
}
void WorldSession::HandleRequestPetInfoOpcode(WorldPacket& /*recvData*/)
{
/* Handle the packet CMSG_REQUEST_PET_INFO - Send when player has a pet, and does /reload
* From: https://github.com/TrinityCore/TrinityCore/commit/6ebe1afeeccb847702c12e522bddaa7b5694dc38#comments
* This packet is also sent when
* You're controlling a vehicle (Player::VehicleSpellInitialize)
* You have a unit charmed (Player::CharmSpellInitialize)
* You're possessing a unit (Player::PossessSpellInitialize)
*/
if (_player->GetPet() && _player->CanControlPet())
_player->PetSpellInitialize();
if (Unit* charm = _player->GetCharm())
{
if (charm->HasUnitState(UNIT_STATE_POSSESSED))
_player->PossessSpellInitialize();
else if (charm->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED))
_player->VehicleSpellInitialize();
else
_player->CharmSpellInitialize();
}
}