diff --git a/zone/bot_commands/spell_delays.cpp b/zone/bot_commands/spell_delays.cpp index ea2ecfee4..1decded54 100644 --- a/zone/bot_commands/spell_delays.cpp +++ b/zone/bot_commands/spell_delays.cpp @@ -1,7 +1,6 @@ #include "../bot_command.h" -void bot_command_spell_delays(Client* c, const Seperator* sep) -{ +void bot_command_spell_delays(Client* c, const Seperator* sep) { if (helper_command_alias_fail(c, "bot_command_spell_delays", sep->arg[0], "spelldelays")) { c->Message(Chat::White, "note: Controls how long a bot will wait between casts of different spell types."); @@ -14,48 +13,47 @@ void bot_command_spell_delays(Client* c, const Seperator* sep) p.description = { "Controls how long a bot will wait between casts of different spell types." }; p.notes = { + "- Targeting yourself for this command will allow you to control your own settings for how bots cast on you", "- All pet types are based off the pet's owner's setting", "- Any remaining types use the owner's setting when a pet is the target", "- All Heals, Cures, Buffs (DS and resists included) are based off the target's setting, not the caster", - "- e.g., BotA is healing BotB using BotB's settings", + "- e.g., BotA is healing BotB using BotB's settings" }; p.example_format = { - fmt::format( - "{} [Type Shortname] [value] [actionable]" - , sep->arg[0] - ), - fmt::format( - "{} [Type ID] [value] [actionable]" - , sep->arg[0] - ) + fmt::format("{} [Type Shortname] [value] [actionable, default: target]", sep->arg[0]), + fmt::format("{} [Type ID] [value] [actionable, default: target]", sep->arg[0]) }; p.examples_one = { "To set all Necromancers to an 8s DoT delay:", fmt::format( - "{} {} 8000 byclass 11", + "{} {} 8000 byclass {}", sep->arg[0], - c->GetSpellTypeShortNameByID(BotSpellTypes::DOT) + c->GetSpellTypeShortNameByID(BotSpellTypes::DOT), + Class::Necromancer ), fmt::format( - "{} {} 8000 byclass 11", + "{} {} 8000 byclass {}", sep->arg[0], - BotSpellTypes::DOT + BotSpellTypes::DOT, + Class::Necromancer ) }; p.examples_two = { "To set all Warriors to receive Fast Heals every 2.5s:", fmt::format( - "{} {} 2500 byclass 1", + "{} {} 2500 byclass {}", sep->arg[0], - c->GetSpellTypeShortNameByID(BotSpellTypes::FastHeals) + c->GetSpellTypeShortNameByID(BotSpellTypes::FastHeals), + Class::Warrior ), fmt::format( - "{} {} 2500 byclass 1", + "{} {} 2500 byclass {}", sep->arg[0], - BotSpellTypes::FastHeals + BotSpellTypes::FastHeals, + Class::Warrior ) }; p.examples_three = @@ -72,13 +70,14 @@ void bot_command_spell_delays(Client* c, const Seperator* sep) BotSpellTypes::Nuke ) }; - p.actionables = { "target, byname, ownergroup, ownerraid targetgroup, namesgroup, healrotationtargets, mmr, byclass, byrace, spawned" }; + p.actionables = { "target, byname, ownergroup, ownerraid, targetgroup, namesgroup, healrotationtargets, mmr, byclass, byrace, spawned" }; std::string popup_text = c->SendBotCommandHelpWindow(p); popup_text = DialogueWindow::Table(popup_text); c->SendPopupToClient(sep->arg[0], popup_text.c_str()); c->SendSpellTypePrompts(); + c->SendSpellTypePrompts(false, true); if (RuleB(Bots, SendClassRaceOnHelp)) { c->Message( @@ -99,13 +98,26 @@ void bot_command_spell_delays(Client* c, const Seperator* sep) bool current_check = false; uint16 spell_type = 0; uint32 type_value = 0; + Mob* target = c->GetTarget(); + bool clientSetting = (target && target == c); - // String/Int type checks if (sep->IsNumber(1)) { spell_type = atoi(sep->arg[1]); - if (spell_type < BotSpellTypes::START || spell_type > BotSpellTypes::END) { - c->Message(Chat::Yellow, "You must choose a valid spell type. Spell types range from %i to %i", BotSpellTypes::START, BotSpellTypes::END); + if ( + (clientSetting && !IsClientBotSpellType(spell_type)) || + (!clientSetting && (spell_type < BotSpellTypes::START || spell_type > BotSpellTypes::END)) + ) { + c->Message( + Chat::Yellow, + clientSetting ? "Invalid spell type for clients." : "You must choose a valid spell type. Spell types range from %i to %i", + BotSpellTypes::START, + BotSpellTypes::END + ); + + if (clientSetting) { + c->SendSpellTypePrompts(false, true); + } return; } @@ -113,6 +125,11 @@ void bot_command_spell_delays(Client* c, const Seperator* sep) else { if (c->GetSpellTypeIDByShortName(arg1) != UINT16_MAX) { spell_type = c->GetSpellTypeIDByShortName(arg1); + + if (clientSetting && !IsClientBotSpellType(spell_type)) { + c->Message(Chat::Yellow, "Invalid spell type for clients."); + c->SendSpellTypePrompts(false, true); + } } else { c->Message( @@ -157,66 +174,103 @@ void bot_command_spell_delays(Client* c, const Seperator* sep) } 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")) { - class_race_check = true; + std::string actionable_arg = sep->arg[ab_arg]; + + if (actionable_arg.empty()) { + actionable_arg = "target"; } - std::vector sbl; - 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; + if (!clientSetting) { + + 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")) { + class_race_check = true; + } + + std::vector sbl; + + if (ActionableBots::PopulateSBL(c, actionable_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.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); + + Bot* first_found = nullptr; + int success_count = 0; + + for (auto my_bot : sbl) { + if (my_bot->BotPassiveCheck()) { + continue; + } + + if (!first_found) { + first_found = my_bot; + } + + if (current_check) { + c->Message( + Chat::Green, + fmt::format( + "{} says, 'My [{}] spell delay is currently [{}] seconds.'", + my_bot->GetCleanName(), + c->GetSpellTypeNameByID(spell_type), + my_bot->GetSpellDelay(spell_type) / 1000.00 + ).c_str() + ); + } + else { + my_bot->SetSpellDelay(spell_type, type_value); + ++success_count; + } + } + + if (!current_check) { + if (success_count == 1 && first_found) { + c->Message( + Chat::Green, + fmt::format( + "{} says, 'My [{}] spell delay was set to [{}] seconds.'", + first_found->GetCleanName(), + c->GetSpellTypeNameByID(spell_type), + first_found->GetSpellDelay(spell_type) / 1000.00 + ).c_str() + ); + } + else { + c->Message( + Chat::Green, + fmt::format( + "{} of your bots set their [{}] spell delay to [{}] seconds.", + success_count, + c->GetSpellTypeNameByID(spell_type), + type_value / 1000.00 + ).c_str() + ); + } + } } - - sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); - - Bot* first_found = nullptr; - int success_count = 0; - for (auto my_bot : sbl) { - if (my_bot->BotPassiveCheck()) { - continue; - } - - if (!first_found) { - first_found = my_bot; - } - + else { if (current_check) { c->Message( Chat::Green, fmt::format( - "{} says, 'My [{}] spell delay is currently [{}] seconds.'", - my_bot->GetCleanName(), + "Your [{}] spell delay is currently [{}] seconds.", c->GetSpellTypeNameByID(spell_type), - my_bot->GetSpellDelay(spell_type) / 1000.00 + c->GetSpellDelay(spell_type) / 1000.00 ).c_str() ); } else { - my_bot->SetSpellDelay(spell_type, type_value); - ++success_count; - } - } - if (!current_check) { - if (success_count == 1 && first_found) { + c->SetSpellDelay(spell_type, type_value); + c->Message( Chat::Green, fmt::format( - "{} says, 'My [{}] spell delay was set to [{}] seconds.'", - first_found->GetCleanName(), + "Your [{}] spell delay was set to [{}] seconds.", c->GetSpellTypeNameByID(spell_type), - first_found->GetSpellDelay(spell_type) / 1000.00 - ).c_str() - ); - } - else { - c->Message( - Chat::Green, - fmt::format( - "{} of your bots set their [{}] spell delay to [{}] seconds.", - success_count, - c->GetSpellTypeNameByID(spell_type), - type_value / 1000.00 + c->GetSpellDelay(spell_type) / 1000.00 ).c_str() ); } diff --git a/zone/bot_commands/spell_max_thresholds.cpp b/zone/bot_commands/spell_max_thresholds.cpp index 7aaeeceb4..328345a2d 100644 --- a/zone/bot_commands/spell_max_thresholds.cpp +++ b/zone/bot_commands/spell_max_thresholds.cpp @@ -1,7 +1,6 @@ #include "../bot_command.h" -void bot_command_spell_max_thresholds(Client* c, const Seperator* sep) -{ +void bot_command_spell_max_thresholds(Client* c, const Seperator* sep) { if (helper_command_alias_fail(c, "bot_command_spell_max_thresholds", sep->arg[0], "spellmaxthresholds")) { c->Message(Chat::White, "note: Controls at what target HP % the bot will start casting different spell types."); @@ -14,6 +13,7 @@ void bot_command_spell_max_thresholds(Client* c, const Seperator* sep) p.description = { "Controls at what target HP % the bot will start casting different spell types." }; p.notes = { + "- Targeting yourself for this command will allow you to control your own settings for how bots cast on you", "- All pet types are based off the pet's owner's setting", "- Any remaining types use the owner's setting when a pet is the target", "- All Heals, Cures, Buffs (DS and resists included) are based off the target's setting, not the caster", @@ -21,8 +21,8 @@ void bot_command_spell_max_thresholds(Client* c, const Seperator* sep) }; p.example_format = { - fmt::format("{} [Type Shortname] [value] [actionable]", sep->arg[0]), - fmt::format("{} [Type ID] [value] [actionable]", sep->arg[0]) + fmt::format("{} [Type Shortname] [value] [actionable, default: target]", sep->arg[0]), + fmt::format("{} [Type ID] [value] [actionable, default: target]", sep->arg[0]) }; p.examples_one = { @@ -73,6 +73,7 @@ void bot_command_spell_max_thresholds(Client* c, const Seperator* sep) c->SendPopupToClient(sep->arg[0], popup_text.c_str()); c->SendSpellTypePrompts(); + c->SendSpellTypePrompts(false, true); if (RuleB(Bots, SendClassRaceOnHelp)) { c->Message( @@ -93,13 +94,26 @@ void bot_command_spell_max_thresholds(Client* c, const Seperator* sep) bool current_check = false; uint16 spell_type = 0; uint32 type_value = 0; + Mob* target = c->GetTarget(); + bool clientSetting = (target && target == c); - // String/Int type checks if (sep->IsNumber(1)) { spell_type = atoi(sep->arg[1]); - if (spell_type < BotSpellTypes::START || spell_type > BotSpellTypes::END) { - c->Message(Chat::Yellow, "You must choose a valid spell type. Spell types range from %i to %i", BotSpellTypes::START, BotSpellTypes::END); + if ( + (clientSetting && !IsClientBotSpellType(spell_type)) || + (!clientSetting && (spell_type < BotSpellTypes::START || spell_type > BotSpellTypes::END)) + ) { + c->Message( + Chat::Yellow, + clientSetting ? "Invalid spell type for clients." : "You must choose a valid spell type. Spell types range from %i to %i", + BotSpellTypes::START, + BotSpellTypes::END + ); + + if (clientSetting) { + c->SendSpellTypePrompts(false, true); + } return; } @@ -107,6 +121,11 @@ void bot_command_spell_max_thresholds(Client* c, const Seperator* sep) else { if (c->GetSpellTypeIDByShortName(arg1) != UINT16_MAX) { spell_type = c->GetSpellTypeIDByShortName(arg1); + + if (clientSetting && !IsClientBotSpellType(spell_type)) { + c->Message(Chat::Yellow, "Invalid spell type for clients."); + c->SendSpellTypePrompts(false, true); + } } else { c->Message( @@ -151,66 +170,103 @@ void bot_command_spell_max_thresholds(Client* c, const Seperator* sep) } 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")) { - class_race_check = true; + std::string actionable_arg = sep->arg[ab_arg]; + + if (actionable_arg.empty()) { + actionable_arg = "target"; } - std::vector sbl; - 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; + if (!clientSetting) { + + 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")) { + class_race_check = true; + } + + std::vector sbl; + + if (ActionableBots::PopulateSBL(c, actionable_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.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); + + Bot* first_found = nullptr; + int success_count = 0; + + for (auto my_bot : sbl) { + if (my_bot->BotPassiveCheck()) { + continue; + } + + if (!first_found) { + first_found = my_bot; + } + + if (current_check) { + c->Message( + Chat::Green, + fmt::format( + "{} says, 'My [{}] maximum threshold is currently [{}%%].'", + my_bot->GetCleanName(), + c->GetSpellTypeNameByID(spell_type), + my_bot->GetSpellMaxThreshold(spell_type) + ).c_str() + ); + } + else { + my_bot->SetSpellMaxThreshold(spell_type, type_value); + ++success_count; + } + } + + if (!current_check) { + if (success_count == 1 && first_found) { + c->Message( + Chat::Green, + fmt::format( + "{} says, 'My [{}] maximum threshold was set to [{}%%].'", + first_found->GetCleanName(), + c->GetSpellTypeNameByID(spell_type), + first_found->GetSpellMaxThreshold(spell_type) + ).c_str() + ); + } + else { + c->Message( + Chat::Green, + fmt::format( + "{} of your bots set their [{}] maximum threshold to [{}%%].", + success_count, + c->GetSpellTypeNameByID(spell_type), + type_value + ).c_str() + ); + } + } } - - sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); - - Bot* first_found = nullptr; - int success_count = 0; - for (auto my_bot : sbl) { - if (my_bot->BotPassiveCheck()) { - continue; - } - - if (!first_found) { - first_found = my_bot; - } - + else { if (current_check) { c->Message( Chat::Green, fmt::format( - "{} says, 'My [{}] maximum threshold is currently [{}%%].'", - my_bot->GetCleanName(), + "Your [{}] maximum threshold is currently [{}%%].", c->GetSpellTypeNameByID(spell_type), - my_bot->GetSpellMaxThreshold(spell_type) + c->GetSpellMaxThreshold(spell_type) ).c_str() ); } else { - my_bot->SetSpellMaxThreshold(spell_type, type_value); - ++success_count; - } - } - if (!current_check) { - if (success_count == 1 && first_found) { + c->SetSpellMaxThreshold(spell_type, type_value); + c->Message( Chat::Green, fmt::format( - "{} says, 'My [{}] maximum threshold was set to [{}%%].'", - first_found->GetCleanName(), + "Your [{}] maximum threshold was set to [{}%%].", c->GetSpellTypeNameByID(spell_type), - first_found->GetSpellMaxThreshold(spell_type) - ).c_str() - ); - } - else { - c->Message( - Chat::Green, - fmt::format( - "{} of your bots set their [{}] maximum threshold to [{}%%].", - success_count, - c->GetSpellTypeNameByID(spell_type), - type_value + c->GetSpellMaxThreshold(spell_type) ).c_str() ); } diff --git a/zone/bot_commands/spell_min_thresholds.cpp b/zone/bot_commands/spell_min_thresholds.cpp index fdd30c0b9..f39194e2a 100644 --- a/zone/bot_commands/spell_min_thresholds.cpp +++ b/zone/bot_commands/spell_min_thresholds.cpp @@ -1,7 +1,6 @@ #include "../bot_command.h" -void bot_command_spell_min_thresholds(Client* c, const Seperator* sep) -{ +void bot_command_spell_min_thresholds(Client* c, const Seperator* sep) { if (helper_command_alias_fail(c, "bot_command_spell_min_thresholds", sep->arg[0], "spellminthresholds")) { c->Message(Chat::White, "note: Controls at what target HP % the bot will stop casting different spell types."); @@ -14,6 +13,7 @@ void bot_command_spell_min_thresholds(Client* c, const Seperator* sep) p.description = { "Controls at what target HP % the bot will stop casting different spell types." }; p.notes = { + "- Targeting yourself for this command will allow you to control your own settings for how bots cast on you", "- All pet types are based off the pet's owner's setting", "- Any remaining types use the owner's setting when a pet is the target", "- All Heals, Cures, Buffs (DS and resists included) are based off the target's setting, not the caster", @@ -21,8 +21,8 @@ void bot_command_spell_min_thresholds(Client* c, const Seperator* sep) }; p.example_format = { - fmt::format("{} [Type Shortname] [value] [actionable]", sep->arg[0]), - fmt::format("{} [Type ID] [value] [actionable]", sep->arg[0]) + fmt::format("{} [Type Shortname] [value] [actionable, default: target]", sep->arg[0]), + fmt::format("{} [Type ID] [value] [actionable, default: target]", sep->arg[0]) }; p.examples_one = { @@ -75,6 +75,7 @@ void bot_command_spell_min_thresholds(Client* c, const Seperator* sep) c->SendPopupToClient(sep->arg[0], popup_text.c_str()); c->SendSpellTypePrompts(); + c->SendSpellTypePrompts(false, true); if (RuleB(Bots, SendClassRaceOnHelp)) { c->Message( @@ -95,13 +96,26 @@ void bot_command_spell_min_thresholds(Client* c, const Seperator* sep) bool current_check = false; uint16 spell_type = 0; uint32 type_value = 0; + Mob* target = c->GetTarget(); + bool clientSetting = (target && target == c); - // String/Int type checks if (sep->IsNumber(1)) { spell_type = atoi(sep->arg[1]); - if (spell_type < BotSpellTypes::START || spell_type > BotSpellTypes::END) { - c->Message(Chat::Yellow, "You must choose a valid spell type. Spell types range from %i to %i", BotSpellTypes::START, BotSpellTypes::END); + if ( + (clientSetting && !IsClientBotSpellType(spell_type)) || + (!clientSetting && (spell_type < BotSpellTypes::START || spell_type > BotSpellTypes::END)) + ) { + c->Message( + Chat::Yellow, + clientSetting ? "Invalid spell type for clients." : "You must choose a valid spell type. Spell types range from %i to %i", + BotSpellTypes::START, + BotSpellTypes::END + ); + + if (clientSetting) { + c->SendSpellTypePrompts(false, true); + } return; } @@ -109,6 +123,11 @@ void bot_command_spell_min_thresholds(Client* c, const Seperator* sep) else { if (c->GetSpellTypeIDByShortName(arg1) != UINT16_MAX) { spell_type = c->GetSpellTypeIDByShortName(arg1); + + if (clientSetting && !IsClientBotSpellType(spell_type)) { + c->Message(Chat::Yellow, "Invalid spell type for clients."); + c->SendSpellTypePrompts(false, true); + } } else { c->Message( @@ -153,66 +172,103 @@ void bot_command_spell_min_thresholds(Client* c, const Seperator* sep) } 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")) { - class_race_check = true; + std::string actionable_arg = sep->arg[ab_arg]; + + if (actionable_arg.empty()) { + actionable_arg = "target"; } - std::vector sbl; - 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; + if (!clientSetting) { + + 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")) { + class_race_check = true; + } + + std::vector sbl; + + if (ActionableBots::PopulateSBL(c, actionable_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.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); + + Bot* first_found = nullptr; + int success_count = 0; + + for (auto my_bot : sbl) { + if (my_bot->BotPassiveCheck()) { + continue; + } + + if (!first_found) { + first_found = my_bot; + } + + if (current_check) { + c->Message( + Chat::Green, + fmt::format( + "{} says, 'My [{}] minimum threshold is currently [{}%%].'", + my_bot->GetCleanName(), + c->GetSpellTypeNameByID(spell_type), + my_bot->GetSpellMinThreshold(spell_type) + ).c_str() + ); + } + else { + my_bot->SetSpellMinThreshold(spell_type, type_value); + ++success_count; + } + } + + if (!current_check) { + if (success_count == 1 && first_found) { + c->Message( + Chat::Green, + fmt::format( + "{} says, 'My [{}] minimum threshold was set to [{}%%].'", + first_found->GetCleanName(), + c->GetSpellTypeNameByID(spell_type), + first_found->GetSpellMinThreshold(spell_type) + ).c_str() + ); + } + else { + c->Message( + Chat::Green, + fmt::format( + "{} of your bots set their [{}] minimum threshold to [{}%%].", + success_count, + c->GetSpellTypeNameByID(spell_type), + type_value + ).c_str() + ); + } + } } - - sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); - - Bot* first_found = nullptr; - int success_count = 0; - for (auto my_bot : sbl) { - if (my_bot->BotPassiveCheck()) { - continue; - } - - if (!first_found) { - first_found = my_bot; - } - + else { if (current_check) { c->Message( Chat::Green, fmt::format( - "{} says, 'My [{}] minimum threshold is currently [{}%%].'", - my_bot->GetCleanName(), + "Your [{}] minimum threshold is currently [{}%%].", c->GetSpellTypeNameByID(spell_type), - my_bot->GetSpellMinThreshold(spell_type) + c->GetSpellMinThreshold(spell_type) ).c_str() ); } else { - my_bot->SetSpellMinThreshold(spell_type, type_value); - ++success_count; - } - } - if (!current_check) { - if (success_count == 1 && first_found) { + c->SetSpellMinThreshold(spell_type, type_value); + c->Message( Chat::Green, fmt::format( - "{} says, 'My [{}] minimum threshold was set to [{}%%].'", - first_found->GetCleanName(), + "Your [{}] minimum threshold was set to [{}%%].", c->GetSpellTypeNameByID(spell_type), - first_found->GetSpellMinThreshold(spell_type) - ).c_str() - ); - } - else { - c->Message( - Chat::Green, - fmt::format( - "{} of your bots set their [{}] minimum threshold to [{}%%].", - success_count, - c->GetSpellTypeNameByID(spell_type), - type_value + c->GetSpellMinThreshold(spell_type) ).c_str() ); } diff --git a/zone/client_bot.cpp b/zone/client_bot.cpp index 374d64547..348c5ea41 100644 --- a/zone/client_bot.cpp +++ b/zone/client_bot.cpp @@ -298,7 +298,7 @@ void Client::SendSpellTypePrompts(bool commanded_types, bool client_only_types) Message( Chat::Yellow, fmt::format( - "You can view spell types by {} or {}.", + "You can view client spell types by {} or {}.", Saylink::Silent( fmt::format("^spelltypeids client"), "ID" ), diff --git a/zone/command.cpp b/zone/command.cpp index 8b24484fb..94a0ef929 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -219,10 +219,6 @@ int command_init(void) command_add("spawn", "[name] [race] [level] [material] [hp] [gender] [class] [priweapon] [secweapon] [merchantid] - Spawn an NPC", AccountStatus::Steward, command_spawn) || command_add("spawneditmass", "[Search Criteria] [Edit Option] [Edit Value] [Apply] Mass editing spawn command (Apply is optional, 0 = False, 1 = True, default is False)", AccountStatus::GMLeadAdmin, command_spawneditmass) || command_add("spawnfix", "Find targeted NPC in database based on its X/Y/heading and update the database to make it spawn at your current location/heading.", AccountStatus::GMAreas, command_spawnfix) || - command_add("spelldelays", "Controls the delay between casts for a specific spell type", AccountStatus::Player, command_spell_delays) || - //command_add("spellholds", "Controls whether a bot holds the specified spell type or not", AccountStatus::Player, command_spell_holds) || //currently unusued - command_add("spellmaxthresholds", "Controls the minimum target HP threshold for a spell to be cast for a specific type", AccountStatus::Player, command_spell_max_thresholds) || - command_add("spellminthresholds", "Controls the maximum target HP threshold for a spell to be cast for a specific type", AccountStatus::Player, command_spell_min_thresholds) || command_add("stun", "[duration] - Stuns you or your target for duration", AccountStatus::GMAdmin, command_stun) || command_add("summon", "[Character Name] - Summons your corpse, NPC, or player target, or by character name if specified", AccountStatus::QuestTroupe, command_summon) || command_add("summonburiedplayercorpse", "Summons the target's oldest buried corpse, if any exist.", AccountStatus::GMAdmin, command_summonburiedplayercorpse) || @@ -918,10 +914,6 @@ void command_bot(Client *c, const Seperator *sep) #include "gm_commands/spawn.cpp" #include "gm_commands/spawneditmass.cpp" #include "gm_commands/spawnfix.cpp" -#include "gm_commands/spell_delays.cpp" -#include "gm_commands/spell_holds.cpp" -#include "gm_commands/spell_max_thresholds.cpp" -#include "gm_commands/spell_min_thresholds.cpp" #include "gm_commands/faction_association.cpp" #include "gm_commands/stun.cpp" #include "gm_commands/summon.cpp" diff --git a/zone/command.h b/zone/command.h index d3096ce39..4ea728a30 100644 --- a/zone/command.h +++ b/zone/command.h @@ -173,10 +173,6 @@ void command_shutdown(Client *c, const Seperator *sep); void command_spawn(Client *c, const Seperator *sep); void command_spawneditmass(Client *c, const Seperator *sep); void command_spawnfix(Client *c, const Seperator *sep); -void command_spell_delays(Client* c, const Seperator* sep); -//void command_spell_holds(Client* c, const Seperator* sep); //currently unusued -void command_spell_max_thresholds(Client* c, const Seperator* sep); -void command_spell_min_thresholds(Client* c, const Seperator* sep); void command_stun(Client *c, const Seperator *sep); void command_summon(Client *c, const Seperator *sep); void command_summonburiedplayercorpse(Client *c, const Seperator *sep); diff --git a/zone/gm_commands/spell_delays.cpp b/zone/gm_commands/spell_delays.cpp deleted file mode 100644 index 21b744823..000000000 --- a/zone/gm_commands/spell_delays.cpp +++ /dev/null @@ -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() - ); - } -} diff --git a/zone/gm_commands/spell_holds.cpp b/zone/gm_commands/spell_holds.cpp deleted file mode 100644 index be0c9cbca..000000000 --- a/zone/gm_commands/spell_holds.cpp +++ /dev/null @@ -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() - ); - } -} diff --git a/zone/gm_commands/spell_max_thresholds.cpp b/zone/gm_commands/spell_max_thresholds.cpp deleted file mode 100644 index 914163f27..000000000 --- a/zone/gm_commands/spell_max_thresholds.cpp +++ /dev/null @@ -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() - ); - } -} diff --git a/zone/gm_commands/spell_min_thresholds.cpp b/zone/gm_commands/spell_min_thresholds.cpp deleted file mode 100644 index f8b48dbed..000000000 --- a/zone/gm_commands/spell_min_thresholds.cpp +++ /dev/null @@ -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() - ); - } -}