mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-29 07:37:45 +00:00
get/setCurrentTerritory now completely removed
This commit is contained in:
parent
fda2353e78
commit
1472041262
9 changed files with 20 additions and 25 deletions
|
@ -341,23 +341,11 @@ std::set< Sapphire::Entity::GameObjectPtr > Sapphire::Entity::GameObject::getInR
|
||||||
return tempInRange;
|
return tempInRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \return TerritoryPtr to the current zone, nullptr if not set */
|
|
||||||
Sapphire::TerritoryPtr Sapphire::Entity::GameObject::getCurrentTerritory() const
|
|
||||||
{
|
|
||||||
return m_pCurrentTerritory;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Sapphire::Entity::GameObject::getTerritoryTypeId() const
|
uint32_t Sapphire::Entity::GameObject::getTerritoryTypeId() const
|
||||||
{
|
{
|
||||||
return m_territoryTypeId;
|
return m_territoryTypeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \param TerritoryPtr to the zone to be set as current */
|
|
||||||
void Sapphire::Entity::GameObject::setCurrentZone( TerritoryPtr currZone )
|
|
||||||
{
|
|
||||||
m_pCurrentTerritory = currZone;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Sapphire::Entity::GameObject::setTerritoryTypeId( uint32_t territoryTypeId )
|
void Sapphire::Entity::GameObject::setTerritoryTypeId( uint32_t territoryTypeId )
|
||||||
{
|
{
|
||||||
m_territoryTypeId = territoryTypeId;
|
m_territoryTypeId = territoryTypeId;
|
||||||
|
|
|
@ -32,8 +32,6 @@ namespace Sapphire::Entity
|
||||||
uint32_t m_territoryTypeId{};
|
uint32_t m_territoryTypeId{};
|
||||||
/*! Specific GUId of the zone the actor currently is in */
|
/*! Specific GUId of the zone the actor currently is in */
|
||||||
uint32_t m_territoryId{};
|
uint32_t m_territoryId{};
|
||||||
/*! Ptr to the ZoneObj the actor belongs to */
|
|
||||||
TerritoryPtr m_pCurrentTerritory;
|
|
||||||
|
|
||||||
/*! list of various actors in range */
|
/*! list of various actors in range */
|
||||||
std::set< GameObjectPtr > m_inRangeActor;
|
std::set< GameObjectPtr > m_inRangeActor;
|
||||||
|
@ -123,16 +121,12 @@ namespace Sapphire::Entity
|
||||||
|
|
||||||
BNpcPtr getAsBNpc();
|
BNpcPtr getAsBNpc();
|
||||||
|
|
||||||
TerritoryPtr getCurrentTerritory() const;
|
|
||||||
|
|
||||||
uint32_t getTerritoryTypeId() const;
|
uint32_t getTerritoryTypeId() const;
|
||||||
void setTerritoryTypeId( uint32_t territoryTypeId );
|
void setTerritoryTypeId( uint32_t territoryTypeId );
|
||||||
|
|
||||||
uint32_t getTerritoryId() const;
|
uint32_t getTerritoryId() const;
|
||||||
void setTerritoryId( uint32_t territoryTypeId );
|
void setTerritoryId( uint32_t territoryTypeId );
|
||||||
|
|
||||||
void setCurrentZone( TerritoryPtr currZone );
|
|
||||||
|
|
||||||
// get the current cell of a region the actor is in
|
// get the current cell of a region the actor is in
|
||||||
Common::CellId getCellId() const;
|
Common::CellId getCellId() const;
|
||||||
// set the current cell
|
// set the current cell
|
||||||
|
|
|
@ -82,7 +82,8 @@ Sapphire::Entity::Player::Player() :
|
||||||
m_pQueuedAction( nullptr ),
|
m_pQueuedAction( nullptr ),
|
||||||
m_partyId( 0 ),
|
m_partyId( 0 ),
|
||||||
m_onlineStatusCustom( 0 ),
|
m_onlineStatusCustom( 0 ),
|
||||||
m_onlineStatus( 0 )
|
m_onlineStatus( 0 ),
|
||||||
|
m_bIsConnected( false )
|
||||||
{
|
{
|
||||||
m_id = 0;
|
m_id = 0;
|
||||||
m_currentStance = Stance::Passive;
|
m_currentStance = Stance::Passive;
|
||||||
|
@ -123,10 +124,9 @@ void Sapphire::Entity::Player::unload()
|
||||||
{
|
{
|
||||||
// do one last update to db
|
// do one last update to db
|
||||||
updateSql();
|
updateSql();
|
||||||
// reset the zone, so the zone handler knows to remove the actor
|
|
||||||
setCurrentZone( nullptr );
|
|
||||||
// reset isLogin and loading sequences just in case
|
// reset isLogin and loading sequences just in case
|
||||||
setIsLogin( false );
|
setIsLogin( false );
|
||||||
|
setConnected( false );
|
||||||
setLoadingComplete( false );
|
setLoadingComplete( false );
|
||||||
// unset player for removal
|
// unset player for removal
|
||||||
setMarkedForRemoval( false );
|
setMarkedForRemoval( false );
|
||||||
|
@ -2230,3 +2230,13 @@ std::optional< Sapphire::World::Quest > Sapphire::Entity::Player::getQuest( uint
|
||||||
auto quest = getQuestByIndex( idx );
|
auto quest = getQuestByIndex( idx );
|
||||||
return { quest };
|
return { quest };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Sapphire::Entity::Player::isConnected() const
|
||||||
|
{
|
||||||
|
return m_bIsConnected;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Sapphire::Entity::Player::setConnected( bool isConnected )
|
||||||
|
{
|
||||||
|
m_bIsConnected = isConnected;
|
||||||
|
}
|
||||||
|
|
|
@ -823,6 +823,9 @@ namespace Sapphire::Entity
|
||||||
const Common::FFXIVARR_POSITION3& getPrevPos() const;
|
const Common::FFXIVARR_POSITION3& getPrevPos() const;
|
||||||
float getPrevRot() const;
|
float getPrevRot() const;
|
||||||
|
|
||||||
|
bool isConnected() const;
|
||||||
|
void setConnected( bool isConnected );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/*! queue a packet for the player */
|
/*! queue a packet for the player */
|
||||||
void queuePacket( Network::Packets::FFXIVPacketBasePtr pPacket );
|
void queuePacket( Network::Packets::FFXIVPacketBasePtr pPacket );
|
||||||
|
@ -923,6 +926,8 @@ namespace Sapphire::Entity
|
||||||
bool m_bLoadingComplete;
|
bool m_bLoadingComplete;
|
||||||
bool m_bAutoattack;
|
bool m_bAutoattack;
|
||||||
|
|
||||||
|
bool m_bIsConnected;
|
||||||
|
|
||||||
Common::ZoneingType m_zoningType;
|
Common::ZoneingType m_zoningType;
|
||||||
|
|
||||||
bool m_bMarkedForZoning;
|
bool m_bMarkedForZoning;
|
||||||
|
|
|
@ -679,7 +679,6 @@ bool Sapphire::World::Manager::TerritoryMgr::movePlayer( const TerritoryPtr& pZo
|
||||||
if( playerLoaded && pPrevZone )
|
if( playerLoaded && pPrevZone )
|
||||||
pPrevZone->removeActor( player.getAsPlayer() );
|
pPrevZone->removeActor( player.getAsPlayer() );
|
||||||
|
|
||||||
player.setCurrentZone( pZone );
|
|
||||||
pZone->pushActor( player.getAsPlayer() );
|
pZone->pushActor( player.getAsPlayer() );
|
||||||
|
|
||||||
// map player to instanceId so it can be tracked.
|
// map player to instanceId so it can be tracked.
|
||||||
|
|
|
@ -409,6 +409,7 @@ void Sapphire::Network::GameConnection::loginHandler( const Packets::FFXIVARR_PA
|
||||||
auto& teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
auto& teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||||
// init handler means this is a login procedure
|
// init handler means this is a login procedure
|
||||||
player.setIsLogin( true );
|
player.setIsLogin( true );
|
||||||
|
player.setConnected( true );
|
||||||
teriMgr.joinWorld( player );
|
teriMgr.joinWorld( player );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -294,7 +294,6 @@ Sapphire::Entity::EventObjectPtr Sapphire::HousingZone::registerEstateEntranceEO
|
||||||
auto eObj = Entity::make_EventObject( getNextEObjId(), 2002737, 0, 4, land->getMapMarkerPosition(), 0.f, "entrance" );
|
auto eObj = Entity::make_EventObject( getNextEObjId(), 2002737, 0, 4, land->getMapMarkerPosition(), 0.f, "entrance" );
|
||||||
eObj->setHousingLink( landId << 8 );
|
eObj->setHousingLink( landId << 8 );
|
||||||
eObj->setScale( 1.f );
|
eObj->setScale( 1.f );
|
||||||
eObj->setCurrentZone( shared_from_this() );
|
|
||||||
|
|
||||||
registerEObj( eObj );
|
registerEObj( eObj );
|
||||||
|
|
||||||
|
|
|
@ -808,7 +808,6 @@ Sapphire::Entity::EventObjectPtr Sapphire::Territory::registerEObj( const std::s
|
||||||
{
|
{
|
||||||
auto eObj = Entity::make_EventObject( getNextEObjId(), objectId, mapLink, state, pos, rotation, name );
|
auto eObj = Entity::make_EventObject( getNextEObjId(), objectId, mapLink, state, pos, rotation, name );
|
||||||
eObj->setScale( scale );
|
eObj->setScale( scale );
|
||||||
eObj->setCurrentZone( shared_from_this() );
|
|
||||||
|
|
||||||
registerEObj( eObj );
|
registerEObj( eObj );
|
||||||
|
|
||||||
|
|
|
@ -318,7 +318,7 @@ void Sapphire::World::WorldServer::mainLoop()
|
||||||
|
|
||||||
// if the player is in a zone, let the zone handler take care of his updates
|
// if the player is in a zone, let the zone handler take care of his updates
|
||||||
// else do it here.
|
// else do it here.
|
||||||
if( !session->getPlayer()->getCurrentTerritory() )
|
if( !session->getPlayer()->isConnected() )
|
||||||
session->update();
|
session->update();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue