1
Fork 0
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:
Mordred 2017-11-14 23:55:38 +01:00
parent a212dfdb92
commit b3f3c317b5
6 changed files with 37 additions and 5 deletions

View file

@ -731,16 +731,16 @@ struct FFXIVIpcInitUI : FFXIVIpcBasePacket<InitUI>
uint8_t preNamePadding; uint8_t preNamePadding;
char name[32]; char name[32];
uint8_t unknown_54[16]; uint8_t unknown_54[16];
uint8_t unknown55; uint8_t unknown55[4];
uint16_t levels[25]; uint16_t levels[25];
uint32_t exp[25]; uint32_t exp[25];
uint8_t unlockBitmask[64]; uint8_t unlockBitmask[64];
uint8_t aetheryte[16]; uint8_t aetheryte[16];
uint8_t discovery[420]; uint8_t discovery[420];
uint8_t howto[33]; uint8_t howto[33];
uint8_t minions[33]; uint8_t minions[35];
uint8_t chocoboTaxiMask[8]; uint8_t chocoboTaxiMask[8];
uint8_t contentClearMask[104]; uint8_t contentClearMask[105];
uint8_t companionBardingMask[8]; uint8_t companionBardingMask[8];
uint8_t companionEquippedHead; uint8_t companionEquippedHead;
uint8_t companionEquippedBody; uint8_t companionEquippedBody;

View file

@ -70,7 +70,8 @@ Core::Entity::Player::Player() :
m_bLoadingComplete( false ), m_bLoadingComplete( false ),
m_bMarkedForZoning( false ), m_bMarkedForZoning( false ),
m_zoningType( Common::ZoneingType::None ), m_zoningType( Common::ZoneingType::None ),
m_bAutoattack( false ) m_bAutoattack( false ),
m_markedForRemoval( false )
{ {
m_id = 0; m_id = 0;
m_type = ActorType::Player; m_type = ActorType::Player;
@ -90,7 +91,7 @@ Core::Entity::Player::Player() :
Core::Entity::Player::~Player() Core::Entity::Player::~Player()
{ {
g_log.debug( "PlayerObj destroyed" );
} }
// TODO: add a proper calculation based on race / job / level / gear // 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; 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() Core::Common::OnlineStatus Core::Entity::Player::getOnlineStatus()
{ {
uint64_t newMask = uint64_t( 1 ) << static_cast< uint32_t >( OnlineStatus::NewAdventurer ); uint64_t newMask = uint64_t( 1 ) << static_cast< uint32_t >( OnlineStatus::NewAdventurer );

View file

@ -530,6 +530,9 @@ public:
void updateDbSearchInfo() const; void updateDbSearchInfo() const;
void updateDbClass() const; void updateDbClass() const;
void setMarkedForRemoval();
bool isMarkedForRemoval() const;
private: private:
uint32_t m_lastWrite; uint32_t m_lastWrite;
uint32_t m_lastPing; uint32_t m_lastPing;
@ -540,6 +543,8 @@ private:
uint8_t m_mode; uint8_t m_mode;
bool m_markedForRemoval;
private: private:
uint8_t m_voice; uint8_t m_voice;

View file

@ -414,6 +414,8 @@ void Core::Entity::Player::updateSql()
////// Class ////// Class
updateDbClass(); updateDbClass();
memset( m_orchestrion, 0, sizeof( m_orchestrion ) );
} }
void Core::Entity::Player::updateDbClass() const void Core::Entity::Player::updateDbClass() const

View file

@ -540,6 +540,8 @@ void Core::Network::GameConnection::logoutHandler( const Packets::GamePacket& in
logoutPacket.data().flags1 = 0x02; logoutPacket.data().flags1 = 0x02;
logoutPacket.data().flags2 = 0x2000; logoutPacket.data().flags2 = 0x2000;
queueOutPacket( logoutPacket ); queueOutPacket( logoutPacket );
pPlayer->setMarkedForRemoval();
} }

View file

@ -263,10 +263,12 @@ void Core::ServerZone::mainLoop()
auto session = sessionIt.second; auto session = sessionIt.second;
if( session && session->getPlayer() ) if( session && session->getPlayer() )
{ {
// 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()->getCurrentZone() ) if( !session->getPlayer()->getCurrentZone() )
session->update(); session->update();
} }
} }
@ -278,6 +280,16 @@ void Core::ServerZone::mainLoop()
auto pPlayer = it->second->getPlayer(); 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 ) if( diff > 20 )
{ {
g_log.info("[" + std::to_string(it->second->getId() ) + "] Session time out" ); g_log.info("[" + std::to_string(it->second->getId() ) + "] Session time out" );