fix(Core/Spells): Script Lord Valthalak's Amulet (#17431)

* fix(Core/Spells): Script Lord Valthalak's Amulet

* cs
This commit is contained in:
avarishd
2023-10-07 13:34:35 +03:00
committed by GitHub
parent 4d285d21b0
commit 91c6bdd540
3 changed files with 40 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
-- Lord Valthalak's Amulet
DELETE FROM `spell_script_names` WHERE `spell_id`=27360;
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (27360, 'spell_gen_valthalak_amulet');
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 17 AND `SourceGroup` = 0 AND `SourceEntry` = 27360;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(17, 0, 27360, 0, 0, 29, 0, 16073, 50, 0, 1, 0, 0, '', 'Allow using Lord Valthalak\'s Amulet only if there is no Spirit of Lord Valthalak within 50 yards.');

View File

@@ -4572,6 +4572,12 @@ void SpellMgr::LoadSpellInfoCorrections()
spellInfo->RangeEntry = sSpellRangeStore.LookupEntry(13); // 50000yd
});
// Instill Lord Valthalak's Spirit DND
ApplySpellFix({ 27360 }, [](SpellInfo* spellInfo)
{
spellInfo->ChannelInterruptFlags |= AURA_INTERRUPT_FLAG_MOVE;
});
for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i)
{
SpellInfo* spellInfo = mSpellInfoMap[i];

View File

@@ -4997,6 +4997,32 @@ class spell_gen_spirit_of_competition_winner : public SpellScript
}
};
// 27360 - Lord Valthalak's Amulet
enum Valthalak
{
SPELL_INSTILL_LORD_VALTHALAK_SPIRIT = 27360,
NPC_LORD_VALTHALAK = 16042
};
class spell_gen_valthalak_amulet : public SpellScript
{
PrepareSpellScript(spell_gen_valthalak_amulet)
SpellCastResult CheckCast()
{
if (Unit* target = GetExplTargetUnit())
if (target->GetEntry() == NPC_LORD_VALTHALAK && target->isDead())
return SPELL_CAST_OK;
return SPELL_FAILED_BAD_TARGETS;
}
void Register() override
{
OnCheckCast += SpellCheckCastFn(spell_gen_valthalak_amulet::CheckCast);
}
};
void AddSC_generic_spell_scripts()
{
RegisterSpellScript(spell_silithyst);
@@ -5145,4 +5171,5 @@ void AddSC_generic_spell_scripts()
RegisterSpellScript(spell_gen_curse_of_pain);
RegisterSpellScript(spell_gen_spirit_of_competition_participant);
RegisterSpellScript(spell_gen_spirit_of_competition_winner);
RegisterSpellScript(spell_gen_valthalak_amulet);
}