/// <summary> /// Deserialization constructor. /// </summary> /// <param name="group"></param> /// <param name="src"></param> internal StaticCertificateClass(StaticCertificateGroup group, SerializableCertificateClass src) { ID = src.ID; Name = src.Name; Description = src.Description; Group = group; Certificate = new StaticCertificate(this, src.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_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> /// Completes the initialization by updating the prerequisites /// </summary> internal void CompleteInitialization(SerializableCertificatePrerequisite[] prereqs) { foreach (var prereq in prereqs) { // Skills if (prereq.Kind == SerializableCertificatePrerequisiteKind.Skill) { m_prerequisiteSkills.Add(new StaticSkillLevel(prereq.Name, Int32.Parse(prereq.Level))); } // Certificates else { var grade = StaticCertificate.GetGrade(prereq.Level); m_prerequisiteCertificates.Add(StaticCertificates.GetCertificateClass(prereq.Name)[grade]); } } }
/// <summary> /// Recursive method to generate treenodes for tvCertList. /// </summary> /// <param name="certificate">An EntityRecommendedCertificate object</param> /// <returns></returns> private TreeNode GetCertNode(StaticCertificate certificate) { var character = (Character)m_plan.Character; Certificate cert = character.Certificates[certificate.ID]; TreeNode node = new TreeNode(cert.ToString()); node.Tag = cert; // Generate child certificate nodes if required foreach (StaticCertificate childCert in cert.StaticData.PrerequisiteCertificates) { node.Nodes.Add(GetCertNode(childCert)); } // Generate prerequisites skill nodes if required foreach (StaticSkillLevel prereq in cert.StaticData.PrerequisiteSkills) { node.Nodes.Add(GetSkillNode(prereq)); } return node; }