Chris Miles 4fa9e1d66f
[Code Cleanup] Race constants refactor (#3782)
* [Code Cleanup] Race constants refactor

* Update races.h
2023-12-22 21:34:55 -06:00

58 lines
1.0 KiB
C++
Executable File

#include "../../client.h"
void SetRace(Client *c, const Seperator *sep)
{
const auto arguments = sep->argnum;
if (arguments < 2 || !sep->IsNumber(2)) {
c->Message(
Chat::White,
fmt::format(
"Usage: #set race [0-{}, 2253-2259] (0 for back to normal)",
RuleI(NPC, MaxRaceID)
).c_str()
);
return;
}
Mob* t = c;
if (c->GetTarget()) {
t = c->GetTarget();
}
const uint16 race_id = Strings::ToUnsignedInt(sep->arg[2]);
if (
!EQ::ValueWithin(race_id, Race::Doug, RuleI(NPC, MaxRaceID)) &&
!EQ::ValueWithin(race_id, 2253, 2259)
) {
c->Message(
Chat::White,
fmt::format(
"Usage: #race [0-{}, 2253-2259] (0 for back to normal)",
RuleI(NPC, MaxRaceID)
).c_str()
);
return;
}
t->SendIllusionPacket(
AppearanceStruct{
.race_id = race_id,
.size = t->GetSize(),
}
);
c->Message(
Chat::White,
fmt::format(
"{} {} now temporarily a(n) {} ({}).",
c->GetTargetDescription(t, TargetDescriptionType::UCYou),
c == t ? "are" : "is",
GetRaceIDName(race_id),
race_id
).c_str()
);
}