mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 10:26:28 +01:00
Core/Pets: a827230910 followup reducing differences between branches
This commit is contained in:
@@ -67,12 +67,13 @@ enum PetSpellType
|
||||
PETSPELL_TALENT = 2
|
||||
};
|
||||
|
||||
enum ActionFeedback
|
||||
enum class PetActionFeedback : uint8
|
||||
{
|
||||
FEEDBACK_NONE = 0,
|
||||
FEEDBACK_PET_DEAD = 1,
|
||||
FEEDBACK_NOTHING_TO_ATT = 2,
|
||||
FEEDBACK_CANT_ATT_TARGET = 3
|
||||
None = 0,
|
||||
Dead = 1,
|
||||
NoTarget = 2,
|
||||
InvalidTarget = 3,
|
||||
NoPath = 4
|
||||
};
|
||||
|
||||
enum PetAction : int32
|
||||
|
||||
@@ -10243,26 +10243,36 @@ void Unit::TriggerAurasProcOnEvent(ProcEventInfo& eventInfo, AuraApplicationProc
|
||||
}
|
||||
|
||||
///----------Pet responses methods-----------------
|
||||
void Unit::SendPetActionFeedback(uint8 msg) const
|
||||
void Unit::SendPetActionFeedback(PetActionFeedback msg, uint32 spellId) const
|
||||
{
|
||||
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 petActionFeedback;
|
||||
petActionFeedback.SpellID = spellId;
|
||||
petActionFeedback.Response = msg;
|
||||
owner->ToPlayer()->SendDirectMessage(petActionFeedback.Write());
|
||||
}
|
||||
|
||||
void Unit::SendPetActionSound(PetAction action) const
|
||||
{
|
||||
SendMessageToSet(WorldPackets::Pet::PetActionSound(GetGUID(), static_cast<int32>(action)).Write(), false);
|
||||
WorldPackets::Pet::PetActionSound petActionSound;
|
||||
petActionSound.UnitGUID = GetGUID();
|
||||
petActionSound.Action = action;
|
||||
SendMessageToSet(petActionSound.Write(), false);
|
||||
}
|
||||
|
||||
void Unit::SendPetDismissSound() const
|
||||
{
|
||||
if (CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId()))
|
||||
SendMessageToSet(WorldPackets::Pet::PetDismissSound(static_cast<int32>(displayInfo->ModelID), GetPosition()).Write(), false);
|
||||
CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId());
|
||||
if (!displayInfo)
|
||||
return;
|
||||
|
||||
WorldPackets::Pet::PetDismissSound petDismissSound;
|
||||
petDismissSound.ModelId = displayInfo->ModelID;
|
||||
petDismissSound.ModelPosition = GetPosition();
|
||||
SendMessageToSet(petDismissSound.Write(), false);
|
||||
}
|
||||
|
||||
void Unit::SendPetAIReaction(ObjectGuid guid) const
|
||||
|
||||
@@ -1708,7 +1708,7 @@ class TC_GAME_API Unit : public WorldObject
|
||||
void ClearComboPointHolders();
|
||||
|
||||
///----------Pet responses methods-----------------
|
||||
void SendPetActionFeedback(uint8 msg) const;
|
||||
void SendPetActionFeedback(PetActionFeedback msg, uint32 spellId) const;
|
||||
void SendPetActionSound(PetAction action) const;
|
||||
void SendPetDismissSound() const;
|
||||
void SendPetAIReaction(ObjectGuid guid) const;
|
||||
|
||||
@@ -487,7 +487,7 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPackets::Spells::PetCancelAura
|
||||
|
||||
if (!pet->IsAlive())
|
||||
{
|
||||
pet->SendPetActionFeedback(FEEDBACK_PET_DEAD);
|
||||
pet->SendPetActionFeedback(PetActionFeedback::Dead, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,10 +51,20 @@ WorldPacket const* WorldPackets::Pet::PetUnlearnedSpell::Write()
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Pet::PetActionFeedback::Write()
|
||||
{
|
||||
_worldPacket << uint8(Response);
|
||||
if (Response == ::PetActionFeedback::NoTarget || Response == ::PetActionFeedback::InvalidTarget)
|
||||
_worldPacket << int32(SpellID);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Pet::PetActionSound::Write()
|
||||
{
|
||||
_worldPacket << UnitGUID;
|
||||
_worldPacket << int32(Action);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
@@ -62,5 +72,6 @@ WorldPacket const* WorldPackets::Pet::PetDismissSound::Write()
|
||||
{
|
||||
_worldPacket << int32(ModelId);
|
||||
_worldPacket << ModelPosition;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#define PetPackets_h__
|
||||
|
||||
#include "Packet.h"
|
||||
#include "PetDefines.h"
|
||||
#include "Position.h"
|
||||
#include "ObjectGuid.h"
|
||||
|
||||
@@ -96,11 +97,21 @@ namespace WorldPackets
|
||||
void Read() override { }
|
||||
};
|
||||
|
||||
class PetActionFeedback final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
PetActionFeedback() : ServerPacket(SMSG_PET_ACTION_FEEDBACK, 4 + 1) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
int32 SpellID = 0;
|
||||
::PetActionFeedback Response = ::PetActionFeedback::None;
|
||||
};
|
||||
|
||||
class PetActionSound final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
PetActionSound(ObjectGuid unitGUID, int32 action)
|
||||
: ServerPacket(SMSG_PET_ACTION_SOUND, 8 + 4), UnitGUID(unitGUID), Action(action) { }
|
||||
PetActionSound() : ServerPacket(SMSG_PET_ACTION_SOUND, 8 + 4) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
@@ -111,8 +122,7 @@ namespace WorldPackets
|
||||
class PetDismissSound final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
PetDismissSound(int32 modelId, Position modelPosition)
|
||||
: ServerPacket(SMSG_PET_DISMISS_SOUND, 4 + 12), ModelId(modelId), ModelPosition(modelPosition) { }
|
||||
PetDismissSound() : ServerPacket(SMSG_PET_DISMISS_SOUND, 4 + 12) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user