Core/Packets: converted SMSG_PET_ACTION_FEEDBACK to packet class and added spellId argument to Unit::SendPetActionFeedback

This commit is contained in:
Ovahlord committed 2022-12-11 20:03:57 +01:00
1 parent ec97df6528
commit 92c9661804
4 files changed
+36 -5

No files matched your search

+6 -4
View File
@@ -59,6 +59,7 @@
#include "OutdoorPvP.h"
#include "PassiveAI.h"
#include "Pet.h"
#include "PetPackets.h"
#include "PetAI.h"
#include "PhasingHandler.h"
#include "Player.h"
@@ -10196,15 +10197,16 @@ void Unit::TriggerAurasProcOnEvent(ProcEventInfo& eventInfo, AuraApplicationProc
}
///----------Pet responses methods-----------------
void Unit::SendPetActionFeedback(uint8 msg)
void Unit::SendPetActionFeedback(uint8 response, uint32 spellId /*=0*/)
{
Unit* owner = GetOwner();
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
return;
WorldPacket data(SMSG_PET_ACTION_FEEDBACK, 1);
data << uint8(msg);
owner->ToPlayer()->SendDirectMessage(&data);
WorldPackets::Pet::PetActionFeedback actionFeedback;
actionFeedback.Response = response;
actionFeedback.SpellID = spellId;
owner->ToPlayer()->SendDirectMessage(actionFeedback.Write());
}
void Unit::SendPetTalk(uint32 pettalk)
+1 -1
View File
@@ -1693,7 +1693,7 @@ class TC_GAME_API Unit : public WorldObject
int8 m_comboPoints;
///----------Pet responses methods-----------------
void SendPetActionFeedback (uint8 msg);
void SendPetActionFeedback (uint8 response, uint32 spellId = 0);
void SendPetTalk (uint32 pettalk);
void SendPetAIReaction(ObjectGuid guid);
///----------End of Pet responses methods----------
@@ -16,6 +16,7 @@
*/
#include "PetPackets.h"
#include "PetDefines.h"
WorldPacket const* WorldPackets::Pet::PetDismissSound::Write()
{
@@ -41,3 +42,20 @@ WorldPacket const* WorldPackets::Pet::SPetMode::Write()
return &_worldPacket;
}
WorldPacket const* WorldPackets::Pet::PetActionFeedback::Write()
{
_worldPacket << uint8(Response);
switch (Response)
{
case FEEDBACK_NOTHING_TO_ATT:
case FEEDBACK_CANT_ATT_TARGET:
_worldPacket << int32(SpellID);
break;
default:
break;
}
return &_worldPacket;
}
@@ -57,6 +57,17 @@ namespace WorldPackets
ObjectGuid PetGUID;
uint32 PetMode = 0;
};
class PetActionFeedback final : public ServerPacket
{
public:
PetActionFeedback() : ServerPacket(SMSG_PET_ACTION_FEEDBACK, 1) { }
WorldPacket const* Write() override;
int32 SpellID = 0;
uint8 Response = 0;
};
}
}