diff --git a/zone/command.cpp b/zone/command.cpp index 56816192f..120a5da4a 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -346,7 +346,7 @@ int command_init(void) command_add("viewpetition", "[petition number] - View a petition", AccountStatus::ApprenticeGuide, command_viewpetition) || command_add("viewrecipe", "[Recipe ID] - Show a recipe's entries", AccountStatus::GMAdmin, command_viewrecipe) || command_add("viewzoneloot", "[item id] - Allows you to search a zone's loot for a specific item ID. (0 shows all loot in the zone)", AccountStatus::QuestTroupe, command_viewzoneloot) || - command_add("wc", "[wear slot] [material] - Sends an OP_WearChange for your target", AccountStatus::GMMgmt, command_wc) || + command_add("wc", "[Slot ID] [Material] [Hero Forge Model] [Elite Material] - Sets the specified slot for you or your target to a material, Hero Forge Model and Elite Material are optional", AccountStatus::GMMgmt, command_wc) || command_add("weather", "[0/1/2/3] (Off/Rain/Snow/Manual) - Change the weather", AccountStatus::QuestTroupe, command_weather) || command_add("who", "[search]", AccountStatus::ApprenticeGuide, command_who) || command_add("worldshutdown", "Shut down world and all zones", AccountStatus::GMMgmt, command_worldshutdown) || diff --git a/zone/gm_commands/wc.cpp b/zone/gm_commands/wc.cpp index c9520f46a..ada629b7f 100755 --- a/zone/gm_commands/wc.cpp +++ b/zone/gm_commands/wc.cpp @@ -1,44 +1,44 @@ #include "../client.h" +#include "../../common/data_verification.h" void command_wc(Client *c, const Seperator *sep) { - if (sep->argnum < 2) { - c->Message( - 0, - "Usage: #wc [wear slot] [material] [ [hero_forge_model] [elite_material] [unknown06] [unknown18] ]" - ); + const auto arguments = sep->argnum; + if ( + arguments < 2 || + !sep->IsNumber(1) || + !sep->IsNumber(2) + ) { + c->Message(Chat::White, "Usage: #wc [Slot ID] [Material]"); + c->Message(Chat::White, "Usage: #wc [Slot ID] [Material] [Hero Forge Model] [Elite Material]"); + return; } - else if (c->GetTarget() == nullptr) { - c->Message(Chat::Red, "You must have a target to do a wear change."); + + Mob* t = c; + if (c->GetTarget()) { + t = c->GetTarget(); } - else { - uint32 hero_forge_model = 0; - uint32 wearslot = Strings::ToInt(sep->arg[1]); - // Hero Forge - if (sep->argnum > 2) { - hero_forge_model = Strings::ToInt(sep->arg[3]); + const auto slot_id = static_cast(Strings::ToUnsignedInt(sep->arg[1])); + const auto texture = static_cast(Strings::ToUnsignedInt(sep->arg[2])); + uint32 hero_forge_model = 0; + uint32 elite_material = 0; - if (hero_forge_model != 0 && hero_forge_model < 1000) { - // Shorthand Hero Forge ID. Otherwise use the value the user entered. - hero_forge_model = (hero_forge_model * 100) + wearslot; - } + if (arguments >= 3 && sep->IsNumber(3)) { + hero_forge_model = Strings::ToUnsignedInt(sep->arg[3]); + if (EQ::ValueWithin(hero_forge_model, 1, 999)) { // Shorthand Hero Forge ID. Otherwise use the value the user entered. + hero_forge_model = (hero_forge_model * 100) + slot_id; } - /* - // Leaving here to add color option to the #wc command eventually - uint32 Color; - if (c->GetTarget()->IsClient()) - Color = c->GetTarget()->GetEquipmentColor(Strings::ToInt(sep->arg[1])); - else - Color = c->GetTarget()->GetArmorTint(Strings::ToInt(sep->arg[1])); - */ - c->GetTarget()->SendTextureWC( - wearslot, - Strings::ToInt(sep->arg[2]), - hero_forge_model, - Strings::ToInt(sep->arg[4]), - Strings::ToInt(sep->arg[5]), - Strings::ToInt(sep->arg[6])); } -} + if (arguments >= 4 && sep->IsNumber(4)) { + elite_material = Strings::ToUnsignedInt(sep->arg[4]); + } + + c->GetTarget()->SendTextureWC( + slot_id, + texture, + hero_forge_model, + elite_material + ); +}