1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-01 16:37:45 +00:00

Small stuff (organizing, adding titlelist loading)

This commit is contained in:
Maru 2017-11-02 17:54:10 -02:00
parent 54031902ee
commit a1a6cc59f8
4 changed files with 36 additions and 26 deletions

View file

@ -345,8 +345,8 @@ namespace Core {
void PlayerMinimal::insertDbGlobalItem( uint32_t weaponId, uint64_t uniqueId ) const void PlayerMinimal::insertDbGlobalItem( uint32_t weaponId, uint64_t uniqueId ) const
{ {
auto stmtItemGlobal = g_charaDb.getPreparedStatement(Db::CHARA_ITEMGLOBAL_INS ); auto stmtItemGlobal = g_charaDb.getPreparedStatement( Db::CHARA_ITEMGLOBAL_INS );
stmtItemGlobal->setInt(1, m_id); stmtItemGlobal->setInt( 1, m_id );
stmtItemGlobal->setInt64( 2, uniqueId ); stmtItemGlobal->setInt64( 2, uniqueId );
stmtItemGlobal->setInt( 3, weaponId ); stmtItemGlobal->setInt( 3, weaponId );
g_charaDb.directExecute( stmtItemGlobal ); g_charaDb.directExecute( stmtItemGlobal );

View file

@ -1396,7 +1396,7 @@ uint8_t * Core::Entity::Player::getTitleList()
uint16_t Core::Entity::Player::getTitle() const uint16_t Core::Entity::Player::getTitle() const
{ {
return m_title; return m_activeTitle;
} }
void Core::Entity::Player::addTitle( uint16_t titleId ) void Core::Entity::Player::addTitle( uint16_t titleId )
@ -1417,7 +1417,7 @@ void Core::Entity::Player::setTitle( uint16_t titleId )
if ( ( m_titleList[index] & value ) == 0 ) // Player doesn't have title - bail if ( ( m_titleList[index] & value ) == 0 ) // Player doesn't have title - bail
return; return;
m_title = titleId; m_activeTitle = titleId;
sendToInRangeSet( ActorControlPacket142( getId(), SetTitle, titleId ), true ); sendToInRangeSet( ActorControlPacket142( getId(), SetTitle, titleId ), true );
} }

View file

@ -566,7 +566,7 @@ private:
uint8_t status; uint8_t status;
} m_retainerInfo[8]; } m_retainerInfo[8];
uint16_t m_title; uint16_t m_activeTitle;
uint8_t m_titleList[48]; uint8_t m_titleList[48];
uint8_t m_howTo[33]; uint8_t m_howTo[33];
uint8_t m_minions[33]; uint8_t m_minions[33];

View file

