Esempio n. 1
0
 private void AssertCantSpawn(JsonMod mod)
 {
     foreach (var spawnWeight in mod.SpawnWeights)
     {
         Assert.AreEqual("default", spawnWeight.Tag);
         Assert.IsFalse(spawnWeight.CanSpawn);
     }
 }
Esempio n. 2
0
 /// <param name="id">the id of this mod</param>
 /// <param name="jsonMod">the <see cref="JsonMod"/> to encapsulate</param>
 /// <param name="jsonBenchOptions">the master crafting options with which this mod can be crafted</param>
 public Mod(string id, JsonMod jsonMod, IEnumerable <JsonCraftingBenchOption> jsonBenchOptions)
 {
     Id = id;
     foreach (var jsonMasterMod in jsonBenchOptions)
     {
         foreach (var itemClass in jsonMasterMod.ItemClasses)
         {
             if (ItemClassEx.TryParse(itemClass, out ItemClass enumClass))
             {
                 _itemClasses.Add(enumClass);
             }
         }
     }
     foreach (var spawnWeight in jsonMod.SpawnWeights)
     {
         if (TagsExtensions.TryParse(spawnWeight.Tag, out Tags tag))
         {
             _spawnTags.Add(Tuple.Create(tag, spawnWeight.CanSpawn));
         }
     }
     JsonMod = jsonMod;
     Stats   = jsonMod.Stats.Select(s => new Stat(s)).ToList();
 }