public int Compare(Account a, Account b) { if (a == null && b == null) { return(0); } else if (a == null) { return(-1); } else if (b == null) { return(1); } AccessLevel aLevel, bLevel; bool aOnline, bOnline; AdminGump.GetAccountInfo(a, out aLevel, out aOnline); AdminGump.GetAccountInfo(b, out bLevel, out bOnline); if (aOnline && !bOnline) { return(-1); } else if (bOnline && !aOnline) { return(1); } else if (aLevel > bLevel) { return(-1); } else if (aLevel < bLevel) { return(1); } else { return(Insensitive.Compare(a.Username, b.Username)); } }
public void TestGumpPacketAdmin(ProtocolChanges changes) { var m = new Mobile(0x1); m.DefaultMobileInit(); m.RawName = "Test Mobile"; m.AccessLevel = AccessLevel.Administrator; var gump = new AdminGump(m, AdminGumpPage.Clients); using var ns = PacketTestUtilities.CreateTestNetState(); ns.ProtocolChanges = changes; var expected = gump.Compile(ns).Compile(); ns.SendDisplayGump(gump, out _, out _); var result = ns.SendPipe.Reader.TryRead(); AssertThat.Equal(result.Buffer[0].AsSpan(0), expected); }
private static void Traffic_OnCommand(CommandEventArgs e) { e.Mobile.SendMessage("Incoming traffic: " + AdminGump.FormatByteAmount(e.Mobile.NetState.Incoming)); e.Mobile.SendMessage("Outgoing traffic: " + AdminGump.FormatByteAmount(e.Mobile.NetState.Outgoing)); }
private void BuildDetailsLayout() { Account a = Selected; int y = 100; AddHtml(270, y, 200, 16, Color("#FFD700", "Account:"), false, false); AddHtml(420, y, 200, 16, Color("#FFFFFF", a.Username + String.Format("{0}", a.Banned ? "<basefont color=red> [Banned]" : a.Inactive ? "<basefond color=red> [Inactive]" : "<basefont color=green> [Active]")), false, false); y += 20; AddHtml(270, y, 200, 16, Color("#FFD700", "Created:"), false, false); AddHtml(420, y, 200, 16, Color("#FFFFFF", a.Created.ToShortDateString()), false, false); y += 20; AddHtml(270, y, 200, 16, Color("#FFD700", "Total Game Time:"), false, false); AddHtml(420, y, 200, 16, Color("#FFFFFF", AdminGump.FormatTimeSpan(a.TotalGameTime)), false, false); y += 20; AddHtml(270, y, 200, 16, Color("#FFD700", "Characters:"), false, false); y += 20; bool accountGold = AccountGold.Enabled; for (int i = 0; i < a.Length; i++) { if (a[i] == null) { continue; } string hue = SearchBy == SearchCriteria.CharacterName && CompareStrings(TextInput, a[i].Name) ? "#FFD700" : "#FFFFFF"; if (accountGold) { AddButton(i % 2 == 0 ? 272 : 427, y + 2, 2086, 2086, 100 + i, GumpButtonType.Reply, 0); } if (i % 2 == 0) { AddLabelCropped(290, y, 150, 20, 986, a[i].Name); } else { AddLabelCropped(445, y, 150, 20, 986, a[i].Name); y += 20; } } y += 30; if (accountGold) { AddHtml(270, y, 200, 16, Color("#FFD700", "Account Gold:"), false, false); AddHtml(450, y, 200, 16, Color("#FFFFFF", String.Format("{0:#,0}", a.TotalGold.ToString("N0", CultureInfo.GetCultureInfo("en-US")))), false, false); y += 22; AddButton(270, y, 4014, 4015, 6, GumpButtonType.Reply, 0); AddImageTiled(305, y, 100, 20, 9254); AddTextEntry(307, y, 98, 20, 0, 2, "Set Gold"); y += 22; AddHtml(270, y, 200, 16, Color("#FFD700", "Account Platinum:"), false, false); AddHtml(450, y, 200, 16, Color("#FFFFFF", String.Format("{0:#,0}", a.TotalPlat.ToString("N0", CultureInfo.GetCultureInfo("en-US")))), false, false); y += 22; AddButton(270, y, 4014, 4015, 7, GumpButtonType.Reply, 0); AddImageTiled(305, y, 100, 20, 9254); AddTextEntry(307, y, 98, 20, 0, 3, "Set Plat"); if (Player != null && Player.Account == Selected) { y += 22; AddHtml(270, y, 180, 16, Color("#FFD700", String.Format("{0}'s Secure Account:", Player.Name)), false, false); AddHtml(450, y, 200, 16, Color("#FFFFFF", String.Format("{0:#,0}", a.GetSecureAccountAmount(Player).ToString("N0", CultureInfo.GetCultureInfo("en-US")))), false, false); y += 22; AddButton(270, y, 4014, 4015, 8, GumpButtonType.Reply, 0); AddImageTiled(305, y, 100, 20, 9254); AddTextEntry(307, y, 98, 20, 0, 4, "Set Secure"); } } if (User.AccessLevel >= AccessLevel.Administrator) { AddHtml(303, 411, 150, 16, Color("#FFD700", "Admin Page"), false, false); AddButton(270, 411, 4005, 4006, 5, GumpButtonType.Reply, 0); } }
public static void Processar() { string tempoOnline = AdminGump.FormatTimeSpan(DateTime.Now - Clock.ServerStart); ControladorODBC.ODBCProcessarStatusServidor(tempoOnline); }