mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-25 05:57:45 +00:00
Refactoring and modernizing
This commit is contained in:
parent
5182439403
commit
13dc04ebb5
425 changed files with 6922 additions and 6542 deletions
1389
src/common/Common.h
1389
src/common/Common.h
File diff suppressed because it is too large
Load diff
|
@ -7,63 +7,64 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core
|
||||||
class ConfigMgr
|
|
||||||
{
|
{
|
||||||
public:
|
class ConfigMgr
|
||||||
ConfigMgr() = default;
|
{
|
||||||
|
public:
|
||||||
|
ConfigMgr() = default;
|
||||||
|
|
||||||
~ConfigMgr() = default;
|
~ConfigMgr() = default;
|
||||||
|
|
||||||
bool loadConfig( const std::string& configName );
|
bool loadConfig( const std::string& configName );
|
||||||
|
|
||||||
template<class T> struct always_false : std::false_type {};
|
|
||||||
|
|
||||||
template< class T >
|
template<class T> struct always_false : std::false_type {};
|
||||||
T getValue( const std::string& section, const std::string& name, T defaultValue = T() )
|
|
||||||
{
|
|
||||||
if constexpr (std::is_same_v<T, uint32_t>)
|
|
||||||
return m_pInih->GetInteger( section, name, defaultValue );
|
|
||||||
else if constexpr (std::is_same_v<T, int32_t>)
|
|
||||||
return m_pInih->GetInteger( section, name, defaultValue );
|
|
||||||
else if constexpr (std::is_same_v<T, uint16_t>)
|
|
||||||
return m_pInih->GetInteger( section, name, defaultValue );
|
|
||||||
else if constexpr (std::is_same_v<T, int16_t>)
|
|
||||||
return m_pInih->GetInteger( section, name, defaultValue );
|
|
||||||
else if constexpr (std::is_same_v<T, uint8_t>)
|
|
||||||
return m_pInih->GetInteger( section, name, defaultValue );
|
|
||||||
else if constexpr (std::is_same_v<T, int8_t>)
|
|
||||||
return m_pInih->GetInteger( section, name, defaultValue );
|
|
||||||
else if constexpr (std::is_same_v<T, long>)
|
|
||||||
return m_pInih->GetInteger( section, name, defaultValue );
|
|
||||||
else if constexpr (std::is_same_v<T, double>)
|
|
||||||
return m_pInih->GetReal( section, name, defaultValue );
|
|
||||||
else if constexpr (std::is_same_v<T, float>)
|
|
||||||
return m_pInih->GetReal( section, name, defaultValue );
|
|
||||||
else if constexpr (std::is_same_v<T, std::string>)
|
|
||||||
return m_pInih->Get( section, name, defaultValue );
|
|
||||||
else if constexpr (std::is_same_v<T, bool>)
|
|
||||||
return m_pInih->GetBoolean( section, name, defaultValue );
|
|
||||||
else
|
|
||||||
static_assert(always_false<T>::value, "non-exhaustive getter!");
|
|
||||||
}
|
|
||||||
|
|
||||||
template< class T >
|
template< class T >
|
||||||
void setValue( const std::string& name, T defaultValue = T() )
|
T getValue( const std::string& section, const std::string& name, T defaultValue = T() )
|
||||||
{
|
{
|
||||||
// TODO: reimplement this...
|
if constexpr (std::is_same_v<T, uint32_t>)
|
||||||
//m_propTree.put( name, defaultValue );
|
return m_pInih->GetInteger( section, name, defaultValue );
|
||||||
}
|
else if constexpr (std::is_same_v<T, int32_t>)
|
||||||
|
return m_pInih->GetInteger( section, name, defaultValue );
|
||||||
|
else if constexpr (std::is_same_v<T, uint16_t>)
|
||||||
|
return m_pInih->GetInteger( section, name, defaultValue );
|
||||||
|
else if constexpr (std::is_same_v<T, int16_t>)
|
||||||
|
return m_pInih->GetInteger( section, name, defaultValue );
|
||||||
|
else if constexpr (std::is_same_v<T, uint8_t>)
|
||||||
|
return m_pInih->GetInteger( section, name, defaultValue );
|
||||||
|
else if constexpr (std::is_same_v<T, int8_t>)
|
||||||
|
return m_pInih->GetInteger( section, name, defaultValue );
|
||||||
|
else if constexpr (std::is_same_v<T, long>)
|
||||||
|
return m_pInih->GetInteger( section, name, defaultValue );
|
||||||
|
else if constexpr (std::is_same_v<T, double>)
|
||||||
|
return m_pInih->GetReal( section, name, defaultValue );
|
||||||
|
else if constexpr (std::is_same_v<T, float>)
|
||||||
|
return m_pInih->GetReal( section, name, defaultValue );
|
||||||
|
else if constexpr (std::is_same_v<T, std::string>)
|
||||||
|
return m_pInih->Get( section, name, defaultValue );
|
||||||
|
else if constexpr (std::is_same_v<T, bool>)
|
||||||
|
return m_pInih->GetBoolean( section, name, defaultValue );
|
||||||
|
else
|
||||||
|
static_assert(always_false<T>::value, "non-exhaustive getter!");
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
template< class T >
|
||||||
bool copyDefaultConfig( const std::string& configName );
|
void setValue( const std::string& name, T defaultValue = T() )
|
||||||
|
{
|
||||||
|
// TODO: reimplement this...
|
||||||
|
//m_propTree.put( name, defaultValue );
|
||||||
|
}
|
||||||
|
|
||||||
std::unique_ptr< INIReader > m_pInih;
|
private:
|
||||||
|
bool copyDefaultConfig( const std::string& configName );
|
||||||
|
|
||||||
const std::string m_globalConfigFile = "global.ini";
|
std::unique_ptr< INIReader > m_pInih;
|
||||||
const std::string m_configFolderRoot = "./config/";
|
|
||||||
const std::string m_configDefaultSuffix = ".default";
|
const std::string m_globalConfigFile = "global.ini";
|
||||||
};
|
const std::string m_configFolderRoot = "./config/";
|
||||||
|
const std::string m_configDefaultSuffix = ".default";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //SAPPHIRE_CONFIGMGR_H
|
#endif //SAPPHIRE_CONFIGMGR_H
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core::Util
|
||||||
namespace Util {
|
{
|
||||||
std::string base64_encode( uint8_t const*, uint32_t len );
|
std::string base64_encode( uint8_t const*, uint32_t len );
|
||||||
|
|
||||||
std::string base64_decode( std::string const& s );
|
std::string base64_decode( const std::string& s );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,25 +3,25 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core::Util
|
||||||
namespace Util {
|
|
||||||
using md5_context = struct
|
|
||||||
{
|
{
|
||||||
uint32_t total[2];
|
using md5_context = struct
|
||||||
uint32_t state[4];
|
{
|
||||||
uint8_t buffer[64];
|
uint32_t total[2];
|
||||||
};
|
uint32_t state[4];
|
||||||
|
uint8_t buffer[64];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
void md5( uint8_t* text, uint8_t* hash, int32_t size );
|
void md5( uint8_t* text, uint8_t* hash, int32_t size );
|
||||||
|
|
||||||
void md5_starts( md5_context* ctx );
|
void md5_starts( md5_context* ctx );
|
||||||
|
|
||||||
void md5_update( md5_context* ctx, uint8_t* input, uint32_t length );
|
void md5_update( md5_context* ctx, uint8_t* input, uint32_t length );
|
||||||
|
|
||||||
void md5_finish( md5_context* ctx, uint8_t digest[16] );
|
void md5_finish( md5_context* ctx, uint8_t digest[16] );
|
||||||
|
|
||||||
static const char* msg[] =
|
static const char* msg[] =
|
||||||
{
|
{
|
||||||
"",
|
"",
|
||||||
"a",
|
"a",
|
||||||
|
@ -33,7 +33,7 @@ static const char* msg[] =
|
||||||
"345678901234567890"
|
"345678901234567890"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char* val[] =
|
static const char* val[] =
|
||||||
{
|
{
|
||||||
"d41d8cd98f00b204e9800998ecf8427e",
|
"d41d8cd98f00b204e9800998ecf8427e",
|
||||||
"0cc175b9c0f1b6a831c399e269772661",
|
"0cc175b9c0f1b6a831c399e269772661",
|
||||||
|
@ -45,7 +45,7 @@ static const char* val[] =
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* md5.h */
|
#endif /* md5.h */
|
||||||
|
|
|
@ -8,120 +8,112 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "Util/LockedWaitQueue.h"
|
#include "Util/LockedWaitQueue.h"
|
||||||
|
|
||||||
namespace Mysql {
|
namespace Mysql
|
||||||
class Connection;
|
{
|
||||||
|
class Connection;
|
||||||
class ResultSet;
|
class ResultSet;
|
||||||
|
class PreparedResultSet;
|
||||||
class PreparedResultSet;
|
class PreparedStatement;
|
||||||
|
|
||||||
class PreparedStatement;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Core {
|
namespace Core::Db
|
||||||
namespace Db {
|
|
||||||
class DatabaseWorker;
|
|
||||||
|
|
||||||
class PreparedStatement;
|
|
||||||
|
|
||||||
class Operation;
|
|
||||||
|
|
||||||
class DbWorker;
|
|
||||||
|
|
||||||
using PreparedStmtScopedPtr = std::unique_ptr< PreparedStatement >;
|
|
||||||
|
|
||||||
enum ConnectionFlags
|
|
||||||
{
|
{
|
||||||
CONNECTION_ASYNC = 0x1,
|
class DatabaseWorker;
|
||||||
CONNECTION_SYNC = 0x2,
|
class PreparedStatement;
|
||||||
CONNECTION_BOTH = CONNECTION_ASYNC | CONNECTION_SYNC
|
class Operation;
|
||||||
};
|
class DbWorker;
|
||||||
|
using PreparedStmtScopedPtr = std::unique_ptr< PreparedStatement >;
|
||||||
|
|
||||||
struct ConnectionInfo
|
enum ConnectionFlags
|
||||||
{
|
|
||||||
std::string user;
|
|
||||||
std::string password;
|
|
||||||
std::string database;
|
|
||||||
std::string host;
|
|
||||||
uint16_t port;
|
|
||||||
uint8_t syncThreads;
|
|
||||||
uint8_t asyncThreads;
|
|
||||||
};
|
|
||||||
|
|
||||||
using PreparedStatementMap = std::map< uint32_t, std::pair< std::string, ConnectionFlags > >;
|
|
||||||
|
|
||||||
class DbConnection :
|
|
||||||
public std::enable_shared_from_this< DbConnection >
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// Constructor for synchronous connections.
|
|
||||||
DbConnection( ConnectionInfo& connInfo );
|
|
||||||
|
|
||||||
// Constructor for asynchronous connections.
|
|
||||||
DbConnection( Core::LockedWaitQueue< std::shared_ptr< Operation > >* queue, ConnectionInfo& connInfo );
|
|
||||||
|
|
||||||
virtual ~DbConnection();
|
|
||||||
|
|
||||||
virtual uint32_t open();
|
|
||||||
|
|
||||||
void close();
|
|
||||||
|
|
||||||
bool prepareStatements();
|
|
||||||
|
|
||||||
bool execute( const std::string& sql );
|
|
||||||
|
|
||||||
bool execute( std::shared_ptr< PreparedStatement > stmt );
|
|
||||||
|
|
||||||
std::shared_ptr< Mysql::ResultSet > query( const std::string& sql );
|
|
||||||
|
|
||||||
std::shared_ptr< Mysql::ResultSet > query( std::shared_ptr< PreparedStatement > stmt );
|
|
||||||
|
|
||||||
void beginTransaction();
|
|
||||||
|
|
||||||
void rollbackTransaction();
|
|
||||||
|
|
||||||
void commitTransaction();
|
|
||||||
|
|
||||||
bool ping();
|
|
||||||
|
|
||||||
uint32_t getLastError();
|
|
||||||
|
|
||||||
bool lockIfReady();
|
|
||||||
|
|
||||||
void unlock();
|
|
||||||
|
|
||||||
std::shared_ptr< Mysql::Connection > getConnection()
|
|
||||||
{
|
{
|
||||||
return m_pConnection;
|
CONNECTION_ASYNC = 0x1,
|
||||||
}
|
CONNECTION_SYNC = 0x2,
|
||||||
|
CONNECTION_BOTH = CONNECTION_ASYNC | CONNECTION_SYNC
|
||||||
|
};
|
||||||
|
|
||||||
std::shared_ptr< Mysql::PreparedStatement > getPreparedStatement( uint32_t index );
|
struct ConnectionInfo
|
||||||
|
{
|
||||||
|
std::string user;
|
||||||
|
std::string password;
|
||||||
|
std::string database;
|
||||||
|
std::string host;
|
||||||
|
uint16_t port;
|
||||||
|
uint8_t syncThreads;
|
||||||
|
uint8_t asyncThreads;
|
||||||
|
};
|
||||||
|
|
||||||
void prepareStatement( uint32_t index, const std::string& sql, ConnectionFlags flags );
|
using PreparedStatementMap = std::map< uint32_t, std::pair< std::string, ConnectionFlags > >;
|
||||||
|
|
||||||
virtual void doPrepareStatements() = 0;
|
class DbConnection :
|
||||||
|
public std::enable_shared_from_this< DbConnection >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// Constructor for synchronous connections.
|
||||||
|
DbConnection( ConnectionInfo& connInfo );
|
||||||
|
|
||||||
protected:
|
// Constructor for asynchronous connections.
|
||||||
std::vector< std::shared_ptr< Mysql::PreparedStatement > > m_stmts;
|
DbConnection( Core::LockedWaitQueue< std::shared_ptr< Operation > >* queue, ConnectionInfo& connInfo );
|
||||||
PreparedStatementMap m_queries;
|
|
||||||
bool m_reconnecting;
|
|
||||||
bool m_prepareError;
|
|
||||||
|
|
||||||
private:
|
virtual ~DbConnection();
|
||||||
LockedWaitQueue< std::shared_ptr< Operation > >* m_queue;
|
|
||||||
std::shared_ptr< DbWorker > m_worker;
|
|
||||||
std::shared_ptr< Mysql::Connection > m_pConnection;
|
|
||||||
ConnectionInfo& m_connectionInfo;
|
|
||||||
ConnectionFlags m_connectionFlags;
|
|
||||||
std::mutex m_mutex;
|
|
||||||
|
|
||||||
DbConnection( DbConnection const& right ) = delete;
|
virtual uint32_t open();
|
||||||
|
|
||||||
DbConnection& operator=( DbConnection const& right ) = delete;
|
void close();
|
||||||
};
|
|
||||||
|
bool prepareStatements();
|
||||||
|
|
||||||
|
bool execute( const std::string& sql );
|
||||||
|
|
||||||
|
bool execute( std::shared_ptr< PreparedStatement > stmt );
|
||||||
|
|
||||||
|
std::shared_ptr< Mysql::ResultSet > query( const std::string& sql );
|
||||||
|
|
||||||
|
std::shared_ptr< Mysql::ResultSet > query( std::shared_ptr< PreparedStatement > stmt );
|
||||||
|
|
||||||
|
void beginTransaction();
|
||||||
|
|
||||||
|
void rollbackTransaction();
|
||||||
|
|
||||||
|
void commitTransaction();
|
||||||
|
|
||||||
|
bool ping();
|
||||||
|
|
||||||
|
uint32_t getLastError();
|
||||||
|
|
||||||
|
bool lockIfReady();
|
||||||
|
|
||||||
|
void unlock();
|
||||||
|
|
||||||
|
std::shared_ptr< Mysql::Connection > getConnection()
|
||||||
|
{
|
||||||
|
return m_pConnection;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr< Mysql::PreparedStatement > getPreparedStatement( uint32_t index );
|
||||||
|
|
||||||
|
void prepareStatement( uint32_t index, const std::string& sql, ConnectionFlags flags );
|
||||||
|
|
||||||
|
virtual void doPrepareStatements() = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::vector< std::shared_ptr< Mysql::PreparedStatement > > m_stmts;
|
||||||
|
PreparedStatementMap m_queries;
|
||||||
|
bool m_reconnecting;
|
||||||
|
bool m_prepareError;
|
||||||
|
|
||||||
|
private:
|
||||||
|
LockedWaitQueue< std::shared_ptr< Operation > >* m_queue;
|
||||||
|
std::shared_ptr< DbWorker > m_worker;
|
||||||
|
std::shared_ptr< Mysql::Connection > m_pConnection;
|
||||||
|
ConnectionInfo& m_connectionInfo;
|
||||||
|
ConnectionFlags m_connectionFlags;
|
||||||
|
std::mutex m_mutex;
|
||||||
|
|
||||||
|
DbConnection( DbConnection const& right ) = delete;
|
||||||
|
|
||||||
|
DbConnection& operator=( DbConnection const& right ) = delete;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8,44 +8,43 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "DbConnection.h"
|
#include "DbConnection.h"
|
||||||
|
|
||||||
namespace Core {
|
namespace Core::Db
|
||||||
namespace Db {
|
|
||||||
|
|
||||||
template< class T >
|
|
||||||
class DbWorkerPool;
|
|
||||||
|
|
||||||
class DbLoader
|
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
DbLoader();
|
|
||||||
|
|
||||||
template< class T >
|
template< class T >
|
||||||
DbLoader& addDb( DbWorkerPool< T >& pool, const ConnectionInfo& info );
|
class DbWorkerPool;
|
||||||
|
|
||||||
bool initDbs();
|
class DbLoader
|
||||||
|
|
||||||
enum DbTypeFlags
|
|
||||||
{
|
{
|
||||||
DATABASE_NONE = 0,
|
public:
|
||||||
DATABASE_CHARACTER = 1,
|
DbLoader();
|
||||||
DATABASE_MASK_ALL = DATABASE_CHARACTER
|
|
||||||
|
template< class T >
|
||||||
|
DbLoader& addDb( DbWorkerPool< T >& pool, const ConnectionInfo& info );
|
||||||
|
|
||||||
|
bool initDbs();
|
||||||
|
|
||||||
|
enum DbTypeFlags
|
||||||
|
{
|
||||||
|
DATABASE_NONE = 0,
|
||||||
|
DATABASE_CHARACTER = 1,
|
||||||
|
DATABASE_MASK_ALL = DATABASE_CHARACTER
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool openDatabases();
|
||||||
|
|
||||||
|
bool prepareStatements();
|
||||||
|
|
||||||
|
using Predicate = std::function< bool() >;
|
||||||
|
using Closer = std::function< void() >;
|
||||||
|
|
||||||
|
bool process( std::queue< Predicate >& queue );
|
||||||
|
|
||||||
|
std::queue< Predicate > m_open;
|
||||||
|
std::queue< Predicate > m_prepare;
|
||||||
|
std::stack< Closer > m_close;
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
|
||||||
bool openDatabases();
|
|
||||||
|
|
||||||
bool prepareStatements();
|
|
||||||
|
|
||||||
using Predicate = std::function< bool() >;
|
|
||||||
using Closer = std::function< void() >;
|
|
||||||
|
|
||||||
bool process( std::queue< Predicate >& queue );
|
|
||||||
|
|
||||||
std::queue< Predicate > m_open;
|
|
||||||
std::queue< Predicate > m_prepare;
|
|
||||||
std::stack< Closer > m_close;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //SAPPHIRE_DBLOADER_H
|
#endif //SAPPHIRE_DBLOADER_H
|
||||||
|
|
|
@ -6,35 +6,32 @@
|
||||||
#include "Util/LockedWaitQueue.h"
|
#include "Util/LockedWaitQueue.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core::Db
|
||||||
namespace Db {
|
|
||||||
class DbConnection;
|
|
||||||
|
|
||||||
class Operation;
|
|
||||||
|
|
||||||
class DbWorker
|
|
||||||
{
|
{
|
||||||
public:
|
class DbConnection;
|
||||||
DbWorker( LockedWaitQueue< std::shared_ptr< Operation > >* newQueue, DbConnection* connection );
|
class Operation;
|
||||||
|
|
||||||
~DbWorker();
|
class DbWorker
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DbWorker( LockedWaitQueue< std::shared_ptr< Operation > >* newQueue, DbConnection* connection );
|
||||||
|
|
||||||
private:
|
~DbWorker();
|
||||||
LockedWaitQueue< std::shared_ptr< Operation > >* m_queue;
|
|
||||||
DbConnection* m_pConn;
|
|
||||||
|
|
||||||
void workerThread();
|
private:
|
||||||
|
LockedWaitQueue< std::shared_ptr< Operation > >* m_queue;
|
||||||
|
DbConnection* m_pConn;
|
||||||
|
|
||||||
std::thread m_workerThread;
|
void workerThread();
|
||||||
|
|
||||||
std::atomic< bool > m_cancelationToken;
|
std::thread m_workerThread;
|
||||||
|
|
||||||
DbWorker( DbWorker const& right ) = delete;
|
std::atomic< bool > m_cancelationToken;
|
||||||
|
|
||||||
DbWorker& operator=( DbWorker const& right ) = delete;
|
DbWorker( DbWorker const& right ) = delete;
|
||||||
};
|
|
||||||
|
DbWorker& operator=( DbWorker const& right ) = delete;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif //SAPPHIRE_DBWORKER_H
|
#endif //SAPPHIRE_DBWORKER_H
|
||||||
|
|
|
@ -8,89 +8,88 @@
|
||||||
#include "Util/LockedWaitQueue.h"
|
#include "Util/LockedWaitQueue.h"
|
||||||
#include "DbConnection.h"
|
#include "DbConnection.h"
|
||||||
|
|
||||||
namespace Core {
|
namespace Core::Db
|
||||||
namespace Db {
|
|
||||||
|
|
||||||
template< typename T >
|
|
||||||
class LockedWaitQueue;
|
|
||||||
|
|
||||||
class Operation;
|
|
||||||
|
|
||||||
class PreparedStatement;
|
|
||||||
|
|
||||||
struct ConnectionInfo;
|
|
||||||
|
|
||||||
template< class T >
|
|
||||||
class DbWorkerPool
|
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
enum InternalIndex
|
template< typename T >
|
||||||
|
class LockedWaitQueue;
|
||||||
|
|
||||||
|
class Operation;
|
||||||
|
|
||||||
|
class PreparedStatement;
|
||||||
|
|
||||||
|
struct ConnectionInfo;
|
||||||
|
|
||||||
|
template< class T >
|
||||||
|
class DbWorkerPool
|
||||||
{
|
{
|
||||||
IDX_ASYNC,
|
private:
|
||||||
IDX_SYNCH,
|
enum InternalIndex
|
||||||
IDX_SIZE
|
{
|
||||||
|
IDX_ASYNC,
|
||||||
|
IDX_SYNCH,
|
||||||
|
IDX_SIZE
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
DbWorkerPool();
|
||||||
|
|
||||||
|
~DbWorkerPool();
|
||||||
|
|
||||||
|
void setConnectionInfo( const ConnectionInfo& info, uint8_t asyncThreads, uint8_t synchThreads );
|
||||||
|
|
||||||
|
uint32_t open();
|
||||||
|
|
||||||
|
void close();
|
||||||
|
|
||||||
|
bool prepareStatements();
|
||||||
|
|
||||||
|
inline ConnectionInfo getConnectionInfo() const
|
||||||
|
{
|
||||||
|
return m_connectionInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Async execution
|
||||||
|
void execute( const std::string& sql );
|
||||||
|
|
||||||
|
void execute( std::shared_ptr< PreparedStatement > stmt );
|
||||||
|
|
||||||
|
// Sync execution
|
||||||
|
void directExecute( const std::string& sql );
|
||||||
|
|
||||||
|
void directExecute( std::shared_ptr< PreparedStatement > stmt );
|
||||||
|
|
||||||
|
std::shared_ptr< Mysql::ResultSet >
|
||||||
|
query( const std::string& sql, std::shared_ptr< T > connection = nullptr );
|
||||||
|
|
||||||
|
std::shared_ptr< Mysql::PreparedResultSet > query( std::shared_ptr< PreparedStatement > stmt );
|
||||||
|
|
||||||
|
using PreparedStatementIndex = typename T::Statements;
|
||||||
|
|
||||||
|
std::shared_ptr< PreparedStatement > getPreparedStatement( PreparedStatementIndex index );
|
||||||
|
|
||||||
|
void escapeString( std::string& str );
|
||||||
|
|
||||||
|
void keepAlive();
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint32_t openConnections( InternalIndex type, uint8_t numConnections );
|
||||||
|
|
||||||
|
unsigned long escapeString( char* to, const char* from, unsigned long length );
|
||||||
|
|
||||||
|
void enqueue( std::shared_ptr< Operation > op );
|
||||||
|
|
||||||
|
std::shared_ptr< T > getFreeConnection();
|
||||||
|
|
||||||
|
const std::string& getDatabaseName() const;
|
||||||
|
|
||||||
|
std::unique_ptr< Core::LockedWaitQueue< std::shared_ptr< Operation > > > m_queue;
|
||||||
|
std::array< std::vector< std::shared_ptr< T > >, IDX_SIZE > m_connections;
|
||||||
|
ConnectionInfo m_connectionInfo;
|
||||||
|
uint8_t m_asyncThreads;
|
||||||
|
uint8_t m_synchThreads;
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
|
||||||
DbWorkerPool();
|
|
||||||
|
|
||||||
~DbWorkerPool();
|
|
||||||
|
|
||||||
void setConnectionInfo( const ConnectionInfo& info, uint8_t asyncThreads, uint8_t synchThreads );
|
|
||||||
|
|
||||||
uint32_t open();
|
|
||||||
|
|
||||||
void close();
|
|
||||||
|
|
||||||
bool prepareStatements();
|
|
||||||
|
|
||||||
inline ConnectionInfo getConnectionInfo() const
|
|
||||||
{
|
|
||||||
return m_connectionInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Async execution
|
|
||||||
void execute( const std::string& sql );
|
|
||||||
|
|
||||||
void execute( std::shared_ptr< PreparedStatement > stmt );
|
|
||||||
|
|
||||||
// Sync execution
|
|
||||||
void directExecute( const std::string& sql );
|
|
||||||
|
|
||||||
void directExecute( std::shared_ptr< PreparedStatement > stmt );
|
|
||||||
|
|
||||||
std::shared_ptr< Mysql::ResultSet >
|
|
||||||
query( const std::string& sql, std::shared_ptr< T > connection = nullptr );
|
|
||||||
|
|
||||||
std::shared_ptr< Mysql::PreparedResultSet > query( std::shared_ptr< PreparedStatement > stmt );
|
|
||||||
|
|
||||||
using PreparedStatementIndex = typename T::Statements;
|
|
||||||
|
|
||||||
std::shared_ptr< PreparedStatement > getPreparedStatement( PreparedStatementIndex index );
|
|
||||||
|
|
||||||
void escapeString( std::string& str );
|
|
||||||
|
|
||||||
void keepAlive();
|
|
||||||
|
|
||||||
private:
|
|
||||||
uint32_t openConnections( InternalIndex type, uint8_t numConnections );
|
|
||||||
|
|
||||||
unsigned long escapeString( char* to, const char* from, unsigned long length );
|
|
||||||
|
|
||||||
void enqueue( std::shared_ptr< Operation > op );
|
|
||||||
|
|
||||||
std::shared_ptr< T > getFreeConnection();
|
|
||||||
|
|
||||||
const std::string& getDatabaseName() const;
|
|
||||||
|
|
||||||
std::unique_ptr< Core::LockedWaitQueue< std::shared_ptr< Operation > > > m_queue;
|
|
||||||
std::array< std::vector< std::shared_ptr< T > >, IDX_SIZE > m_connections;
|
|
||||||
ConnectionInfo m_connectionInfo;
|
|
||||||
uint8_t m_asyncThreads;
|
|
||||||
uint8_t m_synchThreads;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //SAPPHIRE_DBWORKERPOOL_H
|
#endif //SAPPHIRE_DBWORKERPOOL_H
|
||||||
|
|
|
@ -1,51 +1,49 @@
|
||||||
#ifndef SAPPHIRE_OPERATION_H
|
#ifndef SAPPHIRE_OPERATION_H
|
||||||
#define SAPPHIRE_OPERATION_H
|
#define SAPPHIRE_OPERATION_H
|
||||||
|
|
||||||
namespace Mysql {
|
namespace Mysql
|
||||||
class Connection;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Core {
|
|
||||||
namespace Db {
|
|
||||||
class DbConnection;
|
|
||||||
|
|
||||||
class PreparedStatement;
|
|
||||||
|
|
||||||
class Operation
|
|
||||||
{
|
{
|
||||||
public:
|
class Connection;
|
||||||
Operation() :
|
|
||||||
m_pConn( nullptr )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~Operation()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual int call()
|
|
||||||
{
|
|
||||||
execute();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool execute() = 0;
|
|
||||||
|
|
||||||
virtual void setConnection( DbConnection* pCon )
|
|
||||||
{
|
|
||||||
m_pConn = pCon;
|
|
||||||
}
|
|
||||||
|
|
||||||
DbConnection* m_pConn;
|
|
||||||
|
|
||||||
private:
|
|
||||||
Operation( Operation const& right ) = delete;
|
|
||||||
|
|
||||||
Operation& operator=( Operation const& right ) = delete;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Core::Db
|
||||||
|
{
|
||||||
|
class DbConnection;
|
||||||
|
|
||||||
|
class PreparedStatement;
|
||||||
|
|
||||||
|
class Operation
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Operation() :
|
||||||
|
m_pConn( nullptr )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ~Operation()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int call()
|
||||||
|
{
|
||||||
|
execute();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool execute() = 0;
|
||||||
|
|
||||||
|
virtual void setConnection( DbConnection* pCon )
|
||||||
|
{
|
||||||
|
m_pConn = pCon;
|
||||||
|
}
|
||||||
|
|
||||||
|
DbConnection* m_pConn;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Operation( Operation const& right ) = delete;
|
||||||
|
|
||||||
|
Operation& operator=( Operation const& right ) = delete;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //SAPPHIRE_OPERATION_H
|
#endif //SAPPHIRE_OPERATION_H
|
||||||
|
|
|
@ -7,85 +7,83 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "Operation.h"
|
#include "Operation.h"
|
||||||
|
|
||||||
namespace Mysql {
|
namespace Mysql
|
||||||
class PreparedStatement;
|
{
|
||||||
|
class PreparedStatement;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Core {
|
namespace Core::Db
|
||||||
namespace Db {
|
|
||||||
union PreparedStatementDataUnion
|
|
||||||
{
|
{
|
||||||
bool boolean;
|
union PreparedStatementDataUnion
|
||||||
uint32_t ui32;
|
{
|
||||||
int32_t i32;
|
bool boolean;
|
||||||
uint64_t ui64;
|
uint32_t ui32;
|
||||||
int64_t i64;
|
int32_t i32;
|
||||||
double d;
|
uint64_t ui64;
|
||||||
};
|
int64_t i64;
|
||||||
|
double d;
|
||||||
|
};
|
||||||
|
|
||||||
enum PreparedStatementValueType
|
enum PreparedStatementValueType
|
||||||
{
|
{
|
||||||
TYPE_BOOL,
|
TYPE_BOOL,
|
||||||
TYPE_UI,
|
TYPE_UI,
|
||||||
TYPE_UI64,
|
TYPE_UI64,
|
||||||
TYPE_I,
|
TYPE_I,
|
||||||
TYPE_I64,
|
TYPE_I64,
|
||||||
TYPE_DOUBLE,
|
TYPE_DOUBLE,
|
||||||
TYPE_STRING,
|
TYPE_STRING,
|
||||||
TYPE_BINARY,
|
TYPE_BINARY,
|
||||||
TYPE_NULL
|
TYPE_NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PreparedStatementData
|
struct PreparedStatementData
|
||||||
{
|
{
|
||||||
PreparedStatementDataUnion data;
|
PreparedStatementDataUnion data;
|
||||||
PreparedStatementValueType type;
|
PreparedStatementValueType type;
|
||||||
std::vector< uint8_t > binary;
|
std::vector< uint8_t > binary;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PreparedStatement
|
class PreparedStatement
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit PreparedStatement( uint32_t index );
|
explicit PreparedStatement( uint32_t index );
|
||||||
|
|
||||||
~PreparedStatement();
|
~PreparedStatement();
|
||||||
|
|
||||||
void setBool( uint8_t index, bool value );
|
void setBool( uint8_t index, bool value );
|
||||||
|
|
||||||
void setUInt( uint8_t index, uint32_t value );
|
void setUInt( uint8_t index, uint32_t value );
|
||||||
|
|
||||||
void setUInt64( uint8_t index, uint64_t value );
|
void setUInt64( uint8_t index, uint64_t value );
|
||||||
|
|
||||||
void setInt( uint8_t index, int32_t value );
|
void setInt( uint8_t index, int32_t value );
|
||||||
|
|
||||||
void setInt64( uint8_t index, int64_t value );
|
void setInt64( uint8_t index, int64_t value );
|
||||||
|
|
||||||
void setDouble( uint8_t index, double value );
|
void setDouble( uint8_t index, double value );
|
||||||
|
|
||||||
void setString( uint8_t index, const std::string& value );
|
void setString( uint8_t index, const std::string& value );
|
||||||
|
|
||||||
void setBinary( uint8_t index, const std::vector< uint8_t >& value );
|
void setBinary( uint8_t index, const std::vector< uint8_t >& value );
|
||||||
|
|
||||||
void setNull( uint8_t index );
|
void setNull( uint8_t index );
|
||||||
|
|
||||||
uint32_t getIndex() const;
|
uint32_t getIndex() const;
|
||||||
|
|
||||||
void setMysqlPS( std::shared_ptr< Mysql::PreparedStatement > pStmt );
|
void setMysqlPS( std::shared_ptr< Mysql::PreparedStatement > pStmt );
|
||||||
|
|
||||||
void bindParameters();
|
void bindParameters();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::shared_ptr< Mysql::PreparedStatement > m_stmt;
|
std::shared_ptr< Mysql::PreparedStatement > m_stmt;
|
||||||
uint32_t m_index;
|
uint32_t m_index;
|
||||||
std::vector< PreparedStatementData > m_statementData;
|
std::vector< PreparedStatementData > m_statementData;
|
||||||
|
|
||||||
PreparedStatement( PreparedStatement const& right ) = delete;
|
PreparedStatement( PreparedStatement const& right ) = delete;
|
||||||
|
|
||||||
PreparedStatement& operator=( PreparedStatement const& right ) = delete;
|
PreparedStatement& operator=( PreparedStatement const& right ) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,50 +5,49 @@
|
||||||
#include "Operation.h"
|
#include "Operation.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core::Db
|
||||||
namespace Db {
|
|
||||||
class PreparedStatement;
|
|
||||||
|
|
||||||
class StatementTask :
|
|
||||||
public Operation
|
|
||||||
{
|
{
|
||||||
public:
|
class PreparedStatement;
|
||||||
|
|
||||||
StatementTask( const std::string& sql, bool async = false );
|
class StatementTask :
|
||||||
|
public Operation
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
~StatementTask();
|
StatementTask( const std::string& sql, bool async = false );
|
||||||
|
|
||||||
bool execute() override;
|
~StatementTask();
|
||||||
|
|
||||||
// QueryResultFuture getFuture() const
|
bool execute() override;
|
||||||
// {
|
|
||||||
// return m_result->get_future();
|
|
||||||
// }
|
|
||||||
|
|
||||||
private:
|
// QueryResultFuture getFuture() const
|
||||||
std::string m_sql;
|
// {
|
||||||
bool m_hasResult;
|
// return m_result->get_future();
|
||||||
// QueryResultPromise *m_result;
|
// }
|
||||||
};
|
|
||||||
|
|
||||||
class PreparedStatementTask :
|
private:
|
||||||
public Operation
|
std::string m_sql;
|
||||||
{
|
bool m_hasResult;
|
||||||
public:
|
// QueryResultPromise *m_result;
|
||||||
PreparedStatementTask( std::shared_ptr< PreparedStatement > stmt, bool async = false );
|
};
|
||||||
|
|
||||||
~PreparedStatementTask();
|
class PreparedStatementTask :
|
||||||
|
public Operation
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PreparedStatementTask( std::shared_ptr< PreparedStatement > stmt, bool async = false );
|
||||||
|
|
||||||
bool execute() override;
|
~PreparedStatementTask();
|
||||||
//PreparedQueryResultFuture getFuture() { return m_result->get_future(); }
|
|
||||||
|
|
||||||
protected:
|
bool execute() override;
|
||||||
std::shared_ptr< PreparedStatement > m_stmt;
|
//PreparedQueryResultFuture getFuture() { return m_result->get_future(); }
|
||||||
bool m_hasResult;
|
|
||||||
//PreparedQueryResultPromise* m_result;
|
protected:
|
||||||
};
|
std::shared_ptr< PreparedStatement > m_stmt;
|
||||||
|
bool m_hasResult;
|
||||||
|
//PreparedQueryResultPromise* m_result;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,100 +3,99 @@
|
||||||
|
|
||||||
#include "DbConnection.h"
|
#include "DbConnection.h"
|
||||||
|
|
||||||
namespace Core {
|
namespace Core::Db
|
||||||
namespace Db {
|
|
||||||
class DbConnectionInfo;
|
|
||||||
|
|
||||||
enum ZoneDbStatements : uint32_t
|
|
||||||
{
|
{
|
||||||
CHARA_SEL,
|
class DbConnectionInfo;
|
||||||
CHARA_SEL_MINIMAL,
|
|
||||||
CHARA_SEL_SEARCHINFO,
|
|
||||||
CHARA_SEL_QUEST,
|
|
||||||
CHARA_INS,
|
|
||||||
CHARA_UP,
|
|
||||||
CHARA_UP_NAME,
|
|
||||||
CHARA_UP_HPMP,
|
|
||||||
CHARA_UP_MODE,
|
|
||||||
CHARA_UP_MOUNT,
|
|
||||||
CHARA_UP_INVINCIBLE,
|
|
||||||
CHARA_UP_CUSTOMIZE,
|
|
||||||
CHARA_UP_MODELMAINWEAP,
|
|
||||||
CHARA_UP_MODELSUBWEAP,
|
|
||||||
CHARA_UP_MODELSYSWEAP,
|
|
||||||
CHARA_UP_MODELEQUIP,
|
|
||||||
CHARA_UP_EMOTEMODETYPE,
|
|
||||||
CHARA_UP_FIRSTLOGINTIME,
|
|
||||||
CHARA_UP_LANGUAGE,
|
|
||||||
CHARA_UP_ISNEWGAME,
|
|
||||||
CHARA_UP_ISNEWADV,
|
|
||||||
CHARA_UP_TERRITORY,
|
|
||||||
CHARA_UP_POS,
|
|
||||||
CHARA_UP_CLASS,
|
|
||||||
CHARA_UP_STATUS,
|
|
||||||
CHARA_UP_TOTALPLAYTIME,
|
|
||||||
CHARA_UP_HOMEPOINT,
|
|
||||||
CHARA_UP_FAVOPOINT,
|
|
||||||
CHARA_UP_TITLE,
|
|
||||||
CHARA_UP_TITLELIST,
|
|
||||||
CHARA_UP_ACHIEVEMENTS,
|
|
||||||
CHARA_UP_AETHERYTE,
|
|
||||||
CHARA_UP_HOWTO,
|
|
||||||
CHARA_UP_MINIONS,
|
|
||||||
CHARA_UP_MOUNTS,
|
|
||||||
CHARA_UP_GEARSET,
|
|
||||||
CHARA_UP_CONFIGFLAGS,
|
|
||||||
CHARA_UP_QUESTCOMPLETE,
|
|
||||||
CHARA_UP_OPENINGSEQ,
|
|
||||||
CHARA_UP_QUESTTRACKING,
|
|
||||||
CHARA_UP_GRANDCOMPANY,
|
|
||||||
CHARA_UP_GRANDCOMPANYRANKS,
|
|
||||||
CHARA_UP_DISCOVERY,
|
|
||||||
CHARA_UP_GMRANK,
|
|
||||||
CHARA_UP_EQUIPDISPLAYFLAGS,
|
|
||||||
CHARA_UP_UNLOCKS,
|
|
||||||
CHARA_UP_CFPENATLY,
|
|
||||||
CHARA_SEARCHINFO_INS,
|
|
||||||
CHARA_SEARCHINFO_UP_SELECTCLASS,
|
|
||||||
CHARA_SEARCHINFO_UP_SELECTREGION,
|
|
||||||
CHARA_SEARCHINFO_UP_SEARCHCOMMENT,
|
|
||||||
|
|
||||||
CHARA_QUEST_INS,
|
enum ZoneDbStatements : uint32_t
|
||||||
CHARA_QUEST_UP,
|
{
|
||||||
CHARA_QUEST_DEL,
|
CHARA_SEL,
|
||||||
|
CHARA_SEL_MINIMAL,
|
||||||
|
CHARA_SEL_SEARCHINFO,
|
||||||
|
CHARA_SEL_QUEST,
|
||||||
|
CHARA_INS,
|
||||||
|
CHARA_UP,
|
||||||
|
CHARA_UP_NAME,
|
||||||
|
CHARA_UP_HPMP,
|
||||||
|
CHARA_UP_MODE,
|
||||||
|
CHARA_UP_MOUNT,
|
||||||
|
CHARA_UP_INVINCIBLE,
|
||||||
|
CHARA_UP_CUSTOMIZE,
|
||||||
|
CHARA_UP_MODELMAINWEAP,
|
||||||
|
CHARA_UP_MODELSUBWEAP,
|
||||||
|
CHARA_UP_MODELSYSWEAP,
|
||||||
|
CHARA_UP_MODELEQUIP,
|
||||||
|
CHARA_UP_EMOTEMODETYPE,
|
||||||
|
CHARA_UP_FIRSTLOGINTIME,
|
||||||
|
CHARA_UP_LANGUAGE,
|
||||||
|
CHARA_UP_ISNEWGAME,
|
||||||
|
CHARA_UP_ISNEWADV,
|
||||||
|
CHARA_UP_TERRITORY,
|
||||||
|
CHARA_UP_POS,
|
||||||
|
CHARA_UP_CLASS,
|
||||||
|
CHARA_UP_STATUS,
|
||||||
|
CHARA_UP_TOTALPLAYTIME,
|
||||||
|
CHARA_UP_HOMEPOINT,
|
||||||
|
CHARA_UP_FAVOPOINT,
|
||||||
|
CHARA_UP_TITLE,
|
||||||
|
CHARA_UP_TITLELIST,
|
||||||
|
CHARA_UP_ACHIEVEMENTS,
|
||||||
|
CHARA_UP_AETHERYTE,
|
||||||
|
CHARA_UP_HOWTO,
|
||||||
|
CHARA_UP_MINIONS,
|
||||||
|
CHARA_UP_MOUNTS,
|
||||||
|
CHARA_UP_GEARSET,
|
||||||
|
CHARA_UP_CONFIGFLAGS,
|
||||||
|
CHARA_UP_QUESTCOMPLETE,
|
||||||
|
CHARA_UP_OPENINGSEQ,
|
||||||
|
CHARA_UP_QUESTTRACKING,
|
||||||
|
CHARA_UP_GRANDCOMPANY,
|
||||||
|
CHARA_UP_GRANDCOMPANYRANKS,
|
||||||
|
CHARA_UP_DISCOVERY,
|
||||||
|
CHARA_UP_GMRANK,
|
||||||
|
CHARA_UP_EQUIPDISPLAYFLAGS,
|
||||||
|
CHARA_UP_UNLOCKS,
|
||||||
|
CHARA_UP_CFPENATLY,
|
||||||
|
CHARA_SEARCHINFO_INS,
|
||||||
|
CHARA_SEARCHINFO_UP_SELECTCLASS,
|
||||||
|
CHARA_SEARCHINFO_UP_SELECTREGION,
|
||||||
|
CHARA_SEARCHINFO_UP_SEARCHCOMMENT,
|
||||||
|
|
||||||
CHARA_CLASS_SEL,
|
CHARA_QUEST_INS,
|
||||||
CHARA_CLASS_INS,
|
CHARA_QUEST_UP,
|
||||||
CHARA_CLASS_UP,
|
CHARA_QUEST_DEL,
|
||||||
CHARA_CLASS_DEL,
|
|
||||||
|
|
||||||
CHARA_ITEMINV_INS,
|
CHARA_CLASS_SEL,
|
||||||
|
CHARA_CLASS_INS,
|
||||||
|
CHARA_CLASS_UP,
|
||||||
|
CHARA_CLASS_DEL,
|
||||||
|
|
||||||
CHARA_ITEMGLOBAL_INS,
|
CHARA_ITEMINV_INS,
|
||||||
CHARA_ITEMGLOBAL_UP,
|
|
||||||
CHARA_ITEMGLOBAL_DELETE,
|
|
||||||
|
|
||||||
ZONE_SEL_BNPCTEMPLATES,
|
CHARA_ITEMGLOBAL_INS,
|
||||||
|
CHARA_ITEMGLOBAL_UP,
|
||||||
|
CHARA_ITEMGLOBAL_DELETE,
|
||||||
|
|
||||||
MAX_STATEMENTS
|
ZONE_SEL_BNPCTEMPLATES,
|
||||||
};
|
|
||||||
|
|
||||||
class ZoneDbConnection : public DbConnection
|
MAX_STATEMENTS
|
||||||
{
|
};
|
||||||
public:
|
|
||||||
using Statements = ZoneDbStatements;
|
|
||||||
|
|
||||||
ZoneDbConnection( ConnectionInfo& connInfo );
|
class ZoneDbConnection : public DbConnection
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using Statements = ZoneDbStatements;
|
||||||
|
|
||||||
ZoneDbConnection( Core::LockedWaitQueue< std::shared_ptr< Operation > >* q, ConnectionInfo& connInfo );
|
ZoneDbConnection( ConnectionInfo& connInfo );
|
||||||
|
|
||||||
~ZoneDbConnection();
|
ZoneDbConnection( Core::LockedWaitQueue< std::shared_ptr< Operation > >* q, ConnectionInfo& connInfo );
|
||||||
|
|
||||||
void doPrepareStatements() override;
|
~ZoneDbConnection();
|
||||||
|
|
||||||
};
|
void doPrepareStatements() override;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //SAPPHIRE_CHARACONNECTION_H
|
#endif //SAPPHIRE_CHARACONNECTION_H
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <variant>
|
#include <variant>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core::Data
|
||||||
namespace Data {
|
{
|
||||||
|
|
||||||
class ExdDataGenerated;
|
class ExdDataGenerated;
|
||||||
|
|
||||||
|
@ -8694,7 +8694,6 @@ const std::set< uint32_t >& getZoneSharedGroupIdList()
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -3,34 +3,30 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core
|
||||||
|
{
|
||||||
|
|
||||||
class ConfigMgr;
|
class ConfigMgr;
|
||||||
|
using ConfigMgrPtr = std::shared_ptr< ConfigMgr >;
|
||||||
|
|
||||||
typedef std::shared_ptr< ConfigMgr > ConfigMgrPtr;
|
namespace Network
|
||||||
|
{
|
||||||
|
class Hive;
|
||||||
|
class Acceptor;
|
||||||
|
class Connection;
|
||||||
|
using HivePtr = std::shared_ptr< Hive >;
|
||||||
|
using AcceptorPtr = std::shared_ptr< Acceptor >;
|
||||||
|
using ConnectionPtr = std::shared_ptr< Connection >;
|
||||||
|
|
||||||
|
namespace Packets
|
||||||
|
{
|
||||||
|
class GamePacket;
|
||||||
|
class FFXIVPacketBase;
|
||||||
|
using GamePacketPtr = std::shared_ptr< GamePacket >;
|
||||||
|
using FFXIVPacketBasePtr = std::shared_ptr< FFXIVPacketBase >;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Network {
|
}
|
||||||
class Hive;
|
|
||||||
|
|
||||||
class Acceptor;
|
|
||||||
|
|
||||||
class Connection;
|
|
||||||
|
|
||||||
typedef std::shared_ptr< Hive > HivePtr;
|
|
||||||
typedef std::shared_ptr< Acceptor > AcceptorPtr;
|
|
||||||
typedef std::shared_ptr< Connection > ConnectionPtr;
|
|
||||||
|
|
||||||
namespace Packets {
|
|
||||||
class GamePacket;
|
|
||||||
|
|
||||||
class FFXIVPacketBase;
|
|
||||||
|
|
||||||
typedef std::shared_ptr< GamePacket > GamePacketPtr;
|
|
||||||
typedef std::shared_ptr< FFXIVPacketBase > FFXIVPacketBasePtr;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,29 +7,30 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core
|
||||||
|
|
||||||
class Framework
|
|
||||||
{
|
{
|
||||||
using TypenameToObject = std::map< std::type_index, std::shared_ptr< void > >;
|
|
||||||
TypenameToObject ObjectMap;
|
|
||||||
|
|
||||||
public:
|
class Framework
|
||||||
template< typename T >
|
|
||||||
std::shared_ptr< T > get()
|
|
||||||
{
|
{
|
||||||
auto iType = ObjectMap.find( typeid( T ) );
|
using TypenameToObject = std::map< std::type_index, std::shared_ptr< void > >;
|
||||||
assert( !( iType == ObjectMap.end() ) );
|
TypenameToObject ObjectMap;
|
||||||
return std::static_pointer_cast< T >( iType->second );
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename T >
|
public:
|
||||||
void set( std::shared_ptr< T > value )
|
template< typename T >
|
||||||
{
|
std::shared_ptr< T > get()
|
||||||
assert( value ); // why would anyone store nullptrs....
|
{
|
||||||
ObjectMap[ typeid( T ) ] = value;
|
auto iType = ObjectMap.find( typeid( T ) );
|
||||||
}
|
assert( !( iType == ObjectMap.end() ) );
|
||||||
};
|
return std::static_pointer_cast< T >( iType->second );
|
||||||
|
}
|
||||||
|
|
||||||
|
template< typename T >
|
||||||
|
void set( std::shared_ptr< T > value )
|
||||||
|
{
|
||||||
|
assert( value ); // why would anyone store nullptrs....
|
||||||
|
ObjectMap[ typeid( T ) ] = value;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,11 +48,6 @@ void Logger::init()
|
||||||
spdlog::flush_on( spdlog::level::critical );
|
spdlog::flush_on( spdlog::level::critical );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Logger::Log( LoggingSeverity logSev, const std::string& text )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Logger::error( const std::string& text )
|
void Logger::error( const std::string& text )
|
||||||
{
|
{
|
||||||
spdlog::get( "logger" )->error( text );
|
spdlog::get( "logger" )->error( text );
|
||||||
|
|
|
@ -3,45 +3,33 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core
|
||||||
|
|
||||||
enum struct LoggingSeverity : uint8_t
|
|
||||||
{
|
|
||||||
trace = 0,
|
|
||||||
debug = 1,
|
|
||||||
info = 2,
|
|
||||||
warning = 3,
|
|
||||||
error = 4,
|
|
||||||
fatal = 5
|
|
||||||
};
|
|
||||||
|
|
||||||
class Logger
|
|
||||||
{
|
{
|
||||||
|
|
||||||
private:
|
class Logger
|
||||||
std::string m_logFile;
|
{
|
||||||
|
|
||||||
public:
|
private:
|
||||||
Logger();
|
std::string m_logFile;
|
||||||
|
|
||||||
~Logger();
|
public:
|
||||||
|
Logger();
|
||||||
|
|
||||||
void init();
|
~Logger();
|
||||||
|
|
||||||
void Log( LoggingSeverity logSev, const std::string& text );
|
void init();
|
||||||
|
|
||||||
void error( const std::string& text );
|
void error( const std::string& text );
|
||||||
|
|
||||||
void info( const std::string& text );
|
void info( const std::string& text );
|
||||||
|
|
||||||
void debug( const std::string& text );
|
void debug( const std::string& text );
|
||||||
|
|
||||||
void fatal( const std::string& text );
|
void fatal( const std::string& text );
|
||||||
|
|
||||||
void setLogPath( const std::string& logPath );
|
void setLogPath( const std::string& logPath );
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,75 +13,74 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
namespace Core {
|
namespace Core::Network
|
||||||
namespace Network {
|
|
||||||
|
|
||||||
class Connection;
|
|
||||||
|
|
||||||
class Acceptor : public std::enable_shared_from_this< Acceptor >
|
|
||||||
{
|
{
|
||||||
friend class Hive;
|
|
||||||
|
|
||||||
private:
|
class Connection;
|
||||||
HivePtr m_hive;
|
|
||||||
asio::ip::tcp::acceptor m_acceptor;
|
|
||||||
asio::strand m_io_strand;
|
|
||||||
std::atomic< uint32_t > m_error_state;
|
|
||||||
|
|
||||||
private:
|
class Acceptor : public std::enable_shared_from_this< Acceptor >
|
||||||
Acceptor( const Acceptor& rhs );
|
{
|
||||||
|
friend class Hive;
|
||||||
|
|
||||||
Acceptor& operator=( const Acceptor& rhs );
|
private:
|
||||||
|
HivePtr m_hive;
|
||||||
|
asio::ip::tcp::acceptor m_acceptor;
|
||||||
|
asio::strand m_io_strand;
|
||||||
|
std::atomic< uint32_t > m_error_state;
|
||||||
|
|
||||||
void StartError( const asio::error_code& error );
|
private:
|
||||||
|
Acceptor( const Acceptor& rhs );
|
||||||
|
|
||||||
void DispatchAccept( ConnectionPtr connection );
|
Acceptor& operator=( const Acceptor& rhs );
|
||||||
|
|
||||||
void HandleAccept( const asio::error_code& error, ConnectionPtr connection );
|
void StartError( const asio::error_code& error );
|
||||||
|
|
||||||
private:
|
void DispatchAccept( ConnectionPtr connection );
|
||||||
// Called when a connection has connected to the server. This function
|
|
||||||
// should return true to invoke the connection's OnAccept function if the
|
|
||||||
// connection will be kept. If the connection will not be kept, the
|
|
||||||
// connection's Disconnect function should be called and the function
|
|
||||||
// should return false.
|
|
||||||
virtual bool OnAccept( ConnectionPtr connection, const std::string& host, uint16_t port );
|
|
||||||
|
|
||||||
// Called when an error is encountered. Most typically, this is when the
|
void HandleAccept( const asio::error_code& error, ConnectionPtr connection );
|
||||||
// acceptor is being closed via the Stop function or if the Listen is
|
|
||||||
// called on an address that is not available.
|
|
||||||
virtual void OnError( const asio::error_code& error );
|
|
||||||
|
|
||||||
public:
|
private:
|
||||||
Acceptor( HivePtr hive );
|
// Called when a connection has connected to the server. This function
|
||||||
|
// should return true to invoke the connection's OnAccept function if the
|
||||||
|
// connection will be kept. If the connection will not be kept, the
|
||||||
|
// connection's Disconnect function should be called and the function
|
||||||
|
// should return false.
|
||||||
|
virtual bool OnAccept( ConnectionPtr connection, const std::string& host, uint16_t port );
|
||||||
|
|
||||||
virtual ~Acceptor();
|
// Called when an error is encountered. Most typically, this is when the
|
||||||
|
// acceptor is being closed via the Stop function or if the Listen is
|
||||||
|
// called on an address that is not available.
|
||||||
|
virtual void OnError( const asio::error_code& error );
|
||||||
|
|
||||||
// Returns the Hive object.
|
public:
|
||||||
HivePtr GetHive();
|
Acceptor( HivePtr hive );
|
||||||
|
|
||||||
// Returns the acceptor object.
|
virtual ~Acceptor();
|
||||||
asio::ip::tcp::acceptor& GetAcceptor();
|
|
||||||
|
|
||||||
// Returns the strand object.
|
// Returns the Hive object.
|
||||||
asio::strand& GetStrand();
|
HivePtr GetHive();
|
||||||
|
|
||||||
// Returns true if this object has an error associated with it.
|
// Returns the acceptor object.
|
||||||
bool HasError();
|
asio::ip::tcp::acceptor& GetAcceptor();
|
||||||
|
|
||||||
public:
|
// Returns the strand object.
|
||||||
// Begin listening on the specific network interface.
|
asio::strand& GetStrand();
|
||||||
void Listen( const std::string& host, const uint16_t& port );
|
|
||||||
|
|
||||||
// Posts the connection to the listening interface. The next client that
|
// Returns true if this object has an error associated with it.
|
||||||
// connections will be given this connection. If multiple calls to Accept
|
bool HasError();
|
||||||
// are called at a time, then they are accepted in a FIFO order.
|
|
||||||
void Accept( ConnectionPtr connection );
|
|
||||||
|
|
||||||
// Stop the Acceptor from listening.
|
public:
|
||||||
void Stop();
|
// Begin listening on the specific network interface.
|
||||||
};
|
void Listen( const std::string& host, const uint16_t& port );
|
||||||
|
|
||||||
|
// Posts the connection to the listening interface. The next client that
|
||||||
|
// connections will be given this connection. If multiple calls to Accept
|
||||||
|
// are called at a time, then they are accepted in a FIFO order.
|
||||||
|
void Accept( ConnectionPtr connection );
|
||||||
|
|
||||||
|
// Stop the Acceptor from listening.
|
||||||
|
void Stop();
|
||||||
|
};
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5,182 +5,179 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "PacketDef/Ipcs.h"
|
#include "PacketDef/Ipcs.h"
|
||||||
|
|
||||||
namespace Core {
|
namespace Core::Network::Packets
|
||||||
namespace Network {
|
|
||||||
namespace Packets {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Anticipated usage:
|
|
||||||
* ==================
|
|
||||||
* Set up a stream buffer to collect the bytes to be transmitted as a packet.
|
|
||||||
* Now, you can do the following (given you have the structs filled out already).
|
|
||||||
*
|
|
||||||
* FFXIVARR_PACKET_HEADER pkt_hdr = { . . . };
|
|
||||||
* FFXIVARR_PACKET_SEGMENT_HEADER pkt_seg_hdr[n] = { . . . };
|
|
||||||
*
|
|
||||||
* std::stringstream buf;
|
|
||||||
* buf << pkt_hdr;
|
|
||||||
* for( int i = 0; i < n; i++ )
|
|
||||||
* {
|
|
||||||
* buf << pkt_seg_hdr[i];
|
|
||||||
* buf << {pkt_seg_data[i]};
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* The reverse can be done parsing a packet. Remember to validate the packet
|
|
||||||
* type before parsing the headers.
|
|
||||||
*
|
|
||||||
* Compression and Encryption:
|
|
||||||
* ===========================
|
|
||||||
* By using std::iostream's, you can support stream filters. Simply create a
|
|
||||||
* stream that performs the compression or encryption, and use that stream to
|
|
||||||
* read and write.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Structure representing the common header for all FFXIVARR packets.
|
|
||||||
*
|
|
||||||
* 0 4 8 12 14 16
|
|
||||||
* +-------------------------------+---------------+-------+-------+
|
|
||||||
* | unknown_0 | unknown_8 |
|
|
||||||
* +-------------------------------+---------------+-------+-------+
|
|
||||||
* | timestamp | size | cType | count |
|
|
||||||
* +---+---+-------+---------------+---------------+-------+-------+
|
|
||||||
* | ? |CMP| ? | ? |
|
|
||||||
* +---+---+-------+---------------+
|
|
||||||
* (followed by /count/ FFXIVARR_PACKET_SEGMENTs)
|
|
||||||
*/
|
|
||||||
struct FFXIVARR_PACKET_HEADER
|
|
||||||
{
|
{
|
||||||
/** Unknown data, no actual use has been determined */
|
|
||||||
uint64_t unknown_0;
|
|
||||||
uint64_t unknown_8;
|
|
||||||
/** Represents the number of milliseconds since epoch that the packet was sent. */
|
|
||||||
uint64_t timestamp;
|
|
||||||
/** The size of the packet header and its payload */
|
|
||||||
uint32_t size;
|
|
||||||
/** The type of this connection - 1 zone, 2 chat*/
|
|
||||||
uint16_t connectionType;
|
|
||||||
/** The number of packet segments that follow. */
|
|
||||||
uint16_t count;
|
|
||||||
uint8_t unknown_20;
|
|
||||||
/** Indicates if the data segments of this packet are compressed. */
|
|
||||||
uint8_t isCompressed;
|
|
||||||
uint32_t unknown_24;
|
|
||||||
};
|
|
||||||
|
|
||||||
inline std::ostream& operator<<( std::ostream& os, const FFXIVARR_PACKET_HEADER& hdr )
|
/**
|
||||||
{
|
* Anticipated usage:
|
||||||
return os.write( reinterpret_cast< const char* >( &hdr ), sizeof hdr );
|
* ==================
|
||||||
}
|
* Set up a stream buffer to collect the bytes to be transmitted as a packet.
|
||||||
|
* Now, you can do the following (given you have the structs filled out already).
|
||||||
|
*
|
||||||
|
* FFXIVARR_PACKET_HEADER pkt_hdr = { . . . };
|
||||||
|
* FFXIVARR_PACKET_SEGMENT_HEADER pkt_seg_hdr[n] = { . . . };
|
||||||
|
*
|
||||||
|
* std::stringstream buf;
|
||||||
|
* buf << pkt_hdr;
|
||||||
|
* for( int i = 0; i < n; i++ )
|
||||||
|
* {
|
||||||
|
* buf << pkt_seg_hdr[i];
|
||||||
|
* buf << {pkt_seg_data[i]};
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* The reverse can be done parsing a packet. Remember to validate the packet
|
||||||
|
* type before parsing the headers.
|
||||||
|
*
|
||||||
|
* Compression and Encryption:
|
||||||
|
* ===========================
|
||||||
|
* By using std::iostream's, you can support stream filters. Simply create a
|
||||||
|
* stream that performs the compression or encryption, and use that stream to
|
||||||
|
* read and write.
|
||||||
|
*/
|
||||||
|
|
||||||
inline std::istream& operator>>( std::istream& is, FFXIVARR_PACKET_HEADER& hdr )
|
/**
|
||||||
{
|
* Structure representing the common header for all FFXIVARR packets.
|
||||||
return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr );
|
*
|
||||||
}
|
* 0 4 8 12 14 16
|
||||||
|
* +-------------------------------+---------------+-------+-------+
|
||||||
/**
|
* | unknown_0 | unknown_8 |
|
||||||
* Structure representing the header portion of a packet segment.
|
* +-------------------------------+---------------+-------+-------+
|
||||||
*
|
* | timestamp | size | cType | count |
|
||||||
* NOTE: If the main packet header indicated the packet is compressed, this
|
* +---+---+-------+---------------+---------------+-------+-------+
|
||||||
* header will be compressed as well! The header will NOT ever be encrypted.
|
* | ? |CMP| ? | ? |
|
||||||
*
|
* +---+---+-------+---------------+
|
||||||
* 0 4 8 12 16
|
* (followed by /count/ FFXIVARR_PACKET_SEGMENTs)
|
||||||
* +---------------+---------------+---------------+-------+-------+
|
*/
|
||||||
* | size | source_actor | target_actor | type | pad |
|
struct FFXIVARR_PACKET_HEADER
|
||||||
* +---------------+---------------+---------------+-------+-------+
|
|
||||||
* | |
|
|
||||||
* : type-specific data of length, size, follows :
|
|
||||||
* | (NOTE: Some segments MAY be encrypted) |
|
|
||||||
* +---------------------------------------------------------------+
|
|
||||||
*/
|
|
||||||
struct FFXIVARR_PACKET_SEGMENT_HEADER
|
|
||||||
{
|
|
||||||
/** The size of the segment header and its data. */
|
|
||||||
uint32_t size;
|
|
||||||
/** The session ID this segment describes. */
|
|
||||||
uint32_t source_actor;
|
|
||||||
/** The session ID this packet is being delivered to. */
|
|
||||||
uint32_t target_actor;
|
|
||||||
/** The segment type. (1, 2, 3, 7, 8, 9, 10) */
|
|
||||||
uint16_t type;
|
|
||||||
uint16_t padding;
|
|
||||||
};
|
|
||||||
|
|
||||||
inline std::ostream& operator<<( std::ostream& os, const FFXIVARR_PACKET_SEGMENT_HEADER& hdr )
|
|
||||||
{
|
|
||||||
return os.write( reinterpret_cast< const char* >( &hdr ), sizeof hdr );
|
|
||||||
}
|
|
||||||
|
|
||||||
inline std::istream& operator>>( std::istream& is, FFXIVARR_PACKET_SEGMENT_HEADER& hdr )
|
|
||||||
{
|
|
||||||
return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr );
|
|
||||||
}
|
|
||||||
|
|
||||||
template< int T >
|
|
||||||
struct FFXIVIpcBasePacket
|
|
||||||
{
|
|
||||||
/** Creates a constant representing the IPC type */
|
|
||||||
enum
|
|
||||||
{
|
{
|
||||||
_ServerIpcType = T
|
/** Unknown data, no actual use has been determined */
|
||||||
|
uint64_t unknown_0;
|
||||||
|
uint64_t unknown_8;
|
||||||
|
/** Represents the number of milliseconds since epoch that the packet was sent. */
|
||||||
|
uint64_t timestamp;
|
||||||
|
/** The size of the packet header and its payload */
|
||||||
|
uint32_t size;
|
||||||
|
/** The type of this connection - 1 zone, 2 chat*/
|
||||||
|
uint16_t connectionType;
|
||||||
|
/** The number of packet segments that follow. */
|
||||||
|
uint16_t count;
|
||||||
|
uint8_t unknown_20;
|
||||||
|
/** Indicates if the data segments of this packet are compressed. */
|
||||||
|
uint8_t isCompressed;
|
||||||
|
uint32_t unknown_24;
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
struct FFXIVARR_PACKET_RAW
|
inline std::ostream& operator<<( std::ostream& os, const FFXIVARR_PACKET_HEADER& hdr )
|
||||||
{
|
{
|
||||||
FFXIVARR_PACKET_SEGMENT_HEADER segHdr;
|
return os.write( reinterpret_cast< const char* >( &hdr ), sizeof hdr );
|
||||||
std::vector< uint8_t > data;
|
}
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
inline std::istream& operator>>( std::istream& is, FFXIVARR_PACKET_HEADER& hdr )
|
||||||
* Indicates the type of the segment
|
{
|
||||||
* IPC type will contain an additional header: FFXIVARR_PACKET_SEGMENT_HEADER + FFXIVARR_IPC_HEADER + data
|
return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr );
|
||||||
* The remaining types don't contain an additonal header, FFXIVARR_PACKET_SEGMENT_HEADER + data
|
}
|
||||||
*/
|
|
||||||
enum FFXIVARR_SEGMENT_TYPE
|
|
||||||
{
|
|
||||||
SEGMENTTYPE_SESSIONINIT = 1,
|
|
||||||
SEGMENTTYPE_IPC = 3,
|
|
||||||
SEGMENTTYPE_KEEPALIVE = 7,
|
|
||||||
//SEGMENTTYPE_RESPONSE = 8,
|
|
||||||
SEGMENTTYPE_ENCRYPTIONINIT = 9,
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Structural representation of the common header for IPC packet segments.
|
* Structure representing the header portion of a packet segment.
|
||||||
* NOTE: This is packet segment type 3.
|
*
|
||||||
*
|
* NOTE: If the main packet header indicated the packet is compressed, this
|
||||||
* 0 4 6 8 12 16
|
* header will be compressed as well! The header will NOT ever be encrypted.
|
||||||
* +-------+-------+------+----------+---------------+---------------+
|
*
|
||||||
* | 14 00 | type | pad | serverId | timestamp | pad1 |
|
* 0 4 8 12 16
|
||||||
* +-------+-------+------+----------+---------------+---------------+
|
* +---------------+---------------+---------------+-------+-------+
|
||||||
* | |
|
* | size | source_actor | target_actor | type | pad |
|
||||||
* : data :
|
* +---------------+---------------+---------------+-------+-------+
|
||||||
* | |
|
* | |
|
||||||
* +-----------------------------------------------------------------+
|
* : type-specific data of length, size, follows :
|
||||||
*/
|
* | (NOTE: Some segments MAY be encrypted) |
|
||||||
struct FFXIVARR_IPC_HEADER
|
* +---------------------------------------------------------------+
|
||||||
{
|
*/
|
||||||
uint16_t reserved;
|
struct FFXIVARR_PACKET_SEGMENT_HEADER
|
||||||
uint16_t type;
|
{
|
||||||
uint16_t padding;
|
/** The size of the segment header and its data. */
|
||||||
uint16_t serverId;
|
uint32_t size;
|
||||||
uint32_t timestamp;
|
/** The session ID this segment describes. */
|
||||||
uint32_t padding1;
|
uint32_t source_actor;
|
||||||
};
|
/** The session ID this packet is being delivered to. */
|
||||||
|
uint32_t target_actor;
|
||||||
|
/** The segment type. (1, 2, 3, 7, 8, 9, 10) */
|
||||||
|
uint16_t type;
|
||||||
|
uint16_t padding;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline std::ostream& operator<<( std::ostream& os, const FFXIVARR_PACKET_SEGMENT_HEADER& hdr )
|
||||||
|
{
|
||||||
|
return os.write( reinterpret_cast< const char* >( &hdr ), sizeof hdr );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline std::istream& operator>>( std::istream& is, FFXIVARR_PACKET_SEGMENT_HEADER& hdr )
|
||||||
|
{
|
||||||
|
return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr );
|
||||||
|
}
|
||||||
|
|
||||||
|
template< int T >
|
||||||
|
struct FFXIVIpcBasePacket
|
||||||
|
{
|
||||||
|
/** Creates a constant representing the IPC type */
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
_ServerIpcType = T
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FFXIVARR_PACKET_RAW
|
||||||
|
{
|
||||||
|
FFXIVARR_PACKET_SEGMENT_HEADER segHdr;
|
||||||
|
std::vector< uint8_t > data;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates the type of the segment
|
||||||
|
* IPC type will contain an additional header: FFXIVARR_PACKET_SEGMENT_HEADER + FFXIVARR_IPC_HEADER + data
|
||||||
|
* The remaining types don't contain an additonal header, FFXIVARR_PACKET_SEGMENT_HEADER + data
|
||||||
|
*/
|
||||||
|
enum FFXIVARR_SEGMENT_TYPE
|
||||||
|
{
|
||||||
|
SEGMENTTYPE_SESSIONINIT = 1,
|
||||||
|
SEGMENTTYPE_IPC = 3,
|
||||||
|
SEGMENTTYPE_KEEPALIVE = 7,
|
||||||
|
//SEGMENTTYPE_RESPONSE = 8,
|
||||||
|
SEGMENTTYPE_ENCRYPTIONINIT = 9,
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Structural representation of the common header for IPC packet segments.
|
||||||
|
* NOTE: This is packet segment type 3.
|
||||||
|
*
|
||||||
|
* 0 4 6 8 12 16
|
||||||
|
* +-------+-------+------+----------+---------------+---------------+
|
||||||
|
* | 14 00 | type | pad | serverId | timestamp | pad1 |
|
||||||
|
* +-------+-------+------+----------+---------------+---------------+
|
||||||
|
* | |
|
||||||
|
* : data :
|
||||||
|
* | |
|
||||||
|
* +-----------------------------------------------------------------+
|
||||||
|
*/
|
||||||
|
struct FFXIVARR_IPC_HEADER
|
||||||
|
{
|
||||||
|
uint16_t reserved;
|
||||||
|
uint16_t type;
|
||||||
|
uint16_t padding;
|
||||||
|
uint16_t serverId;
|
||||||
|
uint32_t timestamp;
|
||||||
|
uint32_t padding1;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline std::ostream& operator<<( std::ostream& os, const FFXIVARR_IPC_HEADER& hdr )
|
||||||
|
{
|
||||||
|
return os.write( reinterpret_cast< const char* >( &hdr ), sizeof hdr );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline std::istream& operator>>( std::istream& is, FFXIVARR_IPC_HEADER& hdr )
|
||||||
|
{
|
||||||
|
return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr );
|
||||||
|
}
|
||||||
|
|
||||||
inline std::ostream& operator<<( std::ostream& os, const FFXIVARR_IPC_HEADER& hdr )
|
|
||||||
{
|
|
||||||
return os.write( reinterpret_cast< const char* >( &hdr ), sizeof hdr );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::istream& operator>>( std::istream& is, FFXIVARR_IPC_HEADER& hdr )
|
|
||||||
{
|
|
||||||
return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr );
|
|
||||||
}
|
|
||||||
|
|
||||||
} /* Packets */
|
|
||||||
} /* Network */
|
|
||||||
} /* Core */
|
|
||||||
|
|
||||||
#endif /*_CORE_NETWORK_PACKETS_COMMON_H*/
|
#endif /*_CORE_NETWORK_PACKETS_COMMON_H*/
|
||||||
|
|
|
@ -12,157 +12,153 @@
|
||||||
#include "Acceptor.h"
|
#include "Acceptor.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core::Network
|
||||||
namespace Network {
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class Hive;
|
|
||||||
|
|
||||||
class Acceptor;
|
|
||||||
|
|
||||||
class Connection;
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class Connection : public std::enable_shared_from_this< Connection >
|
|
||||||
{
|
{
|
||||||
friend class Acceptor;
|
|
||||||
|
|
||||||
friend class Hive;
|
class Hive;
|
||||||
|
|
||||||
protected:
|
class Acceptor;
|
||||||
HivePtr m_hive;
|
|
||||||
asio::ip::tcp::socket m_socket;
|
|
||||||
asio::strand m_io_strand;
|
|
||||||
std::vector< uint8_t > m_recv_buffer;
|
|
||||||
std::list< int32_t > m_pending_recvs;
|
|
||||||
std::list< std::vector< uint8_t > > m_pending_sends;
|
|
||||||
int32_t m_receive_buffer_size;
|
|
||||||
std::atomic< uint32_t > m_error_state;
|
|
||||||
|
|
||||||
|
class Connection;
|
||||||
|
|
||||||
Connection( HivePtr hive );
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
virtual ~Connection();
|
class Connection : public std::enable_shared_from_this< Connection >
|
||||||
|
|
||||||
private:
|
|
||||||
Connection( const Connection& rhs );
|
|
||||||
|
|
||||||
Connection& operator=( const Connection& rhs );
|
|
||||||
|
|
||||||
void StartSend();
|
|
||||||
|
|
||||||
void StartRecv( int32_t total_bytes );
|
|
||||||
|
|
||||||
void StartError( const asio::error_code& error );
|
|
||||||
|
|
||||||
void DispatchSend( std::vector< uint8_t > buffer );
|
|
||||||
|
|
||||||
void DispatchRecv( int32_t total_bytes );
|
|
||||||
|
|
||||||
void HandleConnect( const asio::error_code& error );
|
|
||||||
|
|
||||||
void HandleSend( const asio::error_code& error, std::list< std::vector< uint8_t > >::iterator itr );
|
|
||||||
|
|
||||||
void HandleRecv( const asio::error_code& error, int32_t actual_bytes );
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
// Called when the connection has successfully connected to the local host.
|
|
||||||
virtual void OnAccept( const std::string& host, uint16_t port )
|
|
||||||
{
|
{
|
||||||
|
friend class Acceptor;
|
||||||
|
|
||||||
|
friend class Hive;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
HivePtr m_hive;
|
||||||
|
asio::ip::tcp::socket m_socket;
|
||||||
|
asio::strand m_io_strand;
|
||||||
|
std::vector< uint8_t > m_recv_buffer;
|
||||||
|
std::list< int32_t > m_pending_recvs;
|
||||||
|
std::list< std::vector< uint8_t > > m_pending_sends;
|
||||||
|
int32_t m_receive_buffer_size;
|
||||||
|
std::atomic< uint32_t > m_error_state;
|
||||||
|
|
||||||
|
|
||||||
|
Connection( HivePtr hive );
|
||||||
|
|
||||||
|
virtual ~Connection();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Connection( const Connection& rhs );
|
||||||
|
|
||||||
|
Connection& operator=( const Connection& rhs );
|
||||||
|
|
||||||
|
void StartSend();
|
||||||
|
|
||||||
|
void StartRecv( int32_t total_bytes );
|
||||||
|
|
||||||
|
void StartError( const asio::error_code& error );
|
||||||
|
|
||||||
|
void DispatchSend( std::vector< uint8_t > buffer );
|
||||||
|
|
||||||
|
void DispatchRecv( int32_t total_bytes );
|
||||||
|
|
||||||
|
void HandleConnect( const asio::error_code& error );
|
||||||
|
|
||||||
|
void HandleSend( const asio::error_code& error, std::list< std::vector< uint8_t > >::iterator itr );
|
||||||
|
|
||||||
|
void HandleRecv( const asio::error_code& error, int32_t actual_bytes );
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Called when the connection has successfully connected to the local host.
|
||||||
|
virtual void OnAccept( const std::string& host, uint16_t port )
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
// Called when the connection has successfully connected to the remote host.
|
||||||
|
virtual void OnConnect( const std::string& host, uint16_t port )
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
// Called when data has been sent by the connection.
|
||||||
|
virtual void OnSend( const std::vector< uint8_t >& buffer )
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
// Called when data has been received by the connection.
|
||||||
|
virtual void OnRecv( std::vector< uint8_t >& buffer )
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
// Called when an error is encountered.
|
||||||
|
virtual void OnError( const asio::error_code& error )
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
// Called when the connection has been disconnected
|
||||||
|
virtual void OnDisconnect()
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Returns the Hive object.
|
||||||
|
HivePtr GetHive();
|
||||||
|
|
||||||
|
// Returns the socket object.
|
||||||
|
asio::ip::tcp::socket& GetSocket();
|
||||||
|
|
||||||
|
// Returns the strand object.
|
||||||
|
asio::strand& GetStrand();
|
||||||
|
|
||||||
|
// Sets the application specific receive buffer size used. For stream
|
||||||
|
// based protocols such as HTTP, you want this to be pretty large, like
|
||||||
|
// 64kb. For packet based protocols, then it will be much smaller,
|
||||||
|
// usually 512b - 8kb depending on the protocol. The default value is
|
||||||
|
// 4kb.
|
||||||
|
void SetReceiveBufferSize( int32_t size );
|
||||||
|
|
||||||
|
// Returns the size of the receive buffer size of the current object.
|
||||||
|
int32_t GetReceiveBufferSize() const;
|
||||||
|
|
||||||
|
// Returns true if this object has an error associated with it.
|
||||||
|
bool HasError();
|
||||||
|
|
||||||
|
// Binds the socket to the specified interface.
|
||||||
|
void Bind( const std::string& ip, uint16_t port );
|
||||||
|
|
||||||
|
// Starts an a/synchronous connect.
|
||||||
|
void Connect( const std::string& host, uint16_t port );
|
||||||
|
|
||||||
|
// Posts data to be sent to the connection.
|
||||||
|
void Send( const std::vector< uint8_t >& buffer );
|
||||||
|
|
||||||
|
// Posts a recv for the connection to process. If total_bytes is 0, then
|
||||||
|
// as many bytes as possible up to GetReceiveBufferSize() will be
|
||||||
|
// waited for. If Recv is not 0, then the connection will wait for exactly
|
||||||
|
// total_bytes before invoking OnRecv.
|
||||||
|
void Recv( int32_t total_bytes = 0 );
|
||||||
|
|
||||||
|
// Posts an asynchronous disconnect event for the object to process.
|
||||||
|
void Disconnect();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Called when the connection has successfully connected to the remote host.
|
//-----------------------------------------------------------------------------
|
||||||
virtual void OnConnect( const std::string& host, uint16_t port )
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
template< class T >
|
||||||
|
std::shared_ptr< T > addServerToHive( const std::string& listenIp, uint32_t port, HivePtr pHive )
|
||||||
{
|
{
|
||||||
};
|
try
|
||||||
|
{
|
||||||
// Called when data has been sent by the connection.
|
AcceptorPtr acceptor( new Acceptor( pHive ) );
|
||||||
virtual void OnSend( const std::vector< uint8_t >& buffer )
|
acceptor->Listen( listenIp, port );
|
||||||
{
|
std::shared_ptr< T > connection( new T( pHive, acceptor ) );
|
||||||
};
|
acceptor->Accept( connection );
|
||||||
|
return connection;
|
||||||
// Called when data has been received by the connection.
|
}
|
||||||
virtual void OnRecv( std::vector< uint8_t >& buffer )
|
catch( std::runtime_error e )
|
||||||
{
|
{
|
||||||
};
|
throw;
|
||||||
|
}
|
||||||
// Called when an error is encountered.
|
|
||||||
virtual void OnError( const asio::error_code& error )
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
// Called when the connection has been disconnected
|
|
||||||
virtual void OnDisconnect()
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
|
||||||
// Returns the Hive object.
|
|
||||||
HivePtr GetHive();
|
|
||||||
|
|
||||||
// Returns the socket object.
|
|
||||||
asio::ip::tcp::socket& GetSocket();
|
|
||||||
|
|
||||||
// Returns the strand object.
|
|
||||||
asio::strand& GetStrand();
|
|
||||||
|
|
||||||
// Sets the application specific receive buffer size used. For stream
|
|
||||||
// based protocols such as HTTP, you want this to be pretty large, like
|
|
||||||
// 64kb. For packet based protocols, then it will be much smaller,
|
|
||||||
// usually 512b - 8kb depending on the protocol. The default value is
|
|
||||||
// 4kb.
|
|
||||||
void SetReceiveBufferSize( int32_t size );
|
|
||||||
|
|
||||||
// Returns the size of the receive buffer size of the current object.
|
|
||||||
int32_t GetReceiveBufferSize() const;
|
|
||||||
|
|
||||||
// Returns true if this object has an error associated with it.
|
|
||||||
bool HasError();
|
|
||||||
|
|
||||||
// Binds the socket to the specified interface.
|
|
||||||
void Bind( const std::string& ip, uint16_t port );
|
|
||||||
|
|
||||||
// Starts an a/synchronous connect.
|
|
||||||
void Connect( const std::string& host, uint16_t port );
|
|
||||||
|
|
||||||
// Posts data to be sent to the connection.
|
|
||||||
void Send( const std::vector< uint8_t >& buffer );
|
|
||||||
|
|
||||||
// Posts a recv for the connection to process. If total_bytes is 0, then
|
|
||||||
// as many bytes as possible up to GetReceiveBufferSize() will be
|
|
||||||
// waited for. If Recv is not 0, then the connection will wait for exactly
|
|
||||||
// total_bytes before invoking OnRecv.
|
|
||||||
void Recv( int32_t total_bytes = 0 );
|
|
||||||
|
|
||||||
// Posts an asynchronous disconnect event for the object to process.
|
|
||||||
void Disconnect();
|
|
||||||
};
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
template< class T >
|
|
||||||
std::shared_ptr< T > addServerToHive( const std::string& listenIp, uint32_t port, HivePtr pHive )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
AcceptorPtr acceptor( new Acceptor( pHive ) );
|
|
||||||
acceptor->Listen( listenIp, port );
|
|
||||||
std::shared_ptr< T > connection( new T( pHive, acceptor ) );
|
|
||||||
acceptor->Accept( connection );
|
|
||||||
return connection;
|
|
||||||
}
|
}
|
||||||
catch( std::runtime_error e )
|
|
||||||
{
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -14,326 +14,323 @@
|
||||||
#include "CommonNetwork.h"
|
#include "CommonNetwork.h"
|
||||||
#include "PacketDef/Ipcs.h"
|
#include "PacketDef/Ipcs.h"
|
||||||
|
|
||||||
namespace Core {
|
namespace Core::Network::Packets
|
||||||
namespace Network {
|
|
||||||
namespace Packets {
|
|
||||||
|
|
||||||
// Must forward define these in order to enable the compiler to produce the
|
|
||||||
// correct template functions.
|
|
||||||
|
|
||||||
template< typename T, typename T1 >
|
|
||||||
class FFXIVIpcPacket;
|
|
||||||
|
|
||||||
template< class T >
|
|
||||||
using ZoneChannelPacket = FFXIVIpcPacket< T, ServerZoneIpcType >;
|
|
||||||
|
|
||||||
template< class T >
|
|
||||||
using ChatChannelPacket = FFXIVIpcPacket< T, ServerChatIpcType >;
|
|
||||||
|
|
||||||
template< class T >
|
|
||||||
using LobbyChannelPacket = FFXIVIpcPacket< T, ServerLobbyIpcType >;
|
|
||||||
|
|
||||||
|
|
||||||
template< class T, typename... Args >
|
|
||||||
std::shared_ptr< ZoneChannelPacket< T > > makeZonePacket( Args... args )
|
|
||||||
{
|
{
|
||||||
return std::make_shared< ZoneChannelPacket< T > >( args... );
|
|
||||||
|
// Must forward define these in order to enable the compiler to produce the
|
||||||
|
// correct template functions.
|
||||||
|
|
||||||
|
template< typename T, typename T1 >
|
||||||
|
class FFXIVIpcPacket;
|
||||||
|
|
||||||
|
template< class T >
|
||||||
|
using ZoneChannelPacket = FFXIVIpcPacket< T, ServerZoneIpcType >;
|
||||||
|
|
||||||
|
template< class T >
|
||||||
|
using ChatChannelPacket = FFXIVIpcPacket< T, ServerChatIpcType >;
|
||||||
|
|
||||||
|
template< class T >
|
||||||
|
using LobbyChannelPacket = FFXIVIpcPacket< T, ServerLobbyIpcType >;
|
||||||
|
|
||||||
|
|
||||||
|
template< class T, typename... Args >
|
||||||
|
std::shared_ptr< ZoneChannelPacket< T > > makeZonePacket( Args... args )
|
||||||
|
{
|
||||||
|
return std::make_shared< ZoneChannelPacket< T > >( args... );
|
||||||
|
}
|
||||||
|
|
||||||
|
template< class T, typename... Args >
|
||||||
|
std::shared_ptr< T > makeWrappedPacket( Args... args )
|
||||||
|
{
|
||||||
|
return std::make_shared< T >( args... );
|
||||||
|
}
|
||||||
|
|
||||||
|
template< class T, typename... Args >
|
||||||
|
std::shared_ptr< ChatChannelPacket< T > > makeChatPacket( Args... args )
|
||||||
|
{
|
||||||
|
return std::make_shared< ChatChannelPacket< T > >( args... );
|
||||||
|
}
|
||||||
|
|
||||||
|
template< class T, typename... Args >
|
||||||
|
std::shared_ptr< LobbyChannelPacket< T > > makeLobbyPacket( Args... args )
|
||||||
|
{
|
||||||
|
return std::make_shared< LobbyChannelPacket< T > >( args... );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The base implementation of a game packet. Needed for parsing packets.
|
||||||
|
*/
|
||||||
|
template< typename T1 >
|
||||||
|
class FFXIVIpcPacketBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~FFXIVIpcPacketBase() = default;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the IPC type of this packet. (Useful for determining the
|
||||||
|
* type of a parsed packet.)
|
||||||
|
*/
|
||||||
|
virtual T1 ipcType() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
////////////////////////////////////////////////7
|
||||||
|
|
||||||
|
class FFXIVPacketBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FFXIVPacketBase() :
|
||||||
|
m_segmentType( 0 )
|
||||||
|
{
|
||||||
|
initializeSegmentHeader();
|
||||||
|
}
|
||||||
|
|
||||||
|
FFXIVPacketBase( uint16_t segmentType, uint32_t sourceActorId, uint32_t targetActorId ) :
|
||||||
|
m_segmentType( segmentType )
|
||||||
|
{
|
||||||
|
initializeSegmentHeader();
|
||||||
|
setSourceActor( sourceActorId );
|
||||||
|
setTargetActor( targetActorId );
|
||||||
|
}
|
||||||
|
|
||||||
|
std::size_t getSize() const
|
||||||
|
{
|
||||||
|
return m_segHdr.size;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual std::vector< uint8_t > getData() const
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/** The segment header */
|
||||||
|
FFXIVARR_PACKET_SEGMENT_HEADER m_segHdr;
|
||||||
|
uint16_t m_segmentType;
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual uint32_t getContentSize()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual std::vector< uint8_t > getContent()
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the segment type of this packet.
|
||||||
|
*/
|
||||||
|
uint16_t getSegmentType() const
|
||||||
|
{
|
||||||
|
return m_segmentType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the source actor id for this packet.
|
||||||
|
* @param actorId The source actor id.
|
||||||
|
*/
|
||||||
|
void setSourceActor( uint32_t actorId )
|
||||||
|
{
|
||||||
|
m_segHdr.source_actor = actorId;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the source actor id for this packet.
|
||||||
|
* @return The source actor id.
|
||||||
|
*/
|
||||||
|
uint32_t getSourceActor() const
|
||||||
|
{
|
||||||
|
return m_segHdr.source_actor;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the target actor id for this packet.
|
||||||
|
* @param actorId The target actor id.
|
||||||
|
*/
|
||||||
|
void setTargetActor( uint32_t actorId )
|
||||||
|
{
|
||||||
|
m_segHdr.target_actor = actorId;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the target actor id for this packet.
|
||||||
|
*/
|
||||||
|
uint32_t getTargetActor( void ) const
|
||||||
|
{
|
||||||
|
return m_segHdr.target_actor;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Initializes the fields of the segment header structure */
|
||||||
|
virtual void initializeSegmentHeader( void )
|
||||||
|
{
|
||||||
|
// Zero out the structure.
|
||||||
|
memset( &m_segHdr, 0, sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) );
|
||||||
|
|
||||||
|
// Set the values of static fields.
|
||||||
|
// The size must be the sum of the segment header and the content
|
||||||
|
m_segHdr.size = sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) + getContentSize();
|
||||||
|
m_segHdr.type = getSegmentType();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
template< typename T, typename T1 >
|
||||||
|
class FFXIVIpcPacket :
|
||||||
|
public FFXIVIpcPacketBase< T1 >, public FFXIVPacketBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FFXIVIpcPacket< T, T1 >( uint32_t sourceActorId, uint32_t targetActorId ) :
|
||||||
|
FFXIVPacketBase( 3, sourceActorId, targetActorId )
|
||||||
|
{
|
||||||
|
initialize();
|
||||||
|
};
|
||||||
|
|
||||||
|
FFXIVIpcPacket< T, T1 >( uint32_t sourceActorId ) :
|
||||||
|
FFXIVPacketBase( 3, sourceActorId, sourceActorId )
|
||||||
|
{
|
||||||
|
initialize();
|
||||||
|
};
|
||||||
|
|
||||||
|
FFXIVIpcPacket< T, T1 >( const FFXIVARR_PACKET_RAW& rawPacket )
|
||||||
|
{
|
||||||
|
auto ipcHdrSize = sizeof( FFXIVARR_IPC_HEADER );
|
||||||
|
auto copySize = std::min< uint32_t >( sizeof( T ), rawPacket.segHdr.size - ipcHdrSize );
|
||||||
|
|
||||||
|
memcpy( &m_segHdr, &rawPacket.segHdr, sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) );
|
||||||
|
memcpy( &m_data, &rawPacket.data[ 0 ] + ipcHdrSize, copySize );
|
||||||
|
|
||||||
|
memset( &m_ipcHdr, 0, ipcHdrSize );
|
||||||
|
m_ipcHdr.type = static_cast< ServerZoneIpcType >( m_data._ServerIpcType );
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t getContentSize() override
|
||||||
|
{
|
||||||
|
return sizeof( FFXIVARR_IPC_HEADER ) + sizeof( T );
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector< uint8_t > getContent() override
|
||||||
|
{
|
||||||
|
std::vector< uint8_t > content( getContentSize() );
|
||||||
|
memcpy( content.data(), &m_ipcHdr, sizeof( FFXIVARR_IPC_HEADER ) );
|
||||||
|
memcpy( content.data() + sizeof( FFXIVARR_IPC_HEADER ), &m_data, sizeof( T ) );
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector< uint8_t > getData() const override
|
||||||
|
{
|
||||||
|
auto segmentHeaderSize = sizeof( FFXIVARR_PACKET_SEGMENT_HEADER );
|
||||||
|
auto ipcHeaderSize = sizeof( FFXIVARR_IPC_HEADER );
|
||||||
|
auto dataSize = sizeof( m_data );
|
||||||
|
|
||||||
|
std::vector< uint8_t > data( segmentHeaderSize + ipcHeaderSize + dataSize );
|
||||||
|
|
||||||
|
memcpy( &data[ 0 ], &m_segHdr, segmentHeaderSize );
|
||||||
|
memcpy( &data[ segmentHeaderSize ], &m_ipcHdr, ipcHeaderSize );
|
||||||
|
memcpy( &data[ segmentHeaderSize + ipcHeaderSize ], &m_data, dataSize );
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
T1 ipcType() override
|
||||||
|
{
|
||||||
|
return static_cast< T1 >( m_data._ServerIpcType );
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Gets a reference to the underlying IPC data structure. */
|
||||||
|
T& data()
|
||||||
|
{
|
||||||
|
return m_data;
|
||||||
|
};
|
||||||
|
|
||||||
|
const T& data() const
|
||||||
|
{
|
||||||
|
return m_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/** Initializes the fields of the header structures */
|
||||||
|
virtual void initialize()
|
||||||
|
{
|
||||||
|
// Zero out the structures.
|
||||||
|
memset( &m_ipcHdr, 0, sizeof( FFXIVARR_IPC_HEADER ) );
|
||||||
|
memset( &m_data, 0, sizeof( T ) );
|
||||||
|
|
||||||
|
// The IPC type itself.
|
||||||
|
m_ipcHdr.type = static_cast< ServerZoneIpcType >( m_data._ServerIpcType );
|
||||||
|
m_ipcHdr.timestamp = static_cast< uint32_t >( Util::getTimeSeconds() );
|
||||||
|
m_segHdr.size = sizeof( T ) + sizeof( FFXIVARR_IPC_HEADER ) + sizeof( FFXIVARR_PACKET_SEGMENT_HEADER );
|
||||||
|
};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/** The IPC packet header */
|
||||||
|
FFXIVARR_IPC_HEADER m_ipcHdr;
|
||||||
|
/** The underlying data portion of the packet as a structure */
|
||||||
|
T m_data;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class FFXIVRawPacket :
|
||||||
|
public FFXIVPacketBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FFXIVRawPacket( uint16_t type, uint32_t size, uint32_t sourceActorId, uint32_t targetActorId ) :
|
||||||
|
m_data( std::vector< uint8_t >( size - sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) ) ),
|
||||||
|
FFXIVPacketBase( type, sourceActorId, targetActorId )
|
||||||
|
{
|
||||||
|
initialize();
|
||||||
|
m_segHdr.size = size;
|
||||||
|
};
|
||||||
|
|
||||||
|
FFXIVRawPacket( char* data, uint16_t size ) :
|
||||||
|
m_data( std::vector< uint8_t >( size ) )
|
||||||
|
{
|
||||||
|
auto segmentHdrSize = sizeof( FFXIVARR_PACKET_SEGMENT_HEADER );
|
||||||
|
|
||||||
|
memcpy( &m_data[ 0 ], data + segmentHdrSize, size - segmentHdrSize );
|
||||||
|
memcpy( &m_segHdr, data, segmentHdrSize );
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t getContentSize() override
|
||||||
|
{
|
||||||
|
return m_data.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector< uint8_t > getContent() override
|
||||||
|
{
|
||||||
|
return m_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual std::vector< uint8_t > getData() const override
|
||||||
|
{
|
||||||
|
std::vector< uint8_t > data( sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) + m_data.size() );
|
||||||
|
|
||||||
|
memcpy( &data[ 0 ], &m_segHdr, sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) );
|
||||||
|
memcpy( &data[ sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) ], &m_data[ 0 ], m_data.size() );
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Gets a reference to the underlying IPC data structure. */
|
||||||
|
std::vector< uint8_t >& data()
|
||||||
|
{
|
||||||
|
return m_data;
|
||||||
|
};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/** Initializes the fields of the header structures */
|
||||||
|
virtual void initialize()
|
||||||
|
{
|
||||||
|
// Zero out the structures.
|
||||||
|
memset( &m_data[ 0 ], 0, m_data.size() );
|
||||||
|
};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/** The underlying data portion of the packet as a structure */
|
||||||
|
std::vector< uint8_t > m_data;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template< class T, typename... Args >
|
|
||||||
std::shared_ptr< T > makeWrappedPacket( Args... args )
|
|
||||||
{
|
|
||||||
return std::make_shared< T >( args... );
|
|
||||||
}
|
|
||||||
|
|
||||||
template< class T, typename... Args >
|
|
||||||
std::shared_ptr< ChatChannelPacket< T > > makeChatPacket( Args... args )
|
|
||||||
{
|
|
||||||
return std::make_shared< ChatChannelPacket< T > >( args... );
|
|
||||||
}
|
|
||||||
|
|
||||||
template< class T, typename... Args >
|
|
||||||
std::shared_ptr< LobbyChannelPacket< T > > makeLobbyPacket( Args... args )
|
|
||||||
{
|
|
||||||
return std::make_shared< LobbyChannelPacket< T > >( args... );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of a game packet. Needed for parsing packets.
|
|
||||||
*/
|
|
||||||
template< typename T1 >
|
|
||||||
class FFXIVIpcPacketBase
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual ~FFXIVIpcPacketBase() = default;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Gets the IPC type of this packet. (Useful for determining the
|
|
||||||
* type of a parsed packet.)
|
|
||||||
*/
|
|
||||||
virtual T1 ipcType() = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
////////////////////////////////////////////////7
|
|
||||||
|
|
||||||
class FFXIVPacketBase
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
FFXIVPacketBase() :
|
|
||||||
m_segmentType( 0 )
|
|
||||||
{
|
|
||||||
initializeSegmentHeader();
|
|
||||||
}
|
|
||||||
|
|
||||||
FFXIVPacketBase( uint16_t segmentType, uint32_t sourceActorId, uint32_t targetActorId ) :
|
|
||||||
m_segmentType( segmentType )
|
|
||||||
{
|
|
||||||
initializeSegmentHeader();
|
|
||||||
setSourceActor( sourceActorId );
|
|
||||||
setTargetActor( targetActorId );
|
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t getSize() const
|
|
||||||
{
|
|
||||||
return m_segHdr.size;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual std::vector< uint8_t > getData() const
|
|
||||||
{
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
/** The segment header */
|
|
||||||
FFXIVARR_PACKET_SEGMENT_HEADER m_segHdr;
|
|
||||||
uint16_t m_segmentType;
|
|
||||||
|
|
||||||
public:
|
|
||||||
virtual uint32_t getContentSize()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
virtual std::vector< uint8_t > getContent()
|
|
||||||
{
|
|
||||||
return {};
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Gets the segment type of this packet.
|
|
||||||
*/
|
|
||||||
uint16_t getSegmentType() const
|
|
||||||
{
|
|
||||||
return m_segmentType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Sets the source actor id for this packet.
|
|
||||||
* @param actorId The source actor id.
|
|
||||||
*/
|
|
||||||
void setSourceActor( uint32_t actorId )
|
|
||||||
{
|
|
||||||
m_segHdr.source_actor = actorId;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Gets the source actor id for this packet.
|
|
||||||
* @return The source actor id.
|
|
||||||
*/
|
|
||||||
uint32_t getSourceActor() const
|
|
||||||
{
|
|
||||||
return m_segHdr.source_actor;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Sets the target actor id for this packet.
|
|
||||||
* @param actorId The target actor id.
|
|
||||||
*/
|
|
||||||
void setTargetActor( uint32_t actorId )
|
|
||||||
{
|
|
||||||
m_segHdr.target_actor = actorId;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Gets the target actor id for this packet.
|
|
||||||
*/
|
|
||||||
uint32_t getTargetActor( void ) const
|
|
||||||
{
|
|
||||||
return m_segHdr.target_actor;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Initializes the fields of the segment header structure */
|
|
||||||
virtual void initializeSegmentHeader( void )
|
|
||||||
{
|
|
||||||
// Zero out the structure.
|
|
||||||
memset( &m_segHdr, 0, sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) );
|
|
||||||
|
|
||||||
// Set the values of static fields.
|
|
||||||
// The size must be the sum of the segment header and the content
|
|
||||||
m_segHdr.size = sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) + getContentSize();
|
|
||||||
m_segHdr.type = getSegmentType();
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
template< typename T, typename T1 >
|
|
||||||
class FFXIVIpcPacket :
|
|
||||||
public FFXIVIpcPacketBase< T1 >, public FFXIVPacketBase
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
FFXIVIpcPacket< T, T1 >( uint32_t sourceActorId, uint32_t targetActorId ) :
|
|
||||||
FFXIVPacketBase( 3, sourceActorId, targetActorId )
|
|
||||||
{
|
|
||||||
initialize();
|
|
||||||
};
|
|
||||||
|
|
||||||
FFXIVIpcPacket< T, T1 >( uint32_t sourceActorId ) :
|
|
||||||
FFXIVPacketBase( 3, sourceActorId, sourceActorId )
|
|
||||||
{
|
|
||||||
initialize();
|
|
||||||
};
|
|
||||||
|
|
||||||
FFXIVIpcPacket< T, T1 >( const FFXIVARR_PACKET_RAW& rawPacket )
|
|
||||||
{
|
|
||||||
auto ipcHdrSize = sizeof( FFXIVARR_IPC_HEADER );
|
|
||||||
auto copySize = std::min< uint32_t >( sizeof( T ), rawPacket.segHdr.size - ipcHdrSize );
|
|
||||||
|
|
||||||
memcpy( &m_segHdr, &rawPacket.segHdr, sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) );
|
|
||||||
memcpy( &m_data, &rawPacket.data[ 0 ] + ipcHdrSize, copySize );
|
|
||||||
|
|
||||||
memset( &m_ipcHdr, 0, ipcHdrSize );
|
|
||||||
m_ipcHdr.type = static_cast< ServerZoneIpcType >( m_data._ServerIpcType );
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t getContentSize() override
|
|
||||||
{
|
|
||||||
return sizeof( FFXIVARR_IPC_HEADER ) + sizeof( T );
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector< uint8_t > getContent() override
|
|
||||||
{
|
|
||||||
std::vector< uint8_t > content( getContentSize() );
|
|
||||||
memcpy( content.data(), &m_ipcHdr, sizeof( FFXIVARR_IPC_HEADER ) );
|
|
||||||
memcpy( content.data() + sizeof( FFXIVARR_IPC_HEADER ), &m_data, sizeof( T ) );
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector< uint8_t > getData() const override
|
|
||||||
{
|
|
||||||
auto segmentHeaderSize = sizeof( FFXIVARR_PACKET_SEGMENT_HEADER );
|
|
||||||
auto ipcHeaderSize = sizeof( FFXIVARR_IPC_HEADER );
|
|
||||||
auto dataSize = sizeof( m_data );
|
|
||||||
|
|
||||||
std::vector< uint8_t > data( segmentHeaderSize + ipcHeaderSize + dataSize );
|
|
||||||
|
|
||||||
memcpy( &data[ 0 ], &m_segHdr, segmentHeaderSize );
|
|
||||||
memcpy( &data[ segmentHeaderSize ], &m_ipcHdr, ipcHeaderSize );
|
|
||||||
memcpy( &data[ segmentHeaderSize + ipcHeaderSize ], &m_data, dataSize );
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
T1 ipcType() override
|
|
||||||
{
|
|
||||||
return static_cast< T1 >( m_data._ServerIpcType );
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Gets a reference to the underlying IPC data structure. */
|
|
||||||
T& data()
|
|
||||||
{
|
|
||||||
return m_data;
|
|
||||||
};
|
|
||||||
|
|
||||||
const T& data() const
|
|
||||||
{
|
|
||||||
return m_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
/** Initializes the fields of the header structures */
|
|
||||||
virtual void initialize()
|
|
||||||
{
|
|
||||||
// Zero out the structures.
|
|
||||||
memset( &m_ipcHdr, 0, sizeof( FFXIVARR_IPC_HEADER ) );
|
|
||||||
memset( &m_data, 0, sizeof( T ) );
|
|
||||||
|
|
||||||
// The IPC type itself.
|
|
||||||
m_ipcHdr.type = static_cast< ServerZoneIpcType >( m_data._ServerIpcType );
|
|
||||||
m_ipcHdr.timestamp = static_cast< uint32_t >( Util::getTimeSeconds() );
|
|
||||||
m_segHdr.size = sizeof( T ) + sizeof( FFXIVARR_IPC_HEADER ) + sizeof( FFXIVARR_PACKET_SEGMENT_HEADER );
|
|
||||||
};
|
|
||||||
|
|
||||||
protected:
|
|
||||||
/** The IPC packet header */
|
|
||||||
FFXIVARR_IPC_HEADER m_ipcHdr;
|
|
||||||
/** The underlying data portion of the packet as a structure */
|
|
||||||
T m_data;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class FFXIVRawPacket :
|
|
||||||
public FFXIVPacketBase
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
FFXIVRawPacket( uint16_t type, uint32_t size, uint32_t sourceActorId, uint32_t targetActorId ) :
|
|
||||||
m_data( std::vector< uint8_t >( size - sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) ) ),
|
|
||||||
FFXIVPacketBase( type, sourceActorId, targetActorId )
|
|
||||||
{
|
|
||||||
initialize();
|
|
||||||
m_segHdr.size = size;
|
|
||||||
};
|
|
||||||
|
|
||||||
FFXIVRawPacket( char* data, uint16_t size ) :
|
|
||||||
m_data( std::vector< uint8_t >( size ) )
|
|
||||||
{
|
|
||||||
auto segmentHdrSize = sizeof( FFXIVARR_PACKET_SEGMENT_HEADER );
|
|
||||||
|
|
||||||
memcpy( &m_data[ 0 ], data + segmentHdrSize, size - segmentHdrSize );
|
|
||||||
memcpy( &m_segHdr, data, segmentHdrSize );
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t getContentSize() override
|
|
||||||
{
|
|
||||||
return m_data.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector< uint8_t > getContent() override
|
|
||||||
{
|
|
||||||
return m_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual std::vector< uint8_t > getData() const override
|
|
||||||
{
|
|
||||||
std::vector< uint8_t > data( sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) + m_data.size() );
|
|
||||||
|
|
||||||
memcpy( &data[ 0 ], &m_segHdr, sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) );
|
|
||||||
memcpy( &data[ sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) ], &m_data[ 0 ], m_data.size() );
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Gets a reference to the underlying IPC data structure. */
|
|
||||||
std::vector< uint8_t >& data()
|
|
||||||
{
|
|
||||||
return m_data;
|
|
||||||
};
|
|
||||||
|
|
||||||
protected:
|
|
||||||
/** Initializes the fields of the header structures */
|
|
||||||
virtual void initialize()
|
|
||||||
{
|
|
||||||
// Zero out the structures.
|
|
||||||
memset( &m_data[ 0 ], 0, m_data.size() );
|
|
||||||
};
|
|
||||||
|
|
||||||
protected:
|
|
||||||
/** The underlying data portion of the packet as a structure */
|
|
||||||
std::vector< uint8_t > m_data;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} /* Packets */
|
|
||||||
} /* Network */
|
|
||||||
} /* Core */
|
|
||||||
|
|
||||||
#endif /*_CORE_NETWORK_PACKETS_CGAMEPACKETNEW_H*/
|
#endif /*_CORE_NETWORK_PACKETS_CGAMEPACKETNEW_H*/
|
||||||
|
|
|
@ -3,51 +3,47 @@
|
||||||
|
|
||||||
#include "CommonNetwork.h"
|
#include "CommonNetwork.h"
|
||||||
|
|
||||||
namespace Core {
|
namespace Core::Network::Packets
|
||||||
namespace Network {
|
|
||||||
namespace Packets {
|
|
||||||
|
|
||||||
enum PacketParseResult
|
|
||||||
{
|
{
|
||||||
/// Dissected game packet successfully
|
|
||||||
Success,
|
|
||||||
|
|
||||||
/// Buffer is too short to dissect a message.
|
enum PacketParseResult
|
||||||
Incomplete,
|
{
|
||||||
|
/// Dissected game packet successfully
|
||||||
|
Success,
|
||||||
|
|
||||||
/// Invalid data detected.
|
/// Buffer is too short to dissect a message.
|
||||||
Malformed
|
Incomplete,
|
||||||
};
|
|
||||||
|
|
||||||
/// Read packet header from buffer with given offset.
|
/// Invalid data detected.
|
||||||
/// Buffer with given offset must be pointing to start of the new FFXIV packet.
|
Malformed
|
||||||
PacketParseResult getHeader( const std::vector< uint8_t >& buffer, const uint32_t offset,
|
};
|
||||||
FFXIVARR_PACKET_HEADER& header );
|
|
||||||
|
|
||||||
/// Read packet header from buffer with given offset.
|
/// Read packet header from buffer with given offset.
|
||||||
/// Buffer with given offset must be pointing to start of FFXIVARR_PACKET_SEGMENT_HEADER data.
|
/// Buffer with given offset must be pointing to start of the new FFXIV packet.
|
||||||
/// Keep in mind that this function does check for data validity. Call checkSegmentHeader() if that's needed.
|
PacketParseResult getHeader( const std::vector< uint8_t >& buffer, const uint32_t offset,
|
||||||
PacketParseResult getSegmentHeader( const std::vector< uint8_t >& buffer, const uint32_t offset,
|
FFXIVARR_PACKET_HEADER& header );
|
||||||
FFXIVARR_PACKET_SEGMENT_HEADER& header );
|
|
||||||
|
|
||||||
/// Read packets from the buffer with given offset.
|
/// Read packet header from buffer with given offset.
|
||||||
/// Buffer with given offset must be pointing to end of FFXIVARR_PACKET_HEADER data.
|
/// Buffer with given offset must be pointing to start of FFXIVARR_PACKET_SEGMENT_HEADER data.
|
||||||
PacketParseResult getPackets( const std::vector< uint8_t >& buffer, const uint32_t offset,
|
/// Keep in mind that this function does check for data validity. Call checkSegmentHeader() if that's needed.
|
||||||
const FFXIVARR_PACKET_HEADER& header,
|
PacketParseResult getSegmentHeader( const std::vector< uint8_t >& buffer, const uint32_t offset,
|
||||||
std::vector< Packets::FFXIVARR_PACKET_RAW >& packets );
|
FFXIVARR_PACKET_SEGMENT_HEADER& header );
|
||||||
|
|
||||||
/// Read single packet from the buffer with given offset.
|
/// Read packets from the buffer with given offset.
|
||||||
/// Buffer with an offset must be pointing to start of FFXIVARR_PACKET_SEGMENT_HEADER data.
|
/// Buffer with given offset must be pointing to end of FFXIVARR_PACKET_HEADER data.
|
||||||
PacketParseResult getPacket( const std::vector< uint8_t >& buffer, const uint32_t offset,
|
PacketParseResult getPackets( const std::vector< uint8_t >& buffer, const uint32_t offset,
|
||||||
FFXIVARR_PACKET_RAW& packet );
|
const FFXIVARR_PACKET_HEADER& header,
|
||||||
|
std::vector< Packets::FFXIVARR_PACKET_RAW >& packets );
|
||||||
|
|
||||||
bool checkHeader( const FFXIVARR_PACKET_HEADER& header );
|
/// Read single packet from the buffer with given offset.
|
||||||
|
/// Buffer with an offset must be pointing to start of FFXIVARR_PACKET_SEGMENT_HEADER data.
|
||||||
|
PacketParseResult getPacket( const std::vector< uint8_t >& buffer, const uint32_t offset,
|
||||||
|
FFXIVARR_PACKET_RAW& packet );
|
||||||
|
|
||||||
bool checkSegmentHeader( const FFXIVARR_PACKET_SEGMENT_HEADER& header );
|
bool checkHeader( const FFXIVARR_PACKET_HEADER& header );
|
||||||
|
|
||||||
|
bool checkSegmentHeader( const FFXIVARR_PACKET_SEGMENT_HEADER& header );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -5,52 +5,50 @@
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core:: Network
|
||||||
namespace Network {
|
|
||||||
|
|
||||||
class Hive : public std::enable_shared_from_this< Hive >
|
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
asio::io_service m_io_service;
|
|
||||||
std::shared_ptr< asio::io_service::work > m_work_ptr;
|
|
||||||
std::atomic< uint32_t > m_shutdown;
|
|
||||||
|
|
||||||
private:
|
class Hive : public std::enable_shared_from_this< Hive >
|
||||||
Hive( const Hive& rhs );
|
{
|
||||||
|
private:
|
||||||
|
asio::io_service m_io_service;
|
||||||
|
std::shared_ptr< asio::io_service::work > m_work_ptr;
|
||||||
|
std::atomic< uint32_t > m_shutdown;
|
||||||
|
|
||||||
Hive& operator=( const Hive& rhs );
|
private:
|
||||||
|
Hive( const Hive& rhs );
|
||||||
|
|
||||||
public:
|
Hive& operator=( const Hive& rhs );
|
||||||
Hive();
|
|
||||||
|
|
||||||
virtual ~Hive();
|
public:
|
||||||
|
Hive();
|
||||||
|
|
||||||
// Returns the io_service of this object.
|
virtual ~Hive();
|
||||||
asio::io_service& GetService();
|
|
||||||
|
|
||||||
// Returns true if the Stop function has been called.
|
// Returns the io_service of this object.
|
||||||
bool HasStopped();
|
asio::io_service& GetService();
|
||||||
|
|
||||||
// Polls the networking subsystem once from the current thread and
|
// Returns true if the Stop function has been called.
|
||||||
// returns.
|
bool HasStopped();
|
||||||
void Poll();
|
|
||||||
|
|
||||||
// Runs the networking system on the current thread. This function blocks
|
// Polls the networking subsystem once from the current thread and
|
||||||
// until the networking system is stopped, so do not call on a single
|
// returns.
|
||||||
// threaded application with no other means of being able to call Stop
|
void Poll();
|
||||||
// unless you code in such logic.
|
|
||||||
void Run();
|
|
||||||
|
|
||||||
// Stops the networking system. All work is finished and no more
|
// Runs the networking system on the current thread. This function blocks
|
||||||
// networking interactions will be possible afterwards until Reset is called.
|
// until the networking system is stopped, so do not call on a single
|
||||||
void Stop();
|
// threaded application with no other means of being able to call Stop
|
||||||
|
// unless you code in such logic.
|
||||||
|
void Run();
|
||||||
|
|
||||||
// Restarts the networking system after Stop as been called. A new work
|
// Stops the networking system. All work is finished and no more
|
||||||
// object is created ad the shutdown flag is cleared.
|
// networking interactions will be possible afterwards until Reset is called.
|
||||||
void Reset();
|
void Stop();
|
||||||
};
|
|
||||||
|
// Restarts the networking system after Stop as been called. A new work
|
||||||
|
// object is created ad the shutdown flag is cleared.
|
||||||
|
void Reset();
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8,36 +8,33 @@
|
||||||
#include "GamePacketNew.h"
|
#include "GamePacketNew.h"
|
||||||
#include "Forwards.h"
|
#include "Forwards.h"
|
||||||
|
|
||||||
namespace Core {
|
namespace Core::Network::Packets
|
||||||
namespace Network {
|
|
||||||
namespace Packets {
|
|
||||||
|
|
||||||
typedef std::shared_ptr< FFXIVPacketBase > FFXIVPacketBasePtr;
|
|
||||||
|
|
||||||
class PacketContainer
|
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
PacketContainer( uint32_t segmentTargetOverride = 0 );
|
|
||||||
|
|
||||||
~PacketContainer();
|
using FFXIVPacketBasePtr = std::shared_ptr< FFXIVPacketBase >;
|
||||||
|
|
||||||
void addPacket( FFXIVPacketBasePtr entry );
|
class PacketContainer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PacketContainer( uint32_t segmentTargetOverride = 0 );
|
||||||
|
|
||||||
FFXIVARR_PACKET_HEADER m_ipcHdr;
|
~PacketContainer();
|
||||||
|
|
||||||
std::vector< FFXIVPacketBasePtr > m_entryList;
|
void addPacket( FFXIVPacketBasePtr entry );
|
||||||
|
|
||||||
std::string toString();
|
FFXIVARR_PACKET_HEADER m_ipcHdr;
|
||||||
|
|
||||||
void fillSendBuffer( std::vector< uint8_t >& sendBuffer );
|
std::vector< FFXIVPacketBasePtr > m_entryList;
|
||||||
|
|
||||||
private:
|
std::string toString();
|
||||||
uint32_t m_segmentTargetOverride;
|
|
||||||
|
|
||||||
};
|
void fillSendBuffer( std::vector< uint8_t >& sendBuffer );
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint32_t m_segmentTargetOverride;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -7,122 +7,123 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core
|
||||||
|
|
||||||
template< class T >
|
|
||||||
class LockedQueue
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
LockedQueue();
|
|
||||||
|
|
||||||
~LockedQueue();
|
|
||||||
|
|
||||||
T pop();
|
|
||||||
|
|
||||||
//we can pass this in by reference, instead of copying
|
|
||||||
void push( const T object );
|
|
||||||
|
|
||||||
//we can pass this in by reference
|
|
||||||
//this will push it onto the queue, and swap the object
|
|
||||||
// with a default-constructed T at the same time.
|
|
||||||
void push_swap( T& object );
|
|
||||||
|
|
||||||
void push_reset( T& object );
|
|
||||||
|
|
||||||
|
|
||||||
std::size_t size();
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
std::queue< T > m_queue;
|
|
||||||
std::mutex m_mutex;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
template< class T >
|
|
||||||
LockedQueue< T >::LockedQueue()
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
template< class T >
|
||||||
|
class LockedQueue
|
||||||
template< class T >
|
|
||||||
std::size_t LockedQueue< T >::size()
|
|
||||||
{
|
|
||||||
std::lock_guard< std::mutex > lock( m_mutex );
|
|
||||||
return m_queue.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template< class T >
|
|
||||||
LockedQueue< T >::~LockedQueue()
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template< class T >
|
|
||||||
T LockedQueue< T >::pop()
|
|
||||||
{
|
|
||||||
std::lock_guard< std::mutex > lock( m_mutex );
|
|
||||||
|
|
||||||
if( m_queue.empty() )
|
|
||||||
{
|
{
|
||||||
return T();
|
public:
|
||||||
|
LockedQueue();
|
||||||
|
|
||||||
|
~LockedQueue();
|
||||||
|
|
||||||
|
T pop();
|
||||||
|
|
||||||
|
//we can pass this in by reference, instead of copying
|
||||||
|
void push( const T object );
|
||||||
|
|
||||||
|
//we can pass this in by reference
|
||||||
|
//this will push it onto the queue, and swap the object
|
||||||
|
// with a default-constructed T at the same time.
|
||||||
|
void push_swap( T& object );
|
||||||
|
|
||||||
|
void push_reset( T& object );
|
||||||
|
|
||||||
|
|
||||||
|
std::size_t size();
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::queue< T > m_queue;
|
||||||
|
std::mutex m_mutex;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
template< class T >
|
||||||
|
LockedQueue< T >::LockedQueue()
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
T result = m_queue.front();
|
template< class T >
|
||||||
|
std::size_t LockedQueue< T >::size()
|
||||||
|
{
|
||||||
|
std::lock_guard< std::mutex > lock( m_mutex );
|
||||||
|
return m_queue.size();
|
||||||
|
}
|
||||||
|
|
||||||
m_queue.pop();
|
|
||||||
|
|
||||||
return result;
|
template< class T >
|
||||||
}
|
LockedQueue< T >::~LockedQueue()
|
||||||
|
{
|
||||||
|
|
||||||
template< class T >
|
|
||||||
void LockedQueue< T >::push( const T object )
|
|
||||||
{
|
|
||||||
std::lock_guard< std::mutex > lock( m_mutex );
|
|
||||||
m_queue.push( object );
|
|
||||||
}
|
|
||||||
|
|
||||||
template< class T >
|
}
|
||||||
void LockedQueue< T >::push_swap( T& object )
|
|
||||||
{
|
|
||||||
std::lock_guard< std::mutex > lock( m_mutex );
|
|
||||||
|
|
||||||
m_queue.push( object );
|
|
||||||
|
|
||||||
T default_ctored_object = T();
|
template< class T >
|
||||||
//this is a special swap that will do a legit naive swap normally,
|
T LockedQueue< T >::pop()
|
||||||
// except if there exists a function called T::swap(), which is
|
{
|
||||||
// specialized and possibly faster.
|
std::lock_guard< std::mutex > lock( m_mutex );
|
||||||
std::swap( object, default_ctored_object );
|
|
||||||
|
if( m_queue.empty() )
|
||||||
|
{
|
||||||
|
return T();
|
||||||
|
}
|
||||||
|
|
||||||
|
T result = m_queue.front();
|
||||||
|
|
||||||
|
m_queue.pop();
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
template< class T >
|
||||||
|
void LockedQueue< T >::push( const T object )
|
||||||
|
{
|
||||||
|
std::lock_guard< std::mutex > lock( m_mutex );
|
||||||
|
m_queue.push( object );
|
||||||
|
}
|
||||||
|
|
||||||
|
template< class T >
|
||||||
|
void LockedQueue< T >::push_swap( T& object )
|
||||||
|
{
|
||||||
|
std::lock_guard< std::mutex > lock( m_mutex );
|
||||||
|
|
||||||
|
m_queue.push( object );
|
||||||
|
|
||||||
|
T default_ctored_object = T();
|
||||||
|
//this is a special swap that will do a legit naive swap normally,
|
||||||
|
// except if there exists a function called T::swap(), which is
|
||||||
|
// specialized and possibly faster.
|
||||||
|
std::swap( object, default_ctored_object );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//default_ctored_object is now the value of object, and it will go out
|
//default_ctored_object is now the value of object, and it will go out
|
||||||
// of scope here. In the case that T is a shared_ptr of some kind,
|
// of scope here. In the case that T is a shared_ptr of some kind,
|
||||||
// this will allow that the object on the queue is the *last* shared_ptr
|
// this will allow that the object on the queue is the *last* shared_ptr
|
||||||
// in existance by the time this function returns.
|
// in existance by the time this function returns.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template< class T >
|
template< class T >
|
||||||
void LockedQueue< T >::push_reset( T& object )
|
void LockedQueue< T >::push_reset( T& object )
|
||||||
{
|
{
|
||||||
std::lock_guard< std::mutex > lock( m_mutex );
|
std::lock_guard< std::mutex > lock( m_mutex );
|
||||||
|
|
||||||
m_queue.push( object );
|
m_queue.push( object );
|
||||||
|
|
||||||
T default_ctored_object = T();
|
T default_ctored_object = T();
|
||||||
|
|
||||||
object.reset();
|
object.reset();
|
||||||
|
|
||||||
//default_ctored_object is now the value of object, and it will go out
|
//default_ctored_object is now the value of object, and it will go out
|
||||||
// of scope here. In the case that T is a shared_ptr of some kind,
|
// of scope here. In the case that T is a shared_ptr of some kind,
|
||||||
// this will allow that the object on the queue is the *last* shared_ptr
|
// this will allow that the object on the queue is the *last* shared_ptr
|
||||||
// in existance by the time this function returns.
|
// in existance by the time this function returns.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,98 +8,99 @@
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core
|
||||||
|
|
||||||
template< typename T >
|
|
||||||
class LockedWaitQueue
|
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
std::mutex m_queueLock;
|
|
||||||
std::queue< T > m_queue;
|
|
||||||
std::condition_variable m_condition;
|
|
||||||
std::atomic< bool > m_shutdown;
|
|
||||||
|
|
||||||
public:
|
template< typename T >
|
||||||
|
class LockedWaitQueue
|
||||||
LockedWaitQueue< T >() :
|
|
||||||
m_shutdown( false )
|
|
||||||
{
|
{
|
||||||
}
|
private:
|
||||||
|
std::mutex m_queueLock;
|
||||||
|
std::queue< T > m_queue;
|
||||||
|
std::condition_variable m_condition;
|
||||||
|
std::atomic< bool > m_shutdown;
|
||||||
|
|
||||||
void push( const T& value )
|
public:
|
||||||
{
|
|
||||||
std::lock_guard< std::mutex > lock( m_queueLock );
|
|
||||||
m_queue.push( std::move( value ) );
|
|
||||||
|
|
||||||
m_condition.notify_one();
|
LockedWaitQueue< T >() :
|
||||||
}
|
m_shutdown( false )
|
||||||
|
|
||||||
bool empty()
|
|
||||||
{
|
|
||||||
std::lock_guard< std::mutex > lock( m_queueLock );
|
|
||||||
|
|
||||||
return m_queue.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool pop( T& value )
|
|
||||||
{
|
|
||||||
std::lock_guard< std::mutex > lock( m_queueLock );
|
|
||||||
|
|
||||||
if( m_queue.empty() || m_shutdown )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
value = m_queue.front();
|
|
||||||
|
|
||||||
m_queue.pop();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void waitAndPop( T& value )
|
|
||||||
{
|
|
||||||
std::unique_lock< std::mutex > lock( m_queueLock );
|
|
||||||
|
|
||||||
while( m_queue.empty() && !m_shutdown )
|
|
||||||
m_condition.wait( lock );
|
|
||||||
|
|
||||||
if( m_queue.empty() || m_shutdown )
|
|
||||||
return;
|
|
||||||
|
|
||||||
value = m_queue.front();
|
|
||||||
|
|
||||||
m_queue.pop();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cancel()
|
|
||||||
{
|
|
||||||
std::unique_lock< std::mutex > lock( m_queueLock );
|
|
||||||
|
|
||||||
while( !m_queue.empty() )
|
|
||||||
{
|
{
|
||||||
T& value = m_queue.front();
|
}
|
||||||
|
|
||||||
deleteQueuedObject( value );
|
void push( const T& value )
|
||||||
|
{
|
||||||
|
std::lock_guard< std::mutex > lock( m_queueLock );
|
||||||
|
m_queue.push( std::move( value ) );
|
||||||
|
|
||||||
|
m_condition.notify_one();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool empty()
|
||||||
|
{
|
||||||
|
std::lock_guard< std::mutex > lock( m_queueLock );
|
||||||
|
|
||||||
|
return m_queue.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pop( T& value )
|
||||||
|
{
|
||||||
|
std::lock_guard< std::mutex > lock( m_queueLock );
|
||||||
|
|
||||||
|
if( m_queue.empty() || m_shutdown )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
value = m_queue.front();
|
||||||
|
|
||||||
|
m_queue.pop();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void waitAndPop( T& value )
|
||||||
|
{
|
||||||
|
std::unique_lock< std::mutex > lock( m_queueLock );
|
||||||
|
|
||||||
|
while( m_queue.empty() && !m_shutdown )
|
||||||
|
m_condition.wait( lock );
|
||||||
|
|
||||||
|
if( m_queue.empty() || m_shutdown )
|
||||||
|
return;
|
||||||
|
|
||||||
|
value = m_queue.front();
|
||||||
|
|
||||||
m_queue.pop();
|
m_queue.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_shutdown = true;
|
void cancel()
|
||||||
|
{
|
||||||
|
std::unique_lock< std::mutex > lock( m_queueLock );
|
||||||
|
|
||||||
m_condition.notify_all();
|
while( !m_queue.empty() )
|
||||||
}
|
{
|
||||||
|
T& value = m_queue.front();
|
||||||
|
|
||||||
private:
|
deleteQueuedObject( value );
|
||||||
template< typename E = T >
|
|
||||||
typename std::enable_if< std::is_pointer< E >::value >::type deleteQueuedObject( E& obj )
|
|
||||||
{
|
|
||||||
delete obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename E = T >
|
m_queue.pop();
|
||||||
typename std::enable_if< !std::is_pointer< E >::value >::type deleteQueuedObject( E const& )
|
}
|
||||||
{
|
|
||||||
}
|
m_shutdown = true;
|
||||||
};
|
|
||||||
|
m_condition.notify_all();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
template< typename E = T >
|
||||||
|
typename std::enable_if< std::is_pointer< E >::value >::type deleteQueuedObject( E& obj )
|
||||||
|
{
|
||||||
|
delete obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
template< typename E = T >
|
||||||
|
typename std::enable_if< !std::is_pointer< E >::value >::type deleteQueuedObject( E const& )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5,104 +5,104 @@
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core::Util
|
||||||
namespace Util {
|
|
||||||
template< typename T, typename ActorIdType = uint32_t >
|
|
||||||
class SpawnIndexAllocator
|
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
static_assert( std::is_same< T, uint8_t >::value || std::is_same< T, uint16_t >::value ||
|
|
||||||
std::is_same< T, uint32_t >::value || std::is_same< T, uint64_t >::value,
|
|
||||||
"T must be uint8_t, uint16_t, uint32_t, uint64_t" );
|
|
||||||
|
|
||||||
SpawnIndexAllocator() :
|
template< typename T, typename ActorIdType = uint32_t >
|
||||||
m_maxSlotId( 0 ),
|
|
||||||
m_reserveFirstSlot( false )
|
class SpawnIndexAllocator
|
||||||
{
|
{
|
||||||
}
|
public:
|
||||||
|
static_assert( std::is_same< T, uint8_t >::value || std::is_same< T, uint16_t >::value ||
|
||||||
|
std::is_same< T, uint32_t >::value || std::is_same< T, uint64_t >::value,
|
||||||
|
"T must be uint8_t, uint16_t, uint32_t, uint64_t" );
|
||||||
|
|
||||||
void init( T maxSlotId, bool reserveFirstSlot = false )
|
SpawnIndexAllocator() :
|
||||||
{
|
m_maxSlotId( 0 ),
|
||||||
m_maxSlotId = maxSlotId;
|
m_reserveFirstSlot( false )
|
||||||
m_reserveFirstSlot = reserveFirstSlot;
|
{
|
||||||
|
}
|
||||||
|
|
||||||
setupQueue();
|
void init( T maxSlotId, bool reserveFirstSlot = false )
|
||||||
|
{
|
||||||
|
m_maxSlotId = maxSlotId;
|
||||||
|
m_reserveFirstSlot = reserveFirstSlot;
|
||||||
|
|
||||||
// todo: reserve max slot id in map to prevent any runtime reshashing
|
setupQueue();
|
||||||
}
|
|
||||||
|
|
||||||
T freeUsedSpawnIndex( ActorIdType actorId )
|
// todo: reserve max slot id in map to prevent any runtime reshashing
|
||||||
{
|
}
|
||||||
auto it = m_actorIdToAllocatedMap.find( actorId );
|
|
||||||
if( it == m_actorIdToAllocatedMap.end() )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
auto index = it->second;
|
T freeUsedSpawnIndex( ActorIdType actorId )
|
||||||
m_availableIds.push( index );
|
{
|
||||||
m_actorIdToAllocatedMap.erase( it );
|
auto it = m_actorIdToAllocatedMap.find( actorId );
|
||||||
|
if( it == m_actorIdToAllocatedMap.end() )
|
||||||
|
return 0;
|
||||||
|
|
||||||
return index;
|
auto index = it->second;
|
||||||
}
|
m_availableIds.push( index );
|
||||||
|
m_actorIdToAllocatedMap.erase( it );
|
||||||
|
|
||||||
T getNextFreeSpawnIndex( ActorIdType actorId )
|
return index;
|
||||||
{
|
}
|
||||||
assert( m_maxSlotId != 0 );
|
|
||||||
|
|
||||||
if( m_availableIds.empty() )
|
T getNextFreeSpawnIndex( ActorIdType actorId )
|
||||||
return getAllocFailId();
|
{
|
||||||
|
assert( m_maxSlotId != 0 );
|
||||||
|
|
||||||
auto nextId = m_availableIds.front();
|
if( m_availableIds.empty() )
|
||||||
m_availableIds.pop();
|
return getAllocFailId();
|
||||||
|
|
||||||
m_actorIdToAllocatedMap[ actorId ] = nextId;
|
auto nextId = m_availableIds.front();
|
||||||
|
|
||||||
return nextId;
|
|
||||||
}
|
|
||||||
|
|
||||||
void freeAllSpawnIndexes()
|
|
||||||
{
|
|
||||||
setupQueue();
|
|
||||||
|
|
||||||
m_actorIdToAllocatedMap.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isSpawnIndexValid( T spawnIndex )
|
|
||||||
{
|
|
||||||
return spawnIndex != getAllocFailId();
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr T getAllocFailId() const
|
|
||||||
{
|
|
||||||
return static_cast< T >( -1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void setupQueue()
|
|
||||||
{
|
|
||||||
assert( m_maxSlotId != 0 );
|
|
||||||
|
|
||||||
while( !m_availableIds.empty() )
|
|
||||||
m_availableIds.pop();
|
m_availableIds.pop();
|
||||||
|
|
||||||
uint32_t start = 0;
|
m_actorIdToAllocatedMap[ actorId ] = nextId;
|
||||||
|
|
||||||
// slot 0 is reserved when used for spawning actors/players otherwise the local player actor spawnIndex
|
return nextId;
|
||||||
// will be used by another actor and despawn the local player
|
}
|
||||||
if( m_reserveFirstSlot )
|
|
||||||
start = 1;
|
|
||||||
|
|
||||||
for( uint32_t i = start; i < m_maxSlotId; i++ )
|
void freeAllSpawnIndexes()
|
||||||
m_availableIds.push( i );
|
{
|
||||||
}
|
setupQueue();
|
||||||
|
|
||||||
std::queue< T > m_availableIds;
|
m_actorIdToAllocatedMap.clear();
|
||||||
std::unordered_map< ActorIdType, T > m_actorIdToAllocatedMap;
|
}
|
||||||
|
|
||||||
T m_maxSlotId;
|
bool isSpawnIndexValid( T spawnIndex )
|
||||||
bool m_reserveFirstSlot;
|
{
|
||||||
};
|
return spawnIndex != getAllocFailId();
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr T getAllocFailId() const
|
||||||
|
{
|
||||||
|
return static_cast< T >( -1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void setupQueue()
|
||||||
|
{
|
||||||
|
assert( m_maxSlotId != 0 );
|
||||||
|
|
||||||
|
while( !m_availableIds.empty() )
|
||||||
|
m_availableIds.pop();
|
||||||
|
|
||||||
|
uint32_t start = 0;
|
||||||
|
|
||||||
|
// slot 0 is reserved when used for spawning actors/players otherwise the local player actor spawnIndex
|
||||||
|
// will be used by another actor and despawn the local player
|
||||||
|
if( m_reserveFirstSlot )
|
||||||
|
start = 1;
|
||||||
|
|
||||||
|
for( uint32_t i = start; i < m_maxSlotId; i++ )
|
||||||
|
m_availableIds.push( i );
|
||||||
|
}
|
||||||
|
|
||||||
|
std::queue< T > m_availableIds;
|
||||||
|
std::unordered_map< ActorIdType, T > m_actorIdToAllocatedMap;
|
||||||
|
|
||||||
|
T m_maxSlotId;
|
||||||
|
bool m_reserveFirstSlot;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif //SAPPHIRE_SPAWNINDEXALLOCATOR_H
|
#endif //SAPPHIRE_SPAWNINDEXALLOCATOR_H
|
||||||
|
|
|
@ -5,33 +5,34 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
namespace Core::Util {
|
namespace Core::Util
|
||||||
|
|
||||||
std::string binaryToHexString( uint8_t* pBinData, uint16_t size );
|
|
||||||
|
|
||||||
std::string binaryToHexDump( uint8_t* pBinData, uint16_t size );
|
|
||||||
|
|
||||||
std::string intToHexString( uint64_t intValue, uint8_t width = 2 );
|
|
||||||
|
|
||||||
void eraseAll( std::string& inOutStr, char remove );
|
|
||||||
void eraseAllIn( std::string& inOutStr, std::string& remove );
|
|
||||||
|
|
||||||
std::string toLowerCopy( const std::string& inStr );
|
|
||||||
|
|
||||||
uint64_t getTimeMs();
|
|
||||||
|
|
||||||
int64_t getTimeSeconds();
|
|
||||||
|
|
||||||
uint64_t getEorzeanTimeStamp();
|
|
||||||
|
|
||||||
void valueToFlagByteIndexValue( uint32_t inVal, uint8_t& outVal, uint16_t& outIndex );
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
inline void hashCombine( std::size_t& seed, const T& v )
|
|
||||||
{
|
{
|
||||||
std::hash<T> hasher;
|
|
||||||
seed ^= hasher( v ) + 0x9e3779b9 + ( seed << 6 ) + ( seed >> 2 );
|
std::string binaryToHexString( uint8_t* pBinData, uint16_t size );
|
||||||
}
|
|
||||||
|
std::string binaryToHexDump( uint8_t* pBinData, uint16_t size );
|
||||||
|
|
||||||
|
std::string intToHexString( uint64_t intValue, uint8_t width = 2 );
|
||||||
|
|
||||||
|
void eraseAll( std::string& inOutStr, char remove );
|
||||||
|
void eraseAllIn( std::string& inOutStr, std::string& remove );
|
||||||
|
|
||||||
|
std::string toLowerCopy( const std::string& inStr );
|
||||||
|
|
||||||
|
uint64_t getTimeMs();
|
||||||
|
|
||||||
|
int64_t getTimeSeconds();
|
||||||
|
|
||||||
|
uint64_t getEorzeanTimeStamp();
|
||||||
|
|
||||||
|
void valueToFlagByteIndexValue( uint32_t inVal, uint8_t& outVal, uint16_t& outIndex );
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
inline void hashCombine( std::size_t& seed, const T& v )
|
||||||
|
{
|
||||||
|
std::hash< T > hasher;
|
||||||
|
seed ^= hasher( v ) + 0x9e3779b9 + ( seed << 6 ) + ( seed >> 2 );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,42 +5,39 @@
|
||||||
|
|
||||||
#define PI 3.14159265358979323846f
|
#define PI 3.14159265358979323846f
|
||||||
|
|
||||||
namespace Core {
|
namespace Core::Math::Util
|
||||||
namespace Math {
|
|
||||||
namespace Util {
|
|
||||||
|
|
||||||
float distanceSq( float x, float y, float z, float x1, float y1, float z1 );
|
|
||||||
|
|
||||||
float distance( float x, float y, float z, float x1, float y1, float z1 );
|
|
||||||
|
|
||||||
float distance2DSq( float x, float y, float x1, float y1 );
|
|
||||||
|
|
||||||
float distance2D( float x, float y, float x1, float y1 );
|
|
||||||
|
|
||||||
float calcAngTo( float x, float y, float x1, float y1 );
|
|
||||||
|
|
||||||
float calcAngFrom( float x, float y, float x1, float y1 );
|
|
||||||
|
|
||||||
uint16_t floatToUInt16( float val );
|
|
||||||
|
|
||||||
uint16_t floatToUInt16Rot( float val );
|
|
||||||
|
|
||||||
uint8_t floatToUInt8Rot( float val );
|
|
||||||
|
|
||||||
template < typename T >
|
|
||||||
T clamp( T val, T minimum, T maximum )
|
|
||||||
{
|
{
|
||||||
if( val > maximum )
|
|
||||||
return maximum;
|
|
||||||
|
|
||||||
if( val < minimum )
|
float distanceSq( float x, float y, float z, float x1, float y1, float z1 );
|
||||||
return minimum;
|
|
||||||
|
|
||||||
return val;
|
float distance( float x, float y, float z, float x1, float y1, float z1 );
|
||||||
}
|
|
||||||
|
float distance2DSq( float x, float y, float x1, float y1 );
|
||||||
|
|
||||||
|
float distance2D( float x, float y, float x1, float y1 );
|
||||||
|
|
||||||
|
float calcAngTo( float x, float y, float x1, float y1 );
|
||||||
|
|
||||||
|
float calcAngFrom( float x, float y, float x1, float y1 );
|
||||||
|
|
||||||
|
uint16_t floatToUInt16( float val );
|
||||||
|
|
||||||
|
uint16_t floatToUInt16Rot( float val );
|
||||||
|
|
||||||
|
uint8_t floatToUInt8Rot( float val );
|
||||||
|
|
||||||
|
template < typename T >
|
||||||
|
T clamp( T val, T minimum, T maximum )
|
||||||
|
{
|
||||||
|
if( val > maximum )
|
||||||
|
return maximum;
|
||||||
|
|
||||||
|
if( val < minimum )
|
||||||
|
return minimum;
|
||||||
|
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3,13 +3,10 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core::Version
|
||||||
namespace Version {
|
{
|
||||||
|
extern const std::string GIT_HASH;
|
||||||
extern const std::string GIT_HASH;
|
extern const std::string VERSION;
|
||||||
extern const std::string VERSION;
|
}
|
||||||
|
|
||||||
} /* Version */
|
|
||||||
} /* Core */
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -56,7 +56,7 @@ foreach(_scriptDir ${children})
|
||||||
|
|
||||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ScriptLoader.cpp.in" "${_scriptDir}/ScriptLoader.cpp")
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ScriptLoader.cpp.in" "${_scriptDir}/ScriptLoader.cpp")
|
||||||
|
|
||||||
cotire("script_${_name}")
|
#cotire("script_${_name}")
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
add_custom_command(TARGET "script_${_name}" POST_BUILD
|
add_custom_command(TARGET "script_${_name}" POST_BUILD
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#define AETHERYTE_MENU_FAVORITE_POINT 4
|
#define AETHERYTE_MENU_FAVORITE_POINT 4
|
||||||
#define AETHERYTE_MENU_FAVORITE_POINT_SECURITY_TOKEN 5
|
#define AETHERYTE_MENU_FAVORITE_POINT_SECURITY_TOKEN 5
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class Aethernet :
|
class Aethernet :
|
||||||
public EventScript
|
public EventScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
#define AETHERYTE_MENU_FAVORITE_POINT 4
|
#define AETHERYTE_MENU_FAVORITE_POINT 4
|
||||||
#define AETHERYTE_MENU_FAVORITE_POINT_SECURITY_TOKEN 5
|
#define AETHERYTE_MENU_FAVORITE_POINT_SECURITY_TOKEN 5
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class Aetheryte :
|
class Aetheryte :
|
||||||
public EventScript
|
public EventScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class CmnDefCutSceneReplay :
|
class CmnDefCutSceneReplay :
|
||||||
public EventScript
|
public EventScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class CmnDefHousingSignboard :
|
class CmnDefHousingSignboard :
|
||||||
public EventScript
|
public EventScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class CmnDefInnBed :
|
class CmnDefInnBed :
|
||||||
public EventScript
|
public EventScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#define ACTION_RENAME 3
|
#define ACTION_RENAME 3
|
||||||
#define ACTION_REMOVE 4
|
#define ACTION_REMOVE 4
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class CmnDefLinkShell :
|
class CmnDefLinkShell :
|
||||||
public EventScript
|
public EventScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class CmnDefMarketBoardGridania :
|
class CmnDefMarketBoardGridania :
|
||||||
public EventScript
|
public EventScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class CmnDefMogLetter :
|
class CmnDefMogLetter :
|
||||||
public EventScript
|
public EventScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class CmnDefNpcRepair :
|
class CmnDefNpcRepair :
|
||||||
public EventScript
|
public EventScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class CmnDefWeatherForeCast :
|
class CmnDefWeatherForeCast :
|
||||||
public EventScript
|
public EventScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class ComDefMobHuntBoard :
|
class ComDefMobHuntBoard :
|
||||||
public EventScript
|
public EventScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class GilShop :
|
class GilShop :
|
||||||
public EventScript
|
public EventScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class HouFurOrchestrion :
|
class HouFurOrchestrion :
|
||||||
public EventScript
|
public EventScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class ThePalaceoftheDeadFloors101110 :
|
class ThePalaceoftheDeadFloors101110 :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class ThePalaceoftheDeadFloors110 :
|
class ThePalaceoftheDeadFloors110 :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class ThePalaceoftheDeadFloors111120 :
|
class ThePalaceoftheDeadFloors111120 :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class ThePalaceoftheDeadFloors1120 :
|
class ThePalaceoftheDeadFloors1120 :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class ThePalaceoftheDeadFloors121130 :
|
class ThePalaceoftheDeadFloors121130 :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class ThePalaceoftheDeadFloors131140 :
|
class ThePalaceoftheDeadFloors131140 :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class ThePalaceoftheDeadFloors141150 :
|
class ThePalaceoftheDeadFloors141150 :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class ThePalaceoftheDeadFloors151160 :
|
class ThePalaceoftheDeadFloors151160 :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class ThePalaceoftheDeadFloors161170 :
|
class ThePalaceoftheDeadFloors161170 :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class ThePalaceoftheDeadFloors171180 :
|
class ThePalaceoftheDeadFloors171180 :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class ThePalaceoftheDeadFloors181190 :
|
class ThePalaceoftheDeadFloors181190 :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class ThePalaceoftheDeadFloors191200 :
|
class ThePalaceoftheDeadFloors191200 :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class ThePalaceoftheDeadFloors2130 :
|
class ThePalaceoftheDeadFloors2130 :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class ThePalaceoftheDeadFloors3140 :
|
class ThePalaceoftheDeadFloors3140 :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class ThePalaceoftheDeadFloors4150 :
|
class ThePalaceoftheDeadFloors4150 :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class ThePalaceoftheDeadFloors5160 :
|
class ThePalaceoftheDeadFloors5160 :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class ThePalaceoftheDeadFloors6170 :
|
class ThePalaceoftheDeadFloors6170 :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class ThePalaceoftheDeadFloors7180 :
|
class ThePalaceoftheDeadFloors7180 :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class ThePalaceoftheDeadFloors8190 :
|
class ThePalaceoftheDeadFloors8190 :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class ThePalaceoftheDeadFloors91100 :
|
class ThePalaceoftheDeadFloors91100 :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class AlaMhigo :
|
class AlaMhigo :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class AmdaporKeep :
|
class AmdaporKeep :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class AmdaporKeepHard :
|
class AmdaporKeepHard :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class BaelsarsWall :
|
class BaelsarsWall :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class BardamsMettle :
|
class BardamsMettle :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class BrayfloxsLongstop :
|
class BrayfloxsLongstop :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class BrayfloxsLongstopHard :
|
class BrayfloxsLongstopHard :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class CastrumAbania :
|
class CastrumAbania :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class CastrumMeridianum :
|
class CastrumMeridianum :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class CopperbellMines :
|
class CopperbellMines :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class CopperbellMinesHard :
|
class CopperbellMinesHard :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class CuttersCry :
|
class CuttersCry :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class DomaCastle :
|
class DomaCastle :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class DzemaelDarkhold :
|
class DzemaelDarkhold :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class Halatali :
|
class Halatali :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class HalataliHard :
|
class HalataliHard :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class HaukkeManor :
|
class HaukkeManor :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class HaukkeManorHard :
|
class HaukkeManorHard :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class HellsLid :
|
class HellsLid :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class HullbreakerIsle :
|
class HullbreakerIsle :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class HullbreakerIsleHard :
|
class HullbreakerIsleHard :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class KuganeCastle :
|
class KuganeCastle :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class Neverreap :
|
class Neverreap :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class PharosSirius :
|
class PharosSirius :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class PharosSiriusHard :
|
class PharosSiriusHard :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class SaintMociannesArboretum :
|
class SaintMociannesArboretum :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class Sastasha :
|
class Sastasha :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class SastashaHard :
|
class SastashaHard :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class ShisuioftheVioletTides :
|
class ShisuioftheVioletTides :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class Snowcloak :
|
class Snowcloak :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class SohmAl :
|
class SohmAl :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class SohmAlHard :
|
class SohmAlHard :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class SohrKhai :
|
class SohrKhai :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class TheAery :
|
class TheAery :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class TheAetherochemicalResearchFacility :
|
class TheAetherochemicalResearchFacility :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Zone/InstanceContent.h>
|
#include <Zone/InstanceContent.h>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class TheAntitower :
|
class TheAntitower :
|
||||||
public InstanceContentScript
|
public InstanceContentScript
|
||||||
{
|
{
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue