当前位置: 首页>>代码示例>>C#>>正文


C# Chummer.ImprovementManager类代码示例

本文整理汇总了C#中Chummer.ImprovementManager的典型用法代码示例。如果您正苦于以下问题:C# ImprovementManager类的具体用法?C# ImprovementManager怎么用?C# ImprovementManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ImprovementManager类属于Chummer命名空间,在下文中一共展示了ImprovementManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: frmCareer

        public frmCareer(Character objCharacter)
        {
            _objCharacter = objCharacter;
            _objOptions = _objCharacter.Options;

            _objFunctions = new CommonFunctions(_objCharacter);
            _objFunctions.ContextMenuArmor = cmsArmor;
            _objFunctions.ContextMenuArmorMod = cmsArmorMod;
            _objFunctions.ContextMenuCyberware = cmsCyberware;
            _objFunctions.ContextMenuGear = cmsGear;
            _objFunctions.ContextMenuVehicle = cmsVehicle;
            _objFunctions.ContextMenuVehicleMod = cmsVehicle;
            _objFunctions.ContextMenuWeapon = cmsWeapon;
            _objFunctions.ContextMenuWeaponAccessory = cmsWeaponAccessoryGear;
            _objFunctions.ContextMenuWeaponMod = cmsWeaponMod;

            _objImprovementManager = new ImprovementManager(_objCharacter);
            _objController = new MainController(_objCharacter);
            InitializeComponent();

            // Add EventHandlers for the MAG and RES enabled events and tab enabled events.
            _objCharacter.MAGEnabledChanged += objCharacter_MAGEnabledChanged;
            _objCharacter.RESEnabledChanged += objCharacter_RESEnabledChanged;
            _objCharacter.AdeptTabEnabledChanged += objCharacter_AdeptTabEnabledChanged;
            _objCharacter.MagicianTabEnabledChanged += objCharacter_MagicianTabEnabledChanged;
            _objCharacter.TechnomancerTabEnabledChanged += objCharacter_TechnomancerTabEnabledChanged;
            _objCharacter.CritterTabEnabledChanged += objCharacter_CritterTabEnabledChanged;
            _objCharacter.BlackMarketEnabledChanged += objCharacter_BlackMarketChanged;
            _objCharacter.SensitiveSystemChanged += objCharacter_SensitiveSystemChanged;
            _objCharacter.UneducatedChanged += objCharacter_UneducatedChanged;
            _objCharacter.UncouthChanged += objCharacter_UncouthChanged;
            _objCharacter.InfirmChanged += objCharacter_InfirmChanged;
            GlobalOptions.Instance.MRUChanged += PopulateMRU;

            LanguageManager.Instance.Load(this);

            // Update the text in the Menus so they can be merged with frmMain properly.
            foreach (ToolStripMenuItem objItem in mnuCreateMenu.Items.OfType<ToolStripMenuItem>())
            {
                if (objItem.Tag != null)
                {
                    objItem.Text = LanguageManager.Instance.GetString(objItem.Tag.ToString());
                }
            }

            _lvwKarmaColumnSorter = new ListViewColumnSorter();
            _lvwKarmaColumnSorter.SortColumn = 0;
            _lvwKarmaColumnSorter.Order = SortOrder.Descending;
            lstKarma.ListViewItemSorter = _lvwKarmaColumnSorter;
            _lvwNuyenColumnSorter = new ListViewColumnSorter();
            _lvwNuyenColumnSorter.SortColumn = 0;
            _lvwNuyenColumnSorter.Order = SortOrder.Descending;
            lstNuyen.ListViewItemSorter = _lvwNuyenColumnSorter;

            SetTooltips();
            MoveControls();
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:57,代码来源:frmCareer.cs

示例2: frmCreate

        public frmCreate(Character objCharacter)
        {
            _objCharacter = objCharacter;
            _objOptions = _objCharacter.Options;
            _objFunctions = new CommonFunctions(_objCharacter);
            _objImprovementManager = new ImprovementManager(_objCharacter);
            _objController = new MainController(_objCharacter);
            InitializeComponent();

            // Add EventHandlers for the various events MAG, RES, Qualities, etc.
            _objCharacter.MAGEnabledChanged += objCharacter_MAGEnabledChanged;
            _objCharacter.RESEnabledChanged += objCharacter_RESEnabledChanged;
            _objCharacter.AdeptTabEnabledChanged += objCharacter_AdeptTabEnabledChanged;
            _objCharacter.MagicianTabEnabledChanged += objCharacter_MagicianTabEnabledChanged;
            _objCharacter.TechnomancerTabEnabledChanged += objCharacter_TechnomancerTabEnabledChanged;
            _objCharacter.InitiationTabEnabledChanged += objCharacter_InitiationTabEnabledChanged;
            _objCharacter.CritterTabEnabledChanged += objCharacter_CritterTabEnabledChanged;
            _objCharacter.BlackMarketEnabledChanged += objCharacter_BlackMarketDiscountChanged;
            _objCharacter.SkillsSection.UneducatedChanged += objCharacter_UneducatedChanged;
            _objCharacter.SkillsSection.UncouthChanged += objCharacter_UncouthChanged;
            _objCharacter.FriendsInHighPlacesChanged += objCharacter_FriendsInHighPlacesChanged;
            _objCharacter.SkillsSection.SchoolOfHardKnocksChanged += objCharacter_SchoolOfHardKnocksChanged;
            _objCharacter.ExConChanged += objCharacter_ExConChanged;
            _objCharacter.TrustFundChanged += objCharacter_TrustFundChanged;
            _objCharacter.SkillsSection.TechSchoolChanged += objCharacter_TechSchoolChanged;
            _objCharacter.RestrictedGearChanged += objCharacter_RestrictedGearChanged;
            _objCharacter.OverclockerChanged += objCharacter_OverclockerChanged;
            _objCharacter.MadeManChanged += objCharacter_MadeManChanged;
            _objCharacter.SkillsSection.LinguistChanged += objCharacter_LinguistChanged;
            _objCharacter.LightningReflexesChanged += objCharacter_LightningReflexesChanged;
            _objCharacter.FameChanged += objCharacter_FameChanged;
            _objCharacter.BornRichChanged += objCharacter_BornRichChanged;
            _objCharacter.ErasedChanged += objCharacter_ErasedChanged;

            tabSkillUc.ChildPropertyChanged += SkillPropertyChanged;

            GlobalOptions.Instance.MRUChanged += PopulateMRU;

            LanguageManager.Instance.Load(GlobalOptions.Instance.Language, this);

            // Update the text in the Menus so they can be merged with frmMain properly.
            foreach (ToolStripMenuItem objItem in mnuCreateMenu.Items.OfType<ToolStripMenuItem>())
            {
                if (objItem.Tag != null)
                {
                    objItem.Text = LanguageManager.Instance.GetString(objItem.Tag.ToString());
                }
            }

            SetTooltips();
            MoveControls();
        }
开发者ID:argo2445,项目名称:chummer5a,代码行数:52,代码来源:frmCreate.cs

示例3: frmCareer

        public frmCareer(Character objCharacter)
        {
            _objCharacter = objCharacter;
            _objOptions = _objCharacter.Options;
            _objFunctions = new CommonFunctions(_objCharacter);
            _objImprovementManager = new ImprovementManager(_objCharacter);
            _objController = new MainController(_objCharacter);
            InitializeComponent();

            // Add EventHandlers for the MAG and RES enabled events and tab enabled events.
            _objCharacter.MAGEnabledChanged += objCharacter_MAGEnabledChanged;
            _objCharacter.RESEnabledChanged += objCharacter_RESEnabledChanged;
            _objCharacter.AdeptTabEnabledChanged += objCharacter_AdeptTabEnabledChanged;
            _objCharacter.MagicianTabEnabledChanged += objCharacter_MagicianTabEnabledChanged;
            _objCharacter.TechnomancerTabEnabledChanged += objCharacter_TechnomancerTabEnabledChanged;
            _objCharacter.CritterTabEnabledChanged += objCharacter_CritterTabEnabledChanged;
            _objCharacter.SkillsSection.UneducatedChanged += objCharacter_UneducatedChanged;
            _objCharacter.SkillsSection.UncouthChanged += objCharacter_UncouthChanged;
            _objCharacter.FameChanged += objCharacter_FameChanged;
            tabSkillsUc.ChildPropertyChanged += SkillPropertyChanged;
            GlobalOptions.Instance.MRUChanged += PopulateMRU;

            LanguageManager.Instance.Load(GlobalOptions.Instance.Language, this);

            // Update the text in the Menus so they can be merged with frmMain properly.
            foreach (ToolStripMenuItem objItem in mnuCreateMenu.Items.OfType<ToolStripMenuItem>())
            {
                if (objItem.Tag != null)
                {
                    objItem.Text = LanguageManager.Instance.GetString(objItem.Tag.ToString());
                }
            }

            _lvwKarmaColumnSorter = new ListViewColumnSorter();
            _lvwKarmaColumnSorter.SortColumn = 0;
            _lvwKarmaColumnSorter.Order = SortOrder.Descending;
            lstKarma.ListViewItemSorter = _lvwKarmaColumnSorter;
            _lvwNuyenColumnSorter = new ListViewColumnSorter();
            _lvwNuyenColumnSorter.SortColumn = 0;
            _lvwNuyenColumnSorter.Order = SortOrder.Descending;
            lstNuyen.ListViewItemSorter = _lvwNuyenColumnSorter;

            SetTooltips();
            MoveControls();
        }
开发者ID:argo2445,项目名称:chummer5a,代码行数:45,代码来源:frmCareer.cs

示例4: frmCreate

        public frmCreate(Character objCharacter)
        {
            _objCharacter = objCharacter;
            _objOptions = _objCharacter.Options;
            _objFunctions = new CommonFunctions(_objCharacter);
            _objImprovementManager = new ImprovementManager(_objCharacter);
            _objController = new MainController(_objCharacter);
            InitializeComponent();

            // Add EventHandlers for the MAG and RES enabled events and tab enabled events.
            _objCharacter.MAGEnabledChanged += objCharacter_MAGEnabledChanged;
            _objCharacter.RESEnabledChanged += objCharacter_RESEnabledChanged;
            _objCharacter.AdeptTabEnabledChanged += objCharacter_AdeptTabEnabledChanged;
            _objCharacter.MagicianTabEnabledChanged += objCharacter_MagicianTabEnabledChanged;
            _objCharacter.TechnomancerTabEnabledChanged += objCharacter_TechnomancerTabEnabledChanged;
            _objCharacter.InitiationTabEnabledChanged += objCharacter_InitiationTabEnabledChanged;
            _objCharacter.CritterTabEnabledChanged += objCharacter_CritterTabEnabledChanged;
            _objCharacter.BlackMarketEnabledChanged += objCharacter_BlackMarketChanged;
            _objCharacter.UneducatedChanged += objCharacter_UneducatedChanged;
            _objCharacter.UncouthChanged += objCharacter_UncouthChanged;
            _objCharacter.InfirmChanged += objCharacter_InfirmChanged;
            GlobalOptions.Instance.MRUChanged += PopulateMRU;

            LanguageManager.Instance.Load(GlobalOptions.Instance.Language, this);

            // Update the text in the Menus so they can be merged with frmMain properly.
            foreach (ToolStripMenuItem objItem in mnuCreateMenu.Items.OfType<ToolStripMenuItem>())
            {
                if (objItem.Tag != null)
                {
                    objItem.Text = LanguageManager.Instance.GetString(objItem.Tag.ToString());
                }
            }

            SetTooltips();
            MoveControls();
        }
开发者ID:kingcortez905,项目名称:chummer5,代码行数:37,代码来源:frmCreate.cs

示例5: Character

 /// <summary>
 /// Character.
 /// </summary>
 public Character()
 {
     _attBOD._objCharacter = this;
     _attAGI._objCharacter = this;
     _attREA._objCharacter = this;
     _attSTR._objCharacter = this;
     _attCHA._objCharacter = this;
     _attINT._objCharacter = this;
     _attLOG._objCharacter = this;
     _attWIL._objCharacter = this;
     _attINI._objCharacter = this;
     _attEDG._objCharacter = this;
     _attMAG._objCharacter = this;
     _attRES._objCharacter = this;
     _attESS._objCharacter = this;
     _objImprovementManager = new ImprovementManager(this);
 }
开发者ID:ercflemng,项目名称:chummer5a,代码行数:20,代码来源:clsCharacter.cs

示例6: DeleteGear

        /// <summary>
        /// Recursive method to delete a piece of Gear and its Improvements from the character.
        /// </summary>
        /// <param name="objGear">Gear to delete.</param>
        /// <param name="treWeapons">TreeView that holds the list of Weapons.</param>
        /// <param name="objImprovementManager">Improvement Manager the character is using.</param>
        public void DeleteGear(Gear objGear, TreeView treWeapons, ImprovementManager objImprovementManager)
        {
            // Remove any children the Gear may have.
            foreach (Gear objChild in objGear.Children)
                DeleteGear(objChild, treWeapons, objImprovementManager);

            // Remove the Gear Weapon created by the Gear if applicable.
            if (objGear.WeaponID != Guid.Empty.ToString())
            {
                // Remove the Weapon from the TreeView.
                TreeNode objRemoveNode = new TreeNode();
                foreach (TreeNode objWeaponNode in treWeapons.Nodes[0].Nodes)
                {
                    if (objWeaponNode.Tag.ToString() == objGear.WeaponID)
                        objRemoveNode = objWeaponNode;
                }
                treWeapons.Nodes.Remove(objRemoveNode);

                // Remove the Weapon from the Character.
                Weapon objRemoveWeapon = new Weapon(_objCharacter);
                foreach (Weapon objWeapon in _objCharacter.Weapons)
                {
                    if (objWeapon.InternalId == objGear.WeaponID)
                        objRemoveWeapon = objWeapon;
                }
                _objCharacter.Weapons.Remove(objRemoveWeapon);
            }

            objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.Gear, objGear.InternalId);

            // If a Focus is being removed, make sure the actual Focus is being removed from the character as well.
            if (objGear.Category == "Foci" || objGear.Category == "Metamagic Foci")
            {
                List<Focus> lstRemoveFoci = new List<Focus>();
                foreach (Focus objFocus in _objCharacter.Foci)
                {
                    if (objFocus.GearId == objGear.InternalId)
                        lstRemoveFoci.Add(objFocus);
                }
                foreach (Focus objFocus in lstRemoveFoci)
                    _objCharacter.Foci.Remove(objFocus);
            }

            // If a Stacked Focus is being removed, make sure the Stacked Foci and its bonuses are being removed.
            if (objGear.Category == "Stacked Focus")
            {
                foreach (StackedFocus objStack in _objCharacter.StackedFoci)
                {
                    if (objStack.GearId == objGear.InternalId)
                    {
                        objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.StackedFocus, objStack.InternalId);
                        _objCharacter.StackedFoci.Remove(objStack);
                        break;
                    }
                }
            }
        }
