diff --git a/zone/command.cpp b/zone/command.cpp index 1a3d1e66c..178f4d8d1 100755 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -321,7 +321,7 @@ int command_init(void) command_add("setaapts", "[AA|Group|Raid] [AA Amount] - Set your or your player target's Available AA Points by Type", AccountStatus::GMAdmin, command_setaapts) || command_add("setaaxp", "[AA|Group|Raid] [AA Experience] - Set your or your player target's AA Experience by Type", AccountStatus::GMAdmin, command_setaaxp) || command_add("setadventurepoints", "- Set your or your player target's available adventure points", AccountStatus::GMLeadAdmin, command_set_adventure_points) || - command_add("setanim", "[animnum] - Set target's appearance to animnum", AccountStatus::GMMgmt, command_setanim) || + command_add("setanim", "[Animation ID (IDs are 0 to 4)] - Set target's appearance to Animation ID", AccountStatus::GMMgmt, command_setanim) || command_add("setcrystals", "[value] - Set your or your player target's available radiant or ebon crystals", AccountStatus::GMAdmin, command_setcrystals) || command_add("setfaction", "[faction number] - Sets targeted NPC's faction in the database", AccountStatus::GMAreas, command_setfaction) || command_add("setgraveyard", "[zone name] - Creates a graveyard for the specified zone based on your target's LOC.", AccountStatus::GMMgmt, command_setgraveyard) || diff --git a/zone/gm_commands/setanim.cpp b/zone/gm_commands/setanim.cpp index d7ffa11e7..63b925166 100755 --- a/zone/gm_commands/setanim.cpp +++ b/zone/gm_commands/setanim.cpp @@ -2,15 +2,57 @@ void command_setanim(Client *c, const Seperator *sep) { - if (c->GetTarget() && sep->IsNumber(1)) { - int num = atoi(sep->arg[1]); - if (num < 0 || num >= _eaMaxAppearance) { - c->Message(Chat::White, "Invalid animation number, between 0 and %d", _eaMaxAppearance - 1); - } - c->GetTarget()->SetAppearance(EmuAppearance(num)); + int arguments = sep->argnum; + if (!arguments || !sep->IsNumber(1)) { + c->Message(Chat::White, "Usage: #setanim [Animation ID (IDs are 0 to 4)]"); + return; } - else { - c->Message(Chat::White, "Usage: #setanim [animnum]"); + + Mob* target = c; + if (c->GetTarget()) { + target = c->GetTarget(); } + + + int animation_id = std::stoi(sep->arg[1]); + if ( + animation_id < 0 || + animation_id > eaLooting + ) { + c->Message(Chat::White, "Usage: #setanim [Animation ID (IDs are 0 to 4)]"); + return; + } + + target->SetAppearance(static_cast(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"; + } + + c->Message( + Chat::White, + fmt::format( + "Set animation to {} ({}) for {}.", + animation_name, + animation_id, + ( + c == target ? + "yourself" : + fmt::format( + "{} ({})", + target->GetCleanName(), + target->GetID() + ).c_str() + ) + ).c_str() + ); } diff --git a/zone/mob.cpp b/zone/mob.cpp index faea82b8e..834ad6646 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2999,12 +2999,15 @@ const int32& Mob::SetMana(int32 amount) void Mob::SetAppearance(EmuAppearance app, bool iIgnoreSelf) { - if (_appearance == app) + if (_appearance == app) { return; + } + _appearance = app; SendAppearancePacket(AT_Anim, GetAppearanceValue(app), true, iIgnoreSelf); - if (this->IsClient() && this->IsAIControlled()) + if (IsClient() && IsAIControlled()) { SendAppearancePacket(AT_Anim, ANIM_FREEZE, false, false); + } } bool Mob::UpdateActiveLight()