1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-26 06:27:45 +00:00
sapphire/src/servers/Scripts/quest/subquest/gridania/SubFst010.cpp

60 lines
1.6 KiB
C++
Raw Normal View History

2018-03-07 08:14:42 +01:00
#include <Script/NativeScriptApi.h>
#include <Actor/Player.h>
#include "Event/EventHelper.h"
#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, const Event::SceneResult& result )
2018-03-07 08:14:42 +01:00
{
if( result.param2 == 1 ) // accept quest
2018-03-07 08:14:42 +01:00
player.updateQuest( getId(), SEQ_FINISH );
};
2018-03-20 22:33:51 +11:00
player.playScene( getId(), 0, NONE, callback );
2018-03-07 08:14:42 +01:00
}
void Scene00001( Entity::Player& player )
{
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
2018-03-07 08:14:42 +01:00
{
if( result.param2 == 1 ) // finish quest
2018-03-07 08:14:42 +01:00
{
2018-03-20 22:33:51 +11:00
if( player.giveQuestRewards( getId(), 0 ))
player.finishQuest( getId());
2018-03-07 08:14:42 +01:00
}
};
2018-03-20 22:33:51 +11:00
player.playScene( getId(), 1, NONE, callback );
2018-03-07 08:14:42 +01:00
}
public:
2018-03-20 22:33:51 +11:00
SubFst010() : EventScript( 65537 )
{ }
2018-03-07 08:14:42 +01:00
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
2018-03-20 22:33:51 +11:00
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ));
2018-03-07 08:14:42 +01:00
if( actor == ACTOR0 )
Scene00000( player );
else if( actor == ACTOR1 )
Scene00001( player );
}
};