[Commands] Cleanup #wc Command (#3049)

# Notes
- Cleanup messages and logic.
This commit is contained in:
Alex King 2023-03-05 22:18:35 -05:00 committed by GitHub
parent 67df6f62b7
commit a90d41480a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 34 deletions

View File

@ -346,7 +346,7 @@ int command_init(void)
command_add("viewpetition", "[petition number] - View a petition", AccountStatus::ApprenticeGuide, command_viewpetition) || 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("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("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("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("who", "[search]", AccountStatus::ApprenticeGuide, command_who) ||
command_add("worldshutdown", "Shut down world and all zones", AccountStatus::GMMgmt, command_worldshutdown) || command_add("worldshutdown", "Shut down world and all zones", AccountStatus::GMMgmt, command_worldshutdown) ||

View File

@ -1,44 +1,44 @@
#include "../client.h" #include "../client.h"
#include "../../common/data_verification.h"
void command_wc(Client *c, const Seperator *sep) void command_wc(Client *c, const Seperator *sep)
{ {
if (sep->argnum < 2) { const auto arguments = sep->argnum;
c->Message( if (
0, arguments < 2 ||
"Usage: #wc [wear slot] [material] [ [hero_forge_model] [elite_material] [unknown06] [unknown18] ]" !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 {
const auto slot_id = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[1]));
const auto texture = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[2]));
uint32 hero_forge_model = 0; uint32 hero_forge_model = 0;
uint32 wearslot = Strings::ToInt(sep->arg[1]); uint32 elite_material = 0;
// Hero Forge if (arguments >= 3 && sep->IsNumber(3)) {
if (sep->argnum > 2) { hero_forge_model = Strings::ToUnsignedInt(sep->arg[3]);
hero_forge_model = Strings::ToInt(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;
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;
} }
} }
/*
// Leaving here to add color option to the #wc command eventually if (arguments >= 4 && sep->IsNumber(4)) {
uint32 Color; elite_material = Strings::ToUnsignedInt(sep->arg[4]);
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( c->GetTarget()->SendTextureWC(
wearslot, slot_id,
Strings::ToInt(sep->arg[2]), texture,
hero_forge_model, hero_forge_model,
Strings::ToInt(sep->arg[4]), elite_material
Strings::ToInt(sep->arg[5]), );
Strings::ToInt(sep->arg[6]));
}
} }