Bot Rework

This commit is contained in:
nytmyr
2024-04-26 22:38:56 -05:00
parent 77793f364e
commit 6574f780db
94 changed files with 15920 additions and 3952 deletions
+73 -33
View File
@@ -1,11 +1,11 @@
#include "../bot_command.h"
void bot_command_follow(Client *c, const Seperator *sep)
void bot_command_follow(Client* c, const Seperator* sep)
{
if (helper_command_alias_fail(c, "bot_command_follow", sep->arg[0], "follow"))
return;
if (helper_is_help_or_usage(sep->arg[1])) {
c->Message(Chat::White, "usage: (<friendly_target>) %s ([option: reset]) [actionable: byname | ownergroup | ownerraid | namesgroup | healrotation | byclass | byrace | spawned]] ([actionable_name])", sep->arg[0]);
c->Message(Chat::White, "usage: (<friendly_target>) %s ([option: reset]) [actionable: byname | ownergroup | ownerraid | namesgroup | mmr | byclass | byrace | spawned]] ([actionable_name])", sep->arg[0]);
c->Message(Chat::White, "usage: %s chain", sep->arg[0]);
return;
}
@@ -26,13 +26,22 @@ void bot_command_follow(Client *c, const Seperator *sep)
}
else if (!optional_arg.compare("reset")) {
reset = true;
ab_arg = 2;
name_arg = 3;
++ab_arg;
++name_arg ;
}
else {
target_mob = ActionableTarget::VerifyFriendly(c, BCEnum::TT_Single);
//target_mob = ActionableTarget::VerifyFriendly(c, BCEnum::TT_Single);
target_mob = c->GetTarget();
if (!target_mob) {
c->Message(Chat::White, "You must <target> a friendly mob to use this command");
c->Message(Chat::White, "You must <target> a friendly player or bot within your group or raid to use this command");
return;
}
else if (!target_mob->IsBot() && !target_mob->IsClient()) {
c->Message(Chat::White, "You must <target> a friendly player or bot within your group or raid to use this command");
return;
}
else if ((target_mob->GetGroup() && target_mob->GetGroup() != c->GetGroup()) || (target_mob->GetRaid() && target_mob->GetRaid() != c->GetRaid())) {
c->Message(Chat::White, "You must <target> a friendly player or bot within your group or raid to use this command");
return;
}
}
@@ -51,29 +60,54 @@ void bot_command_follow(Client *c, const Seperator *sep)
sbl.remove(nullptr);
for (auto bot_iter : sbl) {
bot_iter->WipeHateList();
auto my_group = bot_iter->GetGroup();
if (my_group) {
if (reset) {
if (!my_group->GetLeader() || my_group->GetLeader() == bot_iter)
bot_iter->SetFollowID(c->GetID());
else
bot_iter->SetFollowID(my_group->GetLeader()->GetID());
bot_iter->SetManualFollow(false);
}
else {
if (bot_iter == target_mob)
bot_iter->SetFollowID(c->GetID());
else
bot_iter->SetFollowID(target_mob->GetID());
bot_iter->SetManualFollow(true);
}
}
else {
if (!bot_iter->GetGroup() && !bot_iter->GetRaid()) {
bot_iter->SetFollowID(0);
bot_iter->SetManualFollow(false);
}
else {
if (reset) {
bot_iter->SetFollowID(c->GetID());
bot_iter->SetManualFollow(false);
}
else {
if (target_mob->IsGrouped() || target_mob->IsRaidGrouped()) {
bot_iter->SetFollowID(target_mob->GetID());
bot_iter->SetManualFollow(true);
}
else if (bot_iter == target_mob) {
bot_iter->SetFollowID(c->GetID());
bot_iter->SetManualFollow(true);
}
else {
bot_iter->SetFollowID(0);
bot_iter->SetManualFollow(false);
}
}
}
//auto my_group = bot_iter->GetGroup();
//if (my_group) {
// if (reset) {
// if (!my_group->GetLeader() || my_group->GetLeader() == bot_iter)
// bot_iter->SetFollowID(c->GetID());
// else
// bot_iter->SetFollowID(my_group->GetLeader()->GetID());
//
// bot_iter->SetManualFollow(false);
// }
// else {
// if (bot_iter == target_mob)
// bot_iter->SetFollowID(c->GetID());
// else
// bot_iter->SetFollowID(target_mob->GetID());
//
// bot_iter->SetManualFollow(true);
// }
//}
//else {
// bot_iter->SetFollowID(0);
// bot_iter->SetManualFollow(false);
//}
if (!bot_iter->GetPet())
continue;
@@ -81,31 +115,37 @@ void bot_command_follow(Client *c, const Seperator *sep)
bot_iter->GetPet()->SetFollowID(bot_iter->GetID());
}
Mob* follow_mob = nullptr;
if (sbl.size() == 1) {
Mob* follow_mob = entity_list.GetMob(sbl.front()->GetFollowID());
Bot::BotGroupSay(
sbl.front(),
follow_mob = entity_list.GetMob(sbl.front()->GetFollowID());
c->Message(
Chat::White,
fmt::format(
"Following {}.",
follow_mob ? follow_mob->GetCleanName() : "no one"
follow_mob ? follow_mob->GetCleanName() : "you"
).c_str()
);
} else {
}
else {
if (reset) {
c->Message(
Chat::White,
fmt::format(
"{} of your bots are following their default assignments.",
"{} of your bots are following you.",
sbl.size()
).c_str()
);
} else {
}
else {
if (!sbl.empty()) {
follow_mob = entity_list.GetMob(sbl.front()->GetFollowID());
}
c->Message(
Chat::White,
fmt::format(
"{} of your bots are following {}.",
sbl.size(),
target_mob->GetCleanName()
follow_mob ? follow_mob->GetCleanName() : "you"
).c_str()
);
}