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) { 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; } }
/// <summary> /// Releases the offender from jail. When using FullJail it will release any character /// logged on the account. /// </summary> public void Release() { if (!m_FullJail) { // Only a mobile has been jailed if (m_Mobile != null) // Might have been deleted { JailSystem.SetFree(m_Mobile); } } else { // All mobiles might have been jailed. Release the one that's online Mobile m = JailSystem.GetOnlineMobile(m_Account); if (m != null) { JailSystem.SetFree(m); } } }
private void MakeGump() { this.Closable = true; this.Disposable = true; this.Dragable = true; this.Resizable = false; this.AddPage(0); this.AddBackground(0, 0, 485, 315, 9250); // Title this.AddAlphaRegion(20, 15, 445, 20); this.AddLabel(25, 15, LabelHue, string.Format("Jail System Search: Displaying {0} results.", m_List.Count)); // Table header this.AddImageTiled(20, 40, 120, 20, 9304); this.AddAlphaRegion(20, 40, 120, 20); this.AddLabel(25, 40, LabelHue, @"Account"); this.AddImageTiled(145, 40, 120, 20, 9304); this.AddAlphaRegion(145, 40, 120, 20); this.AddLabel(150, 40, LabelHue, @"Player"); this.AddImageTiled(270, 40, 90, 20, 9304); this.AddAlphaRegion(270, 40, 90, 20); this.AddLabel(275, 40, LabelHue, @"Status"); this.AddImageTiled(365, 40, 35, 20, 9304); this.AddAlphaRegion(365, 40, 35, 20); this.AddLabel(370, 40, LabelHue, @"Jail"); this.AddImageTiled(405, 40, 60, 20, 9304); this.AddAlphaRegion(405, 40, 60, 20); this.AddLabel(410, 40, LabelHue, "History"); // Table background this.AddImageTiled(20, 65, 120, 210, 9274); this.AddAlphaRegion(20, 65, 120, 210); this.AddAlphaRegion(145, 65, 120, 210); this.AddImageTiled(270, 65, 90, 210, 9274); this.AddAlphaRegion(270, 65, 90, 210); this.AddAlphaRegion(365, 65, 35, 210); this.AddImageTiled(405, 65, 60, 210, 9274); this.AddAlphaRegion(405, 65, 60, 210); // Load data for (int i = m_Page * 10; i < m_Page * 10 + 10 && i < m_List.Count; i++) { // i is the absolute index on the array list Account acc = m_List[i] as Account; Mobile m = m_List[i] as Mobile; if (acc == null && m != null) { acc = m.Account as Account; } if (acc != null && m == null) { m = JailSystem.GetOnlineMobile(acc); } int index = i - (m_Page * 10); // Account label and button if (acc != null) { this.AddLabelCropped(35, 70 + index * 20, 100, 20, LabelHue, acc.Username); if (m_User.AccessLevel == AccessLevel.Administrator) { // View account details button : buttons from 10 to 19 this.AddButton(15, 75 + index * 20, 2224, 2224, 10 + index, GumpButtonType.Reply, 0); } } // Player label and button if (m != null) { this.AddLabelCropped(160, 70 + index * 20, 100, 20, LabelHue, m.Name); // View props button: buttons from 20 to 29 if (m_User.AccessLevel >= AccessLevel.Lead) //Only >= Seer get props button { this.AddButton(140, 75 + index * 20, 2224, 2224, 20 + index, GumpButtonType.Reply, 0); } } // Status if (m != null && m.NetState != null) { // A mobile is online this.AddLabel(285, 70 + index * 20, GreenHue, @"Online"); // View Client button: buttons from 30 to 39 if (m_User.AccessLevel >= AccessLevel.Lead) { this.AddButton(265, 75 + index * 20, 2224, 2224, 30 + index, GumpButtonType.Reply, 0); } } else { // Offline this.AddLabel(285, 70 + index * 20, RedHue, @"Offline"); } // Jail button: buttons from 40 to 49 if ((m != null && m.AccessLevel == AccessLevel.Player) || (acc != null && !acc.Banned)) { this.AddButton(375, 73 + index * 20, 5601, 5605, 40 + index, GumpButtonType.Reply, 0); } // History button: buttons from 50 to 59 if (acc != null && m_User.AccessLevel >= JailSystem.m_HistoryLevel) { this.AddButton(428, 73 + index * 20, 5601, 5605, 50 + index, GumpButtonType.Reply, 0); } } this.AddAlphaRegion(20, 280, 445, 20); if (m_Page * 10 + 10 < m_List.Count) { this.AddButton(270, 280, 4005, 4006, 2, GumpButtonType.Reply, 0); this.AddLabel(305, 280, LabelHue, @"Next"); // Next: B2 } if (m_Page > 0) { this.AddButton(235, 280, 4014, 4015, 1, GumpButtonType.Reply, 0); this.AddLabel(175, 280, LabelHue, @"Previous"); // Prev: B1 } this.AddButton(20, 280, 4017, 4018, 0, GumpButtonType.Reply, 0); this.AddLabel(55, 280, LabelHue, @"Close"); // Close: B0 }
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; } }
public override void OnResponse(Server.Network.NetState sender, RelayInfo info) { // Get information first m_Banned = false; m_Deleted = false; m_Old = false; foreach (int flag in info.Switches) { switch (flag) { case 0: // Banned m_Banned = true; break; case 1: // Deleted m_Deleted = true; break; case 2: // Old m_Old = true; break; } } uint months = 0; try { months = uint.Parse(info.TextEntries[1].Text); } catch {} finally { if (months > 0) { m_Months = (int)months; } } string lookup = null; if (info.TextEntries[0].Text != null) { lookup = info.TextEntries[0].Text; } switch (info.ButtonID) { case 1: // View History ArrayList history = JailSystem.GetFullHistory(); if (history.Count > 0) { sender.Mobile.SendGump(new JailListingGump(sender.Mobile, JailSystem.GetFullHistory(), new JailGumpCallback(JailAdminGumpCallback))); } else { sender.Mobile.SendMessage("The history is empty"); sender.Mobile.SendGump(new JailAdminGump(sender.Mobile, m_Banned, m_Deleted, m_Old, m_Months)); } break; case 2: // Search for players case 3: // Search for accounts if (lookup != null && lookup.Length > 0) { ArrayList matches = null; if (info.ButtonID == 2) { matches = JailSystem.SearchForPlayers(lookup); } else { matches = JailSystem.SearchForAccounts(lookup); } if (matches != null && matches.Count > 0) { sender.Mobile.SendGump(new JailSearchGump(matches, sender.Mobile, new JailGumpCallback(JailAdminGumpCallback))); } else { sender.Mobile.SendMessage("No matches found"); sender.Mobile.SendGump(new JailAdminGump(sender.Mobile, m_Banned, m_Deleted, m_Old, m_Months)); } } else { sender.Mobile.SendMessage("Invalid search"); sender.Mobile.SendGump(new JailAdminGump(sender.Mobile, m_Banned, m_Deleted, m_Old, m_Months)); } break; case 4: // Purge if (!(m_Deleted || m_Banned || m_Old)) { sender.Mobile.SendMessage("Invalid purge options. Please correct and try again."); sender.Mobile.SendGump(new JailAdminGump(sender.Mobile, m_Banned, m_Deleted, m_Old, m_Months)); } else { JailPurge purge = new JailPurge(m_Banned, m_Deleted, m_Old, m_Months); JailSystem.PurgeHistory(sender.Mobile, purge); sender.Mobile.SendGump(new JailAdminGump(sender.Mobile)); } break; case 5: // View Jail sender.Mobile.SendGump(new JailListingGump(sender.Mobile, JailSystem.Jailings, new JailGumpCallback(JailAdminGumpCallback))); break; } }
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; } }
private void MakeGump() { this.Closable = true; this.Disposable = true; this.Dragable = true; this.Resizable = false; bool active = JailSystem.IsActive(m_Jail); this.AddPage(0); this.AddBackground(0, 0, 600, 400, 9250); this.AddAlphaRegion(15, 15, 570, 370); // Title this.AddLabel(20, 20, RedHue, @"Jail Record Review"); // Status this.AddLabel(290, 20, LabelHue, @"Status:"); int statusHue = GreenHue; string status = "Active"; if (m_Jail.Account == null) { statusHue = RedHue; status = "Account Deleted"; } else if (m_Jail.Account.Banned) { statusHue = RedHue; status = "Account Banned"; } else if (m_Jail.Expired) { statusHue = GreenHue; status = "Expired"; } this.AddLabel(350, 20, statusHue, status); // History Record this.AddImageTiled(19, 39, 562, 52, 3604); this.AddAlphaRegion(20, 40, 560, 50); this.AddHtml(20, 40, 560, 50, string.Format("<basefont color=#CCCCCC>{0}", m_Jail.HistoryRecord), false, false); // Player this.AddLabel(40, 90, LabelHue, @"Player:"); if (m_Jail.Mobile != null) { // Player Props: Button 1 if (m_User.AccessLevel >= JailSystem.m_JailLevel) { if (m_User.AccessLevel >= AccessLevel.Lead) { this.AddButton(19, 93, 5601, 5605, 1, GumpButtonType.Reply, 0); } this.AddLabel(90, 90, GreenHue, m_Jail.Mobile.Name); } } else { this.AddLabel(90, 90, RedHue, "Not Available"); } // Account this.AddLabel(310, 90, LabelHue, @"Account:"); if (m_Jail.Account != null) { // Account Information: Button 2 if (m_User.AccessLevel == AccessLevel.Administrator) { this.AddButton(290, 93, 5601, 5605, 2, GumpButtonType.Reply, 0); } this.AddLabel(370, 90, GreenHue, m_Jail.Account.Username); } else { this.AddLabel(370, 90, RedHue, "Deleted"); } if (active) { // Jail Duration this.AddLabel(20, 120, LabelHue, "Jail Duration:"); // Days: Text 0 this.AddLabel(160, 120, LabelHue, @"Days"); this.AddImageTiled(114, 119, 42, 22, 5154); this.AddAlphaRegion(115, 120, 40, 20); this.AddTextEntry(125, 120, 20, 20, LabelHue, 0, m_Jail.Duration.Days.ToString()); // Hours: Text 1 this.AddLabel(240, 120, LabelHue, @"Hours"); this.AddImageTiled(194, 119, 42, 22, 5154); this.AddAlphaRegion(195, 120, 40, 20); this.AddTextEntry(205, 120, 20, 20, LabelHue, 1, m_Jail.Duration.Hours.ToString()); // Update Jail Duration: Button 7 if (m_User.AccessLevel >= JailSystem.m_JailLevel) { this.AddButton(290, 120, 4005, 4006, 7, GumpButtonType.Reply, 0); this.AddLabel(330, 120, LabelHue, @"Update jail duration"); } // Auto Release this.AddLabel(20, 150, LabelHue, @"Auto Release:"); this.AddLabel(160, 150, m_Jail.AutoRelease ? GreenHue : RedHue, m_Jail.AutoRelease ? "Enabled" : "Disabled"); // Toggle Auto Release: Button 3 if (m_User.AccessLevel >= JailSystem.m_JailLevel) { this.AddButton(290, 150, 4005, 4006, 3, GumpButtonType.Reply, 0); this.AddLabel(330, 150, LabelHue, string.Format("Turn {0} auto release", m_Jail.AutoRelease ? "off" : "on")); } // Full Account Jail this.AddLabel(20, 180, LabelHue, @"Full Account Jail:"); this.AddLabel(160, 180, m_Jail.FullJail ? GreenHue : RedHue, m_Jail.FullJail ? "Enabled" : "Disabled"); // Full Account Jail toggle: Button 4 if (m_Jail.Mobile != null || (!m_Jail.FullJail)) { if (m_User.AccessLevel >= JailSystem.m_JailLevel) { this.AddLabel(330, 180, LabelHue, string.Format("Turn {0} full account jail", m_Jail.FullJail ? "off" : "on")); this.AddButton(290, 180, 4005, 4006, 4, GumpButtonType.Reply, 0); } } // New comment: Text 2 this.AddLabel(290, 210, LabelHue, @"New comment"); this.AddImageTiled(289, 229, 292, 102, 5154); this.AddAlphaRegion(290, 230, 290, 100); this.AddTextEntry(290, 230, 290, 100, LabelHue, 2, @""); // Add comment: Button 5 this.AddLabel(330, 335, LabelHue, @"Add comment"); this.AddButton(290, 335, 4011, 4012, 5, GumpButtonType.Reply, 0); // Unjail: Button 6 if (m_User.AccessLevel >= JailSystem.m_JailLevel) { this.AddLabel(330, 360, LabelHue, @"Unjail"); this.AddButton(290, 360, 4002, 4003, 6, GumpButtonType.Reply, 0); } } else { this.AddLabel(20, 120, LabelHue, "This jailing has expired and cannot be modified"); } // Comments string html = ""; if (m_Jail.Comments.Count == 0) { html = "There are no comments"; } else { foreach (string comment in m_Jail.Comments) { html += string.Format("{0}<br>", comment); } } this.AddLabel(20, 210, LabelHue, @"Comments:"); this.AddImageTiled(19, 229, 262, 152, 3604); this.AddAlphaRegion(20, 230, 260, 150); this.AddHtml(20, 230, 260, 150, html, false, true); if (m_User.AccessLevel >= JailSystem.m_HistoryLevel && m_Jail.Account != null) { // History: Button 8 this.AddButton(450, 335, 4029, 4030, 8, GumpButtonType.Reply, 0); this.AddLabel(490, 335, LabelHue, @"History"); } // Close: button 0 this.AddButton(450, 360, 4023, 4024, 0, GumpButtonType.Reply, 0); this.AddLabel(490, 360, LabelHue, @"Close"); }
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; } }