mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 09:06:46 +00:00
Rewrite ^followd command and remove squared values from command
This commit is contained in:
@@ -189,7 +189,7 @@ WHERE rv.rule_name LIKE 'Bots:BotExpansionSettings'
|
|||||||
AND bd.expansion_bitmask != rv.rule_value;
|
AND bd.expansion_bitmask != rv.rule_value;
|
||||||
|
|
||||||
INSERT INTO bot_settings SELECT NULL, 0, `bot_id`, 1, 0, `show_helm`, 'BaseSetting', 'ShowHelm' FROM bot_data WHERE `show_helm` != 1;
|
INSERT INTO bot_settings SELECT NULL, 0, `bot_id`, 1, 0, `show_helm`, 'BaseSetting', 'ShowHelm' FROM bot_data WHERE `show_helm` != 1;
|
||||||
INSERT INTO bot_settings SELECT NULL, 0, `bot_id`, 2, 0, `follow_distance`, 'BaseSetting', 'FollowDistance' FROM bot_data WHERE `follow_distance` != 184;
|
INSERT INTO bot_settings SELECT NULL, 0, `bot_id`, 2, 0, sqrt(`follow_distance`), 'BaseSetting', 'FollowDistance' FROM bot_data WHERE `follow_distance` != 184;
|
||||||
|
|
||||||
INSERT INTO bot_settings
|
INSERT INTO bot_settings
|
||||||
SELECT NULL, 0, `bot_id`, 3, 0, `stop_melee_level`, 'BaseSetting', 'StopMeleeLevel'
|
SELECT NULL, 0, `bot_id`, 3, 0, `stop_melee_level`, 'BaseSetting', 'StopMeleeLevel'
|
||||||
@@ -238,6 +238,7 @@ ALTER TABLE `bot_data`
|
|||||||
|
|
||||||
UPDATE `bot_command_settings` SET `aliases`= 'bh' WHERE `bot_command`='behindmob';
|
UPDATE `bot_command_settings` SET `aliases`= 'bh' WHERE `bot_command`='behindmob';
|
||||||
UPDATE `bot_command_settings` SET `aliases`= 'bs|settings' WHERE `bot_command`='botsettings';
|
UPDATE `bot_command_settings` SET `aliases`= 'bs|settings' WHERE `bot_command`='botsettings';
|
||||||
|
UPDATE `bot_command_settings` SET `aliases`= CASE WHEN LENGTH(`aliases`) > 0 THEN CONCAT(`aliases`, '|followdistance') ELSE 'followd||followdistance' END WHERE `bot_command`='botfollowdistance' AND `aliases` NOT LIKE '%followdistance%';
|
||||||
UPDATE `bot_command_settings` SET `aliases`= CASE WHEN LENGTH(`aliases`) > 0 THEN CONCAT(`aliases`, '|ranged|toggleranged|btr') ELSE 'ranged|toggleranged|btr' END WHERE `bot_command`='bottoggleranged' AND `aliases` NOT LIKE '%ranged|toggleranged|btr%';
|
UPDATE `bot_command_settings` SET `aliases`= CASE WHEN LENGTH(`aliases`) > 0 THEN CONCAT(`aliases`, '|ranged|toggleranged|btr') ELSE 'ranged|toggleranged|btr' END WHERE `bot_command`='bottoggleranged' AND `aliases` NOT LIKE '%ranged|toggleranged|btr%';
|
||||||
UPDATE `bot_command_settings` SET `aliases`= CASE WHEN LENGTH(`aliases`) > 0 THEN CONCAT(`aliases`, '|cr') ELSE 'cr' END WHERE `bot_command`='casterrange' AND `aliases` NOT LIKE '%cr%';
|
UPDATE `bot_command_settings` SET `aliases`= CASE WHEN LENGTH(`aliases`) > 0 THEN CONCAT(`aliases`, '|cr') ELSE 'cr' END WHERE `bot_command`='casterrange' AND `aliases` NOT LIKE '%cr%';
|
||||||
UPDATE `bot_command_settings` SET `aliases`= 'copy' WHERE `bot_command`='copysettings';
|
UPDATE `bot_command_settings` SET `aliases`= 'copy' WHERE `bot_command`='copysettings';
|
||||||
|
|||||||
@@ -867,6 +867,8 @@ RULE_INT(Bots, StatusCreateLimit, 120, "Minimum status to bypass spawn limit. De
|
|||||||
RULE_BOOL(Bots, BardsAnnounceCasts, false, "This determines whether or not Bard bots will announce that they're casting songs (Buffs, Heals, Nukes, Slows, etc.) they will always announce Mez.")
|
RULE_BOOL(Bots, BardsAnnounceCasts, false, "This determines whether or not Bard bots will announce that they're casting songs (Buffs, Heals, Nukes, Slows, etc.) they will always announce Mez.")
|
||||||
RULE_BOOL(Bots, EnableBotTGB, true, "If enabled bots will cast group buffs as TGB.")
|
RULE_BOOL(Bots, EnableBotTGB, true, "If enabled bots will cast group buffs as TGB.")
|
||||||
RULE_BOOL(Bots, DoResponseAnimations, true, "If enabled bots will do animations to certain responses or commands.")
|
RULE_BOOL(Bots, DoResponseAnimations, true, "If enabled bots will do animations to certain responses or commands.")
|
||||||
|
RULE_INT(Bots, DefaultFollowDistance, 20, "Default 20. Distance a bot will follow behind.")
|
||||||
|
RULE_INT(Bots, MaxFollowDistance, 300, "Default 300. Max distance a bot can be set to follow behind.")
|
||||||
RULE_CATEGORY_END()
|
RULE_CATEGORY_END()
|
||||||
|
|
||||||
RULE_CATEGORY(Chat)
|
RULE_CATEGORY(Chat)
|
||||||
|
|||||||
+4
-4
@@ -9904,7 +9904,7 @@ void Bot::SetBotBaseSetting(uint16 botSetting, int settingValue) {
|
|||||||
SetShowHelm(settingValue);
|
SetShowHelm(settingValue);
|
||||||
break;
|
break;
|
||||||
case BotBaseSettings::FollowDistance:
|
case BotBaseSettings::FollowDistance:
|
||||||
SetFollowDistance(EQ::Clamp(static_cast<uint32>(settingValue), static_cast<uint32>(1), BOT_FOLLOW_DISTANCE_DEFAULT_MAX));
|
SetFollowDistance(EQ::Clamp(static_cast<uint32>(settingValue * settingValue), static_cast<uint32>(1), static_cast<uint32>((RuleI(Bots, MaxFollowDistance) * RuleI(Bots, MaxFollowDistance)))));
|
||||||
break;
|
break;
|
||||||
case BotBaseSettings::StopMeleeLevel:
|
case BotBaseSettings::StopMeleeLevel:
|
||||||
SetStopMeleeLevel(settingValue);
|
SetStopMeleeLevel(settingValue);
|
||||||
@@ -9953,8 +9953,8 @@ int Bot::GetBotBaseSetting(uint16 botSetting) {
|
|||||||
//LogBotSettingsDetail("Returning current GetShowHelm of [{}] for [{}]", GetShowHelm(), GetCleanName()); //deleteme
|
//LogBotSettingsDetail("Returning current GetShowHelm of [{}] for [{}]", GetShowHelm(), GetCleanName()); //deleteme
|
||||||
return GetShowHelm();
|
return GetShowHelm();
|
||||||
case BotBaseSettings::FollowDistance:
|
case BotBaseSettings::FollowDistance:
|
||||||
//LogBotSettingsDetail("Returning current GetFollowDistance of [{}] for [{}]", GetFollowDistance(), GetCleanName()); //deleteme
|
//LogBotSettingsDetail("Returning current GetFollowDistance of [{}] for [{}]", sqrt(GetFollowDistance()), GetCleanName()); //deleteme
|
||||||
return GetFollowDistance();
|
return sqrt(GetFollowDistance());
|
||||||
case BotBaseSettings::StopMeleeLevel:
|
case BotBaseSettings::StopMeleeLevel:
|
||||||
//LogBotSettingsDetail("Returning current GetStopMeleeLevel of [{}] for [{}]", GetStopMeleeLevel(), GetCleanName()); //deleteme
|
//LogBotSettingsDetail("Returning current GetStopMeleeLevel of [{}] for [{}]", GetStopMeleeLevel(), GetCleanName()); //deleteme
|
||||||
return GetStopMeleeLevel();
|
return GetStopMeleeLevel();
|
||||||
@@ -10002,7 +10002,7 @@ int Bot::GetDefaultBotBaseSetting(uint16 botSetting) {
|
|||||||
case BotBaseSettings::ShowHelm:
|
case BotBaseSettings::ShowHelm:
|
||||||
return true;
|
return true;
|
||||||
case BotBaseSettings::FollowDistance:
|
case BotBaseSettings::FollowDistance:
|
||||||
return BOT_FOLLOW_DISTANCE_DEFAULT;
|
return (RuleI(Bots, DefaultFollowDistance) * RuleI(Bots, DefaultFollowDistance));
|
||||||
case BotBaseSettings::StopMeleeLevel:
|
case BotBaseSettings::StopMeleeLevel:
|
||||||
if (IsCasterClass(GetClass())) {
|
if (IsCasterClass(GetClass())) {
|
||||||
return RuleI(Bots, CasterStopMeleeLevel);
|
return RuleI(Bots, CasterStopMeleeLevel);
|
||||||
|
|||||||
@@ -37,9 +37,6 @@
|
|||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
constexpr uint32 BOT_FOLLOW_DISTANCE_DEFAULT = 184; // as DSq value (~13.565 units)
|
|
||||||
constexpr uint32 BOT_FOLLOW_DISTANCE_DEFAULT_MAX = 2500; // as DSq value (50 units)
|
|
||||||
|
|
||||||
constexpr uint32 BOT_KEEP_ALIVE_INTERVAL = 5000; // 5 seconds
|
constexpr uint32 BOT_KEEP_ALIVE_INTERVAL = 5000; // 5 seconds
|
||||||
|
|
||||||
constexpr uint32 BOT_COMBAT_JITTER_INTERVAL_MIN = 1500; // 1.5 seconds
|
constexpr uint32 BOT_COMBAT_JITTER_INTERVAL_MIN = 1500; // 1.5 seconds
|
||||||
|
|||||||
+177
-30
@@ -466,58 +466,205 @@ void bot_command_delete(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
void bot_command_follow_distance(Client *c, const Seperator *sep)
|
void bot_command_follow_distance(Client *c, const Seperator *sep)
|
||||||
{
|
{
|
||||||
if (helper_command_alias_fail(c, "bot_command_follow_distance", sep->arg[0], "botfollowdistance"))
|
if (helper_command_alias_fail(c, "bot_command_follow_distance", sep->arg[0], "botfollowdistance")) {
|
||||||
return;
|
|
||||||
if (helper_is_help_or_usage(sep->arg[1])) {
|
|
||||||
c->Message(Chat::White, "usage: %s [set [1 to %i]] [distance] ([actionable: target | byname | ownergroup | ownerraid | targetgroup | namesgroup | healrotationmembers | healrotationtargets | mmr | byclass | byrace | spawned] ([actionable_name]))", sep->arg[0], BOT_FOLLOW_DISTANCE_DEFAULT_MAX);
|
|
||||||
c->Message(Chat::White, "usage: %s [clear] ([actionable: target | byname | ownergroup | ownerraid | targetgroup | namesgroup | healrotationmembers | healrotationtargets | mmr | byclass | byrace | spawned] ([actionable_name]))", sep->arg[0]);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const int ab_mask = ActionableBots::ABM_NoFilter;
|
|
||||||
|
|
||||||
uint32 bfd = BOT_FOLLOW_DISTANCE_DEFAULT;
|
if (helper_is_help_or_usage(sep->arg[1])) {
|
||||||
|
std::vector<std::string> description =
|
||||||
|
{
|
||||||
|
"Sets or resets the follow distance of the selected bots."
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<std::string> notes =
|
||||||
|
{
|
||||||
|
fmt::format(
|
||||||
|
"[Default]: {}",
|
||||||
|
RuleI(Bots, MaxFollowDistance)
|
||||||
|
),
|
||||||
|
|
||||||
|
fmt::format(
|
||||||
|
"- You must use a value between 1 and {}.",
|
||||||
|
RuleI(Bots, MaxFollowDistance)
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<std::string> example_format =
|
||||||
|
{
|
||||||
|
fmt::format(
|
||||||
|
"{} [reset]/[set [value]] [actionable]"
|
||||||
|
, sep->arg[0]
|
||||||
|
)
|
||||||
|
};
|
||||||
|
std::vector<std::string> examples_one =
|
||||||
|
{
|
||||||
|
"To set all bots to follow at a distance of 25:",
|
||||||
|
fmt::format(
|
||||||
|
"{} set 25 spawned",
|
||||||
|
sep->arg[0]
|
||||||
|
)
|
||||||
|
};
|
||||||
|
std::vector<std::string> examples_two =
|
||||||
|
{
|
||||||
|
"To check the curret following distance of all bots:",
|
||||||
|
fmt::format(
|
||||||
|
"{} current spawned",
|
||||||
|
sep->arg[0]
|
||||||
|
)
|
||||||
|
};
|
||||||
|
std::vector<std::string> examples_three =
|
||||||
|
{
|
||||||
|
"To reset the following distance of all Wizards:",
|
||||||
|
fmt::format(
|
||||||
|
"{} reset byclass {}",
|
||||||
|
sep->arg[0],
|
||||||
|
Class::Wizard
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<std::string> actionables =
|
||||||
|
{
|
||||||
|
"target, byname, ownergroup, ownerraid, targetgroup, namesgroup, healrotationtargets, mmr, byclass, byrace, spawned"
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<std::string> options = { };
|
||||||
|
std::vector<std::string> options_one = { };
|
||||||
|
std::vector<std::string> options_two = { };
|
||||||
|
std::vector<std::string> options_three = { };
|
||||||
|
|
||||||
|
std::string popup_text = c->SendCommandHelpWindow(
|
||||||
|
c,
|
||||||
|
description,
|
||||||
|
notes,
|
||||||
|
example_format,
|
||||||
|
examples_one, examples_two, examples_three,
|
||||||
|
actionables,
|
||||||
|
options,
|
||||||
|
options_one, options_two, options_three
|
||||||
|
);
|
||||||
|
|
||||||
|
popup_text = DialogueWindow::Table(popup_text);
|
||||||
|
|
||||||
|
c->SendPopupToClient(sep->arg[0], popup_text.c_str());
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int ab_mask = ActionableBots::ABM_Type2;
|
||||||
|
|
||||||
|
uint32 bfd = RuleI(Bots, DefaultFollowDistance);
|
||||||
bool set_flag = false;
|
bool set_flag = false;
|
||||||
|
bool currentCheck = false;
|
||||||
int ab_arg = 2;
|
int ab_arg = 2;
|
||||||
|
|
||||||
if (!strcasecmp(sep->arg[1], "set")) {
|
std::string arg1 = sep->arg[1];
|
||||||
|
|
||||||
|
if (!arg1.compare("set")) {
|
||||||
if (!sep->IsNumber(2)) {
|
if (!sep->IsNumber(2)) {
|
||||||
c->Message(Chat::White, "A numeric [distance] is required to use this command. [1 to %i]", BOT_FOLLOW_DISTANCE_DEFAULT_MAX);
|
c->Message(Chat::Yellow, "You must enter a value between 1 and %i.", RuleI(Bots, MaxFollowDistance));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bfd = Strings::ToInt(sep->arg[2]);
|
bfd = Strings::ToInt(sep->arg[2]);
|
||||||
if (bfd < 1)
|
|
||||||
bfd = 1;
|
if (bfd < 1) {
|
||||||
if (bfd > BOT_FOLLOW_DISTANCE_DEFAULT_MAX)
|
c->Message(Chat::Yellow, "You must enter a value between 1 and %i.", RuleI(Bots, MaxFollowDistance));
|
||||||
bfd = BOT_FOLLOW_DISTANCE_DEFAULT_MAX;
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bfd > RuleI(Bots, MaxFollowDistance)) {
|
||||||
|
c->Message(Chat::Yellow, "You must enter a value between 1 and %i.", RuleI(Bots, MaxFollowDistance));
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
set_flag = true;
|
set_flag = true;
|
||||||
ab_arg = 3;
|
++ab_arg;
|
||||||
}
|
}
|
||||||
else if (strcasecmp(sep->arg[1], "clear")) {
|
else if (!arg1.compare("current")) {
|
||||||
c->Message(Chat::White, "This command requires a [set | clear] argument");
|
currentCheck = true;
|
||||||
|
}
|
||||||
|
else if (arg1.compare("reset")) {
|
||||||
|
c->Message(
|
||||||
|
Chat::Yellow,
|
||||||
|
fmt::format(
|
||||||
|
"Incorrect argument, use {} for information regarding this command.",
|
||||||
|
Saylink::Silent(
|
||||||
|
fmt::format("{} help", sep->arg[0])
|
||||||
|
)
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
std::list<Bot*> sbl;
|
||||||
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 (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;
|
||||||
|
|
||||||
int bot_count = 0;
|
|
||||||
for (auto bot_iter : sbl) {
|
|
||||||
if (!bot_iter)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
bot_iter->SetFollowDistance(bfd);
|
|
||||||
|
|
||||||
++bot_count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ab_type == ActionableBots::ABT_All) {
|
sbl.remove(nullptr);
|
||||||
c->Message(Chat::White, "%s all of your bot follow distances to %i", set_flag ? "Set" : "Cleared", bfd);
|
|
||||||
|
int botCount = 0;
|
||||||
|
for (auto bot_iter : sbl) {
|
||||||
|
if (!bot_iter) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentCheck) {
|
||||||
|
Mob* follow_mob = entity_list.GetMob(bot_iter->GetFollowID());
|
||||||
|
|
||||||
|
c->Message(
|
||||||
|
Chat::Green,
|
||||||
|
fmt::format(
|
||||||
|
"{} says, 'I am currently following {} at a distance of {}.'",
|
||||||
|
bot_iter->GetCleanName(),
|
||||||
|
follow_mob ? follow_mob->GetCleanName() : "no one",
|
||||||
|
sqrt(bot_iter->GetFollowDistance())
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bot_iter->SetFollowDistance(bfd * bfd);
|
||||||
|
++botCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentCheck) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (botCount == 1) {
|
||||||
|
Mob* follow_mob = entity_list.GetMob(sbl.front()->GetFollowID());
|
||||||
|
|
||||||
|
c->Message(
|
||||||
|
Chat::Green,
|
||||||
|
fmt::format(
|
||||||
|
"{} says, 'Following {} at a distance of {}.'",
|
||||||
|
sbl.front()->GetCleanName(),
|
||||||
|
follow_mob ? follow_mob->GetCleanName() : "you",
|
||||||
|
bfd
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
c->Message(Chat::White, "%s %i of your spawned bot follow distances to %i", (set_flag ? "Set" : "Cleared"), bot_count, bfd);
|
c->Message(
|
||||||
|
Chat::Green,
|
||||||
|
fmt::format(
|
||||||
|
"{} of your bots are now following at a distance of {}.",
|
||||||
|
botCount,
|
||||||
|
bfd
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user