Пример #1
0
        public Item Reconstruct()
        {
            SmallBOD bod = null;

            switch (m_DeedType)
            {
            case BODType.Smith: bod = new SmallSmithBOD(m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material, m_Hue); break;

            case BODType.Tailor: bod = new SmallTailorBOD(m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material, m_Hue); break;

            case BODType.Inscription: bod = new SmallInscriptionBOD(m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material, m_Hue); break;

            case BODType.Alchemy: bod = new SmallAlchemyBOD(m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material, m_Hue); break;

            case BODType.Carpentry: bod = new SmallCarpentryBOD(m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material, m_Hue); break;

            case BODType.Fletching: bod = new SmallFletchingBOD(m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material, m_Hue); break;

            case BODType.Tinkering: bod = new SmallTinkerBOD(m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material, m_Hue, m_GemType); break;

            case BODType.Cooking: bod = new SmallCookingBOD(m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material, m_Hue); break;
            }

            return(bod);
        }
Пример #2
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
                _GemType = (GemType)reader.ReadInt();
                break;
            }

            if (version < 1 && Entries != null && Entries.Length > 0 && Entries[0].Details != null)
            {
                Type t = Entries[0].Details.Type;

                if (SmallTinkerBOD.CannotAssignMaterial(t) && Material != BulkMaterialType.None)
                {
                    Material = BulkMaterialType.None;
                }

                if (t.IsSubclassOf(typeof(BaseJewel)))
                {
                    AssignGemType();
                }
            }
        }
Пример #3
0
        public static Item CreateBulkOrder(Mobile m, BODType type, bool fromContextMenu)
        {
            PlayerMobile pm = m as PlayerMobile;

            if (pm == null)
            {
                return(null);
            }

            if (pm.AccessLevel > AccessLevel.Player || fromContextMenu || 0.2 > Utility.RandomDouble())
            {
                SkillName sk         = GetSkillForBOD(type);
                double    theirSkill = pm.Skills[sk].Base;
                bool      doLarge    = theirSkill >= 70.1 && ((theirSkill - 40.0) / 300.0) > Utility.RandomDouble();

                switch (type)
                {
                case BODType.Smith:
                    if (doLarge)
                    {
                        return(new LargeSmithBOD());
                    }
                    else
                    {
                        return(SmallSmithBOD.CreateRandomFor(pm));
                    }

                case BODType.Tailor: if (doLarge)
                    {
                        return(new LargeTailorBOD());
                    }
                    else
                    {
                        return(SmallTailorBOD.CreateRandomFor(pm));
                    }

                case BODType.Alchemy:
                    if (doLarge)
                    {
                        return(new LargeAlchemyBOD());
                    }
                    else
                    {
                        return(SmallAlchemyBOD.CreateRandomFor(pm));
                    }

                case BODType.Inscription:
                    if (doLarge)
                    {
                        return(new LargeInscriptionBOD());
                    }
                    else
                    {
                        return(SmallInscriptionBOD.CreateRandomFor(pm));
                    }

                case BODType.Tinkering:
                    if (doLarge)
                    {
                        return(new LargeTinkerBOD());
                    }
                    else
                    {
                        return(SmallTinkerBOD.CreateRandomFor(pm));
                    }

                case BODType.Cooking:
                    if (doLarge)
                    {
                        return(new LargeCookingBOD());
                    }
                    else
                    {
                        return(SmallCookingBOD.CreateRandomFor(pm));
                    }

                case BODType.Fletching:
                    if (doLarge)
                    {
                        return(new LargeFletchingBOD());
                    }
                    else
                    {
                        return(SmallFletchingBOD.CreateRandomFor(pm));
                    }

                case BODType.Carpentry:
                    if (doLarge)
                    {
                        return(new LargeCarpentryBOD());
                    }
                    else
                    {
                        return(SmallCarpentryBOD.CreateRandomFor(pm));
                    }
                }
            }

            return(null);
        }
Пример #4
0
        public static SmallTinkerBOD CreateRandomFor(Mobile m)
        {
            SmallBulkEntry[] entries;
            bool             useMaterials;

            if (useMaterials = 0.75 > Utility.RandomDouble())
            {
                entries = SmallBulkEntry.TinkeringSmalls;
            }
            else
            {
                entries = SmallBulkEntry.TinkeringSmallsRegular;
            }

            if (entries.Length > 0)
            {
                double theirSkill = BulkOrderSystem.GetBODSkill(m, SkillName.Tinkering);
                int    amountMax;

                if (theirSkill >= 70.1)
                {
                    amountMax = Utility.RandomList(10, 15, 20, 20);
                }
                else if (theirSkill >= 50.1)
                {
                    amountMax = Utility.RandomList(10, 15, 15, 20);
                }
                else
                {
                    amountMax = Utility.RandomList(10, 10, 15, 20);
                }

                BulkMaterialType material = BulkMaterialType.None;

                if (useMaterials && theirSkill >= 70.1)
                {
                    for (int i = 0; i < 20; ++i)
                    {
                        BulkMaterialType check    = GetRandomMaterial(BulkMaterialType.DullCopper, m_TinkerMaterialChances);
                        double           skillReq = GetRequiredSkill(check);

                        if (theirSkill >= skillReq)
                        {
                            material = check;
                            break;
                        }
                    }
                }

                double excChance = 0.0;

                if (useMaterials && theirSkill >= 70.1)
                {
                    excChance = (theirSkill + 80.0) / 200.0;
                }

                bool reqExceptional = (excChance > Utility.RandomDouble());

                CraftSystem system = DefTinkering.CraftSystem;

                List <SmallBulkEntry> validEntries = new List <SmallBulkEntry>();

                for (int i = 0; i < entries.Length; ++i)
                {
                    CraftItem item = system.CraftItems.SearchFor(entries[i].Type);

                    if (item != null)
                    {
                        bool   allRequiredSkills = true;
                        double chance            = item.GetSuccessChance(m, null, system, false, ref allRequiredSkills);

                        if (allRequiredSkills && chance >= 0.0)
                        {
                            if (reqExceptional)
                            {
                                chance = item.GetExceptionalChance(system, chance, m);
                            }

                            if (chance > 0.0)
                            {
                                validEntries.Add(entries[i]);
                            }
                        }
                    }
                }

                if (validEntries.Count > 0)
                {
                    SmallBulkEntry entry = validEntries[Utility.Random(validEntries.Count)];

                    if (material != BulkMaterialType.None && CannotAssignMaterial(entry.Type))
                    {
                        material = BulkMaterialType.None;
                    }

                    SmallTinkerBOD bod = new SmallTinkerBOD(entry, material, amountMax, reqExceptional);

                    if (entry.Type.IsSubclassOf(typeof(BaseJewel)))
                    {
                        bod.AssignGemType(entry.Type);
                    }

                    return(bod);
                }
            }

            return(null);
        }