aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoroffl <11556157+offl@users.noreply.github.com>2021-03-11 20:20:34 +0200
committerGitHub <noreply@github.com>2021-03-11 20:20:34 +0200
commitd0b67aecb6428c104c7a0c414384997cd9748ca4 (patch)
treef2ebe6756a2daa8d1b81b0cae11f83cfc6f54e39
parent5a22cd868a2a2eafbd914235fa62016d26729703 (diff)
Scripts/Spells: Feign Death & 'prevent emotes flag' spell scripts (#26198)
Closes #25842 Ref #25764
-rw-r--r--sql/updates/world/3.3.5/2021_03_11_07_world.sql40
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp170
2 files changed, 178 insertions, 32 deletions
diff --git a/sql/updates/world/3.3.5/2021_03_11_07_world.sql b/sql/updates/world/3.3.5/2021_03_11_07_world.sql
new file mode 100644
index 00000000000..9bc9848ce92
--- /dev/null
+++ b/sql/updates/world/3.3.5/2021_03_11_07_world.sql
@@ -0,0 +1,40 @@
+-- spell_gen_feign_death_no_dyn_flag
+-- UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT, UNIT_FLAG2_FEIGN_DEATH
+UPDATE `spell_script_names` SET `ScriptName` = "spell_gen_feign_death_no_dyn_flag" WHERE `spell_id` = 35357 AND `ScriptName` = "spell_gen_creature_permanent_feign_death";
+
+DELETE FROM `spell_script_names` WHERE `spell_id` IN (51329) AND `ScriptName` = "spell_gen_feign_death_no_dyn_flag";
+INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
+(51329,"spell_gen_feign_death_no_dyn_flag");
+
+UPDATE `creature_template` SET `unit_flags` = `unit_flags` &~ 536870912 WHERE `entry` IN (31786); -- 35357
+DELETE FROM `creature_template_addon` WHERE `entry` IN (29811);
+INSERT INTO `creature_template_addon` (`entry`, `path_id`, `mount`, `bytes1`, `bytes2`, `emote`, `visibilityDistanceType`, `auras`) VALUES
+(29811,0,0,0,1,0,0,"51329");
+UPDATE `creature_template` SET `unit_flags` = `unit_flags` &~ (262144|536870912) WHERE `entry` IN (29811); -- 51329
+
+
+-- spell_gen_feign_death_no_prevent_emotes
+-- UNIT_FLAG2_FEIGN_DEATH, UNIT_DYNFLAG_DEAD, used by 31281
+UPDATE `spell_script_names` SET `ScriptName` = "spell_gen_feign_death_no_prevent_emotes" WHERE `spell_id` = 58951 AND `ScriptName` = "spell_gen_creature_permanent_feign_death";
+
+
+-- spell_gen_feign_death_all_flags
+-- All flags
+UPDATE `spell_script_names` SET `ScriptName` = "spell_gen_feign_death_all_flags" WHERE `ScriptName` = "spell_gen_creature_permanent_feign_death";
+
+UPDATE `creature_template` SET `unit_flags` = `unit_flags` &~ 536870912 WHERE `entry` IN (37970,37972,37973,38399,38400,38401,38769,38770,38771,38772,38784,38785); -- 71598
+
+
+-- spell_gen_prevent_emotes
+-- UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT
+DELETE FROM `spell_script_names` WHERE `spell_id` IN (33569,58540,70904,58806,58768) AND `ScriptName` = "spell_gen_prevent_emotes";
+INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
+(33569,"spell_gen_prevent_emotes"),
+(58540,"spell_gen_prevent_emotes"),
+(70904,"spell_gen_prevent_emotes"),
+(58806,"spell_gen_prevent_emotes"),
+(58768,"spell_gen_prevent_emotes");
+
+UPDATE `creature_template` SET `unit_flags` = `unit_flags` &~ 536870912 WHERE `entry` IN (19224,20663); -- 33569
+UPDATE `creature_template` SET `unit_flags` = `unit_flags` &~ (262144|536870912) WHERE `entry` IN (30947); -- 58540
+UPDATE `creature_template` SET `unit_flags` = `unit_flags` &~ 536870912 WHERE `entry` IN (36789,38174); -- 70904
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 2770aecfda6..3d4a012cf2b 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -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");