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

EventObjectParser is functioning again

This commit is contained in:
Mordred 2022-01-31 00:15:28 +01:00
parent 895d1eb7b1
commit bac72c1b76
5 changed files with 36 additions and 40 deletions

View file

@ -134,7 +134,7 @@ struct EObjData : public InstanceObject
{ {
uint32_t eobjId; uint32_t eobjId;
uint32_t levelHierachyId; uint32_t levelHierachyId;
uint8_t unknown1[0xC]; uint8_t unknown1[136];
}; };
enum TriggerBoxShape : int32_t enum TriggerBoxShape : int32_t

View file

@ -1413,10 +1413,10 @@ namespace Excel
uint16_t SharedGroup; uint16_t SharedGroup;
uint8_t PopType; uint8_t PopType;
uint8_t Invisibility; uint8_t Invisibility;
uint8_t padding1 : 5;
uint8_t EyeCollision : 1;
uint8_t DirectorControl : 1;
uint8_t Target : 1; uint8_t Target : 1;
uint8_t DirectorControl : 1;
uint8_t EyeCollision : 1;
uint8_t padding1 : 5;
int8_t padding2[3]; int8_t padding2[3];
}; };

View file

@ -25,6 +25,6 @@ add_subdirectory( "quest_parser" )
add_subdirectory( "pcb_reader" ) add_subdirectory( "pcb_reader" )
add_subdirectory( "nav_export" ) add_subdirectory( "nav_export" )
#add_subdirectory( "BattleNpcParserPs3" ) #add_subdirectory( "BattleNpcParserPs3" )
#add_subdirectory( "event_object_parser" ) add_subdirectory( "event_object_parser" )
add_subdirectory( "action_parse" ) add_subdirectory( "action_parse" )
#add_subdirectory( "questbattle_bruteforce" ) #add_subdirectory( "questbattle_bruteforce" )

View file

@ -37,8 +37,9 @@ namespace fs = std::filesystem;
// garbage to ignore models // garbage to ignore models
bool ignoreModels = false; 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( "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; std::unordered_map< uint32_t, std::string > eobjNameMap;
struct instanceContent struct instanceContent
@ -73,8 +74,8 @@ std::string zoneNameToPath( const std::string& name )
if( !teri ) if( !teri )
continue; continue;
auto teriName = teri->name; auto teriName = teri->getString( teri->data().Name );
auto teriPath = teri->bg; auto teriPath = teri->getString( teri->data().LVB );
if( teriName.empty() ) if( teriName.empty() )
continue; continue;
@ -102,44 +103,40 @@ std::string zoneNameToPath( const std::string& name )
void loadEobjNames() void loadEobjNames()
{ {
auto nameIdList = g_exdData..getIdList< Excel::EObj >(); auto nameIdList = g_exdData.getIdList< Excel::EObj >();
for( auto id : nameIdList ) for( auto id : nameIdList )
{ {
auto eObjName = g_exdData.getRow< Excel::EObjName >( id ); auto eObjName = g_exdData.getRow< Excel::EObj >( id );
if( !eObjName ) if( !eObjName )
continue; continue;
if( !eObjName->singular.empty() ) if( !eObjName->getString( eObjName->data().Text.SGL ).empty() )
eobjNameMap[ id ] = eObjName->singular; eobjNameMap[ id ] = eObjName->getString( eObjName->data().Text.SGL );
} }
} }
void loadAllInstanceContentEntries() void loadAllInstanceContentEntries()
{ {
auto cfcIdList = g_exdData.getContentFinderConditionIdList(); auto cfcIdList = g_exdData.getIdList< Excel::InstanceContent >();
for( auto cfcId : cfcIdList ) for( auto cfcId : cfcIdList )
{ {
auto cfc = g_exdData.get< Sapphire::Data::ContentFinderCondition >( cfcId );
auto cfc = g_exdData.getRow< Excel::InstanceContent >( cfcId );
if( !cfc ) if( !cfc )
continue; continue;
uint16_t teriId = cfc->territoryType; uint16_t teriId = cfc->data().TerritoryType;
auto tt = g_exdData.get< Sapphire::Data::TerritoryType >( teriId ); auto tt = g_exdData.getRow< Excel::TerritoryType >( teriId );
if( !tt ) if( !tt )
continue; continue;
uint16_t contentId = cfc->content; uint16_t contentId = cfcId;
uint8_t type; uint8_t type;
std::string name; std::string name;
if( cfc->contentLinkType == 1 ) type = cfc->data().Type;
{ name = cfc->getString( cfc->data().Text.Name );
auto ic = g_exdData.get< Sapphire::Data::InstanceContent >( cfc->content );
if( !ic ) /* else if( cfc->contentLinkType == 5 )
continue;
type = ic->instanceContentType;
name = cfc->name;
}
else if( cfc->contentLinkType == 5 )
{ {
auto qb = g_exdData.get< Sapphire::Data::QuestBattle >( cfc->content ); auto qb = g_exdData.get< Sapphire::Data::QuestBattle >( cfc->content );
if( !qb ) if( !qb )
@ -151,7 +148,7 @@ void loadAllInstanceContentEntries()
name = q->name; name = q->name;
} }
else else
continue; continue;*/
if( name.empty() ) if( name.empty() )
continue; continue;
@ -163,7 +160,7 @@ void loadAllInstanceContentEntries()
std::string remove = ",★_ '()[]-\xae\x1a\x1\x2\x1f\x1\x3.:"; std::string remove = ",★_ '()[]-\xae\x1a\x1\x2\x1f\x1\x3.:";
Common::Util::eraseAllIn( name, remove ); Common::Util::eraseAllIn( name, remove );
name[ 0 ] = toupper( name[ 0 ] ); 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 bgFile = g_gameData->getFile( bgLgbPath );
auto planmapFile = g_gameData->getFile( planmapLgbPath ); auto planmapFile = g_gameData->getFile( planmapLgbPath );
auto planeventFile = g_gameData->getFile( planeventLgbPath ); 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 bgData = bgFile->access_data_sections().at( 0 );
auto planmapData = planmapFile->access_data_sections().at( 0 ); auto planmapData = planmapFile->access_data_sections().at( 0 );
auto planeventData = planeventFile->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 bgLgb( &bgData[ 0 ], "bg" );
LGB_FILE planmapLgb( &planmapData[ 0 ], "planmap" ); LGB_FILE planmapLgb( &planmapData[ 0 ], "planmap" );
LGB_FILE planeventLgb( &planeventData[ 0 ], "planevent" ); 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 totalGroups = 0;
uint32_t totalGroupEntries = 0; uint32_t totalGroupEntries = 0;
@ -294,8 +291,7 @@ int main( int argc, char* argv[] )
for( const auto& pEntry1 : group.entries ) for( const auto& pEntry1 : group.entries )
{ {
auto pGObj = pEntry1.get(); auto pGObj = pEntry1.get();
if( pGObj->getType() == LgbEntryType::Gimmick && if( pGObj->getType() == LgbEntryType::Gimmick && pGObj->header.instanceId == pEobj->data.levelHierachyId )
pGObj->header.instanceId == pEobj->data.levelHierachyId )
{ {
auto pGObjR = reinterpret_cast< LGB_GIMMICK_ENTRY* >( pGObj ); auto pGObjR = reinterpret_cast< LGB_GIMMICK_ENTRY* >( pGObj );
char* dataSection = nullptr; char* dataSection = nullptr;
@ -402,17 +398,17 @@ int main( int argc, char* argv[] )
if( entry.id > 200 ) if( entry.id > 200 )
continue; continue;
auto qb = g_exdData.get< Sapphire::Data::QuestBattle >( entry.id ); auto qb = g_exdData.getRow< Excel::QuestBattle >( entry.id );
if( !qb ) if( !qb )
continue; continue;
std::string instruction; std::string instruction;
for( int i = 0; i < 149; ++i ) for( int i = 0; i < 149; ++i )
{ {
if( qb->scriptInstruction[ i ].empty() ) if( qb->getString( qb->data().Define[i].DefineName ).empty() )
continue; continue;
instruction += " static constexpr auto " + qb->scriptInstruction[ i ] + " = " + instruction += " static constexpr auto " + qb->getString( qb->data().Define[i].DefineName ) + " = " +
std::to_string( qb->scriptValue[ i ] ) + ";\n"; std::to_string( qb->data().Define[i].DefineValue ) + ";\n";
} }
result = std::regex_replace( result, std::regex( "\\SCRIPT_INSTRUCTIONS" ), instruction ); result = std::regex_replace( result, std::regex( "\\SCRIPT_INSTRUCTIONS" ), instruction );

View file

@ -101,7 +101,7 @@ void WarpMgr::requestWarp( Entity::Player& player, Common::WarpType warpType, Co
auto& teriMgr = Common::Service< TerritoryMgr >::ref(); auto& teriMgr = Common::Service< TerritoryMgr >::ref();
auto& server = Common::Service< WorldServer >::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 ) ); player.sendToInRangeSet( makeActorControl( player.getId(), ActorDespawnEffect, warpType ) );
auto& taskMgr = Common::Service< TaskMgr >::ref(); auto& taskMgr = Common::Service< TaskMgr >::ref();