private void CheckBountyOnHead(object[] states) { var head = (BountiedHead)states[0]; var bountyHunter = (Mobile)states[1]; var bi = BountyInformation.GetBountyInformation(head.Player); if (bi == null) { Say("The reward on this scoundrel's head has already been claimed!"); head.Delete(); return; } var totalBounty = bi.Bounty; var headBounty = head.Bounty; var difference = totalBounty - headBounty; if (difference < 0) { Say("The reward on this scoundrel's head has already been claimed!"); head.Delete(); return; } bi.SubtractBounty(headBounty); AwardBounty(bountyHunter, head.PlayerName, headBounty); head.Delete(); }
public override void Cleanup() { // Remove any outdated bounties, and remove any posts made by players. Cannot deny player postings without editing BaseBulletinBoard. var validBountyPlayers = BountyInformation.GetValidBounties().Select(x => x.BountyPlayer); Items.Where(x => !validBountyPlayers.Contains(((BountyMessage)x).BountyPlayer)) .ToList() .ForEach(message => message.Delete()); }
private void GetInitialBounties() { var bountyPlayers = BountyInformation.GetValidBounties().Select(x => x.BountyPlayer); foreach (var bounty in bountyPlayers) { AddBountyToBoard(bounty); } }
public new static Container Mobile_CreateCorpseHandler(Mobile owner, HairInfo hair, FacialHairInfo facialhair, List <Item> initialContent, List <Item> equipItems) { var pm = owner as PlayerMobile; if (pm == null || BountyInformation.GetBounty(pm) <= 0) { return(Corpse.Mobile_CreateCorpseHandler(owner, hair, facialhair, initialContent, equipItems)); } Corpse c = new BountyCorpse(owner, hair, facialhair, equipItems); //UOSI Logging //MoreLogging.WriteLine(owner, "A BountyCorpse has been created!"); owner.Corpse = c; for (var i = 0; i < initialContent.Count; ++i) { var item = initialContent[i]; if (Core.AOS && item.Parent == owner.Backpack) { c.AddItem(item); } else { c.DropItem(item); } if (Core.AOS) { c.SetRestoreInfo(item, item.Location); } } if (Core.AOS) { c.RestoreEquip = pm.EquipSnapshot; } var loc = owner.Location; var map = owner.Map; if (map == null || map == Map.Internal) { loc = owner.LogoutLocation; map = owner.LogoutMap; } c.MoveToWorld(loc, map); return(c); }
public new void Carve(Mobile from, Item item) { base.Carve(from, item); var charName = Owner.Name; var itemsInRange = GetItemsInRange(0); Head oldHead = null; foreach (var it in itemsInRange) { var h = it as Head; if (h == null || h is BountiedHead || h.PlayerName != charName) { continue; } oldHead = h; break; } /* RunUO 2.2 IPooledEnumerable does not support ToList()? * var oldHead = GetItemsInRange(0) * .ToList() * .FirstOrDefault(x => x is Head && ((Head) x).PlayerName == charName);*/ if (oldHead == null) { return; } var bh = new BountiedHead(charName) { Player = Owner as PlayerMobile, Bounty = BountyInformation.GetBounty(Owner), Created = DateTime.UtcNow }; bh.MoveToWorld(oldHead.Location, oldHead.Map); oldHead.Delete(); }
public static string[] CreateDescription(Mobile bountyPlayer) { string subtext1 = null; string subtext2 = null; switch (Utility.Random(18)) { case 0: subtext1 = "hath murdered one too many!"; break; case 1: subtext1 = "shall not slay again!"; break; case 2: subtext1 = "hath slain too many!"; break; case 3: subtext1 = "cannot continue to kill!"; break; case 4: subtext1 = "must be stopped."; break; case 5: subtext1 = "is a bloodthirsty monster."; break; case 6: subtext1 = "is a killer of the worst sort."; break; case 7: subtext1 = "hath no conscience!"; break; case 8: subtext1 = "hath cowardly slain many."; break; case 9: subtext1 = "must die for all our sakes."; break; case 10: subtext1 = "sheds innocent blood!"; break; case 11: subtext1 = "must fall to preserve us."; break; case 12: subtext1 = "must be taken care of."; break; case 13: subtext1 = "is a thug and must die."; break; case 14: subtext1 = "cannot be redeemed."; break; case 15: subtext1 = "is a shameless butcher."; break; case 16: subtext1 = "is a callous monster."; break; case 17: subtext1 = "is a cruel, casual killer."; break; } switch (Utility.Random(7)) { case 0: subtext2 = "A bounty is hereby offered"; break; case 1: subtext2 = "Lord British sets a price"; break; case 2: subtext2 = "Claim the reward! 'Tis"; break; case 3: subtext2 = "Lord Blackthorn set a price"; break; case 4: subtext2 = "The Paladins set a price"; break; case 5: subtext2 = "The Merchants set a price"; break; case 6: subtext2 = "Lord British's bounty"; break; } var text = string.Format("The foul scum known as {0} {1} For {2} is responsible for {3} murders. {4} of {5} gold pieces for {6} head!", bountyPlayer.RawName, subtext1, (bountyPlayer.Body.IsFemale ? "she" : "he"), bountyPlayer.Kills, subtext2, BountyInformation.GetBounty(bountyPlayer).ToString(), (bountyPlayer.Body.IsFemale ? "her" : "his")); var current = 0; var linesList = new List <string>(); // break up the text into single line length pieces while (current < text.Length) { // make each line 25 chars long var length = text.Length - current; if (length > 25) { length = 25; while (text[current + length] != ' ') { length--; } length++; linesList.Add(text.Substring(current, length)); } else { linesList.Add(string.Format("{0} ", text.Substring(current, length))); } current += length; } return(linesList.ToArray()); }
public BountyMessage(Mobile m) : this(m, BountyInformation.GetBounty(m)) { }
public override void OnResponse(NetState state, RelayInfo info) { var from = state.Mobile; switch (info.ButtonID) { case 1: { var killer = _killers[_idx]; if (killer != null && !killer.Deleted) { killer.Kills++; killer.ShortTermMurders++; ((PlayerMobile)from).RecentlyReported.Add(killer); Timer.DelayCall(TimeSpan.FromMinutes(10), new TimerStateCallback(ReportedListExpiry_Callback), new object[] { from, killer }); var pk = (PlayerMobile)killer; if (info.GetTextEntry(1) != null) { var c = info.GetTextEntry(1); if (c != null) { var bounty = Math.Min(Utility.ToInt32(c.Text), Banker.GetBalance(from)); if (bounty > 0) { Banker.Withdraw(from, bounty); BountyInformation.AddBounty(pk, bounty, true); pk.SendMessage("{0} has placed a bounty of {1} {2} on your head!", from.Name, bounty, bounty == 1 ? "gold piece" : "gold pieces"); pk.Say(500546); // I am now bounty hunted! from.SendMessage("You place a bounty of {0}gp on {1}'s head.", bounty, pk.Name); } } } pk.ResetKillTime(); pk.SendLocalizedMessage(1049067); //You have been reported for murder! if (pk.Kills == 5) { pk.SendLocalizedMessage(502134); //You are now known as a murderer! } else if (SkillHandlers.Stealing.SuspendOnMurder && pk.Kills == 1 && pk.NpcGuild == NpcGuild.ThievesGuild) { pk.SendLocalizedMessage(501562); // You have been suspended by the Thieves Guild. } } break; } case 2: { break; } } _idx++; if (_idx < _killers.Count) { from.SendGump(new ReportMurdererBountyGump(from, _killers, _idx)); } }