mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-21 20:56:23 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user