mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-30 16:17:46 +00:00
Added BaseManager and moved DebugCommandHandler to Manager
This commit is contained in:
parent
96ba9a9e69
commit
d03e7a43a6
33 changed files with 309 additions and 252 deletions
|
@ -297,7 +297,7 @@ Send a packet to all players in range, potentially to self if set and is player
|
||||||
*/
|
*/
|
||||||
void Sapphire::Entity::Actor::sendToInRangeSet( Network::Packets::FFXIVPacketBasePtr pPacket, bool bToSelf )
|
void Sapphire::Entity::Actor::sendToInRangeSet( Network::Packets::FFXIVPacketBasePtr pPacket, bool bToSelf )
|
||||||
{
|
{
|
||||||
auto pServerZone = g_fw.get< ServerMgr >();
|
auto pServerZone = g_fw.get< World::ServerMgr >();
|
||||||
if( bToSelf && isPlayer() )
|
if( bToSelf && isPlayer() )
|
||||||
{
|
{
|
||||||
auto pPlayer = getAsPlayer();
|
auto pPlayer = getAsPlayer();
|
||||||
|
|
|
@ -109,7 +109,7 @@ Sapphire::Entity::Player::~Player()
|
||||||
|
|
||||||
void Sapphire::Entity::Player::injectPacket( const std::string& path )
|
void Sapphire::Entity::Player::injectPacket( const std::string& path )
|
||||||
{
|
{
|
||||||
auto pServerZone = g_fw.get< ServerMgr >();
|
auto pServerZone = g_fw.get< World::ServerMgr >();
|
||||||
auto session = pServerZone->getSession( getId() );
|
auto session = pServerZone->getSession( getId() );
|
||||||
if( session )
|
if( session )
|
||||||
session->getZoneConnection()->injectPacket( path, *this );
|
session->getZoneConnection()->injectPacket( path, *this );
|
||||||
|
@ -1206,7 +1206,7 @@ const uint8_t* Sapphire::Entity::Player::getGcRankArray() const
|
||||||
|
|
||||||
void Sapphire::Entity::Player::queuePacket( Network::Packets::FFXIVPacketBasePtr pPacket )
|
void Sapphire::Entity::Player::queuePacket( Network::Packets::FFXIVPacketBasePtr pPacket )
|
||||||
{
|
{
|
||||||
auto pServerZone = g_fw.get< ServerMgr >();
|
auto pServerZone = g_fw.get< World::ServerMgr >();
|
||||||
auto pSession = pServerZone->getSession( m_id );
|
auto pSession = pServerZone->getSession( m_id );
|
||||||
|
|
||||||
if( !pSession )
|
if( !pSession )
|
||||||
|
@ -1221,7 +1221,7 @@ void Sapphire::Entity::Player::queuePacket( Network::Packets::FFXIVPacketBasePtr
|
||||||
|
|
||||||
void Sapphire::Entity::Player::queueChatPacket( Network::Packets::FFXIVPacketBasePtr pPacket )
|
void Sapphire::Entity::Player::queueChatPacket( Network::Packets::FFXIVPacketBasePtr pPacket )
|
||||||
{
|
{
|
||||||
auto pServerZone = g_fw.get< ServerMgr >();
|
auto pServerZone = g_fw.get< World::ServerMgr >();
|
||||||
auto pSession = pServerZone->getSession( m_id );
|
auto pSession = pServerZone->getSession( m_id );
|
||||||
|
|
||||||
if( !pSession )
|
if( !pSession )
|
||||||
|
@ -1557,7 +1557,7 @@ void Sapphire::Entity::Player::sendZonePackets()
|
||||||
if( isLogin() )
|
if( isLogin() )
|
||||||
{
|
{
|
||||||
//Update player map in servermgr - in case player name has been changed
|
//Update player map in servermgr - in case player name has been changed
|
||||||
auto pServerMgr = g_fw.get< Sapphire::ServerMgr >();
|
auto pServerMgr = g_fw.get< World::ServerMgr >();
|
||||||
pServerMgr->updatePlayerName( getId(), getName() );
|
pServerMgr->updatePlayerName( getId(), getName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -682,7 +682,7 @@ namespace Sapphire::Entity
|
||||||
void updateSql();
|
void updateSql();
|
||||||
|
|
||||||
/*! load player from db, by id */
|
/*! load player from db, by id */
|
||||||
bool load( uint32_t charId, SessionPtr pSession );
|
bool load( uint32_t charId, World::SessionPtr pSession );
|
||||||
|
|
||||||
/*! load active class data */
|
/*! load active class data */
|
||||||
bool loadClassData();
|
bool loadClassData();
|
||||||
|
|
|
@ -29,7 +29,7 @@ using namespace Sapphire::Network::Packets::Server;
|
||||||
using namespace Sapphire::World::Manager;
|
using namespace Sapphire::World::Manager;
|
||||||
|
|
||||||
// load player from the db
|
// load player from the db
|
||||||
bool Sapphire::Entity::Player::load( uint32_t charId, SessionPtr pSession )
|
bool Sapphire::Entity::Player::load( uint32_t charId, World::SessionPtr pSession )
|
||||||
{
|
{
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
||||||
|
|
|
@ -5,16 +5,19 @@
|
||||||
|
|
||||||
#include "ForwardsZone.h"
|
#include "ForwardsZone.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Sapphire
|
namespace Sapphire
|
||||||
{
|
{
|
||||||
|
namespace World::Manager
|
||||||
class DebugCommandHandler;
|
{
|
||||||
|
class DebugCommandMgr;
|
||||||
|
}
|
||||||
|
|
||||||
class DebugCommand
|
class DebugCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
using pFunc = void ( DebugCommandHandler::* )( char*, Entity::Player&, std::shared_ptr< DebugCommand > );
|
using pFunc = void ( World::Manager::DebugCommandMgr::* )( char*, Entity::Player&, std::shared_ptr< DebugCommand > );
|
||||||
|
|
||||||
// String for the command
|
// String for the command
|
||||||
std::string m_commandName;
|
std::string m_commandName;
|
||||||
|
|
|
@ -25,10 +25,15 @@ TYPE_FORWARD( House );
|
||||||
TYPE_FORWARD( InstanceContent );
|
TYPE_FORWARD( InstanceContent );
|
||||||
TYPE_FORWARD( Item );
|
TYPE_FORWARD( Item );
|
||||||
TYPE_FORWARD( ItemContainer );
|
TYPE_FORWARD( ItemContainer );
|
||||||
TYPE_FORWARD( Session );
|
|
||||||
TYPE_FORWARD( ZonePosition );
|
TYPE_FORWARD( ZonePosition );
|
||||||
TYPE_FORWARD( Land )
|
TYPE_FORWARD( Land );
|
||||||
TYPE_FORWARD( Linkshell )
|
TYPE_FORWARD( Linkshell );
|
||||||
|
TYPE_FORWARD( Framework );
|
||||||
|
|
||||||
|
namespace World
|
||||||
|
{
|
||||||
|
TYPE_FORWARD( Session );
|
||||||
|
}
|
||||||
|
|
||||||
namespace World::Territory::Housing
|
namespace World::Territory::Housing
|
||||||
{
|
{
|
||||||
|
|
27
src/world/Manager/BaseManager.h
Normal file
27
src/world/Manager/BaseManager.h
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
#ifndef SAPPHIRE_MANAGER_H
|
||||||
|
#define SAPPHIRE_MANAGER_H
|
||||||
|
|
||||||
|
#include "ForwardsZone.h"
|
||||||
|
|
||||||
|
namespace Sapphire::World::Manager
|
||||||
|
{
|
||||||
|
|
||||||
|
class BaseManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit BaseManager( FrameworkPtr pFw ) : m_pFw( pFw ) {};
|
||||||
|
virtual ~BaseManager() = default;
|
||||||
|
|
||||||
|
FrameworkPtr framework() const
|
||||||
|
{ return m_pFw; }
|
||||||
|
void setFw( FrameworkPtr pFw )
|
||||||
|
{ m_pFw = pFw; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
FrameworkPtr m_pFw;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif //SAPPHIRE_MANAGER_H
|
|
@ -11,8 +11,8 @@
|
||||||
#include <Database/DatabaseDef.h>
|
#include <Database/DatabaseDef.h>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "DebugCommand.h"
|
#include "DebugCommand/DebugCommand.h"
|
||||||
#include "DebugCommandHandler.h"
|
#include "DebugCommandMgr.h"
|
||||||
|
|
||||||
#include "Network/PacketWrappers/ServerNoticePacket.h"
|
#include "Network/PacketWrappers/ServerNoticePacket.h"
|
||||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||||
|
@ -37,51 +37,50 @@
|
||||||
#include "Session.h"
|
#include "Session.h"
|
||||||
#include "Framework.h"
|
#include "Framework.h"
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
|
||||||
|
|
||||||
using namespace Sapphire::Network;
|
using namespace Sapphire::Network;
|
||||||
using namespace Sapphire::Network::Packets;
|
using namespace Sapphire::Network::Packets;
|
||||||
using namespace Sapphire::Network::Packets::Server;
|
using namespace Sapphire::Network::Packets::Server;
|
||||||
using namespace Sapphire::World::Manager;
|
using namespace Sapphire::World::Manager;
|
||||||
|
|
||||||
// instanciate and initialize commands
|
// instanciate and initialize commands
|
||||||
Sapphire::DebugCommandHandler::DebugCommandHandler()
|
Sapphire::World::Manager::DebugCommandMgr::DebugCommandMgr( FrameworkPtr pFw ) :
|
||||||
|
BaseManager( pFw )
|
||||||
{
|
{
|
||||||
// Push all commands onto the register map ( command name - function - description - required GM level )
|
// Push all commands onto the register map ( command name - function - description - required GM level )
|
||||||
registerCommand( "set", &DebugCommandHandler::set, "Executes SET commands.", 1 );
|
registerCommand( "set", &DebugCommandMgr::set, "Executes SET commands.", 1 );
|
||||||
registerCommand( "get", &DebugCommandHandler::get, "Executes GET commands.", 1 );
|
registerCommand( "get", &DebugCommandMgr::get, "Executes GET commands.", 1 );
|
||||||
registerCommand( "add", &DebugCommandHandler::add, "Executes ADD commands.", 1 );
|
registerCommand( "add", &DebugCommandMgr::add, "Executes ADD commands.", 1 );
|
||||||
registerCommand( "inject", &DebugCommandHandler::injectPacket, "Loads and injects a premade packet.", 1 );
|
registerCommand( "inject", &DebugCommandMgr::injectPacket, "Loads and injects a premade packet.", 1 );
|
||||||
registerCommand( "injectc", &DebugCommandHandler::injectChatPacket, "Loads and injects a premade chat packet.", 1 );
|
registerCommand( "injectc", &DebugCommandMgr::injectChatPacket, "Loads and injects a premade chat packet.", 1 );
|
||||||
registerCommand( "replay", &DebugCommandHandler::replay, "Replays a saved capture folder.", 1 );
|
registerCommand( "replay", &DebugCommandMgr::replay, "Replays a saved capture folder.", 1 );
|
||||||
registerCommand( "nudge", &DebugCommandHandler::nudge, "Nudges you forward/up/down.", 1 );
|
registerCommand( "nudge", &DebugCommandMgr::nudge, "Nudges you forward/up/down.", 1 );
|
||||||
registerCommand( "info", &DebugCommandHandler::serverInfo, "Show server info.", 0 );
|
registerCommand( "info", &DebugCommandMgr::serverInfo, "Show server info.", 0 );
|
||||||
registerCommand( "help", &DebugCommandHandler::help, "Shows registered commands.", 0 );
|
registerCommand( "help", &DebugCommandMgr::help, "Shows registered commands.", 0 );
|
||||||
registerCommand( "script", &DebugCommandHandler::script, "Server script utilities.", 1 );
|
registerCommand( "script", &DebugCommandMgr::script, "Server script utilities.", 1 );
|
||||||
registerCommand( "instance", &DebugCommandHandler::instance, "Instance utilities", 1 );
|
registerCommand( "instance", &DebugCommandMgr::instance, "Instance utilities", 1 );
|
||||||
registerCommand( "housing", &DebugCommandHandler::housing, "Housing utilities", 1 );
|
registerCommand( "housing", &DebugCommandMgr::housing, "Housing utilities", 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear all loaded commands
|
// clear all loaded commands
|
||||||
Sapphire::DebugCommandHandler::~DebugCommandHandler()
|
Sapphire::World::Manager::DebugCommandMgr::~DebugCommandMgr()
|
||||||
{
|
{
|
||||||
for( auto it = m_commandMap.begin(); it != m_commandMap.end(); ++it )
|
for( auto it = m_commandMap.begin(); it != m_commandMap.end(); ++it )
|
||||||
( *it ).second.reset();
|
( *it ).second.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
// add a command set to the register map
|
// add a command set to the register map
|
||||||
void Sapphire::DebugCommandHandler::registerCommand( const std::string& n, DebugCommand::pFunc functionPtr,
|
void Sapphire::World::Manager::DebugCommandMgr::registerCommand( const std::string& n, DebugCommand::pFunc functionPtr,
|
||||||
const std::string& hText, uint8_t uLevel )
|
const std::string& hText, uint8_t uLevel )
|
||||||
{
|
{
|
||||||
m_commandMap[ std::string( n ) ] = std::make_shared< DebugCommand >( n, functionPtr, hText, uLevel );
|
m_commandMap[ std::string( n ) ] = std::make_shared< DebugCommand >( n, functionPtr, hText, uLevel );
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to retrieve the command in question, execute if found
|
// try to retrieve the command in question, execute if found
|
||||||
void Sapphire::DebugCommandHandler::execCommand( char* data, Entity::Player& player )
|
void Sapphire::World::Manager::DebugCommandMgr::execCommand( char* data, Entity::Player& player )
|
||||||
{
|
{
|
||||||
|
|
||||||
// define callback pointer
|
// define callback pointer
|
||||||
void ( DebugCommandHandler::*pf )( char*, Entity::Player&, std::shared_ptr< DebugCommand > );
|
void ( DebugCommandMgr::*pf )( char*, Entity::Player&, std::shared_ptr< DebugCommand > );
|
||||||
|
|
||||||
std::string commandString;
|
std::string commandString;
|
||||||
|
|
||||||
|
@ -124,7 +123,8 @@ void Sapphire::DebugCommandHandler::execCommand( char* data, Entity::Player& pla
|
||||||
// Definition of the commands
|
// Definition of the commands
|
||||||
///////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void Sapphire::DebugCommandHandler::help( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
|
void Sapphire::World::Manager::DebugCommandMgr::help( char* data, Entity::Player& player,
|
||||||
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
player.sendDebug( "Registered debug commands:" );
|
player.sendDebug( "Registered debug commands:" );
|
||||||
for( auto cmd : m_commandMap )
|
for( auto cmd : m_commandMap )
|
||||||
|
@ -136,11 +136,12 @@ void Sapphire::DebugCommandHandler::help( char* data, Entity::Player& player, st
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::DebugCommandHandler::set( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
|
void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player& player,
|
||||||
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pLog = framework()->get< Logger >();
|
||||||
auto pTerriMgr = g_fw.get< TerritoryMgr >();
|
auto pTerriMgr = framework()->get< TerritoryMgr >();
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
std::string subCommand = "";
|
std::string subCommand = "";
|
||||||
std::string params = "";
|
std::string params = "";
|
||||||
|
|
||||||
|
@ -375,9 +376,10 @@ void Sapphire::DebugCommandHandler::set( char* data, Entity::Player& player, std
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::DebugCommandHandler::add( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
|
void Sapphire::World::Manager::DebugCommandMgr::add( char* data, Entity::Player& player,
|
||||||
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pLog = framework()->get< Logger >();
|
||||||
std::string subCommand;
|
std::string subCommand;
|
||||||
std::string params = "";
|
std::string params = "";
|
||||||
|
|
||||||
|
@ -423,7 +425,7 @@ void Sapphire::DebugCommandHandler::add( char* data, Entity::Player& player, std
|
||||||
}
|
}
|
||||||
else if( subCommand == "bnpc" )
|
else if( subCommand == "bnpc" )
|
||||||
{
|
{
|
||||||
auto serverZone = g_fw.get< ServerMgr >();
|
auto serverZone = framework()->get< World::ServerMgr >();
|
||||||
|
|
||||||
auto bNpcTemplate = serverZone->getBNpcTemplate( params );
|
auto bNpcTemplate = serverZone->getBNpcTemplate( params );
|
||||||
|
|
||||||
|
@ -509,10 +511,11 @@ void Sapphire::DebugCommandHandler::add( char* data, Entity::Player& player, std
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::DebugCommandHandler::get( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
|
void Sapphire::World::Manager::DebugCommandMgr::get( char* data, Entity::Player& player,
|
||||||
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pLog = framework()->get< Logger >();
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = framework()->get< Data::ExdDataGenerated >();
|
||||||
std::string subCommand;
|
std::string subCommand;
|
||||||
std::string params = "";
|
std::string params = "";
|
||||||
|
|
||||||
|
@ -556,27 +559,29 @@ void Sapphire::DebugCommandHandler::get( char* data, Entity::Player& player, std
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Sapphire::DebugCommandHandler::injectPacket( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
|
Sapphire::World::Manager::DebugCommandMgr::injectPacket( char* data, Entity::Player& player,
|
||||||
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto pServerZone = g_fw.get< ServerMgr >();
|
auto pServerZone = framework()->get< World::ServerMgr >();
|
||||||
auto pSession = pServerZone->getSession( player.getId() );
|
auto pSession = pServerZone->getSession( player.getId() );
|
||||||
if( pSession )
|
if( pSession )
|
||||||
pSession->getZoneConnection()->injectPacket( data + 7, player );
|
pSession->getZoneConnection()->injectPacket( data + 7, player );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::DebugCommandHandler::injectChatPacket( char* data, Entity::Player& player,
|
void Sapphire::World::Manager::DebugCommandMgr::injectChatPacket( char* data, Entity::Player& player,
|
||||||
std::shared_ptr< DebugCommand > command )
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto pServerZone = g_fw.get< ServerMgr >();
|
auto pServerZone = framework()->get< World::ServerMgr >();
|
||||||
auto pSession = pServerZone->getSession( player.getId() );
|
auto pSession = pServerZone->getSession( player.getId() );
|
||||||
if( pSession )
|
if( pSession )
|
||||||
pSession->getChatConnection()->injectPacket( data + 8, player );
|
pSession->getChatConnection()->injectPacket( data + 8, player );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::DebugCommandHandler::replay( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
|
void Sapphire::World::Manager::DebugCommandMgr::replay( char* data, Entity::Player& player,
|
||||||
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pLog = framework()->get< Logger >();
|
||||||
auto pServerZone = g_fw.get< ServerMgr >();
|
auto pServerZone = framework()->get< World::ServerMgr >();
|
||||||
std::string subCommand;
|
std::string subCommand;
|
||||||
std::string params = "";
|
std::string params = "";
|
||||||
|
|
||||||
|
@ -625,7 +630,8 @@ void Sapphire::DebugCommandHandler::replay( char* data, Entity::Player& player,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::DebugCommandHandler::nudge( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
|
void Sapphire::World::Manager::DebugCommandMgr::nudge( char* data, Entity::Player& player,
|
||||||
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
std::string subCommand;
|
std::string subCommand;
|
||||||
|
|
||||||
|
@ -672,18 +678,20 @@ void Sapphire::DebugCommandHandler::nudge( char* data, Entity::Player& player, s
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Sapphire::DebugCommandHandler::serverInfo( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
|
Sapphire::World::Manager::DebugCommandMgr::serverInfo( char* data, Entity::Player& player,
|
||||||
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto pServerZone = g_fw.get< ServerMgr >();
|
auto pServerZone = framework()->get< World::ServerMgr >();
|
||||||
player.sendDebug( "SapphireZone " + Version::VERSION + "\nRev: " + Version::GIT_HASH );
|
player.sendDebug( "SapphireZone " + Version::VERSION + "\nRev: " + Version::GIT_HASH );
|
||||||
player.sendDebug( "Compiled: " __DATE__ " " __TIME__ );
|
player.sendDebug( "Compiled: " __DATE__ " " __TIME__ );
|
||||||
player.sendDebug( "Sessions: " + std::to_string( pServerZone->getSessionCount() ) );
|
player.sendDebug( "Sessions: " + std::to_string( pServerZone->getSessionCount() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::DebugCommandHandler::script( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
|
void Sapphire::World::Manager::DebugCommandMgr::script( char* data, Entity::Player& player,
|
||||||
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pLog = framework()->get< Logger >();
|
||||||
auto pScriptMgr = g_fw.get< Scripting::ScriptMgr >();
|
auto pScriptMgr = framework()->get< Scripting::ScriptMgr >();
|
||||||
std::string subCommand;
|
std::string subCommand;
|
||||||
std::string params = "";
|
std::string params = "";
|
||||||
|
|
||||||
|
@ -769,9 +777,10 @@ void Sapphire::DebugCommandHandler::script( char* data, Entity::Player& player,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Sapphire::DebugCommandHandler::instance( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
|
Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Player& player,
|
||||||
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
auto pTeriMgr = framework()->get< TerritoryMgr >();
|
||||||
std::string cmd( data ), params, subCommand;
|
std::string cmd( data ), params, subCommand;
|
||||||
auto cmdPos = cmd.find_first_of( ' ' );
|
auto cmdPos = cmd.find_first_of( ' ' );
|
||||||
|
|
||||||
|
@ -985,9 +994,10 @@ Sapphire::DebugCommandHandler::instance( char* data, Entity::Player& player, std
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::DebugCommandHandler::housing( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
|
void Sapphire::World::Manager::DebugCommandMgr::housing( char* data, Entity::Player& player,
|
||||||
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
auto pTeriMgr = framework()->get< TerritoryMgr >();
|
||||||
std::string cmd( data ), params, subCommand;
|
std::string cmd( data ), params, subCommand;
|
||||||
auto cmdPos = cmd.find_first_of( ' ' );
|
auto cmdPos = cmd.find_first_of( ' ' );
|
||||||
|
|
|
@ -4,23 +4,24 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <Common.h>
|
#include <Common.h>
|
||||||
|
|
||||||
#include "DebugCommand.h"
|
#include "DebugCommand/DebugCommand.h"
|
||||||
#include "ForwardsZone.h"
|
#include "ForwardsZone.h"
|
||||||
|
#include "BaseManager.h"
|
||||||
|
|
||||||
namespace Sapphire
|
namespace Sapphire::World::Manager
|
||||||
{
|
{
|
||||||
|
|
||||||
// handler for in game commands
|
// handler for in game commands
|
||||||
class DebugCommandHandler
|
class DebugCommandMgr : public Manager::BaseManager
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
// container mapping command string to command object
|
// container mapping command string to command object
|
||||||
std::map< std::string, std::shared_ptr< DebugCommand > > m_commandMap;
|
std::map< std::string, std::shared_ptr< DebugCommand > > m_commandMap;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DebugCommandHandler();
|
DebugCommandMgr( FrameworkPtr pFw );
|
||||||
|
|
||||||
~DebugCommandHandler();
|
~DebugCommandMgr();
|
||||||
|
|
||||||
// register command to command map
|
// register command to command map
|
||||||
void registerCommand( const std::string& n, DebugCommand::pFunc, const std::string& hText, uint8_t uLevel );
|
void registerCommand( const std::string& n, DebugCommand::pFunc, const std::string& hText, uint8_t uLevel );
|
|
@ -31,9 +31,8 @@ using namespace Sapphire::Network;
|
||||||
using namespace Sapphire::Network::Packets;
|
using namespace Sapphire::Network::Packets;
|
||||||
using namespace Sapphire::Network::Packets::Server;
|
using namespace Sapphire::Network::Packets::Server;
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
Sapphire::World::Manager::HousingMgr::HousingMgr( FrameworkPtr pFw ) :
|
||||||
|
BaseManager( pFw )
|
||||||
Sapphire::World::Manager::HousingMgr::HousingMgr()
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -56,13 +55,13 @@ uint32_t Sapphire::World::Manager::HousingMgr::toLandSetId( uint16_t territoryTy
|
||||||
|
|
||||||
Sapphire::Data::HousingZonePtr Sapphire::World::Manager::HousingMgr::getHousingZoneByLandSetId( uint32_t id )
|
Sapphire::Data::HousingZonePtr Sapphire::World::Manager::HousingMgr::getHousingZoneByLandSetId( uint32_t id )
|
||||||
{
|
{
|
||||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
auto pTeriMgr = framework()->get< TerritoryMgr >();
|
||||||
return std::dynamic_pointer_cast< HousingZone >( pTeriMgr->getZoneByLandSetId( id ) );
|
return std::dynamic_pointer_cast< HousingZone >( pTeriMgr->getZoneByLandSetId( id ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::LandPtr Sapphire::World::Manager::HousingMgr::getLandByOwnerId( uint32_t id )
|
Sapphire::LandPtr Sapphire::World::Manager::HousingMgr::getLandByOwnerId( uint32_t id )
|
||||||
{
|
{
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto res = pDb->query( "SELECT LandSetId, LandId FROM land WHERE OwnerId = " + std::to_string( id ) );
|
auto res = pDb->query( "SELECT LandSetId, LandId FROM land WHERE OwnerId = " + std::to_string( id ) );
|
||||||
|
|
||||||
if( !res->next() )
|
if( !res->next() )
|
||||||
|
@ -104,7 +103,7 @@ void Sapphire::World::Manager::HousingMgr::sendLandSignOwned( Entity::Player& pl
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t playerId = land->getOwnerId();
|
uint32_t playerId = land->getOwnerId();
|
||||||
std::string playerName = g_fw.get< Sapphire::ServerMgr >()->getPlayerNameFromDb( playerId );
|
std::string playerName = framework()->get< World::ServerMgr >()->getPlayerNameFromDb( playerId );
|
||||||
|
|
||||||
memcpy( &landInfoSignPacket->data().ownerName, playerName.c_str(), playerName.size() );
|
memcpy( &landInfoSignPacket->data().ownerName, playerName.c_str(), playerName.size() );
|
||||||
|
|
||||||
|
@ -278,7 +277,7 @@ void Sapphire::World::Manager::HousingMgr::sendWardLandInfo( Entity::Player& pla
|
||||||
entry.infoFlags |= Common::WardlandFlags::IsEstateOwned;
|
entry.infoFlags |= Common::WardlandFlags::IsEstateOwned;
|
||||||
|
|
||||||
auto owner = land->getOwnerId();
|
auto owner = land->getOwnerId();
|
||||||
auto playerName = g_fw.get< Sapphire::ServerMgr >()->getPlayerNameFromDb( owner );
|
auto playerName = framework()->get< World::ServerMgr >()->getPlayerNameFromDb( owner );
|
||||||
memcpy( &entry.estateOwnerName, playerName.c_str(), playerName.size() );
|
memcpy( &entry.estateOwnerName, playerName.c_str(), playerName.size() );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -514,6 +513,6 @@ void Sapphire::World::Manager::HousingMgr::sendHousingInventory( Entity::Player&
|
||||||
if( !container )
|
if( !container )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto invMgr = g_fw.get< Manager::InventoryMgr >();
|
auto invMgr = framework()->get< Manager::InventoryMgr >();
|
||||||
invMgr->sendInventoryContainer( player, container );
|
invMgr->sendInventoryContainer( player, container );
|
||||||
}
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
#define SAPPHIRE_HOUSINGMGR_H
|
#define SAPPHIRE_HOUSINGMGR_H
|
||||||
|
|
||||||
#include "Forwards.h"
|
#include "Forwards.h"
|
||||||
|
#include "BaseManager.h"
|
||||||
#include "Territory/HousingZone.h"
|
#include "Territory/HousingZone.h"
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
@ -13,11 +14,11 @@ namespace Sapphire::Data
|
||||||
|
|
||||||
namespace Sapphire::World::Manager
|
namespace Sapphire::World::Manager
|
||||||
{
|
{
|
||||||
class HousingMgr
|
class HousingMgr : public BaseManager
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HousingMgr();
|
HousingMgr( FrameworkPtr pFw );
|
||||||
virtual ~HousingMgr();
|
virtual ~HousingMgr();
|
||||||
|
|
||||||
bool init();
|
bool init();
|
||||||
|
|
|
@ -5,15 +5,14 @@
|
||||||
#include "Framework.h"
|
#include "Framework.h"
|
||||||
#include "LinkshellMgr.h"
|
#include "LinkshellMgr.h"
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
Sapphire::World::Manager::LinkshellMgr::LinkshellMgr( FrameworkPtr pFw ) :
|
||||||
|
BaseManager( pFw )
|
||||||
Sapphire::World::Manager::LinkshellMgr::LinkshellMgr()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sapphire::World::Manager::LinkshellMgr::loadLinkshells()
|
bool Sapphire::World::Manager::LinkshellMgr::loadLinkshells()
|
||||||
{
|
{
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto res = pDb->query( "SELECT LinkshellId, MasterCharacterId, CharacterIdList, "
|
auto res = pDb->query( "SELECT LinkshellId, MasterCharacterId, CharacterIdList, "
|
||||||
"LinkshellName, LeaderIdList, InviteIdList "
|
"LinkshellName, LeaderIdList, InviteIdList "
|
||||||
"FROM infolinkshell "
|
"FROM infolinkshell "
|
||||||
|
|
|
@ -4,11 +4,12 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "ForwardsZone.h"
|
#include "ForwardsZone.h"
|
||||||
|
#include "BaseManager.h"
|
||||||
|
|
||||||
namespace Sapphire::World::Manager
|
namespace Sapphire::World::Manager
|
||||||
{
|
{
|
||||||
|
|
||||||
class LinkshellMgr
|
class LinkshellMgr : public Manager::BaseManager
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
std::map< uint64_t, LinkshellPtr > m_linkshellIdMap;
|
std::map< uint64_t, LinkshellPtr > m_linkshellIdMap;
|
||||||
|
@ -19,7 +20,7 @@ namespace Sapphire::World::Manager
|
||||||
LinkshellPtr getLinkshellById( uint64_t lsId );
|
LinkshellPtr getLinkshellById( uint64_t lsId );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LinkshellMgr();
|
LinkshellMgr( FrameworkPtr pFw );
|
||||||
|
|
||||||
bool loadLinkshells();
|
bool loadLinkshells();
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,13 +10,18 @@
|
||||||
|
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
|
||||||
using namespace Sapphire::World::Manager;
|
using namespace Sapphire::World::Manager;
|
||||||
|
|
||||||
|
Sapphire::World::Manager::PlayerMgr::PlayerMgr( Sapphire::FrameworkPtr pFw ) :
|
||||||
|
BaseManager( pFw )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void Sapphire::World::Manager::PlayerMgr::movePlayerToLandDestination( Sapphire::Entity::Player& player, uint32_t landId, uint16_t param )
|
void Sapphire::World::Manager::PlayerMgr::movePlayerToLandDestination( Sapphire::Entity::Player& player, uint32_t landId, uint16_t param )
|
||||||
{
|
{
|
||||||
// check if we have one in the db first
|
// check if we have one in the db first
|
||||||
auto terriMgr = g_fw.get< TerritoryMgr >();
|
auto terriMgr = framework()->get< TerritoryMgr >();
|
||||||
if( !terriMgr )
|
if( !terriMgr )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -28,7 +33,7 @@ void Sapphire::World::Manager::PlayerMgr::movePlayerToLandDestination( Sapphire:
|
||||||
// check if its a housing zone, zoning is different here
|
// check if its a housing zone, zoning is different here
|
||||||
if( terriMgr->isHousingTerritory( terriPos->getTargetZoneId() ) )
|
if( terriMgr->isHousingTerritory( terriPos->getTargetZoneId() ) )
|
||||||
{
|
{
|
||||||
auto housingMgr = g_fw.get< HousingMgr >();
|
auto housingMgr = framework()->get< HousingMgr >();
|
||||||
auto landSetId = housingMgr->toLandSetId( terriPos->getTargetZoneId(), param );
|
auto landSetId = housingMgr->toLandSetId( terriPos->getTargetZoneId(), param );
|
||||||
|
|
||||||
auto housingZone = housingMgr->getHousingZoneByLandSetId( landSetId );
|
auto housingZone = housingMgr->getHousingZoneByLandSetId( landSetId );
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
#include "ForwardsZone.h"
|
#include "ForwardsZone.h"
|
||||||
|
#include "BaseManager.h"
|
||||||
|
|
||||||
namespace Sapphire::World::Manager
|
namespace Sapphire::World::Manager
|
||||||
{
|
{
|
||||||
class PlayerMgr
|
class PlayerMgr : public Manager::BaseManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
PlayerMgr( FrameworkPtr pFw );
|
||||||
|
|
||||||
void movePlayerToLandDestination( Sapphire::Entity::Player& player, uint32_t landId, uint16_t param = 0 );
|
void movePlayerToLandDestination( Sapphire::Entity::Player& player, uint32_t landId, uint16_t param = 0 );
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -5,12 +5,17 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Common.h>
|
#include <Common.h>
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
Sapphire::World::Manager::ShopMgr::ShopMgr( FrameworkPtr pFw ) :
|
||||||
|
BaseManager( pFw )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
bool Sapphire::World::Manager::ShopMgr::purchaseGilShopItem( Entity::Player& player, uint32_t shopId, uint16_t itemId, uint32_t quantity )
|
bool Sapphire::World::Manager::ShopMgr::purchaseGilShopItem( Entity::Player& player, uint32_t shopId, uint16_t itemId, uint32_t quantity )
|
||||||
{
|
{
|
||||||
auto exdData = g_fw.get< Data::ExdDataGenerated >();
|
auto exdData = framework()->get< Data::ExdDataGenerated >();
|
||||||
if( !exdData )
|
if( !exdData )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
#include "ForwardsZone.h"
|
#include "ForwardsZone.h"
|
||||||
|
#include "BaseManager.h"
|
||||||
|
|
||||||
namespace Sapphire::World::Manager
|
namespace Sapphire::World::Manager
|
||||||
{
|
{
|
||||||
class ShopMgr
|
class ShopMgr : public Manager::BaseManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
ShopMgr( FrameworkPtr pFw );
|
||||||
bool purchaseGilShopItem( Sapphire::Entity::Player& player, uint32_t shopId, uint16_t itemId, uint32_t quantity );
|
bool purchaseGilShopItem( Sapphire::Entity::Player& player, uint32_t shopId, uint16_t itemId, uint32_t quantity );
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -17,9 +17,8 @@
|
||||||
#include "Territory/House.h"
|
#include "Territory/House.h"
|
||||||
#include "Territory/Housing/HousingInteriorTerritory.h"
|
#include "Territory/Housing/HousingInteriorTerritory.h"
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
Sapphire::World::Manager::TerritoryMgr::TerritoryMgr( Sapphire::FrameworkPtr pFw ) :
|
||||||
|
BaseManager( pFw ),
|
||||||
Sapphire::World::Manager::TerritoryMgr::TerritoryMgr() :
|
|
||||||
m_lastInstanceId( 10000 )
|
m_lastInstanceId( 10000 )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -27,7 +26,7 @@ Sapphire::World::Manager::TerritoryMgr::TerritoryMgr() :
|
||||||
|
|
||||||
void Sapphire::World::Manager::TerritoryMgr::loadTerritoryTypeDetailCache()
|
void Sapphire::World::Manager::TerritoryMgr::loadTerritoryTypeDetailCache()
|
||||||
{
|
{
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = framework()->get< Data::ExdDataGenerated >();
|
||||||
auto idList = pExdData->getTerritoryTypeIdList();
|
auto idList = pExdData->getTerritoryTypeIdList();
|
||||||
|
|
||||||
for( auto id : idList )
|
for( auto id : idList )
|
||||||
|
@ -137,8 +136,8 @@ bool Sapphire::World::Manager::TerritoryMgr::isHousingTerritory( uint32_t territ
|
||||||
|
|
||||||
bool Sapphire::World::Manager::TerritoryMgr::createDefaultTerritories()
|
bool Sapphire::World::Manager::TerritoryMgr::createDefaultTerritories()
|
||||||
{
|
{
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = framework()->get< Data::ExdDataGenerated >();
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pLog = framework()->get< Logger >();
|
||||||
// for each entry in territoryTypeExd, check if it is a normal and if so, add the zone object
|
// for each entry in territoryTypeExd, check if it is a normal and if so, add the zone object
|
||||||
for( const auto& territory : m_territoryTypeDetailCacheMap )
|
for( const auto& territory : m_territoryTypeDetailCacheMap )
|
||||||
{
|
{
|
||||||
|
@ -179,8 +178,8 @@ bool Sapphire::World::Manager::TerritoryMgr::createDefaultTerritories()
|
||||||
bool Sapphire::World::Manager::TerritoryMgr::createHousingTerritories()
|
bool Sapphire::World::Manager::TerritoryMgr::createHousingTerritories()
|
||||||
{
|
{
|
||||||
//separate housing zones from default
|
//separate housing zones from default
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = framework()->get< Data::ExdDataGenerated >();
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pLog = framework()->get< Logger >();
|
||||||
for( const auto& territory : m_territoryTypeDetailCacheMap )
|
for( const auto& territory : m_territoryTypeDetailCacheMap )
|
||||||
{
|
{
|
||||||
auto territoryTypeId = territory.first;
|
auto territoryTypeId = territory.first;
|
||||||
|
@ -232,8 +231,8 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::createTerritoryInstanc
|
||||||
if( isInstanceContentTerritory( territoryTypeId ) )
|
if( isInstanceContentTerritory( territoryTypeId ) )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = framework()->get< Data::ExdDataGenerated >();
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pLog = framework()->get< Logger >();
|
||||||
auto pTeri = getTerritoryDetail( territoryTypeId );
|
auto pTeri = getTerritoryDetail( territoryTypeId );
|
||||||
auto pPlaceName = pExdData->get< Sapphire::Data::PlaceName >( pTeri->placeName );
|
auto pPlaceName = pExdData->get< Sapphire::Data::PlaceName >( pTeri->placeName );
|
||||||
|
|
||||||
|
@ -256,7 +255,7 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::createTerritoryInstanc
|
||||||
Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::createInstanceContent( uint32_t contentFinderConditionId )
|
Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::createInstanceContent( uint32_t contentFinderConditionId )
|
||||||
{
|
{
|
||||||
|
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = framework()->get< Data::ExdDataGenerated >();
|
||||||
auto pContentFinderCondition = pExdData->get< Sapphire::Data::ContentFinderCondition >( contentFinderConditionId );
|
auto pContentFinderCondition = pExdData->get< Sapphire::Data::ContentFinderCondition >( contentFinderConditionId );
|
||||||
if( !pContentFinderCondition )
|
if( !pContentFinderCondition )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -274,7 +273,7 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::createInstanceContent(
|
||||||
if( !pTeri || pInstanceContent->name.empty() )
|
if( !pTeri || pInstanceContent->name.empty() )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pLog = framework()->get< Logger >();
|
||||||
pLog->debug( "Starting instance for InstanceContent id: " + std::to_string( instanceContentId ) +
|
pLog->debug( "Starting instance for InstanceContent id: " + std::to_string( instanceContentId ) +
|
||||||
" (" + pInstanceContent->name + ")" );
|
" (" + pInstanceContent->name + ")" );
|
||||||
|
|
||||||
|
@ -301,7 +300,7 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::findOrCreateHousingInt
|
||||||
}
|
}
|
||||||
|
|
||||||
// otherwise, create it
|
// otherwise, create it
|
||||||
auto housingMgr = g_fw.get< Manager::HousingMgr >();
|
auto housingMgr = framework()->get< Manager::HousingMgr >();
|
||||||
|
|
||||||
auto parentZone = std::dynamic_pointer_cast< HousingZone >(
|
auto parentZone = std::dynamic_pointer_cast< HousingZone >(
|
||||||
getZoneByLandSetId( housingMgr->toLandSetId( static_cast< uint16_t >( landIdent.territoryTypeId ),
|
getZoneByLandSetId( housingMgr->toLandSetId( static_cast< uint16_t >( landIdent.territoryTypeId ),
|
||||||
|
@ -395,7 +394,7 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::getInstanceZonePtr( ui
|
||||||
|
|
||||||
void Sapphire::World::Manager::TerritoryMgr::loadTerritoryPositionMap()
|
void Sapphire::World::Manager::TerritoryMgr::loadTerritoryPositionMap()
|
||||||
{
|
{
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto pQR = pDb->query( "SELECT id, target_zone_id, pos_x, pos_y, pos_z, pos_o, radius FROM zonepositions;" );
|
auto pQR = pDb->query( "SELECT id, target_zone_id, pos_x, pos_y, pos_z, pos_o, radius FROM zonepositions;" );
|
||||||
|
|
||||||
while( pQR->next() )
|
while( pQR->next() )
|
||||||
|
@ -454,7 +453,7 @@ void Sapphire::World::Manager::TerritoryMgr::updateTerritoryInstances( uint32_t
|
||||||
zone->update( currentTime );
|
zone->update( currentTime );
|
||||||
}
|
}
|
||||||
|
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pLog = framework()->get< Logger >();
|
||||||
|
|
||||||
// remove internal house zones with nobody in them
|
// remove internal house zones with nobody in them
|
||||||
for( auto it = m_landIdentToZonePtrMap.begin(); it != m_landIdentToZonePtrMap.end(); )
|
for( auto it = m_landIdentToZonePtrMap.begin(); it != m_landIdentToZonePtrMap.end(); )
|
||||||
|
@ -502,7 +501,7 @@ bool Sapphire::World::Manager::TerritoryMgr::movePlayer( uint32_t territoryTypeI
|
||||||
|
|
||||||
bool Sapphire::World::Manager::TerritoryMgr::movePlayer( ZonePtr pZone, Sapphire::Entity::PlayerPtr pPlayer )
|
bool Sapphire::World::Manager::TerritoryMgr::movePlayer( ZonePtr pZone, Sapphire::Entity::PlayerPtr pPlayer )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pLog = framework()->get< Logger >();
|
||||||
if( !pZone )
|
if( !pZone )
|
||||||
{
|
{
|
||||||
pLog->error( "Zone not found on this server." );
|
pLog->error( "Zone not found on this server." );
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define SAPPHIRE_TERRITORYMGR_H
|
#define SAPPHIRE_TERRITORYMGR_H
|
||||||
|
|
||||||
#include "ForwardsZone.h"
|
#include "ForwardsZone.h"
|
||||||
|
#include "BaseManager.h"
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
|
@ -26,7 +27,7 @@ namespace Sapphire::World::Manager
|
||||||
This class manages persistent and temporary instances alike.
|
This class manages persistent and temporary instances alike.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
class TerritoryMgr
|
class TerritoryMgr : public Manager::BaseManager
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -59,7 +60,7 @@ namespace Sapphire::World::Manager
|
||||||
//Eureka = 41, // wat
|
//Eureka = 41, // wat
|
||||||
};
|
};
|
||||||
|
|
||||||
TerritoryMgr();
|
TerritoryMgr( FrameworkPtr pFw );
|
||||||
|
|
||||||
/*! initializes the territoryMgr */
|
/*! initializes the territoryMgr */
|
||||||
bool init();
|
bool init();
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
#include "Network/PacketWrappers/InitUIPacket.h"
|
#include "Network/PacketWrappers/InitUIPacket.h"
|
||||||
|
|
||||||
#include "DebugCommand/DebugCommandHandler.h"
|
#include "Manager/DebugCommandMgr.h"
|
||||||
|
|
||||||
#include "GameConnection.h"
|
#include "GameConnection.h"
|
||||||
#include "ServerMgr.h"
|
#include "ServerMgr.h"
|
||||||
|
@ -397,7 +397,7 @@ void Sapphire::Network::GameConnection::handlePackets( const Sapphire::Network::
|
||||||
const std::vector< Sapphire::Network::Packets::FFXIVARR_PACKET_RAW >& packetData )
|
const std::vector< Sapphire::Network::Packets::FFXIVARR_PACKET_RAW >& packetData )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pLog = g_fw.get< Logger >();
|
||||||
auto pServerZone = g_fw.get< ServerMgr >();
|
auto pServerZone = g_fw.get< World::ServerMgr >();
|
||||||
// if a session is set, update the last time it recieved a game packet
|
// if a session is set, update the last time it recieved a game packet
|
||||||
if( m_pSession )
|
if( m_pSession )
|
||||||
m_pSession->updateLastDataTime();
|
m_pSession->updateLastDataTime();
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace Sapphire::Network
|
||||||
HandlerMap m_chatHandlerMap;
|
HandlerMap m_chatHandlerMap;
|
||||||
HandlerStrMap m_chatHandlerStrMap;
|
HandlerStrMap m_chatHandlerStrMap;
|
||||||
|
|
||||||
SessionPtr m_pSession;
|
World::SessionPtr m_pSession;
|
||||||
|
|
||||||
LockedQueue< Sapphire::Network::Packets::FFXIVARR_PACKET_RAW > m_inQueue;
|
LockedQueue< Sapphire::Network::Packets::FFXIVARR_PACKET_RAW > m_inQueue;
|
||||||
LockedQueue< Packets::FFXIVPacketBasePtr > m_outQueue;
|
LockedQueue< Packets::FFXIVPacketBasePtr > m_outQueue;
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
#include "Network/PacketWrappers/PlayerStateFlagsPacket.h"
|
#include "Network/PacketWrappers/PlayerStateFlagsPacket.h"
|
||||||
|
|
||||||
#include "DebugCommand/DebugCommandHandler.h"
|
#include "Manager/DebugCommandMgr.h"
|
||||||
|
|
||||||
#include "Action/Action.h"
|
#include "Action/Action.h"
|
||||||
#include "Action/ActionCast.h"
|
#include "Action/ActionCast.h"
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "Network/PacketWrappers/ServerNoticePacket.h"
|
#include "Network/PacketWrappers/ServerNoticePacket.h"
|
||||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||||
|
|
||||||
#include "DebugCommand/DebugCommandHandler.h"
|
#include "Manager/DebugCommandMgr.h"
|
||||||
|
|
||||||
#include "Event/EventHelper.h"
|
#include "Event/EventHelper.h"
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ void examineHandler( Sapphire::Entity::Player& player, uint32_t targetId )
|
||||||
{
|
{
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
auto pSession = g_fw.get< Sapphire::ServerMgr >()->getSession( targetId );
|
auto pSession = g_fw.get< World::ServerMgr >()->getSession( targetId );
|
||||||
if( pSession )
|
if( pSession )
|
||||||
{
|
{
|
||||||
auto pTarget = pSession->getPlayer();
|
auto pTarget = pSession->getPlayer();
|
||||||
|
|
|
@ -552,7 +552,7 @@ void Sapphire::Network::GameConnection::gm2Handler( const Packets::FFXIVARR_PACK
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pLog = g_fw.get< Logger >();
|
||||||
auto pServerZone = g_fw.get< ServerMgr >();
|
auto pServerZone = g_fw.get< World::ServerMgr >();
|
||||||
|
|
||||||
const auto packet = ZoneChannelPacket< Client::FFXIVIpcGmCommand2 >( inPacket );
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcGmCommand2 >( inPacket );
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "Territory/Zone.h"
|
#include "Territory/Zone.h"
|
||||||
#include "Territory/ZonePosition.h"
|
#include "Territory/ZonePosition.h"
|
||||||
|
|
||||||
#include "DebugCommand/DebugCommandHandler.h"
|
#include "Manager/DebugCommandMgr.h"
|
||||||
#include "Actor/Player.h"
|
#include "Actor/Player.h"
|
||||||
|
|
||||||
#include "Session.h"
|
#include "Session.h"
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include "Network/PacketWrappers/EventFinishPacket.h"
|
#include "Network/PacketWrappers/EventFinishPacket.h"
|
||||||
#include "Network/PacketWrappers/PlayerStateFlagsPacket.h"
|
#include "Network/PacketWrappers/PlayerStateFlagsPacket.h"
|
||||||
|
|
||||||
#include "DebugCommand/DebugCommandHandler.h"
|
#include "Manager/DebugCommandMgr.h"
|
||||||
|
|
||||||
#include "Event/EventHelper.h"
|
#include "Event/EventHelper.h"
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ void Sapphire::Network::GameConnection::reqExamineSearchCommentHandler( const Pa
|
||||||
{
|
{
|
||||||
|
|
||||||
auto targetId = *reinterpret_cast< const uint32_t* >( &inPacket.data[ 0x10 ] );
|
auto targetId = *reinterpret_cast< const uint32_t* >( &inPacket.data[ 0x10 ] );
|
||||||
auto pSession = g_fw.get< Sapphire::ServerMgr >()->getSession( targetId );
|
auto pSession = g_fw.get< World::ServerMgr >()->getSession( targetId );
|
||||||
|
|
||||||
g_fw.get< Sapphire::Logger >()->debug( std::to_string( targetId ) );
|
g_fw.get< Sapphire::Logger >()->debug( std::to_string( targetId ) );
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ void Sapphire::Network::GameConnection::reqExamineFcInfo( const Packets::FFXIVAR
|
||||||
{
|
{
|
||||||
|
|
||||||
auto targetId = *reinterpret_cast< const uint32_t* >( &inPacket.data[ 0x18 ] );
|
auto targetId = *reinterpret_cast< const uint32_t* >( &inPacket.data[ 0x18 ] );
|
||||||
auto pSession = g_fw.get< Sapphire::ServerMgr >()->getSession( targetId );
|
auto pSession = g_fw.get< World::ServerMgr >()->getSession( targetId );
|
||||||
|
|
||||||
g_fw.get< Sapphire::Logger >()->debug( std::to_string( targetId ) );
|
g_fw.get< Sapphire::Logger >()->debug( std::to_string( targetId ) );
|
||||||
|
|
||||||
|
@ -528,7 +528,7 @@ void Sapphire::Network::GameConnection::socialListHandler( const Packets::FFXIVA
|
||||||
void Sapphire::Network::GameConnection::chatHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
void Sapphire::Network::GameConnection::chatHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||||
Entity::Player& player )
|
Entity::Player& player )
|
||||||
{
|
{
|
||||||
auto pDebugCom = g_fw.get< DebugCommandHandler >();
|
auto pDebugCom = g_fw.get< DebugCommandMgr >();
|
||||||
|
|
||||||
const auto packet = ZoneChannelPacket< Client::FFXIVIpcChatHandler >( inPacket );
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcChatHandler >( inPacket );
|
||||||
|
|
||||||
|
@ -600,7 +600,7 @@ void Sapphire::Network::GameConnection::tellHandler( const Packets::FFXIVARR_PAC
|
||||||
{
|
{
|
||||||
const auto packet = ZoneChannelPacket< Client::FFXIVIpcTellHandler >( inPacket );
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcTellHandler >( inPacket );
|
||||||
|
|
||||||
auto pZoneServer = g_fw.get< ServerMgr >();
|
auto pZoneServer = g_fw.get< World::ServerMgr >();
|
||||||
|
|
||||||
auto pSession = pZoneServer->getSession( packet.data().targetPCName );
|
auto pSession = pZoneServer->getSession( packet.data().targetPCName );
|
||||||
|
|
||||||
|
|
|
@ -33,17 +33,15 @@
|
||||||
#include "Manager/LinkshellMgr.h"
|
#include "Manager/LinkshellMgr.h"
|
||||||
#include "Manager/TerritoryMgr.h"
|
#include "Manager/TerritoryMgr.h"
|
||||||
#include "Manager/HousingMgr.h"
|
#include "Manager/HousingMgr.h"
|
||||||
#include "DebugCommand/DebugCommandHandler.h"
|
#include "Manager/DebugCommandMgr.h"
|
||||||
#include "Manager/PlayerMgr.h"
|
#include "Manager/PlayerMgr.h"
|
||||||
#include "Manager/ShopMgr.h"
|
#include "Manager/ShopMgr.h"
|
||||||
#include "Manager/InventoryMgr.h"
|
#include "Manager/InventoryMgr.h"
|
||||||
|
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
|
||||||
|
|
||||||
using namespace Sapphire::World::Manager;
|
using namespace Sapphire::World::Manager;
|
||||||
|
|
||||||
Sapphire::ServerMgr::ServerMgr( const std::string& configName ) :
|
Sapphire::World::ServerMgr::ServerMgr( const std::string& configName, FrameworkPtr pFw ) :
|
||||||
|
Manager::BaseManager( pFw ),
|
||||||
m_configName( configName ),
|
m_configName( configName ),
|
||||||
m_bRunning( true ),
|
m_bRunning( true ),
|
||||||
m_lastDBPingTime( 0 ),
|
m_lastDBPingTime( 0 ),
|
||||||
|
@ -51,19 +49,19 @@ Sapphire::ServerMgr::ServerMgr( const std::string& configName ) :
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::ServerMgr::~ServerMgr()
|
Sapphire::World::ServerMgr::~ServerMgr()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t Sapphire::ServerMgr::getSessionCount() const
|
size_t Sapphire::World::ServerMgr::getSessionCount() const
|
||||||
{
|
{
|
||||||
return m_sessionMapById.size();
|
return m_sessionMapById.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sapphire::ServerMgr::loadSettings( int32_t argc, char* argv[] )
|
bool Sapphire::World::ServerMgr::loadSettings( int32_t argc, char* argv[] )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Sapphire::Logger >();
|
auto pLog = framework()->get< Sapphire::Logger >();
|
||||||
auto pConfig = g_fw.get< Sapphire::ConfigMgr >();
|
auto pConfig = framework()->get< Sapphire::ConfigMgr >();
|
||||||
|
|
||||||
pLog->info( "Loading config " + m_configName );
|
pLog->info( "Loading config " + m_configName );
|
||||||
|
|
||||||
|
@ -80,7 +78,7 @@ bool Sapphire::ServerMgr::loadSettings( int32_t argc, char* argv[] )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::ServerMgr::run( int32_t argc, char* argv[] )
|
void Sapphire::World::ServerMgr::run( int32_t argc, char* argv[] )
|
||||||
{
|
{
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
using namespace Sapphire::World;
|
using namespace Sapphire::World;
|
||||||
|
@ -88,12 +86,12 @@ void Sapphire::ServerMgr::run( int32_t argc, char* argv[] )
|
||||||
auto pLog = std::make_shared< Logger >();
|
auto pLog = std::make_shared< Logger >();
|
||||||
pLog->setLogPath( "log/world" );
|
pLog->setLogPath( "log/world" );
|
||||||
pLog->init();
|
pLog->init();
|
||||||
g_fw.set< Logger >( pLog );
|
framework()->set< Logger >( pLog );
|
||||||
|
|
||||||
printBanner();
|
printBanner();
|
||||||
|
|
||||||
auto pConfig = std::make_shared< ConfigMgr >();
|
auto pConfig = std::make_shared< ConfigMgr >();
|
||||||
g_fw.set< ConfigMgr >( pConfig );
|
framework()->set< ConfigMgr >( pConfig );
|
||||||
if( !loadSettings( argc, argv ) )
|
if( !loadSettings( argc, argv ) )
|
||||||
{
|
{
|
||||||
pLog->fatal( "Unable to load settings!" );
|
pLog->fatal( "Unable to load settings!" );
|
||||||
|
@ -109,7 +107,7 @@ void Sapphire::ServerMgr::run( int32_t argc, char* argv[] )
|
||||||
pLog->fatal( "DataPath: " + dataPath );
|
pLog->fatal( "DataPath: " + dataPath );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
g_fw.set< Data::ExdDataGenerated >( pExdData );
|
framework()->set< Data::ExdDataGenerated >( pExdData );
|
||||||
|
|
||||||
Sapphire::Db::ConnectionInfo info;
|
Sapphire::Db::ConnectionInfo info;
|
||||||
info.password = pConfig->getValue< std::string >( "Database", "Password", "" );
|
info.password = pConfig->getValue< std::string >( "Database", "Password", "" );
|
||||||
|
@ -128,16 +126,16 @@ void Sapphire::ServerMgr::run( int32_t argc, char* argv[] )
|
||||||
pLog->fatal( "Database not initialized properly!" );
|
pLog->fatal( "Database not initialized properly!" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
g_fw.set< Db::DbWorkerPool< Db::ZoneDbConnection > >( pDb );
|
framework()->set< Db::DbWorkerPool< Db::ZoneDbConnection > >( pDb );
|
||||||
|
|
||||||
pLog->info( "LinkshellMgr: Caching linkshells" );
|
pLog->info( "LinkshellMgr: Caching linkshells" );
|
||||||
auto pLsMgr = std::make_shared< Manager::LinkshellMgr >();
|
auto pLsMgr = std::make_shared< Manager::LinkshellMgr >( framework() );
|
||||||
if( !pLsMgr->loadLinkshells() )
|
if( !pLsMgr->loadLinkshells() )
|
||||||
{
|
{
|
||||||
pLog->fatal( "Unable to load linkshells!" );
|
pLog->fatal( "Unable to load linkshells!" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
g_fw.set< Manager::LinkshellMgr >( pLsMgr );
|
framework()->set< Manager::LinkshellMgr >( pLsMgr );
|
||||||
|
|
||||||
auto pScript = std::make_shared< Scripting::ScriptMgr >();
|
auto pScript = std::make_shared< Scripting::ScriptMgr >();
|
||||||
if( !pScript->init() )
|
if( !pScript->init() )
|
||||||
|
@ -145,13 +143,13 @@ void Sapphire::ServerMgr::run( int32_t argc, char* argv[] )
|
||||||
pLog->fatal( "Failed to setup scripts!" );
|
pLog->fatal( "Failed to setup scripts!" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
g_fw.set< Scripting::ScriptMgr >( pScript );
|
framework()->set< Scripting::ScriptMgr >( pScript );
|
||||||
|
|
||||||
pLog->info( "TerritoryMgr: Setting up zones" );
|
pLog->info( "TerritoryMgr: Setting up zones" );
|
||||||
auto pTeriMgr = std::make_shared< Manager::TerritoryMgr >();
|
auto pTeriMgr = std::make_shared< Manager::TerritoryMgr >( framework() );
|
||||||
auto pHousingMgr = std::make_shared< Manager::HousingMgr >();
|
auto pHousingMgr = std::make_shared< Manager::HousingMgr >( framework() );
|
||||||
g_fw.set< Manager::HousingMgr >( pHousingMgr );
|
framework()->set< Manager::HousingMgr >( pHousingMgr );
|
||||||
g_fw.set< Manager::TerritoryMgr >( pTeriMgr );
|
framework()->set< Manager::TerritoryMgr >( pTeriMgr );
|
||||||
if( !pTeriMgr->init() )
|
if( !pTeriMgr->init() )
|
||||||
{
|
{
|
||||||
pLog->fatal( "Failed to setup zones!" );
|
pLog->fatal( "Failed to setup zones!" );
|
||||||
|
@ -166,15 +164,15 @@ void Sapphire::ServerMgr::run( int32_t argc, char* argv[] )
|
||||||
std::vector< std::thread > thread_list;
|
std::vector< std::thread > thread_list;
|
||||||
thread_list.emplace_back( std::thread( std::bind( &Network::Hive::Run, hive.get() ) ) );
|
thread_list.emplace_back( std::thread( std::bind( &Network::Hive::Run, hive.get() ) ) );
|
||||||
|
|
||||||
auto pDebugCom = std::make_shared< DebugCommandHandler >();
|
auto pDebugCom = std::make_shared< DebugCommandMgr >( framework() );
|
||||||
auto pPlayerMgr = std::make_shared< Manager::PlayerMgr >();
|
auto pPlayerMgr = std::make_shared< Manager::PlayerMgr >( framework() );
|
||||||
auto pShopMgr = std::make_shared< Manager::ShopMgr >();
|
auto pShopMgr = std::make_shared< Manager::ShopMgr >( framework() );
|
||||||
auto pInventoryMgr = std::make_shared< Manager::InventoryMgr >();
|
auto pInventoryMgr = std::make_shared< Manager::InventoryMgr >();
|
||||||
|
|
||||||
g_fw.set< DebugCommandHandler >( pDebugCom );
|
framework()->set< DebugCommandMgr >( pDebugCom );
|
||||||
g_fw.set< Manager::PlayerMgr >( pPlayerMgr );
|
framework()->set< Manager::PlayerMgr >( pPlayerMgr );
|
||||||
g_fw.set< Manager::ShopMgr >( pShopMgr );
|
framework()->set< Manager::ShopMgr >( pShopMgr );
|
||||||
g_fw.set< Manager::InventoryMgr >( pInventoryMgr );
|
framework()->set< Manager::InventoryMgr >( pInventoryMgr );
|
||||||
|
|
||||||
pLog->info( "World server running on " + m_ip + ":" + std::to_string( m_port ) );
|
pLog->info( "World server running on " + m_ip + ":" + std::to_string( m_port ) );
|
||||||
|
|
||||||
|
@ -187,19 +185,19 @@ void Sapphire::ServerMgr::run( int32_t argc, char* argv[] )
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t Sapphire::ServerMgr::getWorldId() const
|
uint16_t Sapphire::World::ServerMgr::getWorldId() const
|
||||||
{
|
{
|
||||||
return m_worldId;
|
return m_worldId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::ServerMgr::setWorldId( uint16_t worldId )
|
void Sapphire::World::ServerMgr::setWorldId( uint16_t worldId )
|
||||||
{
|
{
|
||||||
m_worldId = worldId;
|
m_worldId = worldId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::ServerMgr::printBanner() const
|
void Sapphire::World::ServerMgr::printBanner() const
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Sapphire::Logger >();
|
auto pLog = framework()->get< Sapphire::Logger >();
|
||||||
|
|
||||||
pLog->info( "===========================================================" );
|
pLog->info( "===========================================================" );
|
||||||
pLog->info( "Sapphire Server Project " );
|
pLog->info( "Sapphire Server Project " );
|
||||||
|
@ -209,12 +207,12 @@ void Sapphire::ServerMgr::printBanner() const
|
||||||
pLog->info( "===========================================================" );
|
pLog->info( "===========================================================" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::ServerMgr::mainLoop()
|
void Sapphire::World::ServerMgr::mainLoop()
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pLog = framework()->get< Logger >();
|
||||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
auto pTeriMgr = framework()->get< TerritoryMgr >();
|
||||||
auto pScriptMgr = g_fw.get< Scripting::ScriptMgr >();
|
auto pScriptMgr = framework()->get< Scripting::ScriptMgr >();
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
|
|
||||||
while( isRunning() )
|
while( isRunning() )
|
||||||
{
|
{
|
||||||
|
@ -290,13 +288,13 @@ void Sapphire::ServerMgr::mainLoop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sapphire::ServerMgr::createSession( uint32_t sessionId )
|
bool Sapphire::World::ServerMgr::createSession( uint32_t sessionId )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Sapphire::Logger >();
|
auto pLog = framework()->get< Sapphire::Logger >();
|
||||||
|
|
||||||
std::lock_guard< std::mutex > lock( m_sessionMutex );
|
std::lock_guard< std::mutex > lock( m_sessionMutex );
|
||||||
|
|
||||||
const std::string session_id_str = std::to_string( sessionId );
|
const auto session_id_str = std::to_string( sessionId );
|
||||||
|
|
||||||
auto it = m_sessionMapById.find( sessionId );
|
auto it = m_sessionMapById.find( sessionId );
|
||||||
|
|
||||||
|
@ -323,15 +321,14 @@ bool Sapphire::ServerMgr::createSession( uint32_t sessionId )
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::ServerMgr::removeSession( uint32_t sessionId )
|
void Sapphire::World::ServerMgr::removeSession( uint32_t sessionId )
|
||||||
{
|
{
|
||||||
m_sessionMapById.erase( sessionId );
|
m_sessionMapById.erase( sessionId );
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::SessionPtr Sapphire::ServerMgr::getSession( uint32_t id )
|
Sapphire::World::SessionPtr Sapphire::World::ServerMgr::getSession( uint32_t id )
|
||||||
{
|
{
|
||||||
//std::lock_guard<std::mutex> lock( m_sessionMutex );
|
//std::lock_guard<std::mutex> lock( m_sessionMutex );
|
||||||
|
|
||||||
auto it = m_sessionMapById.find( id );
|
auto it = m_sessionMapById.find( id );
|
||||||
|
|
||||||
if( it != m_sessionMapById.end() )
|
if( it != m_sessionMapById.end() )
|
||||||
|
@ -340,7 +337,7 @@ Sapphire::SessionPtr Sapphire::ServerMgr::getSession( uint32_t id )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::SessionPtr Sapphire::ServerMgr::getSession( const std::string& playerName )
|
Sapphire::World::SessionPtr Sapphire::World::ServerMgr::getSession( const std::string& playerName )
|
||||||
{
|
{
|
||||||
//std::lock_guard<std::mutex> lock( m_sessionMutex );
|
//std::lock_guard<std::mutex> lock( m_sessionMutex );
|
||||||
|
|
||||||
|
@ -352,18 +349,18 @@ Sapphire::SessionPtr Sapphire::ServerMgr::getSession( const std::string& playerN
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::ServerMgr::removeSession( const std::string& playerName )
|
void Sapphire::World::ServerMgr::removeSession( const std::string& playerName )
|
||||||
{
|
{
|
||||||
m_sessionMapByName.erase( playerName );
|
m_sessionMapByName.erase( playerName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Sapphire::ServerMgr::isRunning() const
|
bool Sapphire::World::ServerMgr::isRunning() const
|
||||||
{
|
{
|
||||||
return m_bRunning;
|
return m_bRunning;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Sapphire::ServerMgr::getPlayerNameFromDb( uint32_t playerId, bool forceDbLoad )
|
std::string Sapphire::World::ServerMgr::getPlayerNameFromDb( uint32_t playerId, bool forceDbLoad )
|
||||||
{
|
{
|
||||||
if( !forceDbLoad )
|
if( !forceDbLoad )
|
||||||
{
|
{
|
||||||
|
@ -373,7 +370,7 @@ std::string Sapphire::ServerMgr::getPlayerNameFromDb( uint32_t playerId, bool fo
|
||||||
return ( it->second );
|
return ( it->second );
|
||||||
}
|
}
|
||||||
|
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto res = pDb->query( "SELECT name FROM charainfo WHERE characterid = " + std::to_string( playerId ) );
|
auto res = pDb->query( "SELECT name FROM charainfo WHERE characterid = " + std::to_string( playerId ) );
|
||||||
|
|
||||||
if( !res->next() )
|
if( !res->next() )
|
||||||
|
@ -385,16 +382,16 @@ std::string Sapphire::ServerMgr::getPlayerNameFromDb( uint32_t playerId, bool fo
|
||||||
return playerName;
|
return playerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::ServerMgr::updatePlayerName( uint32_t playerId, const std::string & playerNewName )
|
void Sapphire::World::ServerMgr::updatePlayerName( uint32_t playerId, const std::string & playerNewName )
|
||||||
{
|
{
|
||||||
m_playerNameMapById[ playerId ] = playerNewName;
|
m_playerNameMapById[ playerId ] = playerNewName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::ServerMgr::loadBNpcTemplates()
|
void Sapphire::World::ServerMgr::loadBNpcTemplates()
|
||||||
{
|
{
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
auto pTeriMgr = framework()->get< TerritoryMgr >();
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pLog = framework()->get< Logger >();
|
||||||
|
|
||||||
auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::ZONE_SEL_BNPCTEMPLATES );
|
auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::ZONE_SEL_BNPCTEMPLATES );
|
||||||
|
|
||||||
|
@ -433,7 +430,7 @@ void Sapphire::ServerMgr::loadBNpcTemplates()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::Entity::BNpcTemplatePtr Sapphire::ServerMgr::getBNpcTemplate( const std::string& key )
|
Sapphire::Entity::BNpcTemplatePtr Sapphire::World::ServerMgr::getBNpcTemplate( const std::string& key )
|
||||||
{
|
{
|
||||||
auto it = m_bNpcTemplateMap.find( key );
|
auto it = m_bNpcTemplateMap.find( key );
|
||||||
|
|
||||||
|
@ -443,7 +440,7 @@ Sapphire::Entity::BNpcTemplatePtr Sapphire::ServerMgr::getBNpcTemplate( const st
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::Entity::BNpcTemplatePtr Sapphire::ServerMgr::getBNpcTemplate( uint32_t id )
|
Sapphire::Entity::BNpcTemplatePtr Sapphire::World::ServerMgr::getBNpcTemplate( uint32_t id )
|
||||||
{
|
{
|
||||||
for( auto entry : m_bNpcTemplateMap )
|
for( auto entry : m_bNpcTemplateMap )
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,18 +5,18 @@
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "ForwardsZone.h"
|
#include "ForwardsZone.h"
|
||||||
|
#include "Manager/BaseManager.h"
|
||||||
|
|
||||||
namespace Sapphire
|
namespace Sapphire::World
|
||||||
{
|
{
|
||||||
|
|
||||||
class ServerMgr
|
class ServerMgr : public Manager::BaseManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ServerMgr( const std::string& configName );
|
ServerMgr( const std::string& configName, FrameworkPtr pFw );
|
||||||
|
|
||||||
~ServerMgr();
|
~ServerMgr() override;
|
||||||
|
|
||||||
void run( int32_t argc, char* argv[] );
|
void run( int32_t argc, char* argv[] );
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@ namespace Sapphire
|
||||||
void removeSession( uint32_t sessionId );
|
void removeSession( uint32_t sessionId );
|
||||||
void removeSession( const std::string& playerName );
|
void removeSession( const std::string& playerName );
|
||||||
|
|
||||||
SessionPtr getSession( uint32_t id );
|
World::SessionPtr getSession( uint32_t id );
|
||||||
SessionPtr getSession( const std::string& playerName );
|
World::SessionPtr getSession( const std::string& playerName );
|
||||||
|
|
||||||
size_t getSessionCount() const;
|
size_t getSessionCount() const;
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
extern Sapphire::Framework g_fw;
|
extern Sapphire::Framework g_fw;
|
||||||
namespace fs = std::experimental::filesystem;
|
namespace fs = std::experimental::filesystem;
|
||||||
|
|
||||||
Sapphire::Session::Session( uint32_t sessionId ) :
|
Sapphire::World::Session::Session( uint32_t sessionId ) :
|
||||||
m_sessionId( sessionId ),
|
m_sessionId( sessionId ),
|
||||||
m_lastDataTime( Util::getTimeSeconds() ),
|
m_lastDataTime( Util::getTimeSeconds() ),
|
||||||
m_lastSqlTime( Util::getTimeSeconds() ),
|
m_lastSqlTime( Util::getTimeSeconds() ),
|
||||||
|
@ -23,34 +23,34 @@ Sapphire::Session::Session( uint32_t sessionId ) :
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::Session::~Session()
|
Sapphire::World::Session::~Session()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Session::setZoneConnection( Network::GameConnectionPtr pZoneCon )
|
void Sapphire::World::Session::setZoneConnection( Network::GameConnectionPtr pZoneCon )
|
||||||
{
|
{
|
||||||
pZoneCon->m_conType = Network::ConnectionType::Zone;
|
pZoneCon->m_conType = Network::ConnectionType::Zone;
|
||||||
m_pZoneConnection = pZoneCon;
|
m_pZoneConnection = pZoneCon;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Session::setChatConnection( Network::GameConnectionPtr pChatCon )
|
void Sapphire::World::Session::setChatConnection( Network::GameConnectionPtr pChatCon )
|
||||||
{
|
{
|
||||||
pChatCon->m_conType = Network::ConnectionType::Chat;
|
pChatCon->m_conType = Network::ConnectionType::Chat;
|
||||||
m_pChatConnection = pChatCon;
|
m_pChatConnection = pChatCon;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::Network::GameConnectionPtr Sapphire::Session::getZoneConnection() const
|
Sapphire::Network::GameConnectionPtr Sapphire::World::Session::getZoneConnection() const
|
||||||
{
|
{
|
||||||
return m_pZoneConnection;
|
return m_pZoneConnection;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::Network::GameConnectionPtr Sapphire::Session::getChatConnection() const
|
Sapphire::Network::GameConnectionPtr Sapphire::World::Session::getChatConnection() const
|
||||||
{
|
{
|
||||||
return m_pChatConnection;
|
return m_pChatConnection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Sapphire::Session::loadPlayer()
|
bool Sapphire::World::Session::loadPlayer()
|
||||||
{
|
{
|
||||||
|
|
||||||
m_pPlayer = Entity::make_Player();
|
m_pPlayer = Entity::make_Player();
|
||||||
|
@ -67,7 +67,7 @@ bool Sapphire::Session::loadPlayer()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Session::close()
|
void Sapphire::World::Session::close()
|
||||||
{
|
{
|
||||||
if( m_pZoneConnection )
|
if( m_pZoneConnection )
|
||||||
m_pZoneConnection->Disconnect();
|
m_pZoneConnection->Disconnect();
|
||||||
|
@ -85,37 +85,37 @@ void Sapphire::Session::close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Sapphire::Session::getId() const
|
uint32_t Sapphire::World::Session::getId() const
|
||||||
{
|
{
|
||||||
return m_sessionId;
|
return m_sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t Sapphire::Session::getLastDataTime() const
|
int64_t Sapphire::World::Session::getLastDataTime() const
|
||||||
{
|
{
|
||||||
return m_lastDataTime;
|
return m_lastDataTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t Sapphire::Session::getLastSqlTime() const
|
int64_t Sapphire::World::Session::getLastSqlTime() const
|
||||||
{
|
{
|
||||||
return m_lastSqlTime;
|
return m_lastSqlTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sapphire::Session::isValid() const
|
bool Sapphire::World::Session::isValid() const
|
||||||
{
|
{
|
||||||
return m_isValid;
|
return m_isValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Session::updateLastDataTime()
|
void Sapphire::World::Session::updateLastDataTime()
|
||||||
{
|
{
|
||||||
m_lastDataTime = Util::getTimeSeconds();
|
m_lastDataTime = Util::getTimeSeconds();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Session::updateLastSqlTime()
|
void Sapphire::World::Session::updateLastSqlTime()
|
||||||
{
|
{
|
||||||
m_lastSqlTime = Util::getTimeSeconds();
|
m_lastSqlTime = Util::getTimeSeconds();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Session::startReplay( const std::string& path )
|
void Sapphire::World::Session::startReplay( const std::string& path )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pLog = g_fw.get< Logger >();
|
||||||
if( !fs::exists( path ) )
|
if( !fs::exists( path ) )
|
||||||
|
@ -161,13 +161,13 @@ void Sapphire::Session::startReplay( const std::string& path )
|
||||||
m_isReplaying = true;
|
m_isReplaying = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Session::stopReplay()
|
void Sapphire::World::Session::stopReplay()
|
||||||
{
|
{
|
||||||
m_isReplaying = false;
|
m_isReplaying = false;
|
||||||
m_replayCache.clear();
|
m_replayCache.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Session::processReplay()
|
void Sapphire::World::Session::processReplay()
|
||||||
{
|
{
|
||||||
int at = 0;
|
int at = 0;
|
||||||
for( const auto& set : m_replayCache )
|
for( const auto& set : m_replayCache )
|
||||||
|
@ -185,7 +185,7 @@ void Sapphire::Session::processReplay()
|
||||||
m_isReplaying = false;
|
m_isReplaying = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Session::sendReplayInfo()
|
void Sapphire::World::Session::sendReplayInfo()
|
||||||
{
|
{
|
||||||
std::string message = std::to_string( m_replayCache.size() ) + " Sets left in cache, ";
|
std::string message = std::to_string( m_replayCache.size() ) + " Sets left in cache, ";
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ void Sapphire::Session::sendReplayInfo()
|
||||||
getPlayer()->sendDebug( message );
|
getPlayer()->sendDebug( message );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Session::update()
|
void Sapphire::World::Session::update()
|
||||||
{
|
{
|
||||||
if( m_isReplaying )
|
if( m_isReplaying )
|
||||||
processReplay();
|
processReplay();
|
||||||
|
@ -226,7 +226,7 @@ void Sapphire::Session::update()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::Entity::PlayerPtr Sapphire::Session::getPlayer() const
|
Sapphire::Entity::PlayerPtr Sapphire::World::Session::getPlayer() const
|
||||||
{
|
{
|
||||||
return m_pPlayer;
|
return m_pPlayer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,12 @@
|
||||||
|
|
||||||
#include "ForwardsZone.h"
|
#include "ForwardsZone.h"
|
||||||
|
|
||||||
namespace Sapphire {
|
namespace Sapphire::World
|
||||||
|
|
||||||
class Session :
|
|
||||||
public std::enable_shared_from_this< Session >
|
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
|
class Session : public std::enable_shared_from_this< Session >
|
||||||
|
{
|
||||||
|
public:
|
||||||
Session( uint32_t sessionId );
|
Session( uint32_t sessionId );
|
||||||
|
|
||||||
~Session();
|
~Session();
|
||||||
|
@ -51,7 +51,7 @@ public:
|
||||||
|
|
||||||
Entity::PlayerPtr getPlayer() const;
|
Entity::PlayerPtr getPlayer() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t m_sessionId;
|
uint32_t m_sessionId;
|
||||||
|
|
||||||
Entity::PlayerPtr m_pPlayer;
|
Entity::PlayerPtr m_pPlayer;
|
||||||
|
@ -67,7 +67,7 @@ private:
|
||||||
Network::GameConnectionPtr m_pZoneConnection;
|
Network::GameConnectionPtr m_pZoneConnection;
|
||||||
Network::GameConnectionPtr m_pChatConnection;
|
Network::GameConnectionPtr m_pChatConnection;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -223,7 +223,7 @@ void Sapphire::Zone::pushActor( Entity::ActorPtr pActor )
|
||||||
{
|
{
|
||||||
auto pPlayer = pActor->getAsPlayer();
|
auto pPlayer = pActor->getAsPlayer();
|
||||||
|
|
||||||
auto pServerZone = g_fw.get< ServerMgr >();
|
auto pServerZone = g_fw.get< World::ServerMgr >();
|
||||||
auto pSession = pServerZone->getSession( pPlayer->getId() );
|
auto pSession = pServerZone->getSession( pPlayer->getId() );
|
||||||
if( pSession )
|
if( pSession )
|
||||||
m_sessionSet.insert( pSession );
|
m_sessionSet.insert( pSession );
|
||||||
|
@ -285,7 +285,7 @@ void Sapphire::Zone::queuePacketForRange( Entity::Player& sourcePlayer, uint32_t
|
||||||
if( pTeriMgr->isPrivateTerritory( getTerritoryTypeId() ) )
|
if( pTeriMgr->isPrivateTerritory( getTerritoryTypeId() ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto pServerZone = g_fw.get< ServerMgr >();
|
auto pServerZone = g_fw.get< World::ServerMgr >();
|
||||||
for( auto entry : m_playerMap )
|
for( auto entry : m_playerMap )
|
||||||
{
|
{
|
||||||
auto player = entry.second;
|
auto player = entry.second;
|
||||||
|
@ -311,7 +311,7 @@ void Sapphire::Zone::queuePacketForZone( Entity::Player& sourcePlayer,
|
||||||
if( pTeriMgr->isPrivateTerritory( getTerritoryTypeId() ) )
|
if( pTeriMgr->isPrivateTerritory( getTerritoryTypeId() ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto pServerZone = g_fw.get< ServerMgr >();
|
auto pServerZone = g_fw.get< World::ServerMgr >();
|
||||||
for( auto entry : m_playerMap )
|
for( auto entry : m_playerMap )
|
||||||
{
|
{
|
||||||
auto player = entry.second;
|
auto player = entry.second;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "Cell.h"
|
#include "Cell.h"
|
||||||
#include "CellHandler.h"
|
#include "CellHandler.h"
|
||||||
|
|
||||||
#include "Forwards.h"
|
#include "ForwardsZone.h"
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
@ -19,11 +19,9 @@
|
||||||
namespace Sapphire
|
namespace Sapphire
|
||||||
{
|
{
|
||||||
|
|
||||||
class Session;
|
|
||||||
|
|
||||||
class ZonePosition;
|
class ZonePosition;
|
||||||
|
|
||||||
using SessionSet = std::set< SessionPtr >;
|
using SessionSet = std::set< World::SessionPtr >;
|
||||||
using FestivalPair = std::pair< uint16_t, uint16_t >;
|
using FestivalPair = std::pair< uint16_t, uint16_t >;
|
||||||
|
|
||||||
namespace Data
|
namespace Data
|
||||||
|
|
|
@ -12,7 +12,8 @@ using namespace Sapphire::World;
|
||||||
|
|
||||||
bool setupFramework()
|
bool setupFramework()
|
||||||
{
|
{
|
||||||
auto pServer = std::make_shared< ServerMgr >( "config.ini" );
|
auto pFramework = Sapphire::make_Framework();
|
||||||
|
auto pServer = std::make_shared< ServerMgr >( "config.ini", pFramework );
|
||||||
g_fw.set< ServerMgr >( pServer );
|
g_fw.set< ServerMgr >( pServer );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue