[Bug Fix] Fix Bot "Failed to Load" Messages. (#2719)

* [Bug Fix] Fix Bot "Failed to Load" Messages.

# Notes
- Bots were producing error messages for "failing to load" spells and inventory when the bot had no spells, like a Warrior, or when the bot was naked, like a newly created bot.

* Update botspellsai.cpp
This commit is contained in:
Alex King 2023-01-10 21:45:04 -05:00 committed by GitHub
parent 4df9fa89bc
commit 933293098b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 40 deletions

View File

@ -1225,13 +1225,12 @@ bool BotDatabase::LoadItemSlots(const uint32 bot_id, std::map<uint16, uint32>& m
bot_id
)
);
if (l.empty()) {
return false;
}
if (!l.empty()) {
for (const auto& e : l) {
m.insert(std::pair<uint16, uint32>(e.slot_id, e.item_id));
}
}
return true;
}

View File

@ -3286,10 +3286,8 @@ DBbotspells_Struct* ZoneDatabase::GetBotSpells(uint32 bot_spell_id)
bot_spell_id
)
);
if (bse.empty()) {
return nullptr;
}
if (!bse.empty()) {
for (const auto& e : bse) {
DBbotspells_entries_Struct entry;
entry.spellid = e.spellid;
@ -3319,6 +3317,7 @@ DBbotspells_Struct* ZoneDatabase::GetBotSpells(uint32 bot_spell_id)
spell_set.entries.push_back(entry);
}
}
bot_spells_cache.insert(std::make_pair(bot_spell_id, spell_set));
@ -3444,7 +3443,6 @@ void Bot::AI_Bot_Event_SpellCastFinished(bool iCastSucceeded, uint16 slot) {
}
bool Bot::HasBotSpellEntry(uint16 spellid) {
auto* spell_list = content_db.GetBotSpells(GetBotSpellID());
if (!spell_list) {