mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-09 20:27:45 +00:00
Load hunting log data
This commit is contained in:
parent
814a4f3cdc
commit
6e52a63526
7 changed files with 51 additions and 2 deletions
|
@ -263,6 +263,12 @@ namespace Sapphire::Common
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct HuntingLogEntry
|
||||||
|
{
|
||||||
|
uint8_t rank;
|
||||||
|
uint8_t entries[10][4];
|
||||||
|
};
|
||||||
|
|
||||||
enum class UnlockEntry : uint16_t
|
enum class UnlockEntry : uint16_t
|
||||||
{
|
{
|
||||||
Return = 1,
|
Return = 1,
|
||||||
|
|
|
@ -200,6 +200,14 @@ void Sapphire::Db::ZoneDbConnection::doPrepareStatements()
|
||||||
" WHERE CharacterId = ?;",
|
" WHERE CharacterId = ?;",
|
||||||
CONNECTION_ASYNC );
|
CONNECTION_ASYNC );
|
||||||
|
|
||||||
|
/// CLASS INFO
|
||||||
|
prepareStatement( CHARA_MONSTERNOTE_SEL, "SELECT Category_0, Category_1, Category_2, "
|
||||||
|
"Category_3, Category_4, Category_5, "
|
||||||
|
"Category_6, Category_7, Category_8, "
|
||||||
|
"Category_9, Category_10, Category_11 FROM charamonsternote "
|
||||||
|
"WHERE CharacterId = ?;",
|
||||||
|
CONNECTION_SYNC );
|
||||||
|
|
||||||
/// ZONE QUERIES
|
/// ZONE QUERIES
|
||||||
prepareStatement( ZONE_SEL_BNPCTEMPLATES,
|
prepareStatement( ZONE_SEL_BNPCTEMPLATES,
|
||||||
"SELECT Id, Name, bNPCBaseId, bNPCNameId, mainWeaponModel, "
|
"SELECT Id, Name, bNPCBaseId, bNPCNameId, mainWeaponModel, "
|
||||||
|
|
|
@ -78,6 +78,7 @@ namespace Sapphire::Db
|
||||||
|
|
||||||
CHARA_MONSTERNOTE_INS,
|
CHARA_MONSTERNOTE_INS,
|
||||||
CHARA_MONSTERNOTE_UP,
|
CHARA_MONSTERNOTE_UP,
|
||||||
|
CHARA_MONSTERNOTE_SEL,
|
||||||
|
|
||||||
ZONE_SEL_BNPCTEMPLATES,
|
ZONE_SEL_BNPCTEMPLATES,
|
||||||
ZONE_SEL_SPAWNGROUPS,
|
ZONE_SEL_SPAWNGROUPS,
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
#include <array>
|
||||||
|
|
||||||
namespace Sapphire::Entity
|
namespace Sapphire::Entity
|
||||||
{
|
{
|
||||||
|
@ -66,7 +67,7 @@ namespace Sapphire::Entity
|
||||||
} m_baseStats;
|
} m_baseStats;
|
||||||
|
|
||||||
// array for bonuses, 80 to have some spare room.
|
// array for bonuses, 80 to have some spare room.
|
||||||
uint32_t m_bonusStats[ 80 ];
|
std::array< uint32_t, 80 > m_bonusStats;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
char m_name[34];
|
char m_name[34];
|
||||||
|
|
|
@ -1976,3 +1976,9 @@ void Sapphire::Entity::Player::sendLandFlagsSlot( Common::LandFlagsSlot slot )
|
||||||
|
|
||||||
queuePacket( landFlags );
|
queuePacket( landFlags );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Sapphire::Common::HuntingLogEntry& Sapphire::Entity::Player::getHuntingLogEntry( uint8_t index )
|
||||||
|
{
|
||||||
|
assert( index < m_huntingLogEntries.size() );
|
||||||
|
return m_huntingLogEntries[ index ];
|
||||||
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "Event/EventHandler.h"
|
#include "Event/EventHandler.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
#include <array>
|
||||||
|
|
||||||
namespace Sapphire::Entity
|
namespace Sapphire::Entity
|
||||||
{
|
{
|
||||||
|
@ -705,6 +706,9 @@ namespace Sapphire::Entity
|
||||||
/*! load search info */
|
/*! load search info */
|
||||||
bool loadSearchInfo();
|
bool loadSearchInfo();
|
||||||
|
|
||||||
|
/*! load hunting log entries */
|
||||||
|
bool loadHuntingLog();
|
||||||
|
|
||||||
// Player Network Handling
|
// Player Network Handling
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/*! send current models ( equipment ) */
|
/*! send current models ( equipment ) */
|
||||||
|
@ -960,6 +964,7 @@ namespace Sapphire::Entity
|
||||||
|
|
||||||
Sapphire::ItemPtr dropInventoryItem( Common::InventoryType type, uint16_t slotId );
|
Sapphire::ItemPtr dropInventoryItem( Common::InventoryType type, uint16_t slotId );
|
||||||
|
|
||||||
|
Common::HuntingLogEntry& getHuntingLogEntry( uint8_t index );
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -1092,6 +1097,8 @@ namespace Sapphire::Entity
|
||||||
|
|
||||||
Util::SpawnIndexAllocator< uint8_t > m_objSpawnIndexAllocator;
|
Util::SpawnIndexAllocator< uint8_t > m_objSpawnIndexAllocator;
|
||||||
Util::SpawnIndexAllocator< uint8_t > m_actorSpawnIndexAllocator;
|
Util::SpawnIndexAllocator< uint8_t > m_actorSpawnIndexAllocator;
|
||||||
|
|
||||||
|
std::array< Common::HuntingLogEntry, 12 > m_huntingLogEntries;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,7 +205,7 @@ bool Sapphire::Entity::Player::load( uint32_t charId, World::SessionPtr pSession
|
||||||
|
|
||||||
m_pCell = nullptr;
|
m_pCell = nullptr;
|
||||||
|
|
||||||
if( !loadActiveQuests() || !loadClassData() || !loadSearchInfo() )
|
if( !loadActiveQuests() || !loadClassData() || !loadSearchInfo() || loadHuntingLog() )
|
||||||
Logger::error( "Player #{0} data corrupt!", char_id_str );
|
Logger::error( "Player #{0} data corrupt!", char_id_str );
|
||||||
|
|
||||||
m_maxHp = getMaxHp();
|
m_maxHp = getMaxHp();
|
||||||
|
@ -334,6 +334,26 @@ bool Sapphire::Entity::Player::loadSearchInfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Sapphire::Entity::Player::loadHuntingLog()
|
||||||
|
{
|
||||||
|
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
|
auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::CHARA_MONSTERNOTE_SEL );
|
||||||
|
stmt->setUInt( 1, m_id );
|
||||||
|
auto res = pDb->query( stmt );
|
||||||
|
|
||||||
|
if( !res->next() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
for( auto i = 0; i < 12; ++i )
|
||||||
|
{
|
||||||
|
std::string catStr = fmt::format( "Category_{}", i );
|
||||||
|
auto cat = res->getBlobVector( catStr );
|
||||||
|
m_huntingLogEntries[i].rank = cat[0];
|
||||||
|
memcpy( reinterpret_cast< char* >( m_huntingLogEntries[i].entries ), cat.data() + 1, cat.size() - 1 );
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::Player::updateSql()
|
void Sapphire::Entity::Player::updateSql()
|
||||||
{
|
{
|
||||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
|
|
Loading…
Add table
Reference in a new issue