mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[9079] Less strict check related to TARGET_SCRIPT_COORDINATES
Fixes and enables ~20 more summon related spells. Some minor cleanup in related code Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
15d4388696
commit
46b6723af1
2 changed files with 27 additions and 18 deletions
|
|
@ -4169,12 +4169,12 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||||
return castResult;
|
return castResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
//ImpliciteTargetA-B = 38, If fact there is 0 Spell with ImpliciteTargetB=38
|
// Database based targets from spell_target_script
|
||||||
if (m_UniqueTargetInfo.empty()) // skip second CheckCast apply (for delayed spells for example)
|
if (m_UniqueTargetInfo.empty()) // skip second CheckCast apply (for delayed spells for example)
|
||||||
{
|
{
|
||||||
for(uint8 j = 0; j < 3; ++j)
|
for(uint8 j = 0; j < 3; ++j)
|
||||||
{
|
{
|
||||||
if(m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT ||
|
if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT ||
|
||||||
(m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT && m_spellInfo->EffectImplicitTargetA[j] != TARGET_SELF) ||
|
(m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT && m_spellInfo->EffectImplicitTargetA[j] != TARGET_SELF) ||
|
||||||
m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT_COORDINATES ||
|
m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT_COORDINATES ||
|
||||||
m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT_COORDINATES ||
|
m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT_COORDINATES ||
|
||||||
|
|
@ -4182,7 +4182,8 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||||
{
|
{
|
||||||
|
|
||||||
SpellScriptTargetBounds bounds = sSpellMgr.GetSpellScriptTargetBounds(m_spellInfo->Id);
|
SpellScriptTargetBounds bounds = sSpellMgr.GetSpellScriptTargetBounds(m_spellInfo->Id);
|
||||||
if(bounds.first==bounds.second)
|
|
||||||
|
if (bounds.first==bounds.second)
|
||||||
sLog.outErrorDb("Spell (ID: %u) has effect EffectImplicitTargetA/EffectImplicitTargetB = TARGET_SCRIPT or TARGET_SCRIPT_COORDINATES, but does not have record in `spell_script_target`",m_spellInfo->Id);
|
sLog.outErrorDb("Spell (ID: %u) has effect EffectImplicitTargetA/EffectImplicitTargetB = TARGET_SCRIPT or TARGET_SCRIPT_COORDINATES, but does not have record in `spell_script_target`",m_spellInfo->Id);
|
||||||
|
|
||||||
SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex);
|
SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex);
|
||||||
|
|
@ -4205,8 +4206,8 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||||
Cell cell(p);
|
Cell cell(p);
|
||||||
cell.data.Part.reserved = ALL_DISTRICT;
|
cell.data.Part.reserved = ALL_DISTRICT;
|
||||||
|
|
||||||
MaNGOS::NearestGameObjectEntryInObjectRangeCheck go_check(*m_caster,i_spellST->second.targetEntry,range);
|
MaNGOS::NearestGameObjectEntryInObjectRangeCheck go_check(*m_caster, i_spellST->second.targetEntry, range);
|
||||||
MaNGOS::GameObjectLastSearcher<MaNGOS::NearestGameObjectEntryInObjectRangeCheck> checker(m_caster, p_GameObject,go_check);
|
MaNGOS::GameObjectLastSearcher<MaNGOS::NearestGameObjectEntryInObjectRangeCheck> checker(m_caster, p_GameObject, go_check);
|
||||||
|
|
||||||
TypeContainerVisitor<MaNGOS::GameObjectLastSearcher<MaNGOS::NearestGameObjectEntryInObjectRangeCheck>, GridTypeMapContainer > object_checker(checker);
|
TypeContainerVisitor<MaNGOS::GameObjectLastSearcher<MaNGOS::NearestGameObjectEntryInObjectRangeCheck>, GridTypeMapContainer > object_checker(checker);
|
||||||
CellLock<GridReadGuard> cell_lock(cell, p);
|
CellLock<GridReadGuard> cell_lock(cell, p);
|
||||||
|
|
@ -4241,7 +4242,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||||
CellPair p(MaNGOS::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY()));
|
CellPair p(MaNGOS::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY()));
|
||||||
Cell cell(p);
|
Cell cell(p);
|
||||||
cell.data.Part.reserved = ALL_DISTRICT;
|
cell.data.Part.reserved = ALL_DISTRICT;
|
||||||
cell.SetNoCreate(); // Really don't know what is that???
|
cell.SetNoCreate();
|
||||||
|
|
||||||
MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*m_caster,i_spellST->second.targetEntry,i_spellST->second.type!=SPELL_TARGET_TYPE_DEAD,range);
|
MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*m_caster,i_spellST->second.targetEntry,i_spellST->second.type!=SPELL_TARGET_TYPE_DEAD,range);
|
||||||
MaNGOS::CreatureLastSearcher<MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(m_caster, p_Creature, u_check);
|
MaNGOS::CreatureLastSearcher<MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(m_caster, p_Creature, u_check);
|
||||||
|
|
@ -4251,7 +4252,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||||
CellLock<GridReadGuard> cell_lock(cell, p);
|
CellLock<GridReadGuard> cell_lock(cell, p);
|
||||||
cell_lock->Visit(cell_lock, grid_creature_searcher, *m_caster->GetMap(), *m_caster, range);
|
cell_lock->Visit(cell_lock, grid_creature_searcher, *m_caster->GetMap(), *m_caster, range);
|
||||||
|
|
||||||
if(p_Creature )
|
if (p_Creature)
|
||||||
{
|
{
|
||||||
creatureScriptTarget = p_Creature;
|
creatureScriptTarget = p_Creature;
|
||||||
goScriptTarget = NULL;
|
goScriptTarget = NULL;
|
||||||
|
|
@ -4262,35 +4263,43 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(creatureScriptTarget)
|
if (creatureScriptTarget)
|
||||||
{
|
{
|
||||||
// store coordinates for TARGET_SCRIPT_COORDINATES
|
// store coordinates for TARGET_SCRIPT_COORDINATES
|
||||||
if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT_COORDINATES ||
|
if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT_COORDINATES ||
|
||||||
m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT_COORDINATES )
|
m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT_COORDINATES)
|
||||||
{
|
{
|
||||||
m_targets.setDestination(creatureScriptTarget->GetPositionX(),creatureScriptTarget->GetPositionY(),creatureScriptTarget->GetPositionZ());
|
m_targets.setDestination(creatureScriptTarget->GetPositionX(),creatureScriptTarget->GetPositionY(),creatureScriptTarget->GetPositionZ());
|
||||||
|
|
||||||
if(m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT_COORDINATES && m_spellInfo->EffectImplicitTargetB[j] == 0 && m_spellInfo->Effect[j]!=SPELL_EFFECT_PERSISTENT_AREA_AURA)
|
if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT_COORDINATES && m_spellInfo->Effect[j] != SPELL_EFFECT_PERSISTENT_AREA_AURA)
|
||||||
AddUnitTarget(creatureScriptTarget, j);
|
AddUnitTarget(creatureScriptTarget, j);
|
||||||
}
|
}
|
||||||
// store explicit target for TARGET_SCRIPT
|
// store explicit target for TARGET_SCRIPT
|
||||||
else
|
else
|
||||||
AddUnitTarget(creatureScriptTarget, j);
|
{
|
||||||
|
if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT ||
|
||||||
|
m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT)
|
||||||
|
AddUnitTarget(creatureScriptTarget, j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(goScriptTarget)
|
else if (goScriptTarget)
|
||||||
{
|
{
|
||||||
// store coordinates for TARGET_SCRIPT_COORDINATES
|
// store coordinates for TARGET_SCRIPT_COORDINATES
|
||||||
if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT_COORDINATES ||
|
if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT_COORDINATES ||
|
||||||
m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT_COORDINATES )
|
m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT_COORDINATES)
|
||||||
{
|
{
|
||||||
m_targets.setDestination(goScriptTarget->GetPositionX(),goScriptTarget->GetPositionY(),goScriptTarget->GetPositionZ());
|
m_targets.setDestination(goScriptTarget->GetPositionX(),goScriptTarget->GetPositionY(),goScriptTarget->GetPositionZ());
|
||||||
|
|
||||||
if(m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT_COORDINATES && m_spellInfo->EffectImplicitTargetB[j] == 0 && m_spellInfo->Effect[j]!=SPELL_EFFECT_PERSISTENT_AREA_AURA)
|
if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT_COORDINATES && m_spellInfo->Effect[j] != SPELL_EFFECT_PERSISTENT_AREA_AURA)
|
||||||
AddGOTarget(goScriptTarget, j);
|
AddGOTarget(goScriptTarget, j);
|
||||||
}
|
}
|
||||||
// store explicit target for TARGET_SCRIPT
|
// store explicit target for TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT
|
||||||
else
|
else
|
||||||
AddGOTarget(goScriptTarget, j);
|
{
|
||||||
|
if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT ||
|
||||||
|
m_spellInfo->EffectImplicitTargetB[j] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT)
|
||||||
|
AddGOTarget(goScriptTarget, j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//Missing DB Entry or targets for this spellEffect.
|
//Missing DB Entry or targets for this spellEffect.
|
||||||
else
|
else
|
||||||
|
|
@ -4301,7 +4310,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||||
if (m_spellInfo->EffectImplicitTargetA[j] != TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT)
|
if (m_spellInfo->EffectImplicitTargetA[j] != TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT)
|
||||||
{
|
{
|
||||||
// not report target not existence for triggered spells
|
// not report target not existence for triggered spells
|
||||||
if(m_triggeredByAuraSpell || m_IsTriggeredSpell)
|
if (m_triggeredByAuraSpell || m_IsTriggeredSpell)
|
||||||
return SPELL_FAILED_DONT_REPORT;
|
return SPELL_FAILED_DONT_REPORT;
|
||||||
else
|
else
|
||||||
return SPELL_FAILED_BAD_TARGETS;
|
return SPELL_FAILED_BAD_TARGETS;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "9078"
|
#define REVISION_NR "9079"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue