Return for GetRawBotList

This checks offline bots too
This commit is contained in:
nytmyr
2025-01-30 22:38:03 -06:00
parent e039ce2e37
commit e695f1c499
2 changed files with 8 additions and 10 deletions
+6 -8
View File
@@ -1017,11 +1017,9 @@ void Group::GetBotList(std::list<Bot*>& bot_list, bool clear_list)
} }
} }
void Group::GetRawBotList(std::list<uint32>& bot_list, bool clear_list) std::list<uint32> Group::GetRawBotList()
{ {
if (clear_list) { std::list<uint32> bot_list;
bot_list.clear();
}
const auto& l = GroupIdRepository::GetWhere( const auto& l = GroupIdRepository::GetWhere(
database, database,
@@ -1036,6 +1034,8 @@ void Group::GetRawBotList(std::list<uint32>& bot_list, bool clear_list)
bot_list.push_back(e.bot_id); bot_list.push_back(e.bot_id);
} }
} }
return bot_list;
} }
bool Group::Process() { bool Group::Process() {
@@ -1263,8 +1263,7 @@ void Client::LeaveGroup() {
} }
if (RuleB(Bots, Enabled)) { if (RuleB(Bots, Enabled)) {
std::list<uint32> sbl; std::list<uint32> sbl = g->GetRawBotList();
g->GetRawBotList(sbl);
for (auto botID : sbl) { for (auto botID : sbl) {
auto b = entity_list.GetBotByBotID(botID); auto b = entity_list.GetBotByBotID(botID);
@@ -2618,8 +2617,7 @@ void Group::AddToGroup(AddToGroupRequest r)
} }
void Group::RemoveClientsBots(Client* c) { void Group::RemoveClientsBots(Client* c) {
std::list<uint32> sbl; std::list<uint32> sbl = GetRawBotList();
GetRawBotList(sbl);
for (auto botID : sbl) { for (auto botID : sbl) {
auto b = entity_list.GetBotByBotID(botID); auto b = entity_list.GetBotByBotID(botID);
+1 -1
View File
@@ -69,7 +69,7 @@ public:
void GetMemberList(std::list<Mob*>& member_list, bool clear_list = true); void GetMemberList(std::list<Mob*>& member_list, bool clear_list = true);
void GetClientList(std::list<Client*>& client_list, bool clear_list = true); void GetClientList(std::list<Client*>& client_list, bool clear_list = true);
void GetBotList(std::list<Bot*>& bot_list, bool clear_list = true); void GetBotList(std::list<Bot*>& bot_list, bool clear_list = true);
void GetRawBotList(std::list<uint32>& bot_list, bool clear_list = true); std::list<uint32> GetRawBotList();
bool IsGroupMember(Mob* c); bool IsGroupMember(Mob* c);
bool IsGroupMember(const char* name); bool IsGroupMember(const char* name);
bool Process(); bool Process();