From df421d34c594a616b7d1ece60ce21c900034ff65 Mon Sep 17 00:00:00 2001 From: goaaats Date: Fri, 25 May 2018 14:16:39 +0200 Subject: [PATCH 01/10] Use generated EXD data for quest_parse --- src/tools/quest_parser/main.cpp | 119 ++++++++++++++++---------------- 1 file changed, 61 insertions(+), 58 deletions(-) diff --git a/src/tools/quest_parser/main.cpp b/src/tools/quest_parser/main.cpp index 666bb61c..72c124dc 100644 --- a/src/tools/quest_parser/main.cpp +++ b/src/tools/quest_parser/main.cpp @@ -16,11 +16,13 @@ #include #include +#include #include +#include "exd_struct_gen/ExdDataGenerated.h" Core::Logger g_log; -Core::Data::ExdData g_exdData; +Core::Data::ExdDataGenerated g_exdDataGen; const std::string onTalkStr( " void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override\n" @@ -58,7 +60,7 @@ std::string titleCase( const std::string& str ) return retStr; } -void createScript( boost::shared_ptr< Core::Data::QuestInfo >& pQuestData, std::set< std::string >& additionalList ) +void createScript( boost::shared_ptr< Core::Data::Quest >& pQuestData, std::set< std::string >& additionalList, int questId ) { std::string header( "// This is an automatically generated C++ script template\n" @@ -69,8 +71,8 @@ void createScript( boost::shared_ptr< Core::Data::QuestInfo >& pQuestData, std:: "#include \n\n" ); - std::size_t splitPos( pQuestData->name_intern.find( "_" ) ); - std::string className( pQuestData->name_intern.substr( 0, splitPos ) ); + std::size_t splitPos( pQuestData->id.find( "_" ) ); + std::string className( pQuestData->id.substr( 0, splitPos ) ); //className = "Quest" + className; std::string sceneStr( " //////////////////////////////////////////////////////////////////////\n // Available Scenes in this quest, not necessarly all are used\n" ); std::string seqStr; @@ -131,26 +133,26 @@ void createScript( boost::shared_ptr< Core::Data::QuestInfo >& pQuestData, std:: std::string rewards; rewards.reserve( 0xFFF ); rewards += " // Quest rewards \n"; - rewards += ( pQuestData->reward_exp_factor != 0 ) ? " static constexpr auto RewardExpFactor = " + std::to_string( pQuestData->reward_exp_factor ) + ";\n" : ""; - rewards += ( pQuestData->reward_gil != 0 ) ? " static constexpr auto RewardGil = " + std::to_string( pQuestData->reward_gil ) + ";\n" : ""; - rewards += ( pQuestData->reward_emote != 0 ) ? " static constexpr auto RewardEmote = " + std::to_string( pQuestData->reward_emote ) + ";\n" : ""; - rewards += ( pQuestData->reward_action != 0 ) ? " static constexpr auto RewardAction = " + std::to_string( pQuestData->reward_action ) + ";\n" : ""; - rewards += ( pQuestData->reward_action_general1 != 0 ) ? " static constexpr auto RewardGeneralAction1 = " + std::to_string( pQuestData->reward_action_general1 ) + ";\n" : ""; - rewards += ( pQuestData->reward_action_general2 != 0 ) ? " static constexpr auto RewardGeneralAction2 = " + std::to_string( pQuestData->reward_action_general2 ) + ";\n" : ""; - rewards += ( pQuestData->reward_gc_seals != 0 ) ? " static constexpr auto RewardGCSeals = " + std::to_string( pQuestData->reward_gc_seals ) + ";\n" : ""; - rewards += ( pQuestData->reward_other != 0 ) ? " static constexpr auto RewardOther = " + std::to_string( pQuestData->reward_other ) + ";\n" : ""; - rewards += ( pQuestData->reward_reputation != 0 ) ? " static constexpr auto RewardReputation = " + std::to_string( pQuestData->reward_reputation ) + ";\n" : ""; - rewards += ( pQuestData->reward_tome_type != 0 ) ? " static constexpr auto RewardTomeType = " + std::to_string( pQuestData->reward_tome_type ) + ";\n" : ""; - rewards += ( pQuestData->reward_tome_count != 0 ) ? " static constexpr auto RewardTomeCount = " + std::to_string( pQuestData->reward_tome_count ) + ";\n" : ""; - rewards += ( pQuestData->instanced_content_unlock != 0 ) ? " static constexpr auto InstancedContentUnlock = " + std::to_string( pQuestData->instanced_content_unlock ) + ";\n" : ""; + rewards += ( pQuestData->expFactor != 0 ) ? " static constexpr auto RewardExpFactor = " + std::to_string( pQuestData->expFactor ) + ";\n" : ""; + rewards += ( pQuestData->gilReward != 0 ) ? " static constexpr auto RewardGil = " + std::to_string( pQuestData->gilReward ) + ";\n" : ""; + rewards += ( pQuestData->emoteReward != 0 ) ? " static constexpr auto RewardEmote = " + std::to_string( pQuestData->emoteReward ) + ";\n" : ""; + rewards += ( pQuestData->actionReward != 0 ) ? " static constexpr auto RewardAction = " + std::to_string( pQuestData->actionReward ) + ";\n" : ""; + rewards += ( pQuestData->generalActionReward[0] != 0 ) ? " static constexpr auto RewardGeneralAction1 = " + std::to_string( pQuestData->generalActionReward[0] ) + ";\n" : ""; + rewards += ( pQuestData->generalActionReward[1] != 0 ) ? " static constexpr auto RewardGeneralAction2 = " + std::to_string( pQuestData->generalActionReward[1] ) + ";\n" : ""; + rewards += ( pQuestData->gCSeals != 0 ) ? " static constexpr auto RewardGCSeals = " + std::to_string( pQuestData->gCSeals ) + ";\n" : ""; + rewards += ( pQuestData->otherReward != 0 ) ? " static constexpr auto RewardOther = " + std::to_string( pQuestData->otherReward ) + ";\n" : ""; + rewards += ( pQuestData->reputationReward != 0 ) ? " static constexpr auto RewardReputation = " + std::to_string( pQuestData->reputationReward ) + ";\n" : ""; + rewards += ( pQuestData->tomestoneReward != 0 ) ? " static constexpr auto RewardTomeType = " + std::to_string( pQuestData->tomestoneReward ) + ";\n" : ""; + rewards += ( pQuestData->tomestoneCountReward != 0 ) ? " static constexpr auto RewardTomeCount = " + std::to_string( pQuestData->tomestoneCountReward ) + ";\n" : ""; + rewards += ( pQuestData->instanceContentUnlock != 0 ) ? " static constexpr auto InstancedContentUnlock = " + std::to_string( pQuestData->instanceContentUnlock ) + ";\n" : ""; - if( pQuestData->reward_item.size() > 0 ) + if( !pQuestData->itemReward0.empty() ) { rewards += " static constexpr auto RewardItem[] = { "; - for( size_t ca = 0; ca < pQuestData->reward_item.size(); ca++ ) + for( size_t ca = 0; ca < pQuestData->itemReward0.size(); ca++ ) { - rewards += std::to_string( pQuestData->reward_item.at( ca ) ); - if( ca != pQuestData->reward_item.size() - 1 ) + rewards += std::to_string( pQuestData->itemReward0.at( ca ) ); + if( ca != pQuestData->itemReward0.size() - 1 ) { rewards += ", "; } @@ -158,13 +160,13 @@ void createScript( boost::shared_ptr< Core::Data::QuestInfo >& pQuestData, std:: rewards += " };\n"; } - if( pQuestData->reward_item.size() > 0 ) + if( !pQuestData->itemReward0.empty() ) { rewards += " static constexpr auto RewardItemCount[] = { "; - for( size_t ca = 0; ca < pQuestData->reward_item_count.size(); ca++ ) + for( size_t ca = 0; ca < pQuestData->itemCountReward0.size(); ca++ ) { - rewards += std::to_string( pQuestData->reward_item_count.at( ca ) ); - if( ca != pQuestData->reward_item_count.size() - 1 ) + rewards += std::to_string( pQuestData->itemCountReward0.at( ca ) ); + if( ca != pQuestData->itemCountReward0.size() - 1 ) { rewards += ", "; } @@ -172,13 +174,13 @@ void createScript( boost::shared_ptr< Core::Data::QuestInfo >& pQuestData, std:: rewards += " };\n"; } - if( pQuestData->reward_item_optional.size() > 0 ) + if( !pQuestData->itemReward1.empty() ) { rewards += " static constexpr auto RewardItemOptional[] = { "; - for( size_t ca = 0; ca < pQuestData->reward_item_optional.size(); ca++ ) + for( size_t ca = 0; ca < pQuestData->itemReward1.size(); ca++ ) { - rewards += std::to_string( pQuestData->reward_item_optional.at( ca ) ); - if( ca != pQuestData->reward_item_optional.size() - 1 ) + rewards += std::to_string( pQuestData->itemReward1.at( ca ) ); + if( ca != pQuestData->itemReward1.size() - 1 ) { rewards += ", "; } @@ -186,13 +188,13 @@ void createScript( boost::shared_ptr< Core::Data::QuestInfo >& pQuestData, std:: rewards += " };\n"; } - if( pQuestData->reward_item_optional_count.size() > 0 ) + if( !pQuestData->itemCountReward1.empty() ) { rewards += " static constexpr auto RewardItemOptionalCount[] = { "; - for( size_t ca = 0; ca < pQuestData->reward_item_optional_count.size(); ca++ ) + for( size_t ca = 0; ca < pQuestData->itemCountReward1.size(); ca++ ) { - rewards += std::to_string( pQuestData->reward_item_optional_count.at( ca ) ); - if( ca != pQuestData->reward_item_optional_count.size() - 1 ) + rewards += std::to_string( pQuestData->itemCountReward1.at( ca ) ); + if( ca != pQuestData->itemCountReward1.size() - 1 ) { rewards += ", "; } @@ -207,21 +209,22 @@ void createScript( boost::shared_ptr< Core::Data::QuestInfo >& pQuestData, std:: std::vector< std::string > script_entities; std::string sentities = " // Entities found in the script data of the quest\n"; - for( size_t ca = 0; ca < pQuestData->script_entity.size(); ca ++ ) + for( size_t ca = 0; ca < pQuestData->scriptInstruction.size(); ca ++ ) { - if( ( pQuestData->script_entity.at( ca ).find( "HOWTO" ) != std::string::npos ) || ( pQuestData->script_entity.at( ca ).find( "HOW_TO" ) != std::string::npos ) ) + if( ( pQuestData->scriptInstruction.at( ca ).find( "HOWTO" ) != std::string::npos ) || ( pQuestData->scriptInstruction.at( ca ).find( "HOW_TO" ) != std::string::npos ) ) continue; - if( ( pQuestData->script_entity.at( ca ).find( "EMOTENO" ) != std::string::npos ) || ( pQuestData->script_entity.at( ca ).find( "EMOTEOK" ) != std::string::npos ) ) + if( ( pQuestData->scriptInstruction.at( ca ).find( "EMOTENO" ) != std::string::npos ) || ( pQuestData->scriptInstruction.at( ca ).find( "EMOTEOK" ) != std::string::npos ) ) hasEmote = true; - if( pQuestData->script_entity.at( ca ).find( "ENEMY" ) != std::string::npos ) + if( pQuestData->scriptInstruction.at( ca ).find( "ENEMY" ) != std::string::npos ) { hasEnemies = true; - enemy_ids.push_back( pQuestData->script_value.at( ca ) ); + enemy_ids.push_back( pQuestData->scriptArg.at( ca ) ); } - script_entities.push_back( pQuestData->script_entity.at( ca ) + " = " + std::to_string( pQuestData->script_value.at( ca ) ) ); + if( !pQuestData->scriptInstruction.at( ca ).empty() ) + script_entities.push_back( pQuestData->scriptInstruction.at( ca ) + " = " + std::to_string( pQuestData->scriptArg.at( ca ) ) ); } std::sort( script_entities.begin(), script_entities.end() ); for( auto& entity : script_entities ) @@ -231,11 +234,11 @@ void createScript( boost::shared_ptr< Core::Data::QuestInfo >& pQuestData, std:: sentities += " static constexpr auto " + name + ";\n"; } - std::string additional = "// Quest Script: " + pQuestData->name_intern + "\n"; + std::string additional = "// Quest Script: " + pQuestData->id + "\n"; additional += "// Quest Name: " + pQuestData->name + "\n"; - additional += "// Quest ID: " + std::to_string( pQuestData->id ) + "\n"; - additional += "// Start NPC: " + std::to_string( pQuestData->enpc_resident_start ) + "\n"; - additional += "// End NPC: " + std::to_string( pQuestData->enpc_resident_end ) + "\n\n"; + additional += "// Quest ID: " + std::to_string( questId ) + "\n"; + additional += "// Start NPC: " + std::to_string( pQuestData->eNpcResidentStart ) + "\n"; + additional += "// End NPC: " + std::to_string( pQuestData->eNpcResidentEnd ) + "\n\n"; std::string scriptEntry; scriptEntry.reserve(0xFFFF); @@ -271,7 +274,7 @@ void createScript( boost::shared_ptr< Core::Data::QuestInfo >& pQuestData, std:: constructor += rewards + "\n"; constructor += sentities + "\n"; constructor += " public:\n"; - constructor += " " + className + "() : EventScript" + "( " + std::to_string( pQuestData->id ) + " ){}; \n"; + constructor += " " + className + "() : EventScript" + "( " + std::to_string( questId ) + " ){}; \n"; constructor += " ~" + className + "(){}; \n"; std::string classString( @@ -287,7 +290,7 @@ void createScript( boost::shared_ptr< Core::Data::QuestInfo >& pQuestData, std:: std::ofstream outputFile; - outputFile.open( "generated/" + className + ".cpp_generated" ); + outputFile.open( "generated/" + className + ".cpp" ); outputFile << header << additional << classString; outputFile.close(); } @@ -308,8 +311,8 @@ int main( int argc, char** argv ) unluac = true; - g_log.info( "Setting up EXD data" ); - if( !g_exdData.init( datLocation ) ) + g_log.info( "Setting up generated EXD data" ); + if( !g_exdDataGen.init( datLocation ) ) { std::cout << datLocation << "\n"; g_log.fatal( "Error setting up EXD data " ); @@ -318,33 +321,33 @@ int main( int argc, char** argv ) } xiv::dat::GameData data( datLocation ); - xiv::exd::ExdData eData( data ); - auto QuestDat = g_exdData.setupDatAccess( "Quest", xiv::exd::Language::en ); - auto rows = QuestDat.get_rows(); + auto rows = g_exdDataGen.getQuestIdList(); if ( !boost::filesystem::exists( "./generated" ) ) boost::filesystem::create_directory( "./generated" ); - std::cout << "Export in progress"; + g_log.info( "Export in progress" ); + uint32_t updateInterval = rows.size() / 20; uint32_t i = 0; for( const auto& row : rows ) { - auto questInfo = g_exdData.getQuestInfo( row.first ); + g_log.info( "Generating " + std::to_string( row ) ); + auto questInfo = g_exdDataGen.get( row ); - if( questInfo->name.empty() || questInfo->name_intern.empty() ) + if( questInfo->name.empty() || questInfo->id.empty() ) { continue; } - size_t pos_seperator = questInfo->name_intern.find_first_of( "_" ); + size_t pos_seperator = questInfo->id.find_first_of( "_" ); std::string folder; if( pos_seperator != std::string::npos ) { - folder = questInfo->name_intern.substr( pos_seperator + 1, 3 ); + folder = questInfo->id.substr( pos_seperator + 1, 3 ); } else { @@ -355,7 +358,7 @@ int main( int argc, char** argv ) const xiv::dat::Cat& test = data.getCategory( "game_script" ); - const std::string questPath = "game_script/quest/" + folder + "/" + questInfo->name_intern + ".luab"; + const std::string questPath = "game_script/quest/" + folder + "/" + questInfo->id + ".luab"; const auto &test_file = data.getFile( questPath ); auto §ion = test_file->access_data_sections().at( 0 ); @@ -366,12 +369,12 @@ int main( int argc, char** argv ) uint32_t offset = 0; std::ofstream outputFile1; - outputFile1.open( "generated/" + questInfo->name_intern + ".luab", std::ios::binary ); + outputFile1.open( "generated/" + questInfo->id + ".luab", std::ios::binary ); outputFile1.write( §ion[0], section.size() ); outputFile1.close(); if( unluac ) { - std::string command = std::string( "java -jar unluac_2015_06_13.jar " ) + "generated/" + questInfo->name_intern + ".luab" + ">> " + "generated/" + questInfo->name_intern + ".lua"; + std::string command = std::string( "java -jar unluac_2015_06_13.jar " ) + "generated/" + questInfo->id + ".luab" + ">> " + "generated/" + questInfo->id + ".lua"; if ( system( command.c_str() ) == -1 ) { g_log.error( "Error executing java command:\n" + command + "\nerrno: " + std::strerror( errno ) ); @@ -402,7 +405,7 @@ int main( int argc, char** argv ) } - createScript( questInfo, stringList ); + createScript( questInfo, stringList, row ); ++i; if( i % updateInterval == 0 ) std::cout << "."; From e13903041626024c58737e4f1a31f18a05658774 Mon Sep 17 00:00:00 2001 From: goaaats Date: Fri, 25 May 2018 14:27:54 +0200 Subject: [PATCH 02/10] Fixed bad include --- src/tools/quest_parser/main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/tools/quest_parser/main.cpp b/src/tools/quest_parser/main.cpp index 72c124dc..9c4098f8 100644 --- a/src/tools/quest_parser/main.cpp +++ b/src/tools/quest_parser/main.cpp @@ -18,7 +18,6 @@ #include #include #include -#include "exd_struct_gen/ExdDataGenerated.h" Core::Logger g_log; From 8439b9a922905e0c05d9d54d23cd3eaf4df6367b Mon Sep 17 00:00:00 2001 From: Mordred Date: Sun, 27 May 2018 16:21:52 +0200 Subject: [PATCH 03/10] More initui adjustments --- .../Network/PacketDef/Zone/ServerZoneDef.h | 292 +++++++++--------- .../Network/PacketWrappers/InitUIPacket.h | 2 +- 2 files changed, 143 insertions(+), 151 deletions(-) diff --git a/src/common/Network/PacketDef/Zone/ServerZoneDef.h b/src/common/Network/PacketDef/Zone/ServerZoneDef.h index b88b6024..1385202a 100644 --- a/src/common/Network/PacketDef/Zone/ServerZoneDef.h +++ b/src/common/Network/PacketDef/Zone/ServerZoneDef.h @@ -609,157 +609,149 @@ struct FFXIVIpcInitZone : FFXIVIpcBasePacket */ struct FFXIVIpcInitUI : FFXIVIpcBasePacket { - uint64_t contentId; - uint32_t unknown8; - uint32_t unknownC; - uint32_t charId; - uint32_t restedExp; - - uint32_t companionCurrentExp; - - uint32_t unknown3C; - uint32_t fishCaught; - uint32_t useBaitCatalogId; - - uint32_t pvpWolfFoldMatches; - uint16_t pvpWolfFoldWeeklyMatches; - uint16_t pvpWolfFoldWeeklyVictories; - uint16_t pvpStats[6]; - uint16_t playerCommendations; - uint16_t pvpStats1; - uint8_t frontlineCampaigns[4]; - uint16_t frontlineCampaignsWeekly; - uint8_t currentRelic; - uint8_t currentBook; - uint8_t masterCrafterMask; - uint8_t unknown69; - uint8_t unknown6A; - uint8_t unknown6B; - uint8_t unknown6C[4]; - uint8_t unknown70[34]; - - uint16_t unknown18; - uint8_t maxLevel; - uint8_t expansion; - uint8_t unknown; - uint8_t race; - uint8_t tribe; - uint8_t gender; - uint8_t currentJob; - uint8_t currentClass; - uint8_t deity; - uint8_t namedayMonth; - uint8_t namedayDay; - uint8_t cityState; - uint8_t homepoint; - uint8_t unknown26; - uint8_t petHotBar; - uint8_t companionRank; - uint8_t companionStars; - uint8_t companionSp; - uint8_t companionUnk2B; - uint8_t companionColor; - uint8_t companionFavoFeed; - uint8_t companionUnk2E; - uint8_t companionTimePassed[4]; - uint16_t unknown38[11]; - - uint32_t exp[25]; - uint8_t unknown564[16]; - uint32_t pvpFrontlineOverall1st; - uint32_t pvpFrontlineOverall2nd; - uint32_t pvpFrontlineOverall3rd; - uint8_t relicBookCompletion1[4]; - uint16_t levels[25]; - uint16_t levelsPadding; - uint8_t unknown__[16]; - uint16_t fishingRecordsFish[26]; - uint16_t fishingRecordsFishWeight[26]; - uint8_t unknownMask554[44]; - - uint8_t companion_name[21]; - uint8_t companionDefRank; - uint8_t companionAttRank; - uint8_t companionHealRank; - uint8_t mountGuideMask[16]; + // plain C types for a bit until the packet is actually fixed. + // makes conversion between different editors easier. + __int64 contentId; + unsigned int unknown8; + unsigned int unknownC; + unsigned int charId; + unsigned int restedExp; + unsigned int companionCurrentExp; + unsigned int unknown3C; + unsigned int fishCaught; + unsigned int useBaitCatalogId; + unsigned int pvpWolfFoldMatches; + unsigned __int16 pvpWolfFoldWeeklyMatches; + unsigned __int16 pvpWolfFoldWeeklyVictories; + unsigned __int16 pvpStats[6]; + unsigned __int16 playerCommendations; + unsigned __int16 pvpStats1; + unsigned __int8 frontlineCampaigns[4]; + unsigned __int16 frontlineCampaignsWeekly; + unsigned __int8 currentRelic; + unsigned __int8 currentBook; + unsigned __int8 masterCrafterMask; + unsigned __int8 unknown69; + unsigned __int8 unknown6A; + unsigned __int8 unknown6B; + unsigned __int8 unknown6C[4]; + unsigned __int8 unknown50[34]; + unsigned __int16 unknown18; + unsigned __int8 maxLevel; + unsigned __int8 expansion; + unsigned __int8 unknown76; + unsigned __int8 race; + unsigned __int8 tribe; + unsigned __int8 gender; + unsigned __int8 currentJob; + unsigned __int8 currentClass; + unsigned __int8 deity; + unsigned __int8 namedayMonth; + unsigned __int8 namedayDay; + unsigned __int8 cityState; + unsigned __int8 homepoint; + unsigned __int8 unknown26; + unsigned __int8 petHotBar; + unsigned __int8 companionRank; + unsigned __int8 companionStars; + unsigned __int8 companionSp; + unsigned __int8 companionUnk2B; + unsigned __int8 companionColor; + unsigned __int8 companionFavoFeed; + unsigned __int8 companionUnk89; + unsigned __int8 companionUnk90[5]; + unsigned __int16 unknown90[7]; + unsigned __int16 unknown9E; + unsigned __int16 unknownA0; + unsigned int exp[25]; + unsigned __int8 unknown564[16]; + unsigned int pvpFrontlineOverall1st; + unsigned int pvpFrontlineOverall2nd; + unsigned int pvpFrontlineOverall3rd; + unsigned __int8 relicBookCompletion1[4]; + unsigned __int16 levels[25]; + unsigned __int16 levelsPadding; + unsigned __int16 unknown15C[8]; + unsigned __int16 fishingRecordsFish[26]; + unsigned __int16 fishingRecordsFishWeight[26]; + unsigned __int8 unknownMask554[44]; + unsigned __int8 companion_name[21]; + unsigned __int8 companionDefRank; + unsigned __int8 companionAttRank; + unsigned __int8 companionHealRank; + unsigned __int8 mountGuideMask[16]; char name[32]; - uint8_t unknownOword[16]; - uint8_t unlockBitmask[64]; - uint8_t aetheryte[17]; - uint8_t discovery[421]; - uint8_t howto[33]; - uint8_t minions[38]; - uint8_t chocoboTaxiMask[8]; - uint8_t contentClearMask[111]; - uint8_t contentClearPadding; - uint16_t unknown428[8]; - uint8_t companionBardingMask[8]; - uint8_t companionEquippedHead; - uint8_t companionEquippedBody; - uint8_t companionEquippedFeet; - uint8_t companionUnk4[4]; - uint8_t companion_fields[11]; - - uint8_t fishingGuideMask[89]; - uint8_t fishingSpotVisited[25]; - - - uint8_t unknownMask4Padding; - - uint8_t rankAmalJaa; - uint8_t rankSylph; - uint8_t rankKobold; - uint8_t rankSahagin; - uint8_t rankIxal; - uint8_t rankVanu; - uint8_t rankVath; - uint8_t rankMoogle; - uint8_t rankKojin; - uint8_t rankAnata; - uint16_t expAmalJaa; - uint16_t expSylph; - uint16_t expKobold; - uint16_t expSahagin; - uint16_t expIxal; - uint16_t expVanu; - uint16_t expVath; - uint16_t expMoogle; - uint16_t expKojin; - uint16_t expAnata; - uint8_t unknown596[10]; - uint16_t unknown5A0[5]; - uint8_t unknownMask59E[5]; - uint8_t unknown5A3[18]; - uint8_t unknownMask5C1[28]; - uint8_t unknown_03411; - uint32_t unknownDword5E0; - uint16_t pvpFrontlineWeekly1st; - uint16_t pvpFrontlineWeekly2nd; - uint16_t pvpFrontlineWeekly3rd; - uint8_t relicBookCompletion2[8]; - uint8_t sightseeingMask[26]; - uint16_t unknown_XXX; - - uint8_t unknown61E; - uint8_t unknown61F[32]; - uint8_t unknown63F[22]; - uint8_t tripleTriadCards[28]; - uint8_t unknown671[11]; - uint8_t unknownMask67C[22]; - uint8_t unknown692[3]; - uint8_t orchestrionMask[40]; - uint8_t hallOfNoviceCompleteMask[3]; - uint8_t unknownMask6C0[11]; - uint8_t unknownMask6CB[16]; - uint8_t unknown6DB[14]; - uint8_t unlockedRaids[28]; - uint8_t unlockedDungeons[18]; - uint8_t unlockedGuildhests[10]; - uint8_t unlockedTrials[7]; - uint8_t unlockedPvp[5]; - uint8_t unknownMask72D[28]; - // uint8_t unknownMask749[18]; - //uint8_t unknown749[13]; + unsigned __int8 unknownOword[16]; + unsigned __int8 unknown258; + unsigned __int8 unlockBitmask[64]; + unsigned __int8 aetheryte[17]; + unsigned __int8 discovery[421]; + unsigned __int8 howto[33]; + unsigned __int8 minions[38]; + unsigned __int8 chocoboTaxiMask[8]; + unsigned __int8 contentClearMask[111]; + unsigned __int8 contentClearPadding; + unsigned __int16 unknown428[8]; + unsigned __int8 companionBardingMask[8]; + unsigned __int8 companionEquippedHead; + unsigned __int8 companionEquippedBody; + unsigned __int8 companionEquippedFeet; + unsigned __int8 companionUnk4[4]; + unsigned __int8 companion_fields[11]; + unsigned __int8 fishingGuideMask[89]; + unsigned __int8 fishingSpotVisited[25]; + unsigned __int8 unknownMask4Padding; + unsigned __int8 rankAmalJaa; + unsigned __int8 rankSylph; + unsigned __int8 rankKobold; + unsigned __int8 rankSahagin; + unsigned __int8 rankIxal; + unsigned __int8 rankVanu; + unsigned __int8 rankVath; + unsigned __int8 rankMoogle; + unsigned __int8 rankKojin; + unsigned __int8 rankAnata; + unsigned __int16 expAmalJaa; + unsigned __int16 expSylph; + unsigned __int16 expKobold; + unsigned __int16 expSahagin; + unsigned __int16 expIxal; + unsigned __int16 expVanu; + unsigned __int16 expVath; + unsigned __int16 expMoogle; + unsigned __int16 expKojin; + unsigned __int16 expAnata; + unsigned __int8 unknown596[10]; + unsigned __int16 unknown5A0[5]; + unsigned __int8 unknownMask59E[5]; + unsigned __int8 unknown5A3[18]; + unsigned __int8 unknownMask5C1[28]; + unsigned __int8 unknown_03411; + unsigned int unknownDword5E0; + unsigned __int16 pvpFrontlineWeekly1st; + unsigned __int16 pvpFrontlineWeekly2nd; + unsigned __int16 pvpFrontlineWeekly3rd; + unsigned __int8 relicBookCompletion2[8]; + unsigned __int8 sightseeingMask[26]; + unsigned __int16 unknown_XXX; + unsigned __int8 unknown61E[20]; + unsigned __int8 unknown656[29]; + unsigned __int8 unknown63F[22]; + unsigned __int8 tripleTriadCards[28]; + unsigned __int8 unknown671[11]; + unsigned __int8 unknownMask67C[22]; + unsigned __int8 unknown692[3]; + unsigned __int8 orchestrionMask[40]; + unsigned __int8 hallOfNoviceCompleteMask[3]; + unsigned __int8 unknownMask6C0[11]; + unsigned __int8 unknownMask6CB[16]; + unsigned __int8 unknown6DB[14]; + unsigned __int8 unlockedRaids[28]; + unsigned __int8 unlockedDungeons[18]; + unsigned __int8 unlockedGuildhests[10]; + unsigned __int8 unlockedTrials[7]; + unsigned __int8 unlockedPvp[5]; + unsigned __int8 unknownMask72D[28]; }; diff --git a/src/servers/sapphire_zone/Network/PacketWrappers/InitUIPacket.h b/src/servers/sapphire_zone/Network/PacketWrappers/InitUIPacket.h index 548c45a6..14ac8bf2 100644 --- a/src/servers/sapphire_zone/Network/PacketWrappers/InitUIPacket.h +++ b/src/servers/sapphire_zone/Network/PacketWrappers/InitUIPacket.h @@ -77,7 +77,7 @@ private: // df stuff // todo: actually do this properly - m_data.unknown70[4] = 1; // enable df +// m_data.unknown70[4] = 1; // enable df // enable all raids/guildhests/dungeons memset( m_data.unlockedDungeons, 0xFF, sizeof( m_data.unlockedDungeons ) ); From d9782ed71a436acdd449614b21553a996709f2d3 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 29 May 2018 23:33:45 +1000 Subject: [PATCH 04/10] update opcodes --- src/common/Network/PacketDef/Ipcs.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/common/Network/PacketDef/Ipcs.h b/src/common/Network/PacketDef/Ipcs.h index 9eb847e3..0f6c5b69 100644 --- a/src/common/Network/PacketDef/Ipcs.h +++ b/src/common/Network/PacketDef/Ipcs.h @@ -86,12 +86,13 @@ namespace Packets { CountdownInitiate = 0x0111, // updated 4.3 CountdownCancel = 0x0112, // updated 4.3 - BlackList = 0x00FF, // updated 4.2 + BlackList = 0x0115, // updated 4.3 LogMessage = 0x00D0, - LinkshellList = 0x0106, // updated 4.2 - SetCharacterFCInfo = 0x0114, // updated 4.2 + LinkshellList = 0x011C, // updated 4.3 + SetCharaFCTag = 0x013B, // updated 4.3 + SetFreeCompanyInfo = 0x013D, // updated 4.3 StatusEffectList = 0x014E, // updated 4.3 Effect = 0x0151, // updated 4.3 @@ -199,6 +200,7 @@ namespace Packets { CFDutyInfoHandler = 0x0078, // updated 4.2 SocialReqSendHandler = 0x00AE, // updated 4.1 + CreateCrossWorldLS = 0x00AF, // updated 4.3 ChatHandler = 0x00D3, // updated 4.3 From 5afe39cf59ac99f6918a85552a36f1de141da95b Mon Sep 17 00:00:00 2001 From: Mordred Date: Tue, 29 May 2018 22:12:55 +0200 Subject: [PATCH 05/10] Removed unused functions --- src/servers/sapphire_zone/ServerZone.cpp | 17 ----------------- src/servers/sapphire_zone/ServerZone.h | 3 --- 2 files changed, 20 deletions(-) diff --git a/src/servers/sapphire_zone/ServerZone.cpp b/src/servers/sapphire_zone/ServerZone.cpp index 46f635ef..25a6e323 100644 --- a/src/servers/sapphire_zone/ServerZone.cpp +++ b/src/servers/sapphire_zone/ServerZone.cpp @@ -335,15 +335,6 @@ void Core::ServerZone::removeSession( uint32_t sessionId ) m_sessionMapById.erase( sessionId ); } -void Core::ServerZone::updateSession( uint32_t id ) -{ - std::lock_guard< std::mutex > lock( m_sessionMutex ); - auto it = m_sessionMapById.find( id ); - - if( it != m_sessionMapById.end() ) - it->second->loadPlayer(); -} - Core::SessionPtr Core::ServerZone::getSession( uint32_t id ) { //std::lock_guard lock( m_sessionMutex ); @@ -373,14 +364,6 @@ void Core::ServerZone::removeSession( std::string playerName ) m_sessionMapByName.erase( playerName ); } -void Core::ServerZone::updateSession( std::string playerName ) -{ - std::lock_guard< std::mutex > lock( m_sessionMutex ); - auto it = m_sessionMapByName.find( playerName ); - - if( it != m_sessionMapByName.end() ) - it->second->loadPlayer(); -} bool Core::ServerZone::isRunning() const { diff --git a/src/servers/sapphire_zone/ServerZone.h b/src/servers/sapphire_zone/ServerZone.h index 4c728f9c..09230846 100644 --- a/src/servers/sapphire_zone/ServerZone.h +++ b/src/servers/sapphire_zone/ServerZone.h @@ -27,8 +27,6 @@ namespace Core { SessionPtr getSession( uint32_t id ); SessionPtr getSession( std::string playerName ); - void updateSession( uint32_t id ); - void updateSession( std::string playerName ); size_t getSessionCount() const; @@ -38,7 +36,6 @@ namespace Core { void printBanner() const; - private: uint16_t m_port; From 911bf39af81a375ea348b3901d08c7c0f6294015 Mon Sep 17 00:00:00 2001 From: Mordred Date: Sat, 2 Jun 2018 13:38:00 +0200 Subject: [PATCH 06/10] Some cleanup and buildfix --- src/common/Network/PacketDef/Ipcs.h | 4 +- .../Network/PacketDef/Zone/ServerZoneDef.h | 280 +++++++++--------- src/servers/sapphire_zone/Event/EventDefs.h | 6 - .../sapphire_zone/Inventory/Inventory.cpp | 4 +- .../sapphire_zone/Network/GameConnection.cpp | 2 + .../sapphire_zone/Network/GameConnection.h | 2 +- .../Network/Handlers/GMCommandHandlers.cpp | 7 - src/servers/sapphire_zone/ServerZone.cpp | 8 +- 8 files changed, 147 insertions(+), 166 deletions(-) diff --git a/src/common/Network/PacketDef/Ipcs.h b/src/common/Network/PacketDef/Ipcs.h index 0f6c5b69..7d1af019 100644 --- a/src/common/Network/PacketDef/Ipcs.h +++ b/src/common/Network/PacketDef/Ipcs.h @@ -1,7 +1,7 @@ #ifndef _CORE_NETWORK_PACKETS_IPCS_H #define _CORE_NETWORK_PACKETS_IPCS_H -#include +#include namespace Core { namespace Network { @@ -175,8 +175,6 @@ namespace Packets { }; - // TODO: Include structures for the individual packet segment types - /** * Client IPC Zone Type Codes. */ diff --git a/src/common/Network/PacketDef/Zone/ServerZoneDef.h b/src/common/Network/PacketDef/Zone/ServerZoneDef.h index 1385202a..3baa1305 100644 --- a/src/common/Network/PacketDef/Zone/ServerZoneDef.h +++ b/src/common/Network/PacketDef/Zone/ServerZoneDef.h @@ -611,147 +611,147 @@ struct FFXIVIpcInitUI : FFXIVIpcBasePacket { // plain C types for a bit until the packet is actually fixed. // makes conversion between different editors easier. - __int64 contentId; - unsigned int unknown8; - unsigned int unknownC; - unsigned int charId; - unsigned int restedExp; - unsigned int companionCurrentExp; - unsigned int unknown3C; - unsigned int fishCaught; - unsigned int useBaitCatalogId; - unsigned int pvpWolfFoldMatches; - unsigned __int16 pvpWolfFoldWeeklyMatches; - unsigned __int16 pvpWolfFoldWeeklyVictories; - unsigned __int16 pvpStats[6]; - unsigned __int16 playerCommendations; - unsigned __int16 pvpStats1; - unsigned __int8 frontlineCampaigns[4]; - unsigned __int16 frontlineCampaignsWeekly; - unsigned __int8 currentRelic; - unsigned __int8 currentBook; - unsigned __int8 masterCrafterMask; - unsigned __int8 unknown69; - unsigned __int8 unknown6A; - unsigned __int8 unknown6B; - unsigned __int8 unknown6C[4]; - unsigned __int8 unknown50[34]; - unsigned __int16 unknown18; - unsigned __int8 maxLevel; - unsigned __int8 expansion; - unsigned __int8 unknown76; - unsigned __int8 race; - unsigned __int8 tribe; - unsigned __int8 gender; - unsigned __int8 currentJob; - unsigned __int8 currentClass; - unsigned __int8 deity; - unsigned __int8 namedayMonth; - unsigned __int8 namedayDay; - unsigned __int8 cityState; - unsigned __int8 homepoint; - unsigned __int8 unknown26; - unsigned __int8 petHotBar; - unsigned __int8 companionRank; - unsigned __int8 companionStars; - unsigned __int8 companionSp; - unsigned __int8 companionUnk2B; - unsigned __int8 companionColor; - unsigned __int8 companionFavoFeed; - unsigned __int8 companionUnk89; - unsigned __int8 companionUnk90[5]; - unsigned __int16 unknown90[7]; - unsigned __int16 unknown9E; - unsigned __int16 unknownA0; - unsigned int exp[25]; - unsigned __int8 unknown564[16]; - unsigned int pvpFrontlineOverall1st; - unsigned int pvpFrontlineOverall2nd; - unsigned int pvpFrontlineOverall3rd; - unsigned __int8 relicBookCompletion1[4]; - unsigned __int16 levels[25]; - unsigned __int16 levelsPadding; - unsigned __int16 unknown15C[8]; - unsigned __int16 fishingRecordsFish[26]; - unsigned __int16 fishingRecordsFishWeight[26]; - unsigned __int8 unknownMask554[44]; - unsigned __int8 companion_name[21]; - unsigned __int8 companionDefRank; - unsigned __int8 companionAttRank; - unsigned __int8 companionHealRank; - unsigned __int8 mountGuideMask[16]; + uint64_t contentId; + uint32_t unknown8; + uint32_t unknownC; + uint32_t charId; + uint32_t restedExp; + uint32_t companionCurrentExp; + uint32_t unknown3C; + uint32_t fishCaught; + uint32_t useBaitCatalogId; + uint32_t pvpWolfFoldMatches; + uint16_t pvpWolfFoldWeeklyMatches; + uint16_t pvpWolfFoldWeeklyVictories; + uint16_t pvpStats[6]; + uint16_t playerCommendations; + uint16_t pvpStats1; + uint16_t frontlineCampaigns[4]; + uint16_t frontlineCampaignsWeekly; + uint16_t currentRelic; + uint16_t currentBook; + uint16_t masterCrafterMask; + uint16_t unknown69; + uint16_t unknown6A; + uint16_t unknown6B; + uint16_t unknown6C[4]; + uint16_t unknown50[34]; + uint16_t unknown18; + uint16_t maxLevel; + uint16_t expansion; + uint16_t unknown76; + uint16_t race; + uint16_t tribe; + uint16_t gender; + uint16_t currentJob; + uint16_t currentClass; + uint16_t deity; + uint16_t namedayMonth; + uint16_t namedayDay; + uint16_t cityState; + uint16_t homepoint; + uint16_t unknown26; + uint16_t petHotBar; + uint16_t companionRank; + uint16_t companionStars; + uint16_t companionSp; + uint16_t companionUnk2B; + uint16_t companionColor; + uint16_t companionFavoFeed; + uint16_t companionUnk89; + uint16_t companionUnk90[5]; + uint16_t unknown90[7]; + uint16_t unknown9E; + uint16_t unknownA0; + uint32_t exp[25]; + uint16_t unknown564[16]; + uint32_t pvpFrontlineOverall1st; + uint32_t pvpFrontlineOverall2nd; + uint32_t pvpFrontlineOverall3rd; + uint16_t relicBookCompletion1[4]; + uint16_t levels[25]; + uint16_t levelsPadding; + uint16_t unknown15C[8]; + uint16_t fishingRecordsFish[26]; + uint16_t fishingRecordsFishWeight[26]; + uint16_t unknownMask554[44]; + uint16_t companion_name[21]; + uint16_t companionDefRank; + uint16_t companionAttRank; + uint16_t companionHealRank; + uint16_t mountGuideMask[16]; char name[32]; - unsigned __int8 unknownOword[16]; - unsigned __int8 unknown258; - unsigned __int8 unlockBitmask[64]; - unsigned __int8 aetheryte[17]; - unsigned __int8 discovery[421]; - unsigned __int8 howto[33]; - unsigned __int8 minions[38]; - unsigned __int8 chocoboTaxiMask[8]; - unsigned __int8 contentClearMask[111]; - unsigned __int8 contentClearPadding; - unsigned __int16 unknown428[8]; - unsigned __int8 companionBardingMask[8]; - unsigned __int8 companionEquippedHead; - unsigned __int8 companionEquippedBody; - unsigned __int8 companionEquippedFeet; - unsigned __int8 companionUnk4[4]; - unsigned __int8 companion_fields[11]; - unsigned __int8 fishingGuideMask[89]; - unsigned __int8 fishingSpotVisited[25]; - unsigned __int8 unknownMask4Padding; - unsigned __int8 rankAmalJaa; - unsigned __int8 rankSylph; - unsigned __int8 rankKobold; - unsigned __int8 rankSahagin; - unsigned __int8 rankIxal; - unsigned __int8 rankVanu; - unsigned __int8 rankVath; - unsigned __int8 rankMoogle; - unsigned __int8 rankKojin; - unsigned __int8 rankAnata; - unsigned __int16 expAmalJaa; - unsigned __int16 expSylph; - unsigned __int16 expKobold; - unsigned __int16 expSahagin; - unsigned __int16 expIxal; - unsigned __int16 expVanu; - unsigned __int16 expVath; - unsigned __int16 expMoogle; - unsigned __int16 expKojin; - unsigned __int16 expAnata; - unsigned __int8 unknown596[10]; - unsigned __int16 unknown5A0[5]; - unsigned __int8 unknownMask59E[5]; - unsigned __int8 unknown5A3[18]; - unsigned __int8 unknownMask5C1[28]; - unsigned __int8 unknown_03411; - unsigned int unknownDword5E0; - unsigned __int16 pvpFrontlineWeekly1st; - unsigned __int16 pvpFrontlineWeekly2nd; - unsigned __int16 pvpFrontlineWeekly3rd; - unsigned __int8 relicBookCompletion2[8]; - unsigned __int8 sightseeingMask[26]; - unsigned __int16 unknown_XXX; - unsigned __int8 unknown61E[20]; - unsigned __int8 unknown656[29]; - unsigned __int8 unknown63F[22]; - unsigned __int8 tripleTriadCards[28]; - unsigned __int8 unknown671[11]; - unsigned __int8 unknownMask67C[22]; - unsigned __int8 unknown692[3]; - unsigned __int8 orchestrionMask[40]; - unsigned __int8 hallOfNoviceCompleteMask[3]; - unsigned __int8 unknownMask6C0[11]; - unsigned __int8 unknownMask6CB[16]; - unsigned __int8 unknown6DB[14]; - unsigned __int8 unlockedRaids[28]; - unsigned __int8 unlockedDungeons[18]; - unsigned __int8 unlockedGuildhests[10]; - unsigned __int8 unlockedTrials[7]; - unsigned __int8 unlockedPvp[5]; - unsigned __int8 unknownMask72D[28]; + uint16_t unknownOword[16]; + uint16_t unknown258; + uint16_t unlockBitmask[64]; + uint16_t aetheryte[17]; + uint16_t discovery[421]; + uint16_t howto[33]; + uint16_t minions[38]; + uint16_t chocoboTaxiMask[8]; + uint16_t contentClearMask[111]; + uint16_t contentClearPadding; + uint16_t unknown428[8]; + uint16_t companionBardingMask[8]; + uint16_t companionEquippedHead; + uint16_t companionEquippedBody; + uint16_t companionEquippedFeet; + uint16_t companionUnk4[4]; + uint16_t companion_fields[11]; + uint16_t fishingGuideMask[89]; + uint16_t fishingSpotVisited[25]; + uint16_t unknownMask4Padding; + uint16_t rankAmalJaa; + uint16_t rankSylph; + uint16_t rankKobold; + uint16_t rankSahagin; + uint16_t rankIxal; + uint16_t rankVanu; + uint16_t rankVath; + uint16_t rankMoogle; + uint16_t rankKojin; + uint16_t rankAnata; + uint16_t expAmalJaa; + uint16_t expSylph; + uint16_t expKobold; + uint16_t expSahagin; + uint16_t expIxal; + uint16_t expVanu; + uint16_t expVath; + uint16_t expMoogle; + uint16_t expKojin; + uint16_t expAnata; + uint16_t unknown596[10]; + uint16_t unknown5A0[5]; + uint16_t unknownMask59E[5]; + uint16_t unknown5A3[18]; + uint16_t unknownMask5C1[28]; + uint16_t unknown_03411; + uint32_t unknownDword5E0; + uint16_t pvpFrontlineWeekly1st; + uint16_t pvpFrontlineWeekly2nd; + uint16_t pvpFrontlineWeekly3rd; + uint16_t relicBookCompletion2[8]; + uint16_t sightseeingMask[26]; + uint16_t unknown_XXX; + uint16_t unknown61E[20]; + uint16_t unknown656[29]; + uint16_t unknown63F[22]; + uint16_t tripleTriadCards[28]; + uint16_t unknown671[11]; + uint16_t unknownMask67C[22]; + uint16_t unknown692[3]; + uint16_t orchestrionMask[40]; + uint16_t hallOfNoviceCompleteMask[3]; + uint16_t unknownMask6C0[11]; + uint16_t unknownMask6CB[16]; + uint16_t unknown6DB[14]; + uint16_t unlockedRaids[28]; + uint16_t unlockedDungeons[18]; + uint16_t unlockedGuildhests[10]; + uint16_t unlockedTrials[7]; + uint16_t unlockedPvp[5]; + uint16_t unknownMask72D[28]; }; diff --git a/src/servers/sapphire_zone/Event/EventDefs.h b/src/servers/sapphire_zone/Event/EventDefs.h index b7c4afba..7f1a008f 100644 --- a/src/servers/sapphire_zone/Event/EventDefs.h +++ b/src/servers/sapphire_zone/Event/EventDefs.h @@ -69,12 +69,6 @@ namespace Core EVENT_TABLE_GAME = 24 }; - enum EventFinishState - { - UNLOCK = 1, - KEEPLOCK = 0 - }; - enum DamageType { STD_DAMAGE = 0X03, diff --git a/src/servers/sapphire_zone/Inventory/Inventory.cpp b/src/servers/sapphire_zone/Inventory/Inventory.cpp index b601dd81..2d475021 100644 --- a/src/servers/sapphire_zone/Inventory/Inventory.cpp +++ b/src/servers/sapphire_zone/Inventory/Inventory.cpp @@ -2,7 +2,7 @@ #include #include -#include + #include #include #include @@ -12,8 +12,6 @@ #include "Network/PacketWrappers/ServerNoticePacket.h" #include "Network/PacketWrappers/ActorControlPacket143.h" -#include "Forwards.h" -#include "Inventory.h" #include "ItemContainer.h" #include "Item.h" #include "Framework.h" diff --git a/src/servers/sapphire_zone/Network/GameConnection.cpp b/src/servers/sapphire_zone/Network/GameConnection.cpp index 31fc5062..a106481f 100644 --- a/src/servers/sapphire_zone/Network/GameConnection.cpp +++ b/src/servers/sapphire_zone/Network/GameConnection.cpp @@ -4,6 +4,8 @@ #include #include #include + +#include #include #include diff --git a/src/servers/sapphire_zone/Network/GameConnection.h b/src/servers/sapphire_zone/Network/GameConnection.h index e8a8af37..ec14ec94 100644 --- a/src/servers/sapphire_zone/Network/GameConnection.h +++ b/src/servers/sapphire_zone/Network/GameConnection.h @@ -2,7 +2,7 @@ #define GAMECONNECTION_H #include -#include + #include #include #include diff --git a/src/servers/sapphire_zone/Network/Handlers/GMCommandHandlers.cpp b/src/servers/sapphire_zone/Network/Handlers/GMCommandHandlers.cpp index 7f1d99d0..110a1107 100644 --- a/src/servers/sapphire_zone/Network/Handlers/GMCommandHandlers.cpp +++ b/src/servers/sapphire_zone/Network/Handlers/GMCommandHandlers.cpp @@ -7,7 +7,6 @@ #include #include -#include #include "Network/GameConnection.h" @@ -18,7 +17,6 @@ #include "Zone/InstanceContent.h" #include "Zone/ZonePosition.h" -#include "Network/GameConnection.h" #include "Network/PacketWrappers/InitUIPacket.h" #include "Network/PacketWrappers/PingPacket.h" #include "Network/PacketWrappers/MoveActorPacket.h" @@ -33,16 +31,11 @@ #include "DebugCommand/DebugCommandHandler.h" -#include "Actor/Player.h" - -#include "Inventory/Inventory.h" - #include "Event/EventHelper.h" #include "Action/Action.h" #include "Action/ActionTeleport.h" -#include "Session.h" #include "ServerZone.h" #include "Forwards.h" #include "Framework.h" diff --git a/src/servers/sapphire_zone/ServerZone.cpp b/src/servers/sapphire_zone/ServerZone.cpp index 25a6e323..d1880965 100644 --- a/src/servers/sapphire_zone/ServerZone.cpp +++ b/src/servers/sapphire_zone/ServerZone.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include #include @@ -26,15 +25,12 @@ #include "Zone/TerritoryMgr.h" -#include "DebugCommand/DebugCommandHandler.h" - #include "Script/ScriptMgr.h" #include "Linkshell/LinkshellMgr.h" #include "Forwards.h" -#include + #include -#include #include #include "Framework.h" @@ -206,7 +202,7 @@ void Core::ServerZone::run( int32_t argc, char* argv[] ) void Core::ServerZone::printBanner() const { - auto pLog = g_fw.get< Core::Logger>(); + auto pLog = g_fw.get< Core::Logger >(); pLog->info("===========================================================" ); pLog->info( "Sapphire Server Project " ); From 738b09d5c524ce1147b272c5031f533d6f77e3f9 Mon Sep 17 00:00:00 2001 From: Mordred Date: Sat, 2 Jun 2018 15:52:35 +0200 Subject: [PATCH 07/10] More cleanup yet --- src/servers/sapphire_zone/Action/ActionCollision.cpp | 1 - src/servers/sapphire_zone/Action/ActionCollision.h | 4 ++-- src/servers/sapphire_zone/Action/ActionMount.h | 2 +- src/servers/sapphire_zone/Action/ActionTeleport.h | 2 +- src/servers/sapphire_zone/Action/EventAction.cpp | 1 - src/servers/sapphire_zone/Action/EventAction.h | 2 +- src/servers/sapphire_zone/Action/EventItemAction.h | 2 +- src/servers/sapphire_zone/Actor/Actor.cpp | 10 +--------- src/servers/sapphire_zone/Actor/Chara.cpp | 1 - src/servers/sapphire_zone/Actor/EventObject.cpp | 1 - src/servers/sapphire_zone/Actor/EventObject.h | 7 ++++--- src/servers/sapphire_zone/Actor/Player.cpp | 5 ----- src/servers/sapphire_zone/Actor/PlayerEvent.cpp | 5 ----- src/servers/sapphire_zone/Actor/PlayerQuest.cpp | 2 -- src/servers/sapphire_zone/Actor/PlayerSql.cpp | 6 ------ .../sapphire_zone/DebugCommand/DebugCommandHandler.cpp | 3 --- src/servers/sapphire_zone/Event/EventHandler.h | 2 +- src/servers/sapphire_zone/Event/EventHelper.cpp | 6 ++++-- src/servers/sapphire_zone/Inventory/Inventory.h | 2 +- src/servers/sapphire_zone/Inventory/ItemContainer.h | 2 +- src/servers/sapphire_zone/Network/GameConnection.cpp | 3 +-- src/servers/sapphire_zone/Network/GameConnection.h | 6 ++++-- .../sapphire_zone/Network/Handlers/ActionHandler.cpp | 4 ---- .../sapphire_zone/Network/Handlers/CFHandlers.cpp | 3 --- .../sapphire_zone/Network/Handlers/EventHandlers.cpp | 4 +--- .../Network/Handlers/GMCommandHandlers.cpp | 9 --------- .../Network/Handlers/InventoryHandler.cpp | 3 +-- .../sapphire_zone/Network/Handlers/PacketHandlers.cpp | 7 ------- .../sapphire_zone/Network/Handlers/SkillHandler.cpp | 3 --- 29 files changed, 25 insertions(+), 83 deletions(-) diff --git a/src/servers/sapphire_zone/Action/ActionCollision.cpp b/src/servers/sapphire_zone/Action/ActionCollision.cpp index c81ceb36..90a18e43 100644 --- a/src/servers/sapphire_zone/Action/ActionCollision.cpp +++ b/src/servers/sapphire_zone/Action/ActionCollision.cpp @@ -9,7 +9,6 @@ #include "Actor/Player.h" #include -#include using namespace Core::Entity; using namespace Core::Common; diff --git a/src/servers/sapphire_zone/Action/ActionCollision.h b/src/servers/sapphire_zone/Action/ActionCollision.h index 7b845b51..89a3a99c 100644 --- a/src/servers/sapphire_zone/Action/ActionCollision.h +++ b/src/servers/sapphire_zone/Action/ActionCollision.h @@ -2,14 +2,14 @@ #define _ACTIONCOLLISION_H #include -#include "Action.h" - +#include "Forwards.h" namespace Core { namespace Data { struct Action; } + namespace Entity { enum class TargetFilter diff --git a/src/servers/sapphire_zone/Action/ActionMount.h b/src/servers/sapphire_zone/Action/ActionMount.h index 3450a2b2..23533c90 100644 --- a/src/servers/sapphire_zone/Action/ActionMount.h +++ b/src/servers/sapphire_zone/Action/ActionMount.h @@ -1,7 +1,7 @@ #ifndef _ACTIONMOUNT_H_ #define _ACTIONMOUNT_H_ -#include "../Forwards.h" +#include "Forwards.h" #include "Action.h" namespace Core { diff --git a/src/servers/sapphire_zone/Action/ActionTeleport.h b/src/servers/sapphire_zone/Action/ActionTeleport.h index fab98d06..4c42fc65 100644 --- a/src/servers/sapphire_zone/Action/ActionTeleport.h +++ b/src/servers/sapphire_zone/Action/ActionTeleport.h @@ -1,7 +1,7 @@ #ifndef _ACTIONTELEPORT_H_ #define _ACTIONTELEPORT_H_ -#include "../Forwards.h" +#include "Forwards.h" #include "Action.h" namespace Core { diff --git a/src/servers/sapphire_zone/Action/EventAction.cpp b/src/servers/sapphire_zone/Action/EventAction.cpp index e0578dce..a21400f0 100644 --- a/src/servers/sapphire_zone/Action/EventAction.cpp +++ b/src/servers/sapphire_zone/Action/EventAction.cpp @@ -6,7 +6,6 @@ #include "Network/PacketWrappers/ActorControlPacket143.h" #include "Actor/Player.h" -#include "Event/EventHandler.h" #include "EventAction.h" #include "Framework.h" diff --git a/src/servers/sapphire_zone/Action/EventAction.h b/src/servers/sapphire_zone/Action/EventAction.h index 642513a2..346f0256 100644 --- a/src/servers/sapphire_zone/Action/EventAction.h +++ b/src/servers/sapphire_zone/Action/EventAction.h @@ -3,7 +3,7 @@ #include -#include "../Forwards.h" +#include "Forwards.h" #include "Action.h" namespace Core { diff --git a/src/servers/sapphire_zone/Action/EventItemAction.h b/src/servers/sapphire_zone/Action/EventItemAction.h index 6c69e1aa..69832263 100644 --- a/src/servers/sapphire_zone/Action/EventItemAction.h +++ b/src/servers/sapphire_zone/Action/EventItemAction.h @@ -1,7 +1,7 @@ #ifndef _EVENTITEMACTION_H_ #define _EVENTITEMACTION_H_ -#include "../Forwards.h" +#include "Forwards.h" #include "Action.h" namespace Core { diff --git a/src/servers/sapphire_zone/Actor/Actor.cpp b/src/servers/sapphire_zone/Actor/Actor.cpp index 0de580e6..dcbb812f 100644 --- a/src/servers/sapphire_zone/Actor/Actor.cpp +++ b/src/servers/sapphire_zone/Actor/Actor.cpp @@ -1,11 +1,10 @@ #include "Actor.h" #include -#include + #include #include -#include "Forwards.h" #include "Action/Action.h" #include "Action/ActionCollision.h" @@ -19,8 +18,6 @@ #include "ServerZone.h" #include "Session.h" -#include "Zone/Zone.h" - #include "Zone/TerritoryMgr.h" @@ -28,11 +25,6 @@ #include "Math/CalcBattle.h" -#include "ServerZone.h" -#include "Session.h" -#include "Actor.h" -#include "Player.h" - #include "Framework.h" extern Core::Framework g_fw; diff --git a/src/servers/sapphire_zone/Actor/Chara.cpp b/src/servers/sapphire_zone/Actor/Chara.cpp index d905c341..841e75fa 100644 --- a/src/servers/sapphire_zone/Actor/Chara.cpp +++ b/src/servers/sapphire_zone/Actor/Chara.cpp @@ -2,7 +2,6 @@ #include #include #include -#include #include "Forwards.h" #include "Action/Action.h" diff --git a/src/servers/sapphire_zone/Actor/EventObject.cpp b/src/servers/sapphire_zone/Actor/EventObject.cpp index 64e59688..eac02744 100644 --- a/src/servers/sapphire_zone/Actor/EventObject.cpp +++ b/src/servers/sapphire_zone/Actor/EventObject.cpp @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include diff --git a/src/servers/sapphire_zone/Actor/EventObject.h b/src/servers/sapphire_zone/Actor/EventObject.h index 363d5077..937ac0f3 100644 --- a/src/servers/sapphire_zone/Actor/EventObject.h +++ b/src/servers/sapphire_zone/Actor/EventObject.h @@ -10,10 +10,11 @@ namespace Entity class EventObject : public Actor { public: - EventObject( uint32_t actorId, uint32_t objectId, uint32_t gimmickId, uint8_t initialState, Common::FFXIVARR_POSITION3 pos, - float rotation, const std::string& givenName = "none" ); + EventObject( uint32_t actorId, uint32_t objectId, uint32_t gimmickId, uint8_t initialState, + Common::FFXIVARR_POSITION3 pos, float rotation, const std::string& givenName = "none" ); - using OnTalkEventHandler = std::function< void( Entity::Player&, Entity::EventObjectPtr, InstanceContentPtr, uint64_t ) >; + using OnTalkEventHandler = std::function< void( Entity::Player&, Entity::EventObjectPtr, + InstanceContentPtr, uint64_t ) >; uint32_t getGimmickId() const; void setGimmickId( uint32_t gimmickId ); diff --git a/src/servers/sapphire_zone/Actor/Player.cpp b/src/servers/sapphire_zone/Actor/Player.cpp index 9aed1649..dbc28283 100644 --- a/src/servers/sapphire_zone/Actor/Player.cpp +++ b/src/servers/sapphire_zone/Actor/Player.cpp @@ -30,11 +30,6 @@ #include "Script/ScriptMgr.h" -#include "Inventory/Item.h" -#include "Inventory/Inventory.h" - -#include "Event/EventHandler.h" - #include "Action/Action.h" #include "Action/ActionTeleport.h" #include "Action/EventAction.h" diff --git a/src/servers/sapphire_zone/Actor/PlayerEvent.cpp b/src/servers/sapphire_zone/Actor/PlayerEvent.cpp index 80e3dbda..ec05b996 100644 --- a/src/servers/sapphire_zone/Actor/PlayerEvent.cpp +++ b/src/servers/sapphire_zone/Actor/PlayerEvent.cpp @@ -16,12 +16,7 @@ #include "Action/EventAction.h" #include "Action/EventItemAction.h" -#include "Event/EventHandler.h" - #include "Zone/Zone.h" - -#include "Player.h" -#include "Forwards.h" #include "ServerZone.h" #include "Framework.h" diff --git a/src/servers/sapphire_zone/Actor/PlayerQuest.cpp b/src/servers/sapphire_zone/Actor/PlayerQuest.cpp index ebd89a1e..952d0bf8 100644 --- a/src/servers/sapphire_zone/Actor/PlayerQuest.cpp +++ b/src/servers/sapphire_zone/Actor/PlayerQuest.cpp @@ -8,8 +8,6 @@ #include "Network/PacketWrappers/QuestMessagePacket.h" #include "Session.h" -#include "Inventory/Inventory.h" -#include "Player.h" #include "Framework.h" extern Core::Framework g_fw; diff --git a/src/servers/sapphire_zone/Actor/PlayerSql.cpp b/src/servers/sapphire_zone/Actor/PlayerSql.cpp index 2cb73926..7ced3f9a 100644 --- a/src/servers/sapphire_zone/Actor/PlayerSql.cpp +++ b/src/servers/sapphire_zone/Actor/PlayerSql.cpp @@ -1,6 +1,4 @@ #include -#include -#include #include #include @@ -19,11 +17,7 @@ #include "Zone/TerritoryMgr.h" #include "Zone/Zone.h" -#include "Inventory/Inventory.h" - -#include "Player.h" #include "ServerZone.h" -#include "Forwards.h" #include "Framework.h" extern Core::Framework g_fw; diff --git a/src/servers/sapphire_zone/DebugCommand/DebugCommandHandler.cpp b/src/servers/sapphire_zone/DebugCommand/DebugCommandHandler.cpp index 71d8d8fe..10a83b85 100644 --- a/src/servers/sapphire_zone/DebugCommand/DebugCommandHandler.cpp +++ b/src/servers/sapphire_zone/DebugCommand/DebugCommandHandler.cpp @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include @@ -25,7 +24,6 @@ #include "Script/ScriptMgr.h" #include "Script/NativeScriptMgr.h" -#include "Actor/Player.h" #include "Actor/EventObject.h" #include "Zone/Zone.h" @@ -34,7 +32,6 @@ #include "ServerZone.h" -#include "StatusEffect/StatusEffect.h" #include "Session.h" #include "Framework.h" diff --git a/src/servers/sapphire_zone/Event/EventHandler.h b/src/servers/sapphire_zone/Event/EventHandler.h index acdaf592..87a29c8d 100644 --- a/src/servers/sapphire_zone/Event/EventHandler.h +++ b/src/servers/sapphire_zone/Event/EventHandler.h @@ -1,7 +1,7 @@ #ifndef _EVENT_H #define _EVENT_H -#include "../Forwards.h" +#include "Forwards.h" namespace Core { namespace Event { diff --git a/src/servers/sapphire_zone/Event/EventHelper.cpp b/src/servers/sapphire_zone/Event/EventHelper.cpp index 4a389965..1b4c34b6 100644 --- a/src/servers/sapphire_zone/Event/EventHelper.cpp +++ b/src/servers/sapphire_zone/Event/EventHelper.cpp @@ -1,10 +1,12 @@ #include #include +#include +#include + #include "Framework.h" #include "EventHelper.h" #include "EventHandler.h" -#include -#include + extern Core::Framework g_fw; diff --git a/src/servers/sapphire_zone/Inventory/Inventory.h b/src/servers/sapphire_zone/Inventory/Inventory.h index dacfa514..997e840c 100644 --- a/src/servers/sapphire_zone/Inventory/Inventory.h +++ b/src/servers/sapphire_zone/Inventory/Inventory.h @@ -2,7 +2,7 @@ #define INVENTORY_H_ #include #include -#include "../Forwards.h" +#include "Forwards.h" namespace Core { diff --git a/src/servers/sapphire_zone/Inventory/ItemContainer.h b/src/servers/sapphire_zone/Inventory/ItemContainer.h index 1d7147d5..223dd7ae 100644 --- a/src/servers/sapphire_zone/Inventory/ItemContainer.h +++ b/src/servers/sapphire_zone/Inventory/ItemContainer.h @@ -5,7 +5,7 @@ #include -#include "../Forwards.h" +#include "Forwards.h" namespace Core { diff --git a/src/servers/sapphire_zone/Network/GameConnection.cpp b/src/servers/sapphire_zone/Network/GameConnection.cpp index a106481f..e885a994 100644 --- a/src/servers/sapphire_zone/Network/GameConnection.cpp +++ b/src/servers/sapphire_zone/Network/GameConnection.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include "Zone/Zone.h" @@ -15,8 +16,6 @@ #include "DebugCommand/DebugCommandHandler.h" -#include "Actor/Player.h" - #include "GameConnection.h" #include "ServerZone.h" #include "Session.h" diff --git a/src/servers/sapphire_zone/Network/GameConnection.h b/src/servers/sapphire_zone/Network/GameConnection.h index ec14ec94..07e17bc3 100644 --- a/src/servers/sapphire_zone/Network/GameConnection.h +++ b/src/servers/sapphire_zone/Network/GameConnection.h @@ -4,7 +4,7 @@ #include #include -#include +//#include #include #include "Forwards.h" @@ -13,7 +13,9 @@ namespace Core { namespace Network { - +namespace Packets { + class GamePacket; +} enum ConnectionType : uint8_t { Zone = 1, diff --git a/src/servers/sapphire_zone/Network/Handlers/ActionHandler.cpp b/src/servers/sapphire_zone/Network/Handlers/ActionHandler.cpp index 6c37a645..50c81fb0 100644 --- a/src/servers/sapphire_zone/Network/Handlers/ActionHandler.cpp +++ b/src/servers/sapphire_zone/Network/Handlers/ActionHandler.cpp @@ -25,10 +25,6 @@ #include "DebugCommand/DebugCommandHandler.h" -#include "Actor/Player.h" - -#include "Inventory/Inventory.h" - #include "Event/EventHelper.h" #include "Action/Action.h" diff --git a/src/servers/sapphire_zone/Network/Handlers/CFHandlers.cpp b/src/servers/sapphire_zone/Network/Handlers/CFHandlers.cpp index 5e0b1bdf..683a966f 100644 --- a/src/servers/sapphire_zone/Network/Handlers/CFHandlers.cpp +++ b/src/servers/sapphire_zone/Network/Handlers/CFHandlers.cpp @@ -15,9 +15,6 @@ #include "Network/PacketWrappers/ActorControlPacket144.h" #include "Network/PacketWrappers/PlayerStateFlagsPacket.h" -#include "Actor/Player.h" - -#include "Forwards.h" #include "Framework.h" #include "Session.h" diff --git a/src/servers/sapphire_zone/Network/Handlers/EventHandlers.cpp b/src/servers/sapphire_zone/Network/Handlers/EventHandlers.cpp index f8a4763c..1e6913bb 100644 --- a/src/servers/sapphire_zone/Network/Handlers/EventHandlers.cpp +++ b/src/servers/sapphire_zone/Network/Handlers/EventHandlers.cpp @@ -19,14 +19,12 @@ #include "Script/ScriptMgr.h" -#include "Actor/Player.h" - #include "Event/EventHelper.h" #include "Zone/InstanceContent.h" #include "Session.h" -#include "Forwards.h" + #include "Framework.h" extern Core::Framework g_fw; diff --git a/src/servers/sapphire_zone/Network/Handlers/GMCommandHandlers.cpp b/src/servers/sapphire_zone/Network/Handlers/GMCommandHandlers.cpp index 110a1107..35808521 100644 --- a/src/servers/sapphire_zone/Network/Handlers/GMCommandHandlers.cpp +++ b/src/servers/sapphire_zone/Network/Handlers/GMCommandHandlers.cpp @@ -15,7 +15,6 @@ #include "Zone/TerritoryMgr.h" #include "Zone/Zone.h" #include "Zone/InstanceContent.h" -#include "Zone/ZonePosition.h" #include "Network/PacketWrappers/InitUIPacket.h" #include "Network/PacketWrappers/PingPacket.h" @@ -29,15 +28,7 @@ #include "Network/PacketWrappers/EventFinishPacket.h" #include "Network/PacketWrappers/PlayerStateFlagsPacket.h" -#include "DebugCommand/DebugCommandHandler.h" - -#include "Event/EventHelper.h" - -#include "Action/Action.h" -#include "Action/ActionTeleport.h" - #include "ServerZone.h" -#include "Forwards.h" #include "Framework.h" extern Core::Framework g_fw; diff --git a/src/servers/sapphire_zone/Network/Handlers/InventoryHandler.cpp b/src/servers/sapphire_zone/Network/Handlers/InventoryHandler.cpp index 00b57c72..63c09215 100644 --- a/src/servers/sapphire_zone/Network/Handlers/InventoryHandler.cpp +++ b/src/servers/sapphire_zone/Network/Handlers/InventoryHandler.cpp @@ -17,11 +17,10 @@ #include "DebugCommand/DebugCommandHandler.h" #include "Actor/Player.h" -#include "Inventory/Inventory.h" #include "Session.h" #include "ServerZone.h" -#include "Forwards.h" + #include "Framework.h" extern Core::Framework g_fw; diff --git a/src/servers/sapphire_zone/Network/Handlers/PacketHandlers.cpp b/src/servers/sapphire_zone/Network/Handlers/PacketHandlers.cpp index 1e23fd3a..49efc3de 100644 --- a/src/servers/sapphire_zone/Network/Handlers/PacketHandlers.cpp +++ b/src/servers/sapphire_zone/Network/Handlers/PacketHandlers.cpp @@ -7,10 +7,7 @@ #include #include #include -#include -#include -#include #include #include "Network/GameConnection.h" @@ -32,10 +29,6 @@ #include "DebugCommand/DebugCommandHandler.h" -#include "Actor/Player.h" - -#include "Inventory/Inventory.h" - #include "Event/EventHelper.h" #include "Action/Action.h" diff --git a/src/servers/sapphire_zone/Network/Handlers/SkillHandler.cpp b/src/servers/sapphire_zone/Network/Handlers/SkillHandler.cpp index f3ed84d3..aa068d79 100644 --- a/src/servers/sapphire_zone/Network/Handlers/SkillHandler.cpp +++ b/src/servers/sapphire_zone/Network/Handlers/SkillHandler.cpp @@ -18,8 +18,6 @@ #include "DebugCommand/DebugCommandHandler.h" -#include "Actor/Player.h" - #include "Action/Action.h" #include "Action/ActionCast.h" #include "Action/ActionMount.h" @@ -27,7 +25,6 @@ #include "Script/ScriptMgr.h" #include "Session.h" -#include "Forwards.h" #include "Framework.h" extern Core::Framework g_fw; From f6375f326e40d761523867ba453a502537b5073c Mon Sep 17 00:00:00 2001 From: Mordred Date: Sat, 2 Jun 2018 18:09:29 +0200 Subject: [PATCH 08/10] Reordered IPC list --- src/common/Network/PacketDef/Ipcs.h | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/common/Network/PacketDef/Ipcs.h b/src/common/Network/PacketDef/Ipcs.h index 7d1af019..0515d755 100644 --- a/src/common/Network/PacketDef/Ipcs.h +++ b/src/common/Network/PacketDef/Ipcs.h @@ -45,11 +45,10 @@ namespace Packets { enum ServerZoneIpcType : uint16_t { - // static opcode ( the ones that rarely if ever change ) + // static opcode ( the ones that rarely, if ever, change ) Ping = 0x0065, Init = 0x0066, - //ActorSpawn = 0x0190, // DEPRECATED ActorFreeSpawn = 0x0191, InitZone = 0x019A, @@ -74,6 +73,7 @@ namespace Packets { CFRegistered = 0x00B8, // updated 4.1 SocialRequestResponse = 0x00BB, // updated 4.1 CancelAllianceForming = 0x00C6, // updated 4.2 + Chat = 0x00F7, // updated 4.3 SocialList = 0x00FD, // updated 4.3 @@ -111,7 +111,8 @@ namespace Packets { ObjectSpawn = 0x017D, // updated 4.3 ObjectDespawn = 0x017E, // updated 4.3 - UpdateClassInfo = 0x018A, // updated 4.3 + + InventoryActionAck = 0x0180, // updated 4.2 ? InitUI = 0x0181, // updated 4.3 PlayerStats = 0x0182, // updated 4.3 @@ -120,13 +121,14 @@ namespace Packets { PlayerClassInfo = 0x0185, // updated 4.3 ModelEquip = 0x0186, // 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 = 0x0197, // updated 4.3 - InventoryActionAck = 0x0180, // updated 4.2 ? UpdateInventorySlot = 0x0198, // updated 4.3 EventPlay = 0x01A6, // updated 4.3 @@ -137,21 +139,24 @@ namespace Packets { EventLinkshell = 0x1169, - QuestMessage = 0x01CE, // updated 4.3 - QuestTracker = 0x01D3, // 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 - QuestActiveList = 0x01C3, // updated 4.3 - QuestUpdate = 0x01C4, // updated 4.3 - QuestCompleteList = 0x01C5, // updated 4.3 + QuestMessage = 0x01CE, // updated 4.3 + + QuestTracker = 0x01D3, // updated 4.3 Mount = 0x01E3, // updated 4.3 DirectorVars = 0x01E5, // updated 4.3 + CFAvailableContents = 0x01FD, // updated 4.2 + WeatherChange = 0x0200, // updated 4.3 PlayerTitleList = 0x0201, // updated 4.3 Discovery = 0x0202, // updated 4.3 @@ -160,13 +165,13 @@ namespace Packets { EquipDisplayFlags = 0x0210, // updated 4.3 - CFAvailableContents = 0x01FD, // updated 4.2 + 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 - DuelChallenge = 0x0277, // 4.2; this is the responsible for opening an ui - PerformNote = 0x0286, // updated 4.3 + // Unknown IPC types that still need to be sent // TODO: figure all these out properly From 04671e2e24fb0175b1f5890bea7a766c1777a061 Mon Sep 17 00:00:00 2001 From: Mordred Date: Sun, 3 Jun 2018 19:31:03 +0200 Subject: [PATCH 09/10] Cleanup cleanup cleanup --- src/common/Network/CommonNetwork.h | 56 +++++------ src/common/Network/GamePacket.cpp | 2 +- src/common/Network/GamePacketNew.h | 28 +++--- src/common/Network/GamePacketParser.cpp | 96 +++++++------------ src/common/Network/PacketContainer.cpp | 4 +- src/common/Network/PacketContainer.h | 6 +- .../sapphire_zone/Actor/EventObject.cpp | 1 - .../Network/Handlers/PacketHandlers.cpp | 7 +- 8 files changed, 82 insertions(+), 118 deletions(-) diff --git a/src/common/Network/CommonNetwork.h b/src/common/Network/CommonNetwork.h index b52c7d5b..c5d4dc90 100644 --- a/src/common/Network/CommonNetwork.h +++ b/src/common/Network/CommonNetwork.h @@ -1,6 +1,3 @@ -/** -* Structural definitions common to all FFXIV:ARR packets. -*/ #ifndef _CORE_NETWORK_PACKETS_COMMON_H #define _CORE_NETWORK_PACKETS_COMMON_H @@ -25,7 +22,7 @@ namespace Packets { * * std::stringstream buf; * buf << pkt_hdr; -* for (int i = 0; i < n; i++) +* for( int i = 0; i < n; i++ ) * { * buf << pkt_seg_hdr[i]; * buf << {pkt_seg_data[i]}; @@ -46,6 +43,8 @@ namespace Packets { * * 0 4 8 12 14 16 * +-------------------------------+---------------+-------+-------+ +* | unknown_0 | unknown_8 | +* +-------------------------------+---------------+-------+-------+ * | timestamp | size | cType | count | * +---+---+-------+---------------+---------------+-------+-------+ * | ? |CMP| ? | ? | @@ -54,13 +53,10 @@ 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. - */ + /** 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; @@ -74,14 +70,14 @@ struct FFXIVARR_PACKET_HEADER 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(&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(&hdr), sizeof hdr); + return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr ); } /** @@ -92,7 +88,7 @@ inline istream& operator>>(istream& is, FFXIVARR_PACKET_HEADER& hdr) * * 0 4 8 12 16 * +---------------+---------------+---------------+-------+-------+ -* | size | source_actor | target_actor | type | ? | +* | size | source_actor | target_actor | type | pad | * +---------------+---------------+---------------+-------+-------+ * | | * : type-specific data of length, size, follows : @@ -109,22 +105,20 @@ struct FFXIVARR_PACKET_SEGMENT_HEADER uint32_t target_actor; /** The segment type. (1, 2, 3, 7, 8, 9, 10) */ uint16_t type; - uint16_t _reserved_E; + 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(&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(&hdr), sizeof hdr); + return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr ); } -// TODO: Include structures for the individual packet segment types - -template struct FFXIVIpcBasePacket +template < int T > struct FFXIVIpcBasePacket { /** Creates a constant representing the IPC type */ enum { _ServerIpcType = T }; @@ -133,7 +127,7 @@ template struct FFXIVIpcBasePacket struct FFXIVARR_PACKET_RAW { FFXIVARR_PACKET_SEGMENT_HEADER segHdr; - std::vector data; + std::vector< uint8_t > data; }; /** @@ -142,7 +136,7 @@ struct FFXIVARR_PACKET_RAW * * 0 4 6 8 12 16 * +-------+-------+------+----------+---------------+---------------+ -* | 14 00 | type | ?? | serverId | timestamp | ??? | +* | 14 00 | type | pad | serverId | timestamp | pad1 | * +-------+-------+------+----------+---------------+---------------+ * | | * : data : @@ -153,24 +147,22 @@ struct FFXIVARR_IPC_HEADER { uint16_t reserved; uint16_t type; - uint16_t unknown_2; + uint16_t padding; uint16_t serverId; uint32_t timestamp; - uint32_t unknown_C; + 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(&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(&hdr), sizeof hdr); + return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr ); } - - } /* Packets */ } /* Network */ } /* Core */ diff --git a/src/common/Network/GamePacket.cpp b/src/common/Network/GamePacket.cpp index 15e9d0f9..b5072b8f 100644 --- a/src/common/Network/GamePacket.cpp +++ b/src/common/Network/GamePacket.cpp @@ -88,7 +88,7 @@ Core::Network::Packets::GamePacket::~GamePacket() void Core::Network::Packets::GamePacket::savePacket() { char filename[20]; - sprintf( filename, "dump_0x%x.dat", m_subType ); + sprintf( filename, "dump_0x%x_%i.dat", m_subType, Util::getTimeMs() ); FILE * fp = nullptr; fp = fopen( filename, "wb" ); fwrite( &m_dataBuf[0], 1, m_segHdr.size, fp ); diff --git a/src/common/Network/GamePacketNew.h b/src/common/Network/GamePacketNew.h index b59a0cdf..451c4eee 100644 --- a/src/common/Network/GamePacketNew.h +++ b/src/common/Network/GamePacketNew.h @@ -16,11 +16,11 @@ namespace Packets { // Must forward define these in order to enable the compiler to produce the // correct template functions. -template +template < typename T, typename T1 > class GamePacketNew; -template -std::ostream& operator<< ( std::ostream& os, const GamePacketNew& packet ); +template < typename T, typename T1 > +std::ostream& operator<< ( std::ostream& os, const GamePacketNew< T, T1 >& packet ); template< class T > using ZoneChannelPacket = GamePacketNew< T, ServerZoneIpcType >; @@ -31,11 +31,11 @@ using ChatChannelPacket = GamePacketNew< T, ServerChatIpcType >; /** * The base implementation of a game packet. Needed for parsing packets. */ -template -class GamePacketNewBase +template < typename T1 > +class FFXIVPacketBase { public: - virtual ~GamePacketNewBase() = default; + virtual ~FFXIVPacketBase() = default; /** * @brief Gets the IPC type of this packet. (Useful for determining the * type of a parsed packet.) @@ -49,8 +49,8 @@ public: * type that represents just the IPC data portion (the bytes after the initial * 32 byte header information.) */ -template -class GamePacketNew : public GamePacketNewBase +template < typename T, typename T1 > +class GamePacketNew : public FFXIVPacketBase< T1 > { public: /** @@ -58,7 +58,7 @@ public: * @param sourceActorId The source actor id. * @param targetActorId The target actor id. */ - GamePacketNew( uint32_t sourceActorId, uint32_t targetActorId ) + GamePacketNew< T, T1 >( uint32_t sourceActorId, uint32_t targetActorId ) { initialize(); m_segHdr.source_actor = sourceActorId; @@ -69,7 +69,7 @@ public: * @brief Constructs a new game packet with the specified actors. * @param sourceActorId The source and target actor id. */ - GamePacketNew( uint32_t bothActorId ) + GamePacketNew< T, T1 >( uint32_t bothActorId ) { initialize(); m_segHdr.source_actor = bothActorId; @@ -109,7 +109,7 @@ public: * @param actorId The source actor id. * @return This IPC packet object (can be used for chaining). */ - GamePacketNew sourceActor( uint32_t actorId ) + GamePacketNew< T, T1 > sourceActor( uint32_t actorId ) { m_segHdr.source_actor = actorId; return this; @@ -129,7 +129,7 @@ public: * @param actorId The target actor id. * @return This IPC packet object (can be used for chaining). */ - GamePacketNew targetActor( uint32_t actorId ) + GamePacketNew< T, T1 > targetActor( uint32_t actorId ) { m_segHdr.target_actor = actorId; return this; @@ -144,7 +144,7 @@ public: return m_segHdr.target_actor; }; - friend std::ostream& operator<< <> ( std::ostream& os, const GamePacketNew& packet ); + friend std::ostream& operator<< <> ( std::ostream& os, const GamePacketNew< T, T1 >& packet ); friend class GamePacketFactory; @@ -205,7 +205,7 @@ private: }; }; -template +template < typename T, typename T1 > std::ostream& operator<<( std::ostream& os, const GamePacketNew& packet ) { #if 0 diff --git a/src/common/Network/GamePacketParser.cpp b/src/common/Network/GamePacketParser.cpp index d80da93b..4a9fd067 100644 --- a/src/common/Network/GamePacketParser.cpp +++ b/src/common/Network/GamePacketParser.cpp @@ -11,80 +11,67 @@ namespace Core { namespace Packets { - PacketParseResult getHeader( - const std::vector< uint8_t > &buffer, - const uint32_t offset, - FFXIVARR_PACKET_HEADER &header) + PacketParseResult getHeader( const std::vector< uint8_t > &buffer, + const uint32_t offset, + FFXIVARR_PACKET_HEADER &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 ) - { + if( remainingBytes < headerSize ) return Incomplete; - } // Copy packet header. memcpy( &header, buffer.data() + offset, headerSize ); - if ( !checkHeader(header) ) - { + if( !checkHeader(header) ) return Malformed; - } return Success; } - PacketParseResult getSegmentHeader( - const std::vector< uint8_t > &buffer, - const uint32_t offset, - FFXIVARR_PACKET_SEGMENT_HEADER &header) + PacketParseResult getSegmentHeader( const std::vector< uint8_t > &buffer, + const uint32_t offset, + FFXIVARR_PACKET_SEGMENT_HEADER &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) - { + if( remainingBytes < headerSize ) return Incomplete; - } // Copy segment header - memcpy(&header, buffer.data() + offset, headerSize); + memcpy( &header, buffer.data() + offset, headerSize ); return Success; } - PacketParseResult getPackets( - const std::vector< uint8_t > &buffer, - const uint32_t offset, - const FFXIVARR_PACKET_HEADER &packetHeader, - std::vector< FFXIVARR_PACKET_RAW > &packets) + PacketParseResult getPackets( const std::vector< uint8_t > &buffer, + const uint32_t offset, + 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 ) - { + 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 ) + while( count < packetHeader.count ) { FFXIVARR_PACKET_RAW rawPacket; // Copy ipc packet message - const auto packetResult = getPacket(buffer, offset + bytesProcessed, rawPacket); - if ( packetResult != Success ) - { + 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? + // why is okay to do this? packets.push_back( rawPacket ); // Add message size and count @@ -94,34 +81,25 @@ namespace Core // 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 ) - { + if( bytesExpected != bytesProcessed ) return Malformed; - } return Success; } - PacketParseResult getPacket( - const std::vector< uint8_t > &buffer, - const uint32_t offset, - FFXIVARR_PACKET_RAW &packet - ) + PacketParseResult 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 ) - { + const auto headerResult = getSegmentHeader( buffer, offset, packet.segHdr ); + if( headerResult != Success ) return headerResult; - } // Check header sanity and it's size - if ( !checkSegmentHeader( packet.segHdr ) ) - { + if( !checkSegmentHeader( packet.segHdr ) ) return Malformed; - } - const auto dataOffset = offset + sizeof(struct FFXIVARR_PACKET_SEGMENT_HEADER); + const auto dataOffset = offset + sizeof( struct FFXIVARR_PACKET_SEGMENT_HEADER ); const auto dataSize = packet.segHdr.size; // Allocate data buffer and copy @@ -131,30 +109,24 @@ namespace Core return Success; } - bool checkHeader(const FFXIVARR_PACKET_HEADER &header) + bool checkHeader( const FFXIVARR_PACKET_HEADER &header ) { // Max size of the packet is capped at 1MB for now. - if ( header.size > 1 * 1024 * 1024 ) - { + if( header.size > 1 * 1024 * 1024 ) return false; - } // Max number of message is capped at 255 for now. - if ( header.count > 255 ) - { + if( header.count > 255 ) return false; - } return true; } - - bool checkSegmentHeader(const FFXIVARR_PACKET_SEGMENT_HEADER &header) + + bool checkSegmentHeader( const FFXIVARR_PACKET_SEGMENT_HEADER &header ) { // Max size of individual message is capped at 256KB for now. - if ( header.size > 256 * 1024 ) - { + if( header.size > 256 * 1024 ) return false; - } return true; } diff --git a/src/common/Network/PacketContainer.cpp b/src/common/Network/PacketContainer.cpp index a0b6037f..d0074938 100644 --- a/src/common/Network/PacketContainer.cpp +++ b/src/common/Network/PacketContainer.cpp @@ -7,14 +7,14 @@ #include -Core::Network::Packets::PacketContainer::PacketContainer( void ) +Core::Network::Packets::PacketContainer::PacketContainer() { memset( &m_ipcHdr, 0, sizeof( FFXIVARR_PACKET_HEADER ) ); m_ipcHdr.size = sizeof( FFXIVARR_PACKET_HEADER ); m_ipcHdr.count = 0; } -Core::Network::Packets::PacketContainer::~PacketContainer( void ) +Core::Network::Packets::PacketContainer::~PacketContainer() { m_entryList.clear(); } diff --git a/src/common/Network/PacketContainer.h b/src/common/Network/PacketContainer.h index a00e0b88..494fe64b 100644 --- a/src/common/Network/PacketContainer.h +++ b/src/common/Network/PacketContainer.h @@ -16,14 +16,14 @@ class GamePacket; class PacketContainer { public: - PacketContainer( void ); - ~PacketContainer( void ); + PacketContainer(); + ~PacketContainer(); void addPacket( GamePacket pEntry ); FFXIVARR_PACKET_HEADER m_ipcHdr; - std::vector m_entryList; + std::vector< GamePacket > m_entryList; std::string toString(); diff --git a/src/servers/sapphire_zone/Actor/EventObject.cpp b/src/servers/sapphire_zone/Actor/EventObject.cpp index eac02744..79244193 100644 --- a/src/servers/sapphire_zone/Actor/EventObject.cpp +++ b/src/servers/sapphire_zone/Actor/EventObject.cpp @@ -7,7 +7,6 @@ #include #include #include -#include #include using namespace Core::Common; diff --git a/src/servers/sapphire_zone/Network/Handlers/PacketHandlers.cpp b/src/servers/sapphire_zone/Network/Handlers/PacketHandlers.cpp index 49efc3de..a0b55b65 100644 --- a/src/servers/sapphire_zone/Network/Handlers/PacketHandlers.cpp +++ b/src/servers/sapphire_zone/Network/Handlers/PacketHandlers.cpp @@ -48,9 +48,10 @@ using namespace Core::Network::Packets::Server; void Core::Network::GameConnection::fcInfoReqHandler( const Packets::GamePacket& inPacket, Entity::Player& player ) { - GamePacketPtr pPe( new GamePacket( 0xDD, 0x78, player.getId(), player.getId() ) ); - pPe->setValAt< uint8_t >( 0x48, 0x01 ); - queueOutPacket( pPe ); + // TODO: use new packet struct for this + //GamePacketPtr pPe( new GamePacket( 0xDD, 0x78, player.getId(), player.getId() ) ); + //pPe->setValAt< uint8_t >( 0x48, 0x01 ); + //queueOutPacket( pPe ); } void Core::Network::GameConnection::setSearchInfoHandler( const Packets::GamePacket& inPacket, From dc64bcf9e6e24973f71d180c04aed1fbaa160176 Mon Sep 17 00:00:00 2001 From: Mordred Date: Sun, 3 Jun 2018 19:50:21 +0200 Subject: [PATCH 10/10] Buildfix --- src/common/Network/GamePacket.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/Network/GamePacket.cpp b/src/common/Network/GamePacket.cpp index b5072b8f..c4d61f81 100644 --- a/src/common/Network/GamePacket.cpp +++ b/src/common/Network/GamePacket.cpp @@ -23,7 +23,7 @@ void Core::Network::Packets::GamePacket::setHeader( uint16_t size, uint16_t type m_segHdr.type = type; m_segHdr.source_actor = id1; m_segHdr.target_actor = id2; - m_segHdr._reserved_E = 0x00; + //m_segHdr._reserved_E = 0x00; m_subType = subType; m_timeStamp = static_cast< uint32_t >( time( nullptr ) );