예제 #1
0
        public string JoinGame(ulong guildId, ulong chanId, ulong playerId)
        {
            AGame game = _games.Find(x => x.IsSelf(chanId));

            if (game == null)
            {
                return(Sentences.LobbyNoWaiting(guildId));
            }
            if (!game.IsWaitingForPlayers())
            {
                return(Sentences.LobbyNoWaiting(guildId));
            }
            if (!game.HaveMultiplayerLobby())
            {
                return(Sentences.LobbySoloJoin(guildId));
            }
            if (game.IsFull())
            {
                return(Sentences.LobbyFull(guildId));
            }
            if (game.IsPlayerInLobby(playerId))
            {
                return(Sentences.LobbyAlreadyInThis(guildId));
            }
            if (_games.Any(x => x.IsPlayerInLobby(playerId)))
            {
                return(Sentences.LobbyAlreadyIn(guildId));
            }
            game.AddPlayerToLobby(playerId);
            return(Sentences.LobbyJoined(guildId, game.GetName()));
        }