mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-25 14:07:46 +00:00
validate the time since the last combo action and ignore any old combos
This commit is contained in:
parent
892069ed51
commit
68cc187cc6
3 changed files with 26 additions and 1 deletions
|
@ -21,6 +21,13 @@ namespace Sapphire::Common
|
|||
const int32_t INVALID_GAME_OBJECT_ID = 0xE0000000;
|
||||
const uint64_t INVALID_GAME_OBJECT_ID64 = 0xE0000000;
|
||||
|
||||
/*!
|
||||
* @brief The maximum length (in ms) of a combo before it is canceled/voided.
|
||||
*
|
||||
* The client has a combo timer of about 12 seconds, with a 0.5 second grace on top for latency considerations.
|
||||
*/
|
||||
const uint16_t MAX_COMBO_LENGTH = 12500;
|
||||
|
||||
struct FFXIVARR_POSITION3_U16
|
||||
{
|
||||
uint16_t x;
|
||||
|
|
|
@ -662,9 +662,18 @@ int64_t Sapphire::Entity::Chara::getLastUpdateTime() const
|
|||
void Sapphire::Entity::Chara::setLastComboActionId( uint32_t actionId )
|
||||
{
|
||||
m_lastComboActionId = actionId;
|
||||
m_lastComboActionTime = Util::getTimeMs();
|
||||
}
|
||||
|
||||
uint32_t Sapphire::Entity::Chara::getLastComboActionId() const
|
||||
{
|
||||
// initially check for the time passed first, if it's more than the threshold just return 0 for the combo
|
||||
// we can hide the implementation detail this way and it just works:tm: for anything that uses it
|
||||
|
||||
if( std::difftime( Util::getTimeMs(), m_lastComboActionTime ) > Common::MAX_COMBO_LENGTH )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return m_lastComboActionId;
|
||||
}
|
||||
|
|
|
@ -103,8 +103,17 @@ namespace Sapphire::Entity
|
|||
uint64_t m_targetId;
|
||||
/*! Ptr to a queued action */
|
||||
Action::ActionPtr m_pCurrentAction;
|
||||
/*! the id of the last combo action used (IgnoresCombo) */
|
||||
|
||||
/*!
|
||||
* @brief the id of the last combo action used (IgnoresCombo)
|
||||
*/
|
||||
uint32_t m_lastComboActionId;
|
||||
|
||||
/*!
|
||||
* @brief when the last combo action was used in ms
|
||||
*/
|
||||
uint64_t m_lastComboActionTime;
|
||||
|
||||
/*! Invincibility type */
|
||||
Common::InvincibilityType m_invincibilityType;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue