public CommentsGump(Account acct) : base(30, 30) { m_Acct = acct; AddPage(0); AddImageTiled(0, 0, 410, 448, 0xA40); AddAlphaRegion(1, 1, 408, 446); string title = String.Format("Comments for '{0}'", acct.Username); int x = 205 - ((title.Length / 2) * 7); if (x < 120) { x = 120; } AddLabel(x, 12, 2100, title); AddPage(1); AddButton(12, 12, 0xFA8, 0xFAA, 0x7F, GumpButtonType.Reply, 0); AddLabel(48, 12, 2100, "Add Comment"); List <AccountComment> list = acct.Comments; if (list.Count > 0) { for (int i = 0; i < list.Count; ++i) { AccountComment comment = list[i]; if (i >= 5 && (i % 5) == 0) { AddButton(368, 12, 0xFA5, 0xFA7, 0, GumpButtonType.Page, (i / 5) + 1); AddLabel(298, 12, 2100, "Next Page"); AddPage((i / 5) + 1); AddButton(12, 12, 0xFAE, 0xFB0, 0, GumpButtonType.Page, (i / 5)); AddLabel(48, 12, 2100, "Prev Page"); } string html = String.Format("[Added By: {0} on {1}]<br>{2}", comment.AddedBy, comment.LastModified.ToString("H:mm M/d/yy"), comment.Content); AddHtml(12, 44 + ((i % 5) * 80), 386, 70, html, true, true); } } else { AddLabel(12, 44, 2100, "There are no comments for this account."); } }
public CommentsGump(Account acct) : base(30, 30) { m_Acct = acct; AddPage(0); AddImageTiled(0, 0, 410, 448, 0xA40); AddAlphaRegion(1, 1, 408, 446); string title = $"Comments for '{acct.Username}'"; int x = 205 - title.Length / 2 * 7; if (x < 120) { x = 120; } AddLabel(x, 12, 2100, title); AddPage(1); AddButton(12, 12, 0xFA8, 0xFAA, 0x7F); AddLabel(48, 12, 2100, "Add Comment"); List <AccountComment> list = acct.Comments; if (list.Count > 0) { for (int i = 0; i < list.Count; ++i) { AccountComment comment = list[i]; if (i >= 5 && i % 5 == 0) { AddButton(368, 12, 0xFA5, 0xFA7, 0, GumpButtonType.Page, i / 5 + 1); AddLabel(298, 12, 2100, "Next Page"); AddPage(i / 5 + 1); AddButton(12, 12, 0xFAE, 0xFB0, 0, GumpButtonType.Page, i / 5); AddLabel(48, 12, 2100, "Prev Page"); } string html = $"[Added By: {comment.AddedBy} on {comment.LastModified.ToString("H:mm M/d/yy")}]<br>{comment.Content}"; AddHtml(12, 44 + i % 5 * 80, 386, 70, html, true, true); } } else { AddLabel(12, 44, 2100, "There are no comments for this account."); } }
public static void Cheater(Mobile from, string text, bool accomplice) { if (from is PlayerMobile == false) { return; } // log what's going on TrackIt(from, text, accomplice); //Add to watchlist (from as PlayerMobile).WatchList = true; //Add comment to account Account a = (from as PlayerMobile).Account as Account; if (a != null) { // We may add lots of these, so only keep the last 5 AUDIT records ArrayList delete = new ArrayList(); for (int ix = 0; ix < a.Comments.Count; ix++) { if (a.Comments[ix] is AccountComment) { AccountComment temp = a.Comments[ix] as AccountComment; // old audit key "System", new audit key "AUDIT" if (temp.AddedBy.StartsWith("System", false, null) || temp.AddedBy.StartsWith("AUDIT", false, null)) { delete.Add(a.Comments[ix]); } } } // delete all messages but the last 5 if (delete.Count > 5) { int limit = delete.Count - 5; for (int jx = 0; jx < limit; jx++) { a.Comments.Remove(delete[jx]); } } // okay, now add a fresh message a.Comments.Add(new AccountComment("AUDIT", text)); } }
private void Show() { if (m_Viewing.NetState == null || m_Viewing.NetState.Account == null) { return; } Account a = m_Viewing.Account as Account; if (a == null) { return; } AddHtml(10, 125, 400, 20, Color(Center(string.Format("Comments: {0}", DateTime.UtcNow.ToString())), LabelColor32), false, false); AddButtonLabeled(20, 150, 8, "Add Comment"); StringBuilder sb = new StringBuilder(); if (a.Comments.Count == 0) { sb.Append("There are no comments for this account."); } for (int i = 0; i < a.Comments.Count; ++i) { if (i > 0) { sb.Append("<BR><BR>"); } AccountComment c = a.Comments[i]; sb.AppendFormat("[{0} on {1}]<BR>{2}", c.AddedBy, c.LastModified, c.Content); } AddHtml(20, 180, 380, 190, sb.ToString(), true, true); }
public AFKInfoGump(Mobile m) : base(275, 200) { Closable = true; Disposable = true; Dragable = true; Resizable = false; AddBackground(0, 0, 600, 270, 9200); string text = String.Format("Character: {0}-({1})", m.Name, m.Account); AddLabel(20, 5, 1150, @text); AddLabel(250, 5, 1150, "Online:"); NetState ns = m.NetState; TimeSpan TimeOnline = TimeSpan.Zero; if (ns != null) { TimeOnline = DateTime.Now - ((PlayerMobile)m).SessionStart; text = String.Format("{0:g} - ({1:##:##:##.##})", ((PlayerMobile)m).SessionStart, TimeOnline); } else { text = String.Format("This player is currently offline."); } AddLabel(290, 5, TimeOnline > TimeSpan.FromHours(2) ? (TimeOnline > TimeSpan.FromHours(4) ? 37 : 51) : 71, @text); bool capped = m.SkillsTotal >= m.SkillsCap; text = String.Format("Skill Total/Cap: {0}/{1}", m.SkillsTotal, m.SkillsCap); AddLabel(20, 20, capped ? 37 : 71, @text); text = String.Format("Mining: {0}-{1}", m.Skills[SkillName.Mining].Base, m.Skills[SkillName.Mining].Lock); AddLabel(20, 35, SkillCheck(m, capped, SkillName.Mining), @text); text = String.Format("Lumberjacking: {0}-{1}", m.Skills[SkillName.Lumberjacking].Base, m.Skills[SkillName.Lumberjacking].Lock); AddLabel(150, 35, SkillCheck(m, capped, SkillName.Lumberjacking), @text); text = String.Format("Lockpicking: {0}-{1}", m.Skills[SkillName.Lockpicking].Base, m.Skills[SkillName.Lockpicking].Lock); AddLabel(320, 35, SkillCheck(m, capped, SkillName.Lockpicking), @text); text = String.Format("Fishing: {0}-{1}", m.Skills[SkillName.Fishing].Base, m.Skills[SkillName.Fishing].Lock); AddLabel(470, 35, SkillCheck(m, capped, SkillName.Fishing), @text); StringBuilder sb = new StringBuilder(); Account a = m.Account as Account; if (a != null) { int Failed = 0; int Passed = 0; int Canceled = 0; int Other = 0; for (int i = 0; i < a.Comments.Count; ++i) { AccountComment c = (AccountComment)a.Comments[i]; if (Insensitive.Contains(c.Content, "AFK Check")) { sb.AppendFormat("{0}<BR>", c.Content); if (Insensitive.Contains(c.Content, "Failed")) { Failed++; } else if (Insensitive.Contains(c.Content, "Passed")) { Passed++; } else if (Insensitive.Contains(c.Content, "Canceled")) { Canceled++; } else { Other++; } } } AddHtml(10, 55, 585, 170, sb.ToString(), true, true); text = String.Format("Total AFK Checks: {0}", Failed + Passed + Canceled + Other); AddLabel(20, 230, 1150, text); text = String.Format("Failed={0}", Failed); AddLabel(170, 230, (Failed > 0) ? 37 : 1150, @text); text = String.Format("Passed={0}", Passed); AddLabel(240, 230, (Passed > 0) ? 71 : 1150, @text); text = String.Format("Canceled={0}", Canceled); AddLabel(310, 230, 1150, @text); string LastAFKCheck = a.GetTag("LastAFKCheck"); string LastAFKCheckBy = a.GetTag("LastAFKCheckBy"); if (LastAFKCheck != null && LastAFKCheckBy != null) { DateTime d_LastAFKCheck = DateTime.Now; try { d_LastAFKCheck = DateTime.Parse(LastAFKCheck); } catch { }; if (DateTime.Now - d_LastAFKCheck < TimeSpan.FromHours(4)) { AddLabel(445, 245, 3, "** Under 4 Hours **"); } text = String.Format("Last Check: {0} by {1}.", LastAFKCheck, LastAFKCheckBy); } else { text = String.Format("Last Check: Never"); } AddLabel(20, 245, 1150, @text); } }