diff --git a/src/tools/event_object_parser/instance.tmpl b/src/tools/event_object_parser/instance.tmpl index f904e955..d0ebdbc7 100644 --- a/src/tools/event_object_parser/instance.tmpl +++ b/src/tools/event_object_parser/instance.tmpl @@ -1,26 +1,31 @@ #include #include -class INSTANCE_NAME : public InstanceContentScript +using namespace Sapphire; + +class INSTANCE_NAME : + public Sapphire::ScriptAPI::InstanceContentScript { public: - INSTANCE_NAME() : InstanceContentScript( INSTANCE_ID ) - { } + INSTANCE_NAME() : + Sapphire::ScriptAPI::InstanceContentScript( INSTANCE_ID ) + { } - void onInit( InstanceContentPtr instance ) override - { - EOBJ_INIT - } + void onInit( InstanceContent& instance ) override + { +EOBJ_INIT + } - void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override - { + void onUpdate( InstanceContent& instance, uint32_t currTime ) override + { - } + } - void onEnterTerritory( InstanceContentPtr instance, Sapphire::Entity::Player& player, Entity::Player &player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override - { + void onEnterTerritory( InstanceContent& instance, Entity::Player& player, uint32_t eventId, uint16_t param1, + uint16_t param2 ) override + { - } + } }; diff --git a/src/tools/event_object_parser/main.cpp b/src/tools/event_object_parser/main.cpp index 70994e63..8fb216b0 100644 --- a/src/tools/event_object_parser/main.cpp +++ b/src/tools/event_object_parser/main.cpp @@ -290,8 +290,12 @@ void writeEobjEntry( std::ofstream& out, LGB_ENTRY* pObj ) void loadAllInstanceContentEntries() { - auto& catInstance = eData->get_category( "InstanceContent" ); + auto& catInstance = eData->get_category( "ContentFinderCondition" ); + auto& territoryTypeSheet = eData->get_category( "TerritoryType" ); + auto& instanceContentSheet = eData->get_category( "InstanceContent" ); + auto exdInstance = static_cast< xiv::exd::Exd >( catInstance.get_data_ln( xiv::exd::Language::en ) ); + auto instanceContentData = static_cast< xiv::exd::Exd >( instanceContentSheet.get_data_ln( xiv::exd::Language::en ) ); if( zoneNameMap.size() == 0 ) { @@ -315,25 +319,63 @@ void loadAllInstanceContentEntries() auto id = row.first; auto& fields = row.second; - auto name = std::get< std::string >( fields.at( 3 ) ); + auto contentLinkType = std::get< uint8_t >( fields.at( 2 ) ); + auto contentLink = std::get< uint16_t >( fields.at( 3 ) ); + + std::string name; + uint8_t type = 0; + + if( contentLinkType == 1 ) + { + // instancecontent + auto row = instanceContentData.get_row( contentLink ); + + name = std::get< std::string >( row.at( 3 ) ); + type = std::get< uint8_t >( row.at( 0 ) ); + id = contentLink; + } +// else if( contentLinkType == 2 ) +// { +// // partycontent +// auto row = partyContentData.get_row( contentLink ); +// +// name = std::get< std::string >( row.at( 2 ) ); +// } +// else if( contentLinkType == 3 ) +// { +// // publiccontent +// auto row = publicContentData.get_row( contentLink ); +// +// name = std::get< std::string >( row.at( 3 ) ); +// } +// else if( contentLinkType == 4 ) +// { +// // goldsaucercontent +// } + else + { + continue; + } + + if( name.empty() ) continue; - auto type = std::get< uint8_t >( fields.at( 0 ) ); - auto teri = std::get< std::string >( fields.at( 3 ) ); + + auto teri = std::get< uint16_t >( fields.at( 1 ) ); auto i = 0; while( ( i = name.find( ' ' ) ) != std::string::npos ) name = name.replace( name.begin() + i, name.begin() + i + 1, { '_' } ); std::string outStr( - std::to_string( id ) + ", \"" + name + "\", \"" + teri + "\"," + teri + "\n" + std::to_string( id ) + ", \"" + name + "\", \"" + zoneNameMap[ teri ] + "\"," + std::to_string( teri ) + "\n" ); out.write( outStr.c_str(), outStr.size() ); //zoneInstanceMap[zoneId].push_back( std::make_pair( id, name ) ); - zoneDumpList.emplace( teri ); + zoneDumpList.emplace( zoneNameMap[ teri ] ); std::string remove = "★_ '()[]-\x1a\x1\x2\x1f\x1\x3.:"; Sapphire::Util::eraseAllIn( name, remove ); name[ 0 ] = toupper( name[ 0 ] ); - contentList.push_back( { id, name, teri, type } ); + contentList.push_back( { id, name, zoneNameMap[ teri ], type } ); } out.close(); } @@ -379,20 +421,23 @@ int main( int argc, char* argv[] ) } } - std::map< uint8_t, std::string > contentTypeMap; - contentTypeMap[ 0 ] = ""; - contentTypeMap[ 1 ] = "raids"; - contentTypeMap[ 2 ] = "dungeons"; - contentTypeMap[ 3 ] = "guildhests"; - contentTypeMap[ 4 ] = "trials"; - contentTypeMap[ 5 ] = "pvp"; - contentTypeMap[ 6 ] = "pvp"; - contentTypeMap[ 7 ] = "questbattles"; - contentTypeMap[ 8 ] = "hallofthenovice"; - contentTypeMap[ 9 ] = "deepdungeon"; - contentTypeMap[ 10 ] = "treasurehunt"; - contentTypeMap[ 11 ] = "events"; - contentTypeMap[ 12 ] = "pvp"; + std::map< uint8_t, std::string > instanceContentTypeMap; + instanceContentTypeMap[ 0 ] = ""; + instanceContentTypeMap[ 1 ] = "raids"; + instanceContentTypeMap[ 2 ] = "dungeons"; + instanceContentTypeMap[ 3 ] = "guildhests"; + instanceContentTypeMap[ 4 ] = "trials"; + instanceContentTypeMap[ 5 ] = "pvp/thefeast"; + instanceContentTypeMap[ 6 ] = "pvp"; + instanceContentTypeMap[ 7 ] = "questbattles"; + instanceContentTypeMap[ 8 ] = "hallofthenovice"; + instanceContentTypeMap[ 9 ] = "deepdungeon"; + instanceContentTypeMap[ 10 ] = "treasurehunt"; + instanceContentTypeMap[ 11 ] = "events"; + instanceContentTypeMap[ 12 ] = "pvp/rivalwings"; + instanceContentTypeMap[ 13 ] = "maskedcarnivale"; // todo: better name? + instanceContentTypeMap[ 14 ] = "goldsaucer/mahjong"; + instanceContentTypeMap[ 15 ] = "goldsaucer"; if( !fs::exists( "instance.tmpl" ) ) throw std::runtime_error( "instance.tmpl is missing in working directory" ); @@ -446,18 +491,18 @@ int main( int argc, char* argv[] ) loadEobjNames(); //dumpLevelExdEntries( zoneId, zoneName ); - std::string eobjFileName( entry.name + "_eobj.csv" ); - std::ofstream eobjOut( eobjFileName, std::ios::trunc ); - if( !eobjOut.good() ) - throw std::string( "Unable to create " + zoneName + - "_eobj.csv for eobj entries. Run as admin or check there isnt already a handle on the file." ).c_str(); - - eobjOut.close(); - eobjOut.open( eobjFileName, std::ios::app ); - - if( !eobjOut.good() ) - throw std::string( "Unable to create " + zoneName + - "_eobj.csv for eobj entries. Run as admin or check there isnt already a handle on the file." ).c_str(); +// std::string eobjFileName( entry.name + "_eobj.csv" ); +// std::ofstream eobjOut( eobjFileName, std::ios::trunc ); +// if( !eobjOut.good() ) +// throw std::string( "Unable to create " + zoneName + +// "_eobj.csv for eobj entries. Run as admin or check there isnt already a handle on the file." ).c_str(); +// +// eobjOut.close(); +// eobjOut.open( eobjFileName, std::ios::app ); +// +// if( !eobjOut.good() ) +// throw std::string( "Unable to create " + zoneName + +// "_eobj.csv for eobj entries. Run as admin or check there isnt already a handle on the file." ).c_str(); LGB_FILE bgLgb( §ion[ 0 ], "bg" ); LGB_FILE planmapLgb( §ion2[ 0 ], "planmap" ); @@ -569,7 +614,7 @@ int main( int argc, char* argv[] ) states = " // States -> "; for( auto entries1 : sgbFile.stateEntries ) { - states += entries1.name + " "; + states += entries1.name + " (id: " + std::to_string( entries1.header.id ) + ") "; } states += "\n"; } @@ -612,7 +657,7 @@ int main( int argc, char* argv[] ) if( count1 > 0 ) name = name + "_" + std::to_string( count1 ); - eobjects += " instance->registerEObj( \"" + name + "\", " + std::to_string( id ) + + eobjects += " instance.registerEObj( \"" + name + "\", " + std::to_string( id ) + ", " + std::to_string( eobjlevelHierachyId ) + ", " + std::to_string( state ) + ", " + "{ " + std::to_string( pObj->header.translation.x ) + "f, " @@ -664,8 +709,8 @@ int main( int argc, char* argv[] ) std::string subdir = ""; - auto subdirIt = contentTypeMap.find( entry.type ); - if( subdirIt != contentTypeMap.end() ) + auto subdirIt = instanceContentTypeMap.find( entry.type ); + if( subdirIt != instanceContentTypeMap.end() ) subdir = subdirIt->second + "/"; fs::path outDir( "instances/" + subdir ); @@ -682,7 +727,7 @@ int main( int argc, char* argv[] ) std::chrono::duration_cast< std::chrono::seconds >( std::chrono::system_clock::now() - startTime ).count() << " seconds\n"; - getchar(); +// getchar(); if( eData ) delete eData;