diff --git a/zone/command.cpp b/zone/command.cpp index 5a5943067..f74a951c0 100755 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -165,7 +165,7 @@ int command_init(void) command_add("emotesearch", "Searches NPC Emotes", AccountStatus::QuestTroupe, command_emotesearch) || command_add("emoteview", "Lists all NPC Emotes", AccountStatus::QuestTroupe, command_emoteview) || command_add("emptyinventory", "- Clears you or your target's entire inventory (Equipment, General, Bank, and Shared Bank)", AccountStatus::GMImpossible, command_emptyinventory) || - command_add("enablerecipe", "[recipe_id] - Enables a recipe using the recipe id.", AccountStatus::QuestTroupe, command_enablerecipe) || + command_add("enablerecipe", "[Recipe ID] - Enables a Recipe", AccountStatus::QuestTroupe, command_enablerecipe) || command_add("endurance", "Restores you or your target's endurance.", AccountStatus::Guide, command_endurance) || command_add("equipitem", "[slotid(0-21)] - Equip the item on your cursor into the specified slot", AccountStatus::Guide, command_equipitem) || command_add("face", "- Change the face of your target", AccountStatus::QuestTroupe, command_face) || diff --git a/zone/gm_commands/enablerecipe.cpp b/zone/gm_commands/enablerecipe.cpp index acfa1ff93..088907a75 100755 --- a/zone/gm_commands/enablerecipe.cpp +++ b/zone/gm_commands/enablerecipe.cpp @@ -2,28 +2,28 @@ void command_enablerecipe(Client *c, const Seperator *sep) { - uint32 recipe_id = 0; - bool success = false; - if (c) { - if (sep->argnum == 1) { - recipe_id = atoi(sep->arg[1]); - } - else { - c->Message(Chat::White, "Invalid number of arguments.\nUsage: #enablerecipe recipe_id"); - return; - } - if (recipe_id > 0) { - success = content_db.EnableRecipe(recipe_id); - if (success) { - c->Message(Chat::White, "Recipe enabled."); - } - else { - c->Message(Chat::White, "Recipe not enabled."); - } - } - else { - c->Message(Chat::White, "Invalid recipe id.\nUsage: #enablerecipe recipe_id"); - } + 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() + ); +}