Skip to content

Commit ec84bf9

Browse files
fix(Scripts/Spell): Added random whispers of the Death Knight Newbie Village Lich King (azerothcore#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 <[email protected]> --------- Co-authored-by: Kitzunu <[email protected]>
1 parent 6b2cc0f commit ec84bf9

File tree

2 files changed

+115
-0
lines changed

2 files changed

+115
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 28576;
2+
3+
DELETE FROM `smart_scripts` WHERE (`entryorguid` = 28576) AND (`source_type` = 0) AND (`id` IN (8));
4+
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
5+
(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\'');
6+
7+
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 22 AND `SourceEntry` = 28576 AND `SourceId` = 0;
8+
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `Comment`) VALUES
9+
(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)');
10+
11+
DELETE
12+
FROM `spell_script_names`
13+
WHERE `spell_id` BETWEEN 58207 AND 58223;
14+
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
15+
(58207, 'spell_lich_king_vo_blocker'),
16+
(58208, 'spell_lich_king_whisper'),
17+
(58209, 'spell_lich_king_whisper'),
18+
(58210, 'spell_lich_king_whisper'),
19+
(58211, 'spell_lich_king_whisper'),
20+
(58212, 'spell_lich_king_whisper'),
21+
(58213, 'spell_lich_king_whisper'),
22+
(58214, 'spell_lich_king_whisper'),
23+
(58215, 'spell_lich_king_whisper'),
24+
(58216, 'spell_lich_king_whisper'),
25+
(58217, 'spell_lich_king_whisper'),
26+
(58218, 'spell_lich_king_whisper'),
27+
(58219, 'spell_lich_king_whisper'),
28+
(58220, 'spell_lich_king_whisper'),
29+
(58221, 'spell_lich_king_whisper'),
30+
(58222, 'spell_lich_king_whisper'),
31+
(58223, 'spell_lich_king_whisper');

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

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,88 @@ class spell_death_knight_initiate_visual : public SpellScript
12151215
}
12161216
};
12171217

1218+
enum spells_lich_king_whisper
1219+
{
1220+
SPELL_LICH_KING_VO_BLOCKER = 58207,
1221+
SPELL_LICHKINGDK001 = 58208,
1222+
SPELL_LICHKINGDK002 = 58209,
1223+
SPELL_LICHKINGDK003 = 58210,
1224+
SPELL_LICHKINGDK004 = 58211,
1225+
SPELL_LICHKINGDK005 = 58212,
1226+
SPELL_LICHKINGDK006 = 58213,
1227+
SPELL_LICHKINGDK007 = 58214,
1228+
SPELL_LICHKINGDK008 = 58215,
1229+
SPELL_LICHKINGDK009 = 58216,
1230+
SPELL_LICHKINGDK010 = 58217,
1231+
SPELL_LICHKINGDK011 = 58218,
1232+
SPELL_LICHKINGDK012 = 58219,
1233+
SPELL_LICHKINGDK013 = 58220,
1234+
SPELL_LICHKINGDK014 = 58221,
1235+
SPELL_LICHKINGDK015 = 58222,
1236+
SPELL_LICHKINGDK016 = 58223
1237+
};
1238+
1239+
//spell 58207 rand Whisper
1240+
class spell_lich_king_vo_blocker : public AuraScript
1241+
{
1242+
PrepareAuraScript(spell_lich_king_vo_blocker);
1243+
1244+
bool Validate(SpellInfo const* /*spellInfo*/) override
1245+
{
1246+
return ValidateSpellInfo
1247+
({
1248+
SPELL_LICHKINGDK001, SPELL_LICHKINGDK002, SPELL_LICHKINGDK003, SPELL_LICHKINGDK004,
1249+
SPELL_LICHKINGDK005, SPELL_LICHKINGDK006, SPELL_LICHKINGDK007, SPELL_LICHKINGDK008,
1250+
SPELL_LICHKINGDK009, SPELL_LICHKINGDK010, SPELL_LICHKINGDK011, SPELL_LICHKINGDK012,
1251+
SPELL_LICHKINGDK013, SPELL_LICHKINGDK014, SPELL_LICHKINGDK015, SPELL_LICHKINGDK016
1252+
});
1253+
}
1254+
1255+
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
1256+
{
1257+
if (Player* target = GetTarget()->ToPlayer())
1258+
{
1259+
//spell 58208-58223
1260+
GetCaster()->CastSpell(target, urand(SPELL_LICHKINGDK001, SPELL_LICHKINGDK016), true);
1261+
}
1262+
}
1263+
1264+
void Register() override
1265+
{
1266+
OnEffectApply += AuraEffectApplyFn(spell_lich_king_vo_blocker::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
1267+
}
1268+
};
1269+
1270+
// 58208 - 58224 - Creature - The Lich King (28765) Whisper
1271+
class spell_lich_king_whisper : public SpellScript
1272+
{
1273+
PrepareSpellScript(spell_lich_king_whisper);
1274+
1275+
bool Validate(SpellInfo const* spellInfo) override
1276+
{
1277+
return sObjectMgr->GetBroadcastText(uint32(spellInfo->GetEffect(EFFECT_0).CalcValue())) &&
1278+
sSoundEntriesStore.LookupEntry(uint32(spellInfo->GetEffect(EFFECT_1).CalcValue()));
1279+
}
1280+
1281+
void HandleScript(SpellEffIndex /*effIndex*/)
1282+
{
1283+
if (Player* player = GetHitPlayer())
1284+
GetCaster()->Whisper(uint32(GetEffectValue()), player, false);
1285+
}
1286+
1287+
void HandleDummy(SpellEffIndex /*effIndex*/)
1288+
{
1289+
if (Player* player = GetHitPlayer())
1290+
player->PlayDistanceSound(uint32(GetEffectValue()), player);
1291+
}
1292+
1293+
void Register() override
1294+
{
1295+
OnEffectHitTarget += SpellEffectFn(spell_lich_king_whisper::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
1296+
OnEffectHitTarget += SpellEffectFn(spell_lich_king_whisper::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY);
1297+
}
1298+
};
1299+
12181300
void AddSC_the_scarlet_enclave_c1()
12191301
{
12201302
// Ours
@@ -1237,4 +1319,6 @@ void AddSC_the_scarlet_enclave_c1()
12371319
new go_inconspicuous_mine_car();
12381320

12391321
RegisterSpellScript(spell_death_knight_initiate_visual);
1322+
RegisterSpellScript(spell_lich_king_whisper);
1323+
RegisterSpellScript(spell_lich_king_vo_blocker);
12401324
}

0 commit comments

Comments
 (0)