[10205] Correctly implement flying mount restrictions in zone 4395 by use of special area flag.

Also drop existing spell_area entries if exist, workaround not needed anymore.
This commit is contained in:
Lynx3d 2010-07-17 03:16:53 +02:00
parent 3ed6542c1d
commit f2e3881a77
9 changed files with 50 additions and 23 deletions

View file

@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
`version` varchar(120) default NULL,
`creature_ai_version` varchar(120) default NULL,
`cache_id` int(10) default '0',
`required_10203_01_mangos_item_template` bit(1) default NULL
`required_10205_01_mangos_spell_area` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
--

View file

@ -0,0 +1,3 @@
ALTER TABLE db_version CHANGE COLUMN required_10203_01_mangos_item_template required_10205_01_mangos_spell_area bit;
DELETE FROM spell_area WHERE spell = 58600;

View file

@ -108,6 +108,7 @@ pkgdata_DATA = \
10171_01_mangos_mangos_string.sql \
10197_01_mangos_playercreateinfo.sql \
10203_01_mangos_item_template.sql \
10205_01_mangos_spell_area.sql \
README
## Additional files to include when running 'make dist'
@ -196,4 +197,5 @@ EXTRA_DIST = \
10171_01_mangos_mangos_string.sql \
10197_01_mangos_playercreateinfo.sql \
10203_01_mangos_item_template.sql \
10205_01_mangos_spell_area.sql \
README

View file

@ -244,8 +244,8 @@ enum AreaFlags
AREA_FLAG_OUTDOOR_PVP = 0x01000000, // Wintergrasp and it's subzones
AREA_FLAG_INSIDE = 0x02000000, // used for determinating spell related inside/outside questions in Map::IsOutdoors
AREA_FLAG_OUTSIDE = 0x04000000, // used for determinating spell related inside/outside questions in Map::IsOutdoors
AREA_FLAG_CAN_HEARTH_AND_RES = 0x08000000 // Wintergrasp and it's subzones
// 0x20000000 not flyable?
AREA_FLAG_CAN_HEARTH_AND_RES = 0x08000000, // Wintergrasp and it's subzones
AREA_FLAG_CANNOT_FLY = 0x20000000 // not allowed to fly, only used in Dalaran areas (zone 4395)
};
enum Difficulty

View file

@ -6621,15 +6621,15 @@ uint32 Player::GetLevelFromDB(uint64 guid)
void Player::UpdateArea(uint32 newArea)
{
// FFA_PVP flags are area and not zone id dependent
// so apply them accordingly
m_areaUpdateId = newArea;
AreaTableEntry const* area = GetAreaEntryByAreaID(newArea);
if(area && (area->flags & AREA_FLAG_ARENA))
// FFA_PVP flags are area and not zone id dependent
// so apply them accordingly
if (area && (area->flags & AREA_FLAG_ARENA))
{
if(!isGameMaster())
if (!isGameMaster())
SetFFAPvP(true);
}
else
@ -6640,6 +6640,17 @@ void Player::UpdateArea(uint32 newArea)
SetFFAPvP(false);
}
if (area)
{
// Dalaran restricted flight zone
if ((area->flags & AREA_FLAG_CANNOT_FLY) && IsFreeFlying() && !isGameMaster())
CastSpell(this, 58600, true);
// TODO: implement wintergrasp parachute when battle in progress
/* if ((area->flags & AREA_FLAG_OUTDOOR_PVP) && IsFreeFlying() && <WINTERGRASP_BATTLE_IN_PROGRESS> && !isGameMaster())
CastSpell(this, 58730, true); */
}
UpdateAreaDependentAuras(newArea);
}
@ -21002,13 +21013,24 @@ uint32 Player::CalculateTalentsPoints() const
return uint32(talentPointsForLevel * sWorld.getConfig(CONFIG_FLOAT_RATE_TALENT));
}
bool Player::IsKnowHowFlyIn(uint32 mapid, uint32 zone, uint32 area) const
bool Player::CanStartFlyInArea(uint32 mapid, uint32 zone, uint32 area) const
{
if (isGameMaster())
return true;
// continent checked in SpellMgr::GetSpellAllowedInLocationError at cast and area update
uint32 v_map = GetVirtualMapForMapAndZone(mapid, zone);
// don't allow flying in Dalaran except Krasus' Landing
return (v_map != 571 || HasSpell(54197)) && (zone != 4395 || area == 4564); // Cold Weather Flying
if (v_map == 571 && !HasSpell(54197)) // Cold Weather Flying
return false;
// don't allow flying in Dalaran restricted areas
// (no other zones currently has areas with AREA_FLAG_CANNOT_FLY)
if (AreaTableEntry const* atEntry = GetAreaEntryByAreaID(area))
return (!(atEntry->flags & AREA_FLAG_CANNOT_FLY));
// TODO: disallow mounting in wintergrasp too when battle is in progress
// forced dismount part in Player::UpdateArea()
return true;
}
struct DoPlayerLearnSpell

View file

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

View file

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

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10204"
#define REVISION_NR "10205"
#endif // __REVISION_NR_H__

View file

@ -1,6 +1,6 @@
#ifndef __REVISION_SQL_H__
#define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_10160_02_characters_pet_aura"
#define REVISION_DB_MANGOS "required_10203_01_mangos_item_template"
#define REVISION_DB_MANGOS "required_10205_01_mangos_spell_area"
#define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version"
#endif // __REVISION_SQL_H__