public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            switch (info.ButtonID)
            {
            case 1:                      // Previous page

                m_User.SendGump(new JailSearchGump(m_List, m_User, m_Page - 1, m_Callback));
                break;

            case 2:                     // Next page

                m_User.SendGump(new JailSearchGump(m_List, m_User, m_Page + 1, m_Callback));
                break;

            case 0:                     // Close

                if (m_Callback != null)
                {
                    try
                    {
                        m_Callback.DynamicInvoke(new object[] { m_User });
                    }
                    catch {}
                }

                break;

            default:

                int type  = info.ButtonID / 10;
                int index = info.ButtonID % 10;

                Mobile  m   = m_List[m_Page * 10 + index] as Mobile;
                Account acc = m_List[m_Page * 10 + index] as Account;

                if (acc == null && m != null)
                {
                    acc = m.Account as Account;
                }

                if (m == null && acc != null)
                {
                    m = JailSystem.GetOnlineMobile(acc);
                }

                switch (type)
                {
                case 1:                                 // View Account details

                    m_User.SendGump(new JailSearchGump(m_List, m_User, m_Page, m_Callback));

                    if (acc != null)
                    {
                        m_User.SendGump(new AdminGump(m_User, AdminGumpPage.AccountDetails_Information, 0, null, "Returned from the jail system", acc));
                    }

                    break;

                case 2:                                 // View Mobile props

                    m_User.SendGump(new JailSearchGump(m_List, m_User, m_Page, m_Callback));

                    if (m_User.AccessLevel < AccessLevel.Lead)
                    {
                        return;
                    }
                    if (m != null)
                    {
                        m_User.SendGump(new PropertiesGump(m_User, m));
                    }
                    break;

                case 3:                                 // View Client gump

                    m_User.SendGump(new JailSearchGump(m_List, m_User, m_Page, m_Callback));

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

                    if (m != null && m.NetState != null)
                    {
                        m_User.SendGump(new ClientGump(m_User, m.NetState));
                    }
                    else
                    {
                        m_User.SendMessage("That mobile is no longer online");
                    }
                    break;

                case 4:                                 // Jail button

                    object obj = m_List[m_Page * 10 + index];

                    if (obj is Mobile)
                    {
                        // Requesting a jail on a mobile
                        JailSystem.InitJail(m_User, obj as Mobile);
                    }
                    else if (obj is Account)
                    {
                        // Jail an account
                        JailSystem.InitJail(m_User, obj as Account);
                    }

                    break;

                case 5:                                 // History button

                    if (acc != null)
                    {
                        ArrayList history = JailSystem.SearchHistory(acc);

                        if (history.Count > 0)
                        {
                            m_User.SendGump(new JailListingGump(m_User, history, new JailGumpCallback(JailSearchCallback)));
                        }
                        else
                        {
                            m_User.SendMessage("No jail entries have been found for that account");
                            m_User.SendGump(new JailSearchGump(m_List, m_User, m_Page, m_Callback));
                        }
                    }
                    break;
                }
                break;
            }
        }
Esempio n. 2
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;
            }
        }