mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[7159] Allow GO cast as need (use go coordinates for target select in some cases)
Fixed work all Huter traps target selection More check in ObjectAccessor::Get Object More generic work 22 TARGET_CASTER_COORDINATES target type Signed-off-by: DiSlord <dislord@nomail.com>
This commit is contained in:
parent
c2a0a18a38
commit
abaa111eaa
10 changed files with 71 additions and 42 deletions
|
|
@ -101,6 +101,14 @@ void SpellCastTargets::setDestination(float x, float y, float z)
|
|||
m_targetMask |= TARGET_FLAG_DEST_LOCATION;
|
||||
}
|
||||
|
||||
void SpellCastTargets::setSource(float x, float y, float z)
|
||||
{
|
||||
m_srcX = x;
|
||||
m_srcY = y;
|
||||
m_srcZ = z;
|
||||
m_targetMask |= TARGET_FLAG_SOURCE_LOCATION;
|
||||
}
|
||||
|
||||
void SpellCastTargets::setGOTarget(GameObject *target)
|
||||
{
|
||||
m_GOTarget = target;
|
||||
|
|
@ -408,17 +416,11 @@ void Spell::FillTargetMap()
|
|||
// but need it support in some know cases
|
||||
switch(m_spellInfo->EffectImplicitTargetA[i])
|
||||
{
|
||||
case TARGET_ALL_AROUND_CASTER:
|
||||
if( m_spellInfo->EffectImplicitTargetB[i]==TARGET_ALL_PARTY ||
|
||||
m_spellInfo->EffectImplicitTargetB[i]==TARGET_ALL_FRIENDLY_UNITS_AROUND_CASTER ||
|
||||
m_spellInfo->EffectImplicitTargetB[i]==TARGET_ALL_RAID_AROUND_CASTER )
|
||||
{
|
||||
SetTargetMap(i,m_spellInfo->EffectImplicitTargetB[i],tmpUnitMap);
|
||||
}
|
||||
case TARGET_CASTER_COORDINATES:
|
||||
// Note: this hack with search required until GO casting not implemented
|
||||
// environment damage spells already have around enemies targeting but this not help in case not existed GO casting support
|
||||
// currently each enemy selected explicitly and self cast damage
|
||||
else if(m_spellInfo->EffectImplicitTargetB[i]==TARGET_ALL_ENEMY_IN_AREA && m_spellInfo->Effect[i]==SPELL_EFFECT_ENVIRONMENTAL_DAMAGE)
|
||||
if(m_spellInfo->EffectImplicitTargetB[i]==TARGET_ALL_ENEMY_IN_AREA && m_spellInfo->Effect[i]==SPELL_EFFECT_ENVIRONMENTAL_DAMAGE)
|
||||
{
|
||||
if(m_targets.getUnitTarget())
|
||||
tmpUnitMap.push_back(m_targets.getUnitTarget());
|
||||
|
|
@ -919,7 +921,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
|
|||
return;
|
||||
|
||||
// Get original caster (if exist) and calculate damage/healing from him data
|
||||
Unit *caster = m_originalCasterGUID ? m_originalCaster : m_caster;
|
||||
Unit *caster = m_originalCaster ? m_originalCaster : m_caster;
|
||||
|
||||
// Skip if m_originalCaster not avaiable
|
||||
if (!caster)
|
||||
|
|
@ -1471,6 +1473,19 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
|
|||
}break;
|
||||
case TARGET_ALL_ENEMY_IN_AREA:
|
||||
{
|
||||
CellPair p(MaNGOS::ComputeCellPair(m_targets.m_destX, m_targets.m_destY));
|
||||
Cell cell(p);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
MaNGOS::SpellNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius, PUSH_DEST_CENTER,SPELL_TARGETS_AOE_DAMAGE);
|
||||
|
||||
TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, WorldTypeMapContainer > world_object_notifier(notifier);
|
||||
TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier);
|
||||
|
||||
CellLock<GridReadGuard> cell_lock(cell, p);
|
||||
cell_lock->Visit(cell_lock, world_object_notifier, *m_caster->GetMap());
|
||||
cell_lock->Visit(cell_lock, grid_object_notifier, *m_caster->GetMap());
|
||||
}break;
|
||||
case TARGET_ALL_ENEMY_IN_AREA_INSTANT:
|
||||
{
|
||||
|
|
@ -1555,25 +1570,13 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
|
|||
if( target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->isPet() && ((Pet*)target)->getPetType() == MINI_PET)
|
||||
TagUnitMap.push_back(target);
|
||||
}break;
|
||||
case TARGET_ALL_AROUND_CASTER:
|
||||
case TARGET_CASTER_COORDINATES:
|
||||
{
|
||||
CellPair p(MaNGOS::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY()));
|
||||
Cell cell(p);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
MaNGOS::SpellNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius, PUSH_SELF_CENTER,SPELL_TARGETS_AOE_DAMAGE);
|
||||
|
||||
TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, WorldTypeMapContainer > world_object_notifier(notifier);
|
||||
TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier);
|
||||
|
||||
CellLock<GridReadGuard> cell_lock(cell, p);
|
||||
cell_lock->Visit(cell_lock, world_object_notifier, *m_caster->GetMap());
|
||||
cell_lock->Visit(cell_lock, grid_object_notifier, *m_caster->GetMap());
|
||||
m_targets.setDestination(m_targets.m_srcX, m_targets.m_srcY, m_targets.m_srcZ);
|
||||
}break;
|
||||
case TARGET_ALL_FRIENDLY_UNITS_AROUND_CASTER:
|
||||
{
|
||||
CellPair p(MaNGOS::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY()));
|
||||
CellPair p(MaNGOS::ComputeCellPair(m_targets.m_destX, m_targets.m_destY));
|
||||
Cell cell(p);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
|
@ -1716,7 +1719,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
|
|||
// targets the ground, not the units in the area
|
||||
if (m_spellInfo->Effect[i]!=SPELL_EFFECT_PERSISTENT_AREA_AURA)
|
||||
{
|
||||
CellPair p(MaNGOS::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY()));
|
||||
CellPair p(MaNGOS::ComputeCellPair(m_targets.m_destX, m_targets.m_destY));
|
||||
Cell cell(p);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
|
@ -2041,6 +2044,16 @@ void Spell::prepare(SpellCastTargets const* targets, Aura* triggeredByAura)
|
|||
|
||||
m_spellState = SPELL_STATE_PREPARING;
|
||||
|
||||
// Check original caster is GO - set its coordinates as src cast
|
||||
WorldObject *caster = NULL;
|
||||
if (m_originalCasterGUID)
|
||||
caster = (WorldObject *)ObjectAccessor::GetObjectByTypeMask(*m_caster, m_originalCasterGUID, TYPEMASK_GAMEOBJECT);
|
||||
if (!caster)
|
||||
caster = m_caster;
|
||||
|
||||
// Set cast source for targets
|
||||
m_targets.setSource(caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ());
|
||||
|
||||
m_castPositionX = m_caster->GetPositionX();
|
||||
m_castPositionY = m_caster->GetPositionY();
|
||||
m_castPositionZ = m_caster->GetPositionZ();
|
||||
|
|
@ -2892,6 +2905,7 @@ void Spell::SendSpellGo()
|
|||
}
|
||||
|
||||
WorldPacket data(SMSG_SPELL_GO, 50); // guess size
|
||||
|
||||
if(m_CastItem)
|
||||
data.append(m_CastItem->GetPackGUID());
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue