[Bug Fix] Check Rule "Bots Enabled" to prevent bot database calls on connect (#3154)

* [Bug Fix] Check for Rule "Bots Enabled" to prevent bot database calls if not enabled.

* formatting

* check if LoadBotsList failed, or is bots_list empty
This commit is contained in:
Aeadoin
2023-03-28 22:44:47 -04:00
committed by GitHub
parent e9c63c7d94
commit 7854130a93
3 changed files with 31 additions and 23 deletions
+2 -22
View File
@@ -607,28 +607,8 @@ void Client::CompleteConnect()
if (raid) {
SetRaidGrouped(true);
raid->LearnMembers();
std::list<BotsAvailableList> bots_list;
database.botdb.LoadBotsList(this->CharacterID(), bots_list);
std::vector<RaidMember> r_members = raid->GetMembers();
for (const RaidMember& iter : r_members) {
if (iter.member_name) {
for (const BotsAvailableList& b_iter : bots_list)
{
if (strcmp(iter.member_name, b_iter.Name) == 0)
{
char buffer[71] = "^spawn ";
strcat(buffer, iter.member_name);
bot_command_real_dispatch(this, buffer);
Bot* b = entity_list.GetBotByBotName(iter.member_name);
if (b)
{
b->SetRaidGrouped(true);
b->p_raid_instance = raid;
//b->SetFollowID(this->GetID());
}
}
}
}
if (RuleB(Bots, Enabled)) {
SpawnRaidBotsOnConnect(raid);
}
raid->VerifyRaid();
raid->GetRaidDetails();