开发者ID:hollis21,项目名称:Chummer,代码行数:63,代码来源:clsCommon.cs

示例7: Create

        /// Create a Skill Limit Modifier from an XmlNode and return the TreeNodes for it.
        /// <param name="objXmlAdvantageNode">XmlNode to create the object from.</param>
        /// <param name="objCharacter">Character the Gear is being added to.</param>
        /// <param name="objNode">TreeNode to populate a TreeView.</param>
        public void Create(XmlNode objXmlLimitModifierNode, Character objCharacter, TreeNode objNode)
        {
            _strName = objXmlLimitModifierNode["name"].InnerText;

            if (objXmlLimitModifierNode["bonus"] != null)
            {
                ImprovementManager objImprovementManager = new ImprovementManager(objCharacter);
                if (!objImprovementManager.CreateImprovements(Improvement.ImprovementSource.MartialArtAdvantage, _guiID.ToString(), objXmlLimitModifierNode["bonus"], false, 1, DisplayNameShort))
                {
                    _guiID = Guid.Empty;
                    return;
                }
            }

            objNode.Text = DisplayName;
            objNode.Tag = _guiID.ToString();
        }
开发者ID:Vanatrix,项目名称:chummer5a,代码行数:21,代码来源:clsUnique.cs

示例8: Create

        /// <summary>
        /// Create a Quality from an XmlNode and return the TreeNodes for it.
        /// </summary>
        /// <param name="objXmlQuality">XmlNode to create the object from.</param>
        /// <param name="objCharacter">Character object the Quality will be added to.</param>
        /// <param name="objQualitySource">Source of the Quality.</param>
        /// <param name="objNode">TreeNode to populate a TreeView.</param>
        /// <param name="objWeapons">List of Weapons that should be added to the Character.</param>
        /// <param name="objWeaponNodes">List of TreeNodes to represent the Weapons added.</param>
        /// <param name="strForceValue">Force a value to be selected for the Quality.</param>
        public void Create(XmlNode objXmlQuality, Character objCharacter, QualitySource objQualitySource, TreeNode objNode, List<Weapon> objWeapons, List<TreeNode> objWeaponNodes, string strForceValue = "")
        {
            _strName = objXmlQuality["name"].InnerText;
            _intBP = Convert.ToInt32(objXmlQuality["karma"].InnerText);
            _objQualityType = ConvertToQualityType(objXmlQuality["category"].InnerText);
            _objQualitySource = objQualitySource;
            if (objXmlQuality["print"] != null)
            {
                if (objXmlQuality["print"].InnerText == "no")
                    _blnPrint = false;
            }
            if (objXmlQuality["contributetolimit"] != null)
            {
                if (objXmlQuality["contributetolimit"].InnerText == "no")
                    _blnContributeToLimit = false;
            }
            _strSource = objXmlQuality["source"].InnerText;
            _strPage = objXmlQuality["page"].InnerText;
            if (objXmlQuality["mutant"] != null)
                _strMutant = "yes";

            if (GlobalOptions.Instance.Language != "en-us")
            {
                XmlDocument objXmlDocument = XmlManager.Instance.Load("qualities.xml");
                XmlNode objQualityNode = objXmlDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + _strName + "\"]");
                if (objQualityNode != null)
                {
                    if (objQualityNode["translate"] != null)
                        _strAltName = objQualityNode["translate"].InnerText;
                    if (objQualityNode["altpage"] != null)
                        _strAltPage = objQualityNode["altpage"].InnerText;
                }
            }

            // Add Weapons if applicable.
            if (objXmlQuality.InnerXml.Contains("<addweapon>"))
            {
                XmlDocument objXmlWeaponDocument = XmlManager.Instance.Load("weapons.xml");

                // More than one Weapon can be added, so loop through all occurrences.
                foreach (XmlNode objXmlAddWeapon in objXmlQuality.SelectNodes("addweapon"))
                {
                    XmlNode objXmlWeapon = objXmlWeaponDocument.SelectSingleNode("/chummer/weapons/weapon[name = \"" + objXmlAddWeapon.InnerText + "\" and starts-with(category, \"Quality\")]");

                    TreeNode objGearWeaponNode = new TreeNode();
                    Weapon objGearWeapon = new Weapon(objCharacter);
                    objGearWeapon.Create(objXmlWeapon, objCharacter, objGearWeaponNode, null, null, null);
                    objGearWeaponNode.ForeColor = SystemColors.GrayText;
                    objWeaponNodes.Add(objGearWeaponNode);
                    objWeapons.Add(objGearWeapon);

                    _guiWeaponID = Guid.Parse(objGearWeapon.InternalId);
                }
            }

            // If the item grants a bonus, pass the information to the Improvement Manager.
            if (objXmlQuality.InnerXml.Contains("<bonus>"))
            {
                ImprovementManager objImprovementManager = new ImprovementManager(objCharacter);
                objImprovementManager.ForcedValue = strForceValue;
                if (!objImprovementManager.CreateImprovements(Improvement.ImprovementSource.Quality, _guiID.ToString(), objXmlQuality["bonus"], false, 1, DisplayNameShort))
                {
                    _guiID = Guid.Empty;
                    return;
                }
                if (objImprovementManager.SelectedValue != "")
                {
                    _strExtra = objImprovementManager.SelectedValue;
                    objNode.Text += " (" + objImprovementManager.SelectedValue + ")";
                }
            }

            // Metatype Qualities appear as grey text to show that they cannot be removed.
            if (objQualitySource == QualitySource.Metatype || objQualitySource == QualitySource.MetatypeRemovable)
                objNode.ForeColor = SystemColors.GrayText;

            objNode.Text = DisplayName;
            objNode.Tag = InternalId;
        }
