eqemu-server/zone/gm_commands/disarmtrap.cpp
Alex King aa0fbb8b45
[Commands] Cleanup #disarmtrap Command (#3713)
# Notes
- Cleanup messages and logic.
2023-11-26 00:27:22 -05:00

29 lines
690 B
C++
Executable File

#include "../client.h"
void command_disarmtrap(Client *c, const Seperator *sep)
{
Mob *t = c->GetTarget();
if (!t || !t->IsNPC()) {
c->Message(Chat::White, "You must target an NPC to use this command.");
return;
}
if (!c->HasSkill(EQ::skills::SkillDisarmTraps)) {
c->Message(Chat::White, "You do not have the Disarm Trap skill.");
return;
}
if (DistanceSquaredNoZ(c->GetPosition(), t->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse)) {
c->Message(
Chat::White,
fmt::format(
"{} is too far away.",
t->GetCleanName()
).c_str()
);
return;
}
c->HandleLDoNDisarm(t->CastToNPC(), c->GetSkill(EQ::skills::SkillDisarmTraps), LDoNTypeMechanical);
}