1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-25 05:57:45 +00:00

Add main handling for chara gear param state;

This commit is contained in:
amibu 2017-10-05 20:24:58 +02:00
parent edd42c53da
commit d4fe294f51
11 changed files with 55 additions and 7 deletions

View file

@ -70,6 +70,7 @@ CREATE TABLE IF NOT EXISTS `charadetail` (
`StepIndex` int(5) DEFAULT NULL,
`ChocoboTaxiStandFlags` binary(8) DEFAULT NULL,
`GMRank` int(3) DEFAULT '0',
`CharaGearParamState` int(3) DEFAULT '0',
`unlocks` binary(64) DEFAULT NULL,
`CharacterId` int(20) NOT NULL DEFAULT '0',
`IS_DELETE` int(3) DEFAULT '0',

View file

@ -22,4 +22,6 @@
--
-- 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 `CharaGearParamState` int(3) DEFAULT '0' AFTER `GMRank`;

View file

@ -946,7 +946,7 @@ namespace Core {
SetMaxGearSets = 0x230,
ToggleDisplayHeadAndWeapon = 0x260,
SetCharaGearParamUI = 0x260,
GearSetEquipMsg = 0x321
};

View file

@ -118,6 +118,8 @@ namespace Packets {
EorzeaTimeOffset = 0x01B4,
CharaGearParams = 0x01C0,
CFAvailableContents = 0x01CF,
PrepareZoning = 0x0239, // updated for sb
@ -185,6 +187,8 @@ namespace Packets {
LinkshellEventHandler = 0x013B,
LinkshellEventHandler1 = 0x013C,
ReqCharaGearParamChange = 0x0143,
};
////////////////////////////////////////////////////////////////////////////////

View file

@ -1286,6 +1286,14 @@ struct FFXIVIpcEorzeaTimeOffset : FFXIVIpcBasePacket<EorzeaTimeOffset>
uint64_t timestamp;
};
/**
* Structural representation of the packet sent by the server
* to set the gear show/hide status of a character
*/
struct FFXIVIpcCharaGearParams : FFXIVIpcBasePacket<CharaGearParams>
{
uint8_t bitmask;
};
} /* Server */

View file

@ -388,6 +388,11 @@ void Core::Entity::Player::setZone( uint32_t zoneId )
sendInventory();
if( isLogin() )
{
queuePacket(ActorControlPacket143( getId(), SetCharaGearParamUI, m_charaGearParamState, 1 ) );
}
// set flags, will be reset automatically by zoning ( only on client side though )
pPlayer->setStateFlag( PlayerStateFlag::BetweenAreas );
pPlayer->setStateFlag( PlayerStateFlag::BetweenAreas1 );
@ -1421,6 +1426,20 @@ void Core::Entity::Player::setTitle( uint16_t titleId )
sendToInRangeSet( ActorControlPacket142( getId(), SetTitle, titleId ), true );
}
void Core::Entity::Player::setCharaGearParamState( uint8_t state )
{
m_charaGearParamState = state;
GamePacketNew< FFXIVIpcCharaGearParams, ServerZoneIpcType > paramPacket( getId() );
paramPacket.data().bitmask = m_charaGearParamState;
sendToInRangeSet( paramPacket, true );
setSyncFlag( PlayerSyncFlags::Status );
}
uint8_t Core::Entity::Player::getCharaGearParamState() const
{
return m_charaGearParamState;
}
void Core::Entity::Player::autoAttack( ActorPtr pTarget )
{

View file

@ -330,6 +330,10 @@ public:
void prepareZoning( uint16_t targetZone, bool fadeOut, uint8_t fadoutTime = 0, uint16_t animation = 0 );
/*! change player's title */
void setTitle( uint16_t titleId );
/*! change gear param state */
void setCharaGearParamState( uint8_t state );
/*! get gear param state and send update to inRangeSet */
uint8_t getCharaGearParamState() const;
void calculateStats() override;
void sendStats();
@ -602,6 +606,8 @@ private:
uint8_t m_gmRank;
uint16_t zoneId;
uint8_t m_charaGearParamState;
bool m_bInCombat;
bool m_bLoadingComplete;
bool m_bAutoattack;

View file

@ -81,7 +81,8 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
"cd.GrandCompanyRank, "
"cd.CFPenaltyUntil, "
"cd.OpeningSequence, "
"cd.GMRank "
"cd.GMRank, "
"cd.CharaGearParamState "
"FROM charabase AS c "
" INNER JOIN charadetail AS cd "
" ON c.CharacterId = cd.CharacterId "
@ -173,6 +174,7 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
m_openingSequence = field[36].get< uint32_t >();
m_gmRank = field[37].get< uint8_t >();
m_charaGearParamState = field[38].get< uint8_t >();
m_pCell = nullptr;
@ -350,6 +352,7 @@ void Core::Entity::Player::createUpdateSql()
charaBaseSet.insert( " ModelEquip = UNHEX('" + std::string( Util::binaryToHexString( reinterpret_cast< uint8_t* >( m_modelEquip ), 40 ) ) + "')" );
charaDetailSet.insert( " Class = " + std::to_string( static_cast< uint32_t >( getClass() ) ) );
charaDetailSet.insert( " Status = " + std::to_string( static_cast< uint8_t >( getStatus() ) ) );
charaDetailSet.insert( " CharaGearParamState = " + std::to_string( static_cast< uint8_t >( getCharaGearParamState() ) ) );
}
if( m_updateFlags & PlayerSyncFlags::OpeningSeq )

View file

@ -93,8 +93,9 @@ Core::Network::GameConnection::GameConnection( Core::Network::HivePtr pHive,
setZoneHandler( ClientZoneIpcType::CFRegisterRoulette, "CFRegisterRoulette", &GameConnection::cfRegisterRoulette );
setZoneHandler( ClientZoneIpcType::CFCommenceHandler, "CFDutyAccepted", &GameConnection::cfDutyAccepted);
setZoneHandler( ClientZoneIpcType::ReqCharaGearParamChange, "ReqCharaGearParamChange",&GameConnection::reqCharaGearParamHandler);
setChatHandler( ClientChatIpcType::TellReq, "TellReq", &GameConnection::tellHandler);
setChatHandler( ClientChatIpcType::TellReq, "TellReq", &GameConnection::tellHandler);
}

View file

@ -116,10 +116,10 @@ public:
DECLARE_HANDLER( gm1Handler );
DECLARE_HANDLER( gm2Handler );
DECLARE_HANDLER( reqCharaGearParamHandler );
DECLARE_HANDLER( tellHandler );
};

View file

@ -285,7 +285,11 @@ void Core::Network::GameConnection::updatePositionHandler( const Packets::GamePa
}
void Core::Network::GameConnection::reqCharaGearParamHandler( const Packets::GamePacket& inPacket,
Entity::PlayerPtr pPlayer )
{
pPlayer->setCharaGearParamState( inPacket.getValAt< uint8_t >( 0x20 ) );
}
void Core::Network::GameConnection::zoneLineHandler( const Packets::GamePacket& inPacket,
Entity::PlayerPtr pPlayer )