Esempio n. 1
0
        public double GetSuccessChance(Mobile from, Type typeRes, CraftSystem craftSystem, bool gainSkills, ref bool allRequiredSkills)
        {
            double minMainSkill = 0.0;
            double maxMainSkill = 0.0;
            double valMainSkill = 0.0;

            allRequiredSkills = true;

            for (int i = 0; i < m_arCraftSkill.Count; i++)
            {
                CraftSkill craftSkill = m_arCraftSkill.GetAt(i);

                double minSkill = craftSkill.MinSkill;
                double maxSkill = craftSkill.MaxSkill;

                double valSkill = from.Skills[craftSkill.SkillToMake].Value;

                if (valSkill < minSkill)
                {
                    allRequiredSkills = false;
                }

                if (craftSkill.SkillToMake == craftSystem.MainSkill)
                {
                    minMainSkill = minSkill;
                    maxMainSkill = maxSkill;
                    valMainSkill = valSkill;
                }

                if (gainSkills)
                {
                    from.CheckSkill(craftSkill.SkillToMake, minSkill, maxSkill, 1.0);
                }
            }

            double chance;

            if (allRequiredSkills)
            {
                chance = craftSystem.GetChanceAtMin(this) + ((valMainSkill - minMainSkill) / (maxMainSkill - minMainSkill) * (1.0 - craftSystem.GetChanceAtMin(this)));

                if (chance <= 0.0)
                {
                    chance = 0.01;
                }
            }

            else
            {
                chance = 0.0;
            }

            if (allRequiredSkills && valMainSkill == maxMainSkill)
            {
                chance = 1.0;
            }

            return(chance);
        }
Esempio n. 2
0
        public void DrawSkill()
        {
            for (int i = 0; i < m_CraftItem.Skills.Count; i++)
            {
                CraftSkill skill = m_CraftItem.Skills.GetAt(i);
                double     minSkill = skill.MinSkill, maxSkill = skill.MaxSkill;

                if (minSkill < 0)
                {
                    minSkill = 0;
                }

                AddHtmlLocalized(170, 132 + (i * 20), 200, 18, 1044060 + (int)skill.SkillToMake, LabelColor, false, false);
                AddLabel(430, 132 + (i * 20), LabelHue, String.Format("{0:F1}", minSkill));
            }

            CraftSubResCol res      = (m_CraftItem.UseSubRes2 ? m_CraftSystem.CraftSubRes2 : m_CraftSystem.CraftSubRes);
            int            resIndex = -1;

            CraftContext context = m_CraftSystem.GetContext(m_From);

            if (context != null)
            {
                resIndex = (m_CraftItem.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);
            }

            bool   allRequiredSkills = true;
            double chance            = m_CraftItem.GetSuccessChance(m_From, resIndex > -1 ? res.GetAt(resIndex).ItemType : null, m_CraftSystem, false, ref allRequiredSkills);

            double excepChance = m_CraftItem.GetExceptionalChance(m_CraftSystem, chance, m_From);

            if (chance < 0.0)
            {
                chance = 0.0;
            }
            else if (chance > 1.0)
            {
                chance = 1.0;
            }

            if (excepChance < 0.0)
            {
                excepChance = 0.0;
            }
            else if (excepChance > 1.0)
            {
                excepChance = 1.0;
            }

            AddHtmlLocalized(170, 80, 250, 18, 1044057, LabelColor, false, false);               // Success Chance:
            AddLabel(430, 80, LabelHue, String.Format("{0:F1}%", chance * 100));

            if (m_ShowExceptionalChance)
            {
                AddHtmlLocalized(170, 100, 250, 18, 1044058, 32767, false, false);                   // Exceptional Chance:
                AddLabel(430, 100, LabelHue, String.Format("{0:F1}%", excepChance * 100));
            }
        }
