Esempio n. 1
0
 public void CreateItem(Mobile from, Type type, Type typeRes, BaseTool tool, CraftItem realCraftItem)
 {
     // Verify if the type is in the list of the craftable item
     if (CraftItems.SearchFor(type) != null)
     {
         realCraftItem.Craft(from, this, typeRes, tool);
     }
 }
Esempio n. 2
0
        public virtual CraftItem FindCraft(Type type, bool subClasses)
        {
            if (CraftItems != null)
            {
                return(subClasses ? CraftItems.SearchForSubclass(type) : CraftItems.SearchFor(type));
            }

            return(null);
        }
Esempio n. 3
0
        public void CreateItem(Mobile from, Type type, Type typeRes, ITool tool, CraftItem realCraftItem)
        {
            CraftItem craftItem = CraftItems.SearchFor(type);

            if (craftItem != null)
            {
                realCraftItem.Craft(from, this, typeRes, tool);
            }
        }
Esempio n. 4
0
        public int AddMapCraft(Type typeItem, TextDefinition group, TextDefinition name, double minSkill, double maxSkill, Type typeRes, int maplevel, TextDefinition nameRes, int amount, TextDefinition message)
        {
            CraftItem craftItem = new CraftItem(typeItem, group, name);

            craftItem.AddMapRes(typeRes, maplevel, nameRes, amount, message);
            craftItem.AddSkill(MainSkill, minSkill, maxSkill);

            DoGroup(group, craftItem);
            return(CraftItems.Add(craftItem));
        }
Esempio n. 5
0
        public int AddCraft(Type typeItem, TextDefinition group, TextDefinition name, SkillName skillToMake, double minSkill, double maxSkill, Type typeRes, TextDefinition nameRes, int amount, TextDefinition message)
        {
            CraftItem craftItem = new CraftItem(typeItem, group, name);

            craftItem.AddRes(typeRes, nameRes, amount, message);
            craftItem.AddSkill(skillToMake, minSkill, maxSkill);

            DoGroup(group, craftItem);
            return(CraftItems.Add(craftItem));
        }
Esempio n. 6
0
 private void Awake()
 {
     items     = FindObjectOfType <Items>();
     player    = FindObjectOfType <Player>();
     inventory = FindObjectOfType <Inventory>();
     move      = FindObjectOfType <Movement>();
     battleM   = FindObjectOfType <BattleEvent>();
     clas      = FindObjectOfType <Classes>();
     craft     = FindObjectOfType <CraftItems>();
 }
Esempio n. 7
0
        public void CreateItem(Mobile from, Type type, Type typeRes, ITool tool, CraftItem realCraftItem)
        {
            // Verify if the type is in the list of the craftable item
            CraftItem craftItem = CraftItems.SearchFor(type);

            if (craftItem != null)
            {
                // The item is in the list, try to create it
                // Test code: items like sextant parts can be crafted either directly from ingots, or from different parts
                realCraftItem.Craft(from, this, typeRes, tool);
                //craftItem.Craft( from, this, typeRes, tool );
            }
        }
Esempio n. 8
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);
        }
Esempio n. 9
0
        /// <summary>
        /// Стоимость покупки за основную валюту
        /// </summary>
        public decimal?GetBuyCost(Data data)
        {
            if (!CraftItems.Any())
            {
                return(null);
            }

            var sum = 0m;

            foreach (var craftItem in CraftItems)
            {
                var cost = craftItem.GetBuyPrice(data);
                if (cost == null)
                {
                    return(null);
                }

                var value = cost.Value;
                if (craftItem.ItemId == Item.WorkScoreId)
                {
                    var pro = data.Professions.FirstOrDefault(p => p.Id == ProfessionId);
                    if (pro != null && pro.Level > 0)
                    {
                        var oldCount = craftItem.Count;
                        try
                        {
                            craftItem.Count = Math.Round(craftItem.Count * pro.GetRatio());
                            value           = craftItem.GetBuyPrice(data).Value;
                        }
                        finally
                        {
                            craftItem.Count = oldCount;
                        }
                    }
                }

                sum += value;
            }
            return(sum);
        }
Esempio n. 10
0
        public void SetUseSubRes2(int index, bool val)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.UseSubRes2 = val;
        }
Esempio n. 11
0
        public void AddRecipe(int index, int id)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.AddRecipe(id, this);
        }
Esempio n. 12
0
        public void AddResCallback(int index, Func <Mobile, ConsumeType, int> func)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.ConsumeResCallback = func;
        }
Esempio n. 13
0
        public void AddSkill(int index, SkillName skillToMake, double minSkill, double maxSkill)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.AddSkill(skillToMake, minSkill, maxSkill);
        }
Esempio n. 14
0
 public void AddCraftItem(CraftItem craftItem)
 {
     CraftItems.Add(craftItem);
 }
Esempio n. 15
0
        public void SetBeverageType(int index, BeverageType requiredBeverage)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.RequiredBeverage = requiredBeverage;
        }
Esempio n. 16
0
        public void SetDisplayID(int index, int id)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.DisplayID = id;
        }
Esempio n. 17
0
        public void AddCraftAction(int index, Action <Mobile, CraftItem, ITool> action)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.TryCraft = action;
        }
Esempio n. 18
0
        public void SetRequiresMechanicalLife(int index)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.RequiresMechanicalLife = true;
        }
Esempio n. 19
0
        public void SetNeedOven(int index, bool needOven)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.NeedOven = needOven;
        }
Esempio n. 20
0
        public void SetRequireResTarget(int index)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.RequiresResTarget = true;
        }
Esempio n. 21
0
        public void SetRequiresBasketWeaving(int index)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.RequiresBasketWeaving = true;
        }
Esempio n. 22
0
        public void SetNeedMill(int index, bool needMill)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.NeedMill = needMill;
        }
Esempio n. 23
0
        public void ForceExceptional(int index)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.ForceExceptional = true;
        }
Esempio n. 24
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;
        }
Esempio n. 25
0
        public void SetMinSkillOffset(int index, double skillOffset)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.MinSkillOffset = skillOffset;
        }
Esempio n. 26
0
        public void SetForceSuccess(int index, int success)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.ForceSuccessChance = success;
        }
Esempio n. 27
0
        public void AddCreateItem(int index, Func <Mobile, CraftItem, ITool, Item> func)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.CreateItem = func;
        }
Esempio n. 28
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);
        }
Esempio n. 29
0
        public void SetData(int index, object data)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.Data = data;
        }
Esempio n. 30
0
        public void SetNeedWater(int index, bool needWater)
        {
            CraftItem craftItem = CraftItems.GetAt(index);

            craftItem.NeedWater = needWater;
        }