[Commands] Cleanup #disarmtrap Command (#3713)

# Notes
- Cleanup messages and logic.
This commit is contained in:
Alex King 2023-11-26 00:27:22 -05:00 committed by GitHub
parent 62532c6bdd
commit aa0fbb8b45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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