1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-29 07:37:45 +00:00

Title list SQL work; Clean-up;

This commit is contained in:
Maru 2017-10-09 00:31:31 -03:00
parent ffd85ff45f
commit eb445fcdc3
6 changed files with 38 additions and 35 deletions

View file

@ -288,6 +288,7 @@ namespace Core {
Aetherytes = 0x00000080, // Attuned aetherytes Aetherytes = 0x00000080, // Attuned aetherytes
HomePoint = 0x00000100, // Current homepoint HomePoint = 0x00000100, // Current homepoint
HowTo = 0x00000200, HowTo = 0x00000200,
Title = 0x00000400,
HpMp = 0x00000800, HpMp = 0x00000800,
QuestTracker = 0x00001000, QuestTracker = 0x00001000,

View file

@ -646,7 +646,6 @@ struct FFXIVIpcUpdateClassInfo : FFXIVIpcBasePacket<UpdateClassInfo>
struct FFXIVIpcPlayerTitleList : FFXIVIpcBasePacket<PlayerTitleList> struct FFXIVIpcPlayerTitleList : FFXIVIpcBasePacket<PlayerTitleList>
{ {
uint8_t titleList[0x30]; uint8_t titleList[0x30];
//uint16_t padding;
}; };
/** /**

View file

@ -1420,8 +1420,32 @@ void Core::Entity::Player::setIsLogin( bool bIsLogin )
m_bIsLogin = bIsLogin; m_bIsLogin = bIsLogin;
} }
uint8_t * Core::Entity::Player::getTitleList()
{
return m_titleList;
}
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
uint8_t bitVal;
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
m_title = titleId; m_title = titleId;
sendToInRangeSet( ActorControlPacket142( getId(), SetTitle, titleId ), true ); sendToInRangeSet( ActorControlPacket142( getId(), SetTitle, titleId ), true );
} }

View file

@ -328,6 +328,10 @@ public:
void teleport( uint16_t aetheryteId, uint8_t type = 1 ); void teleport( uint16_t aetheryteId, uint8_t type = 1 );
/*! prepares zoning / fades out the screen */ /*! prepares zoning / fades out the screen */
void prepareZoning( uint16_t targetZone, bool fadeOut, uint8_t fadoutTime = 0, uint16_t animation = 0 ); void prepareZoning( uint16_t targetZone, bool fadeOut, uint8_t fadoutTime = 0, uint16_t animation = 0 );
/*! get player's title list (available titles) */
uint8_t * getTitleList();
/*! add title to player title list */
void addTitle( uint16_t titleId );
/*! change player's title */ /*! change player's title */
void setTitle( uint16_t titleId ); void setTitle( uint16_t titleId );
/*! change gear param state */ /*! change gear param state */
@ -572,7 +576,7 @@ private:
} m_retainerInfo[8]; } m_retainerInfo[8];
uint16_t m_title; uint16_t m_title;
uint16_t m_titleList[32]; uint8_t m_titleList[30];
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;

View file

@ -311,6 +311,13 @@ void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlaye
pPlayer->addStatusEffect( effect ); pPlayer->addStatusEffect( effect );
} }
else if ( subCommand == "title" )
{
uint32_t titleId;
sscanf( params.c_str(), "%d", &titleId );
pPlayer->addTitle( titleId );
}
else if( subCommand == "spawn" ) else if( subCommand == "spawn" )
{ {
int32_t model, name; int32_t model, name;
@ -333,7 +340,6 @@ void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlaye
pPlayer->queuePacket( pPe ); pPlayer->queuePacket( pPe );
} }
else if( subCommand == "actrl" ) else if( subCommand == "actrl" )
{ {
// temporary research packet // temporary research packet

View file

@ -120,40 +120,9 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
} }
case 0x12F: // Get title list case 0x12F: // Get title list
{ {
g_log.debug( "for real" );
GamePacketNew< FFXIVIpcPlayerTitleList, ServerZoneIpcType > titleListPacket( pPlayer->getId() ); GamePacketNew< FFXIVIpcPlayerTitleList, ServerZoneIpcType > titleListPacket( pPlayer->getId() );
//titleListPacket.data().padding = 3; memcpy( titleListPacket.data().titleList, pPlayer->getTitleList(), sizeof( titleListPacket.data().titleList ) );
/*
titleListPacket.data().titleList[0] |= (1 << 1);
titleListPacket.data().titleList[0] |= ( 1 << 2 );
titleListPacket.data().titleList[0] |= ( 1 << 4 );
titleListPacket.data().titleList[0] |= ( 1 << 8 );
titleListPacket.data().titleList[16] |= ( 1 << 2 );
titleListPacket.data().titleList[20] |= ( 1 << 2 );
titleListPacket.data().titleList[0x2F] = 0xFF;*/
uint32_t titleId = 182;
uint32_t arrayAcc = titleId / 8;
uint32_t maskVal;
if ( titleId < 8 )
{
maskVal = titleId;
}
else if ( titleId < 16 )
{
maskVal = ( (titleId) % 8 );
}
else
{
maskVal = ( titleId % arrayAcc ) + 1;
}
titleListPacket.data().titleList[arrayAcc] |= ( maskVal );
//titleListPacket.data().titleList[6] |= (1 << 1);
pPlayer->queuePacket( titleListPacket ); pPlayer->queuePacket( titleListPacket );
} }