public static void UpdateAnnouncements() { foreach (ListEntry le in TCCS.TheList) { if (le == null) { continue; } if (le.Type != ListEntryType.PJUM) { continue; } //First, update locations string location; int xLong = 0, yLat = 0, xMins = 0, yMins = 0; bool xEast = false, ySouth = false; Map map = le.Mobile.Map; bool valid = Sextant.Format(le.Mobile.Location, map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth); if (valid) { location = Sextant.Format(xLong, yLat, xMins, yMins, xEast, ySouth); } else { location = "????"; } if (!valid) { location = string.Format("{0} {1}", le.Mobile.X, le.Mobile.Y); } if (map != null) { Region reg = le.Mobile.Region; if (reg != map.DefaultRegion) { location += (" in " + reg); } } le.Lines[1] = String.Format("{0} was last seen at {1}.", le.Mobile.Name, location); //Next update if no bounty PlayerMobile pm = le.Mobile as PlayerMobile; if (pm != null) { if (BountyKeeper.BountiesOnPlayer(pm) <= 0) { le.Lines[0] = String.Format("{0} is an enemy of the kingdom for unlawful resource gathering.", pm.Name); } } } }
protected override void OnTarget(Mobile from, object target) { // Mobile from must have at least 50% of Mobile target's Stealing skill double targetstealing = 0; if (target is PlayerMobile) { targetstealing = ((PlayerMobile)target).Skills[SkillName.Stealing].Value; } double skillvalue = from.Skills[SkillName.Forensics].Value; double requiredFE = targetstealing / 2; bool wanted = false; bool bonusExists = false; int amount = 0; //10 second defualt delay, reset this if invalid target from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0); if (target is Mobile) { // Bounties ---- if (target is PlayerMobile) { if (skillvalue > 80) { //foreach( Bounty b in BountyKeeper.Bounties ) //{ // if ( b.WantedPlayer == (PlayerMobile)target ) // { // wanted = true; // amount = b.Reward; // bonusExists = b.LBBonus; // } //} if (BountyKeeper.BountiesOnPlayer((PlayerMobile)target) > 0) { wanted = true; } amount = BountyKeeper.RewardForPlayer((PlayerMobile)target); bonusExists = BountyKeeper.IsEligibleForLBBonus((PlayerMobile)target); if (bonusExists) { amount += BountyKeeper.CurrentLBBonusAmount; } int infoAmount = 1; if (skillvalue > 80) { infoAmount = 1; } if (skillvalue > 95) { infoAmount = Utility.Random(1, 2); } if (skillvalue > 98) { infoAmount = Utility.Random(2, 3); } if (skillvalue == 100) { infoAmount = 3; } string whoWants = bonusExists ? "Lord British" : "an Independant Party"; switch (infoAmount) { case 0: { from.SendMessage("You don't recall any bounties out on this person."); break; } case 1: { if (wanted) { from.SendMessage("That person is wanted."); } else { from.SendMessage("That person is not wanted."); } break; } case 2: { if (wanted) { from.SendMessage("That person is wanted by {0}.", whoWants); } else { from.SendMessage("That person is not wanted."); } break; } case 3: { if (wanted) { from.SendMessage("That person is wanted by {0} for {1} GP!", whoWants, amount.ToString()); } else { from.SendMessage("That person is not wanted."); } break; } default: { if (wanted) { from.SendMessage("You don't recall any bounties out on this person."); } else { from.SendMessage("That person is not wanted."); } break; } } } else { from.SendMessage("You fail to recall any bounties out on this person."); } } else { from.SendMessage("You can not evaluate their status."); } // Theives' guild ---- // Plasma : Detection of perma grey in here too // user FE must be at least half of target's stealing if (from.CheckTargetSkill(SkillName.Forensics, target, requiredFE, 100.0)) { if (target is PlayerMobile && ((PlayerMobile)target).NpcGuild == NpcGuild.ThievesGuild) { from.SendMessage("That person is a scoundrel!"); } //from.SendLocalizedMessage( 501004 );//That individual is a thief! else { from.SendMessage("They look fairly honest.."); //pla: stop here as we don't do perma unless they are a thief return; } //from.SendLocalizedMessage( 501003 );//You notice nothing unusual. // plasma: detection routine for perma grey! // ----------------------------------------- // a) Skill vs Skill check, FE vs Staling // b) Upon success, very small (scaled with FE) chance for false information // c) Display their status bool bCriminal = false; // perma? Mobile targ = (Mobile)target; if (targ == null) { return; // just in case } // Grab steal and FE values with a bit of randomess (I stole this direct from DetectHidden.cs!) double ss = from.Skills[SkillName.Forensics].Value + Utility.Random(21) - 10; double ts = targ.Skills[SkillName.Stealing].Value + Utility.Random(21) - 10; // compare skills if (from.AccessLevel >= targ.AccessLevel && (ss >= ts)) { // is the target perma? bCriminal = (((PlayerMobile)targ).PermaFlags.Count > 0); // now a small chance for false information, scaled 1% for each % from GM FE if (Utility.RandomDouble() < (0.01 * (100 - from.Skills[SkillName.Forensics].Value + 1))) { bCriminal = !bCriminal; } // Display success message if (bCriminal) { from.SendMessage("You identify them as a criminal!"); } else { from.SendMessage("They appear to be a law abiding citizen"); } } else { //Display fail message from.SendMessage("You cannot gather enough evidence to reach a reliable conclusion on their criminal status"); } //end perma } else { // changed from SendLocalizedMessage to be more intuative from.SendMessage("You fail to determine anything useful about that individual's character."); } } else if (target is Corpse) { // Looters ---- if (from.CheckTargetSkill(SkillName.Forensics, target, 25.0, 100.0)) { Corpse c = (Corpse)target; Mobile killer = c.Killer; if (killer != null) { c.LabelTo(from, "They were killed by {0}", killer.Name); } else { c.LabelTo(from, "They were killed by no one."); } if (c.Looters.Count > 0) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < c.Looters.Count; i++) { if (((Mobile)c.Looters[i]).AccessLevel <= from.AccessLevel) { if (sb.ToString() != "") { sb.Append(", "); } sb.Append(((Mobile)c.Looters[i]).Name); } } if (sb.ToString() != "") { c.LabelTo(from, 1042752, sb.ToString()); //This body has been distrubed by ~1_PLAYER_NAMES~ } else { c.LabelTo(from, 501002); } } else { c.LabelTo(from, 501002); //The corpse has not been desecrated. } } else { from.SendLocalizedMessage(501001); //You cannot determain anything useful. } } else if (target is ILockpickable) { // Lockables ---- 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. } } else { from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(1.0); from.SendMessage("You have specified an invalid target. Try again."); from.Target = new ForensicTarget(); from.RevealingAction(); } }
protected void OnTargetWrapper(Mobile from, object target) { double skillvalue = from.Skills[SkillName.Forensics].Value; bool wanted = false; bool bonusExists = false; int amount = 0; if (target == null) //kit 12/29/06 sanity checking { from.SendMessage("You have specified an invalid target."); return; } // Packout old entries; m_Book.PackEntries(); if (target != null && target is Mobile) { if (target is PlayerMobile) { if (from == (PlayerMobile)target) { from.SendMessage("You may not add yourself to your ledger."); return; } foreach (LedgerEntry q in m_Book.Entries) { if (q == null || q.Mob == null) //kit 12/19/06 sanity check { continue; } if ((PlayerMobile)q.Mob == (PlayerMobile)target) { from.SendMessage("You may not have duplicate entries."); return; } } if (skillvalue > 80) { if (BountyKeeper.BountiesOnPlayer((PlayerMobile)target) > 0) { wanted = true; } amount = BountyKeeper.RewardForPlayer((PlayerMobile)target); bonusExists = BountyKeeper.IsEligibleForLBBonus((PlayerMobile)target); if (bonusExists) { amount += BountyKeeper.CurrentLBBonusAmount; } int infoAmount = 1; if (skillvalue > 80) { infoAmount = 1; } if (skillvalue > 95) { infoAmount = Utility.Random(1, 2); } if (skillvalue > 98) { infoAmount = Utility.Random(2, 3); } if (skillvalue == 100) { infoAmount = 3; } string whoWants = bonusExists ? "Lord British" : "an Independant Party"; switch (infoAmount) { case 0: { from.SendMessage("You don't recall any bounties out on this person."); break; } case 1: { if (wanted) { from.SendMessage("That person is wanted."); LedgerEntry e = new LedgerEntry((Mobile)target, 0, true); m_Book.AddEntry(from, e, m_Book.Entries.Count + 1); } else { from.SendMessage("That person is not wanted."); } break; } case 2: { if (wanted) { from.SendMessage("That person is wanted by {0}.", whoWants); LedgerEntry e = new LedgerEntry((Mobile)target, 0, true); m_Book.AddEntry(from, e, m_Book.Entries.Count + 1); } else { from.SendMessage("That person is not wanted."); } break; } case 3: { if (wanted) { from.SendMessage("That person is wanted by {0} for {1} GP!", whoWants, amount.ToString()); LedgerEntry e = new LedgerEntry((Mobile)target, amount, true); m_Book.AddEntry(from, e, m_Book.Entries.Count + 1); } else { from.SendMessage("That person is not wanted."); } break; } default: { if (wanted) { from.SendMessage("You don't recall any bounties out on this person."); } else { from.SendMessage("That person is not wanted."); } break; } } } else { from.SendMessage("You fail to recall any bounties out on this person."); } } else { from.SendMessage("You can not evaluate their status."); } } else if (target != null && target is Corpse) { // Looters ---- if (from.CheckTargetSkill(SkillName.Forensics, target, 25.0, 100.0)) { Corpse c = (Corpse)target; ArrayList looters = new ArrayList(); if (c.Looters.Count > 0) { foreach (Mobile mob in c.Looters) { if (mob == null) //kit 12/29/06 sanity check { continue; } if (mob is PlayerMobile) { looters.Add(mob); } } } else { c.LabelTo(from, 501002); //The corpse has not been desecrated. } if (!(c.Killer is PlayerMobile)) { c.LabelTo(from, "They were killed by {0} (NPC)", c.Killer.Name); } // Corpse Gump Management ---- if (((Body)c.Amount).IsHuman && c.Killer != null && looters != null && looters.Count > 0 && c.Killer is PlayerMobile) { from.SendGump(new ForensicChoiceGump(from, c.Killer, looters, m_Book)); return; } else if (((Body)c.Amount).IsHuman && c.Killer != null && c.Killer is PlayerMobile) { from.SendGump(new ForensicKillerGump(from, c.Killer, m_Book)); return; } else if (looters != null && looters.Count > 0) { from.SendGump(new ForensicLootGump(from, looters, 0, m_Book)); return; } } else { from.SendLocalizedMessage(501001); //You cannot determain anything useful. } } else { from.SendMessage("You have specified an invalid target. Try again."); from.Target = new AddEntryTarget(m_Book); } }