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 && valMainSkill == maxMainSkill) { chance = 1.0; } return(chance); }