@ -81,15 +81,21 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
setRotation( 0.0f ); setRotation( 0.0f );
} }
// Stats
m_hp = res->getUInt( "Hp" ); m_hp = res->getUInt( "Hp" );
m_mp = res->getUInt( "Mp" ); m_mp = res->getUInt( "Mp" );
m_tp = 0; m_tp = 0;
// Position
m_pos.x = res->getFloat( "PosX" ); m_pos.x = res->getFloat( "PosX" );
m_pos.y = res->getFloat( "PosY" ); m_pos.y = res->getFloat( "PosY" );
m_pos.z = res->getFloat( "PosZ" ); m_pos.z = res->getFloat( "PosZ" );
setRotation( res->getFloat( "PosR" ) ); setRotation( res->getFloat( "PosR" ) );
// Model
auto custom = res->getBlobVector( "Customize" ); auto custom = res->getBlobVector( "Customize" );
memcpy( reinterpret_cast< char* >( m_customize ), custom.data(), custom.size() ); memcpy( reinterpret_cast< char* >( m_customize ), custom.data(), custom.size() );
@ -98,6 +104,8 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
auto modelEq = res->getBlobVector( "ModelEquip" ); auto modelEq = res->getBlobVector( "ModelEquip" );
memcpy( reinterpret_cast< char* >( m_modelEquip ), modelEq.data(), modelEq.size() ); memcpy( reinterpret_cast< char* >( m_modelEquip ), modelEq.data(), modelEq.size() );
// Minimal info
m_guardianDeity = res->getUInt8( "GuardianDeity" ); m_guardianDeity = res->getUInt8( "GuardianDeity" );
m_birthDay = res->getUInt8( "BirthDay" ); m_birthDay = res->getUInt8( "BirthDay" );
m_birthMonth = res->getUInt8( "BirthMonth" ); m_birthMonth = res->getUInt8( "BirthMonth" );
@ -105,12 +113,27 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
m_class = static_cast< ClassJob >( res->getUInt( "Class" ) ); m_class = static_cast< ClassJob >( res->getUInt( "Class" ) );
m_homePoint = res->getUInt8( "Homepoint" ); m_homePoint = res->getUInt8( "Homepoint" );
auto howTo = res->getBlobVector( "HowTo" ); // Additional data
memcpy( reinterpret_cast< char* >( m_howTo ), howTo.data(), howTo.size() );
m_contentId = res->getUInt64( "ContentId" ); m_contentId = res->getUInt64( "ContentId" );
m_voice = res->getUInt8( "Voice" ); m_voice = res->getUInt8( "Voice" );
m_startTown = res->getUInt8( "StartTown" );
m_playTime = res->getUInt( "TotalPlayTime" );
m_bNewGame = res->getBoolean( "IsNewGame" );
m_bNewAdventurer = res->getBoolean( "IsNewAdventurer" );
m_openingSequence = res->getUInt8( "OpeningSequence" );
m_gc = res->getUInt8( "GrandCompany" );
m_cfPenaltyUntil = res->getUInt( "CFPenaltyUntil" );
m_activeTitle = res->getUInt16( "ActiveTitle" );
m_gmRank = res->getUInt8( "GMRank" );
// Blobs
auto howTo = res->getBlobVector( "HowTo" );
memcpy( reinterpret_cast< char* >( m_howTo ), howTo.data(), howTo.size() );
auto questCompleteFlags = res->getBlobVector( "QuestCompleteFlags" ); auto questCompleteFlags = res->getBlobVector( "QuestCompleteFlags" );
memcpy( reinterpret_cast< char* >( m_questCompleteFlags ), questCompleteFlags.data(), questCompleteFlags.size() ); memcpy( reinterpret_cast< char* >( m_questCompleteFlags ), questCompleteFlags.data(), questCompleteFlags.size() );
@ -118,8 +141,6 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
auto questTracking = res->getBlobVector( "QuestTracking" ); auto questTracking = res->getBlobVector( "QuestTracking" );
memcpy( reinterpret_cast< char* >( m_questTracking ), questTracking.data(), questTracking.size() ); memcpy( reinterpret_cast< char* >( m_questTracking ), questTracking.data(), questTracking.size() );
m_bNewGame = res->getBoolean( "IsNewGame" );
auto aetheryte = res->getBlobVector( "Aetheryte" ); auto aetheryte = res->getBlobVector( "Aetheryte" );
memcpy( reinterpret_cast< char* >( m_aetheryte ), aetheryte.data(), aetheryte.size() ); memcpy( reinterpret_cast< char* >( m_aetheryte ), aetheryte.data(), aetheryte.size() );
@ -129,21 +150,12 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
auto discovery = res->getBlobVector( "Discovery" ); auto discovery = res->getBlobVector( "Discovery" );
memcpy( reinterpret_cast< char* >( m_discovery ), discovery.data(), discovery.size() ); memcpy( reinterpret_cast< char* >( m_discovery ), discovery.data(), discovery.size() );
m_startTown = res->getUInt8( "StartTown" ); auto titleList = res->getBlobVector( "TitleList" );
m_playTime = res->getUInt( "TotalPlayTime" ); memcpy( reinterpret_cast< char* >( m_titleList ), titleList.data(), titleList.size() );
m_bNewAdventurer = res->getBoolean( "IsNewAdventurer" );
m_gc = res->getUInt8( "GrandCompany" );
auto gcRank = res->getBlobVector( "GrandCompanyRank" ); auto gcRank = res->getBlobVector( "GrandCompanyRank" );
memcpy( reinterpret_cast< char* >( m_gcRank ), gcRank.data(), gcRank.size() ); memcpy( reinterpret_cast< char* >( m_gcRank ), gcRank.data(), gcRank.size() );
m_cfPenaltyUntil = res->getUInt( "CFPenaltyUntil" );
m_openingSequence = res->getUInt8( "OpeningSequence" );
m_gmRank = res->getUInt8( "GMRank" );
res->free(); res->free();
m_pCell = nullptr; m_pCell = nullptr;
@ -338,7 +350,7 @@ void Core::Entity::Player::updateSql()
stmt->setInt( 35, 0 ); // RestPoint stmt->setInt( 35, 0 ); // RestPoint
stmt->setInt( 36, 0 ); // ActiveTitle stmt->setInt( 36, 0 ); // ActiveTitle
std::vector< uint8_t > titleListVec( 32 ); std::vector< uint8_t > titleListVec( sizeof ( m_titleList ) );
stmt->setBinary( 37, titleListVec ); stmt->setBinary( 37, titleListVec );
std::vector< uint8_t > achievementVec( 16 ); std::vector< uint8_t > achievementVec( 16 );
@ -485,5 +497,3 @@ void Core::Entity::Player::insertQuest( uint16_t questId, uint8_t index, uint8_t
stmt->setInt( 12, 0 ); stmt->setInt( 12, 0 );
g_charaDb.execute( stmt ); g_charaDb.execute( stmt );
} }