コード例 #1
0
        public static void SetCardToCheck()
        {
            List <Card> cards     = new List <Card>();
            var         cardsName = new[]
            {
                "Hand of A'dal",
                "Libram of Wisdom",
                "Libram of Hope",
                "Adaptation",
                "Blessing of Might",
                "Blessing of Wisdom",
                "Divine Strength",
                "Hand of Protection",
                "Sand Breath",
                "Lightforged Blessing",
                "Potion of Heroism",
                "Sound the Bells!",
                "Gift of Luminance",
                "Seal of Champions",
                "Blessing of Kings",
                "Silvermoon Portal",
                "Blessed Champion",
                "Blessing of Authority",
                "Pharaoh's Blessing"
            };

            foreach (var cardName in cardsName)
            {
                var card = new Card(Cards.GetFromName(cardName, Locale.enUS));
                cards.Add(card);
            }

            _cardsToCheck = cards;
        }
コード例 #2
0
 public CardInCollection(Card card, int amountNonGolden = 0, int amountGolden = 0)
 {
     Card = card;
     AmountNonGolden = amountNonGolden;
     AmountGolden = amountGolden;
     DesiredAmount = MaxAmountInCollection;
 }
コード例 #3
0
		public GameV2()
		{
            Entities = new Dictionary<int, Entity>();
			CurrentGameMode = GameMode.None;
			IsInMenu = true;
			SetAsideCards = new List<string>();
			OpponentReturnedToDeck = new List<KeyValuePair<string, int>>();
			PlayerDeck = new ObservableCollection<Card>();
			PlayerDrawn = new ObservableCollection<Card>();
			PlayerDrawnIdsTotal = new ObservableCollection<string>();
			OpponentCards = new ObservableCollection<Card>();
			PossibleArenaCards = new List<Card>();
			PossibleConstructedCards = new List<Card>();
			OpponentHandAge = new int[MaxHandSize];
			OpponentHandMarks = new CardMark[MaxHandSize];
			OpponentStolenCardsInformation = new Card[MaxHandSize];
			OpponentSecrets = new OpponentSecrets();
			for(var i = 0; i < MaxHandSize; i++)
			{
				OpponentHandAge[i] = -1;
				OpponentHandMarks[i] = CardMark.None;
			}

			
		}
コード例 #4
0
		static Game()
		{
			Entities = new Dictionary<int, Entity>();
			CurrentGameMode = GameMode.None;
			IsInMenu = true;
			SetAsideCards = new List<string>();
			OpponentReturnedToDeck = new List<KeyValuePair<string, int>>();
			PlayerDeck = new ObservableCollection<Card>();
			PlayerDrawn = new ObservableCollection<Card>();
			OpponentCards = new ObservableCollection<Card>();
			PossibleArenaCards = new List<Card>();
			PossibleConstructedCards = new List<Card>();
			_cardDb = new Dictionary<string, Card>();
			OpponentHandAge = new int[MaxHandSize];
			OpponentHandMarks = new CardMark[MaxHandSize];
			OpponentStolenCardsInformation = new Card[MaxHandSize];
			OpponentSecrets = new OpponentSecrets();
			for(var i = 0; i < MaxHandSize; i++)
			{
				OpponentHandAge[i] = -1;
				OpponentHandMarks[i] = CardMark.None;
			}

			LoadCardDb(Helper.LanguageDict.ContainsValue(Config.Instance.SelectedLanguage) ? Config.Instance.SelectedLanguage : "enUS");
		}
コード例 #5
0
        private async Task <Tuple <int, int> > GetCardsAmount(Hearthstone_Deck_Tracker.Hearthstone.Card card,
                                                              double cardPosX, double card2PosX, double cardPosY)
        {
            if (!User32.IsHearthstoneInForeground())
            {
                Log.WriteLine("Importing aborted, window lost focus", LogType.Info, LOGGER_CATEGORY);
                throw new ImportingException("Hearthstone window lost focus");
            }

            await ClickOnPoint(HearthstoneWindow, SearchBoxPosition, ImportStepDelay);

            string searchInput = Hearthstone_Deck_Tracker.Exporting.ExportingHelper.GetSearchString(card);

            if (PasteFromClipboard)
            {
                Clipboard.SetText(searchInput);
                SendKeys.SendWait("^v");
            }
            else
            {
                SendKeys.SendWait(searchInput);
            }
            SendKeys.SendWait("{ENTER}");

            Log.WriteLine("try to import card: " + card.Name, LogType.Debug, LOGGER_CATEGORY);
            await Task.Delay(ImportStepDelay * 3);

            Tuple <int, int> result;
            int posX  = (int)cardPosX;
            int posY  = (int)cardPosY;
            int posX2 = (int)card2PosX;

            if (CardExists(HearthstoneWindow, posX, posY))
            {
                int firstCardAmount = HasAmountLabel(HearthstoneWindow, posX, posY) ? 2 : 1;
                if (CardExists(HearthstoneWindow, posX2, posY))
                {
                    int secondCardAmount = HasAmountLabel(HearthstoneWindow, posX2, posY) ? 2 : 1;
                    result = new Tuple <int, int>(firstCardAmount, secondCardAmount);
                }
                else
                {
                    if (IsGoldenCard(HearthstoneWindow, posX, posY))
                    {
                        result = new Tuple <int, int>(0, firstCardAmount);
                    }
                    else
                    {
                        result = new Tuple <int, int>(firstCardAmount, 0);
                    }
                }
            }
            else
            {
                result = new Tuple <int, int>(0, 0);
            }

            return(result);
        }
コード例 #6
0
 // Discard from hand, e.g. when playing Soulfire
 internal void PlayerHandDiscard(Hearthstone_Deck_Tracker.Hearthstone.Card card)
 {
     Console.WriteLine("PlayerHandDiscard " + card.Name);
     if (!_isProcessingTask)
     {
         launchAgent();
     }
 }
コード例 #7
0
		public static string GetSearchString(Card card)
		{
			var searchString = card.LocalizedName.ToLowerInvariant();
			if(AddArtist)
				searchString += " " + card.Artist.ToLowerInvariant();
			searchString += GetSpecialSearchCases(card.Name);
			return searchString;
		}
コード例 #8
0
		public CardObject(Card card)
		{
			if(card != null)
			{
				id = card.Id;
				count = card.Count.ToString();
			}
		}
コード例 #9
0
 public CardStats(string id)
 {
     card = Database.GetCardFromId(id);
     drawn = 0;
     played = 0;
     won = 0;
     loss = 0;
 }
コード例 #10
0
        // todo make choose random not just first;
        public SoundPlaySetting GetBattleCryFor(Card card, CardSource cardSource)
        {
            var soundPlaySetting = _configManager.Config.SoundFiles.FirstOrDefault((sound) =>
            {
                return (sound.CardSource == CardSource.All || cardSource == sound.CardSource) && sound.CardId == card.Id;
            });

            return soundPlaySetting;
        }
コード例 #11
0
		protected CardBarImageBuilder(Card card, string dir)
		{
			Card = card;
			ThemeDir = dir;
			TextTypeFace = Helper.LatinLanguages.Contains(Config.Instance.SelectedLanguage)
							   ? NumbersTypeFace : new Typeface(new FontFamily(), FontStyles.Normal, FontWeights.Bold, FontStretches.Condensed);
			HasAllRequired = Required.All(x => File.Exists(Path.Combine(ThemeDir, x.Value.FileName)));
			HasAllOptionalFrames = OptionalFrame.All(x => File.Exists(Path.Combine(ThemeDir, x.Value.FileName)));
			HasAllOptionalGems = OptionalGems.All(x => File.Exists(Path.Combine(ThemeDir, x.Value.FileName)));
			HasAllOptionalCountBoxes = OptionalCountBoxes.All(x => File.Exists(Path.Combine(ThemeDir, x.Value.FileName)));
		}
コード例 #12
0
        private void OnMouseOver(Card card)
        {
            if (!card.IsAnyfin() || !_config.ClassicMode)
            {
                return;
            }
            Log.Debug("Anyfin hover detected");
            var damageDealt  = _calculator.CalculateDamageDealt();
            var friendlyText = damageDealt.Minimum == damageDealt.Maximum ? "" : "between ";

            PlaceTextboxWithText($"Anyfin can deal {friendlyText}{damageDealt}");
        }
コード例 #13
0
        public static void SetCardToCheck(List <string> names)
        {
            List <Card> cards = new List <Card>();

            foreach (var cardName in names)
            {
                var card = new Card(Cards.GetFromName(cardName, Locale.enUS));
                cards.Add(card);
            }

            _cardsToCheck = cards;
        }
