diff --git a/src/scripts/quest/subquest/blackshroud_south/GaiUsa603.cpp b/src/scripts/quest/subquest/blackshroud_south/GaiUsa603.cpp new file mode 100644 index 00000000..91ac941a --- /dev/null +++ b/src/scripts/quest/subquest/blackshroud_south/GaiUsa603.cpp @@ -0,0 +1,152 @@ +// 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 "Manager/EventMgr.h" +#include +#include +#include + +// Quest Script: GaiUsa603_00765 +// Quest Name: Killing Him Softly +// Quest ID: 66301 +// Start NPC: 1000332 +// End NPC: 1000332 + +using namespace Sapphire; + +class GaiUsa603 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // UI8AL + + /// Countable Num: 0 Seq: 1 Event: 1 Listener: 1006219 + /// Countable Num: 0 Seq: 2 Event: 1 Listener: 1000327 + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 1000332 + // 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, + Seq2 = 2, + SeqFinish = 255, + }; + + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1000332;//Meffrid + static constexpr auto Actor1 = 1006219;//Alberda + static constexpr auto Actor2 = 1000327;//Charline + static constexpr auto LocActor0 = 1007660; + static constexpr auto Seq0Actor0Lq = 90; + +public: + GaiUsa603() : Sapphire::ScriptAPI::QuestScript( 66301 ){}; + ~GaiUsa603() = default; + + ////////////////////////////////////////////////////////////////////// + // Event Handlers + void onTalk( World::Quest& quest, Entity::Player& player, uint64_t actorId ) override + { + switch( actorId ) + { + case Actor0: + { + if( quest.getSeq() == Seq0 ) + Scene00000( quest, player ); + else if( quest.getSeq() == SeqFinish ) + Scene00003( quest, player ); + break; + } + case Actor1: + { + if( quest.getSeq() == Seq1 ) + Scene00001( quest, player ); + break; + } + case Actor2: + { + if( quest.getSeq() == Seq2 ) + Scene00002( quest, player ); + 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, HIDE_HOTBAR, bindSceneReturn( &GaiUsa603::Scene00000Return ) ); + } + + void Scene00000Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 )// accept quest + { + Scene00090( quest, player ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00001( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 1, HIDE_HOTBAR, bindSceneReturn( &GaiUsa603::Scene00001Return ) ); + } + + void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 0, 0 ); + quest.setSeq( Seq2 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00002( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 2, HIDE_HOTBAR, bindSceneReturn( &GaiUsa603::Scene00002Return ) ); + } + + void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 1, 0 ); + quest.setSeq( SeqFinish ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00003( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 3, HIDE_HOTBAR, bindSceneReturn( &GaiUsa603::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + player.finishQuest( getId(), result.getResult( 1 ) ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00090( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 90, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, bindSceneReturn( &GaiUsa603::Scene00090Return ) ); + } + + void Scene00090Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setSeq( Seq1 ); + } +}; + +EXPOSE_SCRIPT( GaiUsa603 ); \ No newline at end of file diff --git a/src/scripts/quest/subquest/blackshroud_south/GaiUsa701.cpp b/src/scripts/quest/subquest/blackshroud_south/GaiUsa701.cpp new file mode 100644 index 00000000..96182ee5 --- /dev/null +++ b/src/scripts/quest/subquest/blackshroud_south/GaiUsa701.cpp @@ -0,0 +1,220 @@ +// 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 "Manager/EventMgr.h" +#include +#include +#include + +// Quest Script: GaiUsa701_00774 +// Quest Name: Helping Horn +// Quest ID: 66310 +// Start NPC: 1000332 +// End NPC: 1006680 + +using namespace Sapphire; + +class GaiUsa701 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // UI8AL + // UI8BH + // UI8BL + + /// Countable Num: 0 Seq: 1 Event: 9 Listener: 4 + /// Countable Num: 0 Seq: 2 Event: 1 Listener: 1000332 + /// Countable Num: 0 Seq: 3 Event: 1 Listener: 1000590 + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 1006680 + // 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, + Seq2 = 2, + Seq3 = 3, + SeqFinish = 255, + }; + + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1000332;//Meffrid + static constexpr auto Actor1 = 1000590;//Buscarron + static constexpr auto Actor2 = 1006680;//Faramund + static constexpr auto Enemy0 = 4; //Antelope Stag + static constexpr auto Item0 = 2000612; //Long Antelope Horn (UI8BH) + static constexpr auto Item1 = 2000613; //Herbal Ointement (UI8BL) + +public: + GaiUsa701() : Sapphire::ScriptAPI::QuestScript( 66310 ){}; + ~GaiUsa701() = default; + + ////////////////////////////////////////////////////////////////////// + // Event Handlers + void onTalk( World::Quest& quest, Entity::Player& player, uint64_t actorId ) override + { + switch( actorId ) + { + case Actor0: + { + if( quest.getSeq() == Seq0 ) + Scene00000( quest, player ); + else if( quest.getSeq() == Seq2 ) + Scene00002( quest, player ); + break; + } + case Actor1: + { + if( quest.getSeq() == Seq3 ) + Scene00004( quest, player ); + break; + } + case Actor2: + { + if( quest.getSeq() == SeqFinish ) + Scene00006( quest, player ); + break; + } + } + } + + void onBNpcKill( World::Quest& quest, uint16_t nameId, uint32_t entityId, Entity::Player& player ) override + { + switch( nameId ) + { + case Enemy0: + { + quest.setUI8AL( quest.getUI8AL() + 1 ); + quest.setUI8BH( quest.getUI8BH() + 1 ); + checkQuestCompletion( quest, player ); + break; + } + } + } + +private: + void checkQuestCompletion( World::Quest& quest, Entity::Player& player ) + { + eventMgr().sendEventNotice( player, getId(), 0, 2, quest.getUI8BH(), 4 ); + if( quest.getUI8BH() >= 4 ) + { + quest.setUI8AL( 0 ); + quest.setSeq( Seq2 ); + } + } + ////////////////////////////////////////////////////////////////////// + // Available Scenes in this quest, not necessarly all are used + ////////////////////////////////////////////////////////////////////// + + void Scene00000( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 0, HIDE_HOTBAR, bindSceneReturn( &GaiUsa701::Scene00000Return ) ); + } + + void Scene00000Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 )// accept quest + { + Scene00001( quest, player ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00001( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 1, HIDE_HOTBAR, bindSceneReturn( &GaiUsa701::Scene00001Return ) ); + } + + void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setSeq( Seq1 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00002( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 2, HIDE_HOTBAR, bindSceneReturn( &GaiUsa701::Scene00002Return ) ); + } + + void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + Scene00003( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00003( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 3, HIDE_HOTBAR, bindSceneReturn( &GaiUsa701::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 1, 0 ); + quest.setSeq( Seq3 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00004( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 4, HIDE_HOTBAR, bindSceneReturn( &GaiUsa701::Scene00004Return ) ); + } + + void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + Scene00005( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00005( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 5, HIDE_HOTBAR, bindSceneReturn( &GaiUsa701::Scene00005Return ) ); + } + + void Scene00005Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 2, 0 ); + quest.setUI8BH( 0 ); + quest.setUI8BL( 1 ); + quest.setSeq( SeqFinish ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00006( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 6, HIDE_HOTBAR, bindSceneReturn( &GaiUsa701::Scene00006Return ) ); + } + + void Scene00006Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + Scene00007( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00007( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 7, HIDE_HOTBAR, bindSceneReturn( &GaiUsa701::Scene00007Return ) ); + } + + void Scene00007Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + player.finishQuest( getId(), result.getResult( 1 ) ); + } + } +}; + +EXPOSE_SCRIPT( GaiUsa701 ); \ No newline at end of file diff --git a/src/scripts/quest/subquest/blackshroud_south/GaiUsa702.cpp b/src/scripts/quest/subquest/blackshroud_south/GaiUsa702.cpp new file mode 100644 index 00000000..3d6f4c14 --- /dev/null +++ b/src/scripts/quest/subquest/blackshroud_south/GaiUsa702.cpp @@ -0,0 +1,199 @@ +// 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 "Manager/EventMgr.h" +#include +#include +#include + +#include "Actor/BNpc.h" +#include "Manager/TerritoryMgr.h" +#include "Territory/Territory.h" + +// Quest Script: GaiUsa702_00775 +// Quest Name: He Ain't Heavy +// Quest ID: 66311 +// Start NPC: 1000332 +// End NPC: 1000332 + +using namespace Sapphire; + +class GaiUsa702 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AL + + /// Countable Num: 0 Seq: 1 Event: 1 Listener: 1006219 + /// Countable Num: 0 Seq: 2 Event: 1 Listener: 1000332 + /// Countable Num: 0 Seq: 3 Event: 1 Listener: 1006679 + /// Countable Num: 0 Seq: 4 Event: 5 Listener: 1909 + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 1006679 + // 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, + Seq2 = 2, + Seq3 = 3, + Seq4 = 4, + SeqFinish = 255, + }; + + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1000332;//Meffrid + static constexpr auto Actor1 = 1006219;//Albreda + static constexpr auto Actor2 = 1006679;//Gallien + static constexpr auto Enemy0 = 4278416; + static constexpr auto LocActor0 = 1008112; + static constexpr auto LocBgm1 = 93; + +public: + GaiUsa702() : Sapphire::ScriptAPI::QuestScript( 66311 ){}; + ~GaiUsa702() = default; + + ////////////////////////////////////////////////////////////////////// + // Event Handlers + void onTalk( World::Quest& quest, Entity::Player& player, uint64_t actorId ) override + { + switch( actorId ) + { + case Actor0: + { + if( quest.getSeq() == Seq0 ) + Scene00000( quest, player ); + else if( quest.getSeq() == Seq2 ) + Scene00002( quest, player ); + else if( quest.getSeq() == SeqFinish ) + Scene00005( quest, player ); + break; + } + case Actor1: + { + if( quest.getSeq() == Seq1 ) + Scene00001( quest, player ); + break; + } + case Actor2: + { + if( quest.getSeq() == Seq3 ) + Scene00003( quest, player ); + else if( quest.getSeq() == Seq4 ) + Scene00004( quest, player ); + break; + } + } + } + + void onBNpcKill( World::Quest& quest, uint16_t nameId, uint32_t entityId, Entity::Player& player ) override + { + switch( entityId ) + { + case Enemy0: + { + eventMgr().sendEventNotice( player, getId(), 2, 0 ); + quest.setSeq( Seq4 ); + 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, HIDE_HOTBAR, bindSceneReturn( &GaiUsa702::Scene00000Return ) ); + } + + void Scene00000Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 )// accept quest + { + quest.setSeq( Seq1 ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00001( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 1, HIDE_HOTBAR, bindSceneReturn( &GaiUsa702::Scene00001Return ) ); + } + + void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 0, 0 ); + quest.setSeq( Seq2 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00002( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 2, HIDE_HOTBAR, bindSceneReturn( &GaiUsa702::Scene00002Return ) ); + } + + void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 1, 0 ); + quest.setSeq( Seq3 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00003( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 3, HIDE_HOTBAR, bindSceneReturn( &GaiUsa702::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + auto instance = teriMgr().getTerritoryByGuId( player.getTerritoryId() ); + + auto enemySpawned = instance->getActiveBNpcByInstanceIdAndTriggerOwner( Enemy0, player.getId() ); + + if( !enemySpawned ) + { + auto enemy = instance->createBNpcFromInstanceId( Enemy0, 413 /*TODO: Find the right value*/, Common::BNpcType::Enemy, player.getId() ); + enemy->hateListAdd( player.getAsPlayer(), 1 ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00004( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 4, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, bindSceneReturn( &GaiUsa702::Scene00004Return ) ); + } + + void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 3, 0 ); + quest.setSeq( SeqFinish ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00005( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 5, HIDE_HOTBAR, bindSceneReturn( &GaiUsa702::Scene00005Return ) ); + } + + void Scene00005Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + player.finishQuest( getId(), result.getResult( 1 ) ); + } + } +}; + +EXPOSE_SCRIPT( GaiUsa702 ); \ No newline at end of file diff --git a/src/scripts/quest/subquest/blackshroud_south/GaiUsa703.cpp b/src/scripts/quest/subquest/blackshroud_south/GaiUsa703.cpp new file mode 100644 index 00000000..507e2015 --- /dev/null +++ b/src/scripts/quest/subquest/blackshroud_south/GaiUsa703.cpp @@ -0,0 +1,127 @@ +// 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 "Manager/EventMgr.h" +#include +#include +#include + +// Quest Script: GaiUsa703_00776 +// Quest Name: Come Highly Recommended +// Quest ID: 66312 +// Start NPC: 1000332 +// End NPC: 1006215 + +using namespace Sapphire; + +class GaiUsa703 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // UI8AL + // UI8BH + + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 1006215 + // Steps in this quest ( 0 is before accepting, + // 1 is first, 255 means ready for turning it in + enum Sequence : uint8_t + { + Seq0 = 0, + SeqFinish = 255, + }; + + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1000332;//Meffrid + static constexpr auto Actor1 = 1006215;//Gundobald + static constexpr auto Item0 = 2000614;//Meffrid's Recommendation (UI8BH) + +public: + GaiUsa703() : Sapphire::ScriptAPI::QuestScript( 66312 ){}; + ~GaiUsa703() = default; + + ////////////////////////////////////////////////////////////////////// + // Event Handlers + void onTalk( World::Quest& quest, Entity::Player& player, uint64_t actorId ) override + { + switch( actorId ) + { + case Actor0: + { + if( quest.getSeq() == Seq0 ) + Scene00000( quest, player ); + break; + } + case Actor1: + { + if( quest.getSeq() == SeqFinish ) + Scene00002( quest, player ); + 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, HIDE_HOTBAR, bindSceneReturn( &GaiUsa703::Scene00000Return ) ); + } + + void Scene00000Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 )// accept quest + { + Scene00001( quest, player ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00001( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 1, HIDE_HOTBAR, bindSceneReturn( &GaiUsa703::Scene00001Return ) ); + } + + void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8BH( 1 ); + quest.setSeq( SeqFinish ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00002( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 2, HIDE_HOTBAR, bindSceneReturn( &GaiUsa703::Scene00002Return ) ); + } + + void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + Scene00003( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00003( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 3, HIDE_HOTBAR, bindSceneReturn( &GaiUsa703::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + player.finishQuest( getId(), result.getResult(1) ); + } + } +}; + +EXPOSE_SCRIPT( GaiUsa703 ); \ No newline at end of file diff --git a/src/scripts/quest/subquest/thanalan_south/GaiUsa509.cpp b/src/scripts/quest/subquest/thanalan_south/GaiUsa509.cpp new file mode 100644 index 00000000..78721971 --- /dev/null +++ b/src/scripts/quest/subquest/thanalan_south/GaiUsa509.cpp @@ -0,0 +1,234 @@ +// 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 "Manager/EventMgr.h" +#include +#include +#include + +// Quest Script: GaiUsa509_00761 +// Quest Name: Tea for Three +// Quest ID: 66297 +// Start NPC: 1006217 +// End NPC: 1006217 + +using namespace Sapphire; + +class GaiUsa509 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AH + // UI8AL + // UI8BH + // UI8BL + // UI8CH + + /// Countable Num: 0 Seq: 1 Event: 1 Listener: 1006702 + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 1006703 + // 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 = 1006217;//Gisilbehrt + static constexpr auto Actor1 = 1006702;//Orsic + static constexpr auto Actor2 = 1006703;//Yayazuku + static constexpr auto Actor3 = 1006704;//Angry River + static constexpr auto Item0 = 2000607;//Sweet Thanalan Tea (Seq1-UI8CH) + +public: + GaiUsa509() : Sapphire::ScriptAPI::QuestScript( 66297 ){}; + ~GaiUsa509() = default; + + ////////////////////////////////////////////////////////////////////// + // Event Handlers + void onTalk( World::Quest& quest, Entity::Player& player, uint64_t actorId ) override + { + switch( actorId ) + { + case Actor0: + { + if( quest.getSeq() == Seq0 ) + Scene00000( quest, player ); + else if( quest.getSeq() == SeqFinish ) + Scene00008( quest, player ); + break; + } + case Actor1: + { + if( quest.getSeq() == Seq1 ) + Scene00002( quest, player ); + break; + } + case Actor2: + { + if( quest.getSeq() == Seq1 ) + Scene00004( quest, player ); + break; + } + case Actor3: + { + if( quest.getSeq() == Seq1 ) + Scene00006( quest, player ); + break; + } + } + } + + +private: + void checkQuestCompletion( World::Quest& quest, Entity::Player& player ) + { + eventMgr().sendEventNotice( player, getId(), 0, 2, quest.getUI8AH(), 3 ); + if( quest.getUI8AH() >= 3 ) + { + //Clean Vars + quest.setUI8AH( 0 ); + quest.setUI8AL( 0 ); + quest.setUI8BH( 0 ); + quest.setUI8BL( 0 ); + quest.setUI8CH( 0 ); + quest.setSeq( SeqFinish ); + } + } + ////////////////////////////////////////////////////////////////////// + // Available Scenes in this quest, not necessarly all are used + ////////////////////////////////////////////////////////////////////// + + void Scene00000( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 0, HIDE_HOTBAR, bindSceneReturn( &GaiUsa509::Scene00000Return ) ); + } + + void Scene00000Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 )// accept quest + { + Scene00001( quest, player ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00001( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 1, HIDE_HOTBAR, bindSceneReturn( &GaiUsa509::Scene00001Return ) ); + } + + void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8CH( 3 ); + quest.setSeq( Seq1 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00002( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 2, HIDE_HOTBAR, bindSceneReturn( &GaiUsa509::Scene00002Return ) ); + } + + void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + Scene00003( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00003( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 3, HIDE_HOTBAR, bindSceneReturn( &GaiUsa509::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8AL( 1 ); //Mark the NPC as complete + quest.setUI8AH( quest.getUI8AH() + 1 );//Increment the journal list + quest.setUI8CH( quest.getUI8CH() - 1 );//Take one of the quest items away + checkQuestCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00004( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 4, HIDE_HOTBAR, bindSceneReturn( &GaiUsa509::Scene00004Return ) ); + } + + void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + Scene00005( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00005( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 5, HIDE_HOTBAR, bindSceneReturn( &GaiUsa509::Scene00005Return ) ); + } + + void Scene00005Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8BH( 1 ); //Mark the NPC as complete + quest.setUI8AH( quest.getUI8AH() + 1 );//Increment the journal list + quest.setUI8CH( quest.getUI8CH() - 1 );//Take one of the quest items away + checkQuestCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00006( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 6, HIDE_HOTBAR, bindSceneReturn( &GaiUsa509::Scene00006Return ) ); + } + + void Scene00006Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + Scene00007( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00007( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 7, HIDE_HOTBAR, bindSceneReturn( &GaiUsa509::Scene00007Return ) ); + } + + void Scene00007Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8BL( 1 ); //Mark the NPC as complete + quest.setUI8AH( quest.getUI8AH() + 1 );//Increment the journal list + quest.setUI8CH( quest.getUI8CH() - 1 );//Take one of the quest items away + checkQuestCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00008( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 8, HIDE_HOTBAR, bindSceneReturn( &GaiUsa509::Scene00008Return ) ); + } + + void Scene00008Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + player.finishQuest( getId() ); + } + } +}; + +EXPOSE_SCRIPT( GaiUsa509 ); \ No newline at end of file diff --git a/src/scripts/quest/subquest/thanalan_south/GaiUsa510.cpp b/src/scripts/quest/subquest/thanalan_south/GaiUsa510.cpp new file mode 100644 index 00000000..96a22290 --- /dev/null +++ b/src/scripts/quest/subquest/thanalan_south/GaiUsa510.cpp @@ -0,0 +1,99 @@ +// 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 "Manager/EventMgr.h" +#include +#include +#include + +// Quest Script: GaiUsa510_00762 +// Quest Name: Foot in the Door +// Quest ID: 66298 +// Start NPC: 1006217 +// End NPC: 1006688 + +using namespace Sapphire; + +class GaiUsa510 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // UI8AL + + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 1006688 + // Steps in this quest ( 0 is before accepting, + // 1 is first, 255 means ready for turning it in + enum Sequence : uint8_t + { + Seq0 = 0, + SeqFinish = 255, + }; + + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1006217;//Gisilbehrt + static constexpr auto Actor1 = 1006688;//Minfilia + +public: + GaiUsa510() : Sapphire::ScriptAPI::QuestScript( 66298 ){}; + ~GaiUsa510() = default; + + ////////////////////////////////////////////////////////////////////// + // Event Handlers + void onTalk( World::Quest& quest, Entity::Player& player, uint64_t actorId ) override + { + switch( actorId ) + { + case Actor0: + { + if( quest.getSeq() == Seq0 ) + Scene00000( quest, player ); + break; + } + case Actor1: + { + if( quest.getSeq() == SeqFinish ) + Scene00001( quest, player ); + 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, HIDE_HOTBAR, bindSceneReturn( &GaiUsa510::Scene00000Return ) ); + } + + void Scene00000Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 )// accept quest + { + quest.setSeq( SeqFinish ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00001( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 1, HIDE_HOTBAR, bindSceneReturn( &GaiUsa510::Scene00001Return ) ); + } + + void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + player.finishQuest( getId(), result.getResult(1) ); + } + } +}; + +EXPOSE_SCRIPT( GaiUsa510 ); \ No newline at end of file diff --git a/src/scripts/quest/subquest/thanalan_south/GaiUsa704.cpp b/src/scripts/quest/subquest/thanalan_south/GaiUsa704.cpp new file mode 100644 index 00000000..05b11a46 --- /dev/null +++ b/src/scripts/quest/subquest/thanalan_south/GaiUsa704.cpp @@ -0,0 +1,205 @@ +// 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 "Manager/EventMgr.h" +#include +#include +#include + +// Quest Script: GaiUsa704_00777 +// Quest Name: The Bear and the Young'uns' Cares +// Quest ID: 66313 +// Start NPC: 1006215 +// End NPC: 1006215 + +using namespace Sapphire; + +class GaiUsa704 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AH + // UI8AL + // UI8BH + // UI8BL + // UI8CH + + /// Countable Num: 0 Seq: 1 Event: 1 Listener: 1006221 + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 1006222 + // 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 = 1006215;//Gundobald + static constexpr auto Actor1 = 1006221;//Waldhar + static constexpr auto Actor2 = 1006222;//Adalind + static constexpr auto Actor3 = 1006223;//Sifrid + static constexpr auto Actor4 = 1006224;//Talebot + +public: + GaiUsa704() : Sapphire::ScriptAPI::QuestScript( 66313 ){}; + ~GaiUsa704() = default; + + ////////////////////////////////////////////////////////////////////// + // Event Handlers + void onTalk( World::Quest& quest, Entity::Player& player, uint64_t actorId ) override + { + switch( actorId ) + { + case Actor0: + { + if( quest.getSeq() == Seq0 ) + Scene00000( quest, player ); + else if( quest.getSeq() == SeqFinish ) + Scene00006( quest, player ); + break; + } + case Actor1: + { + if( quest.getSeq() == Seq1 ) + Scene00002( quest, player ); + break; + } + case Actor2: + { + if( quest.getSeq() == Seq1 ) + Scene00003( quest, player ); + break; + } + case Actor3: + { + if( quest.getSeq() == Seq1 ) + Scene00004( quest, player ); + break; + } + case Actor4: + { + if( quest.getSeq() == Seq1 ) + Scene00005( quest, player ); + break; + } + } + } + + +private: + void checkQuestCompletion( World::Quest& quest, Entity::Player& player ) + { + eventMgr().sendEventNotice( player, getId(), 0, 2, quest.getUI8AH(), 4 ); + if( quest.getUI8AH() >= 4 ) + { + quest.setSeq( SeqFinish ); + } + } + ////////////////////////////////////////////////////////////////////// + // Available Scenes in this quest, not necessarly all are used + ////////////////////////////////////////////////////////////////////// + + void Scene00000( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 0, HIDE_HOTBAR, bindSceneReturn( &GaiUsa704::Scene00000Return ) ); + } + + void Scene00000Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 )// accept quest + { + Scene00001( quest, player ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00001( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 1, HIDE_HOTBAR, bindSceneReturn( &GaiUsa704::Scene00001Return ) ); + } + + void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setSeq( Seq1 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00002( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 2, HIDE_HOTBAR, bindSceneReturn( &GaiUsa704::Scene00002Return ) ); + } + + void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8AL( 1 ); + quest.setUI8AH( quest.getUI8AH() + 1 ); + checkQuestCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00003( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 3, HIDE_HOTBAR, bindSceneReturn( &GaiUsa704::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8BH( 1 ); + quest.setUI8AH( quest.getUI8AH() + 1 ); + checkQuestCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00004( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 4, HIDE_HOTBAR, bindSceneReturn( &GaiUsa704::Scene00004Return ) ); + } + + void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8BL( 1 ); + quest.setUI8AH( quest.getUI8AH() + 1 ); + checkQuestCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00005( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 5, HIDE_HOTBAR, bindSceneReturn( &GaiUsa704::Scene00005Return ) ); + } + + void Scene00005Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8CH( 1 ); + quest.setUI8AH( quest.getUI8AH() + 1 ); + checkQuestCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00006( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 6, HIDE_HOTBAR, bindSceneReturn( &GaiUsa704::Scene00006Return ) ); + } + + void Scene00006Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + player.finishQuest( getId(), result.getResult(1) ); + } + } +}; + +EXPOSE_SCRIPT( GaiUsa704 ); \ No newline at end of file diff --git a/src/scripts/quest/subquest/thanalan_south/GaiUsa705.cpp b/src/scripts/quest/subquest/thanalan_south/GaiUsa705.cpp new file mode 100644 index 00000000..500ce410 --- /dev/null +++ b/src/scripts/quest/subquest/thanalan_south/GaiUsa705.cpp @@ -0,0 +1,194 @@ +// 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 "Manager/EventMgr.h" +#include +#include +#include + +#include "Actor/BNpc.h" +#include "Manager/TerritoryMgr.h" +#include "Territory/Territory.h" + +// Quest Script: GaiUsa705_00778 +// Quest Name: Wilred Wants You +// Quest ID: 66314 +// Start NPC: 1006226 +// End NPC: 1006215 + +using namespace Sapphire; + +class GaiUsa705 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AL + + /// Countable Num: 0 Seq: 1 Event: 1 Listener: 1006228 + /// Countable Num: 0 Seq: 2 Event: 5 Listener: 2257 + /// Countable Num: 0 Seq: 255 Event: 5 Listener: 2258 + // 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, + Seq2 = 2, + SeqFinish = 255, + }; + + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1006226;//Hremfing + static constexpr auto Actor1 = 1006228;//Wilred + static constexpr auto Actor2 = 1006215;//Gundobald + static constexpr auto Enemy0 = 4279871; + static constexpr auto Enemy1 = 4279874; + +public: + GaiUsa705() : Sapphire::ScriptAPI::QuestScript( 66314 ){}; + ~GaiUsa705() = default; + + ////////////////////////////////////////////////////////////////////// + // Event Handlers + void onTalk( World::Quest& quest, Entity::Player& player, uint64_t actorId ) override + { + switch( actorId ) + { + case Actor0: + { + if( quest.getSeq() == Seq0 ) + Scene00000( quest, player ); + break; + } + case Actor1: + { + if( quest.getSeq() == Seq1 ) + Scene00002( quest, player ); + else if( quest.getSeq() == Seq2 ) + Scene00003( quest, player ); + break; + } + case Actor2: + { + if( quest.getSeq() == SeqFinish ) + Scene00004( quest, player ); + break; + } + } + } + + void onBNpcKill( World::Quest& quest, uint16_t nameId, uint32_t entityId, Entity::Player& player ) override + { + switch( entityId ) + { + case Enemy0: + { + quest.setUI8AL( quest.getUI8AL() + 1 ); + checkQuestCompletion( quest, player ); + break; + } + case Enemy1: + { + quest.setUI8AL( quest.getUI8AL() + 1 ); + checkQuestCompletion( quest, player ); + break; + } + } + } + +private: + void checkQuestCompletion( World::Quest& quest, Entity::Player& player ) + { + if( quest.getUI8AL() >= 2 ) + { + quest.setUI8AL( 0 ); + eventMgr().sendEventNotice( player, getId(), 0, 0 ); + quest.setSeq( Seq2 ); + } + } + ////////////////////////////////////////////////////////////////////// + // Available Scenes in this quest, not necessarly all are used + ////////////////////////////////////////////////////////////////////// + + void Scene00000( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 0, HIDE_HOTBAR, bindSceneReturn( &GaiUsa705::Scene00000Return ) ); + } + + void Scene00000Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 )// accept quest + { + Scene00001( quest, player ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00001( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 1, HIDE_HOTBAR, bindSceneReturn( &GaiUsa705::Scene00001Return ) ); + } + + void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setSeq( Seq1 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00002( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 2, HIDE_HOTBAR, bindSceneReturn( &GaiUsa705::Scene00002Return ) ); + } + + void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + auto instance = teriMgr().getTerritoryByGuId( player.getTerritoryId() ); + + auto enemy0Spawned = instance->getActiveBNpcByInstanceIdAndTriggerOwner( Enemy0, player.getId() ); + auto enemy1Spawned = instance->getActiveBNpcByInstanceIdAndTriggerOwner( Enemy1, player.getId() ); + + if( !enemy0Spawned && !enemy1Spawned ) + { + auto enemy0 = instance->createBNpcFromInstanceId( Enemy0, 413 /*TODO: Find the right value*/, Common::BNpcType::Enemy, player.getId() ); + auto enemy1 = instance->createBNpcFromInstanceId( Enemy1, 413 /*TODO: Find the right value*/, Common::BNpcType::Enemy, player.getId() ); + enemy0->hateListAdd( player.getAsPlayer(), 1 ); + enemy1->hateListAdd( player.getAsPlayer(), 1 ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00003( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 3, HIDE_HOTBAR, bindSceneReturn( &GaiUsa705::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 1, 0 ); + quest.setSeq( SeqFinish ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00004( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 4, HIDE_HOTBAR, bindSceneReturn( &GaiUsa705::Scene00004Return ) ); + } + + void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + player.finishQuest( getId(), result.getResult(1) ); + } + } +}; + +EXPOSE_SCRIPT( GaiUsa705 ); \ No newline at end of file diff --git a/src/scripts/quest/subquest/thanalan_south/GaiUsa709.cpp b/src/scripts/quest/subquest/thanalan_south/GaiUsa709.cpp new file mode 100644 index 00000000..25b8e3de --- /dev/null +++ b/src/scripts/quest/subquest/thanalan_south/GaiUsa709.cpp @@ -0,0 +1,479 @@ +// 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 "Manager/EventMgr.h" +#include +#include +#include + +// Quest Script: GaiUsa709_00782 +// Quest Name: Big Trouble in Little Ala Mhigo +// Quest ID: 66318 +// Start NPC: 1006215 +// End NPC: 1006215 + +using namespace Sapphire; + +class GaiUsa709 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AH + // UI8AL + // UI8BH + // UI8BL + // UI8CH + // UI8CL + // UI8DH + // UI8DL + + /// Countable Num: 0 Seq: 1 Event: 1 Listener: 1006225 + /// Countable Num: 0 Seq: 2 Event: 1 Listener: 1007616 + /// Countable Num: 0 Seq: 3 Event: 1 Listener: 1007617 + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 2001980 + // 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, + Seq2 = 2, + Seq3 = 3, + SeqFinish = 255, + }; + + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1006215;//Gundoblad + static constexpr auto Actor1 = 1006225;//Wilred + static constexpr auto Actor2 = 1007616;//Riled Lass + static constexpr auto Actor3 = 1007617;//Riled Youth + static constexpr auto Actor4 = 1007635;//Bertliana + static constexpr auto Actor5 = 1006230;//Wilred (QuestBattle trigger) + static constexpr auto Actor6 = 1006229; + static constexpr auto Actor7 = 1006231; + static constexpr auto Actor8 = 1006232; + static constexpr auto Actor9 = 1006233; + static constexpr auto Actor10 = 1007605; + static constexpr auto Eobject0 = 2001980;//Map of Zanr'ak + static constexpr auto Eobject1 = 2001981;//Hunting Knife + static constexpr auto Eobject2 = 2002272; + static constexpr auto EventActionSearch = 1; + static constexpr auto Item0 = 2000974; + static constexpr auto Item1 = 2000973; + static constexpr auto LocActor0 = 1008115; + static constexpr auto LocActor1 = 1008116; + static constexpr auto LocActor2 = 1006226; + static constexpr auto Questbattle0 = 58; + static constexpr auto Seq0Actor0Lq = 90; + static constexpr auto Territorytype0 = 306; + +public: + GaiUsa709() : Sapphire::ScriptAPI::QuestScript( 66318 ){}; + ~GaiUsa709() = default; + + ////////////////////////////////////////////////////////////////////// + // Event Handlers + void onTalk( World::Quest& quest, Entity::Player& player, uint64_t actorId ) override + { + switch( actorId ) + { + case Actor0: + { + if( quest.getSeq() == Seq0 ) + Scene00000( quest, player ); + else if( quest.getSeq() == Seq2 ) + Scene00010( quest, player ); + else if( quest.getSeq() == SeqFinish ) + Scene00022( quest, player ); + break; + } + case Actor1: + { + if( quest.getSeq() == Seq1 ) + Scene00002( quest, player ); + break; + } + case Actor2: + { + if( quest.getSeq() == Seq1 ) + Scene00003( quest, player ); + break; + } + case Actor3: + { + if( quest.getSeq() == Seq1 ) + Scene00004( quest, player ); + break; + } + case Actor4: + { + if( quest.getSeq() == Seq1 ) + Scene00009( quest, player ); + else if( quest.getSeq() == Seq2 ) + Scene00012( quest, player ); + else if( quest.getSeq() == Seq3 ) + Scene00021( quest, player ); + break; + } + case Actor5: + { + if( quest.getSeq() == Seq3 ) + { + playerMgr().sendUrgent( player, "QuestBattle unimplimented, skipping..." ); + quest.setSeq( SeqFinish ); + } + //Scene00013( quest, player ); + break; + } + case Actor6: + { + break; + } + case Actor7: + { + break; + } + case Actor8: + { + break; + } + case Actor9: + { + break; + } + case Actor10: + { + break; + } + case Eobject0: + { + eventMgr().eventActionStart( + player, getId(), EventActionSearch, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { + Scene00005( quest, player ); + }, + nullptr, 0 ); + break; + } + case Eobject1: + { + eventMgr().eventActionStart( + player, getId(), EventActionSearch, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { + Scene00007( quest, player ); + }, + nullptr, 0 ); + break; + } + } + } + + +private: + void checkQuestCompletion( World::Quest& quest, Entity::Player& player ) + { + eventMgr().sendEventNotice( player, getId(), 0, 2, quest.getUI8AH(), 5 ); + if( quest.getUI8AH() >= 5 ) + { + quest.setUI8AH( 0 ); + quest.setUI8AL( 0 ); + quest.setUI8BH( quest.getUI8DH() ); + quest.setUI8BL( quest.getUI8DL() ); + quest.setUI8CH( 0 ); + quest.setUI8CL( 0 ); + quest.setUI8DH( 0 ); + quest.setUI8DL( 0 ); + quest.setSeq( Seq2 ); + } + } + ////////////////////////////////////////////////////////////////////// + // Available Scenes in this quest, not necessarly all are used + ////////////////////////////////////////////////////////////////////// + + void Scene00000( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 0, HIDE_HOTBAR, bindSceneReturn( &GaiUsa709::Scene00000Return ) ); + } + + void Scene00000Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 )// accept quest + { + Scene00090( quest, player ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00002( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 2, HIDE_HOTBAR, bindSceneReturn( &GaiUsa709::Scene00002Return ) ); + } + + void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8AH( quest.getUI8AH() + 1 ); + quest.setUI8AL( 1 ); + checkQuestCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00003( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 3, HIDE_HOTBAR, bindSceneReturn( &GaiUsa709::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8AH( quest.getUI8AH() + 1 ); + quest.setUI8BH( 1 ); + checkQuestCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00004( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 4, HIDE_HOTBAR, bindSceneReturn( &GaiUsa709::Scene00004Return ) ); + } + + void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8AH( quest.getUI8AH() + 1 ); + quest.setUI8BL( 1 ); + checkQuestCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00005( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 5, HIDE_HOTBAR, bindSceneReturn( &GaiUsa709::Scene00005Return ) ); + } + + void Scene00005Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8AH( quest.getUI8AH() + 1 ); + quest.setUI8CH( 1 ); + quest.setUI8DL( 1 ); + checkQuestCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00006( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 6, HIDE_HOTBAR, bindSceneReturn( &GaiUsa709::Scene00006Return ) ); + } + + void Scene00006Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00007( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 7, HIDE_HOTBAR, bindSceneReturn( &GaiUsa709::Scene00007Return ) ); + } + + void Scene00007Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8AH( quest.getUI8AH() + 1 ); + quest.setUI8CL( 1 ); + quest.setUI8DH( 1 ); + checkQuestCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00008( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 8, HIDE_HOTBAR, bindSceneReturn( &GaiUsa709::Scene00008Return ) ); + } + + void Scene00008Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00009( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 9, HIDE_HOTBAR, bindSceneReturn( &GaiUsa709::Scene00009Return ) ); + } + + void Scene00009Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00010( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 10, HIDE_HOTBAR, bindSceneReturn( &GaiUsa709::Scene00010Return ) ); + } + + void Scene00010Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + Scene00011( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00011( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 11, HIDE_HOTBAR, bindSceneReturn( &GaiUsa709::Scene00011Return ) ); + } + + void Scene00011Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 1, 0 ); + quest.setSeq( Seq3 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00012( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 12, HIDE_HOTBAR, bindSceneReturn( &GaiUsa709::Scene00012Return ) ); + } + + void Scene00012Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00013( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 13, HIDE_HOTBAR, bindSceneReturn( &GaiUsa709::Scene00013Return ) ); + } + + void Scene00013Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00014( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 14, HIDE_HOTBAR, bindSceneReturn( &GaiUsa709::Scene00014Return ) ); + } + + void Scene00014Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00015( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 15, HIDE_HOTBAR, bindSceneReturn( &GaiUsa709::Scene00015Return ) ); + } + + void Scene00015Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00016( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 16, HIDE_HOTBAR, bindSceneReturn( &GaiUsa709::Scene00016Return ) ); + } + + void Scene00016Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00017( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 17, HIDE_HOTBAR, bindSceneReturn( &GaiUsa709::Scene00017Return ) ); + } + + void Scene00017Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00018( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 18, HIDE_HOTBAR, bindSceneReturn( &GaiUsa709::Scene00018Return ) ); + } + + void Scene00018Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00019( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 19, HIDE_HOTBAR, bindSceneReturn( &GaiUsa709::Scene00019Return ) ); + } + + void Scene00019Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00020( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 20, HIDE_HOTBAR, bindSceneReturn( &GaiUsa709::Scene00020Return ) ); + } + + void Scene00020Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00021( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 21, HIDE_HOTBAR, bindSceneReturn( &GaiUsa709::Scene00021Return ) ); + } + + void Scene00021Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00022( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 22, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, bindSceneReturn( &GaiUsa709::Scene00022Return ) ); + } + + void Scene00022Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + player.finishQuest( getId(), result.getResult(1) ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00090( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 90, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, bindSceneReturn( &GaiUsa709::Scene00090Return ) ); + } + + void Scene00090Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setSeq( Seq1 ); + } +}; + +EXPOSE_SCRIPT( GaiUsa709 ); \ No newline at end of file diff --git a/src/scripts/quest/subquest/thanalan_south/GaiUsa710.cpp b/src/scripts/quest/subquest/thanalan_south/GaiUsa710.cpp new file mode 100644 index 00000000..8720e616 --- /dev/null +++ b/src/scripts/quest/subquest/thanalan_south/GaiUsa710.cpp @@ -0,0 +1,102 @@ +// 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 "Manager/EventMgr.h" +#include +#include +#include + +// Quest Script: GaiUsa710_00783 +// Quest Name: Back to Square One +// Quest ID: 66319 +// Start NPC: 1006215 +// End NPC: 1006688 + +using namespace Sapphire; + +class GaiUsa710 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // UI8AL + + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 1006688 + // Steps in this quest ( 0 is before accepting, + // 1 is first, 255 means ready for turning it in + enum Sequence : uint8_t + { + Seq0 = 0, + SeqFinish = 255, + }; + + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1006215;//Gundobland + static constexpr auto Actor1 = 1006688;//Minfilia + static constexpr auto LocAction0 = 811; + static constexpr auto LocActor0 = 1007817; + static constexpr auto LocPosActor0 = 4148563; + +public: + GaiUsa710() : Sapphire::ScriptAPI::QuestScript( 66319 ){}; + ~GaiUsa710() = default; + + ////////////////////////////////////////////////////////////////////// + // Event Handlers + void onTalk( World::Quest& quest, Entity::Player& player, uint64_t actorId ) override + { + switch( actorId ) + { + case Actor0: + { + if( quest.getSeq() == Seq0 ) + Scene00000( quest, player ); + break; + } + case Actor1: + { + if( quest.getSeq() == SeqFinish ) + Scene00001( quest, player ); + 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( &GaiUsa710::Scene00000Return ) ); + } + + void Scene00000Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 )// accept quest + { + quest.setSeq( SeqFinish ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00001( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 1, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, bindSceneReturn( &GaiUsa710::Scene00001Return ) ); + } + + void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + player.finishQuest( getId() ); + } + } +}; + +EXPOSE_SCRIPT( GaiUsa710 ); \ No newline at end of file diff --git a/src/scripts/quest/subquest/thanalan_west/GaiUsa601.cpp b/src/scripts/quest/subquest/thanalan_west/GaiUsa601.cpp new file mode 100644 index 00000000..3dde0ab4 --- /dev/null +++ b/src/scripts/quest/subquest/thanalan_west/GaiUsa601.cpp @@ -0,0 +1,133 @@ +// 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 "Manager/EventMgr.h" +#include +#include +#include + +// Quest Script: GaiUsa601_00763 +// Quest Name: Meeting with the Resistance +// Quest ID: 66299 +// Start NPC: 1006688 +// End NPC: 1006219 + +using namespace Sapphire; + +class GaiUsa601 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // UI8AL + + /// Countable Num: 0 Seq: 1 Event: 1 Listener: 1007418 + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 1006219 + // 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 = 1006688;//Minfilia + static constexpr auto Actor1 = 1007418;//HARIBEHRT + static constexpr auto Actor2 = 1006219;//ALBREDA + +public: + GaiUsa601() : Sapphire::ScriptAPI::QuestScript( 66299 ){}; + ~GaiUsa601() = default; + + ////////////////////////////////////////////////////////////////////// + // Event Handlers + void onTalk( World::Quest& quest, Entity::Player& player, uint64_t actorId ) override + { + switch( actorId ) + { + case Actor0: + { + if( quest.getSeq() == Seq0 ) + Scene00000( quest, player ); + break; + } + case Actor1: + { + if( quest.getSeq() == Seq1 ) + Scene00002( quest, player ); + break; + } + case Actor2: + { + if( quest.getSeq() == SeqFinish ) + Scene00003( quest, player ); + 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, HIDE_HOTBAR, bindSceneReturn( &GaiUsa601::Scene00000Return ) ); + } + + void Scene00000Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 )// accept quest + { + Scene00001( quest, player ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00001( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 1, HIDE_HOTBAR, bindSceneReturn( &GaiUsa601::Scene00001Return ) ); + } + + void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setSeq( Seq1 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00002( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 2, HIDE_HOTBAR, bindSceneReturn( &GaiUsa601::Scene00002Return ) ); + } + + void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 0, 0 ); + quest.setSeq( SeqFinish ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00003( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 3, HIDE_HOTBAR, bindSceneReturn( &GaiUsa601::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + player.finishQuest( getId(), result.getResult(1) ); + } + } +}; + +EXPOSE_SCRIPT( GaiUsa601 ); \ No newline at end of file diff --git a/src/scripts/quest/subquest/thanalan_west/GaiUsa711.cpp b/src/scripts/quest/subquest/thanalan_west/GaiUsa711.cpp new file mode 100644 index 00000000..6718c4b7 --- /dev/null +++ b/src/scripts/quest/subquest/thanalan_west/GaiUsa711.cpp @@ -0,0 +1,261 @@ +// 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 "Manager/EventMgr.h" +#include +#include +#include + +// Quest Script: GaiUsa711_00784 +// Quest Name: Terror at Fallgourd +// Quest ID: 66320 +// Start NPC: 1006688 +// End NPC: 1006240 + +using namespace Sapphire; + +class GaiUsa711 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AL + + /// Countable Num: 0 Seq: 1 Event: 1 Listener: 1007417 + /// Countable Num: 0 Seq: 2 Event: 1 Listener: 1006240 + /// Countable Num: 0 Seq: 3 Event: 1 Listener: 1006241 + /// Countable Num: 0 Seq: 4 Event: 1 Listener: 1006240 + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 1006240 + // 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, + Seq2 = 2, + Seq3 = 3, + Seq4 = 4, + SeqFinish = 255, + }; + + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1006688;//Minfilia + static constexpr auto Actor1 = 1007417;//Noraxia + static constexpr auto Actor2 = 1006240;//Medrod + static constexpr auto Actor3 = 1006241;//Aideen + static constexpr auto LocAction1 = 788; + static constexpr auto LocActor1 = 1008113; + static constexpr auto LocActor2 = 1008114; + static constexpr auto LocActor3 = 1006241; + static constexpr auto LocActor4 = 1006242; + static constexpr auto LocFace0 = 604; + static constexpr auto LocFace1 = 620; + static constexpr auto LocPosActor1 = 4256813; + static constexpr auto LocPosActor2 = 4256814; + static constexpr auto Ritem0 = 4674;//Lentils and Chestnuts + + static constexpr auto EmoteSoothe = 35; + +public: + GaiUsa711() : Sapphire::ScriptAPI::QuestScript( 66320 ){}; + ~GaiUsa711() = default; + + ////////////////////////////////////////////////////////////////////// + // Event Handlers + void onTalk( World::Quest& quest, Entity::Player& player, uint64_t actorId ) override + { + switch( actorId ) + { + case Actor0: + { + if( quest.getSeq() == Seq0 ) + Scene00000( quest, player ); + break; + } + case Actor1: + { + if( quest.getSeq() == Seq1 ) + Scene00002( quest, player ); + break; + } + case Actor2: + { + if( quest.getSeq() == Seq2 ) + Scene00003( quest, player ); + else if( quest.getSeq() == Seq3 ) + Scene00005( quest, player ); + else if( quest.getSeq() == Seq4 ) + Scene00006( quest, player ); + else if( quest.getSeq() == SeqFinish ) + Scene00008( quest, player ); + break; + } + case Actor3: + { + if( quest.getSeq() == Seq3 ) + Scene00004( quest, player ); + break; + } + } + } + + void onEmote( World::Quest& quest, uint64_t actorId, uint32_t emoteId, Entity::Player& player ) override + { + if( actorId == Actor2 && quest.getSeq() == SeqFinish ) + { + if( emoteId == EmoteSoothe ) + Scene00009( quest, player ); + else + Scene00010( quest, player ); + } + } + +private: + ////////////////////////////////////////////////////////////////////// + // Available Scenes in this quest, not necessarly all are used + ////////////////////////////////////////////////////////////////////// + + void Scene00000( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 0, HIDE_HOTBAR, bindSceneReturn( &GaiUsa711::Scene00000Return ) ); + } + + void Scene00000Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 )// accept quest + { + Scene00001( quest, player ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00001( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 1, HIDE_HOTBAR, bindSceneReturn( &GaiUsa711::Scene00001Return ) ); + } + + void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setSeq( Seq1 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00002( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 2, HIDE_HOTBAR, bindSceneReturn( &GaiUsa711::Scene00002Return ) ); + } + + void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 0, 0 ); + quest.setSeq( Seq2 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00003( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 3, HIDE_HOTBAR, bindSceneReturn( &GaiUsa711::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 1, 0 ); + quest.setSeq( Seq3 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00004( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 4, HIDE_HOTBAR, bindSceneReturn( &GaiUsa711::Scene00004Return ) ); + } + + void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 2, 0 ); + quest.setSeq( Seq4 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00005( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 5, HIDE_HOTBAR, bindSceneReturn( &GaiUsa711::Scene00005Return ) ); + } + + void Scene00005Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00006( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 6, HIDE_HOTBAR, bindSceneReturn( &GaiUsa711::Scene00006Return ) ); + } + + void Scene00006Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + Scene00007( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00007( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 7, HIDE_HOTBAR, bindSceneReturn( &GaiUsa711::Scene00007Return ) ); + } + + void Scene00007Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 3, 0 ); + player.collectHandInItems( { Ritem0 } ); + quest.setSeq( SeqFinish ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00008( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 8, HIDE_HOTBAR, bindSceneReturn( &GaiUsa711::Scene00008Return ) ); + } + + void Scene00008Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00009( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 9, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, bindSceneReturn( &GaiUsa711::Scene00009Return ) ); + } + + void Scene00009Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + player.finishQuest( getId() ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00010( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 10, HIDE_HOTBAR, bindSceneReturn( &GaiUsa711::Scene00010Return ) ); + } + + void Scene00010Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } +}; + +EXPOSE_SCRIPT( GaiUsa711 ); \ No newline at end of file