Пример #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.Now.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;
            }
        }
Пример #3
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)
                {
                    return;
                }

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

                if (m_User.AccessLevel < AccessLevel.Lead)
                {
                    return;
                }

                if (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)
                {
                    return;
                }

                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)
                {
                    return;
                }
                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)
                {
                    return;
                }
                m_Jail.FullJail = !m_Jail.FullJail;
                m_User.SendGump(new JailViewGump(m_User, m_Jail, m_Callback));
                break;

            case 5:                     // Add comment

                string comment = info.TextEntries[2].Text;

                if (comment != null && comment.Length > 0)
                {
                    m_Jail.AddComment(m_User, comment);
                }
                else
                {
                    m_User.SendMessage("Can't add an empty comment");
                }

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

            case 6:                     // Unjail

                if (sender.Mobile.AccessLevel < JailSystem.m_JailLevel)
                {
                    return;
                }
                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)
                {
                    return;
                }
                uint hours = 0;
                uint days  = 0;

                try
                {
                    days = uint.Parse(info.TextEntries[0].Text);
                }
                catch {}

                try
                {
                    hours = uint.Parse(info.TextEntries[1].Text);
                }
                catch {}

                TimeSpan duration = new TimeSpan((int)days, (int)hours, 0, 0, 0);

                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)
                {
                    return;
                }
                m_User.SendGump(new JailViewGump(m_User, m_Jail, m_Callback));

                ArrayList history = JailSystem.SearchHistory(m_Jail.Account);

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