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

Code style adjusted for 2 spaces and various other small things, checkout CodeStyle.xml for details

This commit is contained in:
Mordred 2018-08-29 21:40:59 +02:00
parent 34c0f74139
commit 89a9b16555
546 changed files with 51735 additions and 45827 deletions

103
CodeStyle.xml Normal file
View file

@ -0,0 +1,103 @@
<code_scheme name="Default" version="173">
<option name="AUTODETECT_INDENTS" value="false" />
<Objective-C>
<option name="INDENT_NAMESPACE_MEMBERS" value="0" />
<option name="INDENT_C_STRUCT_MEMBERS" value="2" />
<option name="INDENT_CLASS_MEMBERS" value="2" />
<option name="INDENT_INSIDE_CODE_BLOCK" value="2" />
<option name="FUNCTION_BRACE_PLACEMENT" value="2" />
<option name="BLOCK_BRACE_PLACEMENT" value="2" />
<option name="CLASS_CONSTRUCTOR_INIT_LIST_NEW_LINE_BEFORE_COLON" value="0" />
<option name="CLASS_CONSTRUCTOR_INIT_LIST_NEW_LINE_AFTER_COLON" value="1" />
<option name="SUPERCLASS_LIST_ALIGN_MULTILINE" value="false" />
<option name="SUPERCLASS_LIST_BEFORE_COLON" value="0" />
<option name="SUPERCLASS_LIST_AFTER_COLON" value="1" />
<option name="SPACE_WITHIN_TEMPLATE_DECLARATION_LTGT" value="true" />
<option name="SPACE_WITHIN_TEMPLATE_CALL_LTGT" value="true" />
<option name="SPACE_WITHIN_FUNCTION_DECLARATION_PARENTHESES" value="true" />
<option name="SPACE_WITHIN_FUNCTION_CALL_PARENTHESES" value="true" />
<option name="SPACE_WITHIN_LAMBDA_CAPTURE_LIST_BRACKET" value="true" />
<option name="SPACE_BEFORE_POINTER_IN_DECLARATION" value="false" />
<option name="SPACE_AFTER_POINTER_IN_DECLARATION" value="true" />
<option name="SPACE_BEFORE_REFERENCE_IN_DECLARATION" value="false" />
<option name="SPACE_AFTER_REFERENCE_IN_DECLARATION" value="true" />
<option name="SPACE_BETWEEN_ADJACENT_BRACKETS" value="true" />
<option name="DISCHARGED_SHORT_TERNARY_OPERATOR" value="true" />
</Objective-C>
<Objective-C-extensions>
<file>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
</file>
<class>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
</class>
<extensions>
<pair source="cpp" header="h" fileNamingConvention="NONE" />
<pair source="c" header="h" fileNamingConvention="NONE" />
</extensions>
</Objective-C-extensions>
<DBN-PSQL>
<case-options enabled="false">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false" />
</DBN-PSQL>
<DBN-SQL>
<case-options enabled="false">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false">
<option name="STATEMENT_SPACING" value="one_line" />
<option name="CLAUSE_CHOP_DOWN" value="chop_down_if_statement_long" />
<option name="ITERATION_ELEMENTS_WRAPPING" value="chop_down_if_not_single" />
</formatting-settings>
</DBN-SQL>
<codeStyleSettings language="ObjectiveC">
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
<option name="BRACE_STYLE" value="2" />
<option name="CLASS_BRACE_STYLE" value="2" />
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="SPACE_AROUND_LAMBDA_ARROW" value="false" />
<option name="SPACE_WITHIN_PARENTHESES" value="true" />
<option name="SPACE_WITHIN_IF_PARENTHESES" value="true" />
<option name="SPACE_WITHIN_WHILE_PARENTHESES" value="true" />
<option name="SPACE_WITHIN_FOR_PARENTHESES" value="true" />
<option name="SPACE_WITHIN_CATCH_PARENTHESES" value="true" />
<option name="SPACE_WITHIN_SWITCH_PARENTHESES" value="true" />
<option name="SPACE_WITHIN_CAST_PARENTHESES" value="true" />
<option name="SPACE_WITHIN_BRACKETS" value="true" />
<option name="SPACE_WITHIN_ARRAY_INITIALIZER_BRACES" value="true" />
<option name="SPACE_BEFORE_IF_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_WHILE_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_FOR_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_CATCH_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_SWITCH_PARENTHESES" value="false" />
<option name="KEEP_SIMPLE_METHODS_IN_ONE_LINE" value="false" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
</code_scheme>

File diff suppressed because it is too large Load diff

View file

@ -5,37 +5,164 @@
namespace Core {
namespace Common {
bool operator==( const ActionCategory& t, const uint8_t& g ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const uint8_t& g, const ActionCategory& t ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const BeastReputationRank& t, const uint8_t& g ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const uint8_t& g, const BeastReputationRank& t ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const BeastTribe& t, const uint8_t& g ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const uint8_t& g, const BeastTribe& t ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const ClassJob& t, const uint8_t& g ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const uint8_t& g, const ClassJob& t ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const ContentType& t, const uint8_t& g ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const uint8_t& g, const ContentType& t ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const EmoteCategory& t, const uint8_t& g ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const uint8_t& g, const EmoteCategory& t ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const ExVersion& t, const uint8_t& g ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const uint8_t& g, const ExVersion& t ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const GrandCompany& t, const uint8_t& g ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const uint8_t& g, const GrandCompany& t ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const GuardianDeity& t, const uint8_t& g ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const uint8_t& g, const GuardianDeity& t ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const ItemUICategory& t, const uint8_t& g ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const uint8_t& g, const ItemUICategory& t ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const ItemSearchCategory& t, const uint8_t& g ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const uint8_t& g, const ItemSearchCategory& t ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const OnlineStatus& t, const uint8_t& g ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const uint8_t& g, const OnlineStatus& t ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const Race& t, const uint8_t& g ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const uint8_t& g, const Race& t ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const Tribe& t, const uint8_t& g ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const uint8_t& g, const Tribe& t ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const Town& t, const uint8_t& g ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const uint8_t& g, const Town& t ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const Weather& t, const uint8_t& g ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const uint8_t& g, const Weather& t ) { return static_cast< uint8_t >( t ) == g; }
bool operator==( const ActionCategory& t, const uint8_t& g )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const uint8_t& g, const ActionCategory& t )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const BeastReputationRank& t, const uint8_t& g )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const uint8_t& g, const BeastReputationRank& t )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const BeastTribe& t, const uint8_t& g )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const uint8_t& g, const BeastTribe& t )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const ClassJob& t, const uint8_t& g )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const uint8_t& g, const ClassJob& t )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const ContentType& t, const uint8_t& g )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const uint8_t& g, const ContentType& t )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const EmoteCategory& t, const uint8_t& g )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const uint8_t& g, const EmoteCategory& t )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const ExVersion& t, const uint8_t& g )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const uint8_t& g, const ExVersion& t )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const GrandCompany& t, const uint8_t& g )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const uint8_t& g, const GrandCompany& t )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const GuardianDeity& t, const uint8_t& g )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const uint8_t& g, const GuardianDeity& t )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const ItemUICategory& t, const uint8_t& g )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const uint8_t& g, const ItemUICategory& t )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const ItemSearchCategory& t, const uint8_t& g )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const uint8_t& g, const ItemSearchCategory& t )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const OnlineStatus& t, const uint8_t& g )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const uint8_t& g, const OnlineStatus& t )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const Race& t, const uint8_t& g )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const uint8_t& g, const Race& t )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const Tribe& t, const uint8_t& g )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const uint8_t& g, const Tribe& t )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const Town& t, const uint8_t& g )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const uint8_t& g, const Town& t )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const Weather& t, const uint8_t& g )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const uint8_t& g, const Weather& t )
{
return static_cast< uint8_t >( t ) == g;
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -10,57 +10,57 @@
*/
bool Core::ConfigMgr::loadConfig( const std::string& configName )
{
std::stringstream configStream;
std::stringstream configStream;
// get global config
auto configDir = boost::filesystem::path( m_configFolderRoot );
// get global config
auto configDir = boost::filesystem::path( m_configFolderRoot );
if( !boost::filesystem::exists( configDir ) )
{
if( !boost::filesystem::exists( configDir ) )
{
return false;
}
auto globalConfig = boost::filesystem::path( configDir / m_globalConfigFile );
if( !boost::filesystem::exists( globalConfig ) )
{
if( !copyDefaultConfig( globalConfig.filename().string() ) )
return false;
}
}
auto globalConfig = boost::filesystem::path( configDir / m_globalConfigFile );
if( !boost::filesystem::exists( globalConfig ) )
{
if( !copyDefaultConfig( globalConfig.filename().string() ) )
return false;
}
std::ifstream globalConfigFile( globalConfig.c_str() );
configStream << globalConfigFile.rdbuf();
std::ifstream globalConfigFile( globalConfig.c_str() );
configStream << globalConfigFile.rdbuf();
// add some newlines just in case there's no newline at the end of the global file
configStream << "\n\n";
// add some newlines just in case there's no newline at the end of the global file
configStream << "\n\n";
// get local config
auto localConfig = boost::filesystem::path( configDir / configName );
if( !boost::filesystem::exists( localConfig ) )
{
if( !copyDefaultConfig( localConfig.filename().string() ) )
return false;
}
std::ifstream configFile( localConfig.c_str() );
configStream << configFile.rdbuf();
// get local config
auto localConfig = boost::filesystem::path( configDir / configName );
if( !boost::filesystem::exists( localConfig ) )
{
if( !copyDefaultConfig( localConfig.filename().string() ) )
return false;
}
std::ifstream configFile( localConfig.c_str() );
configStream << configFile.rdbuf();
// parse the tree and we're fuckin done
boost::property_tree::read_ini( configStream, m_propTree );
// parse the tree and we're fuckin done
boost::property_tree::read_ini( configStream, m_propTree );
return true;
return true;
}
bool Core::ConfigMgr::copyDefaultConfig( const std::string& configName )
{
boost::filesystem::path configPath( m_configFolderRoot );
configPath /= configName;
boost::filesystem::path configPath( m_configFolderRoot );
configPath /= configName;
if( !boost::filesystem::exists( configPath.string() + m_configDefaultSuffix ) )
{
// no default file :(
return false;
}
if( !boost::filesystem::exists( configPath.string() + m_configDefaultSuffix ) )
{
// no default file :(
return false;
}
boost::filesystem::copy_file( configPath.string() + m_configDefaultSuffix, configPath );
boost::filesystem::copy_file( configPath.string() + m_configDefaultSuffix, configPath );
return true;
return true;
}

View file

@ -3,43 +3,43 @@
#include <boost/property_tree/ptree.hpp>
namespace Core
namespace Core {
class ConfigMgr
{
class ConfigMgr
{
public:
ConfigMgr() = default;
~ConfigMgr() = default;
public:
ConfigMgr() = default;
bool loadConfig( const std::string& configName );
~ConfigMgr() = default;
template< class T >
T getValue( const std::string& name, T defaultValue = T() )
{
try
{
return m_propTree.get< T >( name );
}
catch( ... )
{
return defaultValue;
}
}
bool loadConfig( const std::string& configName );
template< class T >
void setValue( const std::string& name, T defaultValue = T() )
{
m_propTree.put( name, defaultValue );
}
template< class T >
T getValue( const std::string& name, T defaultValue = T() )
{
try
{
return m_propTree.get< T >( name );
}
catch( ... )
{
return defaultValue;
}
}
private:
bool copyDefaultConfig( const std::string& configName );
template< class T >
void setValue( const std::string& name, T defaultValue = T() )
{
m_propTree.put( name, defaultValue );
}
boost::property_tree::ptree m_propTree;
const std::string m_globalConfigFile = "global.ini";
const std::string m_configFolderRoot = "./config/";
const std::string m_configDefaultSuffix = ".default";
};
private:
bool copyDefaultConfig( const std::string& configName );
boost::property_tree::ptree m_propTree;
const std::string m_globalConfigFile = "global.ini";
const std::string m_configFolderRoot = "./config/";
const std::string m_configDefaultSuffix = ".default";
};
}
#endif //SAPPHIRE_CONFIGMGR_H

View file

@ -1,7 +1,7 @@
/*
base64.cpp and base64.h
Copyright (C) 2004-2008 René Nyffenegger
Copyright (C) 2004-2008 Ren<EFBFBD> Nyffenegger
This source code is provided 'as-is', without any express or implied
warranty. In no event will the author be held liable for any damages
@ -21,7 +21,7 @@
3. This notice may not be removed or altered from any source distribution.
René Nyffenegger rene.nyffenegger@adp-gmbh.ch
Ren<EFBFBD> Nyffenegger rene.nyffenegger@adp-gmbh.ch
*/
@ -29,95 +29,105 @@
#include <iostream>
static const std::string base64_chars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789+/";
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789+/";
static inline bool is_base64( uint8_t c ) {
return ( isalnum( c ) || ( c == '+' ) || ( c == '/' ) );
static inline bool is_base64( uint8_t c )
{
return ( isalnum( c ) || ( c == '+' ) || ( c == '/' ) );
}
std::string Core::Util::base64_encode( uint8_t const* bytes_to_encode, uint32_t in_len ) {
std::string ret;
int32_t i = 0;
int32_t j = 0;
uint8_t char_array_3[3];
uint8_t char_array_4[4];
std::string Core::Util::base64_encode( uint8_t const* bytes_to_encode, uint32_t in_len )
{
std::string ret;
int32_t i = 0;
int32_t j = 0;
uint8_t char_array_3[3];
uint8_t char_array_4[4];
while( in_len-- ) {
char_array_3[i++] = *( bytes_to_encode++ );
if( i == 3 ) {
char_array_4[0] = ( char_array_3[0] & 0xfc ) >> 2;
char_array_4[1] = ( ( char_array_3[0] & 0x03 ) << 4 ) + ( ( char_array_3[1] & 0xf0 ) >> 4 );
char_array_4[2] = ( ( char_array_3[1] & 0x0f ) << 2 ) + ( ( char_array_3[2] & 0xc0 ) >> 6 );
char_array_4[3] = char_array_3[2] & 0x3f;
while( in_len-- )
{
char_array_3[ i++ ] = *( bytes_to_encode++ );
if( i == 3 )
{
char_array_4[ 0 ] = ( char_array_3[ 0 ] & 0xfc ) >> 2;
char_array_4[ 1 ] = ( ( char_array_3[ 0 ] & 0x03 ) << 4 ) + ( ( char_array_3[ 1 ] & 0xf0 ) >> 4 );
char_array_4[ 2 ] = ( ( char_array_3[ 1 ] & 0x0f ) << 2 ) + ( ( char_array_3[ 2 ] & 0xc0 ) >> 6 );
char_array_4[ 3 ] = char_array_3[ 2 ] & 0x3f;
for( i = 0; ( i < 4 ); i++ )
ret += base64_chars[char_array_4[i]];
i = 0;
}
}
for( i = 0; ( i < 4 ); i++ )
ret += base64_chars[ char_array_4[ i ] ];
i = 0;
}
}
if( i )
{
for( j = i; j < 3; j++ )
char_array_3[j] = '\0';
if( i )
{
for( j = i; j < 3; j++ )
char_array_3[ j ] = '\0';
char_array_4[0] = ( char_array_3[0] & 0xfc ) >> 2;
char_array_4[1] = ( ( char_array_3[0] & 0x03 ) << 4 ) + ( ( char_array_3[1] & 0xf0 ) >> 4 );
char_array_4[2] = ( ( char_array_3[1] & 0x0f ) << 2 ) + ( ( char_array_3[2] & 0xc0 ) >> 6 );
char_array_4[3] = char_array_3[2] & 0x3f;
char_array_4[ 0 ] = ( char_array_3[ 0 ] & 0xfc ) >> 2;
char_array_4[ 1 ] = ( ( char_array_3[ 0 ] & 0x03 ) << 4 ) + ( ( char_array_3[ 1 ] & 0xf0 ) >> 4 );
char_array_4[ 2 ] = ( ( char_array_3[ 1 ] & 0x0f ) << 2 ) + ( ( char_array_3[ 2 ] & 0xc0 ) >> 6 );
char_array_4[ 3 ] = char_array_3[ 2 ] & 0x3f;
for( j = 0; ( j < i + 1 ); j++ )
ret += base64_chars[char_array_4[j]];
for( j = 0; ( j < i + 1 ); j++ )
ret += base64_chars[ char_array_4[ j ] ];
while( ( i++ < 3 ) )
ret += '=';
while( ( i++ < 3 ) )
ret += '=';
}
}
return ret;
return ret;
}
std::string Core::Util::base64_decode( std::string const& encoded_string ) {
int32_t in_len = encoded_string.size();
int32_t i = 0;
int32_t j = 0;
int32_t in_ = 0;
uint8_t char_array_4[4], char_array_3[3];
std::string ret;
std::string Core::Util::base64_decode( std::string const& encoded_string )
{
int32_t in_len = encoded_string.size();
int32_t i = 0;
int32_t j = 0;
int32_t in_ = 0;
uint8_t char_array_4[4], char_array_3[3];
std::string ret;
while( in_len-- && ( encoded_string[in_] != '=' ) && is_base64( encoded_string[in_] ) ) {
char_array_4[i++] = encoded_string[in_]; in_++;
if( i == 4 ) {
for( i = 0; i < 4; i++ )
char_array_4[i] = static_cast< uint8_t >( base64_chars.find( char_array_4[i] ) );
while( in_len-- && ( encoded_string[ in_ ] != '=' ) && is_base64( encoded_string[ in_ ] ) )
{
char_array_4[ i++ ] = encoded_string[ in_ ];
in_++;
if( i == 4 )
{
for( i = 0; i < 4; i++ )
char_array_4[ i ] = static_cast< uint8_t >( base64_chars.find( char_array_4[ i ] ) );
char_array_3[0] = ( char_array_4[0] << 2 ) + ( ( char_array_4[1] & 0x30 ) >> 4 );
char_array_3[1] = ( ( char_array_4[1] & 0xf ) << 4 ) + ( ( char_array_4[2] & 0x3c ) >> 2 );
char_array_3[2] = ( ( char_array_4[2] & 0x3 ) << 6 ) + char_array_4[3];
char_array_3[ 0 ] = ( char_array_4[ 0 ] << 2 ) + ( ( char_array_4[ 1 ] & 0x30 ) >> 4 );
char_array_3[ 1 ] = ( ( char_array_4[ 1 ] & 0xf ) << 4 ) + ( ( char_array_4[ 2 ] & 0x3c ) >> 2 );
char_array_3[ 2 ] = ( ( char_array_4[ 2 ] & 0x3 ) << 6 ) + char_array_4[ 3 ];
for( i = 0; ( i < 3 ); i++ )
ret += char_array_3[i];
i = 0;
}
}
for( i = 0; ( i < 3 ); i++ )
ret += char_array_3[ i ];
i = 0;
}
}
if( i ) {
for( j = i; j < 4; j++ )
char_array_4[j] = 0;
if( i )
{
for( j = i; j < 4; j++ )
char_array_4[ j ] = 0;
for( j = 0; j < 4; j++ )
char_array_4[j] = static_cast< uint8_t >( base64_chars.find( char_array_4[j] ) );
for( j = 0; j < 4; j++ )
char_array_4[ j ] = static_cast< uint8_t >( base64_chars.find( char_array_4[ j ] ) );
char_array_3[0] = ( char_array_4[0] << 2 ) + ( ( char_array_4[1] & 0x30 ) >> 4 );
char_array_3[1] = ( ( char_array_4[1] & 0xf ) << 4 ) + ( ( char_array_4[2] & 0x3c ) >> 2 );
char_array_3[2] = ( ( char_array_4[2] & 0x3 ) << 6 ) + char_array_4[3];
char_array_3[ 0 ] = ( char_array_4[ 0 ] << 2 ) + ( ( char_array_4[ 1 ] & 0x30 ) >> 4 );
char_array_3[ 1 ] = ( ( char_array_4[ 1 ] & 0xf ) << 4 ) + ( ( char_array_4[ 2 ] & 0x3c ) >> 2 );
char_array_3[ 2 ] = ( ( char_array_4[ 2 ] & 0x3 ) << 6 ) + char_array_4[ 3 ];
for( j = 0; ( j < i - 1 ); j++ ) ret += char_array_3[j];
}
for( j = 0; ( j < i - 1 ); j++ )
ret += char_array_3[ j ];
}
return ret;
return ret;
}

View file

@ -1,11 +1,10 @@
#include <string>
namespace Core
{
namespace Util
{
std::string base64_encode( uint8_t const*, uint32_t len );
std::string base64_decode( std::string const& s );
}
namespace Core {
namespace Util {
std::string base64_encode( uint8_t const*, uint32_t len );
std::string base64_decode( std::string const& s );
}
}

View file

@ -6,89 +6,105 @@
#include <cstdint>
#include "blowfish.h"
#include "blowfish.h2" // holds the random digit tables
#include "blowfish.h2" // holds the random digit tables
#define S(x,i) (SBoxes[i][x.w.byte##i])
#define bf_F(x) (((S(x,0) + S(x,1)) ^ S(x,2)) + S(x,3))
#define ROUND(a,b,n) (a.dword ^= bf_F(b) ^ PArray[n])
#define S( x, i ) (SBoxes[i][x.w.byte##i])
#define bf_F( x ) (((S(x,0) + S(x,1)) ^ S(x,2)) + S(x,3))
#define ROUND( a, b, n ) (a.dword ^= bf_F(b) ^ PArray[n])
BlowFish::BlowFish ()
BlowFish::BlowFish()
{
PArray = new DWORD [18] ;
SBoxes = new DWORD [4][256] ;
PArray = new DWORD[18];
SBoxes = new DWORD[4][256];
}
BlowFish::~BlowFish ()
BlowFish::~BlowFish()
{
delete PArray ;
delete [] SBoxes ;
delete PArray;
delete[] SBoxes;
}
// the low level (private) encryption function
void BlowFish::Blowfish_encipher (DWORD *xl, DWORD *xr)
// the low level (private) encryption function
void BlowFish::Blowfish_encipher( DWORD* xl, DWORD* xr )
{
union aword Xl, Xr ;
union aword Xl, Xr;
Xl.dword = *xl ;
Xr.dword = *xr ;
Xl.dword = *xl;
Xr.dword = *xr;
Xl.dword ^= PArray [0];
ROUND (Xr, Xl, 1) ; ROUND (Xl, Xr, 2) ;
ROUND (Xr, Xl, 3) ; ROUND (Xl, Xr, 4) ;
ROUND (Xr, Xl, 5) ; ROUND (Xl, Xr, 6) ;
ROUND (Xr, Xl, 7) ; ROUND (Xl, Xr, 8) ;
ROUND (Xr, Xl, 9) ; ROUND (Xl, Xr, 10) ;
ROUND (Xr, Xl, 11) ; ROUND (Xl, Xr, 12) ;
ROUND (Xr, Xl, 13) ; ROUND (Xl, Xr, 14) ;
ROUND (Xr, Xl, 15) ; ROUND (Xl, Xr, 16) ;
Xr.dword ^= PArray [17] ;
Xl.dword ^= PArray[ 0 ];
ROUND ( Xr, Xl, 1 );
ROUND ( Xl, Xr, 2 );
ROUND ( Xr, Xl, 3 );
ROUND ( Xl, Xr, 4 );
ROUND ( Xr, Xl, 5 );
ROUND ( Xl, Xr, 6 );
ROUND ( Xr, Xl, 7 );
ROUND ( Xl, Xr, 8 );
ROUND ( Xr, Xl, 9 );
ROUND ( Xl, Xr, 10 );
ROUND ( Xr, Xl, 11 );
ROUND ( Xl, Xr, 12 );
ROUND ( Xr, Xl, 13 );
ROUND ( Xl, Xr, 14 );
ROUND ( Xr, Xl, 15 );
ROUND ( Xl, Xr, 16 );
Xr.dword ^= PArray[ 17 ];
*xr = Xl.dword ;
*xl = Xr.dword ;
*xr = Xl.dword;
*xl = Xr.dword;
}
// the low level (private) decryption function
void BlowFish::Blowfish_decipher (DWORD *xl, DWORD *xr)
// the low level (private) decryption function
void BlowFish::Blowfish_decipher( DWORD* xl, DWORD* xr )
{
union aword Xl ;
union aword Xr ;
union aword Xl;
union aword Xr;
Xl.dword = *xl ;
Xr.dword = *xr ;
Xl.dword = *xl;
Xr.dword = *xr;
Xl.dword ^= PArray [17] ;
ROUND (Xr, Xl, 16) ; ROUND (Xl, Xr, 15) ;
ROUND (Xr, Xl, 14) ; ROUND (Xl, Xr, 13) ;
ROUND (Xr, Xl, 12) ; ROUND (Xl, Xr, 11) ;
ROUND (Xr, Xl, 10) ; ROUND (Xl, Xr, 9) ;
ROUND (Xr, Xl, 8) ; ROUND (Xl, Xr, 7) ;
ROUND (Xr, Xl, 6) ; ROUND (Xl, Xr, 5) ;
ROUND (Xr, Xl, 4) ; ROUND (Xl, Xr, 3) ;
ROUND (Xr, Xl, 2) ; ROUND (Xl, Xr, 1) ;
Xr.dword ^= PArray[0];
Xl.dword ^= PArray[ 17 ];
ROUND ( Xr, Xl, 16 );
ROUND ( Xl, Xr, 15 );
ROUND ( Xr, Xl, 14 );
ROUND ( Xl, Xr, 13 );
ROUND ( Xr, Xl, 12 );
ROUND ( Xl, Xr, 11 );
ROUND ( Xr, Xl, 10 );
ROUND ( Xl, Xr, 9 );
ROUND ( Xr, Xl, 8 );
ROUND ( Xl, Xr, 7 );
ROUND ( Xr, Xl, 6 );
ROUND ( Xl, Xr, 5 );
ROUND ( Xr, Xl, 4 );
ROUND ( Xl, Xr, 3 );
ROUND ( Xr, Xl, 2 );
ROUND ( Xl, Xr, 1 );
Xr.dword ^= PArray[ 0 ];
*xl = Xr.dword;
*xr = Xl.dword;
*xl = Xr.dword;
*xr = Xl.dword;
}
// constructs the enctryption sieve
void BlowFish::initialize (BYTE key[], int32_t keybytes)
// constructs the enctryption sieve
void BlowFish::initialize( BYTE key[], int32_t keybytes )
{
int i, j ;
DWORD datal, datar ;
int i, j;
DWORD datal, datar;
// first fill arrays from data tables
for (i = 0 ; i < 18 ; i++)
PArray [i] = bf_P [i] ;
// first fill arrays from data tables
for( i = 0; i < 18; i++ )
PArray[ i ] = bf_P[ i ];
for (i = 0 ; i < 4 ; i++)
{
for (j = 0 ; j < 256 ; j++)
SBoxes [i][j] = bf_S [i][j] ;
}
for( i = 0; i < 4; i++ )
{
for( j = 0; j < 256; j++ )
SBoxes[ i ][ j ] = bf_S[ i ][ j ];
}
int32_t v12; // eax@6
int32_t v13; // ecx@6
@ -104,156 +120,156 @@ void BlowFish::initialize (BYTE key[], int32_t keybytes)
int32_t v10 = keybytes;
uintptr_t v9 = (uintptr_t)key;
uintptr_t v9 = ( uintptr_t ) key;
int32_t v8 = 0;
int32_t v11 = 0;
do {
v13 = (char)(*(BYTE *)(v8 + v9));
do
{
v13 = ( char ) ( *( BYTE* ) ( v8 + v9 ) );
v12 = v8 + 1;
if ( v12 >= v10 )
if( v12 >= v10 )
v12 = 0;
v16 = (char)*(BYTE *)(v12 + v9);
v16 = ( char ) *( BYTE* ) ( v12 + v9 );
v14 = v12 + 1;
v15 = (v13 << 8) | v16;
if ( v14 >= v10 )
v15 = ( v13 << 8 ) | v16;
if( v14 >= v10 )
v14 = 0;
v19 = (char)*(BYTE *)(v14 + v9);
v19 = ( char ) *( BYTE* ) ( v14 + v9 );
v17 = v14 + 1;
v18 = (v15 << 8) | v19;
if ( v17 >= v10 )
v18 = ( v15 << 8 ) | v19;
if( v17 >= v10 )
v17 = 0;
v21 = (char)*(BYTE *)(v17 + v9);
v21 = ( char ) *( BYTE* ) ( v17 + v9 );
v8 = v17 + 1;
v20 = (v18 << 8) | v21;
if ( v8 >= v10 )
v20 = ( v18 << 8 ) | v21;
if( v8 >= v10 )
v8 = 0;
*((DWORD *)PArray + v11++) ^= v20;
} while ( v11 < 18 );
*( ( DWORD* ) PArray + v11++ ) ^= v20;
} while( v11 < 18 );
datal = 0;
datar = 0;
datal = 0 ;
datar = 0 ;
for( i = 0; i < NPASS + 2; i += 2 )
{
Blowfish_encipher( &datal, &datar );
PArray[ i ] = datal;
PArray[ i + 1 ] = datar;
}
for (i = 0 ; i < NPASS + 2 ; i += 2)
{
Blowfish_encipher (&datal, &datar) ;
PArray [i] = datal ;
PArray [i + 1] = datar ;
}
for (i = 0 ; i < 4 ; ++i)
{
for (j = 0 ; j < 256 ; j += 2)
{
Blowfish_encipher (&datal, &datar) ;
SBoxes [i][j] = datal ;
SBoxes [i][j + 1] = datar ;
}
}
for( i = 0; i < 4; ++i )
{
for( j = 0; j < 256; j += 2 )
{
Blowfish_encipher( &datal, &datar );
SBoxes[ i ][ j ] = datal;
SBoxes[ i ][ j + 1 ] = datar;
}
}
}
// get output length, which must be even MOD 8
DWORD BlowFish::GetOutputLength (DWORD lInputLong)
// get output length, which must be even MOD 8
DWORD BlowFish::GetOutputLength( DWORD lInputLong )
{
DWORD lVal ;
DWORD lVal;
lVal = lInputLong % 8 ; // find out if uneven number of bytes at the end
if (lVal != 0)
return lInputLong + 8 - lVal ;
else
return lInputLong ;
lVal = lInputLong % 8; // find out if uneven number of bytes at the end
if( lVal != 0 )
return lInputLong + 8 - lVal;
else
return lInputLong;
}
// Encode pIntput into pOutput. Input length in lSize. Returned value
// is length of output which will be even MOD 8 bytes. Input buffer and
// output buffer can be the same, but be sure buffer length is even MOD 8.
DWORD BlowFish::Encode (BYTE * pInput, BYTE * pOutput, DWORD lSize)
// Encode pIntput into pOutput. Input length in lSize. Returned value
// is length of output which will be even MOD 8 bytes. Input buffer and
// output buffer can be the same, but be sure buffer length is even MOD 8.
DWORD BlowFish::Encode( BYTE* pInput, BYTE* pOutput, DWORD lSize )
{
DWORD lCount, lOutSize, lGoodBytes ;
BYTE *pi, *po ;
int i, j ;
int SameDest = (pInput == pOutput ? 1 : 0) ;
DWORD lCount, lOutSize, lGoodBytes;
BYTE* pi, * po;
int i, j;
int SameDest = ( pInput == pOutput ? 1 : 0 );
lOutSize = GetOutputLength (lSize) ;
for (lCount = 0 ; lCount < lOutSize ; lCount += 8)
{
if (SameDest) // if encoded data is being written into input buffer
{
if (lCount < lSize - 7) // if not dealing with uneven bytes at end
{
Blowfish_encipher ((DWORD *) pInput,
(DWORD *) (pInput + 4)) ;
}
else // pad end of data with null bytes to complete encryption
{
po = pInput + lSize ; // point at byte past the end of actual data
j = (int) (lOutSize - lSize) ; // number of bytes to set to null
for (i = 0 ; i < j ; i++)
*po++ = 0 ;
Blowfish_encipher ((DWORD *) pInput,
(DWORD *) (pInput + 4)) ;
}
pInput += 8 ;
}
else // output buffer not equal to input buffer, so must copy
{ // input to output buffer prior to encrypting
if (lCount < lSize - 7) // if not dealing with uneven bytes at end
{
pi = pInput ;
po = pOutput ;
for (i = 0 ; i < 8 ; i++)
lOutSize = GetOutputLength( lSize );
for( lCount = 0; lCount < lOutSize; lCount += 8 )
{
if( SameDest ) // if encoded data is being written into input buffer
{
if( lCount < lSize - 7 ) // if not dealing with uneven bytes at end
{
Blowfish_encipher( ( DWORD* ) pInput,
( DWORD* ) ( pInput + 4 ) );
}
else // pad end of data with null bytes to complete encryption
{
po = pInput + lSize; // point at byte past the end of actual data
j = ( int ) ( lOutSize - lSize ); // number of bytes to set to null
for( i = 0; i < j; i++ )
*po++ = 0;
Blowfish_encipher( ( DWORD* ) pInput,
( DWORD* ) ( pInput + 4 ) );
}
pInput += 8;
}
else // output buffer not equal to input buffer, so must copy
{ // input to output buffer prior to encrypting
if( lCount < lSize - 7 ) // if not dealing with uneven bytes at end
{
pi = pInput;
po = pOutput;
for( i = 0; i < 8; i++ )
// copy bytes to output
*po++ = *pi++ ;
Blowfish_encipher ((DWORD *) pOutput, // now encrypt them
(DWORD *) (pOutput + 4)) ;
}
else // pad end of data with null bytes to complete encryption
{
lGoodBytes = lSize - lCount ; // number of remaining data bytes
po = pOutput ;
for (i = 0 ; i < (int) lGoodBytes ; i++)
*po++ = *pInput++ ;
for (j = i ; j < 8 ; j++)
*po++ = 0 ;
Blowfish_encipher ((DWORD *) pOutput,
(DWORD *) (pOutput + 4)) ;
}
pInput += 8 ;
pOutput += 8 ;
}
}
return lOutSize ;
}
// Decode pIntput into pOutput. Input length in lSize. Input buffer and
// output buffer can be the same, but be sure buffer length is even MOD 8.
void BlowFish::Decode (BYTE * pInput, BYTE * pOutput, DWORD lSize)
{
DWORD lCount ;
BYTE *pi, *po ;
int i ;
int SameDest = (pInput == pOutput ? 1 : 0) ;
for (lCount = 0 ; lCount < lSize ; lCount += 8)
{
if (SameDest) // if encoded data is being written into input buffer
{
Blowfish_decipher ((DWORD *) pInput,
(DWORD *) (pInput + 4)) ;
pInput += 8 ;
}
else // output buffer not equal to input buffer
{ // so copy input to output before decoding
pi = pInput ;
po = pOutput ;
for (i = 0 ; i < 8 ; i++)
*po++ = *pi++ ;
Blowfish_decipher ((DWORD *) pOutput,
(DWORD *) (pOutput + 4)) ;
pInput += 8 ;
pOutput += 8 ;
}
}
*po++ = *pi++;
Blowfish_encipher( ( DWORD* ) pOutput, // now encrypt them
( DWORD* ) ( pOutput + 4 ) );
}
else // pad end of data with null bytes to complete encryption
{
lGoodBytes = lSize - lCount; // number of remaining data bytes
po = pOutput;
for( i = 0; i < ( int ) lGoodBytes; i++ )
*po++ = *pInput++;
for( j = i; j < 8; j++ )
*po++ = 0;
Blowfish_encipher( ( DWORD* ) pOutput,
( DWORD* ) ( pOutput + 4 ) );
}
pInput += 8;
pOutput += 8;
}
}
return lOutSize;
}
// Decode pIntput into pOutput. Input length in lSize. Input buffer and
// output buffer can be the same, but be sure buffer length is even MOD 8.
void BlowFish::Decode( BYTE* pInput, BYTE* pOutput, DWORD lSize )
{
DWORD lCount;
BYTE* pi, * po;
int i;
int SameDest = ( pInput == pOutput ? 1 : 0 );
for( lCount = 0; lCount < lSize; lCount += 8 )
{
if( SameDest ) // if encoded data is being written into input buffer
{
Blowfish_decipher( ( DWORD* ) pInput,
( DWORD* ) ( pInput + 4 ) );
pInput += 8;
}
else // output buffer not equal to input buffer
{ // so copy input to output before decoding
pi = pInput;
po = pOutput;
for( i = 0; i < 8; i++ )
*po++ = *pi++;
Blowfish_decipher( ( DWORD* ) pOutput,
( DWORD* ) ( pOutput + 4 ) );
pInput += 8;
pOutput += 8;
}
}
}

View file

@ -6,70 +6,79 @@
// Revised code--3/20/94
// Converted to C++ class 5/96, Jim Conger
#define MAXKEYBYTES 56 // 448 bits max
#define NPASS 16 // SBox passes
#define MAXKEYBYTES 56 // 448 bits max
#define NPASS 16 // SBox passes
#define DWORD uint32_t
#define WORD unsigned short
#define BYTE uint8_t
#define DWORD uint32_t
#define WORD unsigned short
#define BYTE uint8_t
class BlowFish
{
private:
DWORD * PArray ;
DWORD (* SBoxes)[256];
void Blowfish_encipher (DWORD *xl, DWORD *xr) ;
void Blowfish_decipher (DWORD *xl, DWORD *xr) ;
DWORD* PArray;
DWORD (* SBoxes)[256];
void Blowfish_encipher( DWORD* xl, DWORD* xr );
void Blowfish_decipher( DWORD* xl, DWORD* xr );
public:
BlowFish () ;
~BlowFish () ;
void initialize (BYTE key[], int32_t keybytes) ;
DWORD GetOutputLength (DWORD lInputLong) ;
DWORD Encode (BYTE * pInput, BYTE * pOutput, DWORD lSize) ;
void Decode (BYTE * pInput, BYTE * pOutput, DWORD lSize) ;
BlowFish();
} ;
~BlowFish();
void initialize( BYTE key[], int32_t keybytes );
DWORD GetOutputLength( DWORD lInputLong );
DWORD Encode( BYTE* pInput, BYTE* pOutput, DWORD lSize );
void Decode( BYTE* pInput, BYTE* pOutput, DWORD lSize );
};
// choose a byte order for your hardware
#define ORDER_DCBA // chosing Intel in this case
#define ORDER_DCBA // chosing Intel in this case
#ifdef ORDER_DCBA // DCBA - little endian - intel
union aword {
DWORD dword;
BYTE byte [4];
struct {
uint32_t byte3:8;
uint32_t byte2:8;
uint32_t byte1:8;
uint32_t byte0:8;
} w;
};
#ifdef ORDER_DCBA // DCBA - little endian - intel
union aword
{
DWORD dword;
BYTE byte[4];
struct
{
uint32_t byte3:8;
uint32_t byte2:8;
uint32_t byte1:8;
uint32_t byte0:8;
} w;
};
#endif
#ifdef ORDER_ABCD // ABCD - big endian - motorola
union aword {
DWORD dword;
BYTE byte [4];
struct {
uint32_t byte0:8;
uint32_t byte1:8;
uint32_t byte2:8;
uint32_t byte3:8;
} w;
};
#ifdef ORDER_ABCD // ABCD - big endian - motorola
union aword {
DWORD dword;
BYTE byte [4];
struct {
uint32_t byte0:8;
uint32_t byte1:8;
uint32_t byte2:8;
uint32_t byte3:8;
} w;
};
#endif
#ifdef ORDER_BADC // BADC - vax
union aword {
DWORD dword;
BYTE byte [4];
struct {
uint32_t byte1:8;
uint32_t byte0:8;
uint32_t byte3:8;
uint32_t byte2:8;
} w;
#ifdef ORDER_BADC // BADC - vax
union aword {
DWORD dword;
BYTE byte [4];
struct {
uint32_t byte1:8;
uint32_t byte0:8;
uint32_t byte3:8;
uint32_t byte2:8;
} w;
};
#endif
#endif

View file

@ -21,236 +21,237 @@
#include <string.h>
#include "md5.h"
#define GET_UINT32(n,b,i) \
#define GET_UINT32( n, b, i ) \
{ \
(n) = ( (uint32_t) (b)[(i) ] ) \
| ( (uint32_t) (b)[(i) + 1] << 8 ) \
| ( (uint32_t) (b)[(i) + 2] << 16 ) \
| ( (uint32_t) (b)[(i) + 3] << 24 ); \
(n) = ( (uint32_t) (b)[(i) ] ) \
| ( (uint32_t) (b)[(i) + 1] << 8 ) \
| ( (uint32_t) (b)[(i) + 2] << 16 ) \
| ( (uint32_t) (b)[(i) + 3] << 24 ); \
}
#define PUT_UINT32(n,b,i) \
#define PUT_UINT32( n, b, i ) \
{ \
(b)[(i) ] = (uint8_t) ( (n) ); \
(b)[(i) + 1] = (uint8_t) ( (n) >> 8 ); \
(b)[(i) + 2] = (uint8_t) ( (n) >> 16 ); \
(b)[(i) + 3] = (uint8_t) ( (n) >> 24 ); \
(b)[(i) ] = (uint8_t) ( (n) ); \
(b)[(i) + 1] = (uint8_t) ( (n) >> 8 ); \
(b)[(i) + 2] = (uint8_t) ( (n) >> 16 ); \
(b)[(i) + 3] = (uint8_t) ( (n) >> 24 ); \
}
void Core::Util::md5_starts( md5_context *ctx )
void Core::Util::md5_starts( md5_context* ctx )
{
ctx->total[0] = 0;
ctx->total[1] = 0;
ctx->total[ 0 ] = 0;
ctx->total[ 1 ] = 0;
ctx->state[0] = 0x67452301;
ctx->state[1] = 0xEFCDAB89;
ctx->state[2] = 0x98BADCFE;
ctx->state[3] = 0x10325476;
ctx->state[ 0 ] = 0x67452301;
ctx->state[ 1 ] = 0xEFCDAB89;
ctx->state[ 2 ] = 0x98BADCFE;
ctx->state[ 3 ] = 0x10325476;
}
void md5_process( Core::Util::md5_context *ctx, uint8_t data[64] )
void md5_process( Core::Util::md5_context* ctx, uint8_t data[64] )
{
uint32_t X[16], A, B, C, D;
uint32_t X[16], A, B, C, D;
GET_UINT32( X[0], data, 0 );
GET_UINT32( X[1], data, 4 );
GET_UINT32( X[2], data, 8 );
GET_UINT32( X[3], data, 12 );
GET_UINT32( X[4], data, 16 );
GET_UINT32( X[5], data, 20 );
GET_UINT32( X[6], data, 24 );
GET_UINT32( X[7], data, 28 );
GET_UINT32( X[8], data, 32 );
GET_UINT32( X[9], data, 36 );
GET_UINT32( X[10], data, 40 );
GET_UINT32( X[11], data, 44 );
GET_UINT32( X[12], data, 48 );
GET_UINT32( X[13], data, 52 );
GET_UINT32( X[14], data, 56 );
GET_UINT32( X[15], data, 60 );
GET_UINT32( X[ 0 ], data, 0 );
GET_UINT32( X[ 1 ], data, 4 );
GET_UINT32( X[ 2 ], data, 8 );
GET_UINT32( X[ 3 ], data, 12 );
GET_UINT32( X[ 4 ], data, 16 );
GET_UINT32( X[ 5 ], data, 20 );
GET_UINT32( X[ 6 ], data, 24 );
GET_UINT32( X[ 7 ], data, 28 );
GET_UINT32( X[ 8 ], data, 32 );
GET_UINT32( X[ 9 ], data, 36 );
GET_UINT32( X[ 10 ], data, 40 );
GET_UINT32( X[ 11 ], data, 44 );
GET_UINT32( X[ 12 ], data, 48 );
GET_UINT32( X[ 13 ], data, 52 );
GET_UINT32( X[ 14 ], data, 56 );
GET_UINT32( X[ 15 ], data, 60 );
#define S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n)))
#define S( x, n ) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n)))
#define P(a,b,c,d,k,s,t) \
{ \
a += F(b,c,d) + X[k] + t; a = S(a,s) + b; \
}
#define P( a, b, c, d, k, s, t ) \
{ \
a += F(b,c,d) + X[k] + t; a = S(a,s) + b; \
}
A = ctx->state[0];
B = ctx->state[1];
C = ctx->state[2];
D = ctx->state[3];
A = ctx->state[ 0 ];
B = ctx->state[ 1 ];
C = ctx->state[ 2 ];
D = ctx->state[ 3 ];
#define F(x,y,z) (z ^ (x & (y ^ z)))
#define F( x, y, z ) (z ^ (x & (y ^ z)))
P( A, B, C, D, 0, 7, 0xD76AA478 );
P( D, A, B, C, 1, 12, 0xE8C7B756 );
P( C, D, A, B, 2, 17, 0x242070DB );
P( B, C, D, A, 3, 22, 0xC1BDCEEE );
P( A, B, C, D, 4, 7, 0xF57C0FAF );
P( D, A, B, C, 5, 12, 0x4787C62A );
P( C, D, A, B, 6, 17, 0xA8304613 );
P( B, C, D, A, 7, 22, 0xFD469501 );
P( A, B, C, D, 8, 7, 0x698098D8 );
P( D, A, B, C, 9, 12, 0x8B44F7AF );
P( C, D, A, B, 10, 17, 0xFFFF5BB1 );
P( B, C, D, A, 11, 22, 0x895CD7BE );
P( A, B, C, D, 12, 7, 0x6B901122 );
P( D, A, B, C, 13, 12, 0xFD987193 );
P( C, D, A, B, 14, 17, 0xA679438E );
P( B, C, D, A, 15, 22, 0x49B40821 );
P( A, B, C, D, 0, 7, 0xD76AA478 );
P( D, A, B, C, 1, 12, 0xE8C7B756 );
P( C, D, A, B, 2, 17, 0x242070DB );
P( B, C, D, A, 3, 22, 0xC1BDCEEE );
P( A, B, C, D, 4, 7, 0xF57C0FAF );
P( D, A, B, C, 5, 12, 0x4787C62A );
P( C, D, A, B, 6, 17, 0xA8304613 );
P( B, C, D, A, 7, 22, 0xFD469501 );
P( A, B, C, D, 8, 7, 0x698098D8 );
P( D, A, B, C, 9, 12, 0x8B44F7AF );
P( C, D, A, B, 10, 17, 0xFFFF5BB1 );
P( B, C, D, A, 11, 22, 0x895CD7BE );
P( A, B, C, D, 12, 7, 0x6B901122 );
P( D, A, B, C, 13, 12, 0xFD987193 );
P( C, D, A, B, 14, 17, 0xA679438E );
P( B, C, D, A, 15, 22, 0x49B40821 );
#undef F
#define F(x,y,z) (y ^ (z & (x ^ y)))
#define F( x, y, z ) (y ^ (z & (x ^ y)))
P( A, B, C, D, 1, 5, 0xF61E2562 );
P( D, A, B, C, 6, 9, 0xC040B340 );
P( C, D, A, B, 11, 14, 0x265E5A51 );
P( B, C, D, A, 0, 20, 0xE9B6C7AA );
P( A, B, C, D, 5, 5, 0xD62F105D );
P( D, A, B, C, 10, 9, 0x02441453 );
P( C, D, A, B, 15, 14, 0xD8A1E681 );
P( B, C, D, A, 4, 20, 0xE7D3FBC8 );
P( A, B, C, D, 9, 5, 0x21E1CDE6 );
P( D, A, B, C, 14, 9, 0xC33707D6 );
P( C, D, A, B, 3, 14, 0xF4D50D87 );
P( B, C, D, A, 8, 20, 0x455A14ED );
P( A, B, C, D, 13, 5, 0xA9E3E905 );
P( D, A, B, C, 2, 9, 0xFCEFA3F8 );
P( C, D, A, B, 7, 14, 0x676F02D9 );
P( B, C, D, A, 12, 20, 0x8D2A4C8A );
P( A, B, C, D, 1, 5, 0xF61E2562 );
P( D, A, B, C, 6, 9, 0xC040B340 );
P( C, D, A, B, 11, 14, 0x265E5A51 );
P( B, C, D, A, 0, 20, 0xE9B6C7AA );
P( A, B, C, D, 5, 5, 0xD62F105D );
P( D, A, B, C, 10, 9, 0x02441453 );
P( C, D, A, B, 15, 14, 0xD8A1E681 );
P( B, C, D, A, 4, 20, 0xE7D3FBC8 );
P( A, B, C, D, 9, 5, 0x21E1CDE6 );
P( D, A, B, C, 14, 9, 0xC33707D6 );
P( C, D, A, B, 3, 14, 0xF4D50D87 );
P( B, C, D, A, 8, 20, 0x455A14ED );
P( A, B, C, D, 13, 5, 0xA9E3E905 );
P( D, A, B, C, 2, 9, 0xFCEFA3F8 );
P( C, D, A, B, 7, 14, 0x676F02D9 );
P( B, C, D, A, 12, 20, 0x8D2A4C8A );
#undef F
#define F(x,y,z) (x ^ y ^ z)
#define F( x, y, z ) (x ^ y ^ z)
P( A, B, C, D, 5, 4, 0xFFFA3942 );
P( D, A, B, C, 8, 11, 0x8771F681 );
P( C, D, A, B, 11, 16, 0x6D9D6122 );
P( B, C, D, A, 14, 23, 0xFDE5380C );
P( A, B, C, D, 1, 4, 0xA4BEEA44 );
P( D, A, B, C, 4, 11, 0x4BDECFA9 );
P( C, D, A, B, 7, 16, 0xF6BB4B60 );
P( B, C, D, A, 10, 23, 0xBEBFBC70 );
P( A, B, C, D, 13, 4, 0x289B7EC6 );
P( D, A, B, C, 0, 11, 0xEAA127FA );
P( C, D, A, B, 3, 16, 0xD4EF3085 );
P( B, C, D, A, 6, 23, 0x04881D05 );
P( A, B, C, D, 9, 4, 0xD9D4D039 );
P( D, A, B, C, 12, 11, 0xE6DB99E5 );
P( C, D, A, B, 15, 16, 0x1FA27CF8 );
P( B, C, D, A, 2, 23, 0xC4AC5665 );
P( A, B, C, D, 5, 4, 0xFFFA3942 );
P( D, A, B, C, 8, 11, 0x8771F681 );
P( C, D, A, B, 11, 16, 0x6D9D6122 );
P( B, C, D, A, 14, 23, 0xFDE5380C );
P( A, B, C, D, 1, 4, 0xA4BEEA44 );
P( D, A, B, C, 4, 11, 0x4BDECFA9 );
P( C, D, A, B, 7, 16, 0xF6BB4B60 );
P( B, C, D, A, 10, 23, 0xBEBFBC70 );
P( A, B, C, D, 13, 4, 0x289B7EC6 );
P( D, A, B, C, 0, 11, 0xEAA127FA );
P( C, D, A, B, 3, 16, 0xD4EF3085 );
P( B, C, D, A, 6, 23, 0x04881D05 );
P( A, B, C, D, 9, 4, 0xD9D4D039 );
P( D, A, B, C, 12, 11, 0xE6DB99E5 );
P( C, D, A, B, 15, 16, 0x1FA27CF8 );
P( B, C, D, A, 2, 23, 0xC4AC5665 );
#undef F
#define F(x,y,z) (y ^ (x | ~z))
#define F( x, y, z ) (y ^ (x | ~z))
P( A, B, C, D, 0, 6, 0xF4292244 );
P( D, A, B, C, 7, 10, 0x432AFF97 );
P( C, D, A, B, 14, 15, 0xAB9423A7 );
P( B, C, D, A, 5, 21, 0xFC93A039 );
P( A, B, C, D, 12, 6, 0x655B59C3 );
P( D, A, B, C, 3, 10, 0x8F0CCC92 );
P( C, D, A, B, 10, 15, 0xFFEFF47D );
P( B, C, D, A, 1, 21, 0x85845DD1 );
P( A, B, C, D, 8, 6, 0x6FA87E4F );
P( D, A, B, C, 15, 10, 0xFE2CE6E0 );
P( C, D, A, B, 6, 15, 0xA3014314 );
P( B, C, D, A, 13, 21, 0x4E0811A1 );
P( A, B, C, D, 4, 6, 0xF7537E82 );
P( D, A, B, C, 11, 10, 0xBD3AF235 );
P( C, D, A, B, 2, 15, 0x2AD7D2BB );
P( B, C, D, A, 9, 21, 0xEB86D391 );
P( A, B, C, D, 0, 6, 0xF4292244 );
P( D, A, B, C, 7, 10, 0x432AFF97 );
P( C, D, A, B, 14, 15, 0xAB9423A7 );
P( B, C, D, A, 5, 21, 0xFC93A039 );
P( A, B, C, D, 12, 6, 0x655B59C3 );
P( D, A, B, C, 3, 10, 0x8F0CCC92 );
P( C, D, A, B, 10, 15, 0xFFEFF47D );
P( B, C, D, A, 1, 21, 0x85845DD1 );
P( A, B, C, D, 8, 6, 0x6FA87E4F );
P( D, A, B, C, 15, 10, 0xFE2CE6E0 );
P( C, D, A, B, 6, 15, 0xA3014314 );
P( B, C, D, A, 13, 21, 0x4E0811A1 );
P( A, B, C, D, 4, 6, 0xF7537E82 );
P( D, A, B, C, 11, 10, 0xBD3AF235 );
P( C, D, A, B, 2, 15, 0x2AD7D2BB );
P( B, C, D, A, 9, 21, 0xEB86D391 );
#undef F
ctx->state[0] += A;
ctx->state[1] += B;
ctx->state[2] += C;
ctx->state[3] += D;
ctx->state[ 0 ] += A;
ctx->state[ 1 ] += B;
ctx->state[ 2 ] += C;
ctx->state[ 3 ] += D;
}
void Core::Util::md5_update( md5_context *ctx, uint8_t *input, uint32_t length )
void Core::Util::md5_update( md5_context* ctx, uint8_t* input, uint32_t length )
{
uint32_t left, fill;
uint32_t left, fill;
if( !length ) return;
if( !length )
return;
left = ctx->total[0] & 0x3F;
fill = 64 - left;
left = ctx->total[ 0 ] & 0x3F;
fill = 64 - left;
ctx->total[0] += length;
ctx->total[0] &= 0xFFFFFFFF;
ctx->total[ 0 ] += length;
ctx->total[ 0 ] &= 0xFFFFFFFF;
if( ctx->total[0] < length )
ctx->total[1]++;
if( ctx->total[ 0 ] < length )
ctx->total[ 1 ]++;
if( left && length >= fill )
{
memcpy( ( void * )( ctx->buffer + left ),
( void * )input, fill );
md5_process( ctx, ctx->buffer );
length -= fill;
input += fill;
left = 0;
}
if( left && length >= fill )
{
memcpy( ( void* ) ( ctx->buffer + left ),
( void* ) input, fill );
md5_process( ctx, ctx->buffer );
length -= fill;
input += fill;
left = 0;
}
while( length >= 64 )
{
md5_process( ctx, input );
length -= 64;
input += 64;
}
while( length >= 64 )
{
md5_process( ctx, input );
length -= 64;
input += 64;
}
if( length )
{
memcpy( ( void * )( ctx->buffer + left ),
( void * )input, length );
}
if( length )
{
memcpy( ( void* ) ( ctx->buffer + left ),
( void* ) input, length );
}
}
static uint8_t md5_padding[64] =
{
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
void Core::Util::md5_finish( md5_context* ctx, uint8_t digest[16] )
{
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
uint32_t last, padn;
uint32_t high, low;
uint8_t msglen[8];
void Core::Util::md5_finish( md5_context *ctx, uint8_t digest[16] )
{
uint32_t last, padn;
uint32_t high, low;
uint8_t msglen[8];
high = ( ctx->total[ 0 ] >> 29 )
| ( ctx->total[ 1 ] << 3 );
low = ( ctx->total[ 0 ] << 3 );
high = ( ctx->total[0] >> 29 )
| ( ctx->total[1] << 3 );
low = ( ctx->total[0] << 3 );
PUT_UINT32( low, msglen, 0 );
PUT_UINT32( high, msglen, 4 );
PUT_UINT32( low, msglen, 0 );
PUT_UINT32( high, msglen, 4 );
last = ctx->total[ 0 ] & 0x3F;
padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
last = ctx->total[0] & 0x3F;
padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
md5_update( ctx, md5_padding, padn );
md5_update( ctx, msglen, 8 );
md5_update( ctx, md5_padding, padn );
md5_update( ctx, msglen, 8 );
PUT_UINT32( ctx->state[0], digest, 0 );
PUT_UINT32( ctx->state[1], digest, 4 );
PUT_UINT32( ctx->state[2], digest, 8 );
PUT_UINT32( ctx->state[3], digest, 12 );
PUT_UINT32( ctx->state[ 0 ], digest, 0 );
PUT_UINT32( ctx->state[ 1 ], digest, 4 );
PUT_UINT32( ctx->state[ 2 ], digest, 8 );
PUT_UINT32( ctx->state[ 3 ], digest, 12 );
}
/*
* those are the standard RFC 1321 test vectors
*/
void Core::Util::md5( uint8_t *text, uint8_t *hash, int32_t size )
void Core::Util::md5( uint8_t* text, uint8_t* hash, int32_t size )
{
md5_context ctx;
md5_starts( &ctx );
md5_update( &ctx, ( uint8_t * )text, size );
md5_finish( &ctx, hash );
md5_context ctx;
md5_starts( &ctx );
md5_update( &ctx, ( uint8_t* ) text, size );
md5_finish( &ctx, hash );
}

View file

@ -1,48 +1,50 @@
#ifndef _MD52_H
#define _MD52_H
#include <stdint.h>
namespace Core
namespace Core {
namespace Util {
using md5_context = struct
{
namespace Util
{
using md5_context = struct
{
uint32_t total[2];
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_starts( md5_context *ctx );
void md5_update( md5_context *ctx, uint8_t *input, uint32_t length );
void md5_finish( md5_context *ctx, uint8_t digest[16] );
void md5( uint8_t* text, uint8_t* hash, int32_t size );
static const char *msg[] =
{
"",
"a",
"abc",
"message digest",
"abcdefghijklmnopqrstuvwxyz",
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
"12345678901234567890123456789012345678901234567890123456789012" \
void md5_starts( md5_context* ctx );
void md5_update( md5_context* ctx, uint8_t* input, uint32_t length );
void md5_finish( md5_context* ctx, uint8_t digest[16] );
static const char* msg[] =
{
"",
"a",
"abc",
"message digest",
"abcdefghijklmnopqrstuvwxyz",
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
"12345678901234567890123456789012345678901234567890123456789012" \
"345678901234567890"
};
};
static const char *val[] =
{
"d41d8cd98f00b204e9800998ecf8427e",
"0cc175b9c0f1b6a831c399e269772661",
"900150983cd24fb0d6963f7d28e17f72",
"f96b697d7cb7938d525a2f31aaf161d0",
"c3fcd3d76192e4007dfb496cca67e13b",
"d174ab98d277d9f5a5611c2c9f419d9f",
"57edf4a22be3c955ac49da2e2107b67a"
};
static const char* val[] =
{
"d41d8cd98f00b204e9800998ecf8427e",
"0cc175b9c0f1b6a831c399e269772661",
"900150983cd24fb0d6963f7d28e17f72",
"f96b697d7cb7938d525a2f31aaf161d0",
"c3fcd3d76192e4007dfb496cca67e13b",
"d174ab98d277d9f5a5611c2c9f419d9f",
"57edf4a22be3c955ac49da2e2107b67a"
};
}
}
}

View file

@ -1,12 +1,14 @@
#include "CharaDbConnection.h"
#include <MySqlConnector.h>
Core::Db::CharaDbConnection::CharaDbConnection( ConnectionInfo& connInfo ) : DbConnection( connInfo )
Core::Db::CharaDbConnection::CharaDbConnection( ConnectionInfo& connInfo ) :
DbConnection( connInfo )
{
}
Core::Db::CharaDbConnection::CharaDbConnection( Core::LockedWaitQueue< boost::shared_ptr< Operation > >* q,
ConnectionInfo& connInfo) : DbConnection( q, connInfo )
ConnectionInfo& connInfo ) :
DbConnection( q, connInfo )
{
}
@ -16,126 +18,162 @@ Core::Db::CharaDbConnection::~CharaDbConnection()
void Core::Db::CharaDbConnection::doPrepareStatements()
{
if( !m_reconnecting )
m_stmts.resize( MAX_STATEMENTS );
if( !m_reconnecting )
m_stmts.resize( MAX_STATEMENTS );
/// CHARA
prepareStatement( CHARA_SEL, "SELECT ContentId, Name, Hp, Mp, Tp, Gp, Mode, Mount, InvincibleGM, Voice, "
"Customize, ModelMainWeapon, ModelSubWeapon, ModelSystemWeapon, "
"ModelEquip, EmoteModeType, FirstLoginTime, Language, IsNewGame, "
"IsNewAdventurer, TerritoryType, TerritoryId, PosX, PosY, PosZ, PosR, "
"OTerritoryType, OTerritoryId, OPosX, OPosY, OPosZ, OPosR, GuardianDeity, "
"BirthDay, BirthMonth, Class, Status, TotalPlayTime, FirstClass, HomePoint, "
"FavoritePoint, RestPoint, StartTown, ActiveTitle, TitleList, Achievement, "
"Aetheryte, HowTo, Minions, Mounts, Orchestrion, EquippedMannequin, ConfigFlags, "
"QuestCompleteFlags, OpeningSequence, QuestTracking, GrandCompany, "
"GrandCompanyRank, Discovery, GMRank, EquipDisplayFlags, Unlocks, CFPenaltyUntil, "
"Pose "
/// CHARA
prepareStatement( CHARA_SEL, "SELECT ContentId, Name, Hp, Mp, Tp, Gp, Mode, Mount, InvincibleGM, Voice, "
"Customize, ModelMainWeapon, ModelSubWeapon, ModelSystemWeapon, "
"ModelEquip, EmoteModeType, FirstLoginTime, Language, IsNewGame, "
"IsNewAdventurer, TerritoryType, TerritoryId, PosX, PosY, PosZ, PosR, "
"OTerritoryType, OTerritoryId, OPosX, OPosY, OPosZ, OPosR, GuardianDeity, "
"BirthDay, BirthMonth, Class, Status, TotalPlayTime, FirstClass, HomePoint, "
"FavoritePoint, RestPoint, StartTown, ActiveTitle, TitleList, Achievement, "
"Aetheryte, HowTo, Minions, Mounts, Orchestrion, EquippedMannequin, ConfigFlags, "
"QuestCompleteFlags, OpeningSequence, QuestTracking, GrandCompany, "
"GrandCompanyRank, Discovery, GMRank, EquipDisplayFlags, Unlocks, CFPenaltyUntil, "
"Pose "
"FROM charainfo WHERE CharacterId = ?;", CONNECTION_SYNC );
prepareStatement( CHARA_UP,
"UPDATE charainfo SET "
"Hp = ?, Mp = ?, Tp = ?, Gp = ?, Mode = ?, Mount = ?, InvincibleGM = ?, Voice = ?, "
"Customize = ?, ModelMainWeapon = ?, ModelSubWeapon = ?, ModelSystemWeapon = ?, "
"ModelEquip = ?, EmoteModeType = ?, Language = ?, IsNewGame = ?, IsNewAdventurer = ?, "
"TerritoryType = ?, TerritoryId = ?, PosX = ?, PosY = ?, PosZ = ?, PosR = ?, "
"OTerritoryType = ?, OTerritoryId = ?, OPosX = ?, OPosY = ?, OPosZ = ?, OPosR = ?, "
"Class = ?, Status = ?, TotalPlayTime = ?, HomePoint = ?, FavoritePoint = ?, RestPoint = ?, "
"ActiveTitle = ?, TitleList = ?, Achievement = ?, Aetheryte = ?, HowTo = ?, Minions = ?, Mounts = ?, Orchestrion = ?, "
"EquippedMannequin = ?, ConfigFlags = ?, QuestCompleteFlags = ?, OpeningSequence = ?, "
"QuestTracking = ?, GrandCompany = ?, GrandCompanyRank = ?, Discovery = ?, GMRank = ?, EquipDisplayFlags = ?, Unlocks = ?, "
"CFPenaltyUntil = ?, Pose = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_SEL_MINIMAL, "SELECT Name, Customize, ModelEquip, TerritoryId, GuardianDeity, "
"Class, ContentId, BirthDay, BirthMonth "
"FROM charainfo WHERE CharacterId = ?;", CONNECTION_SYNC );
prepareStatement( CHARA_INS, "INSERT INTO charainfo (AccountId, CharacterId, ContentId, Name, Hp, Mp, "
"Customize, Voice, IsNewGame, TerritoryId, PosX, PosY, PosZ, PosR, ModelEquip, "
"IsNewAdventurer, GuardianDeity, Birthday, BirthMonth, Class, Status, FirstClass, "
"HomePoint, StartTown, Discovery, HowTo, QuestCompleteFlags, Unlocks, QuestTracking, "
"Aetheryte, GMRank, Mounts, Orchestrion, UPDATE_DATE ) "
"VALUES ( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,NOW() );",
CONNECTION_SYNC );
prepareStatement( CHARA_UP,
"UPDATE charainfo SET "
"Hp = ?, Mp = ?, Tp = ?, Gp = ?, Mode = ?, Mount = ?, InvincibleGM = ?, Voice = ?, "
"Customize = ?, ModelMainWeapon = ?, ModelSubWeapon = ?, ModelSystemWeapon = ?, "
"ModelEquip = ?, EmoteModeType = ?, Language = ?, IsNewGame = ?, IsNewAdventurer = ?, "
"TerritoryType = ?, TerritoryId = ?, PosX = ?, PosY = ?, PosZ = ?, PosR = ?, "
"OTerritoryType = ?, OTerritoryId = ?, OPosX = ?, OPosY = ?, OPosZ = ?, OPosR = ?, "
"Class = ?, Status = ?, TotalPlayTime = ?, HomePoint = ?, FavoritePoint = ?, RestPoint = ?, "
"ActiveTitle = ?, TitleList = ?, Achievement = ?, Aetheryte = ?, HowTo = ?, Minions = ?, Mounts = ?, Orchestrion = ?, "
"EquippedMannequin = ?, ConfigFlags = ?, QuestCompleteFlags = ?, OpeningSequence = ?, "
"QuestTracking = ?, GrandCompany = ?, GrandCompanyRank = ?, Discovery = ?, GMRank = ?, EquipDisplayFlags = ?, Unlocks = ?, "
"CFPenaltyUntil = ?, Pose = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_NAME, "UPDATE charainfo SET Name = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_HPMP, "UPDATE charainfo SET Hp = ?, Mp = ?, Tp = ?, Gp = ? WHERE CharacterId = ?;",
CONNECTION_ASYNC );
prepareStatement( CHARA_UP_MODE, "UPDATE charainfo SET Mode = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_MOUNT, "UPDATE charainfo SET Mount = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_INVINCIBLE, "UPDATE charainfo SET InvincibleGM = ? WHERE CharacterId = ?;",
CONNECTION_ASYNC );
prepareStatement( CHARA_UP_CUSTOMIZE, "UPDATE charainfo SET Customize = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_MODELMAINWEAP, "UPDATE charainfo SET ModelMainWeapon = ? WHERE CharacterId = ?;",
CONNECTION_ASYNC );
prepareStatement( CHARA_UP_MODELSUBWEAP, "UPDATE charainfo SET ModelSubWeapon = ? WHERE CharacterId = ?;",
CONNECTION_ASYNC );
prepareStatement( CHARA_UP_MODELSYSWEAP, "UPDATE charainfo SET ModelSystemWeapon = ? WHERE CharacterId = ?;",
CONNECTION_ASYNC );
prepareStatement( CHARA_UP_MODELEQUIP, "UPDATE charainfo SET ModelEquip = ? WHERE CharacterId = ?;",
CONNECTION_ASYNC );
prepareStatement( CHARA_UP_EMOTEMODETYPE, "UPDATE charainfo SET EmoteModeType = ? WHERE CharacterId = ?;",
CONNECTION_ASYNC );
prepareStatement( CHARA_UP_FIRSTLOGINTIME, "UPDATE charainfo SET FirstLoginTime = ? WHERE CharacterId = ?;",
CONNECTION_ASYNC );
prepareStatement( CHARA_UP_LANGUAGE, "UPDATE charainfo SET Language = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_ISNEWGAME, "UPDATE charainfo SET IsNewGame = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_ISNEWADV, "UPDATE charainfo SET IsNewAdventurer = ? WHERE CharacterId = ?;",
CONNECTION_ASYNC );
prepareStatement( CHARA_UP_TERRITORY,
"UPDATE charainfo SET TerritoryType = ?, TerritoryId = ? WHERE CharacterId = ?;",
CONNECTION_ASYNC );
prepareStatement( CHARA_UP_POS,
"UPDATE charainfo SET OPosX = ?, OPosY = ?, OPosZ = ?, OPosR = ? WHERE CharacterId = ?;",
CONNECTION_ASYNC );
prepareStatement( CHARA_UP_CLASS, "UPDATE charainfo SET Class = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_STATUS, "UPDATE charainfo SET Status = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_TOTALPLAYTIME, "UPDATE charainfo SET TotalPlayTime = ? WHERE CharacterId = ?;",
CONNECTION_ASYNC );
prepareStatement( CHARA_UP_HOMEPOINT, "UPDATE charainfo SET Homepoint = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_FAVOPOINT, "UPDATE charainfo SET FavoritePoint = ? WHERE CharacterId = ?;",
CONNECTION_ASYNC );
prepareStatement( CHARA_UP_TITLE, "UPDATE charainfo SET ActiveTitle = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_TITLELIST, "UPDATE charainfo SET TitleList = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_ACHIEVEMENTS, "UPDATE charainfo SET Achievement = ? WHERE CharacterId = ?;",
CONNECTION_ASYNC );
prepareStatement( CHARA_UP_AETHERYTE, "UPDATE charainfo SET Aetheryte = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_HOWTO, "UPDATE charainfo SET HowTo = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_MINIONS, "UPDATE charainfo SET Minions = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_MOUNTS, "UPDATE charainfo SET Mounts = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_GEARSET, "UPDATE charainfo SET EquippedMannequin = ? WHERE CharacterId = ?;",
CONNECTION_ASYNC );
prepareStatement( CHARA_UP_CONFIGFLAGS, "UPDATE charainfo SET ConfigFlags = ? WHERE CharacterId = ?;",
CONNECTION_ASYNC );
prepareStatement( CHARA_UP_QUESTCOMPLETE, "UPDATE charainfo SET QuestCompleteFlags = ? WHERE CharacterId = ?;",
CONNECTION_ASYNC );
prepareStatement( CHARA_UP_OPENINGSEQ, "UPDATE charainfo SET OpeningSequence = ? WHERE CharacterId = ?;",
CONNECTION_ASYNC );
prepareStatement( CHARA_UP_QUESTTRACKING, "UPDATE charainfo SET QuestTracking = ? WHERE CharacterId = ?;",
CONNECTION_ASYNC );
prepareStatement( CHARA_UP_GRANDCOMPANY, "UPDATE charainfo SET GrandCompany = ? WHERE CharacterId = ?;",
CONNECTION_ASYNC );
prepareStatement( CHARA_UP_GRANDCOMPANYRANKS, "UPDATE charainfo SET GrandCompanyRank = ? WHERE CharacterId = ?;",
CONNECTION_ASYNC );
prepareStatement( CHARA_UP_DISCOVERY, "UPDATE charainfo SET Discovery = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_GMRANK, "UPDATE charainfo SET GMRank = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_EQUIPDISPLAYFLAGS, "UPDATE charainfo SET EquipDisplayFlags = ? WHERE CharacterId = ?;",
CONNECTION_ASYNC );
prepareStatement( CHARA_UP_UNLOCKS, "UPDATE charainfo SET Unlocks = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_CFPENATLY, "UPDATE charainfo SET CFPenaltyUntil = ? WHERE CharacterId = ?;",
CONNECTION_ASYNC );
/// SEARCH INFO
prepareStatement( CHARA_SEARCHINFO_INS,
"INSERT INTO charainfosearch (CharacterId, UPDATE_DATE ) VALUES ( ?, NOW() );", CONNECTION_BOTH );
prepareStatement( CHARA_SEARCHINFO_UP_SELECTCLASS,
"UPDATE charainfosearch SET SelectClassId = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_SEARCHINFO_UP_SELECTREGION,
"UPDATE charainfosearch SET SelectRegion = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_SEARCHINFO_UP_SEARCHCOMMENT,
"UPDATE charainfosearch SET SearchComment = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_SEARCHINFO_SEL, "SELECT * FROM charainfosearch WHERE CharacterId = ?;", CONNECTION_SYNC );
prepareStatement( CHARA_SEL_MINIMAL, "SELECT Name, Customize, ModelEquip, TerritoryId, GuardianDeity, "
"Class, ContentId, BirthDay, BirthMonth "
"FROM charainfo WHERE CharacterId = ?;", CONNECTION_SYNC );
/// QUEST INFO
prepareStatement( CHARA_QUEST_INS,
"INSERT INTO charaquestnew ( CharacterId, SlotId, QuestId, Sequence, Flags, Variables_0, "
"Variables_1, Variables_2, Variables_3, Variables_4, "
"Variables_5, Variables_6 ) VALUES( ?,?,?,?,?,?,?,?,?,?,?,? );", CONNECTION_ASYNC );
prepareStatement( CHARA_INS, "INSERT INTO charainfo (AccountId, CharacterId, ContentId, Name, Hp, Mp, "
"Customize, Voice, IsNewGame, TerritoryId, PosX, PosY, PosZ, PosR, ModelEquip, "
"IsNewAdventurer, GuardianDeity, Birthday, BirthMonth, Class, Status, FirstClass, "
"HomePoint, StartTown, Discovery, HowTo, QuestCompleteFlags, Unlocks, QuestTracking, "
"Aetheryte, GMRank, Mounts, Orchestrion, UPDATE_DATE ) "
"VALUES ( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,NOW() );",
CONNECTION_SYNC );
prepareStatement( CHARA_QUEST_UP, "UPDATE charaquestnew SET Sequence = ?, Flags = ?, Variables_0 = ?, "
"Variables_1 = ?, Variables_2 = ?, Variables_3 = ?, "
"Variables_4 = ?, Variables_5 = ?, Variables_6 = ? "
"WHERE CharacterId = ? AND QuestId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_NAME, "UPDATE charainfo SET Name = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_HPMP, "UPDATE charainfo SET Hp = ?, Mp = ?, Tp = ?, Gp = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_MODE, "UPDATE charainfo SET Mode = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_MOUNT, "UPDATE charainfo SET Mount = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_INVINCIBLE, "UPDATE charainfo SET InvincibleGM = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_CUSTOMIZE, "UPDATE charainfo SET Customize = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_MODELMAINWEAP, "UPDATE charainfo SET ModelMainWeapon = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_MODELSUBWEAP, "UPDATE charainfo SET ModelSubWeapon = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_MODELSYSWEAP, "UPDATE charainfo SET ModelSystemWeapon = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_MODELEQUIP, "UPDATE charainfo SET ModelEquip = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_EMOTEMODETYPE, "UPDATE charainfo SET EmoteModeType = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_FIRSTLOGINTIME, "UPDATE charainfo SET FirstLoginTime = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_LANGUAGE, "UPDATE charainfo SET Language = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_ISNEWGAME, "UPDATE charainfo SET IsNewGame = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_ISNEWADV, "UPDATE charainfo SET IsNewAdventurer = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_TERRITORY, "UPDATE charainfo SET TerritoryType = ?, TerritoryId = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_POS, "UPDATE charainfo SET OPosX = ?, OPosY = ?, OPosZ = ?, OPosR = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_CLASS, "UPDATE charainfo SET Class = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_STATUS, "UPDATE charainfo SET Status = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_TOTALPLAYTIME, "UPDATE charainfo SET TotalPlayTime = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_HOMEPOINT, "UPDATE charainfo SET Homepoint = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_FAVOPOINT, "UPDATE charainfo SET FavoritePoint = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_TITLE, "UPDATE charainfo SET ActiveTitle = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_TITLELIST, "UPDATE charainfo SET TitleList = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_ACHIEVEMENTS, "UPDATE charainfo SET Achievement = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_AETHERYTE, "UPDATE charainfo SET Aetheryte = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_HOWTO, "UPDATE charainfo SET HowTo = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_MINIONS, "UPDATE charainfo SET Minions = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_MOUNTS, "UPDATE charainfo SET Mounts = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_GEARSET, "UPDATE charainfo SET EquippedMannequin = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_CONFIGFLAGS, "UPDATE charainfo SET ConfigFlags = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_QUESTCOMPLETE, "UPDATE charainfo SET QuestCompleteFlags = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_OPENINGSEQ, "UPDATE charainfo SET OpeningSequence = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_QUESTTRACKING, "UPDATE charainfo SET QuestTracking = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_GRANDCOMPANY, "UPDATE charainfo SET GrandCompany = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_GRANDCOMPANYRANKS, "UPDATE charainfo SET GrandCompanyRank = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_DISCOVERY, "UPDATE charainfo SET Discovery = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_GMRANK, "UPDATE charainfo SET GMRank = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_EQUIPDISPLAYFLAGS, "UPDATE charainfo SET EquipDisplayFlags = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_UNLOCKS, "UPDATE charainfo SET Unlocks = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_UP_CFPENATLY, "UPDATE charainfo SET CFPenaltyUntil = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_QUEST_DEL, "DELETE FROM charaquestnew WHERE CharacterId = ? AND QuestId = ?;",
CONNECTION_ASYNC );
/// SEARCH INFO
prepareStatement( CHARA_SEARCHINFO_INS, "INSERT INTO charainfosearch (CharacterId, UPDATE_DATE ) VALUES ( ?, NOW() );", CONNECTION_BOTH );
prepareStatement( CHARA_SEARCHINFO_UP_SELECTCLASS, "UPDATE charainfosearch SET SelectClassId = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_SEARCHINFO_UP_SELECTREGION, "UPDATE charainfosearch SET SelectRegion = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_SEARCHINFO_UP_SEARCHCOMMENT, "UPDATE charainfosearch SET SearchComment = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_SEARCHINFO_SEL, "SELECT * FROM charainfosearch WHERE CharacterId = ?;", CONNECTION_SYNC );
prepareStatement( CHARA_QUEST_SEL, "SELECT * FROM charaquestnew WHERE CharacterId = ?;", CONNECTION_SYNC );
/// QUEST INFO
prepareStatement( CHARA_QUEST_INS, "INSERT INTO charaquestnew ( CharacterId, SlotId, QuestId, Sequence, Flags, Variables_0, "
"Variables_1, Variables_2, Variables_3, Variables_4, "
"Variables_5, Variables_6 ) VALUES( ?,?,?,?,?,?,?,?,?,?,?,? );", CONNECTION_ASYNC );
prepareStatement( CHARA_QUEST_UP, "UPDATE charaquestnew SET Sequence = ?, Flags = ?, Variables_0 = ?, "
"Variables_1 = ?, Variables_2 = ?, Variables_3 = ?, "
"Variables_4 = ?, Variables_5 = ?, Variables_6 = ? "
"WHERE CharacterId = ? AND QuestId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_QUEST_DEL, "DELETE FROM charaquestnew WHERE CharacterId = ? AND QuestId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_QUEST_SEL, "SELECT * FROM charaquestnew WHERE CharacterId = ?;", CONNECTION_SYNC );
/// CLASS INFO
prepareStatement( CHARA_CLASS_SEL, "SELECT ClassIdx, Exp, Lvl FROM characlass WHERE CharacterId = ?;", CONNECTION_SYNC );
prepareStatement( CHARA_CLASS_INS, "INSERT INTO characlass ( CharacterId, ClassIdx, Exp, Lvl ) VALUES( ?,?,?,? );", CONNECTION_BOTH );
prepareStatement( CHARA_CLASS_UP, "UPDATE characlass SET Exp = ?, Lvl = ? WHERE CharacterId = ? AND ClassIdx = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_CLASS_DEL, "DELETE FROM characlass WHERE CharacterId = ?;", CONNECTION_ASYNC );
/// INVENTORY INFO
prepareStatement( CHARA_ITEMINV_INS, "INSERT INTO charaiteminventory ( CharacterId, storageId, UPDATE_DATE ) VALUES ( ?, ?, NOW() );", CONNECTION_BOTH );
/// ITEM GLOBAL
prepareStatement( CHARA_ITEMGLOBAL_INS, "INSERT INTO charaglobalitem ( CharacterId, ItemId, catalogId, UPDATE_DATE ) VALUES ( ?, ?, ?, NOW() );", CONNECTION_BOTH );
/// CLASS INFO
prepareStatement( CHARA_CLASS_SEL, "SELECT ClassIdx, Exp, Lvl FROM characlass WHERE CharacterId = ?;",
CONNECTION_SYNC );
prepareStatement( CHARA_CLASS_INS, "INSERT INTO characlass ( CharacterId, ClassIdx, Exp, Lvl ) VALUES( ?,?,?,? );",
CONNECTION_BOTH );
prepareStatement( CHARA_CLASS_UP, "UPDATE characlass SET Exp = ?, Lvl = ? WHERE CharacterId = ? AND ClassIdx = ?;",
CONNECTION_ASYNC );
prepareStatement( CHARA_CLASS_DEL, "DELETE FROM characlass WHERE CharacterId = ?;", CONNECTION_ASYNC );
/// INVENTORY INFO
prepareStatement( CHARA_ITEMINV_INS,
"INSERT INTO charaiteminventory ( CharacterId, storageId, UPDATE_DATE ) VALUES ( ?, ?, NOW() );",
CONNECTION_BOTH );
/// ITEM GLOBAL
prepareStatement( CHARA_ITEMGLOBAL_INS,
"INSERT INTO charaglobalitem ( CharacterId, ItemId, catalogId, UPDATE_DATE ) VALUES ( ?, ?, ?, NOW() );",
CONNECTION_BOTH );
}

View file

@ -3,93 +3,94 @@
#include "DbConnection.h"
namespace Core
{
namespace Db
{
namespace Core {
namespace Db {
class DbConnectionInfo;
enum CharaDbStatements : uint32_t
enum CharaDbStatements :
uint32_t
{
CHARA_SEL,
CHARA_SEL_MINIMAL,
CHARA_SEARCHINFO_SEL,
CHARA_QUEST_SEL,
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_SEL,
CHARA_SEL_MINIMAL,
CHARA_SEARCHINFO_SEL,
CHARA_QUEST_SEL,
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,
CHARA_QUEST_UP,
CHARA_QUEST_DEL,
CHARA_QUEST_INS,
CHARA_QUEST_UP,
CHARA_QUEST_DEL,
CHARA_CLASS_SEL,
CHARA_CLASS_INS,
CHARA_CLASS_UP,
CHARA_CLASS_DEL,
CHARA_CLASS_SEL,
CHARA_CLASS_INS,
CHARA_CLASS_UP,
CHARA_CLASS_DEL,
CHARA_ITEMINV_INS,
CHARA_ITEMINV_INS,
CHARA_ITEMGLOBAL_INS,
CHARA_ITEMGLOBAL_INS,
MAX_STATEMENTS
MAX_STATEMENTS
};
class CharaDbConnection : public DbConnection
class CharaDbConnection :
public DbConnection
{
public:
using Statements = CharaDbStatements;
using Statements = CharaDbStatements;
CharaDbConnection( ConnectionInfo& connInfo );
CharaDbConnection( Core::LockedWaitQueue< boost::shared_ptr< Operation > >* q, ConnectionInfo &connInfo );
CharaDbConnection( ConnectionInfo& connInfo );
~CharaDbConnection();
CharaDbConnection( Core::LockedWaitQueue< boost::shared_ptr< Operation > >* q, ConnectionInfo& connInfo );
void doPrepareStatements() override;
~CharaDbConnection();
void doPrepareStatements() override;
};

View file

@ -9,241 +9,242 @@
extern Core::Framework g_fw;
Core::Db::DbConnection::DbConnection( ConnectionInfo &connInfo ) :
m_reconnecting( false ),
m_prepareError( false ),
m_queue( nullptr ),
m_pConnection( nullptr ),
m_connectionInfo( connInfo ),
m_connectionFlags( CONNECTION_SYNC )
Core::Db::DbConnection::DbConnection( ConnectionInfo& connInfo ) :
m_reconnecting( false ),
m_prepareError( false ),
m_queue( nullptr ),
m_pConnection( nullptr ),
m_connectionInfo( connInfo ),
m_connectionFlags( CONNECTION_SYNC )
{
}
Core::Db::DbConnection::DbConnection( Core::LockedWaitQueue< boost::shared_ptr< Operation > >* queue,
Core::Db::ConnectionInfo& connInfo ) :
m_reconnecting( false ),
m_prepareError( false ),
m_queue( queue ),
m_pConnection( nullptr ),
m_connectionInfo( connInfo ),
m_connectionFlags( CONNECTION_ASYNC )
m_reconnecting( false ),
m_prepareError( false ),
m_queue( queue ),
m_pConnection( nullptr ),
m_connectionInfo( connInfo ),
m_connectionFlags( CONNECTION_ASYNC )
{
m_worker = boost::make_shared< DbWorker >( m_queue, this );
m_worker = boost::make_shared< DbWorker >( m_queue, this );
}
Core::Db::DbConnection::~DbConnection()
{
close();
close();
}
void Core::Db::DbConnection::close()
{
m_worker.reset();
m_stmts.clear();
m_worker.reset();
m_stmts.clear();
if( m_pConnection )
{
m_pConnection->close();
m_pConnection.reset();
}
if( m_pConnection )
{
m_pConnection->close();
m_pConnection.reset();
}
}
uint32_t Core::Db::DbConnection::open()
{
boost::shared_ptr< Mysql::MySqlBase > base( new Mysql::MySqlBase() );
Mysql::optionMap options;
options[ MYSQL_OPT_RECONNECT ] = "1";
options[ MYSQL_SET_CHARSET_NAME ] = "utf8";
boost::shared_ptr< Mysql::MySqlBase > base( new Mysql::MySqlBase() );
Mysql::optionMap options;
options[ MYSQL_OPT_RECONNECT ] = "1";
options[ MYSQL_SET_CHARSET_NAME ] = "utf8";
try
{
m_pConnection = base->connect( m_connectionInfo.host, m_connectionInfo.user, m_connectionInfo.password,
options, m_connectionInfo.port );
try
{
m_pConnection = base->connect( m_connectionInfo.host, m_connectionInfo.user, m_connectionInfo.password,
options, m_connectionInfo.port );
m_pConnection->setSchema( m_connectionInfo.database );
}
catch( std::runtime_error& e )
{
g_fw.get< Logger >()->error( e.what() );
return 1;
}
m_pConnection->setSchema( m_connectionInfo.database );
}
catch( std::runtime_error& e )
{
g_fw.get< Logger >()->error( e.what() );
return 1;
}
return 0;
return 0;
}
uint32_t Core::Db::DbConnection::getLastError()
{
return m_pConnection->getErrorNo();
return m_pConnection->getErrorNo();
}
bool Core::Db::DbConnection::ping()
{
return m_pConnection->ping();
return m_pConnection->ping();
}
bool Core::Db::DbConnection::lockIfReady()
{
return m_mutex.try_lock();
return m_mutex.try_lock();
}
void Core::Db::DbConnection::unlock()
{
m_mutex.unlock();
m_mutex.unlock();
}
void Core::Db::DbConnection::beginTransaction()
{
m_pConnection->beginTransaction();
m_pConnection->beginTransaction();
}
void Core::Db::DbConnection::rollbackTransaction()
{
m_pConnection->rollbackTransaction();
m_pConnection->rollbackTransaction();
}
void Core::Db::DbConnection::commitTransaction()
{
m_pConnection->commitTransaction();
m_pConnection->commitTransaction();
}
bool Core::Db::DbConnection::execute( const std::string& sql )
{
try
{
auto stmt = m_pConnection->createStatement();
bool result = stmt->execute( sql );
return result;
}
catch( std::runtime_error& e )
{
g_fw.get< Logger >()->error( e.what() );
return false;
}
try
{
auto stmt = m_pConnection->createStatement();
bool result = stmt->execute( sql );
return result;
}
catch( std::runtime_error& e )
{
g_fw.get< Logger >()->error( e.what() );
return false;
}
}
boost::shared_ptr< Mysql::ResultSet > Core::Db::DbConnection::query( const std::string& sql )
{
try
{
auto stmt = m_pConnection->createStatement();
auto result = stmt->executeQuery( sql );
return result;
}
catch( std::runtime_error& e )
{
g_fw.get< Logger >()->error( e.what() );
return nullptr;
}
try
{
auto stmt = m_pConnection->createStatement();
auto result = stmt->executeQuery( sql );
return result;
}
catch( std::runtime_error& e )
{
g_fw.get< Logger >()->error( e.what() );
return nullptr;
}
}
boost::shared_ptr< Mysql::ResultSet > Core::Db::DbConnection::query( boost::shared_ptr< Core::Db::PreparedStatement > stmt )
boost::shared_ptr< Mysql::ResultSet >
Core::Db::DbConnection::query( boost::shared_ptr< Core::Db::PreparedStatement > stmt )
{
boost::shared_ptr< Mysql::ResultSet > res( nullptr );
if( !stmt )
boost::shared_ptr< Mysql::ResultSet > res( nullptr );
if( !stmt )
return nullptr;
if( !ping() )
{
// naivly reconnect and hope for the best
open();
lockIfReady();
if( !prepareStatements() )
return nullptr;
}
if( !ping() )
{
// naivly reconnect and hope for the best
open();
lockIfReady();
if( !prepareStatements() )
return nullptr;
}
uint32_t index = stmt->getIndex();
uint32_t index = stmt->getIndex();
auto pStmt = getPreparedStatement( index );
auto pStmt = getPreparedStatement( index );
if( !pStmt )
return nullptr;
if( !pStmt )
return nullptr;
stmt->setMysqlPS( pStmt );
try
{
stmt->bindParameters();
return pStmt->executeQuery();
}
catch( std::runtime_error& e )
{
g_fw.get< Logger >()->error( e.what() );
return nullptr;
}
stmt->setMysqlPS( pStmt );
try
{
stmt->bindParameters();
return pStmt->executeQuery();
}
catch( std::runtime_error& e )
{
g_fw.get< Logger >()->error( e.what() );
return nullptr;
}
}
bool Core::Db::DbConnection::execute( boost::shared_ptr< Core::Db::PreparedStatement > stmt )
{
if( !stmt )
return false;
if( !stmt )
return false;
uint32_t index = stmt->getIndex();
uint32_t index = stmt->getIndex();
auto pStmt = getPreparedStatement( index );
auto pStmt = getPreparedStatement( index );
if( !pStmt )
return false;
if( !pStmt )
return false;
stmt->setMysqlPS( pStmt );
try
{
stmt->bindParameters();
return pStmt->execute();
}
catch( std::runtime_error& e )
{
g_fw.get< Logger >()->error( e.what() );
return false;
}
stmt->setMysqlPS( pStmt );
try
{
stmt->bindParameters();
return pStmt->execute();
}
catch( std::runtime_error& e )
{
g_fw.get< Logger >()->error( e.what() );
return false;
}
}
boost::shared_ptr< Mysql::PreparedStatement > Core::Db::DbConnection::getPreparedStatement( uint32_t index )
{
assert( index < m_stmts.size() );
auto ret = m_stmts[index];
if( !ret )
nullptr;
assert( index < m_stmts.size() );
auto ret = m_stmts[ index ];
if( !ret )
nullptr;
return ret;
return ret;
}
void Core::Db::DbConnection::prepareStatement( uint32_t index, const std::string &sql, Core::Db::ConnectionFlags flags )
void Core::Db::DbConnection::prepareStatement( uint32_t index, const std::string& sql, Core::Db::ConnectionFlags flags )
{
m_queries.insert( PreparedStatementMap::value_type( index, std::make_pair( sql, flags ) ) );
m_queries.insert( PreparedStatementMap::value_type( index, std::make_pair( sql, flags ) ) );
// Check if specified query should be prepared on this connection
// i.e. don't prepare async statements on synchronous connections
// to save memory that will not be used.
if( !( m_connectionFlags & flags ) )
{
m_stmts[index].reset();
return;
}
// Check if specified query should be prepared on this connection
// i.e. don't prepare async statements on synchronous connections
// to save memory that will not be used.
if( !( m_connectionFlags & flags ) )
{
m_stmts[ index ].reset();
return;
}
boost::shared_ptr< Mysql::PreparedStatement > pStmt( nullptr );
boost::shared_ptr< Mysql::PreparedStatement > pStmt( nullptr );
try
{
pStmt = m_pConnection->prepareStatement( sql );
}
catch( std::runtime_error& e )
{
g_fw.get< Logger >()->error( e.what() );
m_prepareError = true;
}
try
{
pStmt = m_pConnection->prepareStatement( sql );
}
catch( std::runtime_error& e )
{
g_fw.get< Logger >()->error( e.what() );
m_prepareError = true;
}
m_stmts[index] = boost::shared_ptr< Mysql::PreparedStatement >( pStmt );
m_stmts[ index ] = boost::shared_ptr< Mysql::PreparedStatement >( pStmt );
}
bool Core::Db::DbConnection::prepareStatements()
{
doPrepareStatements();
return !m_prepareError;
doPrepareStatements();
return !m_prepareError;
}

View file

@ -10,98 +10,117 @@
#include <boost/scoped_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
namespace Mysql
{
class Connection;
class ResultSet;
class PreparedResultSet;
class PreparedStatement;
namespace Mysql {
class Connection;
class ResultSet;
class PreparedResultSet;
class PreparedStatement;
}
namespace Core
namespace Core {
namespace Db {
class DatabaseWorker;
class PreparedStatement;
class Operation;
class DbWorker;
using PreparedStmtScopedPtr = boost::scoped_ptr< PreparedStatement >;
enum ConnectionFlags
{
namespace Db
CONNECTION_ASYNC = 0x1,
CONNECTION_SYNC = 0x2,
CONNECTION_BOTH = CONNECTION_ASYNC | CONNECTION_SYNC
};
struct ConnectionInfo
{
class DatabaseWorker;
class PreparedStatement;
class Operation;
class DbWorker;
std::string user;
std::string password;
std::string database;
std::string host;
uint16_t port;
uint8_t syncThreads;
uint8_t asyncThreads;
};
using PreparedStmtScopedPtr = boost::scoped_ptr< PreparedStatement >;
using PreparedStatementMap = std::map< uint32_t, std::pair< std::string, ConnectionFlags > >;
enum ConnectionFlags
{
CONNECTION_ASYNC = 0x1,
CONNECTION_SYNC = 0x2,
CONNECTION_BOTH = CONNECTION_ASYNC | CONNECTION_SYNC
};
class DbConnection :
public boost::enable_shared_from_this< DbConnection >
{
public:
// Constructor for synchronous connections.
DbConnection( ConnectionInfo& connInfo );
struct ConnectionInfo
{
std::string user;
std::string password;
std::string database;
std::string host;
uint16_t port;
uint8_t syncThreads;
uint8_t asyncThreads;
};
// Constructor for asynchronous connections.
DbConnection( Core::LockedWaitQueue< boost::shared_ptr< Operation > >* queue, ConnectionInfo& connInfo );
using PreparedStatementMap = std::map< uint32_t, std::pair< std::string, ConnectionFlags > >;
virtual ~DbConnection();
class DbConnection : public boost::enable_shared_from_this< DbConnection >
{
public:
// Constructor for synchronous connections.
DbConnection( ConnectionInfo& connInfo );
// Constructor for asynchronous connections.
DbConnection( Core::LockedWaitQueue< boost::shared_ptr< Operation > >* queue, ConnectionInfo& connInfo );
virtual ~DbConnection();
virtual uint32_t open();
virtual uint32_t open();
void close();
void close();
bool prepareStatements();
bool prepareStatements();
bool execute( const std::string& sql );
bool execute( boost::shared_ptr< PreparedStatement > stmt );
boost::shared_ptr< Mysql::ResultSet > query( const std::string& sql );
boost::shared_ptr< Mysql::ResultSet > query( boost::shared_ptr< PreparedStatement > stmt );
bool execute( const std::string& sql );
void beginTransaction();
void rollbackTransaction();
void commitTransaction();
bool execute( boost::shared_ptr< PreparedStatement > stmt );
bool ping();
boost::shared_ptr< Mysql::ResultSet > query( const std::string& sql );
uint32_t getLastError();
bool lockIfReady();
boost::shared_ptr< Mysql::ResultSet > query( boost::shared_ptr< PreparedStatement > stmt );
void unlock();
void beginTransaction();
boost::shared_ptr< Mysql::Connection > getConnection() { return m_pConnection; }
boost::shared_ptr< Mysql::PreparedStatement > getPreparedStatement( uint32_t index );
void prepareStatement( uint32_t index, const std::string& sql, ConnectionFlags flags );
void rollbackTransaction();
virtual void doPrepareStatements() = 0;
void commitTransaction();
protected:
std::vector< boost::shared_ptr< Mysql::PreparedStatement > > m_stmts;
PreparedStatementMap m_queries;
bool m_reconnecting;
bool m_prepareError;
bool ping();
private:
LockedWaitQueue< boost::shared_ptr< Operation > >* m_queue;
boost::shared_ptr< DbWorker > m_worker;
boost::shared_ptr< Mysql::Connection > m_pConnection;
ConnectionInfo& m_connectionInfo;
ConnectionFlags m_connectionFlags;
std::mutex m_mutex;
uint32_t getLastError();
DbConnection( DbConnection const& right ) = delete;
DbConnection& operator=( DbConnection const& right ) = delete;
};
bool lockIfReady();
void unlock();
boost::shared_ptr< Mysql::Connection > getConnection()
{
return m_pConnection;
}
boost::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< boost::shared_ptr< Mysql::PreparedStatement > > m_stmts;
PreparedStatementMap m_queries;
bool m_reconnecting;
bool m_prepareError;
private:
LockedWaitQueue< boost::shared_ptr< Operation > >* m_queue;
boost::shared_ptr< DbWorker > m_worker;
boost::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;
};
}
}

View file

@ -11,12 +11,12 @@ Core::Db::DbLoader::DbLoader()
{
}
template <class T>
template< class T >
Core::Db::DbLoader& Core::Db::DbLoader::addDb( Core::Db::DbWorkerPool< T >& pool, const ConnectionInfo& info )
{
m_open.push([this, info, &pool]() -> bool
{
m_open.push( [ this, info, &pool ]()->bool
{
auto pLog = g_fw.get< Logger >();
const uint8_t asyncThreads = info.asyncThreads;
@ -24,89 +24,91 @@ Core::Db::DbLoader& Core::Db::DbLoader::addDb( Core::Db::DbWorkerPool< T >& pool
if( asyncThreads < 1 || asyncThreads > 32 )
{
pLog->error( "database: invalid number of worker threads specified. Please pick a value between 1 and 32." );
return false;
pLog->error(
"database: invalid number of worker threads specified. Please pick a value between 1 and 32." );
return false;
}
pool.setConnectionInfo( info, asyncThreads, synchThreads );
if( uint32_t error = pool.open() )
{
// Database does not exist
if( error == ER_BAD_DB_ERROR )
{
return false;
}
// Database does not exist
if( error == ER_BAD_DB_ERROR )
{
return false;
}
if( error )
{
pLog->error( "DatabasePool failed to open." );
return false;
}
if( error )
{
pLog->error( "DatabasePool failed to open." );
return false;
}
}
m_close.push( [&pool] { pool.close(); } );
m_close.push( [ &pool ]
{ pool.close(); } );
return true;
});
} );
m_prepare.push([this, info, &pool]() -> bool
{
m_prepare.push( [ this, info, &pool ]()->bool
{
if( !pool.prepareStatements() )
{
auto pLog = g_fw.get< Logger >();
pLog->error( "Could not prepare statements of the database, see log for details." );
return false;
auto pLog = g_fw.get< Logger >();
pLog->error( "Could not prepare statements of the database, see log for details." );
return false;
}
return true;
});
} );
return *this;
return *this;
}
bool Core::Db::DbLoader::initDbs()
{
if( !openDatabases() )
return false;
if( !openDatabases() )
return false;
if( !prepareStatements() )
return false;
if( !prepareStatements() )
return false;
return true;
return true;
}
bool Core::Db::DbLoader::openDatabases()
{
return process( m_open );
return process( m_open );
}
bool Core::Db::DbLoader::prepareStatements()
{
return process( m_prepare );
return process( m_prepare );
}
bool Core::Db::DbLoader::process( std::queue< Predicate >& queue )
{
while( !queue.empty() )
{
if( !queue.front()() )
while( !queue.empty() )
{
if( !queue.front()() )
{
// Close all open databases which have a registered close operation
while( !m_close.empty() )
{
// Close all open databases which have a registered close operation
while( !m_close.empty() )
{
m_close.top()();
m_close.pop();
}
return false;
m_close.top()();
m_close.pop();
}
queue.pop();
}
return true;
return false;
}
queue.pop();
}
return true;
}
template
Core::Db::DbLoader&
Core::Db::DbLoader::addDb< Core::Db::CharaDbConnection >( Core::Db::DbWorkerPool< Core::Db::CharaDbConnection >&,
const ConnectionInfo& );
Core::Db::DbLoader::addDb< Core::Db::CharaDbConnection >( Core::Db::DbWorkerPool< Core::Db::CharaDbConnection >&,
const ConnectionInfo& );

View file

@ -8,44 +8,43 @@
#include <string>
#include "DbConnection.h"
namespace Core
namespace Core {
namespace Db {
template< class T >
class DbWorkerPool;
class DbLoader
{
namespace Db
{
public:
DbLoader();
template< class T >
class DbWorkerPool;
template< class T >
DbLoader& addDb( DbWorkerPool< T >& pool, const ConnectionInfo& info );
class DbLoader
{
public:
DbLoader();
bool initDbs();
template< class T >
DbLoader& addDb( DbWorkerPool< T >& pool, const ConnectionInfo& info );
enum DbTypeFlags
{
DATABASE_NONE = 0,
DATABASE_CHARACTER = 1,
DATABASE_MASK_ALL = DATABASE_CHARACTER
};
bool initDbs();
private:
bool openDatabases();
enum DbTypeFlags
{
DATABASE_NONE = 0,
DATABASE_CHARACTER = 1,
DATABASE_MASK_ALL = DATABASE_CHARACTER
};
bool prepareStatements();
private:
bool openDatabases();
bool prepareStatements();
using Predicate = std::function< bool() >;
using Closer = std::function< void() >;
using Predicate = std::function< bool() >;
using Closer = std::function< void() >;
bool process( std::queue< Predicate >& queue );
bool process( std::queue< Predicate >& queue );
std::queue< Predicate > m_open;
std::queue< Predicate > m_prepare;
std::stack< Closer > m_close;
};
std::queue< Predicate > m_open;
std::queue< Predicate > m_prepare;
std::stack< Closer > m_close;
};
}
}

View file

@ -4,34 +4,34 @@
Core::Db::DbWorker::DbWorker( Core::LockedWaitQueue< boost::shared_ptr< Operation > >* newQueue, DbConnection* pConn )
{
m_pConn = pConn;
m_queue = newQueue;
m_cancelationToken = false;
m_workerThread = std::thread( &DbWorker::workerThread, this );
m_pConn = pConn;
m_queue = newQueue;
m_cancelationToken = false;
m_workerThread = std::thread( &DbWorker::workerThread, this );
}
Core::Db::DbWorker::~DbWorker()
{
m_cancelationToken = true;
m_queue->cancel();
m_workerThread.join();
m_cancelationToken = true;
m_queue->cancel();
m_workerThread.join();
}
void Core::Db::DbWorker::workerThread()
{
if( !m_queue )
if( !m_queue )
return;
while( true )
{
boost::shared_ptr< Operation > operation = nullptr;
m_queue->waitAndPop( operation );
if( m_cancelationToken || !operation )
return;
while( true )
{
boost::shared_ptr< Operation > operation = nullptr;
m_queue->waitAndPop( operation );
if( m_cancelationToken || !operation )
return;
operation->setConnection( m_pConn );
operation->call();
}
operation->setConnection( m_pConn );
operation->call();
}
}

View file

@ -6,34 +6,35 @@
#include "Util/LockedWaitQueue.h"
#include <boost/shared_ptr.hpp>
namespace Core
namespace Core {
namespace Db {
class DbConnection;
class Operation;
class DbWorker
{
namespace Db
{
class DbConnection;
class Operation;
public:
DbWorker( LockedWaitQueue< boost::shared_ptr< Operation > >* newQueue, DbConnection* connection );
class DbWorker
{
public:
DbWorker( LockedWaitQueue< boost::shared_ptr< Operation > >* newQueue, DbConnection* connection );
~DbWorker();
~DbWorker();
private:
LockedWaitQueue< boost::shared_ptr< Operation > >* m_queue;
DbConnection* m_pConn;
private:
LockedWaitQueue< boost::shared_ptr< Operation > >* m_queue;
DbConnection* m_pConn;
void workerThread();
std::thread m_workerThread;
void workerThread();
std::atomic< bool > m_cancelationToken;
std::thread m_workerThread;
DbWorker( DbWorker const& right ) = delete;
DbWorker& operator=( DbWorker const& right ) = delete;
};
std::atomic< bool > m_cancelationToken;
DbWorker( DbWorker const& right ) = delete;
DbWorker& operator=( DbWorker const& right ) = delete;
};
}
}
#endif //SAPPHIRE_DBWORKER_H

View file

@ -12,249 +12,255 @@
extern Core::Framework g_fw;
class PingOperation : public Core::Db::Operation
class PingOperation :
public Core::Db::Operation
{
bool execute() override
{
m_pConn->ping();
return true;
}
bool execute() override
{
m_pConn->ping();
return true;
}
};
template< class T >
Core::Db::DbWorkerPool<T>::DbWorkerPool()
: m_queue( new Core::LockedWaitQueue< boost::shared_ptr< Operation > >() ),
m_asyncThreads( 0 ),
m_synchThreads( 0 )
Core::Db::DbWorkerPool< T >::DbWorkerPool()
:
m_queue( new Core::LockedWaitQueue< boost::shared_ptr< Operation > >() ),
m_asyncThreads( 0 ),
m_synchThreads( 0 )
{
}
template< class T >
Core::Db::DbWorkerPool< T >::~DbWorkerPool()
{
m_queue->cancel();
m_queue->cancel();
}
template< class T >
void Core::Db::DbWorkerPool< T >::setConnectionInfo( const ConnectionInfo& info,
uint8_t asyncThreads,
uint8_t synchThreads)
uint8_t synchThreads )
{
m_connectionInfo = info;
m_asyncThreads = asyncThreads;
m_synchThreads = synchThreads;
m_connectionInfo = info;
m_asyncThreads = asyncThreads;
m_synchThreads = synchThreads;
}
template< class T >
uint32_t Core::Db::DbWorkerPool< T >::open()
{
auto pLog = g_fw.get< Logger >();
pLog->info( "[DbPool] Opening DatabasePool " + getDatabaseName() +
" Asynchronous connections: " + std::to_string( m_asyncThreads ) +
" Synchronous connections: " + std::to_string( m_synchThreads ) );
auto pLog = g_fw.get< Logger >();
pLog->info( "[DbPool] Opening DatabasePool " + getDatabaseName() +
" Asynchronous connections: " + std::to_string( m_asyncThreads ) +
" Synchronous connections: " + std::to_string( m_synchThreads ) );
uint32_t error = openConnections( IDX_ASYNC, m_asyncThreads );
uint32_t error = openConnections( IDX_ASYNC, m_asyncThreads );
if( error )
return error;
if( error )
return error;
error = openConnections( IDX_SYNCH, m_synchThreads );
error = openConnections( IDX_SYNCH, m_synchThreads );
if( !error )
{
pLog->info( "[DbPool] DatabasePool " + getDatabaseName() + " opened successfully. " +
std::to_string( ( m_connections[IDX_SYNCH].size() + m_connections[IDX_ASYNC].size() ) ) +
" total connections running." );
}
if( !error )
{
pLog->info( "[DbPool] DatabasePool " + getDatabaseName() + " opened successfully. " +
std::to_string( ( m_connections[ IDX_SYNCH ].size() + m_connections[ IDX_ASYNC ].size() ) ) +
" total connections running." );
}
return error;
return error;
}
template< class T >
void Core::Db::DbWorkerPool< T >::close()
{
auto pLog = g_fw.get< Logger >();
pLog->info("[DbPool] Closing down DatabasePool " + getDatabaseName() );
m_connections[IDX_ASYNC].clear();
m_connections[IDX_SYNCH].clear();
pLog->info("[DbPool] All connections on DatabasePool " + getDatabaseName() + "closed." );
auto pLog = g_fw.get< Logger >();
pLog->info( "[DbPool] Closing down DatabasePool " + getDatabaseName() );
m_connections[ IDX_ASYNC ].clear();
m_connections[ IDX_SYNCH ].clear();
pLog->info( "[DbPool] All connections on DatabasePool " + getDatabaseName() + "closed." );
}
template< class T >
bool Core::Db::DbWorkerPool<T>::prepareStatements()
bool Core::Db::DbWorkerPool< T >::prepareStatements()
{
for( auto& connections : m_connections )
for( auto& connection : connections )
for( auto& connections : m_connections )
for( auto& connection : connections )
{
connection->lockIfReady();
if( !connection->prepareStatements() )
{
connection->lockIfReady();
if( !connection->prepareStatements() )
{
connection->unlock();
close();
return false;
}
else
connection->unlock();
connection->unlock();
close();
return false;
}
else
connection->unlock();
}
return true;
return true;
}
template< class T >
boost::shared_ptr< Mysql::ResultSet > Core::Db::DbWorkerPool< T >::query( const std::string& sql, boost::shared_ptr< T > connection )
boost::shared_ptr< Mysql::ResultSet >
Core::Db::DbWorkerPool< T >::query( const std::string& sql, boost::shared_ptr< T > connection )
{
if( !connection )
connection = getFreeConnection();
if( !connection )
connection = getFreeConnection();
boost::shared_ptr< Mysql::ResultSet > result = connection->query( sql );
connection->unlock();
boost::shared_ptr< Mysql::ResultSet > result = connection->query( sql );
connection->unlock();
return result;
return result;
}
template< class T >
boost::shared_ptr< Mysql::PreparedResultSet > Core::Db::DbWorkerPool< T >::query( boost::shared_ptr< PreparedStatement > stmt )
boost::shared_ptr< Mysql::PreparedResultSet >
Core::Db::DbWorkerPool< T >::query( boost::shared_ptr< PreparedStatement > stmt )
{
auto connection = getFreeConnection();
auto ret = boost::static_pointer_cast< Mysql::PreparedResultSet >( connection->query( stmt ) );
connection->unlock();
auto connection = getFreeConnection();
auto ret = boost::static_pointer_cast< Mysql::PreparedResultSet >( connection->query( stmt ) );
connection->unlock();
return ret;
return ret;
}
template< class T >
boost::shared_ptr< Core::Db::PreparedStatement > Core::Db::DbWorkerPool< T >::getPreparedStatement( PreparedStatementIndex index )
boost::shared_ptr< Core::Db::PreparedStatement >
Core::Db::DbWorkerPool< T >::getPreparedStatement( PreparedStatementIndex index )
{
return boost::make_shared< PreparedStatement >( index );
return boost::make_shared< PreparedStatement >( index );
}
template< class T >
void Core::Db::DbWorkerPool< T >::escapeString( std::string& str )
{
if( str.empty() )
return;
if( str.empty() )
return;
char* buf = new char[str.size() * 2 + 1];
escapeString( buf, str.c_str(), str.size() );
str = buf;
delete[] buf;
char* buf = new char[str.size() * 2 + 1];
escapeString( buf, str.c_str(), str.size() );
str = buf;
delete[] buf;
}
template< class T >
void Core::Db::DbWorkerPool< T >::keepAlive()
{
for( auto& connection : m_connections[IDX_SYNCH] )
{
if( connection->lockIfReady() )
{
connection->ping();
connection->unlock();
}
}
for( auto& connection : m_connections[ IDX_SYNCH ] )
{
if( connection->lockIfReady() )
{
connection->ping();
connection->unlock();
}
}
const auto count = m_connections[IDX_ASYNC].size();
for( uint8_t i = 0; i < count; ++i )
enqueue( boost::make_shared< PingOperation >() );
const auto count = m_connections[ IDX_ASYNC ].size();
for( uint8_t i = 0; i < count; ++i )
enqueue( boost::make_shared< PingOperation >() );
}
template< class T >
uint32_t Core::Db::DbWorkerPool< T >::openConnections( InternalIndex type, uint8_t numConnections )
{
for( uint8_t i = 0; i < numConnections; ++i )
{
// Create the connection
auto connection = [&] {
switch (type)
{
case IDX_ASYNC:
return boost::make_shared< T >( m_queue.get(), m_connectionInfo );
case IDX_SYNCH:
return boost::make_shared< T >( m_connectionInfo );
default:
return boost::shared_ptr< T >( nullptr );
}
}();
if( uint32_t error = connection->open() )
for( uint8_t i = 0; i < numConnections; ++i )
{
// Create the connection
auto connection = [ & ]
{
switch( type )
{
// Failed to open a connection or invalid version, abort and cleanup
m_connections[type].clear();
return error;
case IDX_ASYNC:
return boost::make_shared< T >( m_queue.get(), m_connectionInfo );
case IDX_SYNCH:
return boost::make_shared< T >( m_connectionInfo );
default:
return boost::shared_ptr< T >( nullptr );
}
m_connections[type].push_back( connection );
}
}();
return 0;
if( uint32_t error = connection->open() )
{
// Failed to open a connection or invalid version, abort and cleanup
m_connections[ type ].clear();
return error;
}
m_connections[ type ].push_back( connection );
}
return 0;
}
template< class T >
unsigned long Core::Db::DbWorkerPool< T >::escapeString( char *to, const char *from, unsigned long length )
unsigned long Core::Db::DbWorkerPool< T >::escapeString( char* to, const char* from, unsigned long length )
{
if( !to || !from || !length )
return 0;
if( !to || !from || !length )
return 0;
return mysql_real_escape_string(
m_connections[IDX_SYNCH].front()->getConnection()->getRawCon(), to, from, length );
return mysql_real_escape_string(
m_connections[ IDX_SYNCH ].front()->getConnection()->getRawCon(), to, from, length );
}
template< class T >
void Core::Db::DbWorkerPool< T >::enqueue( boost::shared_ptr< Operation > op )
{
m_queue->push( op );
m_queue->push( op );
}
template< class T >
boost::shared_ptr< T > Core::Db::DbWorkerPool< T >::getFreeConnection()
{
uint8_t i = 0;
const auto numCons = m_connections[IDX_SYNCH].size();
boost::shared_ptr< T > connection = nullptr;
uint8_t i = 0;
const auto numCons = m_connections[ IDX_SYNCH ].size();
boost::shared_ptr< T > connection = nullptr;
while( true )
{
connection = m_connections[IDX_SYNCH][i++ % numCons];
while( true )
{
connection = m_connections[ IDX_SYNCH ][ i++ % numCons ];
if( connection->lockIfReady() )
break;
}
if( connection->lockIfReady() )
break;
}
return connection;
return connection;
}
template< class T >
const std::string& Core::Db::DbWorkerPool< T >::getDatabaseName() const
{
return m_connectionInfo.database;
return m_connectionInfo.database;
}
template< class T >
void Core::Db::DbWorkerPool< T >::execute( const std::string& sql )
{
auto task = boost::make_shared< StatementTask >( sql );
enqueue( task );
auto task = boost::make_shared< StatementTask >( sql );
enqueue( task );
}
template< class T >
void Core::Db::DbWorkerPool< T >::execute( boost::shared_ptr< PreparedStatement > stmt )
{
auto task = boost::make_shared< PreparedStatementTask >( stmt );
enqueue( task );
auto task = boost::make_shared< PreparedStatementTask >( stmt );
enqueue( task );
}
template< class T >
void Core::Db::DbWorkerPool< T >::directExecute( const std::string& sql )
{
auto connection = getFreeConnection();
connection->execute( sql );
connection->unlock();
auto connection = getFreeConnection();
connection->execute( sql );
connection->unlock();
}
template< class T >
void Core::Db::DbWorkerPool< T >::directExecute( boost::shared_ptr< PreparedStatement > stmt )
{
auto connection = getFreeConnection();
connection->execute( stmt );
connection->unlock();
auto connection = getFreeConnection();
connection->execute( stmt );
connection->unlock();
}
/*
@ -277,4 +283,5 @@ void DatabaseWorkerPool<T>::ExecuteOrAppend(SQLTransaction& trans, PreparedState
}
*/
template class Core::Db::DbWorkerPool< Core::Db::CharaDbConnection >;
template
class Core::Db::DbWorkerPool< Core::Db::CharaDbConnection >;

View file

@ -7,80 +7,87 @@
#include <ResultSet.h>
#include "Util/LockedWaitQueue.h"
#include "DbConnection.h"
namespace Core
{
namespace Db
{
namespace Core {
namespace Db {
template< typename T >
class LockedWaitQueue;
class Operation;
class PreparedStatement;
struct ConnectionInfo;
template< class T >
class DbWorkerPool
{
private:
enum InternalIndex
{
IDX_ASYNC,
IDX_SYNCH,
IDX_SIZE
};
enum InternalIndex
{
IDX_ASYNC,
IDX_SYNCH,
IDX_SIZE
};
public:
DbWorkerPool();
DbWorkerPool();
~DbWorkerPool();
~DbWorkerPool();
void setConnectionInfo( const ConnectionInfo& info, uint8_t asyncThreads, uint8_t synchThreads);
void setConnectionInfo( const ConnectionInfo& info, uint8_t asyncThreads, uint8_t synchThreads );
uint32_t open();
uint32_t open();
void close();
void close();
bool prepareStatements();
bool prepareStatements();
inline ConnectionInfo getConnectionInfo() const
{
return m_connectionInfo;
}
inline ConnectionInfo getConnectionInfo() const
{
return m_connectionInfo;
}
// Async execution
void execute( const std::string& sql );
void execute( boost::shared_ptr< PreparedStatement > stmt );
// Async execution
void execute( const std::string& sql );
// Sync execution
void directExecute( const std::string& sql );
void directExecute( boost::shared_ptr< PreparedStatement > stmt );
boost::shared_ptr< Mysql::ResultSet > query( const std::string& sql, boost::shared_ptr< T > connection = nullptr );
boost::shared_ptr< Mysql::PreparedResultSet > query( boost::shared_ptr< PreparedStatement > stmt );
void execute( boost::shared_ptr< PreparedStatement > stmt );
using PreparedStatementIndex = typename T::Statements;
// Sync execution
void directExecute( const std::string& sql );
boost::shared_ptr< PreparedStatement > getPreparedStatement( PreparedStatementIndex index );
void directExecute( boost::shared_ptr< PreparedStatement > stmt );
void escapeString( std::string& str );
boost::shared_ptr< Mysql::ResultSet >
query( const std::string& sql, boost::shared_ptr< T > connection = nullptr );
void keepAlive();
boost::shared_ptr< Mysql::PreparedResultSet > query( boost::shared_ptr< PreparedStatement > stmt );
using PreparedStatementIndex = typename T::Statements;
boost::shared_ptr< PreparedStatement > getPreparedStatement( PreparedStatementIndex index );
void escapeString( std::string& str );
void keepAlive();
private:
uint32_t openConnections( InternalIndex type, uint8_t numConnections );
uint32_t openConnections( InternalIndex type, uint8_t numConnections );
unsigned long escapeString( char *to, const char *from, unsigned long length );
unsigned long escapeString( char* to, const char* from, unsigned long length );
void enqueue( boost::shared_ptr< Operation > op );
void enqueue( boost::shared_ptr< Operation > op );
boost::shared_ptr< T > getFreeConnection();
boost::shared_ptr< T > getFreeConnection();
const std::string& getDatabaseName() const;
const std::string& getDatabaseName() const;
std::unique_ptr< Core::LockedWaitQueue< boost::shared_ptr< Operation > > > m_queue;
std::array< std::vector< boost::shared_ptr< T > >, IDX_SIZE > m_connections;
ConnectionInfo m_connectionInfo;
uint8_t m_asyncThreads;
uint8_t m_synchThreads;
std::unique_ptr< Core::LockedWaitQueue< boost::shared_ptr< Operation > > > m_queue;
std::array< std::vector< boost::shared_ptr< T > >, IDX_SIZE > m_connections;
ConnectionInfo m_connectionInfo;
uint8_t m_asyncThreads;
uint8_t m_synchThreads;
};
}

View file

@ -1,38 +1,48 @@
#ifndef SAPPHIRE_OPERATION_H
#define SAPPHIRE_OPERATION_H
namespace Mysql
{
class Connection;
namespace Mysql {
class Connection;
}
namespace Core
namespace Core {
namespace Db {
class DbConnection;
class PreparedStatement;
class Operation
{
namespace Db
{
class DbConnection;
class PreparedStatement;
public:
Operation() :
m_pConn( nullptr )
{
}
class Operation
{
public:
Operation() : m_pConn( nullptr ) { }
virtual ~Operation() { }
virtual ~Operation()
{
}
virtual int call()
{
execute();
return 0;
}
virtual bool execute() = 0;
virtual void setConnection( DbConnection* pCon ) { m_pConn = pCon; }
virtual int call()
{
execute();
return 0;
}
DbConnection* m_pConn;
virtual bool execute() = 0;
private:
Operation( Operation const& right ) = delete;
Operation& operator=( Operation const& right ) = delete;
};
virtual void setConnection( DbConnection* pCon )
{
m_pConn = pCon;
}
DbConnection* m_pConn;
private:
Operation( Operation const& right ) = delete;
Operation& operator=( Operation const& right ) = delete;
};
}

View file

@ -7,146 +7,150 @@
#include <sstream>
Core::Db::PreparedStatement::PreparedStatement( uint32_t index ) :
m_stmt( nullptr ),
m_index( index ) { }
m_stmt( nullptr ),
m_index( index )
{
}
Core::Db::PreparedStatement::~PreparedStatement() { }
Core::Db::PreparedStatement::~PreparedStatement()
{
}
void Core::Db::PreparedStatement::bindParameters()
{
assert( m_stmt );
assert( m_stmt );
uint8_t i = 1;
for( ; i < m_statementData.size(); i++ )
{
switch( m_statementData[i].type)
uint8_t i = 1;
for( ; i < m_statementData.size(); i++ )
{
switch( m_statementData[ i ].type )
{
case TYPE_BOOL:
m_stmt->setBoolean( i, m_statementData[ i ].data.boolean );
break;
case TYPE_UI:
m_stmt->setUInt( i, m_statementData[ i ].data.ui32 );
break;
case TYPE_I:
m_stmt->setInt( i, m_statementData[ i ].data.i32 );
break;
case TYPE_UI64:
m_stmt->setUInt64( i, m_statementData[ i ].data.ui64 );
break;
case TYPE_I64:
m_stmt->setInt64( i, m_statementData[ i ].data.i64 );
break;
case TYPE_DOUBLE:
m_stmt->setDouble( i, m_statementData[ i ].data.d );
break;
case TYPE_STRING:
m_stmt->setString( i, std::string( reinterpret_cast< char* >( m_statementData[ i ].binary.data() ) ) );
break;
case TYPE_BINARY:
{
case TYPE_BOOL:
m_stmt->setBoolean( i, m_statementData[i].data.boolean );
break;
case TYPE_UI:
m_stmt->setUInt( i, m_statementData[i].data.ui32 );
break;
case TYPE_I:
m_stmt->setInt( i, m_statementData[i].data.i32 );
break;
case TYPE_UI64:
m_stmt->setUInt64( i, m_statementData[i].data.ui64 );
break;
case TYPE_I64:
m_stmt->setInt64( i, m_statementData[i].data.i64 );
break;
case TYPE_DOUBLE:
m_stmt->setDouble( i, m_statementData[i].data.d );
break;
case TYPE_STRING:
m_stmt->setString( i, std::string( reinterpret_cast< char* >( m_statementData[i].binary.data() ) ) );
break;
case TYPE_BINARY:
{
std::stringstream *is = new std::stringstream;
std::stringstream* is = new std::stringstream;
for( auto entry : m_statementData[i].binary )
is->rdbuf()->sputc( static_cast< char > ( entry ) );
for( auto entry : m_statementData[ i ].binary )
is->rdbuf()->sputc( static_cast< char > ( entry ) );
m_stmt->setBlob( i, is );
}
break;
case TYPE_NULL:
m_stmt->setNull( i, 0 );
break;
m_stmt->setBlob( i, is );
}
}
break;
case TYPE_NULL:
m_stmt->setNull( i, 0 );
break;
}
}
}
//- Bind to buffer
void Core::Db::PreparedStatement::setBool( uint8_t index, const bool value )
{
if( index >= m_statementData.size() )
m_statementData.resize( index + 1 );
if( index >= m_statementData.size() )
m_statementData.resize( index + 1 );
m_statementData[index].data.boolean = value;
m_statementData[index].type = TYPE_BOOL;
m_statementData[ index ].data.boolean = value;
m_statementData[ index ].type = TYPE_BOOL;
}
void Core::Db::PreparedStatement::setUInt( uint8_t index, uint32_t value )
{
if( index >= m_statementData.size() )
m_statementData.resize(index+1);
if( index >= m_statementData.size() )
m_statementData.resize( index + 1 );
m_statementData[index].data.ui32 = value;
m_statementData[index].type = TYPE_UI;
m_statementData[ index ].data.ui32 = value;
m_statementData[ index ].type = TYPE_UI;
}
void Core::Db::PreparedStatement::setUInt64( uint8_t index, uint64_t value )
{
if( index >= m_statementData.size() )
m_statementData.resize( index + 1 );
if( index >= m_statementData.size() )
m_statementData.resize( index + 1 );
m_statementData[index].data.ui64 = value;
m_statementData[index].type = TYPE_UI64;
m_statementData[ index ].data.ui64 = value;
m_statementData[ index ].type = TYPE_UI64;
}
void Core::Db::PreparedStatement::setInt( uint8_t index, int32_t value )
{
if( index >= m_statementData.size() )
m_statementData.resize( index + 1 );
if( index >= m_statementData.size() )
m_statementData.resize( index + 1 );
m_statementData[index].data.i32 = value;
m_statementData[index].type = TYPE_I;
m_statementData[ index ].data.i32 = value;
m_statementData[ index ].type = TYPE_I;
}
void Core::Db::PreparedStatement::setInt64( uint8_t index, int64_t value )
{
if( index >= m_statementData.size() )
m_statementData.resize( index + 1);
if( index >= m_statementData.size() )
m_statementData.resize( index + 1 );
m_statementData[index].data.i64 = value;
m_statementData[index].type = TYPE_I64;
m_statementData[ index ].data.i64 = value;
m_statementData[ index ].type = TYPE_I64;
}
void Core::Db::PreparedStatement::setDouble( uint8_t index, double value )
{
if( index >= m_statementData.size() )
m_statementData.resize( index + 1 );
if( index >= m_statementData.size() )
m_statementData.resize( index + 1 );
m_statementData[index].data.d = value;
m_statementData[index].type = TYPE_DOUBLE;
m_statementData[ index ].data.d = value;
m_statementData[ index ].type = TYPE_DOUBLE;
}
void Core::Db::PreparedStatement::setString( uint8_t index, const std::string& value )
{
if( index >= m_statementData.size() )
m_statementData.resize( index + 1 );
if( index >= m_statementData.size() )
m_statementData.resize( index + 1 );
m_statementData[index].binary.resize( value.length() + 1 );
memcpy( m_statementData[index].binary.data(), value.c_str(), value.length() + 1 );
m_statementData[index].type = TYPE_STRING;
m_statementData[ index ].binary.resize( value.length() + 1 );
memcpy( m_statementData[ index ].binary.data(), value.c_str(), value.length() + 1 );
m_statementData[ index ].type = TYPE_STRING;
}
void Core::Db::PreparedStatement::setBinary( uint8_t index, const std::vector< uint8_t >& value )
{
if( index >= m_statementData.size() )
m_statementData.resize( index + 1 );
if( index >= m_statementData.size() )
m_statementData.resize( index + 1 );
m_statementData[index].binary = value;
m_statementData[index].type = TYPE_BINARY;
m_statementData[ index ].binary = value;
m_statementData[ index ].type = TYPE_BINARY;
}
void Core::Db::PreparedStatement::setNull( uint8_t index )
{
if( index >= m_statementData.size() )
m_statementData.resize( index + 1 );
if( index >= m_statementData.size() )
m_statementData.resize( index + 1 );
m_statementData[index].type = TYPE_NULL;
m_statementData[ index ].type = TYPE_NULL;
}
uint32_t Core::Db::PreparedStatement::getIndex() const
{
return m_index;
return m_index;
}
void Core::Db::PreparedStatement::setMysqlPS( boost::shared_ptr< Mysql::PreparedStatement> pStmt )
void Core::Db::PreparedStatement::setMysqlPS( boost::shared_ptr< Mysql::PreparedStatement > pStmt )
{
m_stmt = pStmt;
m_stmt = pStmt;
}

View file

@ -1,84 +1,92 @@
#ifndef SAPPHIRE_PREPAREDSTATEMENT_H
#define SAPPHIRE_PREPAREDSTATEMENT_H
#include <stdint.h>
#include <vector>
#include <string>
#include <boost/shared_ptr.hpp>
#include "Operation.h"
namespace Mysql
{
class PreparedStatement;
namespace Mysql {
class PreparedStatement;
}
namespace Core
namespace Core {
namespace Db {
union PreparedStatementDataUnion
{
namespace Db
bool boolean;
uint32_t ui32;
int32_t i32;
uint64_t ui64;
int64_t i64;
double d;
};
enum PreparedStatementValueType
{
union PreparedStatementDataUnion
{
bool boolean;
uint32_t ui32;
int32_t i32;
uint64_t ui64;
int64_t i64;
double d;
};
TYPE_BOOL,
TYPE_UI,
TYPE_UI64,
TYPE_I,
TYPE_I64,
TYPE_DOUBLE,
TYPE_STRING,
TYPE_BINARY,
TYPE_NULL
};
enum PreparedStatementValueType
{
TYPE_BOOL,
TYPE_UI,
TYPE_UI64,
TYPE_I,
TYPE_I64,
TYPE_DOUBLE,
TYPE_STRING,
TYPE_BINARY,
TYPE_NULL
};
struct PreparedStatementData
{
PreparedStatementDataUnion data;
PreparedStatementValueType type;
std::vector< uint8_t > binary;
};
struct PreparedStatementData
{
PreparedStatementDataUnion data;
PreparedStatementValueType type;
std::vector< uint8_t > binary;
};
class PreparedStatement
{
public:
explicit PreparedStatement( uint32_t index );
class PreparedStatement
{
public:
explicit PreparedStatement( uint32_t index );
~PreparedStatement();
~PreparedStatement();
void setBool( uint8_t index, bool value );
void setUInt( uint8_t index, uint32_t value );
void setUInt64( uint8_t index, uint64_t value );
void setInt( uint8_t index, int32_t value );
void setInt64( uint8_t index, int64_t value );
void setDouble( uint8_t index, double value );
void setString( uint8_t index, const std::string& value );
void setBinary( uint8_t index, const std::vector< uint8_t >& value );
void setNull( uint8_t index );
void setBool( uint8_t index, bool value );
uint32_t getIndex() const;
void setMysqlPS( boost::shared_ptr< Mysql::PreparedStatement > pStmt );
void setUInt( uint8_t index, uint32_t value );
void bindParameters();
void setUInt64( uint8_t index, uint64_t value );
protected:
boost::shared_ptr< Mysql::PreparedStatement > m_stmt;
uint32_t m_index;
std::vector< PreparedStatementData > m_statementData;
void setInt( uint8_t index, int32_t value );
PreparedStatement( PreparedStatement const& right ) = delete;
PreparedStatement& operator=( PreparedStatement const& right ) = delete;
};
void setInt64( uint8_t index, int64_t value );
void setDouble( uint8_t index, double value );
void setString( uint8_t index, const std::string& value );
void setBinary( uint8_t index, const std::vector< uint8_t >& value );
void setNull( uint8_t index );
uint32_t getIndex() const;
void setMysqlPS( boost::shared_ptr< Mysql::PreparedStatement > pStmt );
void bindParameters();
protected:
boost::shared_ptr< Mysql::PreparedStatement > m_stmt;
uint32_t m_index;
std::vector< PreparedStatementData > m_statementData;
PreparedStatement( PreparedStatement const& right ) = delete;
PreparedStatement& operator=( PreparedStatement const& right ) = delete;
};
}
}
#endif //SAPPHIRE_PREPAREDSTATEMENT_H

View file

@ -4,68 +4,68 @@
#include "DbConnection.h"
#include "PreparedStatement.h"
Core::Db::StatementTask::StatementTask( const std::string &sql, bool async )
Core::Db::StatementTask::StatementTask( const std::string& sql, bool async )
{
m_sql = sql;
m_hasResult = async; // If the operation is async, then there's a result
//if (async)
// m_result = new QueryResultPromise();
m_sql = sql;
m_hasResult = async; // If the operation is async, then there's a result
//if (async)
// m_result = new QueryResultPromise();
}
Core::Db::StatementTask::~StatementTask()
{
//if( m_hasResult && m_result != nullptr)
// delete m_result;
//if( m_hasResult && m_result != nullptr)
// delete m_result;
}
bool Core::Db::StatementTask::execute()
{
if( m_hasResult )
{
/*ResultSet* result = m_conn->Query(m_sql);
if (!result || !result->GetRowCount() || !result->NextRow())
{
delete result;
m_result->set_value(QueryResult(NULL));
return false;
}
if( m_hasResult )
{
/*ResultSet* result = m_conn->Query(m_sql);
if (!result || !result->GetRowCount() || !result->NextRow())
{
delete result;
m_result->set_value(QueryResult(NULL));
return false;
}
m_result->set_value(QueryResult(result));
return true;*/
}
m_result->set_value(QueryResult(result));
return true;*/
}
return m_pConn->execute( m_sql );
return m_pConn->execute( m_sql );
}
Core::Db::PreparedStatementTask::PreparedStatementTask( boost::shared_ptr< Core::Db::PreparedStatement > stmt, bool async ) :
m_stmt(stmt)
//, m_result(nullptr)
Core::Db::PreparedStatementTask::PreparedStatementTask( boost::shared_ptr< Core::Db::PreparedStatement > stmt,
bool async ) :
m_stmt( stmt )
//, m_result(nullptr)
{
m_hasResult = async; // If the operation is async, then there's a result
m_hasResult = async; // If the operation is async, then there's a result
}
Core::Db::PreparedStatementTask::~PreparedStatementTask()
{
//if (m_has_result && m_result != nullptr)
// delete m_result;
//if (m_has_result && m_result != nullptr)
// delete m_result;
}
bool Core::Db::PreparedStatementTask::execute()
{
//if (m_has_result)
//{
// PreparedResultSet* result = m_conn->Query(m_stmt);
// if (!result || !result->GetRowCount())
// {
// delete result;
// m_result->set_value(PreparedQueryResult(NULL));
// return false;
// }
// m_result->set_value(PreparedQueryResult(result));
// return true;
//}
//if (m_has_result)
//{
// PreparedResultSet* result = m_conn->Query(m_stmt);
// if (!result || !result->GetRowCount())
// {
// delete result;
// m_result->set_value(PreparedQueryResult(NULL));
// return false;
// }
// m_result->set_value(PreparedQueryResult(result));
// return true;
//}
return m_pConn->execute( m_stmt );
return m_pConn->execute( m_stmt );
}

View file

@ -5,47 +5,48 @@
#include <boost/shared_ptr.hpp>
#include "Operation.h"
namespace Core
namespace Core {
namespace Db {
class PreparedStatement;
class StatementTask :
public Operation
{
namespace Db
{
class PreparedStatement;
public:
class StatementTask : public Operation
{
public:
StatementTask( const std::string& sql, bool async = false );
StatementTask( const std::string& sql, bool async = false );
~StatementTask();
~StatementTask();
bool execute() override;
bool execute() override;
// QueryResultFuture getFuture() const
// {
// return m_result->get_future();
// }
// QueryResultFuture getFuture() const
// {
// return m_result->get_future();
// }
private:
std::string m_sql;
bool m_hasResult;
private:
std::string m_sql;
bool m_hasResult;
// QueryResultPromise *m_result;
};
};
class PreparedStatementTask : public Operation
{
public:
PreparedStatementTask( boost::shared_ptr< PreparedStatement > stmt, bool async = false);
~PreparedStatementTask();
class PreparedStatementTask :
public Operation
{
public:
PreparedStatementTask( boost::shared_ptr< PreparedStatement > stmt, bool async = false );
bool execute() override;
//PreparedQueryResultFuture getFuture() { return m_result->get_future(); }
~PreparedStatementTask();
protected:
boost::shared_ptr< PreparedStatement > m_stmt;
bool m_hasResult;
//PreparedQueryResultPromise* m_result;
};
bool execute() override;
//PreparedQueryResultFuture getFuture() { return m_result->get_future(); }
protected:
boost::shared_ptr< PreparedStatement > m_stmt;
bool m_hasResult;
//PreparedQueryResultPromise* m_result;
};
}
}

File diff suppressed because it is too large Load diff

View file

@ -22,334 +22,350 @@ case DataType::uint64: 9
namespace Core {
namespace Data {
namespace Data {
struct ZoneInfo
{
uint16_t id;
std::string zone_str;
std::string zone_name;
uint32_t layout_id;
uint16_t map_id;
int16_t discovery_index;
bool is_two_byte;
uint16_t weather_rate;
std::map< uint8_t, int32_t> weather_rate_map;
struct ZoneInfo
{
uint16_t id;
std::string zone_str;
std::string zone_name;
uint32_t layout_id;
uint16_t map_id;
int16_t discovery_index;
bool is_two_byte;
uint16_t weather_rate;
std::map< uint8_t, int32_t > weather_rate_map;
int32_t aetheryte_index;
uint8_t zone_type;
};
int32_t aetheryte_index;
uint8_t zone_type;
};
struct ClassJobInfo
{
uint8_t id;
std::string name;
std::string name_short;
uint8_t exp_idx;
uint32_t start_weapon_id;
uint16_t mod_hp;
uint16_t mod_mpcpgp;
uint16_t mod_str;
uint16_t mod_vit;
uint16_t mod_dex;
uint16_t mod_int;
uint16_t mod_mnd;
uint16_t mod_pie;
};
struct ClassJobInfo
{
uint8_t id;
std::string name;
std::string name_short;
uint8_t exp_idx;
uint32_t start_weapon_id;
uint16_t mod_hp;
uint16_t mod_mpcpgp;
uint16_t mod_str;
uint16_t mod_vit;
uint16_t mod_dex;
uint16_t mod_int;
uint16_t mod_mnd;
uint16_t mod_pie;
};
struct QuestInfo
{
uint32_t id;
std::string name;
std::string name_intern;
uint16_t quest_level;
uint32_t enpc_resident_start;
uint32_t enpc_resident_end;
uint16_t reward_exp_factor;
uint32_t reward_gil;
uint16_t reward_gc_seals;
uint8_t reward_item_type;
struct QuestInfo
{
uint32_t id;
std::string name;
std::string name_intern;
uint16_t quest_level;
uint32_t enpc_resident_start;
uint32_t enpc_resident_end;
uint16_t reward_exp_factor;
uint32_t reward_gil;
uint16_t reward_gc_seals;
uint8_t reward_item_type;
std::vector< uint32_t > reward_item;
std::vector< uint8_t > reward_item_count;
std::vector< uint8_t > reward_item_stain;
std::vector< uint32_t > reward_item;
std::vector< uint8_t > reward_item_count;
std::vector< uint8_t > reward_item_stain;
std::vector< uint32_t > reward_item_optional;
std::vector< uint8_t > reward_item_optional_count;
std::vector< uint8_t > reward_item_optional_stain;
std::vector< uint32_t > reward_item_optional;
std::vector< uint8_t > reward_item_optional_count;
std::vector< uint8_t > reward_item_optional_stain;
uint8_t reward_emote;
uint16_t reward_action;
uint8_t reward_action_general1;
uint8_t reward_action_general2;
uint8_t reward_emote;
uint16_t reward_action;
uint8_t reward_action_general1;
uint8_t reward_action_general2;
uint8_t reward_other;
uint8_t reward_other;
uint32_t instanced_content_unlock;
uint32_t instanced_content_unlock;
uint8_t reward_tome_type;
uint8_t reward_tome_count;
uint8_t reward_tome_type;
uint8_t reward_tome_count;
uint8_t reward_reputation;
uint8_t reward_reputation;
std::vector< std::string > script_entity;
std::vector< uint32_t > script_value;
};
std::vector< std::string > script_entity;
std::vector< uint32_t > script_value;
};
struct EventActionInfo
{
uint32_t id;
std::string name;
uint32_t castTime;
};
struct EventActionInfo
{
uint32_t id;
std::string name;
uint32_t castTime;
};
struct OpeningInfo
{
uint32_t id;
std::string name;
};
struct OpeningInfo
{
uint32_t id;
std::string name;
};
struct ParamGrowthInfo
{
uint32_t level;
uint32_t needed_exp;
int16_t hp_mod;
int32_t mp_const;
int16_t mp_mod;
int32_t base_secondary;
uint16_t quest_exp_mod;
};
struct ParamGrowthInfo
{
uint32_t level;
uint32_t needed_exp;
int16_t hp_mod;
int32_t mp_const;
int16_t mp_mod;
int32_t base_secondary;
uint16_t quest_exp_mod;
};
struct CustomTalkInfo
{
uint32_t id;
std::string name_intern;
};
struct CustomTalkInfo
{
uint32_t id;
std::string name_intern;
};
struct PlaceNameInfo
{
uint32_t id;
std::string placename;
};
struct PlaceNameInfo
{
uint32_t id;
std::string placename;
};
struct AetheryteInfo
{
uint32_t id;
std::string placename;
std::string placename_aethernet;
int32_t target_zone;
int32_t levelId;
bool isAetheryte;
struct AetheryteInfo
{
uint32_t id;
std::string placename;
std::string placename_aethernet;
int32_t target_zone;
int32_t levelId;
bool isAetheryte;
int16_t map_coord_x;
int16_t map_coord_y;
};
int16_t map_coord_x;
int16_t map_coord_y;
};
struct RaceInfo
{
uint32_t id;
std::string name;
uint32_t male_body;
uint32_t male_hands;
uint32_t male_legs;
uint32_t male_feet;
uint32_t female_body;
uint32_t female_hands;
uint32_t female_legs;
uint32_t female_feet;
struct RaceInfo
{
uint32_t id;
std::string name;
uint32_t male_body;
uint32_t male_hands;
uint32_t male_legs;
uint32_t male_feet;
uint32_t female_body;
uint32_t female_hands;
uint32_t female_legs;
uint32_t female_feet;
int8_t mod_str;
int8_t mod_dex;
int8_t mod_vit;
int8_t mod_int;
int8_t mod_mnd;
int8_t mod_pie;
};
int8_t mod_str;
int8_t mod_dex;
int8_t mod_vit;
int8_t mod_int;
int8_t mod_mnd;
int8_t mod_pie;
};
struct TribeInfo
{
uint32_t id;
std::string name;
struct TribeInfo
{
uint32_t id;
std::string name;
int8_t mod_str;
int8_t mod_dex;
int8_t mod_vit;
int8_t mod_int;
int8_t mod_mnd;
int8_t mod_pie;
};
int8_t mod_str;
int8_t mod_dex;
int8_t mod_vit;
int8_t mod_int;
int8_t mod_mnd;
int8_t mod_pie;
};
struct LevelInfo
{
uint32_t id;
float x;
float y;
float z;
float r;
uint32_t actor_id;
uint32_t zone_id;
};
struct LevelInfo
{
uint32_t id;
float x;
float y;
float z;
float r;
uint32_t actor_id;
uint32_t zone_id;
};
struct ClassJobCategoryInfo
{
uint32_t id;
// should they add new jobs, this needs to be changed
bool can_equip[0x33];
};
struct ClassJobCategoryInfo
{
uint32_t id;
// should they add new jobs, this needs to be changed
bool can_equip[0x33];
};
struct ItemInfo
{
uint32_t id;
std::string name; //0
uint16_t item_level; //11
uint8_t required_level; //12
uint16_t unknown_category; //15
uint16_t ui_category; //17
uint32_t stack_size; //19
bool is_hqable; //20
uint64_t model_primary; //28
uint64_t model_secondary; //29
uint16_t physical_damage; //49
uint16_t magical_damage; //50
uint16_t delayMs; //51
uint32_t class_job_requirement; //58
bool is_unique; //72
bool is_untradeable; //73
uint32_t class_job_index; //86
};
struct ItemInfo
{
uint32_t id;
std::string name; //0
uint16_t item_level; //11
uint8_t required_level; //12
uint16_t unknown_category; //15
uint16_t ui_category; //17
uint32_t stack_size; //19
bool is_hqable; //20
uint64_t model_primary; //28
uint64_t model_secondary; //29
uint16_t physical_damage; //49
uint16_t magical_damage; //50
uint16_t delayMs; //51
uint32_t class_job_requirement; //58
bool is_unique; //72
bool is_untradeable; //73
uint32_t class_job_index; //86
};
struct ActionInfo
{
uint32_t id;
std::string name; // 0
uint16_t category; // 3
struct ActionInfo
{
uint32_t id;
std::string name; // 0
uint16_t category; // 3
int8_t class_job; // 10
uint8_t unlock_level; // 11
int8_t range; // 13
bool can_target_self; // 14
bool can_target_party; // 15
bool can_target_friendly; // 16
bool can_target_enemy; // 17
int8_t class_job; // 10
uint8_t unlock_level; // 11
int8_t range; // 13
bool can_target_self; // 14
bool can_target_party; // 15
bool can_target_friendly; // 16
bool can_target_enemy; // 17
bool is_ground_aoe; // 20
bool is_ground_aoe; // 20
bool can_target_ko; // 24
bool can_target_ko; // 24
uint8_t aoe_type; // 26
uint8_t aoe_range; // 27
uint8_t aoe_width; // 28
uint8_t aoe_type; // 26
uint8_t aoe_range; // 27
uint8_t aoe_width; // 28
uint8_t points_type; // 30
uint16_t points_cost; // 31
uint8_t points_type; // 30
uint16_t points_cost; // 31
bool is_instant; // 35
uint32_t cast_time; // 36
uint32_t recast_time; // 37
bool is_instant; // 35
uint32_t cast_time; // 36
uint32_t recast_time; // 37
int8_t model; // 39
uint8_t aspect; // 40
int8_t model; // 39
uint8_t aspect; // 40
uint16_t toggle_status_id; // 42
uint16_t toggle_status_id; // 42
bool affects_position; // 47
bool affects_position; // 47
bool no_effect_in_battle; // 60
bool no_effect_in_battle; // 60
bool is_aoe; // Internal only
bool is_aoe; // Internal only
};
};
struct EventItemInfo
{
uint32_t id;
std::string name; //0
uint32_t eventId;
uint32_t castTime;
};
struct EventItemInfo
{
uint32_t id;
std::string name; //0
uint32_t eventId;
uint32_t castTime;
};
struct StatusEffectInfo
{
uint32_t id;
std::string name; // 0
bool lock_movement; // 7
bool lock_actions; // 9
bool lock_control; // 10
bool transfiguration; // 11
bool can_dispel; // 13
bool is_permanent; // 15
bool inflicted_by_actor; // 17
bool is_fc_buff; // 21
bool invisibility; // 22
};
struct StatusEffectInfo
{
uint32_t id;
std::string name; // 0
bool lock_movement; // 7
bool lock_actions; // 9
bool lock_control; // 10
bool transfiguration; // 11
bool can_dispel; // 13
bool is_permanent; // 15
bool inflicted_by_actor; // 17
bool is_fc_buff; // 21
bool invisibility; // 22
};
class ExdData
{
public:
ExdData();
~ExdData(void);
class ExdData
{
public:
ExdData();
bool init( const std::string& path );
~ExdData( void );
xiv::exd::Exd setupDatAccess( const std::string& name, xiv::exd::Language lang );
bool init( const std::string& path );
template< class T >
T getField( std::vector< xiv::exd::Field >& fields, uint32_t index )
{
return *boost::get< T >( &fields.at( index ) );
}
xiv::exd::Exd setupDatAccess( const std::string& name, xiv::exd::Language lang );
boost::shared_ptr<xiv::dat::GameData> m_data;
boost::shared_ptr<xiv::exd::ExdData> m_exd_data;
template< class T >
T getField( std::vector< xiv::exd::Field >& fields, uint32_t index )
{
return *boost::get< T >( &fields.at( index ) );
}
xiv::exd::Exd m_questDat;
xiv::exd::Exd m_openingDat;
xiv::exd::Exd m_customTalkDat;
xiv::exd::Exd m_aetheryteDat;
xiv::exd::Exd m_levelDat;
xiv::exd::Exd m_placeNameDat;
xiv::exd::Exd m_itemsDat;
xiv::exd::Exd m_classJobCatDat;
xiv::exd::Exd m_raceDat;
xiv::exd::Exd m_eventItemDat;
boost::shared_ptr< xiv::dat::GameData > m_data;
boost::shared_ptr< xiv::exd::ExdData > m_exd_data;
std::map<uint32_t, ZoneInfo> m_zoneInfoMap;
std::map<uint8_t, ClassJobInfo> m_classJobInfoMap;
std::map<uint32_t, ParamGrowthInfo> m_paramGrowthInfoMap;
std::map<uint16_t, EventActionInfo> m_EventActionInfoMap;
std::map<uint16_t, boost::shared_ptr< ActionInfo > > m_actionInfoMap;
std::map<uint16_t, StatusEffectInfo> m_statusEffectInfoMap;
std::map<uint32_t, boost::shared_ptr< AetheryteInfo > > m_aetheryteInfoMap;
std::map<uint32_t, TribeInfo > m_tribeInfoMap;
xiv::exd::Exd m_questDat;
xiv::exd::Exd m_openingDat;
xiv::exd::Exd m_customTalkDat;
xiv::exd::Exd m_aetheryteDat;
xiv::exd::Exd m_levelDat;
xiv::exd::Exd m_placeNameDat;
xiv::exd::Exd m_itemsDat;
xiv::exd::Exd m_classJobCatDat;
xiv::exd::Exd m_raceDat;
xiv::exd::Exd m_eventItemDat;
bool loadZoneInfo();
bool loadClassJobInfo();
bool loadParamGrowInfo();
bool loadEventActionInfo();
bool loadActionInfo();
bool loadStatusEffectInfo();
bool loadAetheryteInfo();
bool loadTribeInfo();
std::map< uint32_t, ZoneInfo > m_zoneInfoMap;
std::map< uint8_t, ClassJobInfo > m_classJobInfoMap;
std::map< uint32_t, ParamGrowthInfo > m_paramGrowthInfoMap;
std::map< uint16_t, EventActionInfo > m_EventActionInfoMap;
std::map< uint16_t, boost::shared_ptr< ActionInfo > > m_actionInfoMap;
std::map< uint16_t, StatusEffectInfo > m_statusEffectInfoMap;
std::map< uint32_t, boost::shared_ptr< AetheryteInfo > > m_aetheryteInfoMap;
std::map< uint32_t, TribeInfo > m_tribeInfoMap;
boost::shared_ptr< QuestInfo > getQuestInfo( uint32_t questId );
boost::shared_ptr< OpeningInfo > getOpeningInfo( uint32_t openingId );
boost::shared_ptr< CustomTalkInfo > getCustomTalkInfo( uint32_t customTalkId );
boost::shared_ptr< AetheryteInfo > getAetheryteInfo( uint32_t aetheryteId );
boost::shared_ptr< ActionInfo > getActionInfo( uint32_t actionId );
boost::shared_ptr< PlaceNameInfo > getPlaceNameInfo( uint32_t placeNameId );
boost::shared_ptr< ItemInfo > getItemInfo( uint32_t catalogId );
boost::shared_ptr< RaceInfo > getRaceInfo( uint32_t raceId );
boost::shared_ptr< EventItemInfo > getEventItemInfo( uint32_t eventItemId );
boost::shared_ptr< LevelInfo > getLevelInfo( uint32_t levelId );
bool loadZoneInfo();
const std::vector< boost::shared_ptr< AetheryteInfo > > getAetheryteInfoForZone( uint16_t zoneId );
bool loadClassJobInfo();
};
bool loadParamGrowInfo();
}
bool loadEventActionInfo();
bool loadActionInfo();
bool loadStatusEffectInfo();
bool loadAetheryteInfo();
bool loadTribeInfo();
boost::shared_ptr< QuestInfo > getQuestInfo( uint32_t questId );
boost::shared_ptr< OpeningInfo > getOpeningInfo( uint32_t openingId );
boost::shared_ptr< CustomTalkInfo > getCustomTalkInfo( uint32_t customTalkId );
boost::shared_ptr< AetheryteInfo > getAetheryteInfo( uint32_t aetheryteId );
boost::shared_ptr< ActionInfo > getActionInfo( uint32_t actionId );
boost::shared_ptr< PlaceNameInfo > getPlaceNameInfo( uint32_t placeNameId );
boost::shared_ptr< ItemInfo > getItemInfo( uint32_t catalogId );
boost::shared_ptr< RaceInfo > getRaceInfo( uint32_t raceId );
boost::shared_ptr< EventItemInfo > getEventItemInfo( uint32_t eventItemId );
boost::shared_ptr< LevelInfo > getLevelInfo( uint32_t levelId );
const std::vector< boost::shared_ptr< AetheryteInfo > > getAetheryteInfoForZone( uint16_t zoneId );
};
}
}
#endif

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -3,35 +3,34 @@
#include <boost/shared_ptr.hpp>
namespace Core
{
namespace Core {
class ConfigMgr;
class ConfigMgr;
typedef boost::shared_ptr< ConfigMgr > ConfigMgrPtr;
typedef boost::shared_ptr< ConfigMgr > ConfigMgrPtr;
namespace Network
{
class Hive;
class Acceptor;
class Connection;
namespace Network {
class Hive;
typedef boost::shared_ptr< Hive > HivePtr;
typedef boost::shared_ptr< Acceptor > AcceptorPtr;
typedef boost::shared_ptr< Connection > ConnectionPtr;
class Acceptor;
namespace Packets
{
class GamePacket;
class FFXIVPacketBase;
class Connection;
typedef boost::shared_ptr< GamePacket > GamePacketPtr;
typedef boost::shared_ptr< FFXIVPacketBase > FFXIVPacketBasePtr;
}
typedef boost::shared_ptr< Hive > HivePtr;
typedef boost::shared_ptr< Acceptor > AcceptorPtr;
typedef boost::shared_ptr< Connection > ConnectionPtr;
}
namespace Packets {
class GamePacket;
class FFXIVPacketBase;
typedef boost::shared_ptr< GamePacket > GamePacketPtr;
typedef boost::shared_ptr< FFXIVPacketBase > FFXIVPacketBasePtr;
}
}
}

View file

@ -7,30 +7,29 @@
#include <boost/shared_ptr.hpp>
#include <cassert>
namespace Core
namespace Core {
class Framework
{
using TypenameToObject = std::map< std::type_index, boost::shared_ptr< void > >;
TypenameToObject ObjectMap;
class Framework
{
using TypenameToObject = std::map< std::type_index, boost::shared_ptr< void > >;
TypenameToObject ObjectMap;
public:
template< typename T >
boost::shared_ptr< T > get()
{
auto iType = ObjectMap.find( typeid( T ) );
assert( !( iType == ObjectMap.end() ) );
return boost::static_pointer_cast< T >( iType->second );
}
public:
template< typename T >
boost::shared_ptr< T > get()
{
auto iType = ObjectMap.find( typeid( T ) );
assert( !( iType == ObjectMap.end() ) );
return boost::static_pointer_cast< T >( iType->second );
}
template< typename T >
void set( boost::shared_ptr< T > value )
{
assert( value ); // why would anyone store nullptrs....
ObjectMap[typeid( T )] = value;
}
};
template< typename T >
void set( boost::shared_ptr< T > value )
{
assert( value ); // why would anyone store nullptrs....
ObjectMap[ typeid( T ) ] = value;
}
};
}

View file

@ -17,72 +17,75 @@
namespace Core {
Logger::Logger()
{
Logger::Logger()
{
}
}
Logger::~Logger()
{
Logger::~Logger()
{
}
}
void Logger::setLogPath(const std::string& logPath)
{
m_logFile = logPath;
}
void Logger::setLogPath( const std::string& logPath )
{
m_logFile = logPath;
}
void Logger::init()
{
void Logger::init()
{
auto format = (
boost::log::expressions::stream <<
boost::log::expressions::format_date_time< boost::posix_time::ptime >("TimeStamp", "[%H:%M:%S]") <<
"[" << boost::log::trivial::severity << "] " <<
boost::log::expressions::smessage
);
auto format = (
boost::log::expressions::stream <<
boost::log::expressions::format_date_time< boost::posix_time::ptime >(
"TimeStamp", "[%H:%M:%S]" ) <<
"[" << boost::log::trivial::severity << "] " <<
boost::log::expressions::smessage
);
boost::log::add_file_log
(
boost::log::keywords::file_name = m_logFile + "%Y-%m-%d.log", /*< file name pattern >*/
boost::log::keywords::rotation_size = 10 * 1024 * 1024, /*< rotate files every 10 MiB... >*/
boost::log::keywords::time_based_rotation = boost::log::sinks::file::rotation_at_time_point(0, 0, 0), /*< ...or at midnight >*/
boost::log::keywords::open_mode = std::ios::app,
boost::log::keywords::format = format,
boost::log::keywords::auto_flush = true
);
boost::log::add_file_log
(
boost::log::keywords::file_name =
m_logFile + "%Y-%m-%d.log", /*< file name pattern >*/
boost::log::keywords::rotation_size =
10 * 1024 * 1024, /*< rotate files every 10 MiB... >*/
boost::log::keywords::time_based_rotation = boost::log::sinks::file::rotation_at_time_point( 0, 0,
0 ), /*< ...or at midnight >*/
boost::log::keywords::open_mode = std::ios::app,
boost::log::keywords::format = format,
boost::log::keywords::auto_flush = true
);
boost::log::add_console_log(std::cout, boost::log::keywords::format = format);
boost::log::add_console_log( std::cout, boost::log::keywords::format = format );
boost::log::add_common_attributes();
}
boost::log::add_common_attributes();
}
void Logger::Log(LoggingSeverity logSev, const std::string& text)
{
BOOST_LOG_SEV(m_lg, (boost::log::trivial::severity_level)logSev) << text;
}
void Logger::Log( LoggingSeverity logSev, const std::string& text )
{
BOOST_LOG_SEV( m_lg, ( boost::log::trivial::severity_level ) logSev ) << text;
}
void Logger::error( const std::string& text )
{
BOOST_LOG_SEV( m_lg, boost::log::trivial::severity_level::error ) << text;
}
void Logger::error( const std::string& text )
{
BOOST_LOG_SEV( m_lg, boost::log::trivial::severity_level::error ) << text;
}
void Logger::info( const std::string& text )
{
BOOST_LOG_SEV( m_lg, boost::log::trivial::severity_level::info ) << text;
}
void Logger::info( const std::string& text )
{
BOOST_LOG_SEV( m_lg, boost::log::trivial::severity_level::info ) << text;
}
void Logger::debug( const std::string& text )
{
BOOST_LOG_SEV( m_lg, boost::log::trivial::severity_level::debug ) << text;
}
void Logger::fatal( const std::string& text )
{
BOOST_LOG_SEV( m_lg, boost::log::trivial::severity_level::fatal ) << text;
}
void Logger::debug( const std::string& text )
{
BOOST_LOG_SEV( m_lg, boost::log::trivial::severity_level::debug ) << text;
}
void Logger::fatal( const std::string& text )
{
BOOST_LOG_SEV( m_lg, boost::log::trivial::severity_level::fatal ) << text;
}
}

View file

@ -6,46 +6,48 @@
namespace Core {
enum struct LoggingSeverity : uint8_t
{
trace = 0,
debug = 1,
info = 2,
warning = 3,
error = 4,
fatal = 5
};
enum struct LoggingSeverity :
uint8_t
{
trace = 0,
debug = 1,
info = 2,
warning = 3,
error = 4,
fatal = 5
};
class Logger
{
class Logger
{
private:
boost::log::sources::severity_logger_mt< boost::log::trivial::severity_level > m_lg;
private:
boost::log::sources::severity_logger_mt< boost::log::trivial::severity_level > m_lg;
std::string m_logFile;
std::string m_logFile;
public:
Logger();
public:
Logger();
~Logger();
~Logger();
void init();
void init();
void Log(LoggingSeverity logSev, const std::string& text);
void Log( LoggingSeverity logSev, const std::string& text );
void error( const std::string& text );
void info( const std::string& text );
void debug( const std::string& text );
void fatal( const std::string& text );
void error( const std::string& text );
void setLogPath(const std::string& logPath);
void info( const std::string& text );
};
void debug( const std::string& text );
void fatal( const std::string& text );
void setLogPath( const std::string& logPath );
};
}
#endif

View file

@ -4,127 +4,127 @@
#include <boost/interprocess/detail/atomic.hpp>
#include <boost/bind.hpp>
namespace Core
namespace Core {
namespace Network {
//-----------------------------------------------------------------------------
Acceptor::Acceptor( HivePtr hive )
:
m_hive( hive ),
m_acceptor( hive->GetService() ),
m_io_strand( hive->GetService() ),
m_error_state( 0 )
{
namespace Network
{
//-----------------------------------------------------------------------------
Acceptor::Acceptor( HivePtr hive )
: m_hive( hive ),
m_acceptor( hive->GetService() ),
m_io_strand( hive->GetService() ),
m_error_state( 0 )
{
}
Acceptor::~Acceptor()
{
}
bool Acceptor::OnAccept( ConnectionPtr connection, const std::string & host, uint16_t port )
{
return true;
}
void Acceptor::OnError( const boost::system::error_code & error )
{
}
void Acceptor::StartError( const boost::system::error_code & error )
{
if( boost::interprocess::ipcdetail::atomic_cas32( &m_error_state, 1, 0 ) == 0 )
{
boost::system::error_code ec;
m_acceptor.cancel( ec );
m_acceptor.close( ec );
OnError( error );
}
}
void Acceptor::DispatchAccept( ConnectionPtr connection )
{
m_acceptor.async_accept( connection->GetSocket(),
connection->GetStrand().wrap( boost::bind( &Acceptor::HandleAccept,
shared_from_this(),
_1,
connection ) ) );
}
void Acceptor::HandleAccept( const boost::system::error_code & error, ConnectionPtr connection )
{
if( error || HasError() || m_hive->HasStopped() )
{
connection->StartError( error );
}
else
{
if( connection->GetSocket().is_open() )
{
if( OnAccept( connection,
connection->GetSocket().remote_endpoint().address().to_string(),
connection->GetSocket().remote_endpoint().port() ) )
{
connection->OnAccept( m_acceptor.local_endpoint().address().to_string(), m_acceptor.local_endpoint().port() );
connection->Recv();
}
}
else
{
connection->StartError( error );
}
}
}
void Acceptor::Stop()
{
}
void Acceptor::Accept( ConnectionPtr connection )
{
m_io_strand.post( boost::bind( &Acceptor::DispatchAccept, shared_from_this(), connection ) );
}
void Acceptor::Listen( const std::string & host, const uint16_t & port )
{
try
{
boost::asio::ip::tcp::resolver resolver( m_hive->GetService() );
boost::asio::ip::tcp::resolver::query query( host, std::to_string( port ) );
boost::asio::ip::tcp::endpoint endpoint = *resolver.resolve( query );
m_acceptor.open( endpoint.protocol() );
m_acceptor.set_option( boost::asio::ip::tcp::acceptor::reuse_address( false ) );
m_acceptor.bind( endpoint );
m_acceptor.listen( boost::asio::socket_base::max_connections );
}
catch( ... )
{
// this should not happen
assert( true );
}
}
HivePtr Acceptor::GetHive()
{
return m_hive;
}
boost::asio::ip::tcp::acceptor & Acceptor::GetAcceptor()
{
return m_acceptor;
}
bool Acceptor::HasError()
{
return ( boost::interprocess::ipcdetail::atomic_cas32( &m_error_state, 1, 1 ) == 1 );
}
}
}
Acceptor::~Acceptor()
{
}
bool Acceptor::OnAccept( ConnectionPtr connection, const std::string& host, uint16_t port )
{
return true;
}
void Acceptor::OnError( const boost::system::error_code& error )
{
}
void Acceptor::StartError( const boost::system::error_code& error )
{
if( boost::interprocess::ipcdetail::atomic_cas32( &m_error_state, 1, 0 ) == 0 )
{
boost::system::error_code ec;
m_acceptor.cancel( ec );
m_acceptor.close( ec );
OnError( error );
}
}
void Acceptor::DispatchAccept( ConnectionPtr connection )
{
m_acceptor.async_accept( connection->GetSocket(),
connection->GetStrand().wrap( boost::bind( &Acceptor::HandleAccept,
shared_from_this(),
_1,
connection ) ) );
}
void Acceptor::HandleAccept( const boost::system::error_code& error, ConnectionPtr connection )
{
if( error || HasError() || m_hive->HasStopped() )
{
connection->StartError( error );
}
else
{
if( connection->GetSocket().is_open() )
{
if( OnAccept( connection,
connection->GetSocket().remote_endpoint().address().to_string(),
connection->GetSocket().remote_endpoint().port() ) )
{
connection->OnAccept( m_acceptor.local_endpoint().address().to_string(),
m_acceptor.local_endpoint().port() );
connection->Recv();
}
}
else
{
connection->StartError( error );
}
}
}
void Acceptor::Stop()
{
}
void Acceptor::Accept( ConnectionPtr connection )
{
m_io_strand.post( boost::bind( &Acceptor::DispatchAccept, shared_from_this(), connection ) );
}
void Acceptor::Listen( const std::string& host, const uint16_t& port )
{
try
{
boost::asio::ip::tcp::resolver resolver( m_hive->GetService() );
boost::asio::ip::tcp::resolver::query query( host, std::to_string( port ) );
boost::asio::ip::tcp::endpoint endpoint = *resolver.resolve( query );
m_acceptor.open( endpoint.protocol() );
m_acceptor.set_option( boost::asio::ip::tcp::acceptor::reuse_address( false ) );
m_acceptor.bind( endpoint );
m_acceptor.listen( boost::asio::socket_base::max_connections );
}
catch( ... )
{
// this should not happen
assert( true );
}
}
HivePtr Acceptor::GetHive()
{
return m_hive;
}
boost::asio::ip::tcp::acceptor& Acceptor::GetAcceptor()
{
return m_acceptor;
}
bool Acceptor::HasError()
{
return ( boost::interprocess::ipcdetail::atomic_cas32( &m_error_state, 1, 1 ) == 1 );
}
}
}

View file

@ -7,72 +7,76 @@
#include <boost/shared_ptr.hpp>
#include "Forwards.h"
namespace Core
namespace Core {
namespace Network {
class Connection;
class Acceptor :
public boost::enable_shared_from_this< Acceptor >
{
namespace Network
{
friend class Hive;
class Connection;
private:
HivePtr m_hive;
boost::asio::ip::tcp::acceptor m_acceptor;
boost::asio::strand m_io_strand;
volatile uint32_t m_error_state;
class Acceptor : public boost::enable_shared_from_this< Acceptor >
{
friend class Hive;
private:
Acceptor( const Acceptor& rhs );
private:
HivePtr m_hive;
boost::asio::ip::tcp::acceptor m_acceptor;
boost::asio::strand m_io_strand;
volatile uint32_t m_error_state;
Acceptor& operator=( const Acceptor& rhs );
private:
Acceptor( const Acceptor & rhs );
Acceptor & operator =( const Acceptor & rhs );
void StartError( const boost::system::error_code & error );
void DispatchAccept( ConnectionPtr connection );
void HandleAccept( const boost::system::error_code & error, ConnectionPtr connection );
void StartError( const boost::system::error_code& error );
private:
// 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 );
void DispatchAccept( ConnectionPtr connection );
// 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 boost::system::error_code & error );
void HandleAccept( const boost::system::error_code& error, ConnectionPtr connection );
public:
Acceptor( HivePtr hive );
virtual ~Acceptor();
private:
// 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 );
// Returns the Hive object.
HivePtr GetHive();
// 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 boost::system::error_code& error );
// Returns the acceptor object.
boost::asio::ip::tcp::acceptor & GetAcceptor();
public:
Acceptor( HivePtr hive );
// Returns the strand object.
boost::asio::strand & GetStrand();
virtual ~Acceptor();
// Returns true if this object has an error associated with it.
bool HasError();
// Returns the Hive object.
HivePtr GetHive();
public:
// Begin listening on the specific network interface.
void Listen( const std::string & host, const uint16_t & port );
// Returns the acceptor object.
boost::asio::ip::tcp::acceptor& GetAcceptor();
// 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 );
// Returns the strand object.
boost::asio::strand& GetStrand();
// Stop the Acceptor from listening.
void Stop();
};
// Returns true if this object has an error associated with it.
bool HasError();
}
public:
// 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

View file

@ -12,289 +12,290 @@
// They are also defined within the Core::Common namespace to avoid collisions.
// +---------------------------------------------------------------------------
namespace Core {
namespace Network {
namespace ActorControl {
namespace Network {
namespace ActorControl {
enum ActorControlType : uint16_t
{
/*! Toggles weapon status -> Sheathed/UnSheathed
\param param1 status 0|1 */
ToggleWeapon = 0x00,
/*! Toggles Autoattack status on/off
\param param1 status 0|1 */
AutoAttack = 0x01,
SetStatus = 0x02,
CastStart = 0x03,
ToggleAggro = 0x04,
ClassJobChange = 0x05,
DefeatMsg = 0x06,
GainExpMsg = 0x07,
enum ActorControlType :
uint16_t
{
/*! Toggles weapon status -> Sheathed/UnSheathed
\param param1 status 0|1 */
ToggleWeapon = 0x00,
/*! Toggles Autoattack status on/off
\param param1 status 0|1 */
AutoAttack = 0x01,
SetStatus = 0x02,
CastStart = 0x03,
ToggleAggro = 0x04,
ClassJobChange = 0x05,
DefeatMsg = 0x06,
GainExpMsg = 0x07,
LevelUpEffect = 0x0A,
LevelUpEffect = 0x0A,
ExpChainMsg = 0x0C,
HpSetStat = 0x0D,
DeathAnimation = 0x0E,
CastInterrupt = 0x0F,
ExpChainMsg = 0x0C,
HpSetStat = 0x0D,
DeathAnimation = 0x0E,
CastInterrupt = 0x0F,
ActionStart = 0x11,
ActionStart = 0x11,
StatusEffectGain = 0x14,
StatusEffectLose = 0x15,
StatusEffectGain = 0x14,
StatusEffectLose = 0x15,
HPFloatingText = 0x17,
UpdateRestedExp = 0x018,
Unk2 = 0x19,
HPFloatingText = 0x17,
UpdateRestedExp = 0x018,
Unk2 = 0x19,
Flee = 0x1B,
Flee = 0x1B,
Unk3 = 0x20, // Animation related?
Unk3 = 0x20, // Animation related?
CombatIndicationShow = 0x22,
CombatIndicationShow = 0x22,
SpawnEffect = 0x25,
ToggleInvisible = 0x26,
SpawnEffect = 0x25,
ToggleInvisible = 0x26,
ToggleActionUnlock = 0x29,
ToggleActionUnlock = 0x29,
UpdateUiExp = 0x2B,
DmgTakenMsg = 0x2D,
UpdateUiExp = 0x2B,
DmgTakenMsg = 0x2D,
SetTarget = 0x32,
ToggleNameHidden = 0x36,
SetTarget = 0x32,
ToggleNameHidden = 0x36,
LimitbreakStart = 0x47,
LimitbreakPartyStart = 0x48,
BubbleText = 0x49,
LimitbreakStart = 0x47,
LimitbreakPartyStart = 0x48,
BubbleText = 0x49,
DamageEffect = 0x50,
RaiseAnimation = 0x51,
TreasureScreenMsg = 0x57,
SetOwnerId = 0x59,
ItemRepairMsg = 0x5C,
DamageEffect = 0x50,
RaiseAnimation = 0x51,
TreasureScreenMsg = 0x57,
SetOwnerId = 0x59,
ItemRepairMsg = 0x5C,
DirectorInit = 0x64,
DirectorClear = 0x65,
DirectorInit = 0x64,
DirectorClear = 0x65,
LeveStartAnim = 0x66,
LeveStartError = 0x67,
DirectorEObjMod = 0x6A,
LeveStartAnim = 0x66,
LeveStartError = 0x67,
DirectorEObjMod = 0x6A,
DirectorUpdate = 0x6D,
DirectorUpdate = 0x6D,
ItemObtainMsg = 0x75,
DutyQuestScreenMsg = 0x7B,
ItemObtainMsg = 0x75,
DutyQuestScreenMsg = 0x7B,
ItemObtainIcon = 0x84,
FateItemFailMsg = 0x85,
ItemFailMsg = 0x86,
ActionLearnMsg1 = 0x87,
ItemObtainIcon = 0x84,
FateItemFailMsg = 0x85,
ItemFailMsg = 0x86,
ActionLearnMsg1 = 0x87,
FreeEventPos = 0x8A,
FreeEventPos = 0x8A,
SetBGM = 0xA1,
SetBGM = 0xA1,
UnlockAetherCurrentMsg = 0xA4,
UnlockAetherCurrentMsg = 0xA4,
RemoveName = 0xA8,
RemoveName = 0xA8,
ScreenFadeOut = 0xAA,
ScreenFadeOut = 0xAA,
ZoneIn = 0xC8,
ZoneInDefaultPos = 0xC9,
ZoneIn = 0xC8,
ZoneInDefaultPos = 0xC9,
TeleportStart = 0xCB,
TeleportStart = 0xCB,
TeleportDone = 0xCD,
TeleportDoneFadeOut = 0xCE,
DespawnZoneScreenMsg = 0xCF,
TeleportDone = 0xCD,
TeleportDoneFadeOut = 0xCE,
DespawnZoneScreenMsg = 0xCF,
InstanceSelectDlg = 0xD2,
ActorDespawnEffect = 0xD4,
InstanceSelectDlg = 0xD2,
ActorDespawnEffect = 0xD4,
CompanionUnlock = 0xFD,
ObtainBarding = 0xFE,
EquipBarding = 0xFF,
CompanionUnlock = 0xFD,
ObtainBarding = 0xFE,
EquipBarding = 0xFF,
CompanionMsg1 = 0x102,
CompanionMsg2 = 0x103,
ShowPetHotbar = 0x104,
CompanionMsg1 = 0x102,
CompanionMsg2 = 0x103,
ShowPetHotbar = 0x104,
ActionLearnMsg = 0x109,
ActorFadeOut = 0x10A,
ActorFadeIn = 0x10B,
WithdrawMsg = 0x10C,
OrderMinion = 0x10D,
ToggleMinion = 0x10E,
LearnMinion = 0x10F,
ActorFateOut1 = 0x110,
ActionLearnMsg = 0x109,
ActorFadeOut = 0x10A,
ActorFadeIn = 0x10B,
WithdrawMsg = 0x10C,
OrderMinion = 0x10D,
ToggleMinion = 0x10E,
LearnMinion = 0x10F,
ActorFateOut1 = 0x110,
Emote = 0x122,
EmoteInterrupt = 0x123,
Emote = 0x122,
EmoteInterrupt = 0x123,
SetPose = 0x127,
SetPose = 0x127,
CraftingUnk = 0x12C,
CraftingUnk = 0x12C,
GatheringSenseMsg = 0x130,
PartyMsg = 0x131,
GatheringSenseMsg1 = 0x132,
GatheringSenseMsg = 0x130,
PartyMsg = 0x131,
GatheringSenseMsg1 = 0x132,
GatheringSenseMsg2 = 0x138,
GatheringSenseMsg2 = 0x138,
FishingMsg = 0x140,
FishingMsg = 0x140,
FishingBaitMsg = 0x145,
FishingBaitMsg = 0x145,
FishingReachMsg = 0x147,
FishingFailMsg = 0x148,
FishingReachMsg = 0x147,
FishingFailMsg = 0x148,
MateriaConvertMsg = 0x15E,
MeldSuccessMsg = 0x15F,
MeldFailMsg = 0x160,
MeldModeToggle = 0x161,
MateriaConvertMsg = 0x15E,
MeldSuccessMsg = 0x15F,
MeldFailMsg = 0x160,
MeldModeToggle = 0x161,
AetherRestoreMsg = 0x163,
AetherRestoreMsg = 0x163,
DyeMsg = 0x168,
DyeMsg = 0x168,
ToggleCrestMsg = 0x16A,
ToggleBulkCrestMsg = 0x16B,
MateriaRemoveMsg = 0x16C,
GlamourCastMsg = 0x16D,
GlamourRemoveMsg = 0x16E,
ToggleCrestMsg = 0x16A,
ToggleBulkCrestMsg = 0x16B,
MateriaRemoveMsg = 0x16C,
GlamourCastMsg = 0x16D,
GlamourRemoveMsg = 0x16E,
RelicInfuseMsg = 0x179,
RelicInfuseMsg = 0x179,
AetherReductionDlg = 0x17D,
AetherReductionDlg = 0x17D,
Unk6 = 0x19C,
EObjAnimation = 0x19D,
Unk6 = 0x19C,
EObjAnimation = 0x19D,
SetTitle = 0x1F4,
SetTitle = 0x1F4,
SetStatusIcon = 0x1F8,
LimitBreakGauge = 0x1F9, // Max level, amount, build type (chop sound), lb type(0=pve lb 1=pvp lb)
SetHomepoint = 0x1FB,
SetFavorite = 0x1FC,
LearnTeleport = 0x1FD,
SetStatusIcon = 0x1F8,
LimitBreakGauge = 0x1F9, // Max level, amount, build type (chop sound), lb type(0=pve lb 1=pvp lb)
SetHomepoint = 0x1FB,
SetFavorite = 0x1FC,
LearnTeleport = 0x1FD,
OpenRecommendationGuide = 0x200,
ArmoryErrorMsg = 0x201,
OpenRecommendationGuide = 0x200,
ArmoryErrorMsg = 0x201,
AchievementPopup = 0x203,
AchievementPopup = 0x203,
Unk7 = 0x205, // LogMessage?
AchievementMsg = 0x206,
Unk7 = 0x205, // LogMessage?
AchievementMsg = 0x206,
SetItemLevel = 0x209,
SetItemLevel = 0x209,
ChallengeEntryCompleteMsg = 0x20B,
ChallengeEntryUnlockMsg = 0x20C,
ChallengeEntryCompleteMsg = 0x20B,
ChallengeEntryUnlockMsg = 0x20C,
GilTrailMsg = 0x211,
GilTrailMsg = 0x211,
SetMaxGearSets = 0x230,
SetMaxGearSets = 0x230,
SetCharaGearParamUI = 0x260,
ToggleWireframeRendering = 0x261,
SetCharaGearParamUI = 0x260,
ToggleWireframeRendering = 0x261,
GearSetEquipMsg = 0x321,
GearSetEquipMsg = 0x321,
SetFestival = 0x386, // param1: festival.exd index
SetFestival = 0x386, // param1: festival.exd index
ToggleOrchestrionUnlock = 0x396,
Dismount = 0x3A0,
ToggleOrchestrionUnlock = 0x396,
Dismount = 0x3A0,
// Duty Recorder
BeginReplayAck = 0x3A1,
EndReplayAck = 0x3A2,
// Duty Recorder
BeginReplayAck = 0x3A1,
EndReplayAck = 0x3A2,
// PvP Duel
SetPvPState = 0x5E0, // param3 must be 6 to engage a duel (hardcoded in the client)
EndDuelSession = 0x5E1, // because someone went oob?
StartDuelCountdown = 0x5E2, // begins a countdown; also does some duel bgm thing.
StartDuel = 0x5E3, // actually all it does is set the challenger actor id;
DuelResultScreen = 0x5E4, // win/lose thing, also reset a target id just like what EndDuelSession does.
// PvP Duel
SetPvPState = 0x5E0, // param3 must be 6 to engage a duel (hardcoded in the client)
EndDuelSession = 0x5E1, // because someone went oob?
StartDuelCountdown = 0x5E2, // begins a countdown; also does some duel bgm thing.
StartDuel = 0x5E3, // actually all it does is set the challenger actor id;
DuelResultScreen = 0x5E4, // win/lose thing, also reset a target id just like what EndDuelSession does.
// Duty Action
SetDutyActionId = 0x5E8, // ContentExAction
SetDutyActionHud = 0x5E9, // disable/enable
SetDutyActionActive = 0x5EA,
SetDutyActionRemaining = 0x5EB,
};
// Duty Action
SetDutyActionId = 0x5E8, // ContentExAction
SetDutyActionHud = 0x5E9, // disable/enable
SetDutyActionActive = 0x5EA,
SetDutyActionRemaining = 0x5EB,
};
enum ClientTriggerType
{
ToggleSheathe = 0x01,
ToggleAutoAttack = 0x02,
ChangeTarget = 0x03,
enum ClientTriggerType
{
ToggleSheathe = 0x01,
ToggleAutoAttack = 0x02,
ChangeTarget = 0x03,
DismountReq = 0x65,
DismountReq = 0x65,
RemoveStatusEffect = 0x68,
CastCancel = 0x69,
RemoveStatusEffect = 0x68,
CastCancel = 0x69,
Return = 0xC8, // return dead / accept raise
FinishZoning = 0xC9,
Teleport = 0xCA,
Return = 0xC8, // return dead / accept raise
FinishZoning = 0xC9,
Teleport = 0xCA,
MarkPlayer = 0x12D, // Mark player, visible to party only
SetTitleReq = 0x12E,
TitleList = 0x12F,
MarkPlayer = 0x12D, // Mark player, visible to party only
SetTitleReq = 0x12E,
TitleList = 0x12F,
UpdatedSeenHowTos = 0x133,
AllotAttribute = 0x135,
UpdatedSeenHowTos = 0x133,
AllotAttribute = 0x135,
ClearWaymarks = 0x13A,
CameraMode = 0x13B, // param12, 1 = camera mode enable, 0 = disable
ClearWaymarks = 0x13A,
CameraMode = 0x13B, // param12, 1 = camera mode enable, 0 = disable
HuntingLogDetails = 0x194,
HuntingLogDetails = 0x194,
Timers = 0x1AB,
Timers = 0x1AB,
DyeItem = 0x1B5,
DyeItem = 0x1B5,
RequestChocoboInventory = 0x1C4,
RequestChocoboInventory = 0x1C4,
EmoteReq = 0x1F4,
EmoteCancel = 0x1F6,
PersistentEmoteCancel = 0x1F7,
PoseChange = 0x1F9,
PoseReapply = 0x1FA,
PoseCancel = 0x1FB,
EmoteReq = 0x1F4,
EmoteCancel = 0x1F6,
PersistentEmoteCancel = 0x1F7,
PoseChange = 0x1F9,
PoseReapply = 0x1FA,
PoseCancel = 0x1FB,
AchievementCrit = 0x202,
AchievementComp = 0x203,
AchievementCatChat = 0x206,
AchievementCrit = 0x202,
AchievementComp = 0x203,
AchievementCatChat = 0x206,
DirectorInitFinish = 0x321,
DirectorInitFinish = 0x321,
DirectorSync = 0x328, // unsure what exactly triggers it, starts director when returning to instance though
DirectorSync = 0x328, // unsure what exactly triggers it, starts director when returning to instance though
EnterTerritoryEventFinished = 0x330,
RequestInstanceLeave = 0x333, // df menu button
EnterTerritoryEventFinished = 0x330,
RequestInstanceLeave = 0x333, // df menu button
AchievementCritReq = 0x3E8,
AchievementList = 0x3E9,
AchievementCritReq = 0x3E8,
AchievementList = 0x3E9,
CompanionAction = 0x6A4,
CompanionSetBarding = 0x6A5,
CompanionActionUnlock = 0x6A6,
CompanionAction = 0x6A4,
CompanionSetBarding = 0x6A5,
CompanionActionUnlock = 0x6A6,
OpenPerformInstrumentUI = 0x71C,
OpenPerformInstrumentUI = 0x71C,
StartReplay = 0x7BC,
EndReplay = 0x7BD, // request for restoring the original player state (actor, buff, gauge, etc..)
StartReplay = 0x7BC,
EndReplay = 0x7BD, // request for restoring the original player state (actor, buff, gauge, etc..)
OpenDuelUI = 0x898, // Open a duel ui
DuelRequestResult = 0x899, // either accept/reject
OpenDuelUI = 0x898, // Open a duel ui
DuelRequestResult = 0x899, // either accept/reject
};
};
} /* ActorControl */
} /* Common */
} /* ActorControl */
} /* Common */
} /* Core */
#endif

View file

@ -53,31 +53,31 @@ namespace Packets {
*/
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;
/** 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 ostream& operator << ( ostream& os, const FFXIVARR_PACKET_HEADER& hdr )
inline ostream& operator<<( ostream& os, const FFXIVARR_PACKET_HEADER& hdr )
{
return os.write( reinterpret_cast< const char* >( &hdr ), sizeof hdr );
return os.write( reinterpret_cast< const char* >( &hdr ), sizeof hdr );
}
inline istream& operator >> ( istream& is, FFXIVARR_PACKET_HEADER& hdr )
inline istream& operator>>( istream& is, FFXIVARR_PACKET_HEADER& hdr )
{
return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr );
return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr );
}
/**
@ -97,37 +97,41 @@ inline istream& operator >> ( istream& is, FFXIVARR_PACKET_HEADER& hdr )
*/
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;
/** 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 ostream& operator << ( ostream& os, const FFXIVARR_PACKET_SEGMENT_HEADER& hdr )
inline ostream& operator<<( ostream& os, const FFXIVARR_PACKET_SEGMENT_HEADER& hdr )
{
return os.write( reinterpret_cast< const char* >( &hdr ), sizeof hdr );
return os.write( reinterpret_cast< const char* >( &hdr ), sizeof hdr );
}
inline istream& operator >> ( istream& is, FFXIVARR_PACKET_SEGMENT_HEADER& hdr )
inline istream& operator>>( istream& is, FFXIVARR_PACKET_SEGMENT_HEADER& hdr )
{
return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr );
return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr );
}
template < int T > struct FFXIVIpcBasePacket
template< int T >
struct FFXIVIpcBasePacket
{
/** Creates a constant representing the IPC type */
enum { _ServerIpcType = T };
/** Creates a constant representing the IPC type */
enum
{
_ServerIpcType = T
};
};
struct FFXIVARR_PACKET_RAW
{
FFXIVARR_PACKET_SEGMENT_HEADER segHdr;
std::vector< uint8_t > data;
FFXIVARR_PACKET_SEGMENT_HEADER segHdr;
std::vector< uint8_t > data;
};
/**
@ -137,11 +141,11 @@ struct FFXIVARR_PACKET_RAW
*/
enum FFXIVARR_SEGMENT_TYPE
{
SEGMENTTYPE_SESSIONINIT = 1,
SEGMENTTYPE_IPC = 3,
SEGMENTTYPE_KEEPALIVE = 7,
//SEGMENTTYPE_RESPONSE = 8,
SEGMENTTYPE_ENCRYPTIONINIT = 9,
SEGMENTTYPE_SESSIONINIT = 1,
SEGMENTTYPE_IPC = 3,
SEGMENTTYPE_KEEPALIVE = 7,
//SEGMENTTYPE_RESPONSE = 8,
SEGMENTTYPE_ENCRYPTIONINIT = 9,
};
/**
@ -159,22 +163,22 @@ enum FFXIVARR_SEGMENT_TYPE
*/
struct FFXIVARR_IPC_HEADER
{
uint16_t reserved;
uint16_t type;
uint16_t padding;
uint16_t serverId;
uint32_t timestamp;
uint32_t padding1;
uint16_t reserved;
uint16_t type;
uint16_t padding;
uint16_t serverId;
uint32_t timestamp;
uint32_t padding1;
};
inline ostream& operator << ( ostream& os, const FFXIVARR_IPC_HEADER& hdr )
inline ostream& operator<<( ostream& os, const FFXIVARR_IPC_HEADER& hdr )
{
return os.write( reinterpret_cast< const char* >( &hdr ), sizeof hdr );
return os.write( reinterpret_cast< const char* >( &hdr ), sizeof hdr );
}
inline istream& operator >> ( istream& is, FFXIVARR_IPC_HEADER& hdr )
inline istream& operator>>( istream& is, FFXIVARR_IPC_HEADER& hdr )
{
return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr );
return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr );
}
} /* Packets */

View file

@ -4,207 +4,210 @@
#include <boost/bind.hpp>
namespace Core {
namespace Network {
//-----------------------------------------------------------------------------
namespace Network {
//-----------------------------------------------------------------------------
Connection::Connection( HivePtr hive )
: m_hive( hive ),
m_socket( hive->GetService() ),
m_io_strand( hive->GetService() ),
m_receive_buffer_size( 32000 ),
m_error_state( 0 )
{
}
Connection::Connection( HivePtr hive )
:
m_hive( hive ),
m_socket( hive->GetService() ),
m_io_strand( hive->GetService() ),
m_receive_buffer_size( 32000 ),
m_error_state( 0 )
{
}
Connection::~Connection()
{
}
Connection::~Connection()
{
}
void Connection::Bind( const std::string & ip, uint16_t port )
{
boost::asio::ip::tcp::endpoint endpoint( boost::asio::ip::address::from_string( ip ), port );
m_socket.open( endpoint.protocol() );
m_socket.set_option( boost::asio::ip::tcp::acceptor::reuse_address( false ) );
m_socket.bind( endpoint );
}
void Connection::Bind( const std::string& ip, uint16_t port )
{
boost::asio::ip::tcp::endpoint endpoint( boost::asio::ip::address::from_string( ip ), port );
m_socket.open( endpoint.protocol() );
m_socket.set_option( boost::asio::ip::tcp::acceptor::reuse_address( false ) );
m_socket.bind( endpoint );
}
void Connection::StartSend()
{
if( !m_pending_sends.empty() )
{
boost::asio::async_write( m_socket,
boost::asio::buffer( m_pending_sends.front() ),
m_io_strand.wrap( boost::bind( &Connection::HandleSend,
shared_from_this(),
boost::asio::placeholders::error,
m_pending_sends.begin() ) ) );
}
}
void Connection::StartSend()
{
if( !m_pending_sends.empty() )
{
boost::asio::async_write( m_socket,
boost::asio::buffer( m_pending_sends.front() ),
m_io_strand.wrap( boost::bind( &Connection::HandleSend,
shared_from_this(),
boost::asio::placeholders::error,
m_pending_sends.begin() ) ) );
}
}
void Connection::StartRecv( int32_t total_bytes )
{
if( total_bytes > 0 )
{
m_recv_buffer.resize( total_bytes );
boost::asio::async_read( m_socket,
boost::asio::buffer( m_recv_buffer ),
m_io_strand.wrap( boost::bind( &Connection::HandleRecv,
shared_from_this(),
_1,
_2 ) ) );
}
else
{
m_recv_buffer.resize( m_receive_buffer_size );
m_socket.async_read_some( boost::asio::buffer( m_recv_buffer ),
m_io_strand.wrap( boost::bind( &Connection::HandleRecv,
shared_from_this(),
_1,
_2 ) ) );
}
}
void Connection::StartRecv( int32_t total_bytes )
{
if( total_bytes > 0 )
{
m_recv_buffer.resize( total_bytes );
boost::asio::async_read( m_socket,
boost::asio::buffer( m_recv_buffer ),
m_io_strand.wrap( boost::bind( &Connection::HandleRecv,
shared_from_this(),
_1,
_2 ) ) );
}
else
{
m_recv_buffer.resize( m_receive_buffer_size );
m_socket.async_read_some( boost::asio::buffer( m_recv_buffer ),
m_io_strand.wrap( boost::bind( &Connection::HandleRecv,
shared_from_this(),
_1,
_2 ) ) );
}
}
void Connection::StartError( const boost::system::error_code & error )
{
if( boost::interprocess::ipcdetail::atomic_cas32( &m_error_state, 1, 0 ) == 0 )
{
boost::system::error_code ec;
m_socket.shutdown( boost::asio::ip::tcp::socket::shutdown_both, ec );
m_socket.close( ec );
OnError( error );
}
}
void Connection::StartError( const boost::system::error_code& error )
{
if( boost::interprocess::ipcdetail::atomic_cas32( &m_error_state, 1, 0 ) == 0 )
{
boost::system::error_code ec;
m_socket.shutdown( boost::asio::ip::tcp::socket::shutdown_both, ec );
m_socket.close( ec );
OnError( error );
}
}
void Connection::HandleConnect( const boost::system::error_code & error )
{
if( error || HasError() || m_hive->HasStopped() )
{
StartError( error );
}
else
{
if( m_socket.is_open() )
{
OnConnect( m_socket.remote_endpoint().address().to_string(), m_socket.remote_endpoint().port() );
Recv();
}
else
{
StartError( error );
}
}
}
void Connection::HandleConnect( const boost::system::error_code& error )
{
if( error || HasError() || m_hive->HasStopped() )
{
StartError( error );
}
else
{
if( m_socket.is_open() )
{
OnConnect( m_socket.remote_endpoint().address().to_string(), m_socket.remote_endpoint().port() );
Recv();
}
else
{
StartError( error );
}
}
}
void Connection::HandleSend( const boost::system::error_code & error, std::list< std::vector< uint8_t > >::iterator itr )
{
if( error || HasError() || m_hive->HasStopped() )
{
StartError( error );
}
else
{
OnSend( *itr );
m_pending_sends.erase( itr );
StartSend();
}
}
void
Connection::HandleSend( const boost::system::error_code& error, std::list< std::vector< uint8_t > >::iterator itr )
{
if( error || HasError() || m_hive->HasStopped() )
{
StartError( error );
}
else
{
OnSend( *itr );
m_pending_sends.erase( itr );
StartSend();
}
}
void Connection::HandleRecv( const boost::system::error_code & error, int32_t actual_bytes )
{
if( error || HasError() || m_hive->HasStopped() )
{
StartError( error );
}
else
{
m_recv_buffer.resize( actual_bytes );
OnRecv( m_recv_buffer );
Recv();
m_pending_recvs.pop_front();
if( !m_pending_recvs.empty() )
{
StartRecv( m_pending_recvs.front() );
}
}
}
void Connection::HandleRecv( const boost::system::error_code& error, int32_t actual_bytes )
{
if( error || HasError() || m_hive->HasStopped() )
{
StartError( error );
}
else
{
m_recv_buffer.resize( actual_bytes );
OnRecv( m_recv_buffer );
Recv();
m_pending_recvs.pop_front();
if( !m_pending_recvs.empty() )
{
StartRecv( m_pending_recvs.front() );
}
}
}
void Connection::DispatchSend( std::vector< uint8_t > buffer )
{
bool should_start_send = m_pending_sends.empty();
m_pending_sends.push_back( buffer );
if( should_start_send )
{
StartSend();
}
}
void Connection::DispatchSend( std::vector< uint8_t > buffer )
{
bool should_start_send = m_pending_sends.empty();
m_pending_sends.push_back( buffer );
if( should_start_send )
{
StartSend();
}
}
void Connection::DispatchRecv( int32_t total_bytes )
{
bool should_start_receive = m_pending_recvs.empty();
m_pending_recvs.push_back( total_bytes );
if( should_start_receive )
{
StartRecv( total_bytes );
}
}
void Connection::DispatchRecv( int32_t total_bytes )
{
bool should_start_receive = m_pending_recvs.empty();
m_pending_recvs.push_back( total_bytes );
if( should_start_receive )
{
StartRecv( total_bytes );
}
}
void Connection::Connect( const std::string & host, uint16_t port)
{
boost::asio::ip::tcp::resolver resolver( m_hive->GetService() );
boost::asio::ip::tcp::resolver::query query( host, std::to_string( port ) );
boost::asio::ip::tcp::resolver::iterator iterator = resolver.resolve( query );
m_socket.async_connect( *iterator, m_io_strand.wrap( boost::bind( &Connection::HandleConnect, shared_from_this(), _1 ) ) );
void Connection::Connect( const std::string& host, uint16_t port )
{
boost::asio::ip::tcp::resolver resolver( m_hive->GetService() );
boost::asio::ip::tcp::resolver::query query( host, std::to_string( port ) );
boost::asio::ip::tcp::resolver::iterator iterator = resolver.resolve( query );
m_socket.async_connect( *iterator,
m_io_strand.wrap( boost::bind( &Connection::HandleConnect, shared_from_this(), _1 ) ) );
}
}
void Connection::Disconnect()
{
OnDisconnect();
m_socket.close();
}
void Connection::Disconnect()
{
OnDisconnect();
m_socket.close();
}
void Connection::Recv( int32_t total_bytes )
{
m_io_strand.post( boost::bind( &Connection::DispatchRecv, shared_from_this(), total_bytes ) );
}
void Connection::Recv( int32_t total_bytes )
{
m_io_strand.post( boost::bind( &Connection::DispatchRecv, shared_from_this(), total_bytes ) );
}
void Connection::Send( const std::vector< uint8_t > & buffer )
{
m_io_strand.post( boost::bind( &Connection::DispatchSend, shared_from_this(), buffer ) );
}
void Connection::Send( const std::vector< uint8_t >& buffer )
{
m_io_strand.post( boost::bind( &Connection::DispatchSend, shared_from_this(), buffer ) );
}
boost::asio::ip::tcp::socket & Connection::GetSocket()
{
return m_socket;
}
boost::asio::ip::tcp::socket& Connection::GetSocket()
{
return m_socket;
}
boost::asio::strand & Connection::GetStrand()
{
return m_io_strand;
}
boost::asio::strand& Connection::GetStrand()
{
return m_io_strand;
}
HivePtr Connection::GetHive()
{
return m_hive;
}
HivePtr Connection::GetHive()
{
return m_hive;
}
void Connection::SetReceiveBufferSize( int32_t size )
{
m_receive_buffer_size = size;
}
void Connection::SetReceiveBufferSize( int32_t size )
{
m_receive_buffer_size = size;
}
int32_t Connection::GetReceiveBufferSize() const
{
return m_receive_buffer_size;
}
int32_t Connection::GetReceiveBufferSize() const
{
return m_receive_buffer_size;
}
bool Connection::HasError()
{
return ( boost::interprocess::ipcdetail::atomic_cas32( &m_error_state, 1, 1 ) == 1 );
}
bool Connection::HasError()
{
return ( boost::interprocess::ipcdetail::atomic_cas32( &m_error_state, 1, 1 ) == 1 );
}
}
}
}
//-----------------------------------------------------------------------------

View file

@ -14,130 +14,156 @@
namespace Core {
namespace Network {
//-----------------------------------------------------------------------------
namespace Network {
//-----------------------------------------------------------------------------
class Hive;
class Acceptor;
class Connection;
class Hive;
//-----------------------------------------------------------------------------
class Acceptor;
class Connection : public boost::enable_shared_from_this< Connection >
{
friend class Acceptor;
friend class Hive;
class Connection;
protected:
HivePtr m_hive;
boost::asio::ip::tcp::socket m_socket;
boost::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;
volatile uint32_t m_error_state;
//-----------------------------------------------------------------------------
class Connection :
public boost::enable_shared_from_this< Connection >
{
friend class Acceptor;
friend class Hive;
protected:
HivePtr m_hive;
boost::asio::ip::tcp::socket m_socket;
boost::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;
volatile uint32_t m_error_state;
Connection( HivePtr hive );
virtual ~Connection();
Connection( HivePtr hive );
private:
Connection( const Connection & rhs );
Connection & operator =( const Connection & rhs );
void StartSend();
void StartRecv( int32_t total_bytes );
void StartError( const boost::system::error_code & error );
void DispatchSend( std::vector< uint8_t > buffer );
void DispatchRecv( int32_t total_bytes );
void HandleConnect( const boost::system::error_code & error );
void HandleSend( const boost::system::error_code & error, std::list< std::vector< uint8_t > >::iterator itr );
void HandleRecv( const boost::system::error_code & error, int32_t actual_bytes );
virtual ~Connection();
private:
Connection( const Connection& rhs );
Connection& operator=( const Connection& rhs );
void StartSend();
void StartRecv( int32_t total_bytes );
void StartError( const boost::system::error_code& error );
void DispatchSend( std::vector< uint8_t > buffer );
void DispatchRecv( int32_t total_bytes );
void HandleConnect( const boost::system::error_code& error );
void HandleSend( const boost::system::error_code& error, std::list< std::vector< uint8_t > >::iterator itr );
void HandleRecv( const boost::system::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 ) {};
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 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 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 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 boost::system::error_code & error ) {};
// Called when an error is encountered.
virtual void OnError( const boost::system::error_code& error )
{
};
// Called when the connection has been disconnected
virtual void OnDisconnect() {};
// Called when the connection has been disconnected
virtual void OnDisconnect()
{
};
public:
// Returns the Hive object.
HivePtr GetHive();
public:
// Returns the Hive object.
HivePtr GetHive();
// Returns the socket object.
boost::asio::ip::tcp::socket & GetSocket();
// Returns the socket object.
boost::asio::ip::tcp::socket& GetSocket();
// Returns the strand object.
boost::asio::strand & GetStrand();
// Returns the strand object.
boost::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 );
// 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 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();
// 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 );
// 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 );
// 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 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 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();
};
// Posts an asynchronous disconnect event for the object to process.
void Disconnect();
};
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
template<class T>
boost::shared_ptr< T > addServerToHive( const std::string& listenIp, uint32_t port, HivePtr pHive )
{
try
{
AcceptorPtr acceptor( new Acceptor( pHive ) );
acceptor->Listen( listenIp, port );
boost::shared_ptr< T > connection( new T( pHive, acceptor ) );
acceptor->Accept( connection );
return connection;
}
catch( std::runtime_error e )
{
throw;
}
}
template< class T >
boost::shared_ptr< T > addServerToHive( const std::string& listenIp, uint32_t port, HivePtr pHive )
{
try
{
AcceptorPtr acceptor( new Acceptor( pHive ) );
acceptor->Listen( listenIp, port );
boost::shared_ptr< T > connection( new T( pHive, acceptor ) );
acceptor->Accept( connection );
return connection;
}
catch( std::runtime_error e )
{
throw;
}
}
}
}
}

View file

@ -22,7 +22,7 @@ namespace Packets {
// Must forward define these in order to enable the compiler to produce the
// correct template functions.
template < typename T, typename T1 >
template< typename T, typename T1 >
class FFXIVIpcPacket;
template< class T >
@ -38,40 +38,41 @@ using LobbyChannelPacket = FFXIVIpcPacket< T, ServerLobbyIpcType >;
template< class T, typename... Args >
boost::shared_ptr< ZoneChannelPacket< T > > makeZonePacket( Args... args )
{
return boost::make_shared< ZoneChannelPacket< T > >( args... );
return boost::make_shared< ZoneChannelPacket< T > >( args... );
}
template< class T, typename... Args >
boost::shared_ptr< T > makeWrappedPacket( Args... args )
{
return boost::make_shared< T >( args... );
return boost::make_shared< T >( args... );
}
template< class T, typename... Args >
boost::shared_ptr< ChatChannelPacket< T > > makeChatPacket( Args... args )
{
return boost::make_shared< ChatChannelPacket< T > >( args... );
return boost::make_shared< ChatChannelPacket< T > >( args... );
}
template< class T, typename... Args >
boost::shared_ptr< LobbyChannelPacket< T > > makeLobbyPacket( Args... args )
{
return boost::make_shared< LobbyChannelPacket< T > >( args... );
return boost::make_shared< LobbyChannelPacket< T > >( args... );
}
/**
* The base implementation of a game packet. Needed for parsing packets.
*/
template < typename T1 >
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;
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
@ -79,238 +80,256 @@ public:
class FFXIVPacketBase
{
public:
FFXIVPacketBase() :
m_segmentType( 0 )
{
initializeSegmentHeader();
}
FFXIVPacketBase() :
m_segmentType( 0 )
{
initializeSegmentHeader();
}
FFXIVPacketBase( uint16_t segmentType, uint32_t sourceActorId, uint32_t targetActorId ) :
m_segmentType( segmentType )
{
initializeSegmentHeader();
setSourceActor( sourceActorId );
setTargetActor( targetActorId );
}
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;
}
std::size_t getSize() const
{
return m_segHdr.size;
}
virtual std::vector< uint8_t > getData() const
{
return {};
}
virtual std::vector< uint8_t > getData() const
{
return {};
}
protected:
/** The segment header */
FFXIVARR_PACKET_SEGMENT_HEADER m_segHdr;
uint16_t m_segmentType;
/** 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{}; };
virtual uint32_t getContentSize()
{
return 0;
};
/**
* @brief Gets the segment type of this packet.
*/
uint16_t getSegmentType() const
{
return m_segmentType;
}
virtual std::vector< uint8_t > getContent()
{
return {};
};
/**
* @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 segment type of this packet.
*/
uint16_t getSegmentType() const
{
return m_segmentType;
}
/**
* @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 source actor id for this packet.
* @param actorId The source actor id.
*/
void setSourceActor( uint32_t actorId )
{
m_segHdr.source_actor = actorId;
};
/**
* @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 source actor id for this packet.
* @return The source actor id.
*/
uint32_t getSourceActor() const
{
return m_segHdr.source_actor;
};
/**
* @brief Gets the target actor id for this packet.
*/
uint32_t getTargetActor( void ) const
{
return m_segHdr.target_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;
};
/** 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 ) );
/**
* @brief Gets the target actor id for this packet.
*/
uint32_t getTargetActor( void ) const
{
return m_segHdr.target_actor;
};
// 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();
}
/** 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
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, uint32_t targetActorId ) :
FFXIVPacketBase( 3, sourceActorId, targetActorId )
{
initialize();
};
FFXIVIpcPacket< T, T1 >( uint32_t sourceActorId ) :
FFXIVPacketBase( 3, sourceActorId, sourceActorId )
{
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 );
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 );
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 );
}
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 );
}
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 > 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 > 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 );
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 );
memcpy( &data[ 0 ], &m_segHdr, segmentHeaderSize );
memcpy( &data[ segmentHeaderSize ], &m_ipcHdr, ipcHeaderSize );
memcpy( &data[ segmentHeaderSize + ipcHeaderSize ], &m_data, dataSize );
return data;
}
return data;
}
T1 ipcType() override
{
return static_cast< T1 >( m_data._ServerIpcType );
};
T1 ipcType() override
{
return static_cast< T1 >( m_data._ServerIpcType );
};
/** Gets a reference to the underlying IPC data structure. */
T& data() { return m_data; };
/** Gets a reference to the underlying IPC data structure. */
T& data()
{
return m_data;
};
const T& data() const { 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 ) );
/** 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 );
};
// 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;
/** 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
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( 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 );
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 );
}
memcpy( &m_data[ 0 ], data + segmentHdrSize, size - segmentHdrSize );
memcpy( &m_segHdr, data, segmentHdrSize );
}
uint32_t getContentSize() override
{
return m_data.size();
}
uint32_t getContentSize() override
{
return m_data.size();
}
std::vector< uint8_t > getContent() override
{
return m_data;
}
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() );
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() );
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;
}
return data;
}
/** Gets a reference to the underlying IPC data structure. */
std::vector< uint8_t >& data() { return m_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() );
};
/** 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;
/** The underlying data portion of the packet as a structure */
std::vector< uint8_t > m_data;
};

View file

@ -5,122 +5,122 @@
using namespace Core::Network::Packets;
PacketParseResult Core::Network::Packets::getHeader( const std::vector< uint8_t > &buffer,
PacketParseResult Core::Network::Packets::getHeader( const std::vector< uint8_t >& buffer,
const uint32_t offset,
FFXIVARR_PACKET_HEADER &header )
FFXIVARR_PACKET_HEADER& header )
{
const auto headerSize = sizeof( FFXIVARR_PACKET_HEADER );
const auto headerSize = sizeof( FFXIVARR_PACKET_HEADER );
// Check if we have enough bytes in the buffer.
auto remainingBytes = buffer.size() - offset;
if( remainingBytes < headerSize )
return Incomplete;
// Check if we have enough bytes in the buffer.
auto remainingBytes = buffer.size() - offset;
if( remainingBytes < headerSize )
return Incomplete;
// Copy packet header.
memcpy( &header, buffer.data() + offset, headerSize );
// Copy packet header.
memcpy( &header, buffer.data() + offset, headerSize );
if( !checkHeader(header) )
return Malformed;
if( !checkHeader( header ) )
return Malformed;
return Success;
return Success;
}
PacketParseResult Core::Network::Packets::getSegmentHeader( const std::vector< uint8_t > &buffer,
PacketParseResult Core::Network::Packets::getSegmentHeader( const std::vector< uint8_t >& buffer,
const uint32_t offset,
FFXIVARR_PACKET_SEGMENT_HEADER &header )
FFXIVARR_PACKET_SEGMENT_HEADER& header )
{
const auto headerSize = sizeof( FFXIVARR_PACKET_SEGMENT_HEADER );
const auto headerSize = sizeof( FFXIVARR_PACKET_SEGMENT_HEADER );
// Check if we have enough bytes in the buffer.
auto remainingBytes = buffer.size() - offset;
if( remainingBytes < headerSize )
return Incomplete;
// Check if we have enough bytes in the buffer.
auto remainingBytes = buffer.size() - offset;
if( remainingBytes < headerSize )
return Incomplete;
// Copy segment header
memcpy( &header, buffer.data() + offset, headerSize );
// Copy segment header
memcpy( &header, buffer.data() + offset, headerSize );
return Success;
return Success;
}
PacketParseResult Core::Network::Packets::getPackets( const std::vector< uint8_t > &buffer,
PacketParseResult Core::Network::Packets::getPackets( const std::vector< uint8_t >& buffer,
const uint32_t offset,
const FFXIVARR_PACKET_HEADER &packetHeader,
std::vector< FFXIVARR_PACKET_RAW > &packets )
const FFXIVARR_PACKET_HEADER& packetHeader,
std::vector< FFXIVARR_PACKET_RAW >& packets )
{
// sanity check: check there's enough bytes in the buffer
const auto bytesExpected = packetHeader.size - sizeof( struct FFXIVARR_PACKET_HEADER );
if( buffer.size() - offset < bytesExpected )
return Incomplete;
// sanity check: check there's enough bytes in the buffer
const auto bytesExpected = packetHeader.size - sizeof( struct FFXIVARR_PACKET_HEADER );
if( buffer.size() - offset < bytesExpected )
return Incomplete;
// Loop each message
uint32_t count = 0;
uint32_t bytesProcessed = 0;
while( count < packetHeader.count )
{
FFXIVARR_PACKET_RAW rawPacket;
// Loop each message
uint32_t count = 0;
uint32_t bytesProcessed = 0;
while( count < packetHeader.count )
{
FFXIVARR_PACKET_RAW rawPacket;
// Copy ipc packet message
const auto packetResult = getPacket( buffer, offset + bytesProcessed, rawPacket );
if( packetResult != Success )
return packetResult;
// Copy ipc packet message
const auto packetResult = getPacket( buffer, offset + bytesProcessed, rawPacket );
if( packetResult != Success )
return packetResult;
// NOTE: isn't rawPacket is allocated on stack?
// why is okay to do this?
packets.push_back( rawPacket );
// NOTE: isn't rawPacket is allocated on stack?
// why is okay to do this?
packets.push_back( rawPacket );
// Add message size and count
bytesProcessed += rawPacket.segHdr.size;
count += 1;
}
// Add message size and count
bytesProcessed += rawPacket.segHdr.size;
count += 1;
}
// sanity check: check if we processed all bytes.
// this check can fail if size of messages don't add up to size reported from packet header.
if( bytesExpected != bytesProcessed )
return Malformed;
// sanity check: check if we processed all bytes.
// this check can fail if size of messages don't add up to size reported from packet header.
if( bytesExpected != bytesProcessed )
return Malformed;
return Success;
return Success;
}
PacketParseResult Core::Network::Packets::getPacket( const std::vector< uint8_t > &buffer, const uint32_t offset,
FFXIVARR_PACKET_RAW &packet )
PacketParseResult Core::Network::Packets::getPacket( const std::vector< uint8_t >& buffer, const uint32_t offset,
FFXIVARR_PACKET_RAW& packet )
{
// Copy segment header
const auto headerResult = getSegmentHeader( buffer, offset, packet.segHdr );
if( headerResult != Success )
return headerResult;
// Copy segment header
const auto headerResult = getSegmentHeader( buffer, offset, packet.segHdr );
if( headerResult != Success )
return headerResult;
// Check header sanity and it's size
if( !checkSegmentHeader( packet.segHdr ) )
return Malformed;
// Check header sanity and it's size
if( !checkSegmentHeader( packet.segHdr ) )
return Malformed;
const auto dataOffset = offset + sizeof( struct FFXIVARR_PACKET_SEGMENT_HEADER );
const auto dataSize = packet.segHdr.size;
const auto dataOffset = offset + sizeof( struct FFXIVARR_PACKET_SEGMENT_HEADER );
const auto dataSize = packet.segHdr.size;
// Allocate data buffer and copy
packet.data.resize( dataSize );
memcpy( packet.data.data(), buffer.data() + dataOffset, dataSize );
// Allocate data buffer and copy
packet.data.resize( dataSize );
memcpy( packet.data.data(), buffer.data() + dataOffset, dataSize );
return Success;
return Success;
}
bool Core::Network::Packets::checkHeader( const FFXIVARR_PACKET_HEADER &header )
bool Core::Network::Packets::checkHeader( const FFXIVARR_PACKET_HEADER& header )
{
// Max size of the packet is capped at 1MB for now.
if( header.size > 1 * 1024 * 1024 )
return false;
// Max size of the packet is capped at 1MB for now.
if( header.size > 1 * 1024 * 1024 )
return false;
// Max number of message is capped at 255 for now.
if( header.count > 255 )
return false;
// Max number of message is capped at 255 for now.
if( header.count > 255 )
return false;
return true;
return true;
}
bool Core::Network::Packets::checkSegmentHeader( const FFXIVARR_PACKET_SEGMENT_HEADER &header )
bool Core::Network::Packets::checkSegmentHeader( const FFXIVARR_PACKET_SEGMENT_HEADER& header )
{
// Max size of individual message is capped at 256KB for now.
if( header.size > 256 * 1024 )
return false;
// Max size of individual message is capped at 256KB for now.
if( header.size > 256 * 1024 )
return false;
return true;
return true;
}

View file

@ -1,47 +1,49 @@
#ifndef _GAMEPACKETPARSER_H
#define _GAMEPACKETPARSER_H
#include "CommonNetwork.h"
namespace Core {
namespace Network {
namespace Packets {
enum PacketParseResult
{
/// Dissected game packet successfully
Success,
enum PacketParseResult
{
/// Dissected game packet successfully
Success,
/// Buffer is too short to dissect a message.
Incomplete,
/// Buffer is too short to dissect a message.
Incomplete,
/// Invalid data detected.
Malformed
};
/// Invalid data detected.
Malformed
};
/// Read packet header from buffer with given offset.
/// Buffer with given offset must be pointing to start of the new FFXIV packet.
PacketParseResult getHeader( const std::vector< uint8_t > &buffer, const uint32_t offset,
FFXIVARR_PACKET_HEADER &header );
/// Read packet header from buffer with given offset.
/// Buffer with given offset must be pointing to start of the new FFXIV packet.
PacketParseResult getHeader( const std::vector< uint8_t >& buffer, const uint32_t offset,
FFXIVARR_PACKET_HEADER& header );
/// Read packet header from buffer with given offset.
/// Buffer with given offset must be pointing to start of FFXIVARR_PACKET_SEGMENT_HEADER data.
/// Keep in mind that this function does check for data validity. Call checkSegmentHeader() if that's needed.
PacketParseResult getSegmentHeader( const std::vector< uint8_t > &buffer, const uint32_t offset,
FFXIVARR_PACKET_SEGMENT_HEADER &header );
/// Read packet header from buffer with given offset.
/// Buffer with given offset must be pointing to start of FFXIVARR_PACKET_SEGMENT_HEADER data.
/// Keep in mind that this function does check for data validity. Call checkSegmentHeader() if that's needed.
PacketParseResult getSegmentHeader( const std::vector< uint8_t >& buffer, const uint32_t offset,
FFXIVARR_PACKET_SEGMENT_HEADER& header );
/// Read packets from the buffer with given offset.
/// Buffer with given offset must be pointing to end of FFXIVARR_PACKET_HEADER data.
PacketParseResult getPackets( const std::vector< uint8_t > &buffer, const uint32_t offset,
const FFXIVARR_PACKET_HEADER &header,
std::vector< Packets::FFXIVARR_PACKET_RAW > &packets );
/// Read packets from the buffer with given offset.
/// Buffer with given offset must be pointing to end of FFXIVARR_PACKET_HEADER data.
PacketParseResult getPackets( const std::vector< uint8_t >& buffer, const uint32_t offset,
const FFXIVARR_PACKET_HEADER& header,
std::vector< Packets::FFXIVARR_PACKET_RAW >& packets );
/// 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 );
/// 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 checkHeader(const FFXIVARR_PACKET_HEADER &header);
bool checkSegmentHeader(const FFXIVARR_PACKET_SEGMENT_HEADER &header);
bool checkHeader( const FFXIVARR_PACKET_HEADER& header );
bool checkSegmentHeader( const FFXIVARR_PACKET_SEGMENT_HEADER& header );
}
}

View file

@ -4,58 +4,59 @@
#include "Hive.h"
namespace Core {
namespace Network {
namespace Network {
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
Hive::Hive()
: m_work_ptr( new boost::asio::io_service::work( m_io_service ) ),
m_shutdown( 0 )
{
}
Hive::~Hive()
{
}
boost::asio::io_service & Hive::GetService()
{
return m_io_service;
}
bool Hive::HasStopped()
{
return ( boost::interprocess::ipcdetail::atomic_cas32( &m_shutdown, 1, 1 ) == 1 );
}
void Hive::Poll()
{
m_io_service.poll();
}
void Hive::Run()
{
m_io_service.run();
}
void Hive::Stop()
{
if( boost::interprocess::ipcdetail::atomic_cas32( &m_shutdown, 1, 0 ) == 0 )
{
m_work_ptr.reset();
m_io_service.run();
m_io_service.stop();
}
}
void Hive::Reset()
{
if( boost::interprocess::ipcdetail::atomic_cas32( &m_shutdown, 0, 1 ) == 1 )
{
m_io_service.reset();
m_work_ptr.reset( new boost::asio::io_service::work( m_io_service ) );
}
}
}
Hive::Hive()
:
m_work_ptr( new boost::asio::io_service::work( m_io_service ) ),
m_shutdown( 0 )
{
}
Hive::~Hive()
{
}
boost::asio::io_service& Hive::GetService()
{
return m_io_service;
}
bool Hive::HasStopped()
{
return ( boost::interprocess::ipcdetail::atomic_cas32( &m_shutdown, 1, 1 ) == 1 );
}
void Hive::Poll()
{
m_io_service.poll();
}
void Hive::Run()
{
m_io_service.run();
}
void Hive::Stop()
{
if( boost::interprocess::ipcdetail::atomic_cas32( &m_shutdown, 1, 0 ) == 0 )
{
m_work_ptr.reset();
m_io_service.run();
m_io_service.stop();
}
}
void Hive::Reset()
{
if( boost::interprocess::ipcdetail::atomic_cas32( &m_shutdown, 0, 1 ) == 1 )
{
m_io_service.reset();
m_work_ptr.reset( new boost::asio::io_service::work( m_io_service ) );
}
}
}
}

View file

@ -6,49 +6,52 @@
#include <boost/enable_shared_from_this.hpp>
namespace Core {
namespace Network {
namespace Network {
class Hive : public boost::enable_shared_from_this< Hive >
{
private:
boost::asio::io_service m_io_service;
boost::shared_ptr< boost::asio::io_service::work > m_work_ptr;
volatile uint32_t m_shutdown;
class Hive :
public boost::enable_shared_from_this< Hive >
{
private:
boost::asio::io_service m_io_service;
boost::shared_ptr< boost::asio::io_service::work > m_work_ptr;
volatile uint32_t m_shutdown;
private:
Hive( const Hive & rhs );
Hive & operator =( const Hive & rhs );
private:
Hive( const Hive& rhs );
public:
Hive();
virtual ~Hive();
Hive& operator=( const Hive& rhs );
// Returns the io_service of this object.
boost::asio::io_service & GetService();
public:
Hive();
// Returns true if the Stop function has been called.
bool HasStopped();
virtual ~Hive();
// Polls the networking subsystem once from the current thread and
// returns.
void Poll();
// Returns the io_service of this object.
boost::asio::io_service& GetService();
// Runs the networking system on the current thread. This function blocks
// until the networking system is stopped, so do not call on a single
// threaded application with no other means of being able to call Stop
// unless you code in such logic.
void Run();
// Returns true if the Stop function has been called.
bool HasStopped();
// Stops the networking system. All work is finished and no more
// networking interactions will be possible afterwards until Reset is called.
void Stop();
// Polls the networking subsystem once from the current thread and
// returns.
void Poll();
// Restarts the networking system after Stop as been called. A new work
// object is created ad the shutdown flag is cleared.
void Reset();
};
// Runs the networking system on the current thread. This function blocks
// until the networking system is stopped, so do not call on a single
// threaded application with no other means of being able to call Stop
// unless you code in such logic.
void Run();
}
// Stops the networking system. All work is finished and no more
// networking interactions will be possible afterwards until Reset is called.
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

View file

@ -10,81 +10,81 @@
#include <memory>
Core::Network::Packets::PacketContainer::PacketContainer( uint32_t segmentTargetOverride ) :
m_segmentTargetOverride( segmentTargetOverride )
m_segmentTargetOverride( segmentTargetOverride )
{
memset( &m_ipcHdr, 0, sizeof( FFXIVARR_PACKET_HEADER ) );
m_ipcHdr.size = sizeof( FFXIVARR_PACKET_HEADER );
m_ipcHdr.count = 0;
memset( &m_ipcHdr, 0, sizeof( FFXIVARR_PACKET_HEADER ) );
m_ipcHdr.size = sizeof( FFXIVARR_PACKET_HEADER );
m_ipcHdr.count = 0;
}
Core::Network::Packets::PacketContainer::~PacketContainer()
{
m_entryList.clear();
m_entryList.clear();
}
void Core::Network::Packets::PacketContainer::addPacket( Core::Network::Packets::FFXIVPacketBasePtr entry )
{
m_entryList.push_back( entry );
m_entryList.push_back( entry );
m_ipcHdr.size += entry->getSize();
m_ipcHdr.count++;
m_ipcHdr.size += entry->getSize();
m_ipcHdr.count++;
}
void Core::Network::Packets::PacketContainer::fillSendBuffer( std::vector< uint8_t >& sendBuffer )
{
std::vector< uint8_t > tempBuffer( m_ipcHdr.size );
memset( &tempBuffer[0], 0, m_ipcHdr.size );
std::vector< uint8_t > tempBuffer( m_ipcHdr.size );
memset( &tempBuffer[ 0 ], 0, m_ipcHdr.size );
using namespace std::chrono;
auto ms = duration_cast< milliseconds >( system_clock::now().time_since_epoch() );
uint64_t tick = ms.count();
m_ipcHdr.unknown_0 = 0xE2465DFF41a05252;
m_ipcHdr.unknown_8 = 0x75C4997B4D642A7F;
m_ipcHdr.timestamp = tick;
m_ipcHdr.unknown_20 = 1;
using namespace std::chrono;
auto ms = duration_cast< milliseconds >( system_clock::now().time_since_epoch() );
uint64_t tick = ms.count();
m_ipcHdr.unknown_0 = 0xE2465DFF41a05252;
m_ipcHdr.unknown_8 = 0x75C4997B4D642A7F;
m_ipcHdr.timestamp = tick;
m_ipcHdr.unknown_20 = 1;
memcpy( &tempBuffer[0], &m_ipcHdr, sizeof( FFXIVARR_PACKET_HEADER ) );
memcpy( &tempBuffer[ 0 ], &m_ipcHdr, sizeof( FFXIVARR_PACKET_HEADER ) );
auto it = m_entryList.begin();
std::size_t offset = 0;
auto it = m_entryList.begin();
std::size_t offset = 0;
if( m_entryList.size() > 1 )
offset = 0;
if( m_entryList.size() > 1 )
offset = 0;
for( ; it != m_entryList.end(); ++it )
{
auto pPacket = (*it);
for( ; it != m_entryList.end(); ++it )
{
auto pPacket = ( *it );
if( m_segmentTargetOverride != 0 && pPacket->getSegmentType() == SEGMENTTYPE_IPC )
{
pPacket->setTargetActor( m_segmentTargetOverride );
}
if( m_segmentTargetOverride != 0 && pPacket->getSegmentType() == SEGMENTTYPE_IPC )
{
pPacket->setTargetActor( m_segmentTargetOverride );
}
auto data = pPacket->getData();
memcpy( &tempBuffer[0] + sizeof( FFXIVARR_PACKET_HEADER ) + offset, &data[0], pPacket->getSize() );
offset += pPacket->getSize();
}
auto data = pPacket->getData();
memcpy( &tempBuffer[ 0 ] + sizeof( FFXIVARR_PACKET_HEADER ) + offset, &data[ 0 ], pPacket->getSize() );
offset += pPacket->getSize();
}
sendBuffer.assign( &tempBuffer[0], &tempBuffer[0] + m_ipcHdr.size );
sendBuffer.assign( &tempBuffer[ 0 ], &tempBuffer[ 0 ] + m_ipcHdr.size );
}
std::string Core::Network::Packets::PacketContainer::toString()
{
std::vector< uint8_t > tmpBuffer;
std::vector< uint8_t > tmpBuffer;
fillSendBuffer( tmpBuffer );
fillSendBuffer( tmpBuffer );
std::string str = "\n";
for( uint32_t i = 0; i < m_ipcHdr.size; i++ )
{
str += boost::str( boost::format( "%|02X|" ) % static_cast< int32_t >( tmpBuffer[i] & 0xFF ) ) + " ";
std::string str = "\n";
for( uint32_t i = 0; i < m_ipcHdr.size; i++ )
{
str += boost::str( boost::format( "%|02X|" ) % static_cast< int32_t >( tmpBuffer[ i ] & 0xFF ) ) + " ";
if( ( i + 1 ) % 16 == 0 )
str += "\n";
}
str += "\n";
if( ( i + 1 ) % 16 == 0 )
str += "\n";
}
str += "\n";
return str;
return str;
}

View file

@ -17,21 +17,22 @@ typedef boost::shared_ptr< FFXIVPacketBase > FFXIVPacketBasePtr;
class PacketContainer
{
public:
PacketContainer( uint32_t segmentTargetOverride = 0 );
~PacketContainer();
PacketContainer( uint32_t segmentTargetOverride = 0 );
void addPacket( FFXIVPacketBasePtr entry );
~PacketContainer();
FFXIVARR_PACKET_HEADER m_ipcHdr;
void addPacket( FFXIVPacketBasePtr entry );
std::vector< FFXIVPacketBasePtr > m_entryList;
FFXIVARR_PACKET_HEADER m_ipcHdr;
std::string toString();
std::vector< FFXIVPacketBasePtr > m_entryList;
void fillSendBuffer( std::vector< uint8_t >& sendBuffer );
std::string toString();
void fillSendBuffer( std::vector< uint8_t >& sendBuffer );
private:
uint32_t m_segmentTargetOverride;
uint32_t m_segmentTargetOverride;
};

View file

@ -13,25 +13,27 @@ namespace Server {
* Structural representation of the packet sent by the server as response
* to a tell request
*/
struct FFXIVIpcTell : FFXIVIpcBasePacket<Tell>
struct FFXIVIpcTell :
FFXIVIpcBasePacket< Tell >
{
uint32_t u1;
uint16_t u2a;
uint16_t u2b;
uint8_t preName;
uint8_t u3a;
uint8_t u3b; //Setting this to 1 seems to mark the tell as a GM tell (More research needed)
char receipientName[32];
char msg[1031];
uint32_t u1;
uint16_t u2a;
uint16_t u2b;
uint8_t preName;
uint8_t u3a;
uint8_t u3b; //Setting this to 1 seems to mark the tell as a GM tell (More research needed)
char receipientName[32];
char msg[1031];
};
/**
/**
* Structural representation of the packet sent by the server as response
* to a failed tell because of unavailable target player
*/
struct FFXIVIpcTellErrNotFound : FFXIVIpcBasePacket<TellErrNotFound>
struct FFXIVIpcTellErrNotFound :
FFXIVIpcBasePacket< TellErrNotFound >
{
char receipientName[32];
char receipientName[32];
};
} /* Server */

View file

@ -7,291 +7,296 @@ namespace Core {
namespace Network {
namespace Packets {
////////////////////////////////////////////////////////////////////////////////
/// Lobby Connection IPC Codes
/**
* Server IPC Lobby Type Codes.
*/
enum ServerLobbyIpcType : uint16_t
{
LobbyError = 0x0002,
LobbyServiceAccountList = 0x000C,
LobbyCharList = 0x000D,
LobbyCharCreate = 0x000E,
LobbyEnterWorld = 0x000F,
LobbyServerList = 0x0015,
LobbyRetainerList = 0x0017,
};
/**
* Client IPC Lobby Type Codes.
*/
enum ClientLobbyIpcType : uint16_t
{
ReqCharList = 0x0003,
ReqEnterWorld = 0x0004,
ReqServiceAccountList = 0x0005,
ReqCharDelete = 0x000A,
ReqCharCreate = 0x000B,
};
////////////////////////////////////////////////////////////////////////////////
/// Zone Connection IPC Codes
/**
* Server IPC Zone Type Codes.
*/
enum ServerZoneIpcType : uint16_t
{
// static opcode ( the ones that rarely, if ever, change )
Ping = 0x0065,
Init = 0x0066,
ActorFreeSpawn = 0x0191,
InitZone = 0x019A,
AddStatusEffect = 0x0141,
ActorControl142 = 0x0142,
ActorControl143 = 0x0143,
ActorControl144 = 0x0144,
UpdateHpMpTp = 0x0145,
///////////////////////////////////////////////////
ChatBanned = 0x006B,
Logout = 0x0077, // updated 4.3
CFNotify = 0x0078,
CFMemberStatus = 0x0079,
CFDutyInfo = 0x007A,
CFPlayerInNeed = 0x007F,
SocialRequestError = 0x00AD,
////////////////////////////////////////////////////////////////////////////////
/// Lobby Connection IPC Codes
/**
* Server IPC Lobby Type Codes.
*/
enum ServerLobbyIpcType :
uint16_t
{
LobbyError = 0x0002,
LobbyServiceAccountList = 0x000C,
LobbyCharList = 0x000D,
LobbyCharCreate = 0x000E,
LobbyEnterWorld = 0x000F,
LobbyServerList = 0x0015,
LobbyRetainerList = 0x0017,
};
/**
* Client IPC Lobby Type Codes.
*/
enum ClientLobbyIpcType :
uint16_t
{
ReqCharList = 0x0003,
ReqEnterWorld = 0x0004,
ReqServiceAccountList = 0x0005,
ReqCharDelete = 0x000A,
ReqCharCreate = 0x000B,
};
////////////////////////////////////////////////////////////////////////////////
/// Zone Connection IPC Codes
/**
* Server IPC Zone Type Codes.
*/
enum ServerZoneIpcType :
uint16_t
{
// static opcode ( the ones that rarely, if ever, change )
Ping = 0x0065,
Init = 0x0066,
ActorFreeSpawn = 0x0191,
InitZone = 0x019A,
AddStatusEffect = 0x0141,
ActorControl142 = 0x0142,
ActorControl143 = 0x0143,
ActorControl144 = 0x0144,
UpdateHpMpTp = 0x0145,
///////////////////////////////////////////////////
ChatBanned = 0x006B,
Logout = 0x0077, // updated 4.3
CFNotify = 0x0078,
CFMemberStatus = 0x0079,
CFDutyInfo = 0x007A,
CFPlayerInNeed = 0x007F,
SocialRequestError = 0x00AD,
CFRegistered = 0x00B8, // updated 4.1
SocialRequestResponse = 0x00BB, // updated 4.1
CancelAllianceForming = 0x00C6, // updated 4.2
CFRegistered = 0x00B8, // updated 4.1
SocialRequestResponse = 0x00BB, // updated 4.1
CancelAllianceForming = 0x00C6, // updated 4.2
Playtime = 0x00F5, // updated 4.3
Chat = 0x00F7, // updated 4.3
SocialList = 0x00FD, // updated 4.3
Playtime = 0x00F5, // updated 4.3
Chat = 0x00F7, // updated 4.3
SocialList = 0x00FD, // updated 4.3
UpdateSearchInfo = 0x0100, // updated 4.3
InitSearchInfo = 0x0101, // updated 4.3
UpdateSearchInfo = 0x0100, // updated 4.3
InitSearchInfo = 0x0101, // updated 4.3
ServerNotice = 0x0106, // updated 4.3
SetOnlineStatus = 0x0107, // updated 4.3
ServerNotice = 0x0106, // updated 4.3
SetOnlineStatus = 0x0107, // updated 4.3
CountdownInitiate = 0x0111, // updated 4.3
CountdownCancel = 0x0112, // updated 4.3
CountdownInitiate = 0x0111, // updated 4.3
CountdownCancel = 0x0112, // updated 4.3
BlackList = 0x0115, // updated 4.3
BlackList = 0x0115, // updated 4.3
LogMessage = 0x00D0,
LogMessage = 0x00D0,
LinkshellList = 0x011C, // updated 4.3
CharaFreeCompanyTag = 0x013B, // updated 4.3
FreeCompanyBoardMsg = 0x013C, // updated 4.3
FreeCompanyInfo = 0x013D, // updated 4.3
LinkshellList = 0x011C, // updated 4.3
CharaFreeCompanyTag = 0x013B, // updated 4.3
FreeCompanyBoardMsg = 0x013C, // updated 4.3
FreeCompanyInfo = 0x013D, // updated 4.3
StatusEffectList = 0x014E, // updated 4.3
Effect = 0x0151, // updated 4.3
AoeEffect8 = 0x0154, // updated 4.3
AoeEffect16 = 0x0155, // updated 4.3
AoeEffect24 = 0x0156, // updated 4.3
AoeEffect32 = 0x0157, // updated 4.3
PersistantEffect = 0x0158, // updated 4.3
StatusEffectList = 0x014E, // updated 4.3
Effect = 0x0151, // updated 4.3
AoeEffect8 = 0x0154, // updated 4.3
AoeEffect16 = 0x0155, // updated 4.3
AoeEffect24 = 0x0156, // updated 4.3
AoeEffect32 = 0x0157, // updated 4.3
PersistantEffect = 0x0158, // updated 4.3
GCAffiliation = 0x0162, // updated 4.3
GCAffiliation = 0x0162, // updated 4.3
PlayerSpawn = 0x0172, // updated 4.3
NpcSpawn = 0x0173, // updated 4.3
ActorMove = 0x0174, // updated 4.3
ActorSetPos = 0x0176, // updated 4.3
PlayerSpawn = 0x0172, // updated 4.3
NpcSpawn = 0x0173, // updated 4.3
ActorMove = 0x0174, // updated 4.3
ActorSetPos = 0x0176, // updated 4.3
ActorCast = 0x0178, // updated 4.3
ActorCast = 0x0178, // updated 4.3
PartyList = 0x017A, // updated 4.3
HateList = 0x017B, // updated 4.3
PartyList = 0x017A, // updated 4.3
HateList = 0x017B, // updated 4.3
ObjectSpawn = 0x017D, // updated 4.3
ObjectDespawn = 0x017E, // updated 4.3
ObjectSpawn = 0x017D, // updated 4.3
ObjectDespawn = 0x017E, // updated 4.3
SetLevelSync = 0x017F, // updated 4.3
SilentSetClassJob = 0x0180, // updated 4.3 - seems to be the case, not sure if it's actually used for anything
SetLevelSync = 0x017F, // updated 4.3
SilentSetClassJob = 0x0180, // updated 4.3 - seems to be the case, not sure if it's actually used for anything
InitUI = 0x0181, // updated 4.3
PlayerStats = 0x0182, // updated 4.3
ActorOwner = 0x0183, // updated 4.3 ?
PlayerStateFlags = 0x0184, // updated 4.3
PlayerClassInfo = 0x0185, // updated 4.3
ModelEquip = 0x0186, // updated 4.3
InitUI = 0x0181, // updated 4.3
PlayerStats = 0x0182, // updated 4.3
ActorOwner = 0x0183, // updated 4.3 ?
PlayerStateFlags = 0x0184, // updated 4.3
PlayerClassInfo = 0x0185, // updated 4.3
ModelEquip = 0x0186, // updated 4.3
UpdateClassInfo = 0x018A, // updated 4.3
UpdateClassInfo = 0x018A, // updated 4.3
ItemInfo = 0x0190, // updated 4.3
ContainerInfo = 0x0192, // updated 4.3
InventoryTransactionFinish = 0x0193, // updated 4.3
InventoryTransaction = 0x0194, // updated 4.3
CurrencyCrystalInfo = 0x0195, // updated 4.3
InventoryActionAck = 0x0197, // updated 4.3
UpdateInventorySlot = 0x0198, // updated 4.3
ItemInfo = 0x0190, // updated 4.3
ContainerInfo = 0x0192, // updated 4.3
InventoryTransactionFinish = 0x0193, // updated 4.3
InventoryTransaction = 0x0194, // updated 4.3
CurrencyCrystalInfo = 0x0195, // updated 4.3
InventoryActionAck = 0x0197, // updated 4.3
UpdateInventorySlot = 0x0198, // updated 4.3
EventPlay = 0x01A6, // updated 4.3
EventOpenGilShop = 0x01AD, // updated 4.3
DirectorPlayScene = 0x01AA, // updated 4.3
EventPlay = 0x01A6, // updated 4.3
EventOpenGilShop = 0x01AD, // updated 4.3
DirectorPlayScene = 0x01AA, // updated 4.3
EventStart = 0x01AF, // updated 4.3
EventFinish = 0x01B0, // updated 4.3
EventStart = 0x01AF, // updated 4.3
EventFinish = 0x01B0, // updated 4.3
EventLinkshell = 0x1169,
EventLinkshell = 0x1169,
QuestActiveList = 0x01C3, // updated 4.3
QuestUpdate = 0x01C4, // updated 4.3
QuestCompleteList = 0x01C5, // updated 4.3
QuestActiveList = 0x01C3, // updated 4.3
QuestUpdate = 0x01C4, // updated 4.3
QuestCompleteList = 0x01C5, // updated 4.3
QuestFinish = 0x01C6, // updated 4.3
MSQTrackerComplete = 0x01C7, // updated 4.3
MSQTrackerProgress = 0x01C8, // updated 4.3
QuestFinish = 0x01C6, // updated 4.3
MSQTrackerComplete = 0x01C7, // updated 4.3
MSQTrackerProgress = 0x01C8, // updated 4.3
QuestMessage = 0x01CE, // updated 4.3
QuestMessage = 0x01CE, // updated 4.3
QuestTracker = 0x01D3, // updated 4.3
QuestTracker = 0x01D3, // updated 4.3
Mount = 0x01E3, // updated 4.3
Mount = 0x01E3, // updated 4.3
DirectorVars = 0x01E5, // updated 4.3
DirectorVars = 0x01E5, // updated 4.3
CFAvailableContents = 0x01FD, // updated 4.2
CFAvailableContents = 0x01FD, // updated 4.2
WeatherChange = 0x0200, // updated 4.3
PlayerTitleList = 0x0201, // updated 4.3
Discovery = 0x0202, // updated 4.3
WeatherChange = 0x0200, // updated 4.3
PlayerTitleList = 0x0201, // updated 4.3
Discovery = 0x0202, // updated 4.3
EorzeaTimeOffset = 0x0204, // updated 4.3
EorzeaTimeOffset = 0x0204, // updated 4.3
EquipDisplayFlags = 0x0210, // updated 4.3
EquipDisplayFlags = 0x0210, // updated 4.3
WardInfo = 0x0224, // updated 4.3
WardHousingPermission = 0x022D, // updated 4.3
WardYardInfo = 0x022F, // updated 4.3
WardInfo = 0x0224, // updated 4.3
WardHousingPermission = 0x022D, // updated 4.3
WardYardInfo = 0x022F, // updated 4.3
DuelChallenge = 0x0277, // 4.2; this is responsible for opening the ui
PerformNote = 0x0286, // updated 4.3
DuelChallenge = 0x0277, // 4.2; this is responsible for opening the ui
PerformNote = 0x0286, // updated 4.3
PrepareZoning = 0x0291, // updated 4.3
ActorGauge = 0x0292, // updated 4.3
PrepareZoning = 0x0291, // updated 4.3
ActorGauge = 0x0292, // updated 4.3
// Unknown IPC types that still need to be sent
// TODO: figure all these out properly
IPCTYPE_UNK_320 = 0x024C, // updated 4.3
IPCTYPE_UNK_322 = 0x024E, // updated 4.3
// Unknown IPC types that still need to be sent
// TODO: figure all these out properly
IPCTYPE_UNK_320 = 0x024C, // updated 4.3
IPCTYPE_UNK_322 = 0x024E, // updated 4.3
};
};
/**
* Client IPC Zone Type Codes.
*/
enum ClientZoneIpcType :
uint16_t
{
/**
* Client IPC Zone Type Codes.
*/
enum ClientZoneIpcType : uint16_t
{
PingHandler = 0x0065, // unchanged 4.3
InitHandler = 0x0066, // unchanged 4.3
PingHandler = 0x0065, // unchanged 4.3
InitHandler = 0x0066, // unchanged 4.3
FinishLoadingHandler = 0x0069, // unchanged 4.3
FinishLoadingHandler = 0x0069, // unchanged 4.3
CFCommenceHandler = 0x006F,
CFCommenceHandler = 0x006F,
CFRegisterDuty = 0x0071,
CFRegisterRoulette = 0x0072,
PlayTimeHandler = 0x0073, // unchanged 4.3
LogoutHandler = 0x0074, // unchanged 4.3
CFDutyInfoHandler = 0x0078, // updated 4.2
CFRegisterDuty = 0x0071,
CFRegisterRoulette = 0x0072,
PlayTimeHandler = 0x0073, // unchanged 4.3
LogoutHandler = 0x0074, // unchanged 4.3
SocialReqSendHandler = 0x00AE, // updated 4.1
CreateCrossWorldLS = 0x00AF, // updated 4.3
CFDutyInfoHandler = 0x0078, // updated 4.2
ChatHandler = 0x00D3, // updated 4.3
SocialReqSendHandler = 0x00AE, // updated 4.1
CreateCrossWorldLS = 0x00AF, // updated 4.3
SocialListHandler = 0x00DB, // updated 4.3
ReqSearchInfoHandler = 0x00E0, // updated 4.3
SetSearchInfoHandler = 0x00DE, // updated 4.3
ChatHandler = 0x00D3, // updated 4.3
BlackListHandler = 0x00EC, // updated 4.3
PlayerSearchHandler = 0x00E2, // updated 4.2
SocialListHandler = 0x00DB, // updated 4.3
ReqSearchInfoHandler = 0x00E0, // updated 4.3
SetSearchInfoHandler = 0x00DE, // updated 4.3
LinkshellListHandler = 0x00F4, // updated 4.3
BlackListHandler = 0x00EC, // updated 4.3
PlayerSearchHandler = 0x00E2, // updated 4.2
SearchMarketboard = 0x0103, // updated 4.3
LinkshellListHandler = 0x00F4, // updated 4.3
FcInfoReqHandler = 0x011A, // updated 4.2
SearchMarketboard = 0x0103, // updated 4.3
ReqMarketWishList = 0x012C, // updated 4.3
FcInfoReqHandler = 0x011A, // updated 4.2
ReqJoinNoviceNetwork = 0x0129, // updated 4.2
ReqMarketWishList = 0x012C, // updated 4.3
ReqCountdownInitiate = 0x0138, // updated 4.3
ReqCountdownCancel = 0x0139, // updated 4.3
ClearWaymarks = 0x013A, // updated 4.3
ReqJoinNoviceNetwork = 0x0129, // updated 4.2
ZoneLineHandler = 0x013C, // updated 4.3
ClientTrigger = 0x013D, // updated 4.3
DiscoveryHandler = 0x013E, // updated 4.3
ReqCountdownInitiate = 0x0138, // updated 4.3
ReqCountdownCancel = 0x0139, // updated 4.3
ClearWaymarks = 0x013A, // updated 4.3
AddWaymark = 0x013F, // updated 4.3
ZoneLineHandler = 0x013C, // updated 4.3
ClientTrigger = 0x013D, // updated 4.3
DiscoveryHandler = 0x013E, // updated 4.3
SkillHandler = 0x0140, // updated 4.3
GMCommand1 = 0x0141, // updated 4.3
GMCommand2 = 0x0142, // updated 4.3
AddWaymark = 0x013F, // updated 4.3
UpdatePositionHandler = 0x0144, // updated 4.3
UpdatePositionInstance = 0x0183, // updated 4.3
SkillHandler = 0x0140, // updated 4.3
GMCommand1 = 0x0141, // updated 4.3
GMCommand2 = 0x0142, // updated 4.3
InventoryModifyHandler = 0x014B, // updated 4.3
UpdatePositionHandler = 0x0144, // updated 4.3
UpdatePositionInstance = 0x0183, // updated 4.3
TalkEventHandler = 0x0154, // updated 4.3
EmoteEventHandler = 0x0155, // updated 4.3
WithinRangeEventHandler = 0x0156, // updated 4.3
OutOfRangeEventHandler = 0x0157, // updated 4.3
EnterTeriEventHandler = 0x0158, // updated 4.3
InventoryModifyHandler = 0x014B, // updated 4.3
ReturnEventHandler = 0x015D, // updated 4.3
TradeReturnEventHandler = 0x015E, // updated 4.3
TalkEventHandler = 0x0154, // updated 4.3
EmoteEventHandler = 0x0155, // updated 4.3
WithinRangeEventHandler = 0x0156, // updated 4.3
OutOfRangeEventHandler = 0x0157, // updated 4.3
EnterTeriEventHandler = 0x0158, // updated 4.3
LinkshellEventHandler = 0x0150, // updated 4.1 ??
LinkshellEventHandler1 = 0x0151, // updated 4.1 ??
ReturnEventHandler = 0x015D, // updated 4.3
TradeReturnEventHandler = 0x015E, // updated 4.3
PerformNoteHandler = 0x029B, // updated 4.3
LinkshellEventHandler = 0x0150, // updated 4.1 ??
LinkshellEventHandler1 = 0x0151, // updated 4.1 ??
ReqEquipDisplayFlagsChange = 0x0178, // updated 4.3
PerformNoteHandler = 0x029B, // updated 4.3
ReqEquipDisplayFlagsChange = 0x0178, // updated 4.3
};
////////////////////////////////////////////////////////////////////////////////
/// Chat Connection IPC Codes
/**
* Server IPC Chat Type Codes.
*/
enum ServerChatIpcType :
uint16_t
{
Tell = 0x0064, // updated for sb
TellErrNotFound = 0x0066,
};
};
////////////////////////////////////////////////////////////////////////////////
/// Chat Connection IPC Codes
/**
* Server IPC Chat Type Codes.
*/
enum ServerChatIpcType : uint16_t
{
Tell = 0x0064, // updated for sb
TellErrNotFound = 0x0066,
};
/**
* Client IPC Chat Type Codes.
*/
enum ClientChatIpcType : uint16_t
{
TellReq = 0x0064,
};
/**
* Client IPC Chat Type Codes.
*/
enum ClientChatIpcType :
uint16_t
{
TellReq = 0x0064,
};
} /* Packets */

View file

@ -9,133 +9,140 @@ namespace Network {
namespace Packets {
namespace Server {
struct FFXIVIpcRetainerList : FFXIVIpcBasePacket<LobbyRetainerList>
struct FFXIVIpcRetainerList :
FFXIVIpcBasePacket< LobbyRetainerList >
{
uint8_t padding[0x210];
uint8_t padding[0x210];
};
/**
*/
struct FFXIVIpcServiceIdInfo : FFXIVIpcBasePacket<LobbyServiceAccountList>
struct FFXIVIpcServiceIdInfo :
FFXIVIpcBasePacket< LobbyServiceAccountList >
{
uint64_t seq;
uint8_t padding;
uint8_t numServiceAccounts;
uint8_t u1;
uint8_t u2;
uint32_t padding1;
uint64_t seq;
uint8_t padding;
uint8_t numServiceAccounts;
uint8_t u1;
uint8_t u2;
uint32_t padding1;
struct
{
uint32_t id;
uint32_t unknown;
uint32_t index;
char name[0x44];
} serviceAccount[8];
struct
{
uint32_t id;
uint32_t unknown;
uint32_t index;
char name[0x44];
} serviceAccount[8];
};
struct FFXIVIpcServerList : FFXIVIpcBasePacket<LobbyServerList>
struct FFXIVIpcServerList :
FFXIVIpcBasePacket< LobbyServerList >
{
uint64_t seq;
uint16_t final;
uint16_t offset;
uint32_t numServers;
uint32_t padding;
uint32_t padding1;
uint64_t seq;
uint16_t final;
uint16_t offset;
uint32_t numServers;
uint32_t padding;
uint32_t padding1;
struct
{
uint16_t id;
uint16_t index;
uint32_t flags; // 0x02 = World not accepting new characters
uint32_t padding1;
uint32_t icon; // 2 = bonus XP star
uint32_t padding2;
char name[0x40];
} server[6];
struct
{
uint16_t id;
uint16_t index;
uint32_t flags; // 0x02 = World not accepting new characters
uint32_t padding1;
uint32_t icon; // 2 = bonus XP star
uint32_t padding2;
char name[0x40];
} server[6];
};
struct FFXIVIpcCharList : FFXIVIpcBasePacket<LobbyCharList>
struct FFXIVIpcCharList :
FFXIVIpcBasePacket< LobbyCharList >
{
uint64_t seq;
uint8_t counter; // current packet count * 4, count * 4 +1 on last packet.
uint8_t numInPacket; // always 2??
uint16_t padding;
uint8_t unknown1;
uint8_t unknown2;
uint8_t unknown3;
uint8_t unknown4; // 0x80 in case of last packet
uint32_t unknown5[7];
uint8_t unknown6; // 0x80 in case of last packet
uint8_t veteranRank;
uint8_t unknown7;
uint8_t padding1;
uint32_t daysSubscribed;
uint32_t remainingDays;
uint32_t daysToNextRank;
uint16_t maxCharOnWorld;
uint16_t unknown8;
uint32_t entitledExpansion;
uint32_t padding2;
uint64_t seq;
uint8_t counter; // current packet count * 4, count * 4 +1 on last packet.
uint8_t numInPacket; // always 2??
uint16_t padding;
uint8_t unknown1;
uint8_t unknown2;
uint8_t unknown3;
uint8_t unknown4; // 0x80 in case of last packet
uint32_t unknown5[7];
uint8_t unknown6; // 0x80 in case of last packet
uint8_t veteranRank;
uint8_t unknown7;
uint8_t padding1;
uint32_t daysSubscribed;
uint32_t remainingDays;
uint32_t daysToNextRank;
uint16_t maxCharOnWorld;
uint16_t unknown8;
uint32_t entitledExpansion;
uint32_t padding2;
struct CharaDetails
{
uint32_t uniqueId;
uint32_t padding;
uint64_t contentId;
uint32_t index;
uint32_t padding2;
uint16_t serverId;
uint16_t serverId1;
char nameChara[32];
char nameServer[32];
char nameServer1[32];
char charDetailJson[1028];
} charaDetails[2];
struct CharaDetails
{
uint32_t uniqueId;
uint32_t padding;
uint64_t contentId;
uint32_t index;
uint32_t padding2;
uint16_t serverId;
uint16_t serverId1;
char nameChara[32];
char nameServer[32];
char nameServer1[32];
char charDetailJson[1028];
} charaDetails[2];
};
struct FFXIVIpcEnterWorld : FFXIVIpcBasePacket<LobbyEnterWorld>
struct FFXIVIpcEnterWorld :
FFXIVIpcBasePacket< LobbyEnterWorld >
{
uint64_t seq;
uint32_t charId;
uint32_t padding;
uint64_t contentId;
uint32_t padding2;
char sid[66];
uint16_t port;
char host[48];
uint64_t padding3;
uint64_t padding4;
uint64_t seq;
uint32_t charId;
uint32_t padding;
uint64_t contentId;
uint32_t padding2;
char sid[66];
uint16_t port;
char host[48];
uint64_t padding3;
uint64_t padding4;
};
struct FFXIVIpcCharCreate : FFXIVIpcBasePacket<LobbyCharCreate>
struct FFXIVIpcCharCreate :
FFXIVIpcBasePacket< LobbyCharCreate >
{
uint64_t seq;
uint8_t unknown;
uint8_t unknown_2;
uint8_t type;
uint8_t padding;
uint32_t unknown_3;
uint32_t unknown_4;
uint32_t unknown_5;
uint64_t content_id;
uint16_t unknown_7;
uint16_t unknown_8;
uint32_t unknown_9;
uint16_t unknown_10;
char name[32];
char world[32];
uint64_t seq;
uint8_t unknown;
uint8_t unknown_2;
uint8_t type;
uint8_t padding;
uint32_t unknown_3;
uint32_t unknown_4;
uint32_t unknown_5;
uint64_t content_id;
uint16_t unknown_7;
uint16_t unknown_8;
uint32_t unknown_9;
uint16_t unknown_10;
char name[32];
char world[32];
};
struct FFXIVIpcLobbyError : FFXIVIpcBasePacket<LobbyError>
struct FFXIVIpcLobbyError :
FFXIVIpcBasePacket< LobbyError >
{
uint64_t seq;
uint32_t error_id;
uint32_t param;
uint16_t message_id;
char message[516];
uint64_t seq;
uint32_t error_id;
uint32_t param;
uint16_t message_id;
char message[516];
};
}

View file

@ -9,160 +9,178 @@ namespace Network {
namespace Packets {
namespace Client {
struct FFXIVIpcGmCommand1 : FFXIVIpcBasePacket< GMCommand1 >
struct FFXIVIpcGmCommand1 :
FFXIVIpcBasePacket< GMCommand1 >
{
/* 0000 */ uint32_t commandId;
/* 0004 */ uint32_t param1;
/* 0008 */ uint32_t param2;
/* 000C */ uint8_t unknown_C[0xC];
/* 0018 */ uint32_t param3;
/* 0000 */ uint32_t commandId;
/* 0004 */ uint32_t param1;
/* 0008 */ uint32_t param2;
/* 000C */ uint8_t unknown_C[0xC];
/* 0018 */ uint32_t param3;
};
struct FFXIVIpcGmCommand2 : FFXIVIpcBasePacket< GMCommand2 >
struct FFXIVIpcGmCommand2 :
FFXIVIpcBasePacket< GMCommand2 >
{
/* 0000 */ uint32_t commandId;
/* 0004 */ char unk_4[0x10];
/* 0014 */ char param1[0x20];
/* 0000 */ uint32_t commandId;
/* 0004 */ char unk_4[0x10];
/* 0014 */ char param1[0x20];
};
struct FFXIVIpcClientTrigger : FFXIVIpcBasePacket< ClientTrigger >
struct FFXIVIpcClientTrigger :
FFXIVIpcBasePacket< ClientTrigger >
{
/* 0000 */ uint16_t commandId;
/* 0002 */ uint8_t unk_2[2];
/* 0004 */ uint32_t param11;
/* 0008 */ uint32_t param12;
/* 000C */ uint32_t param2;
/* 0010 */ char unk_10[8];
/* 0018 */ uint64_t param3;
/* 0000 */ uint16_t commandId;
/* 0002 */ uint8_t unk_2[2];
/* 0004 */ uint32_t param11;
/* 0008 */ uint32_t param12;
/* 000C */ uint32_t param2;
/* 0010 */ char unk_10[8];
/* 0018 */ uint64_t param3;
};
struct FFXIVIpcSkillHandler : FFXIVIpcBasePacket< SkillHandler >
struct FFXIVIpcSkillHandler :
FFXIVIpcBasePacket< SkillHandler >
{
/* 0000 */ char pad_0000[1];
/* 0001 */ uint8_t type;
/* 0002 */ char pad_0002[2];
/* 0004 */ uint32_t actionId;
/* 0008 */ uint32_t useCount;
/* 000C */ char pad_000C[4];
/* 0010 */ uint64_t targetId;
/* 0000 */ char pad_0000[1];
/* 0001 */ uint8_t type;
/* 0002 */ char pad_0002[2];
/* 0004 */ uint32_t actionId;
/* 0008 */ uint32_t useCount;
/* 000C */ char pad_000C[4];
/* 0010 */ uint64_t targetId;
};
struct FFXIVIpcZoneLineHandler : FFXIVIpcBasePacket< ZoneLineHandler >
struct FFXIVIpcZoneLineHandler :
FFXIVIpcBasePacket< ZoneLineHandler >
{
/* 0000 */ uint32_t zoneLineId;
/* 0000 */ uint32_t zoneLineId;
};
struct FFXIVIpcDiscoveryHandler : FFXIVIpcBasePacket< DiscoveryHandler >
struct FFXIVIpcDiscoveryHandler :
FFXIVIpcBasePacket< DiscoveryHandler >
{
/* 0000 */ uint32_t positionRef;
/* 0000 */ uint32_t positionRef;
};
struct FFXIVIpcEventHandlerReturn : FFXIVIpcBasePacket< ReturnEventHandler >
struct FFXIVIpcEventHandlerReturn :
FFXIVIpcBasePacket< ReturnEventHandler >
{
/* 0000 */ uint32_t eventId;
/* 0004 */ uint16_t scene;
/* 0006 */ uint16_t param1;
/* 0008 */ uint16_t param2;
/* 000A */ char pad_000A[2];
/* 000C */ uint16_t param3;
/* 000E */ char pad_000E[2];
/* 0010 */ uint16_t param4;
/* 0000 */ uint32_t eventId;
/* 0004 */ uint16_t scene;
/* 0006 */ uint16_t param1;
/* 0008 */ uint16_t param2;
/* 000A */ char pad_000A[2];
/* 000C */ uint16_t param3;
/* 000E */ char pad_000E[2];
/* 0010 */ uint16_t param4;
};
struct FFXIVIpcEnterTerritoryHandler : FFXIVIpcBasePacket< EnterTeriEventHandler >
struct FFXIVIpcEnterTerritoryHandler :
FFXIVIpcBasePacket< EnterTeriEventHandler >
{
/* 0000 */ uint32_t eventId;
/* 0004 */ uint16_t param1;
/* 0006 */ uint16_t param2;
/* 0000 */ uint32_t eventId;
/* 0004 */ uint16_t param1;
/* 0006 */ uint16_t param2;
};
struct FFXIVIpcEventHandlerOutsideRange : FFXIVIpcBasePacket< OutOfRangeEventHandler >
struct FFXIVIpcEventHandlerOutsideRange :
FFXIVIpcBasePacket< OutOfRangeEventHandler >
{
/* 0000 */ uint32_t param1;
/* 0004 */ uint32_t eventId;
/* 0008 */ Common::FFXIVARR_POSITION3 position;
/* 0000 */ uint32_t param1;
/* 0004 */ uint32_t eventId;
/* 0008 */ Common::FFXIVARR_POSITION3 position;
};
struct FFXIVIpcEventHandlerWithinRange : FFXIVIpcBasePacket< WithinRangeEventHandler >
struct FFXIVIpcEventHandlerWithinRange :
FFXIVIpcBasePacket< WithinRangeEventHandler >
{
/* 0000 */ uint32_t param1;
/* 0004 */ uint32_t eventId;
/* 0008 */ Common::FFXIVARR_POSITION3 position;
/* 0000 */ uint32_t param1;
/* 0004 */ uint32_t eventId;
/* 0008 */ Common::FFXIVARR_POSITION3 position;
};
struct FFXIVIpcEventHandlerEmote : FFXIVIpcBasePacket< EmoteEventHandler >
struct FFXIVIpcEventHandlerEmote :
FFXIVIpcBasePacket< EmoteEventHandler >
{
/* 0000 */ uint64_t actorId;
/* 0008 */ uint32_t eventId;
/* 000C */ uint16_t emoteId;
/* 0000 */ uint64_t actorId;
/* 0008 */ uint32_t eventId;
/* 000C */ uint16_t emoteId;
};
struct FFXIVIpcEventHandlerTalk : FFXIVIpcBasePacket< TalkEventHandler >
struct FFXIVIpcEventHandlerTalk :
FFXIVIpcBasePacket< TalkEventHandler >
{
/* 0000 */ uint64_t actorId;
/* 0008 */ uint32_t eventId;
/* 0000 */ uint64_t actorId;
/* 0008 */ uint32_t eventId;
};
struct FFXIVIpcPingHandler : FFXIVIpcBasePacket< PingHandler >
struct FFXIVIpcPingHandler :
FFXIVIpcBasePacket< PingHandler >
{
/* 0000 */ uint32_t timestamp; // maybe lol..
/* 0000 */ uint32_t timestamp; // maybe lol..
};
struct FFXIVIpcSetSearchInfo : FFXIVIpcBasePacket< SetSearchInfoHandler >
struct FFXIVIpcSetSearchInfo :
FFXIVIpcBasePacket< SetSearchInfoHandler >
{
union
{
/* 0000 */ uint64_t status;
struct
{
/* 0000 */ uint32_t status1;
/* 0004 */ uint32_t status2;
};
};
union
{
/* 0000 */ uint64_t status;
struct
{
/* 0000 */ uint32_t status1;
/* 0004 */ uint32_t status2;
};
};
/* 0008 */ char pad_0008[9];
/* 0011 */ Common::ClientLanguage language;
/* 0012 */ char searchComment[193];
/* 0008 */ char pad_0008[9];
/* 0011 */ Common::ClientLanguage language;
/* 0012 */ char searchComment[193];
};
struct FFXIVIpcTellHandler : FFXIVIpcBasePacket< TellReq >
struct FFXIVIpcTellHandler :
FFXIVIpcBasePacket< TellReq >
{
/* 0000 */ char pad_0000[4];
/* 0004 */ char targetPCName[32];
/* 0024 */ char message[1012];
/* 0000 */ char pad_0000[4];
/* 0004 */ char targetPCName[32];
/* 0024 */ char message[1012];
};
struct FFXIVIpcChatHandler : FFXIVIpcBasePacket< ChatHandler >
struct FFXIVIpcChatHandler :
FFXIVIpcBasePacket< ChatHandler >
{
/* 0000 */ char pad_0000[4];
/* 0004 */ uint32_t sourceId;
/* 0008 */ char pad_0008[16];
/* 0018 */ Common::ChatType chatType;
/* 001A */ char message[1012];
/* 0000 */ char pad_0000[4];
/* 0004 */ uint32_t sourceId;
/* 0008 */ char pad_0008[16];
/* 0018 */ Common::ChatType chatType;
/* 001A */ char message[1012];
};
struct FFXIVIpcLinkshellEventHandler : FFXIVIpcBasePacket< LinkshellEventHandler >
struct FFXIVIpcLinkshellEventHandler :
FFXIVIpcBasePacket< LinkshellEventHandler >
{
/* 0000 */ uint32_t eventId;
/* 0004 */ uint16_t scene;
/* 0006 */ char pad_0006[1];
/* 0007 */ char lsName[21];
/* 0000 */ uint32_t eventId;
/* 0004 */ uint16_t scene;
/* 0006 */ char pad_0006[1];
/* 0007 */ char lsName[21];
};
struct FFXIVIpcInventoryModifyHandler : FFXIVIpcBasePacket< InventoryModifyHandler >
struct FFXIVIpcInventoryModifyHandler :
FFXIVIpcBasePacket< InventoryModifyHandler >
{
/* 0000 */ uint32_t seq;
/* 0004 */ Common::InventoryOperation action;
/* 0005 */ char pad_0005[7];
/* 000C */ uint16_t fromContainer;
/* 000E */ char pad_000E[2];
/* 0010 */ uint8_t fromSlot;
/* 0011 */ char pad_0011[15];
/* 0020 */ uint16_t toContainer;
/* 0022 */ char pad_0022[2];
/* 0024 */ uint8_t toSlot;
/* 0025 */ uint8_t pad_0025[3];
/* 0028 */ uint32_t splitCount;
/* 0000 */ uint32_t seq;
/* 0004 */ Common::InventoryOperation action;
/* 0005 */ char pad_0005[7];
/* 000C */ uint16_t fromContainer;
/* 000E */ char pad_000E[2];
/* 0010 */ uint8_t fromSlot;
/* 0011 */ char pad_0011[15];
/* 0020 */ uint16_t toContainer;
/* 0022 */ char pad_0022[2];
/* 0024 */ uint8_t toSlot;
/* 0025 */ uint8_t pad_0025[3];
/* 0028 */ uint32_t splitCount;
};
}

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,5 @@
#pragma once
#include <memory>
#include <thread>
#include <mutex>
@ -7,118 +8,120 @@
namespace Core {
template<class T>
class LockedQueue
{
public:
LockedQueue();
~LockedQueue();
template< class T >
class LockedQueue
{
public:
LockedQueue();
T pop();
~LockedQueue();
//we can pass this in by reference, instead of copying
void push(const T object);
T pop();
//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);
//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();
std::size_t size();
protected:
std::queue<T> m_queue;
std::mutex m_mutex;
protected:
std::queue< T > m_queue;
std::mutex m_mutex;
};
};
template <class T>
LockedQueue<T>::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();
}
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.
boost::swap(object, default_ctored_object);
//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,
// this will allow that the object on the queue is the *last* shared_ptr
// in existance by the time this function returns.
}
template <class T>
void LockedQueue<T>::push_reset(T& object)
{
std::lock_guard<std::mutex> lock( m_mutex);
m_queue.push(object);
T default_ctored_object = T();
object.reset();
//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,
// this will allow that the object on the queue is the *last* shared_ptr
// in existance by the time this function returns.
}
template< class T >
LockedQueue< T >::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();
}
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.
boost::swap( object, default_ctored_object );
//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,
// this will allow that the object on the queue is the *last* shared_ptr
// in existance by the time this function returns.
}
template< class T >
void LockedQueue< T >::push_reset( T& object )
{
std::lock_guard< std::mutex > lock( m_mutex );
m_queue.push( object );
T default_ctored_object = T();
object.reset();
//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,
// this will allow that the object on the queue is the *last* shared_ptr
// in existance by the time this function returns.
}
}

View file

@ -8,90 +8,97 @@
#include <type_traits>
#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;
std::mutex m_queueLock;
std::queue< T > m_queue;
std::condition_variable m_condition;
std::atomic< bool > m_shutdown;
public:
LockedWaitQueue<T>() : m_shutdown(false) { }
LockedWaitQueue< T >() :
m_shutdown( false )
{
}
void push( const T& 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();
}
void cancel()
{
std::unique_lock< std::mutex > lock( m_queueLock );
while( !m_queue.empty() )
{
std::lock_guard< std::mutex > lock( m_queueLock );
m_queue.push( std::move( value ) );
T& value = m_queue.front();
m_condition.notify_one();
deleteQueuedObject( value );
m_queue.pop();
}
bool empty()
{
std::lock_guard< std::mutex > lock( m_queueLock );
m_shutdown = true;
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 );
m_queue.pop();
}
m_shutdown = true;
m_condition.notify_all();
}
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& obj )
{
delete obj;
}
template< typename E = T >
typename std::enable_if< !std::is_pointer< E >::value >::type deleteQueuedObject( E const& ) { }
template< typename E = T >
typename std::enable_if< !std::is_pointer< E >::value >::type deleteQueuedObject( E const& )
{
}
};
}

View file

@ -5,103 +5,102 @@
#include <unordered_map>
#include <type_traits>
namespace Core
namespace Core {
namespace Util {
template< typename T, typename ActorIdType = uint32_t >
class SpawnIndexAllocator
{
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" );
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() :
m_maxSlotId( 0 ),
m_reserveFirstSlot( false )
{ }
SpawnIndexAllocator() :
m_maxSlotId( 0 ),
m_reserveFirstSlot( false )
{
}
void init( T maxSlotId, bool reserveFirstSlot = false )
{
m_maxSlotId = maxSlotId;
m_reserveFirstSlot = reserveFirstSlot;
void init( T maxSlotId, bool reserveFirstSlot = false )
{
m_maxSlotId = maxSlotId;
m_reserveFirstSlot = reserveFirstSlot;
setupQueue();
setupQueue();
// todo: reserve max slot id in map to prevent any runtime reshashing
}
// todo: reserve max slot id in map to prevent any runtime reshashing
}
T freeUsedSpawnIndex( ActorIdType actorId )
{
auto it = m_actorIdToAllocatedMap.find( actorId );
if( it == m_actorIdToAllocatedMap.end() )
return 0;
T freeUsedSpawnIndex( ActorIdType actorId )
{
auto it = m_actorIdToAllocatedMap.find( actorId );
if( it == m_actorIdToAllocatedMap.end() )
return 0;
auto index = it->second;
m_availableIds.push( index );
m_actorIdToAllocatedMap.erase( it );
auto index = it->second;
m_availableIds.push( index );
m_actorIdToAllocatedMap.erase( it );
return index;
}
return index;
}
T getNextFreeSpawnIndex( ActorIdType actorId )
{
assert( m_maxSlotId != 0 );
T getNextFreeSpawnIndex( ActorIdType actorId )
{
assert( m_maxSlotId != 0 );
if( m_availableIds.empty() )
return getAllocFailId();
if( m_availableIds.empty() )
return getAllocFailId();
auto nextId = m_availableIds.front();
m_availableIds.pop();
auto nextId = m_availableIds.front();
m_availableIds.pop();
m_actorIdToAllocatedMap[actorId] = nextId;
m_actorIdToAllocatedMap[ actorId ] = nextId;
return nextId;
}
return nextId;
}
void freeAllSpawnIndexes()
{
setupQueue();
void freeAllSpawnIndexes()
{
setupQueue();
m_actorIdToAllocatedMap.clear();
}
m_actorIdToAllocatedMap.clear();
}
bool isSpawnIndexValid( T spawnIndex )
{
return spawnIndex != getAllocFailId();
}
bool isSpawnIndexValid( T spawnIndex )
{
return spawnIndex != getAllocFailId();
}
constexpr T getAllocFailId() const
{
return static_cast< T >( -1 );
}
constexpr T getAllocFailId() const
{
return static_cast< T >( -1 );
}
protected:
void setupQueue()
{
assert( m_maxSlotId != 0 );
protected:
void setupQueue()
{
assert( m_maxSlotId != 0 );
while( !m_availableIds.empty() )
m_availableIds.pop();
while( !m_availableIds.empty() )
m_availableIds.pop();
uint32_t start = 0;
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;
// 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 );
}
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;
std::queue< T > m_availableIds;
std::unordered_map< ActorIdType, T > m_actorIdToAllocatedMap;
T m_maxSlotId;
bool m_reserveFirstSlot;
};
T m_maxSlotId;
bool m_reserveFirstSlot;
};
}
}

View file

@ -4,102 +4,102 @@
std::string Core::Util::binaryToHexString( uint8_t* pBinData, uint16_t size )
{
std::string outStr;
std::string outStr;
for( uint32_t i = 0; i < size; i++ )
{
outStr += boost::str( boost::format( "%|02X|" ) % ( int32_t ) ( pBinData[i] & 0xFF ) );
}
for( uint32_t i = 0; i < size; i++ )
{
outStr += boost::str( boost::format( "%|02X|" ) % ( int32_t ) ( pBinData[ i ] & 0xFF ) );
}
return outStr;
return outStr;
}
std::string Core::Util::binaryToHexDump( uint8_t* pBinData, uint16_t size )
{
int bytesPerLine = 16;
constexpr char hexChars[] = "0123456789ABCDEF";
int bytesPerLine = 16;
constexpr char hexChars[] = "0123456789ABCDEF";
int offsetBlock = 8 + 3;
int byteBlock = offsetBlock + bytesPerLine * 3 + ( bytesPerLine - 1 ) / 8 + 2;
int lineLength = byteBlock + bytesPerLine + 1;
int offsetBlock = 8 + 3;
int byteBlock = offsetBlock + bytesPerLine * 3 + ( bytesPerLine - 1 ) / 8 + 2;
int lineLength = byteBlock + bytesPerLine + 1;
std::string line ( lineLength, ' ' );
int numLines = ( size + bytesPerLine - 1 ) / bytesPerLine;
std::string line( lineLength, ' ' );
int numLines = ( size + bytesPerLine - 1 ) / bytesPerLine;
std::string outStr;
std::string outStr;
for( uint32_t i = 0; i < size; i += bytesPerLine )
{
line[0] = hexChars[( i >> 28 ) & 0xF];
line[1] = hexChars[( i >> 24 ) & 0xF];
line[2] = hexChars[( i >> 20 ) & 0xF];
line[3] = hexChars[( i >> 16 ) & 0xF];
line[4] = hexChars[( i >> 12 ) & 0xF];
line[5] = hexChars[( i >> 8 ) & 0xF];
line[6] = hexChars[( i >> 4 ) & 0xF];
line[7] = hexChars[( i >> 0 ) & 0xF];
for( uint32_t i = 0; i < size; i += bytesPerLine )
{
line[ 0 ] = hexChars[ ( i >> 28 ) & 0xF ];
line[ 1 ] = hexChars[ ( i >> 24 ) & 0xF ];
line[ 2 ] = hexChars[ ( i >> 20 ) & 0xF ];
line[ 3 ] = hexChars[ ( i >> 16 ) & 0xF ];
line[ 4 ] = hexChars[ ( i >> 12 ) & 0xF ];
line[ 5 ] = hexChars[ ( i >> 8 ) & 0xF ];
line[ 6 ] = hexChars[ ( i >> 4 ) & 0xF ];
line[ 7 ] = hexChars[ ( i >> 0 ) & 0xF ];
int hexColumn = offsetBlock;
int charColumn = byteBlock;
int hexColumn = offsetBlock;
int charColumn = byteBlock;
for( int j = 0; j < bytesPerLine; j++ )
for( int j = 0; j < bytesPerLine; j++ )
{
if( j > 0 && ( j & 7 ) == 0 )
{
if( j > 0 && ( j & 7 ) == 0)
{
hexColumn++;
}
if( i + j >= size )
{
line[hexColumn] = ' ';
line[hexColumn + 1] = ' ';
line[charColumn] = ' ';
}
else
{
uint8_t by = pBinData[i + j];
line[hexColumn] = hexChars[( by >> 4 ) & 0xF];
line[hexColumn + 1] = hexChars[by & 0xF];
line[charColumn] = by < 32 ? '.' : static_cast< char >( by );
}
hexColumn += 3;
charColumn++;
hexColumn++;
}
outStr += line + "\n";
}
if( i + j >= size )
{
line[ hexColumn ] = ' ';
line[ hexColumn + 1 ] = ' ';
line[ charColumn ] = ' ';
}
else
{
uint8_t by = pBinData[ i + j ];
line[ hexColumn ] = hexChars[ ( by >> 4 ) & 0xF ];
line[ hexColumn + 1 ] = hexChars[ by & 0xF ];
line[ charColumn ] = by < 32 ? '.' : static_cast< char >( by );
}
return outStr;
hexColumn += 3;
charColumn++;
}
outStr += line + "\n";
}
return outStr;
}
uint64_t Core::Util::getTimeMs()
{
std::chrono::milliseconds epoch = std::chrono::duration_cast< std::chrono::milliseconds >
( std::chrono::system_clock::now().time_since_epoch() );
return epoch.count();
std::chrono::milliseconds epoch = std::chrono::duration_cast< std::chrono::milliseconds >
( std::chrono::system_clock::now().time_since_epoch() );
return epoch.count();
}
int64_t Core::Util::getTimeSeconds()
{
std::chrono::seconds epoch = std::chrono::seconds( std::time( nullptr ) );
return epoch.count();
std::chrono::seconds epoch = std::chrono::seconds( std::time( nullptr ) );
return epoch.count();
}
uint64_t Core::Util::getEorzeanTimeStamp()
{
return static_cast< uint64_t >( getTimeSeconds() * 20.571428571428573f );
return static_cast< uint64_t >( getTimeSeconds() * 20.571428571428573f );
}
void Core::Util::valueToFlagByteIndexValue( uint32_t inVal, uint8_t& outVal, uint16_t& outIndex )
{
uint32_t id = inVal;
outIndex = id / 8;
uint8_t bitIndex = id % 8;
uint32_t id = inVal;
outIndex = id / 8;
uint8_t bitIndex = id % 8;
outVal = 1 << bitIndex;
outVal = 1 << bitIndex;
}

View file

@ -3,69 +3,69 @@
float Core::Math::Util::distanceSq( float x, float y, float z, float x1, float y1, float z1 )
{
float deltaX = x - x1;
float deltaY = y - y1;
float deltaZ = z - z1;
float deltaX = x - x1;
float deltaY = y - y1;
float deltaZ = z - z1;
return ( deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ );
return ( deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ );
}
float Core::Math::Util::distance( float x, float y, float z, float x1, float y1, float z1 )
{
return sqrtf( distanceSq( x, y, z, x1, y1, z1 ) );
return sqrtf( distanceSq( x, y, z, x1, y1, z1 ) );
}
float Core::Math::Util::distance2DSq( float x, float y, float x1, float y1 )
{
float deltaX = x - x1;
float deltaY = y - y1;
return ( deltaX * deltaX + deltaY * deltaY );
float deltaX = x - x1;
float deltaY = y - y1;
return ( deltaX * deltaX + deltaY * deltaY );
}
float Core::Math::Util::distance2D( float x, float y, float x1, float y1 )
{
return sqrtf( distance2DSq( x, y, x1, y1 ) );
return sqrtf( distance2DSq( x, y, x1, y1 ) );
}
float Core::Math::Util::calcAngTo( float x, float y, float x1, float y1 )
{
float dx = x - x1;
float dy = y - y1;
if( dy != 0.0f )
{
return atan2( dy, dx );
}
else
{
return 0.0f;
}
float dx = x - x1;
float dy = y - y1;
if( dy != 0.0f )
{
return atan2( dy, dx );
}
else
{
return 0.0f;
}
}
float Core::Math::Util::calcAngFrom( float x, float y, float x1, float y1 )
{
float dx = x - x1;
float dy = y - y1;
if( dy != 0.0f )
{
return atan2( dy, dx );
}
else
{
return 0.0f;
}
float dx = x - x1;
float dy = y - y1;
if( dy != 0.0f )
{
return atan2( dy, dx );
}
else
{
return 0.0f;
}
}
uint16_t Core::Math::Util::floatToUInt16( float val )
{
return static_cast< uint16_t >( 0x8000 + val * 32.767f );
return static_cast< uint16_t >( 0x8000 + val * 32.767f );
}
uint16_t Core::Math::Util::floatToUInt16Rot( float val )
{
return static_cast< uint16_t >( 0x8000 * ( ( val + PI ) ) / PI );
return static_cast< uint16_t >( 0x8000 * ( ( val + PI ) ) / PI );
}
uint8_t Core::Math::Util::floatToUInt8Rot( float val )
{
return static_cast< uint8_t >( 0x80 * ( ( val + PI ) ) / PI );
return static_cast< uint8_t >( 0x80 * ( ( val + PI ) ) / PI );
}

View file

@ -22,24 +22,26 @@ 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>
< typename T >
T clamp( T val, T minimum, T maximum )
{
if (val > maximum)
{
return maximum;
}
if( val > maximum )
{
return maximum;
}
if (val < minimum)
{
return minimum;
}
if( val < minimum )
{
return minimum;
}
return val;
return val;
}
}
}

View file

@ -4,12 +4,12 @@
#include <string>
namespace Core {
namespace Version {
namespace Version {
extern const std::string GIT_HASH;
extern const std::string VERSION;
extern const std::string GIT_HASH;
extern const std::string VERSION;
} /* Version */
} /* Version */
} /* Core */
#endif

View file

@ -2,14 +2,17 @@
#include "../ScriptObject.h"
#include <Actor/Player.h>
class ActionReturn6 : public ActionScript
class ActionReturn6 :
public ActionScript
{
public:
ActionReturn6() : ActionScript( 6 )
{}
ActionReturn6() :
ActionScript( 6 )
{
}
void onCastFinish( Core::Entity::Player& player, Core::Entity::Chara& targetActor ) override
{
player.returnToHomepoint();
}
void onCastFinish( Core::Entity::Player& player, Core::Entity::Chara& targetActor ) override
{
player.returnToHomepoint();
}
};

View file

@ -1,14 +1,17 @@
#include <ScriptObject.h>
#include <Actor/Player.h>
class ActionSprint3 : public ActionScript
class ActionSprint3 :
public ActionScript
{
public:
ActionSprint3() : ActionScript( 3 )
{}
ActionSprint3() :
ActionScript( 3 )
{
}
void onCastFinish( Core::Entity::Player& player, Core::Entity::Chara& targetActor ) override
{
player.addStatusEffectByIdIfNotExist( 50, 20000, player, 30 );
}
void onCastFinish( Core::Entity::Player& player, Core::Entity::Chara& targetActor ) override
{
player.addStatusEffectByIdIfNotExist( 50, 20000, player, 30 );
}
};

View file

@ -10,37 +10,41 @@
#define AETHERYTE_MENU_FAVORITE_POINT 4
#define AETHERYTE_MENU_FAVORITE_POINT_SECURITY_TOKEN 5
class Aethernet : public EventScript
class Aethernet :
public EventScript
{
public:
Aethernet() : EventScript( EVENTSCRIPT_AETHERNET_ID )
{}
Aethernet() :
EventScript( EVENTSCRIPT_AETHERNET_ID )
{
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
if( player.isAetheryteRegistered( eventId & 0xFFFF ) )
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
if( player.isAetheryteRegistered( eventId & 0xFFFF ) )
{
player.playScene( eventId, 2, 0, []( Entity::Player& player, const Event::SceneResult& result )
{
player.playScene( eventId, 2, 0, []( Entity::Player& player, const Event::SceneResult& result )
{
if( result.param1 == 256 )
{
player.teleport( result.param2, 2 );
}
} );
}
else
{
player.eventActionStart( eventId, ACTION_ATTUNE, []( Entity::Player& player, uint32_t eventId, uint64_t additional )
{
player.registerAetheryte( eventId & 0xFFFF );
player.playScene( eventId, 3, 0, 0, 0 );
},
[] ( Entity::Player& ply, uint32_t evntId, uint64_t additional )
{
if( result.param1 == 256 )
{
player.teleport( result.param2, 2 );
}
} );
}
else
{
player.eventActionStart( eventId, ACTION_ATTUNE,
[]( Entity::Player& player, uint32_t eventId, uint64_t additional )
{
player.registerAetheryte( eventId & 0xFFFF );
player.playScene( eventId, 3, 0, 0, 0 );
},
[]( Entity::Player& ply, uint32_t evntId, uint64_t additional )
{
}, 0 );
}, 0 );
}
}
}
}
};

View file

@ -12,58 +12,63 @@
#define AETHERYTE_MENU_FAVORITE_POINT 4
#define AETHERYTE_MENU_FAVORITE_POINT_SECURITY_TOKEN 5
class Aetheryte : public EventScript
class Aetheryte :
public EventScript
{
public:
Aetheryte() : EventScript( EVENTSCRIPT_AETHERYTE_ID )
{}
Aetheryte() :
EventScript( EVENTSCRIPT_AETHERYTE_ID )
{
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
if( player.isAetheryteRegistered( eventId & 0xFFFF ) )
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
if( player.isAetheryteRegistered( eventId & 0xFFFF ) )
{
player.playScene( eventId, 0, 1, []( Entity::Player& player, const Event::SceneResult& result )
{
player.playScene( eventId, 0, 1, []( Entity::Player& player, const Event::SceneResult& result )
{
if( result.param1 == 256 ) // set homepoint
{
player.setHomepoint( result.eventId & 0xFFFF );
player.sendQuestMessage( result.eventId, 2, 0xEA, 0, 0 );
} else if( result.param1 == 512 ) // aethernet access
{
if( result.param2 == 4 )
{
player.teleport( result.param3, 2 );
}
else if( result.param2 == 2 ) // register favored destination
{
if( result.param1 == 256 ) // set homepoint
{
player.setHomepoint( result.eventId & 0xFFFF );
player.sendQuestMessage( result.eventId, 2, 0xEA, 0, 0 );
}
else if( result.param1 == 512 ) // aethernet access
{
if( result.param2 == 4 )
{
player.teleport( result.param3, 2 );
}
else if( result.param2 == 2 ) // register favored destination
{
}
}
// else if( param2 == 0xC3E1 ) // register free destination
// {
//
// }
}
} );
}
else
{
player.eventActionStart( eventId, ACTION_ATTUNE, []( Entity::Player& player, uint32_t eventId, uint64_t additional )
{
player.registerAetheryte( eventId & 0xFFFF );
}
} );
}
else
{
player.eventActionStart( eventId, ACTION_ATTUNE,
[]( Entity::Player& player, uint32_t eventId, uint64_t additional )
{
player.registerAetheryte( eventId & 0xFFFF );
if( player.isActionLearned( ACTION_TELEPORT ) )
{
player.sendQuestMessage( eventId, 0, 2, 0, 0 );
}
else
{
player.sendQuestMessage( eventId, 0, 1, 1, 0 );
player.learnAction( ACTION_TELEPORT );
}
},
[] ( Entity::Player& player, uint32_t eventId, uint64_t additional )
{}, 0 );
}
}
if( player.isActionLearned( ACTION_TELEPORT ) )
{
player.sendQuestMessage( eventId, 0, 2, 0, 0 );
}
else
{
player.sendQuestMessage( eventId, 0, 1, 1, 0 );
player.learnAction( ACTION_TELEPORT );
}
},
[]( Entity::Player& player, uint32_t eventId, uint64_t additional )
{}, 0 );
}
}
};

View file

@ -1,37 +1,40 @@
#include <ScriptObject.h>
#include <Actor/Player.h>
class CmnDefCutSceneReplay : public EventScript
class CmnDefCutSceneReplay :
public EventScript
{
public:
CmnDefCutSceneReplay() : EventScript( 721028 )
{}
CmnDefCutSceneReplay() :
EventScript( 721028 )
{
}
void Scene00000( Entity::Player& player )
{
auto callback = [this]( Entity::Player& player, const Event::SceneResult& result )
void Scene00000( Entity::Player& player )
{
auto callback = [ this ]( Entity::Player& player, const Event::SceneResult& result )
{
if( result.param2 != 0 )
{
if( result.param2 != 0 )
{
Scene00001( player, result.param2 );
}
};
Scene00001( player, result.param2 );
}
};
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 1, callback );
}
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 1, callback );
}
void Scene00001( Entity::Player& player, uint16_t returnScene )
{
auto callback = []( Entity::Player& player, const Event::SceneResult& result )
{
// todo: this is fucked
};
void Scene00001( Entity::Player& player, uint16_t returnScene )
{
auto callback = []( Entity::Player& player, const Event::SceneResult& result )
{
// todo: this is fucked
};
player.playScene( getId(), 1, 0xFB2EC8F8, 0, 1, returnScene, callback );
}
player.playScene( getId(), 1, 0xFB2EC8F8, 0, 1, returnScene, callback );
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
Scene00000( player );
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
Scene00000( player );
}
};

View file

@ -1,19 +1,22 @@
#include <ScriptObject.h>
#include <Actor/Player.h>
class CmnDefHousingSignboard : public EventScript
class CmnDefHousingSignboard :
public EventScript
{
public:
CmnDefHousingSignboard() : EventScript( 721031 )
{}
CmnDefHousingSignboard() :
EventScript( 721031 )
{
}
void Scene00000( Entity::Player& player )
{
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 1 );
}
void Scene00000( Entity::Player& player )
{
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 1 );
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
Scene00000( player );
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
Scene00000( player );
}
};

View file

@ -1,57 +1,60 @@
#include <ScriptObject.h>
#include <Actor/Player.h>
class CmnDefInnBed : public EventScript
class CmnDefInnBed :
public EventScript
{
public:
CmnDefInnBed() : EventScript( 720916 )
{}
CmnDefInnBed() :
EventScript( 720916 )
{
}
// menu
void Scene00000( Entity::Player& player )
{
auto callback = [this]( Entity::Player& player, const Event::SceneResult& result )
{
if( result.param2 > 0 )
Scene00001( player, result.param2 );
};
// menu
void Scene00000( Entity::Player& player )
{
auto callback = [ this ]( Entity::Player& player, const Event::SceneResult& result )
{
if( result.param2 > 0 )
Scene00001( player, result.param2 );
};
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 1, callback );
}
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 1, callback );
}
// lay down
void Scene00001( Entity::Player& player, uint16_t param )
{
auto callback = [this]( Entity::Player& player, const Event::SceneResult& result )
{
Scene00002( player, result.param2 );
};
// lay down
void Scene00001( Entity::Player& player, uint16_t param )
{
auto callback = [ this ]( Entity::Player& player, const Event::SceneResult& result )
{
Scene00002( player, result.param2 );
};
player.playScene( getId(), 1, 0xF32E48F8, 0, 1, param, callback );
}
player.playScene( getId(), 1, 0xF32E48F8, 0, 1, param, callback );
}
// logout
void Scene00002( Entity::Player& player, uint16_t param )
{
player.playScene( getId(), 2, 0xF32E48F8, 0, 1, param, nullptr );
}
// logout
void Scene00002( Entity::Player& player, uint16_t param )
{
player.playScene( getId(), 2, 0xF32E48F8, 0, 1, param, nullptr );
}
// wake up
void Scene00100( Entity::Player& player )
{
auto callback = []( Entity::Player& player, const Event::SceneResult& result )
{ };
// wake up
void Scene00100( Entity::Player& player )
{
auto callback = []( Entity::Player& player, const Event::SceneResult& result )
{};
player.playScene( getId(), 100, 0x800, 0, 0, callback );
}
player.playScene( getId(), 100, 0x800, 0, 0, callback );
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
Scene00000( player );
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
Scene00000( player );
}
void onEnterTerritory( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override
{
Scene00100( player );
}
void onEnterTerritory( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override
{
Scene00100( player );
}
};

View file

@ -5,55 +5,58 @@
#define ACTION_RENAME 3
#define ACTION_REMOVE 4
class CmnDefLinkShell : public EventScript
class CmnDefLinkShell :
public EventScript
{
public:
CmnDefLinkShell() : EventScript( 0xB0006 )
{}
CmnDefLinkShell() :
EventScript( 0xB0006 )
{
}
void Scene00001( Entity::Player& player )
{
auto callback = [this]( Entity::Player& player, const Event::SceneResult& result )
void Scene00001( Entity::Player& player )
{
auto callback = [ this ]( Entity::Player& player, const Event::SceneResult& result )
{
switch( result.param2 )
{
switch( result.param2 )
{
case ACTION_CREATE:
Scene00002( player );
break;
case ACTION_CREATE:
Scene00002( player );
break;
case ACTION_RENAME:
Scene00003( player );
break;
case ACTION_RENAME:
Scene00003( player );
break;
case ACTION_REMOVE:
Scene00004( player );
break;
}
};
case ACTION_REMOVE:
Scene00004( player );
break;
}
};
player.playScene( getId(), 1, 0, 0, 0, callback );
}
player.playScene( getId(), 1, 0, 0, 0, callback );
}
// create linkshell
void Scene00002( Entity::Player& player )
{
player.playScene( getId(), 2, 0, 0, 0 );
}
// create linkshell
void Scene00002( Entity::Player& player )
{
player.playScene( getId(), 2, 0, 0, 0 );
}
// rename linkshell
void Scene00003( Entity::Player& player )
{
player.playScene( getId(), 3, 0, 0, 0 );
}
// rename linkshell
void Scene00003( Entity::Player& player )
{
player.playScene( getId(), 3, 0, 0, 0 );
}
// remove linkshell
void Scene00004( Entity::Player& player )
{
player.playScene( getId(), 4, 0, 0, 0 );
}
// remove linkshell
void Scene00004( Entity::Player& player )
{
player.playScene( getId(), 4, 0, 0, 0 );
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
Scene00001( player );
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
Scene00001( player );
}
};

View file

@ -1,19 +1,22 @@
#include <ScriptObject.h>
#include <Actor/Player.h>
class CmnDefMarketBoardGridania : public EventScript
class CmnDefMarketBoardGridania :
public EventScript
{
public:
CmnDefMarketBoardGridania() : EventScript( 0xB0027 )
{}
CmnDefMarketBoardGridania() :
EventScript( 0xB0027 )
{
}
void Scene00000( Entity::Player& player )
{
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 1 );
}
void Scene00000( Entity::Player& player )
{
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 1 );
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
Scene00000( player );
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
Scene00000( player );
}
};

View file

@ -1,22 +1,25 @@
#include <ScriptObject.h>
#include <Actor/Player.h>
class CmnDefMogLetter : public EventScript
class CmnDefMogLetter :
public EventScript
{
public:
CmnDefMogLetter() : EventScript( 720898 )
{}
CmnDefMogLetter() :
EventScript( 720898 )
{
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
Scene00000( player );
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
Scene00000( player );
}
void Scene00000( Entity::Player& player )
{
player.playScene( getId(), 0, 0,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
} );
}
void Scene00000( Entity::Player& player )
{
player.playScene( getId(), 0, 0,
[ & ]( Entity::Player& player, const Event::SceneResult& result )
{
} );
}
};

View file

@ -1,19 +1,22 @@
#include <ScriptObject.h>
#include <Actor/Player.h>
class CmnDefNpcRepair : public EventScript
class CmnDefNpcRepair :
public EventScript
{
public:
CmnDefNpcRepair() : EventScript( 0xB0013 )
{}
CmnDefNpcRepair() :
EventScript( 0xB0013 )
{
}
void Scene00000( Entity::Player& player )
{
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 1 );
}
void Scene00000( Entity::Player& player )
{
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 1 );
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
Scene00000( player );
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
Scene00000( player );
}
};

View file

@ -1,22 +1,25 @@
#include <ScriptObject.h>
#include <Actor/Player.h>
class CmnDefWeatherForeCast : public EventScript
class CmnDefWeatherForeCast :
public EventScript
{
public:
CmnDefWeatherForeCast() : EventScript( 721100 )
{}
CmnDefWeatherForeCast() :
EventScript( 721100 )
{
}
void Scene00000( Entity::Player& player )
{
player.playScene( getId(), 0, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
} );
}
void Scene00000( Entity::Player& player )
{
player.playScene( getId(), 0, HIDE_HOTBAR,
[ & ]( Entity::Player& player, const Event::SceneResult& result )
{
} );
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
Scene00000( player );
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
Scene00000( player );
}
};

View file

@ -1,19 +1,22 @@
#include <ScriptObject.h>
#include <Actor/Player.h>
class ComDefMobHuntBoard : public EventScript
class ComDefMobHuntBoard :
public EventScript
{
public:
ComDefMobHuntBoard() : EventScript( 0xB00CA )
{}
ComDefMobHuntBoard() :
EventScript( 0xB00CA )
{
}
void Scene00000( Entity::Player& player )
{
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 1 );
}
void Scene00000( Entity::Player& player )
{
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 1 );
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
Scene00000( player );
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
Scene00000( player );
}
};

View file

@ -1,48 +1,51 @@
#include <ScriptObject.h>
#include <Actor/Player.h>
class GilShop : public EventScript
class GilShop :
public EventScript
{
public:
GilShop() : EventScript( 0x00040001 )
{}
GilShop() :
EventScript( 0x00040001 )
{
}
constexpr static auto SCENE_FLAGS = HIDE_HOTBAR | NO_DEFAULT_CAMERA;
constexpr static auto SCENE_FLAGS = HIDE_HOTBAR | NO_DEFAULT_CAMERA;
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
player.playScene( eventId, 0, SCENE_FLAGS, 0, 2, shopCallback );
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
player.playScene( eventId, 0, SCENE_FLAGS, 0, 2, shopCallback );
}
private:
static void shopInteractionCallback( Entity::Player& player, const Event::SceneResult& result )
{
// item purchase
if( result.param1 == 768 )
static void shopInteractionCallback( Entity::Player& player, const Event::SceneResult& result )
{
// item purchase
if( result.param1 == 768 )
{
// buy
if( result.param2 == 1 )
{
// buy
if( result.param2 == 1 )
{
}
// sell
else if( result.param2 == 2 )
{
}
player.sendDebug( "got tradeQuantity: " + std::to_string( result.param4 ) );
player.playGilShop( result.eventId, SCENE_FLAGS, shopInteractionCallback );
return;
}
// exit
player.playScene( result.eventId, 255, SCENE_FLAGS );
}
// sell
else if( result.param2 == 2 )
{
static void shopCallback( Entity::Player& player, const Event::SceneResult& result )
{
}
player.sendDebug( "got tradeQuantity: " + std::to_string( result.param4 ) );
player.playGilShop( result.eventId, SCENE_FLAGS, shopInteractionCallback );
}
return;
}
// exit
player.playScene( result.eventId, 255, SCENE_FLAGS );
}
static void shopCallback( Entity::Player& player, const Event::SceneResult& result )
{
player.playGilShop( result.eventId, SCENE_FLAGS, shopInteractionCallback );
}
};

View file

@ -1,19 +1,22 @@
#include <ScriptObject.h>
#include <Actor/Player.h>
class HouFurOrchestrion : public EventScript
class HouFurOrchestrion :
public EventScript
{
public:
HouFurOrchestrion() : EventScript( 721226 )
{}
HouFurOrchestrion() :
EventScript( 721226 )
{
}
void Scene00000( Entity::Player& player )
{
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 1 );
}
void Scene00000( Entity::Player& player )
{
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 1 );
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
Scene00000( player );
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
Scene00000( player );
}
};

View file

@ -1,40 +1,50 @@
#include <ScriptObject.h>
#include <Zone/InstanceContent.h>
class AkhAfahAmphitheatreExtreme : public InstanceContentScript
class AkhAfahAmphitheatreExtreme :
public InstanceContentScript
{
public:
AkhAfahAmphitheatreExtreme() : InstanceContentScript( 20025 )
{ }
AkhAfahAmphitheatreExtreme() :
InstanceContentScript( 20025 )
{
}
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "unknown_0", 2004238, 4772738, 4, { -1.210436f, 0.000000f, -0.715586f }, 1.000000f, 0.000000f );
instance->registerEObj( "sgvf_r1fc_b0472", 2004239, 4797573, 4, { 1.181316f, -0.000000f, 1.563968f }, 1.000000f, 0.000000f );
// States -> wind_def wind_def_anim wind_pop wind_pop_anim
instance->registerEObj( "sgvf_r1fc_b0471", 2004240, 4841629, 4, { 11.000000f, 0.000000f, -11.000000f }, 1.000000f, 0.793709f );
// States -> magi_def magi_def_anim magi_pop magi_pop_anim
instance->registerEObj( "sgvf_r1fc_b0471_1", 2004349, 4841631, 4, { 12.811310f, -0.000000f, 9.376424f }, 1.000000f, 0.000000f );
// States -> magi_def magi_def_anim magi_pop magi_pop_anim
instance->registerEObj( "sgvf_r1fc_b0471_2", 2004350, 4841632, 4, { -8.033875f, 0.000000f, 10.406790f }, 1.000000f, 0.000000f );
// States -> magi_def magi_def_anim magi_pop magi_pop_anim
instance->registerEObj( "sgvf_r1fc_b0471_3", 2004351, 4841633, 4, { -8.319038f, -0.000001f, -10.997720f }, 1.000000f, 0.000000f );
// States -> magi_def magi_def_anim magi_pop magi_pop_anim
instance->registerEObj( "Entrance", 2000182, 4738599, 5, { 9.717670f, 0.000000f, 14.522430f }, 1.000000f, 0.000000f );
// States -> vf_lock_on vf_lock_of
instance->registerEObj( "Exit", 2000139, 0, 4, { 0.000000f, 0.000000f, -15.000000f }, 1.000000f, 0.000000f );
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "unknown_0", 2004238, 4772738, 4, { -1.210436f, 0.000000f, -0.715586f }, 1.000000f,
0.000000f );
instance->registerEObj( "sgvf_r1fc_b0472", 2004239, 4797573, 4, { 1.181316f, -0.000000f, 1.563968f }, 1.000000f,
0.000000f );
// States -> wind_def wind_def_anim wind_pop wind_pop_anim
instance->registerEObj( "sgvf_r1fc_b0471", 2004240, 4841629, 4, { 11.000000f, 0.000000f, -11.000000f }, 1.000000f,
0.793709f );
// States -> magi_def magi_def_anim magi_pop magi_pop_anim
instance->registerEObj( "sgvf_r1fc_b0471_1", 2004349, 4841631, 4, { 12.811310f, -0.000000f, 9.376424f }, 1.000000f,
0.000000f );
// States -> magi_def magi_def_anim magi_pop magi_pop_anim
instance->registerEObj( "sgvf_r1fc_b0471_2", 2004350, 4841632, 4, { -8.033875f, 0.000000f, 10.406790f }, 1.000000f,
0.000000f );
// States -> magi_def magi_def_anim magi_pop magi_pop_anim
instance->registerEObj( "sgvf_r1fc_b0471_3", 2004351, 4841633, 4, { -8.319038f, -0.000001f, -10.997720f },
1.000000f, 0.000000f );
// States -> magi_def magi_def_anim magi_pop magi_pop_anim
instance->registerEObj( "Entrance", 2000182, 4738599, 5, { 9.717670f, 0.000000f, 14.522430f }, 1.000000f,
0.000000f );
// States -> vf_lock_on vf_lock_of
instance->registerEObj( "Exit", 2000139, 0, 4, { 0.000000f, 0.000000f, -15.000000f }, 1.000000f, 0.000000f );
}
}
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
}
}
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
}
}
};

View file

@ -1,30 +1,35 @@
#include <ScriptObject.h>
#include <Zone/InstanceContent.h>
class ThePalaceoftheDeadFloors101110 : public InstanceContentScript
class ThePalaceoftheDeadFloors101110 :
public InstanceContentScript
{
public:
ThePalaceoftheDeadFloors101110() : InstanceContentScript( 60011 )
{ }
ThePalaceoftheDeadFloors101110() :
InstanceContentScript( 60011 )
{
}
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6527847, 4, { -300.000000f, 0.000026f, -237.000000f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
instance->registerEObj( "sgvf_w_lvd_b0959_1", 2000608, 6544382, 4, { 301.149902f, -0.045413f, 285.247589f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6527847, 4, { -300.000000f, 0.000026f, -237.000000f },
1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
instance->registerEObj( "sgvf_w_lvd_b0959_1", 2000608, 6544382, 4, { 301.149902f, -0.045413f, 285.247589f },
1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
}
}
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
}
}
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
}
}
};

View file

@ -1,28 +1,32 @@
#include <ScriptObject.h>
#include <Zone/InstanceContent.h>
class ThePalaceoftheDeadFloors110 : public InstanceContentScript
class ThePalaceoftheDeadFloors110 :
public InstanceContentScript
{
public:
ThePalaceoftheDeadFloors110() : InstanceContentScript( 60001 )
{ }
ThePalaceoftheDeadFloors110() :
InstanceContentScript( 60001 )
{
}
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2002872, 6324883, 4, { -300.000000f, -0.000010f, -220.000000f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2002872, 6324883, 4, { -300.000000f, -0.000010f, -220.000000f },
1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
}
}
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
}
}
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
}
}
};

View file

@ -1,28 +1,32 @@
#include <ScriptObject.h>
#include <Zone/InstanceContent.h>
class ThePalaceoftheDeadFloors111120 : public InstanceContentScript
class ThePalaceoftheDeadFloors111120 :
public InstanceContentScript
{
public:
ThePalaceoftheDeadFloors111120() : InstanceContentScript( 60012 )
{ }
ThePalaceoftheDeadFloors111120() :
InstanceContentScript( 60012 )
{
}
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6535115, 4, { -300.000000f, 0.000026f, -237.000000f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6535115, 4, { -300.000000f, 0.000026f, -237.000000f },
1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
}
}
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
}
}
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
}
}
};

View file

@ -1,28 +1,32 @@
#include <ScriptObject.h>
#include <Zone/InstanceContent.h>
class ThePalaceoftheDeadFloors1120 : public InstanceContentScript
class ThePalaceoftheDeadFloors1120 :
public InstanceContentScript
{
public:
ThePalaceoftheDeadFloors1120() : InstanceContentScript( 60002 )
{ }
ThePalaceoftheDeadFloors1120() :
InstanceContentScript( 60002 )
{
}
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6353850, 4, { -300.000000f, 0.000026f, -237.000000f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6353850, 4, { -300.000000f, 0.000026f, -237.000000f },
1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
}
}
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
}
}
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
}
}
};

View file

@ -1,28 +1,32 @@
#include <ScriptObject.h>
#include <Zone/InstanceContent.h>
class ThePalaceoftheDeadFloors121130 : public InstanceContentScript
class ThePalaceoftheDeadFloors121130 :
public InstanceContentScript
{
public:
ThePalaceoftheDeadFloors121130() : InstanceContentScript( 60013 )
{ }
ThePalaceoftheDeadFloors121130() :
InstanceContentScript( 60013 )
{
}
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6535115, 4, { -300.000000f, 0.000026f, -237.000000f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6535115, 4, { -300.000000f, 0.000026f, -237.000000f },
1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
}
}
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
}
}
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
}
}
};

View file

@ -1,28 +1,32 @@
#include <ScriptObject.h>
#include <Zone/InstanceContent.h>
class ThePalaceoftheDeadFloors131140 : public InstanceContentScript
class ThePalaceoftheDeadFloors131140 :
public InstanceContentScript
{
public:
ThePalaceoftheDeadFloors131140() : InstanceContentScript( 60014 )
{ }
ThePalaceoftheDeadFloors131140() :
InstanceContentScript( 60014 )
{
}
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6535683, 4, { -300.000000f, -0.000205f, -237.000000f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6535683, 4, { -300.000000f, -0.000205f, -237.000000f },
1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
}
}
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
}
}
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
}
}
};

View file

@ -1,28 +1,32 @@
#include <ScriptObject.h>
#include <Zone/InstanceContent.h>
class ThePalaceoftheDeadFloors141150 : public InstanceContentScript
class ThePalaceoftheDeadFloors141150 :
public InstanceContentScript
{
public:
ThePalaceoftheDeadFloors141150() : InstanceContentScript( 60015 )
{ }
ThePalaceoftheDeadFloors141150() :
InstanceContentScript( 60015 )
{
}
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6535683, 4, { -300.000000f, -0.000205f, -237.000000f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6535683, 4, { -300.000000f, -0.000205f, -237.000000f },
1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
}
}
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
}
}
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
}
}
};

View file

@ -1,28 +1,32 @@
#include <ScriptObject.h>
#include <Zone/InstanceContent.h>
class ThePalaceoftheDeadFloors151160 : public InstanceContentScript
class ThePalaceoftheDeadFloors151160 :
public InstanceContentScript
{
public:
ThePalaceoftheDeadFloors151160() : InstanceContentScript( 60016 )
{ }
ThePalaceoftheDeadFloors151160() :
InstanceContentScript( 60016 )
{
}
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6534547, 4, { -301.179504f, 0.130118f, -301.014709f }, 1.000000f, -0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6534547, 4, { -301.179504f, 0.130118f, -301.014709f },
1.000000f, -0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
}
}
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
}
}
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
}
}
};

View file

@ -1,28 +1,32 @@
#include <ScriptObject.h>
#include <Zone/InstanceContent.h>
class ThePalaceoftheDeadFloors161170 : public InstanceContentScript
class ThePalaceoftheDeadFloors161170 :
public InstanceContentScript
{
public:
ThePalaceoftheDeadFloors161170() : InstanceContentScript( 60017 )
{ }
ThePalaceoftheDeadFloors161170() :
InstanceContentScript( 60017 )
{
}
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6534547, 4, { -301.179504f, 0.130118f, -301.014709f }, 1.000000f, -0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6534547, 4, { -301.179504f, 0.130118f, -301.014709f },
1.000000f, -0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
}
}
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
}
}
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
}
}
};

View file

@ -1,28 +1,32 @@
#include <ScriptObject.h>
#include <Zone/InstanceContent.h>
class ThePalaceoftheDeadFloors171180 : public InstanceContentScript
class ThePalaceoftheDeadFloors171180 :
public InstanceContentScript
{
public:
ThePalaceoftheDeadFloors171180() : InstanceContentScript( 60018 )
{ }
ThePalaceoftheDeadFloors171180() :
InstanceContentScript( 60018 )
{
}
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6534547, 4, { -301.179504f, 0.130118f, -301.014709f }, 1.000000f, -0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6534547, 4, { -301.179504f, 0.130118f, -301.014709f },
1.000000f, -0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
}
}
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
}
}
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
}
}
};

View file

@ -1,28 +1,32 @@
#include <ScriptObject.h>
#include <Zone/InstanceContent.h>
class ThePalaceoftheDeadFloors181190 : public InstanceContentScript
class ThePalaceoftheDeadFloors181190 :
public InstanceContentScript
{
public:
ThePalaceoftheDeadFloors181190() : InstanceContentScript( 60019 )
{ }
ThePalaceoftheDeadFloors181190() :
InstanceContentScript( 60019 )
{
}
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6534547, 4, { -301.179504f, 0.130118f, -301.014709f }, 1.000000f, -0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6534547, 4, { -301.179504f, 0.130118f, -301.014709f },
1.000000f, -0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
}
}
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
}
}
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
}
}
};

View file

@ -1,28 +1,32 @@
#include <ScriptObject.h>
#include <Zone/InstanceContent.h>
class ThePalaceoftheDeadFloors191200 : public InstanceContentScript
class ThePalaceoftheDeadFloors191200 :
public InstanceContentScript
{
public:
ThePalaceoftheDeadFloors191200() : InstanceContentScript( 60020 )
{ }
ThePalaceoftheDeadFloors191200() :
InstanceContentScript( 60020 )
{
}
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6534547, 4, { -301.179504f, 0.130118f, -301.014709f }, 1.000000f, -0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6534547, 4, { -301.179504f, 0.130118f, -301.014709f },
1.000000f, -0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
}
}
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
}
}
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
}
}
};

View file

@ -1,28 +1,32 @@
#include <ScriptObject.h>
#include <Zone/InstanceContent.h>
class ThePalaceoftheDeadFloors2130 : public InstanceContentScript
class ThePalaceoftheDeadFloors2130 :
public InstanceContentScript
{
public:
ThePalaceoftheDeadFloors2130() : InstanceContentScript( 60003 )
{ }
ThePalaceoftheDeadFloors2130() :
InstanceContentScript( 60003 )
{
}
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2002872, 6387948, 4, { -300.000000f, -0.116918f, -237.513199f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2002872, 6387948, 4, { -300.000000f, -0.116918f, -237.513199f },
1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
}
}
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
}
}
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
}
}
};

View file

@ -1,36 +1,47 @@
#include <ScriptObject.h>
#include <Zone/InstanceContent.h>
class ThePalaceoftheDeadFloors3140 : public InstanceContentScript
class ThePalaceoftheDeadFloors3140 :
public InstanceContentScript
{
public:
ThePalaceoftheDeadFloors3140() : InstanceContentScript( 60004 )
{ }
ThePalaceoftheDeadFloors3140() :
InstanceContentScript( 60004 )
{
}
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6367892, 4, { -300.000000f, 0.000000f, -225.000000f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
instance->registerEObj( "sgvf_w_lvd_b0959_1", 2002872, 6392196, 4, { 300.000000f, 0.000000f, 374.000000f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
instance->registerEObj( "unknown_0", 2007351, 6277715, 4, { 300.036102f, 0.000000f, 373.916687f }, 1.000000f, 0.000000f );
instance->registerEObj( "unknown_1", 2007352, 6394671, 4, { 307.159912f, 0.000000f, 370.556702f }, 1.000000f, 0.000000f );
instance->registerEObj( "unknown_2", 2007353, 6394677, 4, { 305.303894f, 0.000000f, 380.231415f }, 1.000000f, 0.000000f );
instance->registerEObj( "unknown_3", 2007354, 6394673, 4, { 296.024109f, -0.000000f, 381.100189f }, 1.000000f, 0.000000f );
instance->registerEObj( "unknown_4", 2007355, 6394675, 4, { 291.561890f, 0.000000f, 372.412689f }, 1.000000f, 0.000000f );
instance->registerEObj( "unknown_5", 2007356, 6394674, 4, { 298.511902f, 0.000000f, 366.134003f }, 1.000000f, 0.000000f );
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6367892, 4, { -300.000000f, 0.000000f, -225.000000f },
1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
instance->registerEObj( "sgvf_w_lvd_b0959_1", 2002872, 6392196, 4, { 300.000000f, 0.000000f, 374.000000f },
1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
instance->registerEObj( "unknown_0", 2007351, 6277715, 4, { 300.036102f, 0.000000f, 373.916687f }, 1.000000f,
0.000000f );
instance->registerEObj( "unknown_1", 2007352, 6394671, 4, { 307.159912f, 0.000000f, 370.556702f }, 1.000000f,
0.000000f );
instance->registerEObj( "unknown_2", 2007353, 6394677, 4, { 305.303894f, 0.000000f, 380.231415f }, 1.000000f,
0.000000f );
instance->registerEObj( "unknown_3", 2007354, 6394673, 4, { 296.024109f, -0.000000f, 381.100189f }, 1.000000f,
0.000000f );
instance->registerEObj( "unknown_4", 2007355, 6394675, 4, { 291.561890f, 0.000000f, 372.412689f }, 1.000000f,
0.000000f );
instance->registerEObj( "unknown_5", 2007356, 6394674, 4, { 298.511902f, 0.000000f, 366.134003f }, 1.000000f,
0.000000f );
}
}
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
}
}
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
}
}
};

View file

@ -1,36 +1,47 @@
#include <ScriptObject.h>
#include <Zone/InstanceContent.h>
class ThePalaceoftheDeadFloors4150 : public InstanceContentScript
class ThePalaceoftheDeadFloors4150 :
public InstanceContentScript
{
public:
ThePalaceoftheDeadFloors4150() : InstanceContentScript( 60005 )
{ }
ThePalaceoftheDeadFloors4150() :
InstanceContentScript( 60005 )
{
}
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6367892, 4, { -300.000000f, 0.000000f, -225.000000f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
instance->registerEObj( "sgvf_w_lvd_b0959_1", 2002872, 6392196, 4, { 300.000000f, 0.000000f, 374.000000f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
instance->registerEObj( "unknown_0", 2007351, 6277715, 4, { 300.036102f, 0.000000f, 373.916687f }, 1.000000f, 0.000000f );
instance->registerEObj( "unknown_1", 2007352, 6394671, 4, { 307.159912f, 0.000000f, 370.556702f }, 1.000000f, 0.000000f );
instance->registerEObj( "unknown_2", 2007353, 6394677, 4, { 305.303894f, 0.000000f, 380.231415f }, 1.000000f, 0.000000f );
instance->registerEObj( "unknown_3", 2007354, 6394673, 4, { 296.024109f, -0.000000f, 381.100189f }, 1.000000f, 0.000000f );
instance->registerEObj( "unknown_4", 2007355, 6394675, 4, { 291.561890f, 0.000000f, 372.412689f }, 1.000000f, 0.000000f );
instance->registerEObj( "unknown_5", 2007356, 6394674, 4, { 298.511902f, 0.000000f, 366.134003f }, 1.000000f, 0.000000f );
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6367892, 4, { -300.000000f, 0.000000f, -225.000000f },
1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
instance->registerEObj( "sgvf_w_lvd_b0959_1", 2002872, 6392196, 4, { 300.000000f, 0.000000f, 374.000000f },
1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
instance->registerEObj( "unknown_0", 2007351, 6277715, 4, { 300.036102f, 0.000000f, 373.916687f }, 1.000000f,
0.000000f );
instance->registerEObj( "unknown_1", 2007352, 6394671, 4, { 307.159912f, 0.000000f, 370.556702f }, 1.000000f,
0.000000f );
instance->registerEObj( "unknown_2", 2007353, 6394677, 4, { 305.303894f, 0.000000f, 380.231415f }, 1.000000f,
0.000000f );
instance->registerEObj( "unknown_3", 2007354, 6394673, 4, { 296.024109f, -0.000000f, 381.100189f }, 1.000000f,
0.000000f );
instance->registerEObj( "unknown_4", 2007355, 6394675, 4, { 291.561890f, 0.000000f, 372.412689f }, 1.000000f,
0.000000f );
instance->registerEObj( "unknown_5", 2007356, 6394674, 4, { 298.511902f, 0.000000f, 366.134003f }, 1.000000f,
0.000000f );
}
}
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
}
}
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
}
}
};

View file

@ -1,28 +1,32 @@
#include <ScriptObject.h>
#include <Zone/InstanceContent.h>
class ThePalaceoftheDeadFloors5160 : public InstanceContentScript
class ThePalaceoftheDeadFloors5160 :
public InstanceContentScript
{
public:
ThePalaceoftheDeadFloors5160() : InstanceContentScript( 60006 )
{ }
ThePalaceoftheDeadFloors5160() :
InstanceContentScript( 60006 )
{
}
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6521120, 4, { -300.000000f, 3.189805f, -241.061096f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6521120, 4, { -300.000000f, 3.189805f, -241.061096f },
1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
}
}
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
}
}
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
}
}
};

View file

@ -1,28 +1,32 @@
#include <ScriptObject.h>
#include <Zone/InstanceContent.h>
class ThePalaceoftheDeadFloors6170 : public InstanceContentScript
class ThePalaceoftheDeadFloors6170 :
public InstanceContentScript
{
public:
ThePalaceoftheDeadFloors6170() : InstanceContentScript( 60007 )
{ }
ThePalaceoftheDeadFloors6170() :
InstanceContentScript( 60007 )
{
}
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6521120, 4, { -300.000000f, 3.189805f, -241.061096f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6521120, 4, { -300.000000f, 3.189805f, -241.061096f },
1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
}
}
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
}
}
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
}
}
};

View file

@ -1,28 +1,32 @@
#include <ScriptObject.h>
#include <Zone/InstanceContent.h>
class ThePalaceoftheDeadFloors7180 : public InstanceContentScript
class ThePalaceoftheDeadFloors7180 :
public InstanceContentScript
{
public:
ThePalaceoftheDeadFloors7180() : InstanceContentScript( 60008 )
{ }
ThePalaceoftheDeadFloors7180() :
InstanceContentScript( 60008 )
{
}
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6521120, 4, { -300.000000f, 3.189805f, -241.061096f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6521120, 4, { -300.000000f, 3.189805f, -241.061096f },
1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
}
}
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
}
}
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
}
}
};

View file

@ -1,30 +1,35 @@
#include <ScriptObject.h>
#include <Zone/InstanceContent.h>
class ThePalaceoftheDeadFloors8190 : public InstanceContentScript
class ThePalaceoftheDeadFloors8190 :
public InstanceContentScript
{
public:
ThePalaceoftheDeadFloors8190() : InstanceContentScript( 60009 )
{ }
ThePalaceoftheDeadFloors8190() :
InstanceContentScript( 60009 )
{
}
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6527847, 4, { -300.000000f, 0.000026f, -237.000000f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
instance->registerEObj( "sgvf_w_lvd_b0959_1", 2000608, 6544382, 4, { 301.149902f, -0.045413f, 285.247589f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6527847, 4, { -300.000000f, 0.000026f, -237.000000f },
1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
instance->registerEObj( "sgvf_w_lvd_b0959_1", 2000608, 6544382, 4, { 301.149902f, -0.045413f, 285.247589f },
1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
}
}
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
}
}
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
}
}
};

View file

@ -1,30 +1,35 @@
#include <ScriptObject.h>
#include <Zone/InstanceContent.h>
class ThePalaceoftheDeadFloors91100 : public InstanceContentScript
class ThePalaceoftheDeadFloors91100 :
public InstanceContentScript
{
public:
ThePalaceoftheDeadFloors91100() : InstanceContentScript( 60010 )
{ }
ThePalaceoftheDeadFloors91100() :
InstanceContentScript( 60010 )
{
}
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6527847, 4, { -300.000000f, 0.000026f, -237.000000f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
instance->registerEObj( "sgvf_w_lvd_b0959_1", 2000608, 6544382, 4, { 301.149902f, -0.045413f, 285.247589f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0959", 2000608, 6527847, 4, { -300.000000f, 0.000026f, -237.000000f },
1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
instance->registerEObj( "sgvf_w_lvd_b0959_1", 2000608, 6544382, 4, { 301.149902f, -0.045413f, 285.247589f },
1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_on2off vf_bextwall_off
}
}
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
}
}
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
}
}
};

View file

@ -1,26 +1,29 @@
#include <ScriptObject.h>
#include <Zone/InstanceContent.h>
class AlaMhigo : public InstanceContentScript
class AlaMhigo :
public InstanceContentScript
{
public:
AlaMhigo() : InstanceContentScript( 56 )
{ }
AlaMhigo() :
InstanceContentScript( 56 )
{
}
void onInit( InstanceContentPtr instance ) override
{
void onInit( InstanceContentPtr instance ) override
{
}
}
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
}
}
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
}
}
};

View file

@ -1,149 +1,231 @@
#include <ScriptObject.h>
#include <Zone/InstanceContent.h>
class AmdaporKeep : public InstanceContentScript
class AmdaporKeep :
public InstanceContentScript
{
public:
AmdaporKeep() : InstanceContentScript( 14 )
{ }
AmdaporKeep() :
InstanceContentScript( 14 )
{
}
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgbg_f1d3_a1_gar2", 2000551, 4277027, 4, { -3.577190f, 48.000000f, -12.625050f }, 1.000000f, 0.000000f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_1", 2000552, 4277005, 4, { 21.455280f, 48.000011f, -12.604770f }, 1.000000f, 0.000000f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_2", 2000553, 4277029, 4, { -3.963791f, 48.000000f, 9.699657f }, 1.000000f, 0.000000f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_3", 2000554, 4277028, 4, { 21.081841f, 47.999920f, 9.731779f }, 1.000000f, 0.000000f );
// States -> on off vfx_on
instance->registerEObj( "Entrance", 2000491, 4246565, 5, { -254.388702f, -8.857766f, -0.323940f }, 1.000000f, 0.000000f );
// States -> vf_lock_on vf_lock_of
instance->registerEObj( "unknown_0", 2000492, 0, 4, { -266.179810f, -9.200000f, -0.162207f }, 1.000000f, 0.000000f );
instance->registerEObj( "Exit", 2000493, 4246574, 4, { -12.466670f, 48.285069f, -0.015320f }, 0.991760f, 0.000048f );
// States -> vf_htras1_on vf_htras1_of
instance->registerEObj( "sgvf_w_lvd_b0094", 2000494, 4246576, 4, { -81.527344f, 0.000003f, -1.602537f }, 1.000000f, 0.000000f );
// States -> vf_line_on vf_line_of
instance->registerEObj( "sgvf_w_lvd_b0118", 2000495, 4246594, 4, { -81.412201f, 0.000003f, 0.186550f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "sgvf_w_lvd_b0094_1", 2000496, 4246595, 4, { 199.816895f, 21.957701f, -104.781303f }, 0.991760f, 0.000048f );
// States -> vf_line_on vf_line_of
instance->registerEObj( "sgpl_w_lvd_b0118_f1d2", 2000497, 4246596, 4, { 200.915497f, 21.957701f, -104.598198f }, 0.991760f, 0.000048f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "sgvf_w_lvd_b0249", 2000498, 4246617, 4, { 34.775269f, 48.081181f, 0.381470f }, 0.991760f, 0.000048f );
// States -> vf_line_on vf_line_of
instance->registerEObj( "sgvf_w_lvd_b0250", 2000499, 4246618, 4, { 34.775269f, 48.081181f, -0.839294f }, 0.991760f, 0.000048f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "Shortcut", 2000700, 0, 4, { -246.833496f, -8.499996f, 4.016408f }, 1.000000f, 0.000000f );
instance->registerEObj( "Aetherialflow", 2000500, 4247835, 4, { -10.236110f, -0.000000f, -0.015320f }, 0.991760f, 0.000048f );
instance->registerEObj( "PresenceChamberdoor", 2000502, 4308888, 4, { 60.483269f, 48.174511f, -0.015320f }, 0.991760f, 0.000048f );
instance->registerEObj( "BloodyTranseptdoor", 2000687, 4308274, 4, { 199.985397f, 22.200001f, -103.389503f }, 1.000000f, 0.000000f );
instance->registerEObj( "sgvf_f1d1_b0008", 2002741, 4388278, 4, { -82.462273f, 0.000002f, 0.045686f }, 1.000000f, 0.000000f );
// States -> vf_baria1_off vf_baria_on
instance->registerEObj( "sgbg_f1d3_a1_gar1", 2000509, 4271520, 4, { 134.111496f, 22.079769f, -5.935791f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_1", 2000510, 4271522, 4, { 142.229202f, 22.079769f, -6.088379f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_2", 2000511, 4271529, 4, { 158.129196f, 22.079769f, -6.088379f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_3", 2000512, 4271531, 4, { 133.958893f, 22.079769f, 6.271362f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_4", 2000513, 4271532, 4, { 142.015594f, 22.079769f, 6.271362f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_5", 2000514, 4271533, 4, { 158.190201f, 22.079769f, 6.271362f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_6", 2000521, 4274657, 4, { 193.987900f, 22.110291f, 42.099609f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_7", 2000522, 4274656, 4, { 193.804794f, 22.079769f, 57.938480f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_8", 2000523, 4274655, 4, { 193.804794f, 22.079769f, 65.964722f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_9", 2000524, 4274661, 4, { 206.317093f, 22.079769f, 42.038570f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_10", 2000525, 4274660, 4, { 206.286697f, 22.079769f, 57.968990f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_11", 2000526, 4274659, 4, { 206.286697f, 22.079769f, 65.995239f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_12", 2000533, 4274648, 4, { 241.992798f, 22.079769f, -6.332520f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_13", 2000534, 4274649, 4, { 258.075806f, 22.079769f, -6.332520f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_14", 2000535, 4274650, 4, { 265.949493f, 22.079769f, -6.271484f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_15", 2000536, 4274651, 4, { 241.931793f, 22.079769f, 6.240906f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_16", 2000537, 4274652, 4, { 258.075806f, 22.079769f, 6.271362f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_17", 2000538, 4274653, 4, { 266.071503f, 22.079769f, 6.271362f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_18", 2000545, 4274662, 4, { 193.804794f, 22.079769f, -34.042912f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_19", 2000546, 4274667, 4, { 193.804794f, 22.079769f, -42.008121f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_20", 2000547, 4274666, 4, { 193.804794f, 22.079769f, -58.335270f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_21", 2000548, 4274663, 4, { 206.317093f, 22.079769f, -33.890320f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_22", 2000549, 4274665, 4, { 206.317093f, 22.079769f, -41.916561f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_23", 2000550, 4274664, 4, { 206.317093f, 22.079769f, -58.274231f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar2_4", 2000503, 4274671, 4, { 134.111496f, 22.079769f, -5.935791f }, 0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_5", 2000504, 4274672, 4, { 142.229202f, 22.079769f, -6.088379f }, 0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_6", 2000505, 4274673, 4, { 158.129196f, 22.079769f, -6.088379f }, 0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_7", 2000506, 4274674, 4, { 133.958893f, 22.079769f, 6.271362f }, 0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_8", 2000507, 4274675, 4, { 142.015594f, 22.079769f, 6.271362f }, 0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_9", 2000508, 4274676, 4, { 158.190201f, 22.079769f, 6.271362f }, 0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_10", 2000515, 4274685, 4, { 193.987900f, 22.110291f, 42.099609f }, 0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_11", 2000516, 4274684, 4, { 193.804794f, 22.079769f, 57.938480f }, 0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_12", 2000517, 4274683, 4, { 193.804794f, 22.079769f, 65.964722f }, 0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_13", 2000518, 4274688, 4, { 206.317093f, 22.079769f, 42.038570f }, 0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_14", 2000519, 4274687, 4, { 206.317093f, 22.079769f, 57.968990f }, 0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_15", 2000520, 4274686, 4, { 206.317093f, 22.079769f, 65.995239f }, 0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_16", 2000527, 4274677, 4, { 241.992798f, 22.079769f, -6.332520f }, 0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_17", 2000528, 4274678, 4, { 258.075806f, 22.079769f, -6.332520f }, 0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_18", 2000529, 4274679, 4, { 265.949493f, 22.079769f, -6.271484f }, 0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_19", 2000530, 4274680, 4, { 241.931793f, 22.079769f, 6.271362f }, 0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_20", 2000531, 4274681, 4, { 258.075806f, 22.079769f, 6.271362f }, 0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_21", 2000532, 4274682, 4, { 266.071503f, 22.079769f, 6.271362f }, 0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_22", 2000539, 4274689, 4, { 193.804794f, 22.079769f, -34.042912f }, 0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_23", 2000540, 4274694, 4, { 193.804794f, 22.079769f, -42.008121f }, 0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_24", 2000541, 4274693, 4, { 193.804794f, 22.079769f, -58.335270f }, 0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_25", 2000542, 4274690, 4, { 206.317093f, 22.079769f, -33.890320f }, 0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_26", 2000543, 4274692, 4, { 206.317093f, 22.079769f, -41.916561f }, 0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_27", 2000544, 4274691, 4, { 206.317093f, 22.079769f, -58.274231f }, 0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "Entrance_1", 2000182, 5608623, 5, { -156.520401f, -2.800003f, -5.140180f }, 1.000000f, 0.000000f );
// States -> vf_lock_on vf_lock_of
instance->registerEObj( "sgvf_w_lvd_b0118_1", 2002872, 5608617, 4, { -154.662003f, -2.800003f, 5.028913f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "unknown_1", 2002735, 0, 4, { -151.232193f, -2.822998f, 0.289556f }, 1.174927f, -1.570451f );
instance->registerEObj( "sgvf_w_lvd_b0118_2", 2005128, 5608619, 4, { -112.240501f, -2.800003f, -0.701091f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "unknown_2", 2002735, 0, 4, { -46.585720f, 0.045776f, 0.190301f }, 1.179312f, -1.570451f );
instance->registerEObj( "sgvf_w_lvd_b0118_3", 2002872, 5608620, 4, { -46.476231f, 0.000000f, -0.510445f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "Exit_1", 2000139, 0, 4, { -7.766907f, -0.015320f, 0.015198f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgvf_f1d3_bo189", 2000561, 4248559, 4, { 200.121902f, 21.988159f, -114.000000f }, 1.000000f, 0.000048f );
instance->registerEObj( "sgbg_col_wall_00", 2000555, 4249099, 4, { 200.000000f, 21.988159f, -151.822800f }, 0.991760f, 0.000048f );
instance->registerEObj( "Aetherialflow_1", 2000501, 4247838, 4, { 200.061005f, 22.000000f, -165.266006f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_col_wall_00_1", 2000556, 4249100, 4, { 200.000000f, 21.988159f, -146.822800f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_col_wall_00_2", 2000557, 4249101, 4, { 200.000000f, 21.988159f, -141.822800f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_col_wall_00_3", 2000560, 4249104, 4, { 200.000000f, 21.988159f, -126.822800f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_col_wall_00_4", 2000602, 4253048, 4, { 200.000000f, 21.988159f, -121.822800f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_col_wall_00_5", 2000559, 4249103, 4, { 200.000000f, 21.988159f, -131.822800f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgbg_col_wall_00_6", 2000558, 4249102, 4, { 200.000000f, 21.957701f, -136.838501f }, 0.991760f, 0.000048f );
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgbg_f1d3_a1_gar2", 2000551, 4277027, 4, { -3.577190f, 48.000000f, -12.625050f },
1.000000f, 0.000000f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_1", 2000552, 4277005, 4, { 21.455280f, 48.000011f, -12.604770f },
1.000000f, 0.000000f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_2", 2000553, 4277029, 4, { -3.963791f, 48.000000f, 9.699657f },
1.000000f, 0.000000f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_3", 2000554, 4277028, 4, { 21.081841f, 47.999920f, 9.731779f },
1.000000f, 0.000000f );
// States -> on off vfx_on
instance->registerEObj( "Entrance", 2000491, 4246565, 5, { -254.388702f, -8.857766f, -0.323940f }, 1.000000f,
0.000000f );
// States -> vf_lock_on vf_lock_of
instance->registerEObj( "unknown_0", 2000492, 0, 4, { -266.179810f, -9.200000f, -0.162207f }, 1.000000f,
0.000000f );
instance->registerEObj( "Exit", 2000493, 4246574, 4, { -12.466670f, 48.285069f, -0.015320f }, 0.991760f,
0.000048f );
// States -> vf_htras1_on vf_htras1_of
instance->registerEObj( "sgvf_w_lvd_b0094", 2000494, 4246576, 4, { -81.527344f, 0.000003f, -1.602537f }, 1.000000f,
0.000000f );
// States -> vf_line_on vf_line_of
instance->registerEObj( "sgvf_w_lvd_b0118", 2000495, 4246594, 4, { -81.412201f, 0.000003f, 0.186550f }, 1.000000f,
0.000000f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "sgvf_w_lvd_b0094_1", 2000496, 4246595, 4, { 199.816895f, 21.957701f, -104.781303f },
0.991760f, 0.000048f );
// States -> vf_line_on vf_line_of
instance->registerEObj( "sgpl_w_lvd_b0118_f1d2", 2000497, 4246596, 4, { 200.915497f, 21.957701f, -104.598198f },
0.991760f, 0.000048f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "sgvf_w_lvd_b0249", 2000498, 4246617, 4, { 34.775269f, 48.081181f, 0.381470f }, 0.991760f,
0.000048f );
// States -> vf_line_on vf_line_of
instance->registerEObj( "sgvf_w_lvd_b0250", 2000499, 4246618, 4, { 34.775269f, 48.081181f, -0.839294f }, 0.991760f,
0.000048f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "Shortcut", 2000700, 0, 4, { -246.833496f, -8.499996f, 4.016408f }, 1.000000f, 0.000000f );
instance->registerEObj( "Aetherialflow", 2000500, 4247835, 4, { -10.236110f, -0.000000f, -0.015320f }, 0.991760f,
0.000048f );
instance->registerEObj( "PresenceChamberdoor", 2000502, 4308888, 4, { 60.483269f, 48.174511f, -0.015320f },
0.991760f, 0.000048f );
instance->registerEObj( "BloodyTranseptdoor", 2000687, 4308274, 4, { 199.985397f, 22.200001f, -103.389503f },
1.000000f, 0.000000f );
instance->registerEObj( "sgvf_f1d1_b0008", 2002741, 4388278, 4, { -82.462273f, 0.000002f, 0.045686f }, 1.000000f,
0.000000f );
// States -> vf_baria1_off vf_baria_on
instance->registerEObj( "sgbg_f1d3_a1_gar1", 2000509, 4271520, 4, { 134.111496f, 22.079769f, -5.935791f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_1", 2000510, 4271522, 4, { 142.229202f, 22.079769f, -6.088379f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_2", 2000511, 4271529, 4, { 158.129196f, 22.079769f, -6.088379f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_3", 2000512, 4271531, 4, { 133.958893f, 22.079769f, 6.271362f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_4", 2000513, 4271532, 4, { 142.015594f, 22.079769f, 6.271362f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_5", 2000514, 4271533, 4, { 158.190201f, 22.079769f, 6.271362f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_6", 2000521, 4274657, 4, { 193.987900f, 22.110291f, 42.099609f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_7", 2000522, 4274656, 4, { 193.804794f, 22.079769f, 57.938480f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_8", 2000523, 4274655, 4, { 193.804794f, 22.079769f, 65.964722f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_9", 2000524, 4274661, 4, { 206.317093f, 22.079769f, 42.038570f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_10", 2000525, 4274660, 4, { 206.286697f, 22.079769f, 57.968990f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_11", 2000526, 4274659, 4, { 206.286697f, 22.079769f, 65.995239f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_12", 2000533, 4274648, 4, { 241.992798f, 22.079769f, -6.332520f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_13", 2000534, 4274649, 4, { 258.075806f, 22.079769f, -6.332520f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_14", 2000535, 4274650, 4, { 265.949493f, 22.079769f, -6.271484f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_15", 2000536, 4274651, 4, { 241.931793f, 22.079769f, 6.240906f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_16", 2000537, 4274652, 4, { 258.075806f, 22.079769f, 6.271362f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_17", 2000538, 4274653, 4, { 266.071503f, 22.079769f, 6.271362f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_18", 2000545, 4274662, 4, { 193.804794f, 22.079769f, -34.042912f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_19", 2000546, 4274667, 4, { 193.804794f, 22.079769f, -42.008121f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_20", 2000547, 4274666, 4, { 193.804794f, 22.079769f, -58.335270f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_21", 2000548, 4274663, 4, { 206.317093f, 22.079769f, -33.890320f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_22", 2000549, 4274665, 4, { 206.317093f, 22.079769f, -41.916561f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar1_23", 2000550, 4274664, 4, { 206.317093f, 22.079769f, -58.274231f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_f1d3_a1_gar2_4", 2000503, 4274671, 4, { 134.111496f, 22.079769f, -5.935791f },
0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_5", 2000504, 4274672, 4, { 142.229202f, 22.079769f, -6.088379f },
0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_6", 2000505, 4274673, 4, { 158.129196f, 22.079769f, -6.088379f },
0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_7", 2000506, 4274674, 4, { 133.958893f, 22.079769f, 6.271362f },
0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_8", 2000507, 4274675, 4, { 142.015594f, 22.079769f, 6.271362f },
0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_9", 2000508, 4274676, 4, { 158.190201f, 22.079769f, 6.271362f },
0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_10", 2000515, 4274685, 4, { 193.987900f, 22.110291f, 42.099609f },
0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_11", 2000516, 4274684, 4, { 193.804794f, 22.079769f, 57.938480f },
0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_12", 2000517, 4274683, 4, { 193.804794f, 22.079769f, 65.964722f },
0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_13", 2000518, 4274688, 4, { 206.317093f, 22.079769f, 42.038570f },
0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_14", 2000519, 4274687, 4, { 206.317093f, 22.079769f, 57.968990f },
0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_15", 2000520, 4274686, 4, { 206.317093f, 22.079769f, 65.995239f },
0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_16", 2000527, 4274677, 4, { 241.992798f, 22.079769f, -6.332520f },
0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_17", 2000528, 4274678, 4, { 258.075806f, 22.079769f, -6.332520f },
0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_18", 2000529, 4274679, 4, { 265.949493f, 22.079769f, -6.271484f },
0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_19", 2000530, 4274680, 4, { 241.931793f, 22.079769f, 6.271362f },
0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_20", 2000531, 4274681, 4, { 258.075806f, 22.079769f, 6.271362f },
0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_21", 2000532, 4274682, 4, { 266.071503f, 22.079769f, 6.271362f },
0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_22", 2000539, 4274689, 4, { 193.804794f, 22.079769f, -34.042912f },
0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_23", 2000540, 4274694, 4, { 193.804794f, 22.079769f, -42.008121f },
0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_24", 2000541, 4274693, 4, { 193.804794f, 22.079769f, -58.335270f },
0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_25", 2000542, 4274690, 4, { 206.317093f, 22.079769f, -33.890320f },
0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_26", 2000543, 4274692, 4, { 206.317093f, 22.079769f, -41.916561f },
0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "sgbg_f1d3_a1_gar2_27", 2000544, 4274691, 4, { 206.317093f, 22.079769f, -58.274231f },
0.991760f, 0.000048f );
// States -> on off vfx_on
instance->registerEObj( "Entrance_1", 2000182, 5608623, 5, { -156.520401f, -2.800003f, -5.140180f }, 1.000000f,
0.000000f );
// States -> vf_lock_on vf_lock_of
instance->registerEObj( "sgvf_w_lvd_b0118_1", 2002872, 5608617, 4, { -154.662003f, -2.800003f, 5.028913f },
1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "unknown_1", 2002735, 0, 4, { -151.232193f, -2.822998f, 0.289556f }, 1.174927f,
-1.570451f );
instance->registerEObj( "sgvf_w_lvd_b0118_2", 2005128, 5608619, 4, { -112.240501f, -2.800003f, -0.701091f },
1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "unknown_2", 2002735, 0, 4, { -46.585720f, 0.045776f, 0.190301f }, 1.179312f, -1.570451f );
instance->registerEObj( "sgvf_w_lvd_b0118_3", 2002872, 5608620, 4, { -46.476231f, 0.000000f, -0.510445f },
1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "Exit_1", 2000139, 0, 4, { -7.766907f, -0.015320f, 0.015198f }, 0.991760f, 0.000048f );
instance->registerEObj( "sgvf_f1d3_bo189", 2000561, 4248559, 4, { 200.121902f, 21.988159f, -114.000000f },
1.000000f, 0.000048f );
instance->registerEObj( "sgbg_col_wall_00", 2000555, 4249099, 4, { 200.000000f, 21.988159f, -151.822800f },
0.991760f, 0.000048f );
instance->registerEObj( "Aetherialflow_1", 2000501, 4247838, 4, { 200.061005f, 22.000000f, -165.266006f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_col_wall_00_1", 2000556, 4249100, 4, { 200.000000f, 21.988159f, -146.822800f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_col_wall_00_2", 2000557, 4249101, 4, { 200.000000f, 21.988159f, -141.822800f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_col_wall_00_3", 2000560, 4249104, 4, { 200.000000f, 21.988159f, -126.822800f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_col_wall_00_4", 2000602, 4253048, 4, { 200.000000f, 21.988159f, -121.822800f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_col_wall_00_5", 2000559, 4249103, 4, { 200.000000f, 21.988159f, -131.822800f },
0.991760f, 0.000048f );
instance->registerEObj( "sgbg_col_wall_00_6", 2000558, 4249102, 4, { 200.000000f, 21.957701f, -136.838501f },
0.991760f, 0.000048f );
}
}
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
}
}
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
}
}
};

View file

@ -1,66 +1,95 @@
#include <ScriptObject.h>
#include <Zone/InstanceContent.h>
class AmdaporKeepHard : public InstanceContentScript
class AmdaporKeepHard :
public InstanceContentScript
{
public:
AmdaporKeepHard() : InstanceContentScript( 29 )
{ }
AmdaporKeepHard() :
InstanceContentScript( 29 )
{
}
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0118", 2002872, 5040923, 4, { 203.452301f, 0.116688f, 208.657593f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "unknown_0", 2002735, 0, 4, { 199.471802f, 0.116693f, 210.128204f }, 1.000000f, 0.000000f );
instance->registerEObj( "sgbg_f1d7_a4_scy01", 2005153, 5619221, 4, { 198.706802f, -20.000010f, 229.113907f }, 1.000000f, 0.000000f );
instance->registerEObj( "unknown_1", 2004696, 5009720, 4, { -200.316895f, -4.301562f, -43.621670f }, 1.000000f, 0.000000f );
instance->registerEObj( "unknown_2", 2004697, 5009721, 4, { -47.771290f, -0.000000f, -71.658272f }, 1.000000f, 0.000000f );
instance->registerEObj( "sgbg_f1d7_a1_evl01", 2004698, 5031991, 4, { -125.087196f, -2.000000f, 28.417601f }, 1.000000f, -0.000000f );
// States -> evils_def evils_off_anim evils_on evils_on_anim
instance->registerEObj( "sgvf_f1d7_b0574", 2004699, 5031992, 4, { -104.790604f, -2.000000f, 47.174728f }, 1.000000f, 0.000000f );
// States -> vf_baria1_off vf_baria_on
instance->registerEObj( "unknown_3", 2004700, 0, 4, { 2.343430f, 48.179089f, -2.083742f }, 1.000000f, 0.000000f );
instance->registerEObj( "unknown_4", 2004702, 5009732, 4, { 125.604897f, 43.999989f, 3.999085f }, 1.000000f, 0.005971f );
instance->registerEObj( "unknown_5", 2004701, 0, 4, { 149.666000f, 44.200001f, -0.006115f }, 1.000000f, 0.000000f );
instance->registerEObj( "unknown_6", 2004703, 5010816, 4, { 196.927399f, 44.000019f, -101.381798f }, 1.000000f, 0.000000f );
instance->registerEObj( "sgbg_f1d7_a1_evl01_1", 2004704, 5032163, 4, { 199.696106f, 44.000000f, -181.197006f }, 1.000000f, 0.000000f );
// States -> evils_def evils_off_anim evils_on evils_on_anim
instance->registerEObj( "Aetherialflow", 2004705, 5032164, 4, { 199.682800f, 44.163898f, -180.392395f }, 1.000000f, -0.000000f );
instance->registerEObj( "Fellorb", 2004706, 5009746, 4, { 200.094101f, -0.000008f, 0.050249f }, 1.000000f, 0.000000f );
instance->registerEObj( "Aetherialflow_1", 2004707, 5033533, 4, { 199.899506f, 0.000000f, -3.297300f }, 1.000000f, -0.000000f );
instance->registerEObj( "unknown_7", 2004768, 5033548, 4, { 210.649307f, 0.116687f, -6.120441f }, 1.000000f, 0.000000f );
instance->registerEObj( "unknown_8", 2004769, 5033549, 4, { 189.489807f, 0.116688f, -6.804901f }, 1.000000f, 0.000000f );
instance->registerEObj( "unknown_9", 2004770, 5033551, 4, { 204.506500f, 0.116687f, 9.902725f }, 1.000000f, 0.000000f );
instance->registerEObj( "sgvf_w_lvd_b0118_1", 2004708, 5034801, 4, { -119.510101f, -2.400002f, 18.885540f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "sgvf_w_lvd_b0118_2", 2002872, 5034800, 4, { -130.314606f, -2.400000f, -18.221069f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "unknown_10", 2002735, 0, 4, { -125.041801f, -1.964380f, -20.543480f }, 1.000000f, 0.000000f );
instance->registerEObj( "sgpl_f1d7_a1_gar0", 2004996, 5390927, 4, { -112.845497f, -2.400000f, 12.122500f }, 1.000000f, 0.785314f );
instance->registerEObj( "sgpl_f1d7_a1_gar0_1", 2004997, 5390928, 4, { -112.845497f, -2.400000f, -12.378100f }, 1.000000f, 0.785457f );
instance->registerEObj( "sgpl_f1d7_a1_gar0_2", 2004998, 5390929, 4, { -137.250000f, -2.400000f, 12.122500f }, 1.000000f, -0.785410f );
instance->registerEObj( "sgpl_f1d7_a1_gar0_3", 2004999, 5390930, 4, { -137.396194f, -2.400000f, -12.366500f }, 1.000000f, -0.785398f );
instance->registerEObj( "sgvf_w_lvd_b0118_3", 2004782, 5038257, 4, { 198.459198f, 43.991699f, -172.369705f }, 1.000000f, 0.000048f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "sgvf_w_lvd_b0118_4", 2002872, 5038255, 4, { 197.802597f, 43.991699f, -125.932701f }, 1.000000f, -0.000000f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "unknown_11", 2002735, 0, 4, { 199.511703f, 44.022221f, -130.601303f }, 1.000000f, -0.000000f );
instance->registerEObj( "Entrance", 2000182, 5018466, 5, { -255.724792f, -9.199999f, -5.249732f }, 1.000000f, 0.000000f );
// States -> vf_lock_on vf_lock_of
instance->registerEObj( "Shortcut", 2000700, 0, 4, { -252.173401f, -9.199999f, 5.737248f }, 1.000000f, 0.000000f );
instance->registerEObj( "Exit", 2000139, 0, 4, { 200.798599f, -0.000008f, 240.880905f }, 1.000000f, 0.000000f );
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "sgvf_w_lvd_b0118", 2002872, 5040923, 4, { 203.452301f, 0.116688f, 208.657593f }, 1.000000f,
0.000000f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "unknown_0", 2002735, 0, 4, { 199.471802f, 0.116693f, 210.128204f }, 1.000000f, 0.000000f );
instance->registerEObj( "sgbg_f1d7_a4_scy01", 2005153, 5619221, 4, { 198.706802f, -20.000010f, 229.113907f },
1.000000f, 0.000000f );
instance->registerEObj( "unknown_1", 2004696, 5009720, 4, { -200.316895f, -4.301562f, -43.621670f }, 1.000000f,
0.000000f );
instance->registerEObj( "unknown_2", 2004697, 5009721, 4, { -47.771290f, -0.000000f, -71.658272f }, 1.000000f,
0.000000f );
instance->registerEObj( "sgbg_f1d7_a1_evl01", 2004698, 5031991, 4, { -125.087196f, -2.000000f, 28.417601f },
1.000000f, -0.000000f );
// States -> evils_def evils_off_anim evils_on evils_on_anim
instance->registerEObj( "sgvf_f1d7_b0574", 2004699, 5031992, 4, { -104.790604f, -2.000000f, 47.174728f }, 1.000000f,
0.000000f );
// States -> vf_baria1_off vf_baria_on
instance->registerEObj( "unknown_3", 2004700, 0, 4, { 2.343430f, 48.179089f, -2.083742f }, 1.000000f, 0.000000f );
instance->registerEObj( "unknown_4", 2004702, 5009732, 4, { 125.604897f, 43.999989f, 3.999085f }, 1.000000f,
0.005971f );
instance->registerEObj( "unknown_5", 2004701, 0, 4, { 149.666000f, 44.200001f, -0.006115f }, 1.000000f, 0.000000f );
instance->registerEObj( "unknown_6", 2004703, 5010816, 4, { 196.927399f, 44.000019f, -101.381798f }, 1.000000f,
0.000000f );
instance->registerEObj( "sgbg_f1d7_a1_evl01_1", 2004704, 5032163, 4, { 199.696106f, 44.000000f, -181.197006f },
1.000000f, 0.000000f );
// States -> evils_def evils_off_anim evils_on evils_on_anim
instance->registerEObj( "Aetherialflow", 2004705, 5032164, 4, { 199.682800f, 44.163898f, -180.392395f }, 1.000000f,
-0.000000f );
instance->registerEObj( "Fellorb", 2004706, 5009746, 4, { 200.094101f, -0.000008f, 0.050249f }, 1.000000f,
0.000000f );
instance->registerEObj( "Aetherialflow_1", 2004707, 5033533, 4, { 199.899506f, 0.000000f, -3.297300f }, 1.000000f,
-0.000000f );
instance->registerEObj( "unknown_7", 2004768, 5033548, 4, { 210.649307f, 0.116687f, -6.120441f }, 1.000000f,
0.000000f );
instance->registerEObj( "unknown_8", 2004769, 5033549, 4, { 189.489807f, 0.116688f, -6.804901f }, 1.000000f,
0.000000f );
instance->registerEObj( "unknown_9", 2004770, 5033551, 4, { 204.506500f, 0.116687f, 9.902725f }, 1.000000f,
0.000000f );
instance->registerEObj( "sgvf_w_lvd_b0118_1", 2004708, 5034801, 4, { -119.510101f, -2.400002f, 18.885540f },
1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "sgvf_w_lvd_b0118_2", 2002872, 5034800, 4, { -130.314606f, -2.400000f, -18.221069f },
1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "unknown_10", 2002735, 0, 4, { -125.041801f, -1.964380f, -20.543480f }, 1.000000f,
0.000000f );
instance->registerEObj( "sgpl_f1d7_a1_gar0", 2004996, 5390927, 4, { -112.845497f, -2.400000f, 12.122500f },
1.000000f, 0.785314f );
instance->registerEObj( "sgpl_f1d7_a1_gar0_1", 2004997, 5390928, 4, { -112.845497f, -2.400000f, -12.378100f },
1.000000f, 0.785457f );
instance->registerEObj( "sgpl_f1d7_a1_gar0_2", 2004998, 5390929, 4, { -137.250000f, -2.400000f, 12.122500f },
1.000000f, -0.785410f );
instance->registerEObj( "sgpl_f1d7_a1_gar0_3", 2004999, 5390930, 4, { -137.396194f, -2.400000f, -12.366500f },
1.000000f, -0.785398f );
instance->registerEObj( "sgvf_w_lvd_b0118_3", 2004782, 5038257, 4, { 198.459198f, 43.991699f, -172.369705f },
1.000000f, 0.000048f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "sgvf_w_lvd_b0118_4", 2002872, 5038255, 4, { 197.802597f, 43.991699f, -125.932701f },
1.000000f, -0.000000f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "unknown_11", 2002735, 0, 4, { 199.511703f, 44.022221f, -130.601303f }, 1.000000f,
-0.000000f );
instance->registerEObj( "Entrance", 2000182, 5018466, 5, { -255.724792f, -9.199999f, -5.249732f }, 1.000000f,
0.000000f );
// States -> vf_lock_on vf_lock_of
instance->registerEObj( "Shortcut", 2000700, 0, 4, { -252.173401f, -9.199999f, 5.737248f }, 1.000000f, 0.000000f );
instance->registerEObj( "Exit", 2000139, 0, 4, { 200.798599f, -0.000008f, 240.880905f }, 1.000000f, 0.000000f );
}
}
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
}
}
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
}
}
};

View file

@ -1,58 +1,85 @@
#include <ScriptObject.h>
#include <Zone/InstanceContent.h>
class BaelsarsWall : public InstanceContentScript
class BaelsarsWall :
public InstanceContentScript
{
public:
BaelsarsWall() : InstanceContentScript( 48 )
{ }
BaelsarsWall() :
InstanceContentScript( 48 )
{
}
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "unknown_0", 2002735, 0, 4, { -173.966797f, 3.049999f, 52.443710f }, 1.000000f, 0.000000f );
instance->registerEObj( "sgvf_w_lvd_b0118", 2002872, 6588628, 4, { -173.612198f, 3.049997f, 52.688000f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "sgvf_w_lvd_b0118_1", 2002872, 6588629, 4, { -154.029907f, 3.049906f, 72.262756f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "unknown_1", 2002735, 0, 4, { 95.577843f, -300.028412f, 0.707827f }, 1.000000f, -1.570451f );
instance->registerEObj( "sgvf_w_lvd_b0118_2", 2002872, 6588652, 4, { 95.163948f, -300.028198f, 0.952097f }, 1.000000f, -1.570451f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "sgvf_w_lvd_b0118_3", 2002872, 6588653, 4, { 135.748398f, -300.000092f, 0.172490f }, 1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "sgvf_w_lvd_b0118_4", 2002872, 6588667, 4, { 371.527588f, 212.000000f, 391.566010f }, 1.000000f, -0.000000f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "unknown_2", 2002735, 0, 4, { 371.795685f, 212.000000f, 391.643097f }, 1.000000f, -1.570451f );
instance->registerEObj( "Shortcut", 2000700, 0, 4, { -230.764297f, -0.932137f, -173.143600f }, 1.000000f, 0.000000f );
instance->registerEObj( "Exit", 2000139, 0, 4, { 352.071411f, 212.000000f, 391.988892f }, 0.991760f, 0.000048f );
instance->registerEObj( "Entrance", 2000182, 6562675, 5, { -228.044006f, -0.901261f, -183.153198f }, 1.000000f, 0.000000f );
// States -> vf_lock_on vf_lock_of
instance->registerEObj( "Imperialidentificationkey", 2007567, 0, 4, { -202.837997f, -0.966086f, -62.488140f }, 1.000000f, 0.000000f );
instance->registerEObj( "Securityterminal", 2007571, 6640773, 4, { -206.023102f, 2.815013f, -48.897739f }, 1.000000f, 0.000000f );
instance->registerEObj( "unknown_3", 2007575, 6501039, 4, { -203.861694f, 1.804717f, -49.827511f }, 1.000000f, 0.000000f );
instance->registerEObj( "Imperialidentificationkey_1", 2007568, 0, 4, { -176.569397f, 2.150000f, 17.400681f }, 1.000000f, 0.000000f );
instance->registerEObj( "Securityterminal_1", 2007572, 6516973, 4, { -187.083206f, 2.707914f, 19.031469f }, 1.000000f, 0.000000f );
instance->registerEObj( "unknown_4", 2007576, 6502290, 4, { -174.854904f, 2.100000f, 23.458460f }, 1.000000f, 0.000000f );
instance->registerEObj( "unknown_5", 2007776, 6500492, 4, { -126.770897f, 2.000089f, 72.952606f }, 1.000000f, 0.000000f );
instance->registerEObj( "Controlpanel", 2007580, 0, 4, { -0.003809f, -299.760315f, 0.024599f }, 2.000000f, 0.000048f );
instance->registerEObj( "Controlpanel_1", 2007581, 0, 4, { 177.511993f, -298.963196f, 4.224624f }, 0.991760f, 0.000048f );
instance->registerEObj( "Controlpanel_2", 2007582, 6523203, 4, { 177.434006f, -298.072601f, 6.243333f }, 1.000000f, 0.000000f );
instance->registerEObj( "unknown_6", 2007601, 6516974, 4, { 176.321396f, -299.105713f, 0.250570f }, 1.000000f, 0.000000f );
instance->registerEObj( "Imperialidentificationkey_2", 2007569, 0, 4, { 317.032288f, 169.000107f, 230.153503f }, 1.000000f, 0.000000f );
instance->registerEObj( "Securityterminal_2", 2007573, 6488516, 4, { 320.921600f, 169.867996f, 243.976807f }, 1.000000f, 0.000000f );
instance->registerEObj( "unknown_7", 2007577, 6488509, 4, { 328.225189f, 169.000107f, 244.581894f }, 1.000000f, 0.000000f );
instance->registerEObj( "unknown_8", 2007578, 6777152, 4, { 382.790100f, 203.000000f, 357.169403f }, 1.000000f, 0.000000f );
void onInit( InstanceContentPtr instance ) override
{
instance->registerEObj( "unknown_0", 2002735, 0, 4, { -173.966797f, 3.049999f, 52.443710f }, 1.000000f, 0.000000f );
instance->registerEObj( "sgvf_w_lvd_b0118", 2002872, 6588628, 4, { -173.612198f, 3.049997f, 52.688000f }, 1.000000f,
0.000000f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "sgvf_w_lvd_b0118_1", 2002872, 6588629, 4, { -154.029907f, 3.049906f, 72.262756f },
1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "unknown_1", 2002735, 0, 4, { 95.577843f, -300.028412f, 0.707827f }, 1.000000f,
-1.570451f );
instance->registerEObj( "sgvf_w_lvd_b0118_2", 2002872, 6588652, 4, { 95.163948f, -300.028198f, 0.952097f },
1.000000f, -1.570451f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "sgvf_w_lvd_b0118_3", 2002872, 6588653, 4, { 135.748398f, -300.000092f, 0.172490f },
1.000000f, 0.000000f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "sgvf_w_lvd_b0118_4", 2002872, 6588667, 4, { 371.527588f, 212.000000f, 391.566010f },
1.000000f, -0.000000f );
// States -> vf_bextwall_on vf_bextwall_of
instance->registerEObj( "unknown_2", 2002735, 0, 4, { 371.795685f, 212.000000f, 391.643097f }, 1.000000f,
-1.570451f );
instance->registerEObj( "Shortcut", 2000700, 0, 4, { -230.764297f, -0.932137f, -173.143600f }, 1.000000f,
0.000000f );
instance->registerEObj( "Exit", 2000139, 0, 4, { 352.071411f, 212.000000f, 391.988892f }, 0.991760f, 0.000048f );
instance->registerEObj( "Entrance", 2000182, 6562675, 5, { -228.044006f, -0.901261f, -183.153198f }, 1.000000f,
0.000000f );
// States -> vf_lock_on vf_lock_of
instance->registerEObj( "Imperialidentificationkey", 2007567, 0, 4, { -202.837997f, -0.966086f, -62.488140f },
1.000000f, 0.000000f );
instance->registerEObj( "Securityterminal", 2007571, 6640773, 4, { -206.023102f, 2.815013f, -48.897739f },
1.000000f, 0.000000f );
instance->registerEObj( "unknown_3", 2007575, 6501039, 4, { -203.861694f, 1.804717f, -49.827511f }, 1.000000f,
0.000000f );
instance->registerEObj( "Imperialidentificationkey_1", 2007568, 0, 4, { -176.569397f, 2.150000f, 17.400681f },
1.000000f, 0.000000f );
instance->registerEObj( "Securityterminal_1", 2007572, 6516973, 4, { -187.083206f, 2.707914f, 19.031469f },
1.000000f, 0.000000f );
instance->registerEObj( "unknown_4", 2007576, 6502290, 4, { -174.854904f, 2.100000f, 23.458460f }, 1.000000f,
0.000000f );
instance->registerEObj( "unknown_5", 2007776, 6500492, 4, { -126.770897f, 2.000089f, 72.952606f }, 1.000000f,
0.000000f );
instance->registerEObj( "Controlpanel", 2007580, 0, 4, { -0.003809f, -299.760315f, 0.024599f }, 2.000000f,
0.000048f );
instance->registerEObj( "Controlpanel_1", 2007581, 0, 4, { 177.511993f, -298.963196f, 4.224624f }, 0.991760f,
0.000048f );
instance->registerEObj( "Controlpanel_2", 2007582, 6523203, 4, { 177.434006f, -298.072601f, 6.243333f }, 1.000000f,
0.000000f );
instance->registerEObj( "unknown_6", 2007601, 6516974, 4, { 176.321396f, -299.105713f, 0.250570f }, 1.000000f,
0.000000f );
instance->registerEObj( "Imperialidentificationkey_2", 2007569, 0, 4, { 317.032288f, 169.000107f, 230.153503f },
1.000000f, 0.000000f );
instance->registerEObj( "Securityterminal_2", 2007573, 6488516, 4, { 320.921600f, 169.867996f, 243.976807f },
1.000000f, 0.000000f );
instance->registerEObj( "unknown_7", 2007577, 6488509, 4, { 328.225189f, 169.000107f, 244.581894f }, 1.000000f,
0.000000f );
instance->registerEObj( "unknown_8", 2007578, 6777152, 4, { 382.790100f, 203.000000f, 357.169403f }, 1.000000f,
0.000000f );
}
}
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
{
}
}
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
uint16_t param2 ) override
{
}
}
};

Some files were not shown because too many files have changed in this diff Show more