static void AddOrb(this GameSave gameSave, EInventoryOrbType orbType, EOrbSlot orbSlot) { var orbCollection = gameSave.Inventory.OrbInventory.Inventory; var orbTypeKey = (int)orbType; if (!orbCollection.ContainsKey(orbTypeKey)) { orbCollection.Add(orbTypeKey, new InventoryOrb(orbType)); } switch (orbSlot) { case EOrbSlot.Melee: gameSave.DataKeyBools[MeleeOrbPrefixKey + orbTypeKey] = true; break; case EOrbSlot.Spell: orbCollection[orbTypeKey].IsSpellUnlocked = true; break; case EOrbSlot.Passive: orbCollection[orbTypeKey].IsPassiveUnlocked = true; break; case EOrbSlot.All: gameSave.DataKeyBools.Add(MeleeOrbPrefixKey + orbTypeKey, true); orbCollection[orbTypeKey].IsSpellUnlocked = true; orbCollection[orbTypeKey].IsPassiveUnlocked = true; break; } }
public ItemInfo Get(EInventoryOrbType orbType, EOrbSlot orbSlot) { var orb = GetOrAdd(orbItems, GetOrbKey(orbType, orbSlot), () => CreateNew(new ItemIdentifier(orbType, orbSlot))); return progressiveItems.TryGetValue(orb, out var progressiveItem) ? progressiveItem : orb; }
public ItemIdentifier(EInventoryOrbType orbType, EOrbSlot orbSlot) { LootType = LootType.Orb; ItemId = (int)orbType; SubItemId = (int)orbSlot; }
static int GetOrbKey(EInventoryOrbType orbType, EOrbSlot orbSlot) => ((int)orbType * 10) + (int)orbSlot;