eqemu-server/zone/gm_commands/enablerecipe.cpp
Kinglykrab 8b5b19ae2c
[Commands] Cleanup #enablerecipe Command. (#1817)
- Cleanup message and logic.
2021-11-23 21:45:52 -05:00

30 lines
570 B
C++
Executable File

#include "../client.h"
void command_enablerecipe(Client *c, const Seperator *sep)
{
int arguments = sep->argnum;
if (!arguments || !sep->IsNumber(1)) {
c->Message(Chat::White, "Usage: #enablerecipe [Recipe ID]");
return;
}
auto recipe_id = std::stoul(sep->arg[1]);
if (!recipe_id) {
c->Message(Chat::White, "Usage: #enablerecipe [Recipe ID]");
return;
}
c->Message(
Chat::White,
fmt::format(
"Recipe ID {} {} enabled.",
recipe_id,
(
content_db.EnableRecipe(recipe_id) ?
"successfully" :
"failed to be"
)
).c_str()
);
}