mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-03 17:27:47 +00:00
151 lines
4.5 KiB
C++
151 lines
4.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/BNpc.h>
|
||
|
#include <Actor/Player.h>
|
||
|
#include <ScriptObject.h>
|
||
|
#include <Service.h>
|
||
|
|
||
|
// Quest Script: GaiUsb914_00937
|
||
|
// Quest Name: The Best Inventions
|
||
|
// Quest ID: 66473
|
||
|
// Start NPC: 1006461
|
||
|
// End NPC: 1006461
|
||
|
|
||
|
using namespace Sapphire;
|
||
|
|
||
|
class GaiUsb914 : public Sapphire::ScriptAPI::QuestScript
|
||
|
{
|
||
|
private:
|
||
|
// Basic quest information
|
||
|
// Quest vars / flags used
|
||
|
// UI8AL
|
||
|
// UI8BH
|
||
|
|
||
|
/// Countable Num: 0 Seq: 1 Event: 9 Listener: 132
|
||
|
/// Countable Num: 0 Seq: 255 Event: 1 Listener: 1006461
|
||
|
// 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 = 1006461;//Cid
|
||
|
static constexpr auto Enemy0 = 114; //Ice Sprite (INCORRECT: 132)
|
||
|
static constexpr auto Item0 = 2000732; //Ice Sprit Core (UI8BH)
|
||
|
static constexpr auto LocAction1 = 990;
|
||
|
static constexpr auto LocAction2 = 80;
|
||
|
static constexpr auto LocAction3 = 81;
|
||
|
static constexpr auto LocAction4 = 82;
|
||
|
static constexpr auto LocActor0 = 1007641;
|
||
|
static constexpr auto LocActor1 = 1007642;
|
||
|
static constexpr auto LocActor2 = 1006902;
|
||
|
static constexpr auto LocActor3 = 1004089;
|
||
|
static constexpr auto LocEobj1 = 2002560;
|
||
|
static constexpr auto LocPosEobj1 = 4329618;
|
||
|
|
||
|
public:
|
||
|
GaiUsb914() : Sapphire::ScriptAPI::QuestScript( 66473 ){};
|
||
|
~GaiUsb914() = 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 )
|
||
|
Scene00002( quest, player );
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void onBNpcKill( World::Quest& quest, Entity::BNpc& bnpc, Entity::Player& player ) override
|
||
|
{
|
||
|
switch( bnpc.getBNpcNameId() )
|
||
|
{
|
||
|
case Enemy0:
|
||
|
{
|
||
|
quest.setUI8BH( quest.getUI8BH() + 1 );
|
||
|
eventMgr().sendEventNotice( player, getId(), 0, 2, quest.getUI8BH(), 6 );
|
||
|
|
||
|
if( quest.getUI8BH() >= 6 )
|
||
|
quest.setSeq( SeqFinish );
|
||
|
|
||
|
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( &GaiUsb914::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( &GaiUsb914::Scene00001Return ) );
|
||
|
}
|
||
|
|
||
|
void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result )
|
||
|
{
|
||
|
quest.setSeq( Seq1 );
|
||
|
}
|
||
|
|
||
|
//////////////////////////////////////////////////////////////////////
|
||
|
|
||
|
void Scene00002( World::Quest& quest, Entity::Player& player )
|
||
|
{
|
||
|
eventMgr().playQuestScene( player, getId(), 2, HIDE_HOTBAR, bindSceneReturn( &GaiUsb914::Scene00002Return ) );
|
||
|
}
|
||
|
|
||
|
void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result )
|
||
|
{
|
||
|
if( result.getResult( 0 ) == 1 )
|
||
|
Scene00003( quest, player );
|
||
|
}
|
||
|
|
||
|
//////////////////////////////////////////////////////////////////////
|
||
|
|
||
|
void Scene00003( World::Quest& quest, Entity::Player& player )
|
||
|
{
|
||
|
eventMgr().playQuestScene( player, getId(), 3, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, bindSceneReturn( &GaiUsb914::Scene00003Return ) );
|
||
|
}
|
||
|
|
||
|
void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result )
|
||
|
{
|
||
|
|
||
|
if( result.getResult( 0 ) == 1 )
|
||
|
{
|
||
|
player.finishQuest( getId(), result.getResult( 1 ) );
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
EXPOSE_SCRIPT( GaiUsb914 );
|