static df8CategoryItem ResolveQuantity(df8CategoryItem input)
 {
     var result = (df8CategoryItem)input.Clone();
     if (result.GetAttribute("quantity") != null)
     {
         if (result.GetSingleItemByEnum(ItemsChoiceType.Weight) != null)
         {
             result.Items[result.ItemsElementName.ToList().FindIndex(x => x == ItemsChoiceType.Weight)] = Convert.ToDouble(result.GetSingleItemByEnum(ItemsChoiceType.Weight)) * Convert.ToDouble(result.GetAttribute("quantity").value);
         }
     }
     return result;
 }
        internal DF8Result ResolveItem(df8CategoryItem item)
        {
            if (item == null)
            {
                throw new Exception("I HAVE A NULL ITEM WTF");
                // yield break;
            }
            var rerollIndex = item.GetRerolls().ToList();
            var rerolledResults = ProcessRerolls(rerollIndex).ToList();

            throw new NotImplementedException();
        }
        public object Clone()
        {
            var result = new df8CategoryItem();
            result.name = this.name;
            result.Items = new object[this.Items.Length][];
            for (int i = 0; i < result.Items.Length; i++)
            {
                result.Items = (object[])this.Items.Clone();
            }
            result.ItemsElementName = (Syndaryl.TreasureGenerator.ItemsChoiceType[])this.ItemsElementName.Clone();

            return result;
        }
 df8CategoryItem ResolveEquations(df8CategoryItem input)
 {
     var result = (df8CategoryItem)input.Clone();
     for (int i = 0; i < result.ItemsElementName.Length; i++)
     {
         if (result.ItemsElementName[i] != ItemsChoiceType.Attribute && result.ItemsElementName[i] != ItemsChoiceType.Reroll)
         {
             if (result.Items[i] is string && ((string)result.Items[i]).StartsWith("$", StringComparison.CurrentCulture))
             {
                 result.Items[i] = evaluator.Execute(((string)result.Items[i]).Substring(1)).ToString();
             }
         }
     }
     return result;
 }
 df8CategoryItem ResolveDicerolls(df8CategoryItem input)
 {
     var result = (df8CategoryItem)input.Clone();
     foreach (var attrib in result.GetAttributes())
     {
         if (attrib.value.Contains('d'))
         {
             var checkForDice = new System.Text.RegularExpressions.Regex(@"\d+d\d+");
             if (checkForDice.IsMatch(attrib.value))
             {
                 attrib.value = Dice.roll(attrib.value).ToString();
             }
         }
     }
     return result;
 }