コード例 #14
0
        private void OnPlay(Card card, CardSource cardSource)
        {
            var soundToPlay = _cardSoundPicker.GetBattleCryFor(card, cardSource);
            if(soundToPlay == null)
            {
                Hearthstone_Deck_Tracker.Logger.WriteLine("BattleCry SFX not found");
                return;
            }

            _soundBoard.Play(soundToPlay);
            Hearthstone_Deck_Tracker.Logger.WriteLine("BattleCry Sound Effect Triggered");
        }
コード例 #15
0
ファイル: PackWatcher.cs プロジェクト: omgfrost/PackTracker
        private void NewPack(object sender, PackEventArgs e)
        {
            DateTime           Time  = DateTime.Now;
            List <Entity.Card> Cards = new List <Entity.Card>();

            foreach (var Card in e.Cards)
            {
                HDTCard cardFromId = Database.GetCardFromId(Card.Id);
                Cards.Add(new Entity.Card(cardFromId, 1 == Card.PremiumType));
            }

            OnPackOpened(new Pack(e.PackId, Time, Cards));
        }
コード例 #16
0
        private void UpdateDisplay(Card c)
        {
            if (!_inAnyfinGame)
            {
                return;
            }
            Range <int> range = _calculator.CalculateDamageDealt();

            _display.DamageText = $"{range.Minimum}\n{range.Maximum}";
            if (_display.Visibility == Visibility.Collapsed)
            {
                _display.Visibility = _calculator.DeadMurlocs.Any() ? Visibility.Visible : Visibility.Collapsed;
            }
        }
コード例 #17
0
        private HDTCard GetQuestReward(HDTCard questCard)
        {
            HDTCard rValue = null;


            switch (questCard.Id)
            {
            case CollCards.Druid.JungleGiants:
                rValue = Database.GetCardFromId(NonCollCards.Druid.JungleGiants_BarnabusTheStomperToken);
                break;

            case CollCards.Hunter.TheMarshQueen:
                rValue = Database.GetCardFromId(NonCollCards.Hunter.TheMarshQueen_QueenCarnassaToken);
                break;

            case CollCards.Mage.OpenTheWaygate:
                rValue = Database.GetCardFromId(NonCollCards.Mage.OpentheWaygate_TimeWarpToken);
                break;

            case CollCards.Paladin.TheLastKaleidosaur:
                rValue = Database.GetCardFromId(NonCollCards.Paladin.TheLastKaleidosaur_GalvadonToken);
                break;

            case CollCards.Priest.AwakenTheMakers:
                rValue = Database.GetCardFromId(NonCollCards.Priest.AwakentheMakers_AmaraWardenOfHopeToken);
                break;

            case CollCards.Rogue.TheCavernsBelow:
                rValue = Database.GetCardFromId(NonCollCards.Rogue.TheCavernsBelow_CrystalCoreToken);
                break;

            case CollCards.Shaman.UniteTheMurlocs:
                rValue = Database.GetCardFromId(NonCollCards.Shaman.UnitetheMurlocs_MegafinToken);
                break;

            case CollCards.Warlock.LakkariSacrifice:
                // There are two tokens;
                // Possibly! the first is the card to play.
                // Possibly! the second is the card on board.
                rValue = Database.GetCardFromId(NonCollCards.Warlock.LakkariSacrifice_NetherPortalToken1);
                break;

            case CollCards.Warrior.FirePlumesHeart:
                rValue = Database.GetCardFromId(NonCollCards.Warrior.FirePlumesHeart_SulfurasToken);
                break;
            }

            return(rValue);
        }
コード例 #18
0
        private bool IsQuestCard(HDTCard c)
        {
            if (!c.Collectible || c.CardSet == null || !c.CardSet.Equals(CardSet.UNGORO))
            {
                return(false);
            }

            // Loop through all entities to find the passed down card
            var entity = CoreAPI.Game.Entities.Select(kv => kv.Value).Where(e => e.Card.Equals(c)).FirstOrDefault();

            if (entity == null || !entity.IsQuest)
            {
                return(false);
            }

            return(true);
        }
コード例 #19
0
        private bool IsQuestCardV2(HDTCard c)
        {
            switch (c.Id)
            {
            case CollCards.Druid.JungleGiants:
            case CollCards.Hunter.TheMarshQueen:
            case CollCards.Mage.OpenTheWaygate:
            case CollCards.Paladin.TheLastKaleidosaur:
            case CollCards.Priest.AwakenTheMakers:
            case CollCards.Rogue.TheCavernsBelow:
            case CollCards.Shaman.UniteTheMurlocs:
            case CollCards.Warlock.LakkariSacrifice:
            case CollCards.Warrior.FirePlumesHeart:
                return(true);

            default:
                return(false);
            }
        }
