fix(Scripts/Spell): Added random whispers of the Death Knight Newbie Village Lich King (#19006)

* Use rand Spell Whispers

* Added smart script for creature 28576|28577

* Added spell script name

* Fixed the wrong name

* The script name is lowercase
Remove spaces

* Remove spaces

* Remove spaces

* Players will only be able to whisper if they have mission 12678
Attacking civilians is the only way to whisper

* Validate

* Update src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp

Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>

---------

Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
This commit is contained in:
daobashun
2024-11-25 05:03:34 +08:00
committed by GitHub
parent 6b2cc0fd86
commit ec84bf98f9
2 changed files with 115 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 28576;
DELETE FROM `smart_scripts` WHERE (`entryorguid` = 28576) AND (`source_type` = 0) AND (`id` IN (8));
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
(28576, 0, 8, 0, 4, 0, 100, 0, 0, 0, 0, 0, 0, 0, 86, 58207, 0, 10, 128581, 28765, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 'Citizen of Havenshire - On Aggro - Cross Cast \'Lich King VO Blocker\'');
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 22 AND `SourceEntry` = 28576 AND `SourceId` = 0;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `Comment`) VALUES
(22, 9, 28576, 0, 0, 14, 0, 12678, 0, 0, 1, 'Action invoker has finished or active quest If Chaos Drives, Let Suffering Hold The Reins (12678)');
DELETE
FROM `spell_script_names`
WHERE `spell_id` BETWEEN 58207 AND 58223;
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(58207, 'spell_lich_king_vo_blocker'),
(58208, 'spell_lich_king_whisper'),
(58209, 'spell_lich_king_whisper'),
(58210, 'spell_lich_king_whisper'),
(58211, 'spell_lich_king_whisper'),
(58212, 'spell_lich_king_whisper'),
(58213, 'spell_lich_king_whisper'),
(58214, 'spell_lich_king_whisper'),
(58215, 'spell_lich_king_whisper'),
(58216, 'spell_lich_king_whisper'),
(58217, 'spell_lich_king_whisper'),
(58218, 'spell_lich_king_whisper'),
(58219, 'spell_lich_king_whisper'),
(58220, 'spell_lich_king_whisper'),
(58221, 'spell_lich_king_whisper'),
(58222, 'spell_lich_king_whisper'),
(58223, 'spell_lich_king_whisper');

View File

@@ -1215,6 +1215,88 @@ class spell_death_knight_initiate_visual : public SpellScript
}
};
enum spells_lich_king_whisper
{
SPELL_LICH_KING_VO_BLOCKER = 58207,
SPELL_LICHKINGDK001 = 58208,
SPELL_LICHKINGDK002 = 58209,
SPELL_LICHKINGDK003 = 58210,
SPELL_LICHKINGDK004 = 58211,
SPELL_LICHKINGDK005 = 58212,
SPELL_LICHKINGDK006 = 58213,
SPELL_LICHKINGDK007 = 58214,
SPELL_LICHKINGDK008 = 58215,
SPELL_LICHKINGDK009 = 58216,
SPELL_LICHKINGDK010 = 58217,
SPELL_LICHKINGDK011 = 58218,
SPELL_LICHKINGDK012 = 58219,
SPELL_LICHKINGDK013 = 58220,
SPELL_LICHKINGDK014 = 58221,
SPELL_LICHKINGDK015 = 58222,
SPELL_LICHKINGDK016 = 58223
};
//spell 58207 rand Whisper
class spell_lich_king_vo_blocker : public AuraScript
{
PrepareAuraScript(spell_lich_king_vo_blocker);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo
({
SPELL_LICHKINGDK001, SPELL_LICHKINGDK002, SPELL_LICHKINGDK003, SPELL_LICHKINGDK004,
SPELL_LICHKINGDK005, SPELL_LICHKINGDK006, SPELL_LICHKINGDK007, SPELL_LICHKINGDK008,
SPELL_LICHKINGDK009, SPELL_LICHKINGDK010, SPELL_LICHKINGDK011, SPELL_LICHKINGDK012,
SPELL_LICHKINGDK013, SPELL_LICHKINGDK014, SPELL_LICHKINGDK015, SPELL_LICHKINGDK016
});
}
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Player* target = GetTarget()->ToPlayer())
{
//spell 58208-58223
GetCaster()->CastSpell(target, urand(SPELL_LICHKINGDK001, SPELL_LICHKINGDK016), true);
}
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_lich_king_vo_blocker::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
// 58208 - 58224 - Creature - The Lich King (28765) Whisper
class spell_lich_king_whisper : public SpellScript
{
PrepareSpellScript(spell_lich_king_whisper);
bool Validate(SpellInfo const* spellInfo) override
{
return sObjectMgr->GetBroadcastText(uint32(spellInfo->GetEffect(EFFECT_0).CalcValue())) &&
sSoundEntriesStore.LookupEntry(uint32(spellInfo->GetEffect(EFFECT_1).CalcValue()));
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (Player* player = GetHitPlayer())
GetCaster()->Whisper(uint32(GetEffectValue()), player, false);
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (Player* player = GetHitPlayer())
player->PlayDistanceSound(uint32(GetEffectValue()), player);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_lich_king_whisper::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
OnEffectHitTarget += SpellEffectFn(spell_lich_king_whisper::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY);
}
};
void AddSC_the_scarlet_enclave_c1()
{
// Ours
@@ -1237,4 +1319,6 @@ void AddSC_the_scarlet_enclave_c1()
new go_inconspicuous_mine_car();
RegisterSpellScript(spell_death_knight_initiate_visual);
RegisterSpellScript(spell_lich_king_whisper);
RegisterSpellScript(spell_lich_king_vo_blocker);
}