private void RequestDuel(object sender, EventArgs e) { ListBox list = (UserTabs.SelectedTab.Text == Program.LanguageManager.Translation.chatTabUsers ? UserList : FriendList); if (list.SelectedItem == null) return; if (list.SelectedItem.ToString() == Program.UserInfo.Username) NewMessage(new ChatMessage(MessageType.System, CurrentChatWindow().Name, "You cannot duel request your self.")); else { Host form = new Host(); server.SendPacket("REQUESTDUEL||" + list.SelectedItem.ToString() +"||" + form.GenerateGameString(false)); NewMessage(new ChatMessage(MessageType.System, CurrentChatWindow().Name, "Duel request sent to " + list.SelectedItem.ToString() + ".")); } }
private void RequestDuel(object sender, EventArgs e) { ListBox list = (UserListTabs.SelectedTab.Name == OnlineTab.Name ? UserList : (UserListTabs.SelectedTab.Name == TeamTab.Name ? TeamList : FriendList)); if (list.SelectedItem == null) { return; } if (list.SelectedItem.ToString() == Program.UserInfo.Username) { WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "You cannot duel request your self.")); } else { var form = new Host(); Program.ChatServer.SendPacket("REQUESTDUEL||" + list.SelectedItem + "||" + form.GenerateGameString(false)); WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "Duel request sent to " + list.SelectedItem + ".")); } }