示例#1
0
        /// <summary>
        /// Load the Power from the XmlNode.
        /// </summary>
        /// <param name="objNode">XmlNode to load.</param>
        public void Load(XmlNode objNode)
        {
            _guiID             = Guid.Parse(objNode["guid"].InnerText);
            Name               = objNode["name"].InnerText;
            Extra              = objNode["extra"].InnerText ?? "";
            _strPointsPerLevel = objNode["pointsperlevel"]?.InnerText;
            objNode.TryGetField("action", out _strAction);
            if (objNode["adeptway"] != null)
            {
                _strAdeptWayDiscount = objNode["adeptway"].InnerText;
            }
            else
            {
                string strPowerName = Name;
                if (strPowerName.Contains("("))
                {
                    strPowerName = strPowerName.Substring(0, strPowerName.IndexOf("(") - 1);
                }
                XmlDocument objXmlDocument = XmlManager.Instance.Load("powers.xml");
                XmlNode     objXmlPower    = objXmlDocument.SelectSingleNode("/chummer/powers/power[starts-with(./name,\"" + strPowerName + "\")]");
                if (objXmlPower != null)
                {
                    _strAdeptWayDiscount = objXmlPower["adeptway"].InnerText;
                }
            }
            Rating        = Convert.ToInt32(objNode["rating"]?.InnerText);
            LevelsEnabled = Convert.ToBoolean(objNode["levels"]?.InnerText);
            objNode.TryGetBoolFieldQuickly("free", ref _blnFree);
            objNode.TryGetInt32FieldQuickly("maxlevel", ref _intMaxLevel);
            objNode.TryGetInt32FieldQuickly("freelevels", ref _intFreeLevels);
            objNode.TryGetBoolFieldQuickly("discounted", ref _blnDiscountedAdeptWay);
            objNode.TryGetBoolFieldQuickly("discountedgeas", ref _blnDiscountedGeas);
            objNode.TryGetStringFieldQuickly("bonussource", ref _strBonusSource);
            objNode.TryGetDecFieldQuickly("freepoints", ref _decFreePoints);
            objNode.TryGetDecFieldQuickly("extrapointcost", ref _decExtraPointCost);
            objNode.TryGetStringFieldQuickly("source", ref _strSource);
            objNode.TryGetStringFieldQuickly("page", ref _strPage);
            objNode.TryGetStringFieldQuickly("notes", ref _strNotes);
            Bonus = objNode["bonus"];
            _nodAdeptWayRequirements = objNode["adeptwayrequires"];
            if (!objNode.InnerXml.Contains("enhancements"))
            {
                return;
            }
            XmlNodeList nodEnhancements = objNode.SelectNodes("enhancements/enhancement");

            if (nodEnhancements == null)
            {
                return;
            }
            foreach (XmlNode nodEnhancement in nodEnhancements)
            {
                Enhancement objEnhancement = new Enhancement(CharacterObject);
                objEnhancement.Load(nodEnhancement);
                objEnhancement.Parent = this;
                Enhancements.Add(objEnhancement);
            }
        }
示例#2
0
 public bool Create(XmlNode objNode, int intRating = 1, XmlNode objBonusNodeOverride = null)
 {
     Name      = objNode["name"].InnerText;
     _sourceID = Guid.Parse(objNode["id"].InnerText);
     objNode.TryGetStringFieldQuickly("points", ref _strPointsPerLevel);
     objNode.TryGetStringFieldQuickly("adeptway", ref _strAdeptWayDiscount);
     LevelsEnabled = Convert.ToBoolean(objNode["levels"].InnerText);
     Rating        = intRating;
     objNode.TryGetInt32FieldQuickly("maxlevels", ref _intMaxLevel);
     objNode.TryGetBoolFieldQuickly("discounted", ref _blnDiscountedAdeptWay);
     objNode.TryGetBoolFieldQuickly("discountedgeas", ref _blnDiscountedGeas);
     objNode.TryGetStringFieldQuickly("bonussource", ref _strBonusSource);
     objNode.TryGetDecFieldQuickly("freepoints", ref _decFreePoints);
     objNode.TryGetDecFieldQuickly("extrapointcost", ref _decExtraPointCost);
     objNode.TryGetStringFieldQuickly("action", ref _strAction);
     objNode.TryGetStringFieldQuickly("source", ref _strSource);
     objNode.TryGetStringFieldQuickly("page", ref _strPage);
     objNode.TryGetStringFieldQuickly("notes", ref _strNotes);
     Bonus = objNode["bonus"];
     if (objBonusNodeOverride != null)
     {
         Bonus = objBonusNodeOverride;
     }
     _nodAdeptWayRequirements = objNode["adeptwayrequires"];
     if (objNode.InnerXml.Contains("enhancements"))
     {
         XmlNodeList nodEnhancements = objNode.SelectNodes("enhancements/enhancement");
         if (nodEnhancements != null)
         {
             foreach (XmlNode nodEnhancement in nodEnhancements)
             {
                 Enhancement objEnhancement = new Enhancement(CharacterObject);
                 objEnhancement.Load(nodEnhancement);
                 objEnhancement.Parent = this;
                 Enhancements.Add(objEnhancement);
             }
         }
     }
     if (Bonus != null && Bonus.HasChildNodes)
     {
         if (!CharacterObject.ObjImprovementManager.CreateImprovements(Improvement.ImprovementSource.Power, InternalId, Bonus, false, TotalRating, DisplayNameShort))
         {
             this.Deleting = true;
             CharacterObject.Powers.Remove(this);
             OnPropertyChanged(nameof(TotalRating));
             return(false);
         }
         Extra = CharacterObject.ObjImprovementManager.SelectedValue;
     }
     if (TotalMaximumLevels < Rating)
     {
         Rating = TotalMaximumLevels;
         OnPropertyChanged(nameof(TotalRating));
     }
     return(true);
 }
示例#3
0
 public void Create(XmlNode objNode, ImprovementManager objImprovementManager, int intRating = 1)
 {
     Name                 = objNode["name"].InnerText;
     _sourceID            = Guid.Parse(objNode["id"].InnerText);
     _strPointsPerLevel   = objNode["points"].InnerText;
     _strAdeptWayDiscount = objNode["adeptway"]?.InnerText ?? "0";
     LevelsEnabled        = Convert.ToBoolean(objNode["levels"].InnerText);
     Rating               = intRating;
     objNode.TryGetField("maxlevels", out _intMaxLevel, CharacterObject.MAG.TotalValue);
     objNode.TryGetField("discounted", out _blnDiscountedAdeptWay);
     objNode.TryGetField("discountedgeas", out _blnDiscountedGeas);
     objNode.TryGetField("bonussource", out _strBonusSource);
     objNode.TryGetField("freepoints", out _decFreePoints);
     objNode.TryGetField("extrapointcost", out _decExtraPointCost);
     objNode.TryGetField("action", out _strAction);
     objNode.TryGetField("source", out _strSource);
     objNode.TryGetField("page", out _strPage);
     objNode.TryGetField("notes", out _strNotes);
     Bonus = objNode["bonus"];
     _nodAdeptWayRequirements = objNode["adeptwayrequires"];
     if (objNode.InnerXml.Contains("enhancements"))
     {
         XmlNodeList nodEnhancements = objNode.SelectNodes("enhancements/enhancement");
         if (nodEnhancements != null)
         {
             foreach (XmlNode nodEnhancement in nodEnhancements)
             {
                 Enhancement objEnhancement = new Enhancement(CharacterObject);
                 objEnhancement.Load(nodEnhancement);
                 objEnhancement.Parent = this;
                 Enhancements.Add(objEnhancement);
             }
         }
     }
     if (Bonus != null && Bonus.HasChildNodes)
     {
         if (
             !objImprovementManager.CreateImprovements(Improvement.ImprovementSource.Power, InternalId, Bonus, false,
                                                       Convert.ToInt32(Rating), DisplayNameShort))
         {
             this.Deleting = true;
             CharacterObject.Powers.Remove(this);
             return;
         }
         Extra = objImprovementManager.SelectedValue;
     }
 }
