mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-25 11:07:45 +00:00
Merge remote-tracking branch 'remotes/origin/develop' into develop_5.25
This commit is contained in:
commit
d084e1e9d4
21 changed files with 1208 additions and 91 deletions
|
@ -165,6 +165,7 @@ namespace Sapphire::Network::Packets
|
||||||
|
|
||||||
// nb: see #565 on github
|
// nb: see #565 on github
|
||||||
UpdateRetainerItemSalePrice = 0x019F, // updated 5.0
|
UpdateRetainerItemSalePrice = 0x019F, // updated 5.0
|
||||||
|
RetainerInformation = 0x0169, // updated 5.25
|
||||||
|
|
||||||
SetLevelSync = 0x1186, // not updated for 4.4, not sure what it is anymore
|
SetLevelSync = 0x1186, // not updated for 4.4, not sure what it is anymore
|
||||||
|
|
||||||
|
|
|
@ -2021,6 +2021,25 @@ namespace Sapphire::Network::Packets::Server
|
||||||
|
|
||||||
char otherName[32];
|
char otherName[32];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct FFXIVIpcRetainerInformation : FFXIVIpcBasePacket< RetainerInformation >
|
||||||
|
{
|
||||||
|
uint8_t unknown0[8];
|
||||||
|
uint64_t retainerId;
|
||||||
|
uint8_t hireOrder;
|
||||||
|
uint8_t itemCount;
|
||||||
|
uint8_t unknown5[2];
|
||||||
|
uint32_t gil;
|
||||||
|
uint8_t sellingCount;
|
||||||
|
uint8_t cityId;
|
||||||
|
uint8_t classJob;
|
||||||
|
uint8_t level;
|
||||||
|
uint8_t unknown11[4];
|
||||||
|
uint32_t retainerTask;
|
||||||
|
uint32_t retainerTaskComplete;
|
||||||
|
uint8_t unknown14;
|
||||||
|
char retainerName[20];
|
||||||
|
};
|
||||||
|
|
||||||
struct FFXIVIpcCharaVisualEffect : FFXIVIpcBasePacket< CharaVisualEffect >
|
struct FFXIVIpcCharaVisualEffect : FFXIVIpcBasePacket< CharaVisualEffect >
|
||||||
{
|
{
|
||||||
|
|
|
@ -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 )
|
||||||
|
@ -211,14 +209,10 @@ private:
|
||||||
player.playScene( getId(), 7, HIDE_HOTBAR,
|
player.playScene( getId(), 7, HIDE_HOTBAR,
|
||||||
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
||||||
{
|
{
|
||||||
if( result.param2 == 1 )
|
if ( result.param2 == 1 )
|
||||||
{
|
{
|
||||||
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 );
|
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,13 +229,9 @@ 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.finishQuest( getId() );
|
||||||
{
|
|
||||||
player.setQuestUI8AL( getId(), 0 );
|
|
||||||
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 );
|
134
src/scripts/quest/subquest/gridania/SubFst025.cpp
Normal file
134
src/scripts/quest/subquest/gridania/SubFst025.cpp
Normal file
|
@ -0,0 +1,134 @@
|
||||||
|
// 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: SubFst025_00103
|
||||||
|
// Quest Name: Death to the Bean Thieves
|
||||||
|
// Quest ID: 65639
|
||||||
|
// Start NPC: 1000627
|
||||||
|
// End NPC: 1000656
|
||||||
|
|
||||||
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
class SubFst025 : 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,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Entities found in the script data of the quest
|
||||||
|
static constexpr auto Actor0 = 1000627;
|
||||||
|
static constexpr auto Actor1 = 1000656;
|
||||||
|
static constexpr auto Enemy0 = 5;
|
||||||
|
static constexpr auto Item0 = 2000075;
|
||||||
|
|
||||||
|
public:
|
||||||
|
SubFst025() : Sapphire::ScriptAPI::EventScript( 65639 ){};
|
||||||
|
~SubFst025() {};
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// 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 == Actor1 && 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.sendQuestMessage( getId(), 0, 2, credit + 1, 6 );
|
||||||
|
player.setQuestUI8BH( getId(), credit + 1 );
|
||||||
|
player.updateQuest( getId(), SeqFinish );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.setQuestUI8AL( getId(), credit + 1 );
|
||||||
|
player.setQuestUI8BH( 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 )
|
||||||
|
Scene00003( player );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scene00003( Entity::Player& player )
|
||||||
|
{
|
||||||
|
player.playScene( getId(), 3, HIDE_HOTBAR,
|
||||||
|
[&]( Entity::Player& player, const Event::SceneResult& result )
|
||||||
|
{
|
||||||
|
if ( result.param2 == 1 )
|
||||||
|
if ( player.giveQuestRewards( getId(), result.param3 ) )
|
||||||
|
{
|
||||||
|
player.finishQuest( getId() );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scene00004( Entity::Player& player )
|
||||||
|
{
|
||||||
|
player.playScene( getId(), 4, HIDE_HOTBAR,
|
||||||
|
[&]( Entity::Player& player, const Event::SceneResult& result )
|
||||||
|
{
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
EXPOSE_SCRIPT( SubFst025 );
|
|
@ -11,8 +11,6 @@ using namespace Sapphire;
|
||||||
// Start NPC: 1000629
|
// Start NPC: 1000629
|
||||||
// End NPC: 1000629
|
// End NPC: 1000629
|
||||||
|
|
||||||
//NEED TEST KILLCREDIT
|
|
||||||
|
|
||||||
class SubFst026 :
|
class SubFst026 :
|
||||||
public Sapphire::ScriptAPI::EventScript
|
public Sapphire::ScriptAPI::EventScript
|
||||||
{
|
{
|
||||||
|
@ -55,28 +53,27 @@ public:
|
||||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||||
{
|
|
||||||
Scene00000( player );
|
Scene00000( player );
|
||||||
}
|
|
||||||
else if( actor == Actor0 && player.getQuestSeq( getId() ) == SeqFinish )
|
else if( actor == Actor0 && player.getQuestSeq( getId() ) == SeqFinish )
|
||||||
{
|
|
||||||
Scene00001( player );
|
Scene00001( player );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void onMobKill( Entity::Player& player, uint64_t npcId )
|
void onBNpcKill( uint32_t npcId, Entity::Player& player ) override
|
||||||
{
|
{
|
||||||
if( npcId != Enemy0 )
|
if( npcId != Enemy0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto currentKC = player.getQuestUI8AL( getId() ) + 1;
|
auto currentKC = player.getQuestUI8AL( getId() );
|
||||||
|
|
||||||
if( currentKC >= 6 )
|
if ( currentKC + 1 >= 6 )
|
||||||
|
{
|
||||||
|
player.sendQuestMessage( getId(), 0, 2, currentKC + 1, 6 );
|
||||||
player.updateQuest( getId(), SeqFinish );
|
player.updateQuest( getId(), SeqFinish );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.setQuestUI8AL( getId(), currentKC );
|
player.setQuestUI8AL( getId(), currentKC + 1 );
|
||||||
player.sendQuestMessage( getId(), 0, 2, currentKC, 6 );
|
player.sendQuestMessage( getId(), 0, 2, currentKC + 1, 6 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
146
src/scripts/quest/subquest/gridania/SubFst037.cpp
Normal file
146
src/scripts/quest/subquest/gridania/SubFst037.cpp
Normal file
|
@ -0,0 +1,146 @@
|
||||||
|
// 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: SubFst037_00174
|
||||||
|
// Quest Name: No Quarter Given
|
||||||
|
// Quest ID: 65710
|
||||||
|
// Start NPC: 1000612
|
||||||
|
// End NPC: 1000612
|
||||||
|
|
||||||
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
class SubFst037 : public Sapphire::ScriptAPI::EventScript
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
// Basic quest information
|
||||||
|
// Quest vars / flags used
|
||||||
|
// GetQuestUI8AL
|
||||||
|
// GetQuestUI8BH
|
||||||
|
// GetQuestUI8BL
|
||||||
|
|
||||||
|
// 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 = 1000612;
|
||||||
|
static constexpr auto Enemy0 = 192; //743; <- WRONG INFO
|
||||||
|
static constexpr auto Enemy1 = 193; //744; <- WRONG INFO
|
||||||
|
static constexpr auto Enemy2 = 194; //745; <- WRONG INFO
|
||||||
|
|
||||||
|
public:
|
||||||
|
SubFst037() : Sapphire::ScriptAPI::EventScript( 65710 ){};
|
||||||
|
~SubFst037() {};
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// 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
|
||||||
|
{
|
||||||
|
auto credit = 0;
|
||||||
|
|
||||||
|
switch( npcId )
|
||||||
|
{
|
||||||
|
case Enemy0:
|
||||||
|
{
|
||||||
|
credit = player.getQuestUI8AL( getId() );
|
||||||
|
|
||||||
|
player.setQuestUI8AL( getId() , credit + 1 );
|
||||||
|
if( credit + 1 <= 2 )
|
||||||
|
player.sendQuestMessage( getId() , 0, 2, credit + 1, 2 );
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Enemy1:
|
||||||
|
{
|
||||||
|
credit = player.getQuestUI8BH( getId() );
|
||||||
|
|
||||||
|
player.setQuestUI8BH( getId() , credit + 1 );
|
||||||
|
if ( credit + 1 <= 2 )
|
||||||
|
player.sendQuestMessage( getId() , 1, 2, credit + 1, 2 );
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Enemy2:
|
||||||
|
{
|
||||||
|
credit = player.getQuestUI8BL( getId() );
|
||||||
|
|
||||||
|
player.setQuestUI8BL( getId() , credit + 1 );
|
||||||
|
if ( credit + 1 <= 2 )
|
||||||
|
player.sendQuestMessage( getId() , 2, 2, credit + 1, 2 );
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
checkQuestCompletion( player );
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkQuestCompletion( Entity::Player& player )
|
||||||
|
{
|
||||||
|
auto credit192 = player.getQuestUI8AL( getId() );
|
||||||
|
auto credit193 = player.getQuestUI8BH( getId() );
|
||||||
|
auto credit194 = player.getQuestUI8BL( getId() );
|
||||||
|
|
||||||
|
if ( credit192 >= 2 && credit193 >= 2 && credit194 >= 2 )
|
||||||
|
player.updateQuest( getId() , SeqFinish );
|
||||||
|
}
|
||||||
|
|
||||||
|
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( SubFst037 );
|
|
@ -11,8 +11,6 @@ using namespace Sapphire;
|
||||||
// Start NPC: 1000432
|
// Start NPC: 1000432
|
||||||
// End NPC: 1000411
|
// End NPC: 1000411
|
||||||
|
|
||||||
//NEED TEST KILLCREDIT
|
|
||||||
|
|
||||||
class SubFst041 :
|
class SubFst041 :
|
||||||
public Sapphire::ScriptAPI::EventScript
|
public Sapphire::ScriptAPI::EventScript
|
||||||
{
|
{
|
||||||
|
@ -38,7 +36,7 @@ private:
|
||||||
// Entities found in the script data of the quest
|
// Entities found in the script data of the quest
|
||||||
static constexpr auto Actor0 = 1000432;
|
static constexpr auto Actor0 = 1000432;
|
||||||
static constexpr auto Actor1 = 1000411;
|
static constexpr auto Actor1 = 1000411;
|
||||||
static constexpr auto Enemy0 = 159;
|
static constexpr auto Enemy0 = 197; //159; WRONG INFO
|
||||||
static constexpr auto Item0 = 2000142;
|
static constexpr auto Item0 = 2000142;
|
||||||
static constexpr auto Seq0Actor0 = 0;
|
static constexpr auto Seq0Actor0 = 0;
|
||||||
static constexpr auto Seq2Actor1 = 1;
|
static constexpr auto Seq2Actor1 = 1;
|
||||||
|
@ -61,28 +59,30 @@ public:
|
||||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 )
|
if( actor == Actor0 )
|
||||||
{
|
|
||||||
Scene00000( player );
|
Scene00000( player );
|
||||||
}
|
|
||||||
if( actor == Actor1 )
|
if( actor == Actor1 )
|
||||||
{
|
|
||||||
Scene00001( player );
|
Scene00001( player );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void onMobKill( Entity::Player& player, uint64_t npcId )
|
void onBNpcKill( uint32_t npcId, Entity::Player& player ) override
|
||||||
{
|
{
|
||||||
if( npcId != Enemy0 )
|
if( npcId != Enemy0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto currentKC = player.getQuestUI8BH( getId() ) + 1;
|
auto currentKC = player.getQuestUI8BH( getId() );
|
||||||
|
|
||||||
if( currentKC >= 6 )
|
if ( currentKC + 1 >= 4 )
|
||||||
|
{
|
||||||
|
player.setQuestUI8AL( getId(), currentKC + 1 );
|
||||||
|
player.setQuestUI8BH( getId(), currentKC + 1 );
|
||||||
|
player.sendQuestMessage( getId(), 1, 0, 0, 0 );
|
||||||
player.updateQuest( getId(), SeqFinish );
|
player.updateQuest( getId(), SeqFinish );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.setQuestUI8BH( getId(), currentKC );
|
player.setQuestUI8AL( getId(), currentKC + 1 );
|
||||||
player.sendQuestMessage( getId(), 0, 2, currentKC, 6 );
|
player.setQuestUI8BH( getId(), currentKC + 1 );
|
||||||
|
player.sendQuestMessage( getId(), 0, 2, currentKC + 1, 4 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
100
src/scripts/quest/subquest/gridania/SubFst042.cpp
Normal file
100
src/scripts/quest/subquest/gridania/SubFst042.cpp
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
#include <Actor/Player.h>
|
||||||
|
#include <Manager/EventMgr.h>
|
||||||
|
#include <ScriptObject.h>
|
||||||
|
#include <Service.h>
|
||||||
|
|
||||||
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
// Quest Script: SubFst042_00198
|
||||||
|
// Quest Name: Butcher of Greentear
|
||||||
|
// Quest ID: 65734
|
||||||
|
// Start NPC: 1000685
|
||||||
|
// End NPC: 1000685
|
||||||
|
|
||||||
|
class SubFst042 : public Sapphire::ScriptAPI::EventScript
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
// Basic quest information
|
||||||
|
// Quest vars / flags used
|
||||||
|
// GetQuestUI8AL
|
||||||
|
|
||||||
|
enum Sequence : uint8_t
|
||||||
|
{
|
||||||
|
Seq0 = 0,
|
||||||
|
Seq1 = 1,
|
||||||
|
SeqFinish = 255,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Quest rewards
|
||||||
|
static constexpr auto RewardExpFactor = 200;
|
||||||
|
uint32_t RewardItemOptional[3] = { 4092, 4091, 5824 };
|
||||||
|
uint32_t RewardItemOptionalCount[3] = { 1, 1, 1 };
|
||||||
|
|
||||||
|
// Entities found in the script data of the quest
|
||||||
|
static constexpr auto Actor0 = 1000685;
|
||||||
|
static constexpr auto Enemy0 = 14;
|
||||||
|
static constexpr auto Seq0Actor0 = 0;
|
||||||
|
static constexpr auto Seq2Actor0 = 1;
|
||||||
|
|
||||||
|
public:
|
||||||
|
SubFst042() : Sapphire::ScriptAPI::EventScript( 65734 ){};
|
||||||
|
~SubFst042(){};
|
||||||
|
|
||||||
|
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 );
|
||||||
|
}
|
||||||
|
else if ( actor == Actor0 && player.getQuestSeq( getId() ) == SeqFinish )
|
||||||
|
{
|
||||||
|
Scene00001( player );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void onBNpcKill( uint32_t npcId, Entity::Player& player ) override
|
||||||
|
{
|
||||||
|
if ( npcId != Enemy0 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto currentKC = player.getQuestUI8AL( getId() ) + 1;
|
||||||
|
|
||||||
|
if ( currentKC >= 6 )
|
||||||
|
player.updateQuest( getId(), SeqFinish );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.setQuestUI8AL( getId(), currentKC );
|
||||||
|
player.sendQuestMessage( getId(), 0, 2, currentKC, 6 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 )
|
||||||
|
{
|
||||||
|
if ( result.param2 == 1 )
|
||||||
|
{
|
||||||
|
if ( player.giveQuestRewards( getId(), 0 ) )
|
||||||
|
player.finishQuest( getId() );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
EXPOSE_SCRIPT( SubFst042 );
|
184
src/scripts/quest/subquest/gridania/SubFst043.cpp
Normal file
184
src/scripts/quest/subquest/gridania/SubFst043.cpp
Normal file
|
@ -0,0 +1,184 @@
|
||||||
|
// 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: SubFst043_00199
|
||||||
|
// Quest Name: A Clear Sign
|
||||||
|
// Quest ID: 65735
|
||||||
|
// Start NPC: 1000172
|
||||||
|
// End NPC: 1000627
|
||||||
|
|
||||||
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
class SubFst043 : public Sapphire::ScriptAPI::EventScript
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
// Basic quest information
|
||||||
|
// Quest vars / flags used
|
||||||
|
// GetQuestBitFlag8
|
||||||
|
// 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 = 1000172;
|
||||||
|
static constexpr auto Actor1 = 1000627;
|
||||||
|
static constexpr auto Eobject0 = 2000143;
|
||||||
|
static constexpr auto Eobject1 = 2000144;
|
||||||
|
static constexpr auto EventActionProcessMiddle = 16;
|
||||||
|
static constexpr auto Seq0Actor0 = 0;
|
||||||
|
static constexpr auto Seq1Eobject0 = 1;
|
||||||
|
static constexpr auto Seq1Eobject0Eventactionno = 99;
|
||||||
|
static constexpr auto Seq1Eobject0Eventactionok = 100;
|
||||||
|
static constexpr auto Seq1Eobject1 = 2;
|
||||||
|
static constexpr auto Seq1Eobject1Eventactionno = 97;
|
||||||
|
static constexpr auto Seq1Eobject1Eventactionok = 98;
|
||||||
|
static constexpr auto Seq2Actor1 = 3;
|
||||||
|
|
||||||
|
public:
|
||||||
|
SubFst043() : Sapphire::ScriptAPI::EventScript( 65735 ){};
|
||||||
|
~SubFst043() {};
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// 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 )
|
||||||
|
Scene00000( player );
|
||||||
|
else if (actor == Actor1 && player.getQuestSeq( getId() ) == SeqFinish )
|
||||||
|
Scene00003( player );
|
||||||
|
else if ( actor == Eobject0 )
|
||||||
|
player.eventActionStart( getId(), EventActionProcessMiddle,
|
||||||
|
[&]( Entity::Player& player, uint32_t eventId, uint64_t additional )
|
||||||
|
{
|
||||||
|
Scene00001( player );
|
||||||
|
},
|
||||||
|
nullptr, eventId );
|
||||||
|
else if ( actor == Eobject1 )
|
||||||
|
player.eventActionStart( getId(), EventActionProcessMiddle,
|
||||||
|
[&]( Entity::Player& player, uint32_t eventId, uint64_t additional )
|
||||||
|
{
|
||||||
|
Scene00002( player );
|
||||||
|
},
|
||||||
|
nullptr, eventId );
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkQuestCompletion( Entity::Player& player )
|
||||||
|
{
|
||||||
|
auto credit = player.getQuestUI8AL( getId() );
|
||||||
|
|
||||||
|
if ( credit + 1 >= 2 )
|
||||||
|
{
|
||||||
|
player.setQuestUI8AL( getId(), credit + 1 );
|
||||||
|
player.sendQuestMessage( getId(), 0, 2, credit + 1, 2 );
|
||||||
|
player.updateQuest( getId(), SeqFinish );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.setQuestUI8AL( getId(), credit + 1 );
|
||||||
|
player.sendQuestMessage( getId(), 0, 2, credit + 1, 2 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 )
|
||||||
|
{
|
||||||
|
Scene00100( player );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scene00002( Entity::Player& player )
|
||||||
|
{
|
||||||
|
player.playScene( getId(), 2, HIDE_HOTBAR,
|
||||||
|
[&]( Entity::Player& player, const Event::SceneResult& result )
|
||||||
|
{
|
||||||
|
Scene00098( player );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scene00003( Entity::Player& player )
|
||||||
|
{
|
||||||
|
player.playScene( getId(), 3, HIDE_HOTBAR,
|
||||||
|
[&]( Entity::Player& player, const Event::SceneResult& result )
|
||||||
|
{
|
||||||
|
if ( result.param2 == 1 )
|
||||||
|
{
|
||||||
|
if ( player.giveQuestRewards( getId(), 0 ) )
|
||||||
|
{
|
||||||
|
player.setQuestUI8BH( getId(), 0 );
|
||||||
|
player.finishQuest( getId() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scene00097( Entity::Player& player )
|
||||||
|
{
|
||||||
|
player.playScene( getId(), 97, HIDE_HOTBAR,
|
||||||
|
[&]( Entity::Player& player, const Event::SceneResult& result )
|
||||||
|
{
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scene00098( Entity::Player& player )
|
||||||
|
{
|
||||||
|
player.playScene( getId(), 98, HIDE_HOTBAR,
|
||||||
|
[&]( Entity::Player& player, const Event::SceneResult& result )
|
||||||
|
{
|
||||||
|
checkQuestCompletion( player );
|
||||||
|
player.setQuestBitFlag8( getId(), 2, true );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
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 )
|
||||||
|
{
|
||||||
|
checkQuestCompletion( player );
|
||||||
|
player.setQuestBitFlag8( getId(), 1, true );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
EXPOSE_SCRIPT( SubFst043 );
|
150
src/scripts/quest/subquest/gridania/SubFst046.cpp
Normal file
150
src/scripts/quest/subquest/gridania/SubFst046.cpp
Normal file
|
@ -0,0 +1,150 @@
|
||||||
|
// 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: SubFst046_00210
|
||||||
|
// Quest Name: Idle Initiatives
|
||||||
|
// Quest ID: 65746
|
||||||
|
// Start NPC: 1000408
|
||||||
|
// End NPC: 1000408
|
||||||
|
|
||||||
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
class SubFst046 :
|
||||||
|
public Sapphire::ScriptAPI::EventScript
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
// Basic quest information
|
||||||
|
// Quest vars / flags used
|
||||||
|
// GetQuestBitFlag8
|
||||||
|
// 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 ActionTimelineEventBaseIdle = 783;
|
||||||
|
static constexpr auto Actor0 = 1000408;
|
||||||
|
static constexpr auto Actor1 = 1000792;
|
||||||
|
static constexpr auto Actor2 = 1000793;
|
||||||
|
static constexpr auto Actor3 = 1000794;
|
||||||
|
static constexpr auto Seq0Actor0 = 0;
|
||||||
|
static constexpr auto Seq1Actor1 = 1;
|
||||||
|
static constexpr auto Seq1Actor2 = 2;
|
||||||
|
static constexpr auto Seq1Actor3 = 3;
|
||||||
|
static constexpr auto Seq2Actor0 = 4;
|
||||||
|
|
||||||
|
public:
|
||||||
|
SubFst046() : Sapphire::ScriptAPI::EventScript( 65746 ){};
|
||||||
|
~SubFst046() {};
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// 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 == Actor1 )
|
||||||
|
Scene00001( player );
|
||||||
|
if ( actor == Actor2 )
|
||||||
|
Scene00002( player );
|
||||||
|
if ( actor == Actor3 )
|
||||||
|
Scene00003( player );
|
||||||
|
if ( actor == Actor0 && player.getQuestSeq( getId() ) == SeqFinish )
|
||||||
|
Scene00004( player );
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkQuestCompletion( Entity::Player& player )
|
||||||
|
{
|
||||||
|
auto credit = player.getQuestUI8AL( getId() );
|
||||||
|
|
||||||
|
if ( credit + 1 >= 3 )
|
||||||
|
{
|
||||||
|
player.setQuestUI8AL( getId(), credit + 1 );
|
||||||
|
player.sendQuestMessage( getId(), 0, 0, credit + 1, 3 );
|
||||||
|
player.updateQuest( getId(), SeqFinish );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.setQuestUI8AL( getId(), credit + 1 );
|
||||||
|
player.sendQuestMessage( getId(), 0, 0, credit + 1, 3 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 )
|
||||||
|
{
|
||||||
|
checkQuestCompletion( player );
|
||||||
|
player.setQuestBitFlag8( getId(), 1, true );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scene00002( Entity::Player& player )
|
||||||
|
{
|
||||||
|
player.playScene( getId(), 2, HIDE_HOTBAR,
|
||||||
|
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
||||||
|
{
|
||||||
|
checkQuestCompletion( player );
|
||||||
|
player.setQuestBitFlag8( getId(), 2, true );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scene00003( Entity::Player& player )
|
||||||
|
{
|
||||||
|
player.playScene( getId(), 3, HIDE_HOTBAR,
|
||||||
|
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
||||||
|
{
|
||||||
|
checkQuestCompletion( player );
|
||||||
|
player.setQuestBitFlag8( getId(), 3, true );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
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.setQuestUI8BH( getId(), 0 );
|
||||||
|
player.finishQuest( getId() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
EXPOSE_SCRIPT( SubFst046 );
|
144
src/scripts/quest/subquest/gridania/SubFst048.cpp
Normal file
144
src/scripts/quest/subquest/gridania/SubFst048.cpp
Normal file
|
@ -0,0 +1,144 @@
|
||||||
|
// 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: SubFst048_00375
|
||||||
|
// Quest Name: Not a Material Girl
|
||||||
|
// Quest ID: 65911
|
||||||
|
// Start NPC: 1000742
|
||||||
|
// End NPC: 1000742
|
||||||
|
|
||||||
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
class SubFst048 : public Sapphire::ScriptAPI::EventScript
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
// Basic quest information
|
||||||
|
// Quest vars / flags used
|
||||||
|
// GetQuestBitFlag8
|
||||||
|
// 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 = 1000742;
|
||||||
|
static constexpr auto Actor1 = 1000474;
|
||||||
|
static constexpr auto Actor2 = 1000476;
|
||||||
|
static constexpr auto Actor3 = 1000483;
|
||||||
|
static constexpr auto Seq0Actor0 = 0;
|
||||||
|
static constexpr auto Seq1Actor1 = 1;
|
||||||
|
static constexpr auto Seq1Actor2 = 2;
|
||||||
|
static constexpr auto Seq1Actor3 = 3;
|
||||||
|
static constexpr auto Seq2Actor0 = 4;
|
||||||
|
|
||||||
|
public:
|
||||||
|
SubFst048() : Sapphire::ScriptAPI::EventScript( 65911 ){};
|
||||||
|
~SubFst048() {};
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// 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 )
|
||||||
|
Scene00004( player );
|
||||||
|
if ( actor == Actor1 )
|
||||||
|
Scene00001( player );
|
||||||
|
if ( actor == Actor2 )
|
||||||
|
Scene00002( player );
|
||||||
|
if ( actor == Actor3 )
|
||||||
|
Scene00003( player );
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkQuestCompletion( Entity::Player& player )
|
||||||
|
{
|
||||||
|
auto credit = player.getQuestUI8AL( getId() );
|
||||||
|
|
||||||
|
if ( credit + 1 >= 3 )
|
||||||
|
{
|
||||||
|
player.setQuestUI8AL( getId(), credit + 1 );
|
||||||
|
player.sendQuestMessage( getId(), 0, 2, credit + 1, 3 );
|
||||||
|
player.updateQuest( getId(), SeqFinish );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.setQuestUI8AL( getId(), credit + 1 );
|
||||||
|
player.sendQuestMessage( getId(), 0, 2, credit + 1, 3 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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 )
|
||||||
|
{
|
||||||
|
checkQuestCompletion( player );
|
||||||
|
player.setQuestBitFlag8( getId(), 1, true );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scene00002( Entity::Player& player )
|
||||||
|
{
|
||||||
|
player.playScene( getId(), 2, HIDE_HOTBAR,
|
||||||
|
[&]( Entity::Player& player, const Event::SceneResult& result )
|
||||||
|
{
|
||||||
|
checkQuestCompletion( player );
|
||||||
|
player.setQuestBitFlag8( getId(), 2, true );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scene00003( Entity::Player& player )
|
||||||
|
{
|
||||||
|
player.playScene( getId(), 3, HIDE_HOTBAR,
|
||||||
|
[&]( Entity::Player& player, const Event::SceneResult& result )
|
||||||
|
{
|
||||||
|
checkQuestCompletion( player );
|
||||||
|
player.setQuestBitFlag8( getId(), 3, true );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
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(), result.param3 ) )
|
||||||
|
{
|
||||||
|
player.finishQuest( getId() );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
EXPOSE_SCRIPT( SubFst048 );
|
|
@ -2015,7 +2015,7 @@ void Sapphire::Entity::Player::dyeItemFromDyeingInfo()
|
||||||
// TODO: subtract/remove dye used
|
// TODO: subtract/remove dye used
|
||||||
|
|
||||||
insertInventoryItem( static_cast< Sapphire::Common::InventoryType >( itemToDyeContainer ), static_cast< uint16_t >( itemToDyeSlot ), itemToDye );
|
insertInventoryItem( static_cast< Sapphire::Common::InventoryType >( itemToDyeContainer ), static_cast< uint16_t >( itemToDyeSlot ), itemToDye );
|
||||||
writeItem( itemToDye );
|
updateItemDb( itemToDye );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::Player::resetObjSpawnIndex()
|
void Sapphire::Entity::Player::resetObjSpawnIndex()
|
||||||
|
|
|
@ -920,8 +920,6 @@ namespace Sapphire::Entity
|
||||||
using InvSlotPair = std::pair< uint16_t, int8_t >;
|
using InvSlotPair = std::pair< uint16_t, int8_t >;
|
||||||
using InvSlotPairVec = std::vector< InvSlotPair >;
|
using InvSlotPairVec = std::vector< InvSlotPair >;
|
||||||
|
|
||||||
ItemPtr createItem( uint32_t catalogId, uint32_t quantity = 1 );
|
|
||||||
|
|
||||||
bool loadInventory();
|
bool loadInventory();
|
||||||
|
|
||||||
InvSlotPairVec getSlotsOfItemsInInventory( uint32_t catalogId );
|
InvSlotPairVec getSlotsOfItemsInInventory( uint32_t catalogId );
|
||||||
|
@ -956,7 +954,11 @@ namespace Sapphire::Entity
|
||||||
|
|
||||||
void writeInventory( Common::InventoryType type );
|
void writeInventory( Common::InventoryType type );
|
||||||
|
|
||||||
void writeItem( ItemPtr pItem ) const;
|
ItemPtr createTempItem( uint32_t catalogId, uint32_t quantity = 1 );
|
||||||
|
|
||||||
|
void updateItemDb( ItemPtr pItem ) const;
|
||||||
|
|
||||||
|
void writeItemDb( ItemPtr pItem ) const;
|
||||||
|
|
||||||
void deleteItemDb( ItemPtr pItem ) const;
|
void deleteItemDb( ItemPtr pItem ) const;
|
||||||
|
|
||||||
|
|
|
@ -306,13 +306,13 @@ void Sapphire::Entity::Player::addCurrency( CurrencyType type, uint32_t amount,
|
||||||
if( !currItem )
|
if( !currItem )
|
||||||
{
|
{
|
||||||
// TODO: map currency type to itemid
|
// TODO: map currency type to itemid
|
||||||
currItem = createItem( 1 );
|
currItem = createTempItem( 1 );
|
||||||
m_storageMap[ Currency ]->setItem( slot, currItem );
|
m_storageMap[ Currency ]->setItem( slot, currItem );
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t currentAmount = currItem->getStackSize();
|
uint32_t currentAmount = currItem->getStackSize();
|
||||||
currItem->setStackSize( currentAmount + amount );
|
currItem->setStackSize( currentAmount + amount );
|
||||||
writeItem( currItem );
|
updateItemDb( currItem );
|
||||||
|
|
||||||
updateContainer( Currency, slot, currItem );
|
updateContainer( Currency, slot, currItem );
|
||||||
|
|
||||||
|
@ -352,7 +352,7 @@ void Sapphire::Entity::Player::removeCurrency( Common::CurrencyType type, uint32
|
||||||
currItem->setStackSize( 0 );
|
currItem->setStackSize( 0 );
|
||||||
else
|
else
|
||||||
currItem->setStackSize( currentAmount - amount );
|
currItem->setStackSize( currentAmount - amount );
|
||||||
writeItem( currItem );
|
updateItemDb( currItem );
|
||||||
|
|
||||||
auto invUpdate = std::make_shared< UpdateInventorySlotPacket >( getId(),
|
auto invUpdate = std::make_shared< UpdateInventorySlotPacket >( getId(),
|
||||||
static_cast< uint8_t >( type ) - 1,
|
static_cast< uint8_t >( type ) - 1,
|
||||||
|
@ -369,7 +369,7 @@ void Sapphire::Entity::Player::addCrystal( Common::CrystalType type, uint32_t am
|
||||||
if( !currItem )
|
if( !currItem )
|
||||||
{
|
{
|
||||||
// TODO: map currency type to itemid
|
// TODO: map currency type to itemid
|
||||||
currItem = createItem( static_cast< uint8_t >( type ) + 1 );
|
currItem = createTempItem( static_cast< uint8_t >( type ) + 1 );
|
||||||
m_storageMap[ Crystal ]->setItem( static_cast< uint8_t >( type ) - 1, currItem );
|
m_storageMap[ Crystal ]->setItem( static_cast< uint8_t >( type ) - 1, currItem );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ void Sapphire::Entity::Player::addCrystal( Common::CrystalType type, uint32_t am
|
||||||
|
|
||||||
currItem->setStackSize( currentAmount + amount );
|
currItem->setStackSize( currentAmount + amount );
|
||||||
|
|
||||||
writeItem( currItem );
|
updateItemDb( currItem );
|
||||||
|
|
||||||
writeInventory( Crystal );
|
writeInventory( Crystal );
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ void Sapphire::Entity::Player::removeCrystal( Common::CrystalType type, uint32_t
|
||||||
else
|
else
|
||||||
currItem->setStackSize( currentAmount - amount );
|
currItem->setStackSize( currentAmount - amount );
|
||||||
|
|
||||||
writeItem( currItem );
|
updateItemDb( currItem );
|
||||||
|
|
||||||
auto invUpdate = std::make_shared< UpdateInventorySlotPacket >( getId(),
|
auto invUpdate = std::make_shared< UpdateInventorySlotPacket >( getId(),
|
||||||
static_cast< uint8_t >( type ) - 1,
|
static_cast< uint8_t >( type ) - 1,
|
||||||
|
@ -523,8 +523,11 @@ void Sapphire::Entity::Player::writeInventory( InventoryType type )
|
||||||
db.execute( query );
|
db.execute( query );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::Player::writeItem( Sapphire::ItemPtr pItem ) const
|
void Sapphire::Entity::Player::updateItemDb( Sapphire::ItemPtr pItem ) const
|
||||||
{
|
{
|
||||||
|
if( pItem->getUId() == 0 )
|
||||||
|
writeItemDb( pItem );
|
||||||
|
|
||||||
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
auto stmt = db.getPreparedStatement( Db::CHARA_ITEMGLOBAL_UP );
|
auto stmt = db.getPreparedStatement( Db::CHARA_ITEMGLOBAL_UP );
|
||||||
|
|
||||||
|
@ -540,6 +543,9 @@ void Sapphire::Entity::Player::writeItem( Sapphire::ItemPtr pItem ) const
|
||||||
|
|
||||||
void Sapphire::Entity::Player::deleteItemDb( Sapphire::ItemPtr item ) const
|
void Sapphire::Entity::Player::deleteItemDb( Sapphire::ItemPtr item ) const
|
||||||
{
|
{
|
||||||
|
if( item->getUId() == 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
auto stmt = db.getPreparedStatement( Db::CHARA_ITEMGLOBAL_DELETE );
|
auto stmt = db.getPreparedStatement( Db::CHARA_ITEMGLOBAL_DELETE );
|
||||||
|
|
||||||
|
@ -619,7 +625,7 @@ Sapphire::ItemPtr Sapphire::Entity::Player::addItem( ItemPtr itemToAdd, bool sil
|
||||||
itemToAdd->setStackSize( 0 );
|
itemToAdd->setStackSize( 0 );
|
||||||
|
|
||||||
item->setStackSize( newStackSize );
|
item->setStackSize( newStackSize );
|
||||||
writeItem( item );
|
updateItemDb( item );
|
||||||
|
|
||||||
if( !silent )
|
if( !silent )
|
||||||
{
|
{
|
||||||
|
@ -662,6 +668,8 @@ Sapphire::ItemPtr Sapphire::Entity::Player::addItem( ItemPtr itemToAdd, bool sil
|
||||||
if( !foundFreeSlot )
|
if( !foundFreeSlot )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
writeItemDb( itemToAdd );
|
||||||
|
|
||||||
auto storage = m_storageMap[ freeBagSlot.first ];
|
auto storage = m_storageMap[ freeBagSlot.first ];
|
||||||
storage->setItem( freeBagSlot.second, itemToAdd );
|
storage->setItem( freeBagSlot.second, itemToAdd );
|
||||||
|
|
||||||
|
@ -696,7 +704,7 @@ Sapphire::ItemPtr Sapphire::Entity::Player::addItem( uint32_t catalogId, uint32_
|
||||||
{
|
{
|
||||||
if( catalogId == 0 )
|
if( catalogId == 0 )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
auto item = createItem( catalogId, quantity );
|
auto item = createTempItem( catalogId, quantity );
|
||||||
item->setHq( isHq );
|
item->setHq( isHq );
|
||||||
return addItem( item, silent, canMerge, sendLootMessage );
|
return addItem( item, silent, canMerge, sendLootMessage );
|
||||||
}
|
}
|
||||||
|
@ -799,7 +807,7 @@ void Sapphire::Entity::Player::splitItem( uint16_t fromInventoryId, uint8_t from
|
||||||
updateContainer( fromInventoryId, fromSlotId, fromItem );
|
updateContainer( fromInventoryId, fromSlotId, fromItem );
|
||||||
updateContainer( toInventoryId, toSlot, newItem );
|
updateContainer( toInventoryId, toSlot, newItem );
|
||||||
|
|
||||||
writeItem( fromItem );
|
updateItemDb( fromItem );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::Player::mergeItem( uint16_t fromInventoryId, uint8_t fromSlotId,
|
void Sapphire::Entity::Player::mergeItem( uint16_t fromInventoryId, uint8_t fromSlotId,
|
||||||
|
@ -826,14 +834,14 @@ void Sapphire::Entity::Player::mergeItem( uint16_t fromInventoryId, uint8_t from
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fromItem->setStackSize( stackOverflow );
|
fromItem->setStackSize( stackOverflow );
|
||||||
writeItem( fromItem );
|
updateItemDb( fromItem );
|
||||||
|
updateContainer( fromInventoryId, fromSlotId, fromItem );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
toItem->setStackSize( stackSize );
|
toItem->setStackSize( stackSize );
|
||||||
writeItem( toItem );
|
updateItemDb( toItem );
|
||||||
|
|
||||||
updateContainer( fromInventoryId, fromSlotId, fromItem );
|
|
||||||
updateContainer( toInventoryId, toSlot, toItem );
|
updateContainer( toInventoryId, toSlot, toItem );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -627,11 +627,9 @@ void Sapphire::Entity::Player::insertQuest( uint16_t questId, uint8_t index, uin
|
||||||
db.execute( stmt );
|
db.execute( stmt );
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::ItemPtr Sapphire::Entity::Player::createItem( uint32_t catalogId, uint32_t quantity )
|
Sapphire::ItemPtr Sapphire::Entity::Player::createTempItem( uint32_t catalogId, uint32_t quantity )
|
||||||
{
|
{
|
||||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
|
||||||
auto& itemMgr = Common::Service< World::Manager::ItemMgr >::ref();
|
|
||||||
|
|
||||||
auto itemInfo = exdData.get< Sapphire::Data::Item >( catalogId );
|
auto itemInfo = exdData.get< Sapphire::Data::Item >( catalogId );
|
||||||
|
|
||||||
|
@ -641,22 +639,32 @@ Sapphire::ItemPtr Sapphire::Entity::Player::createItem( uint32_t catalogId, uint
|
||||||
if( !itemInfo )
|
if( !itemInfo )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
uint8_t flags = 0;
|
ItemPtr pItem = make_Item( 0, catalogId );
|
||||||
|
|
||||||
ItemPtr pItem = make_Item( itemMgr.getNextUId(), catalogId );
|
|
||||||
|
|
||||||
pItem->setStackSize( quantity );
|
pItem->setStackSize( quantity );
|
||||||
|
|
||||||
db.execute( "INSERT INTO charaglobalitem ( CharacterId, itemId, catalogId, stack, flags ) VALUES ( " +
|
|
||||||
std::to_string( getId() ) + ", " +
|
|
||||||
std::to_string( pItem->getUId() ) + ", " +
|
|
||||||
std::to_string( pItem->getId() ) + ", " +
|
|
||||||
std::to_string( quantity ) + ", " +
|
|
||||||
std::to_string( flags ) + ");" );
|
|
||||||
|
|
||||||
return pItem;
|
return pItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Sapphire::Entity::Player::writeItemDb( Sapphire::ItemPtr pItem ) const
|
||||||
|
{
|
||||||
|
if( pItem->getUId() == 0 )
|
||||||
|
{
|
||||||
|
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
|
auto& itemMgr = Common::Service< World::Manager::ItemMgr >::ref();
|
||||||
|
|
||||||
|
uint8_t flags = 0;
|
||||||
|
pItem->setUId( itemMgr.getNextUId() );
|
||||||
|
std::string sql = "INSERT INTO charaglobalitem ( CharacterId, itemId, catalogId, stack, flags ) VALUES ( " +
|
||||||
|
std::to_string( getId() ) + ", " +
|
||||||
|
std::to_string( pItem->getUId() ) + ", " +
|
||||||
|
std::to_string( pItem->getId() ) + ", " +
|
||||||
|
std::to_string( pItem->getStackSize() ) + ", " +
|
||||||
|
std::to_string( flags ) + ");";
|
||||||
|
db.directExecute( sql );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool Sapphire::Entity::Player::loadInventory()
|
bool Sapphire::Entity::Player::loadInventory()
|
||||||
{
|
{
|
||||||
auto& itemMgr = Common::Service< World::Manager::ItemMgr >::ref();
|
auto& itemMgr = Common::Service< World::Manager::ItemMgr >::ref();
|
||||||
|
|
Loading…
Add table
Reference in a new issue