Пример #1
0
        public virtual int OnCraft(
            int quality,
            bool makersMark,
            Mobile m,
            CraftSystem craftSystem,
            Type typeRes,
            //Compatibility with UOF fix
            IBaseTool tool,
            CraftItem craftItem,
            int resHue)
        {
            if (makersMark)
            {
                Crafter = m;
            }

            if (craftSystem is Pyrotechnics && craftItem != null)
            {
                CraftContext context = craftSystem.GetContext(m);

                if (context != null && !context.DoNotColor)
                {
                    Hue = resHue;
                }

                CraftRes[] fuses = new CraftRes[craftItem.Resources.Count];
                fuses.SetAll(i => craftItem.Resources.GetAt(i));
                fuses = fuses.Where(res => res.ItemType.IsEqualOrChildOf <FireworkFuse>()).ToArray();

                double fuseDelay = FuseDelay.TotalSeconds * fuses.Sum(r => r.Amount);

                if (fuseDelay > 0)
                {
                    FuseDelay = TimeSpan.FromSeconds(fuseDelay);
                }
            }

            return(quality);
        }
Пример #2
0
        public override int OnCraft(
            int quality,
            bool makersMark,
            Mobile m,
            CraftSystem craftSystem,
            Type typeRes,
            BaseTool tool,
            CraftItem craftItem,
            int resHue)
        {
            if (craftSystem is Pyrotechnics && craftItem != null)
            {
                var stars = new CraftRes[craftItem.Resources.Count];

                stars.SetAll(i => craftItem.Resources.GetAt(i));
                stars = stars.Where(res => res.ItemType.IsEqualOrChildOf <BaseFireworkStar>()).ToArray();

                if (stars.Length > 0)
                {
                    StarsRangeMin = 1 + stars.Sum(s => s.Amount);
                    StarsRangeMax = StarsRangeMin * 2;

                    LaunchHeightMin = Math.Max(50, Math.Min(100, StarsRangeMin * 5));
                    LaunchHeightMax = Math.Max(50, Math.Min(100, StarsRangeMax * 5));

                    StarHues.AddRange(BaseFireworkStar.GetEffectHues(typeRes ?? stars[0].ItemType));

                    if (stars.Length > 1)
                    {
                        StarHues.AddRange(stars.Skip(1).SelectMany(s => BaseFireworkStar.GetEffectHues(s.ItemType)));
                    }
                }
            }

            return(base.OnCraft(quality, makersMark, m, craftSystem, typeRes, tool, craftItem, resHue));
        }