From ab91e0c90dbbd9bd042d95c4004e003d9fd0b352 Mon Sep 17 00:00:00 2001 From: GokuWeedLord Date: Sat, 16 Dec 2017 14:45:40 +1100 Subject: [PATCH] opening quests done, still missing some functionality but you teleport into the real zones --- scripts/native/opening/OpeningGridania.cpp | 6 +- scripts/native/opening/OpeningLimsa.cpp | 100 ++++++++++ scripts/native/opening/OpeningUldah.cpp | 93 +++++++++ scripts/native/quest/ManFst003.cpp | 23 +++ scripts/native/quest/ManSea001.cpp | 163 +++++++++++++++ scripts/native/quest/ManSea002.cpp | 151 ++++++++++++++ scripts/native/quest/ManWil001.cpp | 145 ++++++++++++++ scripts/native/quest/ManWil002.cpp | 158 +++++++++++++++ .../quest/subquest/gridania/SubFst013.cpp | 186 ++++++++++++++++++ 9 files changed, 1022 insertions(+), 3 deletions(-) create mode 100644 scripts/native/quest/ManFst003.cpp create mode 100644 scripts/native/quest/ManSea001.cpp create mode 100644 scripts/native/quest/ManSea002.cpp create mode 100644 scripts/native/quest/ManWil001.cpp create mode 100644 scripts/native/quest/ManWil002.cpp create mode 100644 scripts/native/quest/subquest/gridania/SubFst013.cpp diff --git a/scripts/native/opening/OpeningGridania.cpp b/scripts/native/opening/OpeningGridania.cpp index 5e4374c1..45fcbbb6 100644 --- a/scripts/native/opening/OpeningGridania.cpp +++ b/scripts/native/opening/OpeningGridania.cpp @@ -40,17 +40,17 @@ public: void Scene00001( Entity::Player& player ) { - player.eventPlay( getId(), 1, 0x2001, 1, 0x32 ); + player.eventPlay( getId(), 1, NO_DEFAULT_CAMERA | HIDE_HOTBAR, 1, 0x32 ); } void Scene00020( Entity::Player& player ) { - player.eventPlay( getId(), 20, 0x2001, 0, 1 ); + player.eventPlay( getId(), 20, NO_DEFAULT_CAMERA | HIDE_HOTBAR, 0, 1 ); } void Scene00030( Entity::Player& player ) { - player.eventPlay( getId(), 30, 0x2001, 0, 0 ); + player.eventPlay( getId(), 30, NO_DEFAULT_CAMERA | HIDE_HOTBAR, 0, 0 ); } void Scene00040( Entity::Player& player ) diff --git a/scripts/native/opening/OpeningLimsa.cpp b/scripts/native/opening/OpeningLimsa.cpp index e69de29b..09144097 100644 --- a/scripts/native/opening/OpeningLimsa.cpp +++ b/scripts/native/opening/OpeningLimsa.cpp @@ -0,0 +1,100 @@ +#include "../ScriptObject.h" + +// Opening Script: OpeningLimsaLominsa +// Quest Name: OpeningLimsaLominsa +// Quest ID: 1245185 + +class OpeningLimsa : public EventScript +{ +private:; + static constexpr auto ERANGE_HOWTO_ANN_AND_QUEST = 4101831; + static constexpr auto ERANGE_HOWTO_QUEST_REWARD = 4102066; + static constexpr auto ERANGE_SEQ_1_CLOSED_1 = 4101785; + static constexpr auto POS_SEQ_1_CLOSED_RETURN_1 = 4101797; + static constexpr auto ERANGE_ALWAYS_CLOSED_1 = 4101744; + static constexpr auto POS_ALWAYS_CLOSED_RETURN_1 = 4101761; + static constexpr auto ENPC_ALWAYS_CLOSED_1 = 4102038; + static constexpr auto ERANGE_ALWAYS_CLOSED_2 = 4101746; + static constexpr auto POS_ALWAYS_CLOSED_RETURN_2 = 4101763; + static constexpr auto ENPC_ALWAYS_CLOSED_2 = 4102036; + static constexpr auto ERANGE_ALWAYS_CLOSED_3 = 4101967; + static constexpr auto POS_ALWAYS_CLOSED_RETURN_3 = 4101982; + static constexpr auto ENPC_ALWAYS_CLOSED_3 = 4102033; + static constexpr auto ERANGE_ALWAYS_CLOSED_4 = 4101970; + static constexpr auto POS_ALWAYS_CLOSED_RETURN_4 = 4101984; + static constexpr auto ENPC_ALWAYS_CLOSED_4 = 4102031; + static constexpr auto ERANGE_ALWAYS_CLOSED_5 = 4101973; + static constexpr auto POS_ALWAYS_CLOSED_RETURN_5 = 4101985; + static constexpr auto ENPC_ALWAYS_CLOSED_5 = 4102007; + static constexpr auto ERANGE_ALWAYS_CLOSED_6 = 4101979; + static constexpr auto POS_ALWAYS_CLOSED_RETURN_6 = 4101988; + static constexpr auto ENPC_ALWAYS_CLOSED_6 = 2367400; + static constexpr auto BGM_MUSIC_ZONE_SEA_TWN = 1020; + static constexpr auto NCUT_SEA_1 = 200; + static constexpr auto NCUT_SEA_2 = 132; + static constexpr auto NCUT_SEA_3 = 201; + static constexpr auto ENPC_QUEST_OFFER = 4102039; + static constexpr auto NCUT_LIGHT_ALL = 2; + static constexpr auto NCUT_LIGHT_SEA_1 = 147; + static constexpr auto NCUT_LIGHT_SEA_2 = 138; + + + void Scene00000( Entity::Player& player ) + { + auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + player.setOpeningSequence( 1 ); + Scene00001( player ); + }; + + player.eventPlay( getId(), 0, 0x04AC05, 0, 1, callback ); + } + + void Scene00001( Entity::Player& player ) + { + player.eventPlay( getId(), 1, NO_DEFAULT_CAMERA | HIDE_HOTBAR, 1, 0x32 ); + } + + void Scene00020( Entity::Player& player ) + { + player.eventPlay( getId(), 20, NO_DEFAULT_CAMERA | HIDE_HOTBAR, 0, 1 ); + } + + void Scene00030( Entity::Player& player ) + { + player.eventPlay( getId(), 30, NO_DEFAULT_CAMERA | HIDE_HOTBAR, 0, 0 ); + } + + void Scene00040( Entity::Player& player ) + { + auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + if( player.getOpeningSequence() == 2 ) + { + // update instance boundaries + Scene00030( player ); + } + }; + + player.eventPlay( getId(), 40, NO_DEFAULT_CAMERA, 2, 1, callback ); + } + + +public: + OpeningLimsa() : EventScript( "OpeningLimsa", 1245185 ) {} + + void onEnterZone( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override + { + if( player.getOpeningSequence() == 0 ) + Scene00000( player ); + else + Scene00040( player ); + } + + void onWithinRange( Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z ) override + { + // todo: handle closed events + } +}; + +EXPORT_SCRIPTOBJECT( OpeningLimsa ) \ No newline at end of file diff --git a/scripts/native/opening/OpeningUldah.cpp b/scripts/native/opening/OpeningUldah.cpp index e69de29b..df9da939 100644 --- a/scripts/native/opening/OpeningUldah.cpp +++ b/scripts/native/opening/OpeningUldah.cpp @@ -0,0 +1,93 @@ +#include "../ScriptObject.h" + +class OpeningUldah : public EventScript +{ +private: + static constexpr auto ERANGE_HOWTO_ANN_AND_QUEST = 4101650; + static constexpr auto ERANGE_HOWTO_QUEST_REWARD = 4102883; + static constexpr auto ERANGE_SEQ_1_CLOSED_1 = 4101587; + static constexpr auto POS_SEQ_1_CLOSED_RETURN_1 = 4101691; + static constexpr auto ERANGE_ALWAYS_CLOSED_1 = 4101537; + static constexpr auto POS_ALWAYS_CLOSED_RETURN_1 = 4101685; + static constexpr auto ENPC_ALWAYS_CLOSED_1 = 4101796; + static constexpr auto ERANGE_ALWAYS_CLOSED_2 = 4101525; + static constexpr auto POS_ALWAYS_CLOSED_RETURN_2 = 4101680; + static constexpr auto ENPC_ALWAYS_CLOSED_2 = 4101789; + static constexpr auto ERANGE_ALWAYS_CLOSED_3 = 4101535; + static constexpr auto POS_ALWAYS_CLOSED_RETURN_3 = 4101681; + static constexpr auto ENPC_ALWAYS_CLOSED_3 = 4101787; + static constexpr auto BGM_MUSIC_ZONE_WIL_TWN = 1035; + static constexpr auto NCUT_WIL_1 = 186; + static constexpr auto NCUT_WIL_2 = 139; + static constexpr auto NCUT_WIL_3 = 187; + static constexpr auto ENPC_QUEST_OFFER = 3969639; + static constexpr auto NCUT_LIGHT_ALL = 2; + static constexpr auto NCUT_LIGHT_WIL_1 = 147; + static constexpr auto NCUT_LIGHT_WIL_2 = 145; + + void Scene00000( Entity::Player& player ) + { + auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + player.setOpeningSequence( 1 ); + Scene00001( player ); + }; + + player.eventPlay( getId(), 0, 0x04AC05, 0, 1, callback ); + } + + void Scene00001( Entity::Player& player ) + { + player.eventPlay( getId(), 1, HIDE_HOTBAR | NO_DEFAULT_CAMERA, 1, 0x32 ); + } + + void Scene00020( Entity::Player& player ) + { + player.eventPlay( getId(), 20, HIDE_HOTBAR | NO_DEFAULT_CAMERA, 0, 1 ); + } + + void Scene00030( Entity::Player& player ) + { + player.eventPlay( getId(), 30, HIDE_HOTBAR | NO_DEFAULT_CAMERA, 0, 0 ); + } + + void Scene00040( Entity::Player& player ) + { + auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + if( player.getOpeningSequence() == 2 ) + Scene00030( player ); + }; + + player.eventPlay( getId(), 40, NO_DEFAULT_CAMERA, 2, 1, callback ); + } + + + +public: + OpeningUldah() : EventScript( "OpeningUldah", 1245187 ) {} + + void onEnterZone( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override + { + if( player.getOpeningSequence() == 0 ) + Scene00000( player ); + else + Scene00040( player ); + } + + void onOutsideRange( Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z ) override + { + if( param1 == ERANGE_SEQ_1_CLOSED_1 ) + Scene00020( player ); + } + + void onWithinRange( Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z ) override + { + if( param1 == ERANGE_ALWAYS_CLOSED_1 || param1 == ERANGE_ALWAYS_CLOSED_2 || param1 == ERANGE_ALWAYS_CLOSED_3 ) + { + Scene00020( player ); + } + } +}; + +EXPORT_SCRIPTOBJECT( OpeningUldah ) \ No newline at end of file diff --git a/scripts/native/quest/ManFst003.cpp b/scripts/native/quest/ManFst003.cpp new file mode 100644 index 00000000..5d8ada95 --- /dev/null +++ b/scripts/native/quest/ManFst003.cpp @@ -0,0 +1,23 @@ +#include "../ScriptObject.h" + +// Quest Script: ManFst003_00123 +// Quest Name: Close to Home +// Quest ID: 65659 +// Start NPC: 1001140 +// End NPC: 1000100 + +class ManFst003 : public EventScript +{ +private: + + +public: + ManFst003() : EventScript( "ManFst003", 65659 ) {} + + void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override + { + + } +}; + +EXPORT_SCRIPTOBJECT( ManFst003 ) \ No newline at end of file diff --git a/scripts/native/quest/ManSea001.cpp b/scripts/native/quest/ManSea001.cpp new file mode 100644 index 00000000..63a1b750 --- /dev/null +++ b/scripts/native/quest/ManSea001.cpp @@ -0,0 +1,163 @@ +#include "../ScriptObject.h" + +class ManSea001 : public EventScript +{ +private: + // Steps in this quest ( 0 is before accepting, + // 1 is first, 255 means ready for turning it in + static constexpr auto SEQ_0 = 0; + static constexpr auto SEQ_1 = 1; + static constexpr auto SEQ_FINISH = 255; + + static constexpr auto ACTOR0 = 1001028; + static constexpr auto ACTOR1 = 1002732; + static constexpr auto ACTOR2 = 1002697; + static constexpr auto CUT_EVENT = 202; + static constexpr auto EOBJECT0 = 2001679; + static constexpr auto EOBJECT1 = 2001680; + static constexpr auto EVENT_ACTION_SEARCH = 1; + static constexpr auto LOC_ACTOR0 = 1002732; + static constexpr auto LOC_POS_ACTOR0 = 4107186; + static constexpr auto OPENING_EVENT_HANDLER = 1245185; + static constexpr auto POPRANGE0 = 4127803; + static constexpr auto TERRITORYTYPE0 = 181; + + void Scene00000( Entity::Player& player ) + { + auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + if( param2 == 1 ) + { + player.setOpeningSequence( 2 ); + Scene00001( player ); + } + }; + + player.eventPlay( getId(), 0, HIDE_HOTBAR, 0, 0, callback ); + } + + void Scene00001( Entity::Player& player ) + { + auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + Scene00002( player ); + }; + + player.eventPlay( getId(), 1, 0xF8482EFB, 0, 0, callback ); + } + + void Scene00002( Entity::Player& player ) + { + auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + Scene00003( player ); + }; + + player.eventPlay( getId(), 2, NONE, 0, 0, callback ); + } + + void Scene00003( Entity::Player& player ) + { + auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + player.updateQuest( getId(), 1 ); + + player.eventPlay( OPENING_EVENT_HANDLER, 0x1E, HIDE_HOTBAR | NO_DEFAULT_CAMERA, 1, 0 ); + }; + + player.eventPlay( getId(), 3, NONE, 0, 0, callback ); + } + + void Scene00004( Entity::Player& player ) + { + player.eventPlay( getId(), 4, NONE, 0, 0 ); + } + + void Scene00005( Entity::Player& player ) + { + auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + Scene00006( player ); + }; + + player.eventPlay( getId(), 5, HIDE_HOTBAR, 0, 0, callback ); + } + + void Scene00006( Entity::Player& player ) + { + auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + player.updateQuest( getId(), SEQ_FINISH ); + player.prepareZoning( player.getZoneId(), true, 1, 0 ); + player.changePosition( 9, 40, 14, 2 ); + }; + + player.eventPlay( getId(), 6, INVIS_OTHER_PC, 0, 0, callback ); + } + + void Scene00007( Entity::Player& player ) + { + player.eventPlay( getId(), 7, NONE, 0, 0 ); + } + + void Scene00008( Entity::Player& player ) + { + player.eventPlay( getId(), 8, NONE, 0, 0 ); + } + + void Scene00009( Entity::Player& player ) + { + player.eventPlay( getId(), 9, NONE, 0, 0 ); + } + + void Scene00010( Entity::Player& player ) + { + player.eventPlay( getId(), 10, NONE, 0, 0 ); + } + + void Scene00011( Entity::Player& player ) + { + auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + Scene00012( player ); + }; + + player.eventPlay( getId(), 11, 0x2c02, 0, 0, callback ); + } + + void Scene00012( Entity::Player& player ) + { + auto callback = [ this ]( 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(), 12, INVIS_OTHER_PC, 0, 0, callback ); + } + + void Scene00013( Entity::Player& player ) + { + player.eventPlay( getId(), 13, NONE, 0, 0 ); + } + +public: + ManSea001() : EventScript( "ManSea001", 65643 ) {} + + void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override + { + auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + + if( actor == ACTOR0 ) + Scene00000( player ); + else if( actor == ACTOR1 ) + Scene00005( player ); + else if( actor == ACTOR2 ) + Scene00011( player ); + } +}; + +EXPORT_SCRIPTOBJECT( ManSea001 ); \ No newline at end of file diff --git a/scripts/native/quest/ManSea002.cpp b/scripts/native/quest/ManSea002.cpp new file mode 100644 index 00000000..ed43f35c --- /dev/null +++ b/scripts/native/quest/ManSea002.cpp @@ -0,0 +1,151 @@ +#include "../ScriptObject.h" + +// Quest Script: ManSea002_00108 +// Quest Name: Close to Home +// Quest ID: 65644 +// Start NPC: 1002697 +// End NPC: 1000972 + +class ManSea002 : public EventScript +{ +private: + static constexpr auto SEQ_0 = 0; + static constexpr auto SEQ_1 = 1; + static constexpr auto SEQ_FINISH = 255; + + + static constexpr auto ACTOR0 = 1002697; + static constexpr auto ACTOR1 = 1001217; + static constexpr auto ACTOR2 = 1000926; + static constexpr auto ACTOR3 = 1000972; + static constexpr auto AETHERYTE0 = 8; + static constexpr auto BIND_ACTOR0 = 6229226; + static constexpr auto ITEM0 = 2000104; + static constexpr auto LOC_ACTOR1 = 1001023; + static constexpr auto LOC_FACE0 = 604; + static constexpr auto LOC_FACE1 = 605; + static constexpr auto LOC_POS_CAM1 = 4106696; + static constexpr auto LOC_POS_CAM2 = 4106698; + static constexpr auto REWARD0 = 1; + static constexpr auto SCREENIMAGE0 = 14; + static constexpr auto UNLOCK_DESION = 14; + + 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 + Scene00050( player ); + }; + + player.eventPlay( getId(), 0, HIDE_HOTBAR, 0, 0, callback ); + } + + void Scene00001( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + + }; + + player.eventPlay( getId(), 1, NONE, callback ); + } + + void Scene00002( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + + }; + + player.eventPlay( getId(), 2, NONE, callback ); + } + + void Scene00003( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + + }; + + player.eventPlay( getId(), 3, NONE, callback ); + } + + void Scene00004( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + + }; + + player.eventPlay( getId(), 4, NONE, callback ); + } + + void Scene00005( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + + }; + + player.eventPlay( getId(), 5, NONE, callback ); + } + + void Scene00006( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + + }; + + player.eventPlay( getId(), 6, NONE, callback ); + } + + void Scene00007( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + + }; + + player.eventPlay( getId(), 7, NONE, callback ); + } + + void Scene00008( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + + }; + + player.eventPlay( getId(), 8, NONE, callback ); + } + + void Scene00050( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + // on quest accept + player.updateQuest( getId(), 1 ); + player.setQuestUI8CH( getId(), 1 ); // receive key item + + // teleport to real gridania + player.forceZoneing( 128 ); + }; + + player.eventPlay( getId(), 50, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, 0, 0, callback ); + } +public: + ManSea002() : EventScript( "ManSea002", 65644 ) {} + + void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override + { + auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + + // todo: this doesn't actually play a cutscene after accepting the quest + if( actor == ACTOR0 ) + Scene00000( player ); + } +}; + +EXPORT_SCRIPTOBJECT( ManSea002 ) \ No newline at end of file diff --git a/scripts/native/quest/ManWil001.cpp b/scripts/native/quest/ManWil001.cpp new file mode 100644 index 00000000..a2ce36dd --- /dev/null +++ b/scripts/native/quest/ManWil001.cpp @@ -0,0 +1,145 @@ +#include "../ScriptObject.h" + +// Quest Script: ManWil001_00594 +// Quest Name: Coming to Ul'dah +// Quest ID: 66130 +// Start NPC: 1003987 +// End NPC: 1003988 + +class ManWil001 : public EventScript +{ +private: + static constexpr auto SEQ_0 = 0; + static constexpr auto SEQ_FINISH = 255; + + static constexpr auto ACTOR0 = 1003987; + static constexpr auto ACTOR1 = 1003988; + static constexpr auto ACTOR20 = 1001285; + static constexpr auto CUT_EVENT = 188; + static constexpr auto EOBJECT0 = 2001681; + static constexpr auto EOBJECT1 = 2001682; + static constexpr auto EOBJECT2 = 2001683; + static constexpr auto EOBJECT3 = 2001706; + static constexpr auto EVENT_ACTION_SEARCH = 1; + static constexpr auto OPENING_EVENT_HANDLER = 1245187; + + void Scene00000( Entity::Player& player ) + { + auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + if( param2 == 1 ) + { + player.setOpeningSequence( 2 ); + Scene00001( player ); + } + }; + + player.eventPlay( getId(), 0, HIDE_HOTBAR, 0, 0, callback ); + } + + void Scene00001( Entity::Player& player ) + { + auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + Scene00002( player ); + }; + + player.eventPlay( getId(), 1, 0xF8482EFB, 0, 0, callback ); + } + + void Scene00002( Entity::Player& player ) + { + auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + player.updateQuest( getId(), SEQ_FINISH ); + player.eventPlay( OPENING_EVENT_HANDLER, 0x1E, HIDE_HOTBAR | NO_DEFAULT_CAMERA, 0, 0 ); + }; + + player.eventPlay( getId(), 2, NONE, 0, 0, callback ); + } + + void Scene00003( Entity::Player& player ) + { + player.eventPlay( getId(), 3, 0, 0, 0 ); + } + + void Scene00004( Entity::Player& player ) + { + auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + Scene00005( player ); + }; + + player.eventPlay( getId(), 4, 0x2c02, 0, 0, callback ); + } + + void Scene00005( Entity::Player& player ) + { + auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + if( param2 == 1 ) + { + if( player.giveQuestRewards( getId(), 0 ) ) + player.finishQuest( getId() ); + } + }; + + player.eventPlay( getId(), 5, INVIS_OTHER_PC, 0, 0, callback ); + } + + void Scene00006( Entity::Player& player ) + { + player.eventPlay( getId(), 6, 0, 0, 0 ); + } + + void Scene00007( Entity::Player& player ) + { + player.eventPlay( getId(), 7, 0, 0, 0 ); + } + + void Scene00008( Entity::Player& player ) + { + player.eventPlay( getId(), 8, 0, 0, 0 ); + } + + void Scene00009( Entity::Player& player ) + { + player.eventPlay( getId(), 9, 0, 0, 0 ); + } + + void Scene00010( Entity::Player& player ) + { + player.eventPlay( getId(), 10, 0, 0, 0 ); + } + + void Scene00011( Entity::Player& player ) + { + player.eventPlay( getId(), 11, 0, 0, 0 ); + } + + void Scene00012( Entity::Player& player ) + { + player.eventPlay( getId(), 12, 0, 0, 0 ); + } + + void Scene00013( Entity::Player& player ) + { + player.eventPlay( getId(), 13, 0, 0, 0 ); + } + + +public: + ManWil001() : EventScript( "ManWil001", 66130 ) {} + + void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override + { + auto actor = Event::mapEventActorToRealActor( actorId ); + + if( actor == ACTOR0 ) + Scene00000( player ); + else if( actor == ACTOR1 ) + Scene00004( player ); + } +}; + +EXPORT_SCRIPTOBJECT( ManWil001 ) \ No newline at end of file diff --git a/scripts/native/quest/ManWil002.cpp b/scripts/native/quest/ManWil002.cpp new file mode 100644 index 00000000..6791a312 --- /dev/null +++ b/scripts/native/quest/ManWil002.cpp @@ -0,0 +1,158 @@ +#include "../ScriptObject.h" + +// Quest Script: ManWil002_00568 +// Quest Name: Close to Home +// Quest ID: 66104 +// Start NPC: 1003988 +// End NPC: 1001353 + +class ManWil002 : public EventScript +{ +private: + static constexpr auto SEQ_0 = 0; + static constexpr auto SEQ_1 = 1; + static constexpr auto SEQ_FINISH = 255; + + + static constexpr auto ACTOR0 = 1003988; + static constexpr auto ACTOR1 = 1002277; + static constexpr auto ACTOR2 = 1003908; + static constexpr auto ACTOR20 = 1001637; + static constexpr auto ACTOR3 = 1001353; + static constexpr auto AETHERYTE0 = 9; + static constexpr auto BIND_ACTOR0 = 6229228; + static constexpr auto ITEM0 = 2000386; + static constexpr auto LOC_ACTION1 = 605; + static constexpr auto LOC_ACTION2 = 1005; + static constexpr auto LOC_MARKER_01 = 4009142; + static constexpr auto LOC_MARKER_02 = 4009152; + static constexpr auto LOC_POS_CAM1 = 4105872; + static constexpr auto LOC_POS_CAM2 = 4105874; + static constexpr auto LOC_POS_CAM3 = 4009150; + static constexpr auto LOC_POS_CAM4 = 4143488; + static constexpr auto POPRANGE0 = 4110794; + static constexpr auto REWARD0 = 1; + static constexpr auto SCREENIMAGE0 = 14; + static constexpr auto SEQ_0_ACTOR0_LQ = 50; + static constexpr auto TERRITORYTYPE0 = 130; + + 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 + Scene00050( player ); + }; + + player.eventPlay( getId(), 0, HIDE_HOTBAR, 0, 0, callback ); + } + + void Scene00001( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + + }; + + player.eventPlay( getId(), 1, NONE, callback ); + } + + void Scene00002( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + + }; + + player.eventPlay( getId(), 2, NONE, callback ); + } + + void Scene00003( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + + }; + + player.eventPlay( getId(), 3, NONE, callback ); + } + + void Scene00004( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + + }; + + player.eventPlay( getId(), 4, NONE, callback ); + } + + void Scene00005( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + + }; + + player.eventPlay( getId(), 5, NONE, callback ); + } + + void Scene00006( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + + }; + + player.eventPlay( getId(), 6, NONE, callback ); + } + + void Scene00007( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + + }; + + player.eventPlay( getId(), 7, NONE, callback ); + } + + void Scene00008( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + + }; + + player.eventPlay( getId(), 8, NONE, callback ); + } + + void Scene00050( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + // on quest accept + player.updateQuest( getId(), 1 ); + player.setQuestUI8CH( getId(), 1 ); // receive key item + + // teleport to real gridania + player.forceZoneing( 130 ); + }; + + player.eventPlay( getId(), 50, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, 0, 0, callback ); + } + + +public: + ManWil002() : EventScript( "ManWil002", 66104 ) { } + + void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override + { + auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + + if( actor == ACTOR0 ) + Scene00000( player ); + } +}; + +EXPORT_SCRIPTOBJECT( ManWil002 ) \ No newline at end of file diff --git a/scripts/native/quest/subquest/gridania/SubFst013.cpp b/scripts/native/quest/subquest/gridania/SubFst013.cpp new file mode 100644 index 00000000..5e3cb63a --- /dev/null +++ b/scripts/native/quest/subquest/gridania/SubFst013.cpp @@ -0,0 +1,186 @@ +#include "../../../ScriptObject.h" + +// Quest Script: SubFst013_00040 +// Quest Name: For Friendship +// Quest ID: 65576 +// Start NPC: 1000162 +// End NPC: 1000162 + +class SubFst013 : 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_3 = 3; + static constexpr auto SEQ_4 = 4; + static constexpr auto SEQ_5 = 5; + static constexpr auto SEQ_FINISH = 255; + + + // Entities found in the script data of the quest + static constexpr auto ACTOR0 = 1000162; + static constexpr auto ACTOR1 = 1000161; + static constexpr auto FIRST_QUEST = 65575; + static constexpr auto SEQ_0_ACTOR0 = 0; + static constexpr auto SEQ_1_ACTOR1 = 1; + static constexpr auto SEQ_1_ACTOR1_EMOTENO = 99; + static constexpr auto SEQ_1_ACTOR1_EMOTEOK = 100; + static constexpr auto SEQ_2_ACTOR0 = 2; + static constexpr auto SEQ_3_ACTOR1 = 3; + static constexpr auto SEQ_3_ACTOR1_EMOTENO = 97; + static constexpr auto SEQ_3_ACTOR1_EMOTEOK = 98; + static constexpr auto SEQ_4_ACTOR0 = 4; + static constexpr auto SEQ_5_ACTOR1 = 5; + static constexpr auto SEQ_5_ACTOR1_EMOTENO = 95; + static constexpr auto SEQ_5_ACTOR1_EMOTEOK = 96; + static constexpr auto SEQ_6_ACTOR0 = 6; + + 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 ) + { + player.updateQuest( getId(), SEQ_1 ); + } + }; + + player.eventPlay( getId(), 0, NONE, callback ); + } + + void Scene00001( Entity::Player& player ) + { + player.eventPlay( getId(), 2, NONE ); + } + + void Scene00002( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + player.updateQuest( getId(), SEQ_3 ); + }; + + player.eventPlay( getId(), 2, NONE, callback ); + } + + void Scene00003( Entity::Player& player ) + { + player.eventPlay( getId(), 3, NONE ); + } + + void Scene00004( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + player.updateQuest( getId(), SEQ_5 ); + }; + + player.eventPlay( getId(), 4, NONE, callback ); + } + + void Scene00005( Entity::Player& player ) + { + player.eventPlay( getId(), 5, NONE ); + } + + void Scene00006( 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(), 6, NONE, callback ); + } + + void Scene00095( Entity::Player& player ) + { + player.eventPlay( getId(), 95, NONE ); + } + + void Scene00096( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + player.updateQuest( getId(), SEQ_FINISH ); + player.sendQuestMessage( getId(), 4, 2, 0, 0 ); + }; + + player.eventPlay( getId(), 96, NONE, callback ); + } + + void Scene00097( Entity::Player& player ) + { + player.eventPlay( getId(), 97, NONE ); + } + + void Scene00098( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + player.updateQuest( getId(), SEQ_4 ); + player.sendQuestMessage( getId(), 2, 2, 0, 0 ); + }; + + player.eventPlay( getId(), 98, NONE, callback ); + } + + void Scene00099( Entity::Player& player ) + { + player.eventPlay( getId(), 99, NONE ); + } + + void Scene00100( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + player.updateQuest( getId(), SEQ_2 ); + player.sendQuestMessage( getId(), 0, 2, 0, 0 ); + }; + + player.eventPlay( getId(), 100, NONE, callback ); + } + + +public: + SubFst013() : EventScript( "SubFst013", 65576 ) {} + + void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override + { + auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + + if( !player.hasQuest( getId() ) ) + { + Scene00000( player ); + return; + } + + if( actor == ACTOR1 ) // talking to Aunillie while on quest + Scene00003( player ); + else if( actor == ACTOR0 && player.getQuestSeq( getId() ) == SEQ_2 ) + Scene00002( player ); + else if( actor == ACTOR0 && player.getQuestSeq( getId() ) == SEQ_4 ) + Scene00004( player ); + else if( actor == ACTOR0 && player.getQuestSeq( getId() ) == SEQ_FINISH ) + Scene00006( player ); + } + + void onEmote( uint64_t actorId, uint32_t eventId, uint32_t emoteId, Entity::Player& player ) override + { + auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + + if( actor == ACTOR1 && emoteId == 5 && player.getQuestSeq( getId() ) == SEQ_1 ) + Scene00100( player ); + else if( actor == ACTOR1 && emoteId == 18 && player.getQuestSeq( getId() ) == SEQ_3 ) + Scene00098( player ); + else if( actor == ACTOR1 && emoteId == 11 && player.getQuestSeq( getId() ) == SEQ_5 ) + Scene00096( player ); + } +}; + +EXPORT_SCRIPTOBJECT( SubFst013 ) \ No newline at end of file