Core/Gameobject: destroy test

This commit is contained in:
Aokromes committed 2017-04-03 12:20:06 +02:00
1 parent 0decba0ad7
commit 92816c0f17
8 files changed
+27 -29

No files matched your search

+7 -23
View File
@@ -269,29 +269,15 @@ void Object::BuildOutOfRangeUpdateBlock(UpdateData* data) const
data->AddOutOfRangeGUID(GetGUID());
}
void Object::DestroyForPlayer(Player* target, bool onDeath) const
void Object::DestroyForPlayer(Player* target) const
{
ASSERT(target);
if (isType(TYPEMASK_UNIT) || isType(TYPEMASK_PLAYER))
{
if (Battleground* bg = target->GetBattleground())
{
if (bg->isArena())
{
WorldPacket data(SMSG_ARENA_UNIT_DESTROYED, 8);
data << uint64(GetGUID());
target->GetSession()->SendPacket(&data);
}
}
}
WorldPacket data(SMSG_DESTROY_OBJECT, 8 + 1);
data << uint64(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->GetSession()->SendPacket(&data);
UpdateData updateData(target->GetMapId());
BuildOutOfRangeUpdateBlock(&updateData);
WorldPacket packet;
updateData.BuildPacket(&packet);
target->SendDirectMessage(&packet);
}
int32 Object::GetInt32Value(uint16 index) const
@@ -2778,9 +2764,7 @@ void WorldObject::DestroyForNearbyPlayers()
continue;
if (GetTypeId() == TYPEID_UNIT)
DestroyForPlayer(player, ToUnit()->IsDuringRemoveFromWorld() && ToCreature()->isDead()); // at remove from world (destroy) show kill animation
else
DestroyForPlayer(player);
DestroyForPlayer(player); // at remove from world (destroy) show kill animation
player->m_clientGUIDs.erase(GetGUID());
}