Beispiel #1
0
        public string LeaveGame(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.LobbyAlreadyStarted(guildId));
            }
            if (!game.HaveMultiplayerLobby())
            {
                return(Sentences.LobbySoloLeave(guildId));
            }
            if (!game.IsPlayerInLobby(playerId))
            {
                return(Sentences.LobbyAlreadyOut(guildId));
            }
            game.RemovePlayerFromLobby(playerId);
            return(Sentences.LobbyLeaved(guildId) + (game.IsLobbyEmpty() ? Environment.NewLine + Sentences.LobbyEmpty(guildId) : ""));
        }