Ejemplo n.º 1
0
		private void tsMetamagicAddMetamagic_Click(object sender, EventArgs e)
        {
            if (treMetamagic.SelectedNode.Level != 0)
                return;

            int intGrade = 0;
            foreach (InitiationGrade objGrade in _objCharacter.InitiationGrades)
            {
                if (objGrade.InternalId == treMetamagic.SelectedNode.Tag.ToString())
                {
                    intGrade = objGrade.Grade;
                    break;
                }
            }

            frmSelectMetamagic frmPickMetamagic = new frmSelectMetamagic(_objCharacter);
            if (_objCharacter.RESEnabled)
                frmPickMetamagic.WindowMode = frmSelectMetamagic.Mode.Echo;
            frmPickMetamagic.ShowDialog(this);

            // Make sure a value was selected.
            if (frmPickMetamagic.DialogResult == DialogResult.Cancel)
                return;

            string strMetamagic = frmPickMetamagic.SelectedMetamagic;

            XmlDocument objXmlDocument = new XmlDocument();
            XmlNode objXmlMetamagic;

            TreeNode objNode = new TreeNode();
            Metamagic objNewMetamagic = new Metamagic(_objCharacter);
            Improvement.ImprovementSource objSource;

            if (_objCharacter.MAGEnabled)
            {
                objXmlDocument = XmlManager.Instance.Load("metamagic.xml");
                objXmlMetamagic = objXmlDocument.SelectSingleNode("/chummer/metamagics/metamagic[name = \"" + strMetamagic + "\"]");
                objSource = Improvement.ImprovementSource.Metamagic;
            }
            else
            {
                objXmlDocument = XmlManager.Instance.Load("echoes.xml");
                objXmlMetamagic = objXmlDocument.SelectSingleNode("/chummer/echoes/echo[name = \"" + strMetamagic + "\"]");
                objSource = Improvement.ImprovementSource.Echo;
            }

            objNewMetamagic.Create(objXmlMetamagic, _objCharacter, objNode, objSource);
            objNewMetamagic.Grade = intGrade;
            objNode.ContextMenuStrip = cmsInitiationNotes;
            if (objNewMetamagic.InternalId == Guid.Empty.ToString())
                return;

            _objCharacter.Metamagics.Add(objNewMetamagic);

			treMetamagic.SelectedNode.Nodes.Add(objNode);
            treMetamagic.SelectedNode.Expand();

            UpdateCharacterInfo();

            _blnIsDirty = true;
            UpdateWindowTitle();

            if (frmPickMetamagic.AddAgain)
                cmdAddMetamagic_Click(sender, e);
        }
