Move bot_list from std::list to std::unordered_map like other entities

This commit is contained in:
nytmyr
2024-12-23 20:50:36 -06:00
parent c7741efbe5
commit ef983c3d47
53 changed files with 266 additions and 275 deletions
+55 -68
View File
@@ -5529,9 +5529,9 @@ void Bot::BotOrderCampAll(Client* c, uint8 class_id) {
void Bot::ProcessBotOwnerRefDelete(Mob* botOwner) { void Bot::ProcessBotOwnerRefDelete(Mob* botOwner) {
if (botOwner && botOwner->IsClient()) { if (botOwner && botOwner->IsClient()) {
std::list<Bot*> BotList = entity_list.GetBotsByBotOwnerCharacterID(botOwner->CastToClient()->CharacterID()); std::vector<Bot*> BotList = entity_list.GetBotsByBotOwnerCharacterID(botOwner->CastToClient()->CharacterID());
if (!BotList.empty()) { if (!BotList.empty()) {
for (std::list<Bot*>::iterator botListItr = BotList.begin(); botListItr != BotList.end(); ++botListItr) { for (std::vector<Bot*>::iterator botListItr = BotList.begin(); botListItr != BotList.end(); ++botListItr) {
Bot* tempBot = *botListItr; Bot* tempBot = *botListItr;
if (tempBot) { if (tempBot) {
tempBot->SetTarget(nullptr); tempBot->SetTarget(nullptr);
@@ -6966,7 +6966,7 @@ void Bot::UpdateGroupCastingRoles(const Group* group, bool disband)
Bot* Bot::GetBotByBotClientOwnerAndBotName(Client* c, const std::string& botName) { Bot* Bot::GetBotByBotClientOwnerAndBotName(Client* c, const std::string& botName) {
Bot* Result = nullptr; Bot* Result = nullptr;
if (c) { if (c) {
std::list<Bot*> BotList = entity_list.GetBotsByBotOwnerCharacterID(c->CharacterID()); std::vector<Bot*> BotList = entity_list.GetBotsByBotOwnerCharacterID(c->CharacterID());
if (!BotList.empty()) { if (!BotList.empty()) {
for (auto botListItr = BotList.begin(); botListItr != BotList.end(); ++botListItr) { for (auto botListItr = BotList.begin(); botListItr != BotList.end(); ++botListItr) {
if (std::string((*botListItr)->GetCleanName()) == botName) { if (std::string((*botListItr)->GetCleanName()) == botName) {
@@ -7056,9 +7056,9 @@ void Bot::RemoveBotFromRaid(Bot* bot) {
// Handles all client zone change event // Handles all client zone change event
void Bot::ProcessClientZoneChange(Client* botOwner) { void Bot::ProcessClientZoneChange(Client* botOwner) {
if (botOwner) { if (botOwner) {
std::list<Bot*> BotList = entity_list.GetBotsByBotOwnerCharacterID(botOwner->CharacterID()); std::vector<Bot*> BotList = entity_list.GetBotsByBotOwnerCharacterID(botOwner->CharacterID());
for (std::list<Bot*>::iterator itr = BotList.begin(); itr != BotList.end(); ++itr) { for (std::vector<Bot*>::iterator itr = BotList.begin(); itr != BotList.end(); ++itr) {
Bot* tempBot = *itr; Bot* tempBot = *itr;
if (tempBot) { if (tempBot) {
@@ -7285,65 +7285,54 @@ Mob* EntityList::GetMobByBotID(uint32 botID) {
} }
Bot* EntityList::GetBotByBotID(uint32 botID) { Bot* EntityList::GetBotByBotID(uint32 botID) {
Bot* Result = nullptr; auto it = bot_list.begin();
if (botID > 0) { while (it != bot_list.end()) {
for (std::list<Bot*>::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); ++botListItr) { if (it->second->GetBotID() == botID)
Bot* tempBot = *botListItr; return it->second;
if (tempBot && tempBot->GetBotID() == botID) { ++it;
Result = tempBot;
break;
}
}
} }
return Result; return nullptr;
} }
Bot* EntityList::GetBotByBotName(std::string_view botName) { Bot* EntityList::GetBotByBotName(std::string botName) {
Bot* Result = nullptr; for (const auto& e : bot_list) {
if (!botName.empty()) { if (e.second && Strings::EqualFold(e.second->GetName(), botName)) {
for (const auto b : bot_list) { return e.second;
if (b && std::string_view(b->GetName()) == botName) {
Result = b;
break;
}
} }
} }
return Result;
return nullptr;
} }
Client* EntityList::GetBotOwnerByBotEntityID(uint32 entity_id) { Client* EntityList::GetBotOwnerByBotEntityID(uint32 entity_id) {
Client* c = nullptr;
if (entity_id) { if (entity_id) {
for (const auto& b : bot_list) { auto it = bot_list.begin();
if (b && b->GetID() == entity_id) { while (it != bot_list.end()) {
c = b->GetBotOwner()->CastToClient(); if (it->second->GetID() == entity_id)
break; return it->second->GetBotOwner()->CastToClient();
} ++it;
} }
} }
return nullptr;
return c;
} }
Client* EntityList::GetBotOwnerByBotID(const uint32 bot_id) { Client* EntityList::GetBotOwnerByBotID(const uint32 bot_id) {
Client* c = nullptr;
if (bot_id) { if (bot_id) {
const auto owner_id = database.botdb.GetOwnerID(bot_id); auto it = bot_list.begin();
if (owner_id) { while (it != bot_list.end()) {
c = GetClientByCharID(owner_id); if (it->second->GetBotID() == bot_id)
return it->second->GetBotOwner()->CastToClient();
++it;
} }
} }
return nullptr;
return c;
} }
void EntityList::AddBot(Bot *new_bot, bool send_spawn_packet, bool dont_queue) { void EntityList::AddBot(Bot *new_bot, bool send_spawn_packet, bool dont_queue) {
if (new_bot) { if (new_bot) {
new_bot->SetID(GetFreeID()); new_bot->SetID(GetFreeID());
bot_list.push_back(new_bot); bot_list.emplace(std::pair<uint16, Bot*>(new_bot->GetID(), new_bot));
mob_list.insert(std::pair<uint16, Mob*>(new_bot->GetID(), new_bot)); mob_list.emplace(std::pair<uint16, Mob*>(new_bot->GetID(), new_bot));
if (parse->BotHasQuestSub(EVENT_SPAWN)) { if (parse->BotHasQuestSub(EVENT_SPAWN)) {
parse->EventBot(EVENT_SPAWN, new_bot, nullptr, "", 0); parse->EventBot(EVENT_SPAWN, new_bot, nullptr, "", 0);
@@ -7372,31 +7361,32 @@ void EntityList::AddBot(Bot *new_bot, bool send_spawn_packet, bool dont_queue) {
} }
} }
std::list<Bot*> EntityList::GetBotsByBotOwnerCharacterID(uint32 botOwnerCharacterID) { std::vector<Bot*> EntityList::GetBotsByBotOwnerCharacterID(uint32 botOwnerCharacterID) {
std::list<Bot*> Result; std::vector<Bot*> client_bot_list;
if (botOwnerCharacterID > 0) {
for (std::list<Bot*>::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); ++botListItr) { if (botOwnerCharacterID <= 0) {
Bot* tempBot = *botListItr; return client_bot_list;
if (tempBot && tempBot->GetBotOwnerCharacterID() == botOwnerCharacterID)
Result.push_back(tempBot);
}
} }
return Result;
auto it = bot_list.begin();
while (it != bot_list.end()) {
if (it->second->GetOwner() && it->second->GetBotOwnerCharacterID() == botOwnerCharacterID) {
client_bot_list.push_back(it->second);
}
++it;
}
return client_bot_list;
} }
bool EntityList::RemoveBot(uint16 entityID) { bool EntityList::RemoveBot(uint16 entityID) {
bool Result = false; auto it = bot_list.find(entityID);
if (entityID > 0) { if (it != bot_list.end()) {
for (std::list<Bot*>::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); ++botListItr) { bot_list.erase(it); // Already deleted
Bot* tempBot = *botListItr; return true;
if (tempBot && tempBot->GetID() == entityID) {
bot_list.erase(botListItr);
Result = true;
break;
}
}
} }
return Result; return false;
} }
void EntityList::ShowSpawnWindow(Client* client, int Distance, bool NamedOnly) { void EntityList::ShowSpawnWindow(Client* client, int Distance, bool NamedOnly) {
@@ -11973,14 +11963,11 @@ void Bot::CleanBotBlockedBuffs()
} }
std::vector<BotSpells_Struct_wIndex> Bot::BotGetSpellsByType(uint16 spellType) { std::vector<BotSpells_Struct_wIndex> Bot::BotGetSpellsByType(uint16 spellType) {
if (!AIBot_spells_by_type[spellType].empty()) { if (AIBot_spells_by_type[spellType].empty()) {
return AIBot_spells_by_type[spellType];
}
else {
spellType = GetParentSpellType(spellType); spellType = GetParentSpellType(spellType);
return AIBot_spells_by_type[spellType];
} }
return AIBot_spells_by_type[spellType];
} }
void Bot::AssignBotSpellsToTypes(std::vector<BotSpells_Struct>& AIBot_spells, std::unordered_map<uint16, std::vector<BotSpells_Struct_wIndex>>& AIBot_spells_by_type) { void Bot::AssignBotSpellsToTypes(std::vector<BotSpells_Struct>& AIBot_spells, std::unordered_map<uint16, std::vector<BotSpells_Struct_wIndex>>& AIBot_spells_by_type) {
+1 -1
View File
@@ -1814,7 +1814,7 @@ int helper_bot_follow_option_chain(Client* bot_owner)
return 0; return 0;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
MyBots::PopulateSBL_BySpawnedBots(bot_owner, sbl); MyBots::PopulateSBL_BySpawnedBots(bot_owner, sbl);
if (sbl.empty()) { if (sbl.empty()) {
return 0; return 0;
+44 -45
View File
@@ -272,13 +272,13 @@ namespace MyBots
return (grouped_player->GetGroup() == grouped_bot->GetGroup()); return (grouped_player->GetGroup() == grouped_bot->GetGroup());
} }
static void UniquifySBL(std::list<Bot*> &sbl) { static void UniquifySBL(std::vector<Bot*> &sbl) {
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
sbl.sort(); std::sort(sbl.begin(), sbl.end());
sbl.unique(); sbl.erase(std::unique(sbl.begin(), sbl.end()), sbl.end());
} }
static void PopulateSBL_ByTargetedBot(Client *bot_owner, std::list<Bot*> &sbl, bool clear_list = true) { static void PopulateSBL_ByTargetedBot(Client *bot_owner, std::vector<Bot*> &sbl, bool clear_list = true) {
if (clear_list) { if (clear_list) {
sbl.clear(); sbl.clear();
} }
@@ -292,7 +292,7 @@ namespace MyBots
} }
} }
static void PopulateSBL_ByNamedBot(Client *bot_owner, std::list<Bot*> &sbl, const char* name, bool clear_list = true) { static void PopulateSBL_ByNamedBot(Client *bot_owner, std::vector<Bot*> &sbl, const char* name, bool clear_list = true) {
if (clear_list) { if (clear_list) {
sbl.clear(); sbl.clear();
} }
@@ -314,7 +314,7 @@ namespace MyBots
} }
} }
static void PopulateSBL_ByMyGroupedBots(Client *bot_owner, std::list<Bot*> &sbl, bool clear_list = true) { static void PopulateSBL_ByMyGroupedBots(Client *bot_owner, std::vector<Bot*> &sbl, bool clear_list = true) {
if (clear_list) { if (clear_list) {
sbl.clear(); sbl.clear();
} }
@@ -363,7 +363,7 @@ namespace MyBots
} }
} }
static void PopulateSBL_ByMyRaidBots(Client* bot_owner, std::list<Bot*>& sbl, bool clear_list = true) { static void PopulateSBL_ByMyRaidBots(Client* bot_owner, std::vector<Bot*>& sbl, bool clear_list = true) {
if (clear_list) { if (clear_list) {
sbl.clear(); sbl.clear();
} }
@@ -396,7 +396,7 @@ namespace MyBots
} }
} }
static void PopulateSBL_ByTargetsGroupedBots(Client *bot_owner, std::list<Bot*> &sbl, bool clear_list = true) { static void PopulateSBL_ByTargetsGroupedBots(Client *bot_owner, std::vector<Bot*> &sbl, bool clear_list = true) {
if (clear_list) { if (clear_list) {
sbl.clear(); sbl.clear();
} }
@@ -448,7 +448,7 @@ namespace MyBots
} }
} }
static void PopulateSBL_ByNamesGroupedBots(Client *bot_owner, std::list<Bot*> &sbl, const char* name, bool clear_list = true) { static void PopulateSBL_ByNamesGroupedBots(Client *bot_owner, std::vector<Bot*> &sbl, const char* name, bool clear_list = true) {
if (clear_list) { if (clear_list) {
sbl.clear(); sbl.clear();
} }
@@ -507,7 +507,7 @@ namespace MyBots
} }
} }
static void PopulateSBL_ByHealRotation(Client *bot_owner, std::list<Bot*> &sbl, const char* name, bool clear_list = true) { static void PopulateSBL_ByHealRotation(Client *bot_owner, std::vector<Bot*> &sbl, const char* name, bool clear_list = true) {
if (clear_list) { if (clear_list) {
sbl.clear(); sbl.clear();
} }
@@ -516,7 +516,7 @@ namespace MyBots
return; return;
} }
std::list<Bot*> selectable_bot_list; std::vector<Bot*> selectable_bot_list;
if (name) { if (name) {
PopulateSBL_ByNamedBot(bot_owner, selectable_bot_list, name); PopulateSBL_ByNamedBot(bot_owner, selectable_bot_list, name);
} }
@@ -545,7 +545,7 @@ namespace MyBots
UniquifySBL(sbl); UniquifySBL(sbl);
} }
static void PopulateSBL_ByHealRotationMembers(Client *bot_owner, std::list<Bot*> &sbl, const char* name, bool clear_list = true) { static void PopulateSBL_ByHealRotationMembers(Client *bot_owner, std::vector<Bot*> &sbl, const char* name, bool clear_list = true) {
if (clear_list) { if (clear_list) {
sbl.clear(); sbl.clear();
} }
@@ -554,7 +554,7 @@ namespace MyBots
return; return;
} }
std::list<Bot*> selectable_bot_list; std::vector<Bot*> selectable_bot_list;
if (name) { if (name) {
PopulateSBL_ByNamedBot(bot_owner, selectable_bot_list, name); PopulateSBL_ByNamedBot(bot_owner, selectable_bot_list, name);
} }
@@ -578,7 +578,7 @@ namespace MyBots
} }
} }
static void PopulateSBL_ByHealRotationTargets(Client *bot_owner, std::list<Bot*> &sbl, const char* name, bool clear_list = true) { static void PopulateSBL_ByHealRotationTargets(Client *bot_owner, std::vector<Bot*> &sbl, const char* name, bool clear_list = true) {
if (clear_list) { if (clear_list) {
sbl.clear(); sbl.clear();
} }
@@ -587,7 +587,7 @@ namespace MyBots
return; return;
} }
std::list<Bot*> selectable_bot_list; std::vector<Bot*> selectable_bot_list;
if (name) { if (name) {
PopulateSBL_ByNamedBot(bot_owner, selectable_bot_list, name); PopulateSBL_ByNamedBot(bot_owner, selectable_bot_list, name);
} }
@@ -611,17 +611,17 @@ namespace MyBots
} }
} }
static void PopulateSBL_BySpawnedBots(Client *bot_owner, std::list<Bot*> &sbl) { // should be used for most spell casting commands static void PopulateSBL_BySpawnedBots(Client *bot_owner, std::vector<Bot*> &sbl) { // should be used for most spell casting commands
sbl.clear(); sbl.clear();
if (!bot_owner) { if (!bot_owner) {
return; return;
} }
sbl = entity_list.GetBotsByBotOwnerCharacterID(bot_owner->CharacterID()); sbl = entity_list.GetBotsByBotOwnerCharacterID(bot_owner->CharacterID());
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
} }
static void PopulateSBL_BySpawnedBotsClass(Client * bot_owner, std::list<Bot*> &sbl, uint16 cls, bool clear_list = true) { static void PopulateSBL_BySpawnedBotsClass(Client * bot_owner, std::vector<Bot*> &sbl, uint16 cls, bool clear_list = true) {
if (clear_list) { if (clear_list) {
sbl.clear(); sbl.clear();
} }
@@ -644,7 +644,7 @@ namespace MyBots
} }
} }
static void PopulateSBL_BySpawnedBotsRace(Client* bot_owner, std::list<Bot*>& sbl, uint16 race, bool clear_list = true) { static void PopulateSBL_BySpawnedBotsRace(Client* bot_owner, std::vector<Bot*>& sbl, uint16 race, bool clear_list = true) {
if (clear_list) { if (clear_list) {
sbl.clear(); sbl.clear();
} }
@@ -667,7 +667,7 @@ namespace MyBots
} }
} }
static void PopulateSBL_ByAtMMR(Client* bot_owner, std::list<Bot*>& sbl, bool clear_list = true) { static void PopulateSBL_ByAtMMR(Client* bot_owner, std::vector<Bot*>& sbl, bool clear_list = true) {
if (clear_list) { if (clear_list) {
sbl.clear(); sbl.clear();
} }
@@ -927,7 +927,7 @@ namespace ActionableBots
}; };
// Populates 'sbl' // Populates 'sbl'
static ABType PopulateSBL(Client* bot_owner, std::string ab_type_arg, std::list<Bot*> &sbl, int ab_mask, const char* name = nullptr, uint16 classrace = 0, bool clear_list = true, bool suppress_message = false) { static ABType PopulateSBL(Client* bot_owner, std::string ab_type_arg, std::vector<Bot*> &sbl, int ab_mask, const char* name = nullptr, uint16 classrace = 0, bool clear_list = true, bool suppress_message = false) {
if (clear_list) { if (clear_list) {
sbl.clear(); sbl.clear();
} }
@@ -1164,7 +1164,7 @@ namespace ActionableBots
return nullptr; return nullptr;
} }
static Bot* AsSpawned_ByClass(Client *bot_owner, std::list<Bot*> &sbl, uint8 cls, bool petless = false) { static Bot* AsSpawned_ByClass(Client *bot_owner, std::vector<Bot*> &sbl, uint8 cls, bool petless = false) {
if (!bot_owner) { if (!bot_owner) {
return nullptr; return nullptr;
} }
@@ -1188,7 +1188,7 @@ namespace ActionableBots
return nullptr; return nullptr;
} }
static Bot* AsSpawned_ByMinLevelAndClass(Client *bot_owner, std::list<Bot*> &sbl, uint8 minlvl, uint8 cls, bool petless = false) { static Bot* AsSpawned_ByMinLevelAndClass(Client *bot_owner, std::vector<Bot*> &sbl, uint8 minlvl, uint8 cls, bool petless = false) {
// This function can be nixed if we can enforce bot level as owner level..and the level check can then be moved to the spell loop in the command function // This function can be nixed if we can enforce bot level as owner level..and the level check can then be moved to the spell loop in the command function
if (!bot_owner) if (!bot_owner)
return nullptr; return nullptr;
@@ -1218,7 +1218,7 @@ namespace ActionableBots
if (!bot_owner || bot_name.empty()) if (!bot_owner || bot_name.empty())
return nullptr; return nullptr;
std::list<Bot*> selectable_bot_list; std::vector<Bot*> selectable_bot_list;
MyBots::PopulateSBL_BySpawnedBots(bot_owner, selectable_bot_list); MyBots::PopulateSBL_BySpawnedBots(bot_owner, selectable_bot_list);
for (auto bot_iter : selectable_bot_list) { for (auto bot_iter : selectable_bot_list) {
if (!bot_name.compare(bot_iter->GetCleanName())) if (!bot_name.compare(bot_iter->GetCleanName()))
@@ -1228,7 +1228,7 @@ namespace ActionableBots
return nullptr; return nullptr;
} }
static Bot* Select_ByClass(Client* bot_owner, BCEnum::TType target_type, std::list<Bot*>& sbl, uint8 cls, Mob* target_mob = nullptr, bool petless = false) { static Bot* Select_ByClass(Client* bot_owner, BCEnum::TType target_type, std::vector<Bot*>& sbl, uint8 cls, Mob* target_mob = nullptr, bool petless = false) {
if (!bot_owner || sbl.empty()) if (!bot_owner || sbl.empty())
return nullptr; return nullptr;
@@ -1252,7 +1252,7 @@ namespace ActionableBots
return nullptr; return nullptr;
} }
static Bot* Select_ByMinLevelAndClass(Client* bot_owner, BCEnum::TType target_type, std::list<Bot*>& sbl, uint8 minlvl, uint8 cls, Mob* target_mob = nullptr, bool petless = false) { static Bot* Select_ByMinLevelAndClass(Client* bot_owner, BCEnum::TType target_type, std::vector<Bot*>& sbl, uint8 minlvl, uint8 cls, Mob* target_mob = nullptr, bool petless = false) {
if (!bot_owner || sbl.empty()) if (!bot_owner || sbl.empty())
return nullptr; return nullptr;
@@ -1277,23 +1277,23 @@ namespace ActionableBots
} }
// Filters actual 'sbl' list // Filters actual 'sbl' list
static void Filter_ByClasses(Client* bot_owner, std::list<Bot*>& sbl, uint16 class_mask) { static void Filter_ByClasses(Client* bot_owner, std::vector<Bot*>& sbl, uint16 class_mask) {
sbl.remove_if([bot_owner](Bot* l) { return (!MyBots::IsMyBot(bot_owner, l)); }); std::erase_if(sbl, [bot_owner](Bot* l) { return (!MyBots::IsMyBot(bot_owner, l)); });
sbl.remove_if([class_mask](const Bot* l) { return (GetPlayerClassBit(l->GetClass()) & (~class_mask)); }); std::erase_if(sbl, [class_mask](Bot* l) { return (GetPlayerClassBit(l->GetClass()) & (~class_mask)); });
} }
static void Filter_ByMinLevel(Client* bot_owner, std::list<Bot*>& sbl, uint8 min_level) { static void Filter_ByMinLevel(Client* bot_owner, std::vector<Bot*>& sbl, uint8 min_level) {
sbl.remove_if([bot_owner](Bot* l) { return (!MyBots::IsMyBot(bot_owner, l)); }); std::erase_if(sbl, [bot_owner](Bot* l) { return (!MyBots::IsMyBot(bot_owner, l)); });
sbl.remove_if([min_level](const Bot* l) { return (l->GetLevel() < min_level); }); std::erase_if(sbl, [min_level](Bot* l) { return (l->GetLevel() < min_level); });
} }
static void Filter_ByRanged(Client* bot_owner, std::list<Bot*>& sbl) { static void Filter_ByRanged(Client* bot_owner, std::vector<Bot*>& sbl) {
sbl.remove_if([bot_owner](Bot* l) { return (!MyBots::IsMyBot(bot_owner, l)); }); std::erase_if(sbl, [bot_owner](Bot* l) { return (!MyBots::IsMyBot(bot_owner, l)); });
sbl.remove_if([bot_owner](Bot* l) { return (!l->IsBotRanged()); }); std::erase_if(sbl, [bot_owner](Bot* l) { return (l->IsBotRanged()); });
} }
static void Filter_ByHighestSkill(Client* bot_owner, std::list<Bot*>& sbl, EQ::skills::SkillType skill_type, float& skill_value) { static void Filter_ByHighestSkill(Client* bot_owner, std::vector<Bot*>& sbl, EQ::skills::SkillType skill_type, float& skill_value) {
sbl.remove_if([bot_owner](Bot* l) { return (!MyBots::IsMyBot(bot_owner, l)); }); std::erase_if(sbl, [bot_owner](Bot* l) { return (!MyBots::IsMyBot(bot_owner, l)); });
skill_value = 0.0f; skill_value = 0.0f;
float mod_skill_value = 0.0f; float mod_skill_value = 0.0f;
@@ -1319,15 +1319,14 @@ namespace ActionableBots
skilled_bot = bot_iter; skilled_bot = bot_iter;
} }
} }
std::erase_if(sbl, [skilled_bot](Bot* l) { return (l != skilled_bot); });
sbl.remove_if([skilled_bot](const Bot* l) { return (l != skilled_bot); });
} }
static void Filter_ByHighestPickLock(Client* bot_owner, std::list<Bot*>& sbl, float& pick_lock_value) { static void Filter_ByHighestPickLock(Client* bot_owner, std::vector<Bot*>& sbl, float& pick_lock_value) {
sbl.remove_if([bot_owner](Bot* l) { return (!MyBots::IsMyBot(bot_owner, l)); }); std::erase_if(sbl, [bot_owner](Bot* l) { return (!MyBots::IsMyBot(bot_owner, l)); });
sbl.remove_if([bot_owner](const Bot* l) { return (l->GetClass() != Class::Rogue && l->GetClass() != Class::Bard); }); std::erase_if(sbl, [bot_owner](Bot* l) { return (l->GetClass() != Class::Rogue && l->GetClass() != Class::Bard); });
sbl.remove_if([bot_owner](const Bot* l) { return (l->GetClass() == Class::Rogue && l->GetLevel() < 5); }); std::erase_if(sbl, [bot_owner](Bot* l) { return (l->GetClass() == Class::Rogue && l->GetLevel() < 5); });
sbl.remove_if([bot_owner](const Bot* l) { return (l->GetClass() == Class::Bard && l->GetLevel() < 40); }); std::erase_if(sbl, [bot_owner](Bot* l) { return (l->GetClass() == Class::Bard && l->GetLevel() < 40); });
ActionableBots::Filter_ByHighestSkill(bot_owner, sbl, EQ::skills::SkillPickLock, pick_lock_value); ActionableBots::Filter_ByHighestSkill(bot_owner, sbl, EQ::skills::SkillPickLock, pick_lock_value);
} }
+2 -2
View File
@@ -24,13 +24,13 @@ void bot_command_aggressive(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
int success_count = 0; int success_count = 0;
int candidate_count = sbl.size(); int candidate_count = sbl.size();
+1 -1
View File
@@ -214,7 +214,7 @@ void bot_command_dye_armor(Client *c, const Seperator *sep)
uint32 rgb_value = ((uint32)red_value << 16) | ((uint32)green_value << 8) | ((uint32)blue_value); uint32 rgb_value = ((uint32)red_value << 16) | ((uint32)green_value << 8) | ((uint32)blue_value);
std::list<Bot*> sbl; std::vector<Bot*> sbl;
auto ab_type = ActionableBots::PopulateSBL(c, sep->arg[5], sbl, ab_mask); auto ab_type = ActionableBots::PopulateSBL(c, sep->arg[5], sbl, ab_mask);
if (ab_type == ActionableBots::ABT_None) { if (ab_type == ActionableBots::ABT_None) {
return; return;
+2 -2
View File
@@ -34,7 +34,7 @@ void bot_command_attack(Client *c, const Seperator *sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, ab_arg.c_str(), sbl, ab_mask, !class_race_check ? sep->arg[2] : nullptr, class_race_check ? atoi(sep->arg[2]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, ab_arg.c_str(), sbl, ab_mask, !class_race_check ? sep->arg[2] : nullptr, class_race_check ? atoi(sep->arg[2]) : 0) == ActionableBots::ABT_None) {
return; return;
@@ -47,7 +47,7 @@ void bot_command_attack(Client *c, const Seperator *sep)
size_t attacker_count = 0; size_t attacker_count = 0;
Bot *first_attacker = nullptr; Bot *first_attacker = nullptr;
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
for (auto bot_iter : sbl) { for (auto bot_iter : sbl) {
if (bot_iter->GetAppearance() != eaDead && bot_iter->GetBotStance() != Stance::Passive) { if (bot_iter->GetAppearance() != eaDead && bot_iter->GetBotStance() != Stance::Passive) {
+2 -2
View File
@@ -118,12 +118,12 @@ void bot_command_behind_mob(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
Bot* first_found = nullptr; Bot* first_found = nullptr;
int success_count = 0; int success_count = 0;
+4 -4
View File
@@ -162,13 +162,13 @@ void bot_command_blocked_buffs(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, actionableArg, sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, actionableArg, sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
bool isSuccess = false; bool isSuccess = false;
uint16 successCount = 0; uint16 successCount = 0;
@@ -421,13 +421,13 @@ void bot_command_blocked_pet_buffs(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, actionableArg, sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, actionableArg, sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
bool isSuccess = false; bool isSuccess = false;
uint16 successCount = 0; uint16 successCount = 0;
+13 -13
View File
@@ -51,7 +51,7 @@ void bot_command_camp(Client *c, const Seperator *sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, !class_race_check ? sep->arg[2] : nullptr, class_race_check ? atoi(sep->arg[2]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, !class_race_check ? sep->arg[2] : nullptr, class_race_check ? atoi(sep->arg[2]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
@@ -611,13 +611,13 @@ void bot_command_follow_distance(Client *c, const Seperator *sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
int botCount = 0; int botCount = 0;
for (auto bot_iter : sbl) { for (auto bot_iter : sbl) {
@@ -704,7 +704,7 @@ void bot_command_inspect_message(Client *c, const Seperator *sep)
return; return;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
auto ab_type = ActionableBots::PopulateSBL(c, sep->arg[2], sbl, ab_mask, sep->arg[3]); auto ab_type = ActionableBots::PopulateSBL(c, sep->arg[2], sbl, ab_mask, sep->arg[3]);
if (ab_type == ActionableBots::ABT_None) if (ab_type == ActionableBots::ABT_None)
return; return;
@@ -947,7 +947,7 @@ void bot_command_report(Client *c, const Seperator *sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
@@ -1377,7 +1377,7 @@ void bot_command_stance(Client *c, const Seperator *sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
@@ -1519,13 +1519,13 @@ void bot_command_stop_melee_level(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
Bot* first_found = nullptr; Bot* first_found = nullptr;
int success_count = 0; int success_count = 0;
@@ -1614,12 +1614,12 @@ void bot_command_summon(Client *c, const Seperator *sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
for (auto bot_iter : sbl) { for (auto bot_iter : sbl) {
if (!bot_iter) { if (!bot_iter) {
@@ -1695,7 +1695,7 @@ void bot_command_toggle_ranged(Client *c, const Seperator *sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
@@ -1747,7 +1747,7 @@ void bot_command_toggle_helm(Client *c, const Seperator *sep)
++ab_arg; ++ab_arg;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
auto ab_type = ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, sep->arg[(ab_arg + 1)]); auto ab_type = ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, sep->arg[(ab_arg + 1)]);
if (ab_type == ActionableBots::ABT_None) if (ab_type == ActionableBots::ABT_None)
return; return;
@@ -1844,7 +1844,7 @@ void bot_command_update(Client *c, const Seperator *sep)
return; return;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
MyBots::PopulateSBL_BySpawnedBots(c, sbl); MyBots::PopulateSBL_BySpawnedBots(c, sbl);
if (sbl.empty()) { if (sbl.empty()) {
c->Message(Chat::White, "You currently have no spawned bots"); c->Message(Chat::White, "You currently have no spawned bots");
+2 -2
View File
@@ -466,13 +466,13 @@ void bot_command_cast(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, actionableArg, sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, actionableArg, sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
BotSpell botSpell; BotSpell botSpell;
botSpell.SpellId = 0; botSpell.SpellId = 0;
+2 -2
View File
@@ -39,13 +39,13 @@ void bot_command_click_item(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
for (auto my_bot : sbl) { for (auto my_bot : sbl) {
if (my_bot->BotPassiveCheck()) { if (my_bot->BotPassiveCheck()) {
+2 -2
View File
@@ -187,12 +187,12 @@ void bot_command_default_settings(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
Bot* first_found = nullptr; Bot* first_found = nullptr;
int success_count = 0; int success_count = 0;
+2 -2
View File
@@ -22,12 +22,12 @@ void bot_command_defensive(Client *c, const Seperator *sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
int success_count = 0; int success_count = 0;
int candidate_count = sbl.size(); int candidate_count = sbl.size();
+2 -2
View File
@@ -147,13 +147,13 @@ void bot_command_depart(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, actionableArg, sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, actionableArg, sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
BotSpell botSpell; BotSpell botSpell;
botSpell.SpellId = 0; botSpell.SpellId = 0;
+2 -2
View File
@@ -46,12 +46,12 @@ void bot_command_distance_ranged(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
Bot* first_found = nullptr; Bot* first_found = nullptr;
int success_count = 0; int success_count = 0;
+2 -2
View File
@@ -117,12 +117,12 @@ void bot_command_follow(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
auto botCount = sbl.size(); auto botCount = sbl.size();
Mob* follow_mob = nullptr; Mob* follow_mob = nullptr;
+2 -2
View File
@@ -30,12 +30,12 @@ void bot_command_guard(Client *c, const Seperator *sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[name_arg] : nullptr, class_race_check ? atoi(sep->arg[name_arg]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[name_arg] : nullptr, class_race_check ? atoi(sep->arg[name_arg]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
for (auto bot_iter : sbl) { for (auto bot_iter : sbl) {
if (clear) { if (clear) {
+20 -20
View File
@@ -63,7 +63,7 @@ void bot_command_heal_rotation_adaptive_targeting(Client* c, const Seperator* se
std::string adaptive_targeting_arg; std::string adaptive_targeting_arg;
std::list<Bot*> sbl; std::vector<Bot*> sbl;
MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]);
if (!sbl.empty()) { if (!sbl.empty()) {
adaptive_targeting_arg = sep->arg[2]; adaptive_targeting_arg = sep->arg[2];
@@ -123,7 +123,7 @@ void bot_command_heal_rotation_add_member(Client* c, const Seperator* sep)
return; return;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]);
if (sbl.empty()) { if (sbl.empty()) {
c->Message(Chat::White, "You must [name] a new member as a bot that you own to use this command"); c->Message(Chat::White, "You must [name] a new member as a bot that you own to use this command");
@@ -191,7 +191,7 @@ void bot_command_heal_rotation_add_target(Client* c, const Seperator* sep)
return; return;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[2]); MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[2]);
if (sbl.empty()) { if (sbl.empty()) {
MyBots::PopulateSBL_ByTargetedBot(c, sbl); MyBots::PopulateSBL_ByTargetedBot(c, sbl);
@@ -283,7 +283,7 @@ void bot_command_heal_rotation_adjust_critical(Client* c, const Seperator* sep)
return; return;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[3]); MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[3]);
if (sbl.empty()) { if (sbl.empty()) {
MyBots::PopulateSBL_ByTargetedBot(c, sbl); MyBots::PopulateSBL_ByTargetedBot(c, sbl);
@@ -383,7 +383,7 @@ void bot_command_heal_rotation_adjust_safe(Client* c, const Seperator* sep)
return; return;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[3]); MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[3]);
if (sbl.empty()) { if (sbl.empty()) {
MyBots::PopulateSBL_ByTargetedBot(c, sbl); MyBots::PopulateSBL_ByTargetedBot(c, sbl);
@@ -460,7 +460,7 @@ void bot_command_heal_rotation_casting_override(Client* c, const Seperator* sep)
std::string casting_override_arg; std::string casting_override_arg;
std::list<Bot*> sbl; std::vector<Bot*> sbl;
MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]);
if (!sbl.empty()) { if (!sbl.empty()) {
casting_override_arg = sep->arg[2]; casting_override_arg = sep->arg[2];
@@ -534,7 +534,7 @@ void bot_command_heal_rotation_change_interval(Client* c, const Seperator* sep)
std::string change_interval_arg; std::string change_interval_arg;
std::list<Bot*> sbl; std::vector<Bot*> sbl;
MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]);
if (!sbl.empty()) { if (!sbl.empty()) {
change_interval_arg = sep->arg[2]; change_interval_arg = sep->arg[2];
@@ -603,7 +603,7 @@ void bot_command_heal_rotation_clear_hot(Client* c, const Seperator* sep)
return; return;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]);
if (sbl.empty()) { if (sbl.empty()) {
MyBots::PopulateSBL_ByTargetedBot(c, sbl); MyBots::PopulateSBL_ByTargetedBot(c, sbl);
@@ -649,7 +649,7 @@ void bot_command_heal_rotation_clear_targets(Client* c, const Seperator* sep)
return; return;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]);
if (sbl.empty()) { if (sbl.empty()) {
MyBots::PopulateSBL_ByTargetedBot(c, sbl); MyBots::PopulateSBL_ByTargetedBot(c, sbl);
@@ -703,7 +703,7 @@ void bot_command_heal_rotation_create(Client* c, const Seperator* sep)
std::string adaptive_targeting_arg; std::string adaptive_targeting_arg;
std::string casting_override_arg; std::string casting_override_arg;
std::list<Bot*> sbl; std::vector<Bot*> sbl;
MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]);
if (!sbl.empty()) { if (!sbl.empty()) {
interval_arg = sep->arg[2]; interval_arg = sep->arg[2];
@@ -858,7 +858,7 @@ void bot_command_heal_rotation_delete(Client* c, const Seperator* sep)
return; return;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[name_arg]); MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[name_arg]);
if (sbl.empty()) { if (sbl.empty()) {
MyBots::PopulateSBL_ByTargetedBot(c, sbl); MyBots::PopulateSBL_ByTargetedBot(c, sbl);
@@ -896,7 +896,7 @@ void bot_command_heal_rotation_fast_heals(Client* c, const Seperator* sep)
std::string fast_heals_arg; std::string fast_heals_arg;
std::list<Bot*> sbl; std::vector<Bot*> sbl;
MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]);
if (!sbl.empty()) { if (!sbl.empty()) {
fast_heals_arg = sep->arg[2]; fast_heals_arg = sep->arg[2];
@@ -956,7 +956,7 @@ void bot_command_heal_rotation_list(Client* c, const Seperator* sep)
return; return;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]);
if (sbl.empty()) { if (sbl.empty()) {
MyBots::PopulateSBL_ByTargetedBot(c, sbl); MyBots::PopulateSBL_ByTargetedBot(c, sbl);
@@ -1076,7 +1076,7 @@ void bot_command_heal_rotation_remove_member(Client* c, const Seperator* sep)
return; return;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]);
if (sbl.empty()) { if (sbl.empty()) {
MyBots::PopulateSBL_ByTargetedBot(c, sbl); MyBots::PopulateSBL_ByTargetedBot(c, sbl);
@@ -1123,7 +1123,7 @@ void bot_command_heal_rotation_remove_target(Client* c, const Seperator* sep)
return; return;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[2]); MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[2]);
if (sbl.empty()) { if (sbl.empty()) {
MyBots::PopulateSBL_ByTargetedBot(c, sbl); MyBots::PopulateSBL_ByTargetedBot(c, sbl);
@@ -1181,7 +1181,7 @@ void bot_command_heal_rotation_reset_limits(Client* c, const Seperator* sep)
return; return;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]);
if (sbl.empty()) { if (sbl.empty()) {
MyBots::PopulateSBL_ByTargetedBot(c, sbl); MyBots::PopulateSBL_ByTargetedBot(c, sbl);
@@ -1223,7 +1223,7 @@ void bot_command_heal_rotation_save(Client* c, const Seperator* sep)
return; return;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]);
if (sbl.empty()) { if (sbl.empty()) {
MyBots::PopulateSBL_ByTargetedBot(c, sbl); MyBots::PopulateSBL_ByTargetedBot(c, sbl);
@@ -1272,7 +1272,7 @@ void bot_command_heal_rotation_set_hot(Client* c, const Seperator* sep)
return; return;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[2]); MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[2]);
if (sbl.empty()) { if (sbl.empty()) {
MyBots::PopulateSBL_ByTargetedBot(c, sbl); MyBots::PopulateSBL_ByTargetedBot(c, sbl);
@@ -1337,7 +1337,7 @@ void bot_command_heal_rotation_start(Client* c, const Seperator* sep)
return; return;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]);
if (sbl.empty()) { if (sbl.empty()) {
MyBots::PopulateSBL_ByTargetedBot(c, sbl); MyBots::PopulateSBL_ByTargetedBot(c, sbl);
@@ -1384,7 +1384,7 @@ void bot_command_heal_rotation_stop(Client* c, const Seperator* sep)
return; return;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]);
if (sbl.empty()) { if (sbl.empty()) {
MyBots::PopulateSBL_ByTargetedBot(c, sbl); MyBots::PopulateSBL_ByTargetedBot(c, sbl);
+2 -2
View File
@@ -30,12 +30,12 @@ void bot_command_hold(Client *c, const Seperator *sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[name_arg] : nullptr, class_race_check ? atoi(sep->arg[name_arg]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[name_arg] : nullptr, class_race_check ? atoi(sep->arg[name_arg]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
for (auto bot_iter : sbl) { for (auto bot_iter : sbl) {
if (clear) { if (clear) {
+2 -2
View File
@@ -118,12 +118,12 @@ void bot_command_illusion_block(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
Bot* first_found = nullptr; Bot* first_found = nullptr;
int success_count = 0; int success_count = 0;
+4 -4
View File
@@ -34,7 +34,7 @@ void bot_command_inventory_give(Client* c, const Seperator* sep)
int ab_mask = (ActionableBots::ABM_Target | ActionableBots::ABM_ByName); int ab_mask = (ActionableBots::ABM_Target | ActionableBots::ABM_ByName);
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None) {
return; return;
} }
@@ -67,7 +67,7 @@ void bot_command_inventory_list(Client* c, const Seperator* sep)
int ab_mask = (ActionableBots::ABM_Target | ActionableBots::ABM_ByName); int ab_mask = (ActionableBots::ABM_Target | ActionableBots::ABM_ByName);
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None) {
return; return;
} }
@@ -168,7 +168,7 @@ void bot_command_inventory_remove(Client* c, const Seperator* sep)
return; return;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[2], sbl, ab_mask, sep->arg[3]) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[2], sbl, ab_mask, sep->arg[3]) == ActionableBots::ABT_None) {
return; return;
} }
@@ -311,7 +311,7 @@ void bot_command_inventory_window(Client* c, const Seperator* sep)
int ab_mask = ActionableBots::ABM_Target; int ab_mask = ActionableBots::ABM_Target;
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None) {
return; return;
} }
+2 -2
View File
@@ -136,13 +136,13 @@ void bot_command_item_use(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, actionableArg, sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, actionableArg, sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
EQ::SayLinkEngine linker; EQ::SayLinkEngine linker;
linker.SetLinkType(EQ::saylink::SayLinkItemData); linker.SetLinkType(EQ::saylink::SayLinkItemData);
+2 -2
View File
@@ -117,12 +117,12 @@ void bot_command_max_melee_range(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
Bot* first_found = nullptr; Bot* first_found = nullptr;
int success_count = 0; int success_count = 0;
+5 -5
View File
@@ -25,7 +25,7 @@ void bot_command_pet_get_lost(Client *c, const Seperator *sep)
} }
int ab_mask = ActionableBots::ABM_NoFilter; int ab_mask = ActionableBots::ABM_NoFilter;
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None) if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None)
return; return;
@@ -56,7 +56,7 @@ void bot_command_pet_remove(Client *c, const Seperator *sep)
} }
int ab_mask = (ActionableBots::ABM_Target | ActionableBots::ABM_ByName); int ab_mask = (ActionableBots::ABM_Target | ActionableBots::ABM_ByName);
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None) if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None)
return; return;
@@ -66,7 +66,7 @@ void bot_command_pet_remove(Client *c, const Seperator *sep)
c->Message(Chat::White, "You have no spawned bots capable of charming"); c->Message(Chat::White, "You have no spawned bots capable of charming");
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
int charmed_pet = 0; int charmed_pet = 0;
int summoned_pet = 0; int summoned_pet = 0;
@@ -241,13 +241,13 @@ void bot_command_pet_set_type(Client *c, const Seperator *sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, actionableArg, sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, actionableArg, sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
std::string currentType; std::string currentType;
uint16 reclaim_energy_id = RuleI(Bots, ReclaimEnergySpellID); uint16 reclaim_energy_id = RuleI(Bots, ReclaimEnergySpellID);
+1 -1
View File
@@ -11,7 +11,7 @@ void bot_command_pick_lock(Client *c, const Seperator *sep)
return; return;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
MyBots::PopulateSBL_BySpawnedBots(c, sbl); MyBots::PopulateSBL_BySpawnedBots(c, sbl);
float pick_lock_value = 0.0f; float pick_lock_value = 0.0f;
+1 -1
View File
@@ -15,7 +15,7 @@ void bot_command_pickpocket(Client *c, const Seperator *sep)
return; return;
} }
std::list<Bot *> sbl; std::vector<Bot*> sbl;
MyBots::PopulateSBL_BySpawnedBots(c, sbl); MyBots::PopulateSBL_BySpawnedBots(c, sbl);
// Check for capable rogue // Check for capable rogue
+2 -2
View File
@@ -28,13 +28,13 @@ void bot_command_pull(Client *c, const Seperator *sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, actionableArg, sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, actionableArg, sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
auto target_mob = ActionableTarget::VerifyEnemy(c, BCEnum::TT_Single); auto target_mob = ActionableTarget::VerifyEnemy(c, BCEnum::TT_Single);
if (!target_mob) { if (!target_mob) {
+2 -2
View File
@@ -10,11 +10,11 @@ void bot_command_release(Client *c, const Seperator *sep)
} }
const int ab_mask = ActionableBots::ABM_NoFilter; const int ab_mask = ActionableBots::ABM_NoFilter;
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None) if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None)
return; return;
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
for (auto bot_iter : sbl) { for (auto bot_iter : sbl) {
bot_iter->WipeHateList(); bot_iter->WipeHateList();
bot_iter->SetPauseAI(false); bot_iter->SetPauseAI(false);
+2 -2
View File
@@ -117,12 +117,12 @@ void bot_command_sit_hp_percent(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
Bot* first_found = nullptr; Bot* first_found = nullptr;
int success_count = 0; int success_count = 0;
+2 -2
View File
@@ -117,12 +117,12 @@ void bot_command_sit_in_combat(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
Bot* first_found = nullptr; Bot* first_found = nullptr;
int success_count = 0; int success_count = 0;
+2 -2
View File
@@ -117,12 +117,12 @@ void bot_command_sit_mana_percent(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
Bot* first_found = nullptr; Bot* first_found = nullptr;
int success_count = 0; int success_count = 0;
+2 -2
View File
@@ -177,12 +177,12 @@ void bot_command_spell_aggro_checks(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
Bot* first_found = nullptr; Bot* first_found = nullptr;
int success_count = 0; int success_count = 0;
+2 -2
View File
@@ -183,12 +183,12 @@ void bot_command_spell_delays(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
Bot* first_found = nullptr; Bot* first_found = nullptr;
int success_count = 0; int success_count = 0;
+2 -2
View File
@@ -181,12 +181,12 @@ void bot_command_spell_engaged_priority(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
Bot* first_found = nullptr; Bot* first_found = nullptr;
int success_count = 0; int success_count = 0;
+2 -2
View File
@@ -167,12 +167,12 @@ void bot_command_spell_holds(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
Bot* first_found = nullptr; Bot* first_found = nullptr;
int success_count = 0; int success_count = 0;
+2 -2
View File
@@ -181,12 +181,12 @@ void bot_command_spell_idle_priority(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
Bot* first_found = nullptr; Bot* first_found = nullptr;
int success_count = 0; int success_count = 0;
+2 -2
View File
@@ -177,12 +177,12 @@ void bot_command_spell_max_hp_pct(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
Bot* first_found = nullptr; Bot* first_found = nullptr;
int success_count = 0; int success_count = 0;
+2 -2
View File
@@ -177,12 +177,12 @@ void bot_command_spell_max_mana_pct(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
Bot* first_found = nullptr; Bot* first_found = nullptr;
int success_count = 0; int success_count = 0;
+2 -2
View File
@@ -183,12 +183,12 @@ void bot_command_spell_max_thresholds(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
Bot* first_found = nullptr; Bot* first_found = nullptr;
int success_count = 0; int success_count = 0;
+2 -2
View File
@@ -177,12 +177,12 @@ void bot_command_spell_min_hp_pct(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
Bot* first_found = nullptr; Bot* first_found = nullptr;
int success_count = 0; int success_count = 0;
+2 -2
View File
@@ -177,12 +177,12 @@ void bot_command_spell_min_mana_pct(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
Bot* first_found = nullptr; Bot* first_found = nullptr;
int success_count = 0; int success_count = 0;
+2 -2
View File
@@ -185,12 +185,12 @@ void bot_command_spell_min_thresholds(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
Bot* first_found = nullptr; Bot* first_found = nullptr;
int success_count = 0; int success_count = 0;
+2 -2
View File
@@ -181,12 +181,12 @@ void bot_command_spell_pursue_priority(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
Bot* first_found = nullptr; Bot* first_found = nullptr;
int success_count = 0; int success_count = 0;
+2 -2
View File
@@ -177,12 +177,12 @@ void bot_command_spell_target_count(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
Bot* first_found = nullptr; Bot* first_found = nullptr;
int success_count = 0; int success_count = 0;
+2 -2
View File
@@ -11,12 +11,12 @@ void bot_command_suspend(Client *c, const Seperator *sep)
} }
const int ab_mask = ActionableBots::ABM_NoFilter; const int ab_mask = ActionableBots::ABM_NoFilter;
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
for (auto bot_iter : sbl) { for (auto bot_iter : sbl) {
bot_iter->SetPauseAI(true); bot_iter->SetPauseAI(true);
} }
+2 -2
View File
@@ -36,13 +36,13 @@ void bot_command_taunt(Client *c, const Seperator *sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[(ab_arg + 1)] : nullptr, class_race_check ? atoi(sep->arg[(ab_arg + 1)]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[(ab_arg + 1)] : nullptr, class_race_check ? atoi(sep->arg[(ab_arg + 1)]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
int taunting_count = 0; int taunting_count = 0;
for (auto bot_iter : sbl) { for (auto bot_iter : sbl) {
+2 -2
View File
@@ -95,13 +95,13 @@ void bot_command_timer(Client* c, const Seperator* sep)
class_race_check = true; class_race_check = true;
} }
std::list<Bot*> sbl; std::vector<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
return; return;
} }
sbl.remove(nullptr); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
for (auto my_bot : sbl) { for (auto my_bot : sbl) {
bool found = false; bool found = false;
+1 -1
View File
@@ -13,7 +13,7 @@ void bot_command_track(Client *c, const Seperator *sep)
std::string tracking_scope = sep->arg[1]; std::string tracking_scope = sep->arg[1];
std::list<Bot*> sbl; std::vector<Bot*> sbl;
MyBots::PopulateSBL_BySpawnedBots(c, sbl); MyBots::PopulateSBL_BySpawnedBots(c, sbl);
uint16 class_mask = (player_class_bitmasks[Class::Ranger] | player_class_bitmasks[Class::Druid] | player_class_bitmasks[Class::Bard]); uint16 class_mask = (player_class_bitmasks[Class::Ranger] | player_class_bitmasks[Class::Druid] | player_class_bitmasks[Class::Bard]);
+20 -21
View File
@@ -1900,13 +1900,13 @@ Bot* EntityList::GetRandomBot(const glm::vec3& location, float distance, Bot* ex
for (const auto& b : bot_list) { for (const auto& b : bot_list) {
if ( if (
b != exclude_bot && b.second != exclude_bot &&
( (
is_whole_zone || is_whole_zone ||
DistanceSquared(static_cast<glm::vec3>(b->GetPosition()), location) <= distance_squared DistanceSquared(static_cast<glm::vec3>(b.second->GetPosition()), location) <= distance_squared
) )
) { ) {
bots_in_range.push_back(b); bots_in_range.push_back(b.second);
} }
} }
@@ -5121,9 +5121,10 @@ void EntityList::GetClientList(std::list<Client *> &c_list)
void EntityList::GetBotList(std::list<Bot *> &b_list) void EntityList::GetBotList(std::list<Bot *> &b_list)
{ {
b_list.clear(); b_list.clear();
auto it = bot_list.begin();
for (const auto& b : bot_list) { while (it != bot_list.end()) {
b_list.push_back(b); b_list.push_back(it->second);
++it;
} }
} }
@@ -5135,14 +5136,13 @@ std::vector<Bot *> EntityList::GetBotListByCharacterID(uint32 character_id, uint
return client_bot_list; return client_bot_list;
} }
for (const auto& b : bot_list) { auto it = bot_list.begin();
if (
b->GetOwner() && while (it != bot_list.end()) {
b->GetBotOwnerCharacterID() == character_id && if (it->second->GetOwner() && it->second->GetBotOwnerCharacterID() == character_id && (!class_id || it->second->GetClass() == class_id)) {
(!class_id || b->GetClass() == class_id) client_bot_list.push_back(it->second);
) {
client_bot_list.push_back(b);
} }
++it;
} }
return client_bot_list; return client_bot_list;
@@ -5156,14 +5156,13 @@ std::vector<Bot *> EntityList::GetBotListByClientName(std::string client_name, u
return client_bot_list; return client_bot_list;
} }
for (const auto& b : bot_list) { auto it = bot_list.begin();
if (
b->GetOwner() && while (it != bot_list.end()) {
Strings::ToLower(b->GetOwner()->GetCleanName()) == Strings::ToLower(client_name) && if (it->second->GetOwner() && Strings::ToLower(it->second->GetOwner()->GetCleanName()) == Strings::ToLower(client_name) && (!class_id || it->second->GetClass() == class_id)) {
(!class_id || b->GetClass() == class_id) client_bot_list.push_back(it->second);
) {
client_bot_list.push_back(b);
} }
++it;
} }
return client_bot_list; return client_bot_list;
+4 -4
View File
@@ -547,7 +547,7 @@ public:
inline const std::unordered_map<uint16, NPC *> &GetNPCList() { return npc_list; } inline const std::unordered_map<uint16, NPC *> &GetNPCList() { return npc_list; }
inline const std::unordered_map<uint16, Merc *> &GetMercList() { return merc_list; } inline const std::unordered_map<uint16, Merc *> &GetMercList() { return merc_list; }
inline const std::unordered_map<uint16, Client *> &GetClientList() { return client_list; } inline const std::unordered_map<uint16, Client *> &GetClientList() { return client_list; }
inline const std::list<Bot *> &GetBotList() { return bot_list; } inline const std::unordered_map<uint16, Bot*> &GetBotList() { return bot_list; }
std::vector<Bot *> GetBotListByCharacterID(uint32 character_id, uint8 class_id = Class::None); std::vector<Bot *> GetBotListByCharacterID(uint32 character_id, uint8 class_id = Class::None);
std::vector<Bot *> GetBotListByClientName(std::string client_name, uint8 class_id = Class::None); std::vector<Bot *> GetBotListByClientName(std::string client_name, uint8 class_id = Class::None);
void SignalAllBotsByOwnerCharacterID(uint32 character_id, int signal_id); void SignalAllBotsByOwnerCharacterID(uint32 character_id, int signal_id);
@@ -623,10 +623,10 @@ private:
bool RemoveBot(uint16 entityID); bool RemoveBot(uint16 entityID);
Mob* GetMobByBotID(uint32 botID); Mob* GetMobByBotID(uint32 botID);
Bot* GetBotByBotID(uint32 botID); Bot* GetBotByBotID(uint32 botID);
Bot* GetBotByBotName(std::string_view botName); Bot* GetBotByBotName(std::string botName);
Client* GetBotOwnerByBotEntityID(uint32 entity_id); Client* GetBotOwnerByBotEntityID(uint32 entity_id);
Client* GetBotOwnerByBotID(const uint32 bot_id); Client* GetBotOwnerByBotID(const uint32 bot_id);
std::list<Bot*> GetBotsByBotOwnerCharacterID(uint32 botOwnerCharacterID); std::vector<Bot*> GetBotsByBotOwnerCharacterID(uint32 botOwnerCharacterID);
void ShowSpawnWindow(Client* client, int Distance, bool NamedOnly); // TODO: Implement ShowSpawnWindow in the bot class but it needs entity list stuff void ShowSpawnWindow(Client* client, int Distance, bool NamedOnly); // TODO: Implement ShowSpawnWindow in the bot class but it needs entity list stuff
@@ -634,7 +634,7 @@ private:
void GetBotList(std::list<Bot*> &b_list); void GetBotList(std::list<Bot*> &b_list);
private: private:
std::list<Bot*> bot_list; std::unordered_map<uint16, Bot*> bot_list;
}; };
class BulkZoneSpawnPacket { class BulkZoneSpawnPacket {
+8 -6
View File
@@ -74,20 +74,22 @@ void command_list(Client *c, const Seperator *sep)
if (is_bots) { if (is_bots) {
const auto& l = entity_list.GetBotList(); const auto& l = entity_list.GetBotList();
for (const auto& e: l) { for (const auto& e : l) {
Bot* entity = e.second;
entity_count++; entity_count++;
const std::string& entity_name = Strings::ToLower(e->GetName()); const std::string& entity_name = Strings::ToLower(entity->GetName());
if (!search_string.empty() && !Strings::Contains(entity_name, search_string)) { if (!search_string.empty() && !Strings::Contains(entity_name, search_string)) {
continue; continue;
} }
unique_entities.emplace_back( unique_entities.emplace_back(
UniqueEntity{ UniqueEntity{
.entity_id = e->GetID(), .entity_id = entity->GetID(),
.entity_name = e->GetName(), .entity_name = entity->GetName(),
.unique_id = e->GetBotID(), .unique_id = entity->GetBotID(),
.position = e->GetPosition() .position = entity->GetPosition()
} }
); );
+6 -5
View File
@@ -382,12 +382,13 @@ Lua_Bot Lua_EntityList::GetBotByName(std::string bot_name) {
Lua_Bot_List Lua_EntityList::GetBotList() { Lua_Bot_List Lua_EntityList::GetBotList() {
Lua_Safe_Call_Class(Lua_Bot_List); Lua_Safe_Call_Class(Lua_Bot_List);
Lua_Bot_List ret; Lua_Bot_List ret;
auto &bot_list = self->GetBotList();
if (bot_list.size()) { auto &current_bot_list = self->GetBotList();
for (auto bot : bot_list) { auto it = current_bot_list.begin();
ret.entries.emplace_back(Lua_Bot(bot));
} while (it != current_bot_list.end()) {
ret.entries.emplace_back(it->second);
++it;
} }
return ret; return ret;
+6 -3
View File
@@ -419,10 +419,13 @@ perl::array Perl_EntityList_GetBotList(EntityList* self) // @categories Script U
{ {
perl::array result; perl::array result;
auto current_bot_list = self->GetBotList(); auto current_bot_list = self->GetBotList();
for (Bot* bot_iterator : current_bot_list) auto it = current_bot_list.begin();
{
result.push_back(bot_iterator); while (it != current_bot_list.end()) {
result.push_back(it->second);
++it;
} }
return result; return result;
} }