diff --git a/deps/datReader/Exd/Structs.h b/deps/datReader/Exd/Structs.h index baab0c62..09d87d21 100644 --- a/deps/datReader/Exd/Structs.h +++ b/deps/datReader/Exd/Structs.h @@ -173,6 +173,7 @@ namespace Component::Excel InstanceContentTextStruct Text; InstanceContentRewardStruct Reward; uint8_t Unknown1; + uint32_t Unknown2[6]; uint32_t StartCutscene; uint32_t EntranceRect; uint32_t TerritoryType; @@ -182,12 +183,12 @@ namespace Component::Excel uint32_t ContentTextStart; uint32_t ContentTextEnd; int32_t InstanceBuff; - int32_t Unknown2; + int32_t Unknown3; uint16_t Time; uint16_t Music; uint16_t ClearMusic; uint16_t Sortkey; - uint8_t Unknown3; + uint8_t Unknown4; uint8_t Type; uint8_t RandomContentType; uint8_t RewardType; @@ -211,7 +212,7 @@ namespace Component::Excel uint8_t DifferentiateDPS : 1; uint8_t Alliance : 1; uint8_t FreeRole : 1; - uint8_t Unknown4; + uint8_t Unknown5; }; /* 63505 */ diff --git a/src/common/Common.h b/src/common/Common.h index aacb3b51..74c3cd99 100644 --- a/src/common/Common.h +++ b/src/common/Common.h @@ -1185,6 +1185,7 @@ namespace Sapphire::Common { Normal = 0x1, ItemAction = 0x2, + EventItem = 0x3, MountSkill = 0xD, }; diff --git a/src/scripts/quest/subquest/gridania/SubFst033.cpp b/src/scripts/quest/subquest/gridania/SubFst033.cpp new file mode 100644 index 00000000..eee98022 --- /dev/null +++ b/src/scripts/quest/subquest/gridania/SubFst033.cpp @@ -0,0 +1,254 @@ +// This is an automatically generated C++ script template +// Content needs to be added by hand to make it function +// In order for this script to be loaded, move it to the correct folder in /scripts/ + +#include +#include "Manager/EventMgr.h" +#include +#include + +// Quest Script: SubFst033_00127 +// Quest Name: Parasite Cleave +// Quest ID: 65663 +// Start NPC: 1000461 +// End NPC: 1000461 + +using namespace Sapphire; + +class SubFst033 : public Sapphire::ScriptAPI::QuestScript +{ + private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AH + // UI8AL + // UI8BH + // UI8BL + // UI8CH + // UI8CL + // UI8DH + // UI8DL + + /// Countable Num: 3 Seq: 1 Event: 1 Listener: 2000016 + /// Countable Num: 1 Seq: 255 Event: 8 Listener: 2000016 + // Steps in this quest ( 0 is before accepting, + // 1 is first, 255 means ready for turning it in + enum Sequence : uint8_t + { + Seq0 = 0, + Seq1 = 1, + SeqFinish = 255, + }; + + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1000461; + static constexpr auto Enemy0 = 2114368; + static constexpr auto Enemy1 = 2114369; + static constexpr auto Enemy2 = 2114370; + static constexpr auto Eobject0 = 2000016; + static constexpr auto Eobject1 = 2000017; + static constexpr auto Eobject2 = 2000018; + static constexpr auto Item0 = 2000061; + static constexpr auto Seq0Actor0 = 0; + static constexpr auto Seq1Eobject0 = 1; + static constexpr auto Seq1Eobject0Useitemno = 99; + static constexpr auto Seq1Eobject0Useitemok = 100; + static constexpr auto Seq1Eobject1 = 2; + static constexpr auto Seq1Eobject1Useitemno = 97; + static constexpr auto Seq1Eobject1Useitemok = 98; + static constexpr auto Seq1Eobject2 = 3; + static constexpr auto Seq1Eobject2Useitemno = 95; + static constexpr auto Seq1Eobject2Useitemok = 96; + static constexpr auto Seq2Actor0 = 4; + + public: + SubFst033() : Sapphire::ScriptAPI::QuestScript( 65663 ){}; + ~SubFst033() = default; + + ////////////////////////////////////////////////////////////////////// + // Event Handlers + void onTalk( World::Quest& quest, Entity::Player& player, uint64_t actorId ) override + { + quest.setBitFlag8( 0, 0 ); + quest.setBitFlag8( 1, 0 ); + quest.setBitFlag8( 2, 0 ); + quest.setUI8AH( 0 ); + quest.setUI8AL( 0 ); + quest.setUI8BH( 0 ); + quest.setUI8BL( 0 ); + quest.setUI8CH( 0 ); + quest.setUI8CL( 0 ); + quest.setUI8DH( 0 ); + quest.setUI8DL( 1 ); + + Scene00000( quest, player ); + + switch( actorId ) + { + case Actor0: + { + break; + } + } + } + + void onBNpcKill( uint32_t npcId, Entity::Player& player ) override + { + switch( npcId ) + { + case Enemy0: { break; } + case Enemy1: { break; } + case Enemy2: { break; } + } + } + + private: + ////////////////////////////////////////////////////////////////////// + // Available Scenes in this quest, not necessarly all are used + ////////////////////////////////////////////////////////////////////// + + void Scene00000( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 0, NONE, bindSceneReturn( &SubFst033::Scene00000Return ) ); + } + + void Scene00000Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00001( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 1, NONE, bindSceneReturn( &SubFst033::Scene00001Return ) ); + } + + void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00002( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 2, NONE, bindSceneReturn( &SubFst033::Scene00002Return ) ); + } + + void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00003( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 3, NONE, bindSceneReturn( &SubFst033::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00004( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 4, NONE, bindSceneReturn( &SubFst033::Scene00004Return ) ); + } + + void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00095( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 95, NONE, bindSceneReturn( &SubFst033::Scene00095Return ) ); + } + + void Scene00095Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00096( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 96, NONE, bindSceneReturn( &SubFst033::Scene00096Return ) ); + } + + void Scene00096Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00097( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 97, NONE, bindSceneReturn( &SubFst033::Scene00097Return ) ); + } + + void Scene00097Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00098( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 98, NONE, bindSceneReturn( &SubFst033::Scene00098Return ) ); + } + + void Scene00098Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00099( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 99, NONE, bindSceneReturn( &SubFst033::Scene00099Return ) ); + } + + void Scene00099Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00100( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 100, NONE, bindSceneReturn( &SubFst033::Scene00100Return ) ); + } + + void Scene00100Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + + } + +}; + +EXPOSE_SCRIPT( SubFst033 ); \ No newline at end of file diff --git a/src/tools/quest_parser/main.cpp b/src/tools/quest_parser/main.cpp index b4d1f8a6..cbdf1845 100644 --- a/src/tools/quest_parser/main.cpp +++ b/src/tools/quest_parser/main.cpp @@ -26,7 +26,7 @@ using namespace Sapphire; const std::string javaPath("\"C:\\Program Files (x86)\\Java\\jre1.8.0_301\\bin\\java.exe\" -jar unluac_2015_06_13.jar "); -const std::string gamePath( "F:\\client2.3\\game\\sqpack" ); +const std::string gamePath( "F:\\client3.0\\game\\sqpack" ); const std::string onWithinRangeStr( " void onWithinRange( World::Quest& quest, Entity::Player& player, uint64_t eRangeId, float x, float y, float z ) override\n" @@ -123,6 +123,15 @@ createScript( std::shared_ptr< Component::Excel::ExcelStruct< Component::Excel:: std::vector< std::string > scenes; std::vector< std::string > sequences; std::vector< std::string > vars; + bool hasEventItem = false; + + for( const auto& function : functions ) + { + if( function.find( "GetEventItems" ) != std::string::npos ) + { + hasEventItem = true; + } + } for( auto& entry : additionalList ) { if( entry.find( "OnScene" ) != std::string::npos ) @@ -144,7 +153,7 @@ createScript( std::shared_ptr< Component::Excel::ExcelStruct< Component::Excel:: std::size_t splitPos( pQuestData->getString( pQuestData->data().Script ).find( '_' ) ); std::string className( pQuestData->getString( pQuestData->data().Script ).substr( 0, splitPos ) ); - if( className == "ClsLnc000" ) + if( className == "SubFst033" ) { className = className; } @@ -372,6 +381,13 @@ createScript( std::shared_ptr< Component::Excel::ExcelStruct< Component::Excel:: scriptEntry += onEmoteStr; } + if( hasEventItem ) + { + scriptEntry += " void onEventItem( World::Quest& quest, Entity::Player& player, uint64_t actorId ) override\n" + " {\n" + " }\n\n" ; + } + if( !enemy_ids.empty() ) scriptEntry += std::string( " void onBNpcKill( uint32_t npcId, Entity::Player& player ) override\n" diff --git a/src/world/Script/NativeScriptApi.cpp b/src/world/Script/NativeScriptApi.cpp index 0fa70a53..6847abe5 100644 --- a/src/world/Script/NativeScriptApi.cpp +++ b/src/world/Script/NativeScriptApi.cpp @@ -143,6 +143,10 @@ namespace Sapphire::ScriptAPI { } + void QuestScript::onEventItem( World::Quest& quest, Entity::Player& player, uint64_t actorId ) + { + } + void QuestScript::onBNpcKill( uint32_t nameId, Entity::Player& player ) { } @@ -163,10 +167,6 @@ namespace Sapphire::ScriptAPI { } - void QuestScript::onEventItem( Entity::Player& player, uint32_t eventItemId, uint32_t eventId, uint32_t castTime, uint64_t targetId ) - { - } - void QuestScript::onEventHandlerTradeReturn( Entity::Player& player, uint32_t eventId, uint16_t subEvent, uint16_t param, uint32_t catalogId ) { } diff --git a/src/world/Script/NativeScriptApi.h b/src/world/Script/NativeScriptApi.h index ab1aff49..2e6389ca 100644 --- a/src/world/Script/NativeScriptApi.h +++ b/src/world/Script/NativeScriptApi.h @@ -209,6 +209,8 @@ namespace Sapphire::ScriptAPI virtual void onTalk( World::Quest& quest, Sapphire::Entity::Player& player, uint64_t actorId ); + virtual void onEventItem( World::Quest& quest, Sapphire::Entity::Player& player, uint64_t actorId ); + virtual void onBNpcKill( uint32_t nameId, Sapphire::Entity::Player& player ); virtual void onEmote( World::Quest& quest, uint64_t actorId, uint32_t emoteId, Sapphire::Entity::Player& player ); @@ -219,9 +221,6 @@ namespace Sapphire::ScriptAPI virtual void onOutsideRange( Sapphire::Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z ); - virtual void onEventItem( Sapphire::Entity::Player& player, uint32_t eventItemId, uint32_t eventId, uint32_t castTime, - uint64_t targetId ); - virtual void onEventHandlerTradeReturn( Sapphire::Entity::Player& player, uint32_t eventId, uint16_t subEvent, uint16_t param, uint32_t catalogId );