private static void msg_invoke(CommandEventArgs args) { if (args.Length == 1 && args.GetString(0) != null) { string name = args.GetString(0); bool found = false; for (int i = 0; !found && i < NetState.Instances.Count; i++) { if (NetState.Instances[i].Mobile != null && NetState.Instances[i].Mobile.RawName.ToLower() == name.ToLower()) { if (ChatManager.CanChat(args.Mobile, NetState.Instances[i].Mobile)) { args.Mobile.SendGump(new ChatMessageGump(args.Mobile, NetState.Instances[i].Mobile)); found = true; } } } if (!found) { args.Mobile.SendGump(new ChatListGump(ListPage.Everyone, args.Mobile)); } } else { args.Mobile.SendGump(new ChatListGump(ListPage.Everyone, args.Mobile)); } }
public override void OnResponse(NetState sender, RelayInfo info) { int val = (info.ButtonID - 1); if (val < 0) { return; } int type = (val % 10); int index = (val / 10); ChatInfo chatInfo = ChatManager.GetInfo(_client); List <Mobile> userList = ChatManager.GatherUsers(_currentPage, _pageType, _client); switch (type) { case 0: //send message - index represents position in ChatManager.GatherUsers list { if (ChatManager.CanChat(_client, userList[index])) { _client.SendGump(new ChatMessageGump(_client, userList[index])); } else { if (chatInfo.IgnoreList.Contains(userList[index])) { if (_pageType == ListPage.Ignore) { chatInfo.Remove(ChatInfo.UpdateType.Ignore, userList[index]); _client.SendMessage("{0} has been removed from your ignore list.", userList[index].RawName); } else { _client.SendMessage("That user is on your ignore list!"); } } else { _client.SendMessage("You cannot chat with that user."); } Resend(); } break; } case (int)ListPage.Everyone: { switch (index) { case 1: //toggle visibility { chatInfo.Visible = !chatInfo.Visible; Resend(); break; } case 2: //send guild message { if (_client.Guild == null) { _client.SendMessage("You are not in a guild!"); Resend(); } else { _client.SendGump(new ChatMessageGump(_client, null, true)); } break; } } break; } case (int)ListPage.Buddy: { switch (index) { case 0: //display buddy list { if (_pageType == ListPage.Buddy) { _client.SendGump(new ChatListGump(ListPage.Everyone, _client)); } else { if (chatInfo.BuddyList.Count == 0) { _client.SendMessage("You do not have any chat buddies!"); Resend(); } else { _client.SendGump(new ChatListGump(ListPage.Buddy, _client)); } } break; } } break; } case (int)ListPage.Ignore: { switch (index) { case 0: //display ignore list { if (_pageType == ListPage.Ignore) { _client.SendGump(new ChatListGump(ListPage.Everyone, _client)); } else { if (chatInfo.IgnoreList.Count == 0) { _client.SendMessage("You do not have anyone on your ignore list!"); Resend(); } else { _client.SendGump(new ChatListGump(ListPage.Ignore, _client)); } } break; } } break; } case 5: { switch (index) { case 0: { Resend((byte)(_currentPage - 1)); break; } case 1: { Resend((byte)(_currentPage + 1)); break; } } break; } } }