Esempio n. 3
0
        public double GetSuccessChance(Mobile from, Type typeRes, CraftSystem craftSystem, bool gainSkills, ref bool allRequiredSkills)
        {
            double minMainSkill = 0.0;
            double maxMainSkill = 0.0;
            double valMainSkill = 0.0;

            allRequiredSkills = true;

            for (int i = 0; i < m_arCraftSkill.Count; i++)
            {
                CraftSkill craftSkill = m_arCraftSkill.GetAt(i);

                double minSkill = craftSkill.MinSkill;
                double maxSkill = craftSkill.MaxSkill;
                double valSkill = from.Skills[craftSkill.SkillToMake].Value;

                if (valSkill < minSkill)
                    allRequiredSkills = false;

                if (craftSkill.SkillToMake == craftSystem.MainSkill)
                {
                    minMainSkill = minSkill;
                    maxMainSkill = maxSkill;
                    valMainSkill = valSkill;
                }

                if (gainSkills) // This is a passive check. Success chance is entirely dependant on the main skill
                    from.CheckSkill(craftSkill.SkillToMake, minSkill, maxSkill);
            }

            double chance;

            if (allRequiredSkills)
                chance = craftSystem.GetChanceAtMin(this) + ((valMainSkill - minMainSkill) / (maxMainSkill - minMainSkill) * (1.0 - craftSystem.GetChanceAtMin(this)));
            else
                chance = 0.0;

            if (allRequiredSkills && from.Talisman is BaseTalisman)
            {
                BaseTalisman talisman = (BaseTalisman)from.Talisman;

                if (talisman.Skill == craftSystem.MainSkill)
                    chance += talisman.SuccessBonus / 100.0;
            }

            if (allRequiredSkills && valMainSkill == maxMainSkill)
                chance = 1.0;

            return chance;
        }
Esempio n. 4
0
            private void CheckGain()
            {
                int  quality           = 0;
                bool allRequiredSkills = true;

                double minMainSkill = 0.0;
                double maxMainSkill = 0.0;
                double valMainSkill = 0.0;

                m_CraftItem.CheckSkills(m_From, m_TypeRes, m_CraftSystem, ref quality, ref allRequiredSkills);
                CraftSkillCol m_arCraftSkill = m_CraftItem.Skills;

                for (int i = 0; i < m_arCraftSkill.Count; i++)
                {
                    CraftSkill craftSkill = m_arCraftSkill.GetAt(i);

                    double minSkill = craftSkill.MinSkill;
                    double maxSkill = craftSkill.MaxSkill;
                    double valSkill = m_From.Skills[craftSkill.SkillToMake].Value;

                    if (valSkill < minSkill)
                    {
                        allRequiredSkills = false;
                    }

                    if (craftSkill.SkillToMake == m_CraftSystem.MainSkill)
                    {
                        minMainSkill = minSkill;
                        maxMainSkill = maxSkill;
                        valMainSkill = valSkill;
                    }
                    Skill skill = m_From.Skills[craftSkill.SkillToMake];

                    double chance  = (valSkill - minSkill) / (maxSkill - minSkill);
                    bool   success = (chance >= Utility.RandomDouble());
                    if (success)
                    {
                        double ComputedSkillMod = (((1.0 - chance) / 2) * 1.0);

                        if (ComputedSkillMod >= Utility.RandomDouble())
                        {
                            Server.Misc.SkillCheck.Gain(m_From, skill);
                        }
                    }
                }
            }
Esempio n. 5
0
 public void Add(CraftSkill craftSkill)
 {
     List.Add(craftSkill);
 }
Esempio n. 6
0
		public void AddSkill( SkillName skillToMake, double minSkill, double maxSkill )
		{
			CraftSkill craftSkill = new CraftSkill( skillToMake, minSkill, maxSkill );
			m_arCraftSkill.Add( craftSkill );
		}
Esempio n. 7
0
		public void Add( CraftSkill craftSkill )
		{
			List.Add( craftSkill );
		}
