*Allow some spell effects to target units not in caster's map - fixes SPELL_EFFECT_SUMMON_PLAYER
--HG-- branch : trunk
This commit is contained in:
@@ -165,6 +165,11 @@ Player* ObjectAccessor::FindPlayer(uint64 guid)
|
|||||||
return GetObjectInWorld(guid, (Player*)NULL);
|
return GetObjectInWorld(guid, (Player*)NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Unit* ObjectAccessor::FindUnit(uint64 guid)
|
||||||
|
{
|
||||||
|
return GetObjectInWorld(guid, (Unit*)NULL);
|
||||||
|
}
|
||||||
|
|
||||||
Player* ObjectAccessor::FindPlayerByName(const char* name)
|
Player* ObjectAccessor::FindPlayerByName(const char* name)
|
||||||
{
|
{
|
||||||
ACE_GUARD_RETURN(LockType, g, *HashMapHolder<Player>::GetLock(), NULL);
|
ACE_GUARD_RETURN(LockType, g, *HashMapHolder<Player>::GetLock(), NULL);
|
||||||
|
|||||||
@@ -179,6 +179,7 @@ class ObjectAccessor
|
|||||||
// ACCESS LIKE THAT IS NOT THREAD SAFE
|
// ACCESS LIKE THAT IS NOT THREAD SAFE
|
||||||
static Pet * FindPet(uint64);
|
static Pet * FindPet(uint64);
|
||||||
static Player* FindPlayer(uint64);
|
static Player* FindPlayer(uint64);
|
||||||
|
static Unit* FindUnit(uint64);
|
||||||
Player* FindPlayerByName(const char* name);
|
Player* FindPlayerByName(const char* name);
|
||||||
|
|
||||||
// when using this, you must use the hashmapholder's lock
|
// when using this, you must use the hashmapholder's lock
|
||||||
|
|||||||
@@ -272,15 +272,13 @@ void MapManager::Update(uint32 diff)
|
|||||||
MapMapType::iterator iter = i_maps.begin();
|
MapMapType::iterator iter = i_maps.begin();
|
||||||
for (; iter != i_maps.end(); ++iter)
|
for (; iter != i_maps.end(); ++iter)
|
||||||
{
|
{
|
||||||
if (m_updater.activated())
|
if (m_updater.activated())
|
||||||
m_updater.schedule_update(*iter->second, i_timer.GetCurrent());
|
m_updater.schedule_update(*iter->second, i_timer.GetCurrent());
|
||||||
else
|
else
|
||||||
{
|
iter->second->Update(i_timer.GetCurrent());
|
||||||
iter->second->Update(i_timer.GetCurrent());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (m_updater.activated())
|
if (m_updater.activated())
|
||||||
m_updater.wait();
|
m_updater.wait();
|
||||||
|
|
||||||
for (iter = i_maps.begin(); iter != i_maps.end(); ++iter)
|
for (iter = i_maps.begin(); iter != i_maps.end(); ++iter)
|
||||||
iter->second->DelayedUpdate(i_timer.GetCurrent());
|
iter->second->DelayedUpdate(i_timer.GetCurrent());
|
||||||
|
|||||||
@@ -755,7 +755,7 @@ enum SpellEffects
|
|||||||
SPELL_EFFECT_LEAP_BACK = 138,
|
SPELL_EFFECT_LEAP_BACK = 138,
|
||||||
SPELL_EFFECT_CLEAR_QUEST = 139,
|
SPELL_EFFECT_CLEAR_QUEST = 139,
|
||||||
SPELL_EFFECT_FORCE_CAST = 140,
|
SPELL_EFFECT_FORCE_CAST = 140,
|
||||||
SPELL_EFFECT_141 = 141,
|
SPELL_EFFECT_FORCE_CAST_WITH_VALUE = 141,
|
||||||
SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE = 142,
|
SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE = 142,
|
||||||
SPELL_EFFECT_APPLY_AREA_AURA_OWNER = 143,
|
SPELL_EFFECT_APPLY_AREA_AURA_OWNER = 143,
|
||||||
SPELL_EFFECT_KNOCK_BACK_DEST = 144,
|
SPELL_EFFECT_KNOCK_BACK_DEST = 144,
|
||||||
|
|||||||
@@ -1052,11 +1052,34 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
|
|||||||
target->processed = true; // Target checked in apply effects procedure
|
target->processed = true; // Target checked in apply effects procedure
|
||||||
|
|
||||||
// Get mask of effects for target
|
// Get mask of effects for target
|
||||||
uint32 mask = target->effectMask;
|
uint8 mask = target->effectMask;
|
||||||
|
|
||||||
Unit* unit = m_caster->GetGUID() == target->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster,target->targetGUID);
|
Unit* unit = m_caster->GetGUID() == target->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster,target->targetGUID);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
|
{
|
||||||
|
uint8 farMask = 0;
|
||||||
|
// create far target mask
|
||||||
|
for(uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||||
|
{
|
||||||
|
if (IsFarUnitTargetEffect(m_spellInfo->Effect[i]))
|
||||||
|
if ((1<<i) & mask)
|
||||||
|
farMask |= (1<<i);
|
||||||
|
}
|
||||||
|
if (!farMask)
|
||||||
|
return;
|
||||||
|
// find unit in world
|
||||||
|
unit = ObjectAccessor::FindUnit(target->targetGUID);
|
||||||
|
if (!unit)
|
||||||
|
return;
|
||||||
|
// do far effects on the unit
|
||||||
|
// can't use default call because of threading, do stuff as fast as possible
|
||||||
|
for(uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||||
|
{
|
||||||
|
if (farMask & (1<<i))
|
||||||
|
HandleEffects(unit,NULL,NULL,i);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (unit->isAlive() != target->alive)
|
if (unit->isAlive() != target->alive)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -3230,7 +3230,7 @@ bool CanSpellPierceImmuneAura(SpellEntry const * pierceSpell, SpellEntry const *
|
|||||||
// these spells (Cyclone for example) can pierce all...
|
// these spells (Cyclone for example) can pierce all...
|
||||||
if ((pierceSpell->AttributesEx & SPELL_ATTR_EX_UNAFFECTED_BY_SCHOOL_IMMUNE)
|
if ((pierceSpell->AttributesEx & SPELL_ATTR_EX_UNAFFECTED_BY_SCHOOL_IMMUNE)
|
||||||
// ...but not these (Divine shield for example)
|
// ...but not these (Divine shield for example)
|
||||||
&& !(aura->AttributesEx & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY))
|
&& !(aura && aura->AttributesEx & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -398,6 +398,16 @@ inline bool IsAreaOfEffectSpell(SpellEntry const *spellInfo)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool IsFarUnitTargetEffect(uint32 effect)
|
||||||
|
{
|
||||||
|
return (effect == SPELL_EFFECT_SUMMON_PLAYER);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool IsFarDestTargetEffect(uint32 effect)
|
||||||
|
{
|
||||||
|
return (effect == SPELL_EFFECT_TELEPORT_UNITS);
|
||||||
|
}
|
||||||
|
|
||||||
inline bool IsAreaAuraEffect(uint32 effect)
|
inline bool IsAreaAuraEffect(uint32 effect)
|
||||||
{
|
{
|
||||||
if (effect == SPELL_EFFECT_APPLY_AREA_AURA_PARTY ||
|
if (effect == SPELL_EFFECT_APPLY_AREA_AURA_PARTY ||
|
||||||
|
|||||||
Reference in New Issue
Block a user