protected override void OnTarget(Mobile src, object targ) { bool foundAnyone = false; Point3D p; if (targ is Mobile) { p = ((Mobile)targ).Location; } else if (targ is Item) { p = ((Item)targ).Location; } else if (targ is IPoint3D) { p = new Point3D((IPoint3D)targ); } else { p = src.Location; } double srcSkill = src.Skills[SkillName.DetectHidden].Value; int range = (int)(srcSkill / 10.0); // Checking for hidden stashes is free IPooledEnumerable itemsInRange = src.Map.GetItemsInRange(p, 1); foreach (Item item in itemsInRange) { if (item is HiddenStash) { HiddenStash stash = (HiddenStash)item; src.SendMessage("You inspect the area closely, and find a hidden stash."); stash.Visible = true; stash.BeginConceal(); foundAnyone = true; } } if (!src.CheckSkill(SkillName.DetectHidden, 0.0, 100.0)) { range /= 2; } if (range > 0) { IPooledEnumerable inRange = src.Map.GetMobilesInRange(p, range); foreach (Mobile trg in inRange) { if (trg.Hidden && src != trg) { double ss = srcSkill + Utility.Random(21) - 10; double ts = trg.Skills[SkillName.Hiding].Value + Utility.Random(21) - 10; if (src.AccessLevel >= trg.AccessLevel && ss >= ts) { if (trg is ShadowKnight && (trg.X != p.X || trg.Y != p.Y)) { continue; } trg.RevealingAction(); trg.SendLocalizedMessage(500814); // You have been revealed! foundAnyone = true; } } } inRange.Free(); itemsInRange = src.Map.GetItemsInRange(p, range); foreach (Item item in itemsInRange) { if (item is BaseMine) { BaseMine trap = (BaseMine)item; if (src.CheckTargetSkill(SkillName.DetectHidden, trap, 00.0, 100.0)) { src.SendMessage("You inspect the area closely, and find a trap."); trap.Visible = true; trap.BeginConceal(); foundAnyone = true; } } } itemsInRange.Free(); } if (!foundAnyone) { src.SendLocalizedMessage(500817); // You can see nothing hidden there. } }
protected override void OnTarget(Mobile from, object targeted) { TrapRemovalKit kit = (from.Backpack == null ? null : from.Backpack.FindItemByType(typeof(TrapRemovalKit)) as TrapRemovalKit); if (kit == null) { from.SendMessage("You need a trap removal kit to disarm that."); } else if (targeted is Mobile) { from.SendLocalizedMessage(502816); // You feel that such an action would be inappropriate } else if (targeted is TrapableContainer) { TrapableContainer targ = (TrapableContainer)targeted; from.Direction = from.GetDirectionTo(targ); if (targ.TrapType == TrapType.None) { from.SendLocalizedMessage(502373); // That doesn't appear to be trapped return; } from.PlaySound(0x241); if (from.CheckTargetSkill(SkillName.RemoveTrap, targ, targ.TrapPower, targ.TrapPower + 30)) { targ.TrapPower = 0; targ.TrapLevel = 0; targ.TrapType = TrapType.None; from.SendLocalizedMessage(502377); // You successfully render the trap harmless kit.ConsumeCharge(from); } else { from.SendLocalizedMessage(502372); // You fail to disarm the trap... but you don't set it off } } else if (targeted is BaseMine) { BaseMine trap = (BaseMine)targeted; bool isOwner = trap.Placer == from; if (from.CheckTargetSkill(SkillName.RemoveTrap, trap, 80.0, 100.0) && from.CheckTargetSkill(SkillName.Tinkering, trap, 80.0, 100.0)) { from.PrivateOverheadMessage(MessageType.Regular, trap.MessageHue, trap.DisarmMessage, from.NetState); trap.Delete(); } else { from.SendLocalizedMessage(502372); // You fail to disarm the trap... but you don't set it off } kit.ConsumeCharge(from); } else { from.SendLocalizedMessage(502373); // That does'nt appear to be trapped } }