[9887] Fix special mounts using in Dalaran

This commit is contained in:
Laise 2010-05-13 14:40:39 +03:00
parent 080727cbfa
commit a002f22916
4 changed files with 11 additions and 6 deletions

View file

@ -20906,11 +20906,16 @@ uint32 Player::CalculateTalentsPoints() const
return uint32(talentPointsForLevel * sWorld.getConfig(CONFIG_FLOAT_RATE_TALENT)); return uint32(talentPointsForLevel * sWorld.getConfig(CONFIG_FLOAT_RATE_TALENT));
} }
bool Player::IsKnowHowFlyIn(uint32 mapid, uint32 zone) const bool Player::IsKnowHowFlyIn(uint32 mapid) const
{ {
uint32 zone;
uint32 area;
GetZoneAndAreaId(zone, area);
// continent checked in SpellMgr::GetSpellAllowedInLocationError at cast and area update // continent checked in SpellMgr::GetSpellAllowedInLocationError at cast and area update
uint32 v_map = GetVirtualMapForMapAndZone(mapid, zone); uint32 v_map = GetVirtualMapForMapAndZone(mapid, zone);
return v_map != 571 || HasSpell(54197); // Cold Weather Flying
// don't allow flying in Dalaran except Krasus' Landing
return (v_map != 571 || HasSpell(54197)) && (zone != 4395 || area == 4564); // Cold Weather Flying
} }
struct DoPlayerLearnSpell struct DoPlayerLearnSpell

View file

@ -2150,7 +2150,7 @@ class MANGOS_DLL_SPEC Player : public Unit
bool CanFly() const { return m_movementInfo.HasMovementFlag(MOVEFLAG_CAN_FLY); } bool CanFly() const { return m_movementInfo.HasMovementFlag(MOVEFLAG_CAN_FLY); }
bool IsFlying() const { return m_movementInfo.HasMovementFlag(MOVEFLAG_FLYING); } bool IsFlying() const { return m_movementInfo.HasMovementFlag(MOVEFLAG_FLYING); }
bool IsKnowHowFlyIn(uint32 mapid, uint32 zone) const; bool IsKnowHowFlyIn(uint32 mapid) const;
void SetClientControl(Unit* target, uint8 allowMove); void SetClientControl(Unit* target, uint8 allowMove);
void SetMover(Unit* target) { m_mover = target ? target : this; } void SetMover(Unit* target) { m_mover = target ? target : this; }

View file

@ -5113,7 +5113,7 @@ SpellCastResult Spell::CheckCast(bool strict)
// allow always ghost flight spells // allow always ghost flight spells
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->isAlive()) if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->isAlive())
{ {
if (!((Player*)m_caster)->IsKnowHowFlyIn(m_caster->GetMapId(),zone)) if (!((Player*)m_caster)->IsKnowHowFlyIn(m_caster->GetMapId()))
return m_IsTriggeredSpell ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_NOT_HERE; return m_IsTriggeredSpell ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_NOT_HERE;
} }
break; break;
@ -6548,7 +6548,7 @@ void Spell::SelectMountByAreaAndSkill(Unit* target, uint32 spellId75, uint32 spe
target->GetZoneAndAreaId(zone, area); target->GetZoneAndAreaId(zone, area);
SpellCastResult locRes= sSpellMgr.GetSpellAllowedInLocationError(pSpell, target->GetMapId(), zone, area, target->GetCharmerOrOwnerPlayerOrPlayerItself()); SpellCastResult locRes= sSpellMgr.GetSpellAllowedInLocationError(pSpell, target->GetMapId(), zone, area, target->GetCharmerOrOwnerPlayerOrPlayerItself());
if (locRes != SPELL_CAST_OK || !((Player*)target)->IsKnowHowFlyIn(target->GetMapId(),zone)) if (locRes != SPELL_CAST_OK || !((Player*)target)->IsKnowHowFlyIn(target->GetMapId()))
target->CastSpell(target, spellId150, true); target->CastSpell(target, spellId150, true);
else if (spellIdSpecial > 0) else if (spellIdSpecial > 0)
{ {

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9886" #define REVISION_NR "9887"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__