diff --git a/zone/command.cpp b/zone/command.cpp index af5cb680a..14a2d06aa 100755 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -363,7 +363,7 @@ int command_init(void) command_add("tattoo", "- Change the tattoo of your target (Drakkin Only)", AccountStatus::QuestTroupe, command_tattoo) || command_add("tempname", "[newname] - Temporarily renames your target. Leave name blank to restore the original name.", AccountStatus::GMAdmin, command_tempname) || command_add("petname", "[newname] - Temporarily renames your pet. Leave name blank to restore the original name.", AccountStatus::GMAdmin, command_petname) || - command_add("texture", "[texture] [helmtexture] - Change your or your target's appearance, use 255 to show equipment", AccountStatus::Steward, command_texture) || + command_add("texture", "[Texture] [Helmet Texture] - Change your or your target's texture (Helmet Texture defaults to 0 if not used)", AccountStatus::Steward, command_texture) || command_add("time", "[HH] [MM] - Set EQ time", AccountStatus::EQSupport, command_time) || command_add("timers", "- Display persistent timers for target", AccountStatus::GMMgmt, command_timers) || command_add("timezone", "[HH] [MM] - Set timezone. Minutes are optional", AccountStatus::EQSupport, command_timezone) || diff --git a/zone/gm_commands/texture.cpp b/zone/gm_commands/texture.cpp index d6fdf252c..09f00df4b 100755 --- a/zone/gm_commands/texture.cpp +++ b/zone/gm_commands/texture.cpp @@ -2,51 +2,64 @@ void command_texture(Client *c, const Seperator *sep) { - - uint16 texture; - - if (sep->IsNumber(1) && atoi(sep->arg[1]) >= 0 && atoi(sep->arg[1]) <= 255) { - texture = atoi(sep->arg[1]); - uint8 helm = 0xFF; - - // Player Races Wear Armor, so Wearchange is sent instead - int i; - if (!c->GetTarget()) { - for (i = EQ::textures::textureBegin; i <= EQ::textures::LastTintableTexture; i++) { - c->SendTextureWC(i, texture); - } - } - else if ((c->GetTarget()->GetModel() > 0 && c->GetTarget()->GetModel() <= 12) || - c->GetTarget()->GetModel() == 128 || c->GetTarget()->GetModel() == 130 || - c->GetTarget()->GetModel() == 330 || c->GetTarget()->GetModel() == 522) { - for (i = EQ::textures::textureBegin; i <= EQ::textures::LastTintableTexture; i++) { - c->GetTarget()->SendTextureWC(i, texture); - } - } - else // Non-Player Races only need Illusion Packets to be sent for texture - { - if (sep->IsNumber(2) && atoi(sep->arg[2]) >= 0 && atoi(sep->arg[2]) <= 255) { - helm = atoi(sep->arg[2]); - } - else { - helm = texture; - } - - if (texture == 255) { - texture = 0xFFFF; // Should be pulling these from the database instead - helm = 0xFF; - } - - if ((c->GetTarget()) && (c->Admin() >= commandTextureOthers)) { - c->GetTarget()->SendIllusionPacket(c->GetTarget()->GetModel(), 0xFF, texture, helm); - } - else { - c->SendIllusionPacket(c->GetRace(), 0xFF, texture, helm); - } - } + int arguments = sep->argnum; + if (!arguments || !sep->IsNumber(1)) { + c->Message(Chat::White, "Usage: #texture [Texture] [Helmet Texture]"); + return; } - else { - c->Message(Chat::White, "Usage: #texture [texture] [helmtexture] (0-255, 255 for show equipment)"); + + auto texture = static_cast(std::min(std::stoul(sep->arg[1]), (unsigned long) 65535)); + auto helmet_texture = static_cast( + sep->IsNumber(2) ? + std::min(std::stoul(sep->arg[2]), (unsigned long) 255) : + 0 + ); + + Mob* target = c; + if (c->GetTarget() && c->Admin() >= commandTextureOthers) { + target = c->GetTarget(); } + + if (Mob::IsPlayerRace(target->GetModel())) { // Player Races Wear Armor, so Wearchange is sent instead + for ( + int texture_slot = EQ::textures::textureBegin; + texture_slot <= EQ::textures::LastTintableTexture; + texture_slot++ + ) { + target->SendTextureWC(texture_slot, texture); + } + } else { // Non-Player Races only need Illusion Packets to be sent for texture + target->SendIllusionPacket( + target->GetModel(), + target->GetGender(), + texture, + helmet_texture + ); + } + + c->Message( + Chat::White, + fmt::format( + "Texture Changed for {} | Texture: {}{}", + ( + c == target ? + "Yourself" : + fmt::format( + "{} ({})", + target->GetCleanName(), + target->GetID() + ) + ), + texture, + ( + Mob::IsPlayerRace(target->GetModel()) ? + "" : + fmt::format( + " Helmet Texture: {}", + helmet_texture + ) + ) + ).c_str() + ); }