mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-20 13:48:22 +00:00
bot movement cleanup and tweaks, move casterrange to distanceranged
This commit is contained in:
@@ -4,7 +4,7 @@ void bot_command_bot_settings(Client* c, const Seperator* sep)
|
||||
{
|
||||
std::list<const char*> subcommand_list;
|
||||
subcommand_list.push_back("behindmob");
|
||||
subcommand_list.push_back("casterrange");
|
||||
subcommand_list.push_back("distanceranged");
|
||||
subcommand_list.push_back("copysettings");
|
||||
subcommand_list.push_back("defaultsettings");
|
||||
subcommand_list.push_back("enforcespelllist");
|
||||
|
||||
@@ -74,7 +74,7 @@ void bot_command_copy_settings(Client* c, const Seperator* sep)
|
||||
"[misc] copies all miscellaneous options such as:",
|
||||
"- ^showhelm, ^followd, ^stopmeleelevel",
|
||||
"- ^enforcespellsettings, ^bottoggleranged, ^petsettype",
|
||||
"- ^behindmob, ^casterrange, ^illusionblock",
|
||||
"- ^behindmob, ^distanceranged, ^illusionblock",
|
||||
"- ^sitincombat, ^sithppercent and ^sitmanapercent",
|
||||
|
||||
};
|
||||
|
||||
@@ -68,7 +68,7 @@ void bot_command_default_settings(Client* c, const Seperator* sep)
|
||||
"[misc] restores all miscellaneous options such as:",
|
||||
"- ^showhelm, ^followd, ^stopmeleelevel",
|
||||
"- ^enforcespellsettings, ^bottoggleranged, ^petsettype",
|
||||
"- ^behindmob, ^casterrange, ^illusionblock",
|
||||
"- ^behindmob, ^distanceranged, ^illusionblock",
|
||||
"- ^sitincombat, ^sithppercent and ^sitmanapercent",
|
||||
|
||||
};
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
#include "../bot_command.h"
|
||||
|
||||
void bot_command_caster_range(Client* c, const Seperator* sep)
|
||||
void bot_command_distance_ranged(Client* c, const Seperator* sep)
|
||||
{
|
||||
if (helper_command_alias_fail(c, "bot_command_caster_range", sep->arg[0], "casterrange")) {
|
||||
if (helper_command_alias_fail(c, "bot_command_distance_ranged", sep->arg[0], "distanceranged")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (helper_is_help_or_usage(sep->arg[1])) {
|
||||
c->Message(Chat::White, "usage: %s [current | value: 0 - 300] ([actionable: target | byname | ownergroup | ownerraid | targetgroup | namesgroup | healrotationtargets | mmr | byclass | byrace | spawned] ([actionable_name]))", sep->arg[0]);
|
||||
c->Message(Chat::White, "note: Can only be used for Casters or Hybrids.");
|
||||
c->Message(Chat::White, "note: Use [current] to check the current setting.");
|
||||
c->Message(Chat::White, "note: Set the value to the minimum distance you want your bot to try to remain from its target.");
|
||||
c->Message(Chat::White, "note: If they are too far for a spell, it will be skipped.");
|
||||
@@ -21,13 +20,13 @@ void bot_command_caster_range(Client* c, const Seperator* sep)
|
||||
std::string arg1 = sep->arg[1];
|
||||
int ab_arg = 1;
|
||||
bool current_check = false;
|
||||
uint32 crange = 0;
|
||||
uint32 value = 0;
|
||||
|
||||
if (sep->IsNumber(1)) {
|
||||
++ab_arg;
|
||||
crange = atoi(sep->arg[1]);
|
||||
if (crange < 0 || crange > 300) {
|
||||
c->Message(Chat::White, "You must enter a value within the range of 0 - 300.");
|
||||
value = atoi(sep->arg[1]);
|
||||
if (value < 0 || value > RuleI(Bots, MaxDistanceRanged)) {
|
||||
c->Message(Chat::Yellow, "You must enter a value within the range of 0 - 300.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -36,7 +35,7 @@ void bot_command_caster_range(Client* c, const Seperator* sep)
|
||||
current_check = true;
|
||||
}
|
||||
else {
|
||||
c->Message(Chat::White, "Incorrect argument, use %s help for a list of options.", sep->arg[0]);
|
||||
c->Message(Chat::Yellow, "Incorrect argument, use %s help for a list of options.", sep->arg[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -58,47 +57,43 @@ void bot_command_caster_range(Client* c, const Seperator* sep)
|
||||
int success_count = 0;
|
||||
|
||||
for (auto my_bot : sbl) {
|
||||
if (!IsCasterClass(my_bot->GetClass()) && !IsHybridClass(my_bot->GetClass())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!first_found) {
|
||||
first_found = my_bot;
|
||||
}
|
||||
|
||||
if (current_check) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
Chat::Green,
|
||||
fmt::format(
|
||||
"{} says, 'My current caster range is {}.'",
|
||||
"{} says, 'My current Distance Ranged is {}.'",
|
||||
my_bot->GetCleanName(),
|
||||
my_bot->GetBotCasterRange()
|
||||
my_bot->GetBotDistanceRanged()
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
else {
|
||||
my_bot->SetBotCasterRange(crange);
|
||||
my_bot->SetBotDistanceRanged(value);
|
||||
++success_count;
|
||||
}
|
||||
}
|
||||
if (!current_check) {
|
||||
if (success_count == 1 && first_found) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
Chat::Green,
|
||||
fmt::format(
|
||||
"{} says, 'My Caster Range was set to {}.'",
|
||||
"{} says, 'My Distance Ranged was set to {}.'",
|
||||
first_found->GetCleanName(),
|
||||
crange
|
||||
value
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
else {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
Chat::Green,
|
||||
fmt::format(
|
||||
"{} of your bots set their Caster Range to {}.",
|
||||
"{} of your bots set their Distance Ranged to {}.",
|
||||
success_count,
|
||||
crange
|
||||
value
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user