1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-24 21:57:44 +00:00
sapphire/src/servers/sapphire_zone/ServerZone.h

69 lines
1.2 KiB
C
Raw Normal View History

2017-08-08 13:53:47 +02:00
#ifndef __GAMESERVER_H
#define __GAMESERVER_H
2018-03-06 22:22:19 +01:00
#include <Common.h>
2017-08-08 13:53:47 +02:00
#include <boost/shared_ptr.hpp>
#include <mutex>
#include <map>
#include "ForwardsZone.h"
2017-08-08 13:53:47 +02:00
namespace Core {
class ServerZone
{
public:
ServerZone( const std::string& configName );
2017-08-08 13:53:47 +02:00
~ServerZone();
2017-08-08 13:53:47 +02:00
void run( int32_t argc, char* argv[] );
2017-08-08 13:53:47 +02:00
bool createSession( uint32_t sessionId );
2017-08-08 13:53:47 +02:00
void removeSession( uint32_t sessionId );
void removeSession( const std::string& playerName );
2017-10-01 17:58:11 +02:00
SessionPtr getSession( uint32_t id );
SessionPtr getSession( const std::string& playerName );
size_t getSessionCount() const;
2017-08-08 13:53:47 +02:00
void mainLoop();
2017-08-08 13:53:47 +02:00
bool isRunning() const;
2017-10-01 17:58:11 +02:00
void printBanner() const;
2017-08-08 13:53:47 +02:00
bool loadSettings( int32_t argc, char* argv[] );
void loadBNpcTemplates();
Entity::BNpcTemplatePtr getBNpcTemplate( const std::string& key );
Entity::BNpcTemplatePtr getBNpcTemplate( uint32_t id );
2017-08-08 13:53:47 +02:00
private:
uint16_t m_port;
std::string m_ip;
int64_t m_lastDBPingTime;
2017-08-08 13:53:47 +02:00
bool m_bRunning;
2017-08-08 13:53:47 +02:00
std::string m_configName;
std::mutex m_sessionMutex;
std::map< uint32_t, SessionPtr > m_sessionMapById;
std::map< std::string, SessionPtr > m_sessionMapByName;
std::map< uint32_t, uint32_t > m_zones;
std::map< std::string, Entity::BNpcTemplatePtr > m_bNpcTemplateMap;
};
2017-08-08 13:53:47 +02:00
}
#endif