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 if (info.TextEntries[0].Text != null && info.TextEntries[0].Text.Length > 0) { reason = info.TextEntries[0].Text; } break; } if (reason == null || reason.Length == 0) { 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)); } }
public override void OnResponse(Server.Network.NetState sender, RelayInfo info) { // Calculate days and hours first try { if (info.TextEntries[0].Text != null) { m_Days = (int)uint.Parse(info.TextEntries[0].Text); } } catch {} try { if (info.TextEntries[1].Text != null) { m_Hours = (int)uint.Parse(info.TextEntries[1].Text); } } catch {} // Comment if (info.TextEntries[2].Text != null) { m_Comment = info.TextEntries[2].Text; } m_AutoRelease = false; m_FullJail = false; // Switches foreach (int check in info.Switches) { switch (check) { case 0: // AutoRelease m_AutoRelease = true; break; case 1: // FullJail m_FullJail = true; break; } } if (m_Offender == null) { m_FullJail = true; } 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 TimeSpan duration; try { duration = new TimeSpan(m_Days, m_Hours, 0, 0, 0); } catch { sender.Mobile.SendMessage("Invalid jail time. Please specify a valid duration."); return; } if (m_AutoRelease && duration == TimeSpan.Zero) { sender.Mobile.SendMessage("If you request auto release, you must specify a valid duration for your sentence"); sender.Mobile.SendGump(new JailingGump(m_Offender, m_Account, m_Reason, m_AutoRelease, m_Days, m_Hours, m_FullJail, m_Comment)); return; } JailSystem.CommitJailing(m_Offender, m_Account, sender.Mobile, m_Reason, m_AutoRelease, duration, m_FullJail, m_Comment); break; } }