From b79bd4964cbb99fabddaf733707486ec68bdb840 Mon Sep 17 00:00:00 2001 From: dude22072 Date: Sun, 15 Jan 2023 18:06:15 -0600 Subject: [PATCH 01/22] Some random sidequests to de-rust --- .../subquest/lanoscea_outer/GaiUsb406.cpp | 510 ++++++++++++++++++ .../subquest/lanoscea_outer/GaiUsc705.cpp | 206 +++++++ .../subquest/thanalan_west/GaiUsc703.cpp | 111 ++++ 3 files changed, 827 insertions(+) create mode 100644 src/scripts/quest/subquest/lanoscea_outer/GaiUsb406.cpp create mode 100644 src/scripts/quest/subquest/lanoscea_outer/GaiUsc705.cpp create mode 100644 src/scripts/quest/subquest/thanalan_west/GaiUsc703.cpp diff --git a/src/scripts/quest/subquest/lanoscea_outer/GaiUsb406.cpp b/src/scripts/quest/subquest/lanoscea_outer/GaiUsb406.cpp new file mode 100644 index 00000000..176978e3 --- /dev/null +++ b/src/scripts/quest/subquest/lanoscea_outer/GaiUsb406.cpp @@ -0,0 +1,510 @@ +// 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: GaiUsb406_00862 +// Quest Name: Deduce, Reuse, Recycle +// Quest ID: 66398 +// Start NPC: 1006331 +// End NPC: 1006331 + +using namespace Sapphire; + +class GaiUsb406 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // BitFlag16 + // UI8AL + // UI8BH + // UI8BL + // UI8CH + + /// Countable Num: 0 Seq: 1 Event: 1 Listener: 2002341 + /// Countable Num: 0 Seq: 1 Event: 1 Listener: 2002342 + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 2002343 + // 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 = 1006331;//Swygrael <> + static constexpr auto Actor1 = 1007542; + static constexpr auto Actor2 = 1007543; + static constexpr auto Actor3 = 1007544; + static constexpr auto Actor4 = 1007545; + static constexpr auto Actor5 = 1007546; + static constexpr auto Actor6 = 1007547; + static constexpr auto Eobject0 = 2002341; + static constexpr auto Eobject1 = 2002342; + static constexpr auto Eobject2 = 2002343; + static constexpr auto Eobject3 = 2002338;//Serrated Arrowhead + static constexpr auto Eobject4 = 2002339;//Serrated Arrowhead + static constexpr auto Eobject5 = 2002340;//Serrated Arrowhead + static constexpr auto EventActionSearch = 1; + static constexpr auto Item0 = 2000669; + static constexpr auto Item1 = 2000929; + +public: + GaiUsb406() : Sapphire::ScriptAPI::QuestScript( 66398 ){}; + ~GaiUsb406() = 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 ) + Scene00020( quest, player ); + break; + } + case Eobject0: + { + eventMgr().eventActionStart( + player, getId(), EventActionSearch, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { + Scene00002( quest, player ); + }, + nullptr, 0 ); + break; + } + case Eobject1: + { + eventMgr().eventActionStart( + player, getId(), EventActionSearch, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { + Scene00004( quest, player ); + }, + nullptr, 0 ); + break; + } + case Eobject2: + { + eventMgr().eventActionStart( + player, getId(), EventActionSearch, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { + Scene00006( quest, player ); + }, + nullptr, 0 ); + break; + } + case Eobject3: + { + eventMgr().eventActionStart( + player, getId(), EventActionSearch, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { + Scene00008( quest, player ); + }, + nullptr, 0 ); + break; + } + case Eobject4: + { + eventMgr().eventActionStart( + player, getId(), EventActionSearch, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { + Scene00010( quest, player ); + }, + nullptr, 0 ); + break; + } + case Eobject5: + { + eventMgr().eventActionStart( + player, getId(), EventActionSearch, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { + Scene00012( quest, player ); + }, + nullptr, 0 ); + break; + } + } + } + + +private: + void checkQuestCompletion( World::Quest& quest, Entity::Player& player, int type ) + { + if( quest.getSeq() == Seq1 ) + { + eventMgr().sendEventNotice( player, getId(), type, 2, ( type == 0 ) ? quest.getUI8AL() : quest.getUI8BH(), 3 ); //TODO: Item Icons + if( quest.getUI8BL() >= 3 && quest.getUI8CH() >= 3 ) + { + quest.setUI8BH( quest.getUI8BL() ); + quest.setUI8BL( quest.getUI8CH() ); + quest.setUI8AL( 0 ); + quest.setUI8CH( 0 ); + quest.setBitFlag16( 1, false ); + quest.setBitFlag16( 2, false ); + quest.setBitFlag16( 3, false ); + quest.setBitFlag16( 10, false ); + quest.setBitFlag16( 11, false ); + quest.setBitFlag16( 12, false ); + 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, NONE, bindSceneReturn( &GaiUsb406::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, NONE, bindSceneReturn( &GaiUsb406::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, NONE, bindSceneReturn( &GaiUsb406::Scene00002Return ) ); + } + + void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8BL( quest.getUI8BL() + 1 ); + quest.setUI8AL( quest.getUI8AL() + 1 ); + quest.setBitFlag16( 1, true ); + checkQuestCompletion( quest, player, 0 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00003( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 3, NONE, bindSceneReturn( &GaiUsb406::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00004( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 4, NONE, bindSceneReturn( &GaiUsb406::Scene00004Return ) ); + } + + void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8BL( quest.getUI8BL() + 1 ); + quest.setUI8AL( quest.getUI8AL() + 1 ); + quest.setBitFlag16( 2, true ); + checkQuestCompletion( quest, player, 0 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00005( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 5, NONE, bindSceneReturn( &GaiUsb406::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, NONE, bindSceneReturn( &GaiUsb406::Scene00006Return ) ); + } + + void Scene00006Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8BL( quest.getUI8BL() + 1 ); + quest.setUI8AL( quest.getUI8AL() + 1 ); + quest.setBitFlag16( 3, true ); + checkQuestCompletion( quest, player, 0 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00007( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 7, NONE, bindSceneReturn( &GaiUsb406::Scene00007Return ) ); + } + + void Scene00007Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00008( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 8, NONE, bindSceneReturn( &GaiUsb406::Scene00008Return ) ); + } + + void Scene00008Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8CH( quest.getUI8CH() + 1 ); + quest.setUI8BH( quest.getUI8BH() + 1 ); + quest.setBitFlag16( 10, true ); + checkQuestCompletion( quest, player, 1 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00009( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 9, NONE, bindSceneReturn( &GaiUsb406::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, NONE, bindSceneReturn( &GaiUsb406::Scene00010Return ) ); + } + + void Scene00010Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8CH( quest.getUI8CH() + 1 ); + quest.setUI8BH( quest.getUI8BH() + 1 ); + quest.setBitFlag16( 11, true ); + checkQuestCompletion( quest, player, 1 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00011( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 11, NONE, bindSceneReturn( &GaiUsb406::Scene00011Return ) ); + } + + void Scene00011Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00012( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 12, NONE, bindSceneReturn( &GaiUsb406::Scene00012Return ) ); + } + + void Scene00012Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8CH( quest.getUI8CH() + 1 ); + quest.setUI8BH( quest.getUI8BH() + 1 ); + quest.setBitFlag16( 12, true ); + checkQuestCompletion( quest, player, 1 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00013( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 13, NONE, bindSceneReturn( &GaiUsb406::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, NONE, bindSceneReturn( &GaiUsb406::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, NONE, bindSceneReturn( &GaiUsb406::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, NONE, bindSceneReturn( &GaiUsb406::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, NONE, bindSceneReturn( &GaiUsb406::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, NONE, bindSceneReturn( &GaiUsb406::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, NONE, bindSceneReturn( &GaiUsb406::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, NONE, bindSceneReturn( &GaiUsb406::Scene00020Return ) ); + } + + void Scene00020Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + Scene00021( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00021( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 21, NONE, bindSceneReturn( &GaiUsb406::Scene00021Return ) ); + } + + void Scene00021Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + player.finishQuest( getId() ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00022( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 22, NONE, bindSceneReturn( &GaiUsb406::Scene00022Return ) ); + } + + void Scene00022Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00023( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 23, NONE, bindSceneReturn( &GaiUsb406::Scene00023Return ) ); + } + + void Scene00023Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00024( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 24, NONE, bindSceneReturn( &GaiUsb406::Scene00024Return ) ); + } + + void Scene00024Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00025( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 25, NONE, bindSceneReturn( &GaiUsb406::Scene00025Return ) ); + } + + void Scene00025Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00026( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 26, NONE, bindSceneReturn( &GaiUsb406::Scene00026Return ) ); + } + + void Scene00026Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00027( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 27, NONE, bindSceneReturn( &GaiUsb406::Scene00027Return ) ); + } + + void Scene00027Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } +}; + +EXPOSE_SCRIPT( GaiUsb406 ); \ No newline at end of file diff --git a/src/scripts/quest/subquest/lanoscea_outer/GaiUsc705.cpp b/src/scripts/quest/subquest/lanoscea_outer/GaiUsc705.cpp new file mode 100644 index 00000000..bff6f7e7 --- /dev/null +++ b/src/scripts/quest/subquest/lanoscea_outer/GaiUsc705.cpp @@ -0,0 +1,206 @@ +// 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: GaiUsc705_01017 +// Quest Name: A Pirate's Life for Me +// Quest ID: 66553 +// Start NPC: 1006325 +// End NPC: 1006325 + +using namespace Sapphire; + +class GaiUsc705 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AL + + /// Countable Num: 0 Seq: 1 Event: 1 Listener: 1006590 + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 1006591 + // 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 = 1006325;//Bloeidin + static constexpr auto Actor1 = 1006590;//Red Swallow Private First Class + static constexpr auto Actor2 = 1006591;//Red Swallow Private Third Class + static constexpr auto Actor3 = 1006592;//Red Swallow Private Second Class + static constexpr auto Actor4 = 1006593;//Red Swallow Corporal + +public: + GaiUsc705() : Sapphire::ScriptAPI::QuestScript( 66553 ){}; + ~GaiUsc705() = 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 checkForCompletion( World::Quest& quest, Entity::Player& player ) + { + eventMgr().sendEventNotice( player, getId(), 0, 2, quest.getUI8AL(), 4 ); + if( quest.getUI8AL() >= 4 ) + { + quest.setUI8AL( 0 ); + quest.setBitFlag8( 0, false ); + quest.setBitFlag8( 1, false ); + quest.setBitFlag8( 2, false ); + quest.setBitFlag8( 3, false ); + 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, NONE, bindSceneReturn( &GaiUsc705::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, NONE, bindSceneReturn( &GaiUsc705::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, NONE, bindSceneReturn( &GaiUsc705::Scene00002Return ) ); + } + + void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8AL( quest.getUI8AL() + 1 ); + quest.setBitFlag8( 1, true ); + checkForCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00003( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 3, NONE, bindSceneReturn( &GaiUsc705::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8AL( quest.getUI8AL() + 1 ); + quest.setBitFlag8( 2, true ); + checkForCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00004( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 4, NONE, bindSceneReturn( &GaiUsc705::Scene00004Return ) ); + } + + void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8AL( quest.getUI8AL() + 1 ); + quest.setBitFlag8( 3, true ); + checkForCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00005( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 5, NONE, bindSceneReturn( &GaiUsc705::Scene00005Return ) ); + } + + void Scene00005Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8AL( quest.getUI8AL() + 1 ); + quest.setBitFlag8( 4, true ); + checkForCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00006( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 6, NONE, bindSceneReturn( &GaiUsc705::Scene00006Return ) ); + } + + void Scene00006Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + player.finishQuest( getId() ); + } + } +}; + +EXPOSE_SCRIPT( GaiUsc705 ); \ No newline at end of file diff --git a/src/scripts/quest/subquest/thanalan_west/GaiUsc703.cpp b/src/scripts/quest/subquest/thanalan_west/GaiUsc703.cpp new file mode 100644 index 00000000..904137ce --- /dev/null +++ b/src/scripts/quest/subquest/thanalan_west/GaiUsc703.cpp @@ -0,0 +1,111 @@ +// 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: GaiUsc703_01015 +// Quest Name: A Kobold Initiative +// Quest ID: 66551 +// Start NPC: 1007487 +// End NPC: 1006325 + +using namespace Sapphire; + +class GaiUsc703 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // UI8AL + + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 1006325 + // 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 = 1007487;//Slafswys + static constexpr auto Actor1 = 1006325;//Bloeidin + +public: + GaiUsc703() : Sapphire::ScriptAPI::QuestScript( 66551 ){}; + ~GaiUsc703() = 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, NONE, bindSceneReturn( &GaiUsc703::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, NONE, bindSceneReturn( &GaiUsc703::Scene00001Return ) ); + } + + void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setSeq( SeqFinish ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00002( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 2, NONE, bindSceneReturn( &GaiUsc703::Scene00002Return ) ); + } + + void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + player.finishQuest( getId() ); + } + } +}; + +EXPOSE_SCRIPT( GaiUsc703 ); \ No newline at end of file From cb5f8067d6331f10b1a1ddef95069bf365aa97c3 Mon Sep 17 00:00:00 2001 From: Tahir Date: Mon, 16 Jan 2023 02:15:08 +0000 Subject: [PATCH 02/22] fix nav_export for 3.05 - re-add multithreaded exporting and make it eat less ram --- src/tools/nav_export/exportmgr.h | 2 +- src/tools/nav_export/main.cpp | 23 +++++++++++++++-------- src/tools/nav_export/pcb.h | 9 ++++----- src/tools/nav_export/threadpool.h | 11 +++++++++-- 4 files changed, 29 insertions(+), 16 deletions(-) diff --git a/src/tools/nav_export/exportmgr.h b/src/tools/nav_export/exportmgr.h index b2f5a67f..ed822d23 100644 --- a/src/tools/nav_export/exportmgr.h +++ b/src/tools/nav_export/exportmgr.h @@ -37,7 +37,7 @@ public: if( exportFileTypes & ExportFileType::Navmesh ) NavmeshExporter::exportZone( zone ); - } ); + }, true ); } void waitForTasks() diff --git a/src/tools/nav_export/main.cpp b/src/tools/nav_export/main.cpp index c42f8c17..fc4d0565 100644 --- a/src/tools/nav_export/main.cpp +++ b/src/tools/nav_export/main.cpp @@ -34,7 +34,7 @@ using namespace Sapphire; // garbage to ignore models bool noObj = false; -std::string gamePath( "C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack" ); +std::string gamePath( "H:\\Games\\ffxiv3.05\\game\\sqpack" ); std::unordered_map< uint16_t, std::string > zoneNameMap; std::map< std::string, std::string > exportedTeriMap; @@ -82,7 +82,7 @@ std::string getEobjSgbPath( uint32_t eobjId ) return exportedSgMap[ eobjSgbPaths[ eobjId ] ]; auto& eobjCat = eData->get_category( "EObj" ); - auto eObjExd = static_cast< xiv::exd::Exd >( eobjCat.get_data_ln( xiv::exd::Language::none ) ); + auto eObjExd = static_cast< xiv::exd::Exd >( eobjCat.get_data_ln( xiv::exd::Language::en ) ); auto& exportedSgCat = eData->get_category( "ExportedSG" ); auto exportedSgExd = static_cast< xiv::exd::Exd >( exportedSgCat.get_data_ln( xiv::exd::Language::none ) ); @@ -300,6 +300,9 @@ void exportSgbModel( const std::string& sgbFilePath, LgbEntry* pGimmick, Exporte int main( int argc, char* argv[] ) { + printf("Usage: nav_export \"path/to/FINAL FANTASY XIV - A REALM REBORN/game/sqpack\" \n" \ + "- default is 4, memory usage may increase to multiple GB as this increases. ~3.5GB RAM using 16 jobs.\n"); + auto startTime = std::chrono::high_resolution_clock::now(); auto entryStartTime = std::chrono::high_resolution_clock::now(); @@ -319,6 +322,9 @@ int main( int argc, char* argv[] ) if( argc > 1 ) gamePath = std::string( argv[ 1 ] ); + if( argc > 2 ) + nJobs = std::atoi( argv[ 2 ] ); + try { initExd( gamePath ); @@ -326,9 +332,10 @@ int main( int argc, char* argv[] ) } catch( std::exception& e ) { - printf( "Unable to initialise EXD!\n Usage: nav_export \"path/to/FINAL FANTASY XIV - A REALM REBORN/game/sqpack\"\n" ); + printf( "Unable to initialise EXD!\n" ); return -1; } + ExportMgr exportMgr( nJobs ); zoneNameToPath( zoneName ); @@ -475,17 +482,17 @@ int main( int argc, char* argv[] ) exportedZone.groups.emplace( group.name, exportedGroup ); } } + + // :( + if( zoneCount % nJobs == 0 ) + pCache->purge(); + exportMgr.exportZone( exportedZone, static_cast< ExportFileType >( exportFileType ) ); exportedZone.groups.clear(); printf( "Built export struct for %s in %lu seconds \n", zoneName.c_str(), std::chrono::duration_cast< std::chrono::seconds >( std::chrono::high_resolution_clock::now() - entryStartTime ).count() ); - //if( zoneCount++ % nJobs == 0 ) - { - exportMgr.restart(); - pCache->purge(); - } } catch( std::exception& e ) { diff --git a/src/tools/nav_export/pcb.h b/src/tools/nav_export/pcb.h index 647c56ca..3b7f1fdb 100644 --- a/src/tools/nav_export/pcb.h +++ b/src/tools/nav_export/pcb.h @@ -43,7 +43,6 @@ struct PCB_INDEXDATA { uint8_t index[3]; uint8_t unknown[3]; - uint8_t unknown1[6]; }; struct PCB_VERTEXDATAI16 @@ -104,7 +103,7 @@ struct PCB_FILE bool isgroup = true; while( isgroup ) { - PCB_BLOCK_ENTRY block_entry; + PCB_BLOCK_ENTRY block_entry{0}; memcpy( &block_entry.header, data + offset, sizeof( block_entry.header ) ); isgroup = block_entry.header.type == 0x30; @@ -117,10 +116,10 @@ struct PCB_FILE } else { - /* printf( "\tnum_v16: %i, num_indices: %i, num_vertices: %i\n\n", + /*printf( "\tnum_v16: %i, num_indices: %i, num_vertices: %i\n\n", block_entry.header.num_v16, block_entry.header.num_indices, block_entry.header.num_vertices );*/ int doffset = sizeof( block_entry.header ) + offset; - uint16_t block_size = sizeof( block_entry.header ) + + uint32_t block_size = sizeof( block_entry.header ) + block_entry.header.num_vertices * 3 * 4 + block_entry.header.num_v16 * 6 + block_entry.header.num_indices * 6; @@ -143,7 +142,7 @@ struct PCB_FILE if( block_entry.header.num_indices != 0 ) { block_entry.data.indices.resize( block_entry.header.num_indices ); - int32_t size_indexbuffer = block_entry.header.num_indices * 12; + int32_t size_indexbuffer = block_entry.header.num_indices * 6; memcpy( &block_entry.data.indices[ 0 ], data + doffset, size_indexbuffer ); doffset += size_indexbuffer; } diff --git a/src/tools/nav_export/threadpool.h b/src/tools/nav_export/threadpool.h index 78657bd3..9da3f63e 100644 --- a/src/tools/nav_export/threadpool.h +++ b/src/tools/nav_export/threadpool.h @@ -41,7 +41,7 @@ public: } template< class Func, class Ret = std::result_of_t< Func&() > > - std::future< Ret > queue( Func&& f ) + std::future< Ret > queue( Func&& f, bool waitForWorker = false ) { std::packaged_task< Ret() > task( std::forward< Func >( f ) ); auto ret = task.get_future(); @@ -50,6 +50,12 @@ public: m_pendingJobs.emplace_back( std::move( task ) ); } m_cv.notify_one(); + + if( waitForWorker ) + { + std::unique_lock lock( m_mutex ); + m_cv2.wait( lock, [&]() { return m_pendingJobs.size() <= m_workers.size(); } ); + } return ret; } @@ -95,12 +101,13 @@ private: return; } func(); + m_cv2.notify_all(); } } bool m_runFlag{ true }; std::mutex m_mutex; - std::condition_variable m_cv; + std::condition_variable m_cv, m_cv2; std::deque< std::packaged_task< void() > > m_pendingJobs; std::vector< std::future< void > > m_workers; }; From acdb35c86dace28c3339bfc435fc175011d7a5ef Mon Sep 17 00:00:00 2001 From: dude22072 Date: Mon, 16 Jan 2023 17:36:50 -0600 Subject: [PATCH 03/22] More Sidequests --- .../subquest/blackshroud_south/GaiUsc612.cpp | 127 ++++ .../quest/subquest/gridania/GaiUsc608.cpp | 285 +++++++++ .../quest/subquest/gridania/GaiUsc609.cpp | 562 ++++++++++++++++++ .../subquest/thanalan_west/GaiUsc607.cpp | 157 +++++ .../subquest/thanalan_west/GaiUsd001.cpp | 120 ++++ 5 files changed, 1251 insertions(+) create mode 100644 src/scripts/quest/subquest/blackshroud_south/GaiUsc612.cpp create mode 100644 src/scripts/quest/subquest/gridania/GaiUsc608.cpp create mode 100644 src/scripts/quest/subquest/gridania/GaiUsc609.cpp create mode 100644 src/scripts/quest/subquest/thanalan_west/GaiUsc607.cpp create mode 100644 src/scripts/quest/subquest/thanalan_west/GaiUsd001.cpp diff --git a/src/scripts/quest/subquest/blackshroud_south/GaiUsc612.cpp b/src/scripts/quest/subquest/blackshroud_south/GaiUsc612.cpp new file mode 100644 index 00000000..3efb3f3b --- /dev/null +++ b/src/scripts/quest/subquest/blackshroud_south/GaiUsc612.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: GaiUsc612_01012 +// Quest Name: All You Wanted to Know about Odin +// Quest ID: 66548 +// Start NPC: 1006585 +// End NPC: 1007478 + +using namespace Sapphire; + +class GaiUsc612 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // UI8AL + // UI8BH + + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 1007478 + // 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 = 1006585;//Simmie + static constexpr auto Actor1 = 1007478;//Urianger + static constexpr auto Item0 = 2000846; + +public: + GaiUsc612() : Sapphire::ScriptAPI::QuestScript( 66548 ){}; + ~GaiUsc612() = 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, NONE, bindSceneReturn( &GaiUsc612::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, NONE, bindSceneReturn( &GaiUsc612::Scene00001Return ) ); + } + + void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setSeq( SeqFinish ); + quest.setUI8BH( 1 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00002( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 2, NONE, bindSceneReturn( &GaiUsc612::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, NONE, bindSceneReturn( &GaiUsc612::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( GaiUsc612 ); \ No newline at end of file diff --git a/src/scripts/quest/subquest/gridania/GaiUsc608.cpp b/src/scripts/quest/subquest/gridania/GaiUsc608.cpp new file mode 100644 index 00000000..03e2fc93 --- /dev/null +++ b/src/scripts/quest/subquest/gridania/GaiUsc608.cpp @@ -0,0 +1,285 @@ +// 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 "Manager/TerritoryMgr.h" +#include "Territory/Territory.h" + +// Quest Script: GaiUsc608_01008 +// Quest Name: Who Was That Man in Black +// Quest ID: 66544 +// Start NPC: 1003061 +// End NPC: 1003061 + +using namespace Sapphire; + +class GaiUsc608 : 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: 1000423 + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 1000195 + // 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 = 1003061;//Lewin + static constexpr auto Actor1 = 1000423;//Gods' Quiver Bow + static constexpr auto Actor2 = 1000195;//CHANSTELOUP + static constexpr auto Actor3 = 1000372;//TATASOSA + static constexpr auto Actor4 = 1000122;//HONORAINT + static constexpr auto Actor5 = 1000156;//Aedan + static constexpr auto Poprange0 = 3884000; + static constexpr auto Territorytype0 = 204; + +public: + GaiUsc608() : Sapphire::ScriptAPI::QuestScript( 66544 ){}; + ~GaiUsc608() = 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 ) + Scene00007( quest, player ); + break; + } + case Actor1: + { + if( quest.getSeq() == Seq0 ) + Scene00002( quest, player ); + else if( quest.getSeq() == SeqFinish ) + Scene00008( 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; + } + case Actor5: + { + 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(), 4 ); + + if( quest.getUI8AH() >= 4 ) + { + quest.setSeq( SeqFinish ); + quest.setUI8AH( 0 ); + quest.setUI8AL( 0 ); + quest.setUI8BH( 0 ); + quest.setUI8BL( 0 ); + quest.setUI8CH( 0 ); + quest.setBitFlag8( 1, false ); + quest.setBitFlag8( 2, false ); + quest.setBitFlag8( 3, false ); + quest.setBitFlag8( 4, false ); + } + } + + void travelToPoprange( Entity::Player& player, uint32_t poprangeId, bool sameTerritory ) + { + auto& objectCache = Common::Service< Sapphire::InstanceObjectCache >::ref(); + + auto popRangeInfo = objectCache.getPopRangeInfo( poprangeId ); + + if( popRangeInfo ) + { + if( sameTerritory ) + { + warpMgr().requestWarp( player, Common::WarpType::WARP_TYPE_NORMAL, popRangeInfo->m_pos, popRangeInfo->m_rotation ); + } + else + { + auto pTeri = teriMgr().getZoneByTerritoryTypeId( popRangeInfo->m_territoryTypeId ); + warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, pTeri->getGuId(), popRangeInfo->m_pos, popRangeInfo->m_rotation ); + } + } + } + ////////////////////////////////////////////////////////////////////// + // 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( &GaiUsc608::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, NONE, bindSceneReturn( &GaiUsc608::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, NONE, bindSceneReturn( &GaiUsc608::Scene00002Return ) ); + } + + void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + { + travelToPoprange( player, Poprange0, false ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00003( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 3, NONE, bindSceneReturn( &GaiUsc608::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8AH( quest.getUI8AH() + 1 ); + quest.setUI8AL( 1 ); + quest.setBitFlag8( 1, true ); + checkQuestCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00004( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 4, NONE, bindSceneReturn( &GaiUsc608::Scene00004Return ) ); + } + + void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8AH( quest.getUI8AH() + 1 ); + quest.setUI8BH( 1 ); + quest.setBitFlag8( 2, true ); + checkQuestCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00005( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 5, NONE, bindSceneReturn( &GaiUsc608::Scene00005Return ) ); + } + + void Scene00005Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8AH( quest.getUI8AH() + 1 ); + quest.setUI8BL( 1 ); + quest.setBitFlag8( 3, true ); + checkQuestCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00006( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 6, NONE, bindSceneReturn( &GaiUsc608::Scene00006Return ) ); + } + + void Scene00006Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8AH( quest.getUI8AH() + 1 ); + quest.setUI8CH( 1 ); + quest.setBitFlag8( 4, true ); + checkQuestCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00007( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 7, NONE, bindSceneReturn( &GaiUsc608::Scene00007Return ) ); + } + + void Scene00007Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + player.finishQuest( getId() ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00008( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 8, NONE, bindSceneReturn( &GaiUsc608::Scene00008Return ) ); + } + + void Scene00008Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + { + travelToPoprange( player, Poprange0, false ); + } + } +}; + +EXPOSE_SCRIPT( GaiUsc608 ); \ No newline at end of file diff --git a/src/scripts/quest/subquest/gridania/GaiUsc609.cpp b/src/scripts/quest/subquest/gridania/GaiUsc609.cpp new file mode 100644 index 00000000..e913b089 --- /dev/null +++ b/src/scripts/quest/subquest/gridania/GaiUsc609.cpp @@ -0,0 +1,562 @@ +// 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: GaiUsc609_01009 +// Quest Name: The Dark Divinity +// Quest ID: 66545 +// Start NPC: 1003061 +// End NPC: 1006585 + +using namespace Sapphire; + +class GaiUsc609 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AL + // UI8BH + + /// Countable Num: 0 Seq: 1 Event: 1 Listener: 1000423 + /// Countable Num: 0 Seq: 2 Event: 1 Listener: 1006584 + /// Countable Num: 0 Seq: 3 Event: 1 Listener: 1006681 + /// Countable Num: 0 Seq: 4 Event: 1 Listener: 1006682 + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 1006683 + // 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 = 1003061;//Lewin + static constexpr auto Actor1 = 1000423;//Gods' Quiver Bow + static constexpr auto Actor2 = 1006584;//O-App-Pesi + static constexpr auto Actor3 = 1006681; + static constexpr auto Actor4 = 1006682; + static constexpr auto Actor5 = 1006683; + static constexpr auto Actor6 = 1006585;//Simmie + static constexpr auto Enemy0 = 4300261; + static constexpr auto Enemy1 = 2198; + static constexpr auto Eobject0 = 2002241;//Urth's Seal (Seq2) + static constexpr auto Eobject1 = 2002614;//Urth's Seal (Seq3) + static constexpr auto EventActionProcessUpperMiddle = 32; + static constexpr auto EventActionSearch = 1; + static constexpr auto Item0 = 2000963; + static constexpr auto Item1 = 2000965; + static constexpr auto Poprange0 = 3884000; + static constexpr auto Territorytype0 = 204; + +public: + GaiUsc609() : Sapphire::ScriptAPI::QuestScript( 66545 ){}; + ~GaiUsc609() = 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() == Seq0 ) + Scene00002( quest, player ); + break; + } + case Actor2: + { + if( quest.getSeq() == Seq1 ) + Scene00003( quest, player ); + else if( quest.getSeq() == Seq2 ) + Scene00009( quest, player ); + else if( quest.getSeq() == Seq3 ) + Scene00015( quest, player ); + else if( quest.getSeq() == Seq4 ) + Scene00019( quest, player ); + else if( quest.getSeq() == SeqFinish ) + Scene00025( quest, player ); + break; + } + case Actor3: + { + break; + } + case Actor4: + { + break; + } + case Actor5: + { + break; + } + case Actor6: + { + if( quest.getSeq() == SeqFinish ) + Scene00024( quest, player ); + break; + } + case Eobject0: + { + eventMgr().eventActionStart( + player, getId(), EventActionProcessUpperMiddle, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { + Scene00008( quest, player ); + }, + nullptr, 0 ); + break; + } + case Eobject1: + { + eventMgr().eventActionStart( + player, getId(), EventActionProcessUpperMiddle, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { + Scene00014( quest, player ); + }, + nullptr, 0 ); + break; + } + } + } + + void onBNpcKill( World::Quest& quest, Entity::BNpc& bnpc, Entity::Player& player ) override + { + switch( bnpc.getLayoutId() ) + { + case Enemy0: + { + if( bnpc.getTriggerOwnerId() == player.getId() ) + { + quest.setSeq( Seq3 ); + quest.setBitFlag8( 1, false ); + quest.setUI8BH( 0 ); + eventMgr().sendEventNotice( player, getId(), 1, 0 ); + } + break; + } + case Enemy1: + { + break; + } + } + } + + void onEventItem( World::Quest& quest, Entity::Player& player, uint64_t actorId ) override + { + if( quest.getSeq() == Seq2 ) + { + //TODO:Apply Debufs to BNPC + quest.setUI8BH( 0 ); + } + } + + void onPlayerDeath( World::Quest& quest, Sapphire::Entity::Player& player ) override + { + if( quest.getSeq() == Seq2 ) + { + auto instance = teriMgr().getTerritoryByGuId( player.getTerritoryId() ); + + auto enem = instance->getActiveBNpcByLayoutIdAndTriggerOwner( Enemy0, player.getId() ); + if( enem != nullptr ) instance->removeActor( enem ); + + quest.setBitFlag8( 1, false ); + } + } + +private: + void checkQuestCompletion( World::Quest& quest, Entity::Player& player ) + { + //eventMgr().sendEventNotice( player, getId(), 0, 2, quest.getUI8AH(), 4 ); + } + + void travelToPoprange( Entity::Player& player, uint32_t poprangeId, bool sameTerritory ) + { + auto& objectCache = Common::Service< Sapphire::InstanceObjectCache >::ref(); + + auto popRangeInfo = objectCache.getPopRangeInfo( poprangeId ); + + if( popRangeInfo ) + { + if( sameTerritory ) + { + warpMgr().requestWarp( player, Common::WarpType::WARP_TYPE_NORMAL, popRangeInfo->m_pos, popRangeInfo->m_rotation ); + } + else + { + auto pTeri = teriMgr().getZoneByTerritoryTypeId( popRangeInfo->m_territoryTypeId ); + warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, pTeri->getGuId(), popRangeInfo->m_pos, popRangeInfo->m_rotation ); + } + } + } + ////////////////////////////////////////////////////////////////////// + // 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( &GaiUsc609::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, NONE, bindSceneReturn( &GaiUsc609::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, NONE, bindSceneReturn( &GaiUsc609::Scene00002Return ) ); + } + + void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + { + travelToPoprange( player, Poprange0, false ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00003( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 3, NONE, bindSceneReturn( &GaiUsc609::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 0, 0 ); + quest.setUI8BH( 1 ); + quest.setSeq( Seq2 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00004( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 4, NONE, bindSceneReturn( &GaiUsc609::Scene00004Return ) ); + } + + void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00005( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 5, NONE, bindSceneReturn( &GaiUsc609::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, NONE, bindSceneReturn( &GaiUsc609::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, NONE, bindSceneReturn( &GaiUsc609::Scene00007Return ) ); + } + + void Scene00007Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00008( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 8, NONE, bindSceneReturn( &GaiUsc609::Scene00008Return ) ); + } + + void Scene00008Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + auto instance = teriMgr().getTerritoryByGuId( player.getTerritoryId() ); + auto enemy = instance->createBNpcFromLayoutId( Enemy0, 1220 /*Find the right value*/, Common::BNpcType::Enemy, player.getId() ); + enemy->hateListAddDelayed( player.getAsPlayer(), 1 ); + quest.setBitFlag8( 1, true ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00009( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 9, NONE, bindSceneReturn( &GaiUsc609::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, NONE, bindSceneReturn( &GaiUsc609::Scene00010Return ) ); + } + + void Scene00010Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00011( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 11, NONE, bindSceneReturn( &GaiUsc609::Scene00011Return ) ); + } + + void Scene00011Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00012( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 12, NONE, bindSceneReturn( &GaiUsc609::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, NONE, bindSceneReturn( &GaiUsc609::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, NONE, bindSceneReturn( &GaiUsc609::Scene00014Return ) ); + } + + void Scene00014Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setSeq( Seq4 ); + quest.setUI8BH( 1 ); + eventMgr().sendEventNotice( player, getId(), 2, 0 /*1, Item1*/ );//TODO:Item Icon Event Notice + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00015( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 15, NONE, bindSceneReturn( &GaiUsc609::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, NONE, bindSceneReturn( &GaiUsc609::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, NONE, bindSceneReturn( &GaiUsc609::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, NONE, bindSceneReturn( &GaiUsc609::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, NONE, bindSceneReturn( &GaiUsc609::Scene00019Return ) ); + } + + void Scene00019Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + Scene00020( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00020( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 20, NONE, bindSceneReturn( &GaiUsc609::Scene00020Return ) ); + } + + void Scene00020Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setSeq( SeqFinish ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00021( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 21, NONE, bindSceneReturn( &GaiUsc609::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, NONE, bindSceneReturn( &GaiUsc609::Scene00022Return ) ); + } + + void Scene00022Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00023( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 23, NONE, bindSceneReturn( &GaiUsc609::Scene00023Return ) ); + } + + void Scene00023Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00024( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 24, NONE, bindSceneReturn( &GaiUsc609::Scene00024Return ) ); + } + + void Scene00024Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + player.finishQuest( getId(), result.getResult( 1 ) ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00025( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 25, NONE, bindSceneReturn( &GaiUsc609::Scene00025Return ) ); + } + + void Scene00025Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00026( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 26, NONE, bindSceneReturn( &GaiUsc609::Scene00026Return ) ); + } + + void Scene00026Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00027( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 27, NONE, bindSceneReturn( &GaiUsc609::Scene00027Return ) ); + } + + void Scene00027Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00028( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 28, NONE, bindSceneReturn( &GaiUsc609::Scene00028Return ) ); + } + + void Scene00028Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } +}; + +EXPOSE_SCRIPT( GaiUsc609 ); \ No newline at end of file diff --git a/src/scripts/quest/subquest/thanalan_west/GaiUsc607.cpp b/src/scripts/quest/subquest/thanalan_west/GaiUsc607.cpp new file mode 100644 index 00000000..1fd23823 --- /dev/null +++ b/src/scripts/quest/subquest/thanalan_west/GaiUsc607.cpp @@ -0,0 +1,157 @@ +// 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 "Manager/TerritoryMgr.h" +#include "Territory/Territory.h" + +// Quest Script: GaiUsc607_01007 +// Quest Name: Primal Fear +// Quest ID: 66543 +// Start NPC: 1007478 +// End NPC: 1003061 + +using namespace Sapphire; + +class GaiUsc607 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // UI8AH + + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 1003061 + // 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 = 1007478;//Urianger + static constexpr auto Actor1 = 1003061;//Lewin + static constexpr auto Actor2 = 1000423;//Gods' Quiver Bow + static constexpr auto Poprange0 = 3884000; + static constexpr auto Territorytype0 = 204; + +public: + GaiUsc607() : Sapphire::ScriptAPI::QuestScript( 66543 ){}; + ~GaiUsc607() = 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; + } + case Actor2: + { + if( quest.getSeq() == SeqFinish ) + Scene00003( quest, player ); + break; + } + } + } + + +private: + void travelToPoprange( Entity::Player& player, uint32_t poprangeId, bool sameTerritory ) + { + auto& objectCache = Common::Service< Sapphire::InstanceObjectCache >::ref(); + + auto popRangeInfo = objectCache.getPopRangeInfo( poprangeId ); + + if( popRangeInfo ) + { + if( sameTerritory ) + { + warpMgr().requestWarp( player, Common::WarpType::WARP_TYPE_NORMAL, popRangeInfo->m_pos, popRangeInfo->m_rotation ); + } + else + { + auto pTeri = teriMgr().getZoneByTerritoryTypeId( popRangeInfo->m_territoryTypeId ); + warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, pTeri->getGuId(), popRangeInfo->m_pos, popRangeInfo->m_rotation ); + } + } + } + ////////////////////////////////////////////////////////////////////// + // 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( &GaiUsc607::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, NONE, bindSceneReturn( &GaiUsc607::Scene00001Return ) ); + } + + void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setSeq( SeqFinish ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00002( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 2, NONE, bindSceneReturn( &GaiUsc607::Scene00002Return ) ); + } + + void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + player.finishQuest( getId() ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00003( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 3, NONE, bindSceneReturn( &GaiUsc607::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + { + travelToPoprange( player, Poprange0, false ); + } + } +}; + +EXPOSE_SCRIPT( GaiUsc607 ); \ No newline at end of file diff --git a/src/scripts/quest/subquest/thanalan_west/GaiUsd001.cpp b/src/scripts/quest/subquest/thanalan_west/GaiUsd001.cpp new file mode 100644 index 00000000..5d1acff3 --- /dev/null +++ b/src/scripts/quest/subquest/thanalan_west/GaiUsd001.cpp @@ -0,0 +1,120 @@ +// 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: GaiUsd001_01047 +// Quest Name: A Recurring Problem +// Quest ID: 66583 +// Start NPC: 1006693 +// End NPC: 1007478 + +using namespace Sapphire; + +class GaiUsd001 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // UI8AL + + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 1007478 + // 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 = 1006693;//Minfilia + static constexpr auto Actor1 = 1007478;//Urianger + static constexpr auto LocActor0 = 1002275; + static constexpr auto LocActor1 = 1002276; + static constexpr auto LocActor2 = 1003782; + static constexpr auto LocActor3 = 1003781; + static constexpr auto LocActor4 = 1003784; + static constexpr auto LocBgm1 = 97; + static constexpr auto LocFace0 = 604; + static constexpr auto LocFace1 = 605; + static constexpr auto LocFace2 = 617; + +public: + GaiUsd001() : Sapphire::ScriptAPI::QuestScript( 66583 ){}; + ~GaiUsd001() = 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, NONE, bindSceneReturn( &GaiUsd001::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, FADE_OUT | HIDE_UI, bindSceneReturn( &GaiUsd001::Scene00001Return ) ); + } + + void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setSeq( SeqFinish ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00002( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 2, NONE, bindSceneReturn( &GaiUsd001::Scene00002Return ) ); + } + + void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + player.finishQuest( getId() ); + } + } +}; + +EXPOSE_SCRIPT( GaiUsd001 ); \ No newline at end of file From 724dbf367b08a001a59d30d6945185ec54fb9f0e Mon Sep 17 00:00:00 2001 From: Toofy Date: Mon, 16 Jan 2023 23:57:29 +0000 Subject: [PATCH 04/22] Fixing the starting Ul'dah quest by using the new bindSceneReturn api --- src/scripts/quest/ManWil004.cpp | 184 +++++++++++++++----------------- 1 file changed, 87 insertions(+), 97 deletions(-) diff --git a/src/scripts/quest/ManWil004.cpp b/src/scripts/quest/ManWil004.cpp index 8a893bf0..e3fd85e2 100644 --- a/src/scripts/quest/ManWil004.cpp +++ b/src/scripts/quest/ManWil004.cpp @@ -53,9 +53,17 @@ private: static constexpr auto Poprange0 = 4110794; static constexpr auto Reward0 = 1; static constexpr auto Screenimage0 = 14; - static constexpr auto Seq0Actor0Lq = 50; static constexpr auto Territorytype0 = 130; + static constexpr auto SEQ_0_ACTOR0 = 0; + static constexpr auto SEQ_1_ACTOR1 = 1; + static constexpr auto SEQ_1_ACTOR2 = 2; + static constexpr auto SEQ_1_ACTOR3 = 3; + static constexpr auto SEQ_1_ACTOR4 = 4; + static constexpr auto SEQ_1_ACTOR5 = 5; + static constexpr auto SEQ_1_ACTOR8 = 8; + static constexpr auto SEQ_0_ACTOR0_LQ = 50; + public: ManWil004() : Sapphire::ScriptAPI::QuestScript( 66106 ) { @@ -85,13 +93,14 @@ public: } else if( actorId == Aetheryte0 ) { + eventMgr().eventActionStart( player, 0x050002, 0x13, [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { eventMgr().sendEventNotice( player, 0x050002, 0, 1, 0, 0 ); player.registerAetheryte( 2 ); player.setRewardFlag( Common::UnlockEntry::Return ); - Scene00001( player ); + Scene00051( quest, player ); }, nullptr, getId() ); } @@ -99,7 +108,8 @@ public: private: - void checkQuestCompletion( Entity::Player& player, uint32_t varIdx ) + //varIdx refers to the noticeId + void checkQuestCompletion( World::Quest& quest, Entity::Player& player, uint32_t varIdx ) { if( varIdx == 1 ) { @@ -114,141 +124,121 @@ private: eventMgr().sendEventNotice( player, getId(), 0, 0, 0, 0 ); } - auto pQuest = player.getQuest( getId() ); - if( !pQuest ) - return; - auto QUEST_VAR_ATTUNE = pQuest->getUI8AL(); - auto QUEST_VAR_CLASS = pQuest->getUI8BH(); - auto QUEST_VAR_TRADE = pQuest->getUI8BL(); + auto var_attuned = quest.getUI8AL(); + auto var_class = quest.getUI8BH(); + auto var_trade = quest.getUI8BL(); - if( QUEST_VAR_ATTUNE == 1 && QUEST_VAR_CLASS == 1 && QUEST_VAR_TRADE == 1 ) + + if( var_attuned == 1 && var_class == 1 && var_trade == 1 ) { - pQuest->setSeq( SeqFinish ); + quest.setSeq( SeqFinish ); } } void Scene00000( Entity::Player& player ) { - eventMgr().playScene( player, getId(), 0, HIDE_HOTBAR, - [ & ]( Entity::Player& player, const Event::SceneResult& result ) - { - if( result.getResult( 0 ) == 1 ) // accept quest - { - Scene00050( player ); - } - } ); + eventMgr().playQuestScene( player, getId(), SEQ_0_ACTOR0, HIDE_HOTBAR, bindSceneReturn( &ManWil004::Scene00000Return ) ); } - void Scene00001( Entity::Player& player ) + void Scene00000Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - eventMgr().playScene( player, getId(), 1, HIDE_HOTBAR, - [ & ]( Entity::Player& player, const Event::SceneResult& result ) - { - Scene00002( player ); - } ); + if( result.getResult( 0 ) == 1 ) // accept quest + Scene00050( player ); + } + + void Scene00001( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), SEQ_1_ACTOR1, 0x0EFB, bindSceneReturn( &ManWil004::Scene00001Return ) ); + } + + void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + Scene00002(player); + } + + void Scene00051( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestSceneChain( player, getId(), 51, NONE, bindQuestScene( &ManWil004::Scene00001 ) ); } void Scene00002( Entity::Player& player ) { - eventMgr().playScene( player, getId(), 2, SET_EOBJ_BASE | HIDE_HOTBAR | INVIS_EOBJ, - [ & ]( Entity::Player& player, const Event::SceneResult& result ) - { - auto pQuest = player.getQuest( getId() ); - if( !pQuest ) - return; + eventMgr().playQuestScene( player, getId(), SEQ_1_ACTOR2, NONE, bindSceneReturn( &ManWil004::Scene00002Return ) ); + } - pQuest->setUI8BL( 1 ); - checkQuestCompletion( player, 0 ); - } ); + void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8BL(1); + checkQuestCompletion( quest, player, 0 ); } void Scene00003( Entity::Player& player ) { - eventMgr().playScene( player, getId(), 3, HIDE_HOTBAR, - [ & ]( Entity::Player& player, const Event::SceneResult& result ) - { - auto pQuest = player.getQuest( getId() ); - if( !pQuest ) - return; + eventMgr().playQuestScene( player, getId(), SEQ_1_ACTOR3, HIDE_HOTBAR, bindSceneReturn( &ManWil004::Scene00003Return ) ); + } - pQuest->setUI8AL( 1 ); - checkQuestCompletion( player, 1 ); - } ); + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8AL(1); + checkQuestCompletion( quest, player, 1 ); } void Scene00004( Entity::Player& player ) { - eventMgr().playScene( player, getId(), 4, HIDE_HOTBAR, - [ & ]( Entity::Player& player, const Event::SceneResult& result ) - { - if( result.getResult( 0 ) == 1 ) - { - Scene00005( player ); - } - else - return; - } ); + eventMgr().playQuestScene( player, getId(), SEQ_1_ACTOR4, HIDE_HOTBAR, bindSceneReturn( &ManWil004::Scene00004Return ) ); + } + + void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if(result.getResult(0) == 1) + { + Scene00005( player ); + } else + { + return; + } } void Scene00005( Entity::Player& player ) { - eventMgr().playScene( player, getId(), 5, SET_EOBJ_BASE | HIDE_HOTBAR | INVIS_EOBJ, - [ & ]( Entity::Player& player, const Event::SceneResult& result ) - { - auto pQuest = player.getQuest( getId() ); - if( !pQuest ) - return; - - pQuest->setUI8CH( 0 ); - pQuest->setUI8BH( 1 ); - checkQuestCompletion( player, 2 ); - } ); + eventMgr().playQuestScene( player, getId(), SEQ_1_ACTOR5, SET_EOBJ_BASE | HIDE_HOTBAR | INVIS_EOBJ, bindSceneReturn( &ManWil004::Scene00005Return ) ); } - void Scene00006( Entity::Player& player ) + void Scene00005Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - eventMgr().playScene( player, getId(), 6, HIDE_HOTBAR, - [ & ]( Entity::Player& player, const Event::SceneResult& result ) - { - } ); - } - - void Scene00007( Entity::Player& player ) - { - eventMgr().playScene( player, getId(), 7, HIDE_HOTBAR, - [ & ]( Entity::Player& player, const Event::SceneResult& result ) - { - } ); + quest.setUI8CH(0); + quest.setUI8BH(1); + checkQuestCompletion( quest, player, 2 ); } void Scene00008( Entity::Player& player ) { - eventMgr().playScene( player, getId(), 8, SET_EOBJ_BASE | HIDE_HOTBAR | INVIS_EOBJ, - [ & ]( Entity::Player& player, const Event::SceneResult& result ) - { - if( result.getResult( 0 ) == 1 ) - { - player.finishQuest( getId(), result.getResult( 1 ) ); - } - } ); + eventMgr().playQuestScene( player, getId(), SEQ_1_ACTOR8, SET_EOBJ_BASE | HIDE_HOTBAR | INVIS_EOBJ, bindSceneReturn( &ManWil004::Scene00008Return ) ); + + } + + void Scene00008Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + { + player.finishQuest( getId(), result.getResult( 1 ) ); + } } void Scene00050( Entity::Player& player ) { - eventMgr().playScene( player, getId(), 50, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, - [ & ]( Entity::Player& player, const Event::SceneResult& result ) - { - auto pQuest = player.getQuest( getId() ); - if( !pQuest ) - return; - // on quest accept - pQuest->setSeq( Seq1 ); - pQuest->setUI8CH( 1 ); // receive key item + eventMgr().playQuestScene( player, getId(), SEQ_0_ACTOR0_LQ, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, bindSceneReturn( &ManWil004::Scene00050Return ) ); + } - // teleport to real ul'dah - player.forceZoneing( 130 ); - } ); + void Scene00050Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + // on quest accept + quest.setSeq( Seq1 ); + quest.setUI8CH( 1 ); // receive key item + + // teleport to real Uldah + player.forceZoneing( Territorytype0 ); } }; From c536b0e7cffce68fd63a2f17257c3266d055d334 Mon Sep 17 00:00:00 2001 From: dude22072 Date: Tue, 17 Jan 2023 00:22:24 -0600 Subject: [PATCH 05/22] WHM ARR Relic Quest --- .../quest/classquest/WHM/JobWhm001.cpp | 722 ++++++++++++++++++ .../subquest/thanalan_west/SubWil142.cpp | 150 ++++ 2 files changed, 872 insertions(+) create mode 100644 src/scripts/quest/classquest/WHM/JobWhm001.cpp create mode 100644 src/scripts/quest/subquest/thanalan_west/SubWil142.cpp diff --git a/src/scripts/quest/classquest/WHM/JobWhm001.cpp b/src/scripts/quest/classquest/WHM/JobWhm001.cpp new file mode 100644 index 00000000..22d8a59d --- /dev/null +++ b/src/scripts/quest/classquest/WHM/JobWhm001.cpp @@ -0,0 +1,722 @@ +// 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 "Inventory/Item.h"; + +// Quest Script: JobWhm001_01124 +// Quest Name: A Relic Reborn (Thyrus) +// Quest ID: 66660 +// Start NPC: 1003075 +// End NPC: 1003075 + +using namespace Sapphire; + +class JobWhm001 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AL + // UI8BH + // UI8BL + // UI8CH + + /// Countable Num: 0 Seq: 1 Event: 1 Listener: 2002496 + /// Countable Num: 0 Seq: 2 Event: 1 Listener: 1003075 + /// Countable Num: 0 Seq: 3 Event: 1 Listener: 1003075 + /// Countable Num: 0 Seq: 4 Event: 1 Listener: 5010000 + /// Countable Num: 0 Seq: 5 Event: 1 Listener: 1003075 + /// Countable Num: 0 Seq: 6 Event: 1 Listener: 1003075 + /// Countable Num: 0 Seq: 7 Event: 1 Listener: 1001304 + /// Countable Num: 0 Seq: 8 Event: 1 Listener: 5010000 + /// Countable Num: 0 Seq: 9 Event: 1 Listener: 1001304 + /// Countable Num: 0 Seq: 10 Event: 1 Listener: 1003075 + /// Countable Num: 0 Seq: 10 Event: 5 Listener: 756 + /// Countable Num: 0 Seq: 10 Event: 5 Listener: 758 + /// Countable Num: 0 Seq: 11 Event: 5 Listener: 757 + /// Countable Num: 0 Seq: 12 Event: 1 Listener: 1008161 + /// Countable Num: 0 Seq: 13 Event: 1 Listener: 1003075 + /// Countable Num: 0 Seq: 14 Event: 1 Listener: 1003075 + /// Countable Num: 0 Seq: 15 Event: 1 Listener: 5010000 + /// Countable Num: 0 Seq: 16 Event: 1 Listener: 1008161 + /// Countable Num: 0 Seq: 17 Event: 1 Listener: 1003075 + /// Countable Num: 0 Seq: 18 Event: 1 Listener: 1004582 + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 1003075 + // 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, + Seq5 = 5, + Seq6 = 6, + Seq7 = 7, + Seq8 = 8, + Seq9 = 9, + Seq10 = 10, + Seq11 = 11, + Seq12 = 12, + Seq13 = 13, + Seq14 = 14, + Seq15 = 15, + Seq16 = 16, + Seq17 = 17, + Seq18 = 18, + SeqFinish = 255, + }; + + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1003075;//Gerolt + static constexpr auto Actor1 = 5010000;//Portley Moogle? + static constexpr auto Actor2 = 1001304;//Rowena + static constexpr auto Actor3 = 1008161; + static constexpr auto Actor4 = 1004582; //Fafajoni <> + static constexpr auto Enemy0 = 756; //U'Ghamoro Quarryman + static constexpr auto Enemy1 = 758; //U'Ghamoro Priest + static constexpr auto Enemy2 = 757; //U'Ghamoro Bedesman + static constexpr auto Eobject0 = 2002496;//Treasure Coffer + static constexpr auto EventActionProcessMiddle = 16; + static constexpr auto EventActionSearch = 1; + static constexpr auto Instancedungeon0 = 20019;//Assumed to be A Relic Reborn: Chimera + static constexpr auto Instancedungeon1 = 14; + static constexpr auto Instancedungeon2 = 20020; + static constexpr auto Instancedungeon3 = 20004; + static constexpr auto Instancedungeon4 = 20006; + static constexpr auto Instancedungeon5 = 20005; + static constexpr auto Item0 = 2000993; + static constexpr auto Item1 = 2001002; + static constexpr auto Item2 = 2001011; + static constexpr auto Item3 = 2001020; + static constexpr auto Item4 = 2001029; + static constexpr auto Item5 = 2001038; + static constexpr auto Item6 = 2001047; + static constexpr auto LocAction0 = 858; + static constexpr auto LocAction1 = 995; + static constexpr auto LocAction2 = 936; + static constexpr auto LocItem1 = 2052; + static constexpr auto LocPosActor0 = 4311940; + static constexpr auto Ritem0 = 2049;//Madman's Whispering Rod + static constexpr auto Ritem1 = 2046;//Unfinished Thyrus + static constexpr auto Ritem2 = 6267;//Radz-at-Han Quenching Oil + +public: + JobWhm001() : Sapphire::ScriptAPI::QuestScript( 66660 ){}; + ~JobWhm001() = 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 ) + Scene00004( quest, player ); + else if( quest.getSeq() == Seq3 ) + Scene00006( quest, player ); + else if( quest.getSeq() == Seq4 ) + Scene00008( quest, player ); + else if( quest.getSeq() == Seq5 ) + Scene00009( quest, player ); + else if( quest.getSeq() == Seq9 ) + Scene00014( quest, player ); + else if( quest.getSeq() == Seq10 ) + Scene00017( quest, player ); + else if( quest.getSeq() == Seq11 ) + Scene00018( quest, player ); + else if( quest.getSeq() == Seq12 ) + Scene00020( quest, player ); + else if( quest.getSeq() == Seq13 ) + Scene00022( quest, player ); + else if( quest.getSeq() == Seq14 ) + Scene00023( quest, player ); + else if( quest.getSeq() == Seq15 ) + Scene00026( quest, player ); + else if( quest.getSeq() == Seq16 ) + Scene00027( quest, player ); + else if( quest.getSeq() == Seq17 ) + Scene00028( quest, player ); + else if( quest.getSeq() == Seq18 ) + Scene00029( quest, player ); + else if( quest.getSeq() == SeqFinish ) + Scene00031( quest, player ); + break; + } + case Actor1: + { + if( quest.getSeq() == Seq10 ) + Scene00016( quest, player ); + else if( quest.getSeq() == Seq11 ) + Scene00019( quest, player ); + else if( quest.getSeq() == Seq14 ) + Scene00025( quest, player ); + break; + } + case Actor2: + { + if( quest.getSeq() == Seq6 ) + Scene00011( quest, player ); + else if( quest.getSeq() == Seq8 ) + Scene00012( quest, player ); + break; + } + case Actor3: + { + break; + } + case Actor4: + { + if( quest.getSeq() == Seq12 ) + Scene00021( quest, player ); + break; + } + case Eobject0: + { + eventMgr().eventActionStart( + player, getId(), EventActionProcessMiddle, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { + Scene00002( quest, player ); + }, + nullptr, 0 ); + } + } + } + + void onBNpcKill( World::Quest& quest, Sapphire::Entity::BNpc& bnpc, Sapphire::Entity::Player& player ) override + { + if( player.getEquippedWeapon()->getId() != Ritem1 ) return; + switch( bnpc.getBNpcBaseId() ) + { + case Enemy0: + { + if( quest.getUI8AL() < 8 ) + { + quest.setUI8AL( quest.getUI8AL() + 1 ); + eventMgr().sendEventNotice( player, getId(), 9, 2, quest.getUI8AL(), 8 ); + checkQuestCompletion( quest, player ); + } + break; + } + case Enemy1: + { + if( quest.getUI8BH() < 8 ) + { + quest.setUI8BH( quest.getUI8BH() + 1 ); + eventMgr().sendEventNotice( player, getId(), 10, 2, quest.getUI8BH(), 8 ); + checkQuestCompletion( quest, player ); + } + break; + } + case Enemy2: + { + if( quest.getUI8BL() < 8 ) + { + quest.setUI8BL( quest.getUI8BL() + 1 ); + eventMgr().sendEventNotice( player, getId(), 11, 2, quest.getUI8BL(), 8 ); + checkQuestCompletion( quest, player ); + } + break; + } + } + } + + //TODO:Placeholder, not really a func + void onDungeonComplete( World::Quest& quest, Sapphire::Entity::Player& player, int dungeon ) + { + if( quest.getSeq() == Seq4 && dungeon == Instancedungeon0 )//A Relic Reborn: Chimera + { + quest.setUI8BH( 1 ); + eventMgr().sendEventNotice( player, getId(), 3, 0 ); + quest.setSeq( Seq5 ); + } + else if( quest.getSeq() == Seq7 && dungeon == Instancedungeon1 )//Amdapor Keep + { + quest.setUI8BH( 1 ); + eventMgr().sendEventNotice( player, getId(), 6, 0 ); + quest.setSeq( Seq8 ); + } + else if( quest.getSeq() == Seq12 && dungeon == Instancedungeon2 )//A Relic Reborn: Hydra + { + eventMgr().sendEventNotice( player, getId(), 13, 0 ); + quest.setSeq( Seq13 ); + } + else if( quest.getSeq() == Seq15 && dungeon == Instancedungeon3 )//Bowl of Embers (Hard) + { + quest.setUI8BH( 1 ); + eventMgr().sendEventNotice( player, getId(), 16, 0 ); + quest.setSeq( Seq16 ); + } + else if( quest.getSeq() == Seq16 && dungeon == Instancedungeon4 )//Howling Eye (Hard) + { + quest.setUI8BL( 1 ); + eventMgr().sendEventNotice( player, getId(), 17, 0 ); + quest.setSeq( Seq17 ); + } + else if( quest.getSeq() == Seq17 && dungeon == Instancedungeon5 )//Navel (Hard) + { + quest.setUI8CH( 1 ); + eventMgr().sendEventNotice( player, getId(), 18, 0 ); + quest.setSeq( Seq18 ); + } + } + +private: + void checkQuestCompletion( World::Quest& quest, Entity::Player& player ) + { + if( quest.getSeq() == Seq10 ) + { + if( quest.getUI8AL() >= 8 && quest.getUI8BH() >= 8 && quest.getUI8BL() >= 8 ) + { + quest.setUI8AL( 0 ); + quest.setUI8BH( 0 ); + quest.setUI8BL( 0 ); + quest.setSeq( Seq11 ); + } + } + } + ////////////////////////////////////////////////////////////////////// + // 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( &JobWhm001::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, NONE, bindSceneReturn( &JobWhm001::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, NONE, bindSceneReturn( &JobWhm001::Scene00002Return ) ); + } + + void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8BH( 1 ); + eventMgr().sendEventNotice( player, getId(), 0, 0 );//TODO:Item Icon + quest.setSeq( Seq2 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00003( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 3, NONE, bindSceneReturn( &JobWhm001::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00004( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 4, NONE, bindSceneReturn( &JobWhm001::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, NONE, bindSceneReturn( &JobWhm001::Scene00005Return ) ); + } + + void Scene00005Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8BH( 0 ); + eventMgr().sendEventNotice( player, getId(), 1, 0 ); + quest.setSeq( Seq3 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00006( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 6, NONE, bindSceneReturn( &JobWhm001::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, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, bindSceneReturn( &JobWhm001::Scene00007Return ) ); + } + + void Scene00007Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + //TODO: Unlock "A Relic Reborn: The Chimera" + eventMgr().sendEventNotice( player, getId(), 2, 0 ); + quest.setSeq( Seq4 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00008( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 8, NONE, bindSceneReturn( &JobWhm001::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, NONE, bindSceneReturn( &JobWhm001::Scene00009Return ) ); + } + + void Scene00009Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + Scene00010( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00010( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 10, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, bindSceneReturn( &JobWhm001::Scene00010Return ) ); + } + + void Scene00010Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8BH( 0 ); + eventMgr().sendEventNotice( player, getId(), 4, 0 ); + quest.setSeq( Seq6 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00011( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 11, NONE, bindSceneReturn( &JobWhm001::Scene00011Return ) ); + } + + void Scene00011Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 5, 0 ); + quest.setSeq( Seq7 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00012( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 12, NONE, bindSceneReturn( &JobWhm001::Scene00012Return ) ); + } + + void Scene00012Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + Scene00013( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00013( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 13, NONE, bindSceneReturn( &JobWhm001::Scene00013Return ) ); + } + + void Scene00013Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 7, 0 );//TODO: Item Icon + quest.setSeq( Seq9 ); + quest.setUI8BH( 1 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00014( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 14, NONE, bindSceneReturn( &JobWhm001::Scene00014Return ) ); + } + + void Scene00014Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + Scene00015( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00015( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 15, NONE, bindSceneReturn( &JobWhm001::Scene00015Return ) ); + } + + void Scene00015Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8BH( 0 ); + eventMgr().sendEventNotice( player, getId(), 8, 0 );//TODO: Item Icon? + player.addItem( Ritem1 ); + quest.setSeq( Seq10 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00016( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 16, NONE, bindSceneReturn( &JobWhm001::Scene00016Return ) ); + } + + void Scene00016Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + player.addItem( Ritem1 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00017( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 17, NONE, bindSceneReturn( &JobWhm001::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, NONE, bindSceneReturn( &JobWhm001::Scene00018Return ) ); + } + + void Scene00018Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 12, 0 ); + quest.setSeq( Seq12 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00019( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 19, NONE, bindSceneReturn( &JobWhm001::Scene00019Return ) ); + } + + void Scene00019Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + player.addItem( Ritem1 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00020( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 20, NONE, bindSceneReturn( &JobWhm001::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, NONE, bindSceneReturn( &JobWhm001::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, NONE, bindSceneReturn( &JobWhm001::Scene00022Return ) ); + } + + void Scene00022Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 14, 0 ); + quest.setSeq( Seq14 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00023( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 23, NONE, bindSceneReturn( &JobWhm001::Scene00023Return ) ); + } + + void Scene00023Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + Scene00024( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00024( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 24, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, bindSceneReturn( &JobWhm001::Scene00024Return ) ); + } + + void Scene00024Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( player.collectHandInItems( { Ritem1 } ) ) + { + eventMgr().sendEventNotice( player, getId(), 15, 0 ); + quest.setSeq( Seq15 ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00025( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 25, NONE, bindSceneReturn( &JobWhm001::Scene00025Return ) ); + } + + void Scene00025Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + player.addItem( Ritem1 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00026( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 26, NONE, bindSceneReturn( &JobWhm001::Scene00026Return ) ); + } + + void Scene00026Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00027( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 27, NONE, bindSceneReturn( &JobWhm001::Scene00027Return ) ); + } + + void Scene00027Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00028( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 28, NONE, bindSceneReturn( &JobWhm001::Scene00028Return ) ); + } + + void Scene00028Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00029( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 29, NONE, bindSceneReturn( &JobWhm001::Scene00029Return ) ); + } + + void Scene00029Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + Scene00030( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00030( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 30, NONE, bindSceneReturn( &JobWhm001::Scene00030Return ) ); + } + + void Scene00030Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8BH( 0 ); + quest.setUI8BL( 0 ); + quest.setUI8CH( 0 ); + eventMgr().sendEventNotice( player, getId(), 19, 0 ); + quest.setSeq( SeqFinish ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00031( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 31, NONE, bindSceneReturn( &JobWhm001::Scene00031Return ) ); + } + + void Scene00031Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + Scene00032( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00032( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 32, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, bindSceneReturn( &JobWhm001::Scene00032Return ) ); + } + + void Scene00032Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + if( player.collectHandInItems( { Ritem2 } ) ) + player.finishQuest( getId() ); + } + } +}; + +EXPOSE_SCRIPT( JobWhm001 ); \ No newline at end of file diff --git a/src/scripts/quest/subquest/thanalan_west/SubWil142.cpp b/src/scripts/quest/subquest/thanalan_west/SubWil142.cpp new file mode 100644 index 00000000..a2914859 --- /dev/null +++ b/src/scripts/quest/subquest/thanalan_west/SubWil142.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 "Manager/EventMgr.h" +#include +#include +#include + +// Quest Script: SubWil142_00705 +// Quest Name: The Weaponsmith of Legend +// Quest ID: 66241 +// Start NPC: 1005021 +// End NPC: 1003075 + +using namespace Sapphire; + +class SubWil142 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // UI8AL + // UI8BH + + /// Countable Num: 0 Seq: 1 Event: 1 Listener: 1001304 + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 1003075 + // 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 = 1005021;//Nedrick Ironheart + static constexpr auto Actor1 = 1001304;//Rowena + static constexpr auto Actor2 = 1003075; + static constexpr auto Item0 = 2000987; + static constexpr auto LocAction1 = 682; + +public: + SubWil142() : Sapphire::ScriptAPI::QuestScript( 66241 ){}; + ~SubWil142() = 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, NONE, bindSceneReturn( &SubWil142::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, NONE, bindSceneReturn( &SubWil142::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, NONE, bindSceneReturn( &SubWil142::Scene00002Return ) ); + } + + void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8BH( 1 ); + quest.setSeq( SeqFinish ); + eventMgr().sendEventNotice( player, getId(), 0, 0 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00003( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 3, NONE, bindSceneReturn( &SubWil142::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + Scene00004( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00004( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 4, NONE, bindSceneReturn( &SubWil142::Scene00004Return ) ); + } + + void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + player.finishQuest( getId() ); + } + } +}; + +EXPOSE_SCRIPT( SubWil142 ); \ No newline at end of file From 50b288f8c93f6967d3dba96964f9ec54b05cb2d5 Mon Sep 17 00:00:00 2001 From: dude22072 Date: Tue, 17 Jan 2023 00:24:25 -0600 Subject: [PATCH 06/22] Update JobWhm001.cpp --- src/scripts/quest/classquest/WHM/JobWhm001.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/quest/classquest/WHM/JobWhm001.cpp b/src/scripts/quest/classquest/WHM/JobWhm001.cpp index 22d8a59d..0c607406 100644 --- a/src/scripts/quest/classquest/WHM/JobWhm001.cpp +++ b/src/scripts/quest/classquest/WHM/JobWhm001.cpp @@ -714,7 +714,7 @@ private: if( result.getResult( 0 ) == 1 ) { if( player.collectHandInItems( { Ritem2 } ) ) - player.finishQuest( getId() ); + player.finishQuest( getId() ); //TODO: Achievement } } }; From 8af39dfeb86a31ed82d567da2763a6efda960e3f Mon Sep 17 00:00:00 2001 From: Mordred Date: Tue, 17 Jan 2023 08:28:06 +0100 Subject: [PATCH 07/22] Clang tidy cleanups --- src/world/Actor/BNpc.cpp | 22 +++++++--------------- src/world/Actor/BNpc.h | 4 ++-- src/world/Actor/Chara.cpp | 17 ++++++++--------- src/world/Actor/EventObject.cpp | 7 ++++--- src/world/Actor/EventObject.h | 2 +- src/world/Actor/GameObject.cpp | 5 ----- src/world/Actor/Npc.cpp | 3 --- src/world/Actor/Player.cpp | 10 ++++------ src/world/Actor/PlayerEvent.cpp | 11 ++++------- src/world/Actor/PlayerInventory.cpp | 12 +++++------- src/world/Actor/PlayerQuest.cpp | 7 +------ src/world/Actor/PlayerSql.cpp | 2 -- src/world/Territory/Territory.cpp | 2 +- 13 files changed, 37 insertions(+), 67 deletions(-) diff --git a/src/world/Actor/BNpc.cpp b/src/world/Actor/BNpc.cpp index cb812358..aa7b55bb 100644 --- a/src/world/Actor/BNpc.cpp +++ b/src/world/Actor/BNpc.cpp @@ -4,9 +4,7 @@ #include #include #include -#include #include -#include #include #include "Forwards.h" @@ -18,24 +16,20 @@ #include "Network/PacketWrappers/ActorControlPacket.h" #include "Network/PacketWrappers/ActorControlSelfPacket.h" #include "Network/PacketWrappers/ActorControlTargetPacket.h" -#include "Network/PacketWrappers/UpdateHpMpTpPacket.h" #include "Network/PacketWrappers/NpcSpawnPacket.h" #include "Network/PacketWrappers/MoveActorPacket.h" #include "Navi/NaviProvider.h" -#include "Math/CalcBattle.h" #include "Math/CalcStats.h" #include "WorldServer.h" #include "Session.h" #include "Chara.h" -#include "Player.h" #include "BNpc.h" #include "Common.h" #include -#include #include #include #include @@ -55,7 +49,7 @@ Sapphire::Entity::BNpc::BNpc() : { } -Sapphire::Entity::BNpc::BNpc( uint32_t id, std::shared_ptr< Common::BNPCInstanceObject > pInfo, TerritoryPtr pZone ) : +Sapphire::Entity::BNpc::BNpc( uint32_t id, std::shared_ptr< Common::BNPCInstanceObject > pInfo, const Territory& zone ) : Npc( ObjKind::BattleNpc ) { m_id = id; @@ -104,8 +98,8 @@ Sapphire::Entity::BNpc::BNpc( uint32_t id, std::shared_ptr< Common::BNPCInstance m_class = ClassJob::Gladiator; - m_territoryTypeId = pZone->getTerritoryTypeId(); - m_territoryId = pZone->getGuId(); + m_territoryTypeId = zone.getTerritoryTypeId(); + m_territoryId = zone.getGuId(); m_spawnPos = m_pos; @@ -173,7 +167,7 @@ Sapphire::Entity::BNpc::BNpc( uint32_t id, std::shared_ptr< Common::BNPCInstance } -Sapphire::Entity::BNpc::BNpc( uint32_t id, std::shared_ptr< Common::BNPCInstanceObject > pInfo, TerritoryPtr pZone, uint32_t hp, Common::BNpcType type ) : +Sapphire::Entity::BNpc::BNpc( uint32_t id, std::shared_ptr< Common::BNPCInstanceObject > pInfo, const Territory& zone, uint32_t hp, Common::BNpcType type ) : Npc( ObjKind::BattleNpc ) { m_id = id; @@ -201,8 +195,8 @@ Sapphire::Entity::BNpc::BNpc( uint32_t id, std::shared_ptr< Common::BNPCInstance m_flags = 0; m_rank = pInfo->BNPCRankId; - m_territoryTypeId = pZone->getTerritoryTypeId(); - m_territoryId = pZone->getGuId(); + m_territoryTypeId = zone.getTerritoryTypeId(); + m_territoryId = zone.getGuId(); if( pInfo->WanderingRange == 0 || pInfo->BoundInstanceID != 0 ) setFlag( Immobile ); @@ -588,7 +582,6 @@ bool Sapphire::Entity::BNpc::hateListHasActor( const Sapphire::Entity::CharaPtr& { return std::any_of( m_hateList.begin(), m_hateList.end(), [ pChara ]( const auto& entry ) { return entry->m_pChara == pChara; } ); - return false; } void Sapphire::Entity::BNpc::aggro( const Sapphire::Entity::CharaPtr& pChara ) @@ -832,7 +825,6 @@ void Sapphire::Entity::BNpc::onActionHostile( Sapphire::Entity::CharaPtr pSource void Sapphire::Entity::BNpc::onDeath() { - auto& server = Common::Service< World::WorldServer >::ref(); auto& playerMgr = Common::Service< World::Manager::PlayerMgr >::ref(); auto& taskMgr = Common::Service< World::Manager::TaskMgr >::ref(); @@ -893,7 +885,7 @@ void Sapphire::Entity::BNpc::checkAggro() if( levelDiff >= 10 ) range = 0.f; else - range = std::max< float >( 0.f, range - std::pow( 1.53f, levelDiff * 0.6f ) ); + range = std::max< float >( 0.f, range - std::pow( 1.53f, static_cast< float >( levelDiff ) * 0.6f ) ); } auto distance = Util::distance( getPos(), pClosestChara->getPos() ); diff --git a/src/world/Actor/BNpc.h b/src/world/Actor/BNpc.h index c15aa6b3..21445229 100644 --- a/src/world/Actor/BNpc.h +++ b/src/world/Actor/BNpc.h @@ -64,8 +64,8 @@ namespace Sapphire::Entity public: BNpc(); - BNpc( uint32_t id, std::shared_ptr< Common::BNPCInstanceObject > pInfo, TerritoryPtr pZone ); - BNpc( uint32_t id, std::shared_ptr< Common::BNPCInstanceObject > pInfo, TerritoryPtr pZone, uint32_t hp, Common::BNpcType type ); + BNpc( uint32_t id, std::shared_ptr< Common::BNPCInstanceObject > pInfo, const Territory& zone ); + BNpc( uint32_t id, std::shared_ptr< Common::BNPCInstanceObject > pInfo, const Territory& zone, uint32_t hp, Common::BNpcType type ); virtual ~BNpc() override; diff --git a/src/world/Actor/Chara.cpp b/src/world/Actor/Chara.cpp index 25c3cfcf..e65aacf0 100644 --- a/src/world/Actor/Chara.cpp +++ b/src/world/Actor/Chara.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include #include @@ -13,7 +12,6 @@ #include "Network/GameConnection.h" #include "Network/PacketWrappers/ActorControlPacket.h" -#include "Network/PacketWrappers/ActorControlSelfPacket.h" #include "Network/PacketWrappers/ActorControlTargetPacket.h" #include "Network/PacketWrappers/UpdateHpMpTpPacket.h" #include "Network/PacketWrappers/EffectPacket1.h" @@ -60,7 +58,7 @@ Sapphire::Entity::Chara::~Chara() /*! \return the actors name */ std::string Sapphire::Entity::Chara::getName() const { - return std::string( m_name ); + return { m_name }; } @@ -539,7 +537,7 @@ void Sapphire::Entity::Chara::addStatusEffect( StatusEffect::StatusEffectPtr pEf status.Time = static_cast< float >( pEffect->getDuration() ) / 1000; status.Id = static_cast< uint16_t >( pEffect->getId() ); status.Slot = static_cast< uint8_t >( nextSlot ); - status.SystemParam = pEffect->getParam(); + status.SystemParam = static_cast< int16_t >( pEffect->getParam() ); sendToInRangeSet( statusEffectAdd, isPlayer() ); } @@ -585,7 +583,7 @@ void Sapphire::Entity::Chara::statusEffectFreeSlot( uint8_t slotId ) void Sapphire::Entity::Chara::removeSingleStatusEffectById( uint32_t id ) { - for( auto effectIt : m_statusEffectMap ) + for( const auto& effectIt : m_statusEffectMap ) { if( effectIt.second->getId() == id ) { @@ -645,7 +643,7 @@ void Sapphire::Entity::Chara::sendStatusEffectUpdate() auto statusEffectList = makeZonePacket< FFXIVIpcStatus >( getId() ); uint8_t slot = 0; - for( auto effectIt : m_statusEffectMap ) + for( const auto& effectIt : m_statusEffectMap ) { float timeLeft = static_cast< float >( effectIt.second->getDuration() - ( currentTimeMs - effectIt.second->getStartTimeMs() ) ) / 1000; @@ -663,7 +661,7 @@ void Sapphire::Entity::Chara::updateStatusEffects() { uint64_t currentTimeMs = Util::getTimeMs(); - for( auto effectIt : m_statusEffectMap ) + for( const auto& effectIt : m_statusEffectMap ) { uint8_t effectIndex = effectIt.first; auto effect = effectIt.second; @@ -710,7 +708,8 @@ uint32_t Sapphire::Entity::Chara::getLastComboActionId() const // initially check for the time passed first, if it's more than the threshold just return 0 for the combo // we can hide the implementation detail this way and it just works:tm: for anything that uses it - if( std::difftime( Util::getTimeMs(), m_lastComboActionTime ) > Common::MAX_COMBO_LENGTH ) + if( std::difftime( static_cast< time_t >( Util::getTimeMs() ), + static_cast< time_t >( m_lastComboActionTime ) ) > Common::MAX_COMBO_LENGTH ) { return 0; } @@ -791,7 +790,7 @@ void Sapphire::Entity::Chara::onTick() uint32_t thisTickDmg = 0; uint32_t thisTickHeal = 0; - for( auto effectIt : m_statusEffectMap ) + for( const auto& effectIt : m_statusEffectMap ) { auto thisEffect = effectIt.second->getTickEffect(); switch( thisEffect.first ) diff --git a/src/world/Actor/EventObject.cpp b/src/world/Actor/EventObject.cpp index fe8fd951..86eda35d 100644 --- a/src/world/Actor/EventObject.cpp +++ b/src/world/Actor/EventObject.cpp @@ -4,7 +4,6 @@ #include "Actor/Player.h" #include "Network/PacketWrappers/ActorControlPacket.h" -#include "Network/PacketWrappers/ActorControlSelfPacket.h" #include "Network/PacketWrappers/ActorControlTargetPacket.h" #include @@ -13,6 +12,8 @@ #include #include + +#include #include "WorldServer.h" #include "Session.h" #include "Network/GameConnection.h" @@ -70,7 +71,7 @@ Sapphire::Entity::EventObject::OnTalkEventHandler Sapphire::Entity::EventObject: void Sapphire::Entity::EventObject::setOnTalkHandler( Sapphire::Entity::EventObject::OnTalkEventHandler handler ) { - m_onTalkEventHandler = handler; + m_onTalkEventHandler = std::move( handler ); } void Sapphire::Entity::EventObject::setGimmickId( uint32_t gimmickId ) @@ -111,7 +112,7 @@ uint32_t Sapphire::Entity::EventObject::getHousingLink() const void Sapphire::Entity::EventObject::setParentInstance( Sapphire::TerritoryPtr instance ) { - m_parentInstance = instance; + m_parentInstance = std::move( instance ); } Sapphire::TerritoryPtr Sapphire::Entity::EventObject::getParentInstance() const diff --git a/src/world/Actor/EventObject.h b/src/world/Actor/EventObject.h index 85602924..5984d034 100644 --- a/src/world/Actor/EventObject.h +++ b/src/world/Actor/EventObject.h @@ -62,7 +62,7 @@ namespace Sapphire::Entity uint32_t m_ownerId; uint8_t m_state; uint8_t m_permissionInvisibility; - float m_scale; + float m_scale{}; std::string m_name; TerritoryPtr m_parentInstance; OnTalkEventHandler m_onTalkEventHandler; diff --git a/src/world/Actor/GameObject.cpp b/src/world/Actor/GameObject.cpp index f3aac262..fba59b34 100644 --- a/src/world/Actor/GameObject.cpp +++ b/src/world/Actor/GameObject.cpp @@ -2,7 +2,6 @@ #include -#include #include #include #include @@ -23,8 +22,6 @@ #include "StatusEffect/StatusEffect.h" -#include "Math/CalcBattle.h" - using namespace Sapphire::Common; using namespace Sapphire::Network::Packets; //using namespace Sapphire::Network::Packets::Server; @@ -245,8 +242,6 @@ void Sapphire::Entity::GameObject::removeFromInRange() if( !hasInRangeActor() ) return; - Entity::GameObjectPtr pCurAct; - for( auto& pCurAct : m_inRangeActor ) { pCurAct->removeInRangeActor( *this ); diff --git a/src/world/Actor/Npc.cpp b/src/world/Actor/Npc.cpp index 84edeaa8..4ff64afa 100644 --- a/src/world/Actor/Npc.cpp +++ b/src/world/Actor/Npc.cpp @@ -1,10 +1,7 @@ #include -#include #include "Action/Action.h" #include "Territory/Territory.h" -#include "Network/PacketWrappers/UpdateHpMpTpPacket.h" -#include "WorldServer.h" #include "Player.h" #include "Npc.h" #include "Common.h" diff --git a/src/world/Actor/Player.cpp b/src/world/Actor/Player.cpp index 6eb5f3f1..827a71da 100644 --- a/src/world/Actor/Player.cpp +++ b/src/world/Actor/Player.cpp @@ -34,10 +34,8 @@ #include "Network/PacketWrappers/PlayerSetupPacket.h" #include "Network/PacketWrappers/PlayerSpawnPacket.h" -#include "Network/PacketWrappers/EffectPacket.h" #include "Network/PacketWrappers/EffectPacket1.h" #include "Network/PacketWrappers/InitZonePacket.h" -#include "Network/PacketWrappers/WarpPacket.h" #include "Action/Action.h" @@ -93,12 +91,12 @@ Player::Player() : m_invincibilityType = InvincibilityType::InvincibilityNone; m_radius = 1.f; - std::memset( m_questTracking.data(), 0, sizeof( m_questTracking ) ); memset( m_name, 0, sizeof( m_name ) ); - memset( m_stateFlags.data(), 0, m_stateFlags.size() ); memset( m_searchMessage, 0, sizeof( m_searchMessage ) ); - memset( m_classArray.data(), 0, sizeof( m_classArray.data() ) ); - memset( m_expArray.data(), 0, sizeof( m_expArray.data() ) ); + std::fill( std::begin( m_questTracking ), std::end( m_questTracking ), 0 ); + std::fill( std::begin( m_stateFlags ), std::end( m_stateFlags ), 0 ); + std::fill( std::begin( m_classArray ), std::end( m_classArray ), 0 ); + std::fill( std::begin( m_expArray ), std::end( m_expArray ), 0 ); for( uint8_t i = 0; i < 80; ++i ) { diff --git a/src/world/Actor/PlayerEvent.cpp b/src/world/Actor/PlayerEvent.cpp index 18f747e6..188e60ac 100644 --- a/src/world/Actor/PlayerEvent.cpp +++ b/src/world/Actor/PlayerEvent.cpp @@ -1,7 +1,4 @@ -#include - #include -#include #include #include @@ -70,14 +67,14 @@ void Sapphire::Entity::Player::onTick() if( !isAlive() || !isLoadingComplete() ) return; - uint32_t addHp = static_cast< uint32_t >( getMaxHp() * 0.1f + 1 ); - uint32_t addMp = static_cast< uint32_t >( getMaxMp() * 0.06f + 1 ); + auto addHp = static_cast< uint32_t >( static_cast< float >( getMaxHp() ) * 0.1f + 1 ); + auto addMp = static_cast< uint32_t >( static_cast< float >( getMaxMp() ) * 0.06f + 1 ); uint32_t addTp = 100; if( !m_actorIdTohateSlotMap.empty() ) { - addHp = static_cast< uint32_t >( getMaxHp() * 0.01f + 1 ); - addMp = static_cast< uint32_t >( getMaxMp() * 0.02f + 1 ); + addHp = static_cast< uint32_t >( static_cast< float >( getMaxHp() ) * 0.01f + 1 ); + addMp = static_cast< uint32_t >( static_cast< float >( getMaxMp() ) * 0.02f + 1 ); addTp = 60; } diff --git a/src/world/Actor/PlayerInventory.cpp b/src/world/Actor/PlayerInventory.cpp index 99e481c3..1d5118c1 100644 --- a/src/world/Actor/PlayerInventory.cpp +++ b/src/world/Actor/PlayerInventory.cpp @@ -9,7 +9,6 @@ #include "Inventory/ItemContainer.h" #include -#include #include #include "Actor/Player.h" @@ -18,7 +17,6 @@ #include "Network/PacketWrappers/ActorControlPacket.h" #include "Network/PacketWrappers/ActorControlSelfPacket.h" #include "Network/PacketWrappers/UpdateInventorySlotPacket.h" -#include "Network/PacketWrappers/ServerNoticePacket.h" #include #include "Manager/InventoryMgr.h" @@ -438,9 +436,9 @@ void Sapphire::Entity::Player::sendInventory() { auto& invMgr = Common::Service< World::Manager::InventoryMgr >::ref(); - for( auto it = m_storageMap.begin(); it != m_storageMap.end(); ++it ) + for( auto& it : m_storageMap ) { - invMgr.sendInventoryContainer( *this, it->second ); + invMgr.sendInventoryContainer( *this, it.second ); } } @@ -450,7 +448,7 @@ Sapphire::Entity::Player::InvSlotPairVec Sapphire::Entity::Player::getSlotsOfIte for( auto i : { Bag0, Bag1, Bag2, Bag3 } ) { auto inv = m_storageMap[ i ]; - for( auto item : inv->getItemMap() ) + for( const auto& item : inv->getItemMap() ) { if( item.second && item.second->getId() == catalogId ) outVec.push_back( std::make_pair( i, static_cast< int8_t >( item.first ) ) ); @@ -1046,7 +1044,7 @@ void Sapphire::Entity::Player::addSoldItem( uint32_t itemId, uint8_t stackSize ) { if( m_soldItems.size() > 10 ) m_soldItems.pop_back(); - m_soldItems.push_front( std::make_pair( itemId, stackSize ) ); + m_soldItems.emplace_front( itemId, stackSize ); } std::deque< std::pair< uint32_t, uint8_t > > *Sapphire::Entity::Player::getSoldItems() @@ -1069,7 +1067,7 @@ bool Sapphire::Entity::Player::getFreeInventoryContainerSlot( Inventory::Invento auto& container = needle->second; - for( uint8_t idx = 0; idx < container->getMaxSize(); idx++ ) + for( uint16_t idx = 0; idx < container->getMaxSize(); idx++ ) { auto item = container->getItem( idx ); if( !item ) diff --git a/src/world/Actor/PlayerQuest.cpp b/src/world/Actor/PlayerQuest.cpp index 1cade20b..15ce8c11 100644 --- a/src/world/Actor/PlayerQuest.cpp +++ b/src/world/Actor/PlayerQuest.cpp @@ -1,15 +1,11 @@ -#include #include #include -#include #include -#include "Network/GameConnection.h" #include "Network/PacketWrappers/Notice2Packet.h" #include "Manager/QuestMgr.h" -#include "Session.h" #include "Player.h" @@ -118,8 +114,7 @@ bool Sapphire::Entity::Player::addQuest( const World::Quest& quest ) int8_t Sapphire::Entity::Player::getFreeQuestSlot() { - int8_t idx = 0; - int result = -1; + int8_t result = -1; for( int8_t idx = 0; idx < 30; idx++ ) if( m_quests[ idx ].getId() == 0 ) { diff --git a/src/world/Actor/PlayerSql.cpp b/src/world/Actor/PlayerSql.cpp index 3ae159b0..07695d46 100644 --- a/src/world/Actor/PlayerSql.cpp +++ b/src/world/Actor/PlayerSql.cpp @@ -3,14 +3,12 @@ #include #include #include -#include #include #include #include "Network/PacketWrappers/PlayerSetupPacket.h" #include "Manager/TerritoryMgr.h" -#include "Territory/Territory.h" #include "Inventory/Item.h" #include "Inventory/ItemContainer.h" #include "Manager/ItemMgr.h" diff --git a/src/world/Territory/Territory.cpp b/src/world/Territory/Territory.cpp index c7d1d94a..72d7fe02 100644 --- a/src/world/Territory/Territory.cpp +++ b/src/world/Territory/Territory.cpp @@ -828,7 +828,7 @@ Entity::BNpcPtr Territory::createBNpcFromLayoutId( uint32_t levelId, uint32_t hp if( infoPtr == m_bNpcBaseMap.end() ) return nullptr; - auto pBNpc = std::make_shared< Entity::BNpc >( getNextActorId(), infoPtr->second, shared_from_this(), hp, bnpcType ); + auto pBNpc = std::make_shared< Entity::BNpc >( getNextActorId(), infoPtr->second, *this, hp, bnpcType ); pBNpc->setTriggerOwnerId( triggerOwnerId ); pushActor( pBNpc ); return pBNpc; From 436c04993ff3f22f70da5b667b999427be9a9921 Mon Sep 17 00:00:00 2001 From: Mordred Date: Tue, 17 Jan 2023 08:29:07 +0100 Subject: [PATCH 08/22] Missed a zone conversion --- src/world/Territory/Territory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/world/Territory/Territory.cpp b/src/world/Territory/Territory.cpp index 72d7fe02..c2a0c938 100644 --- a/src/world/Territory/Territory.cpp +++ b/src/world/Territory/Territory.cpp @@ -803,7 +803,7 @@ void Territory::updateSpawnPoints() { if( !spawn.bnpcPtr && ( Common::Util::getTimeSeconds() - spawn.timeOfDeath ) > spawn.infoPtr->PopInterval ) { - auto pBNpc = std::make_shared< Entity::BNpc >( getNextActorId(), spawn.infoPtr, shared_from_this() ); + auto pBNpc = std::make_shared< Entity::BNpc >( getNextActorId(), spawn.infoPtr, *this ); pBNpc->init(); spawn.bnpcPtr = pBNpc; From a02e58fd35eb5e9a0387202fb67ce45a74bf768d Mon Sep 17 00:00:00 2001 From: Mordred Date: Tue, 17 Jan 2023 11:27:25 +0100 Subject: [PATCH 09/22] More overall cleanup and warning reductions --- src/world/Action/Action.cpp | 2 +- src/world/Manager/DebugCommandMgr.cpp | 43 +++++++++++++-------------- src/world/Manager/EventMgr.cpp | 16 ++++------ src/world/Manager/FriendListMgr.cpp | 3 -- src/world/Manager/HousingMgr.cpp | 19 ++++-------- src/world/Manager/InventoryMgr.cpp | 20 ++++++------- src/world/Manager/ItemMgr.cpp | 4 +-- src/world/Manager/LinkshellMgr.cpp | 14 +++------ src/world/Manager/LinkshellMgr.h | 2 +- src/world/Manager/MarketMgr.cpp | 4 --- src/world/Manager/PartyMgr.cpp | 3 +- src/world/Manager/PlayerMgr.cpp | 5 +--- src/world/Manager/QuestMgr.cpp | 3 -- src/world/Manager/ShopMgr.cpp | 1 - src/world/Manager/TerritoryMgr.cpp | 11 ++++--- src/world/Manager/WarpMgr.cpp | 4 --- 16 files changed, 57 insertions(+), 97 deletions(-) diff --git a/src/world/Action/Action.cpp b/src/world/Action/Action.cpp index d5163fc8..d7394234 100644 --- a/src/world/Action/Action.cpp +++ b/src/world/Action/Action.cpp @@ -42,7 +42,7 @@ using namespace Sapphire::World; Action::Action::Action() = default; Action::Action::~Action() = default; -Action::Action::Action( Entity::CharaPtr caster, uint32_t actionId, uint16_t sequence) : +Action::Action::Action( Entity::CharaPtr caster, uint32_t actionId, uint16_t sequence ) : Action( std::move( caster ), actionId, sequence, nullptr ) { } diff --git a/src/world/Manager/DebugCommandMgr.cpp b/src/world/Manager/DebugCommandMgr.cpp index db0886eb..7215954f 100644 --- a/src/world/Manager/DebugCommandMgr.cpp +++ b/src/world/Manager/DebugCommandMgr.cpp @@ -78,8 +78,8 @@ DebugCommandMgr::DebugCommandMgr() // clear all loaded commands DebugCommandMgr::~DebugCommandMgr() { - for( auto it = m_commandMap.begin(); it != m_commandMap.end(); ++it ) - ( *it ).second.reset(); + for( auto & it : m_commandMap ) + it.second.reset(); } // add a command set to the register map @@ -99,7 +99,7 @@ void DebugCommandMgr::execCommand( char* data, Entity::Player& player ) // check if the command has parameters std::string tmpCommand = std::string( data ); - std::size_t pos = tmpCommand.find_first_of( " " ); + std::size_t pos = tmpCommand.find_first_of( ' ' ); if( pos != std::string::npos ) // command has parameters, grab the first part @@ -139,7 +139,7 @@ void DebugCommandMgr::execCommand( char* data, Entity::Player& player ) void DebugCommandMgr::help( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command ) { PlayerMgr::sendDebug( player, "Registered debug commands:" ); - for( auto cmd : m_commandMap ) + for( const auto& cmd : m_commandMap ) { if( player.getGmRank() >= cmd.second->m_gmLevel ) { @@ -156,13 +156,13 @@ void DebugCommandMgr::set( char* data, Entity::Player& player, std::shared_ptr< auto pCurrentZone = terriMgr.getTerritoryByGuId( player.getTerritoryId() ); auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref(); - std::string subCommand = ""; - std::string params = ""; + std::string subCommand; + std::string params; // check if the command has parameters std::string tmpCommand = std::string( data + command->getName().length() + 1 ); - std::size_t pos = tmpCommand.find_first_of( " " ); + std::size_t pos = tmpCommand.find_first_of( ' ' ); if( pos != std::string::npos ) // command has parameters, grab the first part @@ -176,7 +176,7 @@ void DebugCommandMgr::set( char* data, Entity::Player& player, std::shared_ptr< Logger::debug( "[{0}] subCommand: {1} params: {1}", player.getId(), subCommand, params ); - if( ( ( subCommand == "pos" ) || ( subCommand == "posr" ) ) && ( params != "" ) ) + if( ( ( subCommand == "pos" ) || ( subCommand == "posr" ) ) && ( !params.empty() ) ) { int32_t posX; int32_t posY; @@ -206,14 +206,14 @@ void DebugCommandMgr::set( char* data, Entity::Player& player, std::shared_ptr< pSession->getZoneConnection()->queueOutPacket( setActorPosPacket ); } - else if( ( subCommand == "tele" ) && ( params != "" ) ) + else if( ( subCommand == "tele" ) && ( !params.empty() ) ) { int32_t aetheryteId; sscanf( params.c_str(), "%i", &aetheryteId ); player.teleport( static_cast< uint16_t >( aetheryteId ) ); } - else if( ( subCommand == "discovery" ) && ( params != "" ) ) + else if( ( subCommand == "discovery" ) && ( !params.empty() ) ) { int32_t map_id; int32_t discover_id; @@ -392,12 +392,12 @@ void DebugCommandMgr::add( char* data, Entity::Player& player, std::shared_ptr< auto pCurrentZone = terriMgr.getTerritoryByGuId( player.getTerritoryId() ); std::string subCommand; - std::string params = ""; + std::string params; // check if the command has parameters std::string tmpCommand = std::string( data + command->getName().length() + 1 ); - std::size_t pos = tmpCommand.find_first_of( " " ); + std::size_t pos = tmpCommand.find_first_of( ' ' ); if( pos != std::string::npos ) // command has parameters, grab the first part @@ -566,12 +566,12 @@ void DebugCommandMgr::get( char* data, Entity::Player& player, std::shared_ptr< { auto& exdData = Common::Service< Data::ExdData >::ref(); std::string subCommand; - std::string params = ""; + std::string params; // check if the command has parameters std::string tmpCommand = std::string( data + command->getName().length() + 1 ); - std::size_t pos = tmpCommand.find_first_of( " " ); + std::size_t pos = tmpCommand.find_first_of( ' ' ); if( pos != std::string::npos ) // command has parameters, grab the first part @@ -624,12 +624,12 @@ void DebugCommandMgr::replay( char* data, Entity::Player& player, std::shared_pt auto& server = Common::Service< World::WorldServer >::ref(); std::string subCommand; - std::string params = ""; + std::string params; // check if the command has parameters std::string tmpCommand = std::string( data + command->getName().length() + 1 ); - std::size_t pos = tmpCommand.find_first_of( " " ); + std::size_t pos = tmpCommand.find_first_of( ' ' ); if( pos != std::string::npos ) // command has parameters, grab the first part @@ -681,7 +681,7 @@ void DebugCommandMgr::nudge( char* data, Entity::Player& player, std::shared_ptr // check if the command has parameters std::string tmpCommand = std::string( data + command->getName().length() + 1 ); - std::size_t spos = tmpCommand.find_first_of( " " ); + std::size_t spos = tmpCommand.find_first_of( ' ' ); auto& pos = player.getPos(); @@ -733,12 +733,12 @@ void DebugCommandMgr::script( char* data, Entity::Player& player, std::shared_pt { auto& scriptMgr = Common::Service< Scripting::ScriptMgr >::ref(); std::string subCommand; - std::string params = ""; + std::string params; // check if the command has parameters std::string tmpCommand = std::string( data + command->getName().length() + 1 ); - std::size_t pos = tmpCommand.find_first_of( " " ); + std::size_t pos = tmpCommand.find_first_of( ' ' ); if( pos != std::string::npos ) // command has parameters, grab the first part @@ -775,9 +775,8 @@ void DebugCommandMgr::script( char* data, Entity::Player& player, std::shared_pt { PlayerMgr::sendDebug( player, "Found {0} scripts", scripts.size() ); - for( auto it = scripts.begin(); it != scripts.end(); ++it ) + for( auto script : scripts ) { - auto script = *it; PlayerMgr::sendDebug( player, " - '{0}', num scripts: {1}", script->library_name, script->scripts.size() ); } } @@ -1411,7 +1410,7 @@ void DebugCommandMgr::easyWarp( char* data, Sapphire::Entity::Player& player, st // check if the command has parameters std::string tmpCommand = std::string( data + command->getName().length() + 1 ); - std::size_t pos = tmpCommand.find_first_of( " " ); + std::size_t pos = tmpCommand.find_first_of( ' ' ); if( pos != std::string::npos ) // command has parameters, grab the first part diff --git a/src/world/Manager/EventMgr.cpp b/src/world/Manager/EventMgr.cpp index 05cdd1de..79486695 100644 --- a/src/world/Manager/EventMgr.cpp +++ b/src/world/Manager/EventMgr.cpp @@ -6,7 +6,6 @@ #include "PlayerMgr.h" #include "ShopMgr.h" #include "Event/EventHandler.h" -#include "Event/Director.h" #include "Event/EventDefs.h" #include @@ -14,8 +13,6 @@ #include #include "Network/GameConnection.h" -#include "Network/PacketWrappers/ActorControlPacket.h" -#include "Network/PacketWrappers/PlayerSetupPacket.h" #include "Network/PacketWrappers/ServerNoticePacket.h" #include "Network/PacketWrappers/EventStartPacket.h" #include "Network/PacketWrappers/EventPlayPacket.h" @@ -26,7 +23,6 @@ #include "Territory/Territory.h" #include "Territory/InstanceContent.h" -#include "Territory/QuestBattle.h" #include "Action/EventAction.h" #include "WorldServer.h" @@ -53,7 +49,7 @@ std::string EventMgr::getEventName( uint32_t eventId ) return unknown + "Quest"; std::string name = questInfo->getString( questInfo->data().Text.Name ); - std::size_t pos = name.find_first_of( "_" ); + std::size_t pos = name.find_first_of( '_' ); return name.substr( 0, pos ); } @@ -64,7 +60,7 @@ std::string EventMgr::getEventName( uint32_t eventId ) return unknown + "CustomTalk"; std::string name = customTalkInfo->getString( customTalkInfo->data().Text.Name ); - std::size_t pos = name.find_first_of( "_" ); + std::size_t pos = name.find_first_of( '_' ); return name.substr( 0, pos ); } @@ -557,11 +553,11 @@ void EventMgr::playGilShop( Entity::Player& player, uint32_t eventId, uint32_t f params[ 1 ] = static_cast< uint32_t >( params.size() - 3 ); //new max item size auto& exdData = Common::Service< Data::ExdData >::ref(); - for( auto it = player.getSoldItems()->cbegin(); it != player.getSoldItems()->cend(); ++it ) + for( auto it : *player.getSoldItems() ) { - auto item = exdData.getRow< Excel::Item >( it->first ); - params.push_back( it->first ); //itemCatalogId - params.push_back( it->second ); //stack + auto item = exdData.getRow< Excel::Item >( it.first ); + params.push_back( it.first ); //itemCatalogId + params.push_back( it.second ); //stack params.push_back( item->data().Price ); //price params.push_back( 0 );//flag isHQ params.push_back( 0 );//numOfMateria diff --git a/src/world/Manager/FriendListMgr.cpp b/src/world/Manager/FriendListMgr.cpp index e711d9b1..ddf9b989 100644 --- a/src/world/Manager/FriendListMgr.cpp +++ b/src/world/Manager/FriendListMgr.cpp @@ -1,8 +1,5 @@ -#include #include -#include -#include #include #include "Actor/Player.h" diff --git a/src/world/Manager/HousingMgr.cpp b/src/world/Manager/HousingMgr.cpp index 539515c6..db44c1a7 100644 --- a/src/world/Manager/HousingMgr.cpp +++ b/src/world/Manager/HousingMgr.cpp @@ -19,12 +19,9 @@ #include "Event/EventDefs.h" #include "TerritoryMgr.h" -#include "Territory/Territory.h" #include "Territory/HousingZone.h" #include "Territory/Housing/HousingInteriorTerritory.h" -#include "HousingMgr.h" #include "EventMgr.h" -#include "TerritoryMgr.h" #include "Territory/Land.h" #include "WorldServer.h" #include "Territory/House.h" @@ -245,7 +242,7 @@ void HousingMgr::initLandCache() auto& containers = getEstateInventory( ident ); - auto makeContainer = [ &containers, this ]( Common::InventoryType type, uint16_t size ) + auto makeContainer = [ &containers ]( Common::InventoryType type, uint16_t size ) { containers[ type ] = make_ItemContainer( type, size, "houseiteminventory", false, false ); }; @@ -649,15 +646,15 @@ bool HousingMgr::initHouseModels( Entity::Player& player, LandPtr land, uint32_t { auto& container = houseInventory[ destContainer.first ]; - for( auto& item : destContainer.second ) + for( auto& itemIt : destContainer.second ) { // small houses attic is just 0, ignore them - if( item.second == 0 ) + if( itemIt.second == 0 ) continue; - auto pItem = invMgr.createItem( player, static_cast< uint32_t >( item.second ) ); + auto pItem = invMgr.createItem( player, static_cast< uint32_t >( itemIt.second ) ); - container->setItem( static_cast< uint8_t >( item.first ), pItem ); + container->setItem( static_cast< uint8_t >( itemIt.first ), pItem ); } invMgr.saveHousingContainer( land->getLandIdent(), container ); @@ -880,7 +877,6 @@ void HousingMgr::sendEstateInventory( Entity::Player& player, uint16_t inventory auto ident = internalZone->getLandIdent(); auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); - auto& teriMgr = Common::Service< TerritoryMgr >::ref(); auto pTeri = teriMgr.getTerritoryByGuId( landSetId ); auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri ); @@ -1028,7 +1024,6 @@ void HousingMgr::reqPlaceHousingItem( Entity::Player& player, uint16_t landId, u auto ident = zone->getLandIdent(); auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); - auto& teriMgr = Common::Service< TerritoryMgr >::ref(); auto pTeri = teriMgr.getTerritoryByGuId( landSetId ); auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri ); @@ -1104,7 +1099,6 @@ void HousingMgr::reqPlaceItemInStore( Entity::Player& player, uint16_t landId, u auto ident = zone->getLandIdent(); auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); - auto& teriMgr = Common::Service< TerritoryMgr >::ref(); auto pTeri = teriMgr.getTerritoryByGuId( landSetId ); auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri ); @@ -1232,7 +1226,7 @@ bool HousingMgr::placeInteriorItem( Entity::Player& player, Inventory::HousingIt invMgr.saveHousingContainer( ident, container ); invMgr.updateHousingItemPosition( item ); - auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( pZone ); + zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( pZone ); assert( zone ); zone->spawnHousingObject( containerIdx, static_cast< uint16_t >( freeSlot ), containerId, item ); @@ -1410,7 +1404,6 @@ void HousingMgr::reqRemoveHousingItem( Entity::Player& player, uint16_t plot, ui auto ident = terri->getLandIdent(); auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); - auto& teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref(); auto pTeri = teriMgr.getTerritoryByGuId( landSetId ); auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri ); diff --git a/src/world/Manager/InventoryMgr.cpp b/src/world/Manager/InventoryMgr.cpp index 35df61f1..4bf294f7 100644 --- a/src/world/Manager/InventoryMgr.cpp +++ b/src/world/Manager/InventoryMgr.cpp @@ -30,18 +30,18 @@ void InventoryMgr::sendInventoryContainer( Entity::Player& player, ItemContainer auto sequence = player.getNextInventorySequence(); auto pMap = container->getItemMap(); - for( auto itM = pMap.begin(); itM != pMap.end(); ++itM ) + for( auto & itM : pMap ) { - if( !itM->second ) + if( !itM.second ) return; if( container->getId() == Common::InventoryType::Currency || container->getId() == Common::InventoryType::Crystal ) { auto currencyInfoPacket = makeZonePacket< FFXIVIpcGilItem >( player.getId() ); currencyInfoPacket->data().contextId = sequence; - currencyInfoPacket->data().item.catalogId = itM->second->getId(); + currencyInfoPacket->data().item.catalogId = itM.second->getId(); currencyInfoPacket->data().item.subquarity = 1; - currencyInfoPacket->data().item.stack = itM->second->getStackSize(); + currencyInfoPacket->data().item.stack = itM.second->getStackSize(); currencyInfoPacket->data().item.storageId = container->getId(); currencyInfoPacket->data().item.containerIndex = 0; @@ -52,15 +52,15 @@ void InventoryMgr::sendInventoryContainer( Entity::Player& player, ItemContainer auto itemInfoPacket = makeZonePacket< FFXIVIpcNormalItem >( player.getId() ); itemInfoPacket->data().contextId = sequence; itemInfoPacket->data().item.storageId = container->getId(); - itemInfoPacket->data().item.containerIndex = itM->first; - itemInfoPacket->data().item.stack = itM->second->getStackSize(); - itemInfoPacket->data().item.catalogId = itM->second->getId(); - itemInfoPacket->data().item.durability = itM->second->getDurability(); + itemInfoPacket->data().item.containerIndex = itM.first; + itemInfoPacket->data().item.stack = itM.second->getStackSize(); + itemInfoPacket->data().item.catalogId = itM.second->getId(); + itemInfoPacket->data().item.durability = itM.second->getDurability(); // itemInfoPacket->data().spiritBond = itM->second->getSpiritbond(); // itemInfoPacket->data().reservedFlag = itM->second->getReservedFlag(); // todo: not sure if correct flag? - itemInfoPacket->data().item.flags = static_cast< uint8_t >( itM->second->isHq() ? 1 : 0 ); - itemInfoPacket->data().item.stain = itM->second->getStain(); + itemInfoPacket->data().item.flags = static_cast< uint8_t >( itM.second->isHq() ? 1 : 0 ); + itemInfoPacket->data().item.stain = static_cast< uint8_t >( itM.second->getStain() ); server.queueForPlayer( player.getCharacterId(), itemInfoPacket ); } diff --git a/src/world/Manager/ItemMgr.cpp b/src/world/Manager/ItemMgr.cpp index b96579a1..32ba611d 100644 --- a/src/world/Manager/ItemMgr.cpp +++ b/src/world/Manager/ItemMgr.cpp @@ -1,11 +1,9 @@ #include "ItemMgr.h" -#include "Inventory/ItemContainer.h" #include "Inventory/Item.h" #include #include -#include #include #include @@ -180,7 +178,7 @@ Common::ContainerType ItemMgr::getContainerType( uint32_t containerId ) uint32_t ItemMgr::getNextUId() { - uint32_t charId = 0; + uint32_t charId; auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref(); auto pQR = db.query( "SELECT MAX(ItemId) FROM charaglobalitem" ); diff --git a/src/world/Manager/LinkshellMgr.cpp b/src/world/Manager/LinkshellMgr.cpp index 3b81951b..29912da0 100644 --- a/src/world/Manager/LinkshellMgr.cpp +++ b/src/world/Manager/LinkshellMgr.cpp @@ -1,14 +1,11 @@ -#include #include #include #include -#include #include #include #include -#include #include #include @@ -20,7 +17,6 @@ #include "WorldServer.h" #include -#include #include #include #include @@ -48,7 +44,7 @@ bool LinkshellMgr::loadLinkshells() auto func = []( std::set< uint64_t >& outList, std::vector< char >& inData ) { - if( inData.size() ) + if( !inData.empty() ) { size_t entryCount = inData.size() / 8; std::vector< uint64_t > list( entryCount ); @@ -128,7 +124,7 @@ void LinkshellMgr::writeLinkshell( uint64_t lsId ) query->setBinary( 3, leaderBin ); query->setBinary( 4, inviteBin ); query->setUInt64( 5, ls->getMasterId() ); - query->setInt64( 6, lsId ); + query->setInt64( 6, static_cast< int64_t >( lsId ) ); db.execute( query ); } @@ -227,7 +223,7 @@ void LinkshellMgr::finishLinkshellAction( const std::string& name, uint32_t resu } -const std::vector< LinkshellPtr > LinkshellMgr::getPlayerLinkshells( Entity::Player& player ) const +std::vector< LinkshellPtr > LinkshellMgr::getPlayerLinkshells( Entity::Player& player ) const { std::vector< LinkshellPtr > lsVec; @@ -321,7 +317,7 @@ void LinkshellMgr::sendLinkshellList( Entity::Player& player ) for( int i = 0; i < lsVec.size(); ++i ) { auto pLs = lsVec[ i ]; - uint32_t hierarchy = 0; + uint32_t hierarchy; if( pLs->getMasterId() == player.getCharacterId() ) hierarchy = Common::Ls::LinkshellHierarchy::Master << 8; @@ -486,8 +482,6 @@ void LinkshellMgr::changeMaster( Entity::Player &sourcePlayer, Entity::Player &n bool LinkshellMgr::renameLinkshell( uint64_t linkshellId, const std::string &name, Entity::Player &player ) { - auto& server = Common::Service< World::WorldServer >::ref(); - auto lsPtr = getLinkshellById( linkshellId ); if( !lsPtr ) diff --git a/src/world/Manager/LinkshellMgr.h b/src/world/Manager/LinkshellMgr.h index 398fd09f..14b579a0 100644 --- a/src/world/Manager/LinkshellMgr.h +++ b/src/world/Manager/LinkshellMgr.h @@ -51,7 +51,7 @@ namespace Sapphire::World::Manager void sendLinkshellList( Entity::Player& player ); // get all linkshells associated with player - const std::vector< LinkshellPtr > getPlayerLinkshells( Entity::Player& player ) const; + std::vector< LinkshellPtr > getPlayerLinkshells( Entity::Player& player ) const; LinkshellPtr getLinkshellById( uint64_t lsId ); diff --git a/src/world/Manager/MarketMgr.cpp b/src/world/Manager/MarketMgr.cpp index 9578ea9a..ec48d013 100644 --- a/src/world/Manager/MarketMgr.cpp +++ b/src/world/Manager/MarketMgr.cpp @@ -1,9 +1,5 @@ #include "MarketMgr.h" -#include -#include - -#include #include #include diff --git a/src/world/Manager/PartyMgr.cpp b/src/world/Manager/PartyMgr.cpp index ed2fcbee..3365487e 100644 --- a/src/world/Manager/PartyMgr.cpp +++ b/src/world/Manager/PartyMgr.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include @@ -365,7 +364,7 @@ void PartyMgr::sendPartyUpdate( Party& party ) if( !classJob ) continue; - ZoneProtoDownPartyMember memberEntry; + ZoneProtoDownPartyMember memberEntry{}; memberEntry.ParentEntityId = Common::INVALID_GAME_OBJECT_ID; memberEntry.PetEntityId = Common::INVALID_GAME_OBJECT_ID; diff --git a/src/world/Manager/PlayerMgr.cpp b/src/world/Manager/PlayerMgr.cpp index 634d8df7..1f6bb526 100644 --- a/src/world/Manager/PlayerMgr.cpp +++ b/src/world/Manager/PlayerMgr.cpp @@ -7,7 +7,6 @@ #include #include -#include #include "Script/ScriptMgr.h" #include "WorldServer.h" @@ -23,14 +22,12 @@ #include #include #include -#include "Network/PacketWrappers/PlayerSetupPacket.h" #include "Network/PacketWrappers/ServerNoticePacket.h" #include "Network/PacketWrappers/ChatPacket.h" #include "Network/PacketWrappers/HudParamPacket.h" #include #include -#include "Territory/InstanceObjectCache.h" using namespace Sapphire; using namespace Sapphire::World::Manager; @@ -61,7 +58,6 @@ void PlayerMgr::onOnlineStatusChanged( Entity::Player& player, bool updateProfil void PlayerMgr::onEquipDisplayFlagsChanged( Entity::Player& player ) { - auto& server = Common::Service< World::WorldServer >::ref(); auto paramPacket = makeZonePacket< FFXIVIpcConfig >( player.getId() ); paramPacket->data().flag = player.getEquipDisplayFlags(); player.sendToInRangeSet( paramPacket, true ); @@ -80,6 +76,7 @@ void PlayerMgr::onSendStateFlags( Entity::Player& player, bool updateInRange ) void PlayerMgr::onSendStats( Entity::Player& player ) { std::array< uint32_t, 50 > statParams; + std::fill( std::begin( statParams ), std::end( statParams ), 0 ); auto& exd = Common::Service< Data::ExdData >::ref(); diff --git a/src/world/Manager/QuestMgr.cpp b/src/world/Manager/QuestMgr.cpp index e76119d3..c03f7ac1 100644 --- a/src/world/Manager/QuestMgr.cpp +++ b/src/world/Manager/QuestMgr.cpp @@ -1,12 +1,10 @@ #include #include -#include #include #include "WorldServer.h" #include -#include #include #include "Network/GameConnection.h" @@ -60,7 +58,6 @@ void QuestMgr::onRemoveQuest( Entity::Player &player, uint8_t questIndex ) bool QuestMgr::giveQuestRewards( Entity::Player& player, uint16_t questId, uint32_t optionalChoice ) { auto& exdData = Common::Service< Data::ExdData >::ref(); - uint32_t playerLevel = player.getLevel(); auto questInfo = exdData.getRow< Excel::Quest >( static_cast< uint32_t >( Event::EventHandler::EventHandlerType::Quest ) << 16 | questId ); if( !questInfo ) diff --git a/src/world/Manager/ShopMgr.cpp b/src/world/Manager/ShopMgr.cpp index 2c23293f..2edeec1c 100644 --- a/src/world/Manager/ShopMgr.cpp +++ b/src/world/Manager/ShopMgr.cpp @@ -54,7 +54,6 @@ uint32_t ShopMgr::getShopItemPrices( uint32_t shopId, uint8_t index ) return getShopItemPrices( shopId, index ); } - return 0; } bool ShopMgr::purchaseGilShopItem( Entity::Player& player, uint32_t shopId, uint16_t itemId, uint32_t quantity ) diff --git a/src/world/Manager/TerritoryMgr.cpp b/src/world/Manager/TerritoryMgr.cpp index 5502409a..2c830871 100644 --- a/src/world/Manager/TerritoryMgr.cpp +++ b/src/world/Manager/TerritoryMgr.cpp @@ -10,7 +10,6 @@ #include "Actor/Player.h" -#include "Territory/Territory.h" #include "Territory/InstanceContent.h" #include "Territory/QuestBattle.h" #include "TerritoryMgr.h" @@ -519,9 +518,9 @@ void TerritoryMgr::updateTerritoryInstances( uint64_t tickCount ) } // remove internal house zones with nobody in them - for( auto it = m_questBattleIdToInstanceMap.begin(); it != m_questBattleIdToInstanceMap.end(); ++it ) + for( auto & it : m_questBattleIdToInstanceMap ) { - for( auto inIt = it->second.begin(); inIt != it->second.end(); ) + for( auto inIt = it.second.begin(); inIt != it.second.end(); ) { auto zone = std::dynamic_pointer_cast< QuestBattle >( inIt->second ); if( !zone ) @@ -545,9 +544,9 @@ void TerritoryMgr::updateTerritoryInstances( uint64_t tickCount ) } - for( auto it = m_instanceContentIdToInstanceMap.begin(); it != m_instanceContentIdToInstanceMap.end(); ++it ) + for( auto& it : m_instanceContentIdToInstanceMap ) { - for( auto inIt = it->second.begin(); inIt != it->second.end(); ) + for( auto inIt = it.second.begin(); inIt != it.second.end(); ) { auto zone = std::dynamic_pointer_cast< InstanceContent >( inIt->second ); if( !zone ) @@ -668,7 +667,7 @@ void TerritoryMgr::createAndJoinQuestBattle( Entity::Player& player, uint16_t qu bool TerritoryMgr::joinWorld( Entity::Player& player ) { - TerritoryPtr pCurrZone = nullptr; + TerritoryPtr pCurrZone; auto territoryTypeId = player.getTerritoryTypeId(); diff --git a/src/world/Manager/WarpMgr.cpp b/src/world/Manager/WarpMgr.cpp index 324638f9..b5b23f97 100644 --- a/src/world/Manager/WarpMgr.cpp +++ b/src/world/Manager/WarpMgr.cpp @@ -1,4 +1,3 @@ -#include #include #include "TaskMgr.h" @@ -13,7 +12,6 @@ #include "Territory/Territory.h" #include "Network/PacketWrappers/ActorControlSelfPacket.h" #include "Network/PacketWrappers/ActorControlPacket.h" -#include "Network/PacketWrappers/WarpPacket.h" #include "Actor/Player.h" using namespace Sapphire::World::Manager; @@ -98,8 +96,6 @@ void WarpMgr::finishWarp( Entity::Player& player ) void WarpMgr::requestWarp( Entity::Player& player, Common::WarpType warpType, Common::FFXIVARR_POSITION3 targetPos, float targetRot ) { m_entityIdToWarpInfoMap[ player.getId() ] = { 0, warpType, targetPos, targetRot }; - auto& teriMgr = Common::Service< TerritoryMgr >::ref(); - auto& server = Common::Service< WorldServer >::ref(); player.sendToInRangeSet( makeActorControl( player.getId(), WarpStart, warpType, 1, 0, player.getTerritoryTypeId(), 1 ), true ); player.sendToInRangeSet( makeActorControl( player.getId(), ActorDespawnEffect, warpType ) ); From 409dc173c57b4b23e86e82c59eb6b818c2c7a1a6 Mon Sep 17 00:00:00 2001 From: Mordred Date: Tue, 17 Jan 2023 12:54:42 +0100 Subject: [PATCH 10/22] Even more cleanup --- src/world/Network/Handlers/ActionHandler.cpp | 2 -- src/world/Network/Handlers/BlacklistHandler.cpp | 3 --- src/world/Network/Handlers/CFHandlers.cpp | 9 +++------ src/world/Network/Handlers/CommonListHandler.cpp | 5 +---- src/world/Network/Handlers/EventHandlers.cpp | 13 ------------- src/world/Network/Handlers/FriendListHandlers.cpp | 2 -- src/world/Network/Handlers/GMCommandHandlers.cpp | 10 ++++------ .../Network/Handlers/HousingPacketHandlers.cpp | 3 --- src/world/Network/Handlers/InventoryHandler.cpp | 1 - src/world/Network/Handlers/InviteHandlers.cpp | 4 ---- src/world/Network/Handlers/LinkshellHandlers.cpp | 1 - src/world/Network/Handlers/PacketCommandHandler.cpp | 1 - src/world/Network/Handlers/PartyHandlers.cpp | 1 - .../Network/PacketWrappers/PlayerStateFlagsPacket.h | 1 + 14 files changed, 9 insertions(+), 47 deletions(-) diff --git a/src/world/Network/Handlers/ActionHandler.cpp b/src/world/Network/Handlers/ActionHandler.cpp index 2547d63a..963404ad 100644 --- a/src/world/Network/Handlers/ActionHandler.cpp +++ b/src/world/Network/Handlers/ActionHandler.cpp @@ -10,7 +10,6 @@ #include "Manager/ActionMgr.h" #include "Manager/PlayerMgr.h" -#include "Manager/EventMgr.h" using namespace Sapphire::Common; using namespace Sapphire::World::Manager; @@ -33,7 +32,6 @@ void Sapphire::Network::GameConnection::actionRequest( const Packets::FFXIVARR_P auto& exdData = Common::Service< Data::ExdData >::ref(); auto& actionMgr = Common::Service< World::Manager::ActionMgr >::ref(); - auto& eventMgr = Common::Service< World::Manager::EventMgr >::ref(); switch( type ) { diff --git a/src/world/Network/Handlers/BlacklistHandler.cpp b/src/world/Network/Handlers/BlacklistHandler.cpp index 8d1fb60e..7600eb4b 100644 --- a/src/world/Network/Handlers/BlacklistHandler.cpp +++ b/src/world/Network/Handlers/BlacklistHandler.cpp @@ -3,17 +3,14 @@ #include #include -#include #include #include -#include #include "Manager/BlacklistMgr.h" #include "Network/GameConnection.h" #include "Actor/Player.h" -#include "WorldServer.h" using namespace Sapphire::Common; using namespace Sapphire::Network::Packets; diff --git a/src/world/Network/Handlers/CFHandlers.cpp b/src/world/Network/Handlers/CFHandlers.cpp index 7c65de81..00a1eda8 100644 --- a/src/world/Network/Handlers/CFHandlers.cpp +++ b/src/world/Network/Handlers/CFHandlers.cpp @@ -1,7 +1,6 @@ #include #include #include -#include #include #include #include @@ -44,7 +43,6 @@ void Sapphire::Network::GameConnection::cfRequestPenalties( const Packets::FFXIV void Sapphire::Network::GameConnection::findContent( const Packets::FFXIVARR_PACKET_RAW& inPacket, Entity::Player& player ) { auto& teriMgr = Common::Service< TerritoryMgr >::ref(); - auto& exdData = Common::Service< Data::ExdData >::ref(); auto& contentFinder = Common::Service< World::ContentFinder >::ref(); const auto packet = ZoneChannelPacket< Client::FFXIVIpcFindContent >( inPacket ); @@ -62,7 +60,6 @@ void Sapphire::Network::GameConnection::findContent( const Packets::FFXIVARR_PAC void Sapphire::Network::GameConnection::find5Contents( const Packets::FFXIVARR_PACKET_RAW& inPacket, Entity::Player& player ) { - auto& teriMgr = Common::Service< TerritoryMgr >::ref(); auto& exdData = Common::Service< Data::ExdData >::ref(); auto& contentFinder = Common::Service< World::ContentFinder >::ref(); @@ -70,9 +67,9 @@ void Sapphire::Network::GameConnection::find5Contents( const Packets::FFXIVARR_P std::set< uint16_t > selectedContent; - for( std::size_t i = 0; i < 5; ++i ) - if( packet.data().territoryTypes[ i ] != 0 ) - selectedContent.insert( packet.data().territoryTypes[ i ] ); + for( auto territoryType : packet.data().territoryTypes ) + if( territoryType != 0 ) + selectedContent.insert( territoryType ); auto contentListIds = exdData.getIdList< Excel::InstanceContent >(); diff --git a/src/world/Network/Handlers/CommonListHandler.cpp b/src/world/Network/Handlers/CommonListHandler.cpp index 23e5cd06..35b6b7c6 100644 --- a/src/world/Network/Handlers/CommonListHandler.cpp +++ b/src/world/Network/Handlers/CommonListHandler.cpp @@ -1,7 +1,6 @@ #include #include #include -#include #include #include #include @@ -9,7 +8,6 @@ #include "Manager/LinkshellMgr.h" #include "Manager/PartyMgr.h" -#include "Territory/InstanceContent.h" #include "Network/GameConnection.h" @@ -19,7 +17,6 @@ #include "Session.h" #include "WorldServer.h" -#include "Forwards.h" using namespace Sapphire::Common; using namespace Sapphire::Network::Packets; @@ -214,7 +211,7 @@ void Sapphire::Network::GameConnection::getCommonlistHandler( const Packets::FFX for( const auto& id : memberVec ) { - Common::HierarchyData hierarchy; + Common::HierarchyData hierarchy{}; if( lsPtr->getMasterId() == id ) { hierarchy.data.type = Ls::LinkshellHierarchy::Master; diff --git a/src/world/Network/Handlers/EventHandlers.cpp b/src/world/Network/Handlers/EventHandlers.cpp index 1228d43b..f76dfb2e 100644 --- a/src/world/Network/Handlers/EventHandlers.cpp +++ b/src/world/Network/Handlers/EventHandlers.cpp @@ -1,10 +1,8 @@ #include -#include #include #include #include #include -#include #include #include "Network/GameConnection.h" @@ -17,7 +15,6 @@ #include "Manager/EventMgr.h" #include "Manager/PlayerMgr.h" #include "Manager/TerritoryMgr.h" -#include "WorldServer.h" #include "Territory/InstanceContent.h" #include "Territory/QuestBattle.h" @@ -40,8 +37,6 @@ void Sapphire::Network::GameConnection::eventHandlerTalk( const Packets::FFXIVAR const auto actorId = packet.data().actorId; const auto eventId = packet.data().eventId; - auto eventType = static_cast< uint16_t >( eventId >> 16 ); - std::string eventName = "onTalk"; std::string objName = eventMgr.getEventName( eventId ); @@ -402,7 +397,6 @@ void Sapphire::Network::GameConnection::yieldEventScene255( const Packets::FFXIV void Sapphire::Network::GameConnection::yieldEventString( const Packets::FFXIVARR_PACKET_RAW& inPacket, Entity::Player& player ) { - auto& server = Common::Service< World::WorldServer >::ref(); auto& eventMgr = Common::Service< World::Manager::EventMgr >::ref(); std::string inString; @@ -438,7 +432,6 @@ void Sapphire::Network::GameConnection::yieldEventString( const Packets::FFXIVAR void Sapphire::Network::GameConnection::yieldEventSceneIntAndString( const Packets::FFXIVARR_PACKET_RAW& inPacket, Entity::Player& player ) { - auto &server = Common::Service< World::WorldServer >::ref(); auto &eventMgr = Common::Service< World::Manager::EventMgr >::ref(); std::string inString; @@ -459,8 +452,6 @@ void Sapphire::Network::GameConnection::startEventSayHandler( const Packets::FFX const auto eventId = packet.data().handlerId; const auto sayId = packet.data().sayId; - auto eventType = static_cast< uint16_t >( eventId >> 16 ); - std::string eventName = "onSay"; std::string objName = eventMgr.getEventName( eventId ); @@ -483,12 +474,8 @@ void Sapphire::Network::GameConnection::startUiEvent( const Packets::FFXIVARR_PA auto& scriptMgr = Common::Service< Scripting::ScriptMgr >::ref(); const auto packet = ZoneChannelPacket< FFXIVIpcShopEventHandler >( inPacket ); - - const auto eventId = packet.data().eventId; - auto eventType = static_cast< uint16_t >( eventId >> 16 ); - std::string eventName = "onOpen"; std::string objName = eventMgr.getEventName( eventId ); diff --git a/src/world/Network/Handlers/FriendListHandlers.cpp b/src/world/Network/Handlers/FriendListHandlers.cpp index df49dcf7..6cda7a57 100644 --- a/src/world/Network/Handlers/FriendListHandlers.cpp +++ b/src/world/Network/Handlers/FriendListHandlers.cpp @@ -1,9 +1,7 @@ -#include #include #include #include -#include #include #include #include diff --git a/src/world/Network/Handlers/GMCommandHandlers.cpp b/src/world/Network/Handlers/GMCommandHandlers.cpp index e6574a0b..17fa812c 100644 --- a/src/world/Network/Handlers/GMCommandHandlers.cpp +++ b/src/world/Network/Handlers/GMCommandHandlers.cpp @@ -137,7 +137,7 @@ void Sapphire::Network::GameConnection::gmCommandHandler( const Packets::FFXIVAR PlayerMgr::sendServerNotice( player, "Race for {0} was set to {1}", targetPlayer->getName(), param1 ); targetPlayer->spawn( targetPlayer ); auto inRange = targetPlayer->getInRangeActors(); - for( auto actor : inRange ) + for( const auto& actor : inRange ) { if( actor->isPlayer() ) { @@ -153,7 +153,7 @@ void Sapphire::Network::GameConnection::gmCommandHandler( const Packets::FFXIVAR PlayerMgr::sendServerNotice( player, "Tribe for {0} was set to ", targetPlayer->getName(), param1 ); targetPlayer->spawn( targetPlayer ); auto inRange = targetPlayer->getInRangeActors(); - for( auto actor : inRange ) + for( const auto& actor : inRange ) { if( actor->isPlayer() ) { @@ -169,7 +169,7 @@ void Sapphire::Network::GameConnection::gmCommandHandler( const Packets::FFXIVAR PlayerMgr::sendServerNotice( player, "Sex for {0} was set to ", targetPlayer->getName(), param1 ); targetPlayer->spawn( targetPlayer ); auto inRange = targetActor->getInRangeActors(); - for( auto actor : inRange ) + for( const auto& actor : inRange ) { if( actor->isPlayer() ) { @@ -239,7 +239,7 @@ void Sapphire::Network::GameConnection::gmCommandHandler( const Packets::FFXIVAR player.setGmInvis( !player.getGmInvis() ); PlayerMgr::sendServerNotice( player, "Invisibility flag for {0} was toggled to {1}", player.getName(), !player.getGmInvis()); - for( auto actor : player.getInRangeActors() ) + for( const auto& actor : player.getInRangeActors() ) { if( actor->isPlayer() ) { @@ -476,7 +476,6 @@ void Sapphire::Network::GameConnection::gmCommandHandler( const Packets::FFXIVAR } case GmCommand::Teri: { - auto& teriMgr = Common::Service< TerritoryMgr >::ref(); auto& warpMgr = Common::Service< WarpMgr >::ref(); if( auto instance = teriMgr.getTerritoryByGuId( param1 ) ) { @@ -538,7 +537,6 @@ void Sapphire::Network::GameConnection::gmCommandHandler( const Packets::FFXIVAR } else { - auto& warpMgr = Common::Service< WarpMgr >::ref(); warpMgr.requestMoveTerritory( *targetPlayer, WarpType::WARP_TYPE_GM, teriMgr.getZoneByTerritoryTypeId( param1 )->getGuId(), targetPlayer->getPos(), 0); } diff --git a/src/world/Network/Handlers/HousingPacketHandlers.cpp b/src/world/Network/Handlers/HousingPacketHandlers.cpp index 392206fa..04555e4c 100644 --- a/src/world/Network/Handlers/HousingPacketHandlers.cpp +++ b/src/world/Network/Handlers/HousingPacketHandlers.cpp @@ -3,8 +3,6 @@ #include #include #include -#include - #include #include @@ -12,7 +10,6 @@ #include "Network/GameConnection.h" -#include "Territory/Territory.h" #include "Territory/HousingZone.h" #include "Territory/Land.h" #include "Territory/House.h" diff --git a/src/world/Network/Handlers/InventoryHandler.cpp b/src/world/Network/Handlers/InventoryHandler.cpp index 4043d06b..2cd3f5a8 100644 --- a/src/world/Network/Handlers/InventoryHandler.cpp +++ b/src/world/Network/Handlers/InventoryHandler.cpp @@ -8,7 +8,6 @@ #include "Network/GameConnection.h" #include "Network/PacketWrappers/ServerNoticePacket.h" -#include "Territory/Territory.h" #include "Actor/Player.h" #include "Session.h" diff --git a/src/world/Network/Handlers/InviteHandlers.cpp b/src/world/Network/Handlers/InviteHandlers.cpp index b10ef3ba..f8e9d519 100644 --- a/src/world/Network/Handlers/InviteHandlers.cpp +++ b/src/world/Network/Handlers/InviteHandlers.cpp @@ -1,10 +1,8 @@ #include #include #include -#include #include #include -#include #include @@ -15,7 +13,6 @@ #include "Session.h" #include "Territory/Territory.h" -#include "Territory/Land.h" #include "Network/PacketWrappers/PlayerSetupPacket.h" #include "Network/PacketWrappers/InviteUpdatePacket.h" @@ -34,7 +31,6 @@ using namespace Sapphire::Network::Packets; using namespace Sapphire::Network::Packets::WorldPackets::Server; using namespace Sapphire::Network::Packets::WorldPackets::Client; using namespace Sapphire::Network::Packets::WorldPackets; -using namespace Sapphire::Network::ActorControl; using namespace Sapphire::World::Manager; diff --git a/src/world/Network/Handlers/LinkshellHandlers.cpp b/src/world/Network/Handlers/LinkshellHandlers.cpp index 6aeffb9d..7ea2edf2 100644 --- a/src/world/Network/Handlers/LinkshellHandlers.cpp +++ b/src/world/Network/Handlers/LinkshellHandlers.cpp @@ -83,7 +83,6 @@ void Sapphire::Network::GameConnection::linkshellDeclineLeaderHandler( const Pac { const auto lsDeclineLeaderPacket = ZoneChannelPacket< Client::FFXIVIpcLinkshellDeclineLeader >( inPacket ); auto& lsMgr = Common::Service< LinkshellMgr >::ref(); - auto& server = Common::Service< World::WorldServer >::ref(); lsMgr.declineLeader( player, lsDeclineLeaderPacket.data().LinkshellID ); diff --git a/src/world/Network/Handlers/PacketCommandHandler.cpp b/src/world/Network/Handlers/PacketCommandHandler.cpp index 2bd1e14f..d8ef7509 100644 --- a/src/world/Network/Handlers/PacketCommandHandler.cpp +++ b/src/world/Network/Handlers/PacketCommandHandler.cpp @@ -7,7 +7,6 @@ #include #include -#include "Territory/Territory.h" #include "Manager/HousingMgr.h" #include "Manager/WarpMgr.h" diff --git a/src/world/Network/Handlers/PartyHandlers.cpp b/src/world/Network/Handlers/PartyHandlers.cpp index 82e126e0..89d1f96b 100644 --- a/src/world/Network/Handlers/PartyHandlers.cpp +++ b/src/world/Network/Handlers/PartyHandlers.cpp @@ -3,7 +3,6 @@ #include #include -#include #include #include diff --git a/src/world/Network/PacketWrappers/PlayerStateFlagsPacket.h b/src/world/Network/PacketWrappers/PlayerStateFlagsPacket.h index b4bb0d6e..8d243e3b 100644 --- a/src/world/Network/PacketWrappers/PlayerStateFlagsPacket.h +++ b/src/world/Network/PacketWrappers/PlayerStateFlagsPacket.h @@ -1,6 +1,7 @@ #pragma once #include #include "Actor/Player.h" +#include #include "Forwards.h" namespace Sapphire::Network::Packets::WorldPackets::Server From 67287242321c5d6f8fc6d1f6c39f2b90050721cd Mon Sep 17 00:00:00 2001 From: Toofy Date: Tue, 17 Jan 2023 18:29:25 +0000 Subject: [PATCH 11/22] Fixing formatting and spacing --- src/scripts/quest/ManWil004.cpp | 49 +++++++++++++++------------------ 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/src/scripts/quest/ManWil004.cpp b/src/scripts/quest/ManWil004.cpp index e3fd85e2..b559a6c9 100644 --- a/src/scripts/quest/ManWil004.cpp +++ b/src/scripts/quest/ManWil004.cpp @@ -36,7 +36,7 @@ private: // Entities found in the script data of the quest static constexpr auto Actor0 = 1003988; static constexpr auto Actor1 = 1002279; - static constexpr auto Actor2 = 1003908; + static constexpr auto Actor2 = 1003908; static constexpr auto Actor20 = 1001637; static constexpr auto Actor3 = 1001353; static constexpr auto Aetheryte0 = 9; @@ -65,13 +65,9 @@ private: static constexpr auto SEQ_0_ACTOR0_LQ = 50; public: - ManWil004() : Sapphire::ScriptAPI::QuestScript( 66106 ) - { - }; + ManWil004() : Sapphire::ScriptAPI::QuestScript( 66106 ){}; - ~ManWil004() - { - }; + ~ManWil004(){}; void onTalk( World::Quest& quest, Entity::Player& player, uint64_t actorId ) override { @@ -94,20 +90,19 @@ public: else if( actorId == Aetheryte0 ) { - eventMgr().eventActionStart( player, 0x050002, 0x13, - [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) - { - eventMgr().sendEventNotice( player, 0x050002, 0, 1, 0, 0 ); - player.registerAetheryte( 2 ); - player.setRewardFlag( Common::UnlockEntry::Return ); - Scene00051( quest, player ); - }, - nullptr, getId() ); + eventMgr().eventActionStart( + player, 0x050002, 0x13, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { + eventMgr().sendEventNotice( player, 0x050002, 0, 1, 0, 0 ); + player.registerAetheryte( 2 ); + player.setRewardFlag( Common::UnlockEntry::Return ); + Scene00051( quest, player ); + }, + nullptr, getId() ); } } private: - //varIdx refers to the noticeId void checkQuestCompletion( World::Quest& quest, Entity::Player& player, uint32_t varIdx ) { @@ -143,7 +138,7 @@ private: void Scene00000Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - if( result.getResult( 0 ) == 1 ) // accept quest + if( result.getResult( 0 ) == 1 )// accept quest Scene00050( player ); } @@ -154,7 +149,7 @@ private: void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00002(player); + Scene00002( player ); } void Scene00051( World::Quest& quest, Entity::Player& player ) @@ -169,7 +164,7 @@ private: void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - quest.setUI8BL(1); + quest.setUI8BL( 1 ); checkQuestCompletion( quest, player, 0 ); } @@ -180,7 +175,7 @@ private: void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - quest.setUI8AL(1); + quest.setUI8AL( 1 ); checkQuestCompletion( quest, player, 1 ); } @@ -191,10 +186,11 @@ private: void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - if(result.getResult(0) == 1) + if( result.getResult( 0 ) == 1 ) { Scene00005( player ); - } else + } + else { return; } @@ -207,15 +203,14 @@ private: void Scene00005Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - quest.setUI8CH(0); - quest.setUI8BH(1); + quest.setUI8CH( 0 ); + quest.setUI8BH( 1 ); checkQuestCompletion( quest, player, 2 ); } void Scene00008( Entity::Player& player ) { eventMgr().playQuestScene( player, getId(), SEQ_1_ACTOR8, SET_EOBJ_BASE | HIDE_HOTBAR | INVIS_EOBJ, bindSceneReturn( &ManWil004::Scene00008Return ) ); - } void Scene00008Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) @@ -235,7 +230,7 @@ private: { // on quest accept quest.setSeq( Seq1 ); - quest.setUI8CH( 1 ); // receive key item + quest.setUI8CH( 1 );// receive key item // teleport to real Uldah player.forceZoneing( Territorytype0 ); From 6e823da8258eabf6b8c95832ff8a08691d090a71 Mon Sep 17 00:00:00 2001 From: dude22072 Date: Tue, 17 Jan 2023 12:47:00 -0600 Subject: [PATCH 12/22] Add BeforeTrialDung to isDefaultTerritory --- src/world/Manager/TerritoryMgr.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/world/Manager/TerritoryMgr.cpp b/src/world/Manager/TerritoryMgr.cpp index 2c830871..1b12884f 100644 --- a/src/world/Manager/TerritoryMgr.cpp +++ b/src/world/Manager/TerritoryMgr.cpp @@ -145,7 +145,8 @@ bool TerritoryMgr::isDefaultTerritory( uint32_t territoryTypeId ) const pTeri->data().IntendedUse == TerritoryIntendedUse::OpenWorld || pTeri->data().IntendedUse == TerritoryIntendedUse::OpeningArea || pTeri->data().IntendedUse == TerritoryIntendedUse::GoldSaucer || - pTeri->data().IntendedUse == TerritoryIntendedUse::ChocoboSquare; + pTeri->data().IntendedUse == TerritoryIntendedUse::ChocoboSquare || + pTeri->data().IntendedUse == TerritoryIntendedUse::BeforeTrialDung; } From 0cabc03c21fb8e402ead6e4588b1f8f2b7811b0c Mon Sep 17 00:00:00 2001 From: dude22072 Date: Tue, 17 Jan 2023 15:16:55 -0600 Subject: [PATCH 13/22] WHM ARR Questline --- .../quest/classquest/WHM/JobWhm300.cpp | 221 ++++++++ .../quest/classquest/WHM/JobWhm350.cpp | 281 +++++++++++ .../quest/classquest/WHM/JobWhm400.cpp | 332 ++++++++++++ .../quest/classquest/WHM/JobWhm450.cpp | 473 ++++++++++++++++++ .../quest/classquest/WHM/JobWhm451.cpp | 319 ++++++++++++ .../quest/classquest/WHM/JobWhm500.cpp | 243 +++++++++ 6 files changed, 1869 insertions(+) create mode 100644 src/scripts/quest/classquest/WHM/JobWhm300.cpp create mode 100644 src/scripts/quest/classquest/WHM/JobWhm350.cpp create mode 100644 src/scripts/quest/classquest/WHM/JobWhm400.cpp create mode 100644 src/scripts/quest/classquest/WHM/JobWhm450.cpp create mode 100644 src/scripts/quest/classquest/WHM/JobWhm451.cpp create mode 100644 src/scripts/quest/classquest/WHM/JobWhm500.cpp diff --git a/src/scripts/quest/classquest/WHM/JobWhm300.cpp b/src/scripts/quest/classquest/WHM/JobWhm300.cpp new file mode 100644 index 00000000..885f331b --- /dev/null +++ b/src/scripts/quest/classquest/WHM/JobWhm300.cpp @@ -0,0 +1,221 @@ +// 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: JobWhm300_01079 +// Quest Name: Seer Folly +// Quest ID: 66615 +// Start NPC: 1000692 +// End NPC: 1006751 + +using namespace Sapphire; + +class JobWhm300 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AL + // UI8BH + + /// Countable Num: 0 Seq: 1 Event: 1 Listener: 1007850 + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 2002391 + // 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 = 1000692;//E-Sumi-Yan + static constexpr auto Actor1 = 1007850;//Raya-O-Senna (Seq1) + static constexpr auto Actor2 = 1007851; + static constexpr auto Actor3 = 1006751;//Raya-O-Senna (SeqFinish) + static constexpr auto Eobject0 = 2002391; + static constexpr auto EventActionSearch = 1; + static constexpr auto GearsetUnlock = 1905; + static constexpr auto Item0 = 2000938; + static constexpr auto LocAction0Wsget = 995; + static constexpr auto LocLogMes = 3651; + static constexpr auto LocVfx1 = 241; + static constexpr auto LocVfx2 = 413; + static constexpr auto LocWs = 136; + static constexpr auto Questbattle0 = 75; + static constexpr auto Territorytype0 = 319; + static constexpr auto UnlockImageClass = 59; + +public: + JobWhm300() : Sapphire::ScriptAPI::QuestScript( 66615 ){}; + ~JobWhm300() = 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 ) + { + //TODO: Selecting "Procede" causes the game to fade out, so if we don't send the player to an instance it soft-locks them. + //Scene00002( quest, player ); + playerMgr().sendUrgent( player, "QuestBattle content is currently broken. The fight has been skipped for you." ); + eventMgr().sendEventNotice( player, getId(), 0, 0 ); + quest.setSeq( SeqFinish ); + } + break; + } + case Actor2: + { + break; + } + case Actor3: + { + if( quest.getSeq() == SeqFinish ) + Scene00006( quest, player ); + break; + } + } + } + + void onEventItem( World::Quest &quest, Entity::Player &player, uint64_t actorId ) override + { + } + + +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( &JobWhm300::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, NONE, bindSceneReturn( &JobWhm300::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, NONE, bindSceneReturn( &JobWhm300::Scene00002Return ) ); + } + + void Scene00002Return( World::Quest &quest, Entity::Player &player, const Event::SceneResult &result ) + { + if( result.getResult( 0 ) == 1 ) + { + //TODO: QuestBattle content + + auto &pTeriMgr = Common::Service< Sapphire::World::Manager::TerritoryMgr >::ref(); + + eventMgr().eventFinish( player, result.eventId, 0 ); + pTeriMgr.createAndJoinQuestBattle( player, Questbattle0 ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00003( World::Quest &quest, Entity::Player &player ) + { + eventMgr().playQuestScene( player, getId(), 3, NONE, bindSceneReturn( &JobWhm300::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest &quest, Entity::Player &player, const Event::SceneResult &result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00004( World::Quest &quest, Entity::Player &player ) + { + eventMgr().playQuestScene( player, getId(), 4, NONE, bindSceneReturn( &JobWhm300::Scene00004Return ) ); + } + + void Scene00004Return( World::Quest &quest, Entity::Player &player, const Event::SceneResult &result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00005( World::Quest &quest, Entity::Player &player ) + { + eventMgr().playQuestScene( player, getId(), 5, NONE, bindSceneReturn( &JobWhm300::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, NONE, bindSceneReturn( &JobWhm300::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, FADE_OUT | HIDE_UI, bindSceneReturn( &JobWhm300::Scene00007Return ) ); + } + + void Scene00007Return( World::Quest &quest, Entity::Player &player, const Event::SceneResult &result ) + { + //TODO: Unlock Skill + player.finishQuest( getId() ); + player.setMaxGearSets( player.getMaxGearSets() + 1 ); + } +}; + +EXPOSE_SCRIPT( JobWhm300 ); \ No newline at end of file diff --git a/src/scripts/quest/classquest/WHM/JobWhm350.cpp b/src/scripts/quest/classquest/WHM/JobWhm350.cpp new file mode 100644 index 00000000..7c45ae54 --- /dev/null +++ b/src/scripts/quest/classquest/WHM/JobWhm350.cpp @@ -0,0 +1,281 @@ +// 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: JobWhm350_01080 +// Quest Name: Only You Can Prevent Forest Ire +// Quest ID: 66616 +// Start NPC: 1006751 +// End NPC: 1006751 + +using namespace Sapphire; + +class JobWhm350 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AL + + /// Countable Num: 0 Seq: 1 Event: 10 Listener: 5000000 + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 2002392 + // 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 = 1006751;//Raya-O-Senna + static constexpr auto Enemy0 = 4306588; + static constexpr auto Enemy1 = 4306589; + static constexpr auto Enemy2 = 4306590; + static constexpr auto Eobject0 = 2002392;//Destination (Seq1) + static constexpr auto Eobject1 = 2002393; + static constexpr auto Eventrange0 = 4306570; + static constexpr auto EventActionQuietUnderLong = 44; + static constexpr auto EventActionSearch = 1; + static constexpr auto LocAction0Wsget = 995; + static constexpr auto LocLogMes = 3652; + static constexpr auto LocVfx1 = 241; + static constexpr auto LocVfx2 = 413; + static constexpr auto LocWs = 137; + static constexpr auto Logmessage0 = 3653; + +public: + JobWhm350() : Sapphire::ScriptAPI::QuestScript( 66616 ){}; + ~JobWhm350() = 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 ) + Scene00007( quest, player ); + break; + } + case Eobject0: + { + if( quest.getUI8AL() >= 3 ) + { + eventMgr().eventActionStart( + player, getId(), EventActionQuietUnderLong, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { + Scene00004( quest, player ); + }, + nullptr, 0 ); + } + else + { + //"The enemy is still about!"?? Seem to not be claiming BNpcs properly? + Scene00003( quest, player ); + } + } + } + } + + void onBNpcKill( World::Quest& quest, Entity::BNpc& bnpc, Entity::Player& player ) override + { + switch( bnpc.getLayoutId() ) + { + case Enemy0: + case Enemy1: + case Enemy2: + { + if( bnpc.getTriggerOwnerId() == player.getId() ) + quest.setUI8AL( quest.getUI8AL() + 1 ); + break; + } + } + } + + void onWithinRange( World::Quest& quest, Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z ) override + { + switch( param1 ) + { + case Eventrange0: + { + if( quest.getUI8AL() < 3 ) + Scene00002( quest, player ); + } + } + } + + void onPlayerDeath( World::Quest& quest, Sapphire::Entity::Player& player ) override + { + auto& teriMgr = Common::Service< Sapphire::World::Manager::TerritoryMgr >::ref(); + auto& instance = teriMgr.getTerritoryByGuId( player.getTerritoryId() ); + + auto enem0 = instance->getActiveBNpcByLayoutIdAndTriggerOwner( Enemy0, player.getId() ); + auto enem1 = instance->getActiveBNpcByLayoutIdAndTriggerOwner( Enemy1, player.getId() ); + auto enem2 = instance->getActiveBNpcByLayoutIdAndTriggerOwner( Enemy2, player.getId() ); + + if( enem0 != nullptr ) instance->removeActor( enem0 ); + if( enem1 != nullptr ) instance->removeActor( enem1 ); + if( enem2 != nullptr ) instance->removeActor( enem2 ); + + quest.setUI8AL( 0 ); + } + +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( &JobWhm350::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, NONE, bindSceneReturn( &JobWhm350::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, NONE, bindSceneReturn( &JobWhm350::Scene00002Return ) ); + } + + void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + auto& teriMgr = Common::Service< Sapphire::World::Manager::TerritoryMgr >::ref(); + auto& instance = teriMgr.getTerritoryByGuId( player.getTerritoryId() ); + + bool enemy0Spawned = instance->getActiveBNpcByLayoutIdAndTriggerOwner( Enemy0, player.getId() ) != nullptr; + bool enemy1Spawned = instance->getActiveBNpcByLayoutIdAndTriggerOwner( Enemy1, player.getId() ) != nullptr; + bool enemy2Spawned = instance->getActiveBNpcByLayoutIdAndTriggerOwner( Enemy2, player.getId() ) != nullptr; + + if( enemy0Spawned || enemy1Spawned || enemy2Spawned || quest.getUI8AL() >= 3) return; + + if( !enemy0Spawned ) + { + auto enemy0 = instance->createBNpcFromLayoutId( Enemy0, 1220 /*Find the right value*/, Common::BNpcType::Enemy, player.getId() ); + enemy0->hateListAddDelayed( player.getAsPlayer(), 1 ); + } + if( !enemy1Spawned ) + { + auto enemy1 = instance->createBNpcFromLayoutId( Enemy1, 1220 /*Find the right value*/, Common::BNpcType::Enemy, player.getId() ); + enemy1->hateListAddDelayed( player.getAsPlayer(), 1 ); + } + if( !enemy2Spawned ) + { + auto enemy2 = instance->createBNpcFromLayoutId( Enemy2, 1220 /*Find the right value*/, Common::BNpcType::Enemy, player.getId() ); + enemy2->hateListAddDelayed( player.getAsPlayer(), 1 ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00003( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 3, HIDE_HOTBAR, bindSceneReturn( &JobWhm350::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00004( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 4, HIDE_HOTBAR, bindSceneReturn( &JobWhm350::Scene00004Return ) ); + } + + void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 0, 0 ); + //TODO: Show the "Your communion has furthered your potentional as a white mage." message. Is it that logmessage0 var? + quest.setSeq( SeqFinish ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00005( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 5, NONE, bindSceneReturn( &JobWhm350::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, NONE, bindSceneReturn( &JobWhm350::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, NONE, bindSceneReturn( &JobWhm350::Scene00007Return ) ); + } + + void Scene00007Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + Scene00008( quest, player ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00008( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 8, FADE_OUT | HIDE_UI | CONDITION_CUTSCENE, bindSceneReturn( &JobWhm350::Scene00008Return ) ); + } + + void Scene00008Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + //TODO: Unlock Regen + player.finishQuest( getId() ); + } +}; + +EXPOSE_SCRIPT( JobWhm350 ); \ No newline at end of file diff --git a/src/scripts/quest/classquest/WHM/JobWhm400.cpp b/src/scripts/quest/classquest/WHM/JobWhm400.cpp new file mode 100644 index 00000000..3e39c44e --- /dev/null +++ b/src/scripts/quest/classquest/WHM/JobWhm400.cpp @@ -0,0 +1,332 @@ +// 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: JobWhm400_01081 +// Quest Name: O Brother, Where Art Thou +// Quest ID: 66617 +// Start NPC: 1006751 +// End NPC: 1006751 + +using namespace Sapphire; + +class JobWhm400 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AL + + /// Countable Num: 0 Seq: 1 Event: 1 Listener: 1007852 + /// Countable Num: 0 Seq: 2 Event: 1 Listener: 2002394 + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 2002395 + // 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 = 1006751;//Raya-o-Senna + static constexpr auto Actor1 = 1007852;//A-Ruhn=Senna + static constexpr auto CutJobwhm00020 = 347; + static constexpr auto Enemy0 = 4306638; + static constexpr auto Enemy1 = 4306639; + static constexpr auto Enemy2 = 4306640; + static constexpr auto Enemy3 = 4306641; + static constexpr auto Eobject0 = 2002394;//Destination (Seq2) + static constexpr auto Eobject1 = 2002395; + static constexpr auto Eventrange0 = 4306632; + static constexpr auto EventActionQuietUnderLong = 44; + static constexpr auto EventActionSearch = 1; + static constexpr auto LocAction0Wsget = 995; + static constexpr auto LocLogMes = 3652; + static constexpr auto LocVfx1 = 241; + static constexpr auto LocVfx2 = 413; + static constexpr auto LocWs = 138; + static constexpr auto Logmessage0 = 3654; + +public: + JobWhm400() : Sapphire::ScriptAPI::QuestScript( 66617 ){}; + ~JobWhm400() = 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 ) + Scene00013( quest, player ); + break; + } + case Actor1: + { + if( quest.getSeq() == Seq1 ) + Scene00002( quest, player ); + else if( quest.getSeq() == Seq2 ) + Scene00012( quest, player ); + break; + } + case Eobject0: + { + if(quest.getUI8AL() < 4) + Scene00008( quest, player ); + else + eventMgr().eventActionStart( + player, getId(), EventActionQuietUnderLong, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { + Scene00009( quest, player ); + }, + nullptr, 0 ); + break; + } + } + } + + void onBNpcKill( World::Quest& quest, Sapphire::Entity::BNpc& bnpc, Sapphire::Entity::Player& player ) override + { + switch( bnpc.getLayoutId() ) + { + case Enemy0: + case Enemy1: + case Enemy2: + case Enemy3: + { + quest.setUI8AL( quest.getUI8AL() + 1 ); + break; + } + } + } + + void onWithinRange( World::Quest& quest, Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z ) override + { + if( param1 == Eventrange0 ) + { + auto instance = teriMgr().getTerritoryByGuId( player.getTerritoryId() ); + + bool enemy0Spawned = instance->getActiveBNpcByLayoutIdAndTriggerOwner( Enemy0, player.getId() ) != nullptr; + bool enemy1Spawned = instance->getActiveBNpcByLayoutIdAndTriggerOwner( Enemy1, player.getId() ) != nullptr; + bool enemy2Spawned = instance->getActiveBNpcByLayoutIdAndTriggerOwner( Enemy2, player.getId() ) != nullptr; + bool enemy3Spawned = instance->getActiveBNpcByLayoutIdAndTriggerOwner( Enemy3, player.getId() ) != nullptr; + + if( !enemy0Spawned && !enemy1Spawned && !enemy2Spawned && !enemy3Spawned && quest.getUI8AL() < 4 ) + Scene00007( 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, NONE, bindSceneReturn( &JobWhm400::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, NONE, bindSceneReturn( &JobWhm400::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, NONE, bindSceneReturn( &JobWhm400::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, NONE, bindSceneReturn( &JobWhm400::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00004( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 4, NONE, bindSceneReturn( &JobWhm400::Scene00004Return ) ); + } + + void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00005( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 5, NONE, bindSceneReturn( &JobWhm400::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, NONE, bindSceneReturn( &JobWhm400::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, NONE, bindSceneReturn( &JobWhm400::Scene00007Return ) ); + } + + void Scene00007Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + auto instance = teriMgr().getTerritoryByGuId( player.getTerritoryId() ); + auto enemy0 = instance->createBNpcFromLayoutId( Enemy0, 1220 /*Find the right value*/, Common::BNpcType::Enemy, player.getId() ); + auto enemy1 = instance->createBNpcFromLayoutId( Enemy1, 1220 /*Find the right value*/, Common::BNpcType::Enemy, player.getId() ); + auto enemy2 = instance->createBNpcFromLayoutId( Enemy2, 1220 /*Find the right value*/, Common::BNpcType::Enemy, player.getId() ); + auto enemy3 = instance->createBNpcFromLayoutId( Enemy3, 1220 /*Find the right value*/, Common::BNpcType::Enemy, player.getId() ); + + enemy0->hateListAddDelayed( player.getAsPlayer(), 1 ); + enemy1->hateListAddDelayed( player.getAsPlayer(), 1 ); + enemy2->hateListAddDelayed( player.getAsPlayer(), 1 ); + enemy3->hateListAddDelayed( player.getAsPlayer(), 1 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00008( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 8, NONE, bindSceneReturn( &JobWhm400::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( &JobWhm400::Scene00009Return ) ); + } + + void Scene00009Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 1, 0 ); + quest.setSeq( SeqFinish ); + quest.setUI8AL( 0 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00010( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 10, NONE, bindSceneReturn( &JobWhm400::Scene00010Return ) ); + } + + void Scene00010Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00011( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 11, NONE, bindSceneReturn( &JobWhm400::Scene00011Return ) ); + } + + void Scene00011Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00012( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 12, NONE, bindSceneReturn( &JobWhm400::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, NONE, bindSceneReturn( &JobWhm400::Scene00013Return ) ); + } + + void Scene00013Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + Scene00014( quest, player ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00014( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 14, FADE_OUT | HIDE_UI, bindSceneReturn( &JobWhm400::Scene00014Return ) ); + } + + void Scene00014Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + //TODO:Unlock Divine Seal + player.finishQuest( getId() ); + } +}; + +EXPOSE_SCRIPT( JobWhm400 ); \ No newline at end of file diff --git a/src/scripts/quest/classquest/WHM/JobWhm450.cpp b/src/scripts/quest/classquest/WHM/JobWhm450.cpp new file mode 100644 index 00000000..b7a316b9 --- /dev/null +++ b/src/scripts/quest/classquest/WHM/JobWhm450.cpp @@ -0,0 +1,473 @@ +// 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: JobWhm450_01082 +// Quest Name: Following in His Footsteps +// Quest ID: 66618 +// Start NPC: 1006751 +// End NPC: 1006751 + +using namespace Sapphire; + +class JobWhm450 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AL + // UI8BH + // UI8BL + // UI8CH + // UI8CL + // UI8DH + + /// Countable Num: 0 Seq: 1 Event: 1 Listener: 2002396 + /// Countable Num: 0 Seq: 1 Event: 2 Listener: 2002396 + /// Countable Num: 0 Seq: 1 Event: 1 Listener: 2002397 + /// Countable Num: 0 Seq: 2 Event: 2 Listener: 2002397 + /// Countable Num: 0 Seq: 3 Event: 1 Listener: 2002398 + /// Countable Num: 0 Seq: 4 Event: 2 Listener: 2002398 + /// Countable Num: 0 Seq: 5 Event: 1 Listener: 1006751 + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 2002399 + // 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, + Seq5 = 5, + SeqFinish = 255, + }; + + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1006751; //Raya-o-Senna + static constexpr auto Eobject0 = 2002396;//Epitaph to Philosophy + static constexpr auto Eobject1 = 2002397;//Epitaph to Discovery + static constexpr auto Eobject2 = 2002398;//Epitaph to Fluidity + static constexpr auto Eobject3 = 2002399;//Epitaph to Infancy + static constexpr auto Eobject4 = 2002401; + static constexpr auto Eobject5 = 2002402; + static constexpr auto Eobject6 = 2002400;//Epitaph to Expiry + static constexpr auto EventActionSearch = 1; + static constexpr auto Item0 = 2000939; + static constexpr auto Item1 = 2000940; + static constexpr auto Item2 = 2000941; + static constexpr auto Item3 = 2000943; + static constexpr auto Item4 = 2000942; + static constexpr auto LocAction0Wsget = 995; + static constexpr auto LocActor1 = 1007861; + static constexpr auto LocActor2 = 1007862; + static constexpr auto LocFace0 = 604; + static constexpr auto LocFace1 = 617; + static constexpr auto LocLogMes = 3652; + static constexpr auto LocPosActor1 = 4307833; + static constexpr auto LocPosActor2 = 4307834; + static constexpr auto LocVfx1 = 241; + static constexpr auto LocVfx2 = 413; + static constexpr auto LocWs = 184; + static constexpr auto Logmessage0 = 3657; + static constexpr auto Ritem0 = 3687; + static constexpr auto Ritem1 = 3894; + static constexpr auto Ritem2 = 3463; + static constexpr auto Ritem3 = 2902; + static constexpr auto VfxReaction = 177; + +public: + JobWhm450() : Sapphire::ScriptAPI::QuestScript( 66618 ){}; + ~JobWhm450() = 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 ) + Scene00008( quest, player ); + else if( quest.getSeq() == Seq4 ) + Scene00014( quest, player ); + else if( quest.getSeq() == SeqFinish ) + Scene00022( quest, player ); + break; + } + case Eobject0: + { + Scene00002( quest, player ); + break; + } + case Eobject1: + { + Scene00004( quest, player ); + break; + } + case Eobject2: + { + Scene00006( quest, player ); + break; + } + case Eobject3: + { + Scene00009( quest, player ); + break; + } + case Eobject6: + { + Scene00020( quest, player ); + break; + } + } + } + + void onEmote( World::Quest& quest, uint64_t actorId, uint32_t emoteId, Entity::Player& player ) override + { + if( emoteId == 58 ) + { + if( actorId == Eobject0 ) + Scene00003( quest, player ); + else if( actorId == Eobject1 ) + Scene00005( quest, player ); + else if( actorId == Eobject2 ) + Scene00007( quest, player ); + else if( actorId == Eobject6 ) + Scene00021( quest, player ); + } + } + + +private: + void checkQuestCompletion( World::Quest& quest, Entity::Player& player ) + { + if( quest.getUI8AL() >= 1 && quest.getUI8BH() >= 1 && quest.getUI8BL() >= 1 ) + { + quest.setUI8AL( 0 ); + quest.setUI8BH( 0 ); + quest.setUI8BL( 0 ); + quest.setUI8CH( 0 ); + quest.setUI8CL( 0 ); + quest.setUI8DH( 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, NONE, bindSceneReturn( &JobWhm450::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, NONE, bindSceneReturn( &JobWhm450::Scene00001Return ) ); + } + + void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setSeq( Seq1 ); + quest.setUI8CH( 1 ); + quest.setUI8CL( 1 ); + quest.setUI8DH( 1 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00002( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 2, HIDE_HOTBAR, bindSceneReturn( &JobWhm450::Scene00002Return ) ); + } + + void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00003( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 3, HIDE_HOTBAR, bindSceneReturn( &JobWhm450::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 0, 0 );//TODO:Item Icon, Cleric's Gloves + //TODO: Show "Your Garb is not blessed with the power of A-Towa-Cant." message (Logmessage0?) + quest.setUI8AL( 1 ); + quest.setUI8CH( 0 ); + checkQuestCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00004( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 4, HIDE_HOTBAR, bindSceneReturn( &JobWhm450::Scene00004Return ) ); + } + + void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00005( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 5, HIDE_HOTBAR, bindSceneReturn( &JobWhm450::Scene00005Return ) ); + } + + void Scene00005Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 1, 0 );//TODO:Item Icon, Cleric's Culottes + //TODO: Show "Your Garb is not blessed with the power of A-Towa-Cant." message (Logmessage0?) + quest.setUI8BH( 1 ); + quest.setUI8CL( 0 ); + checkQuestCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00006( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 6, HIDE_HOTBAR, bindSceneReturn( &JobWhm450::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( &JobWhm450::Scene00007Return ) ); + } + + void Scene00007Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 2, 0 );//TODO:Item Icon, Cleric's Boots + //TODO: Show "Your Garb is not blessed with the power of A-Towa-Cant." message (Logmessage0?) + quest.setUI8BL( 1 ); + quest.setUI8DH( 0 ); + checkQuestCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00008( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 8, NONE, bindSceneReturn( &JobWhm450::Scene00008Return ) ); + } + + void Scene00008Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 3, 0 ); + quest.setSeq( Seq3 ); + quest.setUI8BH( 1 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00009( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 9, HIDE_HOTBAR, bindSceneReturn( &JobWhm450::Scene00009Return ) ); + } + + void Scene00009Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 4, 0 ); + quest.setSeq( Seq4 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00010( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 10, NONE, bindSceneReturn( &JobWhm450::Scene00010Return ) ); + } + + void Scene00010Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00011( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 11, NONE, bindSceneReturn( &JobWhm450::Scene00011Return ) ); + } + + void Scene00011Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00012( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 12, NONE, bindSceneReturn( &JobWhm450::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, NONE, bindSceneReturn( &JobWhm450::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( &JobWhm450::Scene00014Return ) ); + } + + void Scene00014Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + Scene00015( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00015( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 15, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, bindSceneReturn( &JobWhm450::Scene00015Return ) ); + } + + void Scene00015Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 5, 0 ); + quest.setSeq( Seq5 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00016( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 16, NONE, bindSceneReturn( &JobWhm450::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, NONE, bindSceneReturn( &JobWhm450::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, NONE, bindSceneReturn( &JobWhm450::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, NONE, bindSceneReturn( &JobWhm450::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( &JobWhm450::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( &JobWhm450::Scene00021Return ) ); + } + + void Scene00021Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 6, 0 );//TODO:Item Icon, Cleric's Circlet + //TODO: Show "Your Garb is not blessed with the power of A-Towa-Cant." message (Logmessage0?) + quest.setSeq( SeqFinish ); + quest.setUI8BH( 0 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00022( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 22, NONE, bindSceneReturn( &JobWhm450::Scene00022Return ) ); + } + + void Scene00022Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + player.finishQuest( getId() ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00023( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 23, NONE, bindSceneReturn( &JobWhm450::Scene00023Return ) ); + } + + void Scene00023Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } +}; + +EXPOSE_SCRIPT( JobWhm450 ); \ No newline at end of file diff --git a/src/scripts/quest/classquest/WHM/JobWhm451.cpp b/src/scripts/quest/classquest/WHM/JobWhm451.cpp new file mode 100644 index 00000000..a4523f6b --- /dev/null +++ b/src/scripts/quest/classquest/WHM/JobWhm451.cpp @@ -0,0 +1,319 @@ +// 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: JobWhm451_01083 +// Quest Name: Yearn for the Urn +// Quest ID: 66619 +// Start NPC: 1006751 +// End NPC: 1006751 + +using namespace Sapphire; + +class JobWhm451 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AL + // UI8BH + + /// Countable Num: 0 Seq: 1 Event: 1 Listener: 1007861 + /// Countable Num: 0 Seq: 2 Event: 1 Listener: 1007853 + /// Countable Num: 0 Seq: 3 Event: 10 Listener: 5000000 + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 2002403 + // 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 = 1006751;//Raya-o-Senna + static constexpr auto Actor1 = 1007861;//Kupcha Kupa + static constexpr auto Actor2 = 1007853;//Pukno Poki + static constexpr auto Enemy0 = 4307109; + static constexpr auto Enemy1 = 4307272; + static constexpr auto Enemy2 = 4307273; + static constexpr auto Eobject0 = 2002403;//Overloaded Wain + static constexpr auto Eobject1 = 2002407; + static constexpr auto Eventrange0 = 4306924; + static constexpr auto EventActionProcessUpperMiddle = 32; + static constexpr auto EventActionSearch = 1; + static constexpr auto Item0 = 2000944; + static constexpr auto LocAction0Wsget = 995; + static constexpr auto LocLogMes = 3652; + static constexpr auto LocVfx1 = 241; + static constexpr auto LocVfx2 = 413; + static constexpr auto LocWs = 139; + +public: + JobWhm451() : Sapphire::ScriptAPI::QuestScript( 66619 ){}; + ~JobWhm451() = 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 ) + Scene00010( 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 ) + Scene00009( quest, player ); + break; + } + case Eobject0: + { + if( quest.getUI8AL() < 3 ) + Scene00005( quest, player ); + else + eventMgr().eventActionStart( + player, getId(), EventActionProcessUpperMiddle, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { + Scene00006( quest, player ); + }, + nullptr, 0 ); + break; + } + } + } + + void onBNpcKill( World::Quest& quest, Sapphire::Entity::BNpc& bnpc, Sapphire::Entity::Player& player ) override + { + switch( bnpc.getLayoutId() ) + { + case Enemy0: + case Enemy1: + case Enemy2: + { + quest.setUI8AL( quest.getUI8AL() + 1 ); + break; + } + } + } + + void onWithinRange( World::Quest& quest, Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z ) override + { + if( param1 == Eventrange0 ) + { + auto instance = teriMgr().getTerritoryByGuId( player.getTerritoryId() ); + + bool enemy0Spawned = instance->getActiveBNpcByLayoutIdAndTriggerOwner( Enemy0, player.getId() ) != nullptr; + bool enemy1Spawned = instance->getActiveBNpcByLayoutIdAndTriggerOwner( Enemy1, player.getId() ) != nullptr; + bool enemy2Spawned = instance->getActiveBNpcByLayoutIdAndTriggerOwner( Enemy2, player.getId() ) != nullptr; + + if( !enemy0Spawned && !enemy1Spawned && !enemy2Spawned && quest.getUI8AL() < 3 ) + Scene00004( 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, NONE, bindSceneReturn( &JobWhm451::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( &JobWhm451::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( &JobWhm451::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( &JobWhm451::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, NONE, bindSceneReturn( &JobWhm451::Scene00004Return ) ); + } + + void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + auto instance = teriMgr().getTerritoryByGuId( player.getTerritoryId() ); + auto enemy0 = instance->createBNpcFromLayoutId( Enemy0, 1220 /*Find the right value*/, Common::BNpcType::Enemy, player.getId() ); + auto enemy1 = instance->createBNpcFromLayoutId( Enemy1, 1220 /*Find the right value*/, Common::BNpcType::Enemy, player.getId() ); + auto enemy2 = instance->createBNpcFromLayoutId( Enemy2, 1220 /*Find the right value*/, Common::BNpcType::Enemy, player.getId() ); + + enemy0->hateListAddDelayed( player.getAsPlayer(), 1 ); + enemy1->hateListAddDelayed( player.getAsPlayer(), 1 ); + enemy2->hateListAddDelayed( player.getAsPlayer(), 1 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00005( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 5, NONE, bindSceneReturn( &JobWhm451::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, NONE, bindSceneReturn( &JobWhm451::Scene00006Return ) ); + } + + void Scene00006Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 2, 0 ); + quest.setSeq( SeqFinish ); + quest.setUI8AL( 0 ); + quest.setUI8BH( 1 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00007( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 7, NONE, bindSceneReturn( &JobWhm451::Scene00007Return ) ); + } + + void Scene00007Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00008( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 8, NONE, bindSceneReturn( &JobWhm451::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( &JobWhm451::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( &JobWhm451::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( &JobWhm451::Scene00011Return ) ); + } + + void Scene00011Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + Scene00012( quest, player ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00012( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 12, FADE_OUT | HIDE_UI, bindSceneReturn( &JobWhm451::Scene00012Return ) ); + } + + void Scene00012Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + //TODO: Unlock Holy + player.finishQuest( getId() ); + } +}; + +EXPOSE_SCRIPT( JobWhm451 ); \ No newline at end of file diff --git a/src/scripts/quest/classquest/WHM/JobWhm500.cpp b/src/scripts/quest/classquest/WHM/JobWhm500.cpp new file mode 100644 index 00000000..6601c2ab --- /dev/null +++ b/src/scripts/quest/classquest/WHM/JobWhm500.cpp @@ -0,0 +1,243 @@ +// 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: JobWhm500_01084 +// Quest Name: Heart of the Forest +// Quest ID: 66620 +// Start NPC: 1006751 +// End NPC: 1006751 + +using namespace Sapphire; + +class JobWhm500 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AL + + /// Countable Num: 0 Seq: 1 Event: 1 Listener: 2002408 + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 1007854 + // 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 = 1006751;//Raya-o-Senna + static constexpr auto Actor1 = 1007854;//Raya-o-Senna (Seq1) + static constexpr auto Actor2 = 1007855;//A-Ruhn-Senna + static constexpr auto Eobject0 = 2002408;//Destination + static constexpr auto Eobject1 = 2002526; + static constexpr auto EventActionQuietLong = 43; + static constexpr auto EventActionSearch = 1; + static constexpr auto LocAction0Wsget = 995; + static constexpr auto LocActor0 = 1007131; + static constexpr auto LocActor1 = 1007861; + static constexpr auto LocActor2 = 1007862; + static constexpr auto LocLogMes = 3652; + static constexpr auto LocPosActor1 = 4307833; + static constexpr auto LocPosActor2 = 4307834; + static constexpr auto LocVfx1 = 241; + static constexpr auto LocVfx2 = 413; + static constexpr auto LocWs = 140; + static constexpr auto Logmessage0 = 3656; + static constexpr auto Questbattle0 = 76; + static constexpr auto Territorytype0 = 320; + +public: + JobWhm500() : Sapphire::ScriptAPI::QuestScript( 66620 ){}; + ~JobWhm500() = 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 ) + Scene00004( quest, player ); + break; + } + case Actor2: + { + if( quest.getSeq() == Seq1 ) + Scene00005( quest, player ); + break; + } + case Eobject0: + { + eventMgr().eventActionStart( + player, getId(), EventActionQuietLong, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { + //TODO: Selecting "Procede" causes the game to fade out, so if we don't send the player to an instance it soft-locks them. + //Scene00003( quest, player ); + Scene00002( quest, player );//Empty Scene used as temporary solution + + }, + nullptr, 0 ); + 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( &JobWhm500::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, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, bindSceneReturn( &JobWhm500::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, NONE, bindSceneReturn( &JobWhm500::Scene00002Return ) ); + } + + void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + playerMgr().sendUrgent( player, "QuestBattle content is currently broken. The fight has been skipped for you." ); + quest.setSeq( SeqFinish ); + eventMgr().sendEventNotice( player, getId(), 0, 0 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00003( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 3, HIDE_HOTBAR, bindSceneReturn( &JobWhm500::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if (result.getResult(0) == 1) { + //TODO: QuestBattle content + + auto& pTeriMgr = Common::Service< Sapphire::World::Manager::TerritoryMgr >::ref(); + + eventMgr().eventFinish( player, result.eventId, 0 ); + pTeriMgr.createAndJoinQuestBattle( player, Questbattle0 ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00004( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 4, HIDE_HOTBAR, bindSceneReturn( &JobWhm500::Scene00004Return ) ); + } + + void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00005( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 5, HIDE_HOTBAR, bindSceneReturn( &JobWhm500::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, NONE, bindSceneReturn( &JobWhm500::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, NONE, bindSceneReturn( &JobWhm500::Scene00007Return ) ); + } + + void Scene00007Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00008( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 8, HIDE_HOTBAR, bindSceneReturn( &JobWhm500::Scene00008Return ) ); + } + + void Scene00008Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + Scene00009( quest, player ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00009( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 9, FADE_OUT | HIDE_UI, bindSceneReturn( &JobWhm500::Scene00009Return ) ); + } + + void Scene00009Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + //TODO: Unlock Benediction + player.finishQuest( getId() ); + } +}; + +EXPOSE_SCRIPT( JobWhm500 ); \ No newline at end of file From b3bd756946935ef62c1665b3cd221c72964007ce Mon Sep 17 00:00:00 2001 From: dude22072 Date: Tue, 17 Jan 2023 16:56:30 -0600 Subject: [PATCH 14/22] Gridania Sidequests --- .../quest/subquest/gridania/BanIxa001.cpp | 681 ++++++++++++++++++ .../quest/subquest/gridania/BanSyl001.cpp | 162 +++++ .../quest/subquest/gridania/GaiUsa907.cpp | 128 ++++ .../quest/subquest/gridania/GaiUsa908.cpp | 293 ++++++++ .../quest/subquest/gridania/SubFst012.cpp | 222 ++++++ 5 files changed, 1486 insertions(+) create mode 100644 src/scripts/quest/subquest/gridania/BanIxa001.cpp create mode 100644 src/scripts/quest/subquest/gridania/BanSyl001.cpp create mode 100644 src/scripts/quest/subquest/gridania/GaiUsa907.cpp create mode 100644 src/scripts/quest/subquest/gridania/GaiUsa908.cpp create mode 100644 src/scripts/quest/subquest/gridania/SubFst012.cpp diff --git a/src/scripts/quest/subquest/gridania/BanIxa001.cpp b/src/scripts/quest/subquest/gridania/BanIxa001.cpp new file mode 100644 index 00000000..7ea18c80 --- /dev/null +++ b/src/scripts/quest/subquest/gridania/BanIxa001.cpp @@ -0,0 +1,681 @@ +// 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: BanIxa001_01486 +// Quest Name: A Bad Bladder +// Quest ID: 67022 +// Start NPC: 1009294 +// End NPC: 1009199 + +using namespace Sapphire; + +class BanIxa001 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AL + // UI8BH + + /// Countable Num: 1 Seq: 1 Event: 1 Listener: 1000612 + /// Countable Num: 1 Seq: 2 Event: 1 Listener: 1009294 + /// Countable Num: 1 Seq: 3 Event: 1 Listener: 2004442 + /// Countable Num: 1 Seq: 4 Event: 1 Listener: 2004519 + /// Countable Num: 1 Seq: 255 Event: 1 Listener: 2004520 + // 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 = 1009294;//Scarlet <> + static constexpr auto Actor1 = 1000612;//Guithrit + static constexpr auto Actor2 = 1009199; + static constexpr auto Eobject0 = 2004442;//War Balloon Debris + static constexpr auto Eobject1 = 2004519; + static constexpr auto Eobject2 = 2004520; + static constexpr auto Eobject3 = 2004521; + static constexpr auto Eobject4 = 2004443;//Izal Storage Pot + static constexpr auto Eobject5 = 2004444; + static constexpr auto EventActionProcessUpperMiddle = 32; + static constexpr auto EventActionSearch = 1; + static constexpr auto EventActionSearchMiddle = 3; + static constexpr auto Item0 = 2001363; + static constexpr auto LocActor0 = 1009592; + static constexpr auto LocActor1 = 1009593; + static constexpr auto LocBgm1 = 78; + static constexpr auto LocPosActor0 = 4892133; + static constexpr auto MotEventActTalk = 972; + static constexpr auto MotEventCatfight = 970; + static constexpr auto MotEventDirection = 971; + static constexpr auto MotEventJoy = 953; + +public: + BanIxa001() : Sapphire::ScriptAPI::QuestScript( 67022 ){}; + ~BanIxa001() = 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() == Seq1 ) + Scene00003( quest, player ); + else if( quest.getSeq() == Seq2 ) + Scene00012( quest, player ); + else if( quest.getSeq() == Seq3 ) + Scene00016( quest, player ); + else if( quest.getSeq() == Seq4 ) + Scene00025( quest, player ); + else if( quest.getSeq() == SeqFinish ) + Scene00037( quest, player ); + break; + } + case Actor1: + { + if( quest.getSeq() == Seq1 ) + Scene00002( quest, player ); + else if( quest.getSeq() == Seq2 ) + Scene00013( quest, player ); + else if( quest.getSeq() == Seq3 ) + Scene00014( quest, player ); + else if( quest.getSeq() == Seq4 ) + Scene00026( quest, player ); + else if( quest.getSeq() == SeqFinish ) + Scene00038( quest, player ); + break; + } + case Actor2: + { + if( quest.getSeq() == SeqFinish ) + Scene00035( quest, player ); + break; + } + case Eobject0: + { + eventMgr().eventActionStart( + player, getId(), EventActionSearchMiddle, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { + Scene00005( quest, player ); + }, + nullptr, 0 ); + break; + } + case Eobject4: + { + eventMgr().eventActionStart( + player, getId(), EventActionProcessUpperMiddle, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { + Scene00024( quest, player ); + }, + nullptr, 0 ); + 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( &BanIxa001::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( &BanIxa001::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( &BanIxa001::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( &BanIxa001::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00004( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 4, NONE, bindSceneReturn( &BanIxa001::Scene00004Return ) ); + } + + void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00005( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 5, HIDE_HOTBAR, bindSceneReturn( &BanIxa001::Scene00005Return ) ); + } + + void Scene00005Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8BH( 1 ); + eventMgr().sendEventNotice( player, getId(), 1, 0 ); + quest.setSeq( Seq3 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00006( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 6, NONE, bindSceneReturn( &BanIxa001::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, NONE, bindSceneReturn( &BanIxa001::Scene00007Return ) ); + } + + void Scene00007Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00008( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 8, NONE, bindSceneReturn( &BanIxa001::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, NONE, bindSceneReturn( &BanIxa001::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, NONE, bindSceneReturn( &BanIxa001::Scene00010Return ) ); + } + + void Scene00010Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00011( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 11, NONE, bindSceneReturn( &BanIxa001::Scene00011Return ) ); + } + + void Scene00011Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00012( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 12, HIDE_HOTBAR, bindSceneReturn( &BanIxa001::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( &BanIxa001::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( &BanIxa001::Scene00014Return ) ); + } + + void Scene00014Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + Scene00015( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00015( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 15, HIDE_HOTBAR, bindSceneReturn( &BanIxa001::Scene00015Return ) ); + } + + void Scene00015Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 2, 0 ); + quest.setSeq( Seq4 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00016( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 16, HIDE_HOTBAR, bindSceneReturn( &BanIxa001::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, NONE, bindSceneReturn( &BanIxa001::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, NONE, bindSceneReturn( &BanIxa001::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, NONE, bindSceneReturn( &BanIxa001::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, NONE, bindSceneReturn( &BanIxa001::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, NONE, bindSceneReturn( &BanIxa001::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, NONE, bindSceneReturn( &BanIxa001::Scene00022Return ) ); + } + + void Scene00022Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00023( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 23, NONE, bindSceneReturn( &BanIxa001::Scene00023Return ) ); + } + + void Scene00023Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00024( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 24, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, bindSceneReturn( &BanIxa001::Scene00024Return ) ); + } + + void Scene00024Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 3, 0 ); + quest.setSeq( SeqFinish ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00025( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 25, HIDE_HOTBAR, bindSceneReturn( &BanIxa001::Scene00025Return ) ); + } + + void Scene00025Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00026( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 26, HIDE_HOTBAR, bindSceneReturn( &BanIxa001::Scene00026Return ) ); + } + + void Scene00026Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00027( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 27, NONE, bindSceneReturn( &BanIxa001::Scene00027Return ) ); + } + + void Scene00027Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00028( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 28, NONE, bindSceneReturn( &BanIxa001::Scene00028Return ) ); + } + + void Scene00028Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00029( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 29, NONE, bindSceneReturn( &BanIxa001::Scene00029Return ) ); + } + + void Scene00029Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00030( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 30, NONE, bindSceneReturn( &BanIxa001::Scene00030Return ) ); + } + + void Scene00030Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00031( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 31, NONE, bindSceneReturn( &BanIxa001::Scene00031Return ) ); + } + + void Scene00031Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00032( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 32, NONE, bindSceneReturn( &BanIxa001::Scene00032Return ) ); + } + + void Scene00032Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00033( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 33, NONE, bindSceneReturn( &BanIxa001::Scene00033Return ) ); + } + + void Scene00033Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00034( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 34, NONE, bindSceneReturn( &BanIxa001::Scene00034Return ) ); + } + + void Scene00034Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00035( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 35, HIDE_HOTBAR, bindSceneReturn( &BanIxa001::Scene00035Return ) ); + } + + void Scene00035Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + Scene00036( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00036( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 36, HIDE_HOTBAR, bindSceneReturn( &BanIxa001::Scene00036Return ) ); + } + + void Scene00036Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + player.finishQuest( getId() ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00037( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 37, HIDE_HOTBAR, bindSceneReturn( &BanIxa001::Scene00037Return ) ); + } + + void Scene00037Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00038( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 38, HIDE_HOTBAR, bindSceneReturn( &BanIxa001::Scene00038Return ) ); + } + + void Scene00038Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00039( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 39, NONE, bindSceneReturn( &BanIxa001::Scene00039Return ) ); + } + + void Scene00039Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00040( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 40, NONE, bindSceneReturn( &BanIxa001::Scene00040Return ) ); + } + + void Scene00040Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00041( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 41, NONE, bindSceneReturn( &BanIxa001::Scene00041Return ) ); + } + + void Scene00041Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00042( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 42, NONE, bindSceneReturn( &BanIxa001::Scene00042Return ) ); + } + + void Scene00042Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00043( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 43, NONE, bindSceneReturn( &BanIxa001::Scene00043Return ) ); + } + + void Scene00043Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00044( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 44, NONE, bindSceneReturn( &BanIxa001::Scene00044Return ) ); + } + + void Scene00044Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00045( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 45, NONE, bindSceneReturn( &BanIxa001::Scene00045Return ) ); + } + + void Scene00045Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00046( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 46, NONE, bindSceneReturn( &BanIxa001::Scene00046Return ) ); + } + + void Scene00046Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } +}; + +EXPOSE_SCRIPT( BanIxa001 ); \ No newline at end of file diff --git a/src/scripts/quest/subquest/gridania/BanSyl001.cpp b/src/scripts/quest/subquest/gridania/BanSyl001.cpp new file mode 100644 index 00000000..a62ef82c --- /dev/null +++ b/src/scripts/quest/subquest/gridania/BanSyl001.cpp @@ -0,0 +1,162 @@ +// 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: BanSyl001_01252 +// Quest Name: Seeking Solace +// Quest ID: 66788 +// Start NPC: 1000168 +// End NPC: 1005564 + +using namespace Sapphire; + +class BanSyl001 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // UI8AL + + /// Countable Num: 0 Seq: 1 Event: 1 Listener: 1005564 + /// Countable Num: 0 Seq: 2 Event: 1 Listener: 1005577 + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 1005564 + // 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 = 1000168;//Vorsaile Heuloix <> + static constexpr auto Actor1 = 1005564;//Olmxio + static constexpr auto Actor2 = 1005577;//Frixio + static constexpr auto MotEventJoy = 953; + +public: + BanSyl001() : Sapphire::ScriptAPI::QuestScript( 66788 ){}; + ~BanSyl001() = 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() == SeqFinish ) + Scene00004( quest, player ); + break; + } + case Actor2: + { + if( quest.getSeq() == Seq2 ) + Scene00003( quest, player ); + else if( quest.getSeq() == SeqFinish ) + Scene00005( 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( &BanSyl001::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( &BanSyl001::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( &BanSyl001::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( &BanSyl001::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( &BanSyl001::Scene00004Return ) ); + } + + void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + player.finishQuest( getId() ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00005( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 5, HIDE_HOTBAR, bindSceneReturn( &BanSyl001::Scene00005Return ) ); + } + + void Scene00005Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } +}; + +EXPOSE_SCRIPT( BanSyl001 ); \ No newline at end of file diff --git a/src/scripts/quest/subquest/gridania/GaiUsa907.cpp b/src/scripts/quest/subquest/gridania/GaiUsa907.cpp new file mode 100644 index 00000000..ef57eabf --- /dev/null +++ b/src/scripts/quest/subquest/gridania/GaiUsa907.cpp @@ -0,0 +1,128 @@ +// 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: GaiUsa907_00802 +// Quest Name: Broadening Horizons +// Quest ID: 66338 +// Start NPC: 1006259 +// End NPC: 1000171 + +using namespace Sapphire; + +class GaiUsa907 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // UI8AL + // UI8BH + + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 1000171 + // 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 = 1006259;//Tyoh Moui + static constexpr auto Actor1 = 1000171;//Franchemontiaux <> + static constexpr auto Item0 = 2000791; + +public: + GaiUsa907() : Sapphire::ScriptAPI::QuestScript( 66338 ){}; + ~GaiUsa907() = 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, NONE, bindSceneReturn( &GaiUsa907::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, NONE, bindSceneReturn( &GaiUsa907::Scene00001Return ) ); + } + + void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setSeq( SeqFinish ); + quest.setUI8BH( 1 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00002( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 2, NONE, bindSceneReturn( &GaiUsa907::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, NONE, bindSceneReturn( &GaiUsa907::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + //TODO: Unlock Gate Aethernet? + player.finishQuest( getId() ); + } + } +}; + +EXPOSE_SCRIPT( GaiUsa907 ); \ No newline at end of file diff --git a/src/scripts/quest/subquest/gridania/GaiUsa908.cpp b/src/scripts/quest/subquest/gridania/GaiUsa908.cpp new file mode 100644 index 00000000..176072ac --- /dev/null +++ b/src/scripts/quest/subquest/gridania/GaiUsa908.cpp @@ -0,0 +1,293 @@ +// 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: GaiUsa908_00803 +// Quest Name: Beneath the Planks +// Quest ID: 66339 +// Start NPC: 1006694 +// End NPC: 1006260 + +using namespace Sapphire; + +class GaiUsa908 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AH + // UI8AL + // UI8BH + // UI8BL + + /// Countable Num: 0 Seq: 1 Event: 1 Listener: 1006260 + /// Countable Num: 0 Seq: 2 Event: 1 Listener: 2002000 + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 2002001 + // 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 = 1006694;//ROUSTEBANT + static constexpr auto Actor1 = 1006260;//Thievenaix + static constexpr auto Enemy0 = 4287003; + static constexpr auto Eobject0 = 2002000;//Damp Scaffolding + static constexpr auto Eobject1 = 2002001;//Damp Scaffolding + static constexpr auto Eobject2 = 2002002;//Damp Scaffolding + static constexpr auto EventActionSearch = 1; + +public: + GaiUsa908() : Sapphire::ScriptAPI::QuestScript( 66339 ){}; + ~GaiUsa908() = 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() == SeqFinish ) + Scene00009( quest, player ); + break; + } + case Eobject0: + { + eventMgr().eventActionStart( + player, getId(), EventActionSearch, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { + Scene00004( quest, player ); + }, + nullptr, 0 ); + break; + } + case Eobject1: + { + eventMgr().eventActionStart( + player, getId(), EventActionSearch, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { + Scene00006( quest, player ); + }, + nullptr, 0 ); + break; + } + case Eobject2: + { + eventMgr().eventActionStart( + player, getId(), EventActionSearch, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { + Scene00008( quest, player ); + }, + nullptr, 0 ); + break; + } + } + } + + void onBNpcKill( World::Quest& quest, Sapphire::Entity::BNpc& bnpc, Sapphire::Entity::Player& player ) override + { + switch( bnpc.getLayoutId() ) + { + case Enemy0: + { + quest.setUI8AH( quest.getUI8AH() + 1 ); + quest.setUI8BL( 1 ); + eventMgr().sendEventNotice( player, getId(), 1, 2, quest.getUI8AH(), 3 ); + checkQuestCompletion( quest, player ); + break; + } + } + } + + void onPlayerDeath( World::Quest& quest, Sapphire::Entity::Player& player ) override + { + auto instance = teriMgr().getTerritoryByGuId( player.getTerritoryId() ); + + auto enem0 = instance->getActiveBNpcByLayoutIdAndTriggerOwner( Enemy0, player.getId() ); + + if( enem0 != nullptr ) instance->removeActor( enem0 ); + + quest.setBitFlag8( 3, false ); + } + +private: + void checkQuestCompletion( World::Quest& quest, Entity::Player& player ) + { + if( quest.getUI8AH() >= 3 ) + { + quest.setUI8AH( 0 ); + quest.setUI8AL( 0 ); + quest.setUI8BH( 0 ); + quest.setUI8BL( 0 ); + quest.setBitFlag8( 1, false ); + quest.setBitFlag8( 2, false ); + quest.setBitFlag8( 3, false ); + 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, NONE, bindSceneReturn( &GaiUsa908::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( &GaiUsa908::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( &GaiUsa908::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, NONE, bindSceneReturn( &GaiUsa908::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00004( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 4, NONE, bindSceneReturn( &GaiUsa908::Scene00004Return ) ); + } + + void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8AH( quest.getUI8AH() + 1 ); + quest.setUI8AL( 1 ); + quest.setBitFlag8( 1, true ); + eventMgr().sendEventNotice( player, getId(), 1, 2, quest.getUI8AH(), 3 ); + checkQuestCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00005( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 5, NONE, bindSceneReturn( &GaiUsa908::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, NONE, bindSceneReturn( &GaiUsa908::Scene00006Return ) ); + } + + void Scene00006Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8AH( quest.getUI8AH() + 1 ); + quest.setUI8BH( 1 ); + quest.setBitFlag8( 2, true ); + eventMgr().sendEventNotice( player, getId(), 1, 2, quest.getUI8AH(), 3 ); + checkQuestCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00007( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 7, NONE, bindSceneReturn( &GaiUsa908::Scene00007Return ) ); + } + + void Scene00007Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00008( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 8, NONE, bindSceneReturn( &GaiUsa908::Scene00008Return ) ); + } + + void Scene00008Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + auto instance = teriMgr().getTerritoryByGuId( player.getTerritoryId() ); + auto enemy = instance->createBNpcFromLayoutId( Enemy0, 1220 /*Find the right value*/, Common::BNpcType::Enemy, player.getId() ); + enemy->hateListAddDelayed( player.getAsPlayer(), 1 ); + + quest.setBitFlag8( 3, true ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00009( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 9, NONE, bindSceneReturn( &GaiUsa908::Scene00009Return ) ); + } + + void Scene00009Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + player.finishQuest( getId(), result.getResult( 1 ) ); + } + } +}; + +EXPOSE_SCRIPT( GaiUsa908 ); \ No newline at end of file diff --git a/src/scripts/quest/subquest/gridania/SubFst012.cpp b/src/scripts/quest/subquest/gridania/SubFst012.cpp new file mode 100644 index 00000000..5c9992ff --- /dev/null +++ b/src/scripts/quest/subquest/gridania/SubFst012.cpp @@ -0,0 +1,222 @@ +// 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: SubFst012_00038 +// Quest Name: Parsemontrenomics +// Quest ID: 65574 +// Start NPC: 1000768 +// End NPC: 1000248 + +using namespace Sapphire; + +class SubFst012 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AL + // UI8BH + // UI8BL + // UI8CH + // UI8CL + // UI8DH + + /// Countable Num: 1 Seq: 1 Event: 1 Listener: 1000214 + /// Countable Num: 1 Seq: 1 Event: 1 Listener: 1000218 + /// Countable Num: 1 Seq: 1 Event: 1 Listener: 1000238 + /// Countable Num: 1 Seq: 255 Event: 1 Listener: 1000248 + // 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 = 1000768;//Parsemontret + static constexpr auto Actor1 = 1000214;//Gurthcid + static constexpr auto Actor2 = 1000218;//Admiranda <> + static constexpr auto Actor3 = 1000238;//Alaric <> + static constexpr auto Actor4 = 1000248;//Ceinguled + static constexpr auto Item0 = 2000081; + static constexpr auto Item1 = 2000082; + static constexpr auto Item2 = 2000083; + static constexpr auto Seq0Actor0 = 0; + static constexpr auto Seq1Actor1 = 1; + static constexpr auto Seq1Actor2 = 2; + static constexpr auto Seq1Actor3 = 3; + static constexpr auto Seq2Actor4 = 4; + static constexpr auto Seq2Actor4Npctradeno = 99; + static constexpr auto Seq2Actor4Npctradeok = 100; + +public: + SubFst012() : Sapphire::ScriptAPI::QuestScript( 65574 ){}; + ~SubFst012() = 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 ) + Scene00001( quest, player ); + break; + } + case Actor2: + { + if( quest.getSeq() == Seq1 ) + Scene00002( quest, player ); + break; + } + case Actor3: + { + if( quest.getSeq() == Seq1 ) + Scene00003( quest, player ); + break; + } + case Actor4: + { + if( quest.getSeq() == SeqFinish ) + Scene00004( quest, player ); + break; + } + } + } + + +private: + void checkQuestCompletion( World::Quest& quest, Entity::Player& player ) + { + if( quest.getUI8AL() && quest.getUI8BH() && quest.getUI8BL() ) + { + quest.setSeq( SeqFinish ); + quest.setUI8AL( 0 ); + quest.setUI8BH( 1 ); + quest.setUI8BL( 1 ); + quest.setUI8CH( 1 ); + quest.setUI8CL( 0 ); + quest.setUI8DH( 0 ); + } + } + ////////////////////////////////////////////////////////////////////// + // 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( &SubFst012::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( &SubFst012::Scene00001Return ) ); + } + + void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8AL( 1 ); + quest.setUI8CH( 1 ); + eventMgr().sendEventNotice( player, getId(), 0, 0 ); + checkQuestCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00002( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 2, HIDE_HOTBAR, bindSceneReturn( &SubFst012::Scene00002Return ) ); + } + + void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8BH( 1 ); + quest.setUI8CL( 1 ); + eventMgr().sendEventNotice( player, getId(), 1, 0 ); + checkQuestCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00003( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 3, HIDE_HOTBAR, bindSceneReturn( &SubFst012::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8BL( 1 ); + quest.setUI8DH( 1 ); + eventMgr().sendEventNotice( player, getId(), 2, 0 ); + checkQuestCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00004( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 4, HIDE_HOTBAR, bindSceneReturn( &SubFst012::Scene00004Return ) ); + } + + void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + Scene00100( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00099( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 99, NONE, bindSceneReturn( &SubFst012::Scene00099Return ) ); + } + + void Scene00099Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00100( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 100, HIDE_HOTBAR, bindSceneReturn( &SubFst012::Scene00100Return ) ); + } + + void Scene00100Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + player.finishQuest( getId() ); + } + } +}; + +EXPOSE_SCRIPT( SubFst012 ); \ No newline at end of file From 4f954ba328b7f10b54d1baaa88649419b982a75f Mon Sep 17 00:00:00 2001 From: dude22072 Date: Tue, 17 Jan 2023 17:03:24 -0600 Subject: [PATCH 15/22] Fix LogMessage stuff --- src/scripts/quest/classquest/WHM/JobWhm350.cpp | 2 +- src/scripts/quest/classquest/WHM/JobWhm450.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/scripts/quest/classquest/WHM/JobWhm350.cpp b/src/scripts/quest/classquest/WHM/JobWhm350.cpp index 7c45ae54..b8019a72 100644 --- a/src/scripts/quest/classquest/WHM/JobWhm350.cpp +++ b/src/scripts/quest/classquest/WHM/JobWhm350.cpp @@ -222,7 +222,7 @@ private: void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { eventMgr().sendEventNotice( player, getId(), 0, 0 ); - //TODO: Show the "Your communion has furthered your potentional as a white mage." message. Is it that logmessage0 var? + playerMgr().sendLogMessage( player, Logmessage0 ); quest.setSeq( SeqFinish ); } diff --git a/src/scripts/quest/classquest/WHM/JobWhm450.cpp b/src/scripts/quest/classquest/WHM/JobWhm450.cpp index b7a316b9..4953a214 100644 --- a/src/scripts/quest/classquest/WHM/JobWhm450.cpp +++ b/src/scripts/quest/classquest/WHM/JobWhm450.cpp @@ -215,7 +215,7 @@ private: void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { eventMgr().sendEventNotice( player, getId(), 0, 0 );//TODO:Item Icon, Cleric's Gloves - //TODO: Show "Your Garb is not blessed with the power of A-Towa-Cant." message (Logmessage0?) + playerMgr().sendLogMessage( player, Logmessage0 ); quest.setUI8AL( 1 ); quest.setUI8CH( 0 ); checkQuestCompletion( quest, player ); @@ -242,7 +242,7 @@ private: void Scene00005Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { eventMgr().sendEventNotice( player, getId(), 1, 0 );//TODO:Item Icon, Cleric's Culottes - //TODO: Show "Your Garb is not blessed with the power of A-Towa-Cant." message (Logmessage0?) + playerMgr().sendLogMessage( player, Logmessage0 ); quest.setUI8BH( 1 ); quest.setUI8CL( 0 ); checkQuestCompletion( quest, player ); @@ -269,7 +269,7 @@ private: void Scene00007Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { eventMgr().sendEventNotice( player, getId(), 2, 0 );//TODO:Item Icon, Cleric's Boots - //TODO: Show "Your Garb is not blessed with the power of A-Towa-Cant." message (Logmessage0?) + playerMgr().sendLogMessage( player, Logmessage0 ); quest.setUI8BL( 1 ); quest.setUI8DH( 0 ); checkQuestCompletion( quest, player ); @@ -437,7 +437,7 @@ private: void Scene00021Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { eventMgr().sendEventNotice( player, getId(), 6, 0 );//TODO:Item Icon, Cleric's Circlet - //TODO: Show "Your Garb is not blessed with the power of A-Towa-Cant." message (Logmessage0?) + playerMgr().sendLogMessage( player, Logmessage0 ); quest.setSeq( SeqFinish ); quest.setUI8BH( 0 ); } From 1db2c0a14e7410ae67d718786f7f5fe4b8e1d8a2 Mon Sep 17 00:00:00 2001 From: dude22072 Date: Tue, 17 Jan 2023 17:03:55 -0600 Subject: [PATCH 16/22] Fix semicolon that made linux build unhappy --- src/scripts/quest/classquest/WHM/JobWhm001.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/quest/classquest/WHM/JobWhm001.cpp b/src/scripts/quest/classquest/WHM/JobWhm001.cpp index 0c607406..4a809993 100644 --- a/src/scripts/quest/classquest/WHM/JobWhm001.cpp +++ b/src/scripts/quest/classquest/WHM/JobWhm001.cpp @@ -8,7 +8,7 @@ #include #include "Actor/BNpc.h" -#include "Inventory/Item.h"; +#include "Inventory/Item.h" // Quest Script: JobWhm001_01124 // Quest Name: A Relic Reborn (Thyrus) From ca8c40672c9c48f5195af8d9cb2d0fb6f06a396c Mon Sep 17 00:00:00 2001 From: dude22072 Date: Tue, 17 Jan 2023 17:21:52 -0600 Subject: [PATCH 17/22] Fix White Wolf Gate unlock --- src/scripts/quest/subquest/gridania/GaiUsa907.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/quest/subquest/gridania/GaiUsa907.cpp b/src/scripts/quest/subquest/gridania/GaiUsa907.cpp index ef57eabf..8fb6868e 100644 --- a/src/scripts/quest/subquest/gridania/GaiUsa907.cpp +++ b/src/scripts/quest/subquest/gridania/GaiUsa907.cpp @@ -119,7 +119,7 @@ private: if( result.getResult( 0 ) == 1 ) { - //TODO: Unlock Gate Aethernet? + player.registerAetheryte(54); player.finishQuest( getId() ); } } From 83428a56d09ae0bb432a8fef7c588e8ee1ef24be Mon Sep 17 00:00:00 2001 From: dude22072 Date: Tue, 17 Jan 2023 17:34:04 -0600 Subject: [PATCH 18/22] linux are you happy yet --- src/scripts/quest/classquest/WHM/JobWhm350.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/scripts/quest/classquest/WHM/JobWhm350.cpp b/src/scripts/quest/classquest/WHM/JobWhm350.cpp index b8019a72..7f1969ad 100644 --- a/src/scripts/quest/classquest/WHM/JobWhm350.cpp +++ b/src/scripts/quest/classquest/WHM/JobWhm350.cpp @@ -122,8 +122,7 @@ public: void onPlayerDeath( World::Quest& quest, Sapphire::Entity::Player& player ) override { - auto& teriMgr = Common::Service< Sapphire::World::Manager::TerritoryMgr >::ref(); - auto& instance = teriMgr.getTerritoryByGuId( player.getTerritoryId() ); + auto instance = teriMgr().getTerritoryByGuId( player.getTerritoryId() ); auto enem0 = instance->getActiveBNpcByLayoutIdAndTriggerOwner( Enemy0, player.getId() ); auto enem1 = instance->getActiveBNpcByLayoutIdAndTriggerOwner( Enemy1, player.getId() ); From 0926f25fc5dfd13ee611616bece7f252e4b40f27 Mon Sep 17 00:00:00 2001 From: dude22072 Date: Tue, 17 Jan 2023 17:48:01 -0600 Subject: [PATCH 19/22] linux please --- src/scripts/quest/classquest/WHM/JobWhm350.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/scripts/quest/classquest/WHM/JobWhm350.cpp b/src/scripts/quest/classquest/WHM/JobWhm350.cpp index 7f1969ad..ad93b6d0 100644 --- a/src/scripts/quest/classquest/WHM/JobWhm350.cpp +++ b/src/scripts/quest/classquest/WHM/JobWhm350.cpp @@ -174,8 +174,7 @@ private: void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - auto& teriMgr = Common::Service< Sapphire::World::Manager::TerritoryMgr >::ref(); - auto& instance = teriMgr.getTerritoryByGuId( player.getTerritoryId() ); + auto instance = teriMgr().getTerritoryByGuId( player.getTerritoryId() ); bool enemy0Spawned = instance->getActiveBNpcByLayoutIdAndTriggerOwner( Enemy0, player.getId() ) != nullptr; bool enemy1Spawned = instance->getActiveBNpcByLayoutIdAndTriggerOwner( Enemy1, player.getId() ) != nullptr; From 4c8724cff969923943b1d5d2f79d9c9654a3348a Mon Sep 17 00:00:00 2001 From: dude22072 Date: Tue, 17 Jan 2023 20:08:32 -0600 Subject: [PATCH 20/22] Harvest Dance quest --- .../quest/subquest/gridania/SubFst159.cpp | 396 ++++++++++++++++++ 1 file changed, 396 insertions(+) create mode 100644 src/scripts/quest/subquest/gridania/SubFst159.cpp diff --git a/src/scripts/quest/subquest/gridania/SubFst159.cpp b/src/scripts/quest/subquest/gridania/SubFst159.cpp new file mode 100644 index 00000000..9ec74734 --- /dev/null +++ b/src/scripts/quest/subquest/gridania/SubFst159.cpp @@ -0,0 +1,396 @@ +// 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: SubFst159_01425 +// Quest Name: Saw That One Coming +// Quest ID: 66961 +// Start NPC: 1000375 +// End NPC: 1007792 + +using namespace Sapphire; + +class SubFst159 : public Sapphire::ScriptAPI::QuestScript +{ +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AL + // UI8BH + + /// Countable Num: 1 Seq: 1 Event: 1 Listener: 1007792 + /// Countable Num: 1 Seq: 2 Event: 1 Listener: 1000153 + /// Countable Num: 3 Seq: 3 Event: 1 Listener: 1007792 + /// Countable Num: 1 Seq: 255 Event: 1 Listener: 1007793 + // 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 = 1000375;//Eral + static constexpr auto Actor1 = 1007792;//Yedythe + static constexpr auto Actor2 = 1000153;//Beatine <> + static constexpr auto Actor3 = 1007793;//Bubbly Boy + static constexpr auto Actor4 = 1007794;//Gleeful Girl + static constexpr auto Actor5 = 1007795;//Bashful Boy + static constexpr auto Actor6 = 1007969; + static constexpr auto Actor7 = 1007970; + static constexpr auto Actor8 = 1007971; + static constexpr auto EventActionSearch = 1; + static constexpr auto Item0 = 2001249; + static constexpr auto LocActor0 = 1007990; + static constexpr auto LocActor1 = 1007991; + static constexpr auto LocActor2 = 1007992; + static constexpr auto LocActor3 = 1000153; + static constexpr auto LocBgm = 88; + static constexpr auto LocBgm2 = 87; + static constexpr auto LocFace0 = 604; + static constexpr auto LocFace1 = 605; + static constexpr auto LocFace2 = 614; + static constexpr auto LocMotion1 = 571; + static constexpr auto LocMotion2 = 572; + static constexpr auto LocPosActor0 = 4666289; + static constexpr auto LocPosActor1 = 4666740; + static constexpr auto Quest0 = 65741; + +public: + SubFst159() : Sapphire::ScriptAPI::QuestScript( 66961 ){}; + ~SubFst159() = 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 ) + Scene00004( quest, player ); + else if( quest.getSeq() == Seq3 ) + Scene00014( quest, player ); + else if( quest.getSeq() == SeqFinish ) + Scene00015( quest, player ); + break; + } + case Actor2: + { + if( quest.getSeq() == Seq2 ) + Scene00003( quest, player ); + break; + } + case Actor3: + { + if( quest.getSeq() == Seq3 ) + Scene00005( quest, player ); + break; + } + case Actor4: + { + if( quest.getSeq() == Seq3 ) + Scene00008( quest, player ); + break; + } + case Actor5: + { + if( quest.getSeq() == Seq3 ) + Scene00011( quest, player ); + break; + } + case Actor6: + { + break; + } + case Actor7: + { + break; + } + case Actor8: + { + break; + } + } + } + + +private: + void checkQuestCompletion( World::Quest& quest, Entity::Player& player ) + { + eventMgr().sendEventNotice( player, getId(), 2, 2, quest.getUI8AL(), 3 ); + if( quest.getUI8AL() >= 3 ) + { + quest.setUI8AL( 0 ); + quest.setBitFlag8( 1, false ); + quest.setBitFlag8( 2, false ); + quest.setBitFlag8( 3, false ); + 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( &SubFst159::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( &SubFst159::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( &SubFst159::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( &SubFst159::Scene00003Return ) ); + } + + void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + eventMgr().sendEventNotice( player, getId(), 1, 0 ); + quest.setSeq( Seq3 ); + quest.setUI8BH( 3 ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00004( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 4, HIDE_HOTBAR, bindSceneReturn( &SubFst159::Scene00004Return ) ); + } + + void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00005( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 5, HIDE_HOTBAR, bindSceneReturn( &SubFst159::Scene00005Return ) ); + } + + void Scene00005Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + Scene00006( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00006( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 6, HIDE_HOTBAR, bindSceneReturn( &SubFst159::Scene00006Return ) ); + } + + void Scene00006Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8AL( quest.getUI8AL() + 1 ); + quest.setUI8BH( quest.getUI8BH() - 1 ); + quest.setBitFlag8( 1, true ); + checkQuestCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00007( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 7, NONE, bindSceneReturn( &SubFst159::Scene00007Return ) ); + } + + void Scene00007Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00008( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 8, HIDE_HOTBAR, bindSceneReturn( &SubFst159::Scene00008Return ) ); + } + + void Scene00008Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + Scene00009( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00009( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 9, HIDE_HOTBAR, bindSceneReturn( &SubFst159::Scene00009Return ) ); + } + + void Scene00009Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8AL( quest.getUI8AL() + 1 ); + quest.setUI8BH( quest.getUI8BH() - 1 ); + quest.setBitFlag8( 2, true ); + checkQuestCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00010( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 10, NONE, bindSceneReturn( &SubFst159::Scene00010Return ) ); + } + + void Scene00010Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00011( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 11, HIDE_HOTBAR, bindSceneReturn( &SubFst159::Scene00011Return ) ); + } + + void Scene00011Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + Scene00012( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00012( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 12, HIDE_HOTBAR, bindSceneReturn( &SubFst159::Scene00012Return ) ); + } + + void Scene00012Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + quest.setUI8AL( quest.getUI8AL() + 1 ); + quest.setUI8BH( quest.getUI8BH() - 1 ); + quest.setBitFlag8( 3, true ); + checkQuestCompletion( quest, player ); + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00013( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 13, NONE, bindSceneReturn( &SubFst159::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( &SubFst159::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, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, bindSceneReturn( &SubFst159::Scene00015Return ) ); + } + + void Scene00015Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + + if( result.getResult( 0 ) == 1 ) + { + player.setRewardFlag( Common::UnlockEntry::EmoteHarvestDance ); + player.finishQuest( getId() ); + } + } + + ////////////////////////////////////////////////////////////////////// + + void Scene00016( World::Quest& quest, Entity::Player& player ) + { + eventMgr().playQuestScene( player, getId(), 16, NONE, bindSceneReturn( &SubFst159::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, NONE, bindSceneReturn( &SubFst159::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, NONE, bindSceneReturn( &SubFst159::Scene00018Return ) ); + } + + void Scene00018Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + { + } +}; + +EXPOSE_SCRIPT( SubFst159 ); \ No newline at end of file From 920da4de3bd7e4e1a5106d2dcb37ec18a1b00cad Mon Sep 17 00:00:00 2001 From: Mordred Date: Wed, 18 Jan 2023 21:44:09 +0100 Subject: [PATCH 21/22] Tiny cleanup --- src/common/Network/GamePacket.h | 6 +++--- src/scripts/quest/classquest/WHM/JobWhm001.cpp | 2 +- src/tools/pcb_reader/threadpool.h | 2 +- src/world/Action/ItemAction.cpp | 2 +- src/world/Manager/RNGMgr.h | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/common/Network/GamePacket.h b/src/common/Network/GamePacket.h index 28408eec..7de8afff 100644 --- a/src/common/Network/GamePacket.h +++ b/src/common/Network/GamePacket.h @@ -1,12 +1,12 @@ #pragma once -#include +#include #include #include -#include +#include -#include +#include #include #include diff --git a/src/scripts/quest/classquest/WHM/JobWhm001.cpp b/src/scripts/quest/classquest/WHM/JobWhm001.cpp index 0c607406..4a809993 100644 --- a/src/scripts/quest/classquest/WHM/JobWhm001.cpp +++ b/src/scripts/quest/classquest/WHM/JobWhm001.cpp @@ -8,7 +8,7 @@ #include #include "Actor/BNpc.h" -#include "Inventory/Item.h"; +#include "Inventory/Item.h" // Quest Script: JobWhm001_01124 // Quest Name: A Relic Reborn (Thyrus) diff --git a/src/tools/pcb_reader/threadpool.h b/src/tools/pcb_reader/threadpool.h index 78657bd3..a5714170 100644 --- a/src/tools/pcb_reader/threadpool.h +++ b/src/tools/pcb_reader/threadpool.h @@ -34,7 +34,7 @@ public: if( num == 0 ) num = std::thread::hardware_concurrency() - 1; - for( auto i = 0; i < num; ++i ) + for( auto i = 0u; i < num; ++i ) { m_workers.push_back( std::async( std::launch::async, [this]{ run(); } ) ); } diff --git a/src/world/Action/ItemAction.cpp b/src/world/Action/ItemAction.cpp index 5ca875f2..fb84c355 100644 --- a/src/world/Action/ItemAction.cpp +++ b/src/world/Action/ItemAction.cpp @@ -86,5 +86,5 @@ void ItemAction::handleMountItem() auto player = getSourceChara()->getAsPlayer(); player->unlockMount( m_itemAction->data().Calcu0Arg[ 0 ] ); - player->dropInventoryItem( static_cast< Common::InventoryType >( m_itemSourceContainer ), m_itemSourceSlot ); + player->dropInventoryItem( static_cast< Common::InventoryType >( m_itemSourceContainer ), static_cast< uint8_t >( m_itemSourceSlot ) ); } \ No newline at end of file diff --git a/src/world/Manager/RNGMgr.h b/src/world/Manager/RNGMgr.h index 57e9570c..6e9cd632 100644 --- a/src/world/Manager/RNGMgr.h +++ b/src/world/Manager/RNGMgr.h @@ -31,7 +31,7 @@ namespace Sapphire::World::Manager if constexpr( std::is_integral< T >::value ) return m_intDist( *m_engine ); - return m_fpuDist( *m_engine ); + return static_cast< T >( m_fpuDist( *m_engine ) ); } // returns an array of size nSize with values type T on set ranges, deducing real or integer distribution from given numeric type From 9ae27baf0358be65e19ee0f323f2242de6695f15 Mon Sep 17 00:00:00 2001 From: Adam <893184+NotAdam@users.noreply.github.com> Date: Thu, 19 Jan 2023 14:45:48 +1100 Subject: [PATCH 22/22] fix compile warning - missing return --- src/world/Script/ScriptMgr.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/world/Script/ScriptMgr.cpp b/src/world/Script/ScriptMgr.cpp index b05a1654..6f0ef4fa 100644 --- a/src/world/Script/ScriptMgr.cpp +++ b/src/world/Script/ScriptMgr.cpp @@ -255,6 +255,8 @@ bool Sapphire::Scripting::ScriptMgr::onTalk( Entity::Player& player, uint64_t ac return true; } } + + return false; } bool Sapphire::Scripting::ScriptMgr::onEnterTerritory( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 )