1 using System.Collections.Generic;
6 namespace Loot.Soulforging
8 internal class LootEssenceWorld :
ModWorld 10 public HashSet<int> UnlockedCubes =
new HashSet<int>();
12 public bool SoulforgingUnlocked =
true;
14 public void UnlockCube(
int type)
16 UnlockedCubes.Add(type);
19 public bool IsCubeUnlocked(
int type)
21 return UnlockedCubes.Contains(type);
24 public override TagCompound Save()
26 var items =
new Dictionary<string, List<string>>();
27 foreach (var type
in UnlockedCubes)
29 var item =
new Item();
30 item.SetDefaults(type);
31 if (!items.ContainsKey(item.modItem.mod.Name)) items.Add(item.modItem.mod.Name,
new List<string>());
32 items[item.modItem.mod.Name].Add(item.modItem.Name);
34 var tc =
new TagCompound();
35 foreach (
string mod
in items.Keys)
37 tc.Add(mod, items[mod]);
39 return new TagCompound
41 {
"UnlockedCubes", tc},
42 {
"SoulforgingUnlocked", SoulforgingUnlocked}
46 public override void Load(TagCompound tag)
48 foreach (var kvp
in tag.GetCompound(
"UnlockedCubes"))
51 var items = kvp.Value as List<string>;
54 UnlockedCubes.Add(ModLoader.GetMod(mod).ItemType(item));
57 SoulforgingUnlocked = tag.GetBool(
"SoulforgingUnlocked");