From c6b07dd3ac31ec998207c9dd22f7b51f785e1c33 Mon Sep 17 00:00:00 2001 From: xoeo Date: Sat, 25 Jun 2016 04:09:12 +0800 Subject: [PATCH] fix hunter spell Mend pet out Range deduction MP problem (#147) * fix hunter spell Mend pet out Range fix hunter spell Mend pet out Range deduction MP problem * fix hunter spell Mend pet out Range fix hunter spell Mend pet out Range deduction MP problem * Update SharedDefines.h --- src/game/Server/SharedDefines.h | 2 ++ src/game/WorldHandlers/Spell.cpp | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/game/Server/SharedDefines.h b/src/game/Server/SharedDefines.h index 3e88f579..d2f18d78 100644 --- a/src/game/Server/SharedDefines.h +++ b/src/game/Server/SharedDefines.h @@ -1063,6 +1063,8 @@ enum SpellRangeIndex SPELL_RANGE_IDX_SELF_ONLY = 1, /// 5.5 (but dynamic), seems to indicate melee range SPELL_RANGE_IDX_COMBAT = 2, + /// 20 short range + SPELL_RANGE_IDX_SHORT = 3, /// 500000 (anywhere) SPELL_RANGE_IDX_ANYWHERE = 13, }; diff --git a/src/game/WorldHandlers/Spell.cpp b/src/game/WorldHandlers/Spell.cpp index 46e1de9a..f68a6574 100644 --- a/src/game/WorldHandlers/Spell.cpp +++ b/src/game/WorldHandlers/Spell.cpp @@ -5568,6 +5568,19 @@ SpellCastResult Spell::CheckRange(bool strict) } break; // let continue in generic way for no target } + case SPELL_RANGE_IDX_SHORT: + { + if ((m_spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && (m_spellInfo->SpellFamilyFlags & UI64LIT(0x00000080) || m_spellInfo->SpellFamilyFlags & 0x800000))) + { + Pet* pet = m_caster->GetPet(); + if (pet) + { + float max_range = GetSpellMaxRange(sSpellRangeStore.LookupEntry(SPELL_RANGE_IDX_SHORT)); + return m_caster->IsWithinDistInMap(pet, max_range) ? SPELL_CAST_OK : SPELL_FAILED_OUT_OF_RANGE; + } + } + break; + } } // add radius of caster and ~5 yds "give" for non stricred (landing) check @@ -6817,4 +6830,4 @@ SpellCastResult Spell::CanTameUnit(bool isGM) } } return SPELL_CAST_OK; -} \ No newline at end of file +}