1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-06-07 08:37:45 +00:00

Scripts/Quest

Add quest Subsea0012 (Quest Glory Days)
This commit is contained in:
AussieGlenn 2019-02-03 07:46:23 +10:00
parent 558ae87568
commit 332ac9e976
2 changed files with 159 additions and 0 deletions

View file

@ -28,6 +28,7 @@
#include "subquest/gridania/SubFst041.cpp"
#include "subquest/gridania/SubFst045.cpp"
#include "subquest/limsa/SubSea001.cpp"
#include "subquest/limsa/SubSea012.cpp"
#include "subquest/uldah/SubWil000.cpp"
#include "subquest/uldah/SubWil001.cpp"
#include "subquest/uldah/SubWil002.cpp"
@ -72,6 +73,7 @@ const Sapphire::ScriptAPI::ScriptObject* ptrs[] =
static_cast< Sapphire::ScriptAPI::ScriptObject* >( new SubFst041 ),
static_cast< Sapphire::ScriptAPI::ScriptObject* >( new SubFst045 ),
static_cast< Sapphire::ScriptAPI::ScriptObject* >( new SubSea001 ),
static_cast< Sapphire::ScriptAPI::ScriptObject* >( new SubSea012 ),
static_cast< Sapphire::ScriptAPI::ScriptObject* >( new SubWil000 ),
static_cast< Sapphire::ScriptAPI::ScriptObject* >( new SubWil001 ),
static_cast< Sapphire::ScriptAPI::ScriptObject* >( new SubWil002 ),

View file

@ -0,0 +1,157 @@
#include <Script/NativeScriptApi.h>
#include <Actor/Player.h>
#include "Manager/EventMgr.h"
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
// Quest Script: SubSea012_00122
// Quest Name: Glory Days
// Quest ID: 65658
// Start NPC: 1003601
// End NPC: 1000972
class SubSea012 : public EventScript
{
private:
// Basic quest information
// Quest vars / flags used
// GetQuestUI8AL
// GetQuestUI8BH
// 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,
Seq2 = 2,
SeqFinish = 255,
};
// Quest rewards
static constexpr auto RewardExpFactor = 100;
static constexpr auto RewardItem[] = { 0, 0, 0, 0, 0, 0 };
static constexpr auto RewardItemCount[] = { 0, 0, 0, 0, 0, 0 };
static constexpr auto RewardItemOptional[] = { 2999, 3010, 5823, 0, 0 };
static constexpr auto RewardItemOptionalCount[] = { 1, 1, 3, 0, 0 };
// Entities found in the script data of the quest
static constexpr auto Actor0 = 1003601;
static constexpr auto Actor1 = 1001024;
static constexpr auto Actor2 = 1000972;
static constexpr auto Enemy0 = 324;
static constexpr auto Item0 = 2000454;
public:
SubSea012() : EventScript( 65658 ){};
~SubSea012(){};
//////////////////////////////////////////////////////////////////////
// Event Handlers
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 )
{
Scene00000( player );
}
else if( actor == Actor1 )
{
Scene00003( player );
}
else if( actor == Actor2 )
{
Scene00004( player );
}
}
void onMobKill( Entity::Player& player, uint64_t npcId )
{
if( npcId != Enemy0 )
return;
auto currentKC = player.getQuestUI8AL( getId() ) + 1;
if( currentKC >= 4 )
player.updateQuest( getId(), SeqFinish );
else
{
player.setQuestUI8AL( getId(), currentKC );
player.sendQuestMessage( getId(), 0, 2, currentKC, 4 );
}
}
private:
//////////////////////////////////////////////////////////////////////
// Available Scenes in this quest, not necessarly all are used
void checkQuestCompletion( Entity::Player& player )
{
auto currentCC = player.getQuestUI8BH( getId() );
player.sendQuestMessage( getId(), X, Y, currentCC + 1, Z );
if( currentCC + 1 >= Z )
{
player.updateQuest( getId(), SeqFinish );
player.setQuestUI8BH( getId(), currentCC + 1 );
player.setQuestUI8AL( getId(), currentCC + 1 );
}
else
{
player.setQuestUI8BH( getId(), currentCC + 1 );
player.setQuestUI8AL( getId(), currentCC + 1 );
}
}
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(), 1 );
} );
}
void Scene00001( Entity::Player& player )
{
player.playScene( getId(), 1, HIDE_HOTBAR,
[ & ]( Entity::Player& player, const Event::SceneResult& result )
{
} );
}
void Scene00002( Entity::Player& player )
{
player.playScene( getId(), 2, HIDE_HOTBAR,
[ & ]( Entity::Player& player, const Event::SceneResult& result )
{
} );
}
void Scene00003( Entity::Player& player )
{
player.playScene( getId(), 3, HIDE_HOTBAR,
[ & ]( Entity::Player& player, const Event::SceneResult& result )
{
if( result.param2 == 1 )
player.updateQuest( getId(), 2 );
} );
}
void Scene00004( Entity::Player& player )
{
player.playScene( getId(), 4, HIDE_HOTBAR,
[ & ]( Entity::Player& player, const Event::SceneResult& result )
{
if( result.param2 == 1 )
if( player.giveQuestRewards( getId(), 0 ) )
player.finishQuest( getId() );
}
} );
}
};