[Bots] Move commanded spell map to zone (#4755)

- Moves the mapping of commanded spell min levels to zone rather than to each individual bot.
- Adds support for sub spell types.
This commit is contained in:
nytmyr
2025-03-06 16:05:36 -06:00
committed by GitHub
parent 94553501ba
commit 1d4ba082ad
7 changed files with 90 additions and 64 deletions
-49
View File
@@ -2994,52 +2994,3 @@ void Bot::CheckBotSpells() {
}
}
}
void Bot::MapSpellTypeLevels() {
commanded_spells_min_level.clear();
auto start = std::min({ BotSpellTypes::START, BotSpellTypes::COMMANDED_START, BotSpellTypes::DISCIPLINE_START });
auto end = std::max({ BotSpellTypes::END, BotSpellTypes::COMMANDED_END, BotSpellTypes::DISCIPLINE_END });
for (int i = start; i <= end; ++i) {
if (!Bot::IsValidBotSpellType(i)) {
continue;
}
for (int x = Class::Warrior; x <= Class::Berserker; ++x) {
commanded_spells_min_level[i][x] = { UINT8_MAX, "" };
}
}
auto spell_list = BotSpellsEntriesRepository::All(content_db);
for (const auto& s : spell_list) {
if (!IsValidSpell(s.spell_id)) {
LogBotSpellTypeChecks("{} is an invalid spell", s.spell_id);
continue;
}
uint16_t spell_type = s.type;
int32_t bot_class = s.npc_spells_id - BOT_CLASS_BASE_ID_PREFIX;
uint8_t min_level = s.minlevel;
if (
!EQ::ValueWithin(bot_class, Class::Warrior, Class::Berserker) ||
!Bot::IsValidBotSpellType(spell_type)
) {
continue;
}
auto& spell_info = commanded_spells_min_level[spell_type][bot_class];
if (min_level < spell_info.min_level) {
spell_info.min_level = min_level;
spell_info.description = StringFormat(
"%s [#%u]: Level %u",
GetClassIDName(bot_class),
bot_class,
min_level
);
}
}
}