mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-01 16:37:45 +00:00
Redoing everything
This commit is contained in:
parent
20e36d1716
commit
311a587bab
14 changed files with 64 additions and 26 deletions
|
@ -70,7 +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',
|
||||
`EquipDisplayFlags` int(3) DEFAULT '0',
|
||||
`unlocks` binary(64) DEFAULT NULL,
|
||||
`CharacterId` int(20) NOT NULL DEFAULT '0',
|
||||
`IS_DELETE` int(3) DEFAULT '0',
|
||||
|
|
|
@ -24,4 +24,4 @@
|
|||
-- -------------------------------------------
|
||||
-- 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`;
|
|
@ -1056,7 +1056,7 @@ namespace Core {
|
|||
Unused100
|
||||
};
|
||||
|
||||
enum CharaGearParamValues : uint8_t
|
||||
enum EquipDisplayFlags : uint8_t
|
||||
{
|
||||
HideNothing = 0x0,
|
||||
HideHead = 0x1,
|
||||
|
|
|
@ -188,7 +188,7 @@ namespace Packets {
|
|||
LinkshellEventHandler = 0x013B,
|
||||
LinkshellEventHandler1 = 0x013C,
|
||||
|
||||
ReqCharaGearParamChange = 0x0143,
|
||||
ReqEquipDisplayFlagsChange = 0x0143,
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -390,7 +390,7 @@ void Core::Entity::Player::setZone( uint32_t zoneId )
|
|||
|
||||
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 )
|
||||
|
@ -1426,18 +1426,18 @@ void Core::Entity::Player::setTitle( uint16_t titleId )
|
|||
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() );
|
||||
paramPacket.data().bitmask = m_charaGearParamState;
|
||||
paramPacket.data().bitmask = m_equipDisplayFlags;
|
||||
sendToInRangeSet( paramPacket, true );
|
||||
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 )
|
||||
|
|
|
@ -331,9 +331,9 @@ public:
|
|||
/*! change player's title */
|
||||
void setTitle( uint16_t titleId );
|
||||
/*! change gear param state */
|
||||
void setCharaGearParamState( uint8_t state );
|
||||
void setEquipDisplayFlags( uint8_t state );
|
||||
/*! get gear param state and send update to inRangeSet */
|
||||
uint8_t getCharaGearParamState() const;
|
||||
uint8_t getEquipDisplayFlags() const;
|
||||
|
||||
void calculateStats() override;
|
||||
void sendStats();
|
||||
|
@ -606,7 +606,7 @@ private:
|
|||
uint8_t m_gmRank;
|
||||
uint16_t zoneId;
|
||||
|
||||
uint8_t m_charaGearParamState;
|
||||
uint8_t m_equipDisplayFlags;
|
||||
|
||||
bool m_bInCombat;
|
||||
bool m_bLoadingComplete;
|
||||
|
|
|
@ -82,7 +82,7 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
|
|||
"cd.CFPenaltyUntil, "
|
||||
"cd.OpeningSequence, "
|
||||
"cd.GMRank, "
|
||||
"cd.CharaGearParamState "
|
||||
"cd.EquipDisplayFlags "
|
||||
"FROM charabase AS c "
|
||||
" INNER JOIN charadetail AS cd "
|
||||
" ON c.CharacterId = cd.CharacterId "
|
||||
|
@ -90,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( "[SQL] Failed loading Player ID " + char_id_str );
|
||||
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_gmRank = field[37].get< uint8_t >();
|
||||
m_charaGearParamState = field[38].get< uint8_t >();
|
||||
m_equipDisplayFlags = field[38].get< uint8_t >();
|
||||
|
||||
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 ) ) + "')" );
|
||||
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() ) ) );
|
||||
charaDetailSet.insert( " EquipDisplayFlags = " + std::to_string( static_cast< uint8_t >( getEquipDisplayFlags() ) ) );
|
||||
}
|
||||
|
||||
if( m_updateFlags & PlayerSyncFlags::OpeningSeq )
|
||||
|
|
|
@ -375,7 +375,13 @@ void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
}
|
||||
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) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ 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);
|
||||
setZoneHandler( ClientZoneIpcType::ReqEquipDisplayFlagsChange, "ReqEquipDisplayFlagsChange",&GameConnection::reqEquipDisplayFlagsHandler);
|
||||
|
||||
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()
|
||||
{
|
||||
g_log.debug( "DISCONNECT" );
|
||||
g_log.debug( "GameConnection DISCONNECT" );
|
||||
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 )
|
||||
{
|
||||
g_log.debug( "ERROR" );
|
||||
g_log.debug( "GameConnection ERROR: " + error.message() );
|
||||
}
|
||||
|
||||
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" );
|
||||
// return;
|
||||
g_serverZone.createSession( playerId );
|
||||
if( !g_serverZone.createSession( playerId ) )
|
||||
{
|
||||
Disconnect();
|
||||
return;
|
||||
}
|
||||
session = g_serverZone.getSession( playerId );
|
||||
}
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ public:
|
|||
DECLARE_HANDLER( gm1Handler );
|
||||
DECLARE_HANDLER( gm2Handler );
|
||||
|
||||
DECLARE_HANDLER( reqCharaGearParamHandler );
|
||||
DECLARE_HANDLER( reqEquipDisplayFlagsHandler );
|
||||
|
||||
DECLARE_HANDLER( tellHandler );
|
||||
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
pPlayer->setCharaGearParamState( inPacket.getValAt< uint8_t >( 0x20 ) );
|
||||
pPlayer->setEquipDisplayFlags( inPacket.getValAt< uint8_t >( 0x20 ) );
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::zoneLineHandler( const Packets::GamePacket& inPacket,
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -61,6 +61,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
|
||||
|
|
Loading…
Add table
Reference in a new issue