1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-26 06:27:45 +00:00

minor cleanup in regards to how we handle players who cast actions

This commit is contained in:
NotAdam 2019-02-10 21:18:03 +11:00
parent ff712cfb0b
commit 9fe821c676

View file

@ -138,19 +138,22 @@ void Sapphire::Action::Action::onStart()
if( isCastedAction() ) if( isCastedAction() )
{ {
m_pSource->getAsPlayer()->sendDebug( "onStart()" );
auto castPacket = makeZonePacket< Server::FFXIVIpcActorCast >( getId() ); auto castPacket = makeZonePacket< Server::FFXIVIpcActorCast >( getId() );
castPacket->data().action_id = m_id; castPacket->data().action_id = static_cast< uint16_t >( m_id );
castPacket->data().skillType = Common::SkillType::Normal; castPacket->data().skillType = Common::SkillType::Normal;
castPacket->data().unknown_1 = m_id; castPacket->data().unknown_1 = m_id;
// This is used for the cast bar above the target bar of the caster. // This is used for the cast bar above the target bar of the caster.
castPacket->data().cast_time = m_castTime / 1000.f; castPacket->data().cast_time = m_castTime / 1000.f;
castPacket->data().target_id = m_targetId; castPacket->data().target_id = static_cast< uint32_t >( m_targetId );
m_pSource->sendToInRangeSet( castPacket, true ); m_pSource->sendToInRangeSet( castPacket, true );
m_pSource->getAsPlayer()->setStateFlag( PlayerStateFlag::Casting );
if( auto player = m_pSource->getAsPlayer() )
{
player->setStateFlag( PlayerStateFlag::Casting );
player->sendDebug( "onStart()" );
}
} }
} }
@ -171,6 +174,8 @@ void Sapphire::Action::Action::onInterrupt()
// reset state flag // reset state flag
//player->unsetStateFlag( PlayerStateFlag::Occupied1 ); //player->unsetStateFlag( PlayerStateFlag::Occupied1 );
player->unsetStateFlag( PlayerStateFlag::Casting ); player->unsetStateFlag( PlayerStateFlag::Casting );
player->sendDebug( "onInterrupt()" );
} }
if( isCastedAction() ) if( isCastedAction() )
@ -199,8 +204,6 @@ void Sapphire::Action::Action::onFinish()
if( isCastedAction() ) if( isCastedAction() )
{ {
pPlayer->unsetStateFlag( PlayerStateFlag::Casting );
/*auto control = ActorControlPacket143( m_pTarget->getId(), ActorControlType::Unk7, /*auto control = ActorControlPacket143( m_pTarget->getId(), ActorControlType::Unk7,
0x219, m_id, m_id, m_id, m_id ); 0x219, m_id, m_id, m_id, m_id );
m_pSource->sendToInRangeSet( control, true );*/ m_pSource->sendToInRangeSet( control, true );*/