Пример #1
0
        /// <summary>
        /// Retrieve the information for the Mentor Spirit or Paragon the character might have.
        /// </summary>
        /// <param name="objMentorType">Type of feature to check for, either Mentor Spirit or Paragon.</param>
        public MentorSpirit MentorInformation(MentorType objMentorType)
        {
            MentorSpirit objReturn       = new MentorSpirit();
            string       strMentorSpirit = "";

            Quality objMentorQuality = new Quality(_objCharacter);

            // Look for the Mentor Spirit or Paragon Quality based on the type chosen.
            foreach (Quality objQuality in _objCharacter.Qualities)
            {
                if (objMentorType == MentorType.Mentor && objQuality.Name == "Mentor Spirit")
                {
                    strMentorSpirit  = objQuality.Extra;
                    objMentorQuality = objQuality;
                    break;
                }
                if (objMentorType == MentorType.Paragon && objQuality.Name == "Paragon")
                {
                    strMentorSpirit  = objQuality.Extra;
                    objMentorQuality = objQuality;
                    break;
                }
            }

            if (strMentorSpirit != "")
            {
                string strAdvantage    = "";
                string strDisadvantage = "";

                XmlDocument objXmlDocument = new XmlDocument();
                XmlNode     objXmlMentor;
                if (strMentorSpirit != "")
                {
                    // Load the appropriate XML document.
                    if (objMentorType == MentorType.Mentor)
                    {
                        objXmlDocument = XmlManager.Instance.Load("mentors.xml");
                    }
                    else
                    {
                        objXmlDocument = XmlManager.Instance.Load("paragons.xml");
                    }

                    objXmlMentor = objXmlDocument.SelectSingleNode("/chummer/mentors/mentor[name = \"" + strMentorSpirit + "\"]");

                    // Build the list of advantages gained through the Mentor Spirit.
                    if (objXmlMentor["altadvantage"] != null)
                    {
                        strAdvantage = objXmlMentor["altadvantage"].InnerText;
                    }
                    else
                    {
                        strAdvantage = objXmlMentor["advantage"].InnerText;
                    }

                    foreach (Improvement objImprovement in _objCharacter.Improvements)
                    {
                        if (objImprovement.SourceName == objMentorQuality.InternalId)
                        {
                            if (objImprovement.Notes != string.Empty)
                            {
                                strAdvantage += " " + LanguageManager.Instance.TranslateExtra(objImprovement.Notes) + ".";
                            }
                        }
                    }

                    // Build the list of disadvantages gained through the Mentor Spirit.
                    if (objXmlMentor["altdisadvantage"] != null)
                    {
                        strDisadvantage = objXmlMentor["altdisadvantage"].InnerText;
                    }
                    else
                    {
                        strDisadvantage = objXmlMentor["disadvantage"].InnerText;
                    }

                    // Populate the Mentor Spirit object.
                    objReturn.Name       = strMentorSpirit;
                    objReturn.Advantages = LanguageManager.Instance.GetString("Label_SelectMentorSpirit_Advantage") + " " + strAdvantage + "\n\n" + LanguageManager.Instance.GetString("Label_SelectMetamagic_Disadvantage") + " " + strDisadvantage;
                }
            }
            else
            {
                return(null);
            }

            return(objReturn);
        }
Пример #2
0
        /// <summary>
        /// Retrieve the information for the Mentor Spirit or Paragon the character might have.
        /// </summary>
        /// <param name="objMentorType">Type of feature to check for, either Mentor Spirit or Paragon.</param>
        public MentorSpirit MentorInformation(MentorType objMentorType)
        {
            MentorSpirit objReturn = new MentorSpirit();
            string strMentorSpirit = "";

            Quality objMentorQuality = new Quality(_objCharacter);

            // Look for the Mentor Spirit or Paragon Quality based on the type chosen.
            foreach (Quality objQuality in _objCharacter.Qualities)
            {
                if (objMentorType == MentorType.Mentor && objQuality.Name == "Mentor Spirit")
                {
                    strMentorSpirit = objQuality.Extra;
                    objMentorQuality = objQuality;
                    break;
                }
                if (objMentorType == MentorType.Paragon && objQuality.Name == "Paragon")
                {
                    strMentorSpirit = objQuality.Extra;
                    objMentorQuality = objQuality;
                    break;
                }
            }

            if (strMentorSpirit != "")
            {
                string strAdvantage = "";
                string strDisadvantage = "";

                XmlDocument objXmlDocument = new XmlDocument();
                XmlNode objXmlMentor;
                if (strMentorSpirit != "")
                {
                    // Load the appropriate XML document.
                    if (objMentorType == MentorType.Mentor)
                        objXmlDocument = XmlManager.Instance.Load("mentors.xml");
                    else
                        objXmlDocument = XmlManager.Instance.Load("paragons.xml");

                    objXmlMentor = objXmlDocument.SelectSingleNode("/chummer/mentors/mentor[name = \"" + strMentorSpirit + "\"]");

                    // Build the list of advantages gained through the Mentor Spirit.
                    if (objXmlMentor["altadvantage"] != null)
                        strAdvantage = objXmlMentor["altadvantage"].InnerText;
                    else
                        strAdvantage = objXmlMentor["advantage"].InnerText;

                    foreach (Improvement objImprovement in _objCharacter.Improvements)
                    {
                        if (objImprovement.SourceName == objMentorQuality.InternalId)
                        {
                            if (objImprovement.Notes != string.Empty)
                                strAdvantage += " " + LanguageManager.Instance.TranslateExtra(objImprovement.Notes) + ".";
                        }
                    }

                    // Build the list of disadvantages gained through the Mentor Spirit.
                    if (objXmlMentor["altdisadvantage"] != null)
                        strDisadvantage = objXmlMentor["altdisadvantage"].InnerText;
                    else
                        strDisadvantage = objXmlMentor["disadvantage"].InnerText;

                    // Populate the Mentor Spirit object.
                    objReturn.Name = strMentorSpirit;
                    objReturn.Advantages = LanguageManager.Instance.GetString("Label_SelectMentorSpirit_Advantage") + " " + strAdvantage + "\n\n" + LanguageManager.Instance.GetString("Label_SelectMetamagic_Disadvantage") + " " + strDisadvantage;
                }
            }
            else
                return null;

            return objReturn;
        }