diff --git a/data/sql/updates/pending_db_world/rev_1614891941285225200.sql b/data/sql/updates/pending_db_world/rev_1614891941285225200.sql new file mode 100644 index 000000000..c96c327b1 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1614891941285225200.sql @@ -0,0 +1,4 @@ +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1614891941285225200'); + +DELETE FROM `spell_script_names` WHERE (`spell_id` = 7932); +INSERT INTO `spell_script_names` VALUES ('7932', 'spell_item_anti_venom'); diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 1c41da5fe..e86ab5519 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -907,6 +907,52 @@ public: } }; +class spell_item_anti_venom : public SpellScriptLoader +{ +public: + spell_item_anti_venom() : SpellScriptLoader("spell_item_anti_venom") {} + + class spell_item_anti_venom_SpellScript : public SpellScript + { + PrepareSpellScript(spell_item_anti_venom_SpellScript); + + void HandleDummy(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Unit* target = GetHitUnit()) + { + std::list removeList; + Unit::AuraMap const& auras = target->GetOwnedAuras(); + for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + { + Aura* aura = itr->second; + if (aura->GetSpellInfo()->SpellLevel > 25 || aura->GetSpellInfo()->Dispel != DISPEL_POISON) + { + continue; + } + + removeList.push_back(aura->GetId()); + } + + for (std::list::const_iterator itr = removeList.begin(); itr != removeList.end(); ++itr) + { + target->RemoveAurasDueToSpell(*itr); + } + } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_anti_venom_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const override + { + return new spell_item_anti_venom_SpellScript(); + } +}; + enum GnomishShrinkRay { SPELL_GNOMISH_SHRINK_RAY_SELF = 13004, @@ -4272,6 +4318,7 @@ void AddSC_item_spell_scripts() new spell_item_feast(); new spell_item_gnomish_universal_remote(); new spell_item_strong_anti_venom(); + new spell_item_anti_venom(); new spell_item_gnomish_shrink_ray(); new spell_item_goblin_weather_machine(); new spell_item_light_lamp();