1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-25 14:07:46 +00:00
sapphire/src/servers/Server_Zone/ServerZone.h

76 lines
1.7 KiB
C
Raw Normal View History

2017-08-08 13:53:47 +02:00
#ifndef __GAMESERVER_H
#define __GAMESERVER_H
2017-08-19 00:18:40 +02:00
#include <src/servers/Server_Common/Common.h>
2017-08-08 13:53:47 +02:00
#include <boost/shared_ptr.hpp>
#include <mutex>
#include <map>
#include "Forwards.h"
#include "src/servers/Server_Zone/Actor/BattleNpcTemplate.h"
2017-08-08 13:53:47 +02:00
namespace Core {
class ServerZone
{
public:
ServerZone( const std::string& configPath, uint16_t serverId = 0 );
~ServerZone();
void run( int32_t argc, char* argv[] );
2017-08-08 13:53:47 +02:00
bool createSession( uint32_t sessionId );
void removeSession( uint32_t sessionId );
void removeSession( std::string playerName );
bool loadSettings( int32_t argc, char* argv[] );
2017-08-08 13:53:47 +02:00
SessionPtr getSession( uint32_t id );
SessionPtr getSession( std::string playerName );
void updateSession( uint32_t id );
void updateSession( std::string playerName );
XMLConfigPtr getConfig() const;
2017-09-14 17:28:24 +02:00
size_t getSessionCount() const;
2017-09-14 17:07:58 +02:00
2017-08-08 13:53:47 +02:00
bool registerBnpcTemplate( std::string templateName, uint32_t bnpcBaseId,
uint32_t bnpcNameId, uint32_t modelId, std::string aiName );
Entity::BattleNpcTemplatePtr getBnpcTemplate( std::string templateName );
2017-10-01 17:58:11 +02:00
void mainLoop();
bool isRunning() const;
void printBanner() const;
2017-08-08 13:53:47 +02:00
private:
uint16_t m_port;
std::string m_ip;
2017-10-01 17:58:11 +02:00
bool m_bRunning;
2017-08-08 13:53:47 +02:00
std::string m_configPath;
XMLConfigPtr m_pConfig;
std::mutex m_sessionMutex;
std::map< uint32_t, SessionPtr > m_sessionMap;
std::map< std::string, SessionPtr > m_playerSessionMap;
std::map< uint32_t, uint32_t > m_zones;
std::map< std::string, Entity::BattleNpcTemplatePtr > m_bnpcTemplates;
};
}
#endif