aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoroffl <11556157+offl@users.noreply.github.com>2021-03-11 20:20:34 +0200
committerShauren <shauren.trinity@gmail.com>2022-03-07 20:25:57 +0100
commit43f63d76315ec251cc04d70ec6ee811aef9d1176 (patch)
tree03d9a7f7b4ba5a95afdba94610e71794886f11dc /src
parentc19863745addec42cf8e1cd77f3daf10fa25ae16 (diff)
Scripts/Spells: Feign Death & 'prevent emotes flag' spell scripts (#26198)
Closes #25842 Ref #25764 (cherry picked from commit d0b67aecb6428c104c7a0c414384997cd9748ca4)
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp170
1 files changed, 138 insertions, 32 deletions
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 83c473fc425..b3803a8ffcc 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -1052,37 +1052,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->AddDynamicFlag(UNIT_DYNFLAG_DEAD);
- target->AddUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
-
- if (Creature* creature = target->ToCreature())
- creature->SetReactState(REACT_PASSIVE);
- }
-
- void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
- {
- Unit* target = GetTarget();
- target->RemoveDynamicFlag(UNIT_DYNFLAG_DEAD);
- target->RemoveUnitFlag2(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,
@@ -1586,6 +1555,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->AddDynamicFlag( UNIT_DYNFLAG_DEAD);
+ target->AddUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
+ target->AddUnitFlag(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->RemoveDynamicFlag(UNIT_DYNFLAG_DEAD);
+ target->RemoveUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
+ target->RemoveUnitFlag(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->AddUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
+ target->AddUnitFlag(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->RemoveUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
+ target->RemoveUnitFlag(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->AddDynamicFlag(UNIT_DYNFLAG_DEAD);
+ target->AddUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
+
+ if (Creature* creature = target->ToCreature())
+ creature->SetReactState(REACT_PASSIVE);
+ }
+
+ void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* target = GetTarget();
+ target->RemoveDynamicFlag(UNIT_DYNFLAG_DEAD);
+ target->RemoveUnitFlag2(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
{
@@ -2412,6 +2492,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->AddUnitFlag(UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT);
+ }
+
+ void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* target = GetTarget();
+ target->RemoveUnitFlag(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);
@@ -4646,7 +4749,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");
RegisterSpellAndAuraScriptPair(spell_gen_decay_over_time_fungal_decay, spell_gen_decay_over_time_spell);
@@ -4661,6 +4763,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_fishing);
RegisterSpellScript(spell_gen_gadgetzan_transporter_backfire);
@@ -4690,6 +4795,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");