mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 06:27:45 +00:00
General cleanup and improvements of quest_parser
This commit is contained in:
parent
877b8153c2
commit
c59b1df53b
6 changed files with 111 additions and 72 deletions
|
@ -402,25 +402,25 @@ void Sapphire::Network::GameConnection::handleGamePacket( Packets::FFXIVARR_PACK
|
||||||
// todo: validate client version based on sha1 or gamever/bootver
|
// todo: validate client version based on sha1 or gamever/bootver
|
||||||
sendServiceAccountList( packet, tmpId );
|
sendServiceAccountList( packet, tmpId );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ReqCharList:
|
case ReqCharList:
|
||||||
{
|
{
|
||||||
getCharList( packet, tmpId );
|
getCharList( packet, tmpId );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ReqEnterWorld:
|
case ReqEnterWorld:
|
||||||
{
|
{
|
||||||
enterWorld( packet, tmpId );
|
enterWorld( packet, tmpId );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ReqCharCreate:
|
case ReqCharCreate:
|
||||||
{
|
{
|
||||||
createOrModifyChar( packet, tmpId );
|
createOrModifyChar( packet, tmpId );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,6 @@ namespace Sapphire
|
||||||
m_pConfig = std::make_shared< ConfigMgr >();
|
m_pConfig = std::make_shared< ConfigMgr >();
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerLobby::~ServerLobby( void ) = default;
|
|
||||||
|
|
||||||
LobbySessionPtr ServerLobby::getSession( char* sessionId )
|
LobbySessionPtr ServerLobby::getSession( char* sessionId )
|
||||||
{
|
{
|
||||||
return g_restConnector.getSession( sessionId );
|
return g_restConnector.getSession( sessionId );
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace Sapphire
|
||||||
public:
|
public:
|
||||||
ServerLobby( const std::string& configPath );
|
ServerLobby( const std::string& configPath );
|
||||||
|
|
||||||
~ServerLobby( void );
|
~ServerLobby( void ) = default;
|
||||||
|
|
||||||
void run( int32_t argc, char* argv[] );
|
void run( int32_t argc, char* argv[] );
|
||||||
|
|
||||||
|
|
|
@ -25,22 +25,22 @@ namespace fs = std::experimental::filesystem;
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
const std::string onTalkStr(
|
const std::string onTalkStr(
|
||||||
" void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override\n"
|
" void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" auto actor = Event::mapEventActorToRealActor( actorId );\n"
|
" auto actor = Event::mapEventActorToRealActor( actorId );\n"
|
||||||
" }\n\n"
|
" }\n\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
const std::string onWithinRangeStr(
|
const std::string onWithinRangeStr(
|
||||||
" void onWithinRange( uint32_t eventId, Entity::Player& player, uint64_t eRangeId, float x, float y, float z ) override\n"
|
" void onWithinRange( uint32_t eventId, Entity::Player& player, uint64_t eRangeId, float x, float y, float z ) override\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" }\n\n"
|
" }\n\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
const std::string onEmoteStr(
|
const std::string onEmoteStr(
|
||||||
" void onEmote( uint32_t eventId, Entity::Player& player, uint64_t actorId, uint32_t emoteId ) override\n"
|
" void onEmote( uint32_t eventId, Entity::Player& player, uint64_t actorId, uint32_t emoteId ) override\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" }\n\n"
|
" }\n\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
std::string titleCase( const std::string& str )
|
std::string titleCase( const std::string& str )
|
||||||
|
@ -67,8 +67,7 @@ createScript( std::shared_ptr< Sapphire::Data::Quest >& pQuestData, std::set< st
|
||||||
std::string header(
|
std::string header(
|
||||||
"// This is an automatically generated C++ script template\n"
|
"// This is an automatically generated C++ script template\n"
|
||||||
"// Content needs to be added by hand to make it function\n"
|
"// Content needs to be added by hand to make it function\n"
|
||||||
"// In order for this script to be loaded, change its extension to .cpp\n"
|
"// In order for this script to be loaded, move it to the correct folder in <root>/scripts/\n"
|
||||||
"// and move it to the correct folder in <root>/scripts/native/\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
"#include <ScriptObject.h>\n\n"
|
"#include <ScriptObject.h>\n\n"
|
||||||
);
|
);
|
||||||
|
@ -77,13 +76,13 @@ createScript( std::shared_ptr< Sapphire::Data::Quest >& pQuestData, std::set< st
|
||||||
std::string className( pQuestData->id.substr( 0, splitPos ) );
|
std::string className( pQuestData->id.substr( 0, splitPos ) );
|
||||||
//className = "Quest" + className;
|
//className = "Quest" + className;
|
||||||
std::string sceneStr(
|
std::string sceneStr(
|
||||||
" //////////////////////////////////////////////////////////////////////\n // Available Scenes in this quest, not necessarly all are used\n" );
|
" //////////////////////////////////////////////////////////////////////\n // Available Scenes in this quest, not necessarly all are used\n" );
|
||||||
std::string seqStr;
|
std::string seqStr;
|
||||||
seqStr.reserve( 0xFFF );
|
seqStr.reserve( 0xFFF );
|
||||||
seqStr += ( " // Steps in this quest ( 0 is before accepting, \n // 1 is first, 255 means ready for turning it in\n" );
|
seqStr += ( " // Steps in this quest ( 0 is before accepting, \n // 1 is first, 255 means ready for turning it in\n" );
|
||||||
std::string questVarStr( " // Quest vars / flags used\n" );
|
std::string questVarStr( " // Quest vars / flags used\n" );
|
||||||
|
|
||||||
seqStr += " enum Sequence : uint8_t\n {\n";
|
seqStr += " enum Sequence : uint8_t\n {\n";
|
||||||
for( auto& entry : additionalList )
|
for( auto& entry : additionalList )
|
||||||
{
|
{
|
||||||
if( entry.find( "OnScene" ) != std::string::npos )
|
if( entry.find( "OnScene" ) != std::string::npos )
|
||||||
|
@ -95,29 +94,29 @@ createScript( std::shared_ptr< Sapphire::Data::Quest >& pQuestData, std::set< st
|
||||||
sceneId = numOff != std::string::npos ? sceneId.substr( numOff ) : "0";
|
sceneId = numOff != std::string::npos ? sceneId.substr( numOff ) : "0";
|
||||||
|
|
||||||
sceneStr += std::string(
|
sceneStr += std::string(
|
||||||
" void " +
|
" void " +
|
||||||
sceneName +
|
sceneName +
|
||||||
"( Entity::Player& player )\n"
|
"( Entity::Player& player )\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" player.eventPlay( this->getId(), " +
|
" player.playScene( getId(), " +
|
||||||
sceneId +
|
sceneId +
|
||||||
", 0,\n"
|
", 0,\n"
|
||||||
" [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )\n"
|
" [ & ]( Entity::Player& player, const Event::SceneResult& result )\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" });\n"
|
" });\n"
|
||||||
" }\n\n"
|
" }\n\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if( entry.find( "Flag" ) != std::string::npos ||
|
else if( entry.find( "Flag" ) != std::string::npos ||
|
||||||
entry.find( "QuestUI" ) != std::string::npos )
|
entry.find( "QuestUI" ) != std::string::npos )
|
||||||
{
|
{
|
||||||
questVarStr += " // " + entry + "\n";
|
questVarStr += " // " + entry + "\n";
|
||||||
}
|
}
|
||||||
else if( entry.find( "SEQ" ) != std::string::npos )
|
else if( entry.find( "SEQ" ) != std::string::npos )
|
||||||
{
|
{
|
||||||
if( entry.find( "SEQ_FINISH" ) != std::string::npos )
|
if( entry.find( "SEQ_FINISH" ) != std::string::npos )
|
||||||
{
|
{
|
||||||
seqStr += " SeqFinish = 255,\n";
|
seqStr += " SeqFinish = 255,\n";
|
||||||
}
|
}
|
||||||
else if( entry.find( "SEQ_OFFER" ) != std::string::npos )
|
else if( entry.find( "SEQ_OFFER" ) != std::string::npos )
|
||||||
{
|
{
|
||||||
|
@ -131,46 +130,46 @@ createScript( std::shared_ptr< Sapphire::Data::Quest >& pQuestData, std::set< st
|
||||||
}), seqName.end());
|
}), seqName.end());
|
||||||
|
|
||||||
std::string seqId = entry.substr( 4 );
|
std::string seqId = entry.substr( 4 );
|
||||||
seqStr += " " + seqName + " = " + seqId + ",\n";
|
seqStr += " " + seqName + " = " + seqId + ",\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
seqStr += " };\n";
|
seqStr += " };\n";
|
||||||
std::string rewards;
|
std::string rewards;
|
||||||
rewards.reserve( 0xFFF );
|
rewards.reserve( 0xFFF );
|
||||||
rewards += " // Quest rewards \n";
|
rewards += " // Quest rewards \n";
|
||||||
rewards += ( pQuestData->expFactor != 0 ) ? " static constexpr auto RewardExpFactor = " +
|
rewards += ( pQuestData->expFactor != 0 ) ? " static constexpr auto RewardExpFactor = " +
|
||||||
std::to_string( pQuestData->expFactor ) + ";\n" : "";
|
std::to_string( pQuestData->expFactor ) + ";\n" : "";
|
||||||
rewards += ( pQuestData->gilReward != 0 ) ? " static constexpr auto RewardGil = " +
|
rewards += ( pQuestData->gilReward != 0 ) ? " static constexpr auto RewardGil = " +
|
||||||
std::to_string( pQuestData->gilReward ) + ";\n" : "";
|
std::to_string( pQuestData->gilReward ) + ";\n" : "";
|
||||||
rewards += ( pQuestData->emoteReward != 0 ) ? " static constexpr auto RewardEmote = " +
|
rewards += ( pQuestData->emoteReward != 0 ) ? " static constexpr auto RewardEmote = " +
|
||||||
std::to_string( pQuestData->emoteReward ) + ";\n" : "";
|
std::to_string( pQuestData->emoteReward ) + ";\n" : "";
|
||||||
rewards += ( pQuestData->actionReward != 0 ) ? " static constexpr auto RewardAction = " +
|
rewards += ( pQuestData->actionReward != 0 ) ? " static constexpr auto RewardAction = " +
|
||||||
std::to_string( pQuestData->actionReward ) + ";\n" : "";
|
std::to_string( pQuestData->actionReward ) + ";\n" : "";
|
||||||
rewards += ( pQuestData->generalActionReward[ 0 ] != 0 ) ? " static constexpr auto RewardGeneralAction1 = " +
|
rewards += ( pQuestData->generalActionReward[ 0 ] != 0 ) ? " static constexpr auto RewardGeneralAction1 = " +
|
||||||
std::to_string( pQuestData->generalActionReward[ 0 ] ) +
|
std::to_string( pQuestData->generalActionReward[ 0 ] ) +
|
||||||
";\n" : "";
|
";\n" : "";
|
||||||
rewards += ( pQuestData->generalActionReward[ 1 ] != 0 ) ? " static constexpr auto RewardGeneralAction2 = " +
|
rewards += ( pQuestData->generalActionReward[ 1 ] != 0 ) ? " static constexpr auto RewardGeneralAction2 = " +
|
||||||
std::to_string( pQuestData->generalActionReward[ 1 ] ) +
|
std::to_string( pQuestData->generalActionReward[ 1 ] ) +
|
||||||
";\n" : "";
|
";\n" : "";
|
||||||
rewards += ( pQuestData->gCSeals != 0 ) ? " static constexpr auto RewardGCSeals = " +
|
rewards += ( pQuestData->gCSeals != 0 ) ? " static constexpr auto RewardGCSeals = " +
|
||||||
std::to_string( pQuestData->gCSeals ) + ";\n" : "";
|
std::to_string( pQuestData->gCSeals ) + ";\n" : "";
|
||||||
rewards += ( pQuestData->otherReward != 0 ) ? " static constexpr auto RewardOther = " +
|
rewards += ( pQuestData->otherReward != 0 ) ? " static constexpr auto RewardOther = " +
|
||||||
std::to_string( pQuestData->otherReward ) + ";\n" : "";
|
std::to_string( pQuestData->otherReward ) + ";\n" : "";
|
||||||
rewards += ( pQuestData->reputationReward != 0 ) ? " static constexpr auto RewardReputation = " +
|
rewards += ( pQuestData->reputationReward != 0 ) ? " static constexpr auto RewardReputation = " +
|
||||||
std::to_string( pQuestData->reputationReward ) + ";\n" : "";
|
std::to_string( pQuestData->reputationReward ) + ";\n" : "";
|
||||||
rewards += ( pQuestData->tomestoneReward != 0 ) ? " static constexpr auto RewardTomeType = " +
|
rewards += ( pQuestData->tomestoneReward != 0 ) ? " static constexpr auto RewardTomeType = " +
|
||||||
std::to_string( pQuestData->tomestoneReward ) + ";\n" : "";
|
std::to_string( pQuestData->tomestoneReward ) + ";\n" : "";
|
||||||
rewards += ( pQuestData->tomestoneCountReward != 0 ) ? " static constexpr auto RewardTomeCount = " +
|
rewards += ( pQuestData->tomestoneCountReward != 0 ) ? " static constexpr auto RewardTomeCount = " +
|
||||||
std::to_string( pQuestData->tomestoneCountReward ) + ";\n"
|
std::to_string( pQuestData->tomestoneCountReward ) + ";\n"
|
||||||
: "";
|
: "";
|
||||||
rewards += ( pQuestData->instanceContentUnlock != 0 ) ? " static constexpr auto InstancedContentUnlock = " +
|
rewards += ( pQuestData->instanceContentUnlock != 0 ) ? " static constexpr auto InstancedContentUnlock = " +
|
||||||
std::to_string( pQuestData->instanceContentUnlock ) + ";\n"
|
std::to_string( pQuestData->instanceContentUnlock ) + ";\n"
|
||||||
: "";
|
: "";
|
||||||
|
|
||||||
if( !pQuestData->itemReward0.empty() )
|
if( !pQuestData->itemReward0.empty() )
|
||||||
{
|
{
|
||||||
rewards += " static constexpr auto RewardItem[] = { ";
|
rewards += " static constexpr auto RewardItem = { ";
|
||||||
for( size_t ca = 0; ca < pQuestData->itemReward0.size(); ca++ )
|
for( size_t ca = 0; ca < pQuestData->itemReward0.size(); ca++ )
|
||||||
{
|
{
|
||||||
rewards += std::to_string( pQuestData->itemReward0.at( ca ) );
|
rewards += std::to_string( pQuestData->itemReward0.at( ca ) );
|
||||||
|
@ -184,7 +183,7 @@ createScript( std::shared_ptr< Sapphire::Data::Quest >& pQuestData, std::set< st
|
||||||
|
|
||||||
if( !pQuestData->itemReward0.empty() )
|
if( !pQuestData->itemReward0.empty() )
|
||||||
{
|
{
|
||||||
rewards += " static constexpr auto RewardItemCount[] = { ";
|
rewards += " static constexpr auto RewardItemCount = { ";
|
||||||
for( size_t ca = 0; ca < pQuestData->itemCountReward0.size(); ca++ )
|
for( size_t ca = 0; ca < pQuestData->itemCountReward0.size(); ca++ )
|
||||||
{
|
{
|
||||||
rewards += std::to_string( pQuestData->itemCountReward0.at( ca ) );
|
rewards += std::to_string( pQuestData->itemCountReward0.at( ca ) );
|
||||||
|
@ -198,7 +197,7 @@ createScript( std::shared_ptr< Sapphire::Data::Quest >& pQuestData, std::set< st
|
||||||
|
|
||||||
if( !pQuestData->itemReward1.empty() )
|
if( !pQuestData->itemReward1.empty() )
|
||||||
{
|
{
|
||||||
rewards += " static constexpr auto RewardItemOptional[] = { ";
|
rewards += " static constexpr auto RewardItemOptional = { ";
|
||||||
for( size_t ca = 0; ca < pQuestData->itemReward1.size(); ca++ )
|
for( size_t ca = 0; ca < pQuestData->itemReward1.size(); ca++ )
|
||||||
{
|
{
|
||||||
rewards += std::to_string( pQuestData->itemReward1.at( ca ) );
|
rewards += std::to_string( pQuestData->itemReward1.at( ca ) );
|
||||||
|
@ -212,7 +211,7 @@ createScript( std::shared_ptr< Sapphire::Data::Quest >& pQuestData, std::set< st
|
||||||
|
|
||||||
if( !pQuestData->itemCountReward1.empty() )
|
if( !pQuestData->itemCountReward1.empty() )
|
||||||
{
|
{
|
||||||
rewards += " static constexpr auto RewardItemOptionalCount[] = { ";
|
rewards += " static constexpr auto RewardItemOptionalCount = { ";
|
||||||
for( size_t ca = 0; ca < pQuestData->itemCountReward1.size(); ca++ )
|
for( size_t ca = 0; ca < pQuestData->itemCountReward1.size(); ca++ )
|
||||||
{
|
{
|
||||||
rewards += std::to_string( pQuestData->itemCountReward1.at( ca ) );
|
rewards += std::to_string( pQuestData->itemCountReward1.at( ca ) );
|
||||||
|
@ -227,9 +226,13 @@ createScript( std::shared_ptr< Sapphire::Data::Quest >& pQuestData, std::set< st
|
||||||
bool hasERange = false;
|
bool hasERange = false;
|
||||||
bool hasEmote = false;
|
bool hasEmote = false;
|
||||||
bool hasEnemies = false;
|
bool hasEnemies = false;
|
||||||
|
bool hasActions = false;
|
||||||
std::vector< uint32_t > enemy_ids;
|
std::vector< uint32_t > enemy_ids;
|
||||||
|
std::vector< std::string > action_names;
|
||||||
|
std::vector< uint32_t > action_ids;
|
||||||
std::vector< std::string > script_entities;
|
std::vector< std::string > script_entities;
|
||||||
std::string sentities = " // Entities found in the script data of the quest\n";
|
std::string sentities = " // Entities found in the script data of the quest\n";
|
||||||
|
std::vector< std::string > enemy_strings;
|
||||||
|
|
||||||
for( size_t ca = 0; ca < pQuestData->scriptInstruction.size(); ca++ )
|
for( size_t ca = 0; ca < pQuestData->scriptInstruction.size(); ca++ )
|
||||||
{
|
{
|
||||||
|
@ -245,8 +248,21 @@ createScript( std::shared_ptr< Sapphire::Data::Quest >& pQuestData, std::set< st
|
||||||
{
|
{
|
||||||
hasEnemies = true;
|
hasEnemies = true;
|
||||||
enemy_ids.push_back( pQuestData->scriptArg.at( ca ) );
|
enemy_ids.push_back( pQuestData->scriptArg.at( ca ) );
|
||||||
|
enemy_strings.push_back( pQuestData->scriptInstruction.at( ca ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( ( ( pQuestData->scriptInstruction.at( ca ).find( "ACTION0" ) != std::string::npos ) ||
|
||||||
|
( pQuestData->scriptInstruction.at( ca ).find( "ACTION1" ) != std::string::npos ) ||
|
||||||
|
( pQuestData->scriptInstruction.at( ca ).find( "ACTION2" ) != std::string::npos ) ) &&
|
||||||
|
pQuestData->scriptInstruction.at( ca ).find( "_ACTION" ) == std::string::npos &&
|
||||||
|
pQuestData->scriptInstruction.at( ca ).find( "EVENT" ) == std::string::npos )
|
||||||
|
{
|
||||||
|
hasActions = true;
|
||||||
|
action_ids.push_back( pQuestData->scriptArg.at( ca ) );
|
||||||
|
action_names.push_back( pQuestData->scriptInstruction.at( ca ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if( !pQuestData->scriptInstruction.at( ca ).empty() )
|
if( !pQuestData->scriptInstruction.at( ca ).empty() )
|
||||||
script_entities.push_back(
|
script_entities.push_back(
|
||||||
pQuestData->scriptInstruction.at( ca ) + " = " + std::to_string( pQuestData->scriptArg.at( ca ) ) );
|
pQuestData->scriptInstruction.at( ca ) + " = " + std::to_string( pQuestData->scriptArg.at( ca ) ) );
|
||||||
|
@ -260,7 +276,7 @@ createScript( std::shared_ptr< Sapphire::Data::Quest >& pQuestData, std::set< st
|
||||||
return c == '_';
|
return c == '_';
|
||||||
}), name.end());
|
}), name.end());
|
||||||
|
|
||||||
sentities += " static constexpr auto " + name + ";\n";
|
sentities += " static constexpr auto " + name + ";\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string additional = "// Quest Script: " + pQuestData->id + "\n";
|
std::string additional = "// Quest Script: " + pQuestData->id + "\n";
|
||||||
|
@ -269,9 +285,10 @@ createScript( std::shared_ptr< Sapphire::Data::Quest >& pQuestData, std::set< st
|
||||||
additional += "// Start NPC: " + std::to_string( pQuestData->eNpcResidentStart ) + "\n";
|
additional += "// Start NPC: " + std::to_string( pQuestData->eNpcResidentStart ) + "\n";
|
||||||
additional += "// End NPC: " + std::to_string( pQuestData->eNpcResidentEnd ) + "\n\n";
|
additional += "// End NPC: " + std::to_string( pQuestData->eNpcResidentEnd ) + "\n\n";
|
||||||
|
|
||||||
|
std::string actionEntry;
|
||||||
std::string scriptEntry;
|
std::string scriptEntry;
|
||||||
scriptEntry.reserve( 0xFFFF );
|
scriptEntry.reserve( 0xFFFF );
|
||||||
scriptEntry += " //////////////////////////////////////////////////////////////////////\n // Event Handlers\n";
|
scriptEntry += " //////////////////////////////////////////////////////////////////////\n // Event Handlers\n";
|
||||||
|
|
||||||
scriptEntry += onTalkStr;
|
scriptEntry += onTalkStr;
|
||||||
|
|
||||||
|
@ -285,34 +302,59 @@ createScript( std::shared_ptr< Sapphire::Data::Quest >& pQuestData, std::set< st
|
||||||
scriptEntry += onEmoteStr;
|
scriptEntry += onEmoteStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( auto enemy : enemy_ids )
|
|
||||||
{
|
if( !enemy_ids.empty() )
|
||||||
scriptEntry += std::string(
|
scriptEntry += std::string(
|
||||||
" void onMobKill_" + std::to_string( enemy ) + "( Entity::Player& player )\n"
|
" void onBNpcKill( uint32_t npcId, Entity::Player& player )\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" }\n\n"
|
" switch( npcId )\n"
|
||||||
);
|
" {\n" );
|
||||||
|
|
||||||
|
for( auto enemy : enemy_strings )
|
||||||
|
{
|
||||||
|
scriptEntry += " case " + enemy + ": { break; }\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !enemy_ids.empty() )
|
||||||
|
scriptEntry += std::string( " }\n"
|
||||||
|
" }\n" );
|
||||||
|
|
||||||
|
if( !action_ids.empty() )
|
||||||
|
actionEntry += std::string(
|
||||||
|
" void onEObjHit( uint32_t npcId, Entity::Player& player, uin32_t actionId )\n"
|
||||||
|
" {\n"
|
||||||
|
" switch( actionId )\n"
|
||||||
|
" {\n" );
|
||||||
|
|
||||||
|
for( auto action : action_names )
|
||||||
|
{
|
||||||
|
actionEntry += " case " + action + ": { break; }\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !action_ids.empty() )
|
||||||
|
actionEntry += std::string( " }\n"
|
||||||
|
" }\n" );
|
||||||
std::string constructor;
|
std::string constructor;
|
||||||
constructor += std::string(
|
constructor += std::string(
|
||||||
" private:\n"
|
" private:\n"
|
||||||
" // Basic quest information \n" );
|
" // Basic quest information \n" );
|
||||||
constructor += questVarStr + "\n";
|
constructor += questVarStr + "\n";
|
||||||
constructor += seqStr + "\n";
|
constructor += seqStr + "\n";
|
||||||
constructor += rewards + "\n";
|
constructor += rewards + "\n";
|
||||||
constructor += sentities + "\n";
|
constructor += sentities + "\n";
|
||||||
constructor += " public:\n";
|
constructor += " public:\n";
|
||||||
constructor += " " + className + "() : EventScript" + "( " + std::to_string( questId ) + " ){}; \n";
|
constructor += " " + className + "() : Sapphire::ScriptAPI::EventScript" + "( " + std::to_string( questId ) + " ){}; \n";
|
||||||
constructor += " ~" + className + "(){}; \n";
|
constructor += " ~" + className + "() = default; \n";
|
||||||
|
|
||||||
std::string classString(
|
std::string classString(
|
||||||
"class " + className + " : public EventScript\n"
|
"class " + className + " : public Sapphire::ScriptAPI::EventScript\n"
|
||||||
"{\n" +
|
"{\n" +
|
||||||
constructor +
|
constructor +
|
||||||
"\n" +
|
"\n" +
|
||||||
scriptEntry +
|
scriptEntry +
|
||||||
" private:\n" +
|
"\n" +
|
||||||
|
actionEntry +
|
||||||
|
" private:\n" +
|
||||||
sceneStr +
|
sceneStr +
|
||||||
"};\n\nEXPOSE_SCRIPT( " + className + " );"
|
"};\n\nEXPOSE_SCRIPT( " + className + " );"
|
||||||
);
|
);
|
||||||
|
@ -332,7 +374,9 @@ int main( int argc, char** argv )
|
||||||
bool unluac = false;
|
bool unluac = false;
|
||||||
// std::string datLocation( "/opt/sapphire_3_15_0/bin/sqpack" );
|
// std::string datLocation( "/opt/sapphire_3_15_0/bin/sqpack" );
|
||||||
//std::string datLocation( "C:/Program Files (x86)/SquareEnix/FINAL FANTASY XIV - A Realm Reborn/game/sqpack" );
|
//std::string datLocation( "C:/Program Files (x86)/SquareEnix/FINAL FANTASY XIV - A Realm Reborn/game/sqpack" );
|
||||||
std::string datLocation( "C:/SquareEnix/FINAL FANTASY XIV - A Realm Reborn/game/sqpack" );
|
//std::string datLocation( "C:/SquareEnix/FINAL FANTASY XIV - A Realm Reborn/game/sqpack" );
|
||||||
|
|
||||||
|
std::string datLocation( "/home/mordred/sqpack" );
|
||||||
if( argc > 1 )
|
if( argc > 1 )
|
||||||
datLocation = std::string( argv[ 1 ] );
|
datLocation = std::string( argv[ 1 ] );
|
||||||
if( argc > 2 )
|
if( argc > 2 )
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
#define GetRelatCoord( Coord, CellCoord ) ((_maxX-Coord)-CellCoord*_cellSize)
|
#define GetRelatCoord( Coord, CellCoord ) ((_maxX-Coord)-CellCoord*_cellSize)
|
||||||
namespace Sapphire {
|
namespace Sapphire {
|
||||||
|
|
||||||
class Zone;
|
|
||||||
|
|
||||||
template< class T >
|
template< class T >
|
||||||
class CellHandler
|
class CellHandler
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,6 +48,7 @@ namespace Sapphire
|
||||||
|
|
||||||
Common::Weather m_currentWeather;
|
Common::Weather m_currentWeather;
|
||||||
Common::Weather m_weatherOverride;
|
Common::Weather m_weatherOverride;
|
||||||
|
std::map< uint8_t, int32_t > m_weatherRateMap;
|
||||||
|
|
||||||
int64_t m_lastMobUpdate;
|
int64_t m_lastMobUpdate;
|
||||||
|
|
||||||
|
@ -55,8 +56,6 @@ namespace Sapphire
|
||||||
|
|
||||||
std::shared_ptr< Data::TerritoryType > m_territoryTypeInfo;
|
std::shared_ptr< Data::TerritoryType > m_territoryTypeInfo;
|
||||||
|
|
||||||
std::map< uint8_t, int32_t > m_weatherRateMap;
|
|
||||||
|
|
||||||
uint32_t m_nextEObjId;
|
uint32_t m_nextEObjId;
|
||||||
uint32_t m_nextActorId;
|
uint32_t m_nextActorId;
|
||||||
FrameworkPtr m_pFw;
|
FrameworkPtr m_pFw;
|
||||||
|
|
Loading…
Add table
Reference in a new issue