From 00d72fd3c8b0a0b1a9387b4fafcfe98cd79f6e03 Mon Sep 17 00:00:00 2001 From: Kinglykrab Date: Sun, 6 Oct 2024 17:43:55 -0400 Subject: [PATCH] Command cleanup --- zone/gm_commands/evolving_items.cpp | 222 ++++++++++++++++++++-------- 1 file changed, 164 insertions(+), 58 deletions(-) diff --git a/zone/gm_commands/evolving_items.cpp b/zone/gm_commands/evolving_items.cpp index 308fe6b2099..b44e8aa96cb 100644 --- a/zone/gm_commands/evolving_items.cpp +++ b/zone/gm_commands/evolving_items.cpp @@ -4,24 +4,21 @@ void command_evolvingitems(Client *c, const Seperator *sep) { - const auto arguments = sep->argnum; + const uint16 arguments = sep->argnum; if (!arguments) { SendEvolvingItemsSubCommands(c); return; } - auto t = c; + Client* t = c; if (c->GetTarget() && c->GetTarget()->IsClient()) { t = c->GetTarget()->CastToClient(); } - bool const is_target = !strcasecmp(sep->arg[1], "target"); - bool const is_item = !strcasecmp(sep->arg[1], "item"); + const bool is_item = !strcasecmp(sep->arg[1], "item"); + const bool is_target = !strcasecmp(sep->arg[1], "target"); - if ( - !is_target && - !is_item - ) { + if (!is_item && !is_target) { SendEvolvingItemsSubCommands(c); return; } @@ -29,8 +26,7 @@ void command_evolvingitems(Client *c, const Seperator *sep) if (is_target) { if (arguments > 1) { c->Message(Chat::White, "Usage: #evolve target"); - } - else { + } else { c->Message(Chat::Red, "Worn Items"); for (auto const &[key, value]: t->GetInv().GetWorn()) { if (!value->IsEvolving()) { @@ -38,47 +34,87 @@ void command_evolvingitems(Client *c, const Seperator *sep) } auto item = evolving_items_manager.GetEvolvingItemsCache().at(value->GetID()); - c->Message(Chat::Yellow, fmt::format("{}{}{:0d}", "Evolving Items", ":", value->GetID()).c_str()); c->Message( Chat::Yellow, - fmt::format("{}{}{:0d}", "Unique ID", ":", value->GetEvolveUniqueID()).c_str() + fmt::format( + "Evolving Items | {:0d}", + value->GetID() + ).c_str() + ); + c->Message( + Chat::Yellow, + fmt::format( + "Unique ID | {:0d}", + value->GetEvolveUniqueID() + ).c_str() ); c->Message( Chat::Yellow, - fmt::format("{}{}{:0d}", "Final Item ID", ":", value->GetEvolveFinalItemID()).c_str() + fmt::format( + "Final Item ID | {:0d}", + value->GetEvolveFinalItemID() + ).c_str() ); c->Message( Chat::Yellow, - fmt::format("{}{}{}", "Activated", ":", value->GetEvolveActivated() ? "Yes" : "No").c_str() + fmt::format( + "Activated | {}", + value->GetEvolveActivated() ? "Yes" : "No" + ).c_str() ); c->Message( Chat::Yellow, - fmt::format("{}{}{}", "Equiped", ":", value->GetEvolveEquipped() ? "Yes" : "No").c_str() + fmt::format( + "Equipped | {}", + value->GetEvolveEquipped() ? "Yes" : "No" + ).c_str() ); c->Message( Chat::Yellow, - fmt::format("{}{}{:0d}", "Current Amount", ":", value->GetEvolveCurrentAmount()).c_str() + fmt::format( + "Current Amount | {:0d}", + value->GetEvolveCurrentAmount() + ).c_str() ); c->Message( Chat::Yellow, - fmt::format("{}{}{:0d}", "Required Amount", ":", item.required_amount).c_str() + fmt::format( + "Required Amount | {:0d}", + item.required_amount + ).c_str() ); c->Message( Chat::Yellow, - fmt::format("{}{}{:.{}f}", "Progression %", ":", value->GetEvolveProgression(), 2).c_str() + fmt::format( + "Progression (%) | {:.2f}", + value->GetEvolveProgression() + ).c_str() ); - c->Message(Chat::Yellow, fmt::format("{}{}{}", "Type", ":", item.type).c_str()); - c->Message(Chat::Yellow, fmt::format("{}{}{}", "SubType", ":", item.sub_type).c_str()); c->Message( Chat::Yellow, - fmt::format("{}{}{}", "Timer", ":", value->GetTimers().at("evolve").Enabled()).c_str() + fmt::format( + "Type | {}", + item.type + ).c_str() ); c->Message( Chat::Yellow, fmt::format( - "{}{}{}", - "Timer Remaining", - ":", + "Subtype | {}", + item.sub_type + ).c_str() + ); + c->Message( + Chat::Yellow, + fmt::format( + "Timer | {}", + value->GetTimers().at("evolve").Enabled() + ).c_str() + ); + c->Message( + Chat::Yellow, + fmt::format( + "Timer Remaining | {}", value->GetTimers().at("evolve").GetRemainingTime() ).c_str() ); @@ -91,95 +127,165 @@ void command_evolvingitems(Client *c, const Seperator *sep) } auto item = evolving_items_manager.GetEvolvingItemsCache().at(value->GetID()); - c->Message(Chat::Yellow, fmt::format("{}{}{:0d}", "Evolving Items", ":", value->GetID()).c_str()); c->Message( Chat::Yellow, - fmt::format("{}{}{:0d}", "Unique ID", ":", value->GetEvolveUniqueID()).c_str() + fmt::format( + "Evolving Items | {:0d}", + value->GetID() + ).c_str() + ); + c->Message( + Chat::Yellow, + fmt::format( + "Unique ID | {:0d}", + value->GetEvolveUniqueID() + ).c_str() + ); + c->Message( + Chat::Yellow, + fmt::format( + "Final Item ID | {:0d}", + value->GetEvolveFinalItemID() + ).c_str() + ); + c->Message( + Chat::Yellow, + fmt::format( + "Activated | {}", + value->GetEvolveActivated() ? "Yes" : "No" + ).c_str() ); c->Message( Chat::Yellow, - fmt::format("{}{}{:0d}", "Final Item ID", ":", value->GetEvolveFinalItemID()).c_str() + fmt::format( + "Equipped | {}", + value->GetEvolveEquipped() ? "Yes" : "No" + ).c_str() ); c->Message( Chat::Yellow, - fmt::format("{}{}{}", "Activated", ":", value->GetEvolveActivated() ? "Yes" : "No").c_str() + fmt::format( + "Current Amount | {:0d}", + value->GetEvolveCurrentAmount() + ).c_str() ); c->Message( Chat::Yellow, - fmt::format("{}{}{}", "Equiped", ":", value->GetEvolveEquipped() ? "Yes" : "No").c_str() + fmt::format( + "Required Amount | {:0d}", + item.required_amount + ).c_str() ); c->Message( Chat::Yellow, - fmt::format("{}{}{:0d}", "Current Amount", ":", value->GetEvolveCurrentAmount()).c_str() + fmt::format( + "Progression (%) | {:.2f}", + value->GetEvolveProgression() + ).c_str() ); c->Message( Chat::Yellow, - fmt::format("{}{}{:0d}", "Required Amount", ":", item.required_amount).c_str() + fmt::format( + "Type | {}", + item.type + ).c_str() ); c->Message( Chat::Yellow, - fmt::format("{}{}{:.{}f}", "Progression %", ":", value->GetEvolveProgression(), 2).c_str() + fmt::format( + "Subtype | {}", + item.sub_type + ).c_str() ); - c->Message(Chat::Yellow, fmt::format("{}{}{}", "Type", ":", item.type).c_str()); - c->Message(Chat::Yellow, fmt::format("{}{}{}", "SubType", ":", item.sub_type).c_str()); c->Message( Chat::Yellow, - fmt::format("{}{}{}", "Timer", ":", value->GetTimers().at("evolve").Enabled()).c_str() + fmt::format( + "Timer | {}", + value->GetTimers().at("evolve").Enabled() + ).c_str() ); c->Message( Chat::Yellow, fmt::format( - "{}{}{}", - "Timer Remaining", - ":", + "Timer Remaining | {}", value->GetTimers().at("evolve").GetRemainingTime() ).c_str() ); } } - } - else if (is_item) { + } else if (is_item) { if (arguments > 2) { c->Message(Chat::White, "Usage: #evolve item item_id"); - } - else if (sep->IsNumber(2)) { + } else if (sep->IsNumber(2)) { auto item_id = Strings::ToUnsignedInt(sep->arg[2]); auto item = c->GetInv().GetItem(c->GetInv().HasItem(item_id)); if (item) { - c->Message(Chat::Yellow, fmt::format("{}{}{:0d}", "Evolving Items", ":", item->GetID()).c_str()); - c->Message(Chat::Yellow, fmt::format("{}{}{:0d}", "Slot", ":", c->GetInv().HasItem(item_id)).c_str()); c->Message( Chat::Yellow, - fmt::format("{}{}{}", "Activated", ":", item->GetEvolveActivated() ? "Yes" : "No").c_str() + fmt::format( + "Evolving Items | {:0d}", + item->GetID() + ).c_str() ); c->Message( Chat::Yellow, - fmt::format("{}{}{}", "Equiped", ":", item->GetEvolveEquipped() ? "Yes" : "No").c_str() + fmt::format( + "Slot | {:0d}", + c->GetInv().HasItem(item_id) + ).c_str() ); - c->Message(Chat::Yellow, fmt::format("{}{}{:0d}", "Unique ID", ":", item->GetEvolveUniqueID()).c_str()); c->Message( Chat::Yellow, - fmt::format("{}{}{:.{}f}", "Progression %", ":", item->GetEvolveProgression(), 2).c_str() + fmt::format( + "Activated | {}", + item->GetEvolveActivated() ? "Yes" : "No" + ).c_str() ); c->Message( Chat::Yellow, - fmt::format("{}{}{}", "Timer", ":", item->GetTimers().at("evolve").Enabled()).c_str() + fmt::format( + "Equipped | {}", + item->GetEvolveEquipped() ? "Yes" : "No" + ).c_str() + ); + c->Message( + Chat::Yellow, + fmt::format( + "Unique ID | {:0d}", + item->GetEvolveUniqueID() + ).c_str() + ); + c->Message( + Chat::Yellow, + fmt::format( + "Progression (%) | {:.2f}", + item->GetEvolveProgression() + ).c_str() ); c->Message( Chat::Yellow, fmt::format( - "{}{}{}", - "Timer Remaining", - ":", + "Timer | {}", + item->GetTimers().at("evolve").Enabled() + ).c_str() + ); + c->Message( + Chat::Yellow, + fmt::format( + "Timer Remaining | {}", item->GetTimers().at("evolve").GetRemainingTime() ).c_str() ); + } else { + c->Message( + Chat::Red, + fmt::format( + "Item {} could not be found in your inventory.", + item_id + ).c_str() + ); } - else { - c->Message(Chat::Red, fmt::format("Item {} could not be found in your inventory.", item_id).c_str()); - } - } - else { + } else { SendEvolvingItemsSubCommands(c); } } @@ -187,9 +293,9 @@ void command_evolvingitems(Client *c, const Seperator *sep) void SendEvolvingItemsSubCommands(Client *c) { + c->Message(Chat::White, "#evolve item item_id (Shows evolve values within the iteminstance)"); c->Message( Chat::White, "#evolve target (Shows evolve values within the target's cache - Must have a player target selected.)" ); - c->Message(Chat::White, "#evolve item item_id (Shows evolve values within the iteminstance"); }