[7154] Move allow player fly check to function.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
GriffonHeart 2009-01-23 15:47:14 +03:00 committed by VladimirMangos
parent 10468d170d
commit 25b120877e
4 changed files with 13 additions and 5 deletions

View file

@ -18872,8 +18872,7 @@ void Player::SetClientControl(Unit* target, uint8 allowMove)
void Player::UpdateZoneDependentAuras( uint32 newZone ) void Player::UpdateZoneDependentAuras( uint32 newZone )
{ {
// remove new continent flight forms // remove new continent flight forms
uint32 v_map = GetVirtualMapForMapAndZone(GetMapId(), newZone); if( !IsAllowUseFlyMountsHere() )
if( !isGameMaster() && v_map != 530 && v_map != 571)
{ {
RemoveSpellsCausingAura(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED); RemoveSpellsCausingAura(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED);
RemoveSpellsCausingAura(SPELL_AURA_FLY); RemoveSpellsCausingAura(SPELL_AURA_FLY);
@ -19363,3 +19362,12 @@ uint32 Player::CalculateTalentsPoints() const
return talentPointsForLevel; return talentPointsForLevel;
} }
bool Player::IsAllowUseFlyMountsHere() const
{
if (isGameMaster())
return true;
uint32 v_map = GetVirtualMapForMapAndZone(GetMapId(), GetZoneId());
return v_map == 530 || v_map == 571 && HasSpell(54197);
}

View file

@ -2051,6 +2051,7 @@ class MANGOS_DLL_SPEC Player : public Unit
bool CanFly() const { return HasUnitMovementFlag(MOVEMENTFLAG_CAN_FLY); } bool CanFly() const { return HasUnitMovementFlag(MOVEMENTFLAG_CAN_FLY); }
bool IsFlying() const { return HasUnitMovementFlag(MOVEMENTFLAG_FLYING); } bool IsFlying() const { return HasUnitMovementFlag(MOVEMENTFLAG_FLYING); }
bool IsAllowUseFlyMountsHere() const;
void HandleDrowning(); void HandleDrowning();

View file

@ -4418,8 +4418,7 @@ uint8 Spell::CanCast(bool strict)
// not allow cast fly spells at old maps by players (all spells is self target) // not allow cast fly spells at old maps by players (all spells is self target)
if(m_caster->GetTypeId()==TYPEID_PLAYER) if(m_caster->GetTypeId()==TYPEID_PLAYER)
{ {
uint32 v_map = GetVirtualMapForMapAndZone(m_caster->GetMapId(), m_caster->GetZoneId()); if( !((Player*)m_caster)->IsAllowUseFlyMountsHere() )
if( !((Player*)m_caster)->isGameMaster() && v_map != 530 && !(v_map == 571 && ((Player*)m_caster)->HasSpell(54197)))
return SPELL_FAILED_NOT_HERE; return SPELL_FAILED_NOT_HERE;
} }

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 "7153" #define REVISION_NR "7154"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__