[Bots] Fix IsValidSpellTypeBySpellID to account for all types (#4764)

* [Bots] Fix IsValidSpellTypeBySpellID to account for all types

* Formatting
This commit is contained in:
nytmyr
2025-03-19 17:43:15 -05:00
committed by GitHub
parent ef945e6e99
commit 1af29bd7b1
10 changed files with 489 additions and 498 deletions
+283 -77
View File
@@ -3710,11 +3710,6 @@ bool Bot::Spawn(Client* botCharacterOwner) {
}
}
if (RuleB(Bots, RunSpellTypeChecksOnSpawn)) {
OwnerMessage("Running SpellType checks. There may be some spells that are mislabeled as incorrect. Use this as a loose guideline.");
CheckBotSpells(); //This runs through a series of checks and outputs any spells that are set to the wrong spell type in the database
}
if (IsBotRanged()) {
ChangeBotRangedWeapons(true);
}
@@ -9798,6 +9793,7 @@ bool Bot::CanCastSpellType(uint16 spell_type, uint16 spell_id, Mob* tar) {
}
uint8 bot_class = GetClass();
auto spell = spells[spell_id];
switch (spell_type) {
case BotSpellTypes::Buff:
@@ -9821,7 +9817,7 @@ bool Bot::CanCastSpellType(uint16 spell_type, uint16 spell_id, Mob* tar) {
case BotSpellTypes::SendHome:
if (
tar == this &&
spells[spell_id].target_type == ST_TargetsTarget
spell.target_type == ST_TargetsTarget
) {
LogBotSpellChecksDetail("{} says, 'Cancelling cast of {} on {} due to target_type checks. Using {}'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName(), GetSpellTargetType(spell_id));
return false;
@@ -9851,7 +9847,7 @@ bool Bot::CanCastSpellType(uint16 spell_type, uint16 spell_id, Mob* tar) {
}
if (
spells[spell_id].target_type == ST_Pet &&
(spell.target_type == ST_Pet || spell.target_type == ST_SummonedPet) &&
(
!tar->IsPet() ||
(
@@ -11574,18 +11570,265 @@ bool Bot::IsValidSpellTypeBySpellID(uint16 spell_type, uint16 spell_id) {
return false;
}
if (IsBotSpellTypeDetrimental(spell_type) && !IsDetrimentalSpell(spell_id)) {
return false;
}
if (IsBotSpellTypeBeneficial(spell_type) && !IsBeneficialSpell(spell_id)) {
return false;
}
auto spell = spells[spell_id];
std::string teleport_zone = spell.teleport_zone;
switch (spell_type) {
case BotSpellTypes::Buff:
case BotSpellTypes::PetBuffs:
if (
IsResistanceOnlySpell(spell_id) ||
IsDamageShieldOnlySpell(spell_id) ||
IsDamageShieldAndResistSpell(spell_id)
) {
return false;
case BotSpellTypes::Nuke:
if (IsAnyNukeOrStunSpell(spell_id) && !IsStunSpell(spell_id)) {
return true;
}
return true;
return false;
case BotSpellTypes::RegularHeal:
case BotSpellTypes::PetRegularHeals:
if (
IsAnyHealSpell(spell_id) &&
!IsVeryFastHealSpell(spell_id) &&
!IsFastHealSpell(spell_id) &&
!IsCompleteHealSpell(spell_id) &&
!IsHealOverTimeSpell(spell_id) &&
!IsBuffSpell(spell_id)
) {
return true;
}
return false;
case BotSpellTypes::Root:
case BotSpellTypes::AERoot:
if (IsDetrimentalSpell(spell_id) && IsEffectInSpell(spell_id, SE_Root)) {
return true;
}
return false;
case BotSpellTypes::Buff:
case BotSpellTypes::PreCombatBuff:
case BotSpellTypes::PetBuffs:
if (
IsBuffSpell(spell_id) &&
IsBeneficialSpell(spell_id) &&
!IsBardSong(spell_id) &&
!IsResistanceOnlySpell(spell_id) &&
!IsDamageShieldOnlySpell(spell_id) &&
!IsDamageShieldAndResistSpell(spell_id)
) {
if (
spell_type != BotSpellTypes::PetBuffs &&
(spell.target_type == ST_Pet || spell.target_type == ST_SummonedPet)
) {
return false;
}
return true;
}
return false;
case BotSpellTypes::Escape:
if (IsEscapeSpell(spell_id)) {
return true;
}
return false;
case BotSpellTypes::Pet:
if (IsSummonPetSpell(spell_id) || IsEffectInSpell(spell_id, SE_TemporaryPets)) {
return true;
}
return false;
case BotSpellTypes::Lifetap:
case BotSpellTypes::AELifetap:
if (IsDetrimentalSpell(spell_id) && IsLifetapSpell(spell_id)) {
return true;
}
return false;
case BotSpellTypes::Snare:
case BotSpellTypes::AESnare:
if (IsDetrimentalSpell(spell_id) && IsEffectInSpell(spell_id, SE_MovementSpeed)) {
return true;
}
return false;
case BotSpellTypes::DOT:
case BotSpellTypes::AEDoT:
if (
IsDetrimentalSpell(spell_id) &&
(IsStackableDOT(spell_id) || IsDamageOverTimeSpell(spell_id))
) {
return true;
}
return false;
case BotSpellTypes::Dispel:
case BotSpellTypes::AEDispel:
if (IsDispelSpell(spell_id)) {
return true;
}
return false;
case BotSpellTypes::InCombatBuff:
if (
!IsBardSong(spell_id) &&
(
(IsSelfConversionSpell(spell_id) && spell.buff_duration < 1) ||
(spell_type == BotSpellTypes::InCombatBuff && IsAnyBuffSpell(spell_id))
)
) {
return true;
}
return false;
case BotSpellTypes::Mez:
case BotSpellTypes::AEMez:
if (IsMesmerizeSpell(spell_id)) {
return true;
}
return false;
case BotSpellTypes::Charm:
if (IsCharmSpell(spell_id)) {
return true;
}
return false;
case BotSpellTypes::Slow:
case BotSpellTypes::AESlow:
if (IsDetrimentalSpell(spell_id) && IsSlowSpell(spell_id)) {
return true;
}
return false;
case BotSpellTypes::Debuff:
case BotSpellTypes::AEDebuff:
if (
IsDebuffSpell(spell_id) &&
!IsHateReduxSpell(spell_id) &&
!IsHateSpell(spell_id)
) {
return true;
}
return false;
case BotSpellTypes::Cure:
case BotSpellTypes::GroupCures:
case BotSpellTypes::PetCures:
if (IsCureSpell(spell_id)) {
return true;
}
return false;
case BotSpellTypes::Resurrect:
if (IsEffectInSpell(spell_id, SE_Revive)) {
return true;
}
return false;
case BotSpellTypes::HateRedux:
if (IsHateReduxSpell(spell_id)) {
return true;
}
return false;
case BotSpellTypes::InCombatBuffSong:
case BotSpellTypes::OutOfCombatBuffSong:
case BotSpellTypes::PreCombatBuffSong:
if (
IsBuffSpell(spell_id) &&
IsBeneficialSpell(spell_id) &&
IsBardSong(spell_id)
) {
return true;
}
return false;
case BotSpellTypes::Fear:
case BotSpellTypes::AEFear:
if (IsFearSpell(spell_id)) {
return true;
}
return false;
case BotSpellTypes::Stun:
case BotSpellTypes::AEStun:
if (IsDetrimentalSpell(spell_id) && IsStunSpell(spell_id)) {
return true;
}
return false;
case BotSpellTypes::HateLine:
case BotSpellTypes::AEHateLine:
if (IsDetrimentalSpell(spell_id) && IsHateSpell(spell_id)) {
return true;
}
return false;
case BotSpellTypes::CompleteHeal:
case BotSpellTypes::GroupCompleteHeals:
case BotSpellTypes::PetCompleteHeals:
if (IsCompleteHealSpell(spell_id) || IsGroupCompleteHealSpell(spell_id)) {
return true;
}
return false;
case BotSpellTypes::FastHeals:
case BotSpellTypes::PetFastHeals:
if (IsFastHealSpell(spell_id)) {
return true;
}
return false;
case BotSpellTypes::VeryFastHeals:
case BotSpellTypes::PetVeryFastHeals:
if (IsVeryFastHealSpell(spell_id)) {
return true;
}
return false;
case BotSpellTypes::GroupHeals:
if (IsRegularGroupHealSpell(spell_id)) {
return true;
}
return false;
case BotSpellTypes::HoTHeals:
case BotSpellTypes::GroupHoTHeals:
case BotSpellTypes::PetHoTHeals:
if (IsHealOverTimeSpell(spell_id) || IsGroupHealOverTimeSpell(spell_id)) {
return true;
}
return false;
case BotSpellTypes::AENukes:
if (
IsDetrimentalSpell(spell_id) &&
!IsAERainSpell(spell_id) &&
!IsPBAENukeSpell(spell_id) &&
!IsStunSpell(spell_id)
) {
return true;
}
return false;
case BotSpellTypes::AERains:
if (IsAERainNukeSpell(spell_id) && !IsStunSpell(spell_id)) {
return true;
}
return false;
case BotSpellTypes::PBAENuke:
if (IsPBAENukeSpell(spell_id) && !IsStunSpell(spell_id)) {
return true;
}
return false;
case BotSpellTypes::ResistBuffs:
case BotSpellTypes::PetResistBuffs:
if (IsResistanceBuffSpell(spell_id)) {
@@ -11595,44 +11838,7 @@ bool Bot::IsValidSpellTypeBySpellID(uint16 spell_type, uint16 spell_id) {
return false;
case BotSpellTypes::DamageShields:
case BotSpellTypes::PetDamageShields:
if (IsEffectInSpell(spell_id, SE_DamageShield)) {
return true;
}
return false;
case BotSpellTypes::PBAENuke:
if (
IsPBAENukeSpell(spell_id) &&
!IsStunSpell(spell_id)
) {
return true;
}
return false;
case BotSpellTypes::AERains:
if (
IsAERainNukeSpell(spell_id) &&
!IsStunSpell(spell_id)
) {
return true;
}
return false;
case BotSpellTypes::AEStun:
case BotSpellTypes::Stun:
if (IsStunSpell(spell_id)) {
return true;
}
return false;
case BotSpellTypes::AENukes:
case BotSpellTypes::Nuke:
if (!IsStunSpell(spell_id)) {
return true;
}
return false;
case BotSpellTypes::Lull:
if (IsHarmonySpell(spell_id)) {
if (IsBeneficialSpell(spell_id) && IsEffectInSpell(spell_id, SE_DamageShield)) {
return true;
}
@@ -11640,13 +11846,18 @@ bool Bot::IsValidSpellTypeBySpellID(uint16 spell_type, uint16 spell_id) {
case BotSpellTypes::Teleport:
if (
IsBeneficialSpell(spell_id) &&
(
IsEffectInSpell(spell_id, SE_Teleport) || IsEffectInSpell(spell_id, SE_Translocate)
)
(IsEffectInSpell(spell_id, SE_Teleport) || IsEffectInSpell(spell_id, SE_Translocate))
) {
return true;
}
return false;
case BotSpellTypes::Lull:
case BotSpellTypes::AELull:
if (IsHarmonySpell(spell_id)) {
return true;
}
return false;
case BotSpellTypes::Succor:
if (
@@ -11670,25 +11881,21 @@ bool Bot::IsValidSpellTypeBySpellID(uint16 spell_type, uint16 spell_id) {
return false;
case BotSpellTypes::Levitate:
if (
IsBeneficialSpell(spell_id) &&
IsEffectInSpell(spell_id, SE_Levitate)
) {
if (IsBeneficialSpell(spell_id) && IsEffectInSpell(spell_id, SE_Levitate)) {
return true;
}
return false;
case BotSpellTypes::Rune:
if (
IsEffectInSpell(spell_id, SE_AbsorbMagicAtt) ||
IsEffectInSpell(spell_id, SE_Rune)
if (IsBeneficialSpell(spell_id) &&
(IsEffectInSpell(spell_id, SE_AbsorbMagicAtt) || IsEffectInSpell(spell_id, SE_Rune))
) {
return true;
}
return false;
case BotSpellTypes::WaterBreathing:
if (IsEffectInSpell(spell_id, SE_WaterBreathing)) {
if (IsBeneficialSpell(spell_id) && IsEffectInSpell(spell_id, SE_WaterBreathing)) {
return true;
}
@@ -11696,29 +11903,22 @@ bool Bot::IsValidSpellTypeBySpellID(uint16 spell_type, uint16 spell_id) {
case BotSpellTypes::Size:
if (
IsBeneficialSpell(spell_id) &&
(
IsEffectInSpell(spell_id, SE_ModelSize) ||
IsEffectInSpell(spell_id, SE_ChangeHeight)
)
(IsEffectInSpell(spell_id, SE_ModelSize) || IsEffectInSpell(spell_id, SE_ChangeHeight))
) {
return true;
}
return false;
case BotSpellTypes::Invisibility:
if (
IsEffectInSpell(spell_id, SE_SeeInvis) ||
IsInvisibleSpell(spell_id)
if (IsBeneficialSpell(spell_id) &&
(IsEffectInSpell(spell_id, SE_SeeInvis) ||IsInvisibleSpell(spell_id))
) {
return true;
}
return false;
case BotSpellTypes::MovementSpeed:
if (
IsBeneficialSpell(spell_id) &&
IsEffectInSpell(spell_id, SE_MovementSpeed)
) {
if (IsBeneficialSpell(spell_id) && IsEffectInSpell(spell_id, SE_MovementSpeed)) {
return true;
}
@@ -11726,7 +11926,13 @@ bool Bot::IsValidSpellTypeBySpellID(uint16 spell_type, uint16 spell_id) {
case BotSpellTypes::SendHome:
if (
IsBeneficialSpell(spell_id) &&
IsEffectInSpell(spell_id, SE_GateToHomeCity)
(
IsEffectInSpell(spell_id, SE_GateToHomeCity) ||
(
teleport_zone.compare("") &&
(IsEffectInSpell(spell_id, SE_Teleport) || IsEffectInSpell(spell_id, SE_Translocate))
)
)
) {
return true;
}
-1
View File
@@ -683,7 +683,6 @@ public:
void SetSitManaPct(uint8 value) { _SitManaPct = value; }
// Spell lists
void CheckBotSpells();
std::list<BotSpellTypeOrder> GetSpellTypesPrioritized(uint8 priority_type);
static uint16 GetParentSpellType(uint16 spell_type);
static bool IsValidSpellTypeBySpellID(uint16 spell_type, uint16 spell_id);
+6 -1
View File
@@ -220,6 +220,11 @@ int bot_command_init(void)
std::vector<std::pair<std::string, uint8>> injected_bot_command_settings;
std::vector<std::string> orphaned_bot_command_settings;
if (RuleB(Bots, RunSpellTypeChecksOnBoot)) {
LogBotSpellTypeChecks("Running SpellType checks. There may be some spells that are mislabeled as incorrect. Use this as a loose guideline.");
database.botdb.CheckBotSpells();
}
database.botdb.MapCommandedSpellTypeMinLevels();
for (auto bcs_iter : bot_command_settings) {
@@ -813,7 +818,7 @@ void helper_send_usage_required_bots(Client *bot_owner, uint16 spell_type)
auto spell_type_itr = spell_map.find(spell_type);
auto class_itr = spell_type_itr->second.find(i);
const auto& spell_info = class_itr->second;
if (spell_info.min_level < UINT8_MAX) {
found = true;
+136
View File
@@ -2523,6 +2523,142 @@ bool BotDatabase::DeleteBotBlockedBuffs(const uint32 bot_id)
return true;
}
void BotDatabase::CheckBotSpells() {
auto spell_list = BotSpellsEntriesRepository::All(content_db);
uint16 spell_id;
SPDat_Spell_Struct spell;
for (const auto& s : spell_list) {
if (!IsValidSpell(s.spell_id)) {
LogBotSpellTypeChecks("{} is an invalid spell", s.spell_id);
continue;
}
spell = spells[s.spell_id];
spell_id = spell.id;
if (spell.classes[s.npc_spells_id - (BOT_CLASS_BASE_ID_PREFIX + 1)] >= 255) {
LogBotSpellTypeChecks("{} [#{}] is not usable by a {} [#{}].", GetSpellName(spell_id), spell_id, GetClassIDName(s.npc_spells_id - BOT_CLASS_BASE_ID_PREFIX), s.npc_spells_id);
}
else {
if (spell.classes[s.npc_spells_id - (BOT_CLASS_BASE_ID_PREFIX + 1)] > s.minlevel) {
LogBotSpellTypeChecks("{} [#{}] is not usable until level {} for a {} [#{}] and the min level is currently set to {}.",
GetSpellName(spell_id),
spell_id,
spell.classes[s.npc_spells_id - (BOT_CLASS_BASE_ID_PREFIX + 1)],
GetClassIDName(s.npc_spells_id - BOT_CLASS_BASE_ID_PREFIX),
s.npc_spells_id,
s.minlevel
);
LogBotSpellTypeChecksDetail("UPDATE bot_spells_entries SET `minlevel` = {} WHERE `spellid` = {} AND `npc_spells_id` = {}; -- {} [#{}] from minlevel {} to {} for {} [#{}]",
spell.classes[s.npc_spells_id - (BOT_CLASS_BASE_ID_PREFIX + 1)],
spell_id,
s.npc_spells_id,
GetSpellName(spell_id),
spell_id,
s.minlevel,
spell.classes[s.npc_spells_id - (BOT_CLASS_BASE_ID_PREFIX + 1)],
GetClassIDName(s.npc_spells_id - BOT_CLASS_BASE_ID_PREFIX),
s.npc_spells_id
);
}
if (spell.classes[s.npc_spells_id - (BOT_CLASS_BASE_ID_PREFIX + 1)] < s.minlevel) {
LogBotSpellTypeChecks("{} [#{}] could be used starting at level {} for a {} [#{}] instead of the current min level of {}.",
GetSpellName(spell_id),
spell_id,
spell.classes[s.npc_spells_id - (BOT_CLASS_BASE_ID_PREFIX + 1)],
GetClassIDName(s.npc_spells_id - BOT_CLASS_BASE_ID_PREFIX),
s.npc_spells_id,
s.minlevel
);
LogBotSpellTypeChecksDetail("UPDATE bot_spells_entries SET `minlevel` = {} WHERE `spellid` = {} AND `npc_spells_id` = {}; -- {} [#{}] from minlevel {} to {} for {} [#{}]",
spell.classes[s.npc_spells_id - (BOT_CLASS_BASE_ID_PREFIX + 1)],
spell_id,
s.npc_spells_id,
GetSpellName(spell_id),
spell_id,
s.minlevel,
spell.classes[s.npc_spells_id - (BOT_CLASS_BASE_ID_PREFIX + 1)],
GetClassIDName(s.npc_spells_id - BOT_CLASS_BASE_ID_PREFIX),
s.npc_spells_id
);
}
if (spell.classes[s.npc_spells_id - (BOT_CLASS_BASE_ID_PREFIX + 1)] > s.maxlevel) {
LogBotSpellTypeChecks("{} [#{}] is not usable until level {} for a {} [#{}] and the max level is currently set to {}.",
GetSpellName(spell_id),
spell_id,
spell.classes[s.npc_spells_id - (BOT_CLASS_BASE_ID_PREFIX + 1)],
GetClassIDName(s.npc_spells_id - BOT_CLASS_BASE_ID_PREFIX),
s.npc_spells_id,
s.maxlevel
);
}
}
uint16 correct_type = GetCorrectBotSpellType(s.type, spell_id);
if (RuleB(Bots, UseParentSpellTypeForChecks)) {
uint16 parent_type = Bot::GetParentSpellType(correct_type);
if (s.type == parent_type || s.type == correct_type) {
continue;
}
if (correct_type != parent_type) {
correct_type = parent_type;
}
}
else {
if (IsPetBotSpellType(s.type)) {
correct_type = GetPetBotSpellType(correct_type);
}
}
if (IsPetBotSpellType(correct_type) && (spell.target_type != ST_Pet && spell.target_type != ST_SummonedPet)) {
correct_type = Bot::GetParentSpellType(correct_type);
}
if (correct_type == s.type) {
continue;
}
if (correct_type == UINT16_MAX) {
LogBotSpellTypeChecks(
"{} [#{}] is incorrect. It is currently set as {} [#{}] but the correct type is unknown.",
GetSpellName(spell_id),
spell_id,
Bot::GetSpellTypeNameByID(s.type),
s.type
);
}
else {
LogBotSpellTypeChecks("{} [#{}] is incorrect. It is currently set as {} [#{}] and should be {} [#{}]",
GetSpellName(spell_id),
spell_id,
Bot::GetSpellTypeNameByID(s.type),
s.type,
Bot::GetSpellTypeNameByID(correct_type),
correct_type
);
LogBotSpellTypeChecksDetail("UPDATE bot_spells_entries SET `type` = {} WHERE `spell_id` = {}; -- {} [#{}] from {} [#{}] to {} [#{}]",
correct_type,
spell_id,
GetSpellName(spell_id),
spell_id,
Bot::GetSpellTypeNameByID(s.type),
s.type,
Bot::GetSpellTypeNameByID(correct_type),
correct_type
);
}
}
}
void BotDatabase::MapCommandedSpellTypeMinLevels() {
commanded_spell_type_min_levels.clear();
+1
View File
@@ -130,6 +130,7 @@ public:
bool SaveBotSettings(Mob* m);
bool DeleteBotSettings(const uint32 bot_id);
void CheckBotSpells();
void MapCommandedSpellTypeMinLevels();
std::map<int32_t, std::map<int32_t, BotSpellTypesByClass>> GetCommandedSpellTypesMinLevels() { return commanded_spell_type_min_levels; }
-129
View File
@@ -2865,132 +2865,3 @@ BotSpell Bot::GetBestBotSpellForCharm(Bot* caster, Mob* target, uint16 spell_typ
return result;
}
void Bot::CheckBotSpells() {
auto spell_list = BotSpellsEntriesRepository::All(content_db);
uint16 spell_id;
SPDat_Spell_Struct spell;
uint16 correct_type;
uint16 parent_type;
for (const auto& s : spell_list) {
if (!IsValidSpell(s.spell_id)) {
LogBotSpellTypeChecks("{} is an invalid spell", s.spell_id);
continue;
}
spell = spells[s.spell_id];
spell_id = spell.id;
if (spell.classes[s.npc_spells_id - (BOT_CLASS_BASE_ID_PREFIX + 1)] >= 255) {
LogBotSpellTypeChecks("{} [#{}] is not usable by a {} [#{}].", GetSpellName(spell_id), spell_id, GetClassIDName(s.npc_spells_id - BOT_CLASS_BASE_ID_PREFIX), s.npc_spells_id);
}
else {
if (spell.classes[s.npc_spells_id - (BOT_CLASS_BASE_ID_PREFIX + 1)] > s.minlevel) {
LogBotSpellTypeChecks("{} [#{}] is not usable until level {} for a {} [#{}] and the min level is currently set to {}."
, GetSpellName(spell_id)
, spell_id
, spell.classes[s.npc_spells_id - (BOT_CLASS_BASE_ID_PREFIX + 1)]
, GetClassIDName(s.npc_spells_id - BOT_CLASS_BASE_ID_PREFIX)
, s.npc_spells_id
, s.minlevel
);
LogBotSpellTypeChecksDetail("UPDATE bot_spells_entries SET `minlevel` = {} WHERE `spellid` = {} AND `npc_spells_id` = {}; -- {} [#{}] from minlevel {} to {} for {} [#{}]"
, spell.classes[s.npc_spells_id - (BOT_CLASS_BASE_ID_PREFIX + 1)]
, spell_id
, s.npc_spells_id
, GetSpellName(spell_id)
, spell_id
, s.minlevel
, spell.classes[s.npc_spells_id - (BOT_CLASS_BASE_ID_PREFIX + 1)]
, GetClassIDName(s.npc_spells_id - BOT_CLASS_BASE_ID_PREFIX)
, s.npc_spells_id
);
}
if (spell.classes[s.npc_spells_id - (BOT_CLASS_BASE_ID_PREFIX + 1)] < s.minlevel) {
LogBotSpellTypeChecks("{} [#{}] could be used starting at level {} for a {} [#{}] instead of the current min level of {}."
, GetSpellName(spell_id)
, spell_id
, spell.classes[s.npc_spells_id - (BOT_CLASS_BASE_ID_PREFIX + 1)]
, GetClassIDName(s.npc_spells_id - BOT_CLASS_BASE_ID_PREFIX)
, s.npc_spells_id
, s.minlevel
);
LogBotSpellTypeChecksDetail("UPDATE bot_spells_entries SET `minlevel` = {} WHERE `spellid` = {} AND `npc_spells_id` = {}; -- {} [#{}] from minlevel {} to {} for {} [#{}]"
, spell.classes[s.npc_spells_id - (BOT_CLASS_BASE_ID_PREFIX + 1)]
, spell_id
, s.npc_spells_id
, GetSpellName(spell_id)
, spell_id
, s.minlevel
, spell.classes[s.npc_spells_id - (BOT_CLASS_BASE_ID_PREFIX + 1)]
, GetClassIDName(s.npc_spells_id - BOT_CLASS_BASE_ID_PREFIX)
, s.npc_spells_id
);
}
if (spell.classes[s.npc_spells_id - (BOT_CLASS_BASE_ID_PREFIX + 1)] > s.maxlevel) {
LogBotSpellTypeChecks("{} [#{}] is not usable until level {} for a {} [#{}] and the max level is currently set to {}."
, GetSpellName(spell_id)
, spell_id
, spell.classes[s.npc_spells_id - (BOT_CLASS_BASE_ID_PREFIX + 1)]
, GetClassIDName(s.npc_spells_id - BOT_CLASS_BASE_ID_PREFIX)
, s.npc_spells_id
, s.maxlevel
);
}
}
correct_type = GetCorrectBotSpellType(s.type, spell_id);
parent_type = GetParentSpellType(correct_type);
if (RuleB(Bots, UseParentSpellTypeForChecks)) {
if (s.type == parent_type || s.type == correct_type) {
continue;
}
}
else {
if (IsPetBotSpellType(s.type)) {
correct_type = GetPetBotSpellType(correct_type);
}
}
if (correct_type == s.type) {
continue;
}
if (correct_type == UINT16_MAX) {
LogBotSpellTypeChecks("{} [#{}] is incorrect. It is currently set as {} [#{}] but the correct type is unknown."
, GetSpellName(spell_id)
, spell_id
, GetSpellTypeNameByID(s.type)
, s.type
);
}
else {
LogBotSpellTypeChecks("{} [#{}] is incorrect. It is currently set as {} [#{}] and should be {} [#{}]"
, GetSpellName(spell_id)
, spell_id
, GetSpellTypeNameByID(s.type)
, s.type
, GetSpellTypeNameByID(correct_type)
, correct_type
);
LogBotSpellTypeChecksDetail("UPDATE bot_spells_entries SET `type` = {} WHERE `spell_id` = {}; -- {} [#{}] from {} [#{}] to {} [#{}]"
, correct_type
, spell_id
, GetSpellName(spell_id)
, spell_id
, GetSpellTypeNameByID(s.type)
, s.type
, GetSpellTypeNameByID(correct_type)
, correct_type
);
}
}
}