Esempio n. 8
0
        public void AddSkill(SkillName skillToMake, double minSkill, double maxSkill)
        {
            CraftSkill craftSkill = new CraftSkill(skillToMake, minSkill, maxSkill);

            m_arCraftSkill.Add(craftSkill);
        }
Esempio n. 9
0
        public void CreateItemList(int selectedGroup)
        {
            if (selectedGroup == 501)               // 501 : Last 10
            {
                CreateMakeLastList();
                return;
            }

            CraftGroupCol craftGroupCol = m_CraftSystem.CraftGroups;
            CraftGroup    craftGroup    = craftGroupCol.GetAt(selectedGroup);
            CraftItemCol  craftItemCol  = craftGroup.CraftItems;

            for (int i = 0; i < craftItemCol.Count; ++i)
            {
                CraftItem craftItem = craftItemCol.GetAt(i);


                int index = i % 10;


                if (index == 0)
                {
                    if (i > 0)
                    {
                        AddButton(370, 260, 4005, 4007, 0, GumpButtonType.Page, (i / 10) + 1);
                        AddHtmlLocalized(405, 263, 100, 18, 1044045, LabelColor, false, false);                           // NEXT PAGE
                    }

                    AddPage((i / 10) + 1);

                    if (i > 0)
                    {
                        AddButton(220, 260, 4014, 4015, 0, GumpButtonType.Page, i / 10);
                        AddHtmlLocalized(255, 263, 100, 18, 1044044, LabelColor, false, false);                           // PREV PAGE
                    }
                }



                if (craftItem.NameNumber > 0)
                {
                    AddHtmlLocalized(255, 63 + (index * 20), 220, 18, craftItem.NameNumber, LabelColor, false, false);
                }
                else
                {
                    AddLabel(255, 60 + (index * 20), LabelHue, craftItem.NameString);
                }

                // Plume : Section à décommenter si l'on souhaite que seul les items que le joueur peut crafter avec ses skills soient affichés
                bool CantDisplay = false;

                for (int t = 0; t < craftItem.Skills.Count; t++)
                {
                    CraftSkill skill = craftItem.Skills.GetAt(t);

                    if (skill.MinSkill > m_From.Skills[skill.SkillToMake].Value)
                    {
                        CantDisplay = true;
                        break;
                    }
                }

                if (CantDisplay)
                {
                    continue;
                }

                AddButton(220, 60 + (index * 20), 4005, 4007, GetButtonID(1, i), GumpButtonType.Reply, 0); // Quick Create
                AddButton(480, 60 + (index * 20), 4011, 4012, GetButtonID(2, i), GumpButtonType.Reply, 0); //Details
            }
        }
