Scripts/Quest: Fix The Smallest Creatures (#31106)

Closes #11332

(cherry picked from commit 27d50805de131a28a6f587ad4a3627d9903938e4)
This commit is contained in:
Grimgravy
2026-06-23 22:54:41 +02:00
committed by Shauren
parent 1ed565e761
commit 8a7d47bfec
2 changed files with 143 additions and 0 deletions
@@ -0,0 +1,19 @@
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_bem_q10720_poison_keg';
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_bem_coax_marmot';
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_bem_charm_rexxars_rodent';
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
(38629, 'spell_bem_q10720_poison_keg'),
(38544, 'spell_bem_coax_marmot'),
(38586, 'spell_bem_charm_rexxars_rodent');
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=38629;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(13, 1, 38629, 0, 0, 31, 0, 3, 22356, 0, 0, 0, 0, '', 'Poison Keg Targets [DND]Green Spot Grog Keg Credit'),
(13, 1, 38629, 0, 1, 31, 0, 3, 22367, 0, 0, 0, 0, '', 'Poison Keg Targets [DND]Ripe Moonshine Keg Credit'),
(13, 1, 38629, 0, 2, 31, 0, 3, 22368, 0, 0, 0, 0, '', 'Poison Keg Targets [DND]Fermented Seed Beer Keg Credit');
UPDATE `creature_template` SET `ScriptName`='npc_q10720_keg_credit' WHERE `entry` IN (22356,22367,22368);
UPDATE `creature_template` SET `ScriptName`='npc_q10720_marmot' WHERE `entry`=22189;
UPDATE `creature_template` SET `AIName`='' WHERE `entry`=20330;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=20330;
@@ -1059,6 +1059,125 @@ class spell_bem_wicked_strong_fetish : public SpellScript
}
};
enum TheSmallestCreature
{
SPELL_CHARM_REXXARS_RODENT = 38586,
SPELL_COAX_MARMOT = 38544,
SPELL_STEALTH_MARMOT = 42347,
SPELL_GREEN_EYE_GROG_CREDIT = 38996,
SPELL_RIPE_MOONSHINE_CREDIT = 38997,
SPELL_FERMENTED_SEED_BEER_CREDIT = 38998,
NPC_MARMOT = 22189,
NPC_GREEN_SPOT_GROG_KEG_CREDIT = 22356,
NPC_RIPE_MOONSHINE_KEG_CREDIT = 22367,
NPC_FERMENTED_SEED_BEER_KEG_CREDIT = 22368
};
struct npc_q10720_keg_credit : public ScriptedAI
{
npc_q10720_keg_credit(Creature * creature) : ScriptedAI(creature)
{
// Neccessary hack to allow spell 38629 to hit the keg credit (visibility is checked against the summoner, not the caster)
creature->m_invisibilityDetect.AddFlag(INVISIBILITY_UNK4);
}
};
struct npc_q10720_marmot : public ScriptedAI
{
using ScriptedAI::ScriptedAI;
void IsSummonedBy(WorldObject* summoner) override
{
summoner->CastSpell(me, SPELL_CHARM_REXXARS_RODENT, true);
}
};
// 38544 - Coax Marmot
class spell_bem_coax_marmot : public AuraScript
{
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
// prevent loading the aura from db
if (GetTarget()->GetCharmedGUID().IsEmpty())
Remove();
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Creature* marmot = Object::ToCreature(GetTarget()->GetCharmed()))
if (marmot->m_unitData->CreatedBySpell == SPELL_COAX_MARMOT)
marmot->DespawnOrUnsummon();
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_bem_coax_marmot::HandleEffectApply, EFFECT_1, SPELL_AURA_MOD_INVISIBILITY, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectApplyFn(spell_bem_coax_marmot::HandleEffectRemove, EFFECT_1, SPELL_AURA_MOD_INVISIBILITY, AURA_EFFECT_HANDLE_REAL);
}
};
// 38586 - [DND]Charm Rexxar's Rodent
class spell_bem_charm_rexxars_rodent : public AuraScript
{
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
caster->RemoveAurasDueToSpell(SPELL_COAX_MARMOT);
if (Creature* creature = GetTarget()->ToCreature())
creature->DespawnOrUnsummon(1ms);
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_bem_charm_rexxars_rodent::OnRemove, EFFECT_0, SPELL_AURA_MOD_POSSESS, AURA_EFFECT_HANDLE_REAL);
}
};
// 38629 - Poison Keg
class spell_bem_q10720_poison_keg : public SpellScript
{
bool Validate(SpellInfo const* /*spellEntry*/) override
{
return ValidateSpellInfo(
{
SPELL_GREEN_EYE_GROG_CREDIT,
SPELL_RIPE_MOONSHINE_CREDIT,
SPELL_FERMENTED_SEED_BEER_CREDIT
});
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
if (Player* player = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself())
{
uint32 spellId = 0;
switch (GetHitUnit()->GetEntry())
{
case NPC_GREEN_SPOT_GROG_KEG_CREDIT:
spellId = SPELL_GREEN_EYE_GROG_CREDIT;
break;
case NPC_RIPE_MOONSHINE_KEG_CREDIT:
spellId = SPELL_RIPE_MOONSHINE_CREDIT;
break;
case NPC_FERMENTED_SEED_BEER_KEG_CREDIT:
spellId = SPELL_FERMENTED_SEED_BEER_CREDIT;
break;
default:
return;
}
player->CastSpell(nullptr, spellId, true);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_bem_q10720_poison_keg::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
void AddSC_blades_edge_mountains()
{
new npc_nether_drake();
@@ -1070,4 +1189,9 @@ void AddSC_blades_edge_mountains()
new spell_oscillating_field();
RegisterSpellScript(spell_bem_dispelling_analysis);
RegisterSpellScript(spell_bem_wicked_strong_fetish);
RegisterCreatureAI(npc_q10720_keg_credit);
RegisterCreatureAI(npc_q10720_marmot);
RegisterSpellScript(spell_bem_coax_marmot);
RegisterSpellScript(spell_bem_charm_rexxars_rodent);
RegisterSpellScript(spell_bem_q10720_poison_keg);
}