예제 #1
0
 private SmallSmithBOD(SmallBulkEntry entry, BulkMaterialType material, int amountMax, bool reqExceptional)
 {
     this.Hue                = 0x44E;
     this.AmountMax          = amountMax;
     this.Type               = entry.Type;
     this.Number             = entry.Number;
     this.Graphic            = entry.Graphic;
     this.RequireExceptional = reqExceptional;
     this.Material           = material;
 }
예제 #2
0
        public LargeBulkEntry(LargeBOD owner, GenericReader reader)
        {
            m_Owner  = owner;
            m_Amount = reader.ReadInt();

            Type realType = null;

            string type = reader.ReadString();

            if (type != null)
            {
                realType = ScriptCompiler.FindTypeByFullName(type);
            }

            m_Details = new SmallBulkEntry(realType, reader.ReadInt(), reader.ReadInt());
        }
예제 #3
0
        public SmallSmithBOD()
        {
            SmallBulkEntry[] entries;
            bool             useMaterials;

            if (useMaterials = Utility.RandomBool())
            {
                entries = SmallBulkEntry.BlacksmithArmor;
            }
            else
            {
                entries = SmallBulkEntry.BlacksmithWeapons;
            }

            if (entries.Length > 0)
            {
                int hue       = 0x44E;
                int amountMax = Utility.RandomList(10, 15, 20);

                BulkMaterialType material;

                if (useMaterials)
                {
                    material = GetRandomMaterial(BulkMaterialType.DullCopper, m_BlacksmithMaterialChances);
                }
                else
                {
                    material = BulkMaterialType.None;
                }

                bool reqExceptional = Utility.RandomBool() || (material == BulkMaterialType.None);

                SmallBulkEntry entry = entries[Utility.Random(entries.Length)];

                this.Hue                = hue;
                this.AmountMax          = amountMax;
                this.Type               = entry.Type;
                this.Number             = entry.Number;
                this.Graphic            = entry.Graphic;
                this.RequireExceptional = reqExceptional;
                this.Material           = material;
            }
        }
예제 #4
0
        public SmallTailorBOD()
        {
            SmallBulkEntry[] entries;
            bool             useMaterials;

            if (useMaterials = Utility.RandomBool())
            {
                entries = SmallBulkEntry.TailorLeather;
            }
            else
            {
                entries = SmallBulkEntry.TailorCloth;
            }

            if (entries.Length > 0)
            {
                int hue       = 0x483;
                int amountMax = Utility.RandomList(10, 15, 20);

                BulkMaterialType material;

                if (useMaterials)
                {
                    material = GetRandomMaterial(BulkMaterialType.Spined, m_TailoringMaterialChances);
                }
                else
                {
                    material = BulkMaterialType.None;
                }

                bool reqExceptional = Utility.RandomBool() || (material == BulkMaterialType.None);

                SmallBulkEntry entry = entries[Utility.Random(entries.Length)];

                this.Hue                = hue;
                this.AmountMax          = amountMax;
                this.Type               = entry.Type;
                this.Number             = entry.Number;
                this.Graphic            = entry.Graphic;
                this.RequireExceptional = reqExceptional;
                this.Material           = material;
            }
        }
예제 #5
0
        public static SmallBulkEntry[] GetEntries(string type, string name)
        {
            if (m_Cache == null)
            {
                m_Cache = new Dictionary <string, Dictionary <string, SmallBulkEntry[]> >();
            }

            Dictionary <string, SmallBulkEntry[]> table = null;

            if (!m_Cache.TryGetValue(type, out table))
            {
                m_Cache[type] = table = new Dictionary <string, SmallBulkEntry[]>();
            }

            SmallBulkEntry[] entries = null;

            if (!table.TryGetValue(name, out entries))
            {
                table[name] = entries = SmallBulkEntry.LoadEntries(type, name);
            }

            return(entries);
        }
예제 #6
0
        public LargeBODGump(Mobile from, LargeBOD deed) : base(25, 25)
        {
            m_From = from;
            m_Deed = deed;

            m_From.CloseGump(typeof(LargeBODGump));
            m_From.CloseGump(typeof(SmallBODGump));

            LargeBulkEntry[] entries = deed.Entries;

            AddPage(0);

            AddBackground(50, 10, 455, 236 + (entries.Length * 24), 5054);

            AddImageTiled(58, 20, 438, 217 + (entries.Length * 24), 2624);
            AddAlphaRegion(58, 20, 438, 217 + (entries.Length * 24));

            AddImage(45, 5, 10460);
            AddImage(480, 5, 10460);
            AddImage(45, 221 + (entries.Length * 24), 10460);
            AddImage(480, 221 + (entries.Length * 24), 10460);

            AddHtmlLocalized(225, 25, 120, 20, 1045134, 0x7FFF, false, false); // A large bulk order

            AddHtmlLocalized(75, 48, 250, 20, 1045138, 0x7FFF, false, false);  // Amount to make:
            AddLabel(275, 48, 1152, deed.AmountMax.ToString());

            AddHtmlLocalized(75, 72, 120, 20, 1045137, 0x7FFF, false, false);  // Items requested:
            AddHtmlLocalized(275, 76, 200, 20, 1045153, 0x7FFF, false, false); // Amount finished:

            int y = 96;

            for (int i = 0; i < entries.Length; ++i)
            {
                LargeBulkEntry entry   = entries[i];
                SmallBulkEntry details = entry.Details;

                AddHtmlLocalized(75, y, 210, 20, details.Number, 0x7FFF, false, false);
                AddLabel(275, y, 0x480, entry.Amount.ToString());

                y += 24;
            }

            if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
            {
                AddHtmlLocalized(75, y, 200, 20, 1045140, 0x7FFF, false, false); // Special requirements to meet:
                y += 24;
            }

            if (deed.RequireExceptional)
            {
                AddHtmlLocalized(75, y, 300, 20, 1045141, 0x7FFF, false, false); // All items must be exceptional.
                y += 24;
            }

            if (deed.Material != BulkMaterialType.None)
            {
                AddHtmlLocalized(75, y, 300, 20, GetMaterialNumberFor(deed.Material), 0x7FFF, false, false); // All items must be made with x material.
            }
            AddButton(125, 168 + (entries.Length * 24), 4005, 4007, 2, GumpButtonType.Reply, 0);
            AddHtmlLocalized(160, 168 + (entries.Length * 24), 300, 20, 1045155, 0x7FFF, false, false); // Combine this deed with another deed.

            AddButton(125, 192 + (entries.Length * 24), 4005, 4007, 1, GumpButtonType.Reply, 0);
            AddHtmlLocalized(160, 192 + (entries.Length * 24), 120, 20, 1011441, 0x7FFF, false, false); // EXIT
        }
예제 #7
0
        public static SmallSmithBOD CreateRandomFor(Mobile m)
        {
            SmallBulkEntry[] entries;
            bool             useMaterials;

            if (useMaterials = Utility.RandomBool())
            {
                entries = SmallBulkEntry.BlacksmithArmor;
            }
            else
            {
                entries = SmallBulkEntry.BlacksmithWeapons;
            }

            if (entries.Length > 0)
            {
                double theirSkill = m.Skills[SkillName.Blacksmith].Base;
                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_BlacksmithMaterialChances);
                        double           skillReq = 0.0;

                        switch (check)
                        {
                        case BulkMaterialType.DullCopper: skillReq = 65.0; break;

                        case BulkMaterialType.ShadowIron: skillReq = 70.0; break;

                        case BulkMaterialType.Copper: skillReq = 75.0; break;

                        case BulkMaterialType.Bronze: skillReq = 80.0; break;

                        case BulkMaterialType.Gold: skillReq = 85.0; break;

                        case BulkMaterialType.Agapite: skillReq = 90.0; break;

                        case BulkMaterialType.Verite: skillReq = 95.0; break;

                        case BulkMaterialType.Valorite: skillReq = 100.0; break;

                        case BulkMaterialType.Spined: skillReq = 65.0; break;

                        case BulkMaterialType.Horned: skillReq = 80.0; break;

                        case BulkMaterialType.Barbed: skillReq = 99.0; break;
                        }

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

                double excChance = 0.0;

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

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

                CraftSystem system = DefBlacksmithy.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)];
                    return(new SmallSmithBOD(entry, material, amountMax, reqExceptional));
                }
            }

            return(null);
        }
예제 #8
0
 public LargeBulkEntry(LargeBOD owner, SmallBulkEntry details)
 {
     m_Owner   = owner;
     m_Details = details;
 }