mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-22 12:18:27 +00:00
[Bots] Command Cleanup (#4676)
- Fix ^discipline saying no bots were selected - Adds more information to certain commands to explain how they function. - Rewrote ^copysettings and ^defaultsettings to not be so bloated and accept arguments properly. - Added long names for setting categories - Add Spell ID output to ^spells
This commit is contained in:
+163
-172
@@ -52,7 +52,7 @@ void bot_command_copy_settings(Client* c, const Seperator* sep)
|
||||
),
|
||||
};
|
||||
p.actionables = { "target, byname, ownergroup, ownerraid, targetgroup, namesgroup, healrotationtargets, mmr, byclass, byrace, spawned" };
|
||||
p.options = { "all, misc, spellsettings, spelltypesettings, spellholds, spelldelays, spellminthresholds, spellmaxthresholds, spellminmanapct, spellmaxmanapct, spellminhppct, spellmaxhppct, spellidlepriority, spellengagedpriority, spellpursuepriority, spellaggrochecks, spelltargetcounts, spellresistlimits, spellannouncecasts, blockedbuffs, blockedpetbuffs" };
|
||||
p.options = { "all, misc, spellsettings, spelltypesettings, spellholds, spelldelays, spellminthresholds, spellmaxthresholds, spellresistlimits, spellaggrochecks, spellminmanapct, spellmaxmanapct, spellminhppct, spellmaxhppct, spellidlepriority, spellengagedpriority, spellpursuepriority, spelltargetcounts, spellannouncecasts, blockedbuffs, blockedpetbuffs" };
|
||||
p.options_one =
|
||||
{
|
||||
"[spellsettings] will copy ^spellsettings options",
|
||||
@@ -85,12 +85,6 @@ void bot_command_copy_settings(Client* c, const Seperator* sep)
|
||||
return;
|
||||
}
|
||||
|
||||
int spell_type_arg_int = 4;
|
||||
std::string spell_type_arg = sep->arg[spell_type_arg_int];
|
||||
int ab_arg = 2;
|
||||
bool valid_option = false;
|
||||
uint16 spell_type = UINT16_MAX;
|
||||
uint16 setting_type = UINT16_MAX;
|
||||
std::vector<std::string> options =
|
||||
{
|
||||
"all",
|
||||
@@ -100,63 +94,79 @@ void bot_command_copy_settings(Client* c, const Seperator* sep)
|
||||
"spellholds",
|
||||
"spelldelays",
|
||||
"spellminthresholds",
|
||||
"spellmaxthresholds",
|
||||
"spellmaxthresholds",
|
||||
"spellresistlimits",
|
||||
"spellaggrochecks",
|
||||
"spellminmanapct",
|
||||
"spellmaxmanapct",
|
||||
"spellminhppct",
|
||||
"spellmaxhppct",
|
||||
"spellidlepriority",
|
||||
"spellengagedpriority",
|
||||
"spellpursuepriority",
|
||||
"spellaggrochecks",
|
||||
"spellpursuepriority",
|
||||
"spelltargetcounts",
|
||||
"spellresistlimits",
|
||||
"spellannouncecasts",
|
||||
"blockedbuffs",
|
||||
"blockedpetbuffs"
|
||||
};
|
||||
|
||||
if (sep->IsNumber(spell_type_arg_int)) {
|
||||
spell_type = atoi(sep->arg[spell_type_arg_int]);
|
||||
|
||||
if (!Bot::IsValidBotSpellType(spell_type)) {
|
||||
c->Message(
|
||||
Chat::Yellow,
|
||||
fmt::format(
|
||||
"You must choose a valid spell type. Use {} for information regarding this command.",
|
||||
Saylink::Silent(
|
||||
fmt::format("{} help", sep->arg[0])
|
||||
)
|
||||
).c_str()
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!spell_type_arg.empty()) {
|
||||
if (Bot::GetSpellTypeIDByShortName(spell_type_arg) != UINT16_MAX) {
|
||||
spell_type = Bot::GetSpellTypeIDByShortName(spell_type_arg);
|
||||
}
|
||||
else {
|
||||
c->Message(
|
||||
Chat::Yellow,
|
||||
fmt::format(
|
||||
"You must choose a valid spell type. Use {} for information regarding this command.",
|
||||
Saylink::Silent(
|
||||
fmt::format("{} help", sep->arg[0])
|
||||
)
|
||||
).c_str()
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
std::string option_arg = Strings::ToLower(sep->arg[3]);
|
||||
bool valid_option = false;
|
||||
bool copy_all = false;
|
||||
bool copy_misc = false;
|
||||
bool copy_spell_settings = false;
|
||||
bool copy_spell_type_settings = false;
|
||||
bool copy_blocked_buffs = false;
|
||||
bool copy_blocked_pet_buffs = false;
|
||||
uint16 setting_type = UINT16_MAX;
|
||||
|
||||
for (int i = 0; i < options.size(); i++) {
|
||||
if (sep->arg[3] == options[i]) {
|
||||
setting_type = Bot::GetBotSpellCategoryIDByShortName(sep->arg[3]);
|
||||
valid_option = true;
|
||||
break;
|
||||
if (option_arg == options[i]) {
|
||||
if (option_arg == "all") {
|
||||
copy_all = true;
|
||||
valid_option = true;
|
||||
|
||||
break;
|
||||
}
|
||||
else if (option_arg == "misc") {
|
||||
copy_misc = true;
|
||||
valid_option = true;
|
||||
|
||||
break;
|
||||
}
|
||||
else if (option_arg == "spellsettings") {
|
||||
copy_spell_settings = true;
|
||||
valid_option = true;
|
||||
|
||||
break;
|
||||
}
|
||||
else if (option_arg == "spelltypesettings") {
|
||||
copy_spell_type_settings = true;
|
||||
valid_option = true;
|
||||
|
||||
break;
|
||||
}
|
||||
else if (option_arg == "blockedbuffs") {
|
||||
copy_blocked_buffs = true;
|
||||
valid_option = true;
|
||||
|
||||
break;
|
||||
}
|
||||
else if (option_arg == "blockedpetbuffs") {
|
||||
copy_blocked_pet_buffs = true;
|
||||
valid_option = true;
|
||||
|
||||
break;
|
||||
}
|
||||
else {
|
||||
setting_type = Bot::GetBotSpellCategoryIDByShortName(option_arg);
|
||||
|
||||
if (setting_type != UINT16_MAX) {
|
||||
valid_option = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,125 +236,18 @@ void bot_command_copy_settings(Client* c, const Seperator* sep)
|
||||
return;
|
||||
}
|
||||
|
||||
std::string output = "";
|
||||
int ab_arg = 4;
|
||||
std::string spell_type_arg = sep->arg[ab_arg];
|
||||
uint16 spell_type = UINT16_MAX;
|
||||
|
||||
if (setting_type != UINT16_MAX) {
|
||||
if (spell_type != UINT16_MAX) {
|
||||
from->CopySettings(to, setting_type, spell_type);
|
||||
}
|
||||
else {
|
||||
for (uint16 i = BotSpellTypes::START; i <= BotSpellTypes::END; ++i) {
|
||||
from->CopySettings(to, setting_type, i);
|
||||
}
|
||||
}
|
||||
if (sep->IsNumber(ab_arg)) {
|
||||
spell_type = atoi(sep->arg[ab_arg]);
|
||||
|
||||
output = Bot::GetBotSpellCategoryName(setting_type);
|
||||
}
|
||||
else {
|
||||
if (!strcasecmp(sep->arg[3], "misc")) {
|
||||
from->CopySettings(to, BotSettingCategories::BaseSetting);
|
||||
output = "Miscellaneous";
|
||||
}
|
||||
else if (!strcasecmp(sep->arg[3], "spellsettings")) {
|
||||
from->CopyBotSpellSettings(to);
|
||||
output = "^spellsettings";
|
||||
}
|
||||
else if (!strcasecmp(sep->arg[3], "spelltypesettings")) {
|
||||
if (spell_type != UINT16_MAX) {
|
||||
from->CopySettings(to, BotSettingCategories::SpellHold, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellDelay, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellMinThreshold, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellMaxThreshold, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeAggroCheck, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeResistLimit, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeMinManaPct, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeMaxManaPct, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeMinHPPct, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeMaxHPPct, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeIdlePriority, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeEngagedPriority, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypePursuePriority, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeAEOrGroupTargetCount, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeAnnounceCast, spell_type);
|
||||
}
|
||||
else {
|
||||
for (uint16 i = BotSpellTypes::START; i <= BotSpellTypes::END; ++i) {
|
||||
from->CopySettings(to, BotSettingCategories::SpellHold, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellDelay, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellMinThreshold, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellMaxThreshold, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeAggroCheck, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeResistLimit, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeMinManaPct, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeMaxManaPct, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeMinHPPct, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeMaxHPPct, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeIdlePriority, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeEngagedPriority, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypePursuePriority, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeAEOrGroupTargetCount, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeAnnounceCast, i);
|
||||
}
|
||||
}
|
||||
|
||||
output = "spell type";
|
||||
}
|
||||
else if (!strcasecmp(sep->arg[3], "blockedbuffs")) {
|
||||
from->CopyBotBlockedBuffs(to);
|
||||
}
|
||||
else if (!strcasecmp(sep->arg[3], "blockedpetbuffs")) {
|
||||
from->CopyBotBlockedPetBuffs(to);
|
||||
}
|
||||
else if (!strcasecmp(sep->arg[3], "all")) {
|
||||
from->CopySettings(to, BotSettingCategories::BaseSetting);
|
||||
|
||||
if (spell_type != UINT16_MAX) {
|
||||
from->CopySettings(to, BotSettingCategories::SpellHold, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellDelay, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellMinThreshold, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellMaxThreshold, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeAggroCheck, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeResistLimit, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeMinManaPct, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeMaxManaPct, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeMinHPPct, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeMaxHPPct, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeIdlePriority, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeEngagedPriority, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypePursuePriority, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeAEOrGroupTargetCount, spell_type);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeAnnounceCast, spell_type);
|
||||
}
|
||||
else {
|
||||
for (uint16 i = BotSpellTypes::START; i <= BotSpellTypes::END; ++i) {
|
||||
from->CopySettings(to, BotSettingCategories::SpellHold, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellDelay, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellMinThreshold, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellMaxThreshold, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeAggroCheck, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeResistLimit, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeMinManaPct, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeMaxManaPct, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeMinHPPct, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeMaxHPPct, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeIdlePriority, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeEngagedPriority, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypePursuePriority, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeAEOrGroupTargetCount, i);
|
||||
from->CopySettings(to, BotSettingCategories::SpellTypeAnnounceCast, i);
|
||||
}
|
||||
}
|
||||
|
||||
from->CopyBotSpellSettings(to);
|
||||
from->CopyBotBlockedBuffs(to);
|
||||
from->CopyBotBlockedPetBuffs(to);
|
||||
output = "spell type";
|
||||
}
|
||||
else {
|
||||
if (!EQ::ValueWithin(spell_type, BotSpellTypes::START, BotSpellTypes::END)) {
|
||||
c->Message(
|
||||
Chat::Yellow,
|
||||
fmt::format(
|
||||
"Incorrect argument, use {} for information regarding this command.",
|
||||
"You must choose a valid spell type. Use {} for information regarding this command.",
|
||||
Saylink::Silent(
|
||||
fmt::format("{} help", sep->arg[0])
|
||||
)
|
||||
@@ -353,6 +256,101 @@ void bot_command_copy_settings(Client* c, const Seperator* sep)
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
++ab_arg;
|
||||
}
|
||||
else if (!spell_type_arg.empty()) {
|
||||
if (Bot::GetSpellTypeIDByShortName(spell_type_arg) != UINT16_MAX) {
|
||||
spell_type = Bot::GetSpellTypeIDByShortName(spell_type_arg);
|
||||
++ab_arg;
|
||||
}
|
||||
else {
|
||||
if (
|
||||
!copy_all &&
|
||||
!copy_misc &&
|
||||
!copy_spell_settings &&
|
||||
!copy_blocked_buffs &&
|
||||
!copy_blocked_pet_buffs
|
||||
) {
|
||||
c->Message(Chat::Yellow, "If you are trying to specify a spell type, you must enter a valid spell type. Otherwise you can ignore this message.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string output = "";
|
||||
|
||||
if (copy_all) {
|
||||
for (uint16 i = BotBaseSettings::START; i <= BotBaseSettings::END; ++i) {
|
||||
to->SetBotBaseSetting(i, from->GetBotBaseSetting(i));
|
||||
}
|
||||
|
||||
for (uint16 i = BotSettingCategories::START_NO_BASE; i <= BotSettingCategories::END; ++i) {
|
||||
for (uint16 x = BotSpellTypes::START; x <= BotSpellTypes::END; ++x) {
|
||||
to->SetBotSetting(i, x, from->GetSetting(i, x));
|
||||
}
|
||||
}
|
||||
|
||||
from->CopyBotSpellSettings(to);
|
||||
from->CopyBotBlockedBuffs(to);
|
||||
from->CopyBotBlockedPetBuffs(to);
|
||||
output = "settings were";
|
||||
}
|
||||
else if (copy_misc) {
|
||||
for (uint16 i = BotBaseSettings::START; i <= BotBaseSettings::END; ++i) {
|
||||
to->SetBotBaseSetting(i, from->GetBotBaseSetting(i));
|
||||
output = "miscellaneous settings were";
|
||||
}
|
||||
}
|
||||
else if (copy_spell_settings) {
|
||||
from->ResetBotSpellSettings();
|
||||
output = "^spellsettings were";
|
||||
}
|
||||
else if (copy_spell_type_settings) {
|
||||
if (spell_type != UINT16_MAX) {
|
||||
for (uint16 i = BotSettingCategories::START_NO_BASE; i <= BotSettingCategories::END; ++i) {
|
||||
to->SetBotSetting(i, spell_type, from->GetSetting(i, spell_type));
|
||||
}
|
||||
|
||||
output = fmt::format(
|
||||
"[{}] settings were",
|
||||
Bot::GetSpellTypeNameByID(spell_type)
|
||||
);
|
||||
}
|
||||
else {
|
||||
for (uint16 i = BotSettingCategories::START_NO_BASE; i <= BotSettingCategories::END; ++i) {
|
||||
for (uint16 x = BotSpellTypes::START; x <= BotSpellTypes::END; ++x) {
|
||||
to->SetBotSetting(i, x, from->GetSetting(i, x));
|
||||
}
|
||||
}
|
||||
|
||||
output = "spell type settings were";
|
||||
}
|
||||
}
|
||||
else if (copy_blocked_buffs) {
|
||||
from->CopyBotBlockedBuffs(to);
|
||||
}
|
||||
else if (copy_blocked_pet_buffs) {
|
||||
from->CopyBotBlockedPetBuffs(to);
|
||||
}
|
||||
else if (setting_type != UINT16_MAX) {
|
||||
if (spell_type != UINT16_MAX) {
|
||||
to->SetBotSetting(setting_type, spell_type, from->GetSetting(setting_type, spell_type));
|
||||
output = fmt::format(
|
||||
"[{}] {} were",
|
||||
Bot::GetSpellTypeNameByID(spell_type),
|
||||
Bot::GetBotSpellCategoryName(Bot::GetBotSpellCategoryIDByShortName(option_arg))
|
||||
);
|
||||
}
|
||||
else {
|
||||
for (uint16 i = BotSpellTypes::START; i <= BotSpellTypes::END; ++i) {
|
||||
to->SetBotSetting(setting_type, i, from->GetSetting(setting_type, i));
|
||||
}
|
||||
|
||||
output = fmt::format(
|
||||
"{} settings for all spell types",
|
||||
Bot::GetBotSpellCategoryName(Bot::GetBotSpellCategoryIDByShortName(option_arg))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
to->Save();
|
||||
@@ -360,15 +358,8 @@ void bot_command_copy_settings(Client* c, const Seperator* sep)
|
||||
c->Message(
|
||||
Chat::Green,
|
||||
fmt::format(
|
||||
"{}'s{}{} settings were copied to {}.",
|
||||
"{}'s {} copied to {}.",
|
||||
from->GetCleanName(),
|
||||
(
|
||||
spell_type != UINT16_MAX ?
|
||||
fmt::format(" [{}] ",
|
||||
Bot::GetSpellTypeNameByID(spell_type)
|
||||
)
|
||||
: " "
|
||||
),
|
||||
output,
|
||||
to->GetCleanName()
|
||||
).c_str()
|
||||
|
||||
Reference in New Issue
Block a user