mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-02 08:26:36 +00:00
[GM Commands] Split GM Commands Into Separate Files (#1766)
* Split GM commands into their own files * Code cleanup
This commit is contained in:
Executable
+87
@@ -0,0 +1,87 @@
|
||||
#include "../client.h"
|
||||
|
||||
void command_dye(Client *c, const Seperator *sep)
|
||||
{
|
||||
int arguments = sep->argnum;
|
||||
|
||||
if (arguments == 0) {
|
||||
c->Message(Chat::White, "Command Syntax: #dye help | #dye [slot] [red] [green] [blue] [use_tint]");
|
||||
return;
|
||||
}
|
||||
|
||||
uint8 slot = 0;
|
||||
uint8 red = 255;
|
||||
uint8 green = 255;
|
||||
uint8 blue = 255;
|
||||
uint8 use_tint = 255;
|
||||
|
||||
std::vector<std::string> dye_slots = {
|
||||
"Helmet",
|
||||
"Chest",
|
||||
"Arms",
|
||||
"Wrist",
|
||||
"Hands",
|
||||
"Legs",
|
||||
"Feet"
|
||||
};
|
||||
|
||||
if (arguments == 1 && !strcasecmp(sep->arg[1], "help")) {
|
||||
int slot_id = 0;
|
||||
std::vector<std::string> slot_messages;
|
||||
c->Message(Chat::White, "Command Syntax: #dye help | #dye [slot] [red] [green] [blue] [use_tint]");
|
||||
c->Message(Chat::White, "Red, Green, and Blue go from 0 to 255.");
|
||||
|
||||
for (const auto &slot : dye_slots) {
|
||||
slot_messages.push_back(fmt::format("({}) {}", slot_id, slot));
|
||||
slot_id++;
|
||||
}
|
||||
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} {}",
|
||||
"Slots are as follows:",
|
||||
implode(", ", slot_messages)
|
||||
).c_str()
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (arguments >= 1 && sep->IsNumber(1)) {
|
||||
slot = atoi(sep->arg[1]);
|
||||
}
|
||||
|
||||
if (arguments >= 2 && sep->IsNumber(2)) {
|
||||
red = atoi(sep->arg[2]);
|
||||
}
|
||||
|
||||
if (arguments >= 3 && sep->IsNumber(3)) {
|
||||
green = atoi(sep->arg[3]);
|
||||
}
|
||||
|
||||
if (arguments >= 4 && sep->IsNumber(4)) {
|
||||
blue = atoi(sep->arg[4]);
|
||||
}
|
||||
|
||||
if (arguments >= 5 && sep->IsNumber(5)) {
|
||||
use_tint = atoi(sep->arg[5]);
|
||||
}
|
||||
|
||||
if (RuleB(Command, DyeCommandRequiresDyes)) {
|
||||
uint32 dye_item_id = 32557;
|
||||
if (c->CountItem(dye_item_id) >= 1) {
|
||||
c->RemoveItem(dye_item_id);
|
||||
}
|
||||
else {
|
||||
EQ::SayLinkEngine linker;
|
||||
linker.SetLinkType(EQ::saylink::SayLinkItemData);
|
||||
const EQ::ItemData *dye_item = database.GetItem(dye_item_id);
|
||||
linker.SetItemData(dye_item);
|
||||
c->Message(Chat::White, fmt::format("This command requires a {} to use.", linker.GenerateLink()).c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
c->DyeArmorBySlot(slot, red, green, blue, use_tint);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user