mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-03 09:26:36 +00:00
[Bot Commands] Separate Bot Commands into Individual Files (#4035)
# Notes - Separate all bot commands into individual files like regular commands. # Images
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
#include "../bot_command.h"
|
||||
|
||||
void bot_command_hold(Client *c, const Seperator *sep)
|
||||
{
|
||||
if (helper_command_alias_fail(c, "bot_command_hold", sep->arg[0], "hold")) {
|
||||
return;
|
||||
}
|
||||
if (helper_is_help_or_usage(sep->arg[1])) {
|
||||
|
||||
c->Message(Chat::White, "usage: %s ([option: clear]) [actionable: byname | ownergroup | ownerraid | namesgroup | healrotation | byclass | byrace | spawned]] ([actionable_name])", sep->arg[0]);
|
||||
return;
|
||||
}
|
||||
const int ab_mask = (ActionableBots::ABM_Target | ActionableBots::ABM_Type2);
|
||||
|
||||
bool clear = false;
|
||||
int ab_arg = 1;
|
||||
int name_arg = 2;
|
||||
|
||||
std::string clear_arg = sep->arg[1];
|
||||
if (!clear_arg.compare("clear")) {
|
||||
|
||||
clear = true;
|
||||
ab_arg = 2;
|
||||
name_arg = 3;
|
||||
}
|
||||
|
||||
std::string class_race_arg = sep->arg[ab_arg];
|
||||
bool class_race_check = false;
|
||||
if (!class_race_arg.compare("byclass") || !class_race_arg.compare("byrace")) {
|
||||
class_race_check = true;
|
||||
}
|
||||
|
||||
std::list<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) {
|
||||
return;
|
||||
}
|
||||
|
||||
sbl.remove(nullptr);
|
||||
for (auto bot_iter : sbl) {
|
||||
|
||||
if (clear) {
|
||||
bot_iter->SetHoldFlag(false);
|
||||
}
|
||||
else {
|
||||
bot_iter->SetHoldMode();
|
||||
}
|
||||
}
|
||||
|
||||
if (sbl.size() == 1) {
|
||||
Bot::BotGroupSay(
|
||||
sbl.front(),
|
||||
fmt::format(
|
||||
"{}olding my attacks.",
|
||||
clear ? "No longer h" : "H"
|
||||
).c_str()
|
||||
);
|
||||
} else {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} of your bots are {}holding their attacks.",
|
||||
sbl.size(),
|
||||
clear ? "no longer " : ""
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user