From 73cc3f3deb3b0f6113b01a5281ab44d92cc03de5 Mon Sep 17 00:00:00 2001 From: Biscuit Date: Sat, 30 Dec 2017 14:21:33 +1100 Subject: [PATCH 1/4] Ported the Quarrels with Squirrels Quest from Chai Ported the Quarrels with Squirrels from the old ChaiScript over to Native. I cannot Test the Port up to Killing a NPC right now since a Bug, but after the Bug is fixed it should work fine. --- .../quest/subquest/gridania/SubFst002.cpp | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 scripts/native/quest/subquest/gridania/SubFst002.cpp diff --git a/scripts/native/quest/subquest/gridania/SubFst002.cpp b/scripts/native/quest/subquest/gridania/SubFst002.cpp new file mode 100644 index 00000000..19a21bb4 --- /dev/null +++ b/scripts/native/quest/subquest/gridania/SubFst002.cpp @@ -0,0 +1,76 @@ +#include "../../../ScriptObject.h" + +// Quest Script: SubFst002_00025 +// Quest Name: Quarrels with Squirrels +// Quest ID: 65561 +// Start NPC: 1000263 +// End NPC: 1000263 + +class SubFst002 : public EventScript +{ +private: + static constexpr auto SEQ_0 = 0; + static constexpr auto SEQ_1 = 1; + static constexpr auto SEQ_2 = 2; + static constexpr auto SEQ_FINISH = 255; + static constexpr auto ACTOR0 = 1000263; + static constexpr auto ENEMY0 = 37; + static constexpr auto SEQ_0_ACTOR0 = 0; + static constexpr auto SEQ_2_ACTOR0 = 1; + + void Scene00000( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + if( param2 == 1 ) // accept quest + { + player.updateQuest( getId(), SEQ_1 ); + } + }; + + player.eventPlay ( getId (), 0, NONE, callback ); + } + + void Scene00001(Entity::Player& player) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + if( param2 == 1 ) // finish quest + { + if(player.giveQuestRewards( getId(), 0 ) ) + player.finishQuest( getId() ); + } + }; + + player.eventPlay ( getId (), 1, NONE, callback ); + } + +public: + SubFst002() : EventScript( "SubFst002", 65561 ) {} + + void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override + { + auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >(actorId) ); + + if( actor == ACTOR0 && !player.hasQuest( getId() ) ) + Scene00000( player ); + else if( actor == ACTOR0 && player.getQuestSeq( getId() ) == SEQ_FINISH ) + Scene00001( player ); + } + + void onNpcKill( uint32_t npcId, Entity::Player& player ) override + { + if( npcId != ENEMY0 ) + return; + + auto currentKC = player.getQuestUI8AL( getId() ) + 1; + + if( currentKC >= 6 ) + player.updateQuest( getId(), SEQ_FINISH ); + else + { + player.setQuestUI8AL( getId(), currentKC ); + player.sendQuestMessage( getId(), 0, 2, currentKC, 6 ); + } + } +}; From 8dc9faa7dc5720ee124ee42e2bdb726662fc772d Mon Sep 17 00:00:00 2001 From: Biscuit Boy Date: Fri, 5 Jan 2018 23:29:09 +1100 Subject: [PATCH 2/4] Fixed The Formatting Again Please be the last time --- scripts/native/quest/subquest/gridania/SubFst002.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/native/quest/subquest/gridania/SubFst002.cpp b/scripts/native/quest/subquest/gridania/SubFst002.cpp index 19a21bb4..d17c5d0d 100644 --- a/scripts/native/quest/subquest/gridania/SubFst002.cpp +++ b/scripts/native/quest/subquest/gridania/SubFst002.cpp @@ -28,7 +28,7 @@ private: } }; - player.eventPlay ( getId (), 0, NONE, callback ); + player.eventPlay( getId (), 0, NONE, callback ); } void Scene00001(Entity::Player& player) @@ -37,12 +37,12 @@ private: { if( param2 == 1 ) // finish quest { - if(player.giveQuestRewards( getId(), 0 ) ) + if( player.giveQuestRewards( getId(), 0 ) ) player.finishQuest( getId() ); } }; - player.eventPlay ( getId (), 1, NONE, callback ); + player.eventPlay( getId (), 1, NONE, callback ); } public: From e8ebcb812c8c21f3dcaea06867fec336ac573c84 Mon Sep 17 00:00:00 2001 From: Biscuit Boy Date: Fri, 5 Jan 2018 23:44:08 +1100 Subject: [PATCH 3/4] Added Space in Func Call Arguments --- scripts/native/quest/subquest/gridania/SubFst002.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/native/quest/subquest/gridania/SubFst002.cpp b/scripts/native/quest/subquest/gridania/SubFst002.cpp index d17c5d0d..94c96bf6 100644 --- a/scripts/native/quest/subquest/gridania/SubFst002.cpp +++ b/scripts/native/quest/subquest/gridania/SubFst002.cpp @@ -50,7 +50,7 @@ public: void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { - auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >(actorId) ); + auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); if( actor == ACTOR0 && !player.hasQuest( getId() ) ) Scene00000( player ); From 0a81f0a0c82eca5dcfd6eab00838888539ed3326 Mon Sep 17 00:00:00 2001 From: Mordred <30826167+SapphireMordred@users.noreply.github.com> Date: Fri, 5 Jan 2018 18:21:49 +0100 Subject: [PATCH 4/4] Update SubFst002.cpp removed unneeded space --- .../quest/subquest/gridania/SubFst002.cpp | 88 +++++++++---------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/scripts/native/quest/subquest/gridania/SubFst002.cpp b/scripts/native/quest/subquest/gridania/SubFst002.cpp index 94c96bf6..d128fe0f 100644 --- a/scripts/native/quest/subquest/gridania/SubFst002.cpp +++ b/scripts/native/quest/subquest/gridania/SubFst002.cpp @@ -1,38 +1,38 @@ -#include "../../../ScriptObject.h" - +#include "../../../ScriptObject.h" + // Quest Script: SubFst002_00025 // Quest Name: Quarrels with Squirrels // Quest ID: 65561 // Start NPC: 1000263 -// End NPC: 1000263 - -class SubFst002 : public EventScript +// End NPC: 1000263 + +class SubFst002 : public EventScript { -private: - static constexpr auto SEQ_0 = 0; - static constexpr auto SEQ_1 = 1; - static constexpr auto SEQ_2 = 2; - static constexpr auto SEQ_FINISH = 255; - static constexpr auto ACTOR0 = 1000263; - static constexpr auto ENEMY0 = 37; - static constexpr auto SEQ_0_ACTOR0 = 0; - static constexpr auto SEQ_2_ACTOR0 = 1; - - void Scene00000( Entity::Player& player ) - { +private: + static constexpr auto SEQ_0 = 0; + static constexpr auto SEQ_1 = 1; + static constexpr auto SEQ_2 = 2; + static constexpr auto SEQ_FINISH = 255; + static constexpr auto ACTOR0 = 1000263; + static constexpr auto ENEMY0 = 37; + static constexpr auto SEQ_0_ACTOR0 = 0; + static constexpr auto SEQ_2_ACTOR0 = 1; + + void Scene00000( Entity::Player& player ) + { auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) { if( param2 == 1 ) // accept quest { player.updateQuest( getId(), SEQ_1 ); } - }; - - player.eventPlay( getId (), 0, NONE, callback ); - } - - void Scene00001(Entity::Player& player) - { + }; + + player.eventPlay( getId (), 0, NONE, callback ); + } + + void Scene00001(Entity::Player& player) + { auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) { if( param2 == 1 ) // finish quest @@ -40,24 +40,24 @@ private: if( player.giveQuestRewards( getId(), 0 ) ) player.finishQuest( getId() ); } - }; - - player.eventPlay( getId (), 1, NONE, callback ); - } - -public: - SubFst002() : EventScript( "SubFst002", 65561 ) {} - - void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override - { - auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); - - if( actor == ACTOR0 && !player.hasQuest( getId() ) ) - Scene00000( player ); - else if( actor == ACTOR0 && player.getQuestSeq( getId() ) == SEQ_FINISH ) - Scene00001( player ); - } - + }; + + player.eventPlay( getId(), 1, NONE, callback ); + } + +public: + SubFst002() : EventScript( "SubFst002", 65561 ) {} + + void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override + { + auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + + if( actor == ACTOR0 && !player.hasQuest( getId() ) ) + Scene00000( player ); + else if( actor == ACTOR0 && player.getQuestSeq( getId() ) == SEQ_FINISH ) + Scene00001( player ); + } + void onNpcKill( uint32_t npcId, Entity::Player& player ) override { if( npcId != ENEMY0 ) @@ -72,5 +72,5 @@ public: player.setQuestUI8AL( getId(), currentKC ); player.sendQuestMessage( getId(), 0, 2, currentKC, 6 ); } - } -}; + } +};