mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 14:41:28 +00:00
[Commands] Cleanup #enablerecipe Command. (#1817)
- Cleanup message and logic.
This commit is contained in:
parent
6fa41a3b73
commit
8b5b19ae2c
@ -165,7 +165,7 @@ int command_init(void)
|
|||||||
command_add("emotesearch", "Searches NPC Emotes", AccountStatus::QuestTroupe, command_emotesearch) ||
|
command_add("emotesearch", "Searches NPC Emotes", AccountStatus::QuestTroupe, command_emotesearch) ||
|
||||||
command_add("emoteview", "Lists all NPC Emotes", AccountStatus::QuestTroupe, command_emoteview) ||
|
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("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("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("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) ||
|
command_add("face", "- Change the face of your target", AccountStatus::QuestTroupe, command_face) ||
|
||||||
|
|||||||
@ -2,28 +2,28 @@
|
|||||||
|
|
||||||
void command_enablerecipe(Client *c, const Seperator *sep)
|
void command_enablerecipe(Client *c, const Seperator *sep)
|
||||||
{
|
{
|
||||||
uint32 recipe_id = 0;
|
int arguments = sep->argnum;
|
||||||
bool success = false;
|
if (!arguments || !sep->IsNumber(1)) {
|
||||||
if (c) {
|
c->Message(Chat::White, "Usage: #enablerecipe [Recipe ID]");
|
||||||
if (sep->argnum == 1) {
|
return;
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
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()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user