Ejemplo n.º 1
0
        public static void OnLoad( )
        {
            if (DEBUG)
            {
                Console.WriteLine("Bounty Loading...");
            }

            string filePath = Path.Combine("Saves/BountySystem", "Bounty.xml");

            if (!File.Exists(filePath))
            {
                m_LBFundAmount = 1000;
                return;
            }

            try
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(filePath);

                XmlElement root = doc["Bounties"];

                try
                {
                    string strFund = root.GetAttribute("LBFund");
                    m_LBFundAmount = Int32.Parse(strFund);
                }
                catch
                {
                    m_LBFundAmount = 1000;
                }

                foreach (XmlElement bounty in root.GetElementsByTagName("bounty"))
                {
                    try
                    {
                        Bounty b = new Bounty(bounty);

                        if (b.WantedPlayer != null &&
                            b.Reward > 0 &&
                            b.RewardDate <= DateTime.Now)
                        {
                            m_bounties.Add(b);
                        }
                    }
                    catch
                    {
                        Console.WriteLine("Warning: A bounty instance load failed");
                    }
                }
            }
            catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); }
        }
Ejemplo n.º 2
0
 public static void Remove(Bounty b)
 {
     m_bounties.Remove(b);
 }
Ejemplo n.º 3
0
 public static void Add(Bounty b)
 {
     m_bounties.Add(b);
 }
Ejemplo n.º 4
0
		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));
			}
		}
Ejemplo n.º 5
0
        public BountyDisplayGump(Mobile from, int page) : base(50, 10)
        {
            from.CloseGump(typeof(BountyDisplayGump));
            m_Page = page;
            m_From = from;

            AddPage(0);
            AddImage(30, 30, 5400);
            if (BountyKeeper.NumberOfUniqueBounties != 0)                    //only put scroll-up and scroll-down if there are bounties
            {
                AddButton(393, 145, 2084, 2084, 4, GumpButtonType.Reply, 0); // Scroll up
                AddButton(390, 371, 2085, 2085, 5, GumpButtonType.Reply, 0); // Scroll down
            }

            string title = "<CENTER>Bounty Board</CENTER>";            //board.Title;

            if (title != null)
            {
                AddHtml(183, 68, 180, 23, title, false, false);
            }
            if (BountyKeeper.NumberOfUniqueBounties > 0)
            {
                AddLabel(440, 89, LabelHue, (page + 1).ToString());
                AddLabel(455, 89, LabelHue, "/");
                AddLabel(470, 89, LabelHue, BountyKeeper.NumberOfUniqueBounties.ToString());
            }

            if (BountyKeeper.NumberOfUniqueBounties == 0)
            {
                AddHtml(150, 240, 250, 100, "There are no current bounties listed for collection.  All the citizens of Britannia have been good!", false, false);
            }
            else             //list the bounties!
            {
                if ((page >= 0) && (page < BountyKeeper.NumberOfUniqueBounties))
                {
                    Bounty b = BountyKeeper.GetBounty(page);
                    int    thisplayerbounties = BountyKeeper.BountiesOnPlayer(b.WantedPlayer);
                    bool   eligibleforlbbonus = BountyKeeper.IsEligibleForLBBonus(b.WantedPlayer);

                    string output = "";

                    if (eligibleforlbbonus)
                    {
                        if (thisplayerbounties > 1)
                        {
                            output = string.Format("Lord British and {0} others have placed a bounty on the head of {1}.", thisplayerbounties, b.WantedPlayer.Name);
                        }
                        else
                        {
                            output = string.Format("Lord British and {0} have placed a bounty on the head of {1}.", b.PlacerName, b.WantedPlayer.Name);
                        }
                    }
                    else
                    {
                        if (thisplayerbounties > 1)
                        {
                            output = string.Format("{0} people have placed a bounty on the head of {1}.", thisplayerbounties, b.WantedPlayer.Name);
                        }
                        else
                        {
                            output = string.Format("{0} has placed a bounty on the head of {1}.", b.PlacerName, b.WantedPlayer.Name);
                        }
                    }

                    AddHtml(150, 180, 250, 60, output, false, false);
                    if (eligibleforlbbonus)
                    {
                        output = string.Format("The reward is {0} gold!",
                                               BountyKeeper.RewardForPlayer(b.WantedPlayer) + BountyKeeper.CurrentLBBonusAmount);
                    }
                    else
                    {
                        output = string.Format("The reward is {0} gold!",
                                               BountyKeeper.RewardForPlayer(b.WantedPlayer));
                    }
                    AddHtml(150, 240, 250, 60, output, false, false);
                }
            }
        }
Ejemplo n.º 6
0
		public static void Remove(Bounty b)
		{
			m_bounties.Remove(b);
		}
Ejemplo n.º 7
0
		public static void Add(Bounty b)
		{
            m_bounties.Add(b);
		}
Ejemplo n.º 8
0
		public static void OnLoad( ) 
		{ 
			if(DEBUG) Console.WriteLine("Bounty Loading..."); 
			
			string filePath = Path.Combine( "Saves/BountySystem", "Bounty.xml" );

			if ( !File.Exists( filePath ) )
			{
				m_LBFundAmount = 1000;
				return;
			}

			try
			{
				XmlDocument doc = new XmlDocument();
				doc.Load( filePath );

				XmlElement root = doc["Bounties"];

				try
				{
					string strFund = root.GetAttribute("LBFund");
					m_LBFundAmount = Int32.Parse(strFund);
				}
				catch
				{
					m_LBFundAmount = 1000;
				}

				foreach ( XmlElement bounty in root.GetElementsByTagName( "bounty" ) )
				{
					try
					{
						Bounty b = new Bounty(bounty);

						if( b.WantedPlayer != null &&
							b.Reward > 0 &&
							b.RewardDate <= DateTime.Now )
						{
							m_bounties.Add(b);
						}
					}
					catch
					{
						Console.WriteLine( "Warning: A bounty instance load failed" );
					}
				}
			}
			catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); }
		}
Ejemplo n.º 9
0
			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.");
				}
			}