public ChatListGump(byte page, ListPage pageType, Mobile client) : base(10, 10) { _currentPage = Math.Max(page, (byte)1); _pageType = pageType; _client = client; ChatInfo info = ChatManager.GetInfo(client); bool hasNextPage = false; List <Mobile> userList = ChatManager.GatherUsers(_currentPage, pageType, client, out hasNextPage); int backSize = ((userList.Count > 0 ? 55 : 50) + (21 * userList.Count)); uint onlineCount = 0; for (int i = 0; i < NetState.Instances.Count; i++) { if (NetState.Instances[i] != null && NetState.Instances[i].Running && NetState.Instances[i].Mobile != null) { onlineCount++; } } AddPage(1); AddBackground(0, 0, 265, backSize, 9250); AddAlphaRegion(15, 15, 234, 20); AddHtml(15, 15, 234, 20, String.Format("<basefont color='white'><center>{0} List - Online: {1}</center></basefont>", (pageType == ListPage.Everyone ? "User" : (pageType == ListPage.Buddy ? "Buddy" : "Ignore")), onlineCount), false, false); if (_currentPage > 1) { AddButton(215, 18, 9706, 9707, ChatManager.GetButtonId(5, 0), GumpButtonType.Reply, 0); } if (hasNextPage) { AddButton(235, 18, 9702, 9703, ChatManager.GetButtonId(5, 1), GumpButtonType.Reply, 0); } for (int i = 0, y = 40; i < userList.Count; i++, y += 22) { AddAlphaRegion(15, y, 234, 20); AddLabelCropped(20, y, 200, 20, ChatManager.GetGumpNameColor(_client, userList[i]), userList[i].RawName); AddButton(220, y, (info.IgnoreList.Contains(userList[i]) ? 4002 : 4011), (info.IgnoreList.Contains(userList[i]) ? 4004 : 4013), ChatManager.GetButtonId(0, i), GumpButtonType.Reply, 0); } AddButton(15, (backSize + 3), 4008, 4010, ChatManager.GetButtonId((int)ListPage.Buddy, 0), GumpButtonType.Reply, 0); AddLabel(50, (backSize + 3), ChatManager.GumpLabelHue, String.Format("{0} List", (pageType == ListPage.Buddy ? "User" : "Buddy"))); AddButton(225, (backSize + 3), (info.Visible ? 4017 : 4005), (info.Visible ? 4019 : 4007), ChatManager.GetButtonId((int)ListPage.Everyone, 1), GumpButtonType.Reply, 0); AddLabel((info.Visible ? 180 : 175), (backSize + 3), (info.Visible ? ChatManager.GumpVisibleLabelHue : ChatManager.GumpInvisibleLabelHue), (info.Visible ? "Visible" : "Invisible")); AddButton(15, (backSize + 28), 4029, 4031, ChatManager.GetButtonId((int)ListPage.Everyone, 2), GumpButtonType.Reply, 0); AddLabel(50, (backSize + 28), ChatManager.GumpLabelHue, "Guild Message"); AddButton(225, (backSize + 28), 4002, 4004, ChatManager.GetButtonId((int)ListPage.Ignore, 0), GumpButtonType.Reply, 0); AddLabel(152, (backSize + 28), ChatManager.GumpLabelHue, String.Format("{0} List", (pageType == ListPage.Ignore ? "User" : "Ignore"))); }
public ChatMessageListGump(Mobile client, byte page) : base(10, 10) { _client = client; _currentPage = Math.Max(page, (byte)1); List <ChatMessage> fullMessageList = ChatMessageManager.GetMessages(client); int rangeIdx = ((_currentPage * 10) - 10); int count = Math.Min((fullMessageList.Count - rangeIdx), 10); List <ChatMessage> messages = fullMessageList.GetRange(rangeIdx, count); _messages = messages; int backSize = ((messages.Count > 0 ? 55 : 50) + (21 * messages.Count)); AddPage(1); AddBackground(0, 0, 400, backSize, 9250); AddAlphaRegion(15, 15, 370, 20); AddHtml(15, 15, 370, 20, String.Format("<basefont color='white'><center>Message List - Unread: {0}</center></basefont>", fullMessageList.Count), false, false); if (page > 1) { AddButton(347, 18, 9706, 9607, ChatManager.GetButtonId(0, 0), GumpButtonType.Reply, 0); } if (fullMessageList.Count > (rangeIdx + 10)) { AddButton(365, 18, 9702, 9703, ChatManager.GetButtonId(0, 1), GumpButtonType.Reply, 0); } for (int i = 0, y = 40; i < messages.Count; i++, y += 22) { AddAlphaRegion(15, y, 370, 20); AddButton(15, y, 4011, 4013, ChatManager.GetButtonId(1, i), GumpButtonType.Reply, 0); AddLabelCropped(50, y, 155, 20, ChatManager.GetGumpNameColor(_client, messages[i].Client), messages[i].Client.RawName); AddLabelCropped(210, y, 184, 20, ChatManager.GumpLabelHue, ChatMessageManager.FormatTimestamp(messages[i])); } }