1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-27 14:57:44 +00:00
sapphire/src/scripts/quest/subquest/uldah/SubWil019.cpp

94 lines
2.2 KiB
C++
Raw Normal View History

2018-07-31 01:21:54 +02:00
#include <Actor/Player.h>
2018-12-23 03:53:08 +01:00
#include <Manager/EventMgr.h>
2018-07-31 01:21:54 +02:00
#include <ScriptObject.h>
2018-12-23 03:53:08 +01:00
#include "Framework.h"
2018-07-31 01:21:54 +02:00
using namespace Sapphire;
2018-10-28 21:53:21 +01:00
2018-07-31 01:21:54 +02:00
// Quest Script: SubWil019_00392
// Quest Name: Decisions, Decisions
// Quest ID: 65928
// Start NPC: 1001680
// End NPC: 1001691
class SubWil019 :
public Sapphire::ScriptAPI::EventScript
2018-07-31 01:21:54 +02:00
{
private:
// Basic quest information
// Quest vars / flags used
// GetQuestUI8AL
2018-07-31 01:21:54 +02:00
enum Sequence :
uint8_t
{
Seq0 = 0,
SeqFinish = 255,
};
2018-07-31 01:21:54 +02:00
// Quest rewards
static constexpr auto RewardExpFactor = 50;
static constexpr auto RewardGil = 111;
static constexpr auto RewardItem = 5539;
static constexpr auto RewardItemCount = 1;
2018-07-31 01:21:54 +02:00
// Entities found in the script data of the quest
static constexpr auto Actor0 = 1001680;
static constexpr auto Actor1 = 1001691;
2018-07-31 01:21:54 +02:00
public:
SubWil019() :
Sapphire::ScriptAPI::EventScript( 65928 )
{
};
2018-07-31 01:21:54 +02:00
~SubWil019()
{
};
2018-07-31 01:21:54 +02:00
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
2018-12-23 03:53:08 +01:00
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
2018-07-31 01:21:54 +02:00
if( actor == Actor0 )
{
Scene00000( player );
}
else if( actor == Actor1 )
{
Scene00001( player );
}
}
2018-07-31 01:21:54 +02:00
private:
2018-07-31 01:21:54 +02:00
void Scene00000( Entity::Player& player )
{
player.playScene( getId(), 0, HIDE_HOTBAR,
[ & ]( Entity::Player& player, const Event::SceneResult& result )
{
if( result.param2 == 1 )
{
player.updateQuest( getId(), SeqFinish );
}
} );
}
void Scene00001( Entity::Player& player )
{
player.playScene( getId(), 1, HIDE_HOTBAR,
[ & ]( Entity::Player& player, const Event::SceneResult& result )
{
if( result.param2 == 1 )
{
if( player.giveQuestRewards( getId(), 0 ) )
{
player.finishQuest( getId() );
}
}
} );
}
2018-07-31 01:21:54 +02:00
};