diff --git a/scripts/native/CMakeLists.txt b/scripts/native/CMakeLists.txt index 334c9f01..b7b5de1e 100644 --- a/scripts/native/CMakeLists.txt +++ b/scripts/native/CMakeLists.txt @@ -24,7 +24,7 @@ foreach(_sourcefile ${SCRIPT_FILES}) if(MSVC) set_source_files_properties("${_file}" PROPERTIES - COMPILE_FLAGS "/Yc${CMAKE_CURRENT_SOURCE_DIR}/ScriptObject.h" + COMPILE_FLAGS "/YuScriptObject.h" ) set_target_properties(${_file} PROPERTIES CXX_STANDARD 14 diff --git a/scripts/native/ScriptObject.h b/scripts/native/ScriptObject.h index 6691f474..17da1520 100644 --- a/scripts/native/ScriptObject.h +++ b/scripts/native/ScriptObject.h @@ -7,5 +7,88 @@ #include #include +enum EventFlags +{ + NONE = 0, + NO_DEFAULT_CAMERA = 0x00000001, + FADE_OUT = 0x00000002, + INVIS_ENPC = 0x00000004, + INVIS_EOBJ = 0x00000008, + INVIS_BNPC = 0x00000010, + INVIS_OTHER_PC = 0x00000020, + INVIS_PARTY_PC = 0x00000040, + INVIS_PARTY_BUDDY = 0x10000000, + INVIS_GATHERING_POINT = 0x00000080, + INVIS_AETHERYTE = 0x00000100, + INVIS_TREASURE = 0x00000200, + CONDITION_CUTSCENE = 0x00000400, + HIDE_UI = 0x00000800, + INVIS_ALL = 0xF80003FC, + AUTO_LOC_CAMERA = 0x00001000, + HIDE_HOTBAR = 0x00002000, + INVINCIBLE = 0x00004000, + SILENT_ENTER_TERRI_ENV = 0x00008000, + SILENT_ENTER_TERRI_BGM = 0x00010000, + SILENT_ENTER_TERRI_SE = 0x00020000, + SILENT_ENTER_TERRI_ALL = 0x00038000, + DISABLE_SKIP = 0x00080000, + HIDE_FESTIVAL = 0x00200000, + DISABLE_STEALTH = 0x00400000, + ROLLBACK_HIDE_UI = 0x00800000, + LOCK_HUD = 0x01000000, + LOCK_HOTBAR = 0x02000000, + DISABLE_CANCEL_EMOTE = 0x04000000, + INVIS_AOE = 0x08000000, + INVIS_ALLIANCE_PC = 0x20000000, + INVIS_ALLIANCE_BUDDY = 0x40000000, + INVIS_COMPANION = 0x80000000, + SET_BASE = 0xF8400EFB, + SET_INVIS_BASE = 0xF8400FFF, + SET_EOBJ_BASE = 0xF8400EF3 +}; + +enum EventTypes +{ + EVENT_TALK = 1, + EVENT_EMOTE = 2, + EVENT_DISTANCE_BELOW = 3, + EVENT_DISTANCE_OVER = 4, + EVENT_BATTLE_REWARD = 5, + EVENT_CRAFT = 6, + EVENT_NEST = 7, + EVENT_EVENT_ITEM = 8, + EVENT_DROP = 9, + EVENT_WITHIN_RANGE = 10, + EVENT_OUTSIDE_RANGE = 11, + EVENT_GAME_START = 12, + EVENT_GAME_PROGRESS = 13, + EVENT_ENTER_TERRITORY = 15, + EVENT_GAME_COME_BACK = 17, + EVENT_ACTION_RESULT = 18, + EVENT_MATERIA_CRAFT = 19, + EVENT_FISHING = 20, + EVENT_UI = 21, + EVENT_HOUSING = 22, + EVENT_SAY = 23, + EVENT_TABLE_GAME = 24 +}; + +enum EventFinishState +{ + UNLOCK = 1, + KEEPLOCK = 0 +}; + +enum DamageType +{ + STD_DAMAGE = 0X03, + STD_HEAL = 0X04, + STD_MP_LOSS = 0X0A, + STD_MP_GAIN = 0X0B, + STD_TP_LOSS = 0X0C, + STD_TP_GAIN = 0X0D +}; + + #endif //SAPPHIRE_SCRIPTOBJECT_H 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..17ec1170 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/ManFst001.cpp b/scripts/native/quest/ManFst001.cpp new file mode 100644 index 00000000..5603657b --- /dev/null +++ b/scripts/native/quest/ManFst001.cpp @@ -0,0 +1,106 @@ +#include "../ScriptObject.h" + +// Quest Script: ManFst001_00039 +// Quest Name: Coming to Gridania +// Quest ID: 65575 +// Start NPC: 1001148 +// End NPC: 1001140 + +#define SEQ_0 0 +#define SEQ_FINISH 255 + +#define RewardExpFactor 50 +#define RewardGil 103 + +#define ACTOR0 1001148 +#define ACTOR1 1001140 +#define CUT_EVENT 29 +#define EOBJECT0 2001659 +#define EOBJECT1 2001660 +#define EOBJECT7 2616477 +#define EVENT_ACTION_SEARCH 1 +#define HOWTO_QUEST_ACCEPT 12 +#define HOWTO_QUEST_ANNOUNCE 2 +#define HOWTO_REWARD 11 +#define HOWTO_TODO 3 +#define OPENING_EVENT_HANDLER 1245186 +#define SEQ_2_ACTOR1 2 + +class ManFst001 : public EventScript +{ +private: + 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.setOpeningSequence( 2 ); + Scene00001( 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 ) + { + Scene00002( player ); + }; + + player.eventPlay( getId(), 1, 0xF8482EFB, 0, 0, callback ); + } + + 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_FINISH ); + + player.eventPlay( OPENING_EVENT_HANDLER, 0x1E, HIDE_HOTBAR | NO_DEFAULT_CAMERA, 0, 0 ); + }; + + player.eventPlay( getId(), 2, 0, 0, 0, callback ); + } + + void Scene00004( Entity::Player& player ) + { + auto callback = [&]( 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 = [&]( 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 ); + } + +public: + ManFst001() : EventScript( "ManFst001", 65575 ) {} + + 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 ) + Scene00004( player ); + } +}; + +EXPORT_SCRIPTOBJECT( ManFst001 ) \ No newline at end of file diff --git a/scripts/native/quest/ManFst002.cpp b/scripts/native/quest/ManFst002.cpp new file mode 100644 index 00000000..9857ba60 --- /dev/null +++ b/scripts/native/quest/ManFst002.cpp @@ -0,0 +1,225 @@ +#include "../ScriptObject.h" + +// Quest Script: ManFst002_00124 +// Quest Name: Close to Home +// Quest ID: 65660 +// Start NPC: 1001140 +// End NPC: 1000100 + +class ManFst002 : public EventScript +{ +private: + + static constexpr auto SEQ_0 = 0; + static constexpr auto SEQ_1 = 1; + static constexpr auto SEQ_FINISH = 255; + //this.SEQ_OFFER = ?; + + // Quest rewards + static constexpr auto RewardExpFactor = 100; + static constexpr auto RewardGil = 107; + + // Entities found in the script data of the quest + // some of these may be useful + static constexpr auto ACTOR0 = 1001140; + static constexpr auto ACTOR1 = 2; + static constexpr auto ACTOR2 = 1000251; + static constexpr auto ACTOR20 = 1000159; + static constexpr auto ACTOR3 = 1000768; + static constexpr auto ACTOR4 = 1000100; + static constexpr auto BIND_ACTOR0 = 6229224; + static constexpr auto HOW_TO_DESION = 13; + static constexpr auto HOW_TO_MAP_AND_NAVI = 4; + static constexpr auto ITEM0 = 2000074; + static constexpr auto LOC_ACTOR0 = 1003159; + static constexpr auto LOC_MARKER_01 = 2153091; + static constexpr auto LOC_MARKER_02 = 2153104; + static constexpr auto LOC_MARKER_03 = 2153111; + static constexpr auto LOC_MARKER_04 = 2154539; + static constexpr auto LOC_MARKER_05 = 2154540; + static constexpr auto LOC_MARKER_06 = 2154541; + static constexpr auto LOC_MARKER_07 = 2210446; + static constexpr auto LOC_MARKER_08 = 2210454; + static constexpr auto LOC_MARKER_09 = 2210461; + static constexpr auto LOC_MOTION0 = 799; + static constexpr auto POPRANGE0 = 2280858; + static constexpr auto REWARD_DESION = 1; + static constexpr auto SEQ_0_ACTOR0 = 0; + static constexpr auto SEQ_0_ACTOR0_LQ = 50; + static constexpr auto SEQ_1_ACTOR0 = 4; + static constexpr auto SEQ_1_ACTOR1 = 1; + static constexpr auto SEQ_1_ACTOR1_WAIT = 51; + static constexpr auto SEQ_1_ACTOR2 = 2; + static constexpr auto SEQ_1_ACTOR3 = 3; + static constexpr auto SEQ_1_ACTOR3_NPCTRADENO = 99; + static constexpr auto SEQ_1_ACTOR3_NPCTRADEOK = 100; + static constexpr auto SEQ_2_ACTOR4 = 5; + static constexpr auto TERRITORYTYPE0 = 132; + static constexpr auto UNLOCK_DESION = 14; + + + void checkQuestCompletion( Entity::Player& player, uint32_t varIdx ) + { + if( varIdx == 3 ) + player.sendQuestMessage( getId(), 1, 0, 0, 0 ); + else if( varIdx == 2 ) + player.sendQuestMessage( getId(), 2, 0, 0, 0 ); + else + player.sendQuestMessage( getId(), 0, 0, 0, 0 ); + + auto var_attuned = player.getQuestUI8AL( static_cast< uint16_t >( getId() ) ); + auto var_class = player.getQuestUI8BH( static_cast< uint16_t >( getId() ) ); + auto var_trade = player.getQuestUI8BL( static_cast< uint16_t >( getId() ) ); + + if( var_attuned == 1 && var_class == 1 && var_trade == 1 ) + player.updateQuest( getId(), SEQ_FINISH ); + } + + 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.setQuestUI8AL( getId(), 1 ); + checkQuestCompletion( player, 0 ); + }; + + player.eventPlay( getId(), 1, 0x0EFB, 0, 0, callback ); + } + + void Scene00002( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + player.setQuestUI8BH( getId(), 1 ); + checkQuestCompletion( player, 3 ); + }; + + player.eventPlay( getId(), 2, 0, 0, 0, callback ); + } + + void Scene00003( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + if( param2 == 1 ) + Scene00100( player ); + else + Scene00099( player ); + }; + + player.eventPlay( getId(), 3, 0, 0, 0, callback ); + } + + void Scene00004( Entity::Player& player ) + { + player.eventPlay( getId(), 4, 0, 0, 0 ); + } + + void Scene00005( 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(), 5, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, 0, 0, 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( 132 ); + }; + + player.eventPlay( getId(), 50, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, 0, 0, callback ); + } + + void Scene00051( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + Scene00001( player ); + }; + + player.eventPlay( getId(), 51, 0, 0, 0, callback ); + } + + void Scene00099( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + Scene00004( player ); + }; + + player.eventPlay( getId(), 99, 0, 0, 0, callback ); + } + + void Scene00100( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + player.setQuestUI8CH( getId(), 0 ); // remove traded key item + player.setQuestUI8BL( getId(), 1 ); + + checkQuestCompletion( player, 2 ); + }; + + player.eventPlay( getId(), 100, 0x0EFB, 0, 0, callback ); + } + +public: + ManFst002() : EventScript( "ManFst002", 65621 ) {} + + 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 ) + { + // attune + auto event = [&]( Entity::Player& player, uint32_t eventId, uint64_t additional ) + { + player.sendQuestMessage( 0x050002, 0, 1, 0, 0 ); + player.registerAetheryte( 2 ); + player.learnAction( 1 ); + + Scene00051( player ); + }; + + player.eventActionStart( 0x050002, 0x13, event, nullptr, 0x050002 ); + + player.unlock(); + } + else if( actor == ACTOR2 ) + Scene00002( player ); + else if( actor == ACTOR3 ) + Scene00003( player ); + else if( actor == ACTOR4 ) + Scene00005( player ); + } +}; + +EXPORT_SCRIPTOBJECT( ManFst002 ) \ 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..e19b08b6 --- /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( static_cast< uint32_t >( 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/SubFst001.cpp b/scripts/native/quest/subquest/gridania/SubFst001.cpp new file mode 100644 index 00000000..4b5a31a2 --- /dev/null +++ b/scripts/native/quest/subquest/gridania/SubFst001.cpp @@ -0,0 +1,86 @@ +#include "../../../ScriptObject.h" + +// Quest Script: SubFst001_00024 +// Quest Name: Coarse Correspondence +// Quest ID: 65560 +// Start NPC: 1000206 +// End NPC: 1000233 + +class SubFst001 : public EventScript +{ +private: + static constexpr auto SEQ_0 = 0; + static constexpr auto SEQ_FINISH = 255; + static constexpr auto ACTOR0 = 1000206; + static constexpr auto ACTOR1 = 1000233; + static constexpr auto ITEM0 = 2000079; + static constexpr auto SEQ_0_ACTOR0 = 0; + static constexpr auto SEQ_1_ACTOR1 = 1; + static constexpr auto SEQ_1_ACTOR1_NPCTRADENO = 99; + static constexpr auto SEQ_1_ACTOR1_NPCTRADEOK = 100; + + 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.setQuestUI8AL( getId(), 1 ); + player.setQuestUI8BH( getId(), 1 ); + player.updateQuest( getId(), SEQ_FINISH ); + } + }; + + player.eventPlay( getId(), 0, NONE, callback ); + } + + void Scene00001( Entity::Player& player ) + { + player.eventPlay( getId(), 1, NONE ); + } + + 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 ) + { + if( param2 == 1 ) // accept quest + { + if( player.giveQuestRewards( getId(), 0 ) ) + player.finishQuest( getId() ); + } + }; + + player.eventPlay( getId(), 100, NONE, callback ); + } + + +public: + SubFst001() : EventScript( "SubFst001", 65560 ) {} + + void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override + { + auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + + if( actor == ACTOR0 ) + { + if( !player.hasQuest( getId() ) ) + Scene00000( player ); + else + Scene00001( player ); + } + else if( actor == ACTOR1 ) + { + if( !player.hasQuest( getId() ) ) + Scene00099( player ); + else + Scene00100( player ); + } + } +}; + +EXPORT_SCRIPTOBJECT( SubFst001 ) \ No newline at end of file diff --git a/scripts/native/quest/subquest/gridania/SubFst010.cpp b/scripts/native/quest/subquest/gridania/SubFst010.cpp new file mode 100644 index 00000000..6883fae6 --- /dev/null +++ b/scripts/native/quest/subquest/gridania/SubFst010.cpp @@ -0,0 +1,58 @@ +#include "../../../ScriptObject.h" + +// Quest Script: SubFst010_00001 +// Quest Name: A Good Adventurer Is Hard to Find +// Quest ID: 65537 +// Start NPC: 1000146 +// End NPC: 1000195 + +class SubFst010 : public EventScript +{ +private: + static constexpr auto SEQ_0 = 0; + static constexpr auto SEQ_FINISH = 255; + static constexpr auto ACTOR0 = 1000146; + static constexpr auto ACTOR1 = 1000195; + static constexpr auto SEQ_0_ACTOR0 = 0; + static constexpr auto SEQ_1_ACTOR1 = 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_FINISH ); + }; + + 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: + SubFst010() : EventScript( "SubFst010", 65537 ) {} + + 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 ) + Scene00001( player ); + } +}; + +EXPORT_SCRIPTOBJECT( SubFst010 ) \ 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 diff --git a/src/servers/Server_Zone/Script/ScriptManager.cpp b/src/servers/Server_Zone/Script/ScriptManager.cpp index 039c59be..93210400 100644 --- a/src/servers/Server_Zone/Script/ScriptManager.cpp +++ b/src/servers/Server_Zone/Script/ScriptManager.cpp @@ -120,7 +120,6 @@ void Core::Scripting::ScriptManager::loadDir( const std::string& dirname, std::s files.insert( i.string() ); } } - } void Core::Scripting::ScriptManager::onPlayerFirstEnterWorld( Entity::Player& player ) @@ -185,7 +184,7 @@ bool Core::Scripting::ScriptManager::onTalk( Entity::Player& player, uint64_t ac auto questInfo = g_exdData.getQuestInfo( eventId ); if ( questInfo ) { - player.sendUrgent( "Quest not implemented: " + questInfo->name ); + player.sendUrgent( "Quest not implemented: " + questInfo->name + " (" + questInfo->name_intern + ")" ); } }