// Tinker Traps (Start). // ===================== public static bool DetectTinkerTrap(Mobile mobile, Point3D location, int range) { IPooledEnumerable itemsInRange = mobile.Map.GetItemsInRange(location, range); foreach (Item item in itemsInRange) { if (item is BaseTinkerTrap) { BaseTinkerTrap trap = (BaseTinkerTrap)item; double detectMin = trap.DisarmingSkillReq - 10; double detectMax = trap.DisarmingSkillReq + 10; if ((mobile.CheckTargetSkill(SkillName.DetectHidden, trap, detectMin, detectMax)) || (trap.Owner == mobile)) { trap.Visible = true; return(true); } return(false); } return(false); } itemsInRange.Free(); return(false); }
protected override void OnTarget(Mobile from, object target) { if (target is Mobile) { if (from.CheckTargetSkill(SkillName.Forensics, target, 40.0, 100.0)) { if (target is PlayerMobile && ((PlayerMobile)target).NpcGuild == NpcGuild.ThievesGuild) { from.SendLocalizedMessage(501004);//That individual is a thief! } else { from.SendLocalizedMessage(501003);//You notice nothing unusual. } } else { from.SendLocalizedMessage(501001);//You cannot determain anything useful. } } else if (target is Corpse) { if (from.CheckTargetSkill(SkillName.Forensics, target, 0.0, 100.0)) { Corpse c = (Corpse)target; if (c.m_Forensicist != null) { from.SendLocalizedMessage(1042750, c.m_Forensicist); // The forensicist ~1_NAME~ has already discovered that: } else { c.m_Forensicist = from.Name; } if (((Body)c.Amount).IsHuman) { from.SendLocalizedMessage(1042751, (c.Killer == null ? "no one" : c.Killer.Name));//This person was killed by ~1_KILLER_NAME~ } if (c.Looters.Count > 0) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < c.Looters.Count; i++) { if (i > 0) { sb.Append(", "); } sb.Append(((Mobile)c.Looters[i]).Name); } from.SendLocalizedMessage(1042752, sb.ToString());//This body has been distrubed by ~1_PLAYER_NAMES~ } else { from.SendLocalizedMessage(501002);//The corpse has not be desecrated. } } else { from.SendLocalizedMessage(501001);//You cannot determain anything useful. } } else if (target is ILockpickable) { ILockpickable p = (ILockpickable)target; if (p.Picker != null) { from.SendLocalizedMessage(1042749, p.Picker.Name);//This lock was opened by ~1_PICKER_NAME~ } else { from.SendLocalizedMessage(501003);//You notice nothing unusual. } } // Tinker Traps (Start). // ===================== else if (target is BaseTinkerTrap) { BaseTinkerTrap tt = (BaseTinkerTrap)target; if ((from.CheckTargetSkill(SkillName.Forensics, target, 0.0, 100.0)) || (tt.Owner == from)) { StringBuilder sb = new StringBuilder(); if (tt.Owner == null) { sb.Append("This trap is pristine and unused."); } else if (tt.Owner == from) { if (tt.TrapArmed) { sb.Append("You set this trap."); } else { sb.Append("You own this trap."); } } else { if (tt.TrapArmed) { sb.Append("This trap was set by "); } else { sb.Append("This trap is owned by "); } sb.Append(tt.Owner.Name); sb.Append("."); } from.SendMessage(sb.ToString()); } else { from.SendLocalizedMessage(501001); //You cannot determain anything useful. } } // ================== // Tinker Traps (End) }