mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 06:27:45 +00:00
156 lines
No EOL
4.4 KiB
C++
156 lines
No EOL
4.4 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 <Actor/BNpc.h>
|
|
#include <ScriptObject.h>
|
|
#include <Service.h>
|
|
|
|
// Quest Script: SubFst050_00156
|
|
// Quest Name: Ruffled Feathers
|
|
// Quest ID: 65692
|
|
// Start NPC: 1000470
|
|
// End NPC: 1000470
|
|
|
|
using namespace Sapphire;
|
|
|
|
class SubFst050 : public Sapphire::ScriptAPI::QuestScript
|
|
{
|
|
private:
|
|
// Basic quest information
|
|
// Quest vars / flags used
|
|
// UI8AL
|
|
// UI8BH
|
|
|
|
/// Countable Num: 6 Seq: 1 Event: 9 Listener: 22
|
|
/// Countable Num: 1 Seq: 255 Event: 1 Listener: 1000470
|
|
// 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 = 1000470; //Keitha
|
|
static constexpr auto Enemy0 = 22;
|
|
static constexpr auto Item0 = 2000092;
|
|
static constexpr auto Seq0Actor0 = 0;
|
|
static constexpr auto Seq2Actor0 = 1;
|
|
static constexpr auto Seq2Actor0Npctradeno = 99;
|
|
static constexpr auto Seq2Actor0Npctradeok = 100;
|
|
|
|
public:
|
|
SubFst050() : Sapphire::ScriptAPI::QuestScript( 65692 ){};
|
|
~SubFst050() = 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 );
|
|
else if( quest.getSeq() == SeqFinish )
|
|
Scene00001( quest, player );
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
void onEventItem( World::Quest& quest, Entity::Player& player, uint64_t actorId ) override
|
|
{
|
|
}
|
|
|
|
void onBNpcKill( World::Quest& quest, Entity::BNpc& bnpc, Entity::Player& player ) override
|
|
{
|
|
switch( bnpc.getBNpcNameId() )
|
|
{
|
|
case Enemy0:
|
|
{
|
|
quest.setUI8AL( quest.getUI8AL() + 1 );
|
|
quest.setUI8BH( quest.getUI8BH() + 1 );
|
|
checkQuestCompletion( quest, player );
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
private:
|
|
void checkQuestCompletion( World::Quest& quest, Entity::Player& player )
|
|
{
|
|
eventMgr().sendEventNotice( player, getId(), 0, 2, quest.getUI8AL(), 6 );
|
|
if( quest.getUI8AL() >= 6 )
|
|
{
|
|
quest.setUI8AL( 0 );
|
|
quest.setSeq( SeqFinish );
|
|
}
|
|
}
|
|
//////////////////////////////////////////////////////////////////////
|
|
// 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( &SubFst050::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( &SubFst050::Scene00001Return ) );
|
|
}
|
|
|
|
void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result )
|
|
{
|
|
if( result.getResult( 0 ) == 1 )
|
|
Scene00100( quest, player );
|
|
else
|
|
Scene00099( quest, player );
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
void Scene00099( World::Quest& quest, Entity::Player& player )
|
|
{
|
|
eventMgr().playQuestScene( player, getId(), 99, NONE, bindSceneReturn( &SubFst050::Scene00099Return ) );
|
|
}
|
|
|
|
void Scene00099Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result )
|
|
{
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
void Scene00100( World::Quest& quest, Entity::Player& player )
|
|
{
|
|
eventMgr().playQuestScene( player, getId(), 100, HIDE_HOTBAR, bindSceneReturn( &SubFst050::Scene00100Return ) );
|
|
}
|
|
|
|
void Scene00100Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result )
|
|
{
|
|
|
|
if( result.getResult( 0 ) == 1 )
|
|
{
|
|
player.finishQuest( getId(), result.getResult(1) );
|
|
}
|
|
}
|
|
};
|
|
|
|
EXPOSE_SCRIPT( SubFst050 ); |