Beispiel #1
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);
            }
        }
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            switch (info.ButtonID)
            {
            case 1:                      // No: make a new jail entry\
                JailSystem.InitJail(m_User, m_Offender, true);
                break;

            case 2:                     // Yes: set current jail entry to full account
                m_ExistingJail.FullJail = true;
                m_ExistingJail.AddComment(m_User, "Turning on full jail to jail {0}", m_Offender.Name);
                m_User.SendGump(new JailViewGump(m_User, m_ExistingJail, null));
                break;
            }
        }
Beispiel #3
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);
			}
		}
Beispiel #4
0
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            switch (info.ButtonID)
            {
            case 0:                     // Close the gump
            {
                if (m_Callback != null)
                {
                    try
                    {
                        m_Callback.DynamicInvoke(new object[] { m_User });
                    }
                    catch {}
                }
                break;
            }

            case 1:                     // Display player props
            {
                if (sender.Mobile.AccessLevel >= JailSystem.m_JailLevel)
                {
                    m_User.SendGump(new JailViewGump(m_User, m_Jail, m_Callback));

                    if (m_User.AccessLevel >= AccessLevel.Lead && m_Jail.Mobile != null)
                    {
                        m_User.SendGump(new PropertiesGump(m_User, m_Jail.Mobile));
                    }
                }
                break;
            }

            case 2:                     // Display account admin
            {
                if (sender.Mobile.AccessLevel >= AccessLevel.Administrator)
                {
                    m_User.SendGump(new JailViewGump(m_User, m_Jail, m_Callback));

                    if (m_Jail.Account != null)
                    {
                        m_User.SendGump(new AdminGump(m_User, AdminGumpPage.AccountDetails_Information, 0, null, "Jailed account information", m_Jail.Account));
                    }
                }
                break;
            }

            case 3:                     // AutoRelease toggle
            {
                if (sender.Mobile.AccessLevel >= JailSystem.m_JailLevel)
                {
                    m_Jail.AutoRelease = !m_Jail.AutoRelease;
                    m_User.SendGump(new JailViewGump(m_User, m_Jail, m_Callback));
                }
                break;
            }

            case 4:                     // FullJail toggle
            {
                if (sender.Mobile.AccessLevel >= JailSystem.m_JailLevel)
                {
                    m_Jail.FullJail = !m_Jail.FullJail;
                    m_User.SendGump(new JailViewGump(m_User, m_Jail, m_Callback));
                }
                break;
            }

            case 5:                     // Add comment
            {
                TextRelay comment = info.GetTextEntry(2);

                if (comment == null || String.IsNullOrEmpty(comment.Text))
                {
                    m_User.SendMessage("Can't add an empty comment");
                }
                else
                {
                    m_Jail.AddComment(m_User, comment.Text);
                }

                m_User.SendGump(new JailViewGump(m_User, m_Jail, m_Callback));
                break;
            }

            case 6:                     // Unjail
            {
                if (sender.Mobile.AccessLevel >= JailSystem.m_JailLevel)
                {
                    JailSystem.Release(m_Jail, m_User);
                    m_User.SendGump(new JailViewGump(m_User, m_Jail, m_Callback));
                }
                break;
            }

            case 7:                     // Update duration
            {
                if (sender.Mobile.AccessLevel >= JailSystem.m_JailLevel)
                {
                    TimeSpan duration = TimeSpan.Zero;

                    TextRelay text = info.GetTextEntry(0);
                    if (text != null && !String.IsNullOrEmpty(text.Text))
                    {
                        duration += TimeSpan.FromDays(Utility.ToInt32(text.Text));
                    }

                    text = info.GetTextEntry(1);
                    if (text != null && !String.IsNullOrEmpty(text.Text))
                    {
                        duration += TimeSpan.FromHours(Utility.ToInt32(text.Text));
                    }

                    if (duration == TimeSpan.Zero)
                    {
                        m_User.SendMessage("Invalid duration specified. If you wish to release the player, use the unjail button.");
                    }
                    else
                    {
                        m_Jail.Duration = duration;
                    }

                    m_User.SendGump(new JailViewGump(m_User, m_Jail, m_Callback));
                }
                break;
            }

            case 8:                     // History
            {
                if (sender.Mobile.AccessLevel >= JailSystem.m_HistoryLevel)
                {
                    m_User.SendGump(new JailViewGump(m_User, m_Jail, m_Callback));

                    List <JailEntry> history = JailSystem.SearchHistory(m_Jail.Account);

                    if (history.Count > 0)
                    {
                        m_User.SendGump(new JailListingGump(m_User, history, null));
                    }
                }
                break;
            }
            }
        }