*Fix broken chain spells.
--HG-- branch : trunk
This commit is contained in:
@@ -1159,6 +1159,14 @@ float WorldObject::GetDistance(const float x, const float y, const float z) cons
|
|||||||
return ( dist > 0 ? dist : 0);
|
return ( dist > 0 ? dist : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float WorldObject::GetDistanceSq(const float &x, const float &y, const float &z) const
|
||||||
|
{
|
||||||
|
float dx = GetPositionX() - x;
|
||||||
|
float dy = GetPositionY() - y;
|
||||||
|
float dz = GetPositionZ() - z;
|
||||||
|
return dx*dx + dy*dy + dz*dz;
|
||||||
|
}
|
||||||
|
|
||||||
float WorldObject::GetDistance2d(const WorldObject* obj) const
|
float WorldObject::GetDistance2d(const WorldObject* obj) const
|
||||||
{
|
{
|
||||||
float dx = GetPositionX() - obj->GetPositionX();
|
float dx = GetPositionX() - obj->GetPositionX();
|
||||||
|
|||||||
@@ -435,6 +435,7 @@ class TRINITY_DLL_SPEC WorldObject : public Object
|
|||||||
|
|
||||||
float GetDistance( const WorldObject* obj ) const;
|
float GetDistance( const WorldObject* obj ) const;
|
||||||
float GetDistance(const float x, const float y, const float z) const;
|
float GetDistance(const float x, const float y, const float z) const;
|
||||||
|
float GetDistanceSq(const float &x, const float &y, const float &z) const;
|
||||||
float GetDistance2d(const WorldObject* obj) const;
|
float GetDistance2d(const WorldObject* obj) const;
|
||||||
float GetDistance2d(const float x, const float y) const;
|
float GetDistance2d(const float x, const float y) const;
|
||||||
float GetDistanceZ(const WorldObject* obj) const;
|
float GetDistanceZ(const WorldObject* obj) const;
|
||||||
|
|||||||
+5
-2
@@ -1386,7 +1386,7 @@ void Spell::SearchChainTarget(std::list<Unit*> &TagUnitMap, float max_range, uin
|
|||||||
|
|
||||||
void Spell::SearchAreaTarget(std::list<Unit*> &TagUnitMap, float radius, const uint32 &type, SpellTargets TargetType, uint32 entry)
|
void Spell::SearchAreaTarget(std::list<Unit*> &TagUnitMap, float radius, const uint32 &type, SpellTargets TargetType, uint32 entry)
|
||||||
{
|
{
|
||||||
float x, y;
|
float x, y, z;
|
||||||
if(type == PUSH_DEST_CENTER)
|
if(type == PUSH_DEST_CENTER)
|
||||||
{
|
{
|
||||||
if(!m_targets.HasDest())
|
if(!m_targets.HasDest())
|
||||||
@@ -1396,6 +1396,7 @@ void Spell::SearchAreaTarget(std::list<Unit*> &TagUnitMap, float radius, const u
|
|||||||
}
|
}
|
||||||
x = m_targets.m_destX;
|
x = m_targets.m_destX;
|
||||||
y = m_targets.m_destY;
|
y = m_targets.m_destY;
|
||||||
|
z = m_targets.m_destZ;
|
||||||
}
|
}
|
||||||
else if(type == PUSH_TARGET_CENTER)
|
else if(type == PUSH_TARGET_CENTER)
|
||||||
{
|
{
|
||||||
@@ -1407,14 +1408,16 @@ void Spell::SearchAreaTarget(std::list<Unit*> &TagUnitMap, float radius, const u
|
|||||||
}
|
}
|
||||||
x = target->GetPositionX();
|
x = target->GetPositionX();
|
||||||
y = target->GetPositionY();
|
y = target->GetPositionY();
|
||||||
|
z = target->GetPositionZ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
x = m_caster->GetPositionX();
|
x = m_caster->GetPositionX();
|
||||||
y = m_caster->GetPositionY();
|
y = m_caster->GetPositionY();
|
||||||
|
z = m_caster->GetPositionZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
Trinity::SpellNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius, type, TargetType, entry);
|
Trinity::SpellNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius, type, TargetType, entry, x, y, z);
|
||||||
if((m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_PLAYERS_ONLY)
|
if((m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_PLAYERS_ONLY)
|
||||||
|| TargetType == SPELL_TARGETS_ENTRY && !entry)
|
|| TargetType == SPELL_TARGETS_ENTRY && !entry)
|
||||||
m_caster->GetMap()->VisitWorld(x, y, radius, notifier);
|
m_caster->GetMap()->VisitWorld(x, y, radius, notifier);
|
||||||
|
|||||||
+6
-4
@@ -580,14 +580,16 @@ namespace Trinity
|
|||||||
std::list<Unit*> *i_data;
|
std::list<Unit*> *i_data;
|
||||||
Spell &i_spell;
|
Spell &i_spell;
|
||||||
const uint32& i_push_type;
|
const uint32& i_push_type;
|
||||||
float i_radius;
|
float i_radius, i_radiusSq;
|
||||||
SpellTargets i_TargetType;
|
SpellTargets i_TargetType;
|
||||||
Unit* i_caster;
|
Unit* i_caster;
|
||||||
uint32 i_entry;
|
uint32 i_entry;
|
||||||
|
float i_x, i_y, i_z;
|
||||||
|
|
||||||
SpellNotifierCreatureAndPlayer(Spell &spell, std::list<Unit*> &data, float radius, const uint32 &type,
|
SpellNotifierCreatureAndPlayer(Spell &spell, std::list<Unit*> &data, float radius, const uint32 &type,
|
||||||
SpellTargets TargetType = SPELL_TARGETS_ENEMY, uint32 entry = 0)
|
SpellTargets TargetType = SPELL_TARGETS_ENEMY, uint32 entry = 0, float x = 0, float y = 0, float z = 0)
|
||||||
: i_data(&data), i_spell(spell), i_push_type(type), i_radius(radius), i_TargetType(TargetType), i_entry(entry)
|
: i_data(&data), i_spell(spell), i_push_type(type), i_radius(radius), i_radiusSq(radius*radius)
|
||||||
|
, i_TargetType(TargetType), i_entry(entry), i_x(x), i_y(y), i_z(z)
|
||||||
{
|
{
|
||||||
i_caster = spell.GetCaster();
|
i_caster = spell.GetCaster();
|
||||||
}
|
}
|
||||||
@@ -653,7 +655,7 @@ namespace Trinity
|
|||||||
i_data->push_back(itr->getSource());
|
i_data->push_back(itr->getSource());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if((itr->getSource()->GetDistance(i_spell.m_targets.m_destX, i_spell.m_targets.m_destY, i_spell.m_targets.m_destZ) < i_radius ))
|
if((itr->getSource()->GetDistanceSq(i_x, i_y, i_z) < i_radiusSq))
|
||||||
i_data->push_back(itr->getSource());
|
i_data->push_back(itr->getSource());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user