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/SubFst011.cpp

114 lines
3.2 KiB
C++
Raw Normal View History

2022-01-31 00:40:35 -06:00
// 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 "Manager/EventMgr.h"
#include <Actor/Player.h>
2022-02-23 08:36:23 +01:00
#include <Actor/BNpc.h>
2022-01-31 00:40:35 -06:00
#include <ScriptObject.h>
#include <Service.h>
// Quest Script: SubFst011_00037
// Quest Name: Population Control
// Quest ID: 65573
// Start NPC: 1000195
// End NPC: 1000195
using namespace Sapphire;
class SubFst011 : public Sapphire::ScriptAPI::QuestScript
{
private:
// Basic quest information
// Quest vars / flags used
// UI8AL
/// Countable Num: 10 Seq: 1 Event: 5 Listener: 47
/// Countable Num: 1 Seq: 255 Event: 1 Listener: 1000195
// Steps in this quest ( 0 is before accepting,
// 1 is first, 255 means ready for turning it in
enum Sequence : uint8_t
{
Seq0 = 0,
Seq1 = 1,
SeqFinish = 255,
};
// Entities found in the script data of the quest
static constexpr auto Actor0 = 1000195;
static constexpr auto Enemy0 = 47;
static constexpr auto Seq0Actor0 = 0;
static constexpr auto Seq2Actor0 = 1;
public:
SubFst011() : Sapphire::ScriptAPI::QuestScript( 65573 ){};
~SubFst011() = default;
//////////////////////////////////////////////////////////////////////
// Event Handlers
void onTalk( World::Quest& quest, Entity::Player& player, uint64_t actorId ) override
{
switch( actorId )
{
case Actor0:
{
if( !player.hasQuest( getId() ) )
Scene00000( quest, player );
else if( quest.getSeq() == SeqFinish )
Scene00001( quest, player );
}
}
}
2022-02-23 08:36:23 +01:00
void onBNpcKill( World::Quest& quest, Sapphire::Entity::BNpc& bnpc, Sapphire::Entity::Player& player ) override
2022-01-31 00:40:35 -06:00
{
2022-02-23 08:36:23 +01:00
switch( bnpc.getBNpcNameId() )
2022-01-31 00:40:35 -06:00
{
case Enemy0:
{
auto currentKC = quest.getUI8AL();
quest.setUI8AL( currentKC + 1 );
eventMgr().sendEventNotice( player, getId(), 0, 2, currentKC + 1, 6 );
if( currentKC + 1 >= 6 )
quest.setSeq( SeqFinish );
}
}
}
private:
//////////////////////////////////////////////////////////////////////
// Available Scenes in this quest, not necessarly all are used
//////////////////////////////////////////////////////////////////////
void Scene00000( World::Quest& quest, Entity::Player& player )
{
eventMgr().playQuestScene( player, getId(), 0, HIDE_HOTBAR, bindSceneReturn( &SubFst011::Scene00000Return ) );
}
void Scene00000Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result )
{
if( result.getResult( 0 ) == 1 )// accept quest
{
quest.setSeq( Seq1 );
}
}
//////////////////////////////////////////////////////////////////////
void Scene00001( World::Quest& quest, Entity::Player& player )
{
eventMgr().playQuestScene( player, getId(), 1, HIDE_HOTBAR, bindSceneReturn( &SubFst011::Scene00001Return ) );
}
void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result )
{
if( result.getResult( 0 ) == 1 )
{
player.finishQuest( getId(), result.getResult( 1 ) );
}
}
};
EXPOSE_SCRIPT( SubFst011 );