CosmeticOwnershipManager
A class in Root.Township, Alta.Customization.
Which cosmetics a player has bought, owns and may pick from, by category. Get one with the async LoadFor.
- Listed in Customization and screenshots
- Documented in Customization
Constructors
1 private and internal constructor
| Member | What it is |
|---|---|
private CosmeticOwnershipManager(PlayerCharacterCustomizationManager manager, PurchasedList purchasedList) | Creates a CosmeticOwnershipManager from manager and purchasedList. |
Fields
6 private and internal fields
| Member | What it is |
|---|---|
private readonly Dictionary<PlayerCosmeticCategory, HashSet<uint>> available | Backing field for Available. |
private static readonly Logger logger | NLog logger for this class. |
private readonly PlayerCharacterCustomizationManager manager | The player's customization manager. |
private readonly Dictionary<PlayerCosmeticCategory, HashSet<uint>> owned | Backing field for Owned. |
private readonly List<uint> purchased | Backing field for Purchased. |
private TaskCompletionSource<bool> randomize | Task for the randomize in progress, so a second call waits for it instead. |
Properties
| Member | What it is |
|---|---|
IReadOnlyDictionary<PlayerCosmeticCategory, HashSet<uint>> Available { get; } | Cosmetic IDs the player can choose from per category: owned ones plus ones made available without buying. |
IReadOnlyDictionary<PlayerCosmeticCategory, HashSet<uint>> Owned { get; } | Cosmetic IDs the player owns per category, including items from the current store rotation. |
IReadOnlyCollection<uint> Purchased { get; } | Every purchased cosmetic ID (only purchasables that are cosmetics). |
Methods
| Member | What it is |
|---|---|
ICollection<uint> GetCategoryOptions(PlayerCosmeticCategory category) | Returns the available cosmetic IDs for one category. |
List<uint> GetPurchases() | Returns the list of purchased cosmetic IDs. |
static async Task<CosmeticOwnershipManager> LoadFor(Player player) | Loads a player's or user ID's purchases and builds a manager, adding the current store rotation for the local player. The user ID overload returns null on failure. |
static async Task<CosmeticOwnershipManager> LoadFor(int userId, bool isLocalPlayer, PlayerSubscriberStatus status, PlayerCharacterCustomizationManager manager) | Loads a player's or user ID's purchases and builds a manager, adding the current store rotation for the local player. The user ID overload returns null on failure. |
async Task Randomize(bool canUseNonOwned) | Replaces the character's cosmetics with a random pick per category, from owned items or all available ones. Concurrent calls wait for the running one. |
async Task Randomize(PlayerCosmeticWrapper cosmeticWrapper, bool canUseNonOwned) | Replaces the character's cosmetics with a random pick per category, from owned items or all available ones. Concurrent calls wait for the running one. |
async Task RefreshStore() | Removes the old store rotation's items, fetches the current rotation and adds its items (expanding sets) as owned. |
2 private and internal methods
Used in
Members of other types that take, return or hold a CosmeticOwnershipManager: