code cleanup 3

This commit is contained in:
nytmyr
2025-01-10 12:10:12 -06:00
parent 95c1bb6883
commit 90e95572fd
38 changed files with 718 additions and 729 deletions
+4 -4
View File
@@ -12,10 +12,10 @@ void command_illusion_block(Client* c, const Seperator* sep)
}
if (sep->IsNumber(1)) {
int setStatus = atoi(sep->arg[1]);
if (setStatus == 0 || setStatus == 1) {
c->SetIllusionBlock(setStatus);
c->Message(Chat::White, "Your Illusion Block has been %s.", (setStatus ? "enabled" : "disabled"));
int set_status = atoi(sep->arg[1]);
if (set_status == 0 || set_status == 1) {
c->SetIllusionBlock(set_status);
c->Message(Chat::White, "Your Illusion Block has been %s.", (set_status ? "enabled" : "disabled"));
}
else {
c->Message(Chat::White, "You must enter 0 for disabled or 1 for enabled.");
+13 -13
View File
@@ -89,13 +89,13 @@ void command_spell_delays(Client* c, const Seperator* sep)
std::string arg2 = sep->arg[2];
int ab_arg = 2;
bool current_check = false;
uint16 spellType = 0;
uint32 typeValue = 0;
uint16 spell_type = 0;
uint32 type_value = 0;
if (sep->IsNumber(1)) {
spellType = atoi(sep->arg[1]);
spell_type = atoi(sep->arg[1]);
if (!IsClientBotSpellType(spellType)) {
if (!IsClientBotSpellType(spell_type)) {
c->Message(Chat::Yellow, "Invalid spell type.");
c->SendSpellTypePrompts(false, true);
@@ -104,9 +104,9 @@ void command_spell_delays(Client* c, const Seperator* sep)
}
else {
if (c->GetSpellTypeIDByShortName(arg1) != UINT16_MAX) {
spellType = c->GetSpellTypeIDByShortName(arg1);
spell_type = c->GetSpellTypeIDByShortName(arg1);
if (!IsClientBotSpellType(spellType)) {
if (!IsClientBotSpellType(spell_type)) {
c->Message(Chat::Yellow, "Invalid spell type.");
c->SendSpellTypePrompts(false, true);
}
@@ -128,9 +128,9 @@ void command_spell_delays(Client* c, const Seperator* sep)
// Enable/Disable/Current checks
if (sep->IsNumber(2)) {
typeValue = atoi(sep->arg[2]);
type_value = atoi(sep->arg[2]);
++ab_arg;
if (typeValue < 0 || typeValue > 60000) {
if (type_value < 0 || type_value > 60000) {
c->Message(Chat::Yellow, "You must enter a value between 1-60000 (1ms to 60s).");
return;
@@ -159,19 +159,19 @@ void command_spell_delays(Client* c, const Seperator* sep)
Chat::Green,
fmt::format(
"Your [{}] delay is currently {} seconds.'",
c->GetSpellTypeNameByID(spellType),
c->GetSpellDelay(spellType) / 1000.00
c->GetSpellTypeNameByID(spell_type),
c->GetSpellDelay(spell_type) / 1000.00
).c_str()
);
}
else {
c->SetSpellDelay(spellType, typeValue);
c->SetSpellDelay(spell_type, type_value);
c->Message(
Chat::Green,
fmt::format(
"Your [{}] delay was set to {} seconds.'",
c->GetSpellTypeNameByID(spellType),
c->GetSpellDelay(spellType) / 1000.00
c->GetSpellTypeNameByID(spell_type),
c->GetSpellDelay(spell_type) / 1000.00
).c_str()
);
}
+13 -13
View File
@@ -93,13 +93,13 @@ void command_spell_holds(Client *c, const Seperator *sep)
std::string arg2 = sep->arg[2];
int ab_arg = 2;
bool current_check = false;
uint16 spellType = 0;
uint32 typeValue = 0;
uint16 spell_type = 0;
uint32 type_value = 0;
if (sep->IsNumber(1)) {
spellType = atoi(sep->arg[1]);
spell_type = atoi(sep->arg[1]);
if (!IsClientBotSpellType(spellType)) {
if (!IsClientBotSpellType(spell_type)) {
c->Message(Chat::Yellow, "Invalid spell type.");
c->SendSpellTypePrompts(false, true);
@@ -108,9 +108,9 @@ void command_spell_holds(Client *c, const Seperator *sep)
}
else {
if (c->GetSpellTypeIDByShortName(arg1) != UINT16_MAX) {
spellType = c->GetSpellTypeIDByShortName(arg1);
spell_type = c->GetSpellTypeIDByShortName(arg1);
if (!IsClientBotSpellType(spellType)) {
if (!IsClientBotSpellType(spell_type)) {
c->Message(Chat::Yellow, "Invalid spell type.");
c->SendSpellTypePrompts(false, true);
}
@@ -132,9 +132,9 @@ void command_spell_holds(Client *c, const Seperator *sep)
// Enable/Disable/Current checks
if (sep->IsNumber(2)) {
typeValue = atoi(sep->arg[2]);
type_value = atoi(sep->arg[2]);
++ab_arg;
if (typeValue < 0 || typeValue > 1) {
if (type_value < 0 || type_value > 1) {
c->Message(Chat::Yellow, "You must enter either 0 for disabled or 1 for enabled.");
return;
@@ -163,19 +163,19 @@ void command_spell_holds(Client *c, const Seperator *sep)
Chat::Green,
fmt::format(
"Your [{}] spell hold is currently [{}].'",
c->GetSpellTypeNameByID(spellType),
c->GetSpellHold(spellType) ? "enabled" : "disabled"
c->GetSpellTypeNameByID(spell_type),
c->GetSpellHold(spell_type) ? "enabled" : "disabled"
).c_str()
);
}
else {
c->SetSpellHold(spellType, typeValue);
c->SetSpellHold(spell_type, type_value);
c->Message(
Chat::Green,
fmt::format(
"Your [{}] spell hold was [{}].'",
c->GetSpellTypeNameByID(spellType),
c->GetSpellHold(spellType) ? "enabled" : "disabled"
c->GetSpellTypeNameByID(spell_type),
c->GetSpellHold(spell_type) ? "enabled" : "disabled"
).c_str()
);
}
+13 -13
View File
@@ -89,13 +89,13 @@ void command_spell_max_thresholds(Client* c, const Seperator* sep)
std::string arg2 = sep->arg[2];
int ab_arg = 2;
bool current_check = false;
uint16 spellType = 0;
uint32 typeValue = 0;
uint16 spell_type = 0;
uint32 type_value = 0;
if (sep->IsNumber(1)) {
spellType = atoi(sep->arg[1]);
spell_type = atoi(sep->arg[1]);
if (!IsClientBotSpellType(spellType)) {
if (!IsClientBotSpellType(spell_type)) {
c->Message(Chat::Yellow, "Invalid spell type.");
c->SendSpellTypePrompts(false, true);
@@ -104,9 +104,9 @@ void command_spell_max_thresholds(Client* c, const Seperator* sep)
}
else {
if (c->GetSpellTypeIDByShortName(arg1) != UINT16_MAX) {
spellType = c->GetSpellTypeIDByShortName(arg1);
spell_type = c->GetSpellTypeIDByShortName(arg1);
if (!IsClientBotSpellType(spellType)) {
if (!IsClientBotSpellType(spell_type)) {
c->Message(Chat::Yellow, "Invalid spell type.");
c->SendSpellTypePrompts(false, true);
}
@@ -128,9 +128,9 @@ void command_spell_max_thresholds(Client* c, const Seperator* sep)
// Enable/Disable/Current checks
if (sep->IsNumber(2)) {
typeValue = atoi(sep->arg[2]);
type_value = atoi(sep->arg[2]);
++ab_arg;
if (typeValue < 0 || typeValue > 100) {
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;
@@ -159,19 +159,19 @@ void command_spell_max_thresholds(Client* c, const Seperator* sep)
Chat::Green,
fmt::format(
"Your [{}] maximum hold is currently [{}%%].'",
c->GetSpellTypeNameByID(spellType),
c->GetSpellMaxThreshold(spellType)
c->GetSpellTypeNameByID(spell_type),
c->GetSpellMaxThreshold(spell_type)
).c_str()
);
}
else {
c->SetSpellMaxThreshold(spellType, typeValue);
c->SetSpellMaxThreshold(spell_type, type_value);
c->Message(
Chat::Green,
fmt::format(
"Your [{}] maximum hold was set to [{}%%].'",
c->GetSpellTypeNameByID(spellType),
c->GetSpellMaxThreshold(spellType)
c->GetSpellTypeNameByID(spell_type),
c->GetSpellMaxThreshold(spell_type)
).c_str()
);
}
+13 -13
View File
@@ -89,13 +89,13 @@ void command_spell_min_thresholds(Client* c, const Seperator* sep)
std::string arg2 = sep->arg[2];
int ab_arg = 2;
bool current_check = false;
uint16 spellType = 0;
uint32 typeValue = 0;
uint16 spell_type = 0;
uint32 type_value = 0;
if (sep->IsNumber(1)) {
spellType = atoi(sep->arg[1]);
spell_type = atoi(sep->arg[1]);
if (!IsClientBotSpellType(spellType)) {
if (!IsClientBotSpellType(spell_type)) {
c->Message(Chat::Yellow, "Invalid spell type.");
c->SendSpellTypePrompts(false, true);
@@ -104,9 +104,9 @@ void command_spell_min_thresholds(Client* c, const Seperator* sep)
}
else {
if (c->GetSpellTypeIDByShortName(arg1) != UINT16_MAX) {
spellType = c->GetSpellTypeIDByShortName(arg1);
spell_type = c->GetSpellTypeIDByShortName(arg1);
if (!IsClientBotSpellType(spellType)) {
if (!IsClientBotSpellType(spell_type)) {
c->Message(Chat::Yellow, "Invalid spell type.");
c->SendSpellTypePrompts(false, true);
}
@@ -128,9 +128,9 @@ void command_spell_min_thresholds(Client* c, const Seperator* sep)
// Enable/Disable/Current checks
if (sep->IsNumber(2)) {
typeValue = atoi(sep->arg[2]);
type_value = atoi(sep->arg[2]);
++ab_arg;
if (typeValue < 0 || typeValue > 100) {
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;
@@ -159,19 +159,19 @@ void command_spell_min_thresholds(Client* c, const Seperator* sep)
Chat::Green,
fmt::format(
"Your [{}] minimum hold is currently [{}%%].'",
c->GetSpellTypeNameByID(spellType),
c->GetSpellMinThreshold(spellType)
c->GetSpellTypeNameByID(spell_type),
c->GetSpellMinThreshold(spell_type)
).c_str()
);
}
else {
c->SetSpellMinThreshold(spellType, typeValue);
c->SetSpellMinThreshold(spell_type, type_value);
c->Message(
Chat::Green,
fmt::format(
"Your [{}] minimum hold was set to [{}%%].'",
c->GetSpellTypeNameByID(spellType),
c->GetSpellMinThreshold(spellType)
c->GetSpellTypeNameByID(spell_type),
c->GetSpellMinThreshold(spell_type)
).c_str()
);
}