mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
fix(Core/Player): Improve rested removal (#3715)
This commit is contained in:
@@ -1776,6 +1776,16 @@ void Player::Update(uint32 p_time)
|
|||||||
{
|
{
|
||||||
if (p_time >= m_zoneUpdateTimer)
|
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;
|
uint32 newzone, newarea;
|
||||||
GetZoneAndAreaId(newzone, newarea, true);
|
GetZoneAndAreaId(newzone, newarea, true);
|
||||||
m_last_zone_id = newzone;
|
m_last_zone_id = newzone;
|
||||||
@@ -7687,17 +7697,14 @@ void Player::UpdateArea(uint32 newArea)
|
|||||||
else
|
else
|
||||||
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY);
|
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);
|
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());
|
RemoveRestState();
|
||||||
if (!atEntry || !IsInAreaTriggerRadius(atEntry))
|
|
||||||
RemoveRestState();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user