From f67df44d99671cdff2fa04e795fa4a8f15ee1067 Mon Sep 17 00:00:00 2001 From: nytmyr <53322305+nytmyr@users.noreply.github.com> Date: Thu, 12 Dec 2024 08:01:26 -0600 Subject: [PATCH] CanUseBotSpell for ^cast --- zone/botspellsai.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/zone/botspellsai.cpp b/zone/botspellsai.cpp index d1eb10ecd..e61a407d1 100644 --- a/zone/botspellsai.cpp +++ b/zone/botspellsai.cpp @@ -2649,6 +2649,30 @@ bool Bot::HasBotSpellEntry(uint16 spell_id) { return false; } +bool Bot::CanUseBotSpell(uint16 spell_id) { + if (AIBot_spells.empty()) { + return false; + } + + for (const auto& s : AIBot_spells) { + if (!IsValidSpell(s.spellid)) { + return false; + } + + if (s.spellid != spell_id) { + continue; + } + + if (s.minlevel > GetLevel()) { + return false; + } + + return true; + } + + return false; +} + bool Bot::IsValidSpellRange(uint16 spell_id, Mob* tar) { if (!IsValidSpell(spell_id) || !tar) { return false;