mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[9596] Use area trigger zone check for inn leave case.
This is still have false cases but will more correct for specific area triggers. Also let cleanup code and store less data for Player.
This commit is contained in:
parent
56c08e2ef9
commit
db51c29235
6 changed files with 91 additions and 108 deletions
|
|
@ -431,10 +431,7 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa
|
|||
|
||||
////////////////////Rest System/////////////////////
|
||||
time_inn_enter=0;
|
||||
inn_pos_mapid=0;
|
||||
inn_pos_x=0;
|
||||
inn_pos_y=0;
|
||||
inn_pos_z=0;
|
||||
inn_trigger_id=0;
|
||||
m_rest_bonus=0;
|
||||
rest_type=REST_TYPE_NO;
|
||||
////////////////////Rest System/////////////////////
|
||||
|
|
@ -1246,7 +1243,7 @@ void Player::Update( uint32 p_time )
|
|||
if (time_inn >= 10) //freeze update
|
||||
{
|
||||
float bubble = 0.125f*sWorld.getConfig(CONFIG_FLOAT_RATE_REST_INGAME);
|
||||
//speed collect rest bonus (section/in hour)
|
||||
//speed collect rest bonus (section/in hour)
|
||||
SetRestBonus( float(GetRestBonus()+ time_inn*(GetUInt32Value(PLAYER_NEXT_LEVEL_XP)/72000)*bubble ));
|
||||
UpdateInnerTime(time(NULL));
|
||||
}
|
||||
|
|
@ -6473,38 +6470,19 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
|
|||
}
|
||||
|
||||
if(zone->flags & AREA_FLAG_CAPITAL) // in capital city
|
||||
{
|
||||
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
|
||||
SetRestType(REST_TYPE_IN_CITY);
|
||||
InnEnter(time(0),GetMapId(),0,0,0);
|
||||
|
||||
if(sWorld.IsFFAPvPRealm())
|
||||
SetFFAPvP(false);
|
||||
}
|
||||
else // anywhere else
|
||||
{
|
||||
if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING)) // but resting (walk from city or maybe in tavern or leave tavern recently)
|
||||
{
|
||||
if (GetRestType()==REST_TYPE_IN_TAVERN) // has been in tavern. Is still in?
|
||||
{
|
||||
if (GetMapId()!=GetInnPosMapId() || ((GetPositionX()-GetInnPosX())*(GetPositionX()-GetInnPosX())+(GetPositionY()-GetInnPosY())*(GetPositionY()-GetInnPosY())+(GetPositionZ()-GetInnPosZ())*(GetPositionZ()-GetInnPosZ())) > 30*30)
|
||||
{
|
||||
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
|
||||
AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(inn_trigger_id);
|
||||
if (!at || !IsPointInAreaTriggerZone(at, GetMapId(), GetPositionX(), GetPositionY(), GetPositionY()))
|
||||
SetRestType(REST_TYPE_NO);
|
||||
|
||||
if(sWorld.IsFFAPvPRealm())
|
||||
SetFFAPvP(true);
|
||||
}
|
||||
}
|
||||
else // not in tavern (leave city then)
|
||||
{
|
||||
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
|
||||
SetRestType(REST_TYPE_NO);
|
||||
|
||||
// Set player to FFA PVP when not in rested environment.
|
||||
if(sWorld.IsFFAPvPRealm())
|
||||
SetFFAPvP(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -21721,3 +21699,27 @@ Object* Player::GetObjectByTypeMask(ObjectGuid guid, TypeMask typemask)
|
|||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void Player::SetRestType( RestType n_r_type, uint32 areaTriggerId /*= 0*/)
|
||||
{
|
||||
rest_type = n_r_type;
|
||||
|
||||
if (rest_type == REST_TYPE_NO)
|
||||
{
|
||||
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
|
||||
|
||||
// Set player to FFA PVP when not in rested environment.
|
||||
if(sWorld.IsFFAPvPRealm())
|
||||
SetFFAPvP(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
|
||||
|
||||
inn_trigger_id = areaTriggerId;
|
||||
time_inn_enter = time(NULL);
|
||||
|
||||
if(sWorld.IsFFAPvPRealm())
|
||||
SetFFAPvP(false);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue