mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-20 17:58:20 +00:00
More fixes
TGB, ^cast, group/ae checks, in group/raid checks, inviting others bots to group, group disband fix, prevent rogue bs spam, ^follow fixes and cleanup, follow owner only by default when joining raid/group, group buff fixes for bots, range fixes for group buffs
This commit is contained in:
@@ -30,12 +30,19 @@ void bot_command_bot(Client *c, const Seperator *sep)
|
||||
|
||||
void bot_command_camp(Client *c, const Seperator *sep)
|
||||
{
|
||||
if (helper_command_alias_fail(c, "bot_command_camp", sep->arg[0], "botcamp"))
|
||||
if (helper_command_alias_fail(c, "bot_command_camp", sep->arg[0], "botcamp")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (helper_is_help_or_usage(sep->arg[1])) {
|
||||
c->Message(Chat::White, "usage: %s ([actionable: target | byname | ownergroup | ownerraid | targetgroup | namesgroup | healrotationtargets | mmr | byclass | byrace | spawned] ([actionable_name]))", sep->arg[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Bot::CheckCampSpawnConditions(c)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const int ab_mask = ActionableBots::ABM_Type1;
|
||||
|
||||
std::string class_race_arg = sep->arg[1];
|
||||
@@ -49,8 +56,14 @@ void bot_command_camp(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto bot_iter : sbl)
|
||||
uint16 campCount;
|
||||
|
||||
for (auto bot_iter : sbl) {
|
||||
bot_iter->Camp();
|
||||
++campCount;
|
||||
}
|
||||
|
||||
c->Message(Chat::White, "%i of your bots have been camped.", campCount);
|
||||
}
|
||||
|
||||
void bot_command_clone(Client *c, const Seperator *sep)
|
||||
@@ -428,6 +441,10 @@ void bot_command_delete(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Bot::CheckCampSpawnConditions(c)) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto my_bot = ActionableBots::AsTarget_ByBot(c);
|
||||
if (!my_bot) {
|
||||
c->Message(Chat::White, "You must <target> a bot that you own to use this command");
|
||||
@@ -829,7 +846,7 @@ void bot_command_spawn(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Bot::CheckSpawnConditions(c)) {
|
||||
if (!Bot::CheckCampSpawnConditions(c)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ void bot_command_cast(Client* c, const Seperator* sep)
|
||||
if (!tar->IsOfClientBot() && !(tar->IsPet() && tar->GetOwner() && tar->GetOwner()->IsOfClientBot())) {
|
||||
c->Message(Chat::Yellow, "[%s] is an invalid target.", tar->GetCleanName());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
LogTestDebug("{}: Attempting {} on {}", __LINE__, c->GetSpellTypeNameByID(spellType), (tar ? tar->GetCleanName() : "NOBODY")); //deleteme
|
||||
@@ -223,7 +223,7 @@ void bot_command_cast(Client* c, const Seperator* sep)
|
||||
Bot* firstFound = nullptr;
|
||||
|
||||
for (auto bot_iter : sbl) {
|
||||
if (!bot_iter->IsInGroupOrRaid()) {
|
||||
if (!bot_iter->IsInGroupOrRaid(c)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -248,6 +248,14 @@ void bot_command_cast(Client* c, const Seperator* sep)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (
|
||||
BOT_SPELL_TYPES_BENEFICIAL(spellType) &&
|
||||
!RuleB(Bots, CrossRaidBuffingAndHealing) &&
|
||||
!bot_iter->IsInGroupOrRaid(newTar, true)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (BOT_SPELL_TYPES_DETRIMENTAL(spellType, bot_iter->GetClass()) && !bot_iter->IsAttackAllowed(newTar)) {
|
||||
bot_iter->BotGroupSay(
|
||||
bot_iter,
|
||||
|
||||
+183
-71
@@ -2,47 +2,112 @@
|
||||
|
||||
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 | mmr | byclass | byrace | spawned]] ([actionable_name])", sep->arg[0]);
|
||||
c->Message(Chat::White, "usage: %s chain", sep->arg[0]);
|
||||
if (helper_command_alias_fail(c, "bot_command_follow", sep->arg[0], "follow")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (helper_is_help_or_usage(sep->arg[1])) {
|
||||
std::vector<std::string> description =
|
||||
{
|
||||
"Sets bots of your choosing to follow your target, view their current following state or reset their following state."
|
||||
};
|
||||
|
||||
std::vector<std::string> notes =
|
||||
{
|
||||
"- You can only follow players, bots or mercenaries belonging to your group or raid."
|
||||
};
|
||||
|
||||
std::vector<std::string> example_format =
|
||||
{
|
||||
fmt::format(
|
||||
"{} [optional] [actionable]"
|
||||
, sep->arg[0]
|
||||
)
|
||||
};
|
||||
std::vector<std::string> examples_one =
|
||||
{
|
||||
"To set all Clerics to follow your target:",
|
||||
fmt::format(
|
||||
"{} byclass {}",
|
||||
sep->arg[0],
|
||||
Class::Cleric
|
||||
)
|
||||
};
|
||||
std::vector<std::string> examples_two =
|
||||
{
|
||||
"To check the current state of all bots:",
|
||||
fmt::format(
|
||||
"{} current spawned",
|
||||
sep->arg[0]
|
||||
)
|
||||
};
|
||||
std::vector<std::string> examples_three =
|
||||
{
|
||||
"To reset all bots:",
|
||||
fmt::format(
|
||||
"{} reset spawned",
|
||||
sep->arg[0]
|
||||
)
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
bool chain = false;
|
||||
bool reset = false;
|
||||
bool currentCheck = false;
|
||||
int ab_arg = 1;
|
||||
int name_arg = 2;
|
||||
Mob* target_mob = nullptr;
|
||||
|
||||
std::string optional_arg = sep->arg[1];
|
||||
if (!optional_arg.compare("chain")) {
|
||||
|
||||
auto chain_count = helper_bot_follow_option_chain(c);
|
||||
c->Message(Chat::White, "%i of your bots %s now chain following you", chain_count, (chain_count == 1 ? "is" : "are"));
|
||||
|
||||
return;
|
||||
}
|
||||
else if (!optional_arg.compare("reset")) {
|
||||
|
||||
if (!optional_arg.compare("reset")) {
|
||||
target_mob = c;
|
||||
reset = true;
|
||||
++ab_arg;
|
||||
++name_arg ;
|
||||
}
|
||||
else if (!optional_arg.compare("current")) {
|
||||
currentCheck = true;
|
||||
++ab_arg;
|
||||
}
|
||||
else {
|
||||
//target_mob = ActionableTarget::VerifyFriendly(c, BCEnum::TT_Single);
|
||||
target_mob = c->GetTarget();
|
||||
if (!target_mob) {
|
||||
c->Message(Chat::White, "You must <target> a friendly player or bot within your group or raid to use this command");
|
||||
|
||||
if (!target_mob || !target_mob->IsOfClientBotMerc() || !c->IsInGroupOrRaid(target_mob)) {
|
||||
c->Message(Chat::Yellow, "You must <target> a friendly player, bot or merc 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;
|
||||
|
||||
if (!optional_arg.compare("chain")) {
|
||||
chain = true;
|
||||
++ab_arg;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,12 +118,66 @@ void bot_command_follow(Client* c, const Seperator* sep)
|
||||
}
|
||||
|
||||
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) {
|
||||
//if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg] : nullptr, class_race_check ? atoi(sep->arg[ab_arg]) : 0) == 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;
|
||||
}
|
||||
|
||||
sbl.remove(nullptr);
|
||||
|
||||
auto botCount = sbl.size();
|
||||
Mob* follow_mob = nullptr;
|
||||
std::list<Bot*> chainList;
|
||||
std::list<Bot*>::const_iterator it = chainList.begin();
|
||||
uint16 count = 0;
|
||||
for (auto bot_iter : sbl) {
|
||||
if (currentCheck) {
|
||||
follow_mob = entity_list.GetMob(bot_iter->GetFollowID());
|
||||
c->Message(
|
||||
Chat::Green,
|
||||
fmt::format(
|
||||
"{} says, 'I am currently following {}.'",
|
||||
bot_iter->GetCleanName(),
|
||||
follow_mob ? follow_mob->GetCleanName() : "no one"
|
||||
).c_str()
|
||||
);
|
||||
|
||||
if (!follow_mob && RuleB(Bots, DoResponseAnimations)) {
|
||||
bot_iter->DoAnim(28);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bot_iter == target_mob) {
|
||||
if (botCount == 1) {
|
||||
c->Message(
|
||||
Chat::Yellow,
|
||||
fmt::format(
|
||||
"{} says, 'I cannot follow myself, you want me to run circles?",
|
||||
bot_iter->GetCleanName()
|
||||
).c_str()
|
||||
);
|
||||
|
||||
if (RuleB(Bots, DoResponseAnimations)) {
|
||||
bot_iter->DoAnim(60);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bot_iter->WipeHateList();
|
||||
--botCount;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!bot_iter->IsInGroupOrRaid(target_mob)) {
|
||||
--botCount;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
bot_iter->WipeHateList();
|
||||
|
||||
if (!bot_iter->GetGroup() && !bot_iter->GetRaid()) {
|
||||
@@ -71,57 +190,52 @@ void bot_command_follow(Client* c, const Seperator* sep)
|
||||
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);
|
||||
if (chain) {
|
||||
Mob* nextTar = target_mob;
|
||||
|
||||
if (count > 0) {
|
||||
nextTar = *it;
|
||||
|
||||
if (!nextTar) {
|
||||
nextTar = target_mob;
|
||||
}
|
||||
}
|
||||
LogTestDebug("{} is now following {}.", bot_iter->GetCleanName(), nextTar->GetCleanName()); //deleteme
|
||||
chainList.push_back(bot_iter);
|
||||
++it;
|
||||
++count;
|
||||
bot_iter->SetFollowID(nextTar->GetID());
|
||||
}
|
||||
else {
|
||||
bot_iter->SetFollowID(0);
|
||||
bot_iter->SetManualFollow(false);
|
||||
bot_iter->SetFollowID(target_mob->GetID());
|
||||
}
|
||||
|
||||
bot_iter->SetManualFollow(true);
|
||||
}
|
||||
}
|
||||
//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())
|
||||
|
||||
if (!bot_iter->GetPet()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
bot_iter->GetPet()->WipeHateList();
|
||||
bot_iter->GetPet()->SetFollowID(bot_iter->GetID());
|
||||
}
|
||||
|
||||
Mob* follow_mob = nullptr;
|
||||
if (sbl.size() == 1) {
|
||||
if (currentCheck || !botCount) {
|
||||
return;
|
||||
}
|
||||
|
||||
follow_mob = target_mob;
|
||||
|
||||
if (botCount == 1) {
|
||||
follow_mob = entity_list.GetMob(sbl.front()->GetFollowID());
|
||||
|
||||
c->Message(
|
||||
Chat::White,
|
||||
Chat::Green,
|
||||
fmt::format(
|
||||
"Following {}.",
|
||||
"{} says, 'Following {}.'",
|
||||
sbl.front()->GetCleanName(),
|
||||
follow_mob ? follow_mob->GetCleanName() : "you"
|
||||
).c_str()
|
||||
);
|
||||
@@ -129,22 +243,20 @@ void bot_command_follow(Client* c, const Seperator* sep)
|
||||
else {
|
||||
if (reset) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
Chat::Green,
|
||||
fmt::format(
|
||||
"{} of your bots are following you.",
|
||||
sbl.size()
|
||||
botCount
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
else {
|
||||
if (!sbl.empty()) {
|
||||
follow_mob = entity_list.GetMob(sbl.front()->GetFollowID());
|
||||
}
|
||||
c->Message(
|
||||
Chat::White,
|
||||
Chat::Green,
|
||||
fmt::format(
|
||||
"{} of your bots are following {}.",
|
||||
sbl.size(),
|
||||
"{} of your bots are {} {}.",
|
||||
botCount,
|
||||
chain ? "chain following" : "following",
|
||||
follow_mob ? follow_mob->GetCleanName() : "you"
|
||||
).c_str()
|
||||
);
|
||||
|
||||
@@ -179,7 +179,9 @@ void bot_command_item_use(Client* c, const Seperator* sep)
|
||||
).c_str()
|
||||
);
|
||||
|
||||
bot_iter->DoAnim(29);
|
||||
if (RuleB(Bots, DoResponseAnimations)) {
|
||||
bot_iter->DoAnim(29);
|
||||
}
|
||||
}
|
||||
else if (!equipped_item) {
|
||||
c->Message(
|
||||
@@ -204,7 +206,9 @@ void bot_command_item_use(Client* c, const Seperator* sep)
|
||||
).c_str()
|
||||
);
|
||||
|
||||
bot_iter->DoAnim(29);
|
||||
if (RuleB(Bots, DoResponseAnimations)) {
|
||||
bot_iter->DoAnim(29);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ void bot_command_mesmerize(Client *c, const Seperator *sep)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!bot_iter->IsInGroupOrRaid()) {
|
||||
if (!bot_iter->IsInGroupOrRaid(c)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user