2019-02-03 07:46:23 +10:00
|
|
|
#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
|
|
|
|
|
2019-02-03 08:33:48 +10:00
|
|
|
class SubSea012 :
|
|
|
|
public Sapphire::ScriptAPI::EventScript
|
2019-02-03 07:46:23 +10:00
|
|
|
{
|
2019-02-03 08:33:48 +10:00
|
|
|
private:
|
|
|
|
|
|
|
|
// Basic quest information
|
|
|
|
// Quest vars / flags used
|
|
|
|
// GetQuestUI8AL
|
|
|
|
// GetQuestUI8BH
|
|
|
|
|
|
|
|
enum Sequence :
|
|
|
|
uint8_t
|
|
|
|
{
|
|
|
|
Seq0 = 0,
|
|
|
|
Seq1 = 1,
|
|
|
|
Seq2 = 2,
|
|
|
|
SeqFinish = 255,
|
|
|
|
};
|
|
|
|
|
|
|
|
// Quest rewards
|
|
|
|
static constexpr auto RewardExpFactor = 100;
|
|
|
|
// 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 = 563;
|
|
|
|
static constexpr auto Item0 = 2000454;
|
|
|
|
|
|
|
|
public:
|
|
|
|
SubSea012() :
|
|
|
|
Sapphire::ScriptAPI::EventScript(65658)
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
|
|
|
~SubSea012()
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
|
|
|
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)
|
2019-02-03 07:46:23 +10:00
|
|
|
{
|
2019-02-03 08:33:48 +10:00
|
|
|
Scene00000(player);
|
2019-02-03 07:46:23 +10:00
|
|
|
}
|
2019-02-03 08:33:48 +10:00
|
|
|
else if (actor == Actor1)
|
2019-02-03 07:46:23 +10:00
|
|
|
{
|
2019-02-03 08:33:48 +10:00
|
|
|
Scene00002(player);
|
2019-02-03 07:46:23 +10:00
|
|
|
}
|
2019-02-03 08:33:48 +10:00
|
|
|
else if (actor == Actor2)
|
2019-02-03 07:46:23 +10:00
|
|
|
{
|
2019-02-03 08:33:48 +10:00
|
|
|
Scene00003(player);
|
2019-02-03 07:46:23 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-03 08:33:48 +10:00
|
|
|
void onBNpcKill(uint32_t npcId, Entity::Player& player) override
|
2019-02-03 07:46:23 +10:00
|
|
|
{
|
2019-02-03 08:33:48 +10:00
|
|
|
if (npcId != Enemy0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
auto currentKC = player.getQuestUI8AL(getId()) + 1;
|
|
|
|
player.setQuestUI8BH(getId(), currentKC);
|
|
|
|
player.setQuestUI8AL(getId(), currentKC);
|
|
|
|
if (currentKC >= 4)
|
|
|
|
player.updateQuest(getId(), SeqFinish);
|
2019-02-03 07:46:23 +10:00
|
|
|
else
|
|
|
|
{
|
2019-02-03 08:33:48 +10:00
|
|
|
player.sendQuestMessage(getId(), 1, 2, currentKC, 4);
|
2019-02-03 07:46:23 +10:00
|
|
|
}
|
2019-02-03 08:33:48 +10:00
|
|
|
}
|
2019-02-03 07:46:23 +10:00
|
|
|
|
2019-02-03 08:33:48 +10:00
|
|
|
private:
|
2019-02-03 07:46:23 +10:00
|
|
|
|
2019-02-03 08:33:48 +10:00
|
|
|
void Scene00000(Entity::Player& player)
|
|
|
|
{
|
|
|
|
player.playScene(getId(), 0, HIDE_HOTBAR,
|
|
|
|
[&](Entity::Player& player, const Event::SceneResult& result)
|
2019-02-03 07:46:23 +10:00
|
|
|
{
|
2019-02-03 08:33:48 +10:00
|
|
|
if (result.param2 == 1)
|
|
|
|
player.updateQuest(getId(), 1);
|
|
|
|
});
|
2019-02-03 07:46:23 +10:00
|
|
|
}
|
|
|
|
|
2019-02-03 08:33:48 +10:00
|
|
|
void Scene00001(Entity::Player& player)
|
2019-02-03 07:46:23 +10:00
|
|
|
{
|
2019-02-03 08:33:48 +10:00
|
|
|
player.playScene(getId(), 0, HIDE_HOTBAR,
|
|
|
|
[&](Entity::Player& player, const Event::SceneResult& result)
|
|
|
|
{
|
|
|
|
});
|
2019-02-03 07:46:23 +10:00
|
|
|
}
|
|
|
|
|
2019-02-03 08:33:48 +10:00
|
|
|
void Scene00002(Entity::Player& player)
|
2019-02-03 07:46:23 +10:00
|
|
|
{
|
2019-02-03 08:33:48 +10:00
|
|
|
player.playScene(getId(), 0, HIDE_HOTBAR,
|
|
|
|
[&](Entity::Player& player, const Event::SceneResult& result)
|
|
|
|
{
|
|
|
|
player.updateQuest(getId(), 2);
|
|
|
|
});
|
2019-02-03 07:46:23 +10:00
|
|
|
}
|
|
|
|
|
2019-02-03 08:33:48 +10:00
|
|
|
void Scene00003(Entity::Player& player)
|
2019-02-03 07:46:23 +10:00
|
|
|
{
|
2019-02-03 08:33:48 +10:00
|
|
|
player.playScene(getId(), 0, HIDE_HOTBAR,
|
|
|
|
[&](Entity::Player& player, const Event::SceneResult& result)
|
|
|
|
{
|
|
|
|
if (result.param2 == 1)
|
|
|
|
Scene00004(player);
|
|
|
|
});
|
2019-02-03 07:46:23 +10:00
|
|
|
}
|
|
|
|
|
2019-02-03 08:33:48 +10:00
|
|
|
void Scene00004(Entity::Player& player)
|
2019-02-03 07:46:23 +10:00
|
|
|
{
|
2019-02-03 08:33:48 +10:00
|
|
|
player.playScene(getId(), 0, HIDE_HOTBAR,
|
|
|
|
[&](Entity::Player& player, const Event::SceneResult& result)
|
|
|
|
{
|
|
|
|
if (result.param2 == 1)
|
|
|
|
if (player.giveQuestRewards(getId(), 0))
|
|
|
|
{
|
|
|
|
player.finishQuest(getId());
|
|
|
|
}
|
|
|
|
});
|
2019-02-03 07:46:23 +10:00
|
|
|
}
|
|
|
|
|
2019-02-03 08:33:48 +10:00
|
|
|
};
|
2019-02-03 07:46:23 +10:00
|
|
|
|