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"
|
2017-08-18 17:16:15 +02:00
|
|
|
#include "src/servers/Server_Zone/Actor/BattleNpcTemplate.h"
|
2017-08-08 13:53:47 +02:00
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
|
|
|
|
class ServerZone
|
|
|
|
{
|
|
|
|
public:
|
2017-10-28 22:47:25 +02:00
|
|
|
ServerZone( const std::string& configPath );
|
2017-08-08 13:53:47 +02:00
|
|
|
~ServerZone();
|
|
|
|
|
2017-08-11 22:56:30 +01:00
|
|
|
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 );
|
|
|
|
|
2017-08-11 22:56:30 +01:00
|
|
|
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;
|
|
|
|
|
2017-10-03 12:09:51 +02:00
|
|
|
void printBanner() const;
|
|
|
|
|
2017-08-08 13:53:47 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
uint16_t m_port;
|
|
|
|
std::string m_ip;
|
2017-11-20 23:24:50 +01:00
|
|
|
uint32_t m_lastDBPingTime;
|
2017-08-08 13:53:47 +02:00
|
|
|
|
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
|
|
|
|
|