fix(Core/Player): Improve rested removal (#3715)

This commit is contained in:
Kitzunu
2020-11-19 17:11:56 +01:00
committed by GitHub
parent b83650842a
commit fb69db212f

View File

@@ -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();
}
}