Skip to content

Commit

Permalink
Command cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinglykrab committed Oct 6, 2024
1 parent 9cacca5 commit 00d72fd
Showing 1 changed file with 164 additions and 58 deletions.
222 changes: 164 additions & 58 deletions zone/gm_commands/evolving_items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,81 +4,117 @@

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;
}

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()) {
continue;
}

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()
);
Expand All @@ -91,105 +127,175 @@ 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);
}
}
}

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");
}

0 comments on commit 00d72fd

Please sign in to comment.