mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 14:57:44 +00:00
[ Subquests ] SubFst002, SubFst008, SubFst011, SubFst014 adjust - SubFst008 and SubFst021 add
This commit is contained in:
parent
5f99c481d1
commit
acc2c18c95
6 changed files with 262 additions and 38 deletions
|
@ -43,7 +43,7 @@ private:
|
||||||
{
|
{
|
||||||
if( result.param2 == 1 ) // finish quest
|
if( result.param2 == 1 ) // finish quest
|
||||||
{
|
{
|
||||||
if( player.giveQuestRewards( getId(), 0 ) )
|
if( player.giveQuestRewards( getId(), result.param3 ) )
|
||||||
player.finishQuest( getId() );
|
player.finishQuest( getId() );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
134
src/scripts/quest/subquest/gridania/SubFst007.cpp
Normal file
134
src/scripts/quest/subquest/gridania/SubFst007.cpp
Normal file
|
@ -0,0 +1,134 @@
|
||||||
|
#include <Actor/Player.h>
|
||||||
|
#include "Manager/EventMgr.h"
|
||||||
|
#include <ScriptObject.h>
|
||||||
|
#include <Service.h>
|
||||||
|
|
||||||
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
// Quest Script: SubFst007_00031
|
||||||
|
// Quest Name: Essential Oil
|
||||||
|
// Quest ID: 65567
|
||||||
|
// Start NPC: 1000705
|
||||||
|
// End NPC: 1000705
|
||||||
|
|
||||||
|
class SubFst007 : public Sapphire::ScriptAPI::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,
|
||||||
|
SeqFinish = 255,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Quest rewards
|
||||||
|
static constexpr auto RewardExpFactor = 100;
|
||||||
|
uint32_t RewardItemOptional[3] = { 3530, 3531, 5823 };
|
||||||
|
uint32_t RewardItemOptionalCount[3] = { 1, 1, 3 };
|
||||||
|
|
||||||
|
// Entities found in the script data of the quest
|
||||||
|
static constexpr auto Actor0 = 1000705;
|
||||||
|
static constexpr auto Enemy0 = 49;
|
||||||
|
static constexpr auto Item0 = 2000098;
|
||||||
|
static constexpr auto Seq0Actor0 = 0;
|
||||||
|
static constexpr auto Seq2Actor0 = 1;
|
||||||
|
static constexpr auto Seq2Actor0Npctradeno = 99;
|
||||||
|
static constexpr auto Seq2Actor0Npctradeok = 100;
|
||||||
|
|
||||||
|
public:
|
||||||
|
SubFst007() : Sapphire::ScriptAPI::EventScript( 65567 ){};
|
||||||
|
~SubFst007(){};
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// Event Handlers
|
||||||
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
|
{
|
||||||
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast<uint32_t>( actorId ) );
|
||||||
|
|
||||||
|
if ( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||||
|
{
|
||||||
|
Scene00000( player );
|
||||||
|
}
|
||||||
|
if ( actor == Actor0 && player.getQuestSeq( getId() ) == SeqFinish )
|
||||||
|
{
|
||||||
|
Scene00001( player );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void onBNpcKill( uint32_t npcId, Entity::Player& player )
|
||||||
|
{
|
||||||
|
if ( npcId != Enemy0 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto currentKC = player.getQuestUI8AL( getId() );
|
||||||
|
|
||||||
|
if ( currentKC + 1 >= 6 )
|
||||||
|
{
|
||||||
|
player.setQuestUI8AL( getId(), currentKC + 1 );
|
||||||
|
player.setQuestUI8BH( getId(), currentKC + 1 );
|
||||||
|
player.sendQuestMessage( getId(), 0, 2, currentKC + 1, 6 );
|
||||||
|
player.updateQuest( getId(), SeqFinish );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.sendQuestMessage( getId(), 0, 2, currentKC + 1, 6 );
|
||||||
|
player.setQuestUI8AL( getId(), currentKC + 1 );
|
||||||
|
player.setQuestUI8BH( getId(), currentKC + 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// Available Scenes in this quest, not necessarly all are used
|
||||||
|
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(), Seq1 );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scene00001( Entity::Player& player )
|
||||||
|
{
|
||||||
|
player.playScene( getId(), 1, HIDE_HOTBAR,
|
||||||
|
[&]( Entity::Player& player, const Event::SceneResult& result )
|
||||||
|
{
|
||||||
|
result.param2 == 1 ? Scene00100( player ) : Scene00099( player );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scene00099( Entity::Player& player )
|
||||||
|
{
|
||||||
|
player.playScene( getId(), 99, HIDE_HOTBAR,
|
||||||
|
[&]( Entity::Player& player, const Event::SceneResult& result )
|
||||||
|
{
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scene00100( Entity::Player& player )
|
||||||
|
{
|
||||||
|
player.playScene( getId(), 100, HIDE_HOTBAR,
|
||||||
|
[&]( Entity::Player& player, const Event::SceneResult& result )
|
||||||
|
{
|
||||||
|
if ( result.param2 == 1 )
|
||||||
|
{
|
||||||
|
if ( player.giveQuestRewards( getId(), result.param3 ) )
|
||||||
|
{
|
||||||
|
player.finishQuest( getId() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
EXPOSE_SCRIPT(SubFst007);
|
|
@ -93,6 +93,7 @@ private:
|
||||||
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
||||||
{
|
{
|
||||||
player.setQuestUI8BH( getId(), 1 );
|
player.setQuestUI8BH( getId(), 1 );
|
||||||
|
player.sendQuestMessage( getId(), 0, 0, 0, 0 );
|
||||||
player.updateQuest( getId(), SeqFinish );
|
player.updateQuest( getId(), SeqFinish );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
@ -102,14 +103,7 @@ private:
|
||||||
player.playScene( getId(), 2, HIDE_HOTBAR,
|
player.playScene( getId(), 2, HIDE_HOTBAR,
|
||||||
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
||||||
{
|
{
|
||||||
if( result.param2 == 1 )
|
result.param2 == 1 ? Scene00100( player ) : Scene00099( player );
|
||||||
{
|
|
||||||
Scene00100( player );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Scene00099( player );
|
|
||||||
}
|
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +125,7 @@ private:
|
||||||
{
|
{
|
||||||
if( player.giveQuestRewards( getId(), 0 ) )
|
if( player.giveQuestRewards( getId(), 0 ) )
|
||||||
{
|
{
|
||||||
player.setQuestUI8BH( getId(), 0 );
|
player.setQuestUI8BH( getId(), result.param3 );
|
||||||
player.finishQuest( getId() );
|
player.finishQuest( getId() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,6 @@ using namespace Sapphire;
|
||||||
// Start NPC: 1000195
|
// Start NPC: 1000195
|
||||||
// End NPC: 1000195
|
// End NPC: 1000195
|
||||||
|
|
||||||
//NEED TEST KILLCREDIT
|
|
||||||
|
|
||||||
class SubFst011 :
|
class SubFst011 :
|
||||||
public Sapphire::ScriptAPI::EventScript
|
public Sapphire::ScriptAPI::EventScript
|
||||||
{
|
{
|
||||||
|
@ -67,15 +65,12 @@ public:
|
||||||
if( npcId != Enemy0 )
|
if( npcId != Enemy0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto currentKC = player.getQuestUI8AL( getId() ) + 1;
|
auto currentKC = player.getQuestUI8AL( getId() );
|
||||||
|
player.setQuestUI8AL( getId(), currentKC + 1 );
|
||||||
|
player.sendQuestMessage( getId(), 0, 2, currentKC + 1, 6 );
|
||||||
|
|
||||||
if( currentKC >= 6 )
|
if( currentKC + 1 >= 6 )
|
||||||
player.updateQuest( getId(), SeqFinish );
|
player.updateQuest( getId(), SeqFinish );
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setQuestUI8AL( getId(), currentKC );
|
|
||||||
player.sendQuestMessage( getId(), 0, 2, currentKC, 6 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -99,7 +94,7 @@ private:
|
||||||
{
|
{
|
||||||
if( result.param2 == 1 )
|
if( result.param2 == 1 )
|
||||||
{
|
{
|
||||||
if( player.giveQuestRewards( getId(), 0 ) )
|
if( player.giveQuestRewards( getId(), result.param3 ) )
|
||||||
{
|
{
|
||||||
player.finishQuest( getId() );
|
player.finishQuest( getId() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ public:
|
||||||
{
|
{
|
||||||
Scene00000( player );
|
Scene00000( player );
|
||||||
}
|
}
|
||||||
else if( actor == Actor0 )
|
else if( actor == Actor0 && player.getQuestSeq( getId() ) == SeqFinish )
|
||||||
{
|
{
|
||||||
Scene00007( player );
|
Scene00007( player );
|
||||||
}
|
}
|
||||||
|
@ -131,15 +131,13 @@ private:
|
||||||
auto currentCC = player.getQuestUI8AL( getId() );
|
auto currentCC = player.getQuestUI8AL( getId() );
|
||||||
|
|
||||||
player.sendQuestMessage( getId(), 0, 2, currentCC + 1, 6 );
|
player.sendQuestMessage( getId(), 0, 2, currentCC + 1, 6 );
|
||||||
|
player.setQuestUI8AL( getId(), currentCC + 1 );
|
||||||
|
player.setQuestUI8BH( getId(), currentCC + 1 );
|
||||||
|
|
||||||
if ( currentCC + 1 >= 6 )
|
if ( currentCC + 1 >= 6 )
|
||||||
{
|
{
|
||||||
player.updateQuest( getId(), SeqFinish );
|
player.updateQuest( getId(), SeqFinish );
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setQuestUI8AL( getId(), currentCC + 1 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene00000( Entity::Player& player )
|
void Scene00000( Entity::Player& player )
|
||||||
|
@ -215,10 +213,6 @@ private:
|
||||||
{
|
{
|
||||||
Scene00088( player );
|
Scene00088( player );
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Scene00087( player );
|
|
||||||
}
|
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,7 +221,6 @@ private:
|
||||||
player.playScene( getId(), 87, HIDE_HOTBAR,
|
player.playScene( getId(), 87, HIDE_HOTBAR,
|
||||||
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
||||||
{
|
{
|
||||||
player.playScene( getId(), 87, 0, 0, 0 );
|
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,15 +228,11 @@ private:
|
||||||
{
|
{
|
||||||
player.playScene( getId(), 88, HIDE_HOTBAR,
|
player.playScene( getId(), 88, HIDE_HOTBAR,
|
||||||
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
||||||
{
|
|
||||||
if( result.param2 == 1 )
|
|
||||||
{
|
{
|
||||||
if ( player.giveQuestRewards( getId(), 0 ) )
|
if ( player.giveQuestRewards( getId(), 0 ) )
|
||||||
{
|
{
|
||||||
player.setQuestUI8AL( getId(), 0 );
|
|
||||||
player.finishQuest( getId() );
|
player.finishQuest( getId() );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
112
src/scripts/quest/subquest/gridania/SubFst021.cpp
Normal file
112
src/scripts/quest/subquest/gridania/SubFst021.cpp
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
// 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 <Actor/Player.h>
|
||||||
|
#include "Manager/EventMgr.h"
|
||||||
|
#include <ScriptObject.h>
|
||||||
|
#include <Service.h>
|
||||||
|
|
||||||
|
// Quest Script: SubFst021_00095
|
||||||
|
// Quest Name: Hematophagic Harassment
|
||||||
|
// Quest ID: 65631
|
||||||
|
// Start NPC: 1000640
|
||||||
|
// End NPC: 1000640
|
||||||
|
|
||||||
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
class SubFst021 : public Sapphire::ScriptAPI::EventScript
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
// Basic quest information
|
||||||
|
// Quest vars / flags used
|
||||||
|
// GetQuestUI8AL
|
||||||
|
|
||||||
|
// 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 = 1000640;
|
||||||
|
static constexpr auto Enemy0 = 118; //136; <- WRONG INFO
|
||||||
|
|
||||||
|
public:
|
||||||
|
SubFst021() : Sapphire::ScriptAPI::EventScript( 65631 ){};
|
||||||
|
~SubFst021(){};
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// Event Handlers
|
||||||
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
|
{
|
||||||
|
auto& eventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
|
auto actor = eventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
|
if ( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||||
|
Scene00000( player );
|
||||||
|
if ( actor == Actor0 && player.getQuestSeq( getId() ) == SeqFinish )
|
||||||
|
Scene00002( player );
|
||||||
|
}
|
||||||
|
|
||||||
|
void onBNpcKill( uint32_t npcId, Entity::Player& player ) override
|
||||||
|
{
|
||||||
|
if ( npcId != Enemy0 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto credit = player.getQuestUI8AL( getId() );
|
||||||
|
if ( credit + 1 >= 6 )
|
||||||
|
{
|
||||||
|
player.setQuestUI8AL( getId(), credit + 1 );
|
||||||
|
player.sendQuestMessage( getId(), 0, 2, credit + 1, 6 );
|
||||||
|
player.updateQuest( getId(), SeqFinish );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.setQuestUI8AL( getId(), credit + 1 );
|
||||||
|
player.sendQuestMessage( getId(), 0, 2, credit + 1, 6 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// Available Scenes in this quest, not necessarly all are used
|
||||||
|
void Scene00000( Entity::Player& player )
|
||||||
|
{
|
||||||
|
player.playScene( getId(), 0, HIDE_HOTBAR,
|
||||||
|
[&]( Entity::Player& player, const Event::SceneResult& result )
|
||||||
|
{
|
||||||
|
if ( result.param2 == 1 )
|
||||||
|
{
|
||||||
|
Scene00001( player );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scene00001( Entity::Player& player )
|
||||||
|
{
|
||||||
|
player.playScene( getId(), 1, HIDE_HOTBAR,
|
||||||
|
[&]( Entity::Player& player, const Event::SceneResult& result )
|
||||||
|
{
|
||||||
|
player.updateQuest( getId(), Seq1 );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scene00002( Entity::Player& player )
|
||||||
|
{
|
||||||
|
player.playScene( getId(), 2, HIDE_HOTBAR,
|
||||||
|
[&]( Entity::Player& player, const Event::SceneResult& result )
|
||||||
|
{
|
||||||
|
if ( result.param2 == 1 )
|
||||||
|
if ( player.giveQuestRewards( getId(), result.param3 ) )
|
||||||
|
{
|
||||||
|
player.finishQuest( getId() );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
EXPOSE_SCRIPT( SubFst021 );
|
Loading…
Add table
Reference in a new issue