diff --git a/src/scripts/common/aethernet/Aetheryte.cpp b/src/scripts/common/aethernet/Aetheryte.cpp index e6c069e8..43739430 100644 --- a/src/scripts/common/aethernet/Aetheryte.cpp +++ b/src/scripts/common/aethernet/Aetheryte.cpp @@ -8,7 +8,7 @@ using namespace Sapphire; class Aetheryte : - public Sapphire::ScriptAPI::EventScript + public Sapphire::ScriptAPI::EventScript { private: constexpr static auto ACTION_ATTUNE = 0x13; @@ -22,7 +22,7 @@ private: public: Aetheryte() : - Sapphire::ScriptAPI::EventScript( 0x00050000 ) + Sapphire::ScriptAPI::EventScript( 0x00050000 ) { } @@ -30,7 +30,7 @@ public: { if( player.isAetheryteRegistered( eventId & 0xFFFF ) ) { - eventMgr().playScene( player, eventId, 2, 0, [this]( Entity::Player& player, const Event::SceneResult& result ) + eventMgr().playScene( player, eventId, 2, 0, [ this ]( Entity::Player& player, const Event::SceneResult& result ) { auto destination = result.getResult( 0 ); if( result.numOfResults == 1 && destination != 0 ) @@ -42,15 +42,15 @@ public: else { eventMgr().eventActionStart( player, eventId, ACTION_ATTUNE, - [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) - { - player.registerAetheryte( eventId & 0xFFFF ); - eventMgr().playScene( player, eventId, 3, 0 ); - }, - []( Entity::Player& ply, uint32_t evntId, uint64_t additional ) - { + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + player.registerAetheryte( eventId & 0xFFFF ); + eventMgr().playScene( player, eventId, 3, 0 ); + }, + []( Entity::Player& ply, uint32_t evntId, uint64_t additional ) + { - }, 0 ); + }, 0 ); } } @@ -60,12 +60,12 @@ public: if( player.isAetheryteRegistered( eventId & 0xFFFF ) ) { // eventParam4 (or params[1] if using EventPlay8, which is actually used on retail) anything bigger than 1 will show select instance menu item - eventMgr().playScene( player, eventId, 0, 1, { 1, 2 }, [this]( Entity::Player& player, const Event::SceneResult& result ) + eventMgr().playScene( player, eventId, 0, 1, { 1, 2 }, [ this ]( Entity::Player& player, const Event::SceneResult& result ) { if( result.numOfResults == 1 ) // set homepoint { player.setHomepoint( result.eventId & 0xFFFF ); - player.sendEventNotice( result.eventId, 2, 0xEA, 0, 0 ); + eventMgr().sendEventNotice( player, result.eventId, 2, 0xEA, 0, 0 ); } else if( result.numOfResults == 2 ) // aethernet access { @@ -90,22 +90,22 @@ public: else { eventMgr().eventActionStart( player, eventId, ACTION_ATTUNE, - [this]( Entity::Player& player, uint32_t eventId, uint64_t additional ) - { - player.registerAetheryte( eventId & 0xFFFF ); + [ this ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + player.registerAetheryte( eventId & 0xFFFF ); - if( player.isActionLearned( Common::UnlockEntry::Teleport ) ) - { - player.sendEventNotice( eventId, 0, 2, 0, 0 ); - } - else - { - player.sendEventNotice( eventId, 0, 1, 1, 0 ); - player.learnAction( Common::UnlockEntry::Teleport ); - } - }, - []( Entity::Player& player, uint32_t eventId, uint64_t additional ) - {}, 0 ); + if( player.isActionLearned( Common::UnlockEntry::Teleport ) ) + { + eventMgr().sendEventNotice( player, eventId, 0, 2, 0, 0 ); + } + else + { + eventMgr().sendEventNotice( player, eventId, 0, 1, 1, 0 ); + player.learnAction( Common::UnlockEntry::Teleport ); + } + }, + []( Entity::Player& player, uint32_t eventId, uint64_t additional ) + {}, 0 ); } } diff --git a/src/scripts/quest/ManFst002.cpp b/src/scripts/quest/ManFst002.cpp index 4f366771..08eff52f 100644 --- a/src/scripts/quest/ManFst002.cpp +++ b/src/scripts/quest/ManFst002.cpp @@ -69,11 +69,11 @@ private: void checkQuestCompletion( World::Quest& quest, Entity::Player& player, uint32_t varIdx ) { if( varIdx == 3 ) - player.sendEventNotice( getId(), 1, 0, 0, 0 ); + eventMgr().sendEventNotice( player, getId(), 1, 0, 0, 0 ); else if( varIdx == 2 ) - player.sendEventNotice( getId(), 2, 0, 0, 0 ); + eventMgr().sendEventNotice( player, getId(), 2, 0, 0, 0 ); else - player.sendEventNotice( getId(), 0, 0, 0, 0 ); + eventMgr().sendEventNotice( player, getId(), 0, 0, 0, 0 ); auto var_attuned = quest.getUI8AL(); auto var_class = quest.getUI8BH(); @@ -199,7 +199,7 @@ public: // attune auto event = [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { - player.sendEventNotice( 0x050002, 0, 1, 0, 0 ); + eventMgr().sendEventNotice( player, 0x050002, 0, 1, 0, 0 ); player.registerAetheryte( 2 ); player.learnAction( Common::UnlockEntry::Return ); diff --git a/src/scripts/quest/ManFst003.cpp b/src/scripts/quest/ManFst003.cpp index 9b060f9d..c38ec9ed 100644 --- a/src/scripts/quest/ManFst003.cpp +++ b/src/scripts/quest/ManFst003.cpp @@ -59,7 +59,9 @@ private: static constexpr auto UnlockDesion = 14; public: - ManFst003() : Sapphire::ScriptAPI::QuestScript( 65659 ){}; + ManFst003() : Sapphire::ScriptAPI::QuestScript( 65659 ) + {}; + ~ManFst003() = default; ////////////////////////////////////////////////////////////////////// @@ -73,14 +75,14 @@ public: else if( actorId == Actor1 ) { eventMgr().eventActionStart( player, 0x050002, 0x13, - [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) - { - player.sendEventNotice( 0x050002, 0, 1, 0, 0 ); - player.registerAetheryte( 2 ); - player.learnAction( Common::UnlockEntry::Return ); - Scene00051( quest, player ); - }, - nullptr, quest.getId() ); + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + eventMgr().sendEventNotice( player, 0x050002, 0, 1, 0, 0 ); + player.registerAetheryte( 2 ); + player.learnAction( Common::UnlockEntry::Return ); + Scene00051( quest, player ); + }, + nullptr, quest.getId() ); } else if( actorId == Actor2 ) { @@ -107,15 +109,15 @@ private: if( varIdx == 3 ) { - player.sendEventNotice( getId(), 1, 0, 0, 0 ); + eventMgr().sendEventNotice( player, getId(), 1, 0, 0, 0 ); } else if( varIdx == 2 ) { - player.sendEventNotice( getId(), 2, 0, 0, 0 ); + eventMgr().sendEventNotice( player, getId(), 2, 0, 0, 0 ); } else { - player.sendEventNotice( getId(), 0, 0, 0, 0 ); + eventMgr().sendEventNotice( player, getId(), 0, 0, 0, 0 ); } auto QUEST_VAR_ATTUNE = quest.getUI8AL(); diff --git a/src/scripts/quest/ManFst004.cpp b/src/scripts/quest/ManFst004.cpp index 42219ac6..bab3cedd 100644 --- a/src/scripts/quest/ManFst004.cpp +++ b/src/scripts/quest/ManFst004.cpp @@ -59,7 +59,9 @@ private: static constexpr auto UnlockDesion = 14; public: - ManFst004() : Sapphire::ScriptAPI::QuestScript( 65660 ){}; + ManFst004() : Sapphire::ScriptAPI::QuestScript( 65660 ) + {}; + ~ManFst004() = default; ////////////////////////////////////////////////////////////////////// @@ -76,14 +78,14 @@ public: // player.eventStart( actorId, 0x050002, 7, 0, 0); // starting the eventaction 0x13 ( attuning ) eventMgr().eventActionStart( player, 0x050002, 0x13, - [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) - { - player.sendEventNotice( 0x050002, 0, 1, 0, 0 ); - player.registerAetheryte( 2 ); - player.learnAction( Common::UnlockEntry::Return ); - Scene00051( quest, player ); - }, - nullptr, quest.getId() ); + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + eventMgr().sendEventNotice( player, 0x050002, 0, 1, 0, 0 ); + player.registerAetheryte( 2 ); + player.learnAction( Common::UnlockEntry::Return ); + Scene00051( quest, player ); + }, + nullptr, quest.getId() ); } else if( actorId == ManFst004::Actor2 ) { @@ -104,15 +106,15 @@ private: { if( varIdx == 3 ) { - player.sendEventNotice( getId(), 1, 0, 0, 0 ); + eventMgr().sendEventNotice( player, getId(), 1, 0, 0, 0 ); } else if( varIdx == 2 ) { - player.sendEventNotice( getId(), 2, 0, 0, 0 ); + eventMgr().sendEventNotice( player, getId(), 2, 0, 0, 0 ); } else { - player.sendEventNotice( getId(), 0, 0, 0, 0 ); + eventMgr().sendEventNotice( player, getId(), 0, 0, 0, 0 ); } auto QUEST_VAR_ATTUNE = quest.getUI8AL(); @@ -196,7 +198,7 @@ private: void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - eventMgr().playQuestScene( player, getId(), 4, 0 ); + eventMgr().playQuestScene( player, getId(), 4, 0 ); } ////////////////////////////////////////////////////////////////////// diff --git a/src/scripts/quest/ManSea002.cpp b/src/scripts/quest/ManSea002.cpp index a8adc8a8..a960b0b7 100644 --- a/src/scripts/quest/ManSea002.cpp +++ b/src/scripts/quest/ManSea002.cpp @@ -56,7 +56,7 @@ public: eventMgr().eventActionStart( player, 0x050002, 0x13, [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { - player.sendEventNotice( 0x050002, 0, 1, 0, 0 ); + eventMgr().sendEventNotice( player, 0x050002, 0, 1, 0, 0 ); player.registerAetheryte( 2 ); player.learnAction( Common::UnlockEntry::Return ); Scene00002( player ); @@ -83,15 +83,15 @@ private: { if( varIdx == 1 ) { - player.sendEventNotice( getId(), 1, 0, 0, 0 ); + eventMgr().sendEventNotice( player, getId(), 1, 0, 0, 0 ); } else if( varIdx == 2 ) { - player.sendEventNotice( getId(), 2, 0, 0, 0 ); + eventMgr().sendEventNotice( player, getId(), 2, 0, 0, 0 ); } else { - player.sendEventNotice( getId(), 0, 0, 0, 0 ); + eventMgr().sendEventNotice( player, getId(), 0, 0, 0, 0 ); } auto pQuest = player.getQuest( getId() ); diff --git a/src/scripts/quest/ManSea003.cpp b/src/scripts/quest/ManSea003.cpp index 259e2c3c..ef598e34 100644 --- a/src/scripts/quest/ManSea003.cpp +++ b/src/scripts/quest/ManSea003.cpp @@ -68,14 +68,14 @@ public: else if( actorId == Aetheryte0 ) { eventMgr().eventActionStart( player, 0x050002, 0x13, - [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) - { - player.sendEventNotice( 0x050002, 0, 1, 0, 0 ); - player.registerAetheryte( 2 ); - player.learnAction( Common::UnlockEntry::Return ); - Scene00002( player ); - }, - nullptr, getId() ); + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + eventMgr().sendEventNotice( player, 0x050002, 0, 1, 0, 0 ); + player.registerAetheryte( 2 ); + player.learnAction( Common::UnlockEntry::Return ); + Scene00002( player ); + }, + nullptr, getId() ); } else if( actorId == Actor1 ) { @@ -97,15 +97,15 @@ private: { if( varIdx == 1 ) { - player.sendEventNotice( getId(), 1, 0, 0, 0 ); + eventMgr().sendEventNotice( player, getId(), 1, 0, 0, 0 ); } else if( varIdx == 2 ) { - player.sendEventNotice( getId(), 2, 0, 0, 0 ); + eventMgr().sendEventNotice( player, getId(), 2, 0, 0, 0 ); } else { - player.sendEventNotice( getId(), 0, 0, 0, 0 ); + eventMgr().sendEventNotice( player, getId(), 0, 0, 0, 0 ); } auto questId = getId(); @@ -127,102 +127,102 @@ private: void Scene00000( Entity::Player& player ) { eventMgr().playScene( player, getId(), 0, HIDE_HOTBAR, - [ & ]( Entity::Player& player, const Event::SceneResult& result ) - { - if( result.getResult( 0 ) == 1 ) - { - Scene00001( player ); - } - } ); + [ & ]( Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + { + Scene00001( player ); + } + } ); } void Scene00001( Entity::Player& player ) { eventMgr().playScene( player, getId(), 1, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, - [ & ]( Entity::Player& player, const Event::SceneResult& result ) - { - auto pQuest = player.getQuest( getId() ); - if( !pQuest ) - return; + [ & ]( Entity::Player& player, const Event::SceneResult& result ) + { + auto pQuest = player.getQuest( getId() ); + if( !pQuest ) + return; - pQuest->setSeq( Seq1 ); - pQuest->setUI8CH( 1 ); - } ); + pQuest->setSeq( Seq1 ); + pQuest->setUI8CH( 1 ); + } ); } void Scene00002( Entity::Player& player ) { eventMgr().playScene( player, getId(), 2, HIDE_HOTBAR, - [ & ]( Entity::Player& player, const Event::SceneResult& result ) - { - Scene00003( player ); - } ); + [ & ]( Entity::Player& player, const Event::SceneResult& result ) + { + Scene00003( player ); + } ); } void Scene00003( Entity::Player& player ) { eventMgr().playScene( player, getId(), 3, SET_EOBJ_BASE | HIDE_HOTBAR | INVIS_EOBJ, - [ & ]( Entity::Player& player, const Event::SceneResult& result ) - { - auto pQuest = player.getQuest( getId() ); - if( !pQuest ) - return; - pQuest->setUI8BL( 1 ); - checkQuestCompletion( player, 0 ); - } ); + [ & ]( Entity::Player& player, const Event::SceneResult& result ) + { + auto pQuest = player.getQuest( getId() ); + if( !pQuest ) + return; + pQuest->setUI8BL( 1 ); + checkQuestCompletion( player, 0 ); + } ); } 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; - } ); + [ & ]( 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, 1 ); - } ); + [ & ]( Entity::Player& player, const Event::SceneResult& result ) + { + auto pQuest = player.getQuest( getId() ); + if( !pQuest ) + return; + pQuest->setUI8CH( 0 ); + pQuest->setUI8BH( 1 ); + checkQuestCompletion( player, 1 ); + } ); } void Scene00006( Entity::Player& player ) { eventMgr().playScene( player, getId(), 6, HIDE_HOTBAR, - [ & ]( Entity::Player& player, const Event::SceneResult& result ) - { - auto pQuest = player.getQuest( getId() ); - if( !pQuest ) - return; - pQuest->setUI8AL( 1 ); - checkQuestCompletion( player, 2 ); - } ); + [ & ]( Entity::Player& player, const Event::SceneResult& result ) + { + auto pQuest = player.getQuest( getId() ); + if( !pQuest ) + return; + pQuest->setUI8AL( 1 ); + checkQuestCompletion( player, 2 ); + } ); } void Scene00007( Entity::Player& player ) { eventMgr().playScene( player, getId(), 7, 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 ) ); - } - } ); + [ & ]( Entity::Player& player, const Event::SceneResult& result ) + { + if( result.getResult( 0 ) == 1 ) + { + player.finishQuest( getId(), result.getResult( 1 ) ); + } + } ); } }; diff --git a/src/scripts/quest/ManWil002.cpp b/src/scripts/quest/ManWil002.cpp index 052cf18a..0b2b4728 100644 --- a/src/scripts/quest/ManWil002.cpp +++ b/src/scripts/quest/ManWil002.cpp @@ -88,7 +88,7 @@ public: eventMgr().eventActionStart( player, 0x050002, 0x13, [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { - player.sendEventNotice( 0x050002, 0, 1, 0, 0 ); + eventMgr().sendEventNotice( player, 0x050002, 0, 1, 0, 0 ); player.registerAetheryte( 2 ); player.learnAction( Common::UnlockEntry::Return ); Scene00001( quest, player ); @@ -103,15 +103,15 @@ private: { if( varIdx == 1 ) { - player.sendEventNotice( getId(), 1, 0, 0, 0 ); + eventMgr().sendEventNotice( player, getId(), 1, 0, 0, 0 ); } else if( varIdx == 2 ) { - player.sendEventNotice( getId(), 2, 0, 0, 0 ); + eventMgr().sendEventNotice( player, getId(), 2, 0, 0, 0 ); } else { - player.sendEventNotice( getId(), 0, 0, 0, 0 ); + eventMgr().sendEventNotice( player, getId(), 0, 0, 0, 0 ); } auto QUEST_VAR_ATTUNE = quest.getUI8AL(); diff --git a/src/scripts/quest/ManWil003.cpp b/src/scripts/quest/ManWil003.cpp index a63d1a9c..8bc1ecbb 100644 --- a/src/scripts/quest/ManWil003.cpp +++ b/src/scripts/quest/ManWil003.cpp @@ -88,7 +88,7 @@ public: eventMgr().eventActionStart( player, 0x050002, 0x13, [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { - player.sendEventNotice( 0x050002, 0, 1, 0, 0 ); + eventMgr().sendEventNotice( player, 0x050002, 0, 1, 0, 0 ); player.registerAetheryte( 2 ); player.learnAction( Common::UnlockEntry::Return ); Scene00001( player ); @@ -103,15 +103,15 @@ private: { if( varIdx == 1 ) { - player.sendEventNotice( getId(), 1, 0, 0, 0 ); + eventMgr().sendEventNotice( player, getId(), 1, 0, 0, 0 ); } else if( varIdx == 2 ) { - player.sendEventNotice( getId(), 2, 0, 0, 0 ); + eventMgr().sendEventNotice( player, getId(), 2, 0, 0, 0 ); } else { - player.sendEventNotice( getId(), 0, 0, 0, 0 ); + eventMgr().sendEventNotice( player, getId(), 0, 0, 0, 0 ); } auto pQuest = player.getQuest( getId() ); diff --git a/src/scripts/quest/ManWil004.cpp b/src/scripts/quest/ManWil004.cpp index 57118898..45cb045d 100644 --- a/src/scripts/quest/ManWil004.cpp +++ b/src/scripts/quest/ManWil004.cpp @@ -88,7 +88,7 @@ public: eventMgr().eventActionStart( player, 0x050002, 0x13, [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { - player.sendEventNotice( 0x050002, 0, 1, 0, 0 ); + eventMgr().sendEventNotice( player, 0x050002, 0, 1, 0, 0 ); player.registerAetheryte( 2 ); player.learnAction( Common::UnlockEntry::Return ); Scene00001( player ); @@ -103,15 +103,15 @@ private: { if( varIdx == 1 ) { - player.sendEventNotice( getId(), 1, 0, 0, 0 ); + eventMgr().sendEventNotice( player, getId(), 1, 0, 0, 0 ); } else if( varIdx == 2 ) { - player.sendEventNotice( getId(), 2, 0, 0, 0 ); + eventMgr().sendEventNotice( player, getId(), 2, 0, 0, 0 ); } else { - player.sendEventNotice( getId(), 0, 0, 0, 0 ); + eventMgr().sendEventNotice( player, getId(), 0, 0, 0, 0 ); } auto pQuest = player.getQuest( getId() ); diff --git a/src/scripts/quest/classquest/ARC/ClsArc004.cpp b/src/scripts/quest/classquest/ARC/ClsArc004.cpp index be24bdca..39c151a2 100644 --- a/src/scripts/quest/classquest/ARC/ClsArc004.cpp +++ b/src/scripts/quest/classquest/ARC/ClsArc004.cpp @@ -143,23 +143,23 @@ class ClsArc004 : public Sapphire::ScriptAPI::QuestScript } case Eobject3: { - eventMgr().eventActionStart(player, getId(), 0x0A, - [&](Entity::Player& player, uint32_t eventId, uint64_t additional) + eventMgr().eventActionStart( player, getId(), 0x0A, + [&]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { - Scene00013(quest, player); - player.sendEventNotice(getId(), 2, 2, 0, 0); + Scene00013( quest, player ); + eventMgr().sendEventNotice( player, getId(), 2, 2, 0, 0 ); }, nullptr, 0); break; } case Eobject4: { - eventMgr().eventActionStart(player, getId(), 0x01, - [&](Entity::Player& player, uint32_t eventId, uint64_t additional) + eventMgr().eventActionStart( player, getId(), 0x01, + [&]( Entity::Player& player, uint32_t eventId, uint64_t additional ) { - Scene00015(quest, player); + Scene00015( quest, player ); }, - nullptr, 0); + nullptr, 0 ); break; } } @@ -169,20 +169,20 @@ class ClsArc004 : public Sapphire::ScriptAPI::QuestScript private: - void checkQuestCompletion(World::Quest& quest, Entity::Player& player) + void checkQuestCompletion( World::Quest& quest, Entity::Player& player ) { auto currentCC = quest.getUI8AL(); - player.sendEventNotice(getId(), 1, 2, currentCC + 1, 3); + eventMgr().sendEventNotice( player, getId(), 1, 2, currentCC + 1, 3 ); - if (currentCC + 1 >= 3) + if( currentCC + 1 >= 3 ) { - quest.setSeq(Seq3); - quest.setUI8AL(0); + quest.setSeq( Seq3 ); + quest.setUI8AL( 0 ); } else { - quest.setUI8AL(currentCC + 1); + quest.setUI8AL( currentCC + 1 ); } } @@ -199,7 +199,7 @@ class ClsArc004 : public Sapphire::ScriptAPI::QuestScript { if( result.getResult( 0 ) == 1 ) // accept quest { - Scene00001(quest, player); + Scene00001( quest, player ); } } @@ -224,8 +224,8 @@ class ClsArc004 : public Sapphire::ScriptAPI::QuestScript void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - player.sendEventNotice(getId(), 0, 2, 0, 0); - quest.setSeq(Seq2); + eventMgr().sendEventNotice( player, getId(), 0, 2, 0, 0 ); + quest.setSeq( Seq2 ); } ////////////////////////////////////////////////////////////////////// @@ -263,8 +263,8 @@ class ClsArc004 : public Sapphire::ScriptAPI::QuestScript void Scene00005Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - quest.setBitFlag8(3, true); - checkQuestCompletion(quest, player); + quest.setBitFlag8( 3, true ); + checkQuestCompletion( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -384,7 +384,7 @@ class ClsArc004 : public Sapphire::ScriptAPI::QuestScript void Scene00015Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00016(quest, player); + Scene00016( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -396,12 +396,13 @@ class ClsArc004 : public Sapphire::ScriptAPI::QuestScript void Scene00016Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - if (result.getResult(0) == 1) { - quest.setSeq(Seq5); + if( result.getResult( 0) == 1 ) + { + quest.setSeq( Seq5 ); auto& pTeriMgr = Common::Service< Sapphire::World::Manager::TerritoryMgr >::ref(); - eventMgr().eventFinish(player, result.eventId, 0); - pTeriMgr.createAndJoinQuestBattle(player, Questbattle0); + eventMgr().eventFinish( player, result.eventId, 0 ); + pTeriMgr.createAndJoinQuestBattle( player, Questbattle0 ); } } @@ -426,8 +427,8 @@ class ClsArc004 : public Sapphire::ScriptAPI::QuestScript void Scene00018Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - player.sendEventNotice(getId(), 4, 2, 0, 0); - quest.setSeq(SeqFinish); + eventMgr().sendEventNotice( player, getId(), 4, 2, 0, 0 ); + quest.setSeq( SeqFinish ); } ////////////////////////////////////////////////////////////////////// diff --git a/src/scripts/quest/classquest/ARC/ClsArc005.cpp b/src/scripts/quest/classquest/ARC/ClsArc005.cpp index f284f8df..37133869 100644 --- a/src/scripts/quest/classquest/ARC/ClsArc005.cpp +++ b/src/scripts/quest/classquest/ARC/ClsArc005.cpp @@ -18,82 +18,84 @@ using namespace Sapphire; class ClsArc005 : public Sapphire::ScriptAPI::QuestScript { - private: - // Basic quest information - // Quest vars / flags used - // BitFlag8 - // UI8AL +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AL - /// Countable Num: 1 Seq: 1 Event: 1 Listener: 1000204 - /// Countable Num: 1 Seq: 2 Event: 1 Listener: 1000199 - /// Countable Num: 1 Seq: 3 Event: 1 Listener: 2000951 - /// Countable Num: 1 Seq: 4 Event: 1 Listener: 1000534 - /// Countable Num: 1 Seq: 255 Event: 1 Listener: 2001840 - // 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, - }; + /// Countable Num: 1 Seq: 1 Event: 1 Listener: 1000204 + /// Countable Num: 1 Seq: 2 Event: 1 Listener: 1000199 + /// Countable Num: 1 Seq: 3 Event: 1 Listener: 2000951 + /// Countable Num: 1 Seq: 4 Event: 1 Listener: 1000534 + /// Countable Num: 1 Seq: 255 Event: 1 Listener: 2001840 + // 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 = 1000200; - static constexpr auto Actor1 = 1000204; - static constexpr auto Actor2 = 1000199; - static constexpr auto Actor3 = 1000534; - static constexpr auto Actor4 = 1001284; - static constexpr auto Actor5 = 1003025; - static constexpr auto Actor6 = 1003026; - static constexpr auto Eobject0 = 2000951; - static constexpr auto Eobject1 = 2001840; - static constexpr auto EventActionSearch = 1; - static constexpr auto EventActionWaiting = 10; - static constexpr auto LocActor5Action1 = 834; - static constexpr auto LocPosActor5 = 3877820; - static constexpr auto LocPosPc = 3877813; - static constexpr auto Questbattle0 = 4; - static constexpr auto Territorytype0 = 230; + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1000200; + static constexpr auto Actor1 = 1000204; + static constexpr auto Actor2 = 1000199; + static constexpr auto Actor3 = 1000534; + static constexpr auto Actor4 = 1001284; + static constexpr auto Actor5 = 1003025; + static constexpr auto Actor6 = 1003026; + static constexpr auto Eobject0 = 2000951; + static constexpr auto Eobject1 = 2001840; + static constexpr auto EventActionSearch = 1; + static constexpr auto EventActionWaiting = 10; + static constexpr auto LocActor5Action1 = 834; + static constexpr auto LocPosActor5 = 3877820; + static constexpr auto LocPosPc = 3877813; + static constexpr auto Questbattle0 = 4; + static constexpr auto Territorytype0 = 230; - public: - ClsArc005() : Sapphire::ScriptAPI::QuestScript( 65607 ){}; - ~ClsArc005() = default; +public: + ClsArc005() : Sapphire::ScriptAPI::QuestScript( 65607 ) + {}; + + ~ClsArc005() = default; ////////////////////////////////////////////////////////////////////// // Event Handlers - void onTalk( World::Quest& quest, Entity::Player& player, uint64_t actorId ) override + void onTalk( World::Quest &quest, Entity::Player &player, uint64_t actorId ) override { switch( actorId ) { case Actor0: { - if (!player.hasQuest(getId())) - Scene00000(quest, player); - else if (quest.getSeq() == SeqFinish) - Scene00010(quest, player); + if( !player.hasQuest( getId())) + Scene00000( quest, player ); + else if( quest.getSeq() == SeqFinish ) + Scene00010( quest, player ); break; } case Actor1: { - if (quest.getSeq() == Seq1) - Scene00002(quest, player); + if( quest.getSeq() == Seq1 ) + Scene00002( quest, player ); break; } case Actor2: { - if (quest.getSeq() == Seq2) - Scene00003(quest, player); + if( quest.getSeq() == Seq2 ) + Scene00003( quest, player ); break; } case Actor3: { - if (quest.getSeq() == Seq4) - Scene00006(quest, player); + if( quest.getSeq() == Seq4 ) + Scene00006( quest, player ); break; } case Actor4: @@ -110,161 +112,162 @@ class ClsArc005 : public Sapphire::ScriptAPI::QuestScript } case Eobject0: { - eventMgr().eventActionStart(player, getId(), 0x0A, - [&](Entity::Player& player, uint32_t eventId, uint64_t additional) - { - Scene00004(quest, player); - player.sendEventNotice(getId(), 2, 2, 0, 0); - }, - nullptr, 0); + eventMgr().eventActionStart( player, getId(), 0x0A, + [ & ]( Entity::Player &player, uint32_t eventId, uint64_t additional ) + { + Scene00004( quest, player ); + eventMgr().sendEventNotice( player, getId(), 2, 2, 0, 0 ); + }, + nullptr, 0 ); break; } } } - private: +private: ////////////////////////////////////////////////////////////////////// // Available Scenes in this quest, not necessarly all are used ////////////////////////////////////////////////////////////////////// - void Scene00000( World::Quest& quest, Entity::Player& player ) + void Scene00000( World::Quest &quest, Entity::Player &player ) { eventMgr().playQuestScene( player, getId(), 0, HIDE_HOTBAR, bindSceneReturn( &ClsArc005::Scene00000Return ) ); } - void Scene00000Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + void Scene00000Return( World::Quest &quest, Entity::Player &player, const Event::SceneResult &result ) { if( result.getResult( 0 ) == 1 ) // accept quest { - Scene00001(quest, player); + Scene00001( quest, player ); } } ////////////////////////////////////////////////////////////////////// - void Scene00001( World::Quest& quest, Entity::Player& player ) + void Scene00001( World::Quest &quest, Entity::Player &player ) { eventMgr().playQuestScene( player, getId(), 1, HIDE_HOTBAR, bindSceneReturn( &ClsArc005::Scene00001Return ) ); } - void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + void Scene00001Return( World::Quest &quest, Entity::Player &player, const Event::SceneResult &result ) { - quest.setSeq(Seq1); + quest.setSeq( Seq1 ); } ////////////////////////////////////////////////////////////////////// - void Scene00002( World::Quest& quest, Entity::Player& player ) + void Scene00002( World::Quest &quest, Entity::Player &player ) { eventMgr().playQuestScene( player, getId(), 2, HIDE_HOTBAR, bindSceneReturn( &ClsArc005::Scene00002Return ) ); } - void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + void Scene00002Return( World::Quest &quest, Entity::Player &player, const Event::SceneResult &result ) { - player.sendEventNotice(getId(), 0, 2, 0, 0); - quest.setSeq(Seq2); + eventMgr().sendEventNotice( player, getId(), 0, 2, 0, 0 ); + quest.setSeq( Seq2 ); } ////////////////////////////////////////////////////////////////////// - void Scene00003( World::Quest& quest, Entity::Player& player ) + void Scene00003( World::Quest &quest, Entity::Player &player ) { eventMgr().playQuestScene( player, getId(), 3, HIDE_HOTBAR, bindSceneReturn( &ClsArc005::Scene00003Return ) ); } - void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + void Scene00003Return( World::Quest &quest, Entity::Player &player, const Event::SceneResult &result ) { - player.sendEventNotice(getId(), 1, 2, 0, 0); - quest.setSeq(Seq3); + eventMgr().sendEventNotice( player, getId(), 1, 2, 0, 0 ); + quest.setSeq( Seq3 ); } ////////////////////////////////////////////////////////////////////// - void Scene00004( World::Quest& quest, Entity::Player& player ) + void Scene00004( World::Quest &quest, Entity::Player &player ) { eventMgr().playQuestScene( player, getId(), 4, HIDE_HOTBAR, bindSceneReturn( &ClsArc005::Scene00004Return ) ); } - void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + void Scene00004Return( World::Quest &quest, Entity::Player &player, const Event::SceneResult &result ) { - Scene00005(quest, player); + Scene00005( quest, player ); } ////////////////////////////////////////////////////////////////////// - void Scene00005( World::Quest& quest, Entity::Player& player ) + void Scene00005( World::Quest &quest, Entity::Player &player ) { eventMgr().playQuestScene( player, getId(), 5, SET_EOBJ_BASE | HIDE_HOTBAR | INVIS_EOBJ, bindSceneReturn( &ClsArc005::Scene00005Return ) ); } - void Scene00005Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + void Scene00005Return( World::Quest &quest, Entity::Player &player, const Event::SceneResult &result ) { - quest.setSeq(Seq4); + quest.setSeq( Seq4 ); } ////////////////////////////////////////////////////////////////////// - void Scene00006( World::Quest& quest, Entity::Player& player ) + void Scene00006( World::Quest &quest, Entity::Player &player ) { eventMgr().playQuestScene( player, getId(), 6, HIDE_HOTBAR, bindSceneReturn( &ClsArc005::Scene00006Return ) ); } - void Scene00006Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + void Scene00006Return( World::Quest &quest, Entity::Player &player, const Event::SceneResult &result ) { - Scene00007(quest, player); + Scene00007( quest, player ); } ////////////////////////////////////////////////////////////////////// - void Scene00007( World::Quest& quest, Entity::Player& player ) + void Scene00007( World::Quest &quest, Entity::Player &player ) { eventMgr().playQuestScene( player, getId(), 7, HIDE_HOTBAR, bindSceneReturn( &ClsArc005::Scene00007Return ) ); } - void Scene00007Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + void Scene00007Return( World::Quest &quest, Entity::Player &player, const Event::SceneResult &result ) { - if (result.getResult(0) == 1) { - quest.setSeq(SeqFinish); - auto& pTeriMgr = Common::Service< Sapphire::World::Manager::TerritoryMgr >::ref(); + if( result.getResult( 0 ) == 1 ) + { + quest.setSeq( SeqFinish ); + auto &pTeriMgr = Common::Service< Sapphire::World::Manager::TerritoryMgr >::ref(); - eventMgr().eventFinish(player, result.eventId, 0); - pTeriMgr.createAndJoinQuestBattle(player, Questbattle0); + eventMgr().eventFinish( player, result.eventId, 0 ); + pTeriMgr.createAndJoinQuestBattle( player, Questbattle0 ); } } ////////////////////////////////////////////////////////////////////// - void Scene00008( World::Quest& quest, Entity::Player& player ) + void Scene00008( World::Quest &quest, Entity::Player &player ) { eventMgr().playQuestScene( player, getId(), 8, HIDE_HOTBAR, bindSceneReturn( &ClsArc005::Scene00008Return ) ); } - void Scene00008Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + void Scene00008Return( World::Quest &quest, Entity::Player &player, const Event::SceneResult &result ) { //Empty } ////////////////////////////////////////////////////////////////////// - void Scene00009( World::Quest& quest, Entity::Player& player ) + void Scene00009( World::Quest &quest, Entity::Player &player ) { eventMgr().playQuestScene( player, getId(), 9, HIDE_HOTBAR, bindSceneReturn( &ClsArc005::Scene00009Return ) ); } - void Scene00009Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + void Scene00009Return( World::Quest &quest, Entity::Player &player, const Event::SceneResult &result ) { //Empty } ////////////////////////////////////////////////////////////////////// - void Scene00010( World::Quest& quest, Entity::Player& player ) + void Scene00010( World::Quest &quest, Entity::Player &player ) { eventMgr().playQuestScene( player, getId(), 10, HIDE_HOTBAR, bindSceneReturn( &ClsArc005::Scene00010Return ) ); } - void Scene00010Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) + void Scene00010Return( World::Quest &quest, Entity::Player &player, const Event::SceneResult &result ) { if( result.getResult( 0 ) == 1 ) diff --git a/src/scripts/quest/subquest/gridania/SubFst004.cpp b/src/scripts/quest/subquest/gridania/SubFst004.cpp index 998664f5..1c819aba 100644 --- a/src/scripts/quest/subquest/gridania/SubFst004.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst004.cpp @@ -17,37 +17,39 @@ using namespace Sapphire; class SubFst004 : public Sapphire::ScriptAPI::QuestScript { - private: - // Basic quest information - // Quest vars / flags used - // UI8AL - // UI8BH +private: + // Basic quest information + // Quest vars / flags used + // UI8AL + // UI8BH - /// Countable Num: 1 Seq: 1 Event: 1 Listener: 1000686 - /// Countable Num: 1 Seq: 255 Event: 1 Listener: 1000789 - // 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, - }; + /// Countable Num: 1 Seq: 1 Event: 1 Listener: 1000686 + /// Countable Num: 1 Seq: 255 Event: 1 Listener: 1000789 + // 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 = 1000194; - static constexpr auto Actor1 = 1000686; - static constexpr auto Actor2 = 1000789; - static constexpr auto Item0 = 2000024; - static constexpr auto Seq0Actor0 = 0; - static constexpr auto Seq1Actor1 = 1; - static constexpr auto Seq2Actor2 = 2; - static constexpr auto Seq2Actor2Npctradeno = 99; - static constexpr auto Seq2Actor2Npctradeok = 100; + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1000194; + static constexpr auto Actor1 = 1000686; + static constexpr auto Actor2 = 1000789; + static constexpr auto Item0 = 2000024; + static constexpr auto Seq0Actor0 = 0; + static constexpr auto Seq1Actor1 = 1; + static constexpr auto Seq2Actor2 = 2; + static constexpr auto Seq2Actor2Npctradeno = 99; + static constexpr auto Seq2Actor2Npctradeok = 100; - public: - SubFst004() : Sapphire::ScriptAPI::QuestScript( 65563 ){}; - ~SubFst004() = default; +public: + SubFst004() : Sapphire::ScriptAPI::QuestScript( 65563 ) + {}; + + ~SubFst004() = default; ////////////////////////////////////////////////////////////////////// // Event Handlers @@ -74,7 +76,7 @@ class SubFst004 : public Sapphire::ScriptAPI::QuestScript } - private: +private: ////////////////////////////////////////////////////////////////////// // Available Scenes in this quest, not necessarly all are used ////////////////////////////////////////////////////////////////////// @@ -101,7 +103,7 @@ class SubFst004 : public Sapphire::ScriptAPI::QuestScript void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - player.sendEventNotice( getId(), 0, 2, 21002, 0); + eventMgr().sendEventNotice( player, getId(), 0, 2, 21002, 0 ); quest.setUI8BH( 1 ); quest.setSeq( SeqFinish ); } @@ -115,7 +117,7 @@ class SubFst004 : public Sapphire::ScriptAPI::QuestScript void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - if( result.getResult( 0) == 1) + if( result.getResult( 0 ) == 1 ) Scene00100( quest, player ); else Scene00099( quest, player ); diff --git a/src/scripts/quest/subquest/gridania/SubFst008.cpp b/src/scripts/quest/subquest/gridania/SubFst008.cpp index 7ea004f2..203b731a 100644 --- a/src/scripts/quest/subquest/gridania/SubFst008.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst008.cpp @@ -104,7 +104,7 @@ private: void Scene00001Return( World::Quest &quest, Entity::Player &player, const Event::SceneResult &result ) { quest.setUI8BH( 1 ); - player.sendEventNotice( getId(), 0, 0, 0, 0 ); + eventMgr().sendEventNotice( player, getId(), 0, 0, 0, 0 ); quest.setSeq( SeqFinish ); } diff --git a/src/scripts/quest/subquest/gridania/SubFst013.cpp b/src/scripts/quest/subquest/gridania/SubFst013.cpp index 9df6d2e3..661c6a8e 100644 --- a/src/scripts/quest/subquest/gridania/SubFst013.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst013.cpp @@ -17,51 +17,53 @@ using namespace Sapphire; class SubFst013 : public Sapphire::ScriptAPI::QuestScript { - private: - // Basic quest information - // Quest vars / flags used - // UI8AL +private: + // Basic quest information + // Quest vars / flags used + // UI8AL - /// Countable Num: 1 Seq: 1 Event: 1 Listener: 1000161 - /// Countable Num: 1 Seq: 2 Event: 2 Listener: 1000161 - /// Countable Num: 1 Seq: 3 Event: 1 Listener: 1000162 - /// Countable Num: 1 Seq: 4 Event: 1 Listener: 1000161 - /// Countable Num: 1 Seq: 5 Event: 2 Listener: 1000161 - /// Countable Num: 1 Seq: 255 Event: 1 Listener: 1000162 - // 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, - }; + /// Countable Num: 1 Seq: 1 Event: 1 Listener: 1000161 + /// Countable Num: 1 Seq: 2 Event: 2 Listener: 1000161 + /// Countable Num: 1 Seq: 3 Event: 1 Listener: 1000162 + /// Countable Num: 1 Seq: 4 Event: 1 Listener: 1000161 + /// Countable Num: 1 Seq: 5 Event: 2 Listener: 1000161 + /// Countable Num: 1 Seq: 255 Event: 1 Listener: 1000162 + // 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 = 1000162; - static constexpr auto Actor1 = 1000161; - static constexpr auto FirstQuest = 65575; - static constexpr auto Seq0Actor0 = 0; - static constexpr auto Seq1Actor1 = 1; - static constexpr auto Seq1Actor1Emoteno = 99; - static constexpr auto Seq1Actor1Emoteok = 100; - static constexpr auto Seq2Actor0 = 2; - static constexpr auto Seq3Actor1 = 3; - static constexpr auto Seq3Actor1Emoteno = 97; - static constexpr auto Seq3Actor1Emoteok = 98; - static constexpr auto Seq4Actor0 = 4; - static constexpr auto Seq5Actor1 = 5; - static constexpr auto Seq5Actor1Emoteno = 95; - static constexpr auto Seq5Actor1Emoteok = 96; - static constexpr auto Seq6Actor0 = 6; + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1000162; + static constexpr auto Actor1 = 1000161; + static constexpr auto FirstQuest = 65575; + static constexpr auto Seq0Actor0 = 0; + static constexpr auto Seq1Actor1 = 1; + static constexpr auto Seq1Actor1Emoteno = 99; + static constexpr auto Seq1Actor1Emoteok = 100; + static constexpr auto Seq2Actor0 = 2; + static constexpr auto Seq3Actor1 = 3; + static constexpr auto Seq3Actor1Emoteno = 97; + static constexpr auto Seq3Actor1Emoteok = 98; + static constexpr auto Seq4Actor0 = 4; + static constexpr auto Seq5Actor1 = 5; + static constexpr auto Seq5Actor1Emoteno = 95; + static constexpr auto Seq5Actor1Emoteok = 96; + static constexpr auto Seq6Actor0 = 6; - public: - SubFst013() : Sapphire::ScriptAPI::QuestScript( 65576 ){}; - ~SubFst013() = default; +public: + SubFst013() : Sapphire::ScriptAPI::QuestScript( 65576 ) + {}; + + ~SubFst013() = default; ////////////////////////////////////////////////////////////////////// // Event Handlers @@ -71,37 +73,37 @@ class SubFst013 : public Sapphire::ScriptAPI::QuestScript { case Actor0: { - if (quest.getSeq() == Seq2) - Scene00002(quest, player); - else if (quest.getSeq() == Seq4) - Scene00004(quest, player); - else if (quest.getSeq() == SeqFinish) - Scene00006(quest, player); + if( quest.getSeq() == Seq2 ) + Scene00002( quest, player ); + else if( quest.getSeq() == Seq4 ) + Scene00004( quest, player ); + else if( quest.getSeq() == SeqFinish ) + Scene00006( quest, player ); break; } case Actor1: // talking to Aunillie while on quest { - Scene00003(quest, player); + Scene00003( quest, player ); break; } } } - void onEmote(World::Quest& quest, uint64_t actorId, uint32_t emoteId, Sapphire::Entity::Player& player) override + void onEmote( World::Quest& quest, uint64_t actorId, uint32_t emoteId, Sapphire::Entity::Player& player ) override { - if (actorId != Actor1) + if( actorId != Actor1 ) return; - if (emoteId == 5 && quest.getSeq() == Seq1) - Scene00100(quest, player); - else if (emoteId == 18 && quest.getSeq() == Seq3) - Scene00098(quest, player); - else if (emoteId == 11 && quest.getSeq() == Seq5) - Scene00096(quest, player); + if( emoteId == 5 && quest.getSeq() == Seq1 ) + Scene00100( quest, player ); + else if( emoteId == 18 && quest.getSeq() == Seq3 ) + Scene00098( quest, player ); + else if( emoteId == 11 && quest.getSeq() == Seq5 ) + Scene00096( quest, player ); } - private: +private: ////////////////////////////////////////////////////////////////////// // Available Scenes in this quest, not necessarly all are used ////////////////////////////////////////////////////////////////////// @@ -115,7 +117,7 @@ class SubFst013 : public Sapphire::ScriptAPI::QuestScript { if( result.getResult( 0 ) == 1 ) // accept quest { - quest.setSeq(Seq1); + quest.setSeq( Seq1 ); } } @@ -140,7 +142,7 @@ class SubFst013 : public Sapphire::ScriptAPI::QuestScript void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - quest.setSeq(Seq3); + quest.setSeq( Seq3 ); } ////////////////////////////////////////////////////////////////////// @@ -164,7 +166,7 @@ class SubFst013 : public Sapphire::ScriptAPI::QuestScript void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - quest.setSeq(Seq5); + quest.setSeq( Seq5 ); } ////////////////////////////////////////////////////////////////////// @@ -217,8 +219,8 @@ class SubFst013 : public Sapphire::ScriptAPI::QuestScript void Scene00096Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - quest.setSeq(SeqFinish); - player.sendEventNotice(getId(), 4, 2, 0, 0); + quest.setSeq( SeqFinish ); + eventMgr().sendEventNotice( player, getId(), 4, 2, 0, 0 ); } ////////////////////////////////////////////////////////////////////// @@ -242,7 +244,7 @@ class SubFst013 : public Sapphire::ScriptAPI::QuestScript void Scene00098Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - quest.setSeq(Seq4); + quest.setSeq( Seq4 ); } ////////////////////////////////////////////////////////////////////// @@ -266,8 +268,8 @@ class SubFst013 : public Sapphire::ScriptAPI::QuestScript void Scene00100Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - quest.setSeq(Seq2); - player.sendEventNotice(getId(), 0, 2, 0, 0); + quest.setSeq( Seq2 ); + eventMgr().sendEventNotice( player, getId(), 0, 2, 0, 0 ); } }; diff --git a/src/scripts/quest/subquest/gridania/SubFst014.cpp b/src/scripts/quest/subquest/gridania/SubFst014.cpp index ccde1b2f..90fce39c 100644 --- a/src/scripts/quest/subquest/gridania/SubFst014.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst014.cpp @@ -17,38 +17,40 @@ using namespace Sapphire; class SubFst014 : public Sapphire::ScriptAPI::QuestScript { - private: - // Basic quest information - // Quest vars / flags used - // BitFlag8 - // UI8AL - // UI8BH +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AL + // UI8BH - /// Countable Num: 6 Seq: 1 Event: 1 Listener: 2000026 - /// Countable Num: 1 Seq: 255 Event: 1 Listener: 2000027 - // 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, - }; + /// Countable Num: 6 Seq: 1 Event: 1 Listener: 2000026 + /// Countable Num: 1 Seq: 255 Event: 1 Listener: 2000027 + // 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 = 1000300; - static constexpr auto Eobject0 = 2000026; - static constexpr auto Eobject1 = 2000027; - static constexpr auto Eobject2 = 2000028; - static constexpr auto Eobject3 = 2000029; - static constexpr auto Eobject4 = 2000030; - static constexpr auto Eobject5 = 2000031; - static constexpr auto EventActionSearch = 1; - static constexpr auto Item0 = 2000084; + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1000300; + static constexpr auto Eobject0 = 2000026; + static constexpr auto Eobject1 = 2000027; + static constexpr auto Eobject2 = 2000028; + static constexpr auto Eobject3 = 2000029; + static constexpr auto Eobject4 = 2000030; + static constexpr auto Eobject5 = 2000031; + static constexpr auto EventActionSearch = 1; + static constexpr auto Item0 = 2000084; - public: - SubFst014() : Sapphire::ScriptAPI::QuestScript( 65577 ){}; - ~SubFst014() = default; +public: + SubFst014() : Sapphire::ScriptAPI::QuestScript( 65577 ) + {}; + + ~SubFst014() = default; ////////////////////////////////////////////////////////////////////// // Event Handlers @@ -58,92 +60,92 @@ class SubFst014 : public Sapphire::ScriptAPI::QuestScript { case Actor0: { - if (!player.hasQuest(getId())) - Scene00000(quest, player); - else if (quest.getSeq() == SeqFinish) - Scene00007(quest, player); + if( !player.hasQuest( getId() ) ) + Scene00000( quest, player ); + else if( quest.getSeq() == SeqFinish ) + Scene00007( quest, player ); break; } case Eobject0: { - eventMgr().eventActionStart(player, getId(), 0x01, - [&](Entity::Player& player, uint32_t eventId, uint64_t additional) - { - Scene00001(quest, player); - }, - nullptr, 0); + eventMgr().eventActionStart( player, getId(), 0x01, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + Scene00001( quest, player ); + }, + nullptr, 0 ); break; } case Eobject1: { - eventMgr().eventActionStart(player, getId(), 0x01, - [&](Entity::Player& player, uint32_t eventId, uint64_t additional) - { - Scene00002(quest, player); - }, - nullptr, 0); + eventMgr().eventActionStart( player, getId(), 0x01, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + Scene00002( quest, player ); + }, + nullptr, 0 ); break; } case Eobject2: { - eventMgr().eventActionStart(player, getId(), 0x01, - [&](Entity::Player& player, uint32_t eventId, uint64_t additional) - { - Scene00003(quest, player); - }, - nullptr, 0); + eventMgr().eventActionStart( player, getId(), 0x01, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + Scene00003( quest, player ); + }, + nullptr, 0 ); break; } case Eobject3: { - eventMgr().eventActionStart(player, getId(), 0x01, - [&](Entity::Player& player, uint32_t eventId, uint64_t additional) - { - Scene00004(quest, player); - }, - nullptr, 0); + eventMgr().eventActionStart( player, getId(), 0x01, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + Scene00004( quest, player ); + }, + nullptr, 0 ); break; } case Eobject4: { - eventMgr().eventActionStart(player, getId(), 0x01, - [&](Entity::Player& player, uint32_t eventId, uint64_t additional) - { - Scene00005(quest, player); - }, - nullptr, 0); + eventMgr().eventActionStart( player, getId(), 0x01, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + Scene00005( quest, player ); + }, + nullptr, 0 ); break; } case Eobject5: { - eventMgr().eventActionStart(player, getId(), 0x01, - [&](Entity::Player& player, uint32_t eventId, uint64_t additional) - { - Scene00006(quest, player); - }, - nullptr, 0); + eventMgr().eventActionStart( player, getId(), 0x01, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + Scene00006( quest, player ); + }, + nullptr, 0 ); break; } } } - private: +private: - void checkQuestCompletion(World::Quest& quest, Entity::Player& player) + void checkQuestCompletion( World::Quest& quest, Entity::Player& player ) + { + auto currentCC = quest.getUI8AL(); + + eventMgr().sendEventNotice( player, getId(), 0, 2, currentCC + 1, 6 ); + quest.setUI8AL( currentCC + 1 ); + quest.setUI8BH( currentCC + 1 ); + + if( currentCC + 1 >= 6 ) { - auto currentCC = quest.getUI8AL(); - - player.sendEventNotice(getId(), 0, 2, currentCC + 1, 6); - quest.setUI8AL(currentCC + 1); - quest.setUI8BH(currentCC + 1); - - if (currentCC + 1 >= 6) - { - quest.setSeq(SeqFinish); - } + quest.setSeq( SeqFinish ); } + } ////////////////////////////////////////////////////////////////////// // Available Scenes in this quest, not necessarly all are used ////////////////////////////////////////////////////////////////////// @@ -157,7 +159,7 @@ class SubFst014 : public Sapphire::ScriptAPI::QuestScript { if( result.getResult( 0 ) == 1 ) // accept quest { - quest.setSeq(Seq1); + quest.setSeq( Seq1 ); } } @@ -170,7 +172,7 @@ class SubFst014 : public Sapphire::ScriptAPI::QuestScript void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00100(quest, player); + Scene00100( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -182,7 +184,7 @@ class SubFst014 : public Sapphire::ScriptAPI::QuestScript void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00098(quest, player); + Scene00098( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -194,7 +196,7 @@ class SubFst014 : public Sapphire::ScriptAPI::QuestScript void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00096(quest, player); + Scene00096( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -206,7 +208,7 @@ class SubFst014 : public Sapphire::ScriptAPI::QuestScript void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00094(quest, player); + Scene00094( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -218,7 +220,7 @@ class SubFst014 : public Sapphire::ScriptAPI::QuestScript void Scene00005Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00092(quest, player); + Scene00092( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -230,7 +232,7 @@ class SubFst014 : public Sapphire::ScriptAPI::QuestScript void Scene00006Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00090(quest, player); + Scene00090( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -242,8 +244,8 @@ class SubFst014 : public Sapphire::ScriptAPI::QuestScript void Scene00007Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - if (result.getResult(0) == 1) - Scene00088(quest, player); + if( result.getResult( 0 ) == 1 ) + Scene00088( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -296,8 +298,8 @@ class SubFst014 : public Sapphire::ScriptAPI::QuestScript void Scene00090Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(6, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 6, true ); } ////////////////////////////////////////////////////////////////////// @@ -321,8 +323,8 @@ class SubFst014 : public Sapphire::ScriptAPI::QuestScript void Scene00092Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(5, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 5, true ); } ////////////////////////////////////////////////////////////////////// @@ -346,8 +348,8 @@ class SubFst014 : public Sapphire::ScriptAPI::QuestScript void Scene00094Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(4, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 4, true ); } ////////////////////////////////////////////////////////////////////// @@ -371,8 +373,8 @@ class SubFst014 : public Sapphire::ScriptAPI::QuestScript void Scene00096Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(3, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 3, true ); } ////////////////////////////////////////////////////////////////////// @@ -396,8 +398,8 @@ class SubFst014 : public Sapphire::ScriptAPI::QuestScript void Scene00098Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(2, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 2, true ); } ////////////////////////////////////////////////////////////////////// @@ -422,8 +424,8 @@ class SubFst014 : public Sapphire::ScriptAPI::QuestScript void Scene00100Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(1, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 1, true ); } }; diff --git a/src/scripts/quest/subquest/gridania/SubFst015.cpp b/src/scripts/quest/subquest/gridania/SubFst015.cpp index ac26d033..f044e9c2 100644 --- a/src/scripts/quest/subquest/gridania/SubFst015.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst015.cpp @@ -17,36 +17,38 @@ using namespace Sapphire; class SubFst015 : public Sapphire::ScriptAPI::QuestScript { - private: - // Basic quest information - // Quest vars / flags used - // BitFlag8 - // UI8AL +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AL - /// Countable Num: 6 Seq: 1 Event: 1 Listener: 2000020 - /// Countable Num: 1 Seq: 255 Event: 1 Listener: 2000021 - // 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, - }; + /// Countable Num: 6 Seq: 1 Event: 1 Listener: 2000020 + /// Countable Num: 1 Seq: 255 Event: 1 Listener: 2000021 + // 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 = 1000286; - static constexpr auto Eobject0 = 2000020; - static constexpr auto Eobject1 = 2000021; - static constexpr auto Eobject2 = 2000022; - static constexpr auto Eobject3 = 2000023; - static constexpr auto Eobject4 = 2000024; - static constexpr auto Eobject5 = 2000025; - static constexpr auto EventActionSearch = 1; + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1000286; + static constexpr auto Eobject0 = 2000020; + static constexpr auto Eobject1 = 2000021; + static constexpr auto Eobject2 = 2000022; + static constexpr auto Eobject3 = 2000023; + static constexpr auto Eobject4 = 2000024; + static constexpr auto Eobject5 = 2000025; + static constexpr auto EventActionSearch = 1; - public: - SubFst015() : Sapphire::ScriptAPI::QuestScript( 65578 ){}; - ~SubFst015() = default; +public: + SubFst015() : Sapphire::ScriptAPI::QuestScript( 65578 ) + {}; + + ~SubFst015() = default; ////////////////////////////////////////////////////////////////////// // Event Handlers @@ -56,94 +58,94 @@ class SubFst015 : public Sapphire::ScriptAPI::QuestScript { case Actor0: { - if (!player.hasQuest(getId())) - Scene00000(quest, player); + if( !player.hasQuest( getId() ) ) + Scene00000( quest, player ); else - Scene00007(quest, player); + Scene00007( quest, player ); break; } case Eobject0: { - eventMgr().eventActionStart(player, getId(), 0x01, - [&](Entity::Player& player, uint32_t eventId, uint64_t additional) - { - Scene00001(quest, player); - }, - nullptr, 0); + eventMgr().eventActionStart( player, getId(), 0x01, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + Scene00001( quest, player ); + }, + nullptr, 0 ); break; } case Eobject1: { - eventMgr().eventActionStart(player, getId(), 0x01, - [&](Entity::Player& player, uint32_t eventId, uint64_t additional) - { - Scene00002(quest, player); - }, - nullptr, 0); + eventMgr().eventActionStart( player, getId(), 0x01, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + Scene00002( quest, player ); + }, + nullptr, 0 ); break; } case Eobject2: { - eventMgr().eventActionStart(player, getId(), 0x01, - [&](Entity::Player& player, uint32_t eventId, uint64_t additional) - { - Scene00003(quest, player); - }, - nullptr, 0); + eventMgr().eventActionStart( player, getId(), 0x01, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + Scene00003( quest, player ); + }, + nullptr, 0 ); break; } case Eobject3: { - eventMgr().eventActionStart(player, getId(), 0x01, - [&](Entity::Player& player, uint32_t eventId, uint64_t additional) - { - Scene00004(quest, player); - }, - nullptr, 0); + eventMgr().eventActionStart( player, getId(), 0x01, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + Scene00004( quest, player ); + }, + nullptr, 0 ); break; } case Eobject4: { - eventMgr().eventActionStart(player, getId(), 0x01, - [&](Entity::Player& player, uint32_t eventId, uint64_t additional) - { - Scene00005(quest, player); - }, - nullptr, 0); + eventMgr().eventActionStart( player, getId(), 0x01, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + Scene00005( quest, player ); + }, + nullptr, 0 ); break; } case Eobject5: { - eventMgr().eventActionStart(player, getId(), 0x01, - [&](Entity::Player& player, uint32_t eventId, uint64_t additional) - { - Scene00006(quest, player); - }, - nullptr, 0); + eventMgr().eventActionStart( player, getId(), 0x01, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + Scene00006( quest, player ); + }, + nullptr, 0 ); break; } } } - private: +private: - void checkQuestCompletion(World::Quest& quest, Entity::Player& player) + void checkQuestCompletion( World::Quest& quest, Entity::Player& player ) + { + auto currentCC = quest.getUI8AL(); + + eventMgr().sendEventNotice( player, getId(), 0, 2, currentCC + 1, 6 ); + + if( currentCC + 1 >= 6 ) { - auto currentCC = quest.getUI8AL(); - - player.sendEventNotice(getId(), 0, 2, currentCC + 1, 6); - - if (currentCC + 1 >= 6) - { - quest.setSeq(SeqFinish); - } - else - { - quest.setUI8AL(currentCC + 1); - } + quest.setSeq( SeqFinish ); } + else + { + quest.setUI8AL( currentCC + 1 ); + } + } ////////////////////////////////////////////////////////////////////// // Available Scenes in this quest, not necessarly all are used @@ -158,7 +160,7 @@ class SubFst015 : public Sapphire::ScriptAPI::QuestScript { if( result.getResult( 0 ) == 1 ) // accept quest { - quest.setSeq(Seq1); + quest.setSeq( Seq1 ); } } @@ -171,7 +173,7 @@ class SubFst015 : public Sapphire::ScriptAPI::QuestScript void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00100(quest, player); + Scene00100( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -183,7 +185,7 @@ class SubFst015 : public Sapphire::ScriptAPI::QuestScript void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00098(quest, player); + Scene00098( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -195,7 +197,7 @@ class SubFst015 : public Sapphire::ScriptAPI::QuestScript void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00096(quest, player); + Scene00096( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -207,7 +209,7 @@ class SubFst015 : public Sapphire::ScriptAPI::QuestScript void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00094(quest, player); + Scene00094( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -219,7 +221,7 @@ class SubFst015 : public Sapphire::ScriptAPI::QuestScript void Scene00005Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00092(quest, player); + Scene00092( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -231,7 +233,7 @@ class SubFst015 : public Sapphire::ScriptAPI::QuestScript void Scene00006Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00090(quest, player); + Scene00090( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -272,8 +274,8 @@ class SubFst015 : public Sapphire::ScriptAPI::QuestScript void Scene00090Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(6, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 6, true ); } ////////////////////////////////////////////////////////////////////// @@ -297,8 +299,8 @@ class SubFst015 : public Sapphire::ScriptAPI::QuestScript void Scene00092Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(5, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 5, true ); } ////////////////////////////////////////////////////////////////////// @@ -322,8 +324,8 @@ class SubFst015 : public Sapphire::ScriptAPI::QuestScript void Scene00094Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(4, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 4, true ); } ////////////////////////////////////////////////////////////////////// @@ -347,8 +349,8 @@ class SubFst015 : public Sapphire::ScriptAPI::QuestScript void Scene00096Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(3, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 3, true ); } ////////////////////////////////////////////////////////////////////// @@ -372,8 +374,8 @@ class SubFst015 : public Sapphire::ScriptAPI::QuestScript void Scene00098Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(2, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 2, true ); } ////////////////////////////////////////////////////////////////////// @@ -397,8 +399,8 @@ class SubFst015 : public Sapphire::ScriptAPI::QuestScript void Scene00100Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(1, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 1, true ); } }; diff --git a/src/scripts/quest/subquest/gridania/SubFst030.cpp b/src/scripts/quest/subquest/gridania/SubFst030.cpp index 56f3a6ad..55cbd8a7 100644 --- a/src/scripts/quest/subquest/gridania/SubFst030.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst030.cpp @@ -17,47 +17,49 @@ using namespace Sapphire; class SubFst030 : public Sapphire::ScriptAPI::QuestScript { - private: - // Basic quest information - // Quest vars / flags used - // UI8AL - // UI8BH +private: + // Basic quest information + // Quest vars / flags used + // UI8AL + // UI8BH - /// Countable Num: 1 Seq: 1 Event: 1 Listener: 1000784 - /// Countable Num: 1 Seq: 2 Event: 1 Listener: 2000146 - /// Countable Num: 1 Seq: 3 Event: 1 Listener: 1000764 - /// Countable Num: 1 Seq: 255 Event: 1 Listener: 1000632 - // 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, - }; + /// Countable Num: 1 Seq: 1 Event: 1 Listener: 1000784 + /// Countable Num: 1 Seq: 2 Event: 1 Listener: 2000146 + /// Countable Num: 1 Seq: 3 Event: 1 Listener: 1000764 + /// Countable Num: 1 Seq: 255 Event: 1 Listener: 1000632 + // 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 = 1000632; - static constexpr auto Actor1 = 1000784; - static constexpr auto Actor2 = 1000764; - static constexpr auto Eobject0 = 2000146; - static constexpr auto EventActionGatherShort = 6; - static constexpr auto Item0 = 2000140; - static constexpr auto Seq0Actor0 = 0; - static constexpr auto Seq1Actor1 = 1; - static constexpr auto Seq2Eobject0 = 2; - static constexpr auto Seq2Eobject0Eventactionno = 99; - static constexpr auto Seq2Eobject0Eventactionok = 100; - static constexpr auto Seq3Actor2 = 3; - static constexpr auto Seq3Actor2Npctradeno = 97; - static constexpr auto Seq3Actor2Npctradeok = 98; - static constexpr auto Seq4Actor0 = 4; + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1000632; + static constexpr auto Actor1 = 1000784; + static constexpr auto Actor2 = 1000764; + static constexpr auto Eobject0 = 2000146; + static constexpr auto EventActionGatherShort = 6; + static constexpr auto Item0 = 2000140; + static constexpr auto Seq0Actor0 = 0; + static constexpr auto Seq1Actor1 = 1; + static constexpr auto Seq2Eobject0 = 2; + static constexpr auto Seq2Eobject0Eventactionno = 99; + static constexpr auto Seq2Eobject0Eventactionok = 100; + static constexpr auto Seq3Actor2 = 3; + static constexpr auto Seq3Actor2Npctradeno = 97; + static constexpr auto Seq3Actor2Npctradeok = 98; + static constexpr auto Seq4Actor0 = 4; - public: - SubFst030() : Sapphire::ScriptAPI::QuestScript( 65709 ){}; - ~SubFst030() = default; +public: + SubFst030() : Sapphire::ScriptAPI::QuestScript( 65709 ) + {}; + + ~SubFst030() = default; ////////////////////////////////////////////////////////////////////// // Event Handlers @@ -67,37 +69,37 @@ class SubFst030 : public Sapphire::ScriptAPI::QuestScript { case Actor0: { - if (!player.hasQuest(getId())) - Scene00000(quest, player); + if( !player.hasQuest( getId() ) ) + Scene00000( quest, player ); else - Scene00004(quest, player); + Scene00004( quest, player ); break; } case Actor1: { - Scene00001(quest, player); + Scene00001( quest, player ); break; } case Actor2: { - Scene00003(quest, player); + Scene00003( quest, player ); break; } case Eobject0: { - eventMgr().eventActionStart(player, getId(), 0x06, - [&](Entity::Player& player, uint32_t eventId, uint64_t additional) - { - Scene00002(quest, player); - }, - nullptr, 0); + eventMgr().eventActionStart( player, getId(), 0x06, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + Scene00002( quest, player ); + }, + nullptr, 0 ); break; } } } - private: +private: ////////////////////////////////////////////////////////////////////// // Available Scenes in this quest, not necessarly all are used ////////////////////////////////////////////////////////////////////// @@ -111,7 +113,7 @@ class SubFst030 : public Sapphire::ScriptAPI::QuestScript { if( result.getResult( 0 ) == 1 ) // accept quest { - quest.setSeq(Seq1); + quest.setSeq( Seq1 ); } } @@ -124,8 +126,8 @@ class SubFst030 : public Sapphire::ScriptAPI::QuestScript void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - quest.setSeq(Seq2); - player.sendEventNotice(getId(), 0, 2, 0, 0); + quest.setSeq( Seq2 ); + eventMgr().sendEventNotice( player, getId(), 0, 2, 0, 0 ); } ////////////////////////////////////////////////////////////////////// @@ -137,7 +139,7 @@ class SubFst030 : public Sapphire::ScriptAPI::QuestScript void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00100(quest, player); + Scene00100( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -149,10 +151,10 @@ class SubFst030 : public Sapphire::ScriptAPI::QuestScript void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - if (result.getResult(0) == 1) - Scene00098(quest, player); + if( result.getResult( 0 ) == 1 ) + Scene00098( quest, player ); else - Scene00097(quest, player); + Scene00097( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -194,8 +196,8 @@ class SubFst030 : public Sapphire::ScriptAPI::QuestScript void Scene00098Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - quest.setSeq(SeqFinish); - player.sendEventNotice(getId(), 2, 2, 0, 0); + quest.setSeq( SeqFinish ); + eventMgr().sendEventNotice( player, getId(), 2, 2, 0, 0 ); } ////////////////////////////////////////////////////////////////////// @@ -220,10 +222,10 @@ class SubFst030 : public Sapphire::ScriptAPI::QuestScript void Scene00100Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - quest.setSeq(Seq3); - player.sendEventNotice(getId(), 1, 2, 0, 0); - quest.setUI8FL(1); - quest.setUI8BH(1); + quest.setSeq( Seq3 ); + eventMgr().sendEventNotice( player, getId(), 1, 2, 0, 0 ); + quest.setUI8FL( 1 ); + quest.setUI8BH( 1 ); } }; diff --git a/src/scripts/quest/subquest/gridania/SubFst043.cpp b/src/scripts/quest/subquest/gridania/SubFst043.cpp index 51882dec..543b93c6 100644 --- a/src/scripts/quest/subquest/gridania/SubFst043.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst043.cpp @@ -17,41 +17,43 @@ using namespace Sapphire; class SubFst043 : public Sapphire::ScriptAPI::QuestScript { - private: - // Basic quest information - // Quest vars / flags used - // BitFlag8 - // UI8AL +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AL - /// Countable Num: 2 Seq: 1 Event: 1 Listener: 2000143 - /// Countable Num: 1 Seq: 255 Event: 1 Listener: 2000144 - // 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, - }; + /// Countable Num: 2 Seq: 1 Event: 1 Listener: 2000143 + /// Countable Num: 1 Seq: 255 Event: 1 Listener: 2000144 + // Steps in this quest ( 0 is before accepting, + // 1 is first, 255 means ready for turning it in + enum Sequence : uint8_t + { + Seq0 = 0, + Seq1 = 1, + SeqFinish = 255, + }; - // Entities found in the script data of the quest - static constexpr auto Actor0 = 1000172; - static constexpr auto Actor1 = 1000627; - static constexpr auto Eobject0 = 2000143; - static constexpr auto Eobject1 = 2000144; - static constexpr auto EventActionProcessMiddle = 16; - static constexpr auto Seq0Actor0 = 0; - static constexpr auto Seq1Eobject0 = 1; - static constexpr auto Seq1Eobject0Eventactionno = 99; - static constexpr auto Seq1Eobject0Eventactionok = 100; - static constexpr auto Seq1Eobject1 = 2; - static constexpr auto Seq1Eobject1Eventactionno = 97; - static constexpr auto Seq1Eobject1Eventactionok = 98; - static constexpr auto Seq2Actor1 = 3; + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1000172; + static constexpr auto Actor1 = 1000627; + static constexpr auto Eobject0 = 2000143; + static constexpr auto Eobject1 = 2000144; + static constexpr auto EventActionProcessMiddle = 16; + static constexpr auto Seq0Actor0 = 0; + static constexpr auto Seq1Eobject0 = 1; + static constexpr auto Seq1Eobject0Eventactionno = 99; + static constexpr auto Seq1Eobject0Eventactionok = 100; + static constexpr auto Seq1Eobject1 = 2; + static constexpr auto Seq1Eobject1Eventactionno = 97; + static constexpr auto Seq1Eobject1Eventactionok = 98; + static constexpr auto Seq2Actor1 = 3; - public: - SubFst043() : Sapphire::ScriptAPI::QuestScript( 65735 ){}; - ~SubFst043() = default; +public: + SubFst043() : Sapphire::ScriptAPI::QuestScript( 65735 ) + {}; + + ~SubFst043() = default; ////////////////////////////////////////////////////////////////////// // Event Handlers @@ -61,56 +63,56 @@ class SubFst043 : public Sapphire::ScriptAPI::QuestScript { case Actor0: { - Scene00000(quest, player); + Scene00000( quest, player ); break; } case Actor1: { - if (quest.getSeq() == SeqFinish) - Scene00003(quest, player); + if( quest.getSeq() == SeqFinish ) + Scene00003( quest, player ); break; } case Eobject0: { - eventMgr().eventActionStart(player, getId(), EventActionProcessMiddle, - [&](Entity::Player& player, uint32_t eventId, uint64_t additional) - { - Scene00001(quest, player); - }, - nullptr, 0); + eventMgr().eventActionStart( player, getId(), EventActionProcessMiddle, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + Scene00001( quest, player ); + }, + nullptr, 0 ); break; } case Eobject1: { - eventMgr().eventActionStart(player, getId(), EventActionProcessMiddle, - [&](Entity::Player& player, uint32_t eventId, uint64_t additional) - { - Scene00002(quest, player); - }, - nullptr, 0); + eventMgr().eventActionStart( player, getId(), EventActionProcessMiddle, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + Scene00002( quest, player ); + }, + nullptr, 0 ); break; } } } - private: - void checkQuestCompletion(World::Quest& quest, Entity::Player& player) - { - auto credit = quest.getUI8AL(); +private: + void checkQuestCompletion( World::Quest& quest, Entity::Player& player ) + { + auto credit = quest.getUI8AL(); - if (credit + 1 >= 2) - { - quest.setUI8AL(credit + 1); - player.sendEventNotice(getId(), 0, 2, credit + 1, 2); - quest.setSeq(SeqFinish); - } - else - { - quest.setUI8AL( credit + 1); - player.sendEventNotice(getId(), 0, 2, credit + 1, 2); - } + if( credit + 1 >= 2 ) + { + quest.setUI8AL( credit + 1 ); + eventMgr().sendEventNotice( player, getId(), 0, 2, credit + 1, 2 ); + quest.setSeq( SeqFinish ); } + else + { + quest.setUI8AL( credit + 1 ); + eventMgr().sendEventNotice( player, getId(), 0, 2, credit + 1, 2 ); + } + } ////////////////////////////////////////////////////////////////////// // Available Scenes in this quest, not necessarly all are used ////////////////////////////////////////////////////////////////////// @@ -124,7 +126,7 @@ class SubFst043 : public Sapphire::ScriptAPI::QuestScript { if( result.getResult( 0 ) == 1 ) // accept quest { - quest.setSeq(Seq1); + quest.setSeq( Seq1 ); } } @@ -137,7 +139,7 @@ class SubFst043 : public Sapphire::ScriptAPI::QuestScript void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00100(quest, player); + Scene00100( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -149,7 +151,7 @@ class SubFst043 : public Sapphire::ScriptAPI::QuestScript void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00098(quest, player); + Scene00098( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -190,8 +192,8 @@ class SubFst043 : public Sapphire::ScriptAPI::QuestScript void Scene00098Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(2, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 2, true ); } ////////////////////////////////////////////////////////////////////// @@ -215,8 +217,8 @@ class SubFst043 : public Sapphire::ScriptAPI::QuestScript void Scene00100Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(1, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 1, true ); } }; diff --git a/src/scripts/quest/subquest/gridania/SubFst046.cpp b/src/scripts/quest/subquest/gridania/SubFst046.cpp index 71368e1b..b97a12a1 100644 --- a/src/scripts/quest/subquest/gridania/SubFst046.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst046.cpp @@ -17,38 +17,40 @@ using namespace Sapphire; class SubFst046 : public Sapphire::ScriptAPI::QuestScript { - private: - // Basic quest information - // Quest vars / flags used - // BitFlag8 - // UI8AL +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AL - /// Countable Num: 3 Seq: 1 Event: 1 Listener: 1000792 - /// Countable Num: 1 Seq: 255 Event: 1 Listener: 1000793 - // 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, - }; + /// Countable Num: 3 Seq: 1 Event: 1 Listener: 1000792 + /// Countable Num: 1 Seq: 255 Event: 1 Listener: 1000793 + // Steps in this quest ( 0 is before accepting, + // 1 is first, 255 means ready for turning it in + enum Sequence : uint8_t + { + Seq0 = 0, + Seq1 = 1, + SeqFinish = 255, + }; - // Entities found in the script data of the quest - static constexpr auto ActionTimelineEventBaseIdle = 783; - static constexpr auto Actor0 = 1000408; - static constexpr auto Actor1 = 1000792; - static constexpr auto Actor2 = 1000793; - static constexpr auto Actor3 = 1000794; - static constexpr auto Seq0Actor0 = 0; - static constexpr auto Seq1Actor1 = 1; - static constexpr auto Seq1Actor2 = 2; - static constexpr auto Seq1Actor3 = 3; - static constexpr auto Seq2Actor0 = 4; + // Entities found in the script data of the quest + static constexpr auto ActionTimelineEventBaseIdle = 783; + static constexpr auto Actor0 = 1000408; + static constexpr auto Actor1 = 1000792; + static constexpr auto Actor2 = 1000793; + static constexpr auto Actor3 = 1000794; + static constexpr auto Seq0Actor0 = 0; + static constexpr auto Seq1Actor1 = 1; + static constexpr auto Seq1Actor2 = 2; + static constexpr auto Seq1Actor3 = 3; + static constexpr auto Seq2Actor0 = 4; - public: - SubFst046() : Sapphire::ScriptAPI::QuestScript( 65746 ){}; - ~SubFst046() = default; +public: + SubFst046() : Sapphire::ScriptAPI::QuestScript( 65746 ) + {}; + + ~SubFst046() = default; ////////////////////////////////////////////////////////////////////// // Event Handlers @@ -58,49 +60,49 @@ class SubFst046 : public Sapphire::ScriptAPI::QuestScript { case Actor0: { - if (!player.hasQuest(getId())) - Scene00000(quest, player); - else if (quest.getSeq() == SeqFinish) - Scene00004(quest, player); + if( !player.hasQuest( getId() ) ) + Scene00000( quest, player ); + else if( quest.getSeq() == SeqFinish ) + Scene00004( quest, player ); break; } case Actor1: { - Scene00001(quest, player); + Scene00001( quest, player ); break; } case Actor2: { - Scene00002(quest, player); + Scene00002( quest, player ); break; } case Actor3: { - Scene00003(quest, player); + Scene00003( quest, player ); break; } } } - private: +private: - void checkQuestCompletion(World::Quest& quest, Entity::Player& player) + void checkQuestCompletion( World::Quest& quest, Entity::Player& player ) + { + auto credit = quest.getUI8AL(); + + if( credit + 1 >= 3 ) { - auto credit = quest.getUI8AL(); - - if (credit + 1 >= 3) - { - quest.setUI8AL(credit + 1); - player.sendEventNotice(getId(), 0, 0, credit + 1, 3); - quest.setSeq(SeqFinish); - } - else - { - quest.setUI8AL(credit + 1); - player.sendEventNotice(getId(), 0, 0, credit + 1, 3); - } + quest.setUI8AL( credit + 1 ); + eventMgr().sendEventNotice( player, getId(), 0, 0, credit + 1, 3 ); + quest.setSeq( SeqFinish ); } + else + { + quest.setUI8AL( credit + 1 ); + eventMgr().sendEventNotice( player, getId(), 0, 0, credit + 1, 3 ); + } + } ////////////////////////////////////////////////////////////////////// // Available Scenes in this quest, not necessarly all are used ////////////////////////////////////////////////////////////////////// @@ -114,7 +116,7 @@ class SubFst046 : public Sapphire::ScriptAPI::QuestScript { if( result.getResult( 0 ) == 1 ) // accept quest { - quest.setSeq(Seq1); + quest.setSeq( Seq1 ); } } @@ -127,8 +129,8 @@ class SubFst046 : public Sapphire::ScriptAPI::QuestScript void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(1, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 1, true ); } ////////////////////////////////////////////////////////////////////// @@ -140,8 +142,8 @@ class SubFst046 : public Sapphire::ScriptAPI::QuestScript void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(2, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 2, true ); } ////////////////////////////////////////////////////////////////////// @@ -153,8 +155,8 @@ class SubFst046 : public Sapphire::ScriptAPI::QuestScript void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(3, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 3, true ); } ////////////////////////////////////////////////////////////////////// diff --git a/src/scripts/quest/subquest/gridania/SubFst048.cpp b/src/scripts/quest/subquest/gridania/SubFst048.cpp index 324c9c67..5ba3b61f 100644 --- a/src/scripts/quest/subquest/gridania/SubFst048.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst048.cpp @@ -17,37 +17,39 @@ using namespace Sapphire; class SubFst048 : public Sapphire::ScriptAPI::QuestScript { - private: - // Basic quest information - // Quest vars / flags used - // BitFlag8 - // UI8AL +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AL - /// Countable Num: 3 Seq: 1 Event: 1 Listener: 1000474 - /// Countable Num: 1 Seq: 255 Event: 1 Listener: 1000476 - // 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, - }; + /// Countable Num: 3 Seq: 1 Event: 1 Listener: 1000474 + /// Countable Num: 1 Seq: 255 Event: 1 Listener: 1000476 + // Steps in this quest ( 0 is before accepting, + // 1 is first, 255 means ready for turning it in + enum Sequence : uint8_t + { + Seq0 = 0, + Seq1 = 1, + SeqFinish = 255, + }; - // Entities found in the script data of the quest - static constexpr auto Actor0 = 1000742; - static constexpr auto Actor1 = 1000474; - static constexpr auto Actor2 = 1000476; - static constexpr auto Actor3 = 1000483; - static constexpr auto Seq0Actor0 = 0; - static constexpr auto Seq1Actor1 = 1; - static constexpr auto Seq1Actor2 = 2; - static constexpr auto Seq1Actor3 = 3; - static constexpr auto Seq2Actor0 = 4; + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1000742; + static constexpr auto Actor1 = 1000474; + static constexpr auto Actor2 = 1000476; + static constexpr auto Actor3 = 1000483; + static constexpr auto Seq0Actor0 = 0; + static constexpr auto Seq1Actor1 = 1; + static constexpr auto Seq1Actor2 = 2; + static constexpr auto Seq1Actor3 = 3; + static constexpr auto Seq2Actor0 = 4; - public: - SubFst048() : Sapphire::ScriptAPI::QuestScript( 65911 ){}; - ~SubFst048() = default; +public: + SubFst048() : Sapphire::ScriptAPI::QuestScript( 65911 ) + {}; + + ~SubFst048() = default; ////////////////////////////////////////////////////////////////////// // Event Handlers @@ -57,48 +59,48 @@ class SubFst048 : public Sapphire::ScriptAPI::QuestScript { case Actor0: { - if (!player.hasQuest(getId())) - Scene00000(quest, player); - else if (quest.getSeq() == SeqFinish) - Scene00004(quest, player); + if( !player.hasQuest( getId() ) ) + Scene00000( quest, player ); + else if( quest.getSeq() == SeqFinish ) + Scene00004( quest, player ); break; } case Actor1: { - Scene00001(quest, player); + Scene00001( quest, player ); break; } case Actor2: { - Scene00002(quest, player); + Scene00002( quest, player ); break; } case Actor3: { - Scene00003(quest, player); + Scene00003( quest, player ); break; } } } - private: - void checkQuestCompletion(World::Quest& quest, Entity::Player& player) - { - auto credit = quest.getUI8AL(); +private: + void checkQuestCompletion( World::Quest& quest, Entity::Player& player ) + { + auto credit = quest.getUI8AL(); - if (credit + 1 >= 3) - { - quest.setUI8AL(credit + 1); - player.sendEventNotice(getId(), 0, 2, credit + 1, 3); - quest.setSeq(SeqFinish); - } - else - { - quest.setUI8AL(credit + 1); - player.sendEventNotice(getId(), 0, 2, credit + 1, 3); - } + if( credit + 1 >= 3 ) + { + quest.setUI8AL( credit + 1 ); + eventMgr().sendEventNotice( player, getId(), 0, 2, credit + 1, 3 ); + quest.setSeq( SeqFinish ); } + else + { + quest.setUI8AL( credit + 1 ); + eventMgr().sendEventNotice( player, getId(), 0, 2, credit + 1, 3 ); + } + } ////////////////////////////////////////////////////////////////////// // Available Scenes in this quest, not necessarly all are used ////////////////////////////////////////////////////////////////////// @@ -112,7 +114,7 @@ class SubFst048 : public Sapphire::ScriptAPI::QuestScript { if( result.getResult( 0 ) == 1 ) // accept quest { - quest.setSeq(Seq1); + quest.setSeq( Seq1 ); } } @@ -125,8 +127,8 @@ class SubFst048 : public Sapphire::ScriptAPI::QuestScript void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(1, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 1, true ); } ////////////////////////////////////////////////////////////////////// @@ -138,8 +140,8 @@ class SubFst048 : public Sapphire::ScriptAPI::QuestScript void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(2, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 2, true ); } ////////////////////////////////////////////////////////////////////// @@ -151,8 +153,8 @@ class SubFst048 : public Sapphire::ScriptAPI::QuestScript void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(3, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 3, true ); } ////////////////////////////////////////////////////////////////////// diff --git a/src/scripts/quest/subquest/limsa/SubSea001.cpp b/src/scripts/quest/subquest/limsa/SubSea001.cpp index bcd16ecf..12846b34 100644 --- a/src/scripts/quest/subquest/limsa/SubSea001.cpp +++ b/src/scripts/quest/subquest/limsa/SubSea001.cpp @@ -17,46 +17,48 @@ using namespace Sapphire; class SubSea001 : public Sapphire::ScriptAPI::QuestScript { - private: - // Basic quest information - // Quest vars / flags used - // BitFlag8 - // UI8AL - // UI8BH +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AL + // UI8BH - /// Countable Num: 1 Seq: 1 Event: 1 Listener: 1000969 - /// Countable Num: 0 Seq: 2 Event: 1 Listener: 2001563 - /// Countable Num: 0 Seq: 255 Event: 1 Listener: 2001564 - // 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, - }; + /// Countable Num: 1 Seq: 1 Event: 1 Listener: 1000969 + /// Countable Num: 0 Seq: 2 Event: 1 Listener: 2001563 + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 2001564 + // 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 = 1002698; - static constexpr auto Actor1 = 1000969; - static constexpr auto Actor2 = 1003604; - static constexpr auto Eobject0 = 2001563; - static constexpr auto Eobject1 = 2001564; - static constexpr auto Eobject2 = 2001565; - static constexpr auto Eobject3 = 2001566; - static constexpr auto Eobject4 = 2001567; - static constexpr auto Eobject5 = 2001568; - static constexpr auto EventActionProcess = 14; - static constexpr auto Item0 = 2000447; - static constexpr auto Poprange0 = 4161445; - static constexpr auto Quest0 = 65644; - static constexpr auto Quest1 = 65645; - static constexpr auto Territorytype0 = 129; + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1002698; + static constexpr auto Actor1 = 1000969; + static constexpr auto Actor2 = 1003604; + static constexpr auto Eobject0 = 2001563; + static constexpr auto Eobject1 = 2001564; + static constexpr auto Eobject2 = 2001565; + static constexpr auto Eobject3 = 2001566; + static constexpr auto Eobject4 = 2001567; + static constexpr auto Eobject5 = 2001568; + static constexpr auto EventActionProcess = 14; + static constexpr auto Item0 = 2000447; + static constexpr auto Poprange0 = 4161445; + static constexpr auto Quest0 = 65644; + static constexpr auto Quest1 = 65645; + static constexpr auto Territorytype0 = 129; - public: - SubSea001() : Sapphire::ScriptAPI::QuestScript( 65647 ){}; - ~SubSea001() = default; +public: + SubSea001() : Sapphire::ScriptAPI::QuestScript( 65647 ) + {}; + + ~SubSea001() = default; ////////////////////////////////////////////////////////////////////// // Event Handlers @@ -66,82 +68,82 @@ class SubSea001 : public Sapphire::ScriptAPI::QuestScript { case Actor0: { - Scene00000(quest, player); + Scene00000( quest, player ); break; } case Actor1: { - Scene00002(quest, player); + Scene00002( quest, player ); break; } case Actor2: { - Scene00016(quest, player); + Scene00016( quest, player ); break; } case Eobject0: { - eventMgr().eventActionStart(player, getId(), 0x0E, - [&](Entity::Player& player, uint32_t eventId, uint64_t additional) - { - Scene00003(quest, player); - }, - nullptr, 0); + eventMgr().eventActionStart( player, getId(), 0x0E, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + Scene00003( quest, player ); + }, + nullptr, 0 ); break; } case Eobject1: { - eventMgr().eventActionStart(player, getId(), 0x0E, - [&](Entity::Player& player, uint32_t eventId, uint64_t additional) - { - Scene00005(quest, player); - }, - nullptr, 0); + eventMgr().eventActionStart( player, getId(), 0x0E, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + Scene00005( quest, player ); + }, + nullptr, 0 ); break; } case Eobject2: { - eventMgr().eventActionStart(player, getId(), 0x0E, - [&](Entity::Player& player, uint32_t eventId, uint64_t additional) - { - Scene00007(quest, player); - }, - nullptr, 0); + eventMgr().eventActionStart( player, getId(), 0x0E, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + Scene00007( quest, player ); + }, + nullptr, 0 ); break; } case Eobject3: { - eventMgr().eventActionStart(player, getId(), 0x0E, - [&](Entity::Player& player, uint32_t eventId, uint64_t additional) - { - Scene00009(quest, player); - }, - nullptr, 0); + eventMgr().eventActionStart( player, getId(), 0x0E, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + Scene00009( quest, player ); + }, + nullptr, 0 ); break; } case Eobject4: { - eventMgr().eventActionStart(player, getId(), 0x0E, - [&](Entity::Player& player, uint32_t eventId, uint64_t additional) - { - Scene00011(quest, player); - }, - nullptr, 0); + eventMgr().eventActionStart( player, getId(), 0x0E, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + Scene00011( quest, player ); + }, + nullptr, 0 ); break; } case Eobject5: { - eventMgr().eventActionStart(player, getId(), 0x0E, - [&](Entity::Player& player, uint32_t eventId, uint64_t additional) - { - Scene00013(quest, player); - }, - nullptr, 0); + eventMgr().eventActionStart( player, getId(), 0x0E, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + Scene00013( quest, player ); + }, + nullptr, 0 ); break; } @@ -149,27 +151,27 @@ class SubSea001 : public Sapphire::ScriptAPI::QuestScript } - private: +private: - void checkQuestCompletion(World::Quest& quest, Entity::Player& player) + void checkQuestCompletion( World::Quest& quest, Entity::Player& player ) + { + auto currentCC = quest.getUI8BH(); + + eventMgr().sendEventNotice( player, getId(), 1, 3, currentCC + 1, 6 ); + + if( currentCC + 1 >= 6 ) { - auto currentCC = quest.getUI8BH(); - - player.sendEventNotice(getId(), 1, 3, currentCC + 1, 6); - - if (currentCC + 1 >= 6) - { - quest.setSeq(SeqFinish); - quest.setUI8BH(currentCC + 1); - quest.setUI8AL(currentCC + 1); - } - else - { - quest.setUI8BH(currentCC + 1); - quest.setUI8AL(currentCC + 1); - } + quest.setSeq( SeqFinish ); + quest.setUI8BH( currentCC + 1 ); + quest.setUI8AL( currentCC + 1 ); } + else + { + quest.setUI8BH( currentCC + 1 ); + quest.setUI8AL( currentCC + 1 ); + } + } ////////////////////////////////////////////////////////////////////// // Available Scenes in this quest, not necessarly all are used ////////////////////////////////////////////////////////////////////// @@ -183,7 +185,7 @@ class SubSea001 : public Sapphire::ScriptAPI::QuestScript { if( result.getResult( 0 ) == 1 ) // accept quest { - quest.setSeq(Seq1); + quest.setSeq( Seq1 ); } } @@ -209,13 +211,13 @@ class SubSea001 : public Sapphire::ScriptAPI::QuestScript void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - if (player.hasQuest(Quest0) || player.hasQuest(Quest1)) + if( player.hasQuest( Quest0 ) || player.hasQuest( Quest1 ) ) { - if (result.getResult(0) == 1) + if( result.getResult( 0 ) == 1 ) { - quest.setSeq(Seq2); - player.changePosition(10, 21, 13, -2); - player.forceZoneing(Territorytype0); //Teleport to real Limsa + quest.setSeq( Seq2 ); + player.changePosition( 10, 21, 13, -2 ); + player.forceZoneing( Territorytype0 ); //Teleport to real Limsa } } else @@ -233,7 +235,7 @@ class SubSea001 : public Sapphire::ScriptAPI::QuestScript void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00004(quest, player); + Scene00004( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -245,8 +247,8 @@ class SubSea001 : public Sapphire::ScriptAPI::QuestScript void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(1, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 1, true ); } ////////////////////////////////////////////////////////////////////// @@ -258,7 +260,7 @@ class SubSea001 : public Sapphire::ScriptAPI::QuestScript void Scene00005Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00006(quest, player); + Scene00006( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -270,8 +272,8 @@ class SubSea001 : public Sapphire::ScriptAPI::QuestScript void Scene00006Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(2, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 2, true ); } ////////////////////////////////////////////////////////////////////// @@ -283,7 +285,7 @@ class SubSea001 : public Sapphire::ScriptAPI::QuestScript void Scene00007Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00008(quest, player); + Scene00008( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -295,8 +297,8 @@ class SubSea001 : public Sapphire::ScriptAPI::QuestScript void Scene00008Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(3, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 3, true ); } ////////////////////////////////////////////////////////////////////// @@ -308,7 +310,7 @@ class SubSea001 : public Sapphire::ScriptAPI::QuestScript void Scene00009Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00010(quest, player); + Scene00010( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -320,8 +322,8 @@ class SubSea001 : public Sapphire::ScriptAPI::QuestScript void Scene00010Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(4, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 4, true ); } ////////////////////////////////////////////////////////////////////// @@ -333,7 +335,7 @@ class SubSea001 : public Sapphire::ScriptAPI::QuestScript void Scene00011Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00012(quest, player); + Scene00012( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -345,8 +347,8 @@ class SubSea001 : public Sapphire::ScriptAPI::QuestScript void Scene00012Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(5, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 5, true ); } ////////////////////////////////////////////////////////////////////// @@ -358,7 +360,7 @@ class SubSea001 : public Sapphire::ScriptAPI::QuestScript void Scene00013Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00014(quest, player); + Scene00014( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -370,8 +372,8 @@ class SubSea001 : public Sapphire::ScriptAPI::QuestScript void Scene00014Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(6, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 6, true ); } ////////////////////////////////////////////////////////////////////// @@ -396,7 +398,7 @@ class SubSea001 : public Sapphire::ScriptAPI::QuestScript void Scene00016Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00017(quest, player); + Scene00017( quest, player ); } ////////////////////////////////////////////////////////////////////// diff --git a/src/scripts/quest/subquest/uldah/SubWil004.cpp b/src/scripts/quest/subquest/uldah/SubWil004.cpp index 1ba9af6f..ff53423c 100644 --- a/src/scripts/quest/subquest/uldah/SubWil004.cpp +++ b/src/scripts/quest/subquest/uldah/SubWil004.cpp @@ -17,40 +17,42 @@ using namespace Sapphire; class SubWil004 : public Sapphire::ScriptAPI::QuestScript { - private: - // Basic quest information - // Quest vars / flags used - // BitFlag8 - // UI8AH - // UI8AL - // UI8BH +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AH + // UI8AL + // UI8BH - /// Countable Num: 1 Seq: 1 Event: 1 Listener: 1001292 - /// Countable Num: 2 Seq: 2 Event: 1 Listener: 2000691 - /// Countable Num: 1 Seq: 255 Event: 8 Listener: 2000691 - // 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, - }; + /// Countable Num: 1 Seq: 1 Event: 1 Listener: 1001292 + /// Countable Num: 2 Seq: 2 Event: 1 Listener: 2000691 + /// Countable Num: 1 Seq: 255 Event: 8 Listener: 2000691 + // 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 = 1001291; - static constexpr auto Actor1 = 1001292; - static constexpr auto Actor2 = 1003896; - static constexpr auto Eobject0 = 2000691; - static constexpr auto Eobject1 = 2000692; - static constexpr auto Eobject2 = 2000693; - static constexpr auto EventActionSearch = 1; - static constexpr auto Item0 = 2000137; + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1001291; + static constexpr auto Actor1 = 1001292; + static constexpr auto Actor2 = 1003896; + static constexpr auto Eobject0 = 2000691; + static constexpr auto Eobject1 = 2000692; + static constexpr auto Eobject2 = 2000693; + static constexpr auto EventActionSearch = 1; + static constexpr auto Item0 = 2000137; - public: - SubWil004() : Sapphire::ScriptAPI::QuestScript( 65689 ){}; - ~SubWil004() = default; +public: + SubWil004() : Sapphire::ScriptAPI::QuestScript( 65689 ) + {}; + + ~SubWil004() = default; ////////////////////////////////////////////////////////////////////// // Event Handlers @@ -60,77 +62,77 @@ class SubWil004 : public Sapphire::ScriptAPI::QuestScript { case Actor0: { - Scene00000(quest, player); + Scene00000( quest, player ); break; } case Actor1: { - Scene00001(quest, player); + Scene00001( quest, player ); break; } case Actor2: { - Scene00008(quest, player); + Scene00008( quest, player ); break; } case Eobject0: { - eventMgr().eventActionStart(player, getId(), 0x01, - [&](Entity::Player& player, uint32_t eventId, uint64_t additional) - { - Scene00003(quest, player); - }, - nullptr, 0); + eventMgr().eventActionStart( player, getId(), 0x01, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + Scene00003( quest, player ); + }, + nullptr, 0 ); break; } case Eobject1: { - eventMgr().eventActionStart(player, getId(), 0x01, - [&](Entity::Player& player, uint32_t eventId, uint64_t additional) - { - Scene00005(quest, player); - }, - nullptr, 0); + eventMgr().eventActionStart( player, getId(), 0x01, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + Scene00005( quest, player ); + }, + nullptr, 0 ); break; } case Eobject2: { - eventMgr().eventActionStart(player, getId(), 0x01, - [&](Entity::Player& player, uint32_t eventId, uint64_t additional) - { - Scene00007(quest, player); - }, - nullptr, 0); + eventMgr().eventActionStart( player, getId(), 0x01, + [ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + Scene00007( quest, player ); + }, + nullptr, 0 ); break; } } } - private: +private: - void checkQuestCompletion(World::Quest& quest, Entity::Player& player) + void checkQuestCompletion( World::Quest& quest, Entity::Player& player ) + { + auto currentCC = quest.getUI8AL(); + auto currentQC = quest.getUI8BH(); + + eventMgr().sendEventNotice( player, getId(), 1, 3, currentCC + 1, 3 ); + + if( currentCC + 1 >= 3 ) { - auto currentCC = quest.getUI8AL(); - auto currentQC = quest.getUI8BH(); - - player.sendEventNotice(getId(), 1, 3, currentCC + 1, 3); - - if (currentCC + 1 >= 3) - { - quest.setSeq(SeqFinish); - quest.setUI8AH(currentCC + 1); - quest.setUI8AL(currentCC + 1); - quest.setUI8BH(0); - } - else - { - quest.setUI8AH(currentCC + 1); - quest.setUI8AL(currentCC + 1); - quest.setUI8BH(currentQC - 1); - } + quest.setSeq( SeqFinish ); + quest.setUI8AH( currentCC + 1 ); + quest.setUI8AL( currentCC + 1 ); + quest.setUI8BH( 0 ); } + else + { + quest.setUI8AH( currentCC + 1 ); + quest.setUI8AL( currentCC + 1 ); + quest.setUI8BH( currentQC - 1 ); + } + } ////////////////////////////////////////////////////////////////////// // Available Scenes in this quest, not necessarly all are used @@ -145,7 +147,7 @@ class SubWil004 : public Sapphire::ScriptAPI::QuestScript { if( result.getResult( 0 ) == 1 ) // accept quest { - quest.setSeq(Seq1); + quest.setSeq( Seq1 ); } } @@ -158,9 +160,9 @@ class SubWil004 : public Sapphire::ScriptAPI::QuestScript void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - quest.setSeq(Seq2); - player.sendEventNotice(getId(), 0, 2, 0, 0); - quest.setUI8BH(3); + quest.setSeq( Seq2 ); + eventMgr().sendEventNotice( player, getId(), 0, 2, 0, 0 ); + quest.setUI8BH( 3 ); } ////////////////////////////////////////////////////////////////////// @@ -172,7 +174,7 @@ class SubWil004 : public Sapphire::ScriptAPI::QuestScript void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00003(quest, player); + Scene00003( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -184,8 +186,8 @@ class SubWil004 : public Sapphire::ScriptAPI::QuestScript void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(1, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 1, true ); } ////////////////////////////////////////////////////////////////////// @@ -197,7 +199,7 @@ class SubWil004 : public Sapphire::ScriptAPI::QuestScript void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00005(quest, player); + Scene00005( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -209,8 +211,8 @@ class SubWil004 : public Sapphire::ScriptAPI::QuestScript void Scene00005Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(2, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 2, true ); } ////////////////////////////////////////////////////////////////////// @@ -222,7 +224,7 @@ class SubWil004 : public Sapphire::ScriptAPI::QuestScript void Scene00006Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00007(quest, player); + Scene00007( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -234,8 +236,8 @@ class SubWil004 : public Sapphire::ScriptAPI::QuestScript void Scene00007Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(3, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 3, true ); } ////////////////////////////////////////////////////////////////////// diff --git a/src/scripts/quest/subquest/uldah/SubWil006.cpp b/src/scripts/quest/subquest/uldah/SubWil006.cpp index 4dcf2bd8..ed643ff8 100644 --- a/src/scripts/quest/subquest/uldah/SubWil006.cpp +++ b/src/scripts/quest/subquest/uldah/SubWil006.cpp @@ -17,32 +17,34 @@ using namespace Sapphire; class SubWil006 : public Sapphire::ScriptAPI::QuestScript { - private: - // Basic quest information - // Quest vars / flags used - // UI8AL - // UI8BH +private: + // Basic quest information + // Quest vars / flags used + // UI8AL + // UI8BH - /// Countable Num: 1 Seq: 1 Event: 1 Listener: 1002280 - /// Countable Num: 1 Seq: 255 Event: 1 Listener: 1001299 - // 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, - }; + /// Countable Num: 1 Seq: 1 Event: 1 Listener: 1002280 + /// Countable Num: 1 Seq: 255 Event: 1 Listener: 1001299 + // 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 = 1001295; - static constexpr auto Actor1 = 1002280; - static constexpr auto Actor2 = 1001299; - static constexpr auto Item0 = 2000201; + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1001295; + static constexpr auto Actor1 = 1002280; + static constexpr auto Actor2 = 1001299; + static constexpr auto Item0 = 2000201; - public: - SubWil006() : Sapphire::ScriptAPI::QuestScript( 65701 ){}; - ~SubWil006() = default; +public: + SubWil006() : Sapphire::ScriptAPI::QuestScript( 65701 ) + {}; + + ~SubWil006() = default; ////////////////////////////////////////////////////////////////////// // Event Handlers @@ -52,24 +54,24 @@ class SubWil006 : public Sapphire::ScriptAPI::QuestScript { case Actor0: { - Scene00000(quest, player); + Scene00000( quest, player ); break; } case Actor1: { - Scene00001(quest, player); + Scene00001( quest, player ); break; } case Actor2: { - Scene00004(quest, player); + Scene00004( quest, player ); break; } } } - private: +private: ////////////////////////////////////////////////////////////////////// // Available Scenes in this quest, not necessarly all are used ////////////////////////////////////////////////////////////////////// @@ -83,8 +85,8 @@ class SubWil006 : public Sapphire::ScriptAPI::QuestScript { if( result.getResult( 0 ) == 1 ) // accept quest { - quest.setSeq(Seq1); - quest.setUI8BH(1); + quest.setSeq( Seq1 ); + quest.setUI8BH( 1 ); } } @@ -97,10 +99,10 @@ class SubWil006 : public Sapphire::ScriptAPI::QuestScript void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - if (result.getResult(0) == 1) - Scene00002(quest, player); + if( result.getResult( 0 ) == 1 ) + Scene00002( quest, player ); else - Scene00003(quest, player); + Scene00003( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -112,8 +114,8 @@ class SubWil006 : public Sapphire::ScriptAPI::QuestScript void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - quest.setSeq(SeqFinish); - player.sendEventNotice(getId(), 0, 2, 0, 0); + quest.setSeq( SeqFinish ); + eventMgr().sendEventNotice( player, getId(), 0, 2, 0, 0 ); } ////////////////////////////////////////////////////////////////////// diff --git a/src/scripts/quest/subquest/uldah/SubWil007.cpp b/src/scripts/quest/subquest/uldah/SubWil007.cpp index 8ea7bab7..9de7f1a1 100644 --- a/src/scripts/quest/subquest/uldah/SubWil007.cpp +++ b/src/scripts/quest/subquest/uldah/SubWil007.cpp @@ -17,37 +17,39 @@ using namespace Sapphire; class SubWil007 : public Sapphire::ScriptAPI::QuestScript { - private: - // Basic quest information - // Quest vars / flags used - // BitFlag8 - // UI8AL +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AL - /// Countable Num: 1 Seq: 1 Event: 1 Listener: 1007621 - /// Countable Num: 5 Seq: 2 Event: 2 Listener: 1007621 - /// Countable Num: 1 Seq: 255 Event: 1 Listener: 1001297 - // 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, - }; + /// Countable Num: 1 Seq: 1 Event: 1 Listener: 1007621 + /// Countable Num: 5 Seq: 2 Event: 2 Listener: 1007621 + /// Countable Num: 1 Seq: 255 Event: 1 Listener: 1001297 + // 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 = 1007621; - static constexpr auto Actor1 = 1001297; - static constexpr auto Actor2 = 1001692; - static constexpr auto Actor3 = 1001693; - static constexpr auto Actor4 = 1001697; - static constexpr auto Actor5 = 1001698; - static constexpr auto FirstQuest = 66130; + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1007621; + static constexpr auto Actor1 = 1001297; + static constexpr auto Actor2 = 1001692; + static constexpr auto Actor3 = 1001693; + static constexpr auto Actor4 = 1001697; + static constexpr auto Actor5 = 1001698; + static constexpr auto FirstQuest = 66130; - public: - SubWil007() : Sapphire::ScriptAPI::QuestScript( 65703 ){}; - ~SubWil007() = default; +public: + SubWil007() : Sapphire::ScriptAPI::QuestScript( 65703 ) + {}; + + ~SubWil007() = default; ////////////////////////////////////////////////////////////////////// // Event Handlers @@ -57,90 +59,90 @@ class SubWil007 : public Sapphire::ScriptAPI::QuestScript { case Actor0: { - if (!player.hasQuest(getId())) - Scene00000(quest, player); - else if (quest.getSeq() == SeqFinish) - Scene00020(quest, player); + if( !player.hasQuest( getId() ) ) + Scene00000( quest, player ); + else if( quest.getSeq() == SeqFinish ) + Scene00020( quest, player ); break; } case Actor1: { - Scene00005(quest, player); + Scene00005( quest, player ); break; } case Actor2: { - Scene00008(quest, player); + Scene00008( quest, player ); break; } case Actor3: { - Scene00011(quest, player); + Scene00011( quest, player ); break; } case Actor4: { - Scene00014(quest, player); + Scene00014( quest, player ); break; } case Actor5: { - Scene00017(quest, player); + Scene00017( quest, player ); break; } } } - void onEmote(World::Quest& quest, uint64_t actorId, uint32_t emoteId, Entity::Player& player) override + void onEmote( World::Quest& quest, uint64_t actorId, uint32_t emoteId, Entity::Player& player ) override { - if (emoteId != 41) + if( emoteId != 41 ) return; - if (actorId == Actor0 && quest.getSeq() == Seq1) + if( actorId == Actor0 && quest.getSeq() == Seq1 ) { - Scene00003(quest, player); + Scene00003( quest, player ); } - else if (actorId == Actor1 && quest.getSeq() == Seq2) + else if( actorId == Actor1 && quest.getSeq() == Seq2 ) { - Scene00006(quest, player); + Scene00006( quest, player ); } - else if (actorId == Actor2 && quest.getSeq() == Seq2) + else if( actorId == Actor2 && quest.getSeq() == Seq2 ) { - Scene00009(quest, player); + Scene00009( quest, player ); } - else if (actorId == Actor3 && quest.getSeq() == Seq2) + else if( actorId == Actor3 && quest.getSeq() == Seq2 ) { - Scene00012(quest, player); + Scene00012( quest, player ); } - else if (actorId == Actor4 && quest.getSeq() == Seq2) + else if( actorId == Actor4 && quest.getSeq() == Seq2 ) { - Scene00015(quest, player); + Scene00015( quest, player ); } - else if (actorId == Actor5 && quest.getSeq() == Seq2) + else if( actorId == Actor5 && quest.getSeq() == Seq2 ) { - Scene00018(quest, player); + Scene00018( quest, player ); } } - private: +private: - void checkQuestCompletion(World::Quest& quest, Entity::Player& player) + void checkQuestCompletion( World::Quest& quest, Entity::Player& player ) + { + auto currentQC = quest.getUI8AL() + 1; + + if( currentQC >= 5 ) { - auto currentQC = quest.getUI8AL() + 1; - - if (currentQC >= 5) - { - quest.setSeq(SeqFinish); - player.sendEventNotice(getId(), 1, 2, currentQC, 5); - } - else - { - quest.setUI8AL(currentQC); - player.sendEventNotice(getId(), 1, 2, currentQC, 5); - } + quest.setSeq( SeqFinish ); + eventMgr().sendEventNotice( player, getId(), 1, 2, currentQC, 5 ); } + else + { + quest.setUI8AL( currentQC ); + eventMgr().sendEventNotice( player, getId(), 1, 2, currentQC, 5 ); + } + } ////////////////////////////////////////////////////////////////////// // Available Scenes in this quest, not necessarly all are used ////////////////////////////////////////////////////////////////////// @@ -154,7 +156,7 @@ class SubWil007 : public Sapphire::ScriptAPI::QuestScript { if( result.getResult( 0 ) == 1 ) // accept quest { - Scene00001(quest, player); + Scene00001( quest, player ); } } @@ -167,7 +169,7 @@ class SubWil007 : public Sapphire::ScriptAPI::QuestScript void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - quest.setSeq(Seq1); + quest.setSeq( Seq1 ); } ////////////////////////////////////////////////////////////////////// @@ -191,8 +193,8 @@ class SubWil007 : public Sapphire::ScriptAPI::QuestScript void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - quest.setSeq(Seq2); - player.sendEventNotice(getId(), 0, 1, 0, 0); + quest.setSeq( Seq2 ); + eventMgr().sendEventNotice( player, getId(), 0, 1, 0, 0 ); } ////////////////////////////////////////////////////////////////////// @@ -228,8 +230,8 @@ class SubWil007 : public Sapphire::ScriptAPI::QuestScript void Scene00006Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(1, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 1, true ); } ////////////////////////////////////////////////////////////////////// @@ -265,8 +267,8 @@ class SubWil007 : public Sapphire::ScriptAPI::QuestScript void Scene00009Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(2, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 2, true ); } ////////////////////////////////////////////////////////////////////// @@ -302,8 +304,8 @@ class SubWil007 : public Sapphire::ScriptAPI::QuestScript void Scene00012Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(3, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 3, true ); } ////////////////////////////////////////////////////////////////////// @@ -339,8 +341,8 @@ class SubWil007 : public Sapphire::ScriptAPI::QuestScript void Scene00015Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(4, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 4, true ); } ////////////////////////////////////////////////////////////////////// @@ -376,8 +378,8 @@ class SubWil007 : public Sapphire::ScriptAPI::QuestScript void Scene00018Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(5, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 5, true ); } ////////////////////////////////////////////////////////////////////// diff --git a/src/scripts/quest/subquest/uldah/SubWil018.cpp b/src/scripts/quest/subquest/uldah/SubWil018.cpp index 6a25dfcb..583aab86 100644 --- a/src/scripts/quest/subquest/uldah/SubWil018.cpp +++ b/src/scripts/quest/subquest/uldah/SubWil018.cpp @@ -17,37 +17,39 @@ using namespace Sapphire; class SubWil018 : public Sapphire::ScriptAPI::QuestScript { - private: - // Basic quest information - // Quest vars / flags used - // BitFlag8 - // UI8AL - // UI8BH +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AL + // UI8BH - /// Countable Num: 5 Seq: 1 Event: 1 Listener: 2000695 - /// Countable Num: 1 Seq: 255 Event: 1 Listener: 2000696 - // 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, - }; + /// Countable Num: 5 Seq: 1 Event: 1 Listener: 2000695 + /// Countable Num: 1 Seq: 255 Event: 1 Listener: 2000696 + // 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 = 1001675; - static constexpr auto Eobject0 = 2000695; - static constexpr auto Eobject1 = 2000696; - static constexpr auto Eobject2 = 2000697; - static constexpr auto Eobject3 = 2001089; - static constexpr auto Eobject4 = 2001090; - static constexpr auto EventActionSearch = 1; - static constexpr auto Item0 = 2000198; + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1001675; + static constexpr auto Eobject0 = 2000695; + static constexpr auto Eobject1 = 2000696; + static constexpr auto Eobject2 = 2000697; + static constexpr auto Eobject3 = 2001089; + static constexpr auto Eobject4 = 2001090; + static constexpr auto EventActionSearch = 1; + static constexpr auto Item0 = 2000198; - public: - SubWil018() : Sapphire::ScriptAPI::QuestScript( 65932 ){}; - ~SubWil018() = default; +public: + SubWil018() : Sapphire::ScriptAPI::QuestScript( 65932 ) + {}; + + ~SubWil018() = default; ////////////////////////////////////////////////////////////////////// // Event Handlers @@ -57,61 +59,61 @@ class SubWil018 : public Sapphire::ScriptAPI::QuestScript { case Actor0: { - if (!player.hasQuest(getId())) - Scene00000(quest, player); + if( !player.hasQuest( getId() ) ) + Scene00000( quest, player ); else - Scene00016(quest, player); + Scene00016( quest, player ); break; } case Eobject0: { - Scene00001(quest, player); + Scene00001( quest, player ); break; } case Eobject1: { - Scene00004(quest, player); + Scene00004( quest, player ); break; } case Eobject2: { - Scene00007(quest, player); + Scene00007( quest, player ); break; } case Eobject3: { - Scene00010(quest, player); + Scene00010( quest, player ); break; } case Eobject4: { - Scene00013(quest, player); + Scene00013( quest, player ); break; } } } - private: +private: - void checkQuestCompletion(World::Quest& quest, Entity::Player& player) + void checkQuestCompletion( World::Quest& quest, Entity::Player& player ) + { + auto currentCC = quest.getUI8AL(); + + eventMgr().sendEventNotice( player, getId(), 0, 3, currentCC + 1, 5 ); + + if( currentCC + 1 >= 5 ) { - auto currentCC = quest.getUI8AL(); - - player.sendEventNotice(getId(), 0, 3, currentCC + 1, 5); - - if (currentCC + 1 >= 5) - { - quest.setSeq(SeqFinish); - quest.setUI8BH(currentCC + 1); - quest.setUI8AL(currentCC + 1); - } - else - { - quest.setUI8BH(currentCC + 1); - quest.setUI8AL(currentCC + 1); - } + quest.setSeq( SeqFinish ); + quest.setUI8BH( currentCC + 1 ); + quest.setUI8AL( currentCC + 1 ); } + else + { + quest.setUI8BH( currentCC + 1 ); + quest.setUI8AL( currentCC + 1 ); + } + } ////////////////////////////////////////////////////////////////////// // Available Scenes in this quest, not necessarly all are used ////////////////////////////////////////////////////////////////////// @@ -125,7 +127,7 @@ class SubWil018 : public Sapphire::ScriptAPI::QuestScript { if( result.getResult( 0 ) == 1 ) // accept quest { - quest.setSeq(Seq1); + quest.setSeq( Seq1 ); } } @@ -138,7 +140,7 @@ class SubWil018 : public Sapphire::ScriptAPI::QuestScript void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00002(quest, player); + Scene00002( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -150,8 +152,8 @@ class SubWil018 : public Sapphire::ScriptAPI::QuestScript void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(1, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 1, true ); } ////////////////////////////////////////////////////////////////////// @@ -175,7 +177,7 @@ class SubWil018 : public Sapphire::ScriptAPI::QuestScript void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00005(quest, player); + Scene00005( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -187,8 +189,8 @@ class SubWil018 : public Sapphire::ScriptAPI::QuestScript void Scene00005Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(2, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 2, true ); } ////////////////////////////////////////////////////////////////////// @@ -212,7 +214,7 @@ class SubWil018 : public Sapphire::ScriptAPI::QuestScript void Scene00007Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00008(quest, player); + Scene00008( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -224,8 +226,8 @@ class SubWil018 : public Sapphire::ScriptAPI::QuestScript void Scene00008Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(3, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 3, true ); } ////////////////////////////////////////////////////////////////////// @@ -249,7 +251,7 @@ class SubWil018 : public Sapphire::ScriptAPI::QuestScript void Scene00010Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00011(quest, player); + Scene00011( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -261,8 +263,8 @@ class SubWil018 : public Sapphire::ScriptAPI::QuestScript void Scene00011Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(4, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 4, true ); } ////////////////////////////////////////////////////////////////////// @@ -286,7 +288,7 @@ class SubWil018 : public Sapphire::ScriptAPI::QuestScript void Scene00013Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - Scene00014(quest, player); + Scene00014( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -298,8 +300,8 @@ class SubWil018 : public Sapphire::ScriptAPI::QuestScript void Scene00014Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - checkQuestCompletion(quest, player); - quest.setBitFlag8(5, true); + checkQuestCompletion( quest, player ); + quest.setBitFlag8( 5, true ); } ////////////////////////////////////////////////////////////////////// @@ -323,10 +325,10 @@ class SubWil018 : public Sapphire::ScriptAPI::QuestScript void Scene00016Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - if (result.getResult(0) == 1) - Scene00017(quest, player); + if( result.getResult( 0 ) == 1 ) + Scene00017( quest, player ); else - Scene00018(quest, player); + Scene00018( quest, player ); } ////////////////////////////////////////////////////////////////////// diff --git a/src/scripts/quest/subquest/uldah/SubWil020.cpp b/src/scripts/quest/subquest/uldah/SubWil020.cpp index 69e63937..e850f9ba 100644 --- a/src/scripts/quest/subquest/uldah/SubWil020.cpp +++ b/src/scripts/quest/subquest/uldah/SubWil020.cpp @@ -17,41 +17,43 @@ using namespace Sapphire; class SubWil020 : public Sapphire::ScriptAPI::QuestScript { - private: - // Basic quest information - // Quest vars / flags used - // BitFlag8 - // UI8AH - // UI8AL - // UI8BH +private: + // Basic quest information + // Quest vars / flags used + // BitFlag8 + // UI8AH + // UI8AL + // UI8BH - /// Countable Num: 8 Seq: 1 Event: 1 Listener: 1001940 - /// Countable Num: 1 Seq: 1 Event: 1 Listener: 1001937 - /// Countable Num: 0 Seq: 255 Event: 1 Listener: 1001939 - // 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, - }; + /// Countable Num: 8 Seq: 1 Event: 1 Listener: 1001940 + /// Countable Num: 1 Seq: 1 Event: 1 Listener: 1001937 + /// Countable Num: 0 Seq: 255 Event: 1 Listener: 1001939 + // 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 = 1001685; - static constexpr auto Actor1 = 1001940; - static constexpr auto Actor2 = 1001937; - static constexpr auto Actor3 = 1001939; - static constexpr auto Actor4 = 1001942; - static constexpr auto Actor5 = 1001949; - static constexpr auto Actor6 = 1003902; - static constexpr auto Actor7 = 1001914; - static constexpr auto Actor8 = 1003899; - static constexpr auto Actor9 = 1001945; + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1001685; + static constexpr auto Actor1 = 1001940; + static constexpr auto Actor2 = 1001937; + static constexpr auto Actor3 = 1001939; + static constexpr auto Actor4 = 1001942; + static constexpr auto Actor5 = 1001949; + static constexpr auto Actor6 = 1003902; + static constexpr auto Actor7 = 1001914; + static constexpr auto Actor8 = 1003899; + static constexpr auto Actor9 = 1001945; - public: - SubWil020() : Sapphire::ScriptAPI::QuestScript( 65929 ){}; - ~SubWil020() = default; +public: + SubWil020() : Sapphire::ScriptAPI::QuestScript( 65929 ) + {}; + + ~SubWil020() = default; ////////////////////////////////////////////////////////////////////// // Event Handlers @@ -62,91 +64,91 @@ class SubWil020 : public Sapphire::ScriptAPI::QuestScript { case Actor0: { - Scene00000(quest, player); + Scene00000( quest, player ); break; } case Actor1: { - if (!quest.getBitFlag8(1)) - Scene00001(quest, player); + if( !quest.getBitFlag8( 1 ) ) + Scene00001( quest, player ); else - Scene00002(quest, player); + Scene00002( quest, player ); break; } case Actor2: { - if (!quest.getBitFlag8(2)) - Scene00003(quest, player); + if( !quest.getBitFlag8( 2 ) ) + Scene00003( quest, player ); else - Scene00004(quest, player); + Scene00004( quest, player ); break; } case Actor3: { - if (!quest.getBitFlag8(3)) - Scene00005(quest, player); + if( !quest.getBitFlag8( 3 ) ) + Scene00005( quest, player ); else - Scene00006(quest, player); + Scene00006( quest, player ); break; } case Actor4: { - if (!quest.getBitFlag8(4)) - Scene00007(quest, player); + if( !quest.getBitFlag8( 4 ) ) + Scene00007( quest, player ); else - Scene00008(quest, player); + Scene00008( quest, player ); break; } case Actor5: { - if (!quest.getBitFlag8(5)) - Scene00009(quest, player); + if( !quest.getBitFlag8( 5 ) ) + Scene00009( quest, player ); else - Scene00010(quest, player); + Scene00010( quest, player ); break; } case Actor6: { - if (!quest.getBitFlag8(6)) - Scene00011(quest, player); + if( !quest.getBitFlag8( 6 ) ) + Scene00011( quest, player ); else - Scene00012(quest, player); + Scene00012( quest, player ); break; } case Actor7: { - if (!quest.getBitFlag8(7)) - Scene00013(quest, player); + if( !quest.getBitFlag8( 7 ) ) + Scene00013( quest, player ); else - Scene00014(quest, player); + Scene00014( quest, player ); break; } case Actor8: { - if (!quest.getBitFlag8(0)) - Scene00015(quest, player); + if( !quest.getBitFlag8( 0 ) ) + Scene00015( quest, player ); else - Scene00016(quest, player); + Scene00016( quest, player ); break; } case Actor9: { - Scene00017(quest, player); + Scene00017( quest, player ); break; } } } - private: +private: - void checkQuestProgression(World::Quest& quest, Entity::Player& player) + void checkQuestProgression( World::Quest& quest, Entity::Player& player ) + { + if( quest.getUI8AL() == 6 && quest.getUI8BH() == 2 ) { - if (quest.getUI8AL() == 6 && quest.getUI8BH() == 2) - { - quest.setSeq(SeqFinish); - } + quest.setSeq( SeqFinish ); } + } ////////////////////////////////////////////////////////////////////// // Available Scenes in this quest, not necessarly all are used ////////////////////////////////////////////////////////////////////// @@ -160,7 +162,7 @@ class SubWil020 : public Sapphire::ScriptAPI::QuestScript { if( result.getResult( 0 ) == 1 ) // accept quest { - quest.setSeq(Seq1); + quest.setSeq( Seq1 ); } } @@ -175,10 +177,10 @@ class SubWil020 : public Sapphire::ScriptAPI::QuestScript { auto hustCount = quest.getUI8AL(); hustCount += 1; - quest.setUI8AL(hustCount); - player.sendEventNotice(getId(), 0, 2, hustCount, 6); - quest.setBitFlag8(1, true); - checkQuestProgression(quest, player); + quest.setUI8AL( hustCount ); + eventMgr().sendEventNotice( player, getId(), 0, 2, hustCount, 6 ); + quest.setBitFlag8( 1, true ); + checkQuestProgression( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -192,10 +194,10 @@ class SubWil020 : public Sapphire::ScriptAPI::QuestScript { auto hustCount = quest.getUI8AL(); hustCount += 1; - quest.setUI8AL(hustCount); - player.sendEventNotice(getId(), 0, 2, hustCount, 6); - quest.setBitFlag8(2, true); - checkQuestProgression(quest, player); + quest.setUI8AL( hustCount ); + eventMgr().sendEventNotice( player, getId(), 0, 2, hustCount, 6 ); + quest.setBitFlag8( 2, true ); + checkQuestProgression( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -209,10 +211,10 @@ class SubWil020 : public Sapphire::ScriptAPI::QuestScript { auto hustCount = quest.getUI8AL(); hustCount += 1; - quest.setUI8AL(hustCount); - player.sendEventNotice(getId(), 0, 2, hustCount, 6); - quest.setBitFlag8(3, true); - checkQuestProgression(quest, player); + quest.setUI8AL( hustCount ); + eventMgr().sendEventNotice( player, getId(), 0, 2, hustCount, 6 ); + quest.setBitFlag8( 3, true ); + checkQuestProgression( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -226,10 +228,10 @@ class SubWil020 : public Sapphire::ScriptAPI::QuestScript { auto hustCount = quest.getUI8AL(); hustCount += 1; - quest.setUI8AL(hustCount); - player.sendEventNotice(getId(), 0, 2, hustCount, 6); - quest.setBitFlag8(4, true); - checkQuestProgression(quest, player); + quest.setUI8AL( hustCount ); + eventMgr().sendEventNotice( player, getId(), 0, 2, hustCount, 6 ); + quest.setBitFlag8( 4, true ); + checkQuestProgression( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -243,10 +245,10 @@ class SubWil020 : public Sapphire::ScriptAPI::QuestScript { auto hustCount = quest.getUI8AL(); hustCount += 1; - quest.setUI8AL(hustCount); - player.sendEventNotice(getId(), 0, 2, hustCount, 6); - quest.setBitFlag8(5, true); - checkQuestProgression(quest, player); + quest.setUI8AL( hustCount ); + eventMgr().sendEventNotice( player, getId(), 0, 2, hustCount, 6 ); + quest.setBitFlag8( 5, true ); + checkQuestProgression( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -260,10 +262,10 @@ class SubWil020 : public Sapphire::ScriptAPI::QuestScript { auto hustCount = quest.getUI8AL(); hustCount += 1; - quest.setUI8AL(hustCount); - player.sendEventNotice(getId(), 0, 2, hustCount, 6); - quest.setBitFlag8(6, true); - checkQuestProgression(quest, player); + quest.setUI8AL( hustCount ); + eventMgr().sendEventNotice( player, getId(), 0, 2, hustCount, 6 ); + quest.setBitFlag8( 6, true ); + checkQuestProgression( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -277,10 +279,10 @@ class SubWil020 : public Sapphire::ScriptAPI::QuestScript { auto hustCount = quest.getUI8AL(); hustCount += 1; - quest.setUI8AL(hustCount); - player.sendEventNotice(getId(), 0, 2, hustCount, 6); - quest.setBitFlag8(7, true); - checkQuestProgression(quest, player); + quest.setUI8AL( hustCount ); + eventMgr().sendEventNotice( player, getId(), 0, 2, hustCount, 6 ); + quest.setBitFlag8( 7, true ); + checkQuestProgression( quest, player ); } ////////////////////////////////////////////////////////////////////// @@ -294,10 +296,10 @@ class SubWil020 : public Sapphire::ScriptAPI::QuestScript { auto hustCount = quest.getUI8AL(); hustCount += 1; - quest.setUI8AL(hustCount); - player.sendEventNotice(getId(), 0, 2, hustCount, 6); - quest.setBitFlag8(8, true); - checkQuestProgression(quest, player); + quest.setUI8AL( hustCount ); + eventMgr().sendEventNotice( player, getId(), 0, 2, hustCount, 6 ); + quest.setBitFlag8( 8, true ); + checkQuestProgression( quest, player ); } ////////////////////////////////////////////////////////////////////// diff --git a/src/scripts/quest/subquest/uldah/SubWil029.cpp b/src/scripts/quest/subquest/uldah/SubWil029.cpp index 13e8267e..233a3f1e 100644 --- a/src/scripts/quest/subquest/uldah/SubWil029.cpp +++ b/src/scripts/quest/subquest/uldah/SubWil029.cpp @@ -17,32 +17,34 @@ using namespace Sapphire; class SubWil029 : public Sapphire::ScriptAPI::QuestScript { - private: - // Basic quest information - // Quest vars / flags used - // UI8AL - // UI8BH +private: + // Basic quest information + // Quest vars / flags used + // UI8AL + // UI8BH - /// Countable Num: 1 Seq: 1 Event: 1 Listener: 1001390 - /// Countable Num: 1 Seq: 255 Event: 1 Listener: 1001992 - // 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, - }; + /// Countable Num: 1 Seq: 1 Event: 1 Listener: 1001390 + /// Countable Num: 1 Seq: 255 Event: 1 Listener: 1001992 + // 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 = 1001313; - static constexpr auto Actor1 = 1001390; - static constexpr auto Actor2 = 1001992; - static constexpr auto Item0 = 2000410; + // Entities found in the script data of the quest + static constexpr auto Actor0 = 1001313; + static constexpr auto Actor1 = 1001390; + static constexpr auto Actor2 = 1001992; + static constexpr auto Item0 = 2000410; - public: - SubWil029() : Sapphire::ScriptAPI::QuestScript( 65926 ){}; - ~SubWil029() = default; +public: + SubWil029() : Sapphire::ScriptAPI::QuestScript( 65926 ) + {}; + + ~SubWil029() = default; ////////////////////////////////////////////////////////////////////// // Event Handlers @@ -52,24 +54,24 @@ class SubWil029 : public Sapphire::ScriptAPI::QuestScript { case Actor0: { - Scene00000(quest, player); + Scene00000( quest, player ); break; } case Actor1: { - Scene00001(quest, player); + Scene00001( quest, player ); break; } case Actor2: { - Scene00002(quest, player); + Scene00002( quest, player ); break; } } } - private: +private: ////////////////////////////////////////////////////////////////////// // Available Scenes in this quest, not necessarly all are used ////////////////////////////////////////////////////////////////////// @@ -83,7 +85,7 @@ class SubWil029 : public Sapphire::ScriptAPI::QuestScript { if( result.getResult( 0 ) == 1 ) // accept quest { - quest.setSeq(Seq1); + quest.setSeq( Seq1 ); } } @@ -96,9 +98,9 @@ class SubWil029 : public Sapphire::ScriptAPI::QuestScript void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - quest.setSeq(SeqFinish); - quest.setUI8BH(1); - player.sendEventNotice(getId(), 0, 2, 0, 0); + quest.setSeq( SeqFinish ); + quest.setUI8BH( 1 ); + eventMgr().sendEventNotice( player, getId(), 0, 2, 0, 0 ); } ////////////////////////////////////////////////////////////////////// @@ -110,10 +112,10 @@ class SubWil029 : public Sapphire::ScriptAPI::QuestScript void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - if (result.getResult(0) == 1) - Scene00003(quest, player); + if( result.getResult( 0 ) == 1 ) + Scene00003( quest, player ); else - Scene00004(quest, player); + Scene00004( quest, player ); } ////////////////////////////////////////////////////////////////////// diff --git a/src/world/Actor/Player.h b/src/world/Actor/Player.h index f7f8aa21..a5d10de8 100644 --- a/src/world/Actor/Player.h +++ b/src/world/Actor/Player.h @@ -582,9 +582,6 @@ namespace Sapphire::Entity /*! send the entire inventory sequence */ void sendInventory(); - /*! send a quest specific message */ - void sendEventNotice( uint32_t questId, int8_t noticeId, uint8_t numOfArgs, uint32_t var1, uint32_t var2 ); - /*! returns true if loading is complete ( 0x69 has been received ) */ bool isLoadingComplete() const; diff --git a/src/world/Actor/PlayerQuest.cpp b/src/world/Actor/PlayerQuest.cpp index cbc68d57..b0be4541 100644 --- a/src/world/Actor/PlayerQuest.cpp +++ b/src/world/Actor/PlayerQuest.cpp @@ -142,12 +142,6 @@ void Sapphire::Entity::Player::addQuestTracking( uint8_t idx ) } } -void -Sapphire::Entity::Player::sendEventNotice( uint32_t questId, int8_t noticeId, uint8_t numOfArgs, uint32_t var1, uint32_t var2 ) -{ - queuePacket( std::make_shared< Notice2Packet >( getAsPlayer(), questId, noticeId, numOfArgs, var1, var2 ) ); -} - void Sapphire::Entity::Player::updateQuestsCompleted( uint32_t questId ) { uint8_t index = questId / 8; diff --git a/src/world/Manager/EventMgr.cpp b/src/world/Manager/EventMgr.cpp index 32b100c0..c7bc69b7 100644 --- a/src/world/Manager/EventMgr.cpp +++ b/src/world/Manager/EventMgr.cpp @@ -17,6 +17,7 @@ #include "Network/PacketWrappers/EventStartPacket.h" #include "Network/PacketWrappers/EventPlayPacket.h" #include "Network/PacketWrappers/EventFinishPacket.h" +#include "Network/PacketWrappers/Notice2Packet.h" #include "Territory/Territory.h" #include "Territory/InstanceContent.h" @@ -739,3 +740,10 @@ Sapphire::Event::EventHandlerPtr EventMgr::bootstrapSceneEvent( Entity::Player& return pEvent; } + +void EventMgr::sendEventNotice( Entity::Player& player, uint32_t questId, int8_t noticeId, uint8_t numOfArgs, uint32_t var1, uint32_t var2 ) +{ + auto noticePacket = std::make_shared< Notice2Packet >( player.getId(), questId, noticeId, numOfArgs, var1, var2 ); + auto& server = Common::Service< World::WorldServer >::ref(); + server.queueForPlayer( player.getCharacterId(), noticePacket ); +} diff --git a/src/world/Manager/EventMgr.h b/src/world/Manager/EventMgr.h index 9530b7da..5c7488f5 100644 --- a/src/world/Manager/EventMgr.h +++ b/src/world/Manager/EventMgr.h @@ -65,6 +65,8 @@ namespace Sapphire::World::Manager bool sendEventPlay( Entity::Player& player, uint32_t eventid, uint32_t scene, uint32_t flags ); + void sendEventNotice( Entity::Player& player, uint32_t eventId, int8_t noticeId, uint8_t numOfArgs = 0, uint32_t var1 = 0, uint32_t var2 = 0 ); + /*! setup the event and return a ptr to it */ Event::EventHandlerPtr bootstrapSceneEvent( Entity::Player& player, uint32_t eventId, uint32_t flags ); }; diff --git a/src/world/Network/PacketWrappers/Notice2Packet.h b/src/world/Network/PacketWrappers/Notice2Packet.h index 83e76600..8a87f564 100644 --- a/src/world/Network/PacketWrappers/Notice2Packet.h +++ b/src/world/Network/PacketWrappers/Notice2Packet.h @@ -2,7 +2,6 @@ #define _QUESTMESSAGE_H #include -#include "Actor/Player.h" #include "Forwards.h" namespace Sapphire::Network::Packets::WorldPackets::Server @@ -14,20 +13,19 @@ namespace Sapphire::Network::Packets::WorldPackets::Server class Notice2Packet : public ZoneChannelPacket< FFXIVIpcNotice2 > { public: - Notice2Packet( Entity::GameObjectPtr pActor, uint32_t questId, int8_t msgId, - uint8_t type = 0, uint32_t var1 = 0, uint32_t var2 = 0 ) : - ZoneChannelPacket< FFXIVIpcNotice2 >( pActor->getId(), pActor->getId() ) + Notice2Packet( uint32_t entityId, uint32_t questId, int8_t msgId, uint8_t numOfArgs = 0, uint32_t var1 = 0, uint32_t var2 = 0 ) : + ZoneChannelPacket< FFXIVIpcNotice2 >( entityId, entityId ) { - initialize( questId, msgId, type, var1, var2 ); + initialize( questId, msgId, numOfArgs, var1, var2 ); }; private: - void initialize( uint32_t questId, int8_t msgId, uint8_t type, uint32_t var1, uint32_t var2 ) + void initialize( uint32_t questId, int8_t msgId, uint8_t numOfArgs, uint32_t var1, uint32_t var2 ) { m_data.handlerId = questId; m_data.noticeId = msgId; // todo: not correct - m_data.numOfArgs = type; + m_data.numOfArgs = numOfArgs; m_data.args[0] = var1; m_data.args[1] = var2; }; diff --git a/src/world/Territory/QuestBattle.cpp b/src/world/Territory/QuestBattle.cpp index d53f671a..bc46a8da 100644 --- a/src/world/Territory/QuestBattle.cpp +++ b/src/world/Territory/QuestBattle.cpp @@ -177,7 +177,8 @@ void Sapphire::QuestBattle::onFinishLoading( Entity::Player& player ) void Sapphire::QuestBattle::onInitDirector( Entity::Player& player ) { - player.sendEventNotice( getDirectorId(), 0, 2, Util::getTimeSeconds(), 0x0708 ); + auto& eventMgr = Common::Service< World::Manager::EventMgr >::ref(); + eventMgr.sendEventNotice( player, getDirectorId(), 0, 2, Util::getTimeSeconds(), 0x0708 ); sendDirectorVars( player ); player.setDirectorInitialized( true ); }