Move client commands for bot spells from gm commands to existing bot commands

This commit is contained in:
nytmyr
2025-01-23 11:51:58 -06:00
parent 4ff7e98c68
commit 400bf12795
10 changed files with 336 additions and 814 deletions
-157
View File
@@ -1,157 +0,0 @@
#include "../command.h"
void command_spell_delays(Client* c, const Seperator* sep)
{
const int arguments = sep->argnum;
if (arguments) {
const bool is_help = !strcasecmp(sep->arg[1], "help");
if (is_help) {
BotCommandHelpParams p;
p.description = { "Controls how often bots can cast certain spell types on you" };
p.notes =
{
"- All pet types are control your how your pet will be affected"
};
p.example_format =
{
fmt::format(
"{} [Type Shortname] [value]"
, sep->arg[0]
),
fmt::format(
"{} [Type ID] [value]"
, sep->arg[0]
)
};
p.examples_one =
{
"To set Very Fast Heals to be received every 1 second:",
fmt::format(
"{} {} 1000",
sep->arg[0],
c->GetSpellTypeShortNameByID(BotSpellTypes::VeryFastHeals)
),
fmt::format(
"{} {} 1000",
sep->arg[0],
BotSpellTypes::VeryFastHeals
)
};
p.examples_two =
{
"To check your current Regular Heal delay:",
fmt::format(
"{} {} current",
sep->arg[0],
c->GetSpellTypeShortNameByID(BotSpellTypes::RegularHeal)
),
fmt::format(
"{} {} current",
sep->arg[0],
BotSpellTypes::RegularHeal
)
};
std::string popup_text = c->SendBotCommandHelpWindow(p);
popup_text = DialogueWindow::Table(popup_text);
c->SendPopupToClient(sep->arg[0], popup_text.c_str());
c->SendSpellTypePrompts(false, true);
return;
}
}
std::string arg1 = sep->arg[1];
std::string arg2 = sep->arg[2];
int ab_arg = 2;
bool current_check = false;
uint16 spell_type = 0;
uint32 type_value = 0;
if (sep->IsNumber(1)) {
spell_type = atoi(sep->arg[1]);
if (!IsClientBotSpellType(spell_type)) {
c->Message(Chat::Yellow, "Invalid spell type.");
c->SendSpellTypePrompts(false, true);
return;
}
}
else {
if (c->GetSpellTypeIDByShortName(arg1) != UINT16_MAX) {
spell_type = c->GetSpellTypeIDByShortName(arg1);
if (!IsClientBotSpellType(spell_type)) {
c->Message(Chat::Yellow, "Invalid spell type.");
c->SendSpellTypePrompts(false, true);
}
}
else {
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;
}
}
// Enable/Disable/Current checks
if (sep->IsNumber(2)) {
type_value = atoi(sep->arg[2]);
++ab_arg;
if (type_value < 0 || type_value > 60000) {
c->Message(Chat::Yellow, "You must enter a value between 1-60000 (1ms to 60s).");
return;
}
}
else if (!arg2.compare("current")) {
++ab_arg;
current_check = true;
}
else {
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;
}
if (current_check) {
c->Message(
Chat::Green,
fmt::format(
"Your [{}] delay is currently {} seconds.'",
c->GetSpellTypeNameByID(spell_type),
c->GetSpellDelay(spell_type) / 1000.00
).c_str()
);
}
else {
c->SetSpellDelay(spell_type, type_value);
c->Message(
Chat::Green,
fmt::format(
"Your [{}] delay was set to {} seconds.'",
c->GetSpellTypeNameByID(spell_type),
c->GetSpellDelay(spell_type) / 1000.00
).c_str()
);
}
}
-161
View File
@@ -1,161 +0,0 @@
#include "../command.h"
void command_spell_holds(Client *c, const Seperator *sep)
{
//unused for clients
c->Message(Chat::Yellow, "Spell Holds for players is currently unused.");
return;
const int arguments = sep->argnum;
if (arguments) {
const bool is_help = !strcasecmp(sep->arg[1], "help");
if (is_help) {
BotCommandHelpParams p;
p.description = { "Toggles whether or not bots can cast certain spell types on you" };
p.notes =
{
"- All pet types are control your how your pet will be affected"
};
p.example_format =
{
fmt::format(
"{} [Type Shortname] [value]",
sep->arg[0]
),
fmt::format(
"{} [Type ID] [value]",
sep->arg[0]
)
};
p.examples_one =
{
"To set DoTs to be held:",
fmt::format(
"{} {} 1",
sep->arg[0],
c->GetSpellTypeShortNameByID(BotSpellTypes::DOT)
),
fmt::format(
"{} {} 1",
sep->arg[0],
BotSpellTypes::DOT
)
};
p.examples_two =
{
"To check your current DoT settings:",
fmt::format(
"{} {} current",
sep->arg[0],
c->GetSpellTypeShortNameByID(BotSpellTypes::DOT)
),
fmt::format(
"{} {} current",
sep->arg[0],
BotSpellTypes::DOT
)
};
std::string popup_text = c->SendBotCommandHelpWindow(p);
popup_text = DialogueWindow::Table(popup_text);
c->SendPopupToClient(sep->arg[0], popup_text.c_str());
c->SendSpellTypePrompts(false, true);
return;
}
}
std::string arg1 = sep->arg[1];
std::string arg2 = sep->arg[2];
int ab_arg = 2;
bool current_check = false;
uint16 spell_type = 0;
uint32 type_value = 0;
if (sep->IsNumber(1)) {
spell_type = atoi(sep->arg[1]);
if (!IsClientBotSpellType(spell_type)) {
c->Message(Chat::Yellow, "Invalid spell type.");
c->SendSpellTypePrompts(false, true);
return;
}
}
else {
if (c->GetSpellTypeIDByShortName(arg1) != UINT16_MAX) {
spell_type = c->GetSpellTypeIDByShortName(arg1);
if (!IsClientBotSpellType(spell_type)) {
c->Message(Chat::Yellow, "Invalid spell type.");
c->SendSpellTypePrompts(false, true);
}
}
else {
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;
}
}
// Enable/Disable/Current checks
if (sep->IsNumber(2)) {
type_value = atoi(sep->arg[2]);
++ab_arg;
if (type_value < 0 || type_value > 1) {
c->Message(Chat::Yellow, "You must enter either 0 for disabled or 1 for enabled.");
return;
}
}
else if (!arg2.compare("current")) {
++ab_arg;
current_check = true;
}
else {
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;
}
if (current_check) {
c->Message(
Chat::Green,
fmt::format(
"Your [{}] spell hold is currently [{}].'",
c->GetSpellTypeNameByID(spell_type),
c->GetSpellHold(spell_type) ? "enabled" : "disabled"
).c_str()
);
}
else {
c->SetSpellHold(spell_type, type_value);
c->Message(
Chat::Green,
fmt::format(
"Your [{}] spell hold was [{}].'",
c->GetSpellTypeNameByID(spell_type),
c->GetSpellHold(spell_type) ? "enabled" : "disabled"
).c_str()
);
}
}
-157
View File
@@ -1,157 +0,0 @@
#include "../command.h"
void command_spell_max_thresholds(Client* c, const Seperator* sep)
{
const int arguments = sep->argnum;
if (arguments) {
const bool is_help = !strcasecmp(sep->arg[1], "help");
if (is_help) {
BotCommandHelpParams p;
p.description = { "Threshold of your own health when bots will start casting the chosen spell type" };
p.notes =
{
"- All pet types are control your how your pet will be affected"
};
p.example_format =
{
fmt::format(
"{} [Type Shortname] [value]"
, sep->arg[0]
),
fmt::format(
"{} [Type ID] [value]"
, sep->arg[0]
)
};
p.examples_one =
{
"To set Complete Heals to start at 90% health:",
fmt::format(
"{} {} 90",
sep->arg[0],
c->GetSpellTypeShortNameByID(BotSpellTypes::CompleteHeal)
),
fmt::format(
"{} {} 90",
sep->arg[0],
BotSpellTypes::CompleteHeal
)
};
p.examples_two =
{
"To check your current HoT Heal settings:",
fmt::format(
"{} {} current",
sep->arg[0],
c->GetSpellTypeShortNameByID(BotSpellTypes::HoTHeals)
),
fmt::format(
"{} {} current",
sep->arg[0],
BotSpellTypes::HoTHeals
)
};
std::string popup_text = c->SendBotCommandHelpWindow(p);
popup_text = DialogueWindow::Table(popup_text);
c->SendPopupToClient(sep->arg[0], popup_text.c_str());
c->SendSpellTypePrompts(false, true);
return;
}
}
std::string arg1 = sep->arg[1];
std::string arg2 = sep->arg[2];
int ab_arg = 2;
bool current_check = false;
uint16 spell_type = 0;
uint32 type_value = 0;
if (sep->IsNumber(1)) {
spell_type = atoi(sep->arg[1]);
if (!IsClientBotSpellType(spell_type)) {
c->Message(Chat::Yellow, "Invalid spell type.");
c->SendSpellTypePrompts(false, true);
return;
}
}
else {
if (c->GetSpellTypeIDByShortName(arg1) != UINT16_MAX) {
spell_type = c->GetSpellTypeIDByShortName(arg1);
if (!IsClientBotSpellType(spell_type)) {
c->Message(Chat::Yellow, "Invalid spell type.");
c->SendSpellTypePrompts(false, true);
}
}
else {
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;
}
}
// Enable/Disable/Current checks
if (sep->IsNumber(2)) {
type_value = atoi(sep->arg[2]);
++ab_arg;
if (type_value < 0 || type_value > 100) {
c->Message(Chat::Yellow, "You must enter a value between 0-100 (0%% to 100%% of your health).");
return;
}
}
else if (!arg2.compare("current")) {
++ab_arg;
current_check = true;
}
else {
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;
}
if (current_check) {
c->Message(
Chat::Green,
fmt::format(
"Your [{}] maximum hold is currently [{}%%].'",
c->GetSpellTypeNameByID(spell_type),
c->GetSpellMaxThreshold(spell_type)
).c_str()
);
}
else {
c->SetSpellMaxThreshold(spell_type, type_value);
c->Message(
Chat::Green,
fmt::format(
"Your [{}] maximum hold was set to [{}%%].'",
c->GetSpellTypeNameByID(spell_type),
c->GetSpellMaxThreshold(spell_type)
).c_str()
);
}
}
-157
View File
@@ -1,157 +0,0 @@
#include "../command.h"
void command_spell_min_thresholds(Client* c, const Seperator* sep)
{
const int arguments = sep->argnum;
if (arguments) {
const bool is_help = !strcasecmp(sep->arg[1], "help");
if (is_help) {
BotCommandHelpParams p;
p.description = { "Threshold of your own health when bots will stop casting the chosen spell type" };
p.notes =
{
"- All pet types are control your how your pet will be affected"
};
p.example_format =
{
fmt::format(
"{} [Type Shortname] [value]"
, sep->arg[0]
),
fmt::format(
"{} [Type ID] [value]"
, sep->arg[0]
)
};
p.examples_one =
{
"To set Fast Heals to be stopped at 65% health:",
fmt::format(
"{} {} 65",
sep->arg[0],
c->GetSpellTypeShortNameByID(BotSpellTypes::FastHeals)
),
fmt::format(
"{} {} 65",
sep->arg[0],
BotSpellTypes::FastHeals
)
};
p.examples_two =
{
"To check your current Cure settings:",
fmt::format(
"{} {} current",
sep->arg[0],
c->GetSpellTypeShortNameByID(BotSpellTypes::Cure)
),
fmt::format(
"{} {} current",
sep->arg[0],
BotSpellTypes::Cure
)
};
std::string popup_text = c->SendBotCommandHelpWindow(p);
popup_text = DialogueWindow::Table(popup_text);
c->SendPopupToClient(sep->arg[0], popup_text.c_str());
c->SendSpellTypePrompts(false, true);
return;
}
}
std::string arg1 = sep->arg[1];
std::string arg2 = sep->arg[2];
int ab_arg = 2;
bool current_check = false;
uint16 spell_type = 0;
uint32 type_value = 0;
if (sep->IsNumber(1)) {
spell_type = atoi(sep->arg[1]);
if (!IsClientBotSpellType(spell_type)) {
c->Message(Chat::Yellow, "Invalid spell type.");
c->SendSpellTypePrompts(false, true);
return;
}
}
else {
if (c->GetSpellTypeIDByShortName(arg1) != UINT16_MAX) {
spell_type = c->GetSpellTypeIDByShortName(arg1);
if (!IsClientBotSpellType(spell_type)) {
c->Message(Chat::Yellow, "Invalid spell type.");
c->SendSpellTypePrompts(false, true);
}
}
else {
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;
}
}
// Enable/Disable/Current checks
if (sep->IsNumber(2)) {
type_value = atoi(sep->arg[2]);
++ab_arg;
if (type_value < 0 || type_value > 100) {
c->Message(Chat::Yellow, "You must enter a value between 0-100 (0%% to 100%% of your health).");
return;
}
}
else if (!arg2.compare("current")) {
++ab_arg;
current_check = true;
}
else {
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;
}
if (current_check) {
c->Message(
Chat::Green,
fmt::format(
"Your [{}] minimum hold is currently [{}%%].'",
c->GetSpellTypeNameByID(spell_type),
c->GetSpellMinThreshold(spell_type)
).c_str()
);
}
else {
c->SetSpellMinThreshold(spell_type, type_value);
c->Message(
Chat::Green,
fmt::format(
"Your [{}] minimum hold was set to [{}%%].'",
c->GetSpellTypeNameByID(spell_type),
c->GetSpellMinThreshold(spell_type)
).c_str()
);
}
}