Esempio n. 1
0
		public PlayerJailGump( JailEntry jail, Mobile jailer ) : base( 100, 100 )
		{
			m_Jail = jail;
			m_Jailer = jailer;

			MakeGump();
		}
		public JailAccountGump( Mobile offender, Mobile user, JailEntry jail, Account account ) : base( 100, 100 )
		{
			m_Offender = offender;
			m_User = user;
			m_ExistingJail = jail;
			m_Account = account;

			MakeGump();
		}
		public JailViewGump( Mobile user, JailEntry jail, JailGumpCallback callback ) : base( 50, 50 )
		{
			user.CloseGump( typeof( JailViewGump ) );

			m_User = user;
			m_Jail = jail;
			m_Callback = callback;

			MakeGump();
		}
		/// <summary>
		/// Verifies if a JailEntry should be removed from history
		/// </summary>
		/// <param name="jail">The JailEntry object being checked</param>
		/// <returns>True if the JailEntry matches the purge conditions</returns>
		public bool PurgeCheck( JailEntry jail )
		{
			if ( jail.Account == null && m_Deleted )
			{
				return true;
			}
			else if ( jail.Account != null && jail.Account.Banned && m_Banned )
			{
				return true;
			}
			else if ( m_Old )
			{
				TimeSpan age = DateTime.Now - jail.JailTime;

				if ( age.TotalHours >= m_Hours )
				{
					return true;
				}
			}

			return false;
		}
Esempio n. 5
0
		/// <summary>
		///     Verifies if a new jail entry has conflicts with other jail entries
		/// </summary>
		/// <param name="jail">The potential new JailEntry</param>
		/// <returns>True if the new jail entry can be added to the jail</returns>
		private static bool IsValid(JailEntry jail)
		{
			if (jail == null)
			{
				return false;
			}

			foreach (JailEntry cmp in m_Jailings.Where(cmp => jail.Account == cmp.Account))
			{
				if (cmp.FullJail && jail.FullJail)
				{
					return false; // New jail is full account, and a previous full jail already exists
				}
					
				if (cmp.Mobile == jail.Mobile && cmp.FullJail == jail.FullJail)
				{
					return false; // Jailing the same mobile without full jail
				}
			}

			return true;
		}
Esempio n. 6
0
		/// <summary>
		///     Verifies if a given jail entry is active or if it's a historical one
		/// </summary>
		/// <param name="jail">The JailEntry to verify</param>
		/// <returns>True if the jail entry is currently active, false if it's historical</returns>
		public static bool IsActive(JailEntry jail)
		{
			return m_Jailings.Contains(jail);
		}
Esempio n. 7
0
		/// <summary>
		///     Forces a release action on a JailEntry. This also adds a comment specifying the moment of the release.
		/// </summary>
		/// <param name="jail">The jail entry to consider expired</param>
		/// <param name="from">The staff member releasing the jailing</param>
		public static void Release(JailEntry jail, Mobile from)
		{
			if (from != null)
			{
				jail.AddComment(from, "Released at {0}", DateTime.UtcNow.ToShortTimeString());
			}

			jail.Release();

			if (m_Jailings.Contains(jail))
			{
				m_Jailings.Remove(jail);
				m_ExpiredJailings.Add(jail);
			}
		}
Esempio n. 8
0
		/// <summary>
		///     Finalizes a jailing action by adding a jail record and moving the mobile into a jail cell
		/// </summary>
		/// <param name="m">The player being jailed</param>
		/// <param name="account">The account of the player being jailed</param>
		/// <param name="from">The GM performing the jailing</param>
		/// <param name="reason">The reason for the jailing</param>
		/// <param name="autorelease">States if the player should be auto released after the sentence is over</param>
		/// <param name="duration">The length of the sentence</param>
		/// <param name="fulljail">States if the full account should be jailed</param>
		/// <param name="comment">An additional comment about the jailing</param>
		public static void CommitJailing(
			Mobile m,
			Account account,
			Mobile from,
			string reason,
			bool autorelease,
			TimeSpan duration,
			bool fulljail,
			string comment)
		{
			var jail = new JailEntry(m, account, from, duration, reason, comment, autorelease, fulljail);

			// Verify if the new entry is valid
			JailEntry existing = null;

			if (! IsValid(jail))
			{
				existing = jail.Mobile != null ? GetCurrentJail(jail.Mobile) : GetCurrentJail(jail.Account);
			}

			if (existing != null)
			{
				// This jailing wont' be committed, if there's a pending player, release them
				CancelJail(m, from);

				from.SendMessage(
					0x40,
					"Your new jail report is in conflict with an existing entry. Please review and eventually update the existing jailing.");
				from.SendGump(new JailViewGump(from, existing, null));
				return;
			}

			// The jailing is valid so go on and add it

			m_Jailings.Add(jail);
			FinalizeJail(m);

			// Send jailing review gump to the offender
			if (m != null && m.NetState != null)
			{
				m.SendGump(new PlayerJailGump(jail, from));
			}
			else if (jail.FullJail) // Handle full account jailing/player relogging
			{
				Mobile mob = GetOnlineMobile(jail.Account);

				if (mob != null)
				{
					FinalizeJail(mob);
					mob.SendGump(new PlayerJailGump(jail, from));
				}
			}
		}