Skip to main content

PurchasableMap

A class in Root.Township, Alta.Customization.

Global settings asset mapping shop items: store SKUs to hashes, set contents, item categories and which hashes are cosmetics. Get it with GlobalSettings<PurchasableMap>.Instance.

Constructors​

MemberWhat it is
PurchasableMap()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

11 private and internal fields
MemberWhat it is
private string[] allItemsBacking field for AllItems.
private PurchasableMap.CosmeticCategory[] categoriesSerialized category to item list.
private Dictionary<uint, ICustomizationCategory> categoryMapLookup built from categories on first use.
private uint[] cosmeticDefinitionsSerialized hashes of cosmetic definitions.
private uint[] devItemsBacking field for DevItems.
private PurchasableMap.HashIdentifierPair[] hashIdentifierPairsSerialized SKU to hash pairs.
private static Logger loggerNLog logger for this class.
private HashSet<uint> mappedCosmeticDefinitionsSet built from cosmeticDefinitions on first use.
private Dictionary<string, uint> mappedHashIdentifierPairLookup built from hashIdentifierPairs on first use.
private Dictionary<uint, uint[]> mappedSetsLookup built from sets on first use.
private PurchasableMap.CosmeticSet[] setsSerialized cosmetic sets and their items.

Properties​

MemberWhat it is
string[] AllItems { get; }Addressable keys of every purchasable; Purchasable loads them all at startup.
uint[] DevItems { get; }Item hashes that PurchasedList marks as owned for players with Developer status.

Methods​

MemberWhat it is
uint ConvertStoreSKUToHash(string storeSKU)Returns the item hash for a store SKU. Throws if the SKU isn't mapped.
PlayerCosmeticCategory GetItemCategory(uint itemHash)Returns the cosmetic category for an item hash, or null.
bool GetSetContent(uint hash, out uint[] content)Gets the item hashes in a set; false if the hash isn't a set.
bool IsCosmeticDefinition(uint hash)Whether a hash is a cosmetic definition (as opposed to a set or other purchasable).