mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-25 05:57:45 +00:00
Change how scripts init and are exposed during compile time
This commit is contained in:
parent
eca4337443
commit
16fa522ca9
5 changed files with 14 additions and 10 deletions
|
@ -32,12 +32,12 @@ foreach(_scriptDir ${children})
|
||||||
|
|
||||||
if(NOT ${_scriptname} MATCHES "ScriptLoader")
|
if(NOT ${_scriptname} MATCHES "ScriptLoader")
|
||||||
if(ScriptIncludes)
|
if(ScriptIncludes)
|
||||||
set(ScriptIncludes "${ScriptIncludes}\n#include \"${_script}\"")
|
set(ScriptIncludes "${ScriptIncludes}\nextern Sapphire::ScriptAPI::ScriptObject* makeScript${_scriptname}();")
|
||||||
else()
|
else()
|
||||||
set(ScriptIncludes "#include \"${_script}\"")
|
set(ScriptIncludes "extern Sapphire::ScriptAPI::ScriptObject* makeScript${_scriptname}();")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(ScriptNames "${ScriptNames} static_cast< Sapphire::ScriptAPI::ScriptObject* >( new ${_scriptname} ),\n")
|
set(ScriptNames "${ScriptNames} makeScript${_scriptname}(),\n")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
|
|
@ -6,4 +6,6 @@
|
||||||
|
|
||||||
#include <Event/EventDefs.h>
|
#include <Event/EventDefs.h>
|
||||||
|
|
||||||
|
#define EXPOSE_SCRIPT( x ) Sapphire::ScriptAPI::ScriptObject* makeScript##x() { return new x; }
|
||||||
|
|
||||||
#endif //SAPPHIRE_SCRIPTOBJECT_H
|
#endif //SAPPHIRE_SCRIPTOBJECT_H
|
||||||
|
|
|
@ -22,4 +22,6 @@ public:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
EXPOSE_SCRIPT( INSTANCE_NAME );
|
|
@ -33,7 +33,7 @@ namespace fs = std::experimental::filesystem;
|
||||||
// garbage to ignore models
|
// garbage to ignore models
|
||||||
bool ignoreModels = false;
|
bool ignoreModels = false;
|
||||||
|
|
||||||
std::string gamePath( "C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack" );
|
std::string gamePath( "/mnt/c/Program Files (x86)/Steam/steamapps/common/FINAL FANTASY XIV Online/game/sqpack" );
|
||||||
std::unordered_map< uint32_t, std::string > eobjNameMap;
|
std::unordered_map< uint32_t, std::string > eobjNameMap;
|
||||||
std::unordered_map< uint16_t, std::string > zoneNameMap;
|
std::unordered_map< uint16_t, std::string > zoneNameMap;
|
||||||
std::unordered_map< uint16_t, std::vector< std::pair< uint16_t, std::string > > > zoneInstanceMap;
|
std::unordered_map< uint16_t, std::vector< std::pair< uint16_t, std::string > > > zoneInstanceMap;
|
||||||
|
@ -319,21 +319,21 @@ void loadAllInstanceContentEntries()
|
||||||
if( name.empty() )
|
if( name.empty() )
|
||||||
continue;
|
continue;
|
||||||
auto type = std::get< uint8_t >( fields.at( 0 ) );
|
auto type = std::get< uint8_t >( fields.at( 0 ) );
|
||||||
auto teri = std::get< uint32_t >( fields.at( 9 ) );
|
auto teri = std::get< std::string >( fields.at( 3 ) );
|
||||||
auto i = 0;
|
auto i = 0;
|
||||||
while( ( i = name.find( ' ' ) ) != std::string::npos )
|
while( ( i = name.find( ' ' ) ) != std::string::npos )
|
||||||
name = name.replace( name.begin() + i, name.begin() + i + 1, { '_' } );
|
name = name.replace( name.begin() + i, name.begin() + i + 1, { '_' } );
|
||||||
std::string outStr(
|
std::string outStr(
|
||||||
std::to_string( id ) + ", \"" + name + "\", \"" + zoneNameMap[ teri ] + "\"," + std::to_string( teri ) + "\n"
|
std::to_string( id ) + ", \"" + name + "\", \"" + teri + "\"," + teri + "\n"
|
||||||
);
|
);
|
||||||
out.write( outStr.c_str(), outStr.size() );
|
out.write( outStr.c_str(), outStr.size() );
|
||||||
//zoneInstanceMap[zoneId].push_back( std::make_pair( id, name ) );
|
//zoneInstanceMap[zoneId].push_back( std::make_pair( id, name ) );
|
||||||
zoneDumpList.emplace( zoneNameMap[ teri ] );
|
zoneDumpList.emplace( teri );
|
||||||
|
|
||||||
std::string remove = "★_ '()[]-\x1a\x1\x2\x1f\x1\x3.:";
|
std::string remove = "★_ '()[]-\x1a\x1\x2\x1f\x1\x3.:";
|
||||||
Sapphire::Util::eraseAllIn( name, remove );
|
Sapphire::Util::eraseAllIn( name, remove );
|
||||||
name[ 0 ] = toupper( name[ 0 ] );
|
name[ 0 ] = toupper( name[ 0 ] );
|
||||||
contentList.push_back( { id, name, zoneNameMap[ teri ], type } );
|
contentList.push_back( { id, name, teri, type } );
|
||||||
}
|
}
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -314,7 +314,7 @@ createScript( std::shared_ptr< Sapphire::Data::Quest >& pQuestData, std::set< st
|
||||||
scriptEntry +
|
scriptEntry +
|
||||||
" private:\n" +
|
" private:\n" +
|
||||||
sceneStr +
|
sceneStr +
|
||||||
"};\n\n"
|
"};\n\nEXPOSE_SCRIPT( " + className + " );"
|
||||||
);
|
);
|
||||||
|
|
||||||
std::ofstream outputFile;
|
std::ofstream outputFile;
|
||||||
|
|
Loading…
Add table
Reference in a new issue