GetExceptionalChance() public method

public GetExceptionalChance ( CraftSystem system, double chance, Server.Mobile from ) : double
system CraftSystem
chance double
from Server.Mobile
return double
示例#1
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));
            }
        }
示例#2
0
        public void DrawChances()
        {
            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 += m_CraftItem.GetTalismanBonus(m_From, m_CraftSystem);
            }

            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).Replace(",", "."));

            if (m_ShowExceptionalChance)
            {
                AddHtmlLocalized(170, 100, 250, 18, 1044058, 32767, false, false);                   // Exceptional Chance:
                AddLabel(430, 100, LabelHue, String.Format("{0:F1}%", excepChance * 100).Replace(",", "."));
            }
        }
        public void DrawSkill()
        {
            for (int i = 0; i < CraftItem.Skills.Count; i++)
            {
                var    skill = CraftItem.Skills[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, $"{minSkill:F1}");
            }

            var res      = CraftItem.UseSubRes2 ? CraftSystem.CraftSubRes2 : CraftSystem.CraftSubRes;
            var resIndex = -1;

            var context = CraftSystem.GetContext(From);

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

            var allRequiredSkills = true;
            var chance            = CraftItem.GetSuccessChance(From, resIndex > -1 ? res.GetAt(resIndex).ItemType : null,
                                                               CraftSystem, false, ref allRequiredSkills);
            var craftSkillRequired = CraftItem.GetCraftSkillRequired(From,
                                                                     resIndex > -1 ? res.GetAt(resIndex).ItemType : null, CraftSystem);
            var excepChance = CraftItem.GetExceptionalChance(From, CraftSystem, ref craftSkillRequired);

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

            if (m_ShowExceptionalChance)
            {
                AddHtmlLocalized(170, 100, 250, 18, 1044058, 32767, false, false); // Exceptional Chance:
                AddLabel(430, 100, LabelHue, $"{excepChance:F1}%");
            }
        }
示例#4
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");
            }
        }
示例#5
0
		public virtual int OnCraft(
			int quality,
			bool makersMark,
			Mobile from,
			CraftSystem craftSystem,
			Type typeRes,
			IBaseTool tool,
			CraftItem craftItem,
			int resHue)
		{
			int magery = from.Skills.Magery.BaseFixedPoint;

			if (makersMark)
			{
				Crafter = from;
			}

			m_Quality = (BookQuality)(quality - 1);

			if (craftItem.Recipe != null && craftItem.Recipe.ID == 1001) //Full spellbook
			{
				Content = ulong.MaxValue;

				bool allRequiredSkills = true;
				double chance = craftItem.GetSuccessChance(from, typeRes, craftSystem, false, ref allRequiredSkills);
				double excepChance = craftItem.GetExceptionalChance(craftSystem, chance, from);

				double blessChance = excepChance / 3.0;
				if (blessChance < 0.025 && from.Skills[SkillName.Inscribe].Value >= 100.0)
				{
					blessChance = 0.025;
				}

				if (Crafter != null && m_Quality == BookQuality.Exceptional && blessChance > Utility.RandomDouble())
				{
					LootType = LootType.Blessed;
				}
			}

			return quality;
		}
示例#6
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));
                }
            }
        }
示例#7
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());
            }
        }