diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index d4db4fd65..9a3dd449e 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -1776,6 +1776,16 @@ void Player::Update(uint32 p_time) { if (p_time >= m_zoneUpdateTimer) { + if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING)) + { + uint32 zoneId = GetZoneId(); + AreaTableEntry const* zone = sAreaTableStore.LookupEntry(zoneId); + AreaTrigger const* atEntry = sObjectMgr->GetAreaTrigger(GetInnTriggerId()); // Warsong Hold. Only inn that doesn't work so ugly hack it is :) + if (!(atEntry || IsInAreaTriggerRadius(atEntry) || zone->flags & AREA_FLAG_CAPITAL || sAreaTableStore.LookupEntry(4129))) + { + RemoveRestState(); + } + } uint32 newzone, newarea; GetZoneAndAreaId(newzone, newarea, true); m_last_zone_id = newzone; @@ -7687,17 +7697,14 @@ void Player::UpdateArea(uint32 newArea) else RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY); - if (isInn) + uint32 const areaRestFlag = (GetTeamId() == TEAM_ALLIANCE) ? AREA_FLAG_REST_ZONE_ALLIANCE : AREA_FLAG_REST_ZONE_HORDE; + if (area && areaFlags & areaRestFlag) { SetRestState(0); - if (sWorld->IsFFAPvPRealm()) - RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); } - else if (!(areaFlags & AREA_FLAG_CAPITAL)) + else { - AreaTrigger const* atEntry = sObjectMgr->GetAreaTrigger(GetInnTriggerId()); - if (!atEntry || !IsInAreaTriggerRadius(atEntry)) - RemoveRestState(); + RemoveRestState(); } }