public sealed class CollectionRecordOne account's collection: what it has, and how far the rest has got.
Remarks
Account-wide, which is doc 28's word, and the reason there are two types here. Unlocks are "all account-wide, all durable" — a mount earned on one character is owned by all of them. What each character shows is not: two alts have different transmog and different titles from the same collection. So the durable set is this type and the presentation is Wardrobe, one per character, reading from it.
⚠ One subscription, and a watch is dropped the moment its criterion is done. A naive achievement system subscribes every criterion of every achievement and keeps them for ever, so a mature account pays for thousands of dead filters on every kill. Here the cost falls as an account completes things, which is the opposite curve and the one that matters: the accounts with the most live watches are the new ones, which generate the fewest events.
⚠ An earned achievement never un-earns. Requirements are checked on the way in and never again — a title revoked, an item sold or a patch that raises a threshold must not take back something somebody already did.
⚠ Earning cascades and terminates. An achievement grants a tag and unlocks collectibles, either of which can complete another achievement's requirements; that is resolved in a loop rather than by recursion, and it stops because nothing is ever earned twice.
Fields and properties (11)
public const string ValuePrefixThe value naming how many of one kind they have — Collection.Mount.
public const string TotalValueThe value naming how many things they have in all.
public const string PointsValueThe value naming how many points they have.
public const string EarnedValueThe value naming how many achievements they have earned.
public CollectionLibrary LibraryWhere the collectibles and achievements come from.
public GameplayTagSet TagsThe tags their unlocks and achievements have granted.
public int CountHow many things they have.
public int EarnedHow many achievements they have earned.
public int PointsWhat those achievements are worth.
public int WatchingHow many filters are still listening. Falls as an account completes things.
public IEnumerable<Unlock> UnlocksEverything they have, in the order they got it.
Events (2)
public Action<Collectible, Unlock>? CollectedRaised when something is unlocked for the first time.
public Action<Achievement>? AchievedRaised when an achievement is earned.
Methods (16)
public CollectionRecord(CollectionLibrary library, IRequirementContext? context = null, GameplayTagSet? tags = null)Makes an empty collection.
public bool IsUnlocked(DefId collectible)Whether they have something.
public Unlock? SourceOf(DefId collectible)Where something came from.
public int CountOf(CollectibleKind kind)How many of one sort they have.
public bool Unlock(Collectible collectible, UnlockSource source = Unknown, DefId from = default(DefId))Gives them something.
public bool Revoke(Collectible collectible)Takes something back — a refund, a season ending, a mistake.
public bool IsEarned(Achievement achievement)Whether they have earned an achievement.
public int ProgressOf(Achievement achievement, int criterion)How far one criterion has got.
public IEnumerable<Achievement> Achievements()Everything they have earned, in the order they earned it.
public void Attach(GameplayEventBus bus)Starts listening for what its criteria count.
public bool Detach()Stops listening.
public void Observe(in GameplayEvent gameplayEvent)Counts an event against whatever is waiting for it.
public bool Note(Achievement achievement, int criterion, int amount = 1)Advances a criterion by hand.
public int Refresh()Re-checks every achievement whose criteria are done but whose requirements were not met.
public void Restore(IEnumerable<Unlock> saved, IEnumerable<DefId>? achievements = null, IEnumerable<CriterionProgress>? counters = null)Puts a saved collection back, as it was, with no checks.
public IEnumerable<CriterionProgress> Counters()How far everything unfinished has got, for a save.
Used by (3)
- CollectionTestsVixen.Gameplay.Collections.Tests
- WardrobeVixen.Gameplay.Collections
- WardrobeSectionTestsVixen.Live.Gameplay.Tests