开发者ID:kingcortez905,项目名称:chummer5,代码行数:89,代码来源:clsUnique.cs

示例9: MetatypeSelected

        /// <summary>
        /// A Metatype has been selected, so fill in all of the necessary Character information.
        /// </summary>
        void MetatypeSelected()
        {
            if (lstMetatypes.Text != "")
            {
                ImprovementManager objImprovementManager = new ImprovementManager(_objCharacter);
                XmlDocument objXmlDocument = XmlManager.Instance.Load(_strXmlFile);
                XmlNode objXmlMetatype = objXmlDocument.SelectSingleNode("/chummer/metatypes/metatype[name = \"" + lstMetatypes.SelectedValue + "\"]");
                XmlNode objXmlMetavariant = objXmlDocument.SelectSingleNode("/chummer/metatypes/metatype[name = \"" + lstMetatypes.SelectedValue + "\"]/metavariants/metavariant[name = \"" + cboMetavariant.SelectedValue + "\"]");
                int intForce = 0;
                if (nudForce.Visible)
                    intForce = Convert.ToInt32(nudForce.Value);

                // Set Metatype information.

                if (cboMetavariant.SelectedValue.ToString() != "None")
                {
                    _objCharacter.BOD.AssignLimits(ExpressionToString(objXmlMetavariant["bodmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["bodmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["bodaug"].InnerText, intForce, 0));
                    _objCharacter.AGI.AssignLimits(ExpressionToString(objXmlMetavariant["agimin"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["agimax"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["agiaug"].InnerText, intForce, 0));
                    _objCharacter.REA.AssignLimits(ExpressionToString(objXmlMetavariant["reamin"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["reamax"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["reaaug"].InnerText, intForce, 0));
                    _objCharacter.STR.AssignLimits(ExpressionToString(objXmlMetavariant["strmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["strmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["straug"].InnerText, intForce, 0));
                    _objCharacter.CHA.AssignLimits(ExpressionToString(objXmlMetavariant["chamin"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["chamax"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["chaaug"].InnerText, intForce, 0));
                    _objCharacter.INT.AssignLimits(ExpressionToString(objXmlMetavariant["intmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["intmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["intaug"].InnerText, intForce, 0));
                    _objCharacter.LOG.AssignLimits(ExpressionToString(objXmlMetavariant["logmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["logmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["logaug"].InnerText, intForce, 0));
                    _objCharacter.WIL.AssignLimits(ExpressionToString(objXmlMetavariant["wilmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["wilmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["wilaug"].InnerText, intForce, 0));
                    _objCharacter.INI.AssignLimits(ExpressionToString(objXmlMetavariant["inimin"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["inimax"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["iniaug"].InnerText, intForce, 0));
                    _objCharacter.MAG.AssignLimits(ExpressionToString(objXmlMetavariant["magmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["magmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["magaug"].InnerText, intForce, 0));
                    _objCharacter.RES.AssignLimits(ExpressionToString(objXmlMetavariant["resmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["resmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["resaug"].InnerText, intForce, 0));
                    _objCharacter.EDG.AssignLimits(ExpressionToString(objXmlMetavariant["edgmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["edgmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["edgaug"].InnerText, intForce, 0));
                    _objCharacter.ESS.AssignLimits(ExpressionToString(objXmlMetavariant["essmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["essmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["essaug"].InnerText, intForce, 0));
                }
                else if (_strXmlFile != "critters.xml" || lstMetatypes.SelectedValue.ToString() == "Ally Spirit")
                {
                    _objCharacter.BOD.AssignLimits(ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["bodmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["bodaug"].InnerText, intForce, 0));
                    _objCharacter.AGI.AssignLimits(ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["agimax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["agiaug"].InnerText, intForce, 0));
                    _objCharacter.REA.AssignLimits(ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["reamax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["reaaug"].InnerText, intForce, 0));
                    _objCharacter.STR.AssignLimits(ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["strmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["straug"].InnerText, intForce, 0));
                    _objCharacter.CHA.AssignLimits(ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["chamax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["chaaug"].InnerText, intForce, 0));
                    _objCharacter.INT.AssignLimits(ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["intmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["intaug"].InnerText, intForce, 0));
                    _objCharacter.LOG.AssignLimits(ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["logmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["logaug"].InnerText, intForce, 0));
                    _objCharacter.WIL.AssignLimits(ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["wilmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["wilaug"].InnerText, intForce, 0));
                    _objCharacter.INI.AssignLimits(ExpressionToString(objXmlMetatype["inimin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["inimax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["iniaug"].InnerText, intForce, 0));
                    _objCharacter.MAG.AssignLimits(ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["magmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["magaug"].InnerText, intForce, 0));
                    _objCharacter.RES.AssignLimits(ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["resmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["resaug"].InnerText, intForce, 0));
                    _objCharacter.EDG.AssignLimits(ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["edgmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["edgaug"].InnerText, intForce, 0));
                    _objCharacter.ESS.AssignLimits(ExpressionToString(objXmlMetatype["essmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["essmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["essaug"].InnerText, intForce, 0));
                }
                else
                {
                    int intMinModifier = -3;
                    if (cboCategory.SelectedValue.ToString() == "Mutant Critters")
                        intMinModifier = 0;
                    _objCharacter.BOD.AssignLimits(ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, 3));
                    _objCharacter.AGI.AssignLimits(ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, 3));
                    _objCharacter.REA.AssignLimits(ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, 3));
                    _objCharacter.STR.AssignLimits(ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, 3));
                    _objCharacter.CHA.AssignLimits(ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, 3));
                    _objCharacter.INT.AssignLimits(ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, 3));
                    _objCharacter.LOG.AssignLimits(ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, 3));
                    _objCharacter.WIL.AssignLimits(ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, 3));
                    _objCharacter.INI.AssignLimits(ExpressionToString(objXmlMetatype["inimin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["inimax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["iniaug"].InnerText, intForce, 0));
                    _objCharacter.MAG.AssignLimits(ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, 3));
                    _objCharacter.RES.AssignLimits(ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, 3));
                    _objCharacter.EDG.AssignLimits(ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, 3));
                    _objCharacter.ESS.AssignLimits(ExpressionToString(objXmlMetatype["essmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["essmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["essaug"].InnerText, intForce, 0));
                }

                // If we're working with a Critter, set the Attributes to their default values.
                if (_strXmlFile == "critters.xml")
                {
                    _objCharacter.BOD.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, 0));
                    _objCharacter.AGI.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, 0));
                    _objCharacter.REA.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, 0));
                    _objCharacter.STR.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, 0));
                    _objCharacter.CHA.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, 0));
                    _objCharacter.INT.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, 0));
                    _objCharacter.LOG.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, 0));
                    _objCharacter.WIL.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, 0));
                    _objCharacter.MAG.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, 0));
                    _objCharacter.RES.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, 0));
                    _objCharacter.EDG.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, 0));
                    _objCharacter.ESS.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["essmax"].InnerText, intForce, 0));
                }

                // Sprites can never have Physical Attributes or WIL.
                if (lstMetatypes.SelectedValue.ToString().EndsWith("Sprite"))
                {
                    _objCharacter.BOD.AssignLimits("0", "0", "0");
                    _objCharacter.AGI.AssignLimits("0", "0", "0");
                    _objCharacter.REA.AssignLimits("0", "0", "0");
                    _objCharacter.STR.AssignLimits("0", "0", "0");
                    _objCharacter.WIL.AssignLimits("0", "0", "0");
                    _objCharacter.INI.MetatypeMinimum = Convert.ToInt32(ExpressionToString(objXmlMetatype["inimax"].InnerText, intForce, 0));
                    _objCharacter.INI.MetatypeMaximum = Convert.ToInt32(ExpressionToString(objXmlMetatype["inimax"].InnerText, intForce, 0));
                }

                // If this is a Shapeshifter, a Metavariant must be selected. Default to Human if None is selected.
                if (cboCategory.SelectedValue.ToString() == "Shapeshifter" && cboMetavariant.SelectedValue.ToString() == "None")
//.........这里部分代码省略.........
开发者ID:Nitsuj83,项目名称:chummer5a,代码行数:101,代码来源:frmKarmaMetatype.cs

示例10: TestMetatype

        void TestMetatype(string strFile)
        {
            XmlDocument objXmlDocument = XmlManager.Instance.Load(strFile);

            pgbProgress.Minimum = 0;
            pgbProgress.Value = 0;
            pgbProgress.Maximum = objXmlDocument.SelectNodes("/chummer/metatypes/metatype").Count;

            foreach (XmlNode objXmlMetatype in objXmlDocument.SelectNodes("/chummer/metatypes/metatype"))
            {
                pgbProgress.Value++;
                Application.DoEvents();

                objXmlDocument = XmlManager.Instance.Load(strFile);
                Character _objCharacter = new Character();
                ImprovementManager objImprovementManager = new ImprovementManager(_objCharacter);

                try
                {
                    int intForce = 0;
                    if (objXmlMetatype["forcecreature"] != null)
                        intForce = 1;

                    // Set Metatype information.
                    if (strFile != "critters.xml" || objXmlMetatype["name"].InnerText == "Ally Spirit")
                    {
                        _objCharacter.BOD.AssignLimits(ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["bodmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["bodaug"].InnerText, intForce, 0));
                        _objCharacter.AGI.AssignLimits(ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["agimax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["agiaug"].InnerText, intForce, 0));
                        _objCharacter.REA.AssignLimits(ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["reamax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["reaaug"].InnerText, intForce, 0));
                        _objCharacter.STR.AssignLimits(ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["strmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["straug"].InnerText, intForce, 0));
                        _objCharacter.CHA.AssignLimits(ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["chamax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["chaaug"].InnerText, intForce, 0));
                        _objCharacter.INT.AssignLimits(ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["intmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["intaug"].InnerText, intForce, 0));
                        _objCharacter.LOG.AssignLimits(ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["logmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["logaug"].InnerText, intForce, 0));
                        _objCharacter.WIL.AssignLimits(ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["wilmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["wilaug"].InnerText, intForce, 0));
                        _objCharacter.INI.AssignLimits(ExpressionToString(objXmlMetatype["inimin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["inimax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["iniaug"].InnerText, intForce, 0));
                        _objCharacter.MAG.AssignLimits(ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["magmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["magaug"].InnerText, intForce, 0));
                        _objCharacter.RES.AssignLimits(ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["resmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["resaug"].InnerText, intForce, 0));
                        _objCharacter.EDG.AssignLimits(ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["edgmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["edgaug"].InnerText, intForce, 0));
                        _objCharacter.ESS.AssignLimits(ExpressionToString(objXmlMetatype["essmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["essmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["essaug"].InnerText, intForce, 0));
                    }
                    else
                    {
                        int intMinModifier = -3;
                        if (objXmlMetatype["category"].InnerText == "Mutant Critters")
                            intMinModifier = 0;
                        _objCharacter.BOD.AssignLimits(ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, 3));
                        _objCharacter.AGI.AssignLimits(ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, 3));
                        _objCharacter.REA.AssignLimits(ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, 3));
                        _objCharacter.STR.AssignLimits(ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, 3));
                        _objCharacter.CHA.AssignLimits(ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, 3));
                        _objCharacter.INT.AssignLimits(ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, 3));
                        _objCharacter.LOG.AssignLimits(ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, 3));
                        _objCharacter.WIL.AssignLimits(ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, 3));
                        _objCharacter.INI.AssignLimits(ExpressionToString(objXmlMetatype["inimin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["inimax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["iniaug"].InnerText, intForce, 0));
                        _objCharacter.MAG.AssignLimits(ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, 3));
                        _objCharacter.RES.AssignLimits(ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, 3));
                        _objCharacter.EDG.AssignLimits(ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, 3));
                        _objCharacter.ESS.AssignLimits(ExpressionToString(objXmlMetatype["essmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["essmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["essaug"].InnerText, intForce, 0));
                    }

                    // If we're working with a Critter, set the Attributes to their default values.
                    if (strFile == "critters.xml")
                    {
                        _objCharacter.BOD.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, 0));
                        _objCharacter.AGI.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, 0));
                        _objCharacter.REA.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, 0));
                        _objCharacter.STR.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, 0));
                        _objCharacter.CHA.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, 0));
                        _objCharacter.INT.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, 0));
                        _objCharacter.LOG.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, 0));
                        _objCharacter.WIL.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, 0));
                        _objCharacter.MAG.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, 0));
                        _objCharacter.RES.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, 0));
                        _objCharacter.EDG.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, 0));
                        _objCharacter.ESS.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["essmax"].InnerText, intForce, 0));
                    }

                    // Sprites can never have Physical Attributes or WIL.
                    if (objXmlMetatype["name"].InnerText.EndsWith("Sprite"))
                    {
                        _objCharacter.BOD.AssignLimits("0", "0", "0");
                        _objCharacter.AGI.AssignLimits("0", "0", "0");
                        _objCharacter.REA.AssignLimits("0", "0", "0");
                        _objCharacter.STR.AssignLimits("0", "0", "0");
                        _objCharacter.WIL.AssignLimits("0", "0", "0");
                        _objCharacter.INI.MetatypeMinimum = Convert.ToInt32(ExpressionToString(objXmlMetatype["inimax"].InnerText, intForce, 0));
                        _objCharacter.INI.MetatypeMaximum = Convert.ToInt32(ExpressionToString(objXmlMetatype["inimax"].InnerText, intForce, 0));
                    }

                    _objCharacter.Metatype = objXmlMetatype["name"].InnerText;
                    _objCharacter.MetatypeCategory = objXmlMetatype["category"].InnerText;
                    _objCharacter.Metavariant = "";
                    _objCharacter.MetatypeBP = 400;

                    if (objXmlMetatype["movement"] != null)
                        _objCharacter.Movement = objXmlMetatype["movement"].InnerText;
                    // Load the Qualities file.
                    XmlDocument objXmlQualityDocument = XmlManager.Instance.Load("qualities.xml");

                    // Determine if the Metatype has any bonuses.
//.........这里部分代码省略.........
开发者ID:hollis21,项目名称:Chummer,代码行数:101,代码来源:frmTest.cs

示例11: MetatypeSelected

        /// <summary>
        /// A Metatype has been selected, so fill in all of the necessary Character information.
        /// </summary>
        void MetatypeSelected()
        {
            if (cboTalents.SelectedIndex == -1)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_Metatype_SelectTalent"), LanguageManager.Instance.GetString("MessageTitle_Metatype_SelectTalent"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if ((cboSkill1.SelectedIndex == -1 && cboSkill1.Visible) || (cboSkill2.SelectedIndex == -1 && cboSkill2.Visible))
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_Metatype_SelectSkill"), LanguageManager.Instance.GetString("MessageTitle_Metatype_SelectSkill"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (cboSkill1.Visible && cboSkill2.Visible && cboSkill1.SelectedValue.ToString() == cboSkill2.SelectedValue.ToString())
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_Metatype_Duplicate"), LanguageManager.Instance.GetString("MessageTitle_Metatype_Duplicate"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (lstMetatypes.Text != "")
            {
                ImprovementManager objImprovementManager = new ImprovementManager(_objCharacter);
                XmlDocument objXmlDocument = XmlManager.Instance.Load(_strXmlFile);

                XmlNode objXmlMetatype = objXmlDocument.SelectSingleNode("/chummer/metatypes/metatype[name = \"" + lstMetatypes.SelectedValue + "\"]");
                XmlNode objXmlMetavariant = objXmlDocument.SelectSingleNode("/chummer/metatypes/metatype[name = \"" + lstMetatypes.SelectedValue + "\"]/metavariants/metavariant[name = \"" + cboMetavariant.SelectedValue + "\"]");

                int intForce = 0;
                if (nudForce.Visible)
                    intForce = Convert.ToInt32(nudForce.Value);

                // Set Metatype information.
                if (cboMetavariant.SelectedValue.ToString() != "None")
                {
                    _objCharacter.BOD.AssignLimits(ExpressionToString(objXmlMetavariant["bodmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["bodmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["bodaug"].InnerText, intForce, 0));
                    _objCharacter.AGI.AssignLimits(ExpressionToString(objXmlMetavariant["agimin"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["agimax"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["agiaug"].InnerText, intForce, 0));
                    _objCharacter.REA.AssignLimits(ExpressionToString(objXmlMetavariant["reamin"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["reamax"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["reaaug"].InnerText, intForce, 0));
                    _objCharacter.STR.AssignLimits(ExpressionToString(objXmlMetavariant["strmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["strmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["straug"].InnerText, intForce, 0));
                    _objCharacter.CHA.AssignLimits(ExpressionToString(objXmlMetavariant["chamin"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["chamax"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["chaaug"].InnerText, intForce, 0));
                    _objCharacter.INT.AssignLimits(ExpressionToString(objXmlMetavariant["intmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["intmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["intaug"].InnerText, intForce, 0));
                    _objCharacter.LOG.AssignLimits(ExpressionToString(objXmlMetavariant["logmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["logmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["logaug"].InnerText, intForce, 0));
                    _objCharacter.WIL.AssignLimits(ExpressionToString(objXmlMetavariant["wilmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["wilmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["wilaug"].InnerText, intForce, 0));
                    _objCharacter.INI.AssignLimits(ExpressionToString(objXmlMetavariant["inimin"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["inimax"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["iniaug"].InnerText, intForce, 0));
                    _objCharacter.MAG.AssignLimits(ExpressionToString(objXmlMetavariant["magmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["magmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["magaug"].InnerText, intForce, 0));
                    _objCharacter.RES.AssignLimits(ExpressionToString(objXmlMetavariant["resmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["resmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["resaug"].InnerText, intForce, 0));
                    _objCharacter.EDG.AssignLimits(ExpressionToString(objXmlMetavariant["edgmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["edgmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["edgaug"].InnerText, intForce, 0));
                    _objCharacter.ESS.AssignLimits(ExpressionToString(objXmlMetavariant["essmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["essmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetavariant["essaug"].InnerText, intForce, 0));
                    _objCharacter.MetatypeBP = Convert.ToInt32(lblMetavariantBP.Text);
                }
                else if (_strXmlFile != "critters.xml" || lstMetatypes.SelectedValue.ToString() == "Ally Spirit")
                {
                    _objCharacter.BOD.AssignLimits(ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["bodmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["bodaug"].InnerText, intForce, 0));
                    _objCharacter.AGI.AssignLimits(ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["agimax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["agiaug"].InnerText, intForce, 0));
                    _objCharacter.REA.AssignLimits(ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["reamax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["reaaug"].InnerText, intForce, 0));
                    _objCharacter.STR.AssignLimits(ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["strmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["straug"].InnerText, intForce, 0));
                    _objCharacter.CHA.AssignLimits(ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["chamax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["chaaug"].InnerText, intForce, 0));
                    _objCharacter.INT.AssignLimits(ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["intmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["intaug"].InnerText, intForce, 0));
                    _objCharacter.LOG.AssignLimits(ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["logmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["logaug"].InnerText, intForce, 0));
                    _objCharacter.WIL.AssignLimits(ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["wilmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["wilaug"].InnerText, intForce, 0));
                    _objCharacter.INI.AssignLimits(ExpressionToString(objXmlMetatype["inimin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["inimax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["iniaug"].InnerText, intForce, 0));
                    _objCharacter.MAG.AssignLimits(ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["magmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["magaug"].InnerText, intForce, 0));
                    _objCharacter.RES.AssignLimits(ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["resmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["resaug"].InnerText, intForce, 0));
                    _objCharacter.EDG.AssignLimits(ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["edgmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["edgaug"].InnerText, intForce, 0));
                    _objCharacter.ESS.AssignLimits(ExpressionToString(objXmlMetatype["essmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["essmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["essaug"].InnerText, intForce, 0));
                }
                else
                {
                    int intMinModifier = -3;
                    if (cboCategory.SelectedValue.ToString() == "Mutant Critters")
                        intMinModifier = 0;
                    _objCharacter.BOD.AssignLimits(ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, 3));
                    _objCharacter.AGI.AssignLimits(ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, 3));
                    _objCharacter.REA.AssignLimits(ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, 3));
                    _objCharacter.STR.AssignLimits(ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, 3));
                    _objCharacter.CHA.AssignLimits(ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, 3));
                    _objCharacter.INT.AssignLimits(ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, 3));
                    _objCharacter.LOG.AssignLimits(ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, 3));
                    _objCharacter.WIL.AssignLimits(ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, 3));
                    _objCharacter.INI.AssignLimits(ExpressionToString(objXmlMetatype["inimin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["inimax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["iniaug"].InnerText, intForce, 0));
                    _objCharacter.MAG.AssignLimits(ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, 3));
                    _objCharacter.RES.AssignLimits(ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, 3));
                    _objCharacter.EDG.AssignLimits(ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, 3));
                    _objCharacter.ESS.AssignLimits(ExpressionToString(objXmlMetatype["essmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["essmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["essaug"].InnerText, intForce, 0));
                }

                // If we're working with a Critter, set the Attributes to their default values.
                if (_strXmlFile == "critters.xml")
                {
                    _objCharacter.BOD.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, 0));
                    _objCharacter.AGI.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, 0));
                    _objCharacter.REA.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, 0));
                    _objCharacter.STR.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, 0));
                    _objCharacter.CHA.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, 0));
                    _objCharacter.INT.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, 0));
                    _objCharacter.LOG.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, 0));
                    _objCharacter.WIL.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, 0));
//.........这里部分代码省略.........
开发者ID:ltdouthit,项目名称:chummer5a,代码行数:101,代码来源:frmPriorityMetatype.cs

示例12: CalculateValues

        /// <summary>
        /// Calculate the LP value for the selected items.
        /// </summary>
        private int CalculateValues(bool blnIncludePercentage = true)
        {
            if (_blnSkipRefresh)
                return 0;

            int intNuyen = 0;
            decimal decBaseCost = 0;
            decimal decCost = 0;
            // Get the base cost of the lifestyle
            XmlNode objXmlAspect = _objXmlDocument.SelectSingleNode("/chummer/lifestyles/lifestyle[name = \"" + cboLifestyle.SelectedValue + "\"]");
            decBaseCost += Convert.ToDecimal(objXmlAspect["cost"].InnerText);
            _objLifestyle.Dice = Convert.ToInt32(objXmlAspect["dice"].InnerText);
            _objLifestyle.Multiplier = Convert.ToInt32(objXmlAspect["multiplier"].InnerText);

            // Add the flat costs from qualities
            foreach (TreeNode objNode in treQualities.Nodes)
            {
                if (objNode.Checked)
                {
                    XmlNode objXmlQuality = _objXmlDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + GetQualityName(objNode.Tag.ToString()) + "\"]");
                    if (objXmlQuality["cost"] != null && objXmlQuality["cost"].InnerText != "")
                        decCost += Convert.ToDecimal(objXmlQuality["cost"].InnerText);
                }
            }

            decimal decMod = 0;
            if (blnIncludePercentage)
            {
                // Add the modifiers from qualities
                foreach (TreeNode objNode in treQualities.Nodes)
                {
                    if (objNode.Checked)
                    {
                        objXmlAspect = _objXmlDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + GetQualityName(objNode.Tag.ToString()) + "\"]");
                        if (objXmlAspect["multiplier"] != null)
                            decMod += (Convert.ToDecimal(objXmlAspect["multiplier"].InnerText) / 100);
                    }
                }

                // Check for modifiers in the improvements
                ImprovementManager objImprovementManager = new ImprovementManager(_objCharacter);
                decimal decModifier = Convert.ToDecimal(objImprovementManager.ValueOf(Improvement.ImprovementType.LifestyleCost), GlobalOptions.Instance.CultureInfo);
                decMod += Convert.ToDecimal(decModifier / 100, GlobalOptions.Instance.CultureInfo);
            }

            intNuyen = Convert.ToInt32(decBaseCost + (decBaseCost * decMod));
            intNuyen += Convert.ToInt32(decCost);
            lblCost.Text = String.Format("{0:###,###,##0¥}", intNuyen);

            if (nudPercentage.Value != 100)
            {
                decimal decDiscount = 0;
                decDiscount = decBaseCost + (decBaseCost * decMod);
                decDiscount += decCost;
                decDiscount = decDiscount * (nudPercentage.Value /100);
                lblCost.Text += String.Format(" (" + "{0:###,###,##0¥}" +")", Convert.ToInt32(decDiscount));
            }
            return intNuyen;
        }
开发者ID:RunnerHub,项目名称:chummer5a,代码行数:62,代码来源:frmSelectLifestyle.cs

示例13: cmdOK_Click

        private void cmdOK_Click(object sender, EventArgs e)
        {
            // Make sure that each Priority has only been selected once.
            bool blnValid = true;

            if (cboPriorityMetatype.SelectedValue == cboPriorityAttributes.SelectedValue)
                blnValid = false;
            if (cboPriorityMetatype.SelectedValue == cboPrioritySpecial.SelectedValue)
                blnValid = false;
            if (cboPriorityMetatype.SelectedValue == cboPrioritySkills.SelectedValue)
                blnValid = false;
            if (cboPriorityMetatype.SelectedValue == cboPriorityNuyen.SelectedValue)
                blnValid = false;
            if (cboPriorityAttributes.SelectedValue == cboPrioritySpecial.SelectedValue)
                blnValid = false;
            if (cboPriorityAttributes.SelectedValue == cboPrioritySkills.SelectedValue)
                blnValid = false;
            if (cboPriorityAttributes.SelectedValue == cboPriorityNuyen.SelectedValue)
                blnValid = false;
            if (cboPrioritySpecial.SelectedValue == cboPrioritySkills.SelectedValue)
                blnValid = false;
            if (cboPrioritySpecial.SelectedValue == cboPriorityNuyen.SelectedValue)
                blnValid = false;
            if (cboPrioritySkills.SelectedValue == cboPriorityNuyen.SelectedValue)
                blnValid = false;

            if (!blnValid)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_Priorities_UniquePriorities"), LanguageManager.Instance.GetString("MessageTitle_Priorities_UniquePriorities"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else
            {
                // Determine the number of Special Attribute points that come from the selected Metatype.
                XmlNode objXmlMetatypesNode = _objXmlDocument.SelectSingleNode("/chummer/priorities/metatypes/metatype[priority = \"" + cboPriorityMetatype.SelectedValue.ToString() + "\"]");
                XmlNode objXmlMetatypeNode = objXmlMetatypesNode.SelectSingleNode("metatypes/metatype[id = \"" + cboMetatype.SelectedValue.ToString() + "\"]");
                int intSpecialAttributePoints = Convert.ToInt32(objXmlMetatypeNode["points"].InnerText);

                // Determine the number of Attribute Points selected.
                XmlNode objXmlAttributeNode = _objXmlDocument.SelectSingleNode("/chummer/priorities/attributes/attribute[priority = \"" + cboPriorityAttributes.SelectedValue.ToString() + "\"]");
                int intAttributePoints = Convert.ToInt32(objXmlAttributeNode["points"].InnerText);

                // Determine if the character gets anything from their Special Priority.
                if (cboSpecial.SelectedValue != null)
                {
                    if (cboSpecial.SelectedValue.ToString() != string.Empty)
                    {
                        XmlNode objXmlSpecialNode = _objXmlDocument.SelectSingleNode("/chummer/priorities/specials/special[priority = \"" + cboPrioritySpecial.SelectedValue.ToString() + "\"]/" + cboSpecial.SelectedValue.ToString());
                        if (objXmlSpecialNode["bonus"] != null)
                        {
                            ImprovementManager objImprovementManager = new ImprovementManager(_objCharacter);
                            objImprovementManager.CreateImprovements(Improvement.ImprovementSource.Priority, "Priority", objXmlSpecialNode["bonus"]);
                        }
                    }
                }

                // Determine the number of Skill Points selected.

                // Determine the amount of Nuyen selected.
                XmlNode objXmlNuyenNode = _objXmlDocument.SelectSingleNode("/chummer/priorities/resources/resource[priority = \"" + cboPriorityNuyen.SelectedValue.ToString() + "\"]");
                int intNuyen = Convert.ToInt32(objXmlNuyenNode["nuyen"].InnerText);

                // Load the Metatype and set the character build information.
                _objCharacter.LoadMetatype(Guid.Parse(cboMetatype.SelectedValue.ToString()));
                _objCharacter.SpecialAttributePoints = intSpecialAttributePoints;
                _objCharacter.AttributePoints = intAttributePoints;
                _objCharacter.Nuyen = intNuyen;

                this.DialogResult = DialogResult.OK;
            }
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:71,代码来源:frmPriority.cs

示例14: SkillControl_Load


//.........这里部分代码省略.........
                            {
                                intKarmaCost = ((_objSkill.Rating + 1) * _objSkill.CharacterObject.Options.KarmaImproveKnowledgeSkill) - 1;
                            }
                            //Academic Knowledge Skills > Rank 2 gain a 1 karma discount with the College Education quality.
                            else if (_objSkill.CharacterObject.CollegeEducation && _objSkill.SkillCategory == "Academic")
                            {
                                intKarmaCost = ((_objSkill.Rating + 1) * _objSkill.CharacterObject.Options.KarmaImproveKnowledgeSkill) - 1;
                            }
                            //Professional Knowledge Skills > Rank 2 gain a 1 karma discount with the Tech School quality.
                            else if (_objSkill.CharacterObject.TechSchool && _objSkill.SkillCategory == "Professional")
                            {
                                intKarmaCost = ((_objSkill.Rating + 1) * _objSkill.CharacterObject.Options.KarmaImproveKnowledgeSkill) - 1;
                            }
                            //Linguist Skills > Rank 2 gain a 1 karma discount with the Linguist quality.
                            else if (_objSkill.CharacterObject.Linguist && _objSkill.SkillCategory == "Language")
                            {
                                intKarmaCost = ((_objSkill.Rating + 1) * _objSkill.CharacterObject.Options.KarmaImproveKnowledgeSkill) - 1;
                            }
                        }
                        else
                            intKarmaCost = (_objSkill.Rating + 1) * _objSkill.CharacterObject.Options.KarmaImproveKnowledgeSkill;
                    }
                    // Double the Karma cost if the character is Uneducated and is a Technical Active, Academic, or Professional Skill.
                    if (_objSkill.CharacterObject.Uneducated && (SkillCategory == "Technical Active" || SkillCategory == "Academic" || SkillCategory == "Professional"))
                        intKarmaCost *= 2;
                    //Double the Karma cost if the character is Uncouth and is a Social Active Skill.
                    if (_objSkill.CharacterObject.Uncouth && (SkillCategory == "Social Active"))
                    {
                        intKarmaCost *= 2;
                    }
                    strTooltip = LanguageManager.Instance.GetString("Tip_ImproveItem").Replace("{0}", intNewRating.ToString()).Replace("{1}", intKarmaCost.ToString());
                    tipTooltip.SetToolTip(cmdImproveSkill, strTooltip);
                }

                ImprovementManager objImprovementManager = new ImprovementManager(_objSkill.CharacterObject);
                if (objImprovementManager.ValueOf(Improvement.ImprovementType.AdeptLinguistics) > 0 && SkillCategory == "Language" && SkillRating == 0)
                    strTooltip = LanguageManager.Instance.GetString("Tip_ImproveItem").Replace("{0}", "1").Replace("{1}", "0");
                tipTooltip.SetToolTip(cmdImproveSkill, strTooltip);

                nudSkill.Visible = false;
                nudKarma.Visible = false;
                lblSkillRating.Visible = true;
                cmdImproveSkill.Visible = true;

                if (_objSkill.FreeLevels > 0)
                    nudSkill.Minimum = _objSkill.FreeLevels;
                else
                    nudSkill.Minimum = 0;

                // Show the Dice Rolling button if the option is enabled.
                if (_objSkill.CharacterObject.Options.AllowSkillDiceRolling)
                {
                    cmdRoll.Visible = true;
                    this.Width += 30;
                    cboSpec.Left += 30;
                    lblSpec.Left += 30;
                    cmdChangeSpec.Left += 30;
                    cboKnowledgeSkillCategory.Left += 30;
                    cmdDelete.Left += 30;
                    tipTooltip.SetToolTip(cmdRoll, LanguageManager.Instance.GetString("Tip_DiceRoller"));
                }

                if (!_objSkill.ExoticSkill)
                {
                    cboSpec.Visible = false;
                    lblSpec.Visible = true;
                    lblSpec.Text = _objSkill.Specialization;
                    cmdChangeSpec.Visible = true;
                    cboSpec.Enabled = false;
                }
                else
                {
                    cboSpec.Text = _objSkill.Specialization;
                }

                string strTip = LanguageManager.Instance.GetString("Tip_Skill_AddSpecialization").Replace("{0}", _objSkill.CharacterObject.Options.KarmaSpecialization.ToString());
                tipTooltip.SetToolTip(cmdChangeSpec, strTip);
            }
            if (KnowledgeSkill)
            {
                this.Width = cmdExpand.Left + cmdExpand.Width;
            }
            else
                this.Width = cmdChangeSpec.Left + cmdChangeSpec.Width;

            if (!_objSkill.CharacterObject.Created && _objSkill.SkillGroupObject != null && _objSkill.SkillGroupObject.Broken)
            {
                if (!_objSkill.CharacterObject.Options.UsePointsOnBrokenGroups)
                    nudSkill.Enabled = false;
                cmdBreakGroup.Visible = false;
            }

            this.Height = lblSpec.Height + 10;

            chkKarma.Checked = _objSkill.BuyWithKarma;
            lblAttribute.Text = _objSkill.DisplayAttribute;

            RefreshControl();
            _blnSkipRefresh = false;
        }
开发者ID:ltdouthit,项目名称:chummer5a,代码行数:101,代码来源:SkillControl.cs

示例15: RefreshControl

        /// <summary>
        /// Update the Modified Rating shown.
        /// </summary>
        public void RefreshControl()
        {
            bool blnSkillsoft = false;
            ImprovementManager objImprovementManager = new ImprovementManager(_objSkill.CharacterObject);

            int intRating = _objSkill.TotalRating;
            lblModifiedRating.Text = intRating.ToString();

            int intSkillRating = _objSkill.Rating;
            foreach (Gear objGear in _objSkill.CharacterObject.Gear)
            {
                // Look for any Skillsoft that would conflict with the Skill's Rating.
                if (objGear.Equipped && objGear.Category == "Skillsofts" && (objGear.Extra == _objSkill.Name || objGear.Extra == _objSkill.Name + ", " + LanguageManager.Instance.GetString("Label_SelectGear_Hacked")))
                {
                    if (objGear.Rating > _objSkill.Rating)
                    {
                        // Use the Skillsoft's Rating or Skillwire Rating, whichever is lower.
                        // If this is a Knowsoft or Linguasoft, it is not limited to the Skillwire Rating.
                        if (objGear.Name == "Activesoft")
                            intSkillRating = Math.Min(objGear.Rating, objImprovementManager.ValueOf(Improvement.ImprovementType.Skillwire));
                        else
                            intSkillRating = objGear.Rating;
                        blnSkillsoft = true;
                        break;
                    }
                }

                foreach (Gear objChild in objGear.Children)
                {
                    if (objChild.Equipped && objChild.Category == "Skillsofts" && (objChild.Extra == _objSkill.Name || objChild.Extra == _objSkill.Name + ", " + LanguageManager.Instance.GetString("Label_SelectGear_Hacked")))
                    {
                        if (objChild.Rating > _objSkill.Rating)
                        {
                            // Use the Skillsoft's Rating or Skillwire Rating, whichever is lower.
                            // If this is a Knowsoft or Linguasoft, it is not limited to the Skillwire Rating.
                            if (objChild.Name == "Activesoft")
                                intSkillRating = Math.Min(objChild.Rating, objImprovementManager.ValueOf(Improvement.ImprovementType.Skillwire));
                            else
                                intSkillRating = objChild.Rating;
                            blnSkillsoft = true;
                            break;
                        }
                    }
                }
            }
            if (_objSkill.FreeLevels > 0)
            {
                nudSkill.Minimum = _objSkill.FreeLevels;
            }
            else
            {
                nudSkill.Minimum = 0;
            }

            if (cboSpec.Text != "" && !_objSkill.ExoticSkill)
            {
                bool blnFound = false;
                if (this.SkillName == "Artisan")
                {
                    // Look for the Inspired quality to see if we get a free specialization
                    foreach (Quality objQuality in _objSkill.CharacterObject.Qualities)
                    {
                        if (objQuality.Name == "Inspired")
                            blnFound = true;
                    }
                }
                if (!blnFound)
                {
                    lblModifiedRating.Text += " (" + (intRating + 2).ToString() + ")";
                }
                else
                {
                    lblModifiedRating.Text += " (" + (intRating + 3).ToString() + ")";
                }
            }
            lblAttribute.Text = _objSkill.DisplayAttribute;

            // Build the Tooltip.
            string strTooltip = "";
            if (blnSkillsoft)
                strTooltip += LanguageManager.Instance.GetString("Tip_Skill_SkillsoftRating") + " (" + intSkillRating.ToString() + ")";
            else
                strTooltip += LanguageManager.Instance.GetString("Tip_Skill_SkillRating") + " (" + _objSkill.Rating.ToString() + ")";

            if (_objSkill.Default && intSkillRating == 0)
                strTooltip += " - " + LanguageManager.Instance.GetString("Tip_Skill_Defaulting") + " (1)";
            if ((!_objSkill.Default && intSkillRating > 0) || _objSkill.Default)
            {
                strTooltip += " + " + LanguageManager.Instance.GetString("String_Attribute" + _objSkill.Attribute + "Short") + " (" + _objSkill.AttributeModifiers.ToString() + ")";
            }

            // Modifiers only apply when not Defaulting.
            if (intSkillRating > 0 || _objSkill.CharacterObject.Options.SkillDefaultingIncludesModifiers)
            {
                if (_objSkill.RatingModifiers != 0)
                {
                    if (_objSkill.CharacterObject.Options.EnforceMaximumSkillRatingModifier)
//.........这里部分代码省略.........
开发者ID:ltdouthit,项目名称:chummer5a,代码行数:101,代码来源:SkillControl.cs


注:本文中的Chummer.ImprovementManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。