Example #1
0
        public async void HandlePlayerDraw(string cardId, int turn)
        {
            if (string.IsNullOrEmpty(cardId))
            {
                return;
            }
            if (cardId == "GAME_005")
            {
                HandlePlayerGet(cardId, turn);
            }
            else
            {
                if (_game.SetAsideCards.Contains(cardId))
                {
                    _game.SetAsideCards.Remove(cardId);
                }
                LogEvent("PlayerDraw", cardId);
                var correctDeck = _game.PlayerDraw(cardId);

                if (!(await correctDeck) && Config.Instance.AutoDeckDetection && !Helper.MainWindow.NeedToIncorrectDeckMessage &&
                    !Helper.MainWindow.IsShowingIncorrectDeckMessage && _game.IsUsingPremade && _game.CurrentGameMode != GameMode.Spectator)
                {
                    Helper.MainWindow.NeedToIncorrectDeckMessage = true;
                    Logger.WriteLine("Found incorrect deck on PlayerDraw", "GameEventHandler");
                }
                Helper.MainWindow.Overlay.ListViewPlayer.Items.Refresh();
                Helper.MainWindow.PlayerWindow.ListViewPlayer.Items.Refresh();
                _game.AddPlayToCurrentGame(PlayType.PlayerDraw, turn, cardId);
            }
            GameEvents.OnPlayerDraw.Execute(GameV2.GetCardFromId(cardId));
        }