mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 05:21:29 +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)
|
||||
{
|
||||
int arguments = sep->argnum;
|
||||
const auto arguments = sep->argnum;
|
||||
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;
|
||||
}
|
||||
|
||||
@ -13,29 +28,36 @@ void command_setanim(Client *c, const Seperator *sep)
|
||||
target = c->GetTarget();
|
||||
}
|
||||
|
||||
|
||||
int animation_id = Strings::ToInt(sep->arg[1]);
|
||||
const auto animation_id = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[1]));
|
||||
if (
|
||||
animation_id < 0 ||
|
||||
animation_id > eaLooting
|
||||
!EQ::ValueWithin(
|
||||
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;
|
||||
}
|
||||
|
||||
target->SetAppearance(static_cast<EmuAppearance>(animation_id), false);
|
||||
std::string animation_name;
|
||||
if (animation_id == eaStanding) {
|
||||
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";
|
||||
}
|
||||
|
||||
const auto animation_name = EQ::constants::GetSpawnAnimationName(animation_id);
|
||||
|
||||
c->Message(
|
||||
Chat::White,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user