public int CompareTo(object obj) { if (!(obj is CollectionCardStack.ArtStack)) { throw new ArgumentException("Object is not an ArtStack."); } CollectionCardStack.ArtStack stack = obj as CollectionCardStack.ArtStack; EntityDef entityDef = DefLoader.Get().GetEntityDef(this.CardID); EntityDef def2 = DefLoader.Get().GetEntityDef(stack.CardID); if (!entityDef.Equals(def2)) { return(CollectionManager.Get().EntityDefSortComparison(entityDef, def2)); } if (!this.Flair.Equals(stack.Flair)) { return(GameUtils.CardFlairSortComparisonAsc(this.Flair, stack.Flair)); } if (!this.NewestInsertDate.Equals(stack.NewestInsertDate)) { return(this.NewestInsertDate.CompareTo(stack.NewestInsertDate)); } if (this.Count != stack.Count) { return(this.Count - stack.Count); } return(this.NumSeen - stack.NumSeen); }
private FilteredArtStack RunFilters_MustPassAll(CollectionCardStack.ArtStack artStack) { if (this.FiltersExist()) { EntityDef entityDef = DefLoader.Get().GetEntityDef(artStack.CardID); if (entityDef == null) { Log.Rachelle.Print(string.Format("WARNING CollectionFilter.RunFilters_MustPassAll() - entityDef for {0} is null", artStack.CardID), new object[0]); return(null); } foreach (CollectionFilter <GAME_TAG> filter in this.m_gameFilters) { if (!this.RunGameFilter(entityDef, filter)) { return(null); } } foreach (CollectionFilter <ACCOUNT_TAG> filter2 in this.m_accountFilters) { if (!this.RunAccountFilter(artStack, filter2)) { return(null); } } if (((this.m_textFilter != null) && this.m_textFilter.ShouldRunFilter()) && !this.RunTextFilter(entityDef, artStack, this.m_textFilter)) { return(null); } } return(new FilteredArtStack(artStack)); }
public void UpdateCurrentPageCardLocks(bool playSound = false) { if (CollectionDeckTray.Get().GetCurrentContentType() != CollectionDeckTray.DeckContentTypes.Cards) { foreach (CollectionCardVisual visual in this.m_collectionCardVisuals) { if (visual.IsShown()) { visual.ShowLock(CollectionCardVisual.LockType.NONE); } } } else { CollectionDeck taggedDeck = CollectionManager.Get().GetTaggedDeck(CollectionManager.DeckTag.Editing); foreach (CollectionCardVisual visual2 in this.m_collectionCardVisuals) { if (visual2.GetVisualType() != CollectionManagerDisplay.ViewMode.CARD_BACKS) { if (!visual2.IsShown()) { visual2.ShowLock(CollectionCardVisual.LockType.NONE); } else { Actor actor = visual2.GetActor(); string cardId = actor.GetEntityDef().GetCardId(); CardFlair cardFlair = actor.GetCardFlair(); CollectionCardStack.ArtStack collectionArtStack = CollectionManager.Get().GetCollectionArtStack(cardId, cardFlair); if (collectionArtStack.Count <= 0) { visual2.ShowLock(CollectionCardVisual.LockType.NONE); } else { CollectionCardVisual.LockType nONE = CollectionCardVisual.LockType.NONE; if (taggedDeck != null) { if (CollectionDeckValidator.GetDeckViolationCardIdOverflow(taggedDeck, cardId, true) != null) { nONE = CollectionCardVisual.LockType.MAX_COPIES_IN_DECK; } if (((nONE == CollectionCardVisual.LockType.NONE) && (collectionArtStack.Count > 0)) && (taggedDeck.GetCardCount(cardId, cardFlair) >= collectionArtStack.Count)) { nONE = CollectionCardVisual.LockType.NO_MORE_INSTANCES; } } visual2.ShowLock(nONE, playSound); } } } else { visual2.ShowLock(CollectionCardVisual.LockType.NONE); } } } }
private bool RunAccountFilter(CollectionCardStack.ArtStack artStack, CollectionFilter <ACCOUNT_TAG> filter) { ACCOUNT_TAG key = filter.GetKey(); if (key != ACCOUNT_TAG.OWNED_COUNT) { return((key == ACCOUNT_TAG.NEWEST_INSERT_DATE) && filter.DoesValueMatch(artStack.NewestInsertDate.Ticks)); } return(filter.DoesValueMatch(artStack.Count)); }
private Map <NetCache.CardDefinition, FilteredArtStack> GenerateMap() { Map <NetCache.CardDefinition, FilteredArtStack> map = new Map <NetCache.CardDefinition, FilteredArtStack>(); foreach (CollectionCardStack stack in CollectionManager.Get().GetCollectibleStacks().Values) { CollectionCardStack.ArtStack artStack = stack.GetArtStack(this.m_flairRestriction); FilteredArtStack stack3 = !this.m_mustPassAllFilters ? this.RunFilters_CanPassAny(artStack) : this.RunFilters_MustPassAll(artStack); if (stack3 != null) { map.Add(stack3.GetCardDefinition(), stack3); } } return(map); }
public bool MergeWithArtStack(CollectionCardStack.ArtStack other) { if (!this.CardID.Equals(other.CardID)) { return(false); } if (!this.Flair.Equals(other.Flair)) { return(false); } this.m_count += other.Count; this.m_numSeen += other.NumSeen; if (this.NewestInsertDate < other.NewestInsertDate) { this.m_newestInsertDate = other.NewestInsertDate; } return(true); }
private List <string> GetPostDisenchantInvalidDeckNames() { Actor shownActor = CraftingManager.Get().GetShownActor(); string cardId = shownActor.GetEntityDef().GetCardId(); CardFlair cardFlair = shownActor.GetCardFlair(); CollectionCardStack.ArtStack collectionArtStack = CollectionManager.Get().GetCollectionArtStack(cardId, cardFlair); int num = Mathf.Max(0, collectionArtStack.Count - 1); SortedDictionary <long, CollectionDeck> decks = CollectionManager.Get().GetDecks(); List <string> list = new List <string>(); foreach (CollectionDeck deck in decks.Values) { if (deck.GetCardCount(cardId, cardFlair) > num) { list.Add(deck.Name); Log.Rachelle.Print(string.Format("Disenchanting will invalidate deck '{0}'", deck.Name), new object[0]); } } return(list); }
private bool DoesMatchAllSearchTerms(List <string> searchTerms, EntityDef entityDef, CollectionCardStack.ArtStack artStack) { string stringTag = entityDef.GetStringTag(GAME_TAG.CARDNAME); string str2 = entityDef.GetStringTag(GAME_TAG.CARDTEXT_INHAND); string str3 = entityDef.GetStringTag(GAME_TAG.ARTISTNAME); string[] array = (str3 != null) ? str3.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries) : new string[0]; string input = (stringTag != null) ? stringTag.ToLower() : null; string str5 = (str2 != null) ? str2.ToLower() : null; string str = (stringTag != null) ? ConvertEuropeanCharacters(input) : null; string str7 = (str2 != null) ? ConvertEuropeanCharacters(str5) : null; string str8 = (stringTag != null) ? RemoveDiacritics(input) : null; string str9 = (str2 != null) ? RemoveDiacritics(str5) : null; if (< > f__am$cacheA == null) {
public FilteredArtStack(CollectionCardStack.ArtStack artStack) { this.m_artStack = artStack.Clone(); }
private bool RunTextFilter(EntityDef entityDef, CollectionCardStack.ArtStack artStack, CollectionTextFilter filter) { return(filter.DoesValueMatch(entityDef, artStack)); }