[Bots] Add valid state checks to ^clickitem (#4830)

* [Bots] Add valid state checks to ^clickitem

- Bots previously weren't checking if they were in a valid state or not before trying to click an item when told (in a death state, held, feared, silenced, in group/raid, etc.)

* Add error output on no bots selected.=
This commit is contained in:
nytmyr 2025-04-09 21:33:11 -05:00 committed by GitHub
parent 48ecd1222f
commit b813cf71bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -48,9 +48,10 @@ void bot_command_click_item(Client* c, const Seperator* sep)
sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
Mob* tar = c->GetTarget(); Mob* tar = c->GetTarget();
bool is_success = false;
for (auto my_bot : sbl) { for (auto my_bot : sbl) {
if (my_bot->BotPassiveCheck()) { if (!my_bot->ValidStateCheck(c)) {
continue; continue;
} }
@ -68,6 +69,11 @@ void bot_command_click_item(Client* c, const Seperator* sep)
continue; continue;
} }
is_success = true;
my_bot->TryItemClick(slot_id); my_bot->TryItemClick(slot_id);
} }
if (!is_success) {
c->Message(Chat::Yellow, "None of your bots are capable of doing that currently.");
}
} }