示例#4
0
        protected void btnSave_Click(Object Sender, EventArgs e)
        {
            intRequest = oRequest.Add(0, intProfile);
            int intItemID   = oService.GetItemId(intService);
            int intResource = oServiceRequest.AddRequest(intRequest, intItemID, intService, 0, 0.00, (int)EnhancementStatus.UnderReview, 1, dsnServiceEditor);

            oServiceRequest.Update(intRequest, txtTitle.Text);
            oResourceRequest.UpdateName(intResource, txtTitle.Text);
            oServiceRequest.Add(intRequest, 1, 1);
            intID = oEnhancement.Add(txtTitle.Text, txtDescription.Text, Int32.Parse(ddlUsers.SelectedItem.Value), txtURL.Text, fileUpload, intEnvironment, Int32.Parse(radRelease1.SelectedItem.Value), Int32.Parse(radRelease2.SelectedItem.Value), intProfile, intResource);
            if (oServiceRequest.NotifyApproval(intResource, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false)
            {
                oServiceRequest.NotifyTeamLead(intItemID, intResource, intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0);
            }
            oEnhancement.AddLog(intID, 0, "Submitted Original Enhancement", intProfile, "");
            Response.Redirect(oPage.GetFullLinkRelated(intPage));
        }
示例#5
0
文件: Power.cs 项目: Rempha/chummer5a
 /// <summary>
 /// Load the Power from the XmlNode.
 /// </summary>
 /// <param name="objNode">XmlNode to load.</param>
 public void Load(XmlNode objNode)
 {
     _guiID = Guid.Parse(objNode["guid"].InnerText);
     Name   = objNode["name"].InnerText;
     if (objNode["id"] != null)
     {
         _sourceID           = Guid.Parse(objNode["id"].InnerText);
         _objCachedMyXmlNode = null;
     }
     else
     {
         string strPowerName = Name;
         if (strPowerName.Contains('('))
         {
             strPowerName = strPowerName.Substring(0, strPowerName.IndexOf('(') - 1);
         }
         XmlDocument objXmlDocument = XmlManager.Load("powers.xml");
         XmlNode     objXmlPower    = objXmlDocument.SelectSingleNode("/chummer/powers/power[starts-with(./name,\"" + strPowerName + "\")]");
         if (objXmlPower != null)
         {
             _sourceID           = Guid.Parse(objXmlPower["id"].InnerText);
             _objCachedMyXmlNode = null;
         }
     }
     Extra = objNode["extra"].InnerText ?? string.Empty;
     _strPointsPerLevel = objNode["pointsperlevel"]?.InnerText;
     objNode.TryGetField("action", out _strAction);
     if (objNode["adeptway"] != null)
     {
         _strAdeptWayDiscount = objNode["adeptway"].InnerText;
     }
     else
     {
         string strPowerName = Name;
         if (strPowerName.Contains('('))
         {
             strPowerName = strPowerName.Substring(0, strPowerName.IndexOf('(') - 1);
         }
         XmlDocument objXmlDocument = XmlManager.Load("powers.xml");
         XmlNode     objXmlPower    = objXmlDocument.SelectSingleNode("/chummer/powers/power[starts-with(./name,\"" + strPowerName + "\")]");
         if (objXmlPower?["adeptway"] != null)
         {
             _strAdeptWayDiscount = objXmlPower["adeptway"].InnerText;
         }
     }
     Rating        = Convert.ToInt32(objNode["rating"]?.InnerText);
     LevelsEnabled = objNode["levels"]?.InnerText == System.Boolean.TrueString;
     objNode.TryGetBoolFieldQuickly("free", ref _blnFree);
     objNode.TryGetInt32FieldQuickly("maxlevel", ref _intMaxLevel);
     objNode.TryGetInt32FieldQuickly("freelevels", ref _intFreeLevels);
     objNode.TryGetBoolFieldQuickly("discounted", ref _blnDiscountedAdeptWay);
     objNode.TryGetBoolFieldQuickly("discountedgeas", ref _blnDiscountedGeas);
     objNode.TryGetStringFieldQuickly("bonussource", ref _strBonusSource);
     objNode.TryGetDecFieldQuickly("freepoints", ref _decFreePoints);
     objNode.TryGetDecFieldQuickly("extrapointcost", ref _decExtraPointCost);
     objNode.TryGetStringFieldQuickly("source", ref _strSource);
     objNode.TryGetStringFieldQuickly("page", ref _strPage);
     objNode.TryGetStringFieldQuickly("notes", ref _strNotes);
     Bonus = objNode["bonus"];
     if (objNode["adeptway"] != null)
     {
         if (objNode["adeptwayrequires"] == null)
         {
             XmlNode objXmlPower = MyXmlNode;
             if (objXmlPower != null)
             {
                 _nodAdeptWayRequirements = objXmlPower["adeptwayrequires"];
             }
         }
         else
         {
             _nodAdeptWayRequirements = objNode["adeptwayrequires"];
         }
     }
     if (Name != "Improved Reflexes" && Name.StartsWith("Improved Reflexes"))
     {
         XmlDocument objXmlDocument = XmlManager.Load("powers.xml");
         XmlNode     objXmlPower    = objXmlDocument.SelectSingleNode("/chummer/powers/power[starts-with(./name,\"Improved Reflexes\")]");
         if (objXmlPower != null)
         {
             if (int.TryParse(Name.TrimStart("Improved Reflexes", true).Trim(), out int intTemp))
             {
                 Create(objXmlPower, intTemp, null, false);
                 objNode.TryGetStringFieldQuickly("notes", ref _strNotes);
             }
         }
     }
     else
     {
         if (!objNode.InnerXml.Contains("enhancements"))
         {
             return;
         }
         XmlNodeList nodEnhancements = objNode.SelectNodes("enhancements/enhancement");
         if (nodEnhancements == null)
         {
             return;
         }
         foreach (XmlNode nodEnhancement in nodEnhancements)
         {
             Enhancement objEnhancement = new Enhancement(CharacterObject);
             objEnhancement.Load(nodEnhancement);
             objEnhancement.Parent = this;
             Enhancements.Add(objEnhancement);
         }
     }
 }
示例#6
0
        public bool Create(XmlNode objNode, int intRating = 1, XmlNode objBonusNodeOverride = null, bool blnCreateImprovements = true)
        {
            objNode.TryGetStringFieldQuickly("name", ref _strName);
            objNode.TryGetField("id", Guid.TryParse, out _sourceID);
            _objCachedMyXmlNode = null;
            objNode.TryGetStringFieldQuickly("points", ref _strPointsPerLevel);
            objNode.TryGetStringFieldQuickly("adeptway", ref _strAdeptWayDiscount);
            LevelsEnabled = objNode["levels"]?.InnerText == bool.TrueString;
            Rating        = intRating;
            if (!objNode.TryGetStringFieldQuickly("altnotes", ref _strNotes))
            {
                objNode.TryGetStringFieldQuickly("notes", ref _strNotes);
            }
            objNode.TryGetInt32FieldQuickly("maxlevels", ref _intMaxLevel);
            objNode.TryGetBoolFieldQuickly("discounted", ref _blnDiscountedAdeptWay);
            objNode.TryGetBoolFieldQuickly("discountedgeas", ref _blnDiscountedGeas);
            objNode.TryGetStringFieldQuickly("bonussource", ref _strBonusSource);
            objNode.TryGetDecFieldQuickly("freepoints", ref _decFreePoints);
            objNode.TryGetDecFieldQuickly("extrapointcost", ref _decExtraPointCost);
            objNode.TryGetStringFieldQuickly("action", ref _strAction);
            objNode.TryGetStringFieldQuickly("source", ref _strSource);
            objNode.TryGetStringFieldQuickly("page", ref _strPage);
            Bonus = objNode["bonus"];
            if (objBonusNodeOverride != null)
            {
                Bonus = objBonusNodeOverride;
            }
            _nodAdeptWayRequirements = objNode["adeptwayrequires"];
            XmlNode nodEnhancements = objNode["enhancements"];

            if (nodEnhancements != null)
            {
                using (XmlNodeList xmlEnhancementList = nodEnhancements.SelectNodes("enhancement"))
                    if (xmlEnhancementList != null)
                    {
                        foreach (XmlNode nodEnhancement in xmlEnhancementList)
                        {
                            Enhancement objEnhancement = new Enhancement(CharacterObject);
                            objEnhancement.Load(nodEnhancement);
                            objEnhancement.Parent = this;
                            Enhancements.Add(objEnhancement);
                        }
                    }
            }
            if (blnCreateImprovements && Bonus != null && Bonus.HasChildNodes)
            {
                string strOldForce    = ImprovementManager.ForcedValue;
                string strOldSelected = ImprovementManager.SelectedValue;
                ImprovementManager.ForcedValue = Extra;
                if (!ImprovementManager.CreateImprovements(CharacterObject, Improvement.ImprovementSource.Power, InternalId, Bonus, false, TotalRating, DisplayNameShort(GlobalOptions.Language)))
                {
                    ImprovementManager.ForcedValue = strOldForce;
                    Deleting = true;
                    CharacterObject.Powers.Remove(this);
                    OnPropertyChanged(nameof(TotalRating));
                    return(false);
                }
                Extra = ImprovementManager.SelectedValue;
                ImprovementManager.SelectedValue = strOldSelected;
                ImprovementManager.ForcedValue   = strOldForce;
            }
            if (TotalMaximumLevels < Rating)
            {
                Rating = TotalMaximumLevels;
                OnPropertyChanged(nameof(TotalRating));
            }
            return(true);
        }
示例#7
0
 /// <summary>
 /// Load the Power from the XmlNode.
 /// </summary>
 /// <param name="objNode">XmlNode to load.</param>
 public void Load(XmlNode objNode)
 {
     objNode.TryGetField("guid", Guid.TryParse, out _guiID);
     objNode.TryGetStringFieldQuickly("name", ref _strName);
     if (objNode.TryGetField("id", Guid.TryParse, out _sourceID))
     {
         _objCachedMyXmlNode = null;
     }
     else
     {
         string strPowerName = Name;
         int    intPos       = strPowerName.IndexOf('(');
         if (intPos != -1)
         {
             strPowerName = strPowerName.Substring(0, intPos - 1);
         }
         XmlDocument objXmlDocument = XmlManager.Load("powers.xml");
         XmlNode     xmlPower       = objXmlDocument.SelectSingleNode("/chummer/powers/power[starts-with(./name,\"" + strPowerName + "\")]");
         if (xmlPower.TryGetField("id", Guid.TryParse, out _sourceID))
         {
             _objCachedMyXmlNode = null;
         }
     }
     Extra = objNode["extra"]?.InnerText ?? string.Empty;
     _strPointsPerLevel = objNode["pointsperlevel"]?.InnerText;
     objNode.TryGetStringFieldQuickly("action", ref _strAction);
     _strAdeptWayDiscount = objNode["adeptway"]?.InnerText;
     if (string.IsNullOrEmpty(_strAdeptWayDiscount))
     {
         string strPowerName = Name;
         int    intPos       = strPowerName.IndexOf('(');
         if (intPos != -1)
         {
             strPowerName = strPowerName.Substring(0, intPos - 1);
         }
         _strAdeptWayDiscount = XmlManager.Load("powers.xml").SelectSingleNode("/chummer/powers/power[starts-with(./name,\"" + strPowerName + "\")]/adeptway")?.InnerText ?? string.Empty;
     }
     objNode.TryGetInt32FieldQuickly("rating", ref _intRating);
     objNode.TryGetBoolFieldQuickly("levels", ref _blnLevelsEnabled);
     objNode.TryGetInt32FieldQuickly("maxlevel", ref _intMaxLevel);
     objNode.TryGetBoolFieldQuickly("discounted", ref _blnDiscountedAdeptWay);
     objNode.TryGetBoolFieldQuickly("discountedgeas", ref _blnDiscountedGeas);
     objNode.TryGetStringFieldQuickly("bonussource", ref _strBonusSource);
     objNode.TryGetDecFieldQuickly("freepoints", ref _decFreePoints);
     objNode.TryGetDecFieldQuickly("extrapointcost", ref _decExtraPointCost);
     objNode.TryGetStringFieldQuickly("source", ref _strSource);
     objNode.TryGetStringFieldQuickly("page", ref _strPage);
     objNode.TryGetStringFieldQuickly("notes", ref _strNotes);
     Bonus = objNode["bonus"];
     if (objNode["adeptway"] != null)
     {
         _nodAdeptWayRequirements = objNode["adeptwayrequires"] ?? GetNode()?["adeptwayrequires"];
     }
     if (Name != "Improved Reflexes" && Name.StartsWith("Improved Reflexes"))
     {
         XmlNode objXmlPower = XmlManager.Load("powers.xml").SelectSingleNode("/chummer/powers/power[starts-with(./name,\"Improved Reflexes\")]");
         if (objXmlPower != null)
         {
             if (int.TryParse(Name.TrimStartOnce("Improved Reflexes", true).Trim(), out int intTemp))
             {
                 Create(objXmlPower, intTemp, null, false);
                 objNode.TryGetStringFieldQuickly("notes", ref _strNotes);
             }
         }
     }
     else
     {
         XmlNodeList nodEnhancements = objNode.SelectNodes("enhancements/enhancement");
         if (nodEnhancements != null)
         {
             foreach (XmlNode nodEnhancement in nodEnhancements)
             {
                 Enhancement objEnhancement = new Enhancement(CharacterObject);
                 objEnhancement.Load(nodEnhancement);
                 objEnhancement.Parent = this;
                 Enhancements.Add(objEnhancement);
             }
         }
     }
 }
示例#8
0
        /// <summary>
        /// Load the Power from the XmlNode.
        /// </summary>
        /// <param name="objNode">XmlNode to load.</param>
        public void Load(XmlNode objNode)
        {
            if (!objNode.TryGetField("guid", Guid.TryParse, out _guiID))
            {
                _guiID = Guid.NewGuid();
            }
            objNode.TryGetStringFieldQuickly("name", ref _strName);
            if (!objNode.TryGetGuidFieldQuickly("sourceid", ref _guiSourceID))
            {
                XmlNode node = GetNode(GlobalOptions.Language);
                if (!(node.TryGetField("id", Guid.TryParse, out _guiSourceID)))
                {
                    string strPowerName = Name;
                    int    intPos       = strPowerName.IndexOf('(');
                    if (intPos != -1)
                    {
                        strPowerName = strPowerName.Substring(0, intPos - 1);
                    }
                    XmlDocument objXmlDocument = XmlManager.Load("powers.xml");
                    XmlNode     xmlPower       = objXmlDocument.SelectSingleNode("/chummer/powers/power[starts-with(./name,\"" + strPowerName + "\")]");
                    if (xmlPower.TryGetField("id", Guid.TryParse, out _guiSourceID))
                    {
                        _objCachedMyXmlNode = null;
                    }
                }
            }

            Extra = objNode["extra"]?.InnerText ?? string.Empty;
            _strPointsPerLevel = objNode["pointsperlevel"]?.InnerText;
            objNode.TryGetStringFieldQuickly("action", ref _strAction);
            _strAdeptWayDiscount = objNode["adeptway"]?.InnerText;
            if (string.IsNullOrEmpty(_strAdeptWayDiscount))
            {
                string strPowerName = Name;
                int    intPos       = strPowerName.IndexOf('(');
                if (intPos != -1)
                {
                    strPowerName = strPowerName.Substring(0, intPos - 1);
                }
                _strAdeptWayDiscount = XmlManager.Load("powers.xml").SelectSingleNode("/chummer/powers/power[starts-with(./name,\"" + strPowerName + "\")]/adeptway")?.InnerText ?? string.Empty;
            }
            objNode.TryGetInt32FieldQuickly("rating", ref _intRating);
            objNode.TryGetBoolFieldQuickly("levels", ref _blnLevelsEnabled);
            if (!objNode.TryGetInt32FieldQuickly("maxlevel", ref _intMaxLevels))
            {
                objNode.TryGetInt32FieldQuickly("maxlevels", ref _intMaxLevels);
            }
            objNode.TryGetBoolFieldQuickly("discounted", ref _blnDiscountedAdeptWay);
            objNode.TryGetBoolFieldQuickly("discountedgeas", ref _blnDiscountedGeas);
            objNode.TryGetStringFieldQuickly("bonussource", ref _strBonusSource);
            objNode.TryGetDecFieldQuickly("freepoints", ref _decFreePoints);
            objNode.TryGetDecFieldQuickly("extrapointcost", ref _decExtraPointCost);
            objNode.TryGetStringFieldQuickly("source", ref _strSource);
            objNode.TryGetStringFieldQuickly("page", ref _strPage);
            objNode.TryGetStringFieldQuickly("notes", ref _strNotes);
            Bonus = objNode["bonus"];
            if (objNode["adeptway"] != null)
            {
                _nodAdeptWayRequirements = (objNode["adeptwayrequires"] ?? GetNode()?["adeptwayrequires"])?.CreateNavigator();
            }
            if (Name != "Improved Reflexes" && Name.StartsWith("Improved Reflexes", StringComparison.Ordinal))
            {
                XmlNode objXmlPower = XmlManager.Load("powers.xml").SelectSingleNode("/chummer/powers/power[starts-with(./name,\"Improved Reflexes\")]");
                if (objXmlPower != null)
                {
                    if (int.TryParse(Name.TrimStartOnce("Improved Reflexes", true).Trim(), out int intTemp))
                    {
                        Create(objXmlPower, intTemp, null, false);
                        objNode.TryGetStringFieldQuickly("notes", ref _strNotes);
                    }
                }
            }
            else
            {
                XmlNodeList nodEnhancements = objNode.SelectNodes("enhancements/enhancement");
                if (nodEnhancements != null)
                {
                    foreach (XmlNode nodEnhancement in nodEnhancements)
                    {
                        Enhancement objEnhancement = new Enhancement(CharacterObject);
                        objEnhancement.Load(nodEnhancement);
                        objEnhancement.Parent = this;
                        Enhancements.Add(objEnhancement);
                    }
                }
            }

            //TODO: Seems that the MysAd Second Attribute house rule gets accidentally enabled sometimes?
            if (Rating > TotalMaximumLevels)
            {
                Utils.BreakIfDebug();
                Rating = TotalMaximumLevels;
            }
            else if (Rating + FreeLevels > TotalMaximumLevels)
            {
                Utils.BreakIfDebug();
                TotalRating = TotalMaximumLevels;
            }
        }
示例#9
0
 public void AddEnhancement(Enhancement enhancement)
 {
     Enhancements.Add(enhancement);
 }