1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-28 07:07:45 +00:00
sapphire/src/servers/Scripts/quest/subquest/uldah/SubWil022.cpp

106 lines
2.6 KiB
C++
Raw Normal View History

#include <Actor/Player.h>
#include <Event/EventHelper.h>
#include <ScriptObject.h>
// Quest Script: SubWil022_00395
// Quest Name: The Wealth of Nations
// Quest ID: 65931
// Start NPC: 1001657
// End NPC: 1001679
class SubWil022 : public EventScript
{
private:
// Basic quest information
// Quest vars / flags used
// GetQuestUI8AL
// GetQuestUI8BH
enum Sequence : uint8_t
{
Seq0 = 0,
SeqFinish = 255,
};
// Quest rewards
static constexpr auto RewardExpFactor = 50;
static constexpr auto RewardGil = 111;
// Entities found in the script data of the quest
static constexpr auto Actor0 = 1001657;
static constexpr auto Actor1 = 1001679;
static constexpr auto Item0 = 2000197;
static constexpr auto Seq0Actor0 = 0;
static constexpr auto Seq1Actor1 = 1;
static constexpr auto Seq1Actor1Npctradeno = 99;
static constexpr auto Seq1Actor1Npctradeok = 100;
public:
SubWil022() : EventScript( 65931 ){};
~SubWil022(){};
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 )
{
Scene00000( player );
}
else if( actor == Actor1 )
{
Scene00001( player );
}
}
private:
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 );
player.setQuestUI8BH( getId(), 1 );
}
} );
}
void Scene00001( Entity::Player& player )
{
player.playScene( getId(), 1, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
if( result.param2 == 1 )
{
Scene00100( player );
}
else return;
} );
}
void Scene00099( Entity::Player& player )
{
player.playScene( getId(), 99, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
});
}
void Scene00100( Entity::Player& player )
{
player.playScene( getId(), 100, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
if( result.param2 == 1 )
{
if( player.giveQuestRewards( getId(), 0 ) )
player.finishQuest( getId() );
}
} );
}
};