diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 10 | ||||
| -rw-r--r-- | src/server/game/Entities/Player/Player.h | 2 | ||||
| -rw-r--r-- | src/server/game/Miscellaneous/SharedDefines.h | 2 | ||||
| -rw-r--r-- | src/server/game/Spells/SpellInfo.cpp | 43 | ||||
| -rw-r--r-- | src/server/game/Spells/SpellInfo.h | 2 |
5 files changed, 26 insertions, 33 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 3e0f9078c2c..a1e44cd911f 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -23810,7 +23810,7 @@ void Player::UpdateAreaDependentAuras(uint32 newArea) for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();) { // use m_zoneUpdateId for speed: UpdateArea called from UpdateZone or instead UpdateZone in both cases m_zoneUpdateId up-to-date - if (iter->second->GetSpellInfo()->CheckLocation(GetMapId(), m_zoneUpdateId, newArea, this) != SPELL_CAST_OK) + if (iter->second->GetSpellInfo()->CheckLocation(GetMapId(), m_zoneUpdateId, newArea, this, false) != SPELL_CAST_OK) RemoveOwnedAura(iter); else ++iter; @@ -24665,11 +24665,15 @@ uint32 Player::CalculateTalentsPoints() const return uint32(talentPointsForLevel * sWorld->getRate(RATE_TALENT)); } -bool Player::CanFlyInZone(uint32 mapid, uint32 zone) const +bool Player::CanFlyInZone(uint32 mapid, uint32 zone, SpellInfo const* bySpell) const { // continent checked in SpellInfo::CheckLocation at cast and area update uint32 v_map = GetVirtualMapForMapAndZone(mapid, zone); - return v_map != 571 || HasSpell(54197); // 54197 = Cold Weather Flying + if (v_map == 571 && !bySpell->HasAttribute(SPELL_ATTR7_IGNORE_COLD_WEATHER_FLYING)) + if (!HasSpell(54197)) // 54197 = Cold Weather Flying + return false; + + return true; } void Player::LearnSpellHighestRank(uint32 spellid) diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index ed5dc7e954f..256deef4d73 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -2077,7 +2077,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player> void SetFallInformation(uint32 time, float z); void HandleFall(MovementInfo const& movementInfo); - bool CanFlyInZone(uint32 mapid, uint32 zone) const; + bool CanFlyInZone(uint32 mapid, uint32 zone, SpellInfo const* bySpell) const; void SetClientControl(Unit* target, bool allowMove); diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index bf913081fef..3e11eea4f30 100644 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -550,7 +550,7 @@ enum SpellAttr7 SPELL_ATTR7_ZONE_TELEPORT = 0x00080000, // 19 Teleports to specific zones. SPELL_ATTR7_USABLE_IN_STUN_FEAR_CONFUSION = 0x00100000, // 20 Blink, Divine Shield, Ice Block SPELL_ATTR7_UNK21 = 0x00200000, // 21 Not set - SPELL_ATTR7_UNK22 = 0x00400000, // 22 + SPELL_ATTR7_IGNORE_COLD_WEATHER_FLYING = 0x00400000, // 22 Loaned Gryphon, Loaned Wind Rider SPELL_ATTR7_UNK23 = 0x00800000, // 23 Motivate, Mutilate, Shattering Throw SPELL_ATTR7_UNK24 = 0x01000000, // 24 Motivate, Mutilate, Perform Speech, Shattering Throw SPELL_ATTR7_UNK25 = 0x02000000, // 25 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; } diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h index d7b48ddb4d2..a262e84d25f 100644 --- a/src/server/game/Spells/SpellInfo.h +++ b/src/server/game/Spells/SpellInfo.h @@ -465,7 +465,7 @@ class TC_GAME_API SpellInfo bool IsAuraExclusiveBySpecificPerCasterWith(SpellInfo const* spellInfo) const; SpellCastResult CheckShapeshift(uint32 form) const; - SpellCastResult CheckLocation(uint32 map_id, uint32 zone_id, uint32 area_id, Player const* player = NULL) const; + SpellCastResult CheckLocation(uint32 map_id, uint32 zone_id, uint32 area_id, Player const* player = nullptr, bool strict = true) const; SpellCastResult CheckTarget(Unit const* caster, WorldObject const* target, bool implicit = true) const; SpellCastResult CheckExplicitTarget(Unit const* caster, WorldObject const* target, Item const* itemTarget = NULL) const; SpellCastResult CheckVehicle(Unit const* caster) const; |
