mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
* [Bug Fix] Fix Appearance Issues # Notes - Changing race, gender, or texture of a Mob could result in it changing sizes due to use not sending the size as part of the appearance packet. - Also converts the parameterized method to a struct parameter so that we can optionally send things without back-filling multiple arguments. * Gender cleanup. * Fix. * Formatting.
42 lines
932 B
C++
Executable File
42 lines
932 B
C++
Executable File
#include "../../client.h"
|
|
|
|
void SetGender(Client *c, const Seperator *sep)
|
|
{
|
|
const auto arguments = sep->argnum;
|
|
if (arguments < 2 || !sep->IsNumber(2)) {
|
|
c->Message(Chat::White, "Usage: #set gender [Gender ID]");
|
|
c->Message(Chat::White, "Genders: 0 = Male, 1 = Female, 2 = Neuter");
|
|
return;
|
|
}
|
|
|
|
Mob *t = c;
|
|
if (c->GetTarget()) {
|
|
t = c->GetTarget();
|
|
}
|
|
|
|
const uint8 gender_id = Strings::ToUnsignedInt(sep->arg[2]);
|
|
if (!EQ::ValueWithin(gender_id, MALE, NEUTER)) {
|
|
c->Message(Chat::White, "Usage: #set gender [Gender ID]");
|
|
c->Message(Chat::White, "Genders: 0 = Male, 1 = Female, 2 = Neuter");
|
|
return;
|
|
}
|
|
|
|
t->SendIllusionPacket(
|
|
AppearanceStruct{
|
|
.gender_id = gender_id,
|
|
.race_id = t->GetRace(),
|
|
.size = t->GetSize(),
|
|
}
|
|
);
|
|
|
|
c->Message(
|
|
Chat::White,
|
|
fmt::format(
|
|
"Gender changed for {} to {} ({}).",
|
|
c->GetTargetDescription(t),
|
|
GetGenderName(gender_id),
|
|
gender_id
|
|
).c_str()
|
|
);
|
|
}
|