public void AcceptPartyInvite()
 {
     AddLobbyMessageToQueue(42, invitingPlayer + "|" + invitedParty);
     myAccount.partyID = invitedParty;
     myParty = new Party(myAccount, myAccount.partyID);
 }
        private void HandleIncomingLobbyMessage(string output)
        {
            lobbyMessageQueue.Add(new LobbyMessage(255));
            //[1,8]3 [channel created, user Dakos]channelid 3
            string data = output.Substring(1);
            int index = data.IndexOf(",");
            int type = Convert.ToInt32(data.Substring(0, index));
            index = -1;
            index = data.IndexOf("]");
            data = data.Substring(index + 1);

            guiController.SetDebugText("RECEIVED LOBBY: " + output);

            switch (type)
            {
                //Put server message on chat (yellow)
                case 0:
                    guiController.AddToChat(data);
                    break;
                case 1:
                    AddChatChannel(data);
                    guiController.SetDebugText("Added Channel");
                    break;
                case 2:
                    FormatFriendList(data);
                    guiController.SetDebugText("Formatted friendlist");
                    break;
                case 3:
                    FillFriendList(data);
                    guiController.SetDebugText("Filled friendList");
                    break;
                case 4:
                    FriendOnline(Convert.ToInt32(data));
                    guiController.SetDebugText("Friend came online");
                    break;
                case 5:
                    FriendOffline(Convert.ToInt32(data));
                    guiController.SetDebugText("Friend went offline");
                    break;
                // SEND FRIENDREQUEST
                case 6:
                    index = data.IndexOf(",");
                    int accepted = Convert.ToInt32(data.Substring(0, index));
                    data = data.Substring(index + 1);
                    string FriendId = data;

                    if (accepted == 1)
                    {
                        guiController.ShowMessageBox("Friend request to " + data + " successfully sent");
                    }
                    else if (accepted == 0)
                    {
                        guiController.ShowMessageBox("Failed to send friend request, common causes:\n-Name does not exist\n-you already have said user as friend");
                    }
                    guiController.SetDebugText("Friendrequest response");
                    break;
                // ACCEPTED A PENDING FRIEND (completed/failed?)
                case 7:
                    AcceptedPendingFriend(data);
                    guiController.SetDebugText("Accepted pending friend");
                    break;
                // REJECTED FRIENDSHIP REQUEST (completed/failed?)
                case 8:
                    RejectedPendingFriend(data);
                    guiController.SetDebugText("rejected pending friend");
                    break;
                // REMOVED A FRIEND (completed/failed?)
                case 9:
                    RemovedFriendship(data);
                    guiController.SetDebugText("Friend Removed");
                    break;
                case 10:
                    FillPendingList(data);
                    guiController.SetDebugText("Pending friendList");
                    break;
                //get Account data
                case 11:
                    ReceiveAccountInfo(data, false);
                    waitForAccount = false;
                    break;
                case 20:
                    GetChatchannels(data);
                    guiController.SetDebugText("Got all chatchannels");
                    break;
                //join channel and get members
                case 21:
                    JoinChannel(data);
                    break;
                case 32: //get guildInfo
                    GetGuildInfo(data);
                    guiController.SetDebugText("Got guild info");
                    break;
                case 35: //get Guildmembers
                    GetGuildMembers(data);
                    guiController.SetDebugText("Got guildmembers");
                    break;
                //party invite sent
                case 40:
                    myAccount.partyID = Convert.ToInt32(data);
                    myParty = new Party(myAccount, myAccount.partyID);
                    guiController.AddToChat("Party invite sent.");
                    break;
                //get party invite
                case 41:
                    GetPartyInvite(data);
                    break;
                //new party member
                case 42:
                    guiController.AddToChat(data + " has joined the party!");
                    break;
                //your party invitation was declined
                case 43:
                    guiController.AddToChat(data + " has rejected your party request.");
                    break;
                //get party members
                case 44:
                    FormatPartyMembers(data);
                    break;
                //get all clients in home
                case 50:
                    GetAccountsInHome(data);
                    break;
                default:
                    //#if DEBUG
                    guiController.ShowMessageBox("Received unknown message type from lobbyserver: " + type);
                    //#endif
                    break;
            }
        }