From bac72c1b763edf779e58cd7ea1a3df801ea47e1b Mon Sep 17 00:00:00 2001 From: Mordred Date: Mon, 31 Jan 2022 00:15:28 +0100 Subject: [PATCH] EventObjectParser is functioning again --- deps/datReader/DatCategories/bg/LgbTypes.h | 2 +- deps/datReader/Exd/Structs.h | 6 +- src/tools/CMakeLists.txt | 2 +- src/tools/event_object_parser/main.cpp | 64 ++++++++++------------ src/world/Manager/WarpMgr.cpp | 2 +- 5 files changed, 36 insertions(+), 40 deletions(-) diff --git a/deps/datReader/DatCategories/bg/LgbTypes.h b/deps/datReader/DatCategories/bg/LgbTypes.h index 31cbe8b4..6cc77327 100644 --- a/deps/datReader/DatCategories/bg/LgbTypes.h +++ b/deps/datReader/DatCategories/bg/LgbTypes.h @@ -134,7 +134,7 @@ struct EObjData : public InstanceObject { uint32_t eobjId; uint32_t levelHierachyId; - uint8_t unknown1[0xC]; + uint8_t unknown1[136]; }; enum TriggerBoxShape : int32_t diff --git a/deps/datReader/Exd/Structs.h b/deps/datReader/Exd/Structs.h index b86726d1..6bb0feda 100644 --- a/deps/datReader/Exd/Structs.h +++ b/deps/datReader/Exd/Structs.h @@ -1413,10 +1413,10 @@ namespace Excel uint16_t SharedGroup; uint8_t PopType; uint8_t Invisibility; - uint8_t padding1 : 5; - uint8_t EyeCollision : 1; - uint8_t DirectorControl : 1; uint8_t Target : 1; + uint8_t DirectorControl : 1; + uint8_t EyeCollision : 1; + uint8_t padding1 : 5; int8_t padding2[3]; }; diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index b899fb79..3b31872d 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -25,6 +25,6 @@ add_subdirectory( "quest_parser" ) add_subdirectory( "pcb_reader" ) add_subdirectory( "nav_export" ) #add_subdirectory( "BattleNpcParserPs3" ) -#add_subdirectory( "event_object_parser" ) +add_subdirectory( "event_object_parser" ) add_subdirectory( "action_parse" ) #add_subdirectory( "questbattle_bruteforce" ) \ No newline at end of file diff --git a/src/tools/event_object_parser/main.cpp b/src/tools/event_object_parser/main.cpp index 9e3875f9..5ba4321c 100644 --- a/src/tools/event_object_parser/main.cpp +++ b/src/tools/event_object_parser/main.cpp @@ -37,8 +37,9 @@ namespace fs = std::filesystem; // garbage to ignore models bool ignoreModels = false; -std::string gamePath( "/mnt/c/Program Files (x86)/Steam/steamapps/common/FINAL FANTASY XIV Online/game/sqpack" ); +//std::string gamePath( "/mnt/c/Program Files (x86)/Steam/steamapps/common/FINAL FANTASY XIV Online/game/sqpack" ); //std::string gamePath( "C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack" ); +std::string gamePath( "F:\\client3.0\\game\\sqpack" ); std::unordered_map< uint32_t, std::string > eobjNameMap; struct instanceContent @@ -73,8 +74,8 @@ std::string zoneNameToPath( const std::string& name ) if( !teri ) continue; - auto teriName = teri->name; - auto teriPath = teri->bg; + auto teriName = teri->getString( teri->data().Name ); + auto teriPath = teri->getString( teri->data().LVB ); if( teriName.empty() ) continue; @@ -102,44 +103,40 @@ std::string zoneNameToPath( const std::string& name ) void loadEobjNames() { - auto nameIdList = g_exdData..getIdList< Excel::EObj >(); + auto nameIdList = g_exdData.getIdList< Excel::EObj >(); for( auto id : nameIdList ) { - auto eObjName = g_exdData.getRow< Excel::EObjName >( id ); + auto eObjName = g_exdData.getRow< Excel::EObj >( id ); if( !eObjName ) continue; - if( !eObjName->singular.empty() ) - eobjNameMap[ id ] = eObjName->singular; + if( !eObjName->getString( eObjName->data().Text.SGL ).empty() ) + eobjNameMap[ id ] = eObjName->getString( eObjName->data().Text.SGL ); } } void loadAllInstanceContentEntries() { - auto cfcIdList = g_exdData.getContentFinderConditionIdList(); + auto cfcIdList = g_exdData.getIdList< Excel::InstanceContent >(); for( auto cfcId : cfcIdList ) { - auto cfc = g_exdData.get< Sapphire::Data::ContentFinderCondition >( cfcId ); + + auto cfc = g_exdData.getRow< Excel::InstanceContent >( cfcId ); if( !cfc ) continue; - uint16_t teriId = cfc->territoryType; - auto tt = g_exdData.get< Sapphire::Data::TerritoryType >( teriId ); + uint16_t teriId = cfc->data().TerritoryType; + auto tt = g_exdData.getRow< Excel::TerritoryType >( teriId ); if( !tt ) continue; - uint16_t contentId = cfc->content; + uint16_t contentId = cfcId; uint8_t type; std::string name; - - if( cfc->contentLinkType == 1 ) - { - auto ic = g_exdData.get< Sapphire::Data::InstanceContent >( cfc->content ); - if( !ic ) - continue; - type = ic->instanceContentType; - name = cfc->name; - } - else if( cfc->contentLinkType == 5 ) + + type = cfc->data().Type; + name = cfc->getString( cfc->data().Text.Name ); + + /* else if( cfc->contentLinkType == 5 ) { auto qb = g_exdData.get< Sapphire::Data::QuestBattle >( cfc->content ); if( !qb ) @@ -151,7 +148,7 @@ void loadAllInstanceContentEntries() name = q->name; } else - continue; + continue;*/ if( name.empty() ) continue; @@ -163,7 +160,7 @@ void loadAllInstanceContentEntries() std::string remove = ",★_ '()[]-\xae\x1a\x1\x2\x1f\x1\x3.:"; Common::Util::eraseAllIn( name, remove ); name[ 0 ] = toupper( name[ 0 ] ); - contentList.push_back( { contentId, name, tt->name, type } ); + contentList.push_back( { contentId, name, tt->getString( tt->data().Name ), type } ); } } @@ -245,19 +242,19 @@ int main( int argc, char* argv[] ) auto bgFile = g_gameData->getFile( bgLgbPath ); auto planmapFile = g_gameData->getFile( planmapLgbPath ); auto planeventFile = g_gameData->getFile( planeventLgbPath ); - auto plannerFile = g_gameData->getFile( plannerFilePath ); + //auto plannerFile = g_gameData->getFile( plannerFilePath ); auto bgData = bgFile->access_data_sections().at( 0 ); auto planmapData = planmapFile->access_data_sections().at( 0 ); auto planeventData = planeventFile->access_data_sections().at( 0 ); - auto plannerData = plannerFile->access_data_sections().at( 0 ); + //auto plannerData = plannerFile->access_data_sections().at( 0 ); LGB_FILE bgLgb( &bgData[ 0 ], "bg" ); LGB_FILE planmapLgb( &planmapData[ 0 ], "planmap" ); LGB_FILE planeventLgb( &planeventData[ 0 ], "planevent" ); - LGB_FILE planerLgb( &plannerData[ 0 ], "planner" ); + //LGB_FILE planerLgb( &plannerData[ 0 ], "planner" ); - std::vector< LGB_FILE > lgbList{ bgLgb, planmapLgb }; + std::vector< LGB_FILE > lgbList{ bgLgb, planmapLgb, planeventLgb }; uint32_t totalGroups = 0; uint32_t totalGroupEntries = 0; @@ -294,8 +291,7 @@ int main( int argc, char* argv[] ) for( const auto& pEntry1 : group.entries ) { auto pGObj = pEntry1.get(); - if( pGObj->getType() == LgbEntryType::Gimmick && - pGObj->header.instanceId == pEobj->data.levelHierachyId ) + if( pGObj->getType() == LgbEntryType::Gimmick && pGObj->header.instanceId == pEobj->data.levelHierachyId ) { auto pGObjR = reinterpret_cast< LGB_GIMMICK_ENTRY* >( pGObj ); char* dataSection = nullptr; @@ -402,17 +398,17 @@ int main( int argc, char* argv[] ) if( entry.id > 200 ) continue; - auto qb = g_exdData.get< Sapphire::Data::QuestBattle >( entry.id ); + auto qb = g_exdData.getRow< Excel::QuestBattle >( entry.id ); if( !qb ) continue; std::string instruction; for( int i = 0; i < 149; ++i ) { - if( qb->scriptInstruction[ i ].empty() ) + if( qb->getString( qb->data().Define[i].DefineName ).empty() ) continue; - instruction += " static constexpr auto " + qb->scriptInstruction[ i ] + " = " + - std::to_string( qb->scriptValue[ i ] ) + ";\n"; + instruction += " static constexpr auto " + qb->getString( qb->data().Define[i].DefineName ) + " = " + + std::to_string( qb->data().Define[i].DefineValue ) + ";\n"; } result = std::regex_replace( result, std::regex( "\\SCRIPT_INSTRUCTIONS" ), instruction ); diff --git a/src/world/Manager/WarpMgr.cpp b/src/world/Manager/WarpMgr.cpp index 79ce276a..0cf614c4 100644 --- a/src/world/Manager/WarpMgr.cpp +++ b/src/world/Manager/WarpMgr.cpp @@ -101,7 +101,7 @@ void WarpMgr::requestWarp( Entity::Player& player, Common::WarpType warpType, Co auto& teriMgr = Common::Service< TerritoryMgr >::ref(); auto& server = Common::Service< WorldServer >::ref(); - player.sendToInRangeSet( makeActorControl( player.getId(), WarpStart, warpType, 1, player.getTerritoryTypeId(), 1 ), true ); + player.sendToInRangeSet( makeActorControl( player.getId(), WarpStart, warpType, 1, 0, player.getTerritoryTypeId(), 1 ), true ); player.sendToInRangeSet( makeActorControl( player.getId(), ActorDespawnEffect, warpType ) ); auto& taskMgr = Common::Service< TaskMgr >::ref();