From 412eb5deaa9db4af1f9dfa0a22251628de01caa7 Mon Sep 17 00:00:00 2001 From: nytmyr <53322305+nytmyr@users.noreply.github.com> Date: Tue, 7 Mar 2023 17:17:09 -0600 Subject: [PATCH] [Bots] Prevent interrupt spam when OOM (#3011) Notes: Bots currently do not do a mana check until the spell cast has already been started which results in an interrupt immediately after. If it is the last spell for a bot to cast, it tends to result in interrupt spam until the bot has enough mana. This will block the interrupt spam if the spell is invalid. --- zone/spells.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/zone/spells.cpp b/zone/spells.cpp index ba7da07c9..38e9308ca 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -1158,10 +1158,16 @@ void Mob::InterruptSpell(uint16 message, uint16 color, uint16 spellid) uint16 message_other; bool bard_song_mode = false; //has the bard song gone to auto repeat mode if (!IsValidSpell(spellid)) { - if(bardsong) { + if (bardsong) { spellid = bardsong; bard_song_mode = true; - } else { + } + else { + if (IsBot() && !message && !color && !spellid) { // this is to prevent bots from spamming interrupts messages when trying to cast while OOM + ZeroCastingVars(); // resets all the state keeping stuff + LogSpells("Spell [{}] has been interrupted - Bot [{}] doesn't have enough mana", spellid, GetCleanName()); + return; + } spellid = casting_spell_id; } }