1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-29 07:37:45 +00:00
sapphire/src/scripts/quest/subquest/gridania/SubFst005.cpp

94 lines
No EOL
2.5 KiB
C++

// This is an automatically generated C++ script template
// Content needs to be added by hand to make it function
// In order for this script to be loaded, move it to the correct folder in <root>/scripts/
#include <Actor/Player.h>
#include "Manager/EventMgr.h"
#include <ScriptObject.h>
#include <Service.h>
// Quest Script: SubFst005_00028
// Quest Name: To the Bannock
// Quest ID: 65564
// Start NPC: 1000100
// End NPC: 1000421
using namespace Sapphire;
class SubFst005 : public Sapphire::ScriptAPI::QuestScript
{
private:
// Basic quest information
// Quest vars / flags used
// GetQuestUI8AL
// Steps in this quest ( 0 is before accepting,
// 1 is first, 255 means ready for turning it in
enum Sequence : uint8_t
{
Seq0 = 0,
SeqFinish = 255,
};
// Entities found in the script data of the quest
static constexpr auto Actor0 = 1000100;
static constexpr auto Actor1 = 1000421;
static constexpr auto Seq0Actor0 = 0;
static constexpr auto Seq1Actor1 = 1;
public:
SubFst005() : Sapphire::ScriptAPI::QuestScript( 65564 )
{};
~SubFst005() = default;
//////////////////////////////////////////////////////////////////////
// Event Handlers
void onTalk( World::Quest &quest, Entity::Player &player, uint64_t actorId ) override
{
if( actorId == Actor0 )
{
Scene00000( quest, player );
}
else if( actorId == Actor1 )
{
Scene00001( quest, player );
}
}
private:
//////////////////////////////////////////////////////////////////////
// Available Scenes in this quest, not necessarly all are used
//////////////////////////////////////////////////////////////////////
void Scene00000( World::Quest &quest, Entity::Player &player )
{
eventMgr().playQuestScene( player, getId(), 0, NONE, bindSceneReturn( &SubFst005::Scene00000Return ) );
}
void Scene00000Return( World::Quest &quest, Entity::Player &player, const Event::SceneResult &result )
{
if( result.getResult( 0 ) == 1 )
quest.setSeq( SeqFinish );
}
//////////////////////////////////////////////////////////////////////
void Scene00001( World::Quest &quest, Entity::Player &player )
{
eventMgr().playQuestScene( player, getId(), 1, NONE, bindSceneReturn( &SubFst005::Scene00001Return ) );
}
void Scene00001Return( World::Quest &quest, Entity::Player &player, const Event::SceneResult &result )
{
if( result.getResult( 0 ) == 1 )
{
if( player.giveQuestRewards( getId(), 0 ) )
player.finishQuest( getId() );
}
}
};
EXPOSE_SCRIPT( SubFst005 );