/// <summary> /// Constructor at character's initialization time /// </summary> /// <param name="character"></param> /// <param name="src"></param> /// <param name="certClass"></param> internal Certificate(Character character, StaticCertificate src, CertificateClass certClass) { m_staticData = src; m_class = certClass; m_character = character; m_status = CertificateStatus.Untrained; m_prereqSkills = new List<SkillLevel>(src.PrerequisiteSkills.ToCharacter(character)); m_prereqCertificates = new List<Certificate>(); }
/// <summary> /// Constructor at character's initialization time. /// </summary> /// <param name="character"></param> /// <param name="src"></param> /// <param name="certClass"></param> internal Certificate(Character character, StaticCertificate src, CertificateClass certClass) { m_character = character; m_levels = new CertificateLevel[6]; StaticData = src; Class = certClass; foreach (KeyValuePair <CertificateGrade, List <StaticSkillLevel> > skill in src.PrerequisiteSkills) { m_levels[(int)skill.Key] = new CertificateLevel(skill, this, character); } }
/// <summary> /// Constructor at character's initialization time. /// </summary> /// <param name="character"></param> /// <param name="src"></param> /// <param name="certClass"></param> internal Certificate(Character character, StaticCertificate src, CertificateClass certClass) { m_character = character; m_levels = new CertificateLevel[6]; StaticData = src; Class = certClass; foreach (KeyValuePair<CertificateGrade, List<StaticSkillLevel>> skill in src.PrerequisiteSkills) { m_levels[(int)skill.Key] = new CertificateLevel(skill, this, character); } }
/// <summary> /// Gets the time to next grade. /// </summary> /// <param name="certificateClass">The certificate class.</param> /// <returns>The time required to finish the next grade</returns> private static TimeSpan GetTimeToNextLevel(CertificateClass certificateClass) { CertificateLevel lowestTrinedLevel = certificateClass.Certificate.LowestUntrainedLevel; return lowestTrinedLevel?.GetTrainingTime ?? TimeSpan.Zero; }
/// <summary> /// Gets the time to elite grade. /// </summary> /// <param name="certificateClass">The certificate class.</param> /// <returns>The time required to finish the final grade</returns> private static TimeSpan GetTimeToMaxLevel(CertificateClass certificateClass) { CertificateLevel levelFive = certificateClass.Certificate.GetCertificateLevel(5); return levelFive.IsTrained ? TimeSpan.Zero : levelFive.GetTrainingTime; }
/// <summary> /// Updates a "plan to" menu /// </summary> /// <param name="menu">The menu to update</param> /// <param name="certClass">The selected certificate class</param> /// <param name="grade">The grade represent by this menu</param> /// <param name="lastEligibleCert">The highest eligible certificate after this plan</param> private void UpdatePlanningMenuStatus(ToolStripMenuItem menu, CertificateClass certClass, CertificateGrade grade, Certificate lastEligibleCert) { var cert = certClass[grade]; if (cert == null) { menu.Visible = false; } else { menu.Visible = true; if (lastEligibleCert == null) menu.Enabled = true; else menu.Enabled = ((int)cert.Grade > (int)lastEligibleCert.Grade); } }
/// <summary> /// When the user select a new certificate class, we update everything. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void certSelectControl_SelectionChanged(object sender, EventArgs e) { SelectedCertificateClass = certSelectControl.SelectedCertificateClass; }