[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

@ -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);
}
@ -13965,7 +13976,7 @@ bool Player::SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg ) const
if (i_exstatus != mQuestStatus.end()
&& (i_exstatus->second.m_status == QUEST_STATUS_COMPLETE || i_exstatus->second.m_status == QUEST_STATUS_INCOMPLETE))
{
if (msg)
if (msg)
SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ );
return false;
}
@ -15673,7 +15684,7 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff)
aura->SetLoadedState(damage[i], maxduration[i], remaintime[i]);
holder->AddAura(aura, SpellEffectIndex(i));
}
if (!holder->IsEmptyHolder())
{
// reset stolen single target auras
@ -15692,7 +15703,7 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff)
}
if(getClass() == CLASS_WARRIOR && !HasAuraType(SPELL_AURA_MOD_SHAPESHIFT))
CastSpell(this,SPELL_ID_PASSIVE_BATTLE_STANCE,true);
CastSpell(this,SPELL_ID_PASSIVE_BATTLE_STANCE,true);
}
void Player::_LoadGlyphs(QueryResult *result)
@ -16895,7 +16906,7 @@ void Player::_SaveAuras()
for(SpellAuraHolderMap::const_iterator itr = auraHolders.begin(); itr != auraHolders.end(); ++itr)
{
SpellAuraHolder *holder = itr->second;
SpellAuraHolder *holder = itr->second;
//skip all holders from spells that are passive
//do not save single target holders (unless they were cast by the player)
if (!holder->IsPassive() && (holder->GetCasterGUID() == GetGUID() || !holder->IsSingleTarget()))
@ -16923,7 +16934,7 @@ void Player::_SaveAuras()
effIndexMask |= (1 << i);
}
}
if (!effIndexMask)
continue;
@ -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