Core/Scripts: Implement Flag of Ownership

Core/Spells: Implemented TARGET_CORPSE_SRC_AREA_ENEMY.
This commit is contained in:
Aokromes
2016-09-10 03:53:34 +02:00
parent 2701c96ab1
commit dc4657218e
2 changed files with 61 additions and 1 deletions

View File

@@ -2723,6 +2723,65 @@ public:
}
};
enum TauntFlag
{
SPELL_TAUNT_FLAG = 51657,
EMOTE_PLANTS_FLAG = 28008
};
// 51640 - Taunt Flag Targeting
class spell_item_taunt_flag_targeting : public SpellScriptLoader
{
public:
spell_item_taunt_flag_targeting() : SpellScriptLoader("spell_item_taunt_flag_targeting") { }
class spell_item_taunt_flag_targeting_SpellScript : public SpellScript
{
PrepareSpellScript(spell_item_taunt_flag_targeting_SpellScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_TAUNT_FLAG))
return false;
if (!sObjectMgr->GetBroadcastText(EMOTE_PLANTS_FLAG))
return false;
return true;
}
void FilterTargets(std::list<WorldObject*>& targets)
{
if (targets.empty())
{
FinishCast(SPELL_FAILED_NO_VALID_TARGETS);
return;
}
Trinity::Containers::RandomResizeList(targets, 1);
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
// we *really* want the unit implementation here
// it sends a packet like seen on sniff
GetCaster()->Unit::TextEmote(EMOTE_PLANTS_FLAG, GetHitUnit(), false);
GetCaster()->CastSpell(GetHitUnit(), SPELL_TAUNT_FLAG, true);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_item_taunt_flag_targeting_SpellScript::FilterTargets, EFFECT_0, TARGET_CORPSE_SRC_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_item_taunt_flag_targeting_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_item_taunt_flag_targeting_SpellScript();
}
};
void AddSC_item_spell_scripts()
{
// 23074 Arcanite Dragonling
@@ -2793,4 +2852,5 @@ void AddSC_item_spell_scripts()
new spell_item_muisek_vessel();
new spell_item_greatmothers_soulcatcher();
new spell_item_toy_train_set_pulse();
new spell_item_taunt_flag_targeting();
}