private void Update(int tier, IEnumerable <Race> availableRaces) { if (ActiveTier == tier) { return; } ActiveTier = tier; foreach (var item in _tierIcons) { item.Active = tier == item.Tier; } if (tier < 1 || tier > 6) { for (var i = 0; i < 6; i++) { _tierIcons[i].SetFaded(false); } Groups.Clear(); return; } for (var i = 0; i < 6; i++) { _tierIcons[i].SetFaded(i != tier - 1); } var resort = false; foreach (var race in _db.Value.Races) { var title = race == Race.INVALID ? "Other" : HearthDbConverter.RaceConverter(race); var cards = _db.Value.GetCards(tier, race).ToList(); if (race == Race.INVALID) { cards.AddRange(GetUnavailableRaceCards(availableRaces).Where(x => x.TechLevel == tier)); } if (cards.Count == 0) { Groups.FirstOrDefault(x => x.Title == title)?.Hide(); } else { var available = race == Race.ALL || race == Race.INVALID || availableRaces.Contains(race); resort |= AddOrUpdateBgCardGroup(title, cards, available); } } if (resort) { var items = Groups.ToList() .OrderBy(x => string.IsNullOrEmpty(x.Title) || x.Title == "Other") .ThenBy(x => x.Title); foreach (var item in items) { Groups.Remove(item); Groups.Add(item); } } }
private void UpdateCurrentTierList(int tier) { if (_currentTierlist == tier) { return; } _currentTierlist = tier; foreach (var item in _tierlistIcons) { item.Active = tier == item.Tier; } if (tier < 1 || tier > 6) { for (var i = 0; i < 6; i++) { _tierlistIcons[i].Opacity = 1; } BgHideTierlist.Opacity = 0.3; BgCardGroups.Clear(); return; } BgHideTierlist.Opacity = 1; for (var i = 0; i < 6; i++) { _tierlistIcons[i].Opacity = i == tier - 1 ? 1 : 0.5; } var resort = false; foreach (var race in _bgDb.Value.Races) { var title = race == Race.INVALID ? "Other" : HearthDbConverter.RaceConverter(race); var cards = _bgDb.Value.GetCards(tier, race); if (cards.Count == 0) { BgCardGroups.FirstOrDefault(x => x.Title == title)?.Hide(); } else { resort |= AddOrUpdateBgCardGroup(title, cards); } } if (resort) { var items = BgCardGroups.ToList() .OrderBy(x => string.IsNullOrEmpty(x.Title)) .ThenBy(x => x.Title); foreach (var item in items) { BgCardGroups.Remove(item); BgCardGroups.Add(item); } } }
public void PlayerPlay(Card card) { //Hearthstone_Deck_Tracker.API.Core.Game.Player.PlayerCardList.Any(c => c.Id == HearthDb.CardIds.Collectible.Neutral.PatchesThePirate) //Hearthstone_Deck_Tracker.API.Core.Game.Player.Deck.Any(e => e.CardId == HearthDb.CardIds.Collectible.Neutral.PatchesThePirate) if (card.Race == HearthDbConverter.RaceConverter(HearthDb.Enums.Race.PIRATE) && Hearthstone_Deck_Tracker.API.Core.Game.Player.PlayerCardList.Any(c => c.Id == HearthDb.CardIds.Collectible.Neutral.PatchesThePirate && c.Count > 0)) { if (Hearthstone_Deck_Tracker.API.Core.Game.Player.Board.Count(e => e.GetTag(HearthDb.Enums.GameTag.ZONE_POSITION) > 0) < 6) { Card patches = Hearthstone_Deck_Tracker.API.Core.Game.Player.PlayerCardList.First(c => c.Id == HearthDb.CardIds.Collectible.Neutral.PatchesThePirate); //Hearthstone_Deck_Tracker.API.Core.Game.Player. _attackers.Add(patches.Name); OnPatchesEnter(patches.Name); } } //if (Hearthstone_Deck_Tracker.API.Core.Game.Player.Deck.Any(e => e.Card.Name == "Patches the Pirate")) //throw new NotImplementedException(); }
private void Update(int tier, IEnumerable <Race> availableRaces) { if (ActiveTier == tier) { return; } ActiveTier = tier; foreach (var item in _tierIcons) { item.Active = tier == item.Tier; } if (tier < 1 || tier > 6) { for (var i = 0; i < 6; i++) { _tierIcons[i].SetFaded(false); } Groups.Clear(); UnavailableTypes.UnavailableTypesVisibility = System.Windows.Visibility.Collapsed; return; } for (var i = 0; i < 6; i++) { _tierIcons[i].SetFaded(i != tier - 1); } var resort = false; var unavailableRaces = string.Join(", ", _db.Value.Races.Where(x => !availableRaces.Contains(x) && x != Race.INVALID && x != Race.ALL).Select(x => HearthDbConverter.RaceConverter(x))); UnavailableTypes.UnavailableTypesVisibility = System.Windows.Visibility.Visible; UnavailableTypes.UnavailableRacesText = unavailableRaces; foreach (var race in _db.Value.Races) { var title = race == Race.INVALID ? "Other" : HearthDbConverter.RaceConverter(race); var cards = _db.Value.GetCards(tier, race).ToList(); if (race == Race.MURLOC) { cards = cards.Where(x => x.Id != NonBgMurlocTidehunterCardId).ToList(); } if (race == Race.INVALID) { cards.AddRange(GetUnavailableRaceCards(availableRaces).Where(x => x.TechLevel == tier)); } if (cards.Count == 0) { Groups.FirstOrDefault(x => x.Title == title)?.Hide(); } else { if (race == Race.ALL || race == Race.INVALID || availableRaces.Contains(race)) { resort |= AddOrUpdateBgCardGroup(title, cards); } } } if (resort) { var items = Groups.ToList() .OrderBy(x => string.IsNullOrEmpty(x.Title) || x.Title == "Other") .ThenBy(x => x.Title); foreach (var item in items) { Groups.Remove(item); Groups.Add(item); } } }