mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[9323] Fixes in code work with original caster guid.
* Add 2 function for 2 used way for original caster
- GetAffectiveCaster(), is posible NULL unit as source spell affects
(explcit caster, GO owner, caster of aura that trigering affect)..
- GetCastingObject(), possible NULL world object as in game spell effects
source, cast center, etc, need because original caster can store GO
guid that apply effect around. In other cases m_caster
* Use functions and avoid use explicitly m_originalCaster
* Use GetAffectiveCaster() for fix explicit GO cast at near unit, like now fixed campfire bonus.
This commit is contained in:
parent
a8de1c0ad4
commit
2a01c79609
4 changed files with 63 additions and 56 deletions
|
|
@ -841,14 +841,16 @@ void Spell::EffectDummy(uint32 i)
|
|||
}
|
||||
case 17251: // Spirit Healer Res
|
||||
{
|
||||
if (!unitTarget || !m_originalCaster)
|
||||
if (!unitTarget)
|
||||
return;
|
||||
|
||||
if (m_originalCaster->GetTypeId() == TYPEID_PLAYER)
|
||||
Unit* caster = GetAffectiveCaster();
|
||||
|
||||
if (caster && caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
WorldPacket data(SMSG_SPIRIT_HEALER_CONFIRM, 8);
|
||||
data << uint64(unitTarget->GetGUID());
|
||||
((Player*)m_originalCaster)->GetSession()->SendPacket( &data );
|
||||
((Player*)caster)->GetSession()->SendPacket( &data );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -2518,7 +2520,7 @@ void Spell::EffectApplyAura(uint32 i)
|
|||
(unitTarget->GetTypeId() != TYPEID_PLAYER || !((Player*)unitTarget)->GetSession()->PlayerLoading()) )
|
||||
return;
|
||||
|
||||
Unit* caster = m_originalCaster ? m_originalCaster : m_caster;
|
||||
Unit* caster = GetAffectiveCaster();
|
||||
if(!caster)
|
||||
return;
|
||||
|
||||
|
|
@ -2668,9 +2670,7 @@ void Spell::EffectHeal( uint32 /*i*/ )
|
|||
if (unitTarget && unitTarget->isAlive() && damage >= 0)
|
||||
{
|
||||
// Try to get original caster
|
||||
Unit *caster = m_originalCasterGUID ? m_originalCaster : m_caster;
|
||||
|
||||
// Skip if m_originalCaster not available
|
||||
Unit *caster = GetAffectiveCaster();
|
||||
if (!caster)
|
||||
return;
|
||||
|
||||
|
|
@ -2752,9 +2752,7 @@ void Spell::EffectHealPct( uint32 /*i*/ )
|
|||
if (unitTarget && unitTarget->isAlive() && damage >= 0)
|
||||
{
|
||||
// Try to get original caster
|
||||
Unit *caster = m_originalCasterGUID ? m_originalCaster : m_caster;
|
||||
|
||||
// Skip if m_originalCaster not available
|
||||
Unit *caster = GetAffectiveCaster();
|
||||
if (!caster)
|
||||
return;
|
||||
|
||||
|
|
@ -2773,9 +2771,7 @@ void Spell::EffectHealMechanical( uint32 /*i*/ )
|
|||
if (unitTarget && unitTarget->isAlive() && damage >= 0)
|
||||
{
|
||||
// Try to get original caster
|
||||
Unit *caster = m_originalCasterGUID ? m_originalCaster : m_caster;
|
||||
|
||||
// Skip if m_originalCaster not available
|
||||
Unit *caster = GetAffectiveCaster();
|
||||
if (!caster)
|
||||
return;
|
||||
|
||||
|
|
@ -4265,7 +4261,7 @@ void Spell::EffectTameCreature(uint32 /*i*/)
|
|||
{
|
||||
// Caster must be player, checked in Spell::CheckCast
|
||||
// Spell can be triggered, we need to check original caster prior to caster
|
||||
Player* plr = (Player*)(m_originalCaster ? m_originalCaster : m_caster);
|
||||
Player* plr = (Player*)GetAffectiveCaster();
|
||||
|
||||
Creature* creatureTarget = (Creature*)unitTarget;
|
||||
|
||||
|
|
@ -5162,10 +5158,11 @@ void Spell::EffectScriptEffect(uint32 effIndex)
|
|||
// Emblazon Runeblade
|
||||
case 51770:
|
||||
{
|
||||
if(!m_originalCaster)
|
||||
Unit* caster = GetAffectiveCaster();
|
||||
if(!caster)
|
||||
return;
|
||||
|
||||
m_originalCaster->CastSpell(m_originalCaster, damage, false);
|
||||
caster->CastSpell(caster, damage, false);
|
||||
break;
|
||||
}
|
||||
// Death Gate
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue