1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-06-07 16:47:44 +00:00

Scripts/Quests

style changes
This commit is contained in:
AussieGlenn 2019-02-03 09:48:04 +10:00
parent 702f81ca3b
commit f19032f482
2 changed files with 146 additions and 1 deletions

View file

@ -69,7 +69,7 @@ public:
} }
} }
void onBNpcKill(uint32_t npcId, Entity::Player& player) override void onBNpcKill( uint32_t npcId, Entity::Player& player ) override
{ {
if (npcId != Enemy0) if (npcId != Enemy0)
return; return;

View file

@ -0,0 +1,145 @@
#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 Sapphire::ScriptAPI::EventScript
{
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 ) );
<<<<<<< HEAD
if ( actor == Actor0 )
=======
if( actor == Actor0 )
>>>>>>> 4229dec73d4117d8e163dbea6950566ce5c54cc6
{
Scene00000( player );
}
else if ( actor == Actor1 )
{
Scene00002( player );
}
else if ( actor == Actor2 )
{
Scene00003( player );
}
}
void onBNpcKill(uint32_t npcId, Entity::Player& player) override
{
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 );
else
{
player.sendQuestMessage( getId(), 1, 2, currentKC, 4 );
}
}
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(), 1 );
});
}
void Scene00001( Entity::Player& player )
{
player.playScene( getId(), 0, HIDE_HOTBAR,
[&](Entity::Player& player, const Event::SceneResult& result)
{
});
}
void Scene00002( Entity::Player& player )
{
player.playScene( getId(), 0, HIDE_HOTBAR,
[&](Entity::Player& player, const Event::SceneResult& result)
{
player.updateQuest( getId(), 2 );
});
}
void Scene00003( Entity::Player& player )
{
player.playScene( getId(), 0, HIDE_HOTBAR,
[&](Entity::Player& player, const Event::SceneResult& result)
{
if (result.param2 == 1)
Scene00004( player );
});
}
void Scene00004( Entity::Player& player )
{
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() );
}
});
}
};