mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-01 16:37:45 +00:00
Player title SQL; Handle set player title;
This commit is contained in:
parent
eb445fcdc3
commit
20daf4cdc2
7 changed files with 44 additions and 19 deletions
|
@ -23,5 +23,9 @@
|
||||||
-- ALTER TABLE `charadetail` CHANGE `OpeningSequence` `OpeningSequence` INT(3) NULL DEFAULT '0';
|
-- ALTER TABLE `charadetail` CHANGE `OpeningSequence` `OpeningSequence` INT(3) NULL DEFAULT '0';
|
||||||
-- -------------------------------------------
|
-- -------------------------------------------
|
||||||
-- update.sql Before Merge into Other SQL's 30/08/2017
|
-- update.sql Before Merge into Other SQL's 30/08/2017
|
||||||
|
-- -------------------------------------------
|
||||||
|
-- ALTER TABLE `charadetail` ADD `EquipDisplayFlags` int(3) DEFAULT '0' AFTER `GMRank`;
|
||||||
|
-- -------------------------------------------
|
||||||
|
-- update.sql before titles added 09/10/2017
|
||||||
|
|
||||||
ALTER TABLE `charadetail` ADD `EquipDisplayFlags` int(3) DEFAULT '0' AFTER `GMRank`;
|
ALTER TABLE `charadetail` CHANGE `TitleList` `Titlelist` BINARY(48) NULL DEFAULT NULL;
|
|
@ -645,7 +645,7 @@ struct FFXIVIpcUpdateClassInfo : FFXIVIpcBasePacket<UpdateClassInfo>
|
||||||
*/
|
*/
|
||||||
struct FFXIVIpcPlayerTitleList : FFXIVIpcBasePacket<PlayerTitleList>
|
struct FFXIVIpcPlayerTitleList : FFXIVIpcBasePacket<PlayerTitleList>
|
||||||
{
|
{
|
||||||
uint8_t titleList[0x30];
|
uint8_t titleList[48];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -175,6 +175,9 @@ namespace Core {
|
||||||
char unlocks[64];
|
char unlocks[64];
|
||||||
memset( unlocks, 0, 64 );
|
memset( unlocks, 0, 64 );
|
||||||
|
|
||||||
|
char titleList[48];
|
||||||
|
memset( titleList, 0, 48 );
|
||||||
|
|
||||||
int16_t questTracking[5] = { -1, -1, -1, -1, -1 };
|
int16_t questTracking[5] = { -1, -1, -1, -1, -1 };
|
||||||
|
|
||||||
uint16_t size = static_cast< uint16_t >( m_lookMap.size() );
|
uint16_t size = static_cast< uint16_t >( m_lookMap.size() );
|
||||||
|
@ -270,6 +273,7 @@ namespace Core {
|
||||||
" unlocks, "
|
" unlocks, "
|
||||||
" QuestTracking, "
|
" QuestTracking, "
|
||||||
" Aetheryte, "
|
" Aetheryte, "
|
||||||
|
" TitleList, "
|
||||||
" GMRank, "
|
" GMRank, "
|
||||||
" UPDATE_DATE ) "
|
" UPDATE_DATE ) "
|
||||||
" VALUES (" + std::to_string( m_iD ) + ", "
|
" VALUES (" + std::to_string( m_iD ) + ", "
|
||||||
|
@ -285,6 +289,7 @@ namespace Core {
|
||||||
+ "UNHEX('" + std::string( Util::binaryToHexString( (uint8_t*)unlocks, 64 ) ) + "'), "
|
+ "UNHEX('" + std::string( Util::binaryToHexString( (uint8_t*)unlocks, 64 ) ) + "'), "
|
||||||
+ "UNHEX('" + std::string( Util::binaryToHexString( (uint8_t*)questTracking, 10 ) ) + "'), "
|
+ "UNHEX('" + std::string( Util::binaryToHexString( (uint8_t*)questTracking, 10 ) ) + "'), "
|
||||||
+ "UNHEX('" + std::string( Util::binaryToHexString( (uint8_t*)aetherytes, 12 ) ) + "'),"
|
+ "UNHEX('" + std::string( Util::binaryToHexString( (uint8_t*)aetherytes, 12 ) ) + "'),"
|
||||||
|
+ "UNHEX('" + std::string( Util::binaryToHexString( (uint8_t*)titleList, 48 ) ) + "'),"
|
||||||
+ std::to_string( m_gmRank ) + ", NOW());" );
|
+ std::to_string( m_gmRank ) + ", NOW());" );
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1427,27 +1427,27 @@ uint8_t * Core::Entity::Player::getTitleList()
|
||||||
|
|
||||||
void Core::Entity::Player::addTitle( uint16_t titleId )
|
void Core::Entity::Player::addTitle( uint16_t titleId )
|
||||||
{
|
{
|
||||||
uint8_t index = titleId / 8; // Find what index of uint8_t array this title will fit in
|
uint16_t index;
|
||||||
|
uint8_t value;
|
||||||
|
Util::valueToFlagByteIndexValue( titleId, value, index );
|
||||||
|
|
||||||
uint8_t bitVal;
|
m_titleList[index] |= value;
|
||||||
|
setSyncFlag( PlayerSyncFlags::Title );
|
||||||
if ( titleId < 8 )
|
|
||||||
{
|
|
||||||
bitVal = titleId;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bitVal = 1 << ( titleId % ( index * 8 ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_titleList[index] |= bitVal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::setTitle( uint16_t titleId )
|
void Core::Entity::Player::setTitle( uint16_t titleId )
|
||||||
{
|
{
|
||||||
// todo: add check to see if player actually has title from titlelist. packet injection n stuff
|
uint16_t index;
|
||||||
|
uint8_t value;
|
||||||
|
Util::valueToFlagByteIndexValue( titleId, value, index );
|
||||||
|
|
||||||
|
if ( ( m_titleList[index] & value ) == 0 ) // Player doesn't have title - bail
|
||||||
|
return;
|
||||||
|
|
||||||
m_title = titleId;
|
m_title = titleId;
|
||||||
|
|
||||||
sendToInRangeSet( ActorControlPacket142( getId(), SetTitle, titleId ), true );
|
sendToInRangeSet( ActorControlPacket142( getId(), SetTitle, titleId ), true );
|
||||||
|
setSyncFlag( PlayerSyncFlags::Title );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::setEquipDisplayFlags( uint8_t state )
|
void Core::Entity::Player::setEquipDisplayFlags( uint8_t state )
|
||||||
|
|
|
@ -576,7 +576,7 @@ private:
|
||||||
} m_retainerInfo[8];
|
} m_retainerInfo[8];
|
||||||
|
|
||||||
uint16_t m_title;
|
uint16_t m_title;
|
||||||
uint8_t m_titleList[30];
|
uint8_t m_titleList[48];
|
||||||
uint8_t m_achievement[16];
|
uint8_t m_achievement[16];
|
||||||
uint8_t m_howTo[33];
|
uint8_t m_howTo[33];
|
||||||
uint8_t m_homePoint;
|
uint8_t m_homePoint;
|
||||||
|
|
|
@ -82,7 +82,9 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
|
||||||
"cd.CFPenaltyUntil, "
|
"cd.CFPenaltyUntil, "
|
||||||
"cd.OpeningSequence, "
|
"cd.OpeningSequence, "
|
||||||
"cd.GMRank, "
|
"cd.GMRank, "
|
||||||
"cd.EquipDisplayFlags "
|
"cd.EquipDisplayFlags, "
|
||||||
|
"cd.ActiveTitle, "
|
||||||
|
"cd.TitleList " // 40
|
||||||
"FROM charabase AS c "
|
"FROM charabase AS c "
|
||||||
" INNER JOIN charadetail AS cd "
|
" INNER JOIN charadetail AS cd "
|
||||||
" ON c.CharacterId = cd.CharacterId "
|
" ON c.CharacterId = cd.CharacterId "
|
||||||
|
@ -176,6 +178,9 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
|
||||||
m_gmRank = field[37].get< uint8_t >();
|
m_gmRank = field[37].get< uint8_t >();
|
||||||
m_equipDisplayFlags = field[38].get< uint8_t >();
|
m_equipDisplayFlags = field[38].get< uint8_t >();
|
||||||
|
|
||||||
|
m_title = field[39].get< uint8_t >();
|
||||||
|
field[40].getBinary( reinterpret_cast< char* >( m_titleList ), sizeof( m_titleList ) );
|
||||||
|
|
||||||
m_pCell = nullptr;
|
m_pCell = nullptr;
|
||||||
|
|
||||||
if( !loadActiveQuests() || !loadClassData() || !loadSearchInfo() )
|
if( !loadActiveQuests() || !loadClassData() || !loadSearchInfo() )
|
||||||
|
@ -316,6 +321,12 @@ void Core::Entity::Player::createUpdateSql()
|
||||||
if( m_updateFlags & PlayerSyncFlags::HowTo )
|
if( m_updateFlags & PlayerSyncFlags::HowTo )
|
||||||
charaDetailSet.insert( " HowTo = UNHEX('" + std::string( Util::binaryToHexString( static_cast< uint8_t* >( m_howTo ), sizeof( m_howTo ) ) ) + "')" );
|
charaDetailSet.insert( " HowTo = UNHEX('" + std::string( Util::binaryToHexString( static_cast< uint8_t* >( m_howTo ), sizeof( m_howTo ) ) ) + "')" );
|
||||||
|
|
||||||
|
if ( m_updateFlags & PlayerSyncFlags::Title )
|
||||||
|
{
|
||||||
|
charaDetailSet.insert( " ActiveTitle = " + std::to_string( m_title ) );
|
||||||
|
charaDetailSet.insert( " TitleList = UNHEX('" + std::string( Util::binaryToHexString( reinterpret_cast< uint8_t* >( m_titleList ), sizeof( m_titleList ) ) ) + "')" );
|
||||||
|
}
|
||||||
|
|
||||||
if( m_updateFlags & PlayerSyncFlags::Aetherytes )
|
if( m_updateFlags & PlayerSyncFlags::Aetherytes )
|
||||||
charaDetailSet.insert( " Aetheryte = UNHEX('" + std::string( Util::binaryToHexString( reinterpret_cast< uint8_t* >( m_aetheryte ), sizeof( m_aetheryte ) ) ) + "')" );
|
charaDetailSet.insert( " Aetheryte = UNHEX('" + std::string( Util::binaryToHexString( reinterpret_cast< uint8_t* >( m_aetheryte ), sizeof( m_aetheryte ) ) ) + "')" );
|
||||||
|
|
||||||
|
|
|
@ -118,13 +118,18 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
|
||||||
pPlayer->getCurrentAction()->setInterrupted();
|
pPlayer->getCurrentAction()->setInterrupted();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 0x12E: // Set player title
|
||||||
|
{
|
||||||
|
pPlayer->setTitle( param1 );
|
||||||
|
break;
|
||||||
|
}
|
||||||
case 0x12F: // Get title list
|
case 0x12F: // Get title list
|
||||||
{
|
{
|
||||||
GamePacketNew< FFXIVIpcPlayerTitleList, ServerZoneIpcType > titleListPacket( pPlayer->getId() );
|
GamePacketNew< FFXIVIpcPlayerTitleList, ServerZoneIpcType > titleListPacket( pPlayer->getId() );
|
||||||
memcpy( titleListPacket.data().titleList, pPlayer->getTitleList(), sizeof( titleListPacket.data().titleList ) );
|
memcpy( titleListPacket.data().titleList, pPlayer->getTitleList(), sizeof( titleListPacket.data().titleList ) );
|
||||||
|
|
||||||
pPlayer->queuePacket( titleListPacket );
|
pPlayer->queuePacket( titleListPacket );
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case 0x133: // Update howtos seen
|
case 0x133: // Update howtos seen
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue