fix(Spell/Scripts): MOVE Drinking to spell scripts (#11105)

This commit is contained in:
IntelligentQuantum
2022-04-15 16:46:30 +04:30
committed by GitHub
parent ab4ee71762
commit f7760b4ea0
3 changed files with 44 additions and 19 deletions

View File

@@ -0,0 +1,5 @@
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1647924198689563161');
DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_item_mirrens_drinking_hat');
INSERT INTO `spell_script_names` VALUES
(29830, 'spell_item_mirrens_drinking_hat');

View File

@@ -3808,25 +3808,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
m_caster->CastSpell(unitTarget, 22682, true);
return;
}
// Mirren's Drinking Hat
case 29830:
{
uint32 itemId = 23586; // Aerie Peak Pale Ale
switch (urand(0, 5))
{
case 0:
case 1:
case 2:
itemId = 23584;
break; // Loch Modan Lager
case 3:
case 4:
itemId = 23585;
break; // Stouthammer Lite
}
DoCreateItem(effIndex, itemId);
break;
}
case 20589: // Escape artist
case 30918: // Improved Sprint
{

View File

@@ -3634,6 +3634,44 @@ class spell_item_wraith_scythe_drain_life : public SpellScript
}
};
enum MirrensDrinkingHat
{
SPELL_LOCH_MODAN_LAGER = 29827,
SPELL_STOUTHAMMER_LITE = 29828,
SPELL_AERIE_PEAK_PALE_ALE = 29829
};
// 29830 - Mirren's Drinking Hat
class spell_item_mirrens_drinking_hat : public SpellScript
{
PrepareSpellScript(spell_item_mirrens_drinking_hat);
void HandleScriptEffect(SpellEffIndex /* effIndex */)
{
uint32 spellId = 0;
switch (urand(1, 6))
{
case 1:
case 2:
case 3:
spellId = SPELL_LOCH_MODAN_LAGER; break;
case 4:
case 5:
spellId = SPELL_STOUTHAMMER_LITE; break;
case 6:
spellId = SPELL_AERIE_PEAK_PALE_ALE; break;
}
Unit* caster = GetCaster();
caster->CastSpell(caster, spellId);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_item_mirrens_drinking_hat::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
void AddSC_item_spell_scripts()
{
RegisterSpellScript(spell_item_massive_seaforium_charge);
@@ -3746,4 +3784,5 @@ void AddSC_item_spell_scripts()
RegisterSpellScript(spell_item_linken_boomerang);
RegisterSpellScript(spell_item_recall);
RegisterSpellScript(spell_item_wraith_scythe_drain_life);
RegisterSpellScript(spell_item_mirrens_drinking_hat);
}