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

Redoing everything

This commit is contained in:
amibu 2017-10-06 00:13:29 +02:00
parent 20e36d1716
commit 311a587bab
14 changed files with 64 additions and 26 deletions

View file

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

View file

@ -24,4 +24,4 @@
-- ------------------------------------------- -- -------------------------------------------
-- 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`; ALTER TABLE `charadetail` ADD `EquipDisplayFlags` int(3) DEFAULT '0' AFTER `GMRank`;

View file

@ -1056,7 +1056,7 @@ namespace Core {
Unused100 Unused100
}; };
enum CharaGearParamValues : uint8_t enum EquipDisplayFlags : uint8_t
{ {
HideNothing = 0x0, HideNothing = 0x0,
HideHead = 0x1, HideHead = 0x1,

View file

@ -188,7 +188,7 @@ namespace Packets {
LinkshellEventHandler = 0x013B, LinkshellEventHandler = 0x013B,
LinkshellEventHandler1 = 0x013C, LinkshellEventHandler1 = 0x013C,
ReqCharaGearParamChange = 0x0143, ReqEquipDisplayFlagsChange = 0x0143,
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -43,6 +43,16 @@ public:
Active = 1, Active = 1,
}; };
enum DisplayFlags : uint16_t
{
ActiveStance = 0x001,
Invisible = 0x020,
HideHead = 0x040,
HideWeapon = 0x080,
Faded = 0x100,
Visor = 0x800,
};
enum struct ActorStatus : uint8_t enum struct ActorStatus : uint8_t
{ {
Idle = 0x01, Idle = 0x01,

View file

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

View file

@ -331,9 +331,9 @@ public:
/*! 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 */
void setCharaGearParamState( uint8_t state ); void setEquipDisplayFlags( uint8_t state );
/*! get gear param state and send update to inRangeSet */ /*! get gear param state and send update to inRangeSet */
uint8_t getCharaGearParamState() const; uint8_t getEquipDisplayFlags() const;
void calculateStats() override; void calculateStats() override;
void sendStats(); void sendStats();
@ -606,7 +606,7 @@ private:
uint8_t m_gmRank; uint8_t m_gmRank;
uint16_t zoneId; uint16_t zoneId;
uint8_t m_charaGearParamState; uint8_t m_equipDisplayFlags;
bool m_bInCombat; bool m_bInCombat;
bool m_bLoadingComplete; bool m_bLoadingComplete;

View file

@ -82,7 +82,7 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
"cd.CFPenaltyUntil, " "cd.CFPenaltyUntil, "
"cd.OpeningSequence, " "cd.OpeningSequence, "
"cd.GMRank, " "cd.GMRank, "
"cd.CharaGearParamState " "cd.EquipDisplayFlags "
"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 "
@ -90,7 +90,7 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
if( !pQR ) if( !pQR )
{ {
g_log.error( "Player id " + char_id_str + " does not exist!" ); g_log.error( "[SQL] Failed loading Player ID " + char_id_str );
return false; return false;
} }
@ -174,7 +174,7 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
m_openingSequence = field[36].get< uint32_t >(); m_openingSequence = field[36].get< uint32_t >();
m_gmRank = field[37].get< uint8_t >(); m_gmRank = field[37].get< uint8_t >();
m_charaGearParamState = field[38].get< uint8_t >(); m_equipDisplayFlags = field[38].get< uint8_t >();
m_pCell = nullptr; m_pCell = nullptr;
@ -352,7 +352,7 @@ void Core::Entity::Player::createUpdateSql()
charaBaseSet.insert( " ModelEquip = UNHEX('" + std::string( Util::binaryToHexString( reinterpret_cast< uint8_t* >( m_modelEquip ), 40 ) ) + "')" ); 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( " Class = " + std::to_string( static_cast< uint32_t >( getClass() ) ) );
charaDetailSet.insert( " Status = " + std::to_string( static_cast< uint8_t >( getStatus() ) ) ); charaDetailSet.insert( " Status = " + std::to_string( static_cast< uint8_t >( getStatus() ) ) );
charaDetailSet.insert( " CharaGearParamState = " + std::to_string( static_cast< uint8_t >( getCharaGearParamState() ) ) ); charaDetailSet.insert( " EquipDisplayFlags = " + std::to_string( static_cast< uint8_t >( getEquipDisplayFlags() ) ) );
} }
if( m_updateFlags & PlayerSyncFlags::OpeningSeq ) if( m_updateFlags & PlayerSyncFlags::OpeningSeq )

View file

@ -375,7 +375,13 @@ void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlaye
} }
else else
{ {
pPlayer->sendUrgent( subCommand + " is not a valid ADD command." ); int32_t opcode;
sscanf(params.c_str(), "%x", &opcode);
Network::Packets::GamePacketNew<Network::Packets::Server::FFXIVIpcCharaGearParams, Network::Packets::ServerZoneIpcType > paramPacket(pPlayer->getId());
paramPacket.data().bitmask = opcode;
pPlayer->sendToInRangeSet(paramPacket, true);
pPlayer->sendUrgent( subCommand + " is not a valid ADD command." + std::to_string(opcode) );
} }

View file

@ -93,7 +93,7 @@ Core::Network::GameConnection::GameConnection( Core::Network::HivePtr pHive,
setZoneHandler( ClientZoneIpcType::CFRegisterRoulette, "CFRegisterRoulette", &GameConnection::cfRegisterRoulette ); setZoneHandler( ClientZoneIpcType::CFRegisterRoulette, "CFRegisterRoulette", &GameConnection::cfRegisterRoulette );
setZoneHandler( ClientZoneIpcType::CFCommenceHandler, "CFDutyAccepted", &GameConnection::cfDutyAccepted); setZoneHandler( ClientZoneIpcType::CFCommenceHandler, "CFDutyAccepted", &GameConnection::cfDutyAccepted);
setZoneHandler( ClientZoneIpcType::ReqCharaGearParamChange, "ReqCharaGearParamChange",&GameConnection::reqCharaGearParamHandler); setZoneHandler( ClientZoneIpcType::ReqEquipDisplayFlagsChange, "ReqEquipDisplayFlagsChange",&GameConnection::reqEquipDisplayFlagsHandler);
setChatHandler( ClientChatIpcType::TellReq, "TellReq", &GameConnection::tellHandler); setChatHandler( ClientChatIpcType::TellReq, "TellReq", &GameConnection::tellHandler);
@ -117,7 +117,7 @@ void Core::Network::GameConnection::OnAccept( const std::string & host, uint16_t
void Core::Network::GameConnection::OnDisconnect() void Core::Network::GameConnection::OnDisconnect()
{ {
g_log.debug( "DISCONNECT" ); g_log.debug( "GameConnection DISCONNECT" );
m_pSession = nullptr; m_pSession = nullptr;
} }
@ -168,7 +168,7 @@ void Core::Network::GameConnection::OnRecv( std::vector< uint8_t > & buffer )
void Core::Network::GameConnection::OnError( const boost::system::error_code & error ) 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 ) void Core::Network::GameConnection::queueInPacket( Core::Network::Packets::GamePacketPtr inPacket )
@ -381,7 +381,11 @@ void Core::Network::GameConnection::handlePackets( const Core::Network::Packets:
{ {
g_log.info( "[" + std::string( id ) + "] Session not registered, creating" ); g_log.info( "[" + std::string( id ) + "] Session not registered, creating" );
// return; // return;
g_serverZone.createSession( playerId ); if( !g_serverZone.createSession( playerId ) )
{
Disconnect();
return;
}
session = g_serverZone.getSession( playerId ); session = g_serverZone.getSession( playerId );
} }

View file

@ -116,7 +116,7 @@ public:
DECLARE_HANDLER( gm1Handler ); DECLARE_HANDLER( gm1Handler );
DECLARE_HANDLER( gm2Handler ); DECLARE_HANDLER( gm2Handler );
DECLARE_HANDLER( reqCharaGearParamHandler ); DECLARE_HANDLER( reqEquipDisplayFlagsHandler );
DECLARE_HANDLER( tellHandler ); DECLARE_HANDLER( tellHandler );

View file

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

View file

@ -85,7 +85,22 @@ namespace Server {
if( pPlayer->getZoningType() != Common::ZoneingType::None ) 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(); m_data.targetId = pPlayer->getTargetId();

View file

@ -61,6 +61,9 @@ void Core::Session::close()
if( m_pZoneConnection ) if( m_pZoneConnection )
m_pZoneConnection->Disconnect(); m_pZoneConnection->Disconnect();
if( m_pChatConnection )
m_pChatConnection->Disconnect();
// remove the session from the player // remove the session from the player
if( m_pPlayer ) if( m_pPlayer )
// reset the zone, so the zone handler knows to remove the actor // reset the zone, so the zone handler knows to remove the actor