mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-01 08:27:46 +00:00
Logout will now remove a playersession almost instantly
This commit is contained in:
parent
a212dfdb92
commit
b3f3c317b5
6 changed files with 37 additions and 5 deletions
|
@ -731,16 +731,16 @@ struct FFXIVIpcInitUI : FFXIVIpcBasePacket<InitUI>
|
|||
uint8_t preNamePadding;
|
||||
char name[32];
|
||||
uint8_t unknown_54[16];
|
||||
uint8_t unknown55;
|
||||
uint8_t unknown55[4];
|
||||
uint16_t levels[25];
|
||||
uint32_t exp[25];
|
||||
uint8_t unlockBitmask[64];
|
||||
uint8_t aetheryte[16];
|
||||
uint8_t discovery[420];
|
||||
uint8_t howto[33];
|
||||
uint8_t minions[33];
|
||||
uint8_t minions[35];
|
||||
uint8_t chocoboTaxiMask[8];
|
||||
uint8_t contentClearMask[104];
|
||||
uint8_t contentClearMask[105];
|
||||
uint8_t companionBardingMask[8];
|
||||
uint8_t companionEquippedHead;
|
||||
uint8_t companionEquippedBody;
|
||||
|
|
|
@ -70,7 +70,8 @@ Core::Entity::Player::Player() :
|
|||
m_bLoadingComplete( false ),
|
||||
m_bMarkedForZoning( false ),
|
||||
m_zoningType( Common::ZoneingType::None ),
|
||||
m_bAutoattack( false )
|
||||
m_bAutoattack( false ),
|
||||
m_markedForRemoval( false )
|
||||
{
|
||||
m_id = 0;
|
||||
m_type = ActorType::Player;
|
||||
|
@ -90,7 +91,7 @@ Core::Entity::Player::Player() :
|
|||
|
||||
Core::Entity::Player::~Player()
|
||||
{
|
||||
|
||||
g_log.debug( "PlayerObj destroyed" );
|
||||
}
|
||||
|
||||
// TODO: add a proper calculation based on race / job / level / gear
|
||||
|
@ -134,6 +135,16 @@ uint8_t Core::Entity::Player::getStartTown() const
|
|||
return m_startTown;
|
||||
}
|
||||
|
||||
void Core::Entity::Player::setMarkedForRemoval()
|
||||
{
|
||||
m_markedForRemoval = true;
|
||||
}
|
||||
|
||||
bool Core::Entity::Player::isMarkedForRemoval() const
|
||||
{
|
||||
return m_markedForRemoval;
|
||||
}
|
||||
|
||||
Core::Common::OnlineStatus Core::Entity::Player::getOnlineStatus()
|
||||
{
|
||||
uint64_t newMask = uint64_t( 1 ) << static_cast< uint32_t >( OnlineStatus::NewAdventurer );
|
||||
|
|
|
@ -530,6 +530,9 @@ public:
|
|||
void updateDbSearchInfo() const;
|
||||
void updateDbClass() const;
|
||||
|
||||
void setMarkedForRemoval();
|
||||
bool isMarkedForRemoval() const;
|
||||
|
||||
private:
|
||||
uint32_t m_lastWrite;
|
||||
uint32_t m_lastPing;
|
||||
|
@ -540,6 +543,8 @@ private:
|
|||
|
||||
uint8_t m_mode;
|
||||
|
||||
bool m_markedForRemoval;
|
||||
|
||||
private:
|
||||
|
||||
uint8_t m_voice;
|
||||
|
|
|
@ -414,6 +414,8 @@ void Core::Entity::Player::updateSql()
|
|||
////// Class
|
||||
updateDbClass();
|
||||
|
||||
memset( m_orchestrion, 0, sizeof( m_orchestrion ) );
|
||||
|
||||
}
|
||||
|
||||
void Core::Entity::Player::updateDbClass() const
|
||||
|
|
|
@ -540,6 +540,8 @@ void Core::Network::GameConnection::logoutHandler( const Packets::GamePacket& in
|
|||
logoutPacket.data().flags1 = 0x02;
|
||||
logoutPacket.data().flags2 = 0x2000;
|
||||
queueOutPacket( logoutPacket );
|
||||
|
||||
pPlayer->setMarkedForRemoval();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -263,10 +263,12 @@ void Core::ServerZone::mainLoop()
|
|||
auto session = sessionIt.second;
|
||||
if( session && session->getPlayer() )
|
||||
{
|
||||
|
||||
// if the player is in a zone, let the zone handler take care of his updates
|
||||
// else do it here.
|
||||
if( !session->getPlayer()->getCurrentZone() )
|
||||
session->update();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -278,6 +280,16 @@ void Core::ServerZone::mainLoop()
|
|||
|
||||
auto pPlayer = it->second->getPlayer();
|
||||
|
||||
if( pPlayer->isMarkedForRemoval() && diff > 1 )
|
||||
{
|
||||
it->second->close();
|
||||
// if( it->second.unique() )
|
||||
{
|
||||
it = this->m_sessionMap.erase( it );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if( diff > 20 )
|
||||
{
|
||||
g_log.info("[" + std::to_string(it->second->getId() ) + "] Session time out" );
|
||||
|
|
Loading…
Add table
Reference in a new issue