mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 18:10:26 +00:00
fix(Core/Spell): Make use of SPELL_ATTR7_IGNORE_COLD_WEATHER_FLYING (#4933)
This commit is contained in:
@@ -1450,7 +1450,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)
|
||||
@@ -1473,7 +1473,7 @@ SpellCastResult SpellInfo::CheckLocation(uint32 map_id, uint32 zone_id, uint32 a
|
||||
}
|
||||
|
||||
// continent limitation (virtual continent)
|
||||
if (AttributesEx4 & SPELL_ATTR4_CAST_ONLY_IN_OUTLAND)
|
||||
if (HasAttribute(SPELL_ATTR4_CAST_ONLY_IN_OUTLAND))
|
||||
{
|
||||
uint32 v_map = GetVirtualMapForMapAndZone(map_id, zone_id);
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(v_map);
|
||||
@@ -1481,8 +1481,35 @@ SpellCastResult SpellInfo::CheckLocation(uint32 map_id, uint32 zone_id, uint32 a
|
||||
return SPELL_FAILED_INCORRECT_AREA;
|
||||
}
|
||||
|
||||
// continent limitation (virtual continent)
|
||||
if (HasAttribute(SPELL_ATTR4_CAST_ONLY_IN_OUTLAND))
|
||||
{
|
||||
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, 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
|
||||
if (AttributesEx6 & SPELL_ATTR6_NOT_IN_RAID_INSTANCE)
|
||||
if (HasAttribute(SPELL_ATTR6_NOT_IN_RAID_INSTANCE))
|
||||
{
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
|
||||
if (!mapEntry || mapEntry->IsRaid())
|
||||
@@ -1536,26 +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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user