mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 22:57:45 +00:00
Merge remote-tracking branch 'upstream/develop' into develop
This commit is contained in:
commit
d22557cc1c
1 changed files with 21 additions and 20 deletions
|
@ -59,14 +59,12 @@ std::vector< instanceContent > contentList;
|
||||||
std::set< std::string > zoneDumpList;
|
std::set< std::string > zoneDumpList;
|
||||||
|
|
||||||
xiv::dat::GameData* gameData = nullptr;
|
xiv::dat::GameData* gameData = nullptr;
|
||||||
xiv::exd::ExdData* eData = nullptr;
|
|
||||||
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
void initExd( const std::string& gamePath )
|
void initExd( const std::string& gamePath )
|
||||||
{
|
{
|
||||||
gameData = gameData ? gameData : new xiv::dat::GameData( gamePath );
|
gameData = gameData ? gameData : new xiv::dat::GameData( gamePath );
|
||||||
eData = eData ? eData : new xiv::exd::ExdData( *gameData );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int parseBlockEntry( char* data, std::vector< PCB_BLOCK_ENTRY >& entries, int gOff )
|
int parseBlockEntry( char* data, std::vector< PCB_BLOCK_ENTRY >& entries, int gOff )
|
||||||
|
@ -125,11 +123,16 @@ int parseBlockEntry( char* data, std::vector< PCB_BLOCK_ENTRY >& entries, int gO
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unordered_map< std::string, std::string > g_nameMap;
|
||||||
std::string zoneNameToPath( const std::string& name )
|
std::string zoneNameToPath( const std::string& name )
|
||||||
{
|
{
|
||||||
std::string path;
|
std::string path;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
|
auto it = g_nameMap.find( Sapphire::Util::toLowerCopy( name ) );
|
||||||
|
if( it != g_nameMap.end() )
|
||||||
|
return it->second;
|
||||||
|
|
||||||
auto teriIdList = g_exdData.getTerritoryTypeIdList();
|
auto teriIdList = g_exdData.getTerritoryTypeIdList();
|
||||||
for( auto teriId : teriIdList )
|
for( auto teriId : teriIdList )
|
||||||
{
|
{
|
||||||
|
@ -155,6 +158,7 @@ std::string zoneNameToPath( const std::string& name )
|
||||||
{
|
{
|
||||||
path = std::string( "bg/" ) + path.substr( 0, path.find( "/level/" ) );
|
path = std::string( "bg/" ) + path.substr( 0, path.find( "/level/" ) );
|
||||||
Logger::debug( "Found path for {0}: {1}", name, path );
|
Logger::debug( "Found path for {0}: {1}", name, path );
|
||||||
|
g_nameMap[ Sapphire::Util::toLowerCopy( name ) ] = path;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -166,16 +170,15 @@ std::string zoneNameToPath( const std::string& name )
|
||||||
|
|
||||||
void loadEobjNames()
|
void loadEobjNames()
|
||||||
{
|
{
|
||||||
auto& cat = eData->get_category( "EObjName" );
|
auto nameIdList = g_exdData.getEObjNameIdList();
|
||||||
auto exd = static_cast< xiv::exd::Exd >( cat.get_data_ln( xiv::exd::Language::en ) );
|
for( auto id : nameIdList )
|
||||||
for( auto& row : exd.get_rows() )
|
|
||||||
{
|
{
|
||||||
auto id = row.first;
|
auto eObjName = g_exdData.get< Sapphire::Data::EObjName >( id );
|
||||||
auto& fields = row.second;
|
if( !eObjName )
|
||||||
auto name = std::get< std::string >( fields.at( 0 ) );
|
continue;
|
||||||
|
|
||||||
if( !name.empty() )
|
if( !eObjName->singular.empty() )
|
||||||
eobjNameMap[ id ] = name;
|
eobjNameMap[ id ] = eObjName->singular;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,9 +335,7 @@ int main( int argc, char* argv[] )
|
||||||
}
|
}
|
||||||
|
|
||||||
loadAllInstanceContentEntries();
|
loadAllInstanceContentEntries();
|
||||||
|
loadEobjNames();
|
||||||
auto& catQuestBattle = eData->get_category( "QuestBattle" );
|
|
||||||
auto questBattleData = static_cast< xiv::exd::Exd >( catQuestBattle.get_data_ln( xiv::exd::Language::none ) );
|
|
||||||
|
|
||||||
for( auto entry : contentList )
|
for( auto entry : contentList )
|
||||||
{
|
{
|
||||||
|
@ -373,7 +374,6 @@ int main( int argc, char* argv[] )
|
||||||
|
|
||||||
uint32_t offset1 = 0x20;
|
uint32_t offset1 = 0x20;
|
||||||
|
|
||||||
loadEobjNames();
|
|
||||||
|
|
||||||
LGB_FILE bgLgb( §ion[ 0 ], "bg" );
|
LGB_FILE bgLgb( §ion[ 0 ], "bg" );
|
||||||
LGB_FILE planmapLgb( §ion2[ 0 ], "planmap" );
|
LGB_FILE planmapLgb( §ion2[ 0 ], "planmap" );
|
||||||
|
@ -584,14 +584,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 );
|
||||||
|
if( !qb )
|
||||||
|
continue;
|
||||||
|
|
||||||
std::string instruction;
|
std::string instruction;
|
||||||
auto row = questBattleData.get_row( entry.id );
|
|
||||||
for( int i = 0; i < 149; ++i )
|
for( int i = 0; i < 149; ++i )
|
||||||
{
|
{
|
||||||
if( std::get< std::string >( row.at( 4 + i ) ).empty() )
|
if( qb->scriptInstruction[ i ].empty() )
|
||||||
continue;
|
continue;
|
||||||
instruction += " static constexpr auto " + std::get< std::string >( row.at( 4 + i ) ) + " = " +
|
instruction += " static constexpr auto " + qb->scriptInstruction[ i ] + " = " +
|
||||||
std::to_string( std::get< uint32_t >( row.at( 154 + i ) ) )+ ";\n";
|
std::to_string( qb->scriptValue[ i ] ) + ";\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
result = std::regex_replace( result, std::regex( "\\SCRIPT_INSTRUCTIONS" ), instruction );
|
result = std::regex_replace( result, std::regex( "\\SCRIPT_INSTRUCTIONS" ), instruction );
|
||||||
|
@ -620,8 +623,6 @@ int main( int argc, char* argv[] )
|
||||||
|
|
||||||
// getchar();
|
// getchar();
|
||||||
|
|
||||||
if( eData )
|
|
||||||
delete eData;
|
|
||||||
if( gameData )
|
if( gameData )
|
||||||
delete gameData;
|
delete gameData;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue