LobbyServer.ASK_CHARACTER_CREATE.GetFreeSlot C# (CSharp) Method

GetFreeSlot() public method

public GetFreeSlot ( LobbyClient client ) : Byte
client LobbyClient
return Byte
        public Byte GetFreeSlot(LobbyClient client)
        {
            try
            {
                Byte[] slots = new Byte[] { 1, 2, 3, 4, 5, 6, 7, 8 };
                if (client.Characters.Count != 0)
                {
                    for (int i = 0; i < slots.Length; i++)
                        foreach (CharacterEntry ch in client.Characters)
                            if (ch.Slot != slots[i])
                                return slots[i];
                }
                else return 1;
            }
            catch(Exception e)
            {
                Console.WriteLine(e.ToString());
                return 0;
            }
            return 0;
        }
    }
ASK_CHARACTER_CREATE