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());
}
+1 -1
View File
@@ -120,7 +120,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) const;
int32 GetInt32Value(uint16 index) const;
uint32 GetUInt32Value(uint16 index) const;
+2 -2
View File
@@ -4141,9 +4141,9 @@ void Player::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c
Unit::BuildCreateUpdateBlockForPlayer(data, target);
}
void Player::DestroyForPlayer(Player* target, bool onDeath) const
void Player::DestroyForPlayer(Player* target) const
{
Unit::DestroyForPlayer(target, onDeath);
Unit::DestroyForPlayer(target);
for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
+1 -1
View File
@@ -2013,7 +2013,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
WorldSession* GetSession() const { return m_session; }
void BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const override;
void DestroyForPlayer(Player* target, bool onDeath = false) const override;
void DestroyForPlayer(Player* target) const override;
void SendLogXPGain(uint32 GivenXP, Unit* victim, uint32 BonusXP, bool recruitAFriend = false, float group_rate=1.0f) const;
// notifiers
+15
View File
@@ -17027,6 +17027,21 @@ void Unit::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target)
data->append(fieldBuffer);
}
void Unit::DestroyForPlayer(Player* target) const
{
if (Battleground* bg = target->GetBattleground())
{
if (bg->isArena())
{
WorldPacket data(SMSG_ARENA_UNIT_DESTROYED, 8);
data << GetGUID();
target->GetSession()->SendPacket(&data);
}
}
WorldObject::DestroyForPlayer(target);
}
int32 Unit::GetHighestExclusiveSameEffectSpellGroupValue(AuraEffect const* aurEff, AuraType auraType, bool checkMiscValue /*= false*/, int32 miscValue /*= 0*/) const
{
int32 val = 0;
+1
View File
@@ -2217,6 +2217,7 @@ class TC_GAME_API Unit : public WorldObject
explicit Unit (bool isWorldObject);
void BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, Player* target) const override;
void DestroyForPlayer(Player* target) const override;
UnitAI* i_AI, *i_disabledAI;
@@ -770,7 +770,6 @@ void OpcodeTable::Initialize()
DEFINE_OPCODE_HANDLER(SMSG_DEATH_RELEASE_LOC, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_DEBUG_RUNE_REGEN, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_DEFENSE_MESSAGE, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_DESTROY_OBJECT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_DESTRUCTIBLE_BUILDING_DAMAGE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_DIFFERENT_INSTANCE_FROM_PARTY, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_DISENCHANT_CREDIT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
@@ -818,7 +818,6 @@ enum Opcodes
SMSG_DEBUG_RUNE_REGEN = 0x31B3,
SMSG_DEBUG_SERVER_GEO = 0x0235,
SMSG_DEFENSE_MESSAGE = 0x0314,
SMSG_DESTROY_OBJECT = 0x4724,
SMSG_DESTRUCTIBLE_BUILDING_DAMAGE = 0x4825,
SMSG_DIFFERENT_INSTANCE_FROM_PARTY = 0x15B1,
SMSG_DISENCHANT_CREDIT = 0x55A2,