Ejemplo n.º 1
0
        public void LoadFromHeroLab(XmlNode xmlHeroLabNode)
        {
            if (xmlHeroLabNode == null)
            {
                return;
            }
            _eTraditionType = TraditionType.MAG;
            _strName        = xmlHeroLabNode.SelectSingleNode("@name")?.InnerText;
            XmlNode xmlTraditionDataNode = !string.IsNullOrEmpty(_strName) ? XmlManager.Load("traditions.xml").SelectSingleNode("/chummer/traditions/tradition[name = \"" + _strName + "\"]") : null;

            if (xmlTraditionDataNode?.TryGetField("id", Guid.TryParse, out _guiSourceID) != true)
            {
                _guiSourceID         = new Guid(CustomMagicalTraditionGuid);
                xmlTraditionDataNode = GetNode();
            }
            Create(xmlTraditionDataNode);
            if (IsCustomTradition)
            {
                _strSpiritCombat       = xmlHeroLabNode.SelectSingleNode("@combatspirits")?.InnerText;
                _strSpiritDetection    = xmlHeroLabNode.SelectSingleNode("@detectionspirits")?.InnerText;
                _strSpiritHealth       = xmlHeroLabNode.SelectSingleNode("@healthspirits")?.InnerText;
                _strSpiritIllusion     = xmlHeroLabNode.SelectSingleNode("@illusionspirits")?.InnerText;
                _strSpiritManipulation = xmlHeroLabNode.SelectSingleNode("@manipulationspirits")?.InnerText;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Load the Tradition from the XmlNode.
        /// </summary>
        /// <param name="xmlNode">XmlNode to load.</param>
        public void Load(XmlNode xmlNode)
        {
            string strTemp = string.Empty;

            if (!xmlNode.TryGetStringFieldQuickly("traditiontype", ref strTemp) || !Enum.TryParse(strTemp, out _eTraditionType))
            {
                _eTraditionType = TraditionType.None;
                return;
            }
            if (!xmlNode.TryGetField("guid", Guid.TryParse, out _guiID))
            {
                _guiID = Guid.NewGuid();
            }
            xmlNode.TryGetStringFieldQuickly("name", ref _strName);
            if (!xmlNode.TryGetGuidFieldQuickly("sourceid", ref _guiSourceID))
            {
                XmlNode node = GetNode(GlobalOptions.Language);
                node?.TryGetGuidFieldQuickly("id", ref _guiSourceID);
            }

            xmlNode.TryGetStringFieldQuickly("extra", ref _strExtra);
            xmlNode.TryGetStringFieldQuickly("spiritform", ref _strSpiritForm);
            xmlNode.TryGetStringFieldQuickly("drain", ref _strDrainExpression);
            xmlNode.TryGetStringFieldQuickly("source", ref _strSource);
            xmlNode.TryGetStringFieldQuickly("page", ref _strPage);
            xmlNode.TryGetStringFieldQuickly("spiritcombat", ref _strSpiritCombat);
            xmlNode.TryGetStringFieldQuickly("spiritdetection", ref _strSpiritDetection);
            xmlNode.TryGetStringFieldQuickly("spirithealth", ref _strSpiritHealth);
            xmlNode.TryGetStringFieldQuickly("spiritillusion", ref _strSpiritIllusion);
            xmlNode.TryGetStringFieldQuickly("spiritmanipulation", ref _strSpiritManipulation);
            using (XmlNodeList xmlSpiritList = xmlNode.SelectNodes("spirits/spirit"))
            {
                if (xmlSpiritList?.Count > 0)
                {
                    foreach (XmlNode xmlSpiritNode in xmlSpiritList)
                    {
                        _lstAvailableSpirits.Add(xmlSpiritNode.InnerText);
                    }
                }
            }
            _nodBonus = xmlNode["bonus"];
        }