Exemplo n.º 1
0
 public Affix(XmlAffix xmlAffix)
     : this(xmlAffix.ItemType, xmlAffix.Tiers.Select(el => new ItemModTier(el, xmlAffix.ItemType)))
 {
     if (!xmlAffix.Tiers.Any())
     {
         throw new NotSupportedException("There should not be any Affix without tiers");
     }
     ModType = xmlAffix.ModType;
     Name    = xmlAffix.Name;
 }
Exemplo n.º 2
0
        public Affix(XmlAffix xmlAffix)
        {
            ItemType = xmlAffix.ItemType;
            ModType  = xmlAffix.ModType;
            if (xmlAffix.Tiers.Any())
            {
                Mods = xmlAffix.Tiers[0].Stats.Select(s => s.Name).ToList();
            }
            else
            {
                throw new NotSupportedException("There should not be any Affix without tiers");
            }
            Name = xmlAffix.Name;

            var tiers = xmlAffix.Tiers.Select(el => new ItemModTier(el, ItemType)).ToList();

            Tiers = new RangeTree <float, ModWrapper> [Mods.Count];
            for (var i = 0; i < Tiers.Length; i++)
            {
                Tiers[i] = new RangeTree <float, ModWrapper>(tiers.Select(im => new ModWrapper(Mods[i], im)), new ItemModComparer());
            }
        }
Exemplo n.º 3
0
 private static IEnumerable<XmlAffix> GroupToTypes(XmlAffix affix)
 {
     if (affix.ItemGroup == ItemGroup.Unknown)
     {
         yield return affix;
     }
     else
     {
         foreach (var itemType in affix.ItemGroup.Types())
         {
             yield return new XmlAffix
             {
                 Global = affix.Global,
                 ItemGroup = ItemGroup.Unknown,
                 ItemType = itemType,
                 ModType = affix.ModType,
                 Name = affix.Name,
                 Tiers = affix.Tiers
             };
         }
     }
 }