From f510e122a03a057afe2a2abfba19f5534f9ac868 Mon Sep 17 00:00:00 2001 From: avarishd <46330494+avarishd@users.noreply.github.com> Date: Wed, 17 Jul 2024 14:19:48 +0300 Subject: [PATCH] fix(Script/Quest): Protecting Our Own (#19247) * fix(Core/Spells): Gor'drek's Ointment * Update spell_item.cpp * ; --- .../rev_1719813803735600900.sql | 19 +++++++++++ .../game/Spells/SpellInfoCorrections.cpp | 7 ++++ src/server/scripts/Spells/spell_item.cpp | 31 +++++++++++++++++ src/server/scripts/World/item_scripts.cpp | 33 ------------------- 4 files changed, 57 insertions(+), 33 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1719813803735600900.sql diff --git a/data/sql/updates/pending_db_world/rev_1719813803735600900.sql b/data/sql/updates/pending_db_world/rev_1719813803735600900.sql new file mode 100644 index 000000000..27fa8020d --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1719813803735600900.sql @@ -0,0 +1,19 @@ +-- Quest: Protecting Our Own +UPDATE `quest_template` SET `RequiredNpcOrGo1` = 21142 WHERE (`ID` = 10488); +UPDATE `creature_template_addon` SET `auras` = '37691' WHERE (`entry` = 20748); + +DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = 20748); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(20748, 0, 0, 0, 0, 0, 100, 0, 3000, 8000, 11000, 15000, 0, 0, 11, 5781, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Thunderlord Dire Wolf - In Combat - Cast \'Threatening Growl\''), +(20748, 0, 1, 2, 8, 0, 100, 0, 32578, 0, 0, 0, 0, 0, 33, 21142, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 'Thunderlord Dire Wolf - On Target Spellhit \'Gor`drek`s Ointment\' - Quest Credit \'Protecting Our Own\''), +(20748, 0, 2, 0, 61, 0, 50, 0, 0, 0, 0, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 'Thunderlord Dire Wolf - On Target Spellhit \'Gor`drek`s Ointment\' - Start Attacking (50%)'); + +DELETE FROM `spell_custom_attr` WHERE `spell_id`=32578; +INSERT INTO `spell_custom_attr` (`spell_id`, `attributes`) VALUES (32578, 2048); + +DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 17) AND (`SourceGroup` = 0) AND (`SourceEntry` = 32578); + +UPDATE `item_template` SET `ScriptName` = '' WHERE (`entry` = 30175); + +DELETE FROM `spell_script_names` WHERE `spell_id`=32578 AND `ScriptName`='spell_item_gor_dreks_ointment'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (32578, 'spell_item_gor_dreks_ointment'); diff --git a/src/server/game/Spells/SpellInfoCorrections.cpp b/src/server/game/Spells/SpellInfoCorrections.cpp index 13b146f35..d7ebc218e 100644 --- a/src/server/game/Spells/SpellInfoCorrections.cpp +++ b/src/server/game/Spells/SpellInfoCorrections.cpp @@ -4808,6 +4808,13 @@ void SpellMgr::LoadSpellInfoCorrections() spellInfo->AttributesEx4 |= SPELL_ATTR4_NO_CAST_LOG; }); + // Gor'drek's Ointment + ApplySpellFix({ 32578 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx3 |= SPELL_ATTR3_SUPRESS_CASTER_PROCS; + spellInfo->AttributesEx3 |= SPELL_ATTR3_SUPRESS_TARGET_PROCS; + }); + for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i) { SpellInfo* spellInfo = mSpellInfoMap[i]; diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 2a69287c2..b4fb5ffc1 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -4021,6 +4021,36 @@ class spell_item_fel_mana_potion : public AuraScript } }; +// 32578 - Gor'drek's Ointment +enum DreksOintment +{ + NPC_THUNDERLORD_DIRE_WOLF = 20748, + SPELL_GOR_DREKS_OINTMENT = 32578 +}; + +class spell_item_gor_dreks_ointment : public SpellScript +{ + PrepareSpellScript(spell_item_gor_dreks_ointment) + + SpellCastResult CheckCast() + { + if (Unit* target = GetExplTargetUnit()) + { + if (target->GetEntry() == NPC_THUNDERLORD_DIRE_WOLF && !target->HasAura(SPELL_GOR_DREKS_OINTMENT)) + return SPELL_CAST_OK; + if (target->GetEntry() != NPC_THUNDERLORD_DIRE_WOLF) + return SPELL_FAILED_BAD_TARGETS; + } + + return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; + } + + void Register() override + { + OnCheckCast += SpellCheckCastFn(spell_item_gor_dreks_ointment::CheckCast); + } +}; + void AddSC_item_spell_scripts() { RegisterSpellScript(spell_item_massive_seaforium_charge); @@ -4144,5 +4174,6 @@ void AddSC_item_spell_scripts() RegisterSpellScript(spell_item_scroll_of_retribution); RegisterSpellAndAuraScriptPair(spell_item_eye_of_grillok, spell_item_eye_of_grillok_aura); RegisterSpellScript(spell_item_fel_mana_potion); + RegisterSpellScript(spell_item_gor_dreks_ointment); } diff --git a/src/server/scripts/World/item_scripts.cpp b/src/server/scripts/World/item_scripts.cpp index 571c65d70..cddafb57d 100644 --- a/src/server/scripts/World/item_scripts.cpp +++ b/src/server/scripts/World/item_scripts.cpp @@ -20,18 +20,6 @@ #include "Player.h" #include "ScriptedCreature.h" #include "Spell.h" -/* ScriptData -SDName: Item_Scripts -SD%Complete: 100 -SDComment: Items for a range of different items. See content below (in script) -SDCategory: Items -EndScriptData */ - -/* ContentData -item_flying_machine(i34060, i34061) Engineering crafted flying machines -item_gor_dreks_ointment(i30175) Protecting Our Own(q10488) -item_only_for_flight Items which should only useable while flying -EndContentData */ /*##### # item_only_for_flight @@ -79,26 +67,6 @@ public: } }; -/*##### -# item_gor_dreks_ointment -#####*/ - -class item_gor_dreks_ointment : public ItemScript -{ -public: - item_gor_dreks_ointment() : ItemScript("item_gor_dreks_ointment") { } - - bool OnUse(Player* player, Item* item, SpellCastTargets const& targets) override - { - if (targets.GetUnitTarget() && targets.GetUnitTarget()->GetTypeId() == TYPEID_UNIT && - targets.GetUnitTarget()->GetEntry() == 20748 && !targets.GetUnitTarget()->HasAura(32578)) - return false; - - player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, nullptr); - return true; - } -}; - /*##### # item_incendiary_explosives #####*/ @@ -248,7 +216,6 @@ public: void AddSC_item_scripts() { new item_only_for_flight(); - new item_gor_dreks_ointment(); new item_incendiary_explosives(); new item_mysterious_egg(); new item_disgusting_jar();