fix(Scripts/Quest): improve Catch the Wild Wolpertinger! (#17333)

This commit is contained in:
Grimgravy
2023-09-24 16:23:58 -03:00
committed by GitHub
parent e361c92d66
commit 6990a1d2a4
3 changed files with 25 additions and 27 deletions

View File

@@ -0,0 +1,7 @@
--
DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 17) AND (`SourceGroup` = 0) AND (`SourceEntry` = 41621) AND (`SourceId` = 0) AND (`ElseGroup` = 0) AND (`ConditionTypeOrReference` = 31) AND (`ConditionTarget` = 1) AND (`ConditionValue1` = 3) AND (`ConditionValue2` = 23487) AND (`ConditionValue3` = 0);
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(17, 0, 41621, 0, 0, 31, 1, 3, 23487, 0, 0, 0, 0, '', 'Throw a net at a wild wolpertinger, which will allow you to capture it and place it in your pack.');
-- both missions are for the horde and alliance factions
UPDATE `spell_script_names` SET `ScriptName`='spell_catch_the_wild_wolpertinger' WHERE `spell_id`=41621 AND `ScriptName`='spell_q11117_catch_the_wild_wolpertinger';

View File

@@ -3922,12 +3922,6 @@ void SpellMgr::LoadSpellInfoCorrections()
spellInfo->ExcludeCasterAuraSpell = 42299;
});
// Catch the Wild Wolpertinger!
ApplySpellFix({ 41621 }, [](SpellInfo* spellInfo)
{
spellInfo->Effects[EFFECT_0].Effect = SPELL_EFFECT_DUMMY;
});
// Brewfest quests
ApplySpellFix({ 47134, 51798 }, [](SpellInfo* spellInfo)
{

View File

@@ -1031,35 +1031,32 @@ class spell_brewfest_apple_trap : public SpellScript
}
};
class spell_q11117_catch_the_wild_wolpertinger : public SpellScript
enum Catch
{
PrepareSpellScript(spell_q11117_catch_the_wild_wolpertinger);
NPC_WILD_WOLPERTINGER = 23487,
SpellCastResult CheckTarget()
ITEM_STUNNED_WOLPERTINGER = 32906
};
class spell_catch_the_wild_wolpertinger : public AuraScript
{
PrepareAuraScript(spell_catch_the_wild_wolpertinger);
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
if (caster->ToPlayer())
if (Unit* target = caster->ToPlayer()->GetSelectedUnit())
if (target->GetEntry() == 23487 && target->IsAlive())
return SPELL_CAST_OK;
return SPELL_FAILED_BAD_TARGETS;
}
void HandleDummyEffect(SpellEffIndex /*effIndex*/)
{
if (GetCaster() && GetCaster()->ToPlayer())
if (Creature* wild = GetTarget()->ToCreature())
{
GetCaster()->ToPlayer()->AddItem(32906, 1);
if (Unit* target = GetCaster()->ToPlayer()->GetSelectedUnit())
target->ToCreature()->DespawnOrUnsummon(500);
if (wild->GetEntry() == NPC_WILD_WOLPERTINGER)
{
wild->ToCreature()->DespawnOrUnsummon(1s, 0s);
GetCaster()->ToPlayer()->AddItem(ITEM_STUNNED_WOLPERTINGER, 1);
}
}
}
void Register() override
{
OnCheckCast += SpellCheckCastFn(spell_q11117_catch_the_wild_wolpertinger::CheckTarget);
OnEffectHitTarget += SpellEffectFn(spell_q11117_catch_the_wild_wolpertinger::HandleDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY);
OnEffectApply += AuraEffectApplyFn(spell_catch_the_wild_wolpertinger::HandleEffectApply, EFFECT_0, SPELL_AURA_MOD_PACIFY_SILENCE, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -2072,7 +2069,7 @@ void AddSC_event_brewfest_scripts()
RegisterSpellScript(spell_brewfest_ram_fatigue);
RegisterSpellScript(spell_brewfest_apple_trap);
// other
RegisterSpellScript(spell_q11117_catch_the_wild_wolpertinger);
RegisterSpellScript(spell_catch_the_wild_wolpertinger);
RegisterSpellScript(spell_brewfest_fill_keg);
RegisterSpellScript(spell_brewfest_unfill_keg);
RegisterSpellScript(spell_brewfest_toss_mug);