Core/Spells: Reinstate helperfunction removed in commit 0e3607df (with a new functionname to make more sense out of it), and adjust the remaining code slightly to accomodate that.

This commit is contained in:
click committed 2015-04-07 23:51:19 +02:00
1 parent b321f84a39
commit 6c1e4bc20d
3 files changed
+14 -8

No files matched your search

@@ -25085,6 +25085,13 @@ uint32 Player::CalculateTalentsPoints() const
return uint32(talentPointsForLevel * sWorld->getRate(RATE_TALENT));
}
bool Player::canFlyInZone(uint32 mapid, uint32 zone) 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
}
void Player::LearnSpellHighestRank(uint32 spellid)
{
LearnSpell(spellid, false);
+2
View File
@@ -2136,6 +2136,8 @@ class Player : public Unit, public GridObject<Player>
void SetFallInformation(uint32 time, float z);
void HandleFall(MovementInfo const& movementInfo);
bool canFlyInZone(uint32 mapid, uint32 zone) const;
void SetClientControl(Unit* target, bool allowMove);
void SetMover(Unit* target);
+5 -8
View File
@@ -1482,15 +1482,12 @@ SpellCastResult SpellInfo::CheckLocation(uint32 map_id, uint32 zone_id, uint32 a
case SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED:
case SPELL_AURA_FLY:
{
if (player)
SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(Id);
for (SkillLineAbilityMap::const_iterator skillIter = bounds.first; skillIter != bounds.second; ++skillIter)
{
SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(Id);
for (SkillLineAbilityMap::const_iterator skillIter = bounds.first; skillIter != bounds.second; ++skillIter)
{
// spell 54197 (Cold Weather Flying) is a prereq for flying in Northrend
if (skillIter->second->skillId == SKILL_MOUNTS && player->GetMapId() != 571 && !player->HasSpell(54197))
return SPELL_FAILED_INCORRECT_AREA; // maybe: SPELL_CUSTOM_ERROR_CANT_USE_THAT_MOUNT
}
if (skillIter->second->skillId == SKILL_MOUNTS)
if (player && !player->canFlyInZone(map_id, zone_id))
return SPELL_FAILED_INCORRECT_AREA;
}
}
}