Ejemplo n.º 2
0
        private void tsMetamagicAddMetamagic_Click(object sender, EventArgs e)
        {
            // Character can only have a number of Metamagics/Echoes equal to their Initiate Grade. Additional ones cost Karma.
            bool blnPayWithKarma = false;
            string strType = "";

            if (treMetamagic.SelectedNode.Level != 0)
                return;

            int intGrade = 0;
            foreach (InitiationGrade objGrade in _objCharacter.InitiationGrades)
            {
                if (objGrade.InternalId == treMetamagic.SelectedNode.Tag.ToString())
                {
                    intGrade = objGrade.Grade;
                    break;
                }
            }

            // Evaluate each object
            foreach (Metamagic objMetamagic in _objCharacter.Metamagics)
            {
                if (objMetamagic.Grade == intGrade)
                    blnPayWithKarma = true;
            }

            foreach (Spell objSpell in _objCharacter.Spells)
            {
                if (objSpell.Grade == intGrade)
                    blnPayWithKarma = true;
            }

            // Additional Metamagics beyond the standard 1 per Grade cost additional Karma, so ask if the user wants to spend the additional Karma.
            if (blnPayWithKarma && _objCharacter.Karma < _objOptions.KarmaMetamagic)
            {
                // Make sure the Karma expense would not put them over the limit.
                MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (_objCharacter.MAGEnabled && blnPayWithKarma)
            {
                if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseSpend").Replace("{0}", LanguageManager.Instance.GetString("String_Metamagic")).Replace("{1}", _objOptions.KarmaSpell.ToString())))
                    return;
            }
            else if (blnPayWithKarma)
            {
                if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseSpend").Replace("{0}", LanguageManager.Instance.GetString("String_Echo")).Replace("{1}", _objOptions.KarmaSpell.ToString())))
                    return;
            }

            frmSelectMetamagic frmPickMetamagic = new frmSelectMetamagic(_objCharacter);
            if (_objCharacter.RESEnabled)
                frmPickMetamagic.WindowMode = frmSelectMetamagic.Mode.Echo;
            frmPickMetamagic.ShowDialog(this);

            // Make sure a value was selected.
            if (frmPickMetamagic.DialogResult == DialogResult.Cancel)
                return;

            string strMetamagic = frmPickMetamagic.SelectedMetamagic;

            XmlDocument objXmlDocument = new XmlDocument();
            XmlNode objXmlMetamagic;

            TreeNode objNode = new TreeNode();
            Metamagic objNewMetamagic = new Metamagic(_objCharacter);
            Improvement.ImprovementSource objSource;

            if (_objCharacter.MAGEnabled)
            {
                objXmlDocument = XmlManager.Instance.Load("metamagic.xml");
                objXmlMetamagic = objXmlDocument.SelectSingleNode("/chummer/metamagics/metamagic[name = \"" + strMetamagic + "\"]");
                objSource = Improvement.ImprovementSource.Metamagic;
            }
            else
            {
                objXmlDocument = XmlManager.Instance.Load("echoes.xml");
                objXmlMetamagic = objXmlDocument.SelectSingleNode("/chummer/echoes/echo[name = \"" + strMetamagic + "\"]");
                objSource = Improvement.ImprovementSource.Echo;
            }

            objNewMetamagic.Create(objXmlMetamagic, _objCharacter, objNode, objSource);
            objNewMetamagic.Grade = intGrade;
            objNode.ContextMenuStrip = cmsInitiationNotes;
            if (objNewMetamagic.InternalId == Guid.Empty.ToString())
                return;

            _objCharacter.Metamagics.Add(objNewMetamagic);

            if (blnPayWithKarma)
            {
                // Create the Expense Log Entry.
                ExpenseLogEntry objEntry = new ExpenseLogEntry();
                objEntry.Create(_objOptions.KarmaMetamagic * -1, strType + " " + frmPickMetamagic.SelectedMetamagic, ExpenseType.Karma, DateTime.Now);
                _objCharacter.ExpenseEntries.Add(objEntry);

                ExpenseUndo objUndo = new ExpenseUndo();
                objUndo.CreateKarma(KarmaExpenseType.AddMetamagic, objNewMetamagic.InternalId);
                objEntry.Undo = objUndo;

                // Adjust the character's Karma total.
                _objCharacter.Karma -= _objOptions.KarmaMetamagic;
            }

            treMetamagic.SelectedNode.Nodes.Add(objNode);
            treMetamagic.SelectedNode.Expand();

            UpdateCharacterInfo();

            _blnIsDirty = true;
            UpdateWindowTitle();

            if (frmPickMetamagic.AddAgain)
                cmdAddMetamagic_Click(sender, e);
        }
Ejemplo n.º 3
0
        private void cmdAddMetamagic_Click(object sender, EventArgs e)
        {
            // Character can only have a number of Metamagics/Echoes equal to their Initiate Grade. Additional ones cost Karma.
            bool blnPayWithKarma = false;
            int intCount = 0;

            // Count the number of free Metamagics the character has and compare it to their Initiate Grade. If they have reached their limit, a new one is added for Karma.
            foreach (Metamagic objCharacterMetamagic in _objCharacter.Metamagics)
            {
                if (!objCharacterMetamagic.PaidWithKarma)
                    intCount++;
            }

            // Make sure the character has Initiated.
            if (Convert.ToInt32(lblInitiateGrade.Text) == 0)
            {
                if (_objCharacter.MAGEnabled)
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotSelectMetamagic"), LanguageManager.Instance.GetString("MessageTitle_CannotSelectMetamagic"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                else if (_objCharacter.RESEnabled)
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotSelectEcho"), LanguageManager.Instance.GetString("MessageTitle_CannotSelectEcho"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            // Character can only have MAG/RES + Grade Metamagics. Do not let them go beyond this limit.
            if (intCount + 1 > Convert.ToInt32(lblInitiateGrade.Text))
            {
                string strMessage = "";
                string strTitle = "";
                int intGrade = Convert.ToInt32(lblInitiateGrade.Text);
                int intAttribute = 0;

                if (_objCharacter.MAGEnabled)
                    intAttribute = _objCharacter.MAG.TotalValue;
                else
                    intAttribute = _objCharacter.RES.TotalValue;

                if (intCount + 1 > intAttribute + intGrade)
                {
                    if (_objCharacter.MAGEnabled)
                    {
                        strMessage = LanguageManager.Instance.GetString("Message_AdditionalMetamagicLimit");
                        strTitle = LanguageManager.Instance.GetString("MessageTitle_AdditionalMetamagic");
                    }
                    else if (_objCharacter.RESEnabled)
                    {
                        strMessage = LanguageManager.Instance.GetString("Message_AdditionalEchoLimit");
                        strTitle = LanguageManager.Instance.GetString("MessageTitle_CannotSelectEcho");
                    }

                    MessageBox.Show(strMessage, strTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            // Additional Metamagics beyond the standard 1 per Grade cost additional Karma, so ask if the user wants to spend the additional Karma.
            if (intCount >= Convert.ToInt32(lblInitiateGrade.Text))
            {
                string strMessage = "";
                string strTitle = "";
                if (_objCharacter.MAGEnabled)
                {
                    strMessage = LanguageManager.Instance.GetString("Message_AdditionalMetamagic").Replace("{0}", _objOptions.KarmaMetamagic.ToString());
                    strTitle = LanguageManager.Instance.GetString("MessageTitle_AdditionalMetamagic");
                }
                else if (_objCharacter.RESEnabled)
                {
                    strMessage = LanguageManager.Instance.GetString("Message_AdditionalEcho").Replace("{0}", _objOptions.KarmaMetamagic.ToString());
                    strTitle = LanguageManager.Instance.GetString("MessageTitle_AdditionalEcho");
                }

                if (MessageBox.Show(strMessage, strTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    return;
                else
                    blnPayWithKarma = true;
            }

            frmSelectMetamagic frmPickMetamagic = new frmSelectMetamagic(_objCharacter);
            if (_objCharacter.RESEnabled)
                frmPickMetamagic.WindowMode = frmSelectMetamagic.Mode.Echo;
            frmPickMetamagic.ShowDialog(this);

            // Make sure a value was selected.
            if (frmPickMetamagic.DialogResult == DialogResult.Cancel)
                return;

            string strMetamagic = frmPickMetamagic.SelectedMetamagic;

            XmlDocument objXmlDocument = new XmlDocument();
            XmlNode objXmlMetamagic;

            TreeNode objNode = new TreeNode();
            Metamagic objMetamagic = new Metamagic(_objCharacter);
            Improvement.ImprovementSource objSource;

            if (_objCharacter.MAGEnabled)
            {
                objXmlDocument = XmlManager.Instance.Load("metamagic.xml");
                objXmlMetamagic = objXmlDocument.SelectSingleNode("/chummer/metamagics/metamagic[name = \"" + strMetamagic + "\"]");
                objSource = Improvement.ImprovementSource.Metamagic;
            }
            else
            {
                objXmlDocument = XmlManager.Instance.Load("echoes.xml");
                objXmlMetamagic = objXmlDocument.SelectSingleNode("/chummer/echoes/echo[name = \"" + strMetamagic + "\"]");
                objSource = Improvement.ImprovementSource.Echo;
            }

            objMetamagic.Create(objXmlMetamagic, _objCharacter, objNode, objSource);
            objNode.ContextMenuStrip = cmsMetamagic;
            if (objMetamagic.InternalId == Guid.Empty.ToString())
                return;

            objMetamagic.PaidWithKarma = blnPayWithKarma;
            _objCharacter.Metamagics.Add(objMetamagic);

            treMetamagic.Nodes.Add(objNode);

            UpdateCharacterInfo();

            _blnIsDirty = true;
            UpdateWindowTitle();

            if (frmPickMetamagic.AddAgain)
                cmdAddMetamagic_Click(sender, e);
        }
Ejemplo n.º 4
0
        private void cmdChangeSelection_Click(object sender, EventArgs e)
        {
            switch (_strSelect)
            {
            case "SelectActionDicePool":
                List <ListItem> lstActions;
                using (XmlNodeList xmlActionList = _objCharacter.LoadData("actions.xml").SelectNodes("/chummer/actions/action"))
                {
                    lstActions = new List <ListItem>(xmlActionList?.Count ?? 0);
                    if (xmlActionList?.Count > 0)
                    {
                        foreach (XmlNode xmlAction in xmlActionList)
                        {
                            string strName = xmlAction["name"]?.InnerText;
                            if (!string.IsNullOrEmpty(strName))
                            {
                                lstActions.Add(new ListItem(strName, xmlAction["translate"]?.InnerText ?? strName));
                            }
                        }
                    }
                }

                using (frmSelectItem frmSelectAction = new frmSelectItem
                {
                    Description = LanguageManager.GetString("Title_SelectAction")
                })
                {
                    frmSelectAction.SetDropdownItemsMode(lstActions);
                    frmSelectAction.ShowDialog(this);

                    if (frmSelectAction.DialogResult == DialogResult.OK)
                    {
                        txtSelect.Text             = frmSelectAction.SelectedName;
                        txtTranslateSelection.Text = TranslateField(_strSelect, frmSelectAction.SelectedName);
                    }
                }
                break;

            case "SelectAttribute":
            {
                List <string> lstAbbrevs = new List <string>(Backend.Attributes.AttributeSection.AttributeStrings);

                lstAbbrevs.Remove("ESS");
                if (!_objCharacter.MAGEnabled)
                {
                    lstAbbrevs.Remove("MAG");
                    lstAbbrevs.Remove("MAGAdept");
                }
                else if (!_objCharacter.IsMysticAdept || !_objCharacter.Options.MysAdeptSecondMAGAttribute)
                {
                    lstAbbrevs.Remove("MAGAdept");
                }

                if (!_objCharacter.RESEnabled)
                {
                    lstAbbrevs.Remove("RES");
                }
                if (!_objCharacter.DEPEnabled)
                {
                    lstAbbrevs.Remove("DEP");
                }
                using (frmSelectAttribute frmPickAttribute = new frmSelectAttribute(lstAbbrevs.ToArray())
                    {
                        Description = LanguageManager.GetString("Title_SelectAttribute")
                    })
                {
                    frmPickAttribute.ShowDialog(this);

                    if (frmPickAttribute.DialogResult == DialogResult.OK)
                    {
                        txtSelect.Text             = frmPickAttribute.SelectedAttribute;
                        txtTranslateSelection.Text = TranslateField(_strSelect, frmPickAttribute.SelectedAttribute);
                    }
                }
            }
            break;

            case "SelectEcho":
                using (frmSelectMetamagic frmPickMetamagic = new frmSelectMetamagic(_objCharacter, frmSelectMetamagic.Mode.Echo))
                {
                    frmPickMetamagic.ShowDialog(this);
                    if (frmPickMetamagic.DialogResult == DialogResult.OK)
                    {
                        txtSelect.Text             = frmPickMetamagic.SelectedMetamagic;
                        txtTranslateSelection.Text = TranslateField(_strSelect, frmPickMetamagic.SelectedMetamagic);
                    }
                }
                break;

            case "SelectMetamagic":
                using (frmSelectMetamagic frmPickMetamagic = new frmSelectMetamagic(_objCharacter, frmSelectMetamagic.Mode.Metamagic))
                {
                    frmPickMetamagic.ShowDialog(this);
                    if (frmPickMetamagic.DialogResult == DialogResult.OK)
                    {
                        txtSelect.Text             = frmPickMetamagic.SelectedMetamagic;
                        txtTranslateSelection.Text = TranslateField(_strSelect, frmPickMetamagic.SelectedMetamagic);
                    }
                }
                break;

            case "SelectMentalAttribute":
                using (frmSelectAttribute frmPickAttribute = new frmSelectAttribute(Backend.Attributes.AttributeSection.MentalAttributes.ToArray()))
                {
                    frmPickAttribute.Description = LanguageManager.GetString("Title_SelectAttribute");
                    frmPickAttribute.ShowDialog(this);

                    if (frmPickAttribute.DialogResult == DialogResult.OK)
                    {
                        txtSelect.Text             = frmPickAttribute.SelectedAttribute;
                        txtTranslateSelection.Text = TranslateField(_strSelect, frmPickAttribute.SelectedAttribute);
                    }
                }
                break;

            case "SelectPhysicalAttribute":
                using (frmSelectAttribute frmPickAttribute = new frmSelectAttribute(Backend.Attributes.AttributeSection.PhysicalAttributes.ToArray()))
                {
                    frmPickAttribute.Description = LanguageManager.GetString("Title_SelectAttribute");
                    frmPickAttribute.ShowDialog(this);

                    if (frmPickAttribute.DialogResult == DialogResult.OK)
                    {
                        txtSelect.Text             = frmPickAttribute.SelectedAttribute;
                        txtTranslateSelection.Text = TranslateField(_strSelect, frmPickAttribute.SelectedAttribute);
                    }
                }
                break;

            case "SelectSpecialAttribute":
            {
                List <string> lstAbbrevs = new List <string>(Backend.Attributes.AttributeSection.AttributeStrings);
                lstAbbrevs.RemoveAll(x => Backend.Attributes.AttributeSection.PhysicalAttributes.Contains(x) || Backend.Attributes.AttributeSection.MentalAttributes.Contains(x));
                lstAbbrevs.Remove("ESS");

                /*
                 * if (!_objCharacter.MAGEnabled)
                 * {
                 *  lstAbbrevs.Remove("MAG");
                 *  lstAbbrevs.Remove("MAGAdept");
                 * }
                 * else if (!_objCharacter.IsMysticAdept || !_objCharacter.Options.MysAdeptSecondMAGAttribute)
                 *  lstAbbrevs.Remove("MAGAdept");
                 *
                 * if (!_objCharacter.RESEnabled)
                 *  lstAbbrevs.Remove("RES");
                 * if (!_objCharacter.DEPEnabled)
                 *  lstAbbrevs.Remove("DEP");
                 */
                using (frmSelectAttribute frmPickAttribute = new frmSelectAttribute(lstAbbrevs.ToArray())
                    {
                        Description = LanguageManager.GetString("Title_SelectAttribute")
                    })
                {
                    frmPickAttribute.ShowDialog(this);

                    if (frmPickAttribute.DialogResult == DialogResult.OK)
                    {
                        txtSelect.Text             = frmPickAttribute.SelectedAttribute;
                        txtTranslateSelection.Text = TranslateField(_strSelect, frmPickAttribute.SelectedAttribute);
                    }
                }
            }
            break;

            case "SelectSkill":
                using (frmSelectSkill frmPickSkill = new frmSelectSkill(_objCharacter))
                {
                    frmPickSkill.Description = LanguageManager.GetString("Title_SelectSkill");
                    frmPickSkill.ShowDialog(this);

                    if (frmPickSkill.DialogResult == DialogResult.OK)
                    {
                        txtSelect.Text             = frmPickSkill.SelectedSkill;
                        txtTranslateSelection.Text = TranslateField(_strSelect, frmPickSkill.SelectedSkill);
                    }
                }
                break;

            case "SelectKnowSkill":
            {
                List <ListItem>  lstDropdownItems       = new List <ListItem>(_objCharacter.SkillsSection.KnowledgeSkills.Count);
                HashSet <string> setProcessedSkillNames = new HashSet <string>();
                foreach (KnowledgeSkill objKnowledgeSkill in _objCharacter.SkillsSection.KnowledgeSkills)
                {
                    lstDropdownItems.Add(new ListItem(objKnowledgeSkill.Name, objKnowledgeSkill.CurrentDisplayName));
                    setProcessedSkillNames.Add(objKnowledgeSkill.Name);
                }
                StringBuilder objFilter = new StringBuilder();
                if (setProcessedSkillNames.Count > 0)
                {
                    objFilter.Append("not(");
                    foreach (string strName in setProcessedSkillNames)
                    {
                        objFilter.Append("name = \"" + strName + "\" or ");
                    }

                    objFilter.Length -= 4;
                    objFilter.Append(')');
                }

                string strFilter = objFilter.Length > 0 ? '[' + objFilter.ToString() + ']' : string.Empty;
                using (XmlNodeList xmlSkillList = _objCharacter.LoadData("skills.xml").SelectNodes("/chummer/knowledgeskills/skill" + strFilter))
                {
                    if (xmlSkillList?.Count > 0)
                    {
                        foreach (XmlNode xmlSkill in xmlSkillList)
                        {
                            string strName = xmlSkill["name"]?.InnerText;
                            if (!string.IsNullOrEmpty(strName))
                            {
                                lstDropdownItems.Add(new ListItem(strName, xmlSkill["translate"]?.InnerText ?? strName));
                            }
                        }
                    }
                }

                lstDropdownItems.Sort(CompareListItems.CompareNames);

                using (frmSelectItem frmPickSkill = new frmSelectItem
                    {
                        Description = LanguageManager.GetString("Title_SelectSkill")
                    })
                {
                    frmPickSkill.SetDropdownItemsMode(lstDropdownItems);
                    frmPickSkill.ShowDialog(this);

                    if (frmPickSkill.DialogResult == DialogResult.OK)
                    {
                        txtSelect.Text             = frmPickSkill.SelectedItem;
                        txtTranslateSelection.Text = TranslateField(_strSelect, frmPickSkill.SelectedItem);
                    }
                }
            }
            break;

            case "SelectSkillCategory":
                using (frmSelectSkillCategory frmPickSkillCategory = new frmSelectSkillCategory(_objCharacter))
                {
                    frmPickSkillCategory.Description = LanguageManager.GetString("Title_SelectSkillCategory");
                    frmPickSkillCategory.ShowDialog(this);

                    if (frmPickSkillCategory.DialogResult == DialogResult.OK)
                    {
                        txtSelect.Text             = frmPickSkillCategory.SelectedCategory;
                        txtTranslateSelection.Text = TranslateField(_strSelect, frmPickSkillCategory.SelectedCategory);
                    }
                }
                break;

            case "SelectSkillGroup":
                using (frmSelectSkillGroup frmPickSkillGroup = new frmSelectSkillGroup(_objCharacter))
                {
                    frmPickSkillGroup.Description = LanguageManager.GetString("Title_SelectSkillGroup");
                    frmPickSkillGroup.ShowDialog(this);

                    if (frmPickSkillGroup.DialogResult == DialogResult.OK)
                    {
                        txtSelect.Text             = frmPickSkillGroup.SelectedSkillGroup;
                        txtTranslateSelection.Text = TranslateField(_strSelect, frmPickSkillGroup.SelectedSkillGroup);
                    }
                }
                break;

            case "SelectSpell":
                List <ListItem> lstSpells;
                using (XmlNodeList xmlSpellList = _objCharacter.LoadData("spells.xml").SelectNodes("/chummer/spells/spell"))
                {
                    lstSpells = new List <ListItem>(xmlSpellList?.Count ?? 0);
                    if (xmlSpellList?.Count > 0)
                    {
                        foreach (XmlNode xmlSpell in xmlSpellList)
                        {
                            string strName = xmlSpell["name"]?.InnerText;
                            if (!string.IsNullOrEmpty(strName))
                            {
                                lstSpells.Add(new ListItem(strName, xmlSpell["translate"]?.InnerText ?? strName));
                            }
                        }
                    }
                }

                using (frmSelectItem selectSpell = new frmSelectItem
                {
                    Description = LanguageManager.GetString("Title_SelectSpell")
                })
                {
                    selectSpell.SetDropdownItemsMode(lstSpells);
                    selectSpell.ShowDialog(this);

                    if (selectSpell.DialogResult == DialogResult.OK)
                    {
                        txtSelect.Text             = selectSpell.SelectedName;
                        txtTranslateSelection.Text = TranslateField(_strSelect, selectSpell.SelectedName);
                    }
                }
                break;

            case "SelectWeaponCategory":
                using (frmSelectWeaponCategory frmPickWeaponCategory = new frmSelectWeaponCategory(_objCharacter))
                {
                    frmPickWeaponCategory.Description = LanguageManager.GetString("Title_SelectWeaponCategory");
                    frmPickWeaponCategory.ShowDialog(this);

                    if (frmPickWeaponCategory.DialogResult == DialogResult.OK)
                    {
                        txtSelect.Text             = frmPickWeaponCategory.SelectedCategory;
                        txtTranslateSelection.Text = TranslateField(_strSelect, frmPickWeaponCategory.SelectedCategory);
                    }
                }
                break;

            case "SelectSpellCategory":
                using (frmSelectSpellCategory frmPickSpellCategory = new frmSelectSpellCategory(_objCharacter))
                {
                    frmPickSpellCategory.Description = LanguageManager.GetString("Title_SelectSpellCategory");
                    frmPickSpellCategory.ShowDialog(this);

                    if (frmPickSpellCategory.DialogResult == DialogResult.OK)
                    {
                        txtSelect.Text             = frmPickSpellCategory.SelectedCategory;
                        txtTranslateSelection.Text = TranslateField(_strSelect, frmPickSpellCategory.SelectedCategory);
                    }
                }
                break;

            case "SelectAdeptPower":
                using (frmSelectPower frmPickPower = new frmSelectPower(_objCharacter))
                {
                    frmPickPower.IgnoreLimits = chkIgnoreLimits.Checked;
                    frmPickPower.ShowDialog(this);

                    if (frmPickPower.DialogResult == DialogResult.OK)
                    {
                        txtSelect.Text             = _objCharacter.LoadData("powers.xml").SelectSingleNode("/chummer/powers/power[id = \"" + frmPickPower.SelectedPower + "\"]/name")?.InnerText;
                        txtTranslateSelection.Text = TranslateField(_strSelect, frmPickPower.SelectedPower);
                    }
                }
                break;
            }
        }