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

Cleanup, mount DB saving;

This commit is contained in:
amibu 2017-10-18 17:54:17 +02:00
parent 240e06a634
commit 77717d29f3
9 changed files with 43 additions and 17 deletions

View file

@ -952,7 +952,8 @@ namespace Core {
GearSetEquipMsg = 0x321, GearSetEquipMsg = 0x321,
ToggleOrchestrionUnlock = 0x396 ToggleOrchestrionUnlock = 0x396,
Dismount = 0x3a0
}; };
enum struct ChatType : uint16_t enum struct ChatType : uint16_t

View file

@ -26,14 +26,13 @@ Core::Action::ActionMount::ActionMount()
m_handleActionType = Common::HandleActionType::Event; m_handleActionType = Common::HandleActionType::Event;
} }
Core::Action::ActionMount::ActionMount( Entity::ActorPtr pActor, Entity::ActorPtr pTarget, uint32_t actionId ) Core::Action::ActionMount::ActionMount( Entity::ActorPtr pActor, uint32_t mountId )
{ {
m_startTime = 0; m_startTime = 0;
m_id = actionId; m_id = mountId;
m_handleActionType = HandleActionType::Spell; m_handleActionType = HandleActionType::Spell;
m_castTime = 1000; m_castTime = 1000;
m_pSource = pActor; m_pSource = pActor;
m_pTarget = pTarget;
m_bInterrupt = false; m_bInterrupt = false;
} }
@ -56,7 +55,7 @@ void Core::Action::ActionMount::onStart()
castPacket.data().skillType = Common::SkillType::MountSkill; castPacket.data().skillType = Common::SkillType::MountSkill;
castPacket.data().unknown_1 = m_id; castPacket.data().unknown_1 = m_id;
castPacket.data().cast_time = static_cast< float >( m_castTime / 1000 ); // This is used for the cast bar above the target bar of the caster. castPacket.data().cast_time = static_cast< float >( m_castTime / 1000 ); // This is used for the cast bar above the target bar of the caster.
castPacket.data().target_id = m_pTarget->getId(); castPacket.data().target_id = m_pSource->getAsPlayer()->getId();
m_pSource->sendToInRangeSet( castPacket, true ); m_pSource->sendToInRangeSet( castPacket, true );
m_pSource->getAsPlayer()->setStateFlag( PlayerStateFlag::Casting ); m_pSource->getAsPlayer()->setStateFlag( PlayerStateFlag::Casting );
@ -89,9 +88,6 @@ void Core::Action::ActionMount::onFinish()
pPlayer->sendToInRangeSet(effectPacket, true); pPlayer->sendToInRangeSet(effectPacket, true);
pPlayer->sendToInRangeSet(ActorControlPacket142(pPlayer->getId(), ActorControlType::SetStatus, 4), true); //?
pPlayer->sendToInRangeSet(ActorControlPacket143(pPlayer->getId(), 0x39e, 12), true); //?
pPlayer->mount( m_id ); pPlayer->mount( m_id );
} }

View file

@ -14,7 +14,7 @@ namespace Core { namespace Action {
ActionMount(); ActionMount();
~ActionMount(); ~ActionMount();
ActionMount( Entity::ActorPtr pActor, Entity::ActorPtr pTarget, uint32_t actionId ); ActionMount( Entity::ActorPtr pActor, uint32_t mountId );
void onStart() override; void onStart() override;
void onFinish() override; void onFinish() override;

View file

@ -1488,9 +1488,27 @@ uint8_t Core::Entity::Player::getEquipDisplayFlags() const
void Core::Entity::Player::mount( uint32_t id ) void Core::Entity::Player::mount( uint32_t id )
{ {
m_mount = id;
sendToInRangeSet( ActorControlPacket142( getId(), ActorControlType::SetStatus, static_cast< uint8_t >( Entity::Actor::ActorStatus::Mounted )), true );
sendToInRangeSet( ActorControlPacket143( getId(), 0x39e, 12 ), true ); //?
GamePacketNew< FFXIVIpcMount, ServerZoneIpcType > mountPacket( getId() ); GamePacketNew< FFXIVIpcMount, ServerZoneIpcType > mountPacket( getId() );
mountPacket.data().id = id; mountPacket.data().id = m_mount;
sendToInRangeSet( mountPacket, true ); sendToInRangeSet( mountPacket, true );
setSyncFlag( PlayerSyncFlags::Status );
}
void Core::Entity::Player::dismount()
{
sendToInRangeSet( ActorControlPacket142( getId(), ActorControlType::SetStatus, static_cast< uint8_t >( Entity::Actor::ActorStatus::Idle )), true );
sendToInRangeSet( ActorControlPacket143( getId(), ActorControlType::Dismount, 1 ), true );
m_mount = 0;
setSyncFlag( PlayerSyncFlags::Status );
}
uint8_t Core::Entity::Player::getCurrentMount() const
{
return m_mount;
} }
void Core::Entity::Player::autoAttack( ActorPtr pTarget ) void Core::Entity::Player::autoAttack( ActorPtr pTarget )

View file

@ -338,10 +338,14 @@ public:
void setTitle( uint16_t titleId ); void setTitle( uint16_t titleId );
/*! change gear param state */ /*! change gear param state */
void setEquipDisplayFlags( uint8_t state ); void setEquipDisplayFlags( uint8_t state );
/*! get gear param state and send update to inRangeSet */ /*! get gear param state */
uint8_t getEquipDisplayFlags() const; uint8_t getEquipDisplayFlags() const;
/*! mount the specified mount and send the packet */ /*! mount the specified mount and send the packets */
void mount( uint32_t id ); void mount( uint32_t id );
/*! dismount the current mount and send the packets */
void dismount();
/*! get the current mount */
uint8_t getCurrentMount() const;
void calculateStats() override; void calculateStats() override;
void sendStats(); void sendStats();

View file

@ -85,7 +85,8 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
"cd.EquipDisplayFlags, " "cd.EquipDisplayFlags, "
"cd.ActiveTitle, " "cd.ActiveTitle, "
"cd.TitleList, " // 40 "cd.TitleList, " // 40
"cd.Orchestrion " "cd.Orchestrion, "
"c.Mount "
"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 "
@ -180,10 +181,13 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
m_equipDisplayFlags = field[38].get< uint8_t >(); m_equipDisplayFlags = field[38].get< uint8_t >();
m_title = field[39].get< uint8_t >(); m_title = field[39].get< uint8_t >();
field[40].getBinary( reinterpret_cast< char* >( m_titleList ), sizeof( m_titleList ) ); field[40].getBinary( reinterpret_cast< char* >( m_titleList ), sizeof( m_titleList ) );
field[41].getBinary( reinterpret_cast< char* >( m_orchestrion ), sizeof( m_orchestrion ) ); field[41].getBinary( reinterpret_cast< char* >( m_orchestrion ), sizeof( m_orchestrion ) );
m_mount = field[42].get< uint8_t >();
m_pCell = nullptr; m_pCell = nullptr;
if( !loadActiveQuests() || !loadClassData() || !loadSearchInfo() ) if( !loadActiveQuests() || !loadClassData() || !loadSearchInfo() )
@ -371,6 +375,7 @@ void Core::Entity::Player::createUpdateSql()
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( " EquipDisplayFlags = " + std::to_string( static_cast< uint8_t >( getEquipDisplayFlags() ) ) ); charaDetailSet.insert( " EquipDisplayFlags = " + std::to_string( static_cast< uint8_t >( getEquipDisplayFlags() ) ) );
charaBaseSet.insert( " Mount = " + std::to_string( getCurrentMount() ) );
} }
if( m_updateFlags & PlayerSyncFlags::OpeningSeq ) if( m_updateFlags & PlayerSyncFlags::OpeningSeq )

View file

@ -108,8 +108,8 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
} }
case 0x65: case 0x65:
{ {
pPlayer->sendToInRangeSet( ActorControlPacket142(pPlayer->getId(), ActorControlType::SetStatus, 1 ), true ); //? pPlayer->dismount();
pPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), 0x393, 1 ), true ); //? break;
} }
case 0x68: // Remove status (clicking it off) case 0x68: // Remove status (clicking it off)
{ {

View file

@ -118,7 +118,7 @@ void Core::Network::GameConnection::skillHandler( const Packets::GamePacket& inP
pPlayer->sendDebug( "Request mount " + std::to_string( action ) ); pPlayer->sendDebug( "Request mount " + std::to_string( action ) );
Action::ActionMountPtr pActionMount(new Action::ActionMount(pPlayer, pPlayer, action)); Action::ActionMountPtr pActionMount( new Action::ActionMount(pPlayer, action) );
pPlayer->setCurrentAction( pActionMount ); pPlayer->setCurrentAction( pActionMount );
pPlayer->sendDebug("setCurrentAction()"); pPlayer->sendDebug("setCurrentAction()");
pPlayer->getCurrentAction()->onStart(); pPlayer->getCurrentAction()->onStart();

View file

@ -111,6 +111,8 @@ namespace Server {
m_data.displayFlags |= Entity::Actor::DisplayFlags::Visor; m_data.displayFlags |= Entity::Actor::DisplayFlags::Visor;
} }
m_data.currentMount = pPlayer->getCurrentMount();
m_data.targetId = pPlayer->getTargetId(); m_data.targetId = pPlayer->getTargetId();
//m_data.type = 1; //m_data.type = 1;
//m_data.unknown_33 = 4; //m_data.unknown_33 = 4;