mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 10:26:28 +01:00
Scripts/Spells: Feign Death & 'prevent emotes flag' spell scripts (#26198)
Closes #25842 Ref #25764
This commit is contained in:
@@ -1158,37 +1158,6 @@ class spell_gen_create_lance : public SpellScript
|
||||
}
|
||||
};
|
||||
|
||||
class spell_gen_creature_permanent_feign_death : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_gen_creature_permanent_feign_death);
|
||||
|
||||
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
target->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD);
|
||||
target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH);
|
||||
|
||||
if (Creature* creature = target->ToCreature())
|
||||
creature->SetReactState(REACT_PASSIVE);
|
||||
}
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
target->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD);
|
||||
target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH);
|
||||
|
||||
if (Creature* creature = target->ToCreature())
|
||||
creature->InitializeReactState();
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectApply += AuraEffectApplyFn(spell_gen_creature_permanent_feign_death::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_gen_creature_permanent_feign_death::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
enum DalaranDisguiseSpells
|
||||
{
|
||||
SPELL_SUNREAVER_DISGUISE_TRIGGER = 69672,
|
||||
@@ -1733,6 +1702,117 @@ class spell_steal_essence_visual : public AuraScript
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
There are only 3 possible flags Feign Death auras can apply: UNIT_DYNFLAG_DEAD, UNIT_FLAG2_FEIGN_DEATH
|
||||
and UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT. Some auras can apply only 2 flags
|
||||
|
||||
spell_gen_feign_death_all_flags applies all 3 flags
|
||||
spell_gen_feign_death_no_dyn_flag applies no UNIT_DYNFLAG_DEAD (does not make the creature appear dead)
|
||||
spell_gen_feign_death_no_prevent_emotes applies no UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT
|
||||
|
||||
REACT_PASSIVE should be handled directly in scripts since not all creatures should be passive. Otherwise
|
||||
creature will be not able to aggro or execute MoveInLineOfSight events. Removing may cause more issues
|
||||
than already exists
|
||||
*/
|
||||
|
||||
class spell_gen_feign_death_all_flags : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_gen_feign_death_all_flags);
|
||||
|
||||
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
target->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD);
|
||||
target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH);
|
||||
target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT);
|
||||
|
||||
if (Creature* creature = target->ToCreature())
|
||||
creature->SetReactState(REACT_PASSIVE);
|
||||
}
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
target->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD);
|
||||
target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH);
|
||||
target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT);
|
||||
|
||||
if (Creature* creature = target->ToCreature())
|
||||
creature->InitializeReactState();
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectApply += AuraEffectApplyFn(spell_gen_feign_death_all_flags::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_gen_feign_death_all_flags::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
// 35357 - Spawn Feign Death
|
||||
// 51329 - Feign Death
|
||||
class spell_gen_feign_death_no_dyn_flag : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_gen_feign_death_no_dyn_flag);
|
||||
|
||||
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH);
|
||||
target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT);
|
||||
|
||||
if (Creature* creature = target->ToCreature())
|
||||
creature->SetReactState(REACT_PASSIVE);
|
||||
}
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH);
|
||||
target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT);
|
||||
|
||||
if (Creature* creature = target->ToCreature())
|
||||
creature->InitializeReactState();
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectApply += AuraEffectApplyFn(spell_gen_feign_death_no_dyn_flag::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_gen_feign_death_no_dyn_flag::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
// 58951 - Permanent Feign Death
|
||||
class spell_gen_feign_death_no_prevent_emotes : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_gen_feign_death_no_prevent_emotes);
|
||||
|
||||
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
target->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD);
|
||||
target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH);
|
||||
|
||||
if (Creature* creature = target->ToCreature())
|
||||
creature->SetReactState(REACT_PASSIVE);
|
||||
}
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
target->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD);
|
||||
target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH);
|
||||
|
||||
if (Creature* creature = target->ToCreature())
|
||||
creature->InitializeReactState();
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectApply += AuraEffectApplyFn(spell_gen_feign_death_no_prevent_emotes::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_gen_feign_death_no_prevent_emotes::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
// 46642 - 5,000 Gold
|
||||
class spell_gen_5000_gold : public SpellScript
|
||||
{
|
||||
@@ -2642,6 +2722,29 @@ class spell_gen_paralytic_poison : public AuraScript
|
||||
}
|
||||
};
|
||||
|
||||
class spell_gen_prevent_emotes : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_gen_prevent_emotes);
|
||||
|
||||
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT);
|
||||
}
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectApply += AuraEffectApplyFn(spell_gen_prevent_emotes::HandleEffectApply, EFFECT_FIRST_FOUND, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL);
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_gen_prevent_emotes::OnRemove, EFFECT_FIRST_FOUND, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
class spell_gen_proc_below_pct_damaged : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_gen_proc_below_pct_damaged);
|
||||
@@ -4352,7 +4455,6 @@ void AddSC_generic_spell_scripts()
|
||||
RegisterSpellScriptWithArgs(spell_gen_count_pct_from_max_hp, "spell_gen_default_count_pct_from_max_hp");
|
||||
RegisterSpellScriptWithArgs(spell_gen_count_pct_from_max_hp, "spell_gen_50pct_count_pct_from_max_hp", 50);
|
||||
RegisterSpellScript(spell_gen_create_lance);
|
||||
RegisterSpellScript(spell_gen_creature_permanent_feign_death);
|
||||
RegisterSpellScriptWithArgs(spell_gen_dalaran_disguise, "spell_gen_sunreaver_disguise");
|
||||
RegisterSpellScriptWithArgs(spell_gen_dalaran_disguise, "spell_gen_silver_covenant_disguise");
|
||||
RegisterSpellScript(spell_gen_damage_reduction_aura);
|
||||
@@ -4368,6 +4470,9 @@ void AddSC_generic_spell_scripts()
|
||||
RegisterSpellScript(spell_ethereal_pet_onsummon);
|
||||
RegisterSpellScript(spell_ethereal_pet_aura_remove);
|
||||
RegisterSpellScript(spell_steal_essence_visual);
|
||||
RegisterSpellScript(spell_gen_feign_death_all_flags);
|
||||
RegisterSpellScript(spell_gen_feign_death_no_dyn_flag);
|
||||
RegisterSpellScript(spell_gen_feign_death_no_prevent_emotes);
|
||||
RegisterSpellScript(spell_gen_5000_gold);
|
||||
RegisterSpellScript(spell_gen_gadgetzan_transporter_backfire);
|
||||
RegisterSpellScript(spell_gen_gift_of_naaru);
|
||||
@@ -4401,6 +4506,7 @@ void AddSC_generic_spell_scripts()
|
||||
RegisterSpellScript(spell_gen_oracle_wolvar_reputation);
|
||||
RegisterSpellScript(spell_gen_orc_disguise);
|
||||
RegisterSpellScript(spell_gen_paralytic_poison);
|
||||
RegisterSpellScript(spell_gen_prevent_emotes);
|
||||
RegisterSpellScriptWithArgs(spell_gen_proc_below_pct_damaged, "spell_item_soul_harvesters_charm");
|
||||
RegisterSpellScriptWithArgs(spell_gen_proc_below_pct_damaged, "spell_item_commendation_of_kaelthas");
|
||||
RegisterSpellScriptWithArgs(spell_gen_proc_below_pct_damaged, "spell_item_corpse_tongue_coin");
|
||||
|
||||
Reference in New Issue
Block a user