mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-25 05:57:45 +00:00
Merge attempt #2
This commit is contained in:
parent
4a8092b71e
commit
a55e912d9f
4 changed files with 20 additions and 13 deletions
|
@ -131,11 +131,7 @@ void Player::unload()
|
|||
setLoadingComplete( false );
|
||||
// unset player for removal
|
||||
setMarkedForRemoval( false );
|
||||
// send updates to mgrs
|
||||
if( getPartyId() != 0 )
|
||||
partyMgr.onMemberDisconnect( *this );
|
||||
|
||||
fcMgr.onFcLogout( getCharacterId() );
|
||||
syncLastDBWrite();
|
||||
}
|
||||
|
||||
|
|
|
@ -274,8 +274,6 @@ void PlayerMgr::onCompanionUpdate( Entity::Player& player, uint8_t companionId )
|
|||
|
||||
void PlayerMgr::onMountUpdate( Entity::Player& player, uint32_t mountId )
|
||||
{
|
||||
Common::Service< World::Manager::PlayerMgr >::ref().onMountUpdate( player, mountId );
|
||||
|
||||
if( mountId != 0 )
|
||||
{
|
||||
player.sendToInRangeSet( makeActorControl( player.getId(), ActorControlType::SetStatus,
|
||||
|
@ -366,6 +364,17 @@ void PlayerMgr::onLogin( Entity::Player& player )
|
|||
}
|
||||
}
|
||||
|
||||
void PlayerMgr::onLogout( Entity::Player &player )
|
||||
{
|
||||
auto& partyMgr = Common::Service< World::Manager::PartyMgr >::ref();
|
||||
auto& fcMgr = Common::Service< World::Manager::FreeCompanyMgr >::ref();
|
||||
// send updates to mgrs
|
||||
if( player.getPartyId() != 0 )
|
||||
partyMgr.onMemberDisconnect( player );
|
||||
|
||||
fcMgr.onFcLogout( player.getCharacterId() );
|
||||
}
|
||||
|
||||
void PlayerMgr::onDeath( Entity::Player& player )
|
||||
{
|
||||
auto& scriptMgr = Common::Service< Scripting::ScriptMgr >::ref();
|
||||
|
|
|
@ -57,6 +57,7 @@ class PlayerMgr
|
|||
void onHateListChanged( Sapphire::Entity::Player& player );
|
||||
|
||||
void onLogin( Sapphire::Entity::Player& player );
|
||||
void onLogout( Sapphire::Entity::Player& player );
|
||||
|
||||
void onDeath( Sapphire::Entity::Player& player );
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include <filesystem>
|
||||
#include <time.h>
|
||||
|
||||
#include <Util/Util.h>
|
||||
#include <Network/PacketContainer.h>
|
||||
|
@ -78,6 +77,9 @@ void Sapphire::World::Session::close()
|
|||
// remove the session from the player
|
||||
if( m_pPlayer )
|
||||
{
|
||||
auto& playerMgr = Common::Service< World::Manager::PlayerMgr >::ref();
|
||||
playerMgr.onLogout( *m_pPlayer );
|
||||
|
||||
m_pPlayer->unload();
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +118,7 @@ void Sapphire::World::Session::startReplay( const std::string& path )
|
|||
{
|
||||
if( !fs::exists( path ) )
|
||||
{
|
||||
PlayerMgr::sendDebug( *getPlayer(), "Couldn't find folder." );
|
||||
PlayerMgr::sendDebug( *getPlayer(), "Couldn't find folder {}.", path );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -129,11 +131,11 @@ void Sapphire::World::Session::startReplay( const std::string& path )
|
|||
{
|
||||
// Get the filename of the current element
|
||||
auto fileName = it->path().filename().string();
|
||||
auto unixTime = std::stoull( fileName.substr( 0, 14 ).c_str() );
|
||||
auto unixTime = std::stoull( fileName.substr( 0, 14 ) );
|
||||
|
||||
if( unixTime > 1000000000 )
|
||||
{
|
||||
loadedSets.push_back( std::tuple< uint64_t, std::string >( unixTime, it->path().string() ) );
|
||||
loadedSets.emplace_back( unixTime, it->path().string() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,8 +149,7 @@ void Sapphire::World::Session::startReplay( const std::string& path )
|
|||
|
||||
for( auto set : loadedSets )
|
||||
{
|
||||
m_replayCache.push_back( std::tuple< uint64_t, std::string >(
|
||||
Common::Util::getTimeMs() + ( std::get< 0 >( set ) - startTime ), std::get< 1 >( set ) ) );
|
||||
m_replayCache.emplace_back( Common::Util::getTimeMs() + ( std::get< 0 >( set ) - startTime ), std::get< 1 >( set ) );
|
||||
|
||||
Logger::info( "Registering {0} for {1}", std::get< 1 >( set ), std::get< 0 >( set ) - startTime );
|
||||
}
|
||||
|
@ -177,7 +178,7 @@ void Sapphire::World::Session::processReplay()
|
|||
at++;
|
||||
}
|
||||
|
||||
if( m_replayCache.size() == 0 )
|
||||
if( m_replayCache.empty() )
|
||||
m_isReplaying = false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue