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); } } } }
public override bool OnDragDrop(Mobile from, Item dropped) { bool bReturn = false; try { if (dropped is Head) { int result = 0; int goldGiven = 0; bReturn = BountyKeeper.CollectBounty((Head)dropped, from, this, ref goldGiven, ref result); switch (result) { case -2: Say("Pft.. I don't want that."); break; case -3: Say("Haha, yeah right.."); Say("I'll take that head, you just run along now."); break; case -4: //good, gold given Say(string.Format("I thank you for the business. Here's the reward of {0} gold!", goldGiven)); break; case -5: Say(string.Format("I thank you for the business, but the bounty has already been collected.")); break; default: if (bReturn) { Say("I'll take that."); } else { Say("I don't want that."); } break; } } } catch (Exception e) { LogHelper.LogException(e); System.Console.WriteLine("Error (nonfatal) in Thief.OnDragDrop(): " + e.Message); System.Console.WriteLine(e.StackTrace); } return(bReturn); }
public override bool OnDragDrop(Mobile from, Item dropped) { bool bReturn = false; if (dropped is Head) { int result = 0; int goldGiven = 0; bReturn = BountyKeeper.CollectBounty((Head)dropped, from, this, ref goldGiven, ref result); switch (result) { case -2: Say("You disgusting miscreant! Why are you giving me an innocent person's head?"); break; case -3: Say("I suspect treachery...."); Say("I'll take that head, you just run along now."); break; case -4: //good, gold given Say(string.Format("My thanks for slaying this vile person. Here's the reward of {0} gold!", goldGiven)); break; case -5: Say(string.Format("My thanks for slaying this vile person, but the bounty has already been collected.")); break; default: if (bReturn) { Say("I'll take that."); } else { Say("I don't want that."); } break; } } return(bReturn); }
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(); } }
public static void ReportAsMacroer(Mobile from, PlayerMobile pm) { string location; int xLong = 0, yLat = 0, xMins = 0, yMins = 0; bool xEast = false, ySouth = false; Map map = pm.Map; bool valid = Sextant.Format(pm.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}", pm.X, pm.Y); } if (map != null) { Region reg = pm.Region; if (reg != map.DefaultRegion) { location += (" in " + reg); } } //Output command log. if (from != null) { Server.Scripts.Commands.CommandLogging.WriteLine(from, "{0} used [Macroer command on {1}({2}) - at {3}", from.Name, pm.Name, pm.Serial, location); } if (from != null) { from.SendMessage("Reporting {0} as an AFK macroer!", pm.Name); } Account acct = pm.Account as Account; int count = 0; foreach (AccountComment comm in acct.Comments) { if (comm.Content.IndexOf(" : reported using the [macroer command") != -1) { count++; } } if (from != null) { from.SendMessage("{0} has been reported for macroing {1} times before.", pm.Name, count); } string[] lns = new string[2]; lns[0] = String.Format("A bounty has been placed on the head of {0} for unlawful resource gathering.", pm.Name); lns[1] = String.Format("{0} was last seen at {1}.", pm.Name, location); if (PJUM.HasBeenReported(pm)) { if (from != null) { from.SendMessage("{0} has already been reported.", pm.Name); } if (from == null) { // the system is automatically jailing this player. Jail.JailPlayer jt = new Jail.JailPlayer(pm, 3, "Caught macroing again within 8 hours by automated system.", false); jt.GoToJail(); } } else { // Adam: changed to 4 hours from 8 PJUM.AddMacroer(lns, pm, DateTime.Now + TimeSpan.FromHours(4)); //Add bounty to player string name = String.Format("Officer {0}", Utility.RandomBool() ? NameList.RandomName("male") : NameList.RandomName("female")); int bountyAmount = 0; Container cont = pm.BankBox; if (cont != null) { int iAmountInBank = 0; Item[] golds = cont.FindItemsByType(typeof(Gold), true); foreach (Item g in golds) { iAmountInBank += g.Amount; } int min = Math.Min(iAmountInBank, 1000); int max = Math.Min(iAmountInBank, 3000); int randomAmount = Utility.RandomMinMax(min, max); if (cont.ConsumeTotal(typeof(Gold), randomAmount)) { bountyAmount = randomAmount; } } if (bountyAmount < 1500) { bountyAmount = Utility.RandomMinMax(1000, 3000); } Bounty bounty = null; if (from != null) { bounty = new Bounty((PlayerMobile)from, pm, bountyAmount, name); } else { bounty = new Bounty(null, pm, bountyAmount, name); } if (bounty != null) { BountyKeeper.Add(bounty); } //Add comment to account Account acc = pm.Account as Account; string comment = String.Format("On {0}, {1} caught {2} unattended macroing at {3} : reported using the [macroer command", DateTime.Now, from != null?from.Name:"auto-RTT", pm.Name, location); acc.Comments.Add(new AccountComment(from != null ? from.Name : "auto-RTT", comment)); } }
public static void ReportAsMacroer(Mobile from, PlayerMobile pm) { string location; int xLong = 0, yLat = 0, xMins = 0, yMins = 0; bool xEast = false, ySouth = false; Map map = pm.Map; bool valid = Sextant.Format(pm.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}", pm.X, pm.Y); } if (map != null) { Region reg = pm.Region; if (reg != map.DefaultRegion) { location += (" in " + reg); } } //Output command log. if (from != null) { Server.Commands.CommandLogging.WriteLine(from, "{0} used [Macroer command on {1}({2}) - at {3}", from.Name, pm.Name, pm.Serial, location); } if (from != null) { from.SendMessage("Reporting {0} as an AFK macroer!", pm.Name); } Account acct = pm.Account as Account; int count = 0; foreach (AccountComment comm in acct.Comments) { if (comm.Content.IndexOf(" : reported using the [macroer command") != -1) { count++; } } if (from != null) { from.SendMessage("{0} has been reported for macroing {1} times before.", pm.Name, count); } if (PJUM.HasBeenReported(pm)) { if (from != null) { from.SendMessage("{0} has already been reported.", pm.Name); } if (from == null) { // the system is automatically jailing this player. Jail.JailPlayer jt = new Jail.JailPlayer(pm, 3, "Caught macroing again within 8 hours by automated system.", false); jt.GoToJail(); } } else { string[] lns = new string[2]; // make the message reflect whether or not there is an actual/reasonable bounty if (HasGold(pm) > 100 || BountyKeeper.CurrentLBBonusAmount > 100) { lns[0] = String.Format("A bounty has been placed on the head of {0} for unlawful resource gathering.", pm.Name); } else { lns[0] = String.Format("{0} is an enemy of the kingdom for unlawful resource gathering.", pm.Name); } lns[1] = String.Format("{0} was last seen at {1}.", pm.Name, location); // Adam: changed to 4 hours from 8 ListEntry TCTextHandle = PJUM.AddMacroer(lns, pm, DateTime.Now + TimeSpan.FromHours(4)); //Add bounty to player string name = String.Format("Officer {0}", Utility.RandomBool() ? NameList.RandomName("male") : NameList.RandomName("female")); int bountyAmount = 0; Container cont = pm.BankBox; if (cont != null) { int iAmountInBank = 0; Item[] golds = cont.FindItemsByType(typeof(Gold), true); foreach (Item g in golds) { iAmountInBank += g.Amount; } int randomAmount = Utility.RandomMinMax(iAmountInBank / 2, iAmountInBank); if (cont.ConsumeTotal(typeof(Gold), randomAmount)) { bountyAmount = randomAmount; } } // note, from can be null (which is fine) Bounty bounty = null; bounty = new Bounty(from as PlayerMobile, pm, bountyAmount, name); if (bounty != null) { // associate the town crier message with thie bounty so we can update the message once the bounty is collected. bounty.TownCrierEntryID = TCTextHandle.EntryID; BountyKeeper.Add(bounty); } //Add comment to account Account acc = pm.Account as Account; string comment = String.Format("On {0}, {1} caught {2} unattended macroing at {3} : reported using the [macroer command", DateTime.Now, from != null ? from.Name : "auto-RTT", pm.Name, location); acc.Comments.Add(new AccountComment(from != null ? from.Name : "RTT SYSTEM", comment)); } }
protected override void OnTarget(Mobile from, object targ) { if (targ is PlayerMobile) { try { PlayerMobile pm = (PlayerMobile)targ; string location; int xLong = 0, yLat = 0, xMins = 0, yMins = 0; bool xEast = false, ySouth = false; Map map = pm.Map; bool valid = Sextant.Format(pm.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}", pm.X, pm.Y); } if (map != null) { Region reg = pm.Region; if (reg != map.DefaultRegion) { location += (" in " + reg); } } //Output command log. Server.Scripts.Commands.CommandLogging.WriteLine(from, "{0} used [ibanthee command on {1}({2}) - at {3}", from.Name, pm.Name, pm.Serial, location); from.SendMessage("Reporting {0} as Banned!", pm.Name); string[] lns = new string[2]; lns[0] = String.Format("A bounty has been placed on the head of {0} for disrupting a royal tournament. .", pm.Name); lns[1] = String.Format("{0} was last seen at {1}.", pm.Name, location); if (PJUM.HasBeenReported(pm)) { from.SendMessage("{0} has already been reported.", pm.Name); } else { //move player to outside arena pm.MoveToWorld(new Point3D(353, 905, 0), Map.Felucca); PJUM.AddMacroer(lns, pm, DateTime.Now + TimeSpan.FromHours(2)); //Add bounty to player string name = String.Format("Officer {0}", Utility.RandomBool() ? NameList.RandomName("male") : NameList.RandomName("female")); int bountyAmount = 0; Container cont = pm.BankBox; if (cont != null) { int iAmountInBank = 0; Item[] golds = cont.FindItemsByType(typeof(Gold), true); foreach (Item g in golds) { iAmountInBank += g.Amount; } int min = Math.Min(iAmountInBank, 1000); int max = Math.Min(iAmountInBank, 3000); int randomAmount = Utility.RandomMinMax(min, max); if (cont.ConsumeTotal(typeof(Gold), randomAmount)) { bountyAmount = randomAmount; } } if (bountyAmount == 0) { bountyAmount = 100; } Bounty bounty = new Bounty((PlayerMobile)from, pm, bountyAmount, name); BountyKeeper.Add(bounty); //Add comment to account Account acc = pm.Account as Account; string comment = String.Format("On {0}, {1} caught {2} disturbing event at {3} : removed using the [ibanthee command", DateTime.Now, from.Name, pm.Name, location); acc.Comments.Add(new AccountComment(from.Name, comment)); } } catch (Exception except) { LogHelper.LogException(except); System.Console.WriteLine("Caught exception in [ibanthee command: {0}", except.Message); System.Console.WriteLine(except.StackTrace); } } else { from.SendMessage("Only players can be banned."); } }
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); } }