Esempio n. 10
0
        public void DrawSkill()
        {
            for (int i = 0; i < m_CraftItem.Skills.Count; i++)
            {
                CraftSkill skill = m_CraftItem.Skills.GetAt(i);
                double     minSkill = skill.MinSkill, maxSkill = skill.MaxSkill;

                if (minSkill < 0)
                {
                    minSkill = 0;
                }

                AddHtmlLocalized(170, 155 + (i * 20), 200, 18, AosSkillBonuses.GetLabel(skill.SkillToMake), LabelColor, false, false);
                AddLabel(430, 155 + (i * 20), LabelHue, String.Format("{0:F1}", minSkill));
            }

            CraftSubResCol res      = (m_CraftItem.UseSubRes2 ? m_CraftSystem.CraftSubRes2 : m_CraftSystem.CraftSubRes);
            int            resIndex = -1;

            CraftContext context = m_CraftSystem.GetContext(m_From);

            if (context != null)
            {
                resIndex = (m_CraftItem.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);
            }

            bool allRequiredSkills = true;

            double successChance     = m_CraftItem.GetSuccessChance(m_From, resIndex > -1 ? res.GetAt(resIndex).ItemType : null, m_CraftSystem, false, ref allRequiredSkills);
            double exceptionalChance = m_CraftItem.GetExceptionalChance(m_CraftSystem, successChance, m_From);

            bool skillGainPossible = false;

            if (successChance < 0.0)
            {
                successChance = 0.0;
            }

            else if (successChance > 1.0)
            {
                successChance = 1.0;
            }

            if (exceptionalChance < 0.0)
            {
                exceptionalChance = 0.0;
            }

            else if (exceptionalChance > 1.0)
            {
                exceptionalChance = 1.0;
            }

            if (successChance > 0 && successChance < 1.0)
            {
                skillGainPossible = true;
            }

            int startY = 80;

            AddHtmlLocalized(170, startY, 250, 18, 1044057, LabelColor, false, false); // Success Chance:
            AddLabel(430, startY, LabelHue, String.Format("{0:F1}%", successChance * 100));

            startY += 20;

            if (m_ShowExceptionalChance)
            {
                if (exceptionalChance < 0.0)
                {
                    exceptionalChance = 0.0;
                }

                else if (exceptionalChance > 1.0)
                {
                    exceptionalChance = 1.0;
                }

                AddHtmlLocalized(170, startY, 250, 18, 1044058, 32767, false, false); // Exceptional Chance:
                AddLabel(430, startY, LabelHue, String.Format("{0:F1}%", exceptionalChance * 100));

                startY += 20;
            }

            if (skillGainPossible)
            {
                AddLabel(169, startY, 2599, "Skill Gain Possible");
            }
        }
Esempio n. 11
0
        public void AddSkill(SkillName skillToMake, double minSkill, double maxSkill)
        {
            var craftSkill = new CraftSkill(skillToMake, minSkill, maxSkill);

            Skills.Add(craftSkill);
        }
Esempio n. 12
0
        public void DrawSkill()
        {
            for (int i = 0; i < m_CraftItem.Skills.Count; i++)
            {
                CraftSkill skill = m_CraftItem.Skills.GetAt(i);
                double     minSkill = skill.MinSkill, maxSkill = skill.MaxSkill;

                if (minSkill < 0)
                {
                    minSkill = 0;
                }

                string textminSkills = "Débutant";

                if (minSkill >= 30 && minSkill < 40)
                {
                    textminSkills = "Néophite";
                }
                else if (minSkill >= 40 && minSkill < 50)
                {
                    textminSkills = "Novice";
                }
                else if (minSkill >= 50 && minSkill < 60)
                {
                    textminSkills = "Apprenti";
                }
                else if (minSkill >= 60 && minSkill < 70)
                {
                    textminSkills = "Compagnon";
                }
                else if (minSkill >= 70 && minSkill < 80)
                {
                    textminSkills = "Expert";
                }
                else if (minSkill >= 80 && minSkill < 90)
                {
                    textminSkills = "Adepte";
                }
                else if (minSkill >= 90 && minSkill < 100)
                {
                    textminSkills = "Maître";
                }
                else if (minSkill >= 100 && minSkill < 110)
                {
                    textminSkills = "Grand Maître";
                }

                AddHtmlLocalized(170, 132 + (i * 20), 200, 18, AosSkillBonuses.GetLabel(skill.SkillToMake), LabelColor, false, false);

                if (m_From.AccessLevel >= AccessLevel.GameMaster)
                {
                    AddLabel(430, 132 + (i * 20), LabelHue, String.Format("{0:F1}", minSkill));
                }
                else
                {
                    AddLabel(430, 132 + (i * 20), LabelHue, String.Format("{0}", textminSkills));
                }
            }

            CraftSubResCol res      = (m_CraftItem.UseSubRes2 ? m_CraftSystem.CraftSubRes2 : m_CraftSystem.CraftSubRes);
            int            resIndex = -1;

            CraftContext context = m_CraftSystem.GetContext(m_From);

            if (context != null)
            {
                resIndex = (m_CraftItem.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);
            }

            bool   allRequiredSkills = true;
            double chance            = m_CraftItem.GetSuccessChance(m_From, resIndex > -1 ? res.GetAt(resIndex).ItemType : null, m_CraftSystem, false, ref allRequiredSkills);
            double excepChance       = m_CraftItem.GetExceptionalChance(m_CraftSystem, chance, m_From);

            m_Chance = chance;  // Scriptiz : on stocke la chance

            if (chance < 0.0)
            {
                chance = 0.0;
            }
            else if (chance > 1.0)
            {
                chance = 1.0;
            }

            string textchance = "Nulle";

            if (chance > 0 && chance <= 0.2)
            {
                textchance = "Faible";
            }
            else if (chance > 0.2 && chance <= 0.4)
            {
                textchance = "Possible";
            }
            else if (chance > 0.4 && chance <= 0.6)
            {
                textchance = "Moyenne";
            }
            else if (chance > 0.6 && chance <= 0.8)
            {
                textchance = "Favorable";
            }
            else if (chance > 0.8 && chance < 1)
            {
                textchance = "Grande";
            }
            else if (chance == 1)
            {
                textchance = "Aisée";
            }

            AddHtmlLocalized(170, 80, 250, 18, 1044057, LabelColor, false, false);

            if (m_From.AccessLevel >= AccessLevel.GameMaster)
            {
                AddLabel(430, 80, LabelHue, String.Format("{0:F1}%", chance * 100));
            }
            else
            {
                AddLabel(430, 80, LabelHue, String.Format("{0}", textchance));
            }

            if (m_ShowExceptionalChance)
            {
                if (excepChance < 0.0)
                {
                    excepChance = 0.0;
                }
                else if (excepChance > 1.0)
                {
                    excepChance = 1.0;
                }
                if (m_From.AccessLevel >= AccessLevel.GameMaster)
                {
                    AddHtmlLocalized(170, 100, 250, 18, 1044058, 32767, false, false);   // Exceptional Chance:
                    AddLabel(430, 100, LabelHue, String.Format("{0:F1}%", excepChance * 100));
                }
            }
        }
