Exemplo n.º 1
0
        private void cmdAddExoticSkill_Click(object sender, EventArgs e)
        {
            frmSelectExoticSkill frmPickExoticSkill = new frmSelectExoticSkill();
            frmPickExoticSkill.ShowDialog(this);

            if (frmPickExoticSkill.DialogResult == DialogResult.Cancel)
                return;

            XmlDocument objXmlDocument = XmlManager.Instance.Load("skills.xml");

            XmlNode nodSkill = objXmlDocument.SelectSingleNode("/chummer/skills/skill[name = \"" + frmPickExoticSkill.SelectedExoticSkill + "\"]");

            int i = panActiveSkills.Controls.Count;
            Skill objSkill = new Skill(_objCharacter);
            objSkill.Attribute = nodSkill["attribute"].InnerText;
			objSkill.Specialization = frmPickExoticSkill.SelectedExoticSkillSpecialisation;
            if (_objCharacter.MaxSkillRating > 0)
                objSkill.RatingMaximum = _objCharacter.MaxSkillRating;

            SkillControl objSkillControl = new SkillControl(_objCharacter);
            objSkillControl.SkillObject = objSkill;
            objSkillControl.Width = 510;

            // Attach an EventHandler for the RatingChanged and SpecializationChanged Events.
            objSkillControl.RatingChanged += objActiveSkill_RatingChanged;
            objSkillControl.SpecializationChanged += objSkill_SpecializationChanged;
            objSkillControl.SkillName = frmPickExoticSkill.SelectedExoticSkill;
            objSkillControl.BuyWithKarmaChanged += objActiveSkill_BuyWithKarmaChanged;
			objSkillControl.SkillSpec = frmPickExoticSkill.SelectedExoticSkillSpecialisation;
            objSkillControl.SkillCategory = nodSkill["category"].InnerText;
            if (nodSkill["default"].InnerText == "Yes")
                objSkill.Default = true;
            else
                objSkill.Default = false;

            objSkill.ExoticSkill = true;
            _objCharacter.Skills.Add(objSkill);

			// Populate the Skill's Specializations (if any).
			foreach (XmlNode objXmlSpecialization in nodSkill.SelectNodes("specs/spec"))
			{
				if (objXmlSpecialization.Attributes["translate"] != null)
					objSkillControl.AddSpec(objXmlSpecialization.Attributes["translate"].InnerText);
				else
					objSkillControl.AddSpec(objXmlSpecialization.InnerText);
			}

			// Look through the Weapons file and grab the names of items that are part of the appropriate Exotic Category or use the matching Exoctic Skill.
			XmlDocument objXmlWeaponDocument = XmlManager.Instance.Load("weapons.xml");
			XmlNodeList objXmlWeaponList = objXmlWeaponDocument.SelectNodes("/chummer/weapons/weapon[category = \"" + frmPickExoticSkill.SelectedExoticSkill + "s\" or useskill = \"" + frmPickExoticSkill.SelectedExoticSkill + "\"]");
			foreach (XmlNode objXmlWeapon in objXmlWeaponList)
			{
				if (objXmlWeapon["translate"] != null)
					objSkillControl.AddSpec(objXmlWeapon["translate"].InnerText);
				else
					objSkillControl.AddSpec(objXmlWeapon["name"].InnerText);
			}

			if (_objCharacter.IgnoreRules)
			{
				objSkillControl.SkillRatingMaximum = 12;
			}
			else
			{
				objSkillControl.SkillRatingMaximum = 6;
			}
            // Set the SkillControl's Location since scrolling the Panel causes it to actually change the child Controls' Locations.
            objSkillControl.Location = new Point(0, objSkillControl.Height * i + panActiveSkills.AutoScrollPosition.Y);
            panActiveSkills.Controls.Add(objSkillControl);

            _blnIsDirty = true;
            UpdateWindowTitle();
        }
Exemplo n.º 2
0
		private void cmdAddExoticSkill_Click(object sender, EventArgs e)
		{
			frmSelectExoticSkill frmPickExoticSkill = new frmSelectExoticSkill();
			frmPickExoticSkill.ShowDialog(this);

			if (frmPickExoticSkill.DialogResult == DialogResult.Cancel)
				return;

			XmlDocument objXmlDocument = XmlManager.Instance.Load("skills.xml");

			XmlNode nodSkill = objXmlDocument.SelectSingleNode("/chummer/skills/skill[name = \"" + frmPickExoticSkill.SelectedExoticSkill + "\"]");

			int i = panActiveSkills.Controls.Count;
			Skill objSkill = new Skill(_objCharacter);
			SkillSpecialization objSkillSpec = new SkillSpecialization(frmPickExoticSkill.SelectedExoticSkillSpecialisation);
			objSkill.Attribute = nodSkill["attribute"].InnerText;
			objSkill.Specializations.Add(objSkillSpec);
			if (_objCharacter.MaxSkillRating > 0)
				objSkill.RatingMaximum = _objCharacter.MaxSkillRating;

			SkillControl objSkillControl = new SkillControl();
			objSkillControl.SkillObject = objSkill;
			objSkillControl.Width = 510;

			// Attach an EventHandler for the RatingChanged and SpecializationChanged Events.
			objSkillControl.RatingChanged += objActiveSkill_RatingChanged;
			objSkillControl.SpecializationChanged += objSkill_SpecializationChanged;
			objSkillControl.SkillKarmaClicked += objSkill_KarmaClicked;
			objSkillControl.SkillName = frmPickExoticSkill.SelectedExoticSkill;
			objSkillControl.DiceRollerClicked += objSkill_DiceRollerClicked;
			objSkillControl.DeleteSkill += objSkill_DeleteExoticSkill;
			objSkillControl.SkillCategory = nodSkill["category"].InnerText;
			if (nodSkill["default"].InnerText == "Yes")
				objSkill.Default = true;
			else
				objSkill.Default = false;

			objSkill.ExoticSkill = true;
			_objCharacter.Skills.Add(objSkill);

			objSkillControl.SkillRatingMaximum = 12;
			// Set the SkillControl's Location since scrolling the Panel causes it to actually change the child Controls' Locations.
			objSkillControl.Location = new Point(0, objSkillControl.Height * i + panActiveSkills.AutoScrollPosition.Y);
			panActiveSkills.Controls.Add(objSkillControl);

			_blnIsDirty = true;
			UpdateWindowTitle();
		}