コード例 #20
0
        internal void OnMouseOver(Card card)
        {
            IEnumerable <Entity> graveyard = Core.Game.Player.Graveyard ?? Enumerable.Empty <Entity>();

            if (card.IsNzoth())
            {
                List <Card> deadDeathrattleMinions = new List <Card>();
                foreach (Entity ce in graveyard)
                {
                    if (ce.Card == null)
                    {
                        continue;
                    }
                    if (ce.Card.Mechanics.Contains("Deathrattle") && !ce.Info.Discarded)
                    {
                        deadDeathrattleMinions.Add(ce.Card);
                    }
                }

                _list.Update(deadDeathrattleMinions);
                _list.Show();
            }
            else if (card.IsResurrect() || card.IsOnyxBishop())
            {
                List <Card> deadMinions = new List <Card>();
                foreach (Entity ce in graveyard)
                {
                    if (ce.Card == null)
                    {
                        continue;
                    }
                    if (ce.Card.Type == "Minion" && !ce.Info.Discarded)
                    {
                        deadMinions.Add(ce.Card);
                    }
                }

                _list.Update(deadMinions);
                _list.Show();
            }
        }
コード例 #21
0
        private static void LogDeckChange(bool opponent, Card card, bool decrease)
        {
            int previous = decrease ? card.Count + 1 : card.Count - 1;

            Logger.WriteLine(string.Format("({0} deck) {1} count {2} -> {3}", opponent?"opponent":"player", card.Name, previous, card.Count),
                             "Hearthstone");
        }
コード例 #22
0
		public static void Reset(bool resetStats = true)
		{
			Logger.WriteLine(">>>>>>>>>>> Reset <<<<<<<<<<<", "Game");

			ReplayMaker.Reset();
			PlayerDrawn.Clear();
			Entities.Clear();
			PlayerId = -1;
			OpponentId = -1;
			SavedReplay = false;
			PlayerHandCount = 0;
			PlayerFatigueCount = 0;
			OpponentSecretCount = 0;
			OpponentCards.Clear();
			OpponentHandCount = 0;
			OpponentFatigueCount = 0;
			OpponentDeckCount = 30;
			PlayerDeckSize = 30;
			SecondToLastUsedId = null;
			OpponentHandAge = new int[MaxHandSize];
			OpponentHandMarks = new CardMark[MaxHandSize];
			OpponentStolenCardsInformation = new Card[MaxHandSize];
			OpponentSecrets.ClearSecrets();
			NoMatchingDeck = false;

			for(var i = 0; i < MaxHandSize; i++)
			{
				OpponentHandAge[i] = -1;
				OpponentHandMarks[i] = CardMark.None;
			}

			// Assuming opponent has coin, corrected if we draw it
			OpponentHandMarks[DefaultCoinPosition] = CardMark.Coin;
			OpponentHandAge[DefaultCoinPosition] = 0;
			OpponentHasCoin = true;

			SetAsideCards.Clear();
			OpponentReturnedToDeck.Clear();

			//if(CurrentGameMode == GameMode.Ranked) //otherwise switching from playing ranked to casual causes problems
			//	CurrentGameMode = GameMode.Casual;


			if(!IsInMenu && resetStats)
			{
				if(CurrentGameMode != GameMode.Spectator)
					CurrentGameMode = GameMode.None;
				CurrentGameStats = new GameStats(GameResult.None, PlayingAgainst, PlayingAs)
				{
					PlayerName = PlayerName,
					OpponentName = OpponentName,
					Region = CurrentRegion
				};
			}
			hsLogLines = new List<string>();
		}
コード例 #23
0
 internal void OpponentHandDiscard(Hearthstone_Deck_Tracker.Hearthstone.Card card)
 {
     Console.WriteLine("??????? OpponentHandDiscard " + card.Name);
 }
コード例 #24
0
 internal void OpponentJoustReveal(Hearthstone_Deck_Tracker.Hearthstone.Card card)
 {
     Console.WriteLine("??????? OpponentJoustReveal " + card.Name);
 }
