1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-02 08:57:44 +00:00
sapphire/src/scripts/quest/ManFst405.cpp
2022-02-26 23:30:39 -06:00

183 lines
No EOL
5.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 "Manager/EventMgr.h"
#include <Actor/Player.h>
#include <ScriptObject.h>
#include <Service.h>
// Quest Script: ManFst405_00520
// Quest Name: Reclamation
// Quest ID: 66056
// Start NPC: 1006730
// End NPC: 1007630
using namespace Sapphire;
class ManFst405 : public Sapphire::ScriptAPI::QuestScript
{
private:
// Basic quest information
// Quest vars / flags used
// BitFlag8
// UI8AL
/// Countable Num: 0 Seq: 255 Event: 1 Listener: 1004433
// 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 = 1006730;//Alphinaud (Seq0)
static constexpr auto Actor1 = 1004433;//Elyenora
static constexpr auto Actor2 = 1007630;//Alphinaud (SeqFinish)
static constexpr auto Actor3 = 1007629;//Cid
static constexpr auto CutManfst40510 = 109;
static constexpr auto CutManfst40520 = 110;
static constexpr auto CutManfst40530 = 111;
static constexpr auto CutManfst40540 = 112;
static constexpr auto Poprange0 = 4103351;//Ul'dah Airship
static constexpr auto Poprange1 = 4148347;//The Solar
static constexpr auto Territorytype0 = 130;
public:
ManFst405() : Sapphire::ScriptAPI::QuestScript( 66056 ){};
~ManFst405() = default;
//////////////////////////////////////////////////////////////////////
// Event Handlers
void onTalk( World::Quest& quest, Entity::Player& player, uint64_t actorId ) override
{
switch( actorId )
{
case Actor0:
{
if( quest.getSeq() == Seq0 )
Scene00000( quest, player );
break;
}
case Actor1:
{
Scene00002( quest, player );
break;
}
case Actor2:
{
if( quest.getSeq() == SeqFinish )
Scene00003( quest, player );
break;
}
case Actor3:
{
if( quest.getSeq() == SeqFinish )
Scene00005( quest, player );
break;
}
}
}
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( &ManFst405::Scene00000Return ) );
}
void Scene00000Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result )
{
if( result.getResult( 0 ) == 1 )// accept quest
{
Scene00001( quest, player );
}
}
//////////////////////////////////////////////////////////////////////
void Scene00001( World::Quest& quest, Entity::Player& player )
{
eventMgr().playQuestScene( player, getId(), 1, HIDE_HOTBAR, bindSceneReturn( &ManFst405::Scene00001Return ) );
}
void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result )
{
quest.setSeq( SeqFinish );
}
//////////////////////////////////////////////////////////////////////
void Scene00002( World::Quest& quest, Entity::Player& player )
{
eventMgr().playQuestScene( player, getId(), 2, HIDE_HOTBAR, bindSceneReturn( &ManFst405::Scene00002Return ) );
}
void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result )
{
if( result.getResult( 0 ) == 1 )
{
auto& objectCache = Common::Service< Sapphire::InstanceObjectCache >::ref();
auto popRangeInfo = objectCache.getPopRangeInfo( Poprange0 );
if( popRangeInfo )
warpMgr().requestWarp( player, Common::WarpType::WARP_TYPE_NORMAL, popRangeInfo->m_pos, popRangeInfo->m_rotation );
}
}
//////////////////////////////////////////////////////////////////////
void Scene00003( World::Quest& quest, Entity::Player& player )
{
eventMgr().playQuestScene( player, getId(), 3, HIDE_HOTBAR, bindSceneReturn( &ManFst405::Scene00003Return ) );
}
void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result )
{
if( result.getResult( 0 ) == 1 )
{
auto& objectCache = Common::Service< Sapphire::InstanceObjectCache >::ref();
auto popRangeInfo = objectCache.getPopRangeInfo( Poprange1 );
if( popRangeInfo )
{
warpMgr().requestWarp( player, Common::WarpType::WARP_TYPE_NORMAL, popRangeInfo->m_pos, popRangeInfo->m_rotation );
Scene00004( quest, player );
}
}
}
//////////////////////////////////////////////////////////////////////
void Scene00004( World::Quest& quest, Entity::Player& player )
{
eventMgr().playQuestScene( player, getId(), 4, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, bindSceneReturn( &ManFst405::Scene00004Return ) );
}
void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result )
{
player.finishQuest( getId(), result.getResult( 1 ) );
}
//////////////////////////////////////////////////////////////////////
void Scene00005( World::Quest& quest, Entity::Player& player )
{
eventMgr().playQuestScene( player, getId(), 5, HIDE_HOTBAR, bindSceneReturn( &ManFst405::Scene00005Return ) );
}
void Scene00005Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result )
{
}
};
EXPOSE_SCRIPT( ManFst405 );