mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 06:21:28 +00:00
[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:
parent
4df9fa89bc
commit
933293098b
@ -1225,12 +1225,11 @@ bool BotDatabase::LoadItemSlots(const uint32 bot_id, std::map<uint16, uint32>& m
|
|||||||
bot_id
|
bot_id
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
if (l.empty()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const auto& e : l) {
|
if (!l.empty()) {
|
||||||
m.insert(std::pair<uint16, uint32>(e.slot_id, e.item_id));
|
for (const auto& e : l) {
|
||||||
|
m.insert(std::pair<uint16, uint32>(e.slot_id, e.item_id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -377,10 +377,10 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
|
|||||||
if (
|
if (
|
||||||
!(
|
!(
|
||||||
(
|
(
|
||||||
spells[selectedBotSpell.SpellId].target_type == ST_Target ||
|
spells[selectedBotSpell.SpellId].target_type == ST_Target ||
|
||||||
spells[selectedBotSpell.SpellId].target_type == ST_Pet ||
|
spells[selectedBotSpell.SpellId].target_type == ST_Pet ||
|
||||||
(tar == this && spells[selectedBotSpell.SpellId].target_type != ST_TargetsTarget) ||
|
(tar == this && spells[selectedBotSpell.SpellId].target_type != ST_TargetsTarget) ||
|
||||||
spells[selectedBotSpell.SpellId].target_type == ST_Group ||
|
spells[selectedBotSpell.SpellId].target_type == ST_Group ||
|
||||||
spells[selectedBotSpell.SpellId].target_type == ST_GroupTeleport ||
|
spells[selectedBotSpell.SpellId].target_type == ST_GroupTeleport ||
|
||||||
(botClass == BARD && spells[selectedBotSpell.SpellId].target_type == ST_AEBard)
|
(botClass == BARD && spells[selectedBotSpell.SpellId].target_type == ST_AEBard)
|
||||||
) &&
|
) &&
|
||||||
@ -2951,8 +2951,8 @@ bool Bot::AI_AddBotSpells(uint32 bot_spell_id) {
|
|||||||
for (const auto &iter : spell_list->entries) {
|
for (const auto &iter : spell_list->entries) {
|
||||||
LogAIDetail("([{}]) [{}]", iter.spellid, spells[iter.spellid].name);
|
LogAIDetail("([{}]) [{}]", iter.spellid, spells[iter.spellid].name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
debug_msg.append(" (not found)");
|
debug_msg.append(" (not found)");
|
||||||
LogAI("[{}]", debug_msg);
|
LogAI("[{}]", debug_msg);
|
||||||
@ -3286,38 +3286,37 @@ DBbotspells_Struct* ZoneDatabase::GetBotSpells(uint32 bot_spell_id)
|
|||||||
bot_spell_id
|
bot_spell_id
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
if (bse.empty()) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const auto& e : bse) {
|
if (!bse.empty()) {
|
||||||
DBbotspells_entries_Struct entry;
|
for (const auto& e : bse) {
|
||||||
entry.spellid = e.spellid;
|
DBbotspells_entries_Struct entry;
|
||||||
entry.type = e.type;
|
entry.spellid = e.spellid;
|
||||||
entry.minlevel = e.minlevel;
|
entry.type = e.type;
|
||||||
entry.maxlevel = e.maxlevel;
|
entry.minlevel = e.minlevel;
|
||||||
entry.manacost = e.manacost;
|
entry.maxlevel = e.maxlevel;
|
||||||
entry.recast_delay = e.recast_delay;
|
entry.manacost = e.manacost;
|
||||||
entry.priority = e.priority;
|
entry.recast_delay = e.recast_delay;
|
||||||
entry.min_hp = e.min_hp;
|
entry.priority = e.priority;
|
||||||
entry.max_hp = e.max_hp;
|
entry.min_hp = e.min_hp;
|
||||||
entry.resist_adjust = e.resist_adjust;
|
entry.max_hp = e.max_hp;
|
||||||
entry.bucket_name = e.bucket_name;
|
|
||||||
entry.bucket_value = e.bucket_value;
|
|
||||||
entry.bucket_comparison = e.bucket_comparison;
|
|
||||||
|
|
||||||
// some spell types don't make much since to be priority 0, so fix that
|
|
||||||
if (!(entry.type & SPELL_TYPES_INNATE) && entry.priority == 0) {
|
|
||||||
entry.priority = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.resist_adjust) {
|
|
||||||
entry.resist_adjust = e.resist_adjust;
|
entry.resist_adjust = e.resist_adjust;
|
||||||
} else if (IsValidSpell(e.spellid)) {
|
entry.bucket_name = e.bucket_name;
|
||||||
entry.resist_adjust = spells[e.spellid].resist_difficulty;
|
entry.bucket_value = e.bucket_value;
|
||||||
}
|
entry.bucket_comparison = e.bucket_comparison;
|
||||||
|
|
||||||
spell_set.entries.push_back(entry);
|
// some spell types don't make much since to be priority 0, so fix that
|
||||||
|
if (!(entry.type & SPELL_TYPES_INNATE) && entry.priority == 0) {
|
||||||
|
entry.priority = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.resist_adjust) {
|
||||||
|
entry.resist_adjust = e.resist_adjust;
|
||||||
|
} else if (IsValidSpell(e.spellid)) {
|
||||||
|
entry.resist_adjust = spells[e.spellid].resist_difficulty;
|
||||||
|
}
|
||||||
|
|
||||||
|
spell_set.entries.push_back(entry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bot_spells_cache.insert(std::make_pair(bot_spell_id, spell_set));
|
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) {
|
bool Bot::HasBotSpellEntry(uint16 spellid) {
|
||||||
|
|
||||||
auto* spell_list = content_db.GetBotSpells(GetBotSpellID());
|
auto* spell_list = content_db.GetBotSpells(GetBotSpellID());
|
||||||
|
|
||||||
if (!spell_list) {
|
if (!spell_list) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user