private void cmdAddPet_Click(object sender, EventArgs e) { Contact objContact = new Contact(_objCharacter); objContact.EntityType = ContactType.Pet; _objCharacter.Contacts.Add(objContact); PetControl objContactControl = new PetControl(); objContactControl.ContactObject = objContact; // Attach an EventHandler for the DeleteContact and FileNameChanged Events. objContactControl.DeleteContact += objPet_DeleteContact; objContactControl.FileNameChanged += objPet_FileNameChanged; // Add the control to the Panel. panPets.Controls.Add(objContactControl); UpdateCharacterInfo(); _blnIsDirty = true; UpdateWindowTitle(); }
private void frmCreate_Load(object sender, EventArgs e) { Timekeeper.Finish("load_free"); Timekeeper.Start("load_frm_create"); _blnLoading = true; if (!_objCharacter.IsCritter && (_objCharacter.BuildMethod == CharacterBuildMethod.Karma && _objCharacter.BuildKarma == 0) || (_objCharacter.BuildMethod == CharacterBuildMethod.Priority && _objCharacter.BuildKarma == 0)) { _blnFreestyle = true; tssBPRemain.Visible = false; tssBPRemainLabel.Visible = false; } // Initialize elements if we're using Priority to build. if (_objCharacter.BuildMethod == CharacterBuildMethod.Priority || _objCharacter.BuildMethod == CharacterBuildMethod.SumtoTen) { // Load the Priority information. if (_objCharacter.GameplayOption == "") { _objCharacter.GameplayOption = "Standard"; } XmlDocument objXmlDocumentGameplayOptions = XmlManager.Instance.Load("gameplayoptions.xml"); XmlNode objXmlGameplayOption = objXmlDocumentGameplayOptions.SelectSingleNode("/chummer/gameplayoptions/gameplayoption[name = \"" + _objCharacter.GameplayOption + "\"]"); string strKarma = objXmlGameplayOption["karma"].InnerText; string strNuyen = objXmlGameplayOption["maxnuyen"].InnerText; if (!_objOptions.FreeContactsMultiplierEnabled) { string strContactMultiplier = objXmlGameplayOption["contactmultiplier"].InnerText; _objCharacter.ContactMultiplier = Convert.ToInt32(strContactMultiplier); } else { _objCharacter.ContactMultiplier = _objOptions.FreeContactsMultiplier; } _objCharacter.MaxKarma = Convert.ToInt32(strKarma); _objCharacter.MaxNuyen = Convert.ToInt32(strNuyen); lblPBuildSpecial.Text = String.Format("{0} " + LanguageManager.Instance.GetString("String_Of") + " {1}", (_objCharacter.Special).ToString(), _objCharacter.TotalSpecial.ToString()); lblPBuildAttributes.Text = String.Format("{0} " + LanguageManager.Instance.GetString("String_Of") + " {1}", (_objCharacter.Attributes).ToString(), _objCharacter.TotalAttributes.ToString()); lblPBuildSpells.Text = String.Format("{0} " + LanguageManager.Instance.GetString("String_Of") + " {1}", (_objCharacter.SpellLimit - _objCharacter.Spells.Count).ToString(), _objCharacter.SpellLimit.ToString()); lblPBuildComplexForms.Text = String.Format("{0} " + LanguageManager.Instance.GetString("String_Of") + " {1}", (_objCharacter.CFPLimit - _objCharacter.ComplexForms.Count).ToString(), _objCharacter.CFPLimit.ToString()); tabInfo.TabPages.RemoveAt(0); } else { tabInfo.TabPages.RemoveAt(1); } int count = 0; foreach (Contact contact in _objCharacter.Contacts) count += contact.ContactPoints; // Set the movement speed defaults lblMovement.Text = _objCharacter.Movement; tssBPLabel.Text = LanguageManager.Instance.GetString("Label_Karma"); tssBPRemainLabel.Text = LanguageManager.Instance.GetString("Label_KarmaRemaining"); tabBPSummary.Text = LanguageManager.Instance.GetString("Tab_BPSummary_Karma"); lblQualityBPLabel.Text = LanguageManager.Instance.GetString("Label_Karma"); // Set the Statusbar Labels if we're using Karma to build. if (_objCharacter.BuildMethod == CharacterBuildMethod.Karma || _objCharacter.BuildMethod == CharacterBuildMethod.LifeModule) { //TODO: Fix the UI for karmagen nudAGI.Enabled = false; nudBOD.Enabled = false; nudSTR.Enabled = false; nudREA.Enabled = false; nudINT.Enabled = false; nudCHA.Enabled = false; nudLOG.Enabled = false; nudWIL.Enabled = false; nudEDG.Enabled = false; nudRES.Enabled = false; nudMAG.Enabled = false; } nudNuyen.Value = _objCharacter.NuyenBP; // Remove the Magician, Adept, and Technomancer tabs since they are not in use until the appropriate Quality is selected. if (!_objCharacter.MagicianEnabled && !_objCharacter.AdeptEnabled) tabCharacterTabs.TabPages.Remove(tabMagician); if (!_objCharacter.AdeptEnabled) tabCharacterTabs.TabPages.Remove(tabAdept); if (!_objCharacter.TechnomancerEnabled) tabCharacterTabs.TabPages.Remove(tabTechnomancer); if (!_objCharacter.CritterEnabled) tabCharacterTabs.TabPages.Remove(tabCritter); if (_objCharacter.AdeptEnabled && !_objCharacter.MagicianEnabled) { // Hide the pieces that only apply to mages or mystic adepts treSpells.Nodes[4].Remove(); treSpells.Nodes[3].Remove(); treSpells.Nodes[2].Remove(); treSpells.Nodes[1].Remove(); treSpells.Nodes[0].Remove(); lblDrainAttributesLabel.Visible = false; lblDrainAttributes.Visible = false; lblDrainAttributesValue.Visible = false; lblSpirits.Visible = false; cmdAddSpirit.Visible = false; panSpirits.Visible = false; } // Set the visibility of the Bioware Suites menu options. mnuSpecialAddBiowareSuite.Visible = _objCharacter.Options.AllowBiowareSuites; mnuSpecialCreateBiowareSuite.Visible = _objCharacter.Options.AllowBiowareSuites; if (_objCharacter.BlackMarket) { chkCyberwareBlackMarketDiscount.Visible = true; chkArmorBlackMarketDiscount.Visible = true; chkWeaponBlackMarketDiscount.Visible = true; chkGearBlackMarketDiscount.Visible = true; chkVehicleBlackMarketDiscount.Visible = true; } // Remove the Improvements Tab. tabCharacterTabs.TabPages.Remove(tabImprovements); if (_objCharacter.BuildMethod == CharacterBuildMethod.Karma) { if (!_objCharacter.MAGEnabled && !_objCharacter.RESEnabled) tabCharacterTabs.TabPages.Remove(tabInitiation); else { if (_objCharacter.MAGEnabled) { tabInitiation.Text = LanguageManager.Instance.GetString("Tab_Initiation"); cmdAddMetamagic.Text = LanguageManager.Instance.GetString("Button_AddMetamagic"); chkInitiationGroup.Text = LanguageManager.Instance.GetString("Checkbox_GroupInitiation"); chkInitiationOrdeal.Text = LanguageManager.Instance.GetString("Checkbox_InitiationOrdeal"); } else { tabInitiation.Text = LanguageManager.Instance.GetString("Tab_Submersion"); cmdAddMetamagic.Text = LanguageManager.Instance.GetString("Button_AddSubmersionGrade"); chkInitiationGroup.Text = LanguageManager.Instance.GetString("Checkbox_NetworkSubmersion"); chkInitiationOrdeal.Text = LanguageManager.Instance.GetString("Checkbox_SubmersionTask"); } } } else { if ((!_objCharacter.MAGEnabled && !_objCharacter.RESEnabled) || !_objCharacter.Options.AllowInitiationInCreateMode) tabCharacterTabs.TabPages.Remove(tabInitiation); } // If the character has a mugshot, decode it and put it in the PictureBox. if (_objCharacter.Mugshot != "") { byte[] bytImage = Convert.FromBase64String(_objCharacter.Mugshot); MemoryStream objStream = new MemoryStream(bytImage, 0, bytImage.Length); objStream.Write(bytImage, 0, bytImage.Length); Image imgMugshot = Image.FromStream(objStream, true); picMugshot.Image = imgMugshot; } // Populate character information fields. XmlDocument objMetatypeDoc = new XmlDocument(); XmlNode objMetatypeNode; string strMetatype = ""; string strBook = ""; string strPage = ""; objMetatypeDoc = XmlManager.Instance.Load("metatypes.xml"); { objMetatypeNode = objMetatypeDoc.SelectSingleNode("/chummer/metatypes/metatype[name = \"" + _objCharacter.Metatype + "\"]"); if (objMetatypeNode == null) objMetatypeDoc = XmlManager.Instance.Load("critters.xml"); objMetatypeNode = objMetatypeDoc.SelectSingleNode("/chummer/metatypes/metatype[name = \"" + _objCharacter.Metatype + "\"]"); if (objMetatypeNode["translate"] != null) strMetatype = objMetatypeNode["translate"].InnerText; else strMetatype = _objCharacter.Metatype; strBook = _objOptions.LanguageBookShort(objMetatypeNode["source"].InnerText); if (objMetatypeNode["altpage"] != null) strPage = objMetatypeNode["altpage"].InnerText; else strPage = objMetatypeNode["page"].InnerText; if (_objCharacter.Metavariant != "") { objMetatypeNode = objMetatypeNode.SelectSingleNode("metavariants/metavariant[name = \"" + _objCharacter.Metavariant + "\"]"); if (objMetatypeNode["translate"] != null) strMetatype += " (" + objMetatypeNode["translate"].InnerText + ")"; else strMetatype += " (" + _objCharacter.Metavariant + ")"; strBook = _objOptions.LanguageBookShort(objMetatypeNode["source"].InnerText); if (objMetatypeNode["altpage"] != null) strPage = objMetatypeNode["altpage"].InnerText; else strPage = objMetatypeNode["page"].InnerText; } } lblMetatype.Text = strMetatype; lblMetatypeSource.Text = strBook + " " + strPage; txtCharacterName.Text = _objCharacter.Name; txtSex.Text = _objCharacter.Sex; txtAge.Text = _objCharacter.Age; txtEyes.Text = _objCharacter.Eyes; txtHeight.Text = _objCharacter.Height; txtWeight.Text = _objCharacter.Weight; txtSkin.Text = _objCharacter.Skin; txtHair.Text = _objCharacter.Hair; txtDescription.Text = _objCharacter.Description; txtBackground.Text = _objCharacter.Background; txtConcept.Text = _objCharacter.Concept; txtNotes.Text = _objCharacter.Notes; txtAlias.Text = _objCharacter.Alias; txtPlayerName.Text = _objCharacter.PlayerName; // Check for Special Attributes. lblMAGLabel.Enabled = _objCharacter.MAGEnabled; lblMAGAug.Enabled = _objCharacter.MAGEnabled; if ((_objCharacter.BuildMethod != CharacterBuildMethod.Karma) && (_objCharacter.BuildMethod != CharacterBuildMethod.LifeModule)) { nudMAG.Enabled = _objCharacter.MAGEnabled; } nudKMAG.Enabled = _objCharacter.MAGEnabled; lblMAGMetatype.Enabled = _objCharacter.MAGEnabled; lblFoci.Visible = _objCharacter.MAGEnabled; treFoci.Visible = _objCharacter.MAGEnabled; cmdCreateStackedFocus.Visible = _objCharacter.MAGEnabled; if (_objCharacter.Metatype == "A.I.") { lblDEPAug.Enabled = true; lblDEPLabel.Enabled = true; if ((_objCharacter.BuildMethod != CharacterBuildMethod.Karma) && (_objCharacter.BuildMethod != CharacterBuildMethod.LifeModule)) { nudDEP.Enabled = true; } nudKDEP.Enabled = true; lblDEPMetatype.Enabled = true; } lblRESLabel.Enabled = _objCharacter.RESEnabled; lblRESAug.Enabled = _objCharacter.RESEnabled; if (_objCharacter.BuildMethod != CharacterBuildMethod.Karma || _objCharacter.BuildMethod != CharacterBuildMethod.LifeModule) { nudRES.Enabled = _objCharacter.RESEnabled; } nudKRES.Enabled = _objCharacter.RESEnabled; lblRESMetatype.Enabled = _objCharacter.RESEnabled; // Define the XML objects that will be used. XmlDocument objXmlDocument = new XmlDocument(); if (_objCharacter.BuildMethod == CharacterBuildMethod.LifeModule) { cmdLifeModule.Visible = true; treQualities.Nodes.Add(new TreeNode("Life Modules")); btnCreateBackstory.Visible = true; btnCreateBackstory.Visible = _objCharacter.Options.AutomaticBackstory; } // Populate the Qualities list. foreach (Quality objQuality in _objCharacter.Qualities) { treQualities.Add(objQuality, cmsQuality); } // Populate the Magician Traditions list. objXmlDocument = XmlManager.Instance.Load("traditions.xml"); List<ListItem> lstTraditions = new List<ListItem>(); ListItem objBlank = new ListItem(); objBlank.Value = ""; objBlank.Name = ""; lstTraditions.Add(objBlank); foreach (XmlNode objXmlTradition in objXmlDocument.SelectNodes("/chummer/traditions/tradition[" + _objOptions.BookXPath() + "]")) { ListItem objItem = new ListItem(); objItem.Value = objXmlTradition["name"].InnerText; if (objXmlTradition["translate"] != null) objItem.Name = objXmlTradition["translate"].InnerText; else objItem.Name = objXmlTradition["name"].InnerText; lstTraditions.Add(objItem); } SortListItem objSort = new SortListItem(); lstTraditions.Sort(objSort.Compare); cboTradition.ValueMember = "Value"; cboTradition.DisplayMember = "Name"; cboTradition.DataSource = lstTraditions; // Populate the Magician Custom Drain Options list. objXmlDocument = XmlManager.Instance.Load("traditions.xml"); List<ListItem> lstDrainAttributes = new List<ListItem>(); ListItem objDrainBlank = new ListItem(); objDrainBlank.Value = ""; objDrainBlank.Name = ""; lstDrainAttributes.Add(objDrainBlank); foreach (XmlNode objXmlDrain in objXmlDocument.SelectNodes("/chummer/drainattributes/drainattribute")) { ListItem objItem = new ListItem(); objItem.Value = objXmlDrain["name"].InnerText; if (objXmlDrain["translate"] != null) objItem.Name = objXmlDrain["translate"].InnerText; else objItem.Name = objXmlDrain["name"].InnerText; lstDrainAttributes.Add(objItem); } SortListItem objDrainSort = new SortListItem(); lstDrainAttributes.Sort(objDrainSort.Compare); cboDrain.ValueMember = "Value"; cboDrain.DisplayMember = "Name"; cboDrain.DataSource = lstDrainAttributes; // Populate the Magician Custom Spirits lists - Combat. objXmlDocument = XmlManager.Instance.Load("traditions.xml"); List<ListItem> lstSpirit = new List<ListItem>(); ListItem objSpiritBlank = new ListItem(); objSpiritBlank.Value = ""; objSpiritBlank.Name = ""; lstSpirit.Add(objSpiritBlank); foreach (XmlNode objXmlSpirit in objXmlDocument.SelectNodes("/chummer/spirits/spirit")) { ListItem objItem = new ListItem(); objItem.Value = objXmlSpirit["name"].InnerText; if (objXmlSpirit["translate"] != null) objItem.Name = objXmlSpirit["translate"].InnerText; else objItem.Name = objXmlSpirit["name"].InnerText; lstSpirit.Add(objItem); } SortListItem objSpiritSort = new SortListItem(); lstSpirit.Sort(objSpiritSort.Compare); cboSpiritCombat.ValueMember = "Value"; cboSpiritCombat.DisplayMember = "Name"; cboSpiritCombat.DataSource = lstSpirit; // Populate the Magician Custom Spirits lists - Detection. lstSpirit = new List<ListItem>(); objSpiritBlank = new ListItem(); objSpiritBlank.Value = ""; objSpiritBlank.Name = ""; lstSpirit.Add(objSpiritBlank); foreach (XmlNode objXmlSpirit in objXmlDocument.SelectNodes("/chummer/spirits/spirit")) { ListItem objItem = new ListItem(); objItem.Value = objXmlSpirit["name"].InnerText; if (objXmlSpirit["translate"] != null) objItem.Name = objXmlSpirit["translate"].InnerText; else objItem.Name = objXmlSpirit["name"].InnerText; lstSpirit.Add(objItem); } objSpiritSort = new SortListItem(); lstSpirit.Sort(objSpiritSort.Compare); cboSpiritDetection.ValueMember = "Value"; cboSpiritDetection.DisplayMember = "Name"; cboSpiritDetection.DataSource = lstSpirit; // Populate the Magician Custom Spirits lists - Health. lstSpirit = new List<ListItem>(); objSpiritBlank = new ListItem(); objSpiritBlank.Value = ""; objSpiritBlank.Name = ""; lstSpirit.Add(objSpiritBlank); foreach (XmlNode objXmlSpirit in objXmlDocument.SelectNodes("/chummer/spirits/spirit")) { ListItem objItem = new ListItem(); objItem.Value = objXmlSpirit["name"].InnerText; if (objXmlSpirit["translate"] != null) objItem.Name = objXmlSpirit["translate"].InnerText; else objItem.Name = objXmlSpirit["name"].InnerText; lstSpirit.Add(objItem); } objSpiritSort = new SortListItem(); lstSpirit.Sort(objSpiritSort.Compare); cboSpiritHealth.ValueMember = "Value"; cboSpiritHealth.DisplayMember = "Name"; cboSpiritHealth.DataSource = lstSpirit; // Populate the Magician Custom Spirits lists - Illusion. lstSpirit = new List<ListItem>(); objSpiritBlank = new ListItem(); objSpiritBlank.Value = ""; objSpiritBlank.Name = ""; lstSpirit.Add(objSpiritBlank); foreach (XmlNode objXmlSpirit in objXmlDocument.SelectNodes("/chummer/spirits/spirit")) { ListItem objItem = new ListItem(); objItem.Value = objXmlSpirit["name"].InnerText; if (objXmlSpirit["translate"] != null) objItem.Name = objXmlSpirit["translate"].InnerText; else objItem.Name = objXmlSpirit["name"].InnerText; lstSpirit.Add(objItem); } objSpiritSort = new SortListItem(); lstSpirit.Sort(objSpiritSort.Compare); cboSpiritIllusion.ValueMember = "Value"; cboSpiritIllusion.DisplayMember = "Name"; cboSpiritIllusion.DataSource = lstSpirit; // Populate the Magician Custom Spirits lists - Manipulation. lstSpirit = new List<ListItem>(); objSpiritBlank = new ListItem(); objSpiritBlank.Value = ""; objSpiritBlank.Name = ""; lstSpirit.Add(objSpiritBlank); foreach (XmlNode objXmlSpirit in objXmlDocument.SelectNodes("/chummer/spirits/spirit")) { ListItem objItem = new ListItem(); objItem.Value = objXmlSpirit["name"].InnerText; if (objXmlSpirit["translate"] != null) objItem.Name = objXmlSpirit["translate"].InnerText; else objItem.Name = objXmlSpirit["name"].InnerText; lstSpirit.Add(objItem); } objSpiritSort = new SortListItem(); lstSpirit.Sort(objSpiritSort.Compare); cboSpiritManipulation.ValueMember = "Value"; cboSpiritManipulation.DisplayMember = "Name"; cboSpiritManipulation.DataSource = lstSpirit; // Load the Metatype information before going anywhere else. Doing this later causes the Attributes to get messed up because of calls // to UpdateCharacterInformation(); MetatypeSelected(); // If the character is a Mystic Adept, set the values for the Mystic Adept NUD. if (_objCharacter.AdeptEnabled && _objCharacter.MagicianEnabled) { nudMysticAdeptMAGMagician.Maximum = _objCharacter.MAG.TotalValue; nudMysticAdeptMAGMagician.Value = _objCharacter.MAGMagician; lblMysticAdeptAssignment.Visible = true; nudMysticAdeptMAGMagician.Visible = true; } // Nuyen can be affected by Qualities, so adjust the total amount available to the character. if (_objCharacter.IgnoreRules == false) { if (_objCharacter.BuildMethod == CharacterBuildMethod.SumtoTen || _objCharacter.BuildMethod == CharacterBuildMethod.Priority) { nudNuyen.Maximum = _objCharacter.MaxNuyen; } else if (_objCharacter.BuildMethod == CharacterBuildMethod.Karma || _objCharacter.BuildMethod == CharacterBuildMethod.LifeModule) { nudNuyen.Maximum = 200; } } else { //nudNuyen.Maximum = decimal.MaxValue; } if (_objCharacter.BornRich) nudNuyen.Maximum += 30; nudNuyen.Value = _objCharacter.NuyenBP; // Load the Skills information. objXmlDocument = XmlManager.Instance.Load("skills.xml"); // Populate the Skills Controls. XmlNodeList objXmlNodeList = objXmlDocument.SelectNodes("/chummer/skills/skill[" + _objCharacter.Options.BookXPath() + "]"); // Counter to keep track of the number of Controls that have been added to the Panel so we can determine their vertical positioning. int i = -1; if (_objCharacter.BuildMethod == CharacterBuildMethod.Karma) { label8.Visible = false; label14.Visible = false; } foreach (Skill objSkill in _objCharacter.Skills) { if (!objSkill.KnowledgeSkill && !objSkill.ExoticSkill) { i++; SkillControl objSkillControl = new SkillControl(_objCharacter); objSkillControl.SkillObject = objSkill; // Attach an EventHandler for the RatingChanged and SpecializationChanged Events. objSkillControl.RatingChanged += objActiveSkill_RatingChanged; objSkillControl.BuyWithKarmaChanged += objActiveSkill_BuyWithKarmaChanged; objSkillControl.SpecializationChanged += objSkill_SpecializationChanged; objSkillControl.BreakGroupClicked += objSkill_BreakGroupClicked; objSkillControl.SkillName = objSkill.Name; objSkillControl.SkillCategory = objSkill.SkillCategory; objSkillControl.SkillGroup = objSkill.SkillGroup; objSkillControl.SkillRatingMaximum = objSkill.RatingMaximum; objSkillControl.SkillRating = objSkill.Rating; objSkillControl.SkillBase = objSkill.Base; objSkillControl.SkillKarma = objSkill.Karma; objSkillControl.SkillSpec = objSkill.Specialization; XmlNode objXmlSkill = objXmlDocument.SelectSingleNode("/chummer/skills/skill[name = \"" + objSkill.Name + "\"]"); // Populate the Skill's Specializations (if any). foreach (XmlNode objXmlSpecialization in objXmlSkill.SelectNodes("specs/spec")) { if (objXmlSpecialization.Attributes["translate"] != null) objSkillControl.AddSpec(objXmlSpecialization.Attributes["translate"].InnerText); else objSkillControl.AddSpec(objXmlSpecialization.InnerText); } // Set the control's vertical position and add it to the Skills Panel. objSkillControl.Top = i * objSkillControl.Height; objSkillControl.Width = 510; objSkillControl.AutoScroll = false; panActiveSkills.Controls.Add(objSkillControl); } } // Exotic Skills. foreach (Skill objSkill in _objCharacter.Skills) { if (objSkill.ExoticSkill) { i++; SkillControl objSkillControl = new SkillControl(_objCharacter); objSkillControl.SkillObject = objSkill; // Attach an EventHandler for the RatingChanged and SpecializationChanged Events. objSkillControl.RatingChanged += objActiveSkill_RatingChanged; objSkillControl.SpecializationChanged += objSkill_SpecializationChanged; objSkillControl.BreakGroupClicked += objSkill_BreakGroupClicked; objSkillControl.BuyWithKarmaChanged += objActiveSkill_BuyWithKarmaChanged; objSkillControl.SkillName = objSkill.Name; objSkillControl.SkillCategory = objSkill.SkillCategory; objSkillControl.SkillGroup = objSkill.SkillGroup; objSkillControl.SkillRatingMaximum = objSkill.RatingMaximum; objSkillControl.SkillBase = objSkill.Base; objSkillControl.SkillKarma = objSkill.Karma; objSkillControl.SkillRating = objSkill.Rating; objSkillControl.SkillSpec = objSkill.Specialization; XmlNode objXmlSkill = objXmlDocument.SelectSingleNode("/chummer/skills/skill[name = \"" + objSkill.Name + "\"]"); // Populate the Skill's Specializations (if any). foreach (XmlNode objXmlSpecialization in objXmlSkill.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 = \"" + objSkill.Name + "s\" or useskill = \"" + objSkill.Name + "\"]"); foreach (XmlNode objXmlWeapon in objXmlWeaponList) { if (objXmlWeapon["translate"] != null) objSkillControl.AddSpec(objXmlWeapon["translate"].InnerText); else objSkillControl.AddSpec(objXmlWeapon["name"].InnerText); } // Set the control's vertical position and add it to the Skills Panel. objSkillControl.Top = i * objSkillControl.Height; objSkillControl.Width = 510; objSkillControl.AutoScroll = false; panActiveSkills.Controls.Add(objSkillControl); } } // Populate the Skill Groups list. i = -1; foreach (SkillGroup objGroup in _objCharacter.SkillGroups) { i++; SkillGroupControl objGroupControl = new SkillGroupControl(_objCharacter.Options, _objCharacter); objGroupControl.SkillGroupObject = objGroup; if (_objCharacter.IgnoreRules) { objGroup.RatingMaximum = 12; } // Attach an EventHandler for the GetRatingChanged Event. objGroupControl.GroupRatingChanged += objGroup_RatingChanged; // Populate the control, set its vertical position and add it to the Skill Groups Panel. A Skill Group cannot start with a Rating higher than 4. objGroupControl.GroupName = objGroup.Name; if (objGroup.Rating > objGroup.RatingMaximum) objGroup.RatingMaximum = objGroup.Rating; objGroupControl.GroupRatingMaximum = objGroup.RatingMaximum; // objGroupControl.GroupRating = objGroup.Rating; objGroupControl.BaseRating = objGroup.Base; objGroupControl.KarmaRating = objGroup.Karma; objGroupControl.Top = i * objGroupControl.Height; objGroupControl.Width = 250; // Loop through all of the Active Skills the character has and set their maximums if needed. if (objGroup.RatingMaximum > 6) { foreach (SkillControl objSkill in panActiveSkills.Controls) { if (objSkill.IsGrouped && objSkill.SkillGroup == objGroup.Name) { objSkill.SkillRatingMaximum = objGroup.RatingMaximum; objSkill.SkillObject.RatingMaximum = objGroup.RatingMaximum; objSkill.SkillRating = objGroup.Rating; } } } /*if (_objCharacter.Uneducated) { objGroupControl.IsEnabled = !objGroup.HasTechnicalSkills; }*/ if (_objCharacter.Uncouth) { objGroupControl.IsEnabled = !objGroup.HasSocialSkills; } panSkillGroups.Controls.Add(objGroupControl); } // Populate Knowledge Skills. i = -1; foreach (Skill objSkill in _objCharacter.Skills) { if (objSkill.KnowledgeSkill) { i++; SkillControl objSkillControl = new SkillControl(_objCharacter); objSkillControl.SkillObject = objSkill; // Attach an EventHandler for the RatingChanged and SpecializationChanged Events. objSkillControl.RatingChanged += objKnowledgeSkill_RatingChanged; objSkillControl.SpecializationChanged += objSkill_SpecializationChanged; objSkillControl.DeleteSkill += objKnowledgeSkill_DeleteSkill; objSkillControl.BreakGroupClicked += objSkill_BreakGroupClicked; objSkillControl.BuyWithKarmaChanged += objKnowledgeSkill_BuyWithKarmaChanged; objSkillControl.MergeClicked += knoSkill_MergeClick; objSkillControl.KnowledgeSkill = true; objSkillControl.SkillCategory = objSkill.SkillCategory; objSkillControl.AllowDelete = true; objSkillControl.SkillRatingMaximum = objSkill.RatingMaximum; objSkillControl.SkillBase = objSkill.Base; objSkillControl.SkillKarma = objSkill.Karma; objSkillControl.SkillRating = objSkill.Rating; objSkillControl.SkillName = objSkill.Name; objSkillControl.SkillSpec = objSkill.Specialization; objSkillControl.Top = i * objSkillControl.Height; objSkillControl.AutoScroll = false; panKnowledgeSkills.Controls.Add(objSkillControl); ////Handler for pre-5.163 Point Buy characters that had skill points in their knowledge skills //if (objSkill.Base != 0 && !objSkill.CharacterObject.Options.FreeKarmaKnowledge && _objCharacter.BuildMethod == CharacterBuildMethod.Karma) //{ //lets no keep this code here! // objSkill.Base = 0; //} } } // Populate Contacts and Enemies. int intContact = -1; int intEnemy = -1; foreach (Contact objContact in _objCharacter.Contacts) { if (objContact.EntityType == ContactType.Contact) { intContact++; ContactControl objContactControl = new ContactControl(_objCharacter); // Attach an EventHandler for the ConnectionRatingChanged, LoyaltyRatingChanged, DeleteContact, FileNameChanged Events and OtherCostChanged objContactControl.ConnectionRatingChanged += objContact_ConnectionRatingChanged; objContactControl.LoyaltyRatingChanged += objContact_LoyaltyRatingChanged; objContactControl.DeleteContact += objContact_DeleteContact; objContactControl.FileNameChanged += objContact_FileNameChanged; objContactControl.FreeRatingChanged += objContact_OtherCostChanged; objContactControl.ContactObject = objContact; objContactControl.ContactName = objContact.Name; objContactControl.ContactLocation = objContact.Location; objContactControl.ContactRole = objContact.Role; objContactControl.ConnectionRating = objContact.Connection; objContactControl.LoyaltyRating = objContact.Loyalty; objContactControl.EntityType = objContact.EntityType; objContactControl.BackColor = objContact.Colour; objContactControl.IsGroup = objContact.IsGroup; objContactControl.MouseDown += panContactControl_MouseDown; objContactControl.Top = intContact * objContactControl.Height; panContacts.Controls.Add(objContactControl); } if (objContact.EntityType == ContactType.Enemy) { intEnemy++; ContactControl objContactControl = new ContactControl(_objCharacter); // Attach an EventHandler for the ConnectioNRatingChanged, LoyaltyRatingChanged, DeleteContact, and FileNameChanged Events. objContactControl.ConnectionRatingChanged += objEnemy_ConnectionRatingChanged; objContactControl.LoyaltyRatingChanged += objEnemy_LoyaltyRatingChanged; objContactControl.GroupStatusChanged += objEnemy_GroupStatusChanged; objContactControl.FreeRatingChanged += objEnemy_FreeStatusChanged; objContactControl.DeleteContact += objEnemy_DeleteContact; objContactControl.FileNameChanged += objEnemy_FileNameChanged; objContactControl.ContactObject = objContact; objContactControl.IsEnemy = true; objContactControl.ContactName = objContact.Name; objContactControl.ContactLocation = objContact.Location; objContactControl.ContactRole = objContact.Role; objContactControl.ConnectionRating = objContact.Connection; objContactControl.LoyaltyRating = objContact.Loyalty; objContactControl.EntityType = objContact.EntityType; objContactControl.BackColor = objContact.Colour; objContactControl.IsGroup = objContact.IsGroup; objContactControl.Top = intEnemy * objContactControl.Height; panEnemies.Controls.Add(objContactControl); } if (objContact.EntityType == ContactType.Pet) { PetControl objContactControl = new PetControl(); // Attach an EventHandler for the DeleteContact and FileNameChanged Events. objContactControl.DeleteContact += objPet_DeleteContact; objContactControl.FileNameChanged += objPet_FileNameChanged; objContactControl.ContactObject = objContact; objContactControl.ContactName = objContact.Name; objContactControl.BackColor = objContact.Colour; panPets.Controls.Add(objContactControl); } } // Populate Armor. // Start by populating Locations. foreach (string strLocation in _objCharacter.ArmorBundles) { TreeNode objLocation = new TreeNode(); objLocation.Tag = strLocation; objLocation.Text = strLocation; objLocation.ContextMenuStrip = cmsArmorLocation; treArmor.Nodes.Add(objLocation); } foreach (Armor objArmor in _objCharacter.Armor) { _objFunctions.CreateArmorTreeNode(objArmor, treArmor, cmsArmor, cmsArmorMod, cmsArmorGear); } // Populate Weapons. // Start by populating Locations. foreach (string strLocation in _objCharacter.WeaponLocations) { TreeNode objLocation = new TreeNode(); objLocation.Tag = strLocation; objLocation.Text = strLocation; objLocation.ContextMenuStrip = cmsWeaponLocation; treWeapons.Nodes.Add(objLocation); } foreach (Weapon objWeapon in _objCharacter.Weapons) { _objFunctions.CreateWeaponTreeNode(objWeapon, treWeapons.Nodes[0], cmsWeapon, cmsWeaponMod, cmsWeaponAccessory, cmsWeaponAccessoryGear); } PopulateCyberwareList(); // Populate Spell list. foreach (Spell objSpell in _objCharacter.Spells) { treSpells.Add(objSpell, cmsSpell, _objCharacter); } // Populate Adept Powers. i = -1; foreach (Power objPower in _objCharacter.Powers) { i++; PowerControl objPowerControl = new PowerControl(); objPowerControl.PowerObject = objPower; // Attach an EventHandler for the PowerRatingChanged Event. objPowerControl.PowerRatingChanged += objPower_PowerRatingChanged; objPowerControl.DeletePower += objPower_DeletePower; objPowerControl.PowerName = objPower.Name; objPowerControl.Extra = objPower.Extra; objPowerControl.PointsPerLevel = objPower.PointsPerLevel; objPowerControl.AdeptWayDiscount = objPower.AdeptWayDiscount; objPowerControl.LevelEnabled = objPower.LevelsEnabled; if (objPower.MaxLevels > 0) { if (objPower.Name == "Improved Ability (skill)") { foreach (Skill objSkill in _objCharacter.Skills) if (objPower.Extra == objSkill.Name || (objSkill.ExoticSkill && objPower.Extra == (objSkill.DisplayName + " (" + objSkill.Specialization + ")"))) { int intImprovedAbilityMaximum = objSkill.Rating + (objSkill.Rating / 2); if (intImprovedAbilityMaximum == 0) { intImprovedAbilityMaximum = 1; } objPower.MaxLevels = intImprovedAbilityMaximum; } else { objPowerControl.MaxLevels = objPower.MaxLevels; } } else { objPowerControl.MaxLevels = objPower.MaxLevels; } } objPowerControl.RefreshMaximum(_objCharacter.MAG.TotalValue); if (objPower.Rating < 1) objPower.Rating = 1; objPowerControl.PowerLevel = Convert.ToInt32(objPower.Rating); if (objPower.DiscountedAdeptWay) objPowerControl.DiscountedByAdeptWay = true; if (objPower.DiscountedGeas) objPowerControl.DiscountedByGeas = true; objPowerControl.Top = i * objPowerControl.Height; panPowers.Controls.Add(objPowerControl); } // Populate Magician Spirits. i = -1; foreach (Spirit objSpirit in _objCharacter.Spirits) { if (objSpirit.EntityType == SpiritType.Spirit) { i++; SpiritControl objSpiritControl = new SpiritControl(); objSpiritControl.SpiritObject = objSpirit; // Attach an EventHandler for the ServicesOwedChanged Event. objSpiritControl.ServicesOwedChanged += objSpirit_ServicesOwedChanged; objSpiritControl.ForceChanged += objSpirit_ForceChanged; objSpiritControl.BoundChanged += objSpirit_BoundChanged; objSpiritControl.DeleteSpirit += objSpirit_DeleteSpirit; objSpiritControl.FileNameChanged += objSpirit_FileNameChanged; objSpiritControl.SpiritName = objSpirit.Name; objSpiritControl.ServicesOwed = objSpirit.ServicesOwed; if (_objCharacter.AdeptEnabled && _objCharacter.MagicianEnabled) { if (_objOptions.SpiritForceBasedOnTotalMAG) objSpiritControl.ForceMaximum = _objCharacter.MAG.TotalValue; else objSpiritControl.ForceMaximum = _objCharacter.MAGMagician; } else objSpiritControl.ForceMaximum = _objCharacter.MAG.TotalValue; objSpiritControl.CritterName = objSpirit.CritterName; objSpiritControl.Force = objSpirit.Force; objSpiritControl.Bound = objSpirit.Bound; objSpiritControl.RebuildSpiritList(_objCharacter.MagicTradition); objSpiritControl.Top = i * objSpiritControl.Height; panSpirits.Controls.Add(objSpiritControl); } } // Populate Technomancer Sprites. i = -1; foreach (Spirit objSpirit in _objCharacter.Spirits) { if (objSpirit.EntityType == SpiritType.Sprite) { i++; SpiritControl objSpiritControl = new SpiritControl(); objSpiritControl.SpiritObject = objSpirit; objSpiritControl.EntityType = SpiritType.Sprite; // Attach an EventHandler for the ServicesOwedChanged Event. objSpiritControl.ServicesOwedChanged += objSprite_ServicesOwedChanged; objSpiritControl.ForceChanged += objSprite_ForceChanged; objSpiritControl.BoundChanged += objSprite_BoundChanged; objSpiritControl.DeleteSpirit += objSprite_DeleteSpirit; objSpiritControl.FileNameChanged += objSprite_FileNameChanged; objSpiritControl.SpiritName = objSpirit.Name; objSpiritControl.ServicesOwed = objSpirit.ServicesOwed; objSpiritControl.ForceMaximum = _objCharacter.RES.TotalValue; objSpiritControl.CritterName = objSpiritControl.CritterName; objSpiritControl.Force = objSpirit.Force; objSpiritControl.Bound = objSpirit.Bound; objSpiritControl.RebuildSpiritList(_objCharacter.TechnomancerStream); objSpiritControl.Top = i * objSpiritControl.Height; panSprites.Controls.Add(objSpiritControl); } } // Populate Technomancer Complex Forms/Programs. foreach (ComplexForm objProgram in _objCharacter.ComplexForms) { TreeNode objNode = new TreeNode(); objNode.Text = objProgram.DisplayName; objNode.Tag = objProgram.InternalId; if (objProgram.Notes != string.Empty) objNode.ForeColor = Color.SaddleBrown; objNode.ToolTipText = CommonFunctions.WordWrap(objProgram.Notes, 100); treComplexForms.Nodes[0].Nodes.Add(objNode); treComplexForms.Nodes[0].Expand(); } // Populate Martial Arts. foreach (MartialArt objMartialArt in _objCharacter.MartialArts) { TreeNode objMartialArtNode = new TreeNode(); objMartialArtNode.Text = objMartialArt.DisplayName; objMartialArtNode.Tag = objMartialArt.Name; objMartialArtNode.ContextMenuStrip = cmsMartialArts; if (objMartialArt.Notes != string.Empty) objMartialArtNode.ForeColor = Color.SaddleBrown; objMartialArtNode.ToolTipText = CommonFunctions.WordWrap(objMartialArt.Notes, 100); foreach (MartialArtAdvantage objAdvantage in objMartialArt.Advantages) { TreeNode objAdvantageNode = new TreeNode(); objAdvantageNode.Text = objAdvantage.DisplayName; objAdvantageNode.Tag = objAdvantage.InternalId; objAdvantageNode.ContextMenuStrip = cmsTechnique; if (objAdvantage.Notes != string.Empty) objAdvantageNode.ForeColor = Color.SaddleBrown; else objAdvantageNode.ForeColor = SystemColors.WindowText; objAdvantageNode.ToolTipText = CommonFunctions.WordWrap(objAdvantage.Notes, 100); objMartialArtNode.Nodes.Add(objAdvantageNode); objMartialArtNode.Expand(); } if (objMartialArt.IsQuality) { treMartialArts.Nodes[1].Nodes.Add(objMartialArtNode); treMartialArts.Nodes[1].Expand(); } else { treMartialArts.Nodes[0].Nodes.Add(objMartialArtNode); treMartialArts.Nodes[0].Expand(); } } // Populate Limit Modifiers. foreach (LimitModifier objLimitModifier in _objCharacter.LimitModifiers) { TreeNode objLimitModifierNode = new TreeNode(); objLimitModifierNode.Text = objLimitModifier.DisplayName; objLimitModifierNode.Tag = objLimitModifier.Name; objLimitModifierNode.ContextMenuStrip = cmsMartialArts; if (objLimitModifier.Notes != string.Empty) objLimitModifierNode.ForeColor = Color.SaddleBrown; objLimitModifierNode.ToolTipText = CommonFunctions.WordWrap(objLimitModifier.Notes, 100); objLimitModifierNode.ContextMenuStrip = cmsLimitModifier; switch (objLimitModifier.Limit) { case "Physical": treLimit.Nodes[0].Nodes.Add(objLimitModifierNode); treLimit.Nodes[0].Expand(); break; case "Mental": treLimit.Nodes[1].Nodes.Add(objLimitModifierNode); treLimit.Nodes[1].Expand(); break; case "Social": treLimit.Nodes[2].Nodes.Add(objLimitModifierNode); treLimit.Nodes[2].Expand(); break; } } // Populate Lifestyles. foreach (Lifestyle objLifestyle in _objCharacter.Lifestyles) { TreeNode objLifestyleNode = new TreeNode(); objLifestyleNode.Text = objLifestyle.DisplayName; objLifestyleNode.Tag = objLifestyle.InternalId; if (objLifestyle.StyleType.ToString() != "Standard") objLifestyleNode.ContextMenuStrip = cmsAdvancedLifestyle; else objLifestyleNode.ContextMenuStrip = cmsLifestyleNotes; if (objLifestyle.Notes != string.Empty) objLifestyleNode.ForeColor = Color.SaddleBrown; objLifestyleNode.ToolTipText = CommonFunctions.WordWrap(objLifestyle.Notes, 100); treLifestyles.Nodes[0].Nodes.Add(objLifestyleNode); } treLifestyles.Nodes[0].Expand(); PopulateGearList(); // Populate Foci. _objController.PopulateFocusList(treFoci); // Populate Vehicles. foreach (Vehicle objVehicle in _objCharacter.Vehicles) { _objFunctions.CreateVehicleTreeNode(objVehicle, treVehicles, cmsVehicle, cmsVehicleLocation, cmsVehicleWeapon, cmsVehicleWeaponMod, cmsVehicleWeaponAccessory, cmsVehicleWeaponAccessoryGear, cmsVehicleGear); } // Populate Initiation/Submersion information. if (_objCharacter.InitiateGrade > 0 || _objCharacter.SubmersionGrade > 0) { foreach (Metamagic objMetamagic in _objCharacter.Metamagics) { TreeNode objNode = new TreeNode(); objNode.Text = objMetamagic.DisplayName; objNode.Tag = objMetamagic.InternalId; objNode.ContextMenuStrip = cmsMetamagic; if (objMetamagic.Notes != string.Empty) objNode.ForeColor = Color.SaddleBrown; objNode.ToolTipText = CommonFunctions.WordWrap(objMetamagic.Notes, 100); treMetamagic.Nodes.Add(objNode); } } // Populate Critter Powers. foreach (CritterPower objPower in _objCharacter.CritterPowers) { TreeNode objNode = new TreeNode(); objNode.Text = objPower.DisplayName; objNode.Tag = objPower.InternalId; objNode.ContextMenuStrip = cmsCritterPowers; if (objPower.Notes != string.Empty) objNode.ForeColor = Color.SaddleBrown; objNode.ToolTipText = CommonFunctions.WordWrap(objPower.Notes, 100); if (objPower.Category != "Weakness") { treCritterPowers.Nodes[0].Nodes.Add(objNode); treCritterPowers.Nodes[0].Expand(); } else { treCritterPowers.Nodes[1].Nodes.Add(objNode); treCritterPowers.Nodes[1].Expand(); } } // Load the Cyberware information. objXmlDocument = XmlManager.Instance.Load("cyberware.xml"); // Populate the Grade list. List<ListItem> lstCyberwareGrades = new List<ListItem>(); foreach (Grade objGrade in GlobalOptions.CyberwareGrades) { ListItem objItem = new ListItem(); objItem.Value = objGrade.Name; objItem.Name = objGrade.DisplayName; lstCyberwareGrades.Add(objItem); } cboCyberwareGrade.ValueMember = "Value"; cboCyberwareGrade.DisplayMember = "Name"; cboCyberwareGrade.DataSource = lstCyberwareGrades; _blnLoading = false; // Select the Magician's Tradition. if (_objCharacter.MagicTradition != "") cboTradition.SelectedValue = _objCharacter.MagicTradition; if (_objCharacter.TraditionName != "") txtTraditionName.Text = _objCharacter.TraditionName; if (_objCharacter.TraditionDrain != "") cboDrain.SelectedValue = _objCharacter.TraditionDrain; if (_objCharacter.SpiritCombat != "") cboSpiritCombat.SelectedValue = _objCharacter.SpiritCombat; if (_objCharacter.SpiritDetection != "") cboSpiritDetection.SelectedValue = _objCharacter.SpiritDetection; if (_objCharacter.SpiritHealth != "") cboSpiritHealth.SelectedValue = _objCharacter.SpiritHealth; if (_objCharacter.SpiritIllusion != "") cboSpiritIllusion.SelectedValue = _objCharacter.SpiritIllusion; if (_objCharacter.SpiritManipulation != "") cboSpiritManipulation.SelectedValue = _objCharacter.SpiritManipulation; // Clear the Dirty flag which gets set when creating a new Character. CalculateBP(); CalculateNuyen(); _blnIsDirty = false; UpdateWindowTitle(); if (_objCharacter.AdeptEnabled) CalculatePowerPoints(); treGear.ItemDrag += treGear_ItemDrag; treGear.DragEnter += treGear_DragEnter; treGear.DragDrop += treGear_DragDrop; treLifestyles.ItemDrag += treLifestyles_ItemDrag; treLifestyles.DragEnter += treLifestyles_DragEnter; treLifestyles.DragDrop += treLifestyles_DragDrop; treArmor.ItemDrag += treArmor_ItemDrag; treArmor.DragEnter += treArmor_DragEnter; treArmor.DragDrop += treArmor_DragDrop; treWeapons.ItemDrag += treWeapons_ItemDrag; treWeapons.DragEnter += treWeapons_DragEnter; treWeapons.DragDrop += treWeapons_DragDrop; treVehicles.ItemDrag += treVehicles_ItemDrag; treVehicles.DragEnter += treVehicles_DragEnter; treVehicles.DragDrop += treVehicles_DragDrop; // Merge the ToolStrips. ToolStripManager.RevertMerge("toolStrip"); ToolStripManager.Merge(toolStrip, "toolStrip"); // If this is a Sprite, re-label the Mental Attribute Labels. if (_objCharacter.Metatype.EndsWith("Sprite")) { lblBODLabel.Enabled = false; nudBOD.Enabled = false; lblAGILabel.Enabled = false; nudAGI.Enabled = false; lblREALabel.Enabled = false; nudREA.Enabled = false; lblSTRLabel.Enabled = false; nudSTR.Enabled = false; lblCHALabel.Text = LanguageManager.Instance.GetString("String_AttributePilot"); lblINTLabel.Text = LanguageManager.Instance.GetString("String_AttributeResponse"); lblLOGLabel.Text = LanguageManager.Instance.GetString("String_AttributeFirewall"); lblWILLabel.Enabled = false; nudWIL.Enabled = false; } else if (_objCharacter.Metatype.EndsWith("A.I.") || _objCharacter.MetatypeCategory == "Technocritters" || _objCharacter.MetatypeCategory == "Protosapients") { lblRatingLabel.Visible = true; lblRating.Visible = true; lblSystemLabel.Visible = true; lblSystem.Visible = true; lblFirewallLabel.Visible = true; lblFirewall.Visible = true; lblResponseLabel.Visible = true; nudResponse.Visible = true; nudResponse.Enabled = true; nudResponse.Value = _objCharacter.Response; lblSignalLabel.Visible = true; nudSignal.Visible = true; nudSignal.Enabled = true; nudSignal.Value = _objCharacter.Signal; // Disable the Physical Attribute controls. lblBODLabel.Enabled = false; lblAGILabel.Enabled = false; lblREALabel.Enabled = false; lblSTRLabel.Enabled = false; nudBOD.Enabled = false; nudAGI.Enabled = false; nudREA.Enabled = false; nudSTR.Enabled = false; } mnuSpecialConvertToFreeSprite.Visible = _objCharacter.IsSprite; // Run through all of the Skills and Enable/Disable them as needed. foreach (SkillControl objSkillControl in panActiveSkills.Controls) { if (objSkillControl.Attribute == "MAG") objSkillControl.Enabled = _objCharacter.MAGEnabled; if (objSkillControl.Attribute == "RES") objSkillControl.Enabled = _objCharacter.RESEnabled; } // Run through all of the Skill Groups and Disable them if all of their Skills are currently inaccessible. foreach (SkillGroupControl objSkillGroupControl in panSkillGroups.Controls) { bool blnEnabled = false; foreach (Skill objSkill in _objCharacter.Skills) { if (objSkill.SkillGroup == objSkillGroupControl.GroupName) { if (objSkill.Attribute == "MAG" || objSkill.Attribute == "RES") { if (objSkill.Attribute == "MAG" && _objCharacter.MAGEnabled) blnEnabled = true; if (objSkill.Attribute == "RES" && _objCharacter.RESEnabled) blnEnabled = true; } else blnEnabled = true; } } objSkillGroupControl.IsEnabled = blnEnabled; if (!blnEnabled) objSkillGroupControl.GroupRating = 0; } // Populate the Skill Filter DropDown. List<ListItem> lstFilter = new List<ListItem>(); ListItem itmAll = new ListItem(); itmAll.Value = "0"; itmAll.Name = LanguageManager.Instance.GetString("String_SkillFilterAll"); ListItem itmRatingAboveZero = new ListItem(); itmRatingAboveZero.Value = "1"; itmRatingAboveZero.Name = LanguageManager.Instance.GetString("String_SkillFilterRatingAboveZero"); ListItem itmTotalRatingAboveZero = new ListItem(); itmTotalRatingAboveZero.Value = "2"; itmTotalRatingAboveZero.Name = LanguageManager.Instance.GetString("String_SkillFilterTotalRatingAboveZero"); ListItem itmRatingEqualZero = new ListItem(); itmRatingEqualZero.Value = "3"; itmRatingEqualZero.Name = LanguageManager.Instance.GetString("String_SkillFilterRatingZero"); lstFilter.Add(itmAll); lstFilter.Add(itmRatingAboveZero); lstFilter.Add(itmTotalRatingAboveZero); lstFilter.Add(itmRatingEqualZero); objXmlDocument = XmlManager.Instance.Load("skills.xml"); objXmlNodeList = objXmlDocument.SelectNodes("/chummer/categories/category[@type = \"active\"]"); foreach (XmlNode objNode in objXmlNodeList) { ListItem objItem = new ListItem(); objItem.Value = objNode.InnerText; if (objNode.Attributes["translate"] != null) objItem.Name = LanguageManager.Instance.GetString("Label_Category") + " " + objNode.Attributes["translate"].InnerText; else objItem.Name = LanguageManager.Instance.GetString("Label_Category") + " " + objNode.InnerText; lstFilter.Add(objItem); } // Add items for Attributes. ListItem itmBOD = new ListItem(); itmBOD.Value = "BOD"; itmBOD.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeBODShort"); ListItem itmAGI = new ListItem(); itmAGI.Value = "AGI"; itmAGI.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeAGIShort"); ListItem itmREA = new ListItem(); itmREA.Value = "REA"; itmREA.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeREAShort"); ListItem itmSTR = new ListItem(); itmSTR.Value = "STR"; itmSTR.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeSTRShort"); ListItem itmCHA = new ListItem(); itmCHA.Value = "CHA"; itmCHA.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeCHAShort"); ListItem itmINT = new ListItem(); itmINT.Value = "INT"; itmINT.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeINTShort"); ListItem itmLOG = new ListItem(); itmLOG.Value = "LOG"; itmLOG.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeLOGShort"); ListItem itmWIL = new ListItem(); itmWIL.Value = "WIL"; itmWIL.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeWILShort"); ListItem itmMAG = new ListItem(); itmMAG.Value = "MAG"; itmMAG.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeMAGShort"); ListItem itmRES = new ListItem(); itmRES.Value = "RES"; itmRES.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeRESShort"); lstFilter.Add(itmBOD); lstFilter.Add(itmAGI); lstFilter.Add(itmREA); lstFilter.Add(itmSTR); lstFilter.Add(itmCHA); lstFilter.Add(itmINT); lstFilter.Add(itmLOG); lstFilter.Add(itmWIL); lstFilter.Add(itmMAG); lstFilter.Add(itmRES); // Add Skill Groups to the filter. objXmlNodeList = objXmlDocument.SelectNodes("/chummer/categories/category[@type = \"active\"]"); foreach (SkillGroup objGroup in _objCharacter.SkillGroups) { ListItem itmGroup = new ListItem(); itmGroup.Value = "GROUP:" + objGroup.Name; itmGroup.Name = LanguageManager.Instance.GetString("String_ExpenseSkillGroup") + ": " + objGroup.DisplayName; lstFilter.Add(itmGroup); } cboSkillFilter.DataSource = lstFilter; cboSkillFilter.ValueMember = "Value"; cboSkillFilter.DisplayMember = "Name"; cboSkillFilter.SelectedIndex = 0; cboSkillFilter_SelectedIndexChanged(null, null); if (_objCharacter.MetatypeCategory == "Mundane Critters") mnuSpecialMutantCritter.Visible = true; if (_objCharacter.MetatypeCategory == "Mutant Critters") mnuSpecialToxicCritter.Visible = true; if (_objCharacter.MetatypeCategory == "Cyberzombie") mnuSpecialCyberzombie.Visible = false; treCyberware.SortCustom(); treSpells.SortCustom(); treComplexForms.SortCustom(); treQualities.SortCustom(); treCritterPowers.SortCustom(); treMartialArts.SortCustom(); UpdateMentorSpirits(); UpdateInitiationGradeTree(); UpdateCharacterInfo(); _blnIsDirty = false; UpdateWindowTitle(false); RefreshPasteStatus(); // Stupid hack to get the MDI icon to show up properly. this.Icon = this.Icon.Clone() as System.Drawing.Icon; Timekeeper.Finish("load_frm_create"); Timekeeper.Finish("loading"); }
private void frmCareer_Load(object sender, EventArgs e) { _blnLoading = true; // Remove the Magician, Adept, and Technomancer tabs since they are not in use until the appropriate Quality is selected. if (!_objCharacter.MagicianEnabled) tabCharacterTabs.TabPages.Remove(tabMagician); if (!_objCharacter.AdeptEnabled) tabCharacterTabs.TabPages.Remove(tabAdept); if (!_objCharacter.TechnomancerEnabled) tabCharacterTabs.TabPages.Remove(tabTechnomancer); if (!_objCharacter.CritterEnabled) tabCharacterTabs.TabPages.Remove(tabCritter); mnuSpecialAddBiowareSuite.Visible = _objCharacter.Options.AllowBiowareSuites; // Remove the Improvements Tab. //tabCharacterTabs.TabPages.Remove(tabImprovements); // Remove the Initiation tab if the character does not have access to MAG or RES. if (!_objCharacter.MAGEnabled && !_objCharacter.RESEnabled) tabCharacterTabs.TabPages.Remove(tabInitiation); else { if (_objCharacter.MAGEnabled) { tabInitiation.Text = LanguageManager.Instance.GetString("Tab_Initiation"); tsMetamagicAddMetamagic.Text = LanguageManager.Instance.GetString("Button_AddMetamagic"); cmdAddMetamagic.Text = LanguageManager.Instance.GetString("Button_AddInitiateGrade"); chkJoinGroup.Text = LanguageManager.Instance.GetString("Checkbox_JoinedGroup"); chkJoinGroup.Checked = _objCharacter.GroupMember; txtGroupName.Text = _objCharacter.GroupName; txtGroupNotes.Text = _objCharacter.GroupNotes; string strInitTip = LanguageManager.Instance.GetString("Tip_ImproveInitiateGrade").Replace("{0}", (_objCharacter.InitiateGrade + 1).ToString()).Replace("{1}", (10 + ((_objCharacter.InitiateGrade + 1) * _objOptions.KarmaInitiation)).ToString()); tipTooltip.SetToolTip(cmdAddMetamagic, strInitTip); } else { tabInitiation.Text = LanguageManager.Instance.GetString("Tab_Submersion"); tsMetamagicAddMetamagic.Text = LanguageManager.Instance.GetString("Button_AddEcho"); cmdAddMetamagic.Text = LanguageManager.Instance.GetString("Button_AddSubmersionGrade"); chkInitiationGroup.Visible = false; chkInitiationOrdeal.Visible = false; chkInitiationSchooling.Visible = false; tsMetamagicAddArt.Visible = false; tsMetamagicAddEnchantment.Visible = false; tsMetamagicAddEnhancement.Visible = false; tsMetamagicAddRitual.Visible = false; treMetamagic.Top = cmdAddMetamagic.Top + cmdAddMetamagic.Height + 6; cmdAddMetamagic.Left = treMetamagic.Left + treMetamagic.Width - cmdAddMetamagic.Width; txtGroupName.Text = _objCharacter.GroupName; txtGroupNotes.Text = _objCharacter.GroupNotes; string strInitTip = LanguageManager.Instance.GetString("Tip_ImproveSubmersionGrade").Replace("{0}", (_objCharacter.SubmersionGrade + 1).ToString()).Replace("{1}", (10 + ((_objCharacter.SubmersionGrade + 1) * _objOptions.KarmaInitiation)).ToString()); tipTooltip.SetToolTip(cmdAddMetamagic, strInitTip); } } // If the character has a mugshot, decode it and put it in the PictureBox. if (_objCharacter.Mugshot != "") { byte[] bytImage = Convert.FromBase64String(_objCharacter.Mugshot); MemoryStream objStream = new MemoryStream(bytImage, 0, bytImage.Length); objStream.Write(bytImage, 0, bytImage.Length); Image imgMugshot = Image.FromStream(objStream, true); picMugshot.Image = imgMugshot; } // Populate character information fields. XmlDocument objMetatypeDoc = new XmlDocument(); XmlNode objMetatypeNode; string strMetatype = ""; string strBook = ""; string strPage = ""; foreach (Skill objSkill in _objCharacter.Skills) { if (objSkill.RatingMaximum == 6) objSkill.RatingMaximum = 12; else if (objSkill.RatingMaximum == 7) objSkill.RatingMaximum = 13; } foreach (SkillGroup objSkillGroup in _objCharacter.SkillGroups) { if (objSkillGroup.RatingMaximum == 6) objSkillGroup.RatingMaximum = 12; } objMetatypeDoc = XmlManager.Instance.Load("metatypes.xml"); { objMetatypeNode = objMetatypeDoc.SelectSingleNode("/chummer/metatypes/metatype[name = \"" + _objCharacter.Metatype + "\"]"); if (objMetatypeNode == null) objMetatypeDoc = XmlManager.Instance.Load("critters.xml"); objMetatypeNode = objMetatypeDoc.SelectSingleNode("/chummer/metatypes/metatype[name = \"" + _objCharacter.Metatype + "\"]"); if (objMetatypeNode["translate"] != null) strMetatype = objMetatypeNode["translate"].InnerText; else strMetatype = _objCharacter.Metatype; strBook = _objOptions.LanguageBookShort(objMetatypeNode["source"].InnerText); if (objMetatypeNode["altpage"] != null) strPage = objMetatypeNode["altpage"].InnerText; else strPage = objMetatypeNode["page"].InnerText; if (_objCharacter.Metavariant != "") { objMetatypeNode = objMetatypeNode.SelectSingleNode("metavariants/metavariant[name = \"" + _objCharacter.Metavariant + "\"]"); if (objMetatypeNode["translate"] != null) strMetatype += " (" + objMetatypeNode["translate"].InnerText + ")"; else strMetatype += " (" + _objCharacter.Metavariant + ")"; strBook = _objOptions.LanguageBookShort(objMetatypeNode["source"].InnerText); if (objMetatypeNode["altpage"] != null) strPage = objMetatypeNode["altpage"].InnerText; else strPage = objMetatypeNode["page"].InnerText; } } lblMetatype.Text = strMetatype; lblMetatypeSource.Text = strBook + " " + strPage; if (_objCharacter.Possessed) lblPossessed.Text = LanguageManager.Instance.GetString("String_Possessed"); else lblPossessed.Visible = false; tipTooltip.SetToolTip(lblMetatypeSource, _objOptions.LanguageBookLong(objMetatypeNode["source"].InnerText) + " " + LanguageManager.Instance.GetString("String_Page") + " " + strPage); txtCharacterName.Text = _objCharacter.Name; txtSex.Text = _objCharacter.Sex; txtAge.Text = _objCharacter.Age; txtEyes.Text = _objCharacter.Eyes; txtHeight.Text = _objCharacter.Height; txtWeight.Text = _objCharacter.Weight; txtSkin.Text = _objCharacter.Skin; txtHair.Text = _objCharacter.Hair; txtDescription.Text = _objCharacter.Description; txtBackground.Text = _objCharacter.Background; txtConcept.Text = _objCharacter.Concept; txtNotes.Text = _objCharacter.Notes; txtAlias.Text = _objCharacter.Alias; txtPlayerName.Text = _objCharacter.PlayerName; txtGameNotes.Text = _objCharacter.GameNotes; nudStreetCred.Value = _objCharacter.StreetCred; nudNotoriety.Value = _objCharacter.Notoriety; nudPublicAware.Value = _objCharacter.PublicAwareness; // Check for Special Attributes. lblMAGLabel.Enabled = _objCharacter.MAGEnabled; lblMAGAug.Enabled = _objCharacter.MAGEnabled; lblMAG.Enabled = _objCharacter.MAGEnabled; lblMAGMetatype.Enabled = _objCharacter.MAGEnabled; lblFoci.Visible = _objCharacter.MAGEnabled; treFoci.Visible = _objCharacter.MAGEnabled; cmdCreateStackedFocus.Visible = _objCharacter.MAGEnabled; lblRESLabel.Enabled = _objCharacter.RESEnabled; lblRESAug.Enabled = _objCharacter.RESEnabled; lblRES.Enabled = _objCharacter.RESEnabled; lblRESMetatype.Enabled = _objCharacter.RESEnabled; // Define the XML objects that will be used. XmlDocument objXmlDocument = new XmlDocument(); if (_objCharacter.BuildMethod == CharacterBuildMethod.LifeModule) { treQualities.Nodes.Add(new TreeNode("Life Modules")); } // Populate the Qualities list. foreach (Quality objQuality in _objCharacter.Qualities) { TreeNode objNode = new TreeNode(); objNode.Text = objQuality.DisplayName; objNode.Tag = objQuality.InternalId; objNode.ContextMenuStrip = cmsQuality; if (objQuality.Notes != string.Empty) objNode.ForeColor = Color.SaddleBrown; else { if (objQuality.OriginSource == QualitySource.Metatype || objQuality.OriginSource == QualitySource.MetatypeRemovable) objNode.ForeColor = SystemColors.GrayText; } objNode.ToolTipText = objQuality.Notes; if (objQuality.Type == QualityType.Positive) { treQualities.Nodes[0].Nodes.Add(objNode); treQualities.Nodes[0].Expand(); } else if (objQuality.Type == QualityType.Negative) { treQualities.Nodes[1].Nodes.Add(objNode); treQualities.Nodes[1].Expand(); } else if (objQuality.Type == QualityType.LifeModule) { treQualities.Nodes[2].Nodes.Add(objNode); treQualities.Nodes[2].Expand(); } } // Populate the Magician Traditions list. objXmlDocument = XmlManager.Instance.Load("traditions.xml"); List<ListItem> lstTraditions = new List<ListItem>(); ListItem objBlank = new ListItem(); objBlank.Value = ""; objBlank.Name = ""; lstTraditions.Add(objBlank); foreach (XmlNode objXmlTradition in objXmlDocument.SelectNodes("/chummer/traditions/tradition[" + _objOptions.BookXPath() + "]")) { ListItem objItem = new ListItem(); objItem.Value = objXmlTradition["name"].InnerText; if (objXmlTradition["translate"] != null) objItem.Name = objXmlTradition["translate"].InnerText; else objItem.Name = objXmlTradition["name"].InnerText; lstTraditions.Add(objItem); } SortListItem objSort = new SortListItem(); lstTraditions.Sort(objSort.Compare); cboTradition.ValueMember = "Value"; cboTradition.DisplayMember = "Name"; cboTradition.DataSource = lstTraditions; // Populate the Magician Custom Drain Options list. objXmlDocument = XmlManager.Instance.Load("traditions.xml"); List<ListItem> lstDrainAttributes = new List<ListItem>(); ListItem objDrainBlank = new ListItem(); objDrainBlank.Value = ""; objDrainBlank.Name = ""; lstDrainAttributes.Add(objDrainBlank); foreach (XmlNode objXmlDrain in objXmlDocument.SelectNodes("/chummer/drainattributes/drainattribute")) { ListItem objItem = new ListItem(); objItem.Value = objXmlDrain["name"].InnerText; if (objXmlDrain["translate"] != null) objItem.Name = objXmlDrain["translate"].InnerText; else objItem.Name = objXmlDrain["name"].InnerText; lstDrainAttributes.Add(objItem); } SortListItem objDrainSort = new SortListItem(); lstDrainAttributes.Sort(objDrainSort.Compare); cboDrain.ValueMember = "Value"; cboDrain.DisplayMember = "Name"; cboDrain.DataSource = lstDrainAttributes; // Populate the Magician Custom Spirits lists - Combat. objXmlDocument = XmlManager.Instance.Load("traditions.xml"); List<ListItem> lstSpirit = new List<ListItem>(); ListItem objSpiritBlank = new ListItem(); objSpiritBlank.Value = ""; objSpiritBlank.Name = ""; lstSpirit.Add(objSpiritBlank); foreach (XmlNode objXmlSpirit in objXmlDocument.SelectNodes("/chummer/spirits/spirit")) { ListItem objItem = new ListItem(); objItem.Value = objXmlSpirit["name"].InnerText; if (objXmlSpirit["translate"] != null) objItem.Name = objXmlSpirit["translate"].InnerText; else objItem.Name = objXmlSpirit["name"].InnerText; lstSpirit.Add(objItem); } SortListItem objSpiritSort = new SortListItem(); lstSpirit.Sort(objSpiritSort.Compare); cboSpiritCombat.ValueMember = "Value"; cboSpiritCombat.DisplayMember = "Name"; cboSpiritCombat.DataSource = lstSpirit; // Populate the Magician Custom Spirits lists - Detection. lstSpirit = new List<ListItem>(); objSpiritBlank = new ListItem(); objSpiritBlank.Value = ""; objSpiritBlank.Name = ""; lstSpirit.Add(objSpiritBlank); foreach (XmlNode objXmlSpirit in objXmlDocument.SelectNodes("/chummer/spirits/spirit")) { ListItem objItem = new ListItem(); objItem.Value = objXmlSpirit["name"].InnerText; if (objXmlSpirit["translate"] != null) objItem.Name = objXmlSpirit["translate"].InnerText; else objItem.Name = objXmlSpirit["name"].InnerText; lstSpirit.Add(objItem); } objSpiritSort = new SortListItem(); lstSpirit.Sort(objSpiritSort.Compare); cboSpiritDetection.ValueMember = "Value"; cboSpiritDetection.DisplayMember = "Name"; cboSpiritDetection.DataSource = lstSpirit; // Populate the Magician Custom Spirits lists - Health. lstSpirit = new List<ListItem>(); objSpiritBlank = new ListItem(); objSpiritBlank.Value = ""; objSpiritBlank.Name = ""; lstSpirit.Add(objSpiritBlank); foreach (XmlNode objXmlSpirit in objXmlDocument.SelectNodes("/chummer/spirits/spirit")) { ListItem objItem = new ListItem(); objItem.Value = objXmlSpirit["name"].InnerText; if (objXmlSpirit["translate"] != null) objItem.Name = objXmlSpirit["translate"].InnerText; else objItem.Name = objXmlSpirit["name"].InnerText; lstSpirit.Add(objItem); } objSpiritSort = new SortListItem(); lstSpirit.Sort(objSpiritSort.Compare); cboSpiritHealth.ValueMember = "Value"; cboSpiritHealth.DisplayMember = "Name"; cboSpiritHealth.DataSource = lstSpirit; // Populate the Magician Custom Spirits lists - Illusion. lstSpirit = new List<ListItem>(); objSpiritBlank = new ListItem(); objSpiritBlank.Value = ""; objSpiritBlank.Name = ""; lstSpirit.Add(objSpiritBlank); foreach (XmlNode objXmlSpirit in objXmlDocument.SelectNodes("/chummer/spirits/spirit")) { ListItem objItem = new ListItem(); objItem.Value = objXmlSpirit["name"].InnerText; if (objXmlSpirit["translate"] != null) objItem.Name = objXmlSpirit["translate"].InnerText; else objItem.Name = objXmlSpirit["name"].InnerText; lstSpirit.Add(objItem); } objSpiritSort = new SortListItem(); lstSpirit.Sort(objSpiritSort.Compare); cboSpiritIllusion.ValueMember = "Value"; cboSpiritIllusion.DisplayMember = "Name"; cboSpiritIllusion.DataSource = lstSpirit; // Populate the Magician Custom Spirits lists - Manipulation. lstSpirit = new List<ListItem>(); objSpiritBlank = new ListItem(); objSpiritBlank.Value = ""; objSpiritBlank.Name = ""; lstSpirit.Add(objSpiritBlank); foreach (XmlNode objXmlSpirit in objXmlDocument.SelectNodes("/chummer/spirits/spirit")) { ListItem objItem = new ListItem(); objItem.Value = objXmlSpirit["name"].InnerText; if (objXmlSpirit["translate"] != null) objItem.Name = objXmlSpirit["translate"].InnerText; else objItem.Name = objXmlSpirit["name"].InnerText; lstSpirit.Add(objItem); } objSpiritSort = new SortListItem(); lstSpirit.Sort(objSpiritSort.Compare); cboSpiritManipulation.ValueMember = "Value"; cboSpiritManipulation.DisplayMember = "Name"; cboSpiritManipulation.DataSource = lstSpirit; // Populate the Technomancer Streams list. objXmlDocument = XmlManager.Instance.Load("streams.xml"); List<ListItem> lstStreams = new List<ListItem>(); lstStreams.Add(objBlank); foreach (XmlNode objXmlTradition in objXmlDocument.SelectNodes("/chummer/traditions/tradition[" + _objOptions.BookXPath() + "]")) { ListItem objItem = new ListItem(); objItem.Value = objXmlTradition["name"].InnerText; if (objXmlTradition["translate"] != null) objItem.Name = objXmlTradition["translate"].InnerText; else objItem.Name = objXmlTradition["name"].InnerText; lstStreams.Add(objItem); } lstStreams.Sort(objSort.Compare); cboStream.ValueMember = "Value"; cboStream.DisplayMember = "Name"; cboStream.DataSource = lstStreams; // Load the Metatype information before going anywhere else. Doing this later causes the Attributes to get messed up because of calls // to UpdateCharacterInformation(); MetatypeSelected(); // If the character is a Mystic Adept, set the values for the Mystic Adept NUD. int intCharacterMAG = _objCharacter.MAG.TotalValue; if (_objCharacter.AdeptEnabled && _objCharacter.MagicianEnabled) { lblMysticAdeptMAGAdept.Text = _objCharacter.MAGAdept.ToString(); intCharacterMAG = _objCharacter.MAGMagician; lblMysticAdeptAssignment.Visible = true; lblMysticAdeptMAGAdept.Visible = true; // cmdIncreasePowerPoints.Visible = true; } // Load the Skills information. objXmlDocument = XmlManager.Instance.Load("skills.xml"); List<ListItem> lstComplexFormSkills = new List<ListItem>(); // Populate the Skills Controls. XmlNodeList objXmlNodeList = objXmlDocument.SelectNodes("/chummer/skills/skill[" + _objCharacter.Options.BookXPath() + "]"); // Counter to keep track of the number of Controls that have been added to the Panel so we can determine their vertical positioning. int i = -1; foreach (Skill objSkill in _objCharacter.Skills) { if (!objSkill.KnowledgeSkill && !objSkill.ExoticSkill) { i++; SkillControl objSkillControl = new SkillControl(); objSkillControl.SkillObject = objSkill; // Attach an EventHandler for the RatingChanged and SpecializationChanged Events. objSkillControl.RatingChanged += objActiveSkill_RatingChanged; objSkillControl.SpecializationChanged += objSkill_SpecializationChanged; objSkillControl.SpecializationLeave += objSkill_SpecializationLeave; objSkillControl.SkillKarmaClicked += objSkill_KarmaClicked; objSkillControl.DiceRollerClicked += objSkill_DiceRollerClicked; objSkillControl.SkillName = objSkill.Name; objSkillControl.SkillCategory = objSkill.SkillCategory; objSkillControl.SkillGroup = objSkill.SkillGroup; objSkillControl.SkillRatingMaximum = objSkill.RatingMaximum; objSkillControl.SkillRating = objSkill.Rating; objSkillControl.SkillSpec = objSkill.Specialization; XmlNode objXmlSkill = objXmlDocument.SelectSingleNode("/chummer/skills/skill[name = \"" + objSkill.Name + "\"]"); // Populate the Skill's Specializations (if any). foreach (XmlNode objXmlSpecialization in objXmlSkill.SelectNodes("specs/spec")) { if (objXmlSpecialization.Attributes["translate"] != null) objSkillControl.AddSpec(objXmlSpecialization.Attributes["translate"].InnerText); else objSkillControl.AddSpec(objXmlSpecialization.InnerText); } // Set the control's vertical position and add it to the Skills Panel. objSkillControl.Width = 510; objSkillControl.AutoScroll = false; panActiveSkills.Controls.Add(objSkillControl); // Determine if this Skill should be added to the list of Skills for Comlex Form Tests. bool blnAddSkill = true; if (objSkill.Attribute == "MAG" || objSkill.SkillCategory == "Magical Active") blnAddSkill = false; if (blnAddSkill) { ListItem objItem = new ListItem(); objItem.Value = objSkill.Name; objItem.Name = objSkill.DisplayName; lstComplexFormSkills.Add(objItem); } } } // Exotic Skills. foreach (Skill objSkill in _objCharacter.Skills) { if (objSkill.ExoticSkill) { i++; SkillControl objSkillControl = new SkillControl(); objSkillControl.SkillObject = objSkill; // Attach an EventHandler for the RatingChanged and SpecializationChanged Events. objSkillControl.RatingChanged += objActiveSkill_RatingChanged; objSkillControl.SpecializationChanged += objSkill_SpecializationChanged; objSkillControl.SkillKarmaClicked += objSkill_KarmaClicked; objSkillControl.DiceRollerClicked += objSkill_DiceRollerClicked; objSkillControl.SkillName = objSkill.Name; objSkillControl.SkillCategory = objSkill.SkillCategory; objSkillControl.SkillGroup = objSkill.SkillGroup; objSkillControl.SkillRatingMaximum = objSkill.RatingMaximum; objSkillControl.SkillRating = objSkill.Rating; objSkillControl.SkillSpec = objSkill.Specialization; XmlNode objXmlSkill = objXmlDocument.SelectSingleNode("/chummer/skills/skill[name = \"" + objSkill.Name + "\"]"); // Populate the Skill's Specializations (if any). foreach (XmlNode objXmlSpecialization in objXmlSkill.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 = \"" + objSkill.Name + "s\" or useskill = \"" + objSkill.Name + "\"]"); foreach (XmlNode objXmlWeapon in objXmlWeaponList) { if (objXmlWeapon["translate"] != null) objSkillControl.AddSpec(objXmlWeapon["translate"].InnerText); else objSkillControl.AddSpec(objXmlWeapon["name"].InnerText); } // Set the control's vertical position and add it to the Skills Panel. objSkillControl.Top = i * objSkillControl.Height; objSkillControl.Width = 510; objSkillControl.AutoScroll = false; panActiveSkills.Controls.Add(objSkillControl); } } // Populate the Skill Groups list. i = -1; foreach (SkillGroup objGroup in _objCharacter.SkillGroups) { i++; SkillGroupControl objGroupControl = new SkillGroupControl(_objCharacter.Options, _objCharacter, true); objGroupControl.SkillGroupObject = objGroup; // Attach an EventHandler for the GetRatingChanged Event. objGroupControl.GroupRatingChanged += objGroup_RatingChanged; objGroupControl.GroupKarmaClicked += objGroup_KarmaClicked; // Populate the control, set its vertical position and add it to the Skill Groups Panel. A Skill Group cannot start with a Rating higher than 4. objGroupControl.GroupName = objGroup.Name; if (objGroup.Rating > objGroup.RatingMaximum) objGroup.RatingMaximum = objGroup.Rating; objGroupControl.GroupRatingMaximum = objGroup.RatingMaximum; objGroupControl.GroupRating = objGroup.Rating; objGroupControl.Top = i * objGroupControl.Height; objGroupControl.Width = 250; if (_objCharacter.Uneducated) { objGroupControl.IsEnabled = !objGroup.HasTechnicalSkills; } if (_objCharacter.Uncouth) { objGroupControl.IsEnabled = !objGroup.HasSocialSkills; } if (_objCharacter.Infirm) { objGroupControl.IsEnabled = !objGroup.HasPhysicalSkills; } panSkillGroups.Controls.Add(objGroupControl); } // Populate Knowledge Skills. i = -1; foreach (Skill objSkill in _objCharacter.Skills) { if (objSkill.KnowledgeSkill) { i++; SkillControl objSkillControl = new SkillControl(); objSkillControl.SkillObject = objSkill; // Attach an EventHandler for the RatingChanged and SpecializationChanged Events. objSkillControl.RatingChanged += objKnowledgeSkill_RatingChanged; objSkillControl.SpecializationChanged += objSkill_SpecializationChanged; objSkillControl.SpecializationLeave += objSkill_SpecializationLeave; objSkillControl.DeleteSkill += objKnowledgeSkill_DeleteSkill; objSkillControl.SkillKarmaClicked += objKnowledgeSkill_KarmaClicked; objSkillControl.DiceRollerClicked += objSkill_DiceRollerClicked; objSkillControl.KnowledgeSkill = true; objSkillControl.SkillCategory = objSkill.SkillCategory; objSkillControl.AllowDelete = true; objSkillControl.SkillRatingMaximum = objSkill.RatingMaximum; objSkillControl.SkillRating = objSkill.Rating; objSkillControl.SkillName = objSkill.Name; objSkillControl.SkillSpec = objSkill.Specialization; objSkillControl.Top = i * objSkillControl.Height; objSkillControl.AutoScroll = false; panKnowledgeSkills.Controls.Add(objSkillControl); } } // Populate Contacts and Enemies. int intContact = -1; int intEnemy = -1; foreach (Contact objContact in _objCharacter.Contacts) { if (objContact.EntityType == ContactType.Contact) { intContact++; ContactControl objContactControl = new ContactControl(_objCharacter); // Attach an EventHandler for the ConnectionRatingChanged, LoyaltyRatingChanged, DeleteContact, and FileNameChanged Events. objContactControl.ConnectionRatingChanged += objContact_ConnectionRatingChanged; objContactControl.LoyaltyRatingChanged += objContact_LoyaltyRatingChanged; objContactControl.DeleteContact += objContact_DeleteContact; objContactControl.FileNameChanged += objContact_FileNameChanged; objContactControl.ContactObject = objContact; objContactControl.ContactName = objContact.Name; objContactControl.ContactLocation = objContact.Location; objContactControl.ContactRole = objContact.Role; objContactControl.ConnectionRating = objContact.Connection; objContactControl.LoyaltyRating = objContact.Loyalty; objContactControl.EntityType = objContact.EntityType; objContactControl.BackColor = objContact.Colour; objContactControl.IsGroup = objContact.IsGroup; if (objContact.MadeMan) { objContactControl.IsGroup = objContact.MadeMan; } objContactControl.Top = intContact * objContactControl.Height; panContacts.Controls.Add(objContactControl); } if (objContact.EntityType == ContactType.Enemy) { intEnemy++; ContactControl objContactControl = new ContactControl(_objCharacter); // Attach an EventHandler for the ConnectioNRatingChanged, LoyaltyRatingChanged, DeleteContact, and FileNameChanged Events. objContactControl.ConnectionRatingChanged += objEnemy_ConnectionRatingChanged; objContactControl.LoyaltyRatingChanged += objEnemy_LoyaltyRatingChanged; objContactControl.DeleteContact += objEnemy_DeleteContact; objContactControl.FileNameChanged += objEnemy_FileNameChanged; objContactControl.IsEnemy = true; objContactControl.ContactObject = objContact; objContactControl.ContactName = objContact.Name; objContactControl.ContactLocation = objContact.Location; objContactControl.ContactRole = objContact.Role; objContactControl.ConnectionRating = objContact.Connection; objContactControl.LoyaltyRating = objContact.Loyalty; objContactControl.EntityType = objContact.EntityType; objContactControl.BackColor = objContact.Colour; objContactControl.IsGroup = objContact.IsGroup; objContactControl.Top = intEnemy * objContactControl.Height; panEnemies.Controls.Add(objContactControl); } if (objContact.EntityType == ContactType.Pet) { PetControl objContactControl = new PetControl(); // Attach an EventHandler for the DeleteContact and FileNameChanged Events. objContactControl.DeleteContact += objPet_DeleteContact; objContactControl.FileNameChanged += objPet_FileNameChanged; objContactControl.ContactObject = objContact; objContactControl.ContactName = objContact.Name; objContactControl.BackColor = objContact.Colour; panPets.Controls.Add(objContactControl); } } // Populate Armor. // Start by populating Locations. foreach (string strLocation in _objCharacter.ArmorBundles) { TreeNode objLocation = new TreeNode(); objLocation.Tag = strLocation; objLocation.Text = strLocation; objLocation.ContextMenuStrip = cmsArmorLocation; treArmor.Nodes.Add(objLocation); } foreach (Armor objArmor in _objCharacter.Armor) { _objFunctions.CreateArmorTreeNode(objArmor, treArmor, cmsArmor, cmsArmorMod, cmsArmorGear); } // Populate Weapons. // Start by populating Locations. foreach (string strLocation in _objCharacter.WeaponLocations) { TreeNode objLocation = new TreeNode(); objLocation.Tag = strLocation; objLocation.Text = strLocation; objLocation.ContextMenuStrip = cmsWeaponLocation; treWeapons.Nodes.Add(objLocation); } foreach (Weapon objWeapon in _objCharacter.Weapons) { _objFunctions.CreateWeaponTreeNode(objWeapon, treWeapons.Nodes[0], cmsWeapon, cmsWeaponMod, cmsWeaponAccessory, cmsWeaponAccessoryGear); } PopulateCyberware(); // Populate Spell list. foreach (Spell objSpell in _objCharacter.Spells) { TreeNode objNode = new TreeNode(); objNode.Text = objSpell.DisplayName; objNode.Tag = objSpell.InternalId; objNode.ContextMenuStrip = cmsSpell; if (objSpell.Notes != string.Empty) objNode.ForeColor = Color.SaddleBrown; objNode.ToolTipText = objSpell.Notes; switch (objSpell.Category) { case "Combat": treSpells.Nodes[0].Nodes.Add(objNode); treSpells.Nodes[0].Expand(); break; case "Detection": treSpells.Nodes[1].Nodes.Add(objNode); treSpells.Nodes[1].Expand(); break; case "Health": treSpells.Nodes[2].Nodes.Add(objNode); treSpells.Nodes[2].Expand(); break; case "Illusion": treSpells.Nodes[3].Nodes.Add(objNode); treSpells.Nodes[3].Expand(); break; case "Manipulation": treSpells.Nodes[4].Nodes.Add(objNode); treSpells.Nodes[4].Expand(); break; case "Rituals": int intNode = 5; if (_objCharacter.AdeptEnabled && !_objCharacter.MagicianEnabled) intNode = 0; treSpells.Nodes[intNode].Nodes.Add(objNode); treSpells.Nodes[intNode].Expand(); break; case "Enchantments": treSpells.Nodes[6].Nodes.Add(objNode); treSpells.Nodes[6].Expand(); break; } } // Populate Adept Powers. i = -1; foreach (Power objPower in _objCharacter.Powers) { i++; PowerControl objPowerControl = new PowerControl(); objPowerControl.PowerObject = objPower; // Attach an EventHandler for the PowerRatingChanged Event. objPowerControl.PowerRatingChanged += objPower_PowerRatingChanged; objPowerControl.DeletePower += objPower_DeletePower; objPowerControl.PowerName = objPower.Name; objPowerControl.Extra = objPower.Extra; objPowerControl.PointsPerLevel = objPower.PointsPerLevel; objPowerControl.AdeptWayDiscount = objPower.AdeptWayDiscount; objPowerControl.LevelEnabled = objPower.LevelsEnabled; if (objPower.MaxLevels > 0) objPowerControl.MaxLevels = objPower.MaxLevels; objPowerControl.RefreshMaximum(_objCharacter.MAG.TotalValue); if (objPower.Rating < 1) objPower.Rating = 1; objPowerControl.PowerLevel = Convert.ToInt32(objPower.Rating); if (objPower.DiscountedAdeptWay) objPowerControl.DiscountedByAdeptWay = true; if (objPower.DiscountedGeas) objPowerControl.DiscountedByGeas = true; objPowerControl.Top = i * objPowerControl.Height; panPowers.Controls.Add(objPowerControl); } // Populate Magician Spirits. i = -1; foreach (Spirit objSpirit in _objCharacter.Spirits) { if (objSpirit.EntityType == SpiritType.Spirit) { i++; SpiritControl objSpiritControl = new SpiritControl(true); objSpiritControl.SpiritObject = objSpirit; // Attach an EventHandler for the ServicesOwedChanged Event. objSpiritControl.ServicesOwedChanged += objSpirit_ServicesOwedChanged; objSpiritControl.ForceChanged += objSpirit_ForceChanged; objSpiritControl.BoundChanged += objSpirit_BoundChanged; objSpiritControl.DeleteSpirit += objSpirit_DeleteSpirit; objSpiritControl.FileNameChanged += objSpirit_FileNameChanged; objSpiritControl.SpiritName = objSpirit.Name; objSpiritControl.ServicesOwed = objSpirit.ServicesOwed; if (_objOptions.SpiritForceBasedOnTotalMAG) objSpiritControl.ForceMaximum = _objCharacter.MAG.TotalValue * 2; else objSpiritControl.ForceMaximum = intCharacterMAG * 2; objSpiritControl.CritterName = objSpirit.CritterName; objSpiritControl.Force = objSpirit.Force; objSpiritControl.Bound = objSpirit.Bound; objSpiritControl.RebuildSpiritList(_objCharacter.MagicTradition); objSpiritControl.Top = i * objSpiritControl.Height; panSpirits.Controls.Add(objSpiritControl); } } // Populate Technomancer Sprites. i = -1; foreach (Spirit objSpirit in _objCharacter.Spirits) { if (objSpirit.EntityType == SpiritType.Sprite) { i++; SpiritControl objSpiritControl = new SpiritControl(true); objSpiritControl.SpiritObject = objSpirit; objSpiritControl.EntityType = SpiritType.Sprite; // Attach an EventHandler for the ServicesOwedChanged Event. objSpiritControl.ServicesOwedChanged += objSprite_ServicesOwedChanged; objSpiritControl.ForceChanged += objSprite_ForceChanged; objSpiritControl.BoundChanged += objSprite_BoundChanged; objSpiritControl.DeleteSpirit += objSprite_DeleteSpirit; objSpiritControl.FileNameChanged += objSprite_FileNameChanged; objSpiritControl.SpiritName = objSpirit.Name; objSpiritControl.ServicesOwed = objSpirit.ServicesOwed; objSpiritControl.ForceMaximum = _objCharacter.RES.TotalValue * 2; objSpiritControl.CritterName = objSpirit.CritterName; objSpiritControl.Force = objSpirit.Force; objSpiritControl.Bound = objSpirit.Bound; objSpiritControl.RebuildSpiritList(_objCharacter.TechnomancerStream); objSpiritControl.Top = i * objSpiritControl.Height; panSprites.Controls.Add(objSpiritControl); } } // Populate Technomancer Complex Forms/Programs. foreach (ComplexForm objProgram in _objCharacter.ComplexForms) { TreeNode objNode = new TreeNode(); objNode.Text = objProgram.DisplayName; objNode.Tag = objProgram.InternalId; if (objProgram.Notes != string.Empty) objNode.ForeColor = Color.SaddleBrown; objNode.ToolTipText = objProgram.Notes; treComplexForms.Nodes[0].Nodes.Add(objNode); treComplexForms.Nodes[0].Expand(); } // Populate Martial Arts. foreach (MartialArt objMartialArt in _objCharacter.MartialArts) { TreeNode objMartialArtNode = new TreeNode(); objMartialArtNode.Text = objMartialArt.DisplayName; objMartialArtNode.Tag = objMartialArt.Name; objMartialArtNode.ContextMenuStrip = cmsMartialArts; if (objMartialArt.Notes != string.Empty) objMartialArtNode.ForeColor = Color.SaddleBrown; objMartialArtNode.ToolTipText = objMartialArt.Notes; foreach (MartialArtAdvantage objAdvantage in objMartialArt.Advantages) { TreeNode objAdvantageNode = new TreeNode(); objAdvantageNode.Text = objAdvantage.DisplayName; objAdvantageNode.Tag = objAdvantage.InternalId; objAdvantageNode.ContextMenuStrip = cmsTechnique; if (objAdvantage.Notes != string.Empty) objAdvantageNode.ForeColor = Color.SaddleBrown; else objAdvantageNode.ForeColor = SystemColors.WindowText; objAdvantageNode.ToolTipText = objAdvantage.Notes; objMartialArtNode.Nodes.Add(objAdvantageNode); objMartialArtNode.Expand(); } treMartialArts.Nodes[0].Nodes.Add(objMartialArtNode); treMartialArts.Nodes[0].Expand(); } // Populate Martial Art Maneuvers. foreach (MartialArtManeuver objManeuver in _objCharacter.MartialArtManeuvers) { TreeNode objManeuverNode = new TreeNode(); objManeuverNode.Text = objManeuver.DisplayName; objManeuverNode.Tag = objManeuver.InternalId; objManeuverNode.ContextMenuStrip = cmsMartialArtManeuver; if (objManeuver.Notes != string.Empty) objManeuverNode.ForeColor = Color.SaddleBrown; objManeuverNode.ToolTipText = objManeuver.Notes; treMartialArts.Nodes[1].Nodes.Add(objManeuverNode); treMartialArts.Nodes[1].Expand(); } // Populate Limit Modifiers. foreach (LimitModifier objLimitModifier in _objCharacter.LimitModifiers) { TreeNode objLimitModifierNode = new TreeNode(); objLimitModifierNode.Text = objLimitModifier.DisplayName; objLimitModifierNode.Tag = objLimitModifier.Name; objLimitModifierNode.ContextMenuStrip = cmsMartialArts; if (objLimitModifier.Notes != string.Empty) objLimitModifierNode.ForeColor = Color.SaddleBrown; objLimitModifierNode.ToolTipText = objLimitModifier.Notes; objLimitModifierNode.ContextMenuStrip = cmsLimitModifier; switch (objLimitModifier.Limit) { case "Physical": treLimit.Nodes[0].Nodes.Add(objLimitModifierNode); treLimit.Nodes[0].Expand(); break; case "Mental": treLimit.Nodes[1].Nodes.Add(objLimitModifierNode); treLimit.Nodes[1].Expand(); break; case "Social": treLimit.Nodes[2].Nodes.Add(objLimitModifierNode); treLimit.Nodes[2].Expand(); break; } } // Populate Lifestyles. foreach (Lifestyle objLifestyle in _objCharacter.Lifestyles) { TreeNode objLifestyleNode = new TreeNode(); objLifestyleNode.Text = objLifestyle.DisplayName; objLifestyleNode.Tag = objLifestyle.InternalId; if (objLifestyle.BaseLifestyle != "") objLifestyleNode.ContextMenuStrip = cmsAdvancedLifestyle; else objLifestyleNode.ContextMenuStrip = cmsLifestyleNotes; if (objLifestyle.Notes != string.Empty) objLifestyleNode.ForeColor = Color.SaddleBrown; objLifestyleNode.ToolTipText = objLifestyle.Notes; treLifestyles.Nodes[0].Nodes.Add(objLifestyleNode); } treLifestyles.Nodes[0].Expand(); PopulateGearList(); // Populate Foci. _objController.PopulateFocusList(treFoci); // Populate Vehicles. foreach (Vehicle objVehicle in _objCharacter.Vehicles) { _objFunctions.CreateVehicleTreeNode(objVehicle, treVehicles, cmsVehicle, cmsVehicleLocation, cmsVehicleWeapon, cmsVehicleWeaponMod, cmsVehicleWeaponAccessory, cmsVehicleWeaponAccessoryGear, cmsVehicleGear); } UpdateInitiationGradeTree(); if (_objCharacter.MagicTradition != "") { objXmlDocument = XmlManager.Instance.Load("traditions.xml"); XmlNode objXmlTradition = objXmlDocument.SelectSingleNode("/chummer/traditions/tradition[name = \"" + _objCharacter.MagicTradition + "\"]"); lblDrainAttributes.Text = objXmlTradition["drain"].InnerText; // Update the Drain Attribute Value. try { XPathNavigator nav = objXmlDocument.CreateNavigator(); string strDrain = lblDrainAttributes.Text.Replace(LanguageManager.Instance.GetString("String_AttributeBODShort"), _objCharacter.BOD.Value.ToString()); strDrain = strDrain.Replace(LanguageManager.Instance.GetString("String_AttributeAGIShort"), _objCharacter.AGI.Value.ToString()); strDrain = strDrain.Replace(LanguageManager.Instance.GetString("String_AttributeREAShort"), _objCharacter.REA.Value.ToString()); strDrain = strDrain.Replace(LanguageManager.Instance.GetString("String_AttributeSTRShort"),_objCharacter.STR.Value.ToString()); strDrain = strDrain.Replace(LanguageManager.Instance.GetString("String_AttributeCHAShort"), _objCharacter.CHA.Value.ToString()); strDrain = strDrain.Replace(LanguageManager.Instance.GetString("String_AttributeINTShort"), _objCharacter.INT.Value.ToString()); strDrain = strDrain.Replace(LanguageManager.Instance.GetString("String_AttributeLOGShort"), _objCharacter.LOG.Value.ToString()); strDrain = strDrain.Replace(LanguageManager.Instance.GetString("String_AttributeWILShort"), _objCharacter.WIL.Value.ToString()); strDrain = strDrain.Replace(LanguageManager.Instance.GetString("String_AttributeMAGShort"), _objCharacter.MAG.TotalValue.ToString()); XPathExpression xprDrain = nav.Compile(strDrain); int intDrain = Convert.ToInt32(nav.Evaluate(xprDrain).ToString()); intDrain += _objImprovementManager.ValueOf(Improvement.ImprovementType.DrainResistance); lblDrainAttributesValue.Text = intDrain.ToString(); } catch { } } if (_objCharacter.TechnomancerStream != "") { objXmlDocument = XmlManager.Instance.Load("streams.xml"); XmlNode objXmlTradition = objXmlDocument.SelectSingleNode("/chummer/traditions/tradition[name = \"" + _objCharacter.TechnomancerStream + "\"]"); lblFadingAttributes.Text = objXmlTradition["drain"].InnerText; // Update the Fading Attribute Value. try { XPathNavigator nav = objXmlDocument.CreateNavigator(); string strFading = lblFadingAttributes.Text.Replace(LanguageManager.Instance.GetString("String_AttributeBODShort"), _objCharacter.BOD.Value.ToString()); strFading = strFading.Replace(LanguageManager.Instance.GetString("String_AttributeAGIShort"), _objCharacter.AGI.Value.ToString()); strFading = strFading.Replace(LanguageManager.Instance.GetString("String_AttributeREAShort"), _objCharacter.REA.Value.ToString()); strFading = strFading.Replace(LanguageManager.Instance.GetString("String_AttributeSTRShort"), _objCharacter.STR.Value.ToString()); strFading = strFading.Replace(LanguageManager.Instance.GetString("String_AttributeCHAShort"), _objCharacter.CHA.Value.ToString()); strFading = strFading.Replace(LanguageManager.Instance.GetString("String_AttributeINTShort"), _objCharacter.INT.Value.ToString()); strFading = strFading.Replace(LanguageManager.Instance.GetString("String_AttributeLOGShort"), _objCharacter.LOG.Value.ToString()); strFading = strFading.Replace(LanguageManager.Instance.GetString("String_AttributeWILShort"), _objCharacter.WIL.Value.ToString()); strFading = strFading.Replace(LanguageManager.Instance.GetString("String_AttributeRESShort"), _objCharacter.RES.TotalValue.ToString()); XPathExpression xprFading = nav.Compile(strFading); int intFading = Convert.ToInt32(nav.Evaluate(xprFading).ToString()); intFading += _objImprovementManager.ValueOf(Improvement.ImprovementType.FadingResistance); lblFadingAttributesValue.Text = intFading.ToString(); } catch { } } // Populate Critter Powers. foreach (CritterPower objPower in _objCharacter.CritterPowers) { TreeNode objNode = new TreeNode(); objNode.Text = objPower.DisplayName; objNode.Tag = objPower.InternalId; objNode.ContextMenuStrip = cmsCritterPowers; if (objPower.Notes != string.Empty) objNode.ForeColor = Color.SaddleBrown; objNode.ToolTipText = objPower.Notes; if (objPower.Category != "Weakness") { treCritterPowers.Nodes[0].Nodes.Add(objNode); treCritterPowers.Nodes[0].Expand(); } else { treCritterPowers.Nodes[1].Nodes.Add(objNode); treCritterPowers.Nodes[1].Expand(); } } _blnLoading = false; // Select the Magician's Tradition. if (_objCharacter.MagicTradition != "") cboTradition.SelectedValue = _objCharacter.MagicTradition; if (_objCharacter.TraditionName != "") txtTraditionName.Text = _objCharacter.TraditionName; if (_objCharacter.TraditionDrain != "") cboDrain.SelectedValue = _objCharacter.TraditionDrain; if (_objCharacter.SpiritCombat != "") cboSpiritCombat.SelectedValue = _objCharacter.SpiritCombat; if (_objCharacter.SpiritDetection != "") cboSpiritDetection.SelectedValue = _objCharacter.SpiritDetection; if (_objCharacter.SpiritHealth != "") cboSpiritHealth.SelectedValue = _objCharacter.SpiritHealth; if (_objCharacter.SpiritIllusion != "") cboSpiritIllusion.SelectedValue = _objCharacter.SpiritIllusion; if (_objCharacter.SpiritManipulation != "") cboSpiritManipulation.SelectedValue = _objCharacter.SpiritManipulation; // Select the Technomancer's Stream. if (_objCharacter.TechnomancerStream != "") cboStream.SelectedValue = _objCharacter.TechnomancerStream; // Clear the Dirty flag which gets set when creating a new Character. _blnIsDirty = false; UpdateWindowTitle(); if (_objCharacter.AdeptEnabled) CalculatePowerPoints(); treGear.ItemDrag += treGear_ItemDrag; treGear.DragEnter += treGear_DragEnter; treGear.DragDrop += treGear_DragDrop; treLifestyles.ItemDrag += treLifestyles_ItemDrag; treLifestyles.DragEnter += treLifestyles_DragEnter; treLifestyles.DragDrop += treLifestyles_DragDrop; treArmor.ItemDrag += treArmor_ItemDrag; treArmor.DragEnter += treArmor_DragEnter; treArmor.DragDrop += treArmor_DragDrop; treWeapons.ItemDrag += treWeapons_ItemDrag; treWeapons.DragEnter += treWeapons_DragEnter; treWeapons.DragDrop += treWeapons_DragDrop; treVehicles.ItemDrag += treVehicles_ItemDrag; treVehicles.DragEnter += treVehicles_DragEnter; treVehicles.DragDrop += treVehicles_DragDrop; treImprovements.ItemDrag += treImprovements_ItemDrag; treImprovements.DragEnter += treImprovements_DragEnter; treImprovements.DragDrop += treImprovements_DragDrop; // Merge the ToolStrips. ToolStripManager.RevertMerge("toolStrip"); ToolStripManager.Merge(toolStrip, "toolStrip"); // If this is a Sprite, re-label the Mental Attribute Labels. if (_objCharacter.Metatype.EndsWith("Sprite")) { lblBODLabel.Enabled = false; lblAGILabel.Enabled = false; lblREALabel.Enabled = false; lblSTRLabel.Enabled = false; lblCHALabel.Text = LanguageManager.Instance.GetString("String_AttributePilot"); lblINTLabel.Text = LanguageManager.Instance.GetString("String_AttributeResponse"); lblLOGLabel.Text = LanguageManager.Instance.GetString("String_AttributeFirewall"); lblWILLabel.Enabled = false; } else if (_objCharacter.Metatype.EndsWith("A.I.") || _objCharacter.MetatypeCategory == "Technocritters" || _objCharacter.MetatypeCategory == "Protosapients") { lblRatingLabel.Visible = true; lblRating.Visible = true; lblSystemLabel.Visible = true; lblSystem.Visible = true; lblFirewallLabel.Visible = true; lblFirewall.Visible = true; lblResponseLabel.Visible = true; nudResponse.Visible = true; nudResponse.Enabled = true; nudResponse.Value = _objCharacter.Response; lblSignalLabel.Visible = true; nudSignal.Visible = true; nudSignal.Enabled = true; nudSignal.Value = _objCharacter.Signal; } mnuSpecialConvertToFreeSprite.Visible = _objCharacter.IsSprite; // Run through all of the Skills and Enable/Disable them as needed. foreach (SkillControl objSkillControl in panActiveSkills.Controls) { if (objSkillControl.Attribute == "MAG") objSkillControl.Enabled = _objCharacter.MAGEnabled; if (objSkillControl.Attribute == "RES") objSkillControl.Enabled = _objCharacter.RESEnabled; } // Run through all of the Skill Groups and Disable them if all of their Skills are currently inaccessible. foreach (SkillGroupControl objSkillGroupControl in panSkillGroups.Controls) { bool blnEnabled = false; foreach (Skill objSkill in _objCharacter.Skills) { if (objSkill.SkillGroup == objSkillGroupControl.GroupName) { if (objSkill.Attribute == "MAG" || objSkill.Attribute == "RES") { if (objSkill.Attribute == "MAG" && _objCharacter.MAGEnabled) blnEnabled = true; if (objSkill.Attribute == "RES" && _objCharacter.RESEnabled) blnEnabled = true; } else blnEnabled = true; } } objSkillGroupControl.IsEnabled = blnEnabled; if (!blnEnabled) objSkillGroupControl.GroupRating = 0; } // Populate the Skill Filter DropDown. List<ListItem> lstFilter = new List<ListItem>(); ListItem itmAll = new ListItem(); itmAll.Value = "0"; itmAll.Name = LanguageManager.Instance.GetString("String_SkillFilterAll"); ListItem itmRatingAboveZero = new ListItem(); itmRatingAboveZero.Value = "1"; itmRatingAboveZero.Name = LanguageManager.Instance.GetString("String_SkillFilterRatingAboveZero"); ListItem itmTotalRatingAboveZero = new ListItem(); itmTotalRatingAboveZero.Value = "2"; itmTotalRatingAboveZero.Name = LanguageManager.Instance.GetString("String_SkillFilterTotalRatingAboveZero"); ListItem itmRatingEqualZero = new ListItem(); itmRatingEqualZero.Value = "3"; itmRatingEqualZero.Name = LanguageManager.Instance.GetString("String_SkillFilterRatingZero"); lstFilter.Add(itmAll); lstFilter.Add(itmRatingAboveZero); lstFilter.Add(itmTotalRatingAboveZero); lstFilter.Add(itmRatingEqualZero); objXmlDocument = XmlManager.Instance.Load("skills.xml"); objXmlNodeList = objXmlDocument.SelectNodes("/chummer/categories/category[@type = \"active\"]"); foreach (XmlNode objNode in objXmlNodeList) { ListItem objItem = new ListItem(); objItem.Value = objNode.InnerText; if (objNode.Attributes["translate"] != null) objItem.Name = LanguageManager.Instance.GetString("Label_Category") + " " + objNode.Attributes["translate"].InnerText; else objItem.Name = LanguageManager.Instance.GetString("Label_Category") + " " + objNode.InnerText; lstFilter.Add(objItem); } // Add items for Attributes. ListItem itmBOD = new ListItem(); itmBOD.Value = "BOD"; itmBOD.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeBODShort"); ListItem itmAGI = new ListItem(); itmAGI.Value = "AGI"; itmAGI.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeAGIShort"); ListItem itmREA = new ListItem(); itmREA.Value = "REA"; itmREA.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeREAShort"); ListItem itmSTR = new ListItem(); itmSTR.Value = "STR"; itmSTR.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeSTRShort"); ListItem itmCHA = new ListItem(); itmCHA.Value = "CHA"; itmCHA.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeCHAShort"); ListItem itmINT = new ListItem(); itmINT.Value = "INT"; itmINT.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeINTShort"); ListItem itmLOG = new ListItem(); itmLOG.Value = "LOG"; itmLOG.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeLOGShort"); ListItem itmWIL = new ListItem(); itmWIL.Value = "WIL"; itmWIL.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeWILShort"); ListItem itmMAG = new ListItem(); itmMAG.Value = "MAG"; itmMAG.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeMAGShort"); ListItem itmRES = new ListItem(); itmRES.Value = "RES"; itmRES.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeRESShort"); lstFilter.Add(itmBOD); lstFilter.Add(itmAGI); lstFilter.Add(itmREA); lstFilter.Add(itmSTR); lstFilter.Add(itmCHA); lstFilter.Add(itmINT); lstFilter.Add(itmLOG); lstFilter.Add(itmWIL); lstFilter.Add(itmMAG); lstFilter.Add(itmRES); // Add Skill Groups to the filter. objXmlNodeList = objXmlDocument.SelectNodes("/chummer/categories/category[@type = \"active\"]"); foreach (SkillGroup objGroup in _objCharacter.SkillGroups) { ListItem itmGroup = new ListItem(); itmGroup.Value = "GROUP:" + objGroup.Name; itmGroup.Name = LanguageManager.Instance.GetString("String_ExpenseSkillGroup") + ": " + objGroup.DisplayName; lstFilter.Add(itmGroup); } cboSkillFilter.DataSource = lstFilter; cboSkillFilter.ValueMember = "Value"; cboSkillFilter.DisplayMember = "Name"; cboSkillFilter.SelectedIndex = 0; cboSkillFilter_SelectedIndexChanged(null, null); // If the option to re-group Skill Groups is enabled, run through the Skill Groups and see if they can be re-enabled. if (_objOptions.AllowSkillRegrouping) { foreach (SkillGroupControl objSkillGroupControl in panSkillGroups.Controls) { bool blnBroken = false; int intRating = -1; if (objSkillGroupControl.Broken) { foreach (SkillControl objControl in panActiveSkills.Controls) { if (objControl.SkillGroup == objSkillGroupControl.GroupName) { if (objControl.SkillRating > 5) blnBroken = true; if (intRating == -1) intRating = objControl.SkillRating; if (objControl.SkillRating != intRating) blnBroken = true; if (objControl.SkillSpec != string.Empty) blnBroken = true; } } if (!blnBroken) { objSkillGroupControl.Broken = false; objSkillGroupControl.GroupRating = intRating; } } } } if (_objCharacter.MetatypeCategory == "Cyberzombie") mnuSpecialCyberzombie.Visible = false; // Determine if the Critter should have access to the Possession menu item. bool blnAllowPossession = false; foreach (CritterPower objCritterPower in _objCharacter.CritterPowers) { if (objCritterPower.Name == "Inhabitation" || objCritterPower.Name == "Possession") { blnAllowPossession = true; break; } } mnuSpecialPossess.Visible = blnAllowPossession; // Set the visibility of the Armor Degradation buttons. cmdArmorDecrease.Visible = _objOptions.ArmorDegradation; cmdArmorIncrease.Visible = _objOptions.ArmorDegradation; _objFunctions.SortTree(treCyberware); _objFunctions.SortTree(treSpells); _objFunctions.SortTree(treComplexForms); _objFunctions.SortTree(treQualities); _objFunctions.SortTree(treCritterPowers); _objFunctions.SortTree(treMartialArts); UpdateMentorSpirits(); UpdateInitiationGradeTree(); PopulateCalendar(); RefreshImprovements(); UpdateCharacterInfo(); _blnIsDirty = false; UpdateWindowTitle(false); RefreshPasteStatus(); // Stupid hack to get the MDI icon to show up properly. this.Icon = this.Icon.Clone() as System.Drawing.Icon; }
private void frmCreate_Load(object sender, EventArgs e) { _blnLoading = true; if (!_objCharacter.IsCritter && (_objCharacter.BuildMethod == CharacterBuildMethod.BP && _objCharacter.BuildPoints == 0) || (_objCharacter.BuildMethod == CharacterBuildMethod.Karma && _objCharacter.BuildKarma == 0)) { _blnFreestyle = true; } // Set the Statusbar Labels if we're using Karma to build. if (_objCharacter.BuildMethod == CharacterBuildMethod.Karma) { tabBPSummary.Text = LanguageManager.Instance.GetString("Tab_BPSummary_Karma"); lblQualityBPLabel.Text = LanguageManager.Instance.GetString("Label_Karma"); } // Remove the Magician, Adept, and Technomancer tabs since they are not in use until the appropriate Quality is selected. if (!_objCharacter.MagicianEnabled) tabCharacterTabs.TabPages.Remove(tabMagician); if (!_objCharacter.AdeptEnabled) tabCharacterTabs.TabPages.Remove(tabAdept); if (!_objCharacter.TechnomancerEnabled) tabCharacterTabs.TabPages.Remove(tabTechnomancer); if (!_objCharacter.CritterEnabled) tabCharacterTabs.TabPages.Remove(tabCritter); if (_objCharacter.BlackMarket) { chkCyberwareBlackMarketDiscount.Visible = true; chkArmorBlackMarketDiscount.Visible = true; chkWeaponBlackMarketDiscount.Visible = true; chkGearBlackMarketDiscount.Visible = true; chkVehicleBlackMarketDiscount.Visible = true; } if (_objCharacter.BuildMethod == CharacterBuildMethod.Karma) { if (!_objCharacter.MAGEnabled && !_objCharacter.RESEnabled) tabCharacterTabs.TabPages.Remove(tabInitiation); else { if (_objCharacter.MAGEnabled) { tabInitiation.Text = LanguageManager.Instance.GetString("Tab_Initiation"); lblInitiateGradeLabel.Text = LanguageManager.Instance.GetString("Label_InitiationGrade"); cmdAddMetamagic.Text = LanguageManager.Instance.GetString("Button_AddMetamagic"); chkInitiationGroup.Text = LanguageManager.Instance.GetString("Checkbox_GroupInitiation"); chkInitiationOrdeal.Text = LanguageManager.Instance.GetString("Checkbox_InitiationOrdeal"); chkJoinGroup.Text = LanguageManager.Instance.GetString("Checkbox_JoinedGroup"); chkJoinGroup.Checked = _objCharacter.GroupMember; txtGroupName.Text = _objCharacter.GroupName; txtGroupNotes.Text = _objCharacter.GroupNotes; } else { tabInitiation.Text = LanguageManager.Instance.GetString("Tab_Submersion"); lblInitiateGradeLabel.Text = LanguageManager.Instance.GetString("Label_SubmersionGrade"); cmdAddMetamagic.Text = LanguageManager.Instance.GetString("Button_AddEcho"); chkInitiationGroup.Text = LanguageManager.Instance.GetString("Checkbox_NetworkSubmersion"); chkInitiationOrdeal.Text = LanguageManager.Instance.GetString("Checkbox_SubmersionTask"); chkJoinGroup.Text = LanguageManager.Instance.GetString("Checkbox_JoinedNetwork"); chkJoinGroup.Checked = _objCharacter.GroupMember; txtGroupName.Text = _objCharacter.GroupName; txtGroupNotes.Text = _objCharacter.GroupNotes; } } } else { if (!_objCharacter.InitiationEnabled) tabCharacterTabs.TabPages.Remove(tabInitiation); } // If the character has a mugshot, decode it and put it in the PictureBox. if (_objCharacter.Mugshot != "") { byte[] bytImage = Convert.FromBase64String(_objCharacter.Mugshot); MemoryStream objStream = new MemoryStream(bytImage, 0, bytImage.Length); objStream.Write(bytImage, 0, bytImage.Length); Image imgMugshot = Image.FromStream(objStream, true); picMugshot.Image = imgMugshot; } // Populate character information fields. XmlDocument objMetatypeDoc = new XmlDocument(); XmlNode objMetatypeNode; string strMetatype = ""; string strBook = ""; string strPage = ""; objMetatypeDoc = XmlManager.Instance.Load("metatypes.xml"); { objMetatypeNode = objMetatypeDoc.SelectSingleNode("/chummer/metatypes/metatype[name = \"" + _objCharacter.Metatype + "\"]"); if (objMetatypeNode == null) objMetatypeDoc = XmlManager.Instance.Load("critters.xml"); objMetatypeNode = objMetatypeDoc.SelectSingleNode("/chummer/metatypes/metatype[name = \"" + _objCharacter.Metatype + "\"]"); if (objMetatypeNode["translate"] != null) strMetatype = objMetatypeNode["translate"].InnerText; else strMetatype = _objCharacter.Metatype; strBook = _objOptions.LanguageBookShort(objMetatypeNode["source"].InnerText); if (objMetatypeNode["altpage"] != null) strPage = objMetatypeNode["altpage"].InnerText; else strPage = objMetatypeNode["page"].InnerText; if (_objCharacter.Metavariant != "") { objMetatypeNode = objMetatypeNode.SelectSingleNode("metavariants/metavariant[name = \"" + _objCharacter.Metavariant + "\"]"); if (objMetatypeNode["translate"] != null) strMetatype += " (" + objMetatypeNode["translate"].InnerText + ")"; else strMetatype += " (" + _objCharacter.Metavariant + ")"; strBook = _objOptions.LanguageBookShort(objMetatypeNode["source"].InnerText); if (objMetatypeNode["altpage"] != null) strPage = objMetatypeNode["altpage"].InnerText; else strPage = objMetatypeNode["page"].InnerText; } } lblMetatype.Text = strMetatype; lblMetatypeSource.Text = strBook + " " + strPage; txtCharacterName.Text = _objCharacter.Name; txtSex.Text = _objCharacter.Sex; txtAge.Text = _objCharacter.Age; txtEyes.Text = _objCharacter.Eyes; txtHeight.Text = _objCharacter.Height; txtWeight.Text = _objCharacter.Weight; txtSkin.Text = _objCharacter.Skin; txtHair.Text = _objCharacter.Hair; txtDescription.Text = _objCharacter.Description; txtBackground.Text = _objCharacter.Background; txtConcept.Text = _objCharacter.Concept; txtNotes.Text = _objCharacter.Notes; txtAlias.Text = _objCharacter.Alias; txtPlayerName.Text = _objCharacter.PlayerName; // Check for Special Attributes. lblMAGLabel.Enabled = _objCharacter.MAGEnabled; lblMAGAug.Enabled = _objCharacter.MAGEnabled; nudMAG.Enabled = _objCharacter.MAGEnabled; lblMAGMetatype.Enabled = _objCharacter.MAGEnabled; lblFoci.Visible = _objCharacter.MAGEnabled; treFoci.Visible = _objCharacter.MAGEnabled; cmdCreateStackedFocus.Visible = _objCharacter.MAGEnabled; lblRESLabel.Enabled = _objCharacter.RESEnabled; lblRESAug.Enabled = _objCharacter.RESEnabled; nudRES.Enabled = _objCharacter.RESEnabled; lblRESMetatype.Enabled = _objCharacter.RESEnabled; // Define the XML objects that will be used. XmlDocument objXmlDocument = new XmlDocument(); // Populate the Qualities list. foreach (Quality objQuality in _objCharacter.Qualities) { TreeNode objNode = new TreeNode(); objNode.Text = objQuality.DisplayName; objNode.Tag = objQuality.InternalId; objNode.ContextMenuStrip = cmsQuality; if (objQuality.Notes != string.Empty) objNode.ForeColor = Color.SaddleBrown; else { if (objQuality.OriginSource == QualitySource.Metatype || objQuality.OriginSource == QualitySource.MetatypeRemovable) objNode.ForeColor = SystemColors.GrayText; } objNode.ToolTipText = objQuality.Notes; if (objQuality.Type == QualityType.Positive) { treQualities.Nodes[0].Nodes.Add(objNode); treQualities.Nodes[0].Expand(); } else { treQualities.Nodes[1].Nodes.Add(objNode); treQualities.Nodes[1].Expand(); } } // Populate the Magician Traditions list. objXmlDocument = XmlManager.Instance.Load("traditions.xml"); List<ListItem> lstTraditions = new List<ListItem>(); ListItem objBlank = new ListItem(); objBlank.Value = ""; objBlank.Name = ""; lstTraditions.Add(objBlank); foreach (XmlNode objXmlTradition in objXmlDocument.SelectNodes("/chummer/traditions/tradition[" + _objOptions.BookXPath() + "]")) { ListItem objItem = new ListItem(); objItem.Value = objXmlTradition["id"].InnerText; if (objXmlTradition["translate"] != null) objItem.Name = objXmlTradition["translate"].InnerText; else objItem.Name = objXmlTradition["name"].InnerText; lstTraditions.Add(objItem); } SortListItem objSort = new SortListItem(); lstTraditions.Sort(objSort.Compare); cboTradition.ValueMember = "Value"; cboTradition.DisplayMember = "Name"; cboTradition.DataSource = lstTraditions; // Populate the Technomancer Streams list. objXmlDocument = XmlManager.Instance.Load("streams.xml"); List<ListItem> lstStreams = new List<ListItem>(); lstStreams.Add(objBlank); foreach (XmlNode objXmlTradition in objXmlDocument.SelectNodes("/chummer/traditions/tradition[" + _objOptions.BookXPath() + "]")) { ListItem objItem = new ListItem(); objItem.Value = objXmlTradition["id"].InnerText; if (objXmlTradition["translate"] != null) objItem.Name = objXmlTradition["translate"].InnerText; else objItem.Name = objXmlTradition["name"].InnerText; lstStreams.Add(objItem); } lstStreams.Sort(objSort.Compare); cboStream.ValueMember = "Value"; cboStream.DisplayMember = "Name"; cboStream.DataSource = lstStreams; // Load the Metatype information before going anywhere else. Doing this later causes the Attributes to get messed up because of calls // to UpdateCharacterInformation(); MetatypeSelected(); // If the character is a Mystic Adept, set the values for the Mystic Adept NUD. if (_objCharacter.AdeptEnabled && _objCharacter.MagicianEnabled) { nudMysticAdeptMAGMagician.Maximum = _objCharacter.MAG.TotalValue; nudMysticAdeptMAGMagician.Value = _objCharacter.MAGMagician; lblMysticAdeptMAGAdept.Text = _objCharacter.MAGAdept.ToString(); lblMysticAdeptAssignment.Visible = true; lblMysticAdeptAssignmentAdept.Visible = true; lblMysticAdeptAssignmentMagician.Visible = true; lblMysticAdeptMAGAdept.Visible = true; nudMysticAdeptMAGMagician.Visible = true; } // Nuyen can be affected by Qualities, so adjust the total amount available to the character. if (!_objCharacter.IgnoreRules) nudNuyen.Maximum = _objCharacter.NuyenMaximumBP; else nudNuyen.Maximum = 100000; // Nuyen. nudNuyen.Value = _objCharacter.NuyenBP; // Load the Skills information. objXmlDocument = XmlManager.Instance.Load("skills.xml"); // Populate the Skills Controls. XmlNodeList objXmlNodeList = objXmlDocument.SelectNodes("/chummer/skills/skill[" + _objCharacter.Options.BookXPath() + "]"); // Counter to keep track of the number of Controls that have been added to the Panel so we can determine their vertical positioning. int i = -1; foreach (Skill objSkill in _objCharacter.Skills) { if (!objSkill.KnowledgeSkill && !objSkill.ExoticSkill) { i++; SkillControl objSkillControl = new SkillControl(); objSkillControl.SkillObject = objSkill; // Attach an EventHandler for the RatingChanged and SpecializationChanged Events. objSkillControl.RatingChanged += objActiveSkill_RatingChanged; objSkillControl.SpecializationChanged += objSkill_SpecializationChanged; objSkillControl.BreakGroupClicked += objSkill_BreakGroupClicked; objSkillControl.SkillName = objSkill.Name; objSkillControl.SkillCategory = objSkill.SkillCategory; objSkillControl.SkillGroup = objSkill.SkillGroup; objSkillControl.SkillRatingMaximum = objSkill.RatingMaximum; objSkillControl.SkillRating = objSkill.Rating; objSkillControl.SkillSpec = objSkill.Specialization; XmlNode objXmlSkill = objXmlDocument.SelectSingleNode("/chummer/skills/skill[name = \"" + objSkill.Name + "\"]"); // Populate the Skill's Specializations (if any). foreach (XmlNode objXmlSpecialization in objXmlSkill.SelectNodes("specs/spec")) { if (objXmlSpecialization.Attributes["translate"] != null) objSkillControl.AddSpec(objXmlSpecialization.Attributes["translate"].InnerText); else objSkillControl.AddSpec(objXmlSpecialization.InnerText); } // Set the control's vertical position and add it to the Skills Panel. objSkillControl.Top = i * objSkillControl.Height; objSkillControl.Width = 510; objSkillControl.AutoScroll = false; panActiveSkills.Controls.Add(objSkillControl); } } // Exotic Skills. foreach (Skill objSkill in _objCharacter.Skills) { if (objSkill.ExoticSkill) { i++; SkillControl objSkillControl = new SkillControl(); objSkillControl.SkillObject = objSkill; // Attach an EventHandler for the RatingChanged and SpecializationChanged Events. objSkillControl.RatingChanged += objActiveSkill_RatingChanged; objSkillControl.SpecializationChanged += objSkill_SpecializationChanged; objSkillControl.BreakGroupClicked += objSkill_BreakGroupClicked; objSkillControl.SkillName = objSkill.Name; objSkillControl.SkillCategory = objSkill.SkillCategory; objSkillControl.SkillGroup = objSkill.SkillGroup; objSkillControl.SkillRatingMaximum = objSkill.RatingMaximum; objSkillControl.SkillRating = objSkill.Rating; objSkillControl.SkillSpec = objSkill.Specialization; XmlNode objXmlSkill = objXmlDocument.SelectSingleNode("/chummer/skills/skill[name = \"" + objSkill.Name + "\"]"); // Populate the Skill's Specializations (if any). foreach (XmlNode objXmlSpecialization in objXmlSkill.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 = \"" + objSkill.Name + "s\" or useskill = \"" + objSkill.Name + "\"]"); foreach (XmlNode objXmlWeapon in objXmlWeaponList) { if (objXmlWeapon["translate"] != null) objSkillControl.AddSpec(objXmlWeapon["translate"].InnerText); else objSkillControl.AddSpec(objXmlWeapon["name"].InnerText); } // Set the control's vertical position and add it to the Skills Panel. objSkillControl.Top = i * objSkillControl.Height; objSkillControl.Width = 510; objSkillControl.AutoScroll = false; panActiveSkills.Controls.Add(objSkillControl); } } // Populate the Skill Groups list. i = -1; foreach (SkillGroup objGroup in _objCharacter.SkillGroups) { i++; SkillGroupControl objGroupControl = new SkillGroupControl(_objCharacter.Options); objGroupControl.SkillGroupObject = objGroup; // Attach an EventHandler for the GetRatingChanged Event. objGroupControl.GroupRatingChanged += objGroup_RatingChanged; // Populate the control, set its vertical position and add it to the Skill Groups Panel. A Skill Group cannot start with a Rating higher than 4. objGroupControl.GroupName = objGroup.Name; if (objGroup.Rating > objGroup.RatingMaximum) objGroup.RatingMaximum = objGroup.Rating; objGroupControl.GroupRatingMaximum = objGroup.RatingMaximum; objGroupControl.GroupRating = objGroup.Rating; objGroupControl.Top = i * objGroupControl.Height; objGroupControl.Width = 250; // Loop through all of the Active Skills the character has and set their maximums if needed. if (objGroup.RatingMaximum > 6) { foreach (SkillControl objSkill in panActiveSkills.Controls) { if (objSkill.IsGrouped && objSkill.SkillGroup == objGroup.Name) { objSkill.SkillRatingMaximum = objGroup.RatingMaximum; objSkill.SkillObject.RatingMaximum = objGroup.RatingMaximum; objSkill.SkillRating = objGroup.Rating; } } } if (_objCharacter.SensitiveSystem) { cmdAddBioware.Enabled = false; } if (_objCharacter.Uneducated) { objGroupControl.IsEnabled = !objGroup.HasTechnicalSkills; } if (_objCharacter.Uncouth) { objGroupControl.IsEnabled = !objGroup.HasSocialSkills; } if (_objCharacter.Infirm) { objGroupControl.IsEnabled = !objGroup.HasPhysicalSkills; } panSkillGroups.Controls.Add(objGroupControl); } // Populate Knowledge Skills. i = -1; foreach (Skill objSkill in _objCharacter.Skills) { if (objSkill.KnowledgeSkill) { i++; SkillControl objSkillControl = new SkillControl(); objSkillControl.SkillObject = objSkill; // Attach an EventHandler for the RatingChanged and SpecializationChanged Events. objSkillControl.RatingChanged += objKnowledgeSkill_RatingChanged; objSkillControl.SpecializationChanged += objSkill_SpecializationChanged; objSkillControl.DeleteSkill += objKnowledgeSkill_DeleteSkill; objSkillControl.BreakGroupClicked += objSkill_BreakGroupClicked; objSkillControl.KnowledgeSkill = true; objSkillControl.SkillCategory = objSkill.SkillCategory; objSkillControl.AllowDelete = true; objSkillControl.SkillRatingMaximum = objSkill.RatingMaximum; objSkillControl.SkillRating = objSkill.Rating; objSkillControl.SkillName = objSkill.Name; objSkillControl.SkillSpec = objSkill.Specialization; objSkillControl.Top = i * objSkillControl.Height; objSkillControl.AutoScroll = false; panKnowledgeSkills.Controls.Add(objSkillControl); } } // Populate Contacts and Enemies. int intContact = -1; int intEnemy = -1; foreach (Contact objContact in _objCharacter.Contacts) { if (objContact.EntityType == ContactType.Contact) { intContact++; ContactControl objContactControl = new ContactControl(); // Attach an EventHandler for the ConnectionRatingChanged, LoyaltyRatingChanged, DeleteContact, and FileNameChanged Events. objContactControl.ConnectionRatingChanged += objContact_ConnectionRatingChanged; objContactControl.ConnectionGroupRatingChanged += objContact_ConnectionGroupRatingChanged; objContactControl.LoyaltyRatingChanged += objContact_LoyaltyRatingChanged; objContactControl.DeleteContact += objContact_DeleteContact; objContactControl.FileNameChanged += objContact_FileNameChanged; objContactControl.ContactObject = objContact; objContactControl.ContactName = objContact.Name; objContactControl.ConnectionRating = objContact.Connection; objContactControl.LoyaltyRating = objContact.Loyalty; objContactControl.EntityType = objContact.EntityType; objContactControl.BackColor = objContact.Colour; objContactControl.Top = intContact * objContactControl.Height; panContacts.Controls.Add(objContactControl); } if (objContact.EntityType == ContactType.Enemy) { intEnemy++; ContactControl objContactControl = new ContactControl(); // Attach an EventHandler for the ConnectioNRatingChanged, LoyaltyRatingChanged, DeleteContact, and FileNameChanged Events. objContactControl.ConnectionRatingChanged += objEnemy_ConnectionRatingChanged; objContactControl.ConnectionGroupRatingChanged += objEnemy_ConnectionGroupRatingChanged; objContactControl.LoyaltyRatingChanged += objEnemy_LoyaltyRatingChanged; objContactControl.DeleteContact += objEnemy_DeleteContact; objContactControl.FileNameChanged += objEnemy_FileNameChanged; objContactControl.ContactObject = objContact; objContactControl.ContactName = objContact.Name; objContactControl.ConnectionRating = objContact.Connection; objContactControl.LoyaltyRating = objContact.Loyalty; objContactControl.EntityType = objContact.EntityType; objContactControl.BackColor = objContact.Colour; objContactControl.Top = intEnemy * objContactControl.Height; panEnemies.Controls.Add(objContactControl); } if (objContact.EntityType == ContactType.Pet) { PetControl objContactControl = new PetControl(); // Attach an EventHandler for the DeleteContact and FileNameChanged Events. objContactControl.DeleteContact += objPet_DeleteContact; objContactControl.FileNameChanged += objPet_FileNameChanged; objContactControl.ContactObject = objContact; objContactControl.ContactName = objContact.Name; objContactControl.BackColor = objContact.Colour; panPets.Controls.Add(objContactControl); } } // Populate Armor. // Start by populating Locations. foreach (string strLocation in _objCharacter.ArmorBundles) { TreeNode objLocation = new TreeNode(); objLocation.Tag = strLocation; objLocation.Text = strLocation; objLocation.ContextMenuStrip = cmsArmorLocation; treArmor.Nodes.Add(objLocation); } foreach (Armor objArmor in _objCharacter.Armor) { _objFunctions.CreateArmorTreeNode(objArmor, treArmor, cmsArmor, cmsArmorMod, cmsArmorGear); } // Populate Weapons. // Start by populating Locations. foreach (string strLocation in _objCharacter.WeaponLocations) { TreeNode objLocation = new TreeNode(); objLocation.Tag = strLocation; objLocation.Text = strLocation; objLocation.ContextMenuStrip = cmsWeaponLocation; treWeapons.Nodes.Add(objLocation); } foreach (Weapon objWeapon in _objCharacter.Weapons) { _objFunctions.CreateWeaponTreeNode(objWeapon, treWeapons.Nodes[0], cmsWeapon, cmsWeaponMod, cmsWeaponAccessory, cmsWeaponAccessoryGear); } PopulateCyberwareList(); // Populate Spell list. foreach (Spell objSpell in _objCharacter.Spells) { TreeNode objNode = new TreeNode(); objNode.Text = objSpell.DisplayName; objNode.Tag = objSpell.InternalId; objNode.ContextMenuStrip = cmsSpell; if (objSpell.Notes != string.Empty) objNode.ForeColor = Color.SaddleBrown; objNode.ToolTipText = objSpell.Notes; switch (objSpell.Category) { case "Combat": treSpells.Nodes[0].Nodes.Add(objNode); treSpells.Nodes[0].Expand(); break; case "Detection": treSpells.Nodes[1].Nodes.Add(objNode); treSpells.Nodes[1].Expand(); break; case "Health": treSpells.Nodes[2].Nodes.Add(objNode); treSpells.Nodes[2].Expand(); break; case "Illusion": treSpells.Nodes[3].Nodes.Add(objNode); treSpells.Nodes[3].Expand(); break; case "Manipulation": treSpells.Nodes[4].Nodes.Add(objNode); treSpells.Nodes[4].Expand(); break; } } // Populate Adept Powers. i = -1; foreach (Power objPower in _objCharacter.Powers) { i++; PowerControl objPowerControl = new PowerControl(); objPowerControl.PowerObject = objPower; // Attach an EventHandler for the PowerRatingChanged Event. objPowerControl.PowerRatingChanged += objPower_PowerRatingChanged; objPowerControl.DeletePower += objPower_DeletePower; objPowerControl.RefreshMaximum(_objCharacter.MAG.TotalValue); if (objPower.Rating < 1) objPower.Rating = 1; objPowerControl.PowerLevel = Convert.ToInt32(objPower.Rating); if (objPower.DiscountedAdeptWay) objPowerControl.DiscountedByAdeptWay = true; if (objPower.DiscountedGeas) objPowerControl.DiscountedByGeas = true; objPowerControl.Top = i * objPowerControl.Height; panPowers.Controls.Add(objPowerControl); } // Populate Magician Spirits. i = -1; foreach (Spirit objSpirit in _objCharacter.Spirits) { if (objSpirit.EntityType == SpiritType.Spirit) { i++; SpiritControl objSpiritControl = new SpiritControl(); objSpiritControl.SpiritObject = objSpirit; // Attach an EventHandler for the ServicesOwedChanged Event. objSpiritControl.ServicesOwedChanged += objSpirit_ServicesOwedChanged; objSpiritControl.ForceChanged += objSpirit_ForceChanged; objSpiritControl.BoundChanged += objSpirit_BoundChanged; objSpiritControl.DeleteSpirit += objSpirit_DeleteSpirit; objSpiritControl.FileNameChanged += objSpirit_FileNameChanged; objSpiritControl.SpiritName = objSpirit.Name; objSpiritControl.ServicesOwed = objSpirit.ServicesOwed; if (_objCharacter.AdeptEnabled && _objCharacter.MagicianEnabled) objSpiritControl.ForceMaximum = _objCharacter.MAGMagician; else objSpiritControl.ForceMaximum = _objCharacter.MAG.TotalValue; objSpiritControl.CritterName = objSpirit.CritterName; objSpiritControl.Force = objSpirit.Force; objSpiritControl.Bound = objSpirit.Bound; objSpiritControl.RebuildSpiritList(_objCharacter.MagicTradition); objSpiritControl.Top = i * objSpiritControl.Height; panSpirits.Controls.Add(objSpiritControl); } } // Populate Technomancer Sprites. i = -1; foreach (Spirit objSpirit in _objCharacter.Spirits) { if (objSpirit.EntityType == SpiritType.Sprite) { i++; SpiritControl objSpiritControl = new SpiritControl(); objSpiritControl.SpiritObject = objSpirit; objSpiritControl.EntityType = SpiritType.Sprite; // Attach an EventHandler for the ServicesOwedChanged Event. objSpiritControl.ServicesOwedChanged += objSprite_ServicesOwedChanged; objSpiritControl.ForceChanged += objSprite_ForceChanged; objSpiritControl.BoundChanged += objSprite_BoundChanged; objSpiritControl.DeleteSpirit += objSprite_DeleteSpirit; objSpiritControl.FileNameChanged += objSprite_FileNameChanged; objSpiritControl.SpiritName = objSpirit.Name; objSpiritControl.ServicesOwed = objSpirit.ServicesOwed; objSpiritControl.ForceMaximum = _objCharacter.RES.TotalValue; objSpiritControl.CritterName = objSpiritControl.CritterName; objSpiritControl.Force = objSpirit.Force; objSpiritControl.Bound = objSpirit.Bound; objSpiritControl.RebuildSpiritList(_objCharacter.TechnomancerStream); objSpiritControl.Top = i * objSpiritControl.Height; panSprites.Controls.Add(objSpiritControl); } } // Populate Technomancer Complex Forms/Programs. foreach (TechProgram objProgram in _objCharacter.TechPrograms) { TreeNode objNode = new TreeNode(); objNode.Text = objProgram.DisplayName; if (objProgram.Extra != "") objNode.Text += " (" + objProgram.Extra + ")"; objNode.Tag = objProgram.InternalId; if (Convert.ToInt32(objProgram.CalculatedCapacity) > 0) objNode.ContextMenuStrip = cmsComplexForm; if (objProgram.Notes != string.Empty) objNode.ForeColor = Color.SaddleBrown; objNode.ToolTipText = objProgram.Notes; foreach (TechProgramOption objOption in objProgram.Options) { TreeNode objChild = new TreeNode(); objChild.Text = objOption.DisplayName; objChild.ContextMenuStrip = cmsComplexFormPlugin; if (objOption.Extra != "") objChild.Text += " (" + objProgram.Extra + ")"; objChild.Tag = objOption.InternalId; if (objOption.Notes != string.Empty) objChild.ForeColor = Color.SaddleBrown; objChild.ToolTipText = objOption.Notes; objNode.Nodes.Add(objChild); objNode.Expand(); } switch (objProgram.Category) { case "Advanced": treComplexForms.Nodes[0].Nodes.Add(objNode); treComplexForms.Nodes[0].Expand(); break; case "ARE Programs": treComplexForms.Nodes[1].Nodes.Add(objNode); treComplexForms.Nodes[1].Expand(); break; case "Autosoft": treComplexForms.Nodes[2].Nodes.Add(objNode); treComplexForms.Nodes[2].Expand(); break; case "Common Use": treComplexForms.Nodes[3].Nodes.Add(objNode); treComplexForms.Nodes[3].Expand(); break; case "Hacking": treComplexForms.Nodes[4].Nodes.Add(objNode); treComplexForms.Nodes[4].Expand(); break; case "Malware": treComplexForms.Nodes[5].Nodes.Add(objNode); treComplexForms.Nodes[5].Expand(); break; case "Sensor Software": treComplexForms.Nodes[6].Nodes.Add(objNode); treComplexForms.Nodes[6].Expand(); break; case "Skillsofts": treComplexForms.Nodes[7].Nodes.Add(objNode); treComplexForms.Nodes[7].Expand(); break; case "Tactical AR Software": treComplexForms.Nodes[8].Nodes.Add(objNode); treComplexForms.Nodes[8].Expand(); break; } } // Populate Martial Arts. foreach (MartialArt objMartialArt in _objCharacter.MartialArts) { TreeNode objMartialArtNode = new TreeNode(); objMartialArtNode.Text = objMartialArt.DisplayName; objMartialArtNode.Tag = objMartialArt.Name; objMartialArtNode.ContextMenuStrip = cmsMartialArts; if (objMartialArt.Notes != string.Empty) objMartialArtNode.ForeColor = Color.SaddleBrown; objMartialArtNode.ToolTipText = objMartialArt.Notes; foreach (MartialArtAdvantage objAdvantage in objMartialArt.Advantages) { TreeNode objAdvantageNode = new TreeNode(); objAdvantageNode.Text = objAdvantage.DisplayName; objAdvantageNode.Tag = objAdvantage.InternalId; objMartialArtNode.Nodes.Add(objAdvantageNode); objMartialArtNode.Expand(); } treMartialArts.Nodes[0].Nodes.Add(objMartialArtNode); treMartialArts.Nodes[0].Expand(); } // Populate Martial Art Maneuvers. foreach (MartialArtManeuver objManeuver in _objCharacter.MartialArtManeuvers) { TreeNode objManeuverNode = new TreeNode(); objManeuverNode.Text = objManeuver.DisplayName; objManeuverNode.Tag = objManeuver.InternalId; objManeuverNode.ContextMenuStrip = cmsMartialArtManeuver; if (objManeuver.Notes != string.Empty) objManeuverNode.ForeColor = Color.SaddleBrown; objManeuverNode.ToolTipText = objManeuver.Notes; treMartialArts.Nodes[1].Nodes.Add(objManeuverNode); treMartialArts.Nodes[1].Expand(); } // Populate Lifestyles. foreach (Lifestyle objLifestyle in _objCharacter.Lifestyles) { TreeNode objLifestyleNode = new TreeNode(); objLifestyleNode.Text = objLifestyle.DisplayName; objLifestyleNode.Tag = objLifestyle.InternalId; if (objLifestyle.Comforts != "") objLifestyleNode.ContextMenuStrip = cmsAdvancedLifestyle; else objLifestyleNode.ContextMenuStrip = cmsLifestyleNotes; if (objLifestyle.Notes != string.Empty) objLifestyleNode.ForeColor = Color.SaddleBrown; objLifestyleNode.ToolTipText = objLifestyle.Notes; treLifestyles.Nodes[0].Nodes.Add(objLifestyleNode); } treLifestyles.Nodes[0].Expand(); PopulateGearList(); // Populate Foci. _objController.PopulateFocusList(treFoci); // Populate Vehicles. foreach (Vehicle objVehicle in _objCharacter.Vehicles) { _objFunctions.CreateVehicleTreeNode(objVehicle, treVehicles, cmsVehicle, cmsVehicleLocation, cmsVehicleWeapon, cmsVehicleWeaponMod, cmsVehicleWeaponAccessory, cmsVehicleWeaponAccessoryGear, cmsVehicleGear); } // Populate Initiation/Submersion information. if (_objCharacter.InitiateGrade > 0 || _objCharacter.SubmersionGrade > 0) { foreach (Metamagic objMetamagic in _objCharacter.Metamagics) { TreeNode objNode = new TreeNode(); objNode.Text = objMetamagic.DisplayName; objNode.Tag = objMetamagic.InternalId; objNode.ContextMenuStrip = cmsMetamagic; if (objMetamagic.Notes != string.Empty) objNode.ForeColor = Color.SaddleBrown; objNode.ToolTipText = objMetamagic.Notes; treMetamagic.Nodes.Add(objNode); } if (_objCharacter.InitiateGrade > 0) lblInitiateGrade.Text = _objCharacter.InitiateGrade.ToString(); else lblInitiateGrade.Text = _objCharacter.SubmersionGrade.ToString(); } // Populate Critter Powers. foreach (CritterPower objPower in _objCharacter.CritterPowers) { TreeNode objNode = new TreeNode(); objNode.Text = objPower.DisplayName; objNode.Tag = objPower.InternalId; objNode.ContextMenuStrip = cmsCritterPowers; if (objPower.Notes != string.Empty) objNode.ForeColor = Color.SaddleBrown; objNode.ToolTipText = objPower.Notes; if (objPower.Category != "Weakness") { treCritterPowers.Nodes[0].Nodes.Add(objNode); treCritterPowers.Nodes[0].Expand(); } else { treCritterPowers.Nodes[1].Nodes.Add(objNode); treCritterPowers.Nodes[1].Expand(); } } // Load the Cyberware information. objXmlDocument = XmlManager.Instance.Load("cyberware.xml"); // Populate the Grade list. List<ListItem> lstCyberwareGrades = new List<ListItem>(); foreach (Grade objGrade in GlobalOptions.CyberwareGrades) { ListItem objItem = new ListItem(); objItem.Value = objGrade.Name; objItem.Name = objGrade.DisplayName; lstCyberwareGrades.Add(objItem); } cboCyberwareGrade.ValueMember = "Value"; cboCyberwareGrade.DisplayMember = "Name"; cboCyberwareGrade.DataSource = lstCyberwareGrades; _blnLoading = false; // Select the Magician's Tradition. if (_objCharacter.MagicTradition != Guid.Empty) cboTradition.SelectedValue = _objCharacter.MagicTradition; // Select the Technomancer's Stream. if (_objCharacter.TechnomancerStream != Guid.Empty) cboStream.SelectedValue = _objCharacter.TechnomancerStream; // Clear the Dirty flag which gets set when creating a new Character. CalculateBP(); _blnIsDirty = false; UpdateWindowTitle(); if (_objCharacter.AdeptEnabled) CalculatePowerPoints(); treGear.ItemDrag += treGear_ItemDrag; treGear.DragEnter += treGear_DragEnter; treGear.DragDrop += treGear_DragDrop; treLifestyles.ItemDrag += treLifestyles_ItemDrag; treLifestyles.DragEnter += treLifestyles_DragEnter; treLifestyles.DragDrop += treLifestyles_DragDrop; treArmor.ItemDrag += treArmor_ItemDrag; treArmor.DragEnter += treArmor_DragEnter; treArmor.DragDrop += treArmor_DragDrop; treWeapons.ItemDrag += treWeapons_ItemDrag; treWeapons.DragEnter += treWeapons_DragEnter; treWeapons.DragDrop += treWeapons_DragDrop; treVehicles.ItemDrag += treVehicles_ItemDrag; treVehicles.DragEnter += treVehicles_DragEnter; treVehicles.DragDrop += treVehicles_DragDrop; treImprovements.ItemDrag += treImprovements_ItemDrag; treImprovements.DragEnter += treImprovements_DragEnter; treImprovements.DragDrop += treImprovements_DragDrop; // Merge the ToolStrips. ToolStripManager.RevertMerge("toolStrip"); ToolStripManager.Merge(toolStrip, "toolStrip"); // If this is a Sprite, re-label the Mental Attribute Labels. if (_objCharacter.Metatype.EndsWith("Sprite")) { lblBODLabel.Enabled = false; nudBOD.Enabled = false; lblAGILabel.Enabled = false; nudAGI.Enabled = false; lblREALabel.Enabled = false; nudREA.Enabled = false; lblSTRLabel.Enabled = false; nudSTR.Enabled = false; lblCHALabel.Text = LanguageManager.Instance.GetString("String_AttributePilot"); lblINTLabel.Text = LanguageManager.Instance.GetString("String_AttributeResponse"); lblLOGLabel.Text = LanguageManager.Instance.GetString("String_AttributeFirewall"); lblWILLabel.Enabled = false; nudWIL.Enabled = false; } else if (_objCharacter.Metatype.EndsWith("A.I.") || _objCharacter.MetatypeCategory == "Technocritters" || _objCharacter.MetatypeCategory == "Protosapients") { lblRatingLabel.Visible = true; lblRating.Visible = true; lblSystemLabel.Visible = true; lblSystem.Visible = true; lblFirewallLabel.Visible = true; lblFirewall.Visible = true; lblResponseLabel.Visible = true; nudResponse.Visible = true; nudResponse.Enabled = true; nudResponse.Value = _objCharacter.Response; lblSignalLabel.Visible = true; nudSignal.Visible = true; nudSignal.Enabled = true; nudSignal.Value = _objCharacter.Signal; // Disable the Physical Attribute controls. lblBODLabel.Enabled = false; lblAGILabel.Enabled = false; lblREALabel.Enabled = false; lblSTRLabel.Enabled = false; nudBOD.Enabled = false; nudAGI.Enabled = false; nudREA.Enabled = false; nudSTR.Enabled = false; } mnuSpecialConvertToFreeSprite.Visible = _objCharacter.IsSprite; // Run through all of the Skills and Enable/Disable them as needed. foreach (SkillControl objSkillControl in panActiveSkills.Controls) { if (objSkillControl.Attribute == "MAG") objSkillControl.Enabled = _objCharacter.MAGEnabled; if (objSkillControl.Attribute == "RES") objSkillControl.Enabled = _objCharacter.RESEnabled; } // Run through all of the Skill Groups and Disable them if all of their Skills are currently inaccessible. foreach (SkillGroupControl objSkillGroupControl in panSkillGroups.Controls) { bool blnEnabled = false; foreach (Skill objSkill in _objCharacter.Skills) { if (objSkill.SkillGroup == objSkillGroupControl.GroupName) { if (objSkill.Attribute == "MAG" || objSkill.Attribute == "RES") { if (objSkill.Attribute == "MAG" && _objCharacter.MAGEnabled) blnEnabled = true; if (objSkill.Attribute == "RES" && _objCharacter.RESEnabled) blnEnabled = true; } else blnEnabled = true; } } objSkillGroupControl.IsEnabled = blnEnabled; if (!blnEnabled) objSkillGroupControl.GroupRating = 0; } // Populate the Skill Filter DropDown. List<ListItem> lstFilter = new List<ListItem>(); ListItem itmAll = new ListItem(); itmAll.Value = "0"; itmAll.Name = LanguageManager.Instance.GetString("String_SkillFilterAll"); ListItem itmRatingAboveZero = new ListItem(); itmRatingAboveZero.Value = "1"; itmRatingAboveZero.Name = LanguageManager.Instance.GetString("String_SkillFilterRatingAboveZero"); ListItem itmTotalRatingAboveZero = new ListItem(); itmTotalRatingAboveZero.Value = "2"; itmTotalRatingAboveZero.Name = LanguageManager.Instance.GetString("String_SkillFilterTotalRatingAboveZero"); ListItem itmRatingEqualZero = new ListItem(); itmRatingEqualZero.Value = "3"; itmRatingEqualZero.Name = LanguageManager.Instance.GetString("String_SkillFilterRatingZero"); lstFilter.Add(itmAll); lstFilter.Add(itmRatingAboveZero); lstFilter.Add(itmTotalRatingAboveZero); lstFilter.Add(itmRatingEqualZero); objXmlDocument = XmlManager.Instance.Load("skills.xml"); objXmlNodeList = objXmlDocument.SelectNodes("/chummer/categories/category[@type = \"active\"]"); foreach (XmlNode objNode in objXmlNodeList) { ListItem objItem = new ListItem(); objItem.Value = objNode.InnerText; if (objNode.Attributes["translate"] != null) objItem.Name = LanguageManager.Instance.GetString("Label_Category") + " " + objNode.Attributes["translate"].InnerText; else objItem.Name = LanguageManager.Instance.GetString("Label_Category") + " " + objNode.InnerText; lstFilter.Add(objItem); } // Add items for Attributes. ListItem itmBOD = new ListItem(); itmBOD.Value = "BOD"; itmBOD.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeBODShort"); ListItem itmAGI = new ListItem(); itmAGI.Value = "AGI"; itmAGI.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeAGIShort"); ListItem itmREA = new ListItem(); itmREA.Value = "REA"; itmREA.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeREAShort"); ListItem itmSTR = new ListItem(); itmSTR.Value = "STR"; itmSTR.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeSTRShort"); ListItem itmCHA = new ListItem(); itmCHA.Value = "CHA"; itmCHA.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeCHAShort"); ListItem itmINT = new ListItem(); itmINT.Value = "INT"; itmINT.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeINTShort"); ListItem itmLOG = new ListItem(); itmLOG.Value = "LOG"; itmLOG.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeLOGShort"); ListItem itmWIL = new ListItem(); itmWIL.Value = "WIL"; itmWIL.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeWILShort"); ListItem itmMAG = new ListItem(); itmMAG.Value = "MAG"; itmMAG.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeMAGShort"); ListItem itmRES = new ListItem(); itmRES.Value = "RES"; itmRES.Name = LanguageManager.Instance.GetString("String_ExpenseAttribute") + ": " + LanguageManager.Instance.GetString("String_AttributeRESShort"); lstFilter.Add(itmBOD); lstFilter.Add(itmAGI); lstFilter.Add(itmREA); lstFilter.Add(itmSTR); lstFilter.Add(itmCHA); lstFilter.Add(itmINT); lstFilter.Add(itmLOG); lstFilter.Add(itmWIL); lstFilter.Add(itmMAG); lstFilter.Add(itmRES); // Add Skill Groups to the filter. objXmlNodeList = objXmlDocument.SelectNodes("/chummer/categories/category[@type = \"active\"]"); foreach (SkillGroup objGroup in _objCharacter.SkillGroups) { ListItem itmGroup = new ListItem(); itmGroup.Value = "GROUP:" + objGroup.Name; itmGroup.Name = LanguageManager.Instance.GetString("String_ExpenseSkillGroup") + ": " + objGroup.DisplayName; lstFilter.Add(itmGroup); } cboSkillFilter.DataSource = lstFilter; cboSkillFilter.ValueMember = "Value"; cboSkillFilter.DisplayMember = "Name"; cboSkillFilter.SelectedIndex = 0; cboSkillFilter_SelectedIndexChanged(null, null); if (_objCharacter.MetatypeCategory == "Mundane Critters") mnuSpecialMutantCritter.Visible = true; if (_objCharacter.MetatypeCategory == "Mutant Critters") mnuSpecialToxicCritter.Visible = true; if (_objCharacter.MetatypeCategory == "Cyberzombie") mnuSpecialCyberzombie.Visible = false; _objFunctions.SortTree(treCyberware); _objFunctions.SortTree(treSpells); _objFunctions.SortTree(treComplexForms); _objFunctions.SortTree(treQualities); _objFunctions.SortTree(treCritterPowers); _objFunctions.SortTree(treMartialArts); UpdateMentorSpirits(); UpdateInitiationGradeList(); RefreshImprovements(); UpdateCharacterInfo(); _blnIsDirty = false; UpdateWindowTitle(false); RefreshPasteStatus(); // Stupid hack to get the MDI icon to show up properly. this.Icon = this.Icon.Clone() as System.Drawing.Icon; }
private void frmCreate_Load(object sender, EventArgs e) { Timekeeper.Finish("load_free"); Timekeeper.Start("load_frm_create"); _blnLoading = true; tabSkillUc.ObjCharacter = _objCharacter; if (!_objCharacter.IsCritter && (_objCharacter.BuildMethod == CharacterBuildMethod.Karma && _objCharacter.BuildKarma == 0) || (_objCharacter.BuildMethod == CharacterBuildMethod.Priority && _objCharacter.BuildKarma == 0)) { _blnFreestyle = true; tssBPRemain.Visible = false; tssBPRemainLabel.Visible = false; } // Initialize elements if we're using Priority to build. if (_objCharacter.BuildMethod == CharacterBuildMethod.Priority || _objCharacter.BuildMethod == CharacterBuildMethod.SumtoTen) { // Load the Priority information. if (_objCharacter.GameplayOption == "") { _objCharacter.GameplayOption = "Standard"; } XmlDocument objXmlDocumentGameplayOptions = XmlManager.Instance.Load("gameplayoptions.xml"); XmlNode objXmlGameplayOption = objXmlDocumentGameplayOptions.SelectSingleNode("/chummer/gameplayoptions/gameplayoption[name = \"" + _objCharacter.GameplayOption + "\"]"); string strKarma = objXmlGameplayOption["karma"].InnerText; string strNuyen = objXmlGameplayOption["maxnuyen"].InnerText; if (!_objOptions.FreeContactsMultiplierEnabled) { string strContactMultiplier = objXmlGameplayOption["contactmultiplier"].InnerText; _objCharacter.ContactMultiplier = Convert.ToInt32(strContactMultiplier); } else { _objCharacter.ContactMultiplier = _objOptions.FreeContactsMultiplier; } _objCharacter.MaxKarma = Convert.ToInt32(strKarma); _objCharacter.MaxNuyen = Convert.ToInt32(strNuyen); lblPBuildSpecial.Text = String.Format("{0} " + LanguageManager.Instance.GetString("String_Of") + " {1}", (_objCharacter.Special).ToString(), _objCharacter.TotalSpecial.ToString()); lblPBuildAttributes.Text = String.Format("{0} " + LanguageManager.Instance.GetString("String_Of") + " {1}", (_objCharacter.Attributes).ToString(), _objCharacter.TotalAttributes.ToString()); lblPBuildSpells.Text = String.Format("{0} " + LanguageManager.Instance.GetString("String_Of") + " {1}", (_objCharacter.SpellLimit - _objCharacter.Spells.Count).ToString(), _objCharacter.SpellLimit.ToString()); lblPBuildComplexForms.Text = String.Format("{0} " + LanguageManager.Instance.GetString("String_Of") + " {1}", (_objCharacter.CFPLimit - _objCharacter.ComplexForms.Count).ToString(), _objCharacter.CFPLimit.ToString()); tabInfo.TabPages.RemoveAt(0); } else { tabInfo.TabPages.RemoveAt(1); } int count = 0; foreach (Contact contact in _objCharacter.Contacts) count += contact.ContactPoints; // Set the movement speed defaults lblMovement.Text = _objCharacter.Movement; tssBPLabel.Text = LanguageManager.Instance.GetString("Label_Karma"); tssBPRemainLabel.Text = LanguageManager.Instance.GetString("Label_KarmaRemaining"); tabBPSummary.Text = LanguageManager.Instance.GetString("Tab_BPSummary_Karma"); lblQualityBPLabel.Text = LanguageManager.Instance.GetString("Label_Karma"); // Set the Statusbar Labels if we're using Karma to build. if (_objCharacter.BuildMethod == CharacterBuildMethod.Karma || _objCharacter.BuildMethod == CharacterBuildMethod.LifeModule) { //TODO: Fix the UI for karmagen nudAGI.Enabled = false; nudBOD.Enabled = false; nudSTR.Enabled = false; nudREA.Enabled = false; nudINT.Enabled = false; nudCHA.Enabled = false; nudLOG.Enabled = false; nudWIL.Enabled = false; nudEDG.Enabled = false; nudRES.Enabled = false; nudMAG.Enabled = false; } nudNuyen.Value = _objCharacter.NuyenBP; // Remove the Magician, Adept, and Technomancer tabs since they are not in use until the appropriate Quality is selected. if (!_objCharacter.MagicianEnabled && !_objCharacter.AdeptEnabled) tabCharacterTabs.TabPages.Remove(tabMagician); if (!_objCharacter.AdeptEnabled) tabCharacterTabs.TabPages.Remove(tabAdept); if (!_objCharacter.TechnomancerEnabled) tabCharacterTabs.TabPages.Remove(tabTechnomancer); if (!_objCharacter.CritterEnabled) tabCharacterTabs.TabPages.Remove(tabCritter); if (_objCharacter.AdeptEnabled && !_objCharacter.MagicianEnabled) { // Hide the pieces that only apply to mages or mystic adepts treSpells.Nodes[4].Remove(); treSpells.Nodes[3].Remove(); treSpells.Nodes[2].Remove(); treSpells.Nodes[1].Remove(); treSpells.Nodes[0].Remove(); lblDrainAttributesLabel.Visible = false; lblDrainAttributes.Visible = false; lblDrainAttributesValue.Visible = false; lblSpirits.Visible = false; cmdAddSpirit.Visible = false; panSpirits.Visible = false; } // Set the visibility of the Bioware Suites menu options. mnuSpecialAddBiowareSuite.Visible = _objCharacter.Options.AllowBiowareSuites; mnuSpecialCreateBiowareSuite.Visible = _objCharacter.Options.AllowBiowareSuites; // Remove the Improvements Tab. tabCharacterTabs.TabPages.Remove(tabImprovements); if ((!_objCharacter.MAGEnabled && !_objCharacter.RESEnabled) || !_objOptions.AllowInitiationInCreateMode) tabCharacterTabs.TabPages.Remove(tabInitiation); else { if (_objCharacter.MAGEnabled) { tabInitiation.Text = LanguageManager.Instance.GetString("Tab_Initiation"); tsMetamagicAddMetamagic.Text = LanguageManager.Instance.GetString("Button_AddMetamagic"); cmdAddMetamagic.Text = LanguageManager.Instance.GetString("Button_AddInitiateGrade"); } else { tabInitiation.Text = LanguageManager.Instance.GetString("Tab_Submersion"); tsMetamagicAddMetamagic.Text = LanguageManager.Instance.GetString("Button_AddEcho"); cmdAddMetamagic.Text = LanguageManager.Instance.GetString("Button_AddSubmersionGrade"); chkInitiationOrdeal.Text = LanguageManager.Instance.GetString("Checkbox_SubmersionTask"); chkInitiationGroup.Visible = false; chkInitiationSchooling.Visible = false; tsMetamagicAddArt.Visible = false; tsMetamagicAddEnchantment.Visible = false; tsMetamagicAddEnhancement.Visible = false; tsMetamagicAddRitual.Visible = false; treMetamagic.Top = cmdAddMetamagic.Top + cmdAddMetamagic.Height + 6; cmdAddMetamagic.Left = treMetamagic.Left + treMetamagic.Width - cmdAddMetamagic.Width; } UpdateInitiationCost(); } // If the character has a mugshot, decode it and put it in the PictureBox. if (_objCharacter.Mugshot != "") { byte[] bytImage = Convert.FromBase64String(_objCharacter.Mugshot); MemoryStream objStream = new MemoryStream(bytImage, 0, bytImage.Length); objStream.Write(bytImage, 0, bytImage.Length); Image imgMugshot = Image.FromStream(objStream, true); picMugshot.Image = imgMugshot; } // Populate character information fields. XmlDocument objMetatypeDoc = new XmlDocument(); XmlNode objMetatypeNode; string strMetatype = ""; string strBook = ""; string strPage = ""; objMetatypeDoc = XmlManager.Instance.Load("metatypes.xml"); { objMetatypeNode = objMetatypeDoc.SelectSingleNode("/chummer/metatypes/metatype[name = \"" + _objCharacter.Metatype + "\"]"); if (objMetatypeNode == null) objMetatypeDoc = XmlManager.Instance.Load("critters.xml"); objMetatypeNode = objMetatypeDoc.SelectSingleNode("/chummer/metatypes/metatype[name = \"" + _objCharacter.Metatype + "\"]"); if (objMetatypeNode["translate"] != null) strMetatype = objMetatypeNode["translate"].InnerText; else strMetatype = _objCharacter.Metatype; strBook = _objOptions.LanguageBookShort(objMetatypeNode["source"].InnerText); if (objMetatypeNode["altpage"] != null) strPage = objMetatypeNode["altpage"].InnerText; else strPage = objMetatypeNode["page"].InnerText; if (_objCharacter.Metavariant != "") { objMetatypeNode = objMetatypeNode.SelectSingleNode("metavariants/metavariant[name = \"" + _objCharacter.Metavariant + "\"]"); if (objMetatypeNode["translate"] != null) strMetatype += " (" + objMetatypeNode["translate"].InnerText + ")"; else strMetatype += " (" + _objCharacter.Metavariant + ")"; strBook = _objOptions.LanguageBookShort(objMetatypeNode["source"].InnerText); if (objMetatypeNode["altpage"] != null) strPage = objMetatypeNode["altpage"].InnerText; else strPage = objMetatypeNode["page"].InnerText; } } lblMetatype.Text = strMetatype; lblMetatypeSource.Text = strBook + " " + strPage; txtCharacterName.Text = _objCharacter.Name; txtSex.Text = _objCharacter.Sex; txtAge.Text = _objCharacter.Age; txtEyes.Text = _objCharacter.Eyes; txtHeight.Text = _objCharacter.Height; txtWeight.Text = _objCharacter.Weight; txtSkin.Text = _objCharacter.Skin; txtHair.Text = _objCharacter.Hair; txtDescription.Text = _objCharacter.Description; txtBackground.Text = _objCharacter.Background; txtConcept.Text = _objCharacter.Concept; txtNotes.Text = _objCharacter.Notes; txtAlias.Text = _objCharacter.Alias; txtPlayerName.Text = _objCharacter.PlayerName; // Check for Special Attributes. lblMAGLabel.Enabled = _objCharacter.MAGEnabled; lblMAGAug.Enabled = _objCharacter.MAGEnabled; if ((_objCharacter.BuildMethod != CharacterBuildMethod.Karma) && (_objCharacter.BuildMethod != CharacterBuildMethod.LifeModule)) { nudMAG.Enabled = _objCharacter.MAGEnabled; } nudKMAG.Enabled = _objCharacter.MAGEnabled; lblMAGMetatype.Enabled = _objCharacter.MAGEnabled; lblFoci.Visible = _objCharacter.MAGEnabled; treFoci.Visible = _objCharacter.MAGEnabled; nudAdeptWayDiscount.Visible = _objCharacter.MAGEnabled; lblAdeptWayDiscount.Visible = _objCharacter.MAGEnabled; cmdCreateStackedFocus.Visible = _objCharacter.MAGEnabled; if (_objCharacter.Metatype == "A.I.") { lblDEPAug.Enabled = true; lblDEPLabel.Enabled = true; if ((_objCharacter.BuildMethod != CharacterBuildMethod.Karma) && (_objCharacter.BuildMethod != CharacterBuildMethod.LifeModule)) { nudDEP.Enabled = true; } nudKDEP.Enabled = true; lblDEPMetatype.Enabled = true; } lblRESLabel.Enabled = _objCharacter.RESEnabled; lblRESAug.Enabled = _objCharacter.RESEnabled; if (_objCharacter.BuildMethod != CharacterBuildMethod.Karma || _objCharacter.BuildMethod != CharacterBuildMethod.LifeModule) { nudRES.Enabled = _objCharacter.RESEnabled; } nudKRES.Enabled = _objCharacter.RESEnabled; lblRESMetatype.Enabled = _objCharacter.RESEnabled; // Define the XML objects that will be used. XmlDocument objXmlDocument = new XmlDocument(); if (_objCharacter.BuildMethod == CharacterBuildMethod.LifeModule) { cmdLifeModule.Visible = true; treQualities.Nodes.Add(new TreeNode("Life Modules")); btnCreateBackstory.Visible = true; btnCreateBackstory.Visible = _objCharacter.Options.AutomaticBackstory; } // Populate the Qualities list. foreach (Quality objQuality in _objCharacter.Qualities) { treQualities.Add(objQuality, cmsQuality); } // Populate the Magician Traditions list. objXmlDocument = XmlManager.Instance.Load("traditions.xml"); List<ListItem> lstTraditions = new List<ListItem>(); ListItem objBlank = new ListItem(); objBlank.Value = ""; objBlank.Name = ""; lstTraditions.Add(objBlank); foreach (XmlNode objXmlTradition in objXmlDocument.SelectNodes("/chummer/traditions/tradition[" + _objOptions.BookXPath() + "]")) { ListItem objItem = new ListItem(); objItem.Value = objXmlTradition["name"].InnerText; if (objXmlTradition["translate"] != null) objItem.Name = objXmlTradition["translate"].InnerText; else objItem.Name = objXmlTradition["name"].InnerText; lstTraditions.Add(objItem); } SortListItem objSort = new SortListItem(); lstTraditions.Sort(objSort.Compare); cboTradition.ValueMember = "Value"; cboTradition.DisplayMember = "Name"; cboTradition.DataSource = lstTraditions; // Populate the Magician Custom Drain Options list. objXmlDocument = XmlManager.Instance.Load("traditions.xml"); List<ListItem> lstDrainAttributes = new List<ListItem>(); ListItem objDrainBlank = new ListItem(); objDrainBlank.Value = ""; objDrainBlank.Name = ""; lstDrainAttributes.Add(objDrainBlank); foreach (XmlNode objXmlDrain in objXmlDocument.SelectNodes("/chummer/drainattributes/drainattribute")) { ListItem objItem = new ListItem(); objItem.Value = objXmlDrain["name"].InnerText; if (objXmlDrain["translate"] != null) objItem.Name = objXmlDrain["translate"].InnerText; else objItem.Name = objXmlDrain["name"].InnerText; lstDrainAttributes.Add(objItem); } SortListItem objDrainSort = new SortListItem(); lstDrainAttributes.Sort(objDrainSort.Compare); cboDrain.ValueMember = "Value"; cboDrain.DisplayMember = "Name"; cboDrain.DataSource = lstDrainAttributes; // Populate the Magician Custom Spirits lists - Combat. objXmlDocument = XmlManager.Instance.Load("traditions.xml"); List<ListItem> lstSpirit = new List<ListItem>(); ListItem objSpiritBlank = new ListItem(); objSpiritBlank.Value = ""; objSpiritBlank.Name = ""; lstSpirit.Add(objSpiritBlank); foreach (XmlNode objXmlSpirit in objXmlDocument.SelectNodes("/chummer/spirits/spirit")) { ListItem objItem = new ListItem(); objItem.Value = objXmlSpirit["name"].InnerText; if (objXmlSpirit["translate"] != null) objItem.Name = objXmlSpirit["translate"].InnerText; else objItem.Name = objXmlSpirit["name"].InnerText; lstSpirit.Add(objItem); } SortListItem objSpiritSort = new SortListItem(); lstSpirit.Sort(objSpiritSort.Compare); cboSpiritCombat.ValueMember = "Value"; cboSpiritCombat.DisplayMember = "Name"; cboSpiritCombat.DataSource = lstSpirit; // Populate the Magician Custom Spirits lists - Detection. lstSpirit = new List<ListItem>(); objSpiritBlank = new ListItem(); objSpiritBlank.Value = ""; objSpiritBlank.Name = ""; lstSpirit.Add(objSpiritBlank); foreach (XmlNode objXmlSpirit in objXmlDocument.SelectNodes("/chummer/spirits/spirit")) { ListItem objItem = new ListItem(); objItem.Value = objXmlSpirit["name"].InnerText; if (objXmlSpirit["translate"] != null) objItem.Name = objXmlSpirit["translate"].InnerText; else objItem.Name = objXmlSpirit["name"].InnerText; lstSpirit.Add(objItem); } objSpiritSort = new SortListItem(); lstSpirit.Sort(objSpiritSort.Compare); cboSpiritDetection.ValueMember = "Value"; cboSpiritDetection.DisplayMember = "Name"; cboSpiritDetection.DataSource = lstSpirit; // Populate the Magician Custom Spirits lists - Health. lstSpirit = new List<ListItem>(); objSpiritBlank = new ListItem(); objSpiritBlank.Value = ""; objSpiritBlank.Name = ""; lstSpirit.Add(objSpiritBlank); foreach (XmlNode objXmlSpirit in objXmlDocument.SelectNodes("/chummer/spirits/spirit")) { ListItem objItem = new ListItem(); objItem.Value = objXmlSpirit["name"].InnerText; if (objXmlSpirit["translate"] != null) objItem.Name = objXmlSpirit["translate"].InnerText; else objItem.Name = objXmlSpirit["name"].InnerText; lstSpirit.Add(objItem); } objSpiritSort = new SortListItem(); lstSpirit.Sort(objSpiritSort.Compare); cboSpiritHealth.ValueMember = "Value"; cboSpiritHealth.DisplayMember = "Name"; cboSpiritHealth.DataSource = lstSpirit; // Populate the Magician Custom Spirits lists - Illusion. lstSpirit = new List<ListItem>(); objSpiritBlank = new ListItem(); objSpiritBlank.Value = ""; objSpiritBlank.Name = ""; lstSpirit.Add(objSpiritBlank); foreach (XmlNode objXmlSpirit in objXmlDocument.SelectNodes("/chummer/spirits/spirit")) { ListItem objItem = new ListItem(); objItem.Value = objXmlSpirit["name"].InnerText; if (objXmlSpirit["translate"] != null) objItem.Name = objXmlSpirit["translate"].InnerText; else objItem.Name = objXmlSpirit["name"].InnerText; lstSpirit.Add(objItem); } objSpiritSort = new SortListItem(); lstSpirit.Sort(objSpiritSort.Compare); cboSpiritIllusion.ValueMember = "Value"; cboSpiritIllusion.DisplayMember = "Name"; cboSpiritIllusion.DataSource = lstSpirit; // Populate the Magician Custom Spirits lists - Manipulation. lstSpirit = new List<ListItem>(); objSpiritBlank = new ListItem(); objSpiritBlank.Value = ""; objSpiritBlank.Name = ""; lstSpirit.Add(objSpiritBlank); foreach (XmlNode objXmlSpirit in objXmlDocument.SelectNodes("/chummer/spirits/spirit")) { ListItem objItem = new ListItem(); objItem.Value = objXmlSpirit["name"].InnerText; if (objXmlSpirit["translate"] != null) objItem.Name = objXmlSpirit["translate"].InnerText; else objItem.Name = objXmlSpirit["name"].InnerText; lstSpirit.Add(objItem); } objSpiritSort = new SortListItem(); lstSpirit.Sort(objSpiritSort.Compare); cboSpiritManipulation.ValueMember = "Value"; cboSpiritManipulation.DisplayMember = "Name"; cboSpiritManipulation.DataSource = lstSpirit; // Load the Metatype information before going anywhere else. Doing this later causes the Attributes to get messed up because of calls // to UpdateCharacterInformation(); MetatypeSelected(); // If the character is a Mystic Adept, set the values for the Mystic Adept NUD. if (_objCharacter.AdeptEnabled && _objCharacter.MagicianEnabled) { nudMysticAdeptMAGMagician.Maximum = _objCharacter.MAG.TotalValue; nudMysticAdeptMAGMagician.Value = _objCharacter.MAGMagician; lblMysticAdeptAssignment.Visible = true; nudMysticAdeptMAGMagician.Visible = true; } // Nuyen can be affected by Qualities, so adjust the total amount available to the character. if (_objCharacter.IgnoreRules == false) { nudNuyen.Maximum = _objCharacter.NuyenMaximumBP; } else { nudNuyen.Maximum = int.MaxValue / 2000 - 75000; // To ensure there is no overflow in character nuyen even with max karma to nuyen and in debt quality } if (_objCharacter.BornRich) nudNuyen.Maximum += 30; nudNuyen.Value = _objCharacter.NuyenBP; // Load the Skills information. objXmlDocument = XmlManager.Instance.Load("skills.xml"); int i = -1; // Populate Contacts and Enemies. int intContact = -1; int intEnemy = -1; foreach (Contact objContact in _objCharacter.Contacts) { if (objContact.EntityType == ContactType.Contact) { intContact++; ContactControl objContactControl = new ContactControl(_objCharacter); // Attach an EventHandler for the ConnectionRatingChanged, LoyaltyRatingChanged, DeleteContact, FileNameChanged Events and OtherCostChanged objContactControl.ConnectionRatingChanged += objContact_ConnectionRatingChanged; objContactControl.LoyaltyRatingChanged += objContact_LoyaltyRatingChanged; objContactControl.DeleteContact += objContact_DeleteContact; objContactControl.FileNameChanged += objContact_FileNameChanged; objContactControl.FreeRatingChanged += objContact_OtherCostChanged; objContactControl.ContactObject = objContact; objContactControl.ContactName = objContact.Name; objContactControl.ContactLocation = objContact.Location; objContactControl.ContactRole = objContact.Role; objContactControl.ConnectionRating = objContact.Connection; objContactControl.LoyaltyRating = objContact.Loyalty; objContactControl.EntityType = objContact.EntityType; objContactControl.BackColor = objContact.Colour; objContactControl.IsGroup = objContact.IsGroup; objContactControl.MouseDown += panContactControl_MouseDown; objContactControl.Top = intContact * objContactControl.Height; panContacts.Controls.Add(objContactControl); } if (objContact.EntityType == ContactType.Enemy) { intEnemy++; ContactControl objContactControl = new ContactControl(_objCharacter); // Attach an EventHandler for the ConnectioNRatingChanged, LoyaltyRatingChanged, DeleteContact, and FileNameChanged Events. objContactControl.ConnectionRatingChanged += objEnemy_ConnectionRatingChanged; objContactControl.LoyaltyRatingChanged += objEnemy_LoyaltyRatingChanged; objContactControl.GroupStatusChanged += objEnemy_GroupStatusChanged; objContactControl.FreeRatingChanged += objEnemy_FreeStatusChanged; objContactControl.DeleteContact += objEnemy_DeleteContact; objContactControl.FileNameChanged += objEnemy_FileNameChanged; objContactControl.ContactObject = objContact; objContactControl.IsEnemy = true; objContactControl.ContactName = objContact.Name; objContactControl.ContactLocation = objContact.Location; objContactControl.ContactRole = objContact.Role; objContactControl.ConnectionRating = objContact.Connection; objContactControl.LoyaltyRating = objContact.Loyalty; objContactControl.EntityType = objContact.EntityType; objContactControl.BackColor = objContact.Colour; objContactControl.IsGroup = objContact.IsGroup; objContactControl.Top = intEnemy * objContactControl.Height; panEnemies.Controls.Add(objContactControl); } if (objContact.EntityType == ContactType.Pet) { PetControl objContactControl = new PetControl(); // Attach an EventHandler for the DeleteContact and FileNameChanged Events. objContactControl.DeleteContact += objPet_DeleteContact; objContactControl.FileNameChanged += objPet_FileNameChanged; objContactControl.ContactObject = objContact; objContactControl.ContactName = objContact.Name; objContactControl.BackColor = objContact.Colour; panPets.Controls.Add(objContactControl); } } // Populate Armor. // Start by populating Locations. foreach (string strLocation in _objCharacter.ArmorBundles) { TreeNode objLocation = new TreeNode(); objLocation.Tag = strLocation; objLocation.Text = strLocation; objLocation.ContextMenuStrip = cmsArmorLocation; treArmor.Nodes.Add(objLocation); } foreach (Armor objArmor in _objCharacter.Armor) { _objFunctions.CreateArmorTreeNode(objArmor, treArmor, cmsArmor, cmsArmorMod, cmsArmorGear); } // Populate Weapons. // Start by populating Locations. foreach (string strLocation in _objCharacter.WeaponLocations) { TreeNode objLocation = new TreeNode(); objLocation.Tag = strLocation; objLocation.Text = strLocation; objLocation.ContextMenuStrip = cmsWeaponLocation; treWeapons.Nodes.Add(objLocation); } foreach (Weapon objWeapon in _objCharacter.Weapons) { _objFunctions.CreateWeaponTreeNode(objWeapon, treWeapons.Nodes[0], cmsWeapon, cmsWeaponAccessory, cmsWeaponAccessoryGear); } PopulateCyberwareList(); // Populate Spell list. foreach (Spell objSpell in _objCharacter.Spells) { treSpells.Add(objSpell, cmsSpell, _objCharacter); } // Populate Adept Powers. i = -1; foreach (Power objPower in _objCharacter.Powers) { i++; PowerControl objPowerControl = new PowerControl(); objPowerControl.PowerObject = objPower; // Attach an EventHandler for the PowerRatingChanged Event. objPowerControl.PowerRatingChanged += objPower_PowerRatingChanged; objPowerControl.DeletePower += objPower_DeletePower; objPowerControl.PowerName = objPower.Name; objPowerControl.Extra = objPower.Extra; objPowerControl.PointsPerLevel = objPower.PointsPerLevel; objPowerControl.AdeptWayDiscount = objPower.AdeptWayDiscount; objPowerControl.LevelEnabled = objPower.LevelsEnabled; if (objPower.MaxLevels > 0) { if (objPower.Name == "Improved Ability (skill)") { foreach (Skill objSkill in _objCharacter.SkillsSection.Skills) if (objPower.Extra == objSkill.Name || (objSkill.IsExoticSkill && objPower.Extra == (objSkill.DisplayName + " (" + (objSkill as ExoticSkill).Specific + ")"))) { int intImprovedAbilityMaximum = objSkill.Rating + (objSkill.Rating / 2); if (intImprovedAbilityMaximum == 0) { intImprovedAbilityMaximum = 1; } objPower.MaxLevels = intImprovedAbilityMaximum; } else { objPowerControl.MaxLevels = objPower.MaxLevels; } } else { objPowerControl.MaxLevels = objPower.MaxLevels; } } objPowerControl.RefreshMaximum(_objCharacter.MAG.TotalValue); if (objPower.Rating < 1) objPower.Rating = 1; objPowerControl.PowerLevel = Convert.ToInt32(objPower.Rating); if (objPower.DiscountedAdeptWay) objPowerControl.DiscountedByAdeptWay = true; if (objPower.DiscountedGeas) objPowerControl.DiscountedByGeas = true; objPowerControl.Top = i * objPowerControl.Height; panPowers.Controls.Add(objPowerControl); } // Populate Magician Spirits. i = -1; foreach (Spirit objSpirit in _objCharacter.Spirits) { if (objSpirit.EntityType == SpiritType.Spirit) { i++; SpiritControl objSpiritControl = new SpiritControl(); objSpiritControl.SpiritObject = objSpirit; // Attach an EventHandler for the ServicesOwedChanged Event. objSpiritControl.ServicesOwedChanged += objSpirit_ServicesOwedChanged; objSpiritControl.ForceChanged += objSpirit_ForceChanged; objSpiritControl.BoundChanged += objSpirit_BoundChanged; objSpiritControl.DeleteSpirit += objSpirit_DeleteSpirit; objSpiritControl.FileNameChanged += objSpirit_FileNameChanged; objSpiritControl.SpiritName = objSpirit.Name; objSpiritControl.ServicesOwed = objSpirit.ServicesOwed; if (_objCharacter.AdeptEnabled && _objCharacter.MagicianEnabled) { if (_objOptions.SpiritForceBasedOnTotalMAG) objSpiritControl.ForceMaximum = _objCharacter.MAG.TotalValue; else objSpiritControl.ForceMaximum = _objCharacter.MAGMagician; } else objSpiritControl.ForceMaximum = _objCharacter.MAG.TotalValue; objSpiritControl.CritterName = objSpirit.CritterName; objSpiritControl.Force = objSpirit.Force; objSpiritControl.Bound = objSpirit.Bound; objSpiritControl.RebuildSpiritList(_objCharacter.MagicTradition); objSpiritControl.Top = i * objSpiritControl.Height; panSpirits.Controls.Add(objSpiritControl); } } // Populate Technomancer Sprites. i = -1; foreach (Spirit objSpirit in _objCharacter.Spirits) { if (objSpirit.EntityType == SpiritType.Sprite) { i++; SpiritControl objSpiritControl = new SpiritControl(); objSpiritControl.SpiritObject = objSpirit; objSpiritControl.EntityType = SpiritType.Sprite; // Attach an EventHandler for the ServicesOwedChanged Event. objSpiritControl.ServicesOwedChanged += objSprite_ServicesOwedChanged; objSpiritControl.ForceChanged += objSprite_ForceChanged; objSpiritControl.BoundChanged += objSprite_BoundChanged; objSpiritControl.DeleteSpirit += objSprite_DeleteSpirit; objSpiritControl.FileNameChanged += objSprite_FileNameChanged; objSpiritControl.SpiritName = objSpirit.Name; objSpiritControl.ServicesOwed = objSpirit.ServicesOwed; objSpiritControl.ForceMaximum = _objCharacter.RES.TotalValue; objSpiritControl.CritterName = objSpiritControl.CritterName; objSpiritControl.Force = objSpirit.Force; objSpiritControl.Bound = objSpirit.Bound; objSpiritControl.RebuildSpiritList(_objCharacter.TechnomancerStream); objSpiritControl.Top = i * objSpiritControl.Height; panSprites.Controls.Add(objSpiritControl); } } // Populate Technomancer Complex Forms/Programs. foreach (ComplexForm objProgram in _objCharacter.ComplexForms) { TreeNode objNode = new TreeNode(); objNode.Text = objProgram.DisplayName; objNode.Tag = objProgram.InternalId; if (objProgram.Notes != string.Empty) objNode.ForeColor = Color.SaddleBrown; objNode.ToolTipText = CommonFunctions.WordWrap(objProgram.Notes, 100); treComplexForms.Nodes[0].Nodes.Add(objNode); treComplexForms.Nodes[0].Expand(); } // Populate Martial Arts. foreach (MartialArt objMartialArt in _objCharacter.MartialArts) { TreeNode objMartialArtNode = new TreeNode(); objMartialArtNode.Text = objMartialArt.DisplayName; objMartialArtNode.Tag = objMartialArt.Name; objMartialArtNode.ContextMenuStrip = cmsMartialArts; if (objMartialArt.Notes != string.Empty) objMartialArtNode.ForeColor = Color.SaddleBrown; objMartialArtNode.ToolTipText = CommonFunctions.WordWrap(objMartialArt.Notes, 100); foreach (MartialArtAdvantage objAdvantage in objMartialArt.Advantages) { TreeNode objAdvantageNode = new TreeNode(); objAdvantageNode.Text = objAdvantage.DisplayName; objAdvantageNode.Tag = objAdvantage.InternalId; objAdvantageNode.ContextMenuStrip = cmsTechnique; if (objAdvantage.Notes != string.Empty) objAdvantageNode.ForeColor = Color.SaddleBrown; else objAdvantageNode.ForeColor = SystemColors.WindowText; objAdvantageNode.ToolTipText = CommonFunctions.WordWrap(objAdvantage.Notes, 100); objMartialArtNode.Nodes.Add(objAdvantageNode); objMartialArtNode.Expand(); } if (objMartialArt.IsQuality) { treMartialArts.Nodes[1].Nodes.Add(objMartialArtNode); treMartialArts.Nodes[1].Expand(); } else { treMartialArts.Nodes[0].Nodes.Add(objMartialArtNode); treMartialArts.Nodes[0].Expand(); } } // Populate Limit Modifiers. foreach (LimitModifier objLimitModifier in _objCharacter.LimitModifiers) { TreeNode objLimitModifierNode = new TreeNode(); objLimitModifierNode.Text = objLimitModifier.DisplayName; objLimitModifierNode.Tag = objLimitModifier.Name; objLimitModifierNode.ContextMenuStrip = cmsMartialArts; if (objLimitModifier.Notes != string.Empty) objLimitModifierNode.ForeColor = Color.SaddleBrown; objLimitModifierNode.ToolTipText = CommonFunctions.WordWrap(objLimitModifier.Notes, 100); objLimitModifierNode.ContextMenuStrip = cmsLimitModifier; switch (objLimitModifier.Limit) { case "Physical": treLimit.Nodes[0].Nodes.Add(objLimitModifierNode); treLimit.Nodes[0].Expand(); break; case "Mental": treLimit.Nodes[1].Nodes.Add(objLimitModifierNode); treLimit.Nodes[1].Expand(); break; case "Social": treLimit.Nodes[2].Nodes.Add(objLimitModifierNode); treLimit.Nodes[2].Expand(); break; } } // Populate Lifestyles. foreach (Lifestyle objLifestyle in _objCharacter.Lifestyles) { TreeNode objLifestyleNode = new TreeNode(); objLifestyleNode.Text = objLifestyle.DisplayName; objLifestyleNode.Tag = objLifestyle.InternalId; if (objLifestyle.StyleType.ToString() != "Standard") objLifestyleNode.ContextMenuStrip = cmsAdvancedLifestyle; else objLifestyleNode.ContextMenuStrip = cmsLifestyleNotes; if (objLifestyle.Notes != string.Empty) objLifestyleNode.ForeColor = Color.SaddleBrown; objLifestyleNode.ToolTipText = CommonFunctions.WordWrap(objLifestyle.Notes, 100); treLifestyles.Nodes[0].Nodes.Add(objLifestyleNode); } treLifestyles.Nodes[0].Expand(); PopulateGearList(); // Populate Foci. _objController.PopulateFocusList(treFoci); // Populate Vehicles. foreach (Vehicle objVehicle in _objCharacter.Vehicles) { _objFunctions.CreateVehicleTreeNode(objVehicle, treVehicles, cmsVehicle, cmsVehicleLocation, cmsVehicleWeapon, cmsVehicleWeaponAccessory, cmsVehicleWeaponAccessoryGear, cmsVehicleGear); } // Populate Initiation/Submersion information. if (_objCharacter.InitiateGrade > 0 || _objCharacter.SubmersionGrade > 0) { foreach (Metamagic objMetamagic in _objCharacter.Metamagics) { TreeNode objNode = new TreeNode(); objNode.Text = objMetamagic.DisplayName; objNode.Tag = objMetamagic.InternalId; objNode.ContextMenuStrip = cmsMetamagic; if (objMetamagic.Notes != string.Empty) objNode.ForeColor = Color.SaddleBrown; objNode.ToolTipText = CommonFunctions.WordWrap(objMetamagic.Notes, 100); treMetamagic.Nodes.Add(objNode); } } // Populate Critter Powers. foreach (CritterPower objPower in _objCharacter.CritterPowers) { TreeNode objNode = new TreeNode(); objNode.Text = objPower.DisplayName; objNode.Tag = objPower.InternalId; objNode.ContextMenuStrip = cmsCritterPowers; if (objPower.Notes != string.Empty) objNode.ForeColor = Color.SaddleBrown; objNode.ToolTipText = CommonFunctions.WordWrap(objPower.Notes, 100); if (objPower.Category != "Weakness") { treCritterPowers.Nodes[0].Nodes.Add(objNode); treCritterPowers.Nodes[0].Expand(); } else { treCritterPowers.Nodes[1].Nodes.Add(objNode); treCritterPowers.Nodes[1].Expand(); } } // Load the Cyberware information. objXmlDocument = XmlManager.Instance.Load("cyberware.xml"); // Populate the Grade list. List<ListItem> lstCyberwareGrades = new List<ListItem>(); foreach (Grade objGrade in GlobalOptions.CyberwareGrades) { ListItem objItem = new ListItem(); objItem.Value = objGrade.Name; objItem.Name = objGrade.DisplayName; lstCyberwareGrades.Add(objItem); } cboCyberwareGrade.ValueMember = "Value"; cboCyberwareGrade.DisplayMember = "Name"; cboCyberwareGrade.DataSource = lstCyberwareGrades; _blnLoading = false; // Select the Magician's Tradition. if (_objCharacter.MagicTradition != "") cboTradition.SelectedValue = _objCharacter.MagicTradition; if (_objCharacter.TraditionName != "") txtTraditionName.Text = _objCharacter.TraditionName; if (_objCharacter.TraditionDrain != "") cboDrain.SelectedValue = _objCharacter.TraditionDrain; if (_objCharacter.SpiritCombat != "") cboSpiritCombat.SelectedValue = _objCharacter.SpiritCombat; if (_objCharacter.SpiritDetection != "") cboSpiritDetection.SelectedValue = _objCharacter.SpiritDetection; if (_objCharacter.SpiritHealth != "") cboSpiritHealth.SelectedValue = _objCharacter.SpiritHealth; if (_objCharacter.SpiritIllusion != "") cboSpiritIllusion.SelectedValue = _objCharacter.SpiritIllusion; if (_objCharacter.SpiritManipulation != "") cboSpiritManipulation.SelectedValue = _objCharacter.SpiritManipulation; // Clear the Dirty flag which gets set when creating a new Character. CalculateBP(); CalculateNuyen(); _blnIsDirty = false; UpdateWindowTitle(); if (_objCharacter.AdeptEnabled) CalculatePowerPoints(); treGear.ItemDrag += treGear_ItemDrag; treGear.DragEnter += treGear_DragEnter; treGear.DragDrop += treGear_DragDrop; treLifestyles.ItemDrag += treLifestyles_ItemDrag; treLifestyles.DragEnter += treLifestyles_DragEnter; treLifestyles.DragDrop += treLifestyles_DragDrop; treArmor.ItemDrag += treArmor_ItemDrag; treArmor.DragEnter += treArmor_DragEnter; treArmor.DragDrop += treArmor_DragDrop; treWeapons.ItemDrag += treWeapons_ItemDrag; treWeapons.DragEnter += treWeapons_DragEnter; treWeapons.DragDrop += treWeapons_DragDrop; treVehicles.ItemDrag += treVehicles_ItemDrag; treVehicles.DragEnter += treVehicles_DragEnter; treVehicles.DragDrop += treVehicles_DragDrop; // Merge the ToolStrips. ToolStripManager.RevertMerge("toolStrip"); ToolStripManager.Merge(toolStrip, "toolStrip"); // If this is a Sprite, re-label the Mental CharacterAttribute Labels. if (_objCharacter.Metatype.EndsWith("Sprite")) { lblBODLabel.Enabled = false; nudBOD.Enabled = false; lblAGILabel.Enabled = false; nudAGI.Enabled = false; lblREALabel.Enabled = false; nudREA.Enabled = false; lblSTRLabel.Enabled = false; nudSTR.Enabled = false; lblCHALabel.Text = LanguageManager.Instance.GetString("String_AttributePilot"); lblINTLabel.Text = LanguageManager.Instance.GetString("String_AttributeResponse"); lblLOGLabel.Text = LanguageManager.Instance.GetString("String_AttributeFirewall"); lblWILLabel.Enabled = false; nudWIL.Enabled = false; } else if (_objCharacter.Metatype.EndsWith("A.I.") || _objCharacter.MetatypeCategory == "Technocritters" || _objCharacter.MetatypeCategory == "Protosapients") { lblRatingLabel.Visible = true; lblRating.Visible = true; lblSystemLabel.Visible = true; lblSystem.Visible = true; lblFirewallLabel.Visible = true; lblFirewall.Visible = true; lblResponseLabel.Visible = true; nudResponse.Visible = true; nudResponse.Enabled = true; nudResponse.Value = _objCharacter.Response; lblSignalLabel.Visible = true; nudSignal.Visible = true; nudSignal.Enabled = true; nudSignal.Value = _objCharacter.Signal; // Disable the Physical CharacterAttribute controls. lblBODLabel.Enabled = false; lblAGILabel.Enabled = false; lblREALabel.Enabled = false; lblSTRLabel.Enabled = false; nudBOD.Enabled = false; nudAGI.Enabled = false; nudREA.Enabled = false; nudSTR.Enabled = false; } mnuSpecialConvertToFreeSprite.Visible = _objCharacter.IsSprite; if (_objCharacter.MetatypeCategory == "Mundane Critters") mnuSpecialMutantCritter.Visible = true; if (_objCharacter.MetatypeCategory == "Mutant Critters") mnuSpecialToxicCritter.Visible = true; if (_objCharacter.MetatypeCategory == "Cyberzombie") mnuSpecialCyberzombie.Visible = false; treCyberware.SortCustom(); treSpells.SortCustom(); treComplexForms.SortCustom(); treQualities.SortCustom(); treCritterPowers.SortCustom(); treMartialArts.SortCustom(); UpdateMentorSpirits(); UpdateInitiationGradeTree(); UpdateCharacterInfo(); _blnIsDirty = false; UpdateWindowTitle(false); RefreshPasteStatus(); // Stupid hack to get the MDI icon to show up properly. this.Icon = this.Icon.Clone() as System.Drawing.Icon; Timekeeper.Finish("load_frm_create"); Timekeeper.Finish("loading"); }