mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +00:00
[Commands] Cleanup #setanim (#3350)
# Notes - Make use of constants instead of hard-coded strings.
This commit is contained in:
parent
9993022418
commit
67fdc75df3
@ -2,9 +2,24 @@
|
|||||||
|
|
||||||
void command_setanim(Client *c, const Seperator *sep)
|
void command_setanim(Client *c, const Seperator *sep)
|
||||||
{
|
{
|
||||||
int arguments = sep->argnum;
|
const auto arguments = sep->argnum;
|
||||||
if (!arguments || !sep->IsNumber(1)) {
|
if (!arguments || !sep->IsNumber(1)) {
|
||||||
c->Message(Chat::White, "Usage: #setanim [Animation ID (IDs are 0 to 4)]");
|
c->Message(Chat::White, "Usage: #setanim [Animation ID]");
|
||||||
|
|
||||||
|
uint32 animation_number = 1;
|
||||||
|
for (const auto& a : EQ::constants::GetSpawnAnimationMap()) {
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"Animation {} | ID: {} Name: {}",
|
||||||
|
animation_number,
|
||||||
|
a.first,
|
||||||
|
a.second
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
|
||||||
|
animation_number++;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -13,29 +28,36 @@ void command_setanim(Client *c, const Seperator *sep)
|
|||||||
target = c->GetTarget();
|
target = c->GetTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto animation_id = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[1]));
|
||||||
int animation_id = Strings::ToInt(sep->arg[1]);
|
|
||||||
if (
|
if (
|
||||||
animation_id < 0 ||
|
!EQ::ValueWithin(
|
||||||
animation_id > eaLooting
|
animation_id,
|
||||||
|
static_cast<uint8>(eaStanding),
|
||||||
|
static_cast<uint8>(eaLooting)
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
c->Message(Chat::White, "Usage: #setanim [Animation ID (IDs are 0 to 4)]");
|
c->Message(Chat::White, "Usage: #setanim [Animation ID]");
|
||||||
|
|
||||||
|
uint32 animation_number = 1;
|
||||||
|
for (const auto& a : EQ::constants::GetSpawnAnimationMap()) {
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"Animation {} | ID: {} Name: {}",
|
||||||
|
animation_number,
|
||||||
|
a.first,
|
||||||
|
a.second
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
|
||||||
|
animation_number++;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
target->SetAppearance(static_cast<EmuAppearance>(animation_id), false);
|
target->SetAppearance(static_cast<EmuAppearance>(animation_id), false);
|
||||||
std::string animation_name;
|
|
||||||
if (animation_id == eaStanding) {
|
const auto animation_name = EQ::constants::GetSpawnAnimationName(animation_id);
|
||||||
animation_name = "Standing";
|
|
||||||
} else if (animation_id == eaSitting) {
|
|
||||||
animation_name = "Sitting";
|
|
||||||
} else if (animation_id == eaCrouching) {
|
|
||||||
animation_name = "Crouching";
|
|
||||||
} else if (animation_id == eaDead) {
|
|
||||||
animation_name = "Dead";
|
|
||||||
} else if (animation_id == eaLooting) {
|
|
||||||
animation_name = "Looting";
|
|
||||||
}
|
|
||||||
|
|
||||||
c->Message(
|
c->Message(
|
||||||
Chat::White,
|
Chat::White,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user