Core/Areas: Update AreaFlags from EnumeratedStings values

This commit is contained in:
Jeremy authored and Ovahlord committed 2023-10-09 20:41:30 +02:00
1 parent b17169b5b1
commit f8aa09f253
10 files changed
+77 -79

No files matched your search

+11 -11
View File
@@ -4543,7 +4543,7 @@ void Player::RepopAtGraveyard()
AreaTableEntry const* zone = sAreaTableStore.LookupEntry(GetAreaId());
// Such zones are considered unreachable as a ghost and the player must be automatically revived
if ((!IsAlive() && zone && zone->Flags & AREA_FLAG_NEED_FLY) || GetTransport() || GetPositionZ() < GetMap()->GetMinHeight(GetPhaseShift(), GetPositionX(), GetPositionY()))
if ((!IsAlive() && zone && zone->GetFlags().HasFlag(AreaFlags::NoGhostOnRelease)) || GetTransport() || GetPositionZ() < GetMap()->GetMinHeight(GetPhaseShift(), GetPositionX(), GetPositionY()))
{
ResurrectPlayer(0.5f);
SpawnCorpseBones();
@@ -4587,10 +4587,10 @@ void Player::RepopAtGraveyard()
bool Player::CanJoinConstantChannelInZone(ChatChannelsEntry const* channel, AreaTableEntry const* zone) const
{
if (channel->Flags & CHANNEL_DBC_FLAG_ZONE_DEP && zone->Flags & AREA_FLAG_ARENA_INSTANCE)
if (channel->Flags & CHANNEL_DBC_FLAG_ZONE_DEP && zone->GetFlags().HasFlag(AreaFlags::NoChatChannels))
return false;
if ((channel->Flags & CHANNEL_DBC_FLAG_CITY_ONLY) && (!(zone->Flags & AREA_FLAG_SLAVE_CAPITAL)))
if ((channel->Flags & CHANNEL_DBC_FLAG_CITY_ONLY) && (!(zone->GetFlags().HasFlag(AreaFlags::AllowTradeChannel))))
return false;
if ((channel->Flags & CHANNEL_DBC_FLAG_GUILD_REQ) && GetGuildId())
@@ -6993,7 +6993,7 @@ void Player::UpdateArea(uint32 newArea)
AreaTableEntry const* area = sAreaTableStore.LookupEntry(newArea);
bool oldFFAPvPArea = pvpInfo.IsInFFAPvPArea;
pvpInfo.IsInFFAPvPArea = area && (area->Flags & AREA_FLAG_ARENA);
pvpInfo.IsInFFAPvPArea = area && (area->GetFlags().HasFlag(AreaFlags::FreeForAllPvP));
UpdatePvPState(true);
// check if we were in ffa arena and we left
@@ -7015,8 +7015,8 @@ void Player::UpdateArea(uint32 newArea)
else
RemoveByteFlag(UNIT_FIELD_BYTES_2, UNIT_BYTES_2_OFFSET_PVP_FLAG, UNIT_BYTE2_FLAG_SANCTUARY);
uint32 const areaRestFlag = (GetTeam() == ALLIANCE) ? AREA_FLAG_REST_ZONE_ALLIANCE : AREA_FLAG_REST_ZONE_HORDE;
if (area && area->Flags & areaRestFlag)
AreaFlags const areaRestFlag = (GetTeam() == ALLIANCE) ? AreaFlags::AllianceResting : AreaFlags::HordeResting;
if (area && area->GetFlags().HasFlag(areaRestFlag))
SetRestFlag(REST_FLAG_IN_FACTION_AREA);
else
RemoveRestFlag(REST_FLAG_IN_FACTION_AREA);
@@ -7063,7 +7063,7 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
UpdateHostileAreaState(zone);
if (zone->Flags & AREA_FLAG_CAPITAL) // Is in a capital city
if (zone->GetFlags().HasFlag(AreaFlags::LinkedChat)) // Is in a capital city
{
if (!pvpInfo.IsHostile || zone->IsSanctuary())
SetRestFlag(REST_FLAG_IN_CITY);
@@ -7107,17 +7107,17 @@ void Player::UpdateHostileAreaState(AreaTableEntry const* area)
if (area->IsSanctuary()) // sanctuary and arena cannot be overriden
pvpInfo.IsInHostileArea = false;
else if (area->Flags & AREA_FLAG_ARENA)
else if (area->GetFlags().HasFlag(AreaFlags::FreeForAllPvP))
pvpInfo.IsInHostileArea = true;
else
{
if (area)
{
if (InBattleground() || area->Flags & AREA_FLAG_COMBAT || (area->PvpCombatWorldStateID != -1 && sWorldStateMgr->GetValue(area->PvpCombatWorldStateID, GetMap()) != 0))
if (InBattleground() || area->GetFlags().HasFlag(AreaFlags::CombatZone) || (area->PvpCombatWorldStateID != -1 && sWorldStateMgr->GetValue(area->PvpCombatWorldStateID, GetMap()) != 0))
pvpInfo.IsInHostileArea = true;
else if (sWorld->IsPvPRealm() || (area->Flags & AREA_FLAG_UNK3))
else if (sWorld->IsPvPRealm() || (area->GetFlags().HasFlag(AreaFlags::EnemiesPvPFlagged)))
{
if (area->Flags & AREA_FLAG_CONTESTED_AREA)
if (area->GetFlags().HasFlag(AreaFlags::Contested))
pvpInfo.IsInHostileArea = sWorld->IsPvPRealm();
else
{