Core/SpellScripts: Changed OnUnitTargetSelect hook to OnObjectAreaTargetSelect, it will now work with WorldObject instead of only Units and call it even for empty target lists

This commit is contained in:
Shauren committed 2012-06-29 21:53:35 +02:00
1 parent 6e4da3367a
commit e0997874f5
44 files changed
+368 -351

No files matched your search

+6 -7
View File
@@ -349,16 +349,15 @@ class spell_dk_death_pact : public SpellScriptLoader
return SPELL_FAILED_NO_PET;
}
void FilterTargets(std::list<Unit*>& unitList)
void FilterTargets(std::list<WorldObject*>& unitList)
{
Unit* unit_to_add = NULL;
for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
for (std::list<WorldObject*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
{
if ((*itr)->GetTypeId() == TYPEID_UNIT
&& (*itr)->GetOwnerGUID() == GetCaster()->GetGUID()
&& (*itr)->ToCreature()->GetCreatureTemplate()->type == CREATURE_TYPE_UNDEAD)
if (Unit* unit = (*itr)->ToUnit())
if (unit->GetOwnerGUID() == GetCaster()->GetGUID() && unit->GetCreatureType() == CREATURE_TYPE_UNDEAD)
{
unit_to_add = (*itr);
unit_to_add = unit;
break;
}
}
@@ -371,7 +370,7 @@ class spell_dk_death_pact : public SpellScriptLoader
void Register()
{
OnCheckCast += SpellCheckCastFn(spell_dk_death_pact_SpellScript::CheckCast);
OnUnitTargetSelect += SpellUnitTargetFn(spell_dk_death_pact_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ALLY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dk_death_pact_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ALLY);
}
};