public static IDeck ReadActiveDeck([NotNull] HearthstoneImage image, long?inputSelectedDeckId)
        {
            if (image == null)
            {
                throw new ArgumentNullException(nameof(image));
            }

            if (image["DeckPickerTrayDisplay"] == null && inputSelectedDeckId == null)
            {
                return(null);
            }

            if (image["CollectionManager"] == null)
            {
                return(null);
            }

            var selectedDeckId = GetSelectedDeckId(image) ?? inputSelectedDeckId ?? 0;
            var deckFromMemory = ReadSelectedDeck(image, selectedDeckId);

            if (deckFromMemory != null)
            {
                return(deckFromMemory);
            }

            var matchInfo = MatchInfoReader.ReadMatchInfo(image);

            if (matchInfo == null)
            {
                return(null);
            }

            switch (matchInfo.GameType)
            {
            case GameType.GT_ARENA:
                return(GetArenaDeck(image));

            case GameType.GT_CASUAL:
                return(GetCasualDeck(image));

            case GameType.GT_RANKED:
                return(GetRankedDeck(image));

            case GameType.GT_VS_AI:
                return(GetSoloDeck(image, matchInfo.MissionId));

            case GameType.GT_VS_FRIEND:
                return(GetFriendlyDeck(image));

            case GameType.GT_PVPDR:
            case GameType.GT_PVPDR_PAID:
                return(GetDuelsDeck(image));

            default: return(null);
            }
        }
Пример #2
0
 public IMatchInfo GetMatchInfo() => MatchInfoReader.ReadMatchInfo(this.image);