mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-23 21:27:45 +00:00
Merge branch 'master'
This commit is contained in:
commit
964198dc90
16 changed files with 123 additions and 14 deletions
Binary file not shown.
Before Width: | Height: | Size: 537 KiB After Width: | Height: | Size: 27 KiB |
|
@ -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',
|
||||
`EquipDisplayFlags` int(3) DEFAULT '0',
|
||||
`unlocks` binary(64) DEFAULT NULL,
|
||||
`CharacterId` int(20) NOT NULL DEFAULT '0',
|
||||
`IS_DELETE` int(3) DEFAULT '0',
|
||||
|
|
|
@ -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 `EquipDisplayFlags` int(3) DEFAULT '0' AFTER `GMRank`;
|
|
@ -946,7 +946,7 @@ namespace Core {
|
|||
|
||||
SetMaxGearSets = 0x230,
|
||||
|
||||
ToggleDisplayHeadAndWeapon = 0x260,
|
||||
SetCharaGearParamUI = 0x260,
|
||||
|
||||
GearSetEquipMsg = 0x321
|
||||
};
|
||||
|
@ -1056,6 +1056,15 @@ namespace Core {
|
|||
Unused100
|
||||
};
|
||||
|
||||
enum EquipDisplayFlags : uint8_t
|
||||
{
|
||||
HideNothing = 0x0,
|
||||
HideHead = 0x1,
|
||||
HideWeapon = 0x2,
|
||||
|
||||
Visor = 0x40,
|
||||
};
|
||||
|
||||
struct ServerEntry
|
||||
{
|
||||
uint32_t serverId;
|
||||
|
|
|
@ -119,6 +119,8 @@ namespace Packets {
|
|||
|
||||
EorzeaTimeOffset = 0x01B4,
|
||||
|
||||
EquipDisplayFlags = 0x01C0,
|
||||
|
||||
CFAvailableContents = 0x01CF,
|
||||
|
||||
PrepareZoning = 0x0239, // updated for sb
|
||||
|
@ -186,6 +188,8 @@ namespace Packets {
|
|||
|
||||
LinkshellEventHandler = 0x013B,
|
||||
LinkshellEventHandler1 = 0x013C,
|
||||
|
||||
ReqEquipDisplayFlagsChange = 0x0143,
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -1294,6 +1294,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 FFXIVIpcEquipDisplayFlags : FFXIVIpcBasePacket<EquipDisplayFlags>
|
||||
{
|
||||
uint8_t bitmask;
|
||||
};
|
||||
|
||||
|
||||
} /* Server */
|
||||
|
|
|
@ -43,6 +43,16 @@ public:
|
|||
Active = 1,
|
||||
};
|
||||
|
||||
enum DisplayFlags : uint16_t
|
||||
{
|
||||
ActiveStance = 0x001,
|
||||
Invisible = 0x020,
|
||||
HideHead = 0x040,
|
||||
HideWeapon = 0x080,
|
||||
Faded = 0x100,
|
||||
Visor = 0x800,
|
||||
};
|
||||
|
||||
enum struct ActorStatus : uint8_t
|
||||
{
|
||||
Idle = 0x01,
|
||||
|
|
|
@ -388,6 +388,11 @@ void Core::Entity::Player::setZone( uint32_t zoneId )
|
|||
|
||||
sendInventory();
|
||||
|
||||
if( isLogin() )
|
||||
{
|
||||
queuePacket(ActorControlPacket143( getId(), SetCharaGearParamUI, m_equipDisplayFlags, 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::setEquipDisplayFlags( uint8_t state )
|
||||
{
|
||||
m_equipDisplayFlags = state;
|
||||
GamePacketNew< FFXIVIpcEquipDisplayFlags, ServerZoneIpcType > paramPacket( getId() );
|
||||
paramPacket.data().bitmask = m_equipDisplayFlags;
|
||||
sendToInRangeSet( paramPacket, true );
|
||||
setSyncFlag( PlayerSyncFlags::Status );
|
||||
}
|
||||
|
||||
uint8_t Core::Entity::Player::getEquipDisplayFlags() const
|
||||
{
|
||||
return m_equipDisplayFlags;
|
||||
}
|
||||
|
||||
void Core::Entity::Player::autoAttack( ActorPtr pTarget )
|
||||
{
|
||||
|
||||
|
|
|
@ -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 setEquipDisplayFlags( uint8_t state );
|
||||
/*! get gear param state and send update to inRangeSet */
|
||||
uint8_t getEquipDisplayFlags() const;
|
||||
|
||||
void calculateStats() override;
|
||||
void sendStats();
|
||||
|
@ -602,6 +606,8 @@ private:
|
|||
uint8_t m_gmRank;
|
||||
uint16_t zoneId;
|
||||
|
||||
uint8_t m_equipDisplayFlags;
|
||||
|
||||
bool m_bInCombat;
|
||||
bool m_bLoadingComplete;
|
||||
bool m_bAutoattack;
|
||||
|
|
|
@ -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.EquipDisplayFlags "
|
||||
"FROM charabase AS c "
|
||||
" INNER JOIN charadetail AS cd "
|
||||
" ON c.CharacterId = cd.CharacterId "
|
||||
|
@ -89,7 +90,7 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
|
|||
|
||||
if( !pQR )
|
||||
{
|
||||
g_log.error( "Player id " + char_id_str + " does not exist!" );
|
||||
g_log.error( "[DB] Failed loading Player ID " + char_id_str );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -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_equipDisplayFlags = 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( " EquipDisplayFlags = " + std::to_string( static_cast< uint8_t >( getEquipDisplayFlags() ) ) );
|
||||
}
|
||||
|
||||
if( m_updateFlags & PlayerSyncFlags::OpeningSeq )
|
||||
|
|
|
@ -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::ReqEquipDisplayFlagsChange, "ReqEquipDisplayFlagsChange",&GameConnection::reqEquipDisplayFlagsHandler);
|
||||
|
||||
setChatHandler( ClientChatIpcType::TellReq, "TellReq", &GameConnection::tellHandler);
|
||||
setChatHandler( ClientChatIpcType::TellReq, "TellReq", &GameConnection::tellHandler);
|
||||
|
||||
}
|
||||
|
||||
|
@ -116,7 +117,7 @@ void Core::Network::GameConnection::OnAccept( const std::string & host, uint16_t
|
|||
|
||||
void Core::Network::GameConnection::OnDisconnect()
|
||||
{
|
||||
g_log.debug( "DISCONNECT" );
|
||||
g_log.debug( "GameConnection DISCONNECT" );
|
||||
m_pSession = nullptr;
|
||||
}
|
||||
|
||||
|
@ -167,7 +168,7 @@ void Core::Network::GameConnection::OnRecv( std::vector< uint8_t > & buffer )
|
|||
|
||||
void Core::Network::GameConnection::OnError( const boost::system::error_code & error )
|
||||
{
|
||||
g_log.debug( "ERROR" );
|
||||
g_log.debug( "GameConnection ERROR: " + error.message() );
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::queueInPacket( Core::Network::Packets::GamePacketPtr inPacket )
|
||||
|
@ -380,10 +381,21 @@ void Core::Network::GameConnection::handlePackets( const Core::Network::Packets:
|
|||
{
|
||||
g_log.info( "[" + std::string( id ) + "] Session not registered, creating" );
|
||||
// return;
|
||||
g_serverZone.createSession( playerId );
|
||||
if( !g_serverZone.createSession( playerId ) )
|
||||
{
|
||||
Disconnect();
|
||||
return;
|
||||
}
|
||||
session = g_serverZone.getSession( playerId );
|
||||
}
|
||||
|
||||
if( !session->isValid() ) //TODO: Catch more things in lobby and send real errors
|
||||
{
|
||||
g_log.error( "[" + std::string(id) + "] Session INVALID, disconnecting" );
|
||||
Disconnect();
|
||||
return;
|
||||
}
|
||||
|
||||
// if not set, set the session for this connection
|
||||
if( !m_pSession && session )
|
||||
m_pSession = session;
|
||||
|
@ -418,8 +430,6 @@ void Core::Network::GameConnection::handlePackets( const Core::Network::Packets:
|
|||
sendSinglePacket( &pPe );
|
||||
}
|
||||
|
||||
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
|
|
@ -116,10 +116,10 @@ public:
|
|||
DECLARE_HANDLER( gm1Handler );
|
||||
DECLARE_HANDLER( gm2Handler );
|
||||
|
||||
DECLARE_HANDLER( reqEquipDisplayFlagsHandler );
|
||||
|
||||
DECLARE_HANDLER( tellHandler );
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -285,7 +285,11 @@ void Core::Network::GameConnection::updatePositionHandler( const Packets::GamePa
|
|||
|
||||
}
|
||||
|
||||
|
||||
void Core::Network::GameConnection::reqEquipDisplayFlagsHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
{
|
||||
pPlayer->setEquipDisplayFlags( inPacket.getValAt< uint8_t >( 0x20 ) );
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::zoneLineHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
|
|
|
@ -85,7 +85,22 @@ namespace Server {
|
|||
|
||||
if( pPlayer->getZoningType() != Common::ZoneingType::None )
|
||||
{
|
||||
m_data.displayFlags |= 0x20;
|
||||
m_data.displayFlags |= Entity::Actor::DisplayFlags::Invisible;
|
||||
}
|
||||
|
||||
if( pPlayer->getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::HideHead )
|
||||
{
|
||||
m_data.displayFlags |= Entity::Actor::DisplayFlags::HideHead;
|
||||
}
|
||||
|
||||
if( pPlayer->getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::HideWeapon )
|
||||
{
|
||||
m_data.displayFlags |= Entity::Actor::DisplayFlags::HideWeapon;
|
||||
}
|
||||
|
||||
if( pPlayer->getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::Visor )
|
||||
{
|
||||
m_data.displayFlags |= Entity::Actor::DisplayFlags::Visor;
|
||||
}
|
||||
|
||||
m_data.targetId = pPlayer->getTargetId();
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
Core::Session::Session( uint32_t sessionId )
|
||||
: m_sessionId( sessionId )
|
||||
, m_isValid( false )
|
||||
, m_lastDataTime( static_cast< uint32_t >( time( nullptr ) ) )
|
||||
{
|
||||
|
||||
|
@ -50,7 +51,12 @@ bool Core::Session::loadPlayer()
|
|||
m_pPlayer = Entity::PlayerPtr( new Entity::Player() );
|
||||
|
||||
if( !m_pPlayer->load( m_sessionId, shared_from_this() ) )
|
||||
{
|
||||
m_isValid = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_isValid = true;
|
||||
|
||||
return true;
|
||||
|
||||
|
@ -61,6 +67,9 @@ void Core::Session::close()
|
|||
if( m_pZoneConnection )
|
||||
m_pZoneConnection->Disconnect();
|
||||
|
||||
if( m_pChatConnection )
|
||||
m_pChatConnection->Disconnect();
|
||||
|
||||
// remove the session from the player
|
||||
if( m_pPlayer )
|
||||
// reset the zone, so the zone handler knows to remove the actor
|
||||
|
@ -77,6 +86,11 @@ uint32_t Core::Session::getLastDataTime() const
|
|||
return m_lastDataTime;
|
||||
}
|
||||
|
||||
bool Core::Session::isValid() const
|
||||
{
|
||||
return m_isValid;
|
||||
}
|
||||
|
||||
void Core::Session::updateLastDataTime()
|
||||
{
|
||||
m_lastDataTime = static_cast< uint32_t >( time( nullptr ) );
|
||||
|
|
|
@ -35,6 +35,8 @@ namespace Core {
|
|||
|
||||
void update();
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
Entity::PlayerPtr getPlayer() const;
|
||||
|
||||
private:
|
||||
|
@ -44,6 +46,8 @@ namespace Core {
|
|||
|
||||
uint32_t m_lastDataTime;
|
||||
|
||||
bool m_isValid;
|
||||
|
||||
Network::GameConnectionPtr m_pZoneConnection;
|
||||
Network::GameConnectionPtr m_pChatConnection;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue