mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +00:00
[Bots] Fix spell priority commands (#4660)
- Fix priority value check in spellpriority commands - Fix list option - Remove unnecessary temp vector on list grab - Will move getter to cache in future PR
This commit is contained in:
parent
95559b2e17
commit
4658e7f60d
13
zone/bot.cpp
13
zone/bot.cpp
@ -11174,25 +11174,18 @@ void Bot::SetSpellTypePriority(uint16 spell_type, uint8 priority_type, uint16 pr
|
||||
|
||||
std::list<BotSpellTypeOrder> Bot::GetSpellTypesPrioritized(uint8 priority_type) {
|
||||
std::list<BotSpellTypeOrder> cast_order;
|
||||
std::list<BotSpellTypeOrder> temp_cast_order;
|
||||
|
||||
|
||||
for (uint16 i = BotSpellTypes::START; i <= BotSpellTypes::END; i++) {
|
||||
BotSpellTypeOrder typeSettings = {
|
||||
.spellType = i,
|
||||
.priority = GetSpellTypePriority(i, priority_type)
|
||||
};
|
||||
|
||||
cast_order.emplace_back(typeSettings);
|
||||
}
|
||||
|
||||
for (auto& currentType : cast_order) {
|
||||
if (currentType.priority != 0) {
|
||||
temp_cast_order.emplace_back(currentType);
|
||||
if (typeSettings.priority != 0) {
|
||||
cast_order.emplace_back(typeSettings);
|
||||
}
|
||||
}
|
||||
|
||||
cast_order = temp_cast_order;
|
||||
|
||||
if (cast_order.size() > 1) {
|
||||
cast_order.sort(
|
||||
[](BotSpellTypeOrder const& l, BotSpellTypeOrder const& r) {
|
||||
|
||||
@ -23,6 +23,14 @@ void bot_command_spell_engaged_priority(Client* c, const Seperator* sep)
|
||||
fmt::format("{} [Type ID] [value] [actionable]", sep->arg[0])
|
||||
};
|
||||
p.examples_one =
|
||||
{
|
||||
"To list your targeted bot's priorities:",
|
||||
fmt::format(
|
||||
"{} list",
|
||||
sep->arg[0]
|
||||
)
|
||||
};
|
||||
p.examples_two =
|
||||
{
|
||||
"To set all Shaman to cast slows first:",
|
||||
fmt::format(
|
||||
@ -38,20 +46,6 @@ void bot_command_spell_engaged_priority(Client* c, const Seperator* sep)
|
||||
Class::Shaman
|
||||
)
|
||||
};
|
||||
p.examples_two =
|
||||
{
|
||||
"To set all bots to not cast snares:",
|
||||
fmt::format(
|
||||
"{} {} 0 spawned",
|
||||
sep->arg[0],
|
||||
Bot::GetSpellTypeShortNameByID(BotSpellTypes::Snare)
|
||||
),
|
||||
fmt::format(
|
||||
"{} {} 0 spawned",
|
||||
sep->arg[0],
|
||||
BotSpellTypes::Snare
|
||||
)
|
||||
};
|
||||
p.examples_three =
|
||||
{
|
||||
"To check the current engaged priority of dispels on all bots:",
|
||||
@ -94,6 +88,7 @@ void bot_command_spell_engaged_priority(Client* c, const Seperator* sep)
|
||||
bool list_check = false;
|
||||
uint16 spell_type = 0;
|
||||
uint32 type_value = 0;
|
||||
int ab_mask = ActionableBots::ABM_Type1;
|
||||
|
||||
// String/Int type checks
|
||||
if (sep->IsNumber(1)) {
|
||||
@ -106,12 +101,22 @@ void bot_command_spell_engaged_priority(Client* c, const Seperator* sep)
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (Bot::GetSpellTypeIDByShortName(arg1) != UINT16_MAX) {
|
||||
spell_type = Bot::GetSpellTypeIDByShortName(arg1);
|
||||
}
|
||||
else if (!arg1.compare("list")) {
|
||||
if (!arg1.compare("list")) {
|
||||
++ab_arg;
|
||||
list_check = true;
|
||||
ab_mask = ActionableBots::ABM_Target;
|
||||
|
||||
if (
|
||||
!c->GetTarget() ||
|
||||
!c->GetTarget()->IsBot() ||
|
||||
c->GetTarget()->GetOwner() != c
|
||||
) {
|
||||
c->Message(Chat::Yellow, "You must target your own bot to list priorities.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (Bot::GetSpellTypeIDByShortName(arg1) != UINT16_MAX) {
|
||||
spell_type = Bot::GetSpellTypeIDByShortName(arg1);
|
||||
}
|
||||
else {
|
||||
c->Message(
|
||||
@ -131,8 +136,8 @@ void bot_command_spell_engaged_priority(Client* c, const Seperator* sep)
|
||||
if (sep->IsNumber(2)) {
|
||||
type_value = atoi(sep->arg[2]);
|
||||
++ab_arg;
|
||||
if (EQ::ValueWithin(type_value, BotSpellTypes::START, BotSpellTypes::END)) {
|
||||
c->Message(Chat::Yellow, "You must enter a value between {} and {}.", BotSpellTypes::START, BotSpellTypes::END);
|
||||
if (!EQ::ValueWithin(type_value, BotSpellTypes::START, BotSpellTypes::END)) {
|
||||
c->Message(Chat::Yellow, "You must enter a value between %u and %u.", BotSpellTypes::START, BotSpellTypes::END);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -155,7 +160,6 @@ void bot_command_spell_engaged_priority(Client* c, const Seperator* sep)
|
||||
return;
|
||||
}
|
||||
|
||||
const int ab_mask = ActionableBots::ABM_Type1;
|
||||
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")) {
|
||||
@ -194,25 +198,28 @@ void bot_command_spell_engaged_priority(Client* c, const Seperator* sep)
|
||||
else if (list_check) {
|
||||
auto cast_order = my_bot->GetSpellTypesPrioritized(BotPriorityCategories::Engaged);
|
||||
|
||||
BotCommandHelpParams p;
|
||||
p.description = {
|
||||
"Anything not listed is currently disabled (0)",
|
||||
"----------",
|
||||
"Spell Type - Priority"
|
||||
};
|
||||
p.notes = { };
|
||||
|
||||
for (auto& current_cast : cast_order) {
|
||||
c->Message(
|
||||
Chat::Green,
|
||||
p.notes.push_back(
|
||||
fmt::format(
|
||||
"{} says, 'My [{}] engaged cast priority for is currently [{}].'",
|
||||
my_bot->GetCleanName(),
|
||||
"{}s - {}",
|
||||
Bot::GetSpellTypeNameByID(current_cast.spellType),
|
||||
(current_cast.priority == 0 ? "disabled (0)" : std::to_string(current_cast.priority))
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
|
||||
c->Message(
|
||||
Chat::Green,
|
||||
fmt::format(
|
||||
"{} says, 'Anything not listed is currently disabled (0).'",
|
||||
my_bot->GetCleanName()
|
||||
).c_str()
|
||||
);
|
||||
std::string popup_text = c->SendBotCommandHelpWindow(p);
|
||||
popup_text = DialogueWindow::Table(popup_text);
|
||||
|
||||
c->SendPopupToClient(sep->arg[0], popup_text.c_str());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -23,6 +23,14 @@ void bot_command_spell_idle_priority(Client* c, const Seperator* sep)
|
||||
fmt::format("{} [Type ID] [value] [actionable]", sep->arg[0])
|
||||
};
|
||||
p.examples_one =
|
||||
{
|
||||
"To list your targeted bot's priorities:",
|
||||
fmt::format(
|
||||
"{} list",
|
||||
sep->arg[0]
|
||||
)
|
||||
};
|
||||
p.examples_two =
|
||||
{
|
||||
"To set all Clerics to cast fast heals third:",
|
||||
fmt::format(
|
||||
@ -38,20 +46,6 @@ void bot_command_spell_idle_priority(Client* c, const Seperator* sep)
|
||||
Class::Cleric
|
||||
)
|
||||
};
|
||||
p.examples_two =
|
||||
{
|
||||
"To set all bots to not cast cures:",
|
||||
fmt::format(
|
||||
"{} {} 0 spawned",
|
||||
sep->arg[0],
|
||||
Bot::GetSpellTypeShortNameByID(BotSpellTypes::Cure)
|
||||
),
|
||||
fmt::format(
|
||||
"{} {} 0 spawned",
|
||||
sep->arg[0],
|
||||
BotSpellTypes::Cure
|
||||
)
|
||||
};
|
||||
p.examples_three =
|
||||
{
|
||||
"To check the current idle priority of buffs on all bots:",
|
||||
@ -94,6 +88,7 @@ void bot_command_spell_idle_priority(Client* c, const Seperator* sep)
|
||||
bool list_check = false;
|
||||
uint16 spell_type = 0;
|
||||
uint32 type_value = 0;
|
||||
int ab_mask = ActionableBots::ABM_Type1;
|
||||
|
||||
// String/Int type checks
|
||||
if (sep->IsNumber(1)) {
|
||||
@ -106,12 +101,22 @@ void bot_command_spell_idle_priority(Client* c, const Seperator* sep)
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (Bot::GetSpellTypeIDByShortName(arg1) != UINT16_MAX) {
|
||||
spell_type = Bot::GetSpellTypeIDByShortName(arg1);
|
||||
}
|
||||
else if (!arg1.compare("list")) {
|
||||
if (!arg1.compare("list")) {
|
||||
++ab_arg;
|
||||
list_check = true;
|
||||
ab_mask = ActionableBots::ABM_Target;
|
||||
|
||||
if (
|
||||
!c->GetTarget() ||
|
||||
!c->GetTarget()->IsBot() ||
|
||||
c->GetTarget()->GetOwner() != c
|
||||
) {
|
||||
c->Message(Chat::Yellow, "You must target your own bot to list priorities.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (Bot::GetSpellTypeIDByShortName(arg1) != UINT16_MAX) {
|
||||
spell_type = Bot::GetSpellTypeIDByShortName(arg1);
|
||||
}
|
||||
else {
|
||||
c->Message(
|
||||
@ -131,8 +136,8 @@ void bot_command_spell_idle_priority(Client* c, const Seperator* sep)
|
||||
if (sep->IsNumber(2)) {
|
||||
type_value = atoi(sep->arg[2]);
|
||||
++ab_arg;
|
||||
if (EQ::ValueWithin(type_value, BotSpellTypes::START, BotSpellTypes::END)) {
|
||||
c->Message(Chat::Yellow, "You must enter a value between {} and {}.", BotSpellTypes::START, BotSpellTypes::END);
|
||||
if (!EQ::ValueWithin(type_value, BotSpellTypes::START, BotSpellTypes::END)) {
|
||||
c->Message(Chat::Yellow, "You must enter a value between %u and %u.", BotSpellTypes::START, BotSpellTypes::END);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -155,7 +160,6 @@ void bot_command_spell_idle_priority(Client* c, const Seperator* sep)
|
||||
return;
|
||||
}
|
||||
|
||||
const int ab_mask = ActionableBots::ABM_Type1;
|
||||
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")) {
|
||||
@ -194,25 +198,28 @@ void bot_command_spell_idle_priority(Client* c, const Seperator* sep)
|
||||
else if (list_check) {
|
||||
auto cast_order = my_bot->GetSpellTypesPrioritized(BotPriorityCategories::Idle);
|
||||
|
||||
BotCommandHelpParams p;
|
||||
p.description = {
|
||||
"Anything not listed is currently disabled (0)",
|
||||
"----------",
|
||||
"Spell Type - Priority"
|
||||
};
|
||||
p.notes = { };
|
||||
|
||||
for (auto& current_cast : cast_order) {
|
||||
c->Message(
|
||||
Chat::Green,
|
||||
p.notes.push_back(
|
||||
fmt::format(
|
||||
"{} says, 'My [{}] idle cast priority for is currently [{}].'",
|
||||
my_bot->GetCleanName(),
|
||||
"{}s - {}",
|
||||
Bot::GetSpellTypeNameByID(current_cast.spellType),
|
||||
(current_cast.priority == 0 ? "disabled (0)" : std::to_string(current_cast.priority))
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
|
||||
c->Message(
|
||||
Chat::Green,
|
||||
fmt::format(
|
||||
"{} says, 'Anything not listed is currently disabled (0).'",
|
||||
my_bot->GetCleanName()
|
||||
).c_str()
|
||||
);
|
||||
std::string popup_text = c->SendBotCommandHelpWindow(p);
|
||||
popup_text = DialogueWindow::Table(popup_text);
|
||||
|
||||
c->SendPopupToClient(sep->arg[0], popup_text.c_str());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -24,16 +24,10 @@ void bot_command_spell_pursue_priority(Client* c, const Seperator* sep)
|
||||
};
|
||||
p.examples_one =
|
||||
{
|
||||
"To set all bots to cast nukes first:",
|
||||
"To list your targeted bot's priorities:",
|
||||
fmt::format(
|
||||
"{} {} 1 spawned",
|
||||
sep->arg[0],
|
||||
Bot::GetSpellTypeShortNameByID(BotSpellTypes::Nuke)
|
||||
),
|
||||
fmt::format(
|
||||
"{} {} 1 spawned",
|
||||
sep->arg[0],
|
||||
BotSpellTypes::FastHeals
|
||||
"{} list",
|
||||
sep->arg[0]
|
||||
)
|
||||
};
|
||||
p.examples_two =
|
||||
@ -94,6 +88,7 @@ void bot_command_spell_pursue_priority(Client* c, const Seperator* sep)
|
||||
bool list_check = false;
|
||||
uint16 spell_type = 0;
|
||||
uint32 type_value = 0;
|
||||
int ab_mask = ActionableBots::ABM_Type1;
|
||||
|
||||
// String/Int type checks
|
||||
if (sep->IsNumber(1)) {
|
||||
@ -106,12 +101,22 @@ void bot_command_spell_pursue_priority(Client* c, const Seperator* sep)
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (Bot::GetSpellTypeIDByShortName(arg1) != UINT16_MAX) {
|
||||
spell_type = Bot::GetSpellTypeIDByShortName(arg1);
|
||||
}
|
||||
else if (!arg1.compare("list")) {
|
||||
if (!arg1.compare("list")) {
|
||||
++ab_arg;
|
||||
list_check = true;
|
||||
ab_mask = ActionableBots::ABM_Target;
|
||||
|
||||
if (
|
||||
!c->GetTarget() ||
|
||||
!c->GetTarget()->IsBot() ||
|
||||
c->GetTarget()->GetOwner() != c
|
||||
) {
|
||||
c->Message(Chat::Yellow, "You must target your own bot to list priorities.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (Bot::GetSpellTypeIDByShortName(arg1) != UINT16_MAX) {
|
||||
spell_type = Bot::GetSpellTypeIDByShortName(arg1);
|
||||
}
|
||||
else {
|
||||
c->Message(
|
||||
@ -131,8 +136,8 @@ void bot_command_spell_pursue_priority(Client* c, const Seperator* sep)
|
||||
if (sep->IsNumber(2)) {
|
||||
type_value = atoi(sep->arg[2]);
|
||||
++ab_arg;
|
||||
if (EQ::ValueWithin(type_value, BotSpellTypes::START, BotSpellTypes::END)) {
|
||||
c->Message(Chat::Yellow, "You must enter a value between {} and {}.", BotSpellTypes::START, BotSpellTypes::END);
|
||||
if (!EQ::ValueWithin(type_value, BotSpellTypes::START, BotSpellTypes::END)) {
|
||||
c->Message(Chat::Yellow, "You must enter a value between %u and %u.", BotSpellTypes::START, BotSpellTypes::END);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -155,7 +160,6 @@ void bot_command_spell_pursue_priority(Client* c, const Seperator* sep)
|
||||
return;
|
||||
}
|
||||
|
||||
const int ab_mask = ActionableBots::ABM_Type1;
|
||||
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")) {
|
||||
@ -194,25 +198,28 @@ void bot_command_spell_pursue_priority(Client* c, const Seperator* sep)
|
||||
else if (list_check) {
|
||||
auto cast_order = my_bot->GetSpellTypesPrioritized(BotPriorityCategories::Pursue);
|
||||
|
||||
BotCommandHelpParams p;
|
||||
p.description = {
|
||||
"Anything not listed is currently disabled (0)",
|
||||
"----------",
|
||||
"Spell Type - Priority"
|
||||
};
|
||||
p.notes = { };
|
||||
|
||||
for (auto& current_cast : cast_order) {
|
||||
c->Message(
|
||||
Chat::Green,
|
||||
p.notes.push_back(
|
||||
fmt::format(
|
||||
"{} says, 'My [{}] pursue cast priority for is currently [{}].'",
|
||||
my_bot->GetCleanName(),
|
||||
"{}s - {}",
|
||||
Bot::GetSpellTypeNameByID(current_cast.spellType),
|
||||
(current_cast.priority == 0 ? "disabled (0)" : std::to_string(current_cast.priority))
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
|
||||
c->Message(
|
||||
Chat::Green,
|
||||
fmt::format(
|
||||
"{} says, 'Anything not listed is currently disabled (0).'",
|
||||
my_bot->GetCleanName()
|
||||
).c_str()
|
||||
);
|
||||
std::string popup_text = c->SendBotCommandHelpWindow(p);
|
||||
popup_text = DialogueWindow::Table(popup_text);
|
||||
|
||||
c->SendPopupToClient(sep->arg[0], popup_text.c_str());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user