mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-01 08:27:46 +00:00
refactor ActionInterruptType and move it into common
This commit is contained in:
parent
5acdef853a
commit
17a15b847e
5 changed files with 15 additions and 15 deletions
|
@ -639,6 +639,13 @@ namespace Sapphire::Common
|
||||||
Unknown3
|
Unknown3
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class ActionInterruptType : uint8_t
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
RegularInterrupt,
|
||||||
|
DamageInterrupt,
|
||||||
|
};
|
||||||
|
|
||||||
enum HandleActionType : uint8_t
|
enum HandleActionType : uint8_t
|
||||||
{
|
{
|
||||||
Event,
|
Event,
|
||||||
|
|
|
@ -28,7 +28,7 @@ Sapphire::Action::Action::Action( Entity::CharaPtr caster, uint32_t actionId,
|
||||||
m_pFw( std::move( fw ) ),
|
m_pFw( std::move( fw ) ),
|
||||||
m_id( actionId ),
|
m_id( actionId ),
|
||||||
m_startTime( 0 ),
|
m_startTime( 0 ),
|
||||||
m_interruptType( ActionInterruptType::None )
|
m_interruptType( Common::ActionInterruptType::None )
|
||||||
{
|
{
|
||||||
m_castTime = static_cast< uint32_t >( action->cast100ms * 100 );
|
m_castTime = static_cast< uint32_t >( action->cast100ms * 100 );
|
||||||
m_cooldownTime = static_cast< uint16_t >( action->recast100ms * 100 );
|
m_cooldownTime = static_cast< uint16_t >( action->recast100ms * 100 );
|
||||||
|
@ -74,10 +74,10 @@ Sapphire::Entity::CharaPtr Sapphire::Action::Action::getTargetChara() const
|
||||||
|
|
||||||
bool Sapphire::Action::Action::isInterrupted() const
|
bool Sapphire::Action::Action::isInterrupted() const
|
||||||
{
|
{
|
||||||
return m_interruptType != ActionInterruptType::None;
|
return m_interruptType != Common::ActionInterruptType::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Action::Action::setInterrupted( ActionInterruptType type )
|
void Sapphire::Action::Action::setInterrupted( Common::ActionInterruptType type )
|
||||||
{
|
{
|
||||||
m_interruptType = type;
|
m_interruptType = type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,13 +24,6 @@ namespace Sapphire::Action
|
||||||
uint16_t m_cost;
|
uint16_t m_cost;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class ActionInterruptType : uint8_t
|
|
||||||
{
|
|
||||||
None,
|
|
||||||
RegularInterrupt,
|
|
||||||
DamageInterrupt,
|
|
||||||
};
|
|
||||||
|
|
||||||
using ActionCostArray = std::array< ActionCostEntry, 2 >;
|
using ActionCostArray = std::array< ActionCostEntry, 2 >;
|
||||||
|
|
||||||
Action();
|
Action();
|
||||||
|
@ -48,7 +41,7 @@ namespace Sapphire::Action
|
||||||
Entity::CharaPtr getActionSource() const;
|
Entity::CharaPtr getActionSource() const;
|
||||||
|
|
||||||
bool isInterrupted() const;
|
bool isInterrupted() const;
|
||||||
void setInterrupted( ActionInterruptType type );
|
void setInterrupted( Common::ActionInterruptType type );
|
||||||
|
|
||||||
uint32_t getCastTime() const;
|
uint32_t getCastTime() const;
|
||||||
void setCastTime( uint32_t castTime );
|
void setCastTime( uint32_t castTime );
|
||||||
|
@ -127,7 +120,7 @@ namespace Sapphire::Action
|
||||||
Entity::CharaPtr m_pTarget;
|
Entity::CharaPtr m_pTarget;
|
||||||
uint64_t m_targetId;
|
uint64_t m_targetId;
|
||||||
|
|
||||||
ActionInterruptType m_interruptType;
|
Common::ActionInterruptType m_interruptType;
|
||||||
|
|
||||||
FrameworkPtr m_pFw;
|
FrameworkPtr m_pFw;
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,7 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( FrameworkPtr pFw,
|
||||||
case ClientTriggerType::CastCancel: // Cancel cast
|
case ClientTriggerType::CastCancel: // Cancel cast
|
||||||
{
|
{
|
||||||
if( player.getCurrentAction() )
|
if( player.getCurrentAction() )
|
||||||
player.getCurrentAction()->setInterrupted( Action::Action::ActionInterruptType::RegularInterrupt );
|
player.getCurrentAction()->setInterrupted( Common::ActionInterruptType::RegularInterrupt );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ClientTriggerType::Examine:
|
case ClientTriggerType::Examine:
|
||||||
|
|
|
@ -196,7 +196,7 @@ void Sapphire::Network::GameConnection::updatePositionHandler( FrameworkPtr pFw,
|
||||||
player.setPos( updatePositionPacket.data().position );
|
player.setPos( updatePositionPacket.data().position );
|
||||||
|
|
||||||
if( ( player.getCurrentAction() != nullptr ) && bPosChanged )
|
if( ( player.getCurrentAction() != nullptr ) && bPosChanged )
|
||||||
player.getCurrentAction()->setInterrupted( Action::Action::ActionInterruptType::RegularInterrupt );
|
player.getCurrentAction()->setInterrupted( Common::ActionInterruptType::RegularInterrupt );
|
||||||
|
|
||||||
// if no one is in range, don't bother trying to send a position update
|
// if no one is in range, don't bother trying to send a position update
|
||||||
if( !player.hasInRangeActor() )
|
if( !player.hasInRangeActor() )
|
||||||
|
|
Loading…
Add table
Reference in a new issue