diff --git a/zone/gm_commands/sensetrap.cpp b/zone/gm_commands/sensetrap.cpp index 792d7867d..03363c06f 100755 --- a/zone/gm_commands/sensetrap.cpp +++ b/zone/gm_commands/sensetrap.cpp @@ -2,23 +2,29 @@ void command_sensetrap(Client *c, const Seperator *sep) { - Mob *target = c->GetTarget(); - if (!target) { - c->Message(Chat::Red, "You must have a target."); + if (!c->GetTarget() || !c->GetTarget()->IsNPC()) { + c->Message(Chat::White, "You must target an NPC to use this command."); return; } - if (target->IsNPC()) { - if (c->HasSkill(EQ::skills::SkillSenseTraps)) { - if (DistanceSquaredNoZ(c->GetPosition(), target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse)) { - c->Message(Chat::Red, "%s is too far away.", target->GetCleanName()); - return; - } - c->HandleLDoNSenseTraps(target->CastToNPC(), c->GetSkill(EQ::skills::SkillSenseTraps), LDoNTypeMechanical); - } - else { - c->Message(Chat::Red, "You do not have the sense traps skill."); - } + auto target = c->GetTarget()->CastToNPC(); + + if (!c->HasSkill(EQ::skills::SkillSenseTraps)) { + c->Message(Chat::White, "You do not have the Sense Traps skill."); + return; } + + if (DistanceSquaredNoZ(c->GetPosition(), target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse)) { + c->Message( + Chat::White, + fmt::format( + "{} ({}) is too far away.", + target->GetCleanName(), + target->GetID() + ).c_str() + ); + } + + c->HandleLDoNSenseTraps(target, c->GetSkill(EQ::skills::SkillSenseTraps), LDoNTypeMechanical); }