コード例 #25
0
		private void RemoveCardFromDeck(Card card)
		{
			if(card == null)
				return;
			if(card.Count > 1)
				card.Count--;
			else
				_newDeck.Cards.Remove(card);

			UpdateCardCount();
			Helper.SortCardCollection(ListViewDeck.Items, Config.Instance.CardSortingClassFirst);
			ManaCurveMyDecks.UpdateValues();
			try
			{
				TextBoxDBFilter.Focus();
				TextBoxDBFilter.Select(0, TextBoxDBFilter.Text.Length);
			}
			catch
			{
			}
			UpdateExpansionIcons();
		}
コード例 #26
0
 internal void OpponentPlayToGraveyard(Hearthstone_Deck_Tracker.Hearthstone.Card card)
 {
     Console.WriteLine("??????? OpponentPlayToGraveyard " + card.Name);
 }
コード例 #27
0
		public bool EqualsWithCount(Card card) => card.Id == Id && card.Count == Count;
コード例 #28
0
		public CardImageBuilder(Card card)
		{
			_card = card;
		}
コード例 #29
0
 internal void PlayerMulligan(Hearthstone_Deck_Tracker.Hearthstone.Card card)
 {
     Console.WriteLine("??????? PlayerMulligan " + card.Name);
 }
コード例 #30
0
 internal void OpponentSecretTriggered(Hearthstone_Deck_Tracker.Hearthstone.Card card)
 {
     Console.WriteLine("??????? OpponentSecretTriggered " + card.Name);
 }
コード例 #31
0
 internal void OpponentDeckToPlay(Hearthstone_Deck_Tracker.Hearthstone.Card card)
 {
     Console.WriteLine("??????? OpponentDeckToPlay " + card.Name);
 }
コード例 #32
0
 internal void PlayerCreateInPlay(Hearthstone_Deck_Tracker.Hearthstone.Card card)
 {
     Console.WriteLine("??????? PlayerCreateInPlay " + card.Name);
 }
コード例 #33
0
		public static bool IsActualCard(Card card)
		{
			return Database.IsActualCard(card);
		}
コード例 #34
0
		public ClassicBarImageBuilder(Card card, string dir) : base(card, dir)
		{
			ImageOffset = FadeOffset = CreatedIconOffset = -19;
			CostFontSize = 18;
			CountFontSize = 16;
		}
コード例 #35
0
		///<summary>
		/// Returns -1 if Hearthstone loses focus
		/// </summary>
		public static async Task<int> AddCardToDeck(Card card, ExportingInfo info)
		{
			if(!User32.IsHearthstoneInForeground())
			{
				Core.MainWindow.ShowMessage("Exporting aborted", "Hearthstone window lost focus.").Forget();
				Logger.WriteLine("Exporting aborted, window lost focus", "DeckExporter");
				return -1;
			}

			if(Config.Instance.ExportForceClear)
				await ClearSearchBox(info.HsHandle, info.SearchBoxPos);

			await ClickOnPoint(info.HsHandle, info.SearchBoxPos);

			if(Config.Instance.ExportPasteClipboard)
			{
				Clipboard.SetText(GetSearchString(card));
				SendKeys.SendWait("^v");
			}
			else
				SendKeys.SendWait(GetSearchString(card));
			SendKeys.SendWait("{ENTER}");

			Logger.WriteLine("try to export card: " + card, "DeckExporter");
			await Task.Delay(Config.Instance.DeckExportDelay * 2);

			if(await CheckForSpecialCases(card, info.CardPosX + 50, info.Card2PosX + 50, info.CardPosY + 50, info.HsHandle))
				return 0;

			//Check if Card exist in collection
			if(CardExists(info.HsHandle, (int)info.CardPosX, (int)info.CardPosY, info.HsRect.Width, info.HsRect.Height))
			{
				//Check if a golden exist
				if(Config.Instance.PrioritizeGolden
				   && CardExists(info.HsHandle, (int)info.Card2PosX, (int)info.CardPosY, info.HsRect.Width, info.HsRect.Height))
				{
					await ClickOnPoint(info.HsHandle, new Point((int)info.Card2PosX + 50, (int)info.CardPosY + 50));

					if(card.Count == 2)
					{
						await ClickOnPoint(info.HsHandle, new Point((int)info.Card2PosX + 50, (int)info.CardPosY + 50));
						await ClickOnPoint(info.HsHandle, new Point((int)info.CardPosX + 50, (int)info.CardPosY + 50));
					}
				}
				else
				{
					await ClickOnPoint(info.HsHandle, new Point((int)info.CardPosX + 50, (int)info.CardPosY + 50));

					if(card.Count == 2)
					{
						//Check if two card are not available 
						await Task.Delay(200 - Config.Instance.DeckExportDelay);
						if(CardHasLock(info.HsHandle, (int)(info.CardPosX + info.HsRect.Width * 0.048),
						                               (int)(info.CardPosY + info.HsRect.Height * 0.287), info.HsRect.Width, info.HsRect.Height))
						{
							if(CardExists(info.HsHandle, (int)info.Card2PosX, (int)info.CardPosY, info.HsRect.Width, info.HsRect.Height))
							{
								await ClickOnPoint(info.HsHandle, new Point((int)info.Card2PosX + 50, (int)info.CardPosY + 50));
								return 0;
							}
							Logger.WriteLine("Only one copy found: " + card.Name, "DeckExporter");
							return 1;
						}

						await ClickOnPoint(info.HsHandle, new Point((int)info.CardPosX + 50, (int)info.CardPosY + 50));
					}
				}
			}
			else
				return card.Count;
			return 0;
		}
コード例 #36
0
        private static Deck CreateDungeonDeck(string playerClass, CardSet set, bool isPVPDR, List <int> selectedDeck = null, Card loadout = null)
        {
            var shrine = Core.Game.Player.Board.FirstOrDefault(x => x.HasTag(GameTag.SHRINE))?.CardId;

            Log.Info($"Creating new {playerClass} dungeon run deck (CardSet={set}, Shrine={shrine}, SelectedDeck={selectedDeck != null})");
            var deck = selectedDeck == null
                                ? DungeonRun.GetDefaultDeck(playerClass, set, shrine)
                                : DungeonRun.GetDeckFromDbfIds(playerClass, set, isPVPDR, selectedDeck);

            if (deck == null)
            {
                Log.Info($"Could not find default deck for {playerClass} in card set {set} with Shrine={shrine}");
                return(null);
            }
            if (loadout != null && selectedDeck != null && !selectedDeck.Contains(loadout.DbfIf))
            {
                deck.Cards.Add(loadout);
            }
            DeckList.Instance.Decks.Add(deck);
            DeckList.Save();
            Core.MainWindow.DeckPickerList.UpdateDecks();
            Core.MainWindow.SelectDeck(deck, true);
            return(deck);
        }
コード例 #37
0
		public static bool IsActualCard(Card card) => Database.IsActualCard(card);
コード例 #38
0
		private void AddCardToDeck(Card card)
		{
			if(card == null)
				return;
			var cardInDeck = _newDeck.Cards.FirstOrDefault(c => c.Name == card.Name);
			if(cardInDeck != null)
			{
				if(!_newDeck.IsArenaDeck && CheckBoxConstructedCardLimits.IsChecked == true 
					&&(cardInDeck.Count >= 2 || cardInDeck.Rarity == Rarity.Legendary && cardInDeck.Count >= 1))
					return;
				cardInDeck.Count++;
			}
			else
				_newDeck.Cards.Add(card);

			UpdateCardCount();
			Helper.SortCardCollection(ListViewDeck.Items, Config.Instance.CardSortingClassFirst);
			ManaCurveMyDecks.UpdateValues();
			try
			{
				TextBoxDBFilter.Focus();
				TextBoxDBFilter.Select(0, TextBoxDBFilter.Text.Length);
			}
			catch
			{
			}
			UpdateExpansionIcons();
		}
コード例 #39
0
 internal void OpponentCreateInDeck(Hearthstone_Deck_Tracker.Hearthstone.Card card)
 {
     Console.WriteLine("??????? OpponentCreateInDeck " + card.Name);
 }
コード例 #40
0
		public static CardBarImageBuilder GetBarImageBuilder(Card card)
		{
			var buildType = CurrentTheme.BuildType ?? typeof(DefaultBarImageBuilder);
			return (CardBarImageBuilder)Activator.CreateInstance(buildType, card, CurrentTheme.Directory);
		}
コード例 #41
0
		public CardImageObject(Card card)
		{
			Count = card.Count;
			Jousted = card.Jousted;
			ColoredFrame = Config.Instance.RarityCardFrames;
			ColoredGem = Config.Instance.RarityCardGems;
			Theme = ThemeManager.CurrentTheme?.Name;
			TextColorHash = card.ColorPlayer.Color.GetHashCode();
			Created = card.IsCreated;
		}
コード例 #42
0
        static private List <Deck> ParseDoc(IHtmlDocument document, string className)
        {
            List <Deck> metaDecks = new List <Deck>();

            IEnumerable <IElement> decks = document.All.Where(x => x.ClassName == "decklist");

            foreach (var deck in decks)
            {
                Deck     d    = new Deck();
                IElement atag = deck.QuerySelectorAll("a").Eq(0);
                d.Class = className;
                d.Name  = atag.Text();
                d.Name  = d.Name.Substring(0, d.Name.LastIndexOf("#")).Trim();
                d.Url   = atag.GetAttribute("href").Trim();
                IElement divtag = deck.QuerySelectorAll("div").Eq(1);
                var      games  = divtag.Text().Trim().Replace("#Games: ", "").Trim();
                d.Note = games.Substring(0, games.IndexOf("\n", 0)).Trim(); // used to store the number of games played with the deck
                var cards = deck.QuerySelectorAll(".card-list-item");

                foreach (var card in cards)
                {
                    IElement img      = card.QuerySelectorAll("img").Eq(0);
                    String   src      = img.GetAttribute("src");
                    String   name     = card.QuerySelectorAll(".hover-img").Eq(0).Text().Trim();
                    var      id       = src.Substring(src.LastIndexOf("/") + 1).Trim();
                    var      quantity = Int32.Parse(card.QuerySelectorAll(".card-quantity").Eq(0).Text().Replace("x", "").Trim());
                    // Looking up key in HearthDb
                    HearthDb.Card HearthDbCard;
                    try {
                        HearthDbCard = Cards.All[id];
                    } catch {
                        // Failed to find card id in database, looking up by name
                        if (name == "Lord Jaraxxus")
                        {
                            // NOTE: Jaraxxus is a special case that fails all other lookups
                            HearthDbCard = Cards.All["CORE_EX1_323"];
                        }
                        else
                        {
                            HearthDbCard = HearthDb.Cards.GetFromName(name, HearthDb.Enums.Locale.enUS);
                            if (HearthDbCard.Id.Substring(0, 4) != "CORE")
                            {
                                HearthDbCard = null;
                                // Failed to find CORE card on name lookup, doing brute force search...
                                var keys = HearthDb.Cards.Collectible.Keys.ToList(); keys.Sort();
                                foreach (var key in keys)
                                {
                                    var val = HearthDb.Cards.Collectible[key];
                                    if (val.Name.Trim() == name && val.Id.Substring(0, 4) == "CORE")
                                    {
                                        HearthDbCard = val;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    if (HearthDbCard == null)
                    {
                        Log.Error("Error: failed to find card id " + id + " with name: " + name);
                    }
                    else
                    {
                        Hearthstone_Deck_Tracker.Hearthstone.Card c = new Hearthstone_Deck_Tracker.Hearthstone.Card(HearthDbCard);
                        c.Count = quantity;
                        d.Cards.Add(c);
                        Log.Info(className + ", " + d.Name + ", " + c.Count + "x " + c.Name);
                    }
                }
                metaDecks.Add(d);
            }
            return(metaDecks);
        }
コード例 #43
0
		public static async Task<bool> CheckForSpecialCases(Card card, double cardPosX, double card2PosX, double cardPosY, IntPtr hsHandle)
		{
			if(card.Name == "Feugen")
			{
				if(Config.Instance.OwnsGoldenFeugen && Config.Instance.PrioritizeGolden)
					await MouseActions.ClickOnPoint(hsHandle, new Point((int)card2PosX, (int)cardPosY));
				else
					await MouseActions.ClickOnPoint(hsHandle, new Point((int)cardPosX, (int)cardPosY));
				return true;
			}
			if(card.Name == "Stalagg")
			{
				var posX3 = cardPosX + (card2PosX - cardPosX) * 2;
				var posX4 = cardPosX + (card2PosX - cardPosX) * 3;
				if(Config.Instance.OwnsGoldenFeugen)
				{
					if(Config.Instance.OwnsGoldenStalagg && Config.Instance.PrioritizeGolden)
						await MouseActions.ClickOnPoint(hsHandle, new Point((int)posX4, (int)cardPosY));
					else
						await MouseActions.ClickOnPoint(hsHandle, new Point((int)posX3, (int)cardPosY));
				}
				else
				{
					if(Config.Instance.OwnsGoldenStalagg && Config.Instance.PrioritizeGolden)
						await MouseActions.ClickOnPoint(hsHandle, new Point((int)posX3, (int)cardPosY));
					else
						await MouseActions.ClickOnPoint(hsHandle, new Point((int)card2PosX, (int)cardPosY));
				}
				return true;
			}
			return false;
		}
コード例 #44
0
		public object Clone()
		{
			var newcard = new Card(Id, PlayerClass, Rarity, Type, Name, Cost, LocalizedName, InHandCount, Count, Text, Attack, Health,
			                       Race, Mechanics, Durability);
			return newcard;
		}
コード例 #45
0
		public object Clone()
		{
			var newcard = new Card(Id, PlayerClass, Rarity, Type, Name, Cost, LocalizedName, InHandCount, Count, Text, EnglishText, Attack, Health, Race,
			                       Mechanics, Durability, Artist, Set, AlternativeNames, AlternativeTexts);
			return newcard;
		}
コード例 #46
0
		// TODO: possibly refactor with GetActualCards, reduce duplication
		public static bool IsActualCard(Card card)
		{
			if(card == null)
				return false;
			return (card.Type == "Minion" || card.Type == "Spell" || card.Type == "Weapon")
			       && (Helper.IsNumeric(card.Id.ElementAt(card.Id.Length - 1)) || card.Id == "AT_063t")
			       && Helper.IsNumeric(card.Id.ElementAt(card.Id.Length - 2))
			       && !CardIds.InvalidCardIds.Any(id => card.Id.Contains(id));
		}
コード例 #47
0
		public bool EqualsWithCount(Card card)
		{
			return card.Id == Id && card.Count == Count;
		}
コード例 #48
0
		private static bool CanRemoveCard(Card card)
		{
			if(card.IsStolen && card.InHandCount < 1)
				return true;
			if(Config.Instance.RemoveCardsFromDeck && card.Count < 1)
			{
				if((Config.Instance.HighlightCardsInHand && card.InHandCount < 1) || !Config.Instance.HighlightCardsInHand)
					return true;
			}
			return false;
		}
コード例 #49
0
		public void TestDreadscaleIsActual()
		{
			Card c = new Card { Id = "AT_063t", Name = "Dreadscale", Type = "Minion" };
			Assert.IsTrue(Database.IsActualCard(c));
		}
コード例 #50
0
		public DarkBarImageBuilder(Card card, string dir) : base(card, dir)
		{
		}
コード例 #51
0
ファイル: XmlHistory.cs プロジェクト: omgfrost/PackTracker
        public History Fetch()
        {
            History History = new History();

            string path = Path.Combine(Config.AppDataPath, "PackTracker", "History.xml");

            if (File.Exists(path))
            {
                XmlDocument Xml = new XmlDocument();
                Xml.Load(path);
                XmlNode Root = Xml.SelectSingleNode("history");

                if (Root != null)
                {
                    XmlNodeList Packs = Root.SelectNodes("pack");

                    if (Packs.Count > 0)
                    {
                        foreach (XmlNode Pack in Packs)
                        {
                            if (int.TryParse(Pack.Attributes["id"]?.Value, out int packId) && long.TryParse(Pack.Attributes["time"]?.Value, out long ticks))
                            {
                                DateTime    Time  = new DateTime(ticks);
                                XmlNodeList Cards = Pack.SelectNodes("card");

                                if (Cards.Count > 0)
                                {
                                    List <Entity.Card> HistoryCards = new List <Entity.Card>();

                                    foreach (XmlNode Card in Cards)
                                    {
                                        string cardId = Card.Attributes["id"]?.Value;
                                        if (!string.IsNullOrEmpty(cardId))
                                        {
                                            HDTCard HDTCard = Database.GetCardFromId(cardId);
                                            string  premium = Card.Attributes["premium"]?.Value;

                                            HistoryCards.Add(new Entity.Card(HDTCard, premium == "premium"));
                                        }
                                        else
                                        {
                                            return(new History());
                                        }
                                    }

                                    History.Add(new Pack(packId, Time, HistoryCards));
                                }
                                else
                                {
                                    return(new History());
                                }
                            }
                            else
                            {
                                return(new History());
                            }
                        }
                    }
                }
            }

            return(History);
        }
コード例 #52
0
		public static bool IsActualCard(Card card)
		{
			return card != null && HearthDb.Cards.Collectible.ContainsKey(card.Id);
		}
コード例 #53
0
 internal void PlayerPlayToHand(Hearthstone_Deck_Tracker.Hearthstone.Card card)
 {
     Console.WriteLine("??????? PlayerPlayToHand " + card.Name);
 }