Merge branch '4.3.4-fix_flying_form_after_teleport' into '4.3.4'

fix flying form in no fly zones after teleport

Checks if the new zone allows flying after a teleport.
If not, removes flying spell auras.

For example, this bug allowed druids to enter Tol Barad with flying form, or in any dungeon with the help of a demonist.

See merge request !12
This commit is contained in:
Aokromes committed 2016-05-08 12:33:04 +00:00
commit 3aa1e95b1b
2 files changed
+30 -3

No files matched your search

+22 -3
View File
@@ -25012,11 +25012,30 @@ uint32 Player::CalculateTalentsPoints() const
return uint32(talentPointsForLevel * sWorld->getRate(RATE_TALENT));
}
bool Player::CanFlyInZone(uint32 mapid, uint32 zone) const
bool Player::CanFlyInZone(uint32 mapid, uint32 areaid) 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
AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaid);
bool can_fly = false;
switch (mapid)
{
case 0: // Eastern Kingdoms
case 1: // Kalimdor
case 646: // Deepholm
can_fly = HasSpell(90267); // Flight Master's License
break;
case 571: // Northrend
can_fly = HasSpell(54197); // Cold Weather Flying
break;
case 530: // Outland
// Draenei and blood elves starting zones belong to Outland map, but are not flyable
// These zones don't have flag AREA_FLAG_OUTLAND2
if (sAreaTableStore.LookupEntry(areaid)->flags & AREA_FLAG_OUTLAND2)
can_fly = true;
default:
break;
}
return can_fly;
}
void Player::LearnSpellHighestRank(uint32 spellid)
@@ -185,6 +185,10 @@ void WorldSession::HandleMoveWorldportAckOpcode()
GetPlayer()->GetZoneAndAreaId(newzone, newarea);
GetPlayer()->UpdateZone(newzone, newarea);
// can fly check
if (!_player->CanFlyInZone(newMap->GetId(), newarea))
_player->RemoveAurasByType(SPELL_AURA_FLY);
// honorless target
if (GetPlayer()->pvpInfo.IsHostile)
GetPlayer()->CastSpell(GetPlayer(), 2479, true);
@@ -259,6 +263,10 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recvPacket)
// in friendly area
else if (plMover->IsPvP() && !plMover->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP))
plMover->UpdatePvP(false, false);
// can fly check
if (!plMover->CanFlyInZone(plMover->GetMapId(), newzone))
plMover->RemoveAurasByType(SPELL_AURA_FLY);
}
// resummon pet