From 8fcfabe784797fea46e25428492d9070adda1dc9 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Fri, 10 Jan 2014 22:39:08 +0100 Subject: Core/Spells: Fix potions cooldown in combat Fix a cooldown issue related to potions allowing Players in combat to use more than 1 potion in a row, especially with high latency. This also fixes an exploit about using infinite potions in combat just by skipping the client-side check. The original implementation c064c2e2e1eebd43b273365583dd181293bafa22 was missing a check in Spell::CheckCast() about this particular case since Potion cooldown is added only after the Player goes out of combat. Fixes #1259 . --- src/server/game/Spells/Spell.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/server/game/Spells/Spell.cpp') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 4aedc1a95eb..49eed70f57d 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -4760,6 +4760,10 @@ SpellCastResult Spell::CheckCast(bool strict) else return SPELL_FAILED_NOT_READY; } + + // check if we are using a potion in combat for the 2nd+ time. Cooldown is added only after caster gets out of combat + if (m_caster->ToPlayer()->GetLastPotionId() && m_CastItem && (m_CastItem->IsPotion() || m_spellInfo->IsCooldownStartedOnEvent())) + return SPELL_FAILED_NOT_READY; } if (m_spellInfo->AttributesEx7 & SPELL_ATTR7_IS_CHEAT_SPELL && !m_caster->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_ALLOW_CHEAT_SPELLS)) -- cgit v1.2.3