aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2022-12-14 00:24:24 +0100
committerShauren <shauren.trinity@gmail.com>2022-12-14 00:24:24 +0100
commit2d205506bfd3a2bb253db73b121fd147928811ba (patch)
tree27776a348e064a17dbf9abc821355010bedd514b /src/server/game/Entities
parente98e1283ea0034baf6be9aa2ffb386eb5582801b (diff)
Core/Spells: Fixed spell effect value truncation when value is a large integer
Diffstat (limited to 'src/server/game/Entities')
-rw-r--r--src/server/game/Entities/Object/Object.cpp4
-rw-r--r--src/server/game/Entities/Object/Object.h2
-rw-r--r--src/server/game/Entities/Player/Player.cpp4
3 files changed, 7 insertions, 3 deletions
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index cca7c5fe890..e833ae78f2c 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -2272,7 +2272,7 @@ float WorldObject::GetSpellMinRangeForTarget(Unit const* target, SpellInfo const
return spellInfo->GetMinRange(!IsHostileTo(target));
}
-float WorldObject::ApplyEffectModifiers(SpellInfo const* spellInfo, uint8 effIndex, float value) const
+double WorldObject::ApplyEffectModifiers(SpellInfo const* spellInfo, uint8 effIndex, double value) const
{
if (Player* modOwner = GetSpellModOwner())
{
@@ -2294,6 +2294,8 @@ float WorldObject::ApplyEffectModifiers(SpellInfo const* spellInfo, uint8 effInd
case EFFECT_4:
modOwner->ApplySpellMod(spellInfo, SpellModOp::PointsIndex4, value);
break;
+ default:
+ break;
}
}
return value;
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index f409b13c626..6269bc1b975 100644
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -599,7 +599,7 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation
float GetSpellMaxRangeForTarget(Unit const* target, SpellInfo const* spellInfo) const;
float GetSpellMinRangeForTarget(Unit const* target, SpellInfo const* spellInfo) const;
- float ApplyEffectModifiers(SpellInfo const* spellInfo, uint8 effIndex, float value) const;
+ double ApplyEffectModifiers(SpellInfo const* spellInfo, uint8 effIndex, double value) const;
int32 CalcSpellDuration(SpellInfo const* spellInfo) const;
int32 ModSpellDuration(SpellInfo const* spellInfo, WorldObject const* target, int32 duration, bool positive, uint32 effectMask) const;
void ModSpellCastTime(SpellInfo const* spellInfo, int32& castTime, Spell* spell = nullptr) const;
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index e2cdadfb468..c49dc685bc0 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -21455,6 +21455,7 @@ void Player::GetSpellModValues(SpellInfo const* spellInfo, SpellModOp op, Spell*
template TC_GAME_API void Player::GetSpellModValues(SpellInfo const* spellInfo, SpellModOp op, Spell* spell, int32 base, int32* flat, float* pct) const;
template TC_GAME_API void Player::GetSpellModValues(SpellInfo const* spellInfo, SpellModOp op, Spell* spell, uint32 base, int32* flat, float* pct) const;
template TC_GAME_API void Player::GetSpellModValues(SpellInfo const* spellInfo, SpellModOp op, Spell* spell, float base, int32* flat, float* pct) const;
+template TC_GAME_API void Player::GetSpellModValues(SpellInfo const* spellInfo, SpellModOp op, Spell* spell, double base, int32* flat, float* pct) const;
template <class T>
void Player::ApplySpellMod(SpellInfo const* spellInfo, SpellModOp op, T& basevalue, Spell* spell /*= nullptr*/) const
@@ -21464,12 +21465,13 @@ void Player::ApplySpellMod(SpellInfo const* spellInfo, SpellModOp op, T& baseval
GetSpellModValues(spellInfo, op, spell, basevalue, &totalflat, &totalmul);
- basevalue = T(float(basevalue + totalflat) * totalmul);
+ basevalue = T(double(basevalue + totalflat) * totalmul);
}
template TC_GAME_API void Player::ApplySpellMod(SpellInfo const* spellInfo, SpellModOp op, int32& basevalue, Spell* spell) const;
template TC_GAME_API void Player::ApplySpellMod(SpellInfo const* spellInfo, SpellModOp op, uint32& basevalue, Spell* spell) const;
template TC_GAME_API void Player::ApplySpellMod(SpellInfo const* spellInfo, SpellModOp op, float& basevalue, Spell* spell) const;
+template TC_GAME_API void Player::ApplySpellMod(SpellInfo const* spellInfo, SpellModOp op, double& basevalue, Spell* spell) const;
void Player::AddSpellMod(SpellModifier* mod, bool apply)
{