Core/Misc: Refactor SendPlaySpellVisual and SendPlaySpellImpact and move them to Unit (from Spell)
This commit is contained in:
@@ -2035,7 +2035,7 @@ void Unit::BuildHeartBeatMsg(WorldPacket *data) const
|
||||
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);
|
||||
VisitNearbyWorldObject(dist, notifier);
|
||||
|
||||
@@ -16282,6 +16282,22 @@ void Unit::SetAuraStack(uint32 spellId, Unit* target, uint32 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
|
||||
{
|
||||
// player mounted on multi-passenger mount is also classified as vehicle
|
||||
|
||||
@@ -1485,6 +1485,8 @@ class Unit : public WorldObject
|
||||
Aura * AddAura(uint32 spellId, Unit* target);
|
||||
Aura * AddAura(SpellEntry const *spellInfo, uint8 effMask, Unit* target);
|
||||
void SetAuraStack(uint32 spellId, Unit* target, uint32 stack);
|
||||
void SendPlaySpellVisual(uint32 id);
|
||||
void SendPlaySpellImpact(uint64 guid, uint32 id);
|
||||
|
||||
bool IsDamageToThreatSpell(SpellEntry const* spellInfo) const;
|
||||
|
||||
|
||||
@@ -279,16 +279,9 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket & recv_data)
|
||||
return;
|
||||
|
||||
_player->ModifyMoney(-int32(nSpellCost));
|
||||
|
||||
WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 12); // visual effect on trainer
|
||||
data << uint64(guid);
|
||||
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);
|
||||
|
||||
unit->SendPlaySpellVisual(179); // 53 SpellCastDirected
|
||||
unit->SendPlaySpellImpact(_player->GetGUID(), 362); // 113 EmoteSalute
|
||||
|
||||
// learn explicitly or cast explicitly
|
||||
if (trainer_spell->IsCastable())
|
||||
@@ -296,7 +289,7 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket & recv_data)
|
||||
else
|
||||
_player->learnSpell(spellId, false);
|
||||
|
||||
data.Initialize(SMSG_TRAINER_BUY_SUCCEEDED, 12);
|
||||
WorldPacket data(SMSG_TRAINER_BUY_SUCCEEDED, 12);
|
||||
data << uint64(guid);
|
||||
data << uint32(spellId); // should be same as in packet from client
|
||||
SendPacket(&data);
|
||||
|
||||
@@ -4213,17 +4213,6 @@ void Spell::SendResurrectRequest(Player* target)
|
||||
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()
|
||||
{
|
||||
if (!m_CastItem || m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
|
||||
@@ -461,7 +461,6 @@ class Spell
|
||||
void SendChannelUpdate(uint32 time);
|
||||
void SendChannelStart(uint32 duration);
|
||||
void SendResurrectRequest(Player* target);
|
||||
void SendPlaySpellVisual(uint32 SpellID);
|
||||
|
||||
void HandleEffects(Unit *pUnitTarget, Item *pItemTarget, GameObject *pGOTarget, uint32 i);
|
||||
void HandleThreatSpells(uint32 spellId);
|
||||
|
||||
Reference in New Issue
Block a user