From 5f99c481d1a8dea83502360cf168cecf7eedd5e5 Mon Sep 17 00:00:00 2001 From: DantestyleXD Date: Sun, 28 Jun 2020 01:33:19 +0200 Subject: [PATCH 1/4] move to a better folder --- src/scripts/quest/classquest/{ => LNC}/ClsLnc000.cpp | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/scripts/quest/classquest/{ => LNC}/ClsLnc000.cpp (100%) diff --git a/src/scripts/quest/classquest/ClsLnc000.cpp b/src/scripts/quest/classquest/LNC/ClsLnc000.cpp similarity index 100% rename from src/scripts/quest/classquest/ClsLnc000.cpp rename to src/scripts/quest/classquest/LNC/ClsLnc000.cpp From acc2c18c95656a09b6b3985deff29eef08c18df5 Mon Sep 17 00:00:00 2001 From: DantestyleXD Date: Sun, 28 Jun 2020 03:19:22 +0200 Subject: [PATCH 2/4] [ Subquests ] SubFst002, SubFst008, SubFst011, SubFst014 adjust - SubFst008 and SubFst021 add --- .../quest/subquest/gridania/SubFst002.cpp | 2 +- .../quest/subquest/gridania/SubFst007.cpp | 134 ++++++++++++++++++ .../quest/subquest/gridania/SubFst008.cpp | 12 +- .../quest/subquest/gridania/SubFst011.cpp | 15 +- .../quest/subquest/gridania/SubFst014.cpp | 25 +--- .../quest/subquest/gridania/SubFst021.cpp | 112 +++++++++++++++ 6 files changed, 262 insertions(+), 38 deletions(-) create mode 100644 src/scripts/quest/subquest/gridania/SubFst007.cpp create mode 100644 src/scripts/quest/subquest/gridania/SubFst021.cpp diff --git a/src/scripts/quest/subquest/gridania/SubFst002.cpp b/src/scripts/quest/subquest/gridania/SubFst002.cpp index 1ed0fc15..7713deff 100644 --- a/src/scripts/quest/subquest/gridania/SubFst002.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst002.cpp @@ -43,7 +43,7 @@ private: { if( result.param2 == 1 ) // finish quest { - if( player.giveQuestRewards( getId(), 0 ) ) + if( player.giveQuestRewards( getId(), result.param3 ) ) player.finishQuest( getId() ); } }; diff --git a/src/scripts/quest/subquest/gridania/SubFst007.cpp b/src/scripts/quest/subquest/gridania/SubFst007.cpp new file mode 100644 index 00000000..533e5d73 --- /dev/null +++ b/src/scripts/quest/subquest/gridania/SubFst007.cpp @@ -0,0 +1,134 @@ +#include +#include "Manager/EventMgr.h" +#include +#include + +using namespace Sapphire; + +// Quest Script: SubFst007_00031 +// Quest Name: Essential Oil +// Quest ID: 65567 +// Start NPC: 1000705 +// End NPC: 1000705 + +class SubFst007 : public Sapphire::ScriptAPI::EventScript +{ + private: + // Basic quest information + // Quest vars / flags used + // GetQuestUI8AL + // GetQuestUI8BH + + // 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, + }; + + // Quest rewards + static constexpr auto RewardExpFactor = 100; + uint32_t RewardItemOptional[3] = { 3530, 3531, 5823 }; + uint32_t RewardItemOptionalCount[3] = { 1, 1, 3 }; + + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1000705; + static constexpr auto Enemy0 = 49; + static constexpr auto Item0 = 2000098; + static constexpr auto Seq0Actor0 = 0; + static constexpr auto Seq2Actor0 = 1; + static constexpr auto Seq2Actor0Npctradeno = 99; + static constexpr auto Seq2Actor0Npctradeok = 100; + + public: + SubFst007() : Sapphire::ScriptAPI::EventScript( 65567 ){}; + ~SubFst007(){}; + + ////////////////////////////////////////////////////////////////////// + // Event Handlers + void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override + { + auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref(); + auto actor = pEventMgr.mapEventActorToRealActor( static_cast( actorId ) ); + + if ( actor == Actor0 && !player.hasQuest( getId() ) ) + { + Scene00000( player ); + } + if ( actor == Actor0 && player.getQuestSeq( getId() ) == SeqFinish ) + { + Scene00001( player ); + } + } + + void onBNpcKill( uint32_t npcId, Entity::Player& player ) + { + if ( npcId != Enemy0 ) + return; + + auto currentKC = player.getQuestUI8AL( getId() ); + + if ( currentKC + 1 >= 6 ) + { + player.setQuestUI8AL( getId(), currentKC + 1 ); + player.setQuestUI8BH( getId(), currentKC + 1 ); + player.sendQuestMessage( getId(), 0, 2, currentKC + 1, 6 ); + player.updateQuest( getId(), SeqFinish ); + } + else + { + player.sendQuestMessage( getId(), 0, 2, currentKC + 1, 6 ); + player.setQuestUI8AL( getId(), currentKC + 1 ); + player.setQuestUI8BH( getId(), currentKC + 1 ); + } + } + + private: + ////////////////////////////////////////////////////////////////////// + // Available Scenes in this quest, not necessarly all are used + void Scene00000( Entity::Player& player ) + { + player.playScene( getId(), 0, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + if( result.param2 == 1 ) + player.updateQuest( getId(), Seq1 ); + } ); + } + + void Scene00001( Entity::Player& player ) + { + player.playScene( getId(), 1, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + result.param2 == 1 ? Scene00100( player ) : Scene00099( player ); + } ); + } + + void Scene00099( Entity::Player& player ) + { + player.playScene( getId(), 99, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + } ); + } + + void Scene00100( Entity::Player& player ) + { + player.playScene( getId(), 100, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + if ( result.param2 == 1 ) + { + if ( player.giveQuestRewards( getId(), result.param3 ) ) + { + player.finishQuest( getId() ); + } + } + } ); + } +}; + +EXPOSE_SCRIPT(SubFst007); \ No newline at end of file diff --git a/src/scripts/quest/subquest/gridania/SubFst008.cpp b/src/scripts/quest/subquest/gridania/SubFst008.cpp index 93bc374a..ad00c64c 100644 --- a/src/scripts/quest/subquest/gridania/SubFst008.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst008.cpp @@ -93,6 +93,7 @@ private: [ & ]( Entity::Player& player, const Event::SceneResult& result ) { player.setQuestUI8BH( getId(), 1 ); + player.sendQuestMessage( getId(), 0, 0, 0, 0 ); player.updateQuest( getId(), SeqFinish ); } ); } @@ -102,14 +103,7 @@ private: player.playScene( getId(), 2, HIDE_HOTBAR, [ & ]( Entity::Player& player, const Event::SceneResult& result ) { - if( result.param2 == 1 ) - { - Scene00100( player ); - } - else - { - Scene00099( player ); - } + result.param2 == 1 ? Scene00100( player ) : Scene00099( player ); } ); } @@ -131,7 +125,7 @@ private: { if( player.giveQuestRewards( getId(), 0 ) ) { - player.setQuestUI8BH( getId(), 0 ); + player.setQuestUI8BH( getId(), result.param3 ); player.finishQuest( getId() ); } } diff --git a/src/scripts/quest/subquest/gridania/SubFst011.cpp b/src/scripts/quest/subquest/gridania/SubFst011.cpp index 42bb9db7..63c37934 100644 --- a/src/scripts/quest/subquest/gridania/SubFst011.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst011.cpp @@ -11,8 +11,6 @@ using namespace Sapphire; // Start NPC: 1000195 // End NPC: 1000195 -//NEED TEST KILLCREDIT - class SubFst011 : public Sapphire::ScriptAPI::EventScript { @@ -67,15 +65,12 @@ public: if( npcId != Enemy0 ) return; - auto currentKC = player.getQuestUI8AL( getId() ) + 1; + auto currentKC = player.getQuestUI8AL( getId() ); + player.setQuestUI8AL( getId(), currentKC + 1 ); + player.sendQuestMessage( getId(), 0, 2, currentKC + 1, 6 ); - if( currentKC >= 6 ) + if( currentKC + 1 >= 6 ) player.updateQuest( getId(), SeqFinish ); - else - { - player.setQuestUI8AL( getId(), currentKC ); - player.sendQuestMessage( getId(), 0, 2, currentKC, 6 ); - } } private: @@ -99,7 +94,7 @@ private: { if( result.param2 == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) + if( player.giveQuestRewards( getId(), result.param3 ) ) { player.finishQuest( getId() ); } diff --git a/src/scripts/quest/subquest/gridania/SubFst014.cpp b/src/scripts/quest/subquest/gridania/SubFst014.cpp index 02908da6..8eff7725 100644 --- a/src/scripts/quest/subquest/gridania/SubFst014.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst014.cpp @@ -63,7 +63,7 @@ public: { Scene00000( player ); } - else if( actor == Actor0 ) + else if( actor == Actor0 && player.getQuestSeq( getId() ) == SeqFinish ) { Scene00007( player ); } @@ -131,15 +131,13 @@ private: auto currentCC = player.getQuestUI8AL( getId() ); player.sendQuestMessage( getId(), 0, 2, currentCC + 1, 6 ); + player.setQuestUI8AL( getId(), currentCC + 1 ); + player.setQuestUI8BH( getId(), currentCC + 1 ); - if( currentCC + 1 >= 6 ) + if ( currentCC + 1 >= 6 ) { player.updateQuest( getId(), SeqFinish ); } - else - { - player.setQuestUI8AL( getId(), currentCC + 1 ); - } } void Scene00000( Entity::Player& player ) @@ -211,14 +209,10 @@ private: player.playScene( getId(), 7, HIDE_HOTBAR, [ & ]( Entity::Player& player, const Event::SceneResult& result ) { - if( result.param2 == 1 ) + if ( result.param2 == 1 ) { Scene00088( player ); } - else - { - Scene00087( player ); - } } ); } @@ -227,7 +221,6 @@ private: player.playScene( getId(), 87, HIDE_HOTBAR, [ & ]( Entity::Player& player, const Event::SceneResult& result ) { - player.playScene( getId(), 87, 0, 0, 0 ); } ); } @@ -236,13 +229,9 @@ private: player.playScene( getId(), 88, HIDE_HOTBAR, [ & ]( Entity::Player& player, const Event::SceneResult& result ) { - if( result.param2 == 1 ) + if ( player.giveQuestRewards( getId(), 0 ) ) { - if( player.giveQuestRewards( getId(), 0 ) ) - { - player.setQuestUI8AL( getId(), 0 ); - player.finishQuest( getId() ); - } + player.finishQuest( getId() ); } } ); } diff --git a/src/scripts/quest/subquest/gridania/SubFst021.cpp b/src/scripts/quest/subquest/gridania/SubFst021.cpp new file mode 100644 index 00000000..eac5b435 --- /dev/null +++ b/src/scripts/quest/subquest/gridania/SubFst021.cpp @@ -0,0 +1,112 @@ +// 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: SubFst021_00095 +// Quest Name: Hematophagic Harassment +// Quest ID: 65631 +// Start NPC: 1000640 +// End NPC: 1000640 + +using namespace Sapphire; + +class SubFst021 : public Sapphire::ScriptAPI::EventScript +{ + private: + // Basic quest information + // Quest vars / flags used + // GetQuestUI8AL + + // 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 = 1000640; + static constexpr auto Enemy0 = 118; //136; <- WRONG INFO + + public: + SubFst021() : Sapphire::ScriptAPI::EventScript( 65631 ){}; + ~SubFst021(){}; + + ////////////////////////////////////////////////////////////////////// + // Event Handlers + void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override + { + auto& eventMgr = Common::Service< World::Manager::EventMgr >::ref(); + auto actor = eventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + + if ( actor == Actor0 && !player.hasQuest( getId() ) ) + Scene00000( player ); + if ( actor == Actor0 && player.getQuestSeq( getId() ) == SeqFinish ) + Scene00002( player ); + } + + void onBNpcKill( uint32_t npcId, Entity::Player& player ) override + { + if ( npcId != Enemy0 ) + return; + + auto credit = player.getQuestUI8AL( getId() ); + if ( credit + 1 >= 6 ) + { + player.setQuestUI8AL( getId(), credit + 1 ); + player.sendQuestMessage( getId(), 0, 2, credit + 1, 6 ); + player.updateQuest( getId(), SeqFinish ); + } + else + { + player.setQuestUI8AL( getId(), credit + 1 ); + player.sendQuestMessage( getId(), 0, 2, credit + 1, 6 ); + } + } + + private: + ////////////////////////////////////////////////////////////////////// + // Available Scenes in this quest, not necessarly all are used + void Scene00000( Entity::Player& player ) + { + player.playScene( getId(), 0, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + if ( result.param2 == 1 ) + { + Scene00001( player ); + } + } ); + } + + void Scene00001( Entity::Player& player ) + { + player.playScene( getId(), 1, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + player.updateQuest( getId(), Seq1 ); + } ); + } + + void Scene00002( Entity::Player& player ) + { + player.playScene( getId(), 2, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + if ( result.param2 == 1 ) + if ( player.giveQuestRewards( getId(), result.param3 ) ) + { + player.finishQuest( getId() ); + } + } ); + } +}; + +EXPOSE_SCRIPT( SubFst021 ); \ No newline at end of file From 535b9f55b7cc09074507292951c729fc2d1dfd33 Mon Sep 17 00:00:00 2001 From: DantestyleXD Date: Sun, 28 Jun 2020 03:23:22 +0200 Subject: [PATCH 3/4] [ Subquests ] SubFst026 and SubFst041 adjust --- .../quest/subquest/gridania/SubFst026.cpp | 19 +++++++-------- .../quest/subquest/gridania/SubFst041.cpp | 24 +++++++++---------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/src/scripts/quest/subquest/gridania/SubFst026.cpp b/src/scripts/quest/subquest/gridania/SubFst026.cpp index 8351ea51..13a835e4 100644 --- a/src/scripts/quest/subquest/gridania/SubFst026.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst026.cpp @@ -11,8 +11,6 @@ using namespace Sapphire; // Start NPC: 1000629 // End NPC: 1000629 -//NEED TEST KILLCREDIT - class SubFst026 : public Sapphire::ScriptAPI::EventScript { @@ -55,28 +53,27 @@ public: auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); if( actor == Actor0 && !player.hasQuest( getId() ) ) - { Scene00000( player ); - } else if( actor == Actor0 && player.getQuestSeq( getId() ) == SeqFinish ) - { Scene00001( player ); - } } - void onMobKill( Entity::Player& player, uint64_t npcId ) + void onBNpcKill( uint32_t npcId, Entity::Player& player ) override { if( npcId != Enemy0 ) return; - auto currentKC = player.getQuestUI8AL( getId() ) + 1; + auto currentKC = player.getQuestUI8AL( getId() ); - if( currentKC >= 6 ) + if ( currentKC + 1 >= 6 ) + { + player.sendQuestMessage( getId(), 0, 2, currentKC + 1, 6 ); player.updateQuest( getId(), SeqFinish ); + } else { - player.setQuestUI8AL( getId(), currentKC ); - player.sendQuestMessage( getId(), 0, 2, currentKC, 6 ); + player.setQuestUI8AL( getId(), currentKC + 1 ); + player.sendQuestMessage( getId(), 0, 2, currentKC + 1, 6 ); } } diff --git a/src/scripts/quest/subquest/gridania/SubFst041.cpp b/src/scripts/quest/subquest/gridania/SubFst041.cpp index 8c3512e4..4cede8e6 100644 --- a/src/scripts/quest/subquest/gridania/SubFst041.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst041.cpp @@ -11,8 +11,6 @@ using namespace Sapphire; // Start NPC: 1000432 // End NPC: 1000411 -//NEED TEST KILLCREDIT - class SubFst041 : public Sapphire::ScriptAPI::EventScript { @@ -38,7 +36,7 @@ private: // Entities found in the script data of the quest static constexpr auto Actor0 = 1000432; static constexpr auto Actor1 = 1000411; - static constexpr auto Enemy0 = 159; + static constexpr auto Enemy0 = 197; //159; WRONG INFO static constexpr auto Item0 = 2000142; static constexpr auto Seq0Actor0 = 0; static constexpr auto Seq2Actor1 = 1; @@ -61,28 +59,30 @@ public: auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); if( actor == Actor0 ) - { Scene00000( player ); - } if( actor == Actor1 ) - { Scene00001( player ); - } } - void onMobKill( Entity::Player& player, uint64_t npcId ) + void onBNpcKill( uint32_t npcId, Entity::Player& player ) override { if( npcId != Enemy0 ) return; - auto currentKC = player.getQuestUI8BH( getId() ) + 1; + auto currentKC = player.getQuestUI8BH( getId() ); - if( currentKC >= 6 ) + if ( currentKC + 1 >= 4 ) + { + player.setQuestUI8AL( getId(), currentKC + 1 ); + player.setQuestUI8BH( getId(), currentKC + 1 ); + player.sendQuestMessage( getId(), 1, 0, 0, 0 ); player.updateQuest( getId(), SeqFinish ); + } else { - player.setQuestUI8BH( getId(), currentKC ); - player.sendQuestMessage( getId(), 0, 2, currentKC, 6 ); + player.setQuestUI8AL( getId(), currentKC + 1 ); + player.setQuestUI8BH( getId(), currentKC + 1 ); + player.sendQuestMessage( getId(), 0, 2, currentKC + 1, 4 ); } } From 7f7e2fa00503d9ac5e3005394bf8fa9ca6685767 Mon Sep 17 00:00:00 2001 From: DantestyleXD Date: Sun, 28 Jun 2020 03:52:45 +0200 Subject: [PATCH 4/4] [ Subquests ] SubFst025, SubFst037, SubFst042, SubFst043, SubFst046, SubFst048 added --- .../quest/subquest/gridania/SubFst025.cpp | 134 +++++++++++++ .../quest/subquest/gridania/SubFst037.cpp | 146 ++++++++++++++ .../quest/subquest/gridania/SubFst042.cpp | 100 ++++++++++ .../quest/subquest/gridania/SubFst043.cpp | 184 ++++++++++++++++++ .../quest/subquest/gridania/SubFst046.cpp | 150 ++++++++++++++ .../quest/subquest/gridania/SubFst048.cpp | 144 ++++++++++++++ 6 files changed, 858 insertions(+) create mode 100644 src/scripts/quest/subquest/gridania/SubFst025.cpp create mode 100644 src/scripts/quest/subquest/gridania/SubFst037.cpp create mode 100644 src/scripts/quest/subquest/gridania/SubFst042.cpp create mode 100644 src/scripts/quest/subquest/gridania/SubFst043.cpp create mode 100644 src/scripts/quest/subquest/gridania/SubFst046.cpp create mode 100644 src/scripts/quest/subquest/gridania/SubFst048.cpp diff --git a/src/scripts/quest/subquest/gridania/SubFst025.cpp b/src/scripts/quest/subquest/gridania/SubFst025.cpp new file mode 100644 index 00000000..9c4176c9 --- /dev/null +++ b/src/scripts/quest/subquest/gridania/SubFst025.cpp @@ -0,0 +1,134 @@ +// 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: SubFst025_00103 +// Quest Name: Death to the Bean Thieves +// Quest ID: 65639 +// Start NPC: 1000627 +// End NPC: 1000656 + +using namespace Sapphire; + +class SubFst025 : public Sapphire::ScriptAPI::EventScript +{ + private: + // Basic quest information + // Quest vars / flags used + // GetQuestUI8AL + // GetQuestUI8BH + + // 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 = 1000627; + static constexpr auto Actor1 = 1000656; + static constexpr auto Enemy0 = 5; + static constexpr auto Item0 = 2000075; + + public: + SubFst025() : Sapphire::ScriptAPI::EventScript( 65639 ){}; + ~SubFst025() {}; + + ////////////////////////////////////////////////////////////////////// + // Event Handlers + void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override + { + auto& eventMgr = Common::Service< World::Manager::EventMgr >::ref(); + auto actor = eventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + + if ( actor == Actor0 && !player.hasQuest( getId() ) ) + Scene00000( player ); + if ( actor == Actor1 && player.getQuestSeq( getId() ) == SeqFinish ) + Scene00002( player ); + } + + void onBNpcKill( uint32_t npcId, Entity::Player& player ) override + { + if ( npcId != Enemy0 ) + return; + + auto credit = player.getQuestUI8AL( getId() ); + + if ( credit + 1 >= 6 ) + { + player.sendQuestMessage( getId(), 0, 2, credit + 1, 6 ); + player.setQuestUI8BH( getId(), credit + 1 ); + player.updateQuest( getId(), SeqFinish ); + } + else + { + player.setQuestUI8AL( getId(), credit + 1 ); + player.setQuestUI8BH( getId(), credit + 1 ); + player.sendQuestMessage( getId(), 0, 2, credit + 1, 6 ); + } + + } + + private: + ////////////////////////////////////////////////////////////////////// + // Available Scenes in this quest, not necessarly all are used + void Scene00000( Entity::Player& player ) + { + player.playScene( getId(), 0, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + if ( result.param2 == 1 ) + Scene00001( player ); + } ); + } + + void Scene00001( Entity::Player& player ) + { + player.playScene( getId(), 1, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + player.updateQuest( getId(), Seq1 ); + } ); + } + + void Scene00002( Entity::Player& player ) + { + player.playScene( getId(), 2, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + if ( result.param2 == 1 ) + Scene00003( player ); + } ); + } + + void Scene00003( Entity::Player& player ) + { + player.playScene( getId(), 3, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + if ( result.param2 == 1 ) + if ( player.giveQuestRewards( getId(), result.param3 ) ) + { + player.finishQuest( getId() ); + } + } ); + } + + void Scene00004( Entity::Player& player ) + { + player.playScene( getId(), 4, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + } ); + } +}; + +EXPOSE_SCRIPT( SubFst025 ); \ No newline at end of file diff --git a/src/scripts/quest/subquest/gridania/SubFst037.cpp b/src/scripts/quest/subquest/gridania/SubFst037.cpp new file mode 100644 index 00000000..73ca87cb --- /dev/null +++ b/src/scripts/quest/subquest/gridania/SubFst037.cpp @@ -0,0 +1,146 @@ +// 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: SubFst037_00174 +// Quest Name: No Quarter Given +// Quest ID: 65710 +// Start NPC: 1000612 +// End NPC: 1000612 + +using namespace Sapphire; + +class SubFst037 : public Sapphire::ScriptAPI::EventScript +{ + private: + // Basic quest information + // Quest vars / flags used + // GetQuestUI8AL + // GetQuestUI8BH + // GetQuestUI8BL + + // 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 = 1000612; + static constexpr auto Enemy0 = 192; //743; <- WRONG INFO + static constexpr auto Enemy1 = 193; //744; <- WRONG INFO + static constexpr auto Enemy2 = 194; //745; <- WRONG INFO + + public: + SubFst037() : Sapphire::ScriptAPI::EventScript( 65710 ){}; + ~SubFst037() {}; + + ////////////////////////////////////////////////////////////////////// + // Event Handlers + void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override + { + auto& eventMgr = Common::Service< World::Manager::EventMgr >::ref(); + auto actor = eventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + + if ( actor == Actor0 && !player.hasQuest( getId() ) ) + Scene00000( player ); + if ( actor == Actor0 && player.getQuestSeq( getId() ) == SeqFinish ) + Scene00002( player ); + } + + void onBNpcKill( uint32_t npcId, Entity::Player& player ) override + { + auto credit = 0; + + switch( npcId ) + { + case Enemy0: + { + credit = player.getQuestUI8AL( getId() ); + + player.setQuestUI8AL( getId() , credit + 1 ); + if( credit + 1 <= 2 ) + player.sendQuestMessage( getId() , 0, 2, credit + 1, 2 ); + + break; + } + case Enemy1: + { + credit = player.getQuestUI8BH( getId() ); + + player.setQuestUI8BH( getId() , credit + 1 ); + if ( credit + 1 <= 2 ) + player.sendQuestMessage( getId() , 1, 2, credit + 1, 2 ); + + break; + } + case Enemy2: + { + credit = player.getQuestUI8BL( getId() ); + + player.setQuestUI8BL( getId() , credit + 1 ); + if ( credit + 1 <= 2 ) + player.sendQuestMessage( getId() , 2, 2, credit + 1, 2 ); + + break; + } + } + + checkQuestCompletion( player ); + } + + void checkQuestCompletion( Entity::Player& player ) + { + auto credit192 = player.getQuestUI8AL( getId() ); + auto credit193 = player.getQuestUI8BH( getId() ); + auto credit194 = player.getQuestUI8BL( getId() ); + + if ( credit192 >= 2 && credit193 >= 2 && credit194 >= 2 ) + player.updateQuest( getId() , SeqFinish ); + } + + private: + ////////////////////////////////////////////////////////////////////// + // Available Scenes in this quest, not necessarly all are used + void Scene00000( Entity::Player& player ) + { + player.playScene( getId(), 0, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + if ( result.param2 == 1 ) + Scene00001( player ); + } ); + } + + void Scene00001( Entity::Player& player ) + { + player.playScene( getId(), 1, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + player.updateQuest( getId() , Seq1 ); + } ); + } + + void Scene00002( Entity::Player& player ) + { + player.playScene( getId(), 2, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + if( result.param2 == 1 ) + if ( player.giveQuestRewards( getId() , result.param3 ) ) + { + player.finishQuest( getId() ); + } + } ); + } +}; + +EXPOSE_SCRIPT( SubFst037 ); \ No newline at end of file diff --git a/src/scripts/quest/subquest/gridania/SubFst042.cpp b/src/scripts/quest/subquest/gridania/SubFst042.cpp new file mode 100644 index 00000000..d8883f36 --- /dev/null +++ b/src/scripts/quest/subquest/gridania/SubFst042.cpp @@ -0,0 +1,100 @@ +#include +#include +#include +#include + +using namespace Sapphire; + +// Quest Script: SubFst042_00198 +// Quest Name: Butcher of Greentear +// Quest ID: 65734 +// Start NPC: 1000685 +// End NPC: 1000685 + +class SubFst042 : public Sapphire::ScriptAPI::EventScript +{ +private: + // Basic quest information + // Quest vars / flags used + // GetQuestUI8AL + + enum Sequence : uint8_t + { + Seq0 = 0, + Seq1 = 1, + SeqFinish = 255, + }; + + // Quest rewards + static constexpr auto RewardExpFactor = 200; + uint32_t RewardItemOptional[3] = { 4092, 4091, 5824 }; + uint32_t RewardItemOptionalCount[3] = { 1, 1, 1 }; + + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1000685; + static constexpr auto Enemy0 = 14; + static constexpr auto Seq0Actor0 = 0; + static constexpr auto Seq2Actor0 = 1; + +public: + SubFst042() : Sapphire::ScriptAPI::EventScript( 65734 ){}; + ~SubFst042(){}; + + void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override + { + auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref(); + auto actor = pEventMgr.mapEventActorToRealActor( static_cast( actorId ) ); + + if ( actor == Actor0 && !player.hasQuest( getId() ) ) + { + Scene00000( player ); + } + else if ( actor == Actor0 && player.getQuestSeq( getId() ) == SeqFinish ) + { + Scene00001( player ); + } + } + + void onBNpcKill( uint32_t npcId, Entity::Player& player ) override + { + if ( npcId != Enemy0 ) + return; + + auto currentKC = player.getQuestUI8AL( getId() ) + 1; + + if ( currentKC >= 6 ) + player.updateQuest( getId(), SeqFinish ); + else + { + player.setQuestUI8AL( getId(), currentKC ); + player.sendQuestMessage( getId(), 0, 2, currentKC, 6 ); + } + } + +private: + + void Scene00000( Entity::Player& player ) + { + player.playScene( getId(), 0, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + if ( result.param2 == 1 ) + player.updateQuest( getId(), 1 ); + } ); + } + + void Scene00001( Entity::Player& player ) + { + player.playScene( getId(), 0, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + if ( result.param2 == 1 ) + { + if ( player.giveQuestRewards( getId(), 0 ) ) + player.finishQuest( getId() ); + } + } ); + } +}; + +EXPOSE_SCRIPT( SubFst042 ); \ No newline at end of file diff --git a/src/scripts/quest/subquest/gridania/SubFst043.cpp b/src/scripts/quest/subquest/gridania/SubFst043.cpp new file mode 100644 index 00000000..c48c0736 --- /dev/null +++ b/src/scripts/quest/subquest/gridania/SubFst043.cpp @@ -0,0 +1,184 @@ +// 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: SubFst043_00199 +// Quest Name: A Clear Sign +// Quest ID: 65735 +// Start NPC: 1000172 +// End NPC: 1000627 + +using namespace Sapphire; + +class SubFst043 : public Sapphire::ScriptAPI::EventScript +{ + private: + // Basic quest information + // Quest vars / flags used + // GetQuestBitFlag8 + // GetQuestUI8AL + + // 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 = 1000172; + static constexpr auto Actor1 = 1000627; + static constexpr auto Eobject0 = 2000143; + static constexpr auto Eobject1 = 2000144; + static constexpr auto EventActionProcessMiddle = 16; + static constexpr auto Seq0Actor0 = 0; + static constexpr auto Seq1Eobject0 = 1; + static constexpr auto Seq1Eobject0Eventactionno = 99; + static constexpr auto Seq1Eobject0Eventactionok = 100; + static constexpr auto Seq1Eobject1 = 2; + static constexpr auto Seq1Eobject1Eventactionno = 97; + static constexpr auto Seq1Eobject1Eventactionok = 98; + static constexpr auto Seq2Actor1 = 3; + + public: + SubFst043() : Sapphire::ScriptAPI::EventScript( 65735 ){}; + ~SubFst043() {}; + + ////////////////////////////////////////////////////////////////////// + // Event Handlers + void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override + { + auto& eventMgr = Common::Service< World::Manager::EventMgr >::ref(); + auto actor = eventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + + if ( actor == Actor0 ) + Scene00000( player ); + else if (actor == Actor1 && player.getQuestSeq( getId() ) == SeqFinish ) + Scene00003( player ); + else if ( actor == Eobject0 ) + player.eventActionStart( getId(), EventActionProcessMiddle, + [&]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + Scene00001( player ); + }, + nullptr, eventId ); + else if ( actor == Eobject1 ) + player.eventActionStart( getId(), EventActionProcessMiddle, + [&]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + Scene00002( player ); + }, + nullptr, eventId ); + } + + void checkQuestCompletion( Entity::Player& player ) + { + auto credit = player.getQuestUI8AL( getId() ); + + if ( credit + 1 >= 2 ) + { + player.setQuestUI8AL( getId(), credit + 1 ); + player.sendQuestMessage( getId(), 0, 2, credit + 1, 2 ); + player.updateQuest( getId(), SeqFinish ); + } + else + { + player.setQuestUI8AL( getId(), credit + 1 ); + player.sendQuestMessage( getId(), 0, 2, credit + 1, 2 ); + } + } + + private: + ////////////////////////////////////////////////////////////////////// + // Available Scenes in this quest, not necessarly all are used + void Scene00000( Entity::Player& player ) + { + player.playScene( getId(), 0, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + if ( result.param2 == 1 ) + { + player.updateQuest( getId(), Seq1 ); + } + } ); + } + + void Scene00001( Entity::Player& player ) + { + player.playScene( getId(), 1, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + Scene00100( player ); + } ); + } + + void Scene00002( Entity::Player& player ) + { + player.playScene( getId(), 2, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + Scene00098( player ); + } ); + } + + void Scene00003( Entity::Player& player ) + { + player.playScene( getId(), 3, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + if ( result.param2 == 1 ) + { + if ( player.giveQuestRewards( getId(), 0 ) ) + { + player.setQuestUI8BH( getId(), 0 ); + player.finishQuest( getId() ); + } + } + }); + } + + void Scene00097( Entity::Player& player ) + { + player.playScene( getId(), 97, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + } ); + } + + void Scene00098( Entity::Player& player ) + { + player.playScene( getId(), 98, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + checkQuestCompletion( player ); + player.setQuestBitFlag8( getId(), 2, true ); + } ); + } + + void Scene00099( Entity::Player& player ) + { + player.playScene( getId(), 99, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + } ); + } + + void Scene00100( Entity::Player& player ) + { + player.playScene( getId(), 100, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + checkQuestCompletion( player ); + player.setQuestBitFlag8( getId(), 1, true ); + } ); + } +}; + +EXPOSE_SCRIPT( SubFst043 ); \ No newline at end of file diff --git a/src/scripts/quest/subquest/gridania/SubFst046.cpp b/src/scripts/quest/subquest/gridania/SubFst046.cpp new file mode 100644 index 00000000..69ce3802 --- /dev/null +++ b/src/scripts/quest/subquest/gridania/SubFst046.cpp @@ -0,0 +1,150 @@ +// 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: SubFst046_00210 +// Quest Name: Idle Initiatives +// Quest ID: 65746 +// Start NPC: 1000408 +// End NPC: 1000408 + +using namespace Sapphire; + +class SubFst046 : + public Sapphire::ScriptAPI::EventScript +{ + private: + // Basic quest information + // Quest vars / flags used + // GetQuestBitFlag8 + // GetQuestUI8AL + + // 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 ActionTimelineEventBaseIdle = 783; + static constexpr auto Actor0 = 1000408; + static constexpr auto Actor1 = 1000792; + static constexpr auto Actor2 = 1000793; + static constexpr auto Actor3 = 1000794; + static constexpr auto Seq0Actor0 = 0; + static constexpr auto Seq1Actor1 = 1; + static constexpr auto Seq1Actor2 = 2; + static constexpr auto Seq1Actor3 = 3; + static constexpr auto Seq2Actor0 = 4; + + public: + SubFst046() : Sapphire::ScriptAPI::EventScript( 65746 ){}; + ~SubFst046() {}; + + ////////////////////////////////////////////////////////////////////// + // Event Handlers + void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override + { + auto& eventMgr = Common::Service< World::Manager::EventMgr >::ref(); + auto actor = eventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + + if ( actor == Actor0 && !player.hasQuest( getId() ) ) + Scene00000( player ); + if ( actor == Actor1 ) + Scene00001( player ); + if ( actor == Actor2 ) + Scene00002( player ); + if ( actor == Actor3 ) + Scene00003( player ); + if ( actor == Actor0 && player.getQuestSeq( getId() ) == SeqFinish ) + Scene00004( player ); + } + + void checkQuestCompletion( Entity::Player& player ) + { + auto credit = player.getQuestUI8AL( getId() ); + + if ( credit + 1 >= 3 ) + { + player.setQuestUI8AL( getId(), credit + 1 ); + player.sendQuestMessage( getId(), 0, 0, credit + 1, 3 ); + player.updateQuest( getId(), SeqFinish ); + } + else + { + player.setQuestUI8AL( getId(), credit + 1 ); + player.sendQuestMessage( getId(), 0, 0, credit + 1, 3 ); + } + } + + private: + ////////////////////////////////////////////////////////////////////// + // Available Scenes in this quest, not necessarly all are used + void Scene00000( Entity::Player& player ) + { + player.playScene( getId(), 0, HIDE_HOTBAR, + [ & ]( Entity::Player& player, const Event::SceneResult& result ) + { + if ( result.param2 == 1 ) + { + player.updateQuest( getId(), Seq1 ); + } + } ); + } + + void Scene00001( Entity::Player& player ) + { + player.playScene( getId(), 1, HIDE_HOTBAR, + [ & ]( Entity::Player& player, const Event::SceneResult& result ) + { + checkQuestCompletion( player ); + player.setQuestBitFlag8( getId(), 1, true ); + } ); + } + + void Scene00002( Entity::Player& player ) + { + player.playScene( getId(), 2, HIDE_HOTBAR, + [ & ]( Entity::Player& player, const Event::SceneResult& result ) + { + checkQuestCompletion( player ); + player.setQuestBitFlag8( getId(), 2, true ); + } ); + } + + void Scene00003( Entity::Player& player ) + { + player.playScene( getId(), 3, HIDE_HOTBAR, + [ & ]( Entity::Player& player, const Event::SceneResult& result ) + { + checkQuestCompletion( player ); + player.setQuestBitFlag8( getId(), 3, true ); + } ); + } + + void Scene00004( Entity::Player& player ) + { + player.playScene( getId(), 4, HIDE_HOTBAR, + [ & ]( Entity::Player& player, const Event::SceneResult& result ) + { + if ( result.param2 == 1 ) + { + if ( player.giveQuestRewards( getId(), 0 ) ) + { + player.setQuestUI8BH( getId(), 0 ); + player.finishQuest( getId() ); + } + } + } ); + } +}; + +EXPOSE_SCRIPT( SubFst046 ); \ No newline at end of file diff --git a/src/scripts/quest/subquest/gridania/SubFst048.cpp b/src/scripts/quest/subquest/gridania/SubFst048.cpp new file mode 100644 index 00000000..1dc1c172 --- /dev/null +++ b/src/scripts/quest/subquest/gridania/SubFst048.cpp @@ -0,0 +1,144 @@ +// 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: SubFst048_00375 +// Quest Name: Not a Material Girl +// Quest ID: 65911 +// Start NPC: 1000742 +// End NPC: 1000742 + +using namespace Sapphire; + +class SubFst048 : public Sapphire::ScriptAPI::EventScript +{ + private: + // Basic quest information + // Quest vars / flags used + // GetQuestBitFlag8 + // GetQuestUI8AL + + // 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 = 1000742; + static constexpr auto Actor1 = 1000474; + static constexpr auto Actor2 = 1000476; + static constexpr auto Actor3 = 1000483; + static constexpr auto Seq0Actor0 = 0; + static constexpr auto Seq1Actor1 = 1; + static constexpr auto Seq1Actor2 = 2; + static constexpr auto Seq1Actor3 = 3; + static constexpr auto Seq2Actor0 = 4; + + public: + SubFst048() : Sapphire::ScriptAPI::EventScript( 65911 ){}; + ~SubFst048() {}; + + ////////////////////////////////////////////////////////////////////// + // Event Handlers + void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override + { + auto& eventMgr = Common::Service< World::Manager::EventMgr >::ref(); + auto actor = eventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + + if ( actor == Actor0 && !player.hasQuest( getId() ) ) + Scene00000( player ); + if ( actor == Actor0 && player.getQuestSeq( getId() ) == SeqFinish ) + Scene00004( player ); + if ( actor == Actor1 ) + Scene00001( player ); + if ( actor == Actor2 ) + Scene00002( player ); + if ( actor == Actor3 ) + Scene00003( player ); + } + + void checkQuestCompletion( Entity::Player& player ) + { + auto credit = player.getQuestUI8AL( getId() ); + + if ( credit + 1 >= 3 ) + { + player.setQuestUI8AL( getId(), credit + 1 ); + player.sendQuestMessage( getId(), 0, 2, credit + 1, 3 ); + player.updateQuest( getId(), SeqFinish ); + } + else + { + player.setQuestUI8AL( getId(), credit + 1 ); + player.sendQuestMessage( getId(), 0, 2, credit + 1, 3 ); + } + } + + + private: + ////////////////////////////////////////////////////////////////////// + // Available Scenes in this quest, not necessarly all are used + void Scene00000( Entity::Player& player ) + { + player.playScene( getId(), 0, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + if ( result.param2 == 1 ) + player.updateQuest( getId(), Seq1 ); + } ); + } + + void Scene00001( Entity::Player& player ) + { + player.playScene( getId(), 1, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + checkQuestCompletion( player ); + player.setQuestBitFlag8( getId(), 1, true ); + } ); + } + + void Scene00002( Entity::Player& player ) + { + player.playScene( getId(), 2, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + checkQuestCompletion( player ); + player.setQuestBitFlag8( getId(), 2, true ); + } ); + } + + void Scene00003( Entity::Player& player ) + { + player.playScene( getId(), 3, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + checkQuestCompletion( player ); + player.setQuestBitFlag8( getId(), 3, true ); + } ); + } + + void Scene00004( Entity::Player& player ) + { + player.playScene( getId(), 4, HIDE_HOTBAR, + [&]( Entity::Player& player, const Event::SceneResult& result ) + { + if( result.param2 == 1 ) + if ( player.giveQuestRewards( getId(), result.param3 ) ) + { + player.finishQuest( getId() ); + } + } ); + } +}; + +EXPOSE_SCRIPT( SubFst048 ); \ No newline at end of file