Core/Misc: Refactor SendPlaySpellVisual and SendPlaySpellImpact and move them to Unit (from Spell)

This commit is contained in:
Nay
2011-07-04 14:46:48 +01:00
parent 40b17fd862
commit d6782fa826
6 changed files with 23 additions and 24 deletions
+1 -1
View File
@@ -2035,7 +2035,7 @@ void Unit::BuildHeartBeatMsg(WorldPacket *data) const
BuildMovementPacket(data); BuildMovementPacket(data);
} }
void WorldObject::SendMessageToSetInRange(WorldPacket *data, float dist, bool /*bToSelf*/) void WorldObject::SendMessageToSetInRange(WorldPacket *data, float dist, bool /*self*/)
{ {
Trinity::MessageDistDeliverer notifier(this, data, dist); Trinity::MessageDistDeliverer notifier(this, data, dist);
VisitNearbyWorldObject(dist, notifier); VisitNearbyWorldObject(dist, notifier);
+16
View File
@@ -16282,6 +16282,22 @@ void Unit::SetAuraStack(uint32 spellId, Unit* target, uint32 stack)
aura->SetStackAmount(stack); aura->SetStackAmount(stack);
} }
void Unit::SendPlaySpellVisual(uint32 id)
{
WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 8 + 4);
data << uint64(GetGUID());
data << uint32(id); // SpellVisualKit.dbc index
SendMessageToSet(&data, false);
}
void Unit::SendPlaySpellImpact(uint64 guid, uint32 id)
{
WorldPacket data(SMSG_PLAY_SPELL_IMPACT, 8 + 4);
data << uint64(guid); // target
data << uint32(id); // SpellVisualKit.dbc index
SendMessageToSet(&data, false);
}
void Unit::ApplyResilience(Unit const* victim, float* crit, int32* damage, bool isCrit, CombatRating type) const void Unit::ApplyResilience(Unit const* victim, float* crit, int32* damage, bool isCrit, CombatRating type) const
{ {
// player mounted on multi-passenger mount is also classified as vehicle // player mounted on multi-passenger mount is also classified as vehicle
+2
View File
@@ -1485,6 +1485,8 @@ class Unit : public WorldObject
Aura * AddAura(uint32 spellId, Unit* target); Aura * AddAura(uint32 spellId, Unit* target);
Aura * AddAura(SpellEntry const *spellInfo, uint8 effMask, Unit* target); Aura * AddAura(SpellEntry const *spellInfo, uint8 effMask, Unit* target);
void SetAuraStack(uint32 spellId, Unit* target, uint32 stack); void SetAuraStack(uint32 spellId, Unit* target, uint32 stack);
void SendPlaySpellVisual(uint32 id);
void SendPlaySpellImpact(uint64 guid, uint32 id);
bool IsDamageToThreatSpell(SpellEntry const* spellInfo) const; bool IsDamageToThreatSpell(SpellEntry const* spellInfo) const;
@@ -280,15 +280,8 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket & recv_data)
_player->ModifyMoney(-int32(nSpellCost)); _player->ModifyMoney(-int32(nSpellCost));
WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 12); // visual effect on trainer unit->SendPlaySpellVisual(179); // 53 SpellCastDirected
data << uint64(guid); unit->SendPlaySpellImpact(_player->GetGUID(), 362); // 113 EmoteSalute
data << uint32(0xB3); // index from SpellVisualKit.dbc
SendPacket(&data);
data.Initialize(SMSG_PLAY_SPELL_IMPACT, 12); // visual effect on player
data << uint64(_player->GetGUID());
data << uint32(0x016A); // index from SpellVisualKit.dbc
SendPacket(&data);
// learn explicitly or cast explicitly // learn explicitly or cast explicitly
if (trainer_spell->IsCastable()) if (trainer_spell->IsCastable())
@@ -296,7 +289,7 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket & recv_data)
else else
_player->learnSpell(spellId, false); _player->learnSpell(spellId, false);
data.Initialize(SMSG_TRAINER_BUY_SUCCEEDED, 12); WorldPacket data(SMSG_TRAINER_BUY_SUCCEEDED, 12);
data << uint64(guid); data << uint64(guid);
data << uint32(spellId); // should be same as in packet from client data << uint32(spellId); // should be same as in packet from client
SendPacket(&data); SendPacket(&data);
-11
View File
@@ -4213,17 +4213,6 @@ void Spell::SendResurrectRequest(Player* target)
target->GetSession()->SendPacket(&data); target->GetSession()->SendPacket(&data);
} }
void Spell::SendPlaySpellVisual(uint32 SpellID)
{
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 8 + 4);
data << uint64(m_caster->GetGUID());
data << uint32(SpellID); // spell visual id?
m_caster->ToPlayer()->GetSession()->SendPacket(&data);
}
void Spell::TakeCastItem() void Spell::TakeCastItem()
{ {
if (!m_CastItem || m_caster->GetTypeId() != TYPEID_PLAYER) if (!m_CastItem || m_caster->GetTypeId() != TYPEID_PLAYER)
-1
View File
@@ -461,7 +461,6 @@ class Spell
void SendChannelUpdate(uint32 time); void SendChannelUpdate(uint32 time);
void SendChannelStart(uint32 duration); void SendChannelStart(uint32 duration);
void SendResurrectRequest(Player* target); void SendResurrectRequest(Player* target);
void SendPlaySpellVisual(uint32 SpellID);
void HandleEffects(Unit *pUnitTarget, Item *pItemTarget, GameObject *pGOTarget, uint32 i); void HandleEffects(Unit *pUnitTarget, Item *pItemTarget, GameObject *pGOTarget, uint32 i);
void HandleThreatSpells(uint32 spellId); void HandleThreatSpells(uint32 spellId);