mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-30 16:17:46 +00:00
exitInstance moved to playerMgr
This commit is contained in:
parent
168cfb1a36
commit
78b800e36e
9 changed files with 26 additions and 26 deletions
|
@ -26,7 +26,7 @@ public:
|
|||
eventMgr().playScene( player, eventId, 1, 0, [this, eobj]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( result.getResult( 0 ) != 1 )
|
||||
player.exitInstance();
|
||||
playerMgr().onExitInstance( player );
|
||||
} );
|
||||
}
|
||||
};
|
||||
|
|
|
@ -823,7 +823,7 @@ private:
|
|||
quest.setSeq( Seq6 );
|
||||
eventMgr().sendEventNotice( player, getId(), 4, 0 );
|
||||
playerMgr().sendUrgent( player, "QuestBattle Unimplemented, skipping..." );
|
||||
player.exitInstance();
|
||||
playerMgr().onExitInstance( player );
|
||||
travelToPoprange( player, Poprange3, false );
|
||||
}
|
||||
|
||||
|
|
|
@ -397,18 +397,6 @@ bool Player::isAutoattackOn() const
|
|||
return m_bAutoattack;
|
||||
}
|
||||
|
||||
bool Player::exitInstance()
|
||||
{
|
||||
auto& warpMgr = Common::Service< WarpMgr >::ref();
|
||||
|
||||
resetHp();
|
||||
resetMp();
|
||||
|
||||
warpMgr.requestMoveTerritory( *this, WarpType::WARP_TYPE_CONTENT_END_RETURN, getPrevTerritoryId(), getPrevPos(), getPrevRot() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t Player::getPlayTime() const
|
||||
{
|
||||
return m_playTime;
|
||||
|
|
|
@ -294,9 +294,6 @@ namespace Sapphire::Entity
|
|||
/*! return current online status depending on current state / activity */
|
||||
Common::OnlineStatus getOnlineStatus() const;
|
||||
|
||||
/*! returns the player to their position before zoning into an instance */
|
||||
bool exitInstance();
|
||||
|
||||
/*! gets the players territoryTypeId */
|
||||
uint32_t getPrevTerritoryTypeId() const;
|
||||
|
||||
|
|
|
@ -923,7 +923,7 @@ void DebugCommandMgr::instance( char* data, Entity::Player& player, std::shared_
|
|||
}
|
||||
else if( subCommand == "return" || subCommand == "ret" )
|
||||
{
|
||||
player.exitInstance();
|
||||
playerMgr().onExitInstance( player );
|
||||
}
|
||||
else if( subCommand == "stringendomode" || subCommand == "sm" )
|
||||
{
|
||||
|
@ -1165,7 +1165,7 @@ void DebugCommandMgr::questBattle( char* data, Entity::Player& player, std::shar
|
|||
}
|
||||
else if( subCommand == "return" || subCommand == "ret" )
|
||||
{
|
||||
player.exitInstance();
|
||||
playerMgr().onExitInstance( player );
|
||||
}
|
||||
else if( subCommand == "set" )
|
||||
{
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <Manager/TerritoryMgr.h>
|
||||
#include <Manager/HousingMgr.h>
|
||||
#include <Manager/QuestMgr.h>
|
||||
#include <Manager/WarpMgr.h>
|
||||
|
||||
#include <Script/ScriptMgr.h>
|
||||
#include <Common.h>
|
||||
|
@ -527,5 +528,17 @@ void PlayerMgr::onUpdateHuntingLog( Entity::Player& player, uint8_t id )
|
|||
Network::Util::Packet::sendHuntingLog( player );
|
||||
}
|
||||
|
||||
void PlayerMgr::onExitInstance( Entity::Player& player )
|
||||
{
|
||||
auto& warpMgr = Common::Service< WarpMgr >::ref();
|
||||
|
||||
player.resetHp();
|
||||
player.resetMp();
|
||||
|
||||
warpMgr.requestMoveTerritory( player, Common::WarpType::WARP_TYPE_CONTENT_END_RETURN,
|
||||
player.getPrevTerritoryId(), player.getPrevPos(), player.getPrevRot() );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -40,6 +40,8 @@ namespace Sapphire::World::Manager
|
|||
|
||||
void onUpdateHuntingLog( Sapphire::Entity::Player& player, uint8_t id );
|
||||
|
||||
void onExitInstance( Sapphire::Entity::Player& player );
|
||||
|
||||
//////////// Helpers
|
||||
|
||||
static void sendServerNotice( Sapphire::Entity::Player& player, const std::string& message );
|
||||
|
|
|
@ -94,7 +94,7 @@ void Sapphire::InstanceContent::onPlayerZoneIn( Entity::Player& player )
|
|||
if( isTerminationReady() ) // wtf
|
||||
{
|
||||
Logger::warn( "Entity#{0} Appear for a terminated instance!", player.getId() );
|
||||
player.exitInstance();
|
||||
playerMgr().onExitInstance( player );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ void Sapphire::InstanceContent::onUpdate( uint64_t tickCount )
|
|||
return;
|
||||
|
||||
auto player = it->second;
|
||||
player->exitInstance();
|
||||
playerMgr().onExitInstance( *player );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ void Sapphire::InstanceContent::onEventHandlerOrder( Entity::Player& player, uin
|
|||
{
|
||||
case 0: // Leave content
|
||||
{
|
||||
player.exitInstance();
|
||||
playerMgr().onExitInstance( player );
|
||||
break;
|
||||
}
|
||||
case 1: // Force leave ( afk timer )
|
||||
|
@ -458,7 +458,7 @@ void Sapphire::InstanceContent::onBeforePlayerZoneIn( Sapphire::Entity::Player&
|
|||
{
|
||||
// remove any players from the instance who aren't bound on zone in
|
||||
if( !isPlayerBound( player.getId() ) )
|
||||
player.exitInstance();
|
||||
playerMgr().onExitInstance( player );
|
||||
|
||||
// if a player has already spawned once inside this instance, don't move them if they happen to zone in again
|
||||
if( !hasPlayerPreviouslySpawned( player ) )
|
||||
|
@ -605,7 +605,7 @@ void Sapphire::InstanceContent::unbindPlayer( uint32_t playerId )
|
|||
|
||||
auto it = m_playerMap.find( playerId );
|
||||
if( it != m_playerMap.end() )
|
||||
it->second->exitInstance();
|
||||
playerMgr().onExitInstance( *it->second );
|
||||
}
|
||||
|
||||
void Sapphire::InstanceContent::clearDirector( Entity::Player& player )
|
||||
|
|
|
@ -158,7 +158,7 @@ void Sapphire::QuestBattle::onUpdate( uint64_t tickCount )
|
|||
|
||||
if( ( static_cast< int64_t >( tickCount ) - static_cast< int64_t >( m_instanceFailTime ) ) > 6000 )
|
||||
{
|
||||
m_pPlayer->exitInstance();
|
||||
playerMgr().onExitInstance( *m_pPlayer );
|
||||
m_pPlayer.reset();
|
||||
}
|
||||
break;
|
||||
|
@ -322,7 +322,7 @@ void Sapphire::QuestBattle::success()
|
|||
auto& scriptMgr = Common::Service< Scripting::ScriptMgr >::ref();
|
||||
scriptMgr.onDutyComplete( *this, *m_pPlayer );
|
||||
|
||||
player.exitInstance();
|
||||
playerMgr().onExitInstance( player );
|
||||
} );
|
||||
|
||||
} );
|
||||
|
|
Loading…
Add table
Reference in a new issue