private void SkillList_Click(object sender, EventArgs e) { newToolStripMenuItem4.HideDropDown(); try { // Make sure that if the class was changed, the new skill list is loaded if (lastClass != CurrentWSG.Class) { DoSkillList(); } // Look up the name of the selected skill from its display text string skillName = SkillsAllXml.XmlReadAssociatedValue("Name", "SkillName", (string)SkillList.SelectedItem); if (skillName == "") { skillName = (string)SkillList.SelectedItem; } // If the skill is already in the tree, just select it and do nothing TreeNodeAdv skillNode = SkillTree.FindFirstNodeByTag(skillName, false); if (skillNode != null) { SkillTree.SelectedNode = skillNode; return; } // Add enough room for the new skill in each of the skill arrays CurrentWSG.NumberOfSkills = CurrentWSG.NumberOfSkills + 1; Util.ResizeArrayLarger(ref CurrentWSG.SkillNames, CurrentWSG.NumberOfSkills); Util.ResizeArrayLarger(ref CurrentWSG.LevelOfSkills, CurrentWSG.NumberOfSkills); Util.ResizeArrayLarger(ref CurrentWSG.ExpOfSkills, CurrentWSG.NumberOfSkills); Util.ResizeArrayLarger(ref CurrentWSG.InUse, CurrentWSG.NumberOfSkills); // Set the data for the new skill. int index = CurrentWSG.NumberOfSkills - 1; CurrentWSG.InUse[index] = -1; CurrentWSG.LevelOfSkills[index] = 0; CurrentWSG.ExpOfSkills[index] = 01; CurrentWSG.SkillNames[CurrentWSG.NumberOfSkills - 1] = skillName; DoSkillTree(); } catch { MessageBox.Show("Could not add new Skill."); } }