예제 #1
0
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            string reason = null;

            switch (info.ButtonID)
            {
            case 0:                     // Cancel the jailing
            {
                if (m_Offender != null)
                {
                    JailSystem.CancelJail(m_Offender, sender.Mobile);
                }
                else if (m_Account != null)
                {
                    sender.Mobile.SendMessage("You have canceled the jailing of the account {0}.", m_Account.Username);
                }

                return;
            }

            case 1:                     // Predefined reasons
            case 2:
            case 3:
            case 4:
            case 5:
            {
                reason = m_Reasons[info.ButtonID - 1];
                break;
            }

            case 6:                     // Other, check for text
            {
                TextRelay text = info.GetTextEntry(0);
                if (text != null && !String.IsNullOrEmpty(text.Text))
                {
                    reason = text.Text;
                }
                break;
            }
            }

            if (String.IsNullOrEmpty(reason))
            {
                sender.Mobile.SendMessage("Please specify a valid reason for the jailing.");

                if (m_Offender != null)
                {
                    sender.Mobile.SendGump(new JailReasonGump(m_Offender));
                }
                else
                {
                    sender.Mobile.SendGump(new JailReasonGump(m_Account));
                }
            }
            else
            {
                sender.Mobile.SendGump(new JailingGump(m_Offender, m_Account, reason));
            }
        }
예제 #2
0
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            // Calculate days and hours first
            TimeSpan duration = TimeSpan.Zero;

            TextRelay text = info.GetTextEntry(0);

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

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

            text = info.GetTextEntry(2);
            if (text != null && !String.IsNullOrEmpty(text.Text))
            {
                m_Comment = text.Text;
            }

            m_AutoRelease = info.IsSwitched(0);
            m_FullJail    = info.IsSwitched(1);

            m_FullJail = m_Offender == null;

            switch (info.ButtonID)
            {
            case 0:                     // Cancel jailing
            {
                JailSystem.CancelJail(m_Offender, sender.Mobile);
                sender.Mobile.SendMessage("You have canceled the jailing of {0} and brought them to your location", m_Offender.Name);
                return;
            }

            case 1:                     // Commit jailing
            {
                if (duration <= TimeSpan.Zero)
                {
                    sender.Mobile.SendMessage("Invalid duration, please specify at least one hour.");
                    sender.Mobile.SendGump(new JailingGump(m_Offender, m_Account, m_Reason, m_AutoRelease, m_Days, m_Hours, m_FullJail, m_Comment));
                }
                else
                {
                    JailSystem.CommitJailing(m_Offender, m_Account, sender.Mobile, m_Reason, m_AutoRelease, duration, m_FullJail, m_Comment);
                }
                break;
            }
            }
        }