Example #1
0
        public virtual int AddCraft(CraftInfo info)
        {
            if (info == null || info.TypeOf == null || info.Resources == null || info.Resources.Length == 0)
            {
                return(-1);
            }

            var item = info.TypeOf.CreateInstanceSafe <Item>();

            if (item == null)
            {
                return(-1);
            }

            item.Delete();

            var res = info.Resources[0];

            var index = AddCraft(
                info.TypeOf,
                info.Group,
                info.Name,
                info.MinSkill,
                info.MaxSkill,
                res.TypeOf,
                res.Name,
                res.Amount,
                String.Format("You do not have the required {0} to craft that item.", res.Name.GetString()));

            if (info.Resources.Length > 1)
            {
                foreach (var r in info.Resources.Skip(1))
                {
                    AddRes(
                        index,
                        r.TypeOf,
                        r.Name,
                        r.Amount,
                        String.Format("You do not have the required {0} to craft that item.", r.Name.GetString()));
                }
            }

            info.OnAdded(CraftItems.GetAt(index));

            return(index);
        }
Example #2
0
        public void ForceExceptional(int index)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.ForceExceptional = true;
        }
Example #3
0
        public void AddCraftAction(int index, Action <Mobile, CraftItem, ITool> action)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.TryCraft = action;
        }
Example #4
0
        public void AddResCallback(int index, Func <Mobile, ConsumeType, int> func)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.ConsumeResCallback = func;
        }
Example #5
0
        public void SetUseSubRes2(int index, bool val)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.UseSubRes2 = val;
        }
Example #6
0
        public void SetDisplayID(int index, int id)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.DisplayID = id;
        }
Example #7
0
        public void SetForceSuccess(int index, int success)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.ForceSuccessChance = success;
        }
Example #8
0
        public void SetUseAllRes(int index, bool useAll)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.UseAllRes = useAll;
        }
Example #9
0
        public void SetForceTypeRes(int index, bool value)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.ForceTypeRes = value;
        }
Example #10
0
        public void SetStamReq(int index, int stam)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.Stam = stam;
        }
Example #11
0
        public void SetHitsReq(int index, int hits)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.Hits = hits;
        }
Example #12
0
        public void SetManaReq(int index, int mana)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.Mana = mana;
        }
Example #13
0
        public void SetItemHue(int index, int hue)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.ItemHue = hue;
        }
Example #14
0
        public void SetNeededThemePack(int index, ThemePack pack)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.RequiredThemePack = pack;
        }
Example #15
0
        public void SetRequiresMechanicalLife(int index)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.RequiresMechanicalLife = true;
        }
Example #16
0
        public void SetNeedHeat(int index, bool needHeat)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.NeedHeat = needHeat;
        }
Example #17
0
        public void SetData(int index, object data)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.Data = data;
        }
Example #18
0
        public void SetNeedOven(int index, bool needOven)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.NeedOven = needOven;
        }
Example #19
0
        /// <summary>
        /// Add a callback Action to allow mutating the crafted item. Handy when you have a single Item Type but you want to create variations of it.
        /// </summary>
        /// <param name="index"></param>
        /// <param name="action"></param>
        public void SetMutateAction(int index, Action <Mobile, Item, ITool> action)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.MutateAction = action;
        }
Example #20
0
        public void SetNeedWater(int index, bool needWater)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.NeedWater = needWater;
        }
Example #21
0
        public void AddMapRes(int index, Type type, int maplevel, TextDefinition name, int amount, TextDefinition message)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.AddMapRes(type, maplevel, name, amount, message);
        }
Example #22
0
        public void SetBeverageType(int index, BeverageType requiredBeverage)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.RequiredBeverage = requiredBeverage;
        }
Example #23
0
        public void AddSkill(int index, SkillName skillToMake, double minSkill, double maxSkill)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.AddSkill(skillToMake, minSkill, maxSkill);
        }
Example #24
0
        public void SetNeedMill(int index, bool needMill)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.NeedMill = needMill;
        }
Example #25
0
        public void AddRecipe(int index, int id)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.AddRecipe(id, this);
        }
Example #26
0
        public void SetRequiresBasketWeaving(int index)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.RequiresBasketWeaving = true;
        }
Example #27
0
        public void SetMinSkillOffset(int index, double skillOffset)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.MinSkillOffset = skillOffset;
        }
Example #28
0
        public void SetRequireResTarget(int index)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.RequiresResTarget = true;
        }
Example #29
0
        public void AddCreateItem(int index, Func <Mobile, CraftItem, ITool, Item> func)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.CreateItem = func;
        }
Example #30
0
        private void AddRecipeBase(int index, int id)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.AddRecipe(id, this);
        }