mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 00:48:56 +01:00
Core/Packets: converted SMSG_DESTROY_OBJECT to packet class
This commit is contained in:
@@ -263,16 +263,16 @@ void Object::BuildOutOfRangeUpdateBlock(UpdateData* data) const
|
||||
data->AddOutOfRangeGUID(GetGUID());
|
||||
}
|
||||
|
||||
void Object::DestroyForPlayer(Player* target, bool onDeath /*= false*/) const
|
||||
void Object::DestroyForPlayer(Player* target, bool isDead /*= false*/) const
|
||||
{
|
||||
ASSERT(target);
|
||||
|
||||
WorldPacket data(SMSG_DESTROY_OBJECT, 8 + 1);
|
||||
data << uint64(GetGUID());
|
||||
WorldPackets::Misc::DestroyObject packet;
|
||||
packet.Guid = GetGUID();
|
||||
//! If the following bool is true, the client will call "void CGUnit_C::OnDeath()" for this object.
|
||||
//! OnDeath() does for eg trigger death animation and interrupts certain spells/missiles/auras/sounds...
|
||||
data << uint8(onDeath ? 1 : 0);
|
||||
target->SendDirectMessage(&data);
|
||||
packet.IsDead = isDead;
|
||||
target->SendDirectMessage(packet.Write());
|
||||
}
|
||||
|
||||
int32 Object::GetInt32Value(uint16 index) const
|
||||
|
||||
@@ -89,7 +89,7 @@ class TC_GAME_API Object
|
||||
void BuildValuesUpdateBlockForPlayer(UpdateData* data, Player* target) const;
|
||||
void BuildOutOfRangeUpdateBlock(UpdateData* data) const;
|
||||
|
||||
virtual void DestroyForPlayer(Player* target, bool onDeath = false) const;
|
||||
virtual void DestroyForPlayer(Player* target, bool isDead = false) const;
|
||||
|
||||
int32 GetInt32Value(uint16 index) const;
|
||||
uint32 GetUInt32Value(uint16 index) const;
|
||||
|
||||
@@ -241,3 +241,11 @@ WorldPacket const* WorldPackets::Misc::StartTimer::Write()
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::DestroyObject::Write()
|
||||
{
|
||||
_worldPacket << Guid;
|
||||
_worldPacket << uint8(IsDead);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
@@ -295,6 +295,17 @@ namespace WorldPackets
|
||||
int32 TimeLeft = 0;
|
||||
int32 TotalTime = 0;
|
||||
};
|
||||
|
||||
class DestroyObject final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
DestroyObject() : ServerPacket(SMSG_DESTROY_OBJECT, 9) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
ObjectGuid Guid;
|
||||
bool IsDead = false;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user