private void cmdAddQuality_Click(object sender, EventArgs e)
        {
            bool blnAddAgain;

            do
            {
                frmSelectLifestyleQuality frmSelectLifestyleQuality = new frmSelectLifestyleQuality(_objCharacter, cboBaseLifestyle.SelectedValue.ToString(), _objLifestyle.LifestyleQualities);
                frmSelectLifestyleQuality.ShowDialog(this);

                // Don't do anything else if the form was canceled.
                if (frmSelectLifestyleQuality.DialogResult == DialogResult.Cancel)
                {
                    frmSelectLifestyleQuality.Close();
                    return;
                }
                blnAddAgain = frmSelectLifestyleQuality.AddAgain;

                XmlNode objXmlQuality = _xmlDocument.SelectSingleNode("/chummer/qualities/quality[id = \"" + frmSelectLifestyleQuality.SelectedQuality + "\"]");

                LifestyleQuality objQuality = new LifestyleQuality(_objCharacter);

                objQuality.Create(objXmlQuality, _objLifestyle, _objCharacter, QualitySource.Selected);
                objQuality.Free = frmSelectLifestyleQuality.FreeCost;
                frmSelectLifestyleQuality.Close();
                //objNode.ContextMenuStrip = cmsQuality;
                if (objQuality.InternalId.IsEmptyGuid())
                {
                    continue;
                }

                _objLifestyle.LifestyleQualities.Add(objQuality);
                CalculateValues();
            }while (blnAddAgain);
        }
        private void cmdAddQuality_Click(object sender, EventArgs e)
        {
            frmSelectLifestyleQuality frmSelectLifestyleQuality = new frmSelectLifestyleQuality(_objCharacter, cboBaseLifestyle.SelectedValue.ToString());

            frmSelectLifestyleQuality.ShowDialog(this);

            // Don't do anything else if the form was canceled.
            if (frmSelectLifestyleQuality.DialogResult == DialogResult.Cancel)
            {
                return;
            }

            XmlDocument objXmlDocument = XmlManager.Instance.Load("lifestyles.xml");
            XmlNode     objXmlQuality  = objXmlDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + frmSelectLifestyleQuality.SelectedQuality + "\"]");

            TreeNode         objNode    = new TreeNode();
            LifestyleQuality objQuality = new LifestyleQuality(_objCharacter);

            objQuality.Create(objXmlQuality, _objLifestyle, _objCharacter, QualitySource.Selected, objNode);
            //objNode.ContextMenuStrip = cmsQuality;
            if (objQuality.InternalId == Guid.Empty.ToString())
            {
                return;
            }

            objQuality.Free = frmSelectLifestyleQuality.FreeCost;

            // Make sure that adding the Quality would not cause the character to exceed their BP limits.
            //bool blnAddItem = true;

            //if (blnAddItem)
            {
                // Add the Quality to the appropriate parent node.
                if (objQuality.Type == QualityType.Positive)
                {
                    treLifestyleQualities.Nodes[0].Nodes.Add(objNode);
                    treLifestyleQualities.Nodes[0].Expand();
                }
                else if (objQuality.Type == QualityType.Negative)
                {
                    treLifestyleQualities.Nodes[1].Nodes.Add(objNode);
                    treLifestyleQualities.Nodes[1].Expand();
                }
                else
                {
                    treLifestyleQualities.Nodes[2].Nodes.Add(objNode);
                    treLifestyleQualities.Nodes[2].Expand();
                }
                _objLifestyle.LifestyleQualities.Add(objQuality);

                CalculateValues();

                if (frmSelectLifestyleQuality.AddAgain)
                {
                    cmdAddQuality_Click(sender, e);
                }
            }
        }
Exemple #3
0
        private void cmdAddQuality_Click(object sender, EventArgs e)
        {
            bool blnAddAgain;

            do
            {
                frmSelectLifestyleQuality frmSelectLifestyleQuality = new frmSelectLifestyleQuality(_objCharacter, cboBaseLifestyle.SelectedValue.ToString(), _objLifestyle.LifestyleQualities);
                frmSelectLifestyleQuality.ShowDialog(this);

                // Don't do anything else if the form was canceled.
                if (frmSelectLifestyleQuality.DialogResult == DialogResult.Cancel)
                {
                    frmSelectLifestyleQuality.Close();
                    return;
                }
                blnAddAgain = frmSelectLifestyleQuality.AddAgain;

                XmlNode objXmlQuality = _xmlDocument.SelectSingleNode("/chummer/qualities/quality[id = \"" + frmSelectLifestyleQuality.SelectedQuality + "\"]");

                LifestyleQuality objQuality = new LifestyleQuality(_objCharacter);

                objQuality.Create(objXmlQuality, _objLifestyle, _objCharacter, QualitySource.Selected);
                objQuality.Free = frmSelectLifestyleQuality.FreeCost;
                frmSelectLifestyleQuality.Close();
                //objNode.ContextMenuStrip = cmsQuality;
                if (objQuality.InternalId.IsEmptyGuid())
                {
                    continue;
                }

                _objLifestyle.LifestyleQualities.Add(objQuality);

                TreeNode objLoopNode = objQuality.CreateTreeNode();
                if (objLoopNode != null)
                {
                    TreeNode nodParent;
                    // Add the Quality to the appropriate parent node.
                    if (objQuality.Type == QualityType.Positive)
                    {
                        nodParent = treLifestyleQualities.Nodes[0];
                    }
                    else if (objQuality.Type == QualityType.Negative)
                    {
                        nodParent = treLifestyleQualities.Nodes[1];
                    }
                    else
                    {
                        nodParent = treLifestyleQualities.Nodes[2];
                    }

                    nodParent.Nodes.Add(objQuality.CreateTreeNode());
                    nodParent.Expand();
                }

                CalculateValues();
            }while (blnAddAgain);
        }
        private void cmdAddQuality_Click(object sender, EventArgs e)
        {
            frmSelectLifestyleQuality frmSelectLifestyleQuality = new frmSelectLifestyleQuality(_objCharacter);
            frmSelectLifestyleQuality.ShowDialog(this);

                        // Don't do anything else if the form was canceled.
            if (frmSelectLifestyleQuality.DialogResult == DialogResult.Cancel)
                return;

            XmlDocument objXmlDocument = XmlManager.Instance.Load("lifestyles.xml");
            XmlNode objXmlQuality = objXmlDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + frmSelectLifestyleQuality.SelectedQuality + "\"]");

            TreeNode objNode = new TreeNode();
            List<Weapon> objWeapons = new List<Weapon>();
            List<TreeNode> objWeaponNodes = new List<TreeNode>();
            LifestyleQuality objQuality = new LifestyleQuality(_objCharacter);

            try { objQuality.Create(objXmlQuality, _objCharacter, QualitySource.Selected, objNode); }
            catch { }
            //objNode.ContextMenuStrip = cmsQuality;
            if (objQuality.InternalId == Guid.Empty.ToString())
                return;

            if (frmSelectLifestyleQuality.FreeCost)
                objQuality.LP = 0;

            // If the item being checked would cause the limit of 25 BP spent on Positive Qualities to be exceed, do not let it be checked and display a message.
            string strAmount = "";
            strAmount = "25 " + LanguageManager.Instance.GetString("String_Karma");

            // Make sure that adding the Quality would not cause the character to exceed their BP limits.
            bool blnAddItem = true;

            if (blnAddItem)
            {
                // Add the Quality to the appropriate parent node.
                if (objQuality.Type == QualityType.Positive)
                {
                    treLifestyleQualities.Nodes[0].Nodes.Add(objNode);
                    treLifestyleQualities.Nodes[0].Expand();
                }
                else if (objQuality.Type == QualityType.Negative)
                {
                    treLifestyleQualities.Nodes[1].Nodes.Add(objNode);
                    treLifestyleQualities.Nodes[1].Expand();
                }
                else
                {
                    treLifestyleQualities.Nodes[2].Nodes.Add(objNode);
                    treLifestyleQualities.Nodes[2].Expand();
                }
                //_objLifestyle.LifestyleQualities.Add(objQuality);

                CalculateValues();

                if (frmSelectLifestyleQuality.AddAgain)
                    cmdAddQuality_Click(sender, e);
            }
        }
Exemple #5
0
        private void cmdAddQuality_Click(object sender, EventArgs e)
        {
            frmSelectLifestyleQuality frmSelectLifestyleQuality = new frmSelectLifestyleQuality(_objCharacter);

            frmSelectLifestyleQuality.ShowDialog(this);

            // Don't do anything else if the form was canceled.
            if (frmSelectLifestyleQuality.DialogResult == DialogResult.Cancel)
            {
                return;
            }

            XmlDocument objXmlDocument = XmlManager.Instance.Load("lifestyles.xml");
            XmlNode     objXmlQuality  = objXmlDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + frmSelectLifestyleQuality.SelectedQuality + "\"]");

            TreeNode         objNode        = new TreeNode();
            List <Weapon>    objWeapons     = new List <Weapon>();
            List <TreeNode>  objWeaponNodes = new List <TreeNode>();
            LifestyleQuality objQuality     = new LifestyleQuality(_objCharacter);

            try { objQuality.Create(objXmlQuality, _objCharacter, QualitySource.Selected, objNode); }
            catch { }
            //objNode.ContextMenuStrip = cmsQuality;
            if (objQuality.InternalId == Guid.Empty.ToString())
            {
                return;
            }

            if (frmSelectLifestyleQuality.FreeCost)
            {
                objQuality.LP = 0;
            }

            // If the item being checked would cause the limit of 25 BP spent on Positive Qualities to be exceed, do not let it be checked and display a message.
            string strAmount = "";

            strAmount = "25 " + LanguageManager.Instance.GetString("String_Karma");

            // Make sure that adding the Quality would not cause the character to exceed their BP limits.
            bool blnAddItem = true;

            if (blnAddItem)
            {
                // Add the Quality to the appropriate parent node.
                if (objQuality.Type == QualityType.Positive)
                {
                    treLifestyleQualities.Nodes[0].Nodes.Add(objNode);
                    treLifestyleQualities.Nodes[0].Expand();
                }
                else if (objQuality.Type == QualityType.Negative)
                {
                    treLifestyleQualities.Nodes[1].Nodes.Add(objNode);
                    treLifestyleQualities.Nodes[1].Expand();
                }
                else
                {
                    treLifestyleQualities.Nodes[2].Nodes.Add(objNode);
                    treLifestyleQualities.Nodes[2].Expand();
                }
                //_objLifestyle.LifestyleQualities.Add(objQuality);

                CalculateValues();

                if (frmSelectLifestyleQuality.AddAgain)
                {
                    cmdAddQuality_Click(sender, e);
                }
            }
        }