aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/SpellInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Spells/SpellInfo.cpp')
-rw-r--r--src/server/game/Spells/SpellInfo.cpp43
1 files changed, 16 insertions, 27 deletions
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index c0fbdf51889..5ff633a6031 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -1435,7 +1435,7 @@ SpellCastResult SpellInfo::CheckShapeshift(uint32 form) const
return SPELL_CAST_OK;
}
-SpellCastResult SpellInfo::CheckLocation(uint32 map_id, uint32 zone_id, uint32 area_id, Player const* player) const
+SpellCastResult SpellInfo::CheckLocation(uint32 map_id, uint32 zone_id, uint32 area_id, Player const* player /*= nullptr*/, bool strict /*= true*/) const
{
// normal case
if (AreaGroupId > 0)
@@ -1460,12 +1460,22 @@ SpellCastResult SpellInfo::CheckLocation(uint32 map_id, uint32 zone_id, uint32 a
// continent limitation (virtual continent)
if (HasAttribute(SPELL_ATTR4_CAST_ONLY_IN_OUTLAND))
{
- AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(area_id);
- if (!areaEntry)
- areaEntry = sAreaTableStore.LookupEntry(zone_id);
+ if (strict)
+ {
+ AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(area_id);
+ if (!areaEntry)
+ areaEntry = sAreaTableStore.LookupEntry(zone_id);
- if (!areaEntry || !areaEntry->IsFlyable() || !player->CanFlyInZone(map_id, zone_id))
- return SPELL_FAILED_INCORRECT_AREA;
+ if (!areaEntry || !areaEntry->IsFlyable() || !player->CanFlyInZone(map_id, zone_id, this))
+ return SPELL_FAILED_INCORRECT_AREA;
+ }
+ else
+ {
+ uint32 const v_map = GetVirtualMapForMapAndZone(map_id, zone_id);
+ MapEntry const* mapEntry = sMapStore.LookupEntry(v_map);
+ if (!mapEntry || mapEntry->Expansion() < 1 || !mapEntry->IsContinent())
+ return SPELL_FAILED_INCORRECT_AREA;
+ }
}
// raid instance limitation
@@ -1553,27 +1563,6 @@ SpellCastResult SpellInfo::CheckLocation(uint32 map_id, uint32 zone_id, uint32 a
}
}
- // aura limitations
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- {
- if (!Effects[i].IsAura())
- continue;
- switch (Effects[i].ApplyAuraName)
- {
- case SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED:
- case SPELL_AURA_FLY:
- {
- SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(Id);
- for (SkillLineAbilityMap::const_iterator skillIter = bounds.first; skillIter != bounds.second; ++skillIter)
- {
- if (skillIter->second->skillId == SKILL_MOUNTS)
- if (player && !player->CanFlyInZone(map_id, zone_id))
- return SPELL_FAILED_INCORRECT_AREA;
- }
- break;
- }
- }
- }
return SPELL_CAST_OK;
}