1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-26 14:37:44 +00:00
sapphire/src/servers/Scripts/quest/ManFst001.cpp

107 lines
3.2 KiB
C++
Raw Normal View History

2018-03-07 08:14:42 +01:00
#include <Script/NativeScriptApi.h>
#include <Actor/Player.h>
#include "../ScriptObject.h"
#include "Event/EventHelper.h"
// Quest Script: ManFst001_00039
// Quest Name: Coming to Gridania
// Quest ID: 65575
// Start NPC: 1001148
// End NPC: 1001140
class ManFst001 : public EventScript
{
private:
static constexpr auto SEQ_0 = 0;
static constexpr auto SEQ_FINISH = 255;
static constexpr auto RewardExpFactor = 50;
static constexpr auto RewardGil = 103;
static constexpr auto ACTOR0 = 1001148;
static constexpr auto ACTOR1 = 1001140;
static constexpr auto CUT_EVENT = 29;
static constexpr auto EOBJECT0 = 2001659;
static constexpr auto EOBJECT1 = 2001660;
static constexpr auto EOBJECT7 = 2616477;
static constexpr auto EVENT_ACTION_SEARCH = 1;
static constexpr auto HOWTO_QUEST_ACCEPT = 12;
static constexpr auto HOWTO_QUEST_ANNOUNCE = 2;
static constexpr auto HOWTO_REWARD = 11;
static constexpr auto HOWTO_TODO = 3;
static constexpr auto OPENING_EVENT_HANDLER = 1245186;
static constexpr auto SEQ_2_ACTOR1 = 2;
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 );
};
2018-03-15 20:03:29 +01:00
player.eventPlay( getId(), 1, DISABLE_SKIP | HIDE_HOTBAR | SET_BASE, 0, 0, callback );
2018-03-07 08:14:42 +01:00
}
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 );
};
2018-03-15 20:03:29 +01:00
player.eventPlay( getId(), 4, FADE_OUT | HIDE_HOTBAR | CONDITION_CUTSCENE | HIDE_UI , 0, 0, callback );
2018-03-07 08:14:42 +01:00
}
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( 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 );
}
};