1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-27 14:57:44 +00:00

Merge pull request #564 from NotAdam/develop

update exd_struct_gen to new saintcoinach defs structure
This commit is contained in:
Mordred 2019-06-25 14:51:45 +02:00 committed by GitHub
commit 7338ef8976
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 8568 additions and 8012 deletions

View file

@ -602,3 +602,8 @@ CREATE TABLE `charamonsternote` (
`UPDATE_DATE` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(`CharacterId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `__Migration` (
`MigrationName` VARCHAR(250) NOT NULL,
PRIMARY KEY (`MigrationName`)
) ENGINE=InnoDB;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -51,7 +51,7 @@ namespace Sapphire::Network::Packets
ActorFreeSpawn = 0x0191,
InitZone = 0x019A,
AddStatusEffect = 0x0141,
EffectResult = 0x0141,
ActorControl142 = 0x0142,
ActorControl143 = 0x0143,
ActorControl144 = 0x0144,
@ -137,7 +137,7 @@ namespace Sapphire::Network::Packets
ObjectDespawn = 0x0182, // updated 4.5
UpdateClassInfo = 0x0183, // updated 4.5
SilentSetClassJob = 0x0184, // updated 4.5 - seems to be the case, not sure if it's actually used for anything
InitUI = 0x0185, // updated 4.5
PlayerSetup = 0x0185, // updated 4.5
PlayerStats = 0x0186, // updated 4.5
ActorOwner = 0x0187, // updated 4.5
PlayerStateFlags = 0x0188, // updated 4.5

View file

@ -305,7 +305,7 @@ namespace Sapphire::Network::Packets::Server
* Structural representation of the packet sent by the server
* add a status effect
*/
struct FFXIVIpcAddStatusEffect : FFXIVIpcBasePacket< AddStatusEffect >
struct FFXIVIpcEffectResult : FFXIVIpcBasePacket< EffectResult >
{
uint32_t unknown;
uint32_t actor_id;
@ -793,7 +793,7 @@ namespace Sapphire::Network::Packets::Server
* Structural representation of the packet sent by the server to initialize
* the client UI upon initial connection.
*/
struct FFXIVIpcInitUI : FFXIVIpcBasePacket< InitUI >
struct FFXIVIpcPlayerSetup : FFXIVIpcBasePacket< PlayerSetup >
{
// plain C types for a bit until the packet is actually fixed.
// makes conversion between different editors easier.

View file

@ -141,3 +141,15 @@ void Util::valueToFlagByteIndexValue( uint32_t inVal, uint8_t& outVal, uint16_t&
outVal = 1 << bitIndex;
}
std::string Util::fmtUtcTime( const std::string& fmt )
{
auto t = std::time( nullptr );
auto tm = std::gmtime( &t );
std::stringstream ss;
ss << std::put_time( tm, fmt.c_str() );
return ss.str();
}

View file

@ -19,6 +19,8 @@ namespace Sapphire::Common::Util
std::string toLowerCopy( const std::string& inStr );
std::string fmtUtcTime( const std::string& fmt );
uint64_t getTimeMs();
/*!

View file

@ -4,6 +4,15 @@
#include <fstream>
#include <streambuf>
#include <sstream>
#include <Logging/Logger.h>
#include <experimental/filesystem>
#include <common/Util/Util.h>
using namespace Sapphire;
using namespace Sapphire::Common;
namespace fs = std::experimental::filesystem;
DbManager::DbManager( const std::string& host, const std::string& database, const std::string& user, const std::string& pw, uint16_t port ) :
m_host( host ),
@ -107,9 +116,14 @@ bool DbManager::performAction()
case Mode::LIQUIDATE:
result = modeLiquidate();
break;
case Mode::UPDATE:
case Mode::MIGRATE:
result = modeMigrate();
break;
case Mode::CHECK:
result = modeCheck();
break;
case Mode::ADD_MIGRATION:
result = modeAddMigration();
break;
case Mode::CLEAN_CHARS:
break;
@ -195,8 +209,8 @@ bool DbManager::modeInit()
content.erase( 0, pos + delimiter.length() );
}
std::cout << "======================================================" << std::endl;
std::cout << "Inserting default values..." << std::endl;
Logger::info( "======================================================" );
Logger::info( "Inserting default values..." );
std::ifstream t1( m_iFile );
@ -273,7 +287,7 @@ bool DbManager::modeLiquidate()
while( resultSet->next() )
{
std::cout << "DROP TABLE `" + resultSet->getString( 1 ) + "`;" << "\n";
Logger::info( "DROP TABLE `{}`;", resultSet->getString( 1 ) );
if( !execute( "DROP TABLE `" + resultSet->getString( 1 ) + "`;" ) )
return false;
}
@ -297,4 +311,175 @@ void DbManager::setSchemaFile( const std::string& sFile )
m_sFile = sFile;
}
void DbManager::setMigratioName( const std::string& name )
{
m_migrationName = name;
}
bool DbManager::modeCheck()
{
if( !selectSchema() )
return false;
std::string query = "SELECT MigrationName FROM __Migration;";
std::vector< std::string > appliedMigrations;
try
{
auto stmt = m_pConnection->createStatement();
auto resultSet = stmt->executeQuery( query );
while( resultSet->next() )
{
appliedMigrations.emplace_back( resultSet->getString( 1 ) );
}
}
catch( std::runtime_error& e )
{
m_lastError = e.what();
return false;
}
uint32_t missing = 0;
for( auto& entry : fs::directory_iterator( "sql/migrations" ) )
{
auto& path = entry.path();
// just in case...
if( path.extension() != ".sql" )
continue;
if( std::find( appliedMigrations.begin(), appliedMigrations.end(), path.filename().string() ) == appliedMigrations.end() )
{
Logger::info( "Missing migration: {}", path.filename().string() );
missing++;
}
}
if( missing > 0 )
{
Logger::warn( "Database is missing {} migration(s).", missing );
}
else
{
Logger::info( "All available migrations have been applied." );
}
return true;
}
bool DbManager::modeMigrate()
{
if( !selectSchema() )
return false;
std::string query = "SELECT MigrationName FROM __Migration;";
std::vector< std::string > appliedMigrations;
try
{
auto stmt = m_pConnection->createStatement();
auto resultSet = stmt->executeQuery( query );
while( resultSet->next() )
{
appliedMigrations.emplace_back( resultSet->getString( 1 ) );
}
}
catch( std::runtime_error& e )
{
m_lastError = e.what();
return false;
}
std::vector< std::string > migrations;
for( auto& entry : fs::directory_iterator( "sql/migrations" ) )
{
auto& path = entry.path();
// just in case...
if( path.extension() != ".sql" )
continue;
migrations.emplace_back( path.string() );
}
std::sort( migrations.begin(), migrations.end() );
for( auto& entry : migrations )
{
auto path = fs::path( entry );
if( std::find( appliedMigrations.begin(), appliedMigrations.end(), path.filename().string() ) == appliedMigrations.end() )
{
Logger::info( "Applying migration: {}", path.filename().string() );
std::ifstream mFile( path.string() );
if( !mFile.is_open() )
{
m_lastError = "File " + path.string() + " does not exist!";
return false;
}
std::string sql( ( std::istreambuf_iterator< char >( mFile ) ),
( std::istreambuf_iterator< char >( ) ) );
try
{
auto stmt = m_pConnection->createStatement();
stmt->executeQuery( sql );
}
catch( std::runtime_error& e )
{
m_lastError = e.what();
return false;
}
// insert into migrations table
if( !execute( fmt::format( "INSERT INTO __Migration (`MigrationName`) VALUES ('{}');", path.filename().string() ) ) )
return false;
}
}
return true;
}
bool DbManager::modeAddMigration()
{
if( !selectSchema() )
return false;
fs::create_directories( "sql/migrations" );
auto filename = fmt::format( "{}_{}.sql", Util::fmtUtcTime( "%Y%m%d%H%M%S" ), m_migrationName );
if( filename.size() > 250 )
{
Logger::error( "Migration name '{}' is longer than 250 characters, please shorten its name.", filename );
return false;
}
auto path = fmt::format( "sql/migrations/{}", filename );
if( fs::exists( path ) )
{
Logger::error( "Migration '{}' already exists.", filename );
return false;
}
std::ofstream mFile( path );
mFile << fmt::format( "-- Migration generated at {}", Util::fmtUtcTime( "%Y/%m/%d %H:%M:%S" ) ) << std::endl;
mFile << fmt::format( "-- {}", filename ) << std::endl << std::endl;
mFile.close();
Logger::info( "New migration created: {}", path );
return true;
}

View file

@ -13,9 +13,10 @@ enum class Mode
{
INIT,
LIQUIDATE,
UPDATE,
MIGRATE,
CHECK,
CLEAN_CHARS
CLEAN_CHARS,
ADD_MIGRATION,
};
class DbManager
@ -37,6 +38,12 @@ class DbManager
bool modeLiquidate();
bool modeCheck();
bool modeMigrate();
bool modeAddMigration();
virtual ~DbManager();
const std::string& getLastError();
@ -49,6 +56,8 @@ class DbManager
void setForceMode( bool mode );
void setMigratioName( const std::string& name );
private:
std::string m_host;
std::string m_database;
@ -61,6 +70,8 @@ class DbManager
std::string m_iFile;
std::string m_sFile;
bool m_force;
std::string m_migrationName;
};

View file

@ -5,7 +5,10 @@
#include <common/Logging/Logger.h>
#include <experimental/filesystem>
#include <MySqlConnector.h>
#include <common/Util/CrashHandler.h>
#include <common/Config/ConfigMgr.h>
Sapphire::Common::Util::CrashHandler crashHandler;
namespace filesys = std::experimental::filesystem;
@ -77,13 +80,14 @@ std::string delChar( std::string &str, char del )
void printUsage()
{
Logger::info( " Usage: sapphire_dbm " );
Logger::info( " Usage: dbm " );
Logger::info( "\t --mode" );
Logger::info( "\t\t initialize -> Creates DB if not present and inserts default tables/data" );
Logger::info( "\t\t check -> Checks if Sapphire DB-Version matches your DB-Version" );
Logger::info( "\t\t update -> Updates your DB-Version to Sapphire DB-Version" );
Logger::info( "\t\t migrate -> Updates your DB-Version to Sapphire DB-Version" );
Logger::info( "\t\t clearchars -> Removes all character data from DB. Accounts will stay untouched" );
Logger::info( "\t\t liquidate -> Removes all tables and deletes the DB" );
Logger::info( "\t\t add-migration -> Creates a new migration with the assoicated up/down sql files" );
Logger::info( "\t --user <mysqlUserName>" );
Logger::info( "\t --pass <mysqlPassword> ( default empty )" );
Logger::info( "\t --host <mysqlHost> ( default 127.0.0.1 )" );
@ -91,6 +95,7 @@ void printUsage()
Logger::info( "\t --database <mysqlDatabase>" );
Logger::info( "\t --sfile <path/to/schemafile> ( default sql/schema/schema.sql )" );
Logger::info( "\t --force ( skips user input / auto Yes )" );
Logger::info( "\t --name <migration name>" );
}
int main( int32_t argc, char* argv[] )
@ -109,8 +114,21 @@ int main( int32_t argc, char* argv[] )
std::string sFile;
std::string iFile;
std::string migrationName;
bool force = false;
// load config first so it can still be overridden if required
Common::ConfigMgr configMgr;
Common::Config::GlobalConfig globalConfig;
if( configMgr.loadGlobalConfig( globalConfig ) )
{
host = globalConfig.database.host;
database = globalConfig.database.database;
user = globalConfig.database.user;
pass = globalConfig.database.password;
}
std::vector< std::string > args( argv + 1, argv + argc );
for( uint32_t i = 0; i + 1 < args.size(); i += 2 )
{
@ -137,6 +155,8 @@ int main( int32_t argc, char* argv[] )
iFile = val;
else if( arg == "force" )
force = true;
else if( arg == "name" )
migrationName = val;
}
if( host.empty() )
@ -155,6 +175,12 @@ int main( int32_t argc, char* argv[] )
dbm.setInsertFile( iFile );
dbm.setSchemaFile( sFile );
}
if( !migrationName.empty() )
{
dbm.setMigratioName( migrationName );
}
if( force )
dbm.setForceMode( true );
//initialize|check|update|clearchars|liquidate
@ -166,9 +192,9 @@ int main( int32_t argc, char* argv[] )
{
dbm.setMode( Mode::CHECK );
}
else if( mode.find( "update" ) != std::string::npos )
else if( mode.find( "migrate" ) != std::string::npos )
{
dbm.setMode( Mode::UPDATE );
dbm.setMode( Mode::MIGRATE );
}
else if( mode.find( "clearchars" ) != std::string::npos )
{
@ -178,6 +204,10 @@ int main( int32_t argc, char* argv[] )
{
dbm.setMode( Mode::LIQUIDATE );
}
else if( mode.find( "add-migration" ) != std::string::npos )
{
dbm.setMode( Mode::ADD_MIGRATION );
}
else
{
Logger::fatal( "Not a valid mode: {0} !", mode );

View file

@ -1,9 +1,5 @@
#include "ExdDataGenerated.h"
#include <boost/make_shared.hpp>
#include <boost/variant.hpp>
#include <memory>
CONSTRUCTORS
Sapphire::Data::ExdDataGenerated::ExdDataGenerated()
@ -16,37 +12,37 @@ Sapphire::Data::ExdDataGenerated::~ExdDataGenerated()
xiv::exd::Exd Sapphire::Data::ExdDataGenerated::setupDatAccess( const std::string& name, xiv::exd::Language lang )
{
auto& cat = m_exd_data->get_category( name );
return static_cast< xiv::exd::Exd >( cat.get_data_ln( lang ) );
auto& cat = m_exd_data->get_category( name );
return static_cast< xiv::exd::Exd >( cat.get_data_ln( lang ) );
};
void Sapphire::Data::ExdDataGenerated::loadIdList( xiv::exd::Exd& data, std::set< uint32_t >& outIdList )
{
auto pDataRows = data.get_rows();
auto pDataRows = data.get_rows();
for( auto row : pDataRows )
{
uint32_t id = row.first;
outIdList.insert( id );
}
for( auto row : pDataRows )
{
uint32_t id = row.first;
outIdList.insert( id );
}
}
bool Sapphire::Data::ExdDataGenerated::init( const std::string& path )
{
try
{
m_data = std::make_shared< xiv::dat::GameData >( path );
m_exd_data = std::make_shared< xiv::exd::ExdData >( *m_data );
try
{
m_data = std::make_shared< xiv::dat::GameData >( path );
m_exd_data = std::make_shared< xiv::exd::ExdData >( *m_data );
SETUPDATACCESS
}
catch( std::runtime_error )
{
return false;
}
}
catch( std::runtime_error )
{
return false;
}
return true;
return true;
}
///////////////////////////////////////////////////////////////

View file

@ -25,23 +25,53 @@ STRUCTS
class ExdDataGenerated
{
public:
ExdDataGenerated();
~ExdDataGenerated();
ExdDataGenerated();
~ExdDataGenerated();
bool init( const std::string& path );
bool init( const std::string& path );
xiv::exd::Exd setupDatAccess( const std::string& name, xiv::exd::Language lang );
xiv::exd::Exd setupDatAccess( const std::string& name, xiv::exd::Language lang );
template< class T >
T getField( std::vector< xiv::exd::Field >& fields, uint32_t index )
{
return std::get< T >( fields.at( index ) );
}
template< class T >
T getField( std::vector< xiv::exd::Field >& fields, uint32_t index )
{
return std::get< T >( fields.at( index ) );
}
void loadIdList( xiv::exd::Exd& data, std::set< uint32_t >& outIdList );
void loadIdList( xiv::exd::Exd& data, std::set< uint32_t >& outIdList );
std::shared_ptr< xiv::dat::GameData > m_data;
std::shared_ptr< xiv::exd::ExdData > m_exd_data;
std::shared_ptr< xiv::dat::GameData > m_data;
std::shared_ptr< xiv::exd::ExdData > m_exd_data;
template< class T >
std::shared_ptr< T > get( uint32_t id )
{
try
{
auto info = std::make_shared< T >( id, this );
return info;
}
catch( ... )
{
return nullptr;
}
return nullptr;
}
template< class T >
std::shared_ptr< T > get( uint32_t id, uint32_t slotId )
{
try
{
auto info = std::make_shared< T >( id, slotId, this );
return info;
}
catch( ... )
{
return nullptr;
}
return nullptr;
}
DATACCESS

View file

@ -11,6 +11,7 @@
#include <set>
#include <Exd/ExdDataGenerated.h>
#include <Logging/Logger.h>
#include <experimental/filesystem>
#include <nlohmann/json.hpp>
@ -21,6 +22,8 @@
using namespace Sapphire;
namespace fs = std::experimental::filesystem;
Sapphire::Data::ExdDataGenerated g_exdData;
bool skipUnmapped = true;
@ -38,10 +41,12 @@ std::map< char, std::string > numberToStringMap
{ '9', "nine" },
};
std::vector< std::string > cppKeyWords
std::vector< std::string > reservedWords
{
"new",
"class"
"class",
"long",
"short"
};
//std::string datLocation( "/home/mordred/sqpack" );
@ -86,7 +91,7 @@ std::string generateSetDatAccessCall( const std::string& exd )
if( langs.size() > 1 )
lang = "xiv::exd::Language::en";
return " m_" + exd + "Dat = setupDatAccess( \"" + exd + "\", " + lang + " );\n";
return " m_" + exd + "Dat = setupDatAccess( \"" + exd + "\", " + lang + " );\n";
}
std::string generateDirectGetterDef()
@ -111,65 +116,63 @@ std::string generateStruct( const std::string& exd )
int count = 0;
auto json = nlohmann::json();
std::ifstream exJson( "ex.json" );
exJson >> json;
for( auto& sheet : json[ "sheets" ] )
auto path = fmt::format( "Definitions/{}.json", exd );
if( !fs::exists( path ) )
{
if( sheet[ "sheet" ] != exd )
continue;
Logger::warn( "No definition for exd: {}", exd );
return "";
}
for( auto& definition : sheet[ "definitions" ] )
auto sheet = nlohmann::json();
std::ifstream defJson( path );
defJson >> sheet;
for( auto& definition : sheet[ "definitions" ] )
{
uint32_t index;
std::string converterTarget = "";
bool isRepeat = false;
int num = 0;
try
{
uint32_t index;
std::string converterTarget = "";
bool isRepeat = false;
int num = 0;
try
{
index = definition.at( "index" );
}
catch( ... )
{
index = 0;
}
try
{
std::string fieldName = std::string( definition.at( "name" ) );
indexToNameMap[ index ] = fieldName;
}
catch( ... )
{
}
try
{
converterTarget = std::string( definition.at( "converter" ).at( "target" ) );
if( nameTaken.find( converterTarget ) != nameTaken.end() )
indexToTarget[ index ] = converterTarget;
}
catch( ... )
{
}
try
{
num = definition.at( "count" );
isRepeat = true;
indexIsArrayMap[ index ] = true;
indexCountMap[ index ] = num;
std::string fName = definition.at( "definition" ).at( "name" );
indexToNameMap[ index ] = fName;
}
catch( ... )
{
}
index = definition.at( "index" );
}
catch( ... )
{
index = 0;
}
try
{
std::string fieldName = std::string( definition.at( "name" ) );
indexToNameMap[ index ] = fieldName;
}
catch( ... )
{
}
try
{
converterTarget = std::string( definition.at( "converter" ).at( "target" ) );
if( nameTaken.find( converterTarget ) != nameTaken.end() )
indexToTarget[ index ] = converterTarget;
}
catch( ... )
{
}
try
{
num = definition.at( "count" );
isRepeat = true;
indexIsArrayMap[ index ] = true;
indexCountMap[ index ] = num;
std::string fName = definition.at( "definition" ).at( "name" );
indexToNameMap[ index ] = fName;
}
catch( ... )
{
}
}
std::string result = "struct " + exd + "\n{\n";
@ -202,7 +205,7 @@ std::string generateStruct( const std::string& exd )
}
fieldName[ 0 ] = std::tolower( fieldName[ 0 ] );
std::string badChars = ",-':![](){}<>% \x02\x1f\x01\x03";
std::string badChars = ",-':![](){}/<>% \x02\x1f\x01\x03";
std::for_each( badChars.begin(), badChars.end(), [ &fieldName ]( const char c )
{
fieldName.erase( std::remove( fieldName.begin(), fieldName.end(), c ), fieldName.end() );
@ -217,23 +220,23 @@ std::string generateStruct( const std::string& exd )
}
}
for( std::string keyword : cppKeyWords )
for( std::string keyword : reservedWords )
{
if( fieldName == keyword )
fieldName[ 0 ] = toupper( fieldName[ 0 ] );
fieldName = fmt::format( "_{}", fieldName );
}
indexToNameMap[ count ] = fieldName;
indexToTypeMap[ count ] = type;
if( indexToTarget.find( count ) != indexToTarget.end() )
result += " std::shared_ptr< " + indexToTarget[ count ] + "> " + fieldName + ";\n";
result += " std::shared_ptr< " + indexToTarget[ count ] + "> " + fieldName + ";\n";
else
{
if( indexIsArrayMap.find( count ) != indexIsArrayMap.end() )
{
type = "std::vector< " + type + " >";
}
result += " " + type + " " + fieldName + ";\n";
result += " " + type + " " + fieldName + ";\n";
}
@ -243,11 +246,11 @@ std::string generateStruct( const std::string& exd )
auto exhHead = exh.get_header();
if( exhHead.variant == 2 )
{
result += "\n " + exd + "( uint32_t row_id, uint32_t subRow, Sapphire::Data::ExdDataGenerated* exdData );\n";
result += "\n " + exd + "( uint32_t row_id, uint32_t subRow, Sapphire::Data::ExdDataGenerated* exdData );\n";
}
else
{
result += "\n " + exd + "( uint32_t row_id, Sapphire::Data::ExdDataGenerated* exdData );\n";
result += "\n " + exd + "( uint32_t row_id, Sapphire::Data::ExdDataGenerated* exdData );\n";
}
result += "};\n\n";
@ -264,7 +267,7 @@ std::string generateConstructorsDecl( const std::string& exd )
int count = 0;
std::string indent = " ";
std::string indent = " ";
auto exhHead = exh.get_header();
if( exhHead.variant == 2 )
{
@ -351,11 +354,6 @@ int main( int argc, char** argv )
std::istreambuf_iterator< char >() );
std::ifstream exJson( "ex.json" );
auto json = nlohmann::json();
exJson >> json;
Logger::info( "Setting up EXD data" );
if( !g_exdData.init( datLocation ) )
{
@ -380,34 +378,36 @@ int main( int argc, char** argv )
//nameTaken[name] = "1";
//}
//
for( auto& sheet : json[ "sheets" ] )
if( !fs::exists( "Definitions" ) )
{
std::string name = sheet[ "sheet" ];
forwards += "struct " + name + ";\n";
structDefs += generateStruct( name );
dataDecl += generateDatAccessDecl( name );
idListsDecl += generateIdListDecl( name );
getterDecl += generateDirectGetters( name );
datAccCall += generateSetDatAccessCall( name );
constructorDecl += generateConstructorsDecl( name );
idListGetters += generateIdListGetter( name );
Logger::error( "Missing definitions directory. Copy it from SaintCoinach to the working directory." );
return 1;
}
getterDecl +=
"\n template< class T >\n"
" std::shared_ptr< T > get( uint32_t id )\n"
" {\n"
" try\n"
" {\n"
" auto info = std::make_shared< T >( id, this );\n"
" return info;\n"
" }\n"
" catch( ... )\n"
" {\n"
" return nullptr;\n"
" }\n"
" return nullptr;\n"
" }\n";
uint32_t entryCount = 0;
for( auto& entry : fs::directory_iterator( "./Definitions/" ) )
{
auto& path = entry.path();
if( path.extension() != ".json" )
continue;
entryCount++;
auto name = path.stem().string();
forwards += "struct " + name + ";\n";
structDefs += generateStruct( name );
dataDecl += generateDatAccessDecl( name );
idListsDecl += generateIdListDecl( name );
getterDecl += generateDirectGetters( name );
datAccCall += generateSetDatAccessCall( name );
constructorDecl += generateConstructorsDecl( name );
idListGetters += generateIdListGetter( name );
}
Logger::info( "Processed {} definition files, writing files...", entryCount );
getterDef += generateDirectGetterDef();
@ -438,5 +438,7 @@ int main( int argc, char** argv )
// g_log.info( result );
Logger::info( "done." );
return 0;
}

View file

@ -99,8 +99,8 @@ bool Action::Action::init()
}
}
m_primaryCostType = static_cast< Common::ActionPrimaryCostType >( m_actionData->costType );
m_primaryCost = m_actionData->cost;
m_primaryCostType = static_cast< Common::ActionPrimaryCostType >( m_actionData->primaryCostType );
m_primaryCost = m_actionData->primaryCostValue;
/*if( !m_actionData->targetArea )
{

View file

@ -457,7 +457,7 @@ void Sapphire::Entity::Chara::addStatusEffect( StatusEffect::StatusEffectPtr pEf
pEffect->applyStatus();
m_statusEffectMap[ nextSlot ] = pEffect;
auto statusEffectAdd = makeZonePacket< FFXIVIpcAddStatusEffect >( getId() );
auto statusEffectAdd = makeZonePacket< FFXIVIpcEffectResult >( getId() );
statusEffectAdd->data().actor_id = pEffect->getTargetActorId();
statusEffectAdd->data().actor_id1 = pEffect->getSrcActorId();

View file

@ -25,7 +25,7 @@
#include "Network/PacketWrappers/ActorControlPacket142.h"
#include "Network/PacketWrappers/ActorControlPacket143.h"
#include "Network/PacketWrappers/ActorControlPacket144.h"
#include "Network/PacketWrappers/InitUIPacket.h"
#include "Network/PacketWrappers/PlayerSetupPacket.h"
#include "Network/PacketWrappers/ServerNoticePacket.h"
#include "Network/PacketWrappers/ChatPacket.h"
#include "Network/PacketWrappers/ModelEquipPacket.h"
@ -1717,7 +1717,7 @@ void Sapphire::Entity::Player::sendZonePackets()
}
queuePacket( contentFinderList );
queuePacket( std::make_shared< InitUIPacket >( *this ) );
queuePacket( std::make_shared< PlayerSetupPacket >( *this ) );
auto classInfoPacket = makeZonePacket< FFXIVIpcPlayerClassInfo >( getId() );
classInfoPacket->data().classId = static_cast< uint8_t >( getClass() );

View file

@ -4,7 +4,7 @@
#include "Network/GameConnection.h"
#include "Network/PacketWrappers/ActorControlPacket142.h"
#include "Network/PacketWrappers/InitUIPacket.h"
#include "Network/PacketWrappers/PlayerSetupPacket.h"
#include "Network/PacketWrappers/ServerNoticePacket.h"
#include "Network/PacketWrappers/EventStartPacket.h"
#include "Network/PacketWrappers/EventPlayPacket.h"

View file

@ -10,7 +10,7 @@
#include <Database/DatabaseDef.h>
#include "Network/GameConnection.h"
#include "Network/PacketWrappers/InitUIPacket.h"
#include "Network/PacketWrappers/PlayerSetupPacket.h"
#include "Manager/TerritoryMgr.h"
#include "Territory/Zone.h"

View file

@ -18,7 +18,7 @@
#include "Network/PacketWrappers/ServerNoticePacket.h"
#include "Network/PacketWrappers/ActorControlPacket142.h"
#include "Network/PacketWrappers/ActorControlPacket143.h"
#include "Network/PacketWrappers/InitUIPacket.h"
#include "Network/PacketWrappers/PlayerSetupPacket.h"
#include "Network/PacketWrappers/PlayerSpawnPacket.h"
#include "Network/GameConnection.h"
#include "Script/ScriptMgr.h"
@ -237,7 +237,7 @@ void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player&
else if( subCommand == "discovery_reset" )
{
player.resetDiscovery();
player.queuePacket( std::make_shared< InitUIPacket >( player ) );
player.queuePacket( std::make_shared< PlayerSetupPacket >( player ) );
}
else if( subCommand == "classjob" )
{

View file

@ -10,7 +10,7 @@
#include "Territory/Zone.h"
#include "Network/PacketWrappers/InitUIPacket.h"
#include "Network/PacketWrappers/PlayerSetupPacket.h"
#include "Manager/DebugCommandMgr.h"

View file

@ -15,7 +15,7 @@
#include "Network/GameConnection.h"
#include "Network/PacketWrappers/ExaminePacket.h"
#include "Network/PacketWrappers/InitUIPacket.h"
#include "Network/PacketWrappers/PlayerSetupPacket.h"
#include "Network/PacketWrappers/PingPacket.h"
#include "Network/PacketWrappers/MoveActorPacket.h"
#include "Network/PacketWrappers/ChatPacket.h"

View file

@ -17,7 +17,7 @@
#include "Territory/Zone.h"
#include "Territory/InstanceContent.h"
#include "Network/PacketWrappers/InitUIPacket.h"
#include "Network/PacketWrappers/PlayerSetupPacket.h"
#include "Network/PacketWrappers/PingPacket.h"
#include "Network/PacketWrappers/MoveActorPacket.h"
#include "Network/PacketWrappers/ChatPacket.h"

View file

@ -21,7 +21,7 @@
#include "Territory/ZonePosition.h"
#include "Territory/House.h"
#include "Network/PacketWrappers/InitUIPacket.h"
#include "Network/PacketWrappers/PlayerSetupPacket.h"
#include "Network/PacketWrappers/PingPacket.h"
#include "Network/PacketWrappers/MoveActorPacket.h"
#include "Network/PacketWrappers/ChatPacket.h"

View file

@ -10,14 +10,14 @@ namespace Sapphire::Network::Packets::Server
{
/**
* @brief The Client UI Initialization packet. This must be sent to the client
* @brief The Client Player Initialization packet. This must be sent to the client
* once upon connection to configure the UI.
*/
class InitUIPacket : public ZoneChannelPacket< FFXIVIpcInitUI >
class PlayerSetupPacket : public ZoneChannelPacket< FFXIVIpcPlayerSetup >
{
public:
InitUIPacket( Entity::Player& player ) :
ZoneChannelPacket< FFXIVIpcInitUI >( player.getId(), player.getId() )
PlayerSetupPacket( Entity::Player& player ) :
ZoneChannelPacket< FFXIVIpcPlayerSetup >( player.getId(), player.getId() )
{
initialize( player );
};