diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h index 84e49bebf..df9424f3f 100644 --- a/src/game/GridNotifiers.h +++ b/src/game/GridNotifiers.h @@ -1129,12 +1129,12 @@ namespace MaNGOS class NearestCreatureEntryWithLiveStateInObjectRangeCheck { public: - NearestCreatureEntryWithLiveStateInObjectRangeCheck(WorldObject const& obj,uint32 entry, bool alive, float range) - : i_obj(obj), i_entry(entry), i_alive(alive), i_range(range) {} + NearestCreatureEntryWithLiveStateInObjectRangeCheck(WorldObject const& obj,uint32 entry, bool onlyAlive, bool onlyDead, float range) + : i_obj(obj), i_entry(entry), i_onlyAlive(onlyAlive), i_onlyDead(onlyDead), i_range(range) {} WorldObject const& GetFocusObject() const { return i_obj; } bool operator()(Creature* u) { - if (u->GetEntry() == i_entry && (i_alive && u->isAlive() || !i_alive && u->IsCorpse()) && i_obj.IsWithinDistInMap(u, i_range)) + if (u->GetEntry() == i_entry && (i_onlyAlive && u->isAlive() || i_onlyDead && u->IsCorpse() || !i_onlyAlive && !i_onlyDead) && i_obj.IsWithinDistInMap(u, i_range)) { i_range = i_obj.GetDistance(u); // use found unit range as new range limit for next check return true; @@ -1145,7 +1145,8 @@ namespace MaNGOS private: WorldObject const& i_obj; uint32 i_entry; - bool i_alive; + bool i_onlyAlive; + bool i_onlyDead; float i_range; // prevent clone this object diff --git a/src/game/ScriptMgr.cpp b/src/game/ScriptMgr.cpp index 052d93781..eb0525047 100644 --- a/src/game/ScriptMgr.cpp +++ b/src/game/ScriptMgr.cpp @@ -827,7 +827,7 @@ bool ScriptAction::GetScriptProcessTargets(WorldObject* pOrigSource, WorldObject { Creature* pCreatureBuddy = NULL; - MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*pSearcher, m_script->buddyEntry, true, m_script->searchRadius); + MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*pSearcher, m_script->buddyEntry, true, false, m_script->searchRadius); MaNGOS::CreatureLastSearcher searcher(pCreatureBuddy, u_check); Cell::VisitGridObjects(pSearcher, searcher, m_script->searchRadius); diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index de15dc2ef..83edb1c7c 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -5105,7 +5105,7 @@ SpellCastResult Spell::CheckCast(bool strict) // no target provided or it was not valid, so use closest in range if (!targetExplicit) { - MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*m_caster, i_spellST->second.targetEntry, i_spellST->second.type != SPELL_TARGET_TYPE_DEAD, range); + MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*m_caster, i_spellST->second.targetEntry, i_spellST->second.type != SPELL_TARGET_TYPE_DEAD, i_spellST->second.type == SPELL_TARGET_TYPE_DEAD, range); MaNGOS::CreatureLastSearcher searcher(p_Creature, u_check); // Visit all, need to find also Pet* objects diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 11fcfd1db..1cf529418 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -2155,7 +2155,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) Creature* pTargetDummy = NULL; float fRange = GetSpellMaxRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); - MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*m_caster, 28523, true, fRange*2); + MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*m_caster, 28523, true, false, fRange*2); MaNGOS::CreatureLastSearcher searcher(pTargetDummy, u_check); Cell::VisitGridObjects(m_caster, searcher, fRange*2); @@ -6778,7 +6778,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) float range = 20.0f; // search for a reef cow nearby - MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*m_caster, 24797, true, range); + MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*m_caster, 24797, true, false, range); MaNGOS::CreatureLastSearcher searcher(pQuestCow, u_check); Cell::VisitGridObjects(m_caster, searcher, range); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a09246f20..594b4054c 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11941" + #define REVISION_NR "11942" #endif // __REVISION_NR_H__