Esempio n. 13
0
        public CraftGumpItem(Mobile from, CraftSystem craftSystem, CraftItem craftItem, BaseTool tool)
            : base(50, 50)
        {
            m_From        = from;
            m_CraftSystem = craftSystem;
            m_CraftItem   = craftItem;
            m_Tool        = tool;

            from.CloseGump <CraftGump>();
            from.CloseGump <CraftGumpItem>();

            AddPage(0);
            AddBackground(0, 0, 530, 417, 5054);
            AddImageTiled(10, 10, 510, 22, 2624);
            AddImageTiled(10, 37, 150, 148, 2624);
            AddImageTiled(165, 37, 355, 90, 2624);
            AddImageTiled(10, 190, 155, 22, 2624);
            AddImageTiled(10, 237, 155, 53, 2624);
            AddImageTiled(165, 132, 355, 80, 2624);
            AddImageTiled(10, 275, 155, 22, 2624);
            AddImageTiled(10, 322, 155, 53, 2624);
            AddImageTiled(165, 217, 355, 80, 2624);
            AddImageTiled(10, 360, 155, 22, 2624);
            AddImageTiled(165, 302, 355, 80, 2624);
            AddImageTiled(10, 387, 510, 22, 2624);
            AddAlphaRegion(10, 10, 510, 397);

            AddHtmlLocalized(170, 40, 150, 20, 1044053, LabelColor, false, false);               // ITEM
            AddHtmlLocalized(10, 215, 150, 22, 1044055, LabelColor, false, false);               // <CENTER>MATERIALS</CENTER>
            AddHtmlLocalized(10, 300, 150, 22, 1044056, LabelColor, false, false);               // <CENTER>OTHER</CENTER>

            if (craftSystem.GumpTitleNumber > 0)
            {
                AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor, false, false);
            }
            else
            {
                AddHtml(10, 12, 510, 20, craftSystem.GumpTitleString, false, false);
            }

            AddButton(15, 387, 4014, 4016, 9999, GumpButtonType.Reply, 0);
            AddHtmlLocalized(50, 390, 150, 18, 1044150, LabelColor, false, false);               // BACK

            // Draw Item
            Type type = m_CraftItem.ItemType;

            if (m_CraftItem.IsMarkable(type))
            {
                AddHtmlLocalized(170, 302 + (m_OtherCount++ *20), 310, 18, 1044059, LabelColor, false, false);                      // This item may hold its maker's mark
                m_ShowExceptionalChance = true;
            }

            if (craftItem.NameNumber > 0)
            {
                AddHtmlLocalized(330, 40, 180, 18, craftItem.NameNumber, LabelColor, false, false);
            }
            else
            {
                AddLabel(330, 40, LabelHue, craftItem.NameString);
            }

            AddItem(20, 50, CraftItem.ItemIDOf(type));
            // ***********************************

            // Draw Skills
            for (int i = 0; i < m_CraftItem.Skills.Count; i++)
            {
                CraftSkill skill    = m_CraftItem.Skills.GetAt(i);
                double     minSkill = skill.MinSkill;

                if (minSkill < 0)
                {
                    minSkill = 0;
                }

                AddHtmlLocalized(170, 132 + (i * 20), 200, 18, 1044060 + (int)skill.SkillToMake, LabelColor, false, false);
                AddLabel(430, 132 + (i * 20), LabelHue, String.Format("{0:F1}", minSkill).Replace(",", "."));
            }
            // ***********************************

            // Draw Ressource
            bool retainedColor = false;

            CraftContext context = m_CraftSystem.GetContext(m_From);

            CraftSubResCol res      = (m_CraftItem.UseSubRes2 ? m_CraftSystem.CraftSubRes2 : m_CraftSystem.CraftSubRes);
            int            resIndex = -1;

            if (context != null)
            {
                resIndex = (m_CraftItem.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);
            }

            bool cropScroll = (m_CraftItem.Ressources.Count > 1) && m_CraftItem.Ressources.GetAt(m_CraftItem.Ressources.Count - 1).ItemType == typeofBlankScroll && typeofSpellScroll.IsAssignableFrom(m_CraftItem.ItemType);

            for (int i = 0; i < m_CraftItem.Ressources.Count - (cropScroll ? 1 : 0) && i < 4; i++)
            {
                Type   _type;
                string nameString;
                int    nameNumber;

                CraftRes craftResource = m_CraftItem.Ressources.GetAt(i);

                _type      = craftResource.ItemType;
                nameString = craftResource.NameString;
                nameNumber = craftResource.NameNumber;
                int amount = craftResource.Amount;

                // Resource Mutation
                if (_type == res.ResType && resIndex > -1)
                {
                    CraftSubRes subResource = res.GetAt(resIndex);

                    _type = subResource.ItemType;

                    nameString = subResource.NameString;
                    nameNumber = subResource.GenericNameNumber;

                    if (nameNumber <= 0)
                    {
                        nameNumber = subResource.NameNumber;
                    }
                }
                // ******************

                if (m_CraftItem.NameNumber == 1044458)                   // cut-up cloth
                {
                    amount = 0;

                    AddHtmlLocalized(170, 302 + (m_OtherCount++ *20), 360, 18, 1044460, LabelColor, false, false);                          // Cut bolts of cloth into pieces of ready cloth.
                    AddHtmlLocalized(170, 302 + (m_OtherCount++ *20), 310, 18, 1048176, LabelColor, false, false);                          // Makes as many as possible at once
                }

                if (m_CraftItem.NameNumber == 1044459)                   //combine cloth
                {
                    amount = 0;

                    AddHtmlLocalized(170, 302 + (m_OtherCount++ *20), 360, 18, 1044461, LabelColor, false, false);                          // Combine available cloth into piles by color.
                    AddHtmlLocalized(170, 302 + (m_OtherCount++ *20), 310, 18, 1048176, LabelColor, false, false);                          // Makes as many as possible at once
                }

                if (!retainedColor && m_CraftItem.RetainsColorFrom(m_CraftSystem, _type))
                {
                    retainedColor = true;
                    AddHtmlLocalized(170, 302 + (m_OtherCount++ *20), 310, 18, 1044152, LabelColor, false, false);                          // * The item retains the color of this material
                    AddLabel(500, 219 + (i * 20), LabelHue, "*");
                }

                if (nameNumber > 0)
                {
                    AddHtmlLocalized(170, 219 + (i * 20), 310, 18, nameNumber, LabelColor, false, false);
                }
                else
                {
                    AddLabel(170, 219 + (i * 20), LabelHue, nameString);
                }

                AddHtml(430, 219 + (i * 20), 40, 20, String.Format("<basefont color=#FFFFFF><div align=right>{0}</basefont></div>", amount.ToString()), false, false);
            }

            if (m_CraftItem.NameNumber == 1041267)               // runebook
            {
                AddHtmlLocalized(170, 219 + (m_CraftItem.Ressources.Count * 20), 310, 18, 1044447, LabelColor, false, false);
                AddHtml(430, 219 + (m_CraftItem.Ressources.Count * 20), 40, 20, String.Format("<basefont color=#FFFFFF><div align=right>{0}</basefont></div>", "1"), false, false);
            }
            // ***********************************

            if (craftItem.UseAllRes)
            {
                // Makes as many as possible at once
                AddHtmlLocalized(170, 302 + (m_OtherCount++ *20), 310, 18, 1048176, LabelColor, false, false);
            }

            if (craftItem.RequiresSE)
            {
                // * Requires the "Samurai Empire" expansion
                AddHtmlLocalized(170, 302 + (m_OtherCount++ *20), 310, 18, 1063363, LabelColor, false, false);
            }

            if (craftItem.RequiresML)
            {
                // * Requires the "Mondain's Legacy" expansion
                AddHtmlLocalized(170, 302 + (m_OtherCount++ *20), 310, 18, 1072651, LabelColor, false, false);
            }

            if (craftItem.RequiresSA)
            {
                // * Requires the "Stygian Abyss" expansion
                AddHtmlLocalized(170, 302 + (m_OtherCount++ *20), 310, 18, 1094732, LabelColor, false, false);
            }

            if (craftItem.RequiresHS)
            {
                // * Requires the "High Seas" booster
                AddHtmlLocalized(170, 302 + (m_OtherCount++ *20), 310, 18, 1116296, LabelColor, false, false);
            }

            bool needsRecipe = (craftItem.Recipe != null && from is PlayerMobile && !((PlayerMobile)from).HasRecipe(craftItem.Recipe));

            if (needsRecipe)
            {
                // You have not learned this recipe.
                AddHtmlLocalized(170, 302 + (m_OtherCount++ *20), 310, 18, 1073620, RedLabelColor, false, false);
            }

            if (cropScroll)
            {
                // Inscribing scrolls also requires a blank scroll and mana.
                AddHtmlLocalized(170, 302 + (m_OtherCount++ *20), 360, 18, 1044379, LabelColor, false, false);
            }

            if (needsRecipe)
            {
                AddButton(135, 387, 0xFAE, 0xFB0, 0, GumpButtonType.Page, 0);
                AddHtmlLocalized(180, 390, 150, 18, 1112624, 0x3DEF, false, false);                   // MAKE MAX

                AddButton(255, 387, 0xFAE, 0xFB0, 0, GumpButtonType.Page, 0);
                AddHtmlLocalized(300, 390, 150, 18, 1112623, 0x3DEF, false, false);                   // MAKE NUMBER

                AddButton(405, 387, 4005, 4007, 0, GumpButtonType.Page, 0);
                AddHtmlLocalized(450, 390, 150, 18, 1044151, GreyLabelColor, false, false);                   // MAKE NOW
            }
            else
            {
                AddButton(135, 387, 0xFAE, 0xFB0, craftItem.CraftId + 11000, GumpButtonType.Reply, 0);
                AddHtmlLocalized(180, 390, 150, 18, 1112624, 0x7FFF, false, false);                   // MAKE MAX

                AddButton(255, 387, 0xFAE, 0xFB0, craftItem.CraftId + 10000, GumpButtonType.Reply, 0);
                AddHtmlLocalized(300, 390, 150, 18, 1112623, 0x7FFF, false, false);                   // MAKE NUMBER

                AddButton(405, 387, 4005, 4007, craftItem.CraftId, GumpButtonType.Reply, 0);
                AddHtmlLocalized(450, 390, 150, 18, 1044151, LabelColor, false, false);                   // MAKE NOW
            }

            // Draw Chances
            DrawChances();
            // ***********************************
        }
Esempio n. 14
0
        public void DrawSkill()
        {
            CraftSubResCol res      = (m_CraftItem.UseSubRes2 ? m_CraftSystem.CraftSubRes2 : m_CraftSystem.CraftSubRes);
            int            resIndex = -1;

            for (int i = 0; i < m_CraftItem.Skills.Count; i++)
            {
                CraftSkill skill    = m_CraftItem.Skills.GetAt(i);
                double     minSkill = m_CraftItem.ScaleWithRessource(skill.MinSkill, m_From, m_CraftSystem);

                if (minSkill < 0)
                {
                    minSkill = 0;
                }

                AddHtml(170, 132 + (i * 20), 300, 20, "<h3><basefont color=#FFFFFF>" + skill.SkillToMake.ToString() + "<basefont></h3>", false, false);
                AddHtml(480, 132 + (i * 20), 300, 20, "<h3><basefont color=#FFFFFF>" + Convert.ToInt32(minSkill) + "%<basefont></h3>", false, false);
            }

            CraftContext context = m_CraftSystem.GetContext(m_From);

            if (context != null)
            {
                resIndex = (m_CraftItem.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);
            }

            bool   allRequiredSkills = true;
            double chance            = m_CraftItem.GetSuccessChance(m_From, resIndex > -1 ? res.GetAt(resIndex).ItemType : null, m_CraftSystem, false, ref allRequiredSkills);
            double excepChance       = m_CraftItem.GetExceptionalChance(chance, m_From, false);

            if (chance < 0.0)
            {
                chance = 0.0;
            }
            else if (chance > 1.0)
            {
                chance = 1.0;
            }
            try
            {
                int chan = Convert.ToInt32(chance * 100);

                AddHtml(170, 80, 300, 20, "<h3><basefont color=#FFFFFF>Chance de Succès :<basefont></h3>", false, false);
                AddHtml(480, 80, 300, 20, "<h3><basefont color=#FFFFFF>" + chan.ToString() + "%<basefont></h3>", false, false);
            }
            catch (OverflowException e)
            {
                Misc.ExceptionLogging.WriteLine(e, "La valeur convertie en int était {0} * 100. L'item était {1}",
                                                chance, m_CraftItem.ItemType.ToString());
            }

            if (excepChance < 0.0)
            {
                excepChance = 0.0;
            }
            else if (excepChance > 1.0)
            {
                excepChance = 1.0;
            }
            try
            {
                int exept = Convert.ToInt32(excepChance * 100);

                AddHtml(170, 100, 300, 20, "<h3><basefont color=#FFFFFF>Chance d'Objet Exceptionel:<basefont></h3>", false, false);
                AddHtml(480, 100, 300, 20, "<h3><basefont color=#FFFFFF>" + exept.ToString() + "%<basefont></h3>", false, false);
            }
            catch (OverflowException e)
            {
                Misc.ExceptionLogging.WriteLine(e, "La valeur convertie en int était {0} * 100. The original chance value was : {1}. L'item était {2}",
                                                excepChance, chance, m_CraftItem.ItemType.ToString());
            }
        }