From 87ca06cfaf0ac0a9f4bdd71ee222bff63ada61d8 Mon Sep 17 00:00:00 2001 From: NotAdam Date: Fri, 28 Dec 2018 19:45:04 +1100 Subject: [PATCH] return player to parent housing zone if logged out inside house --- src/world/Actor/PlayerSql.cpp | 11 +++++++++++ src/world/Manager/TerritoryMgr.cpp | 11 ++++++++++- src/world/Manager/TerritoryMgr.h | 7 +++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/world/Actor/PlayerSql.cpp b/src/world/Actor/PlayerSql.cpp index 1aeb33ee..4f834d95 100644 --- a/src/world/Actor/PlayerSql.cpp +++ b/src/world/Actor/PlayerSql.cpp @@ -84,6 +84,17 @@ bool Sapphire::Entity::Player::load( uint32_t charId, SessionPtr pSession ) pCurrZone = pTeriMgr->getZoneByTerritoryTypeId( zoneId ); } } + else if( pTeriMgr->isInternalEstateTerritory( zoneId ) ) + { + // todo: this needs to go to the area just outside of the plot door + pCurrZone = pTeriMgr->getZoneByLandSetId( m_prevTerritoryId ); + + zoneId = m_prevTerritoryTypeId; + m_pos.x = m_prevPos.x; + m_pos.y = m_prevPos.y; + m_pos.z = m_prevPos.z; + setRot( m_prevRot ); + } else if( pTeriMgr->isHousingTerritory( zoneId ) ) { pCurrZone = pTeriMgr->getZoneByLandSetId( m_territoryId ); diff --git a/src/world/Manager/TerritoryMgr.cpp b/src/world/Manager/TerritoryMgr.cpp index cd1a2301..f1f5ea63 100644 --- a/src/world/Manager/TerritoryMgr.cpp +++ b/src/world/Manager/TerritoryMgr.cpp @@ -106,11 +106,20 @@ bool Sapphire::World::Manager::TerritoryMgr::isPrivateTerritory( uint32_t territ return pTeri->territoryIntendedUse == TerritoryIntendedUse::OpeningArea || pTeri->territoryIntendedUse == TerritoryIntendedUse::Inn || - pTeri->territoryIntendedUse == TerritoryIntendedUse::HousingPrivateArea || pTeri->territoryIntendedUse == TerritoryIntendedUse::JailArea || pTeri->territoryIntendedUse == TerritoryIntendedUse::MSQPrivateArea; } +bool Sapphire::World::Manager::TerritoryMgr::isInternalEstateTerritory( uint32_t territoryTypeId ) const +{ + auto pTeri = getTerritoryDetail( territoryTypeId ); + + if( !pTeri ) + return false; + + return pTeri->territoryIntendedUse == TerritoryIntendedUse::HousingPrivateArea; +} + bool Sapphire::World::Manager::TerritoryMgr::isDefaultTerritory( uint32_t territoryTypeId ) const { auto pTeri = getTerritoryDetail( territoryTypeId ); diff --git a/src/world/Manager/TerritoryMgr.h b/src/world/Manager/TerritoryMgr.h index 794c87af..68fc1243 100644 --- a/src/world/Manager/TerritoryMgr.h +++ b/src/world/Manager/TerritoryMgr.h @@ -87,6 +87,13 @@ namespace Sapphire::World::Manager /*! returns true if the territoryType in question is not a private zone */ bool isPrivateTerritory( uint32_t territoryTypeId ) const; + /*! + * @brief Checks if a territory type is an internal housing area + * @param territoryTypeId The territory to test + * @return true if it is a housing area, false if not + */ + bool isInternalEstateTerritory( uint32_t territoryTypeId ) const; + /*! returns true if the territoryType is a default non-instanced zone */ bool isDefaultTerritory( uint32_t territoryTypeId ) const;