From d5677b2a5ad669961404ae75801ad23202deeb2c Mon Sep 17 00:00:00 2001 From: collett Date: Sat, 16 May 2020 02:46:51 +0900 Subject: [PATCH] greater than 65535 effect entry value. --- src/common/Common.h | 3 ++- src/world/Action/EffectResult.cpp | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/common/Common.h b/src/common/Common.h index efb6335b..854f9d6f 100644 --- a/src/common/Common.h +++ b/src/common/Common.h @@ -662,6 +662,7 @@ namespace Sapphire::Common { None = 0, Absorbed = 0x04, + ExtendedValue = 0x40, EffectOnSource = 0x80, Reflected = 0xA0, }; @@ -690,7 +691,7 @@ namespace Sapphire::Common * Has no effect on what is shown and stored in value */ uint8_t param2; - uint8_t valueMultiplier; // This multiplies whatever value is in the 'value' param by 10. Possibly a workaround for big numbers + uint8_t extendedValueHighestByte; uint8_t flags; int16_t value; }; diff --git a/src/world/Action/EffectResult.cpp b/src/world/Action/EffectResult.cpp index 2860210f..55c76f55 100644 --- a/src/world/Action/EffectResult.cpp +++ b/src/world/Action/EffectResult.cpp @@ -96,14 +96,21 @@ void EffectResult::mount( uint16_t mountId ) Common::EffectEntry EffectResult::buildEffectEntry() const { Common::EffectEntry entry{}; - - // todo: that retarded shit so > u16 max numbers work - entry.value = getValue(); + entry.effectType = m_type; + if( m_value > 0x0000FFFF ) + { + entry.value = static_cast< uint16_t >( m_value & 0x0000FFFF ); + entry.extendedValueHighestByte = static_cast< uint8_t >( m_value >> 16 ); + entry.flags = static_cast< uint8_t >( m_flag ) + static_cast< uint8_t >( Common::ActionEffectResultFlag::ExtendedValue ); + } + else + { + entry.value = static_cast< uint16_t >( m_value ); + entry.flags = static_cast< uint8_t >( m_flag ); + } entry.param0 = m_param0; entry.param1 = m_param1; - entry.effectType = m_type; entry.param2 = m_param2; - entry.flags = static_cast< uint8_t >( m_flag ); return entry; }