Example #1
0
        private void cmdChangeSelection_Click(object sender, EventArgs e)
        {
            switch (_strSelect)
            {
            case "SelectAttribute":
            {
                var frmPickAttribute = new frmSelectAttribute
                {
                    Description = LanguageManager.Instance.GetString("Title_SelectAttribute")
                };
                if (_objCharacter.MAGEnabled)
                {
                    frmPickAttribute.AddMAG();
                }
                if (_objCharacter.RESEnabled)
                {
                    frmPickAttribute.AddRES();
                }
                if (_objCharacter.DEPEnabled)
                {
                    frmPickAttribute.AddDEP();
                }
                frmPickAttribute.ShowDialog(this);

                if (frmPickAttribute.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickAttribute.SelectedAttribute;
                }
            }
            break;

            case "SelectMentalAttribute":
            {
                frmSelectAttribute frmPickAttribute = new frmSelectAttribute
                {
                    Description = LanguageManager.Instance.GetString("Title_SelectAttribute")
                };

                List <string> strValue = new List <string> {
                    "LOG", "WIL", "INT", "CHA", "EDG", "MAG", "RES"
                };
                frmPickAttribute.RemoveFromList(strValue);

                frmPickAttribute.ShowDialog(this);

                if (frmPickAttribute.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickAttribute.SelectedAttribute;
                }
            }
            break;

            case "SelectPhysicalAttribute":
            {
                frmSelectAttribute frmPickAttribute = new frmSelectAttribute();
                frmPickAttribute.Description = LanguageManager.Instance.GetString("Title_SelectAttribute");

                List <string> strValue = new List <string>();
                strValue.Add("BOD");
                strValue.Add("AGI");
                strValue.Add("REA");
                strValue.Add("STR");
                strValue.Add("EDG");
                strValue.Add("MAG");
                strValue.Add("RES");
                frmPickAttribute.RemoveFromList(strValue);

                frmPickAttribute.ShowDialog(this);

                if (frmPickAttribute.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickAttribute.SelectedAttribute;
                }
            }
            break;

            case "SelectSpecialAttribute":
            {
                frmSelectAttribute frmPickAttribute = new frmSelectAttribute();
                frmPickAttribute.Description = LanguageManager.Instance.GetString("Title_SelectAttribute");

                List <string> strValue = new List <string>();
                strValue.Add("MAG");
                strValue.Add("RES");
                strValue.Add("DEP");
                frmPickAttribute.RemoveFromList(strValue);

                frmPickAttribute.ShowDialog(this);

                if (frmPickAttribute.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickAttribute.SelectedAttribute;
                }
            }
            break;

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

                if (frmPickSkill.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickSkill.SelectedSkill;
                }
            }
            break;

            case "SelectKnowSkill":
            {
                frmSelectSkill frmPickSkill = new frmSelectSkill(_objCharacter);
                frmPickSkill.ShowKnowledgeSkills = true;
                frmPickSkill.Description         = LanguageManager.Instance.GetString("Title_SelectSkill");
                frmPickSkill.ShowDialog(this);

                if (frmPickSkill.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickSkill.SelectedSkill;
                }
            }
            break;

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

                if (frmPickSkillCategory.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickSkillCategory.SelectedCategory;
                }
                break;

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

                if (frmPickSkillGroup.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickSkillGroup.SelectedSkillGroup;
                }
                break;

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

                if (frmPickWeaponCategory.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickWeaponCategory.SelectedCategory;
                }
                break;

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

                if (frmPickSpellCategory.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickSpellCategory.SelectedCategory;
                }
                break;

            case "SelectAdeptPower":
                frmSelectPower frmPickPower = new frmSelectPower(_objCharacter);
                frmPickPower.ShowDialog(this);

                if (frmPickPower.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickPower.SelectedPower;
                }
                break;
            }
        }
Example #2
0
        private void cmdChangeSelection_Click(object sender, EventArgs e)
        {
            switch (_strSelect)
            {
            case "SelectActionDicePool":
                List <ListItem> lstActions = new List <ListItem>();
                using (XmlNodeList xmlActionList = XmlManager.Load("actions.xml").SelectNodes("/chummer/actions/action"))
                {
                    if (xmlActionList != null)
                    {
                        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 select = new frmSelectItem
                {
                    Description = LanguageManager.GetString("Title_SelectAction")
                })
                {
                    select.SetDropdownItemsMode(lstActions);
                    select.ShowDialog(this);

                    if (select.DialogResult == DialogResult.OK)
                    {
                        txtSelect.Text             = select.SelectedName;
                        txtTranslateSelection.Text = TranslateField(_strSelect, select.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 "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>();
                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 = XmlManager.Load("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())
                {
                    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())
                {
                    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 = new List <ListItem>();
                using (XmlNodeList xmlSpellList = XmlManager.Load("spells.xml").SelectNodes("/chummer/spells/spell"))
                {
                    if (xmlSpellList != null)
                    {
                        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())
                {
                    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())
                {
                    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             = XmlManager.Load("powers.xml").SelectSingleNode("/chummer/powers/power[id = \"" + frmPickPower.SelectedPower + "\"]/name")?.InnerText;
                        txtTranslateSelection.Text = TranslateField(_strSelect, frmPickPower.SelectedPower);
                    }
                }
                break;
            }
        }
        private void cmdChangeSelection_Click(object sender, EventArgs e)
        {
            if (_strSelect == "SelectAttribute")
            {
                frmSelectAttribute frmPickAttribute = new frmSelectAttribute();
                frmPickAttribute.Description = LanguageManager.Instance.GetString("Title_SelectAttribute");
                if (_objCharacter.MAGEnabled)
                    frmPickAttribute.AddMAG();
                if (_objCharacter.RESEnabled)
                    frmPickAttribute.AddRES();
                frmPickAttribute.ShowDialog(this);

                if (frmPickAttribute.DialogResult == DialogResult.OK)
                    txtSelect.Text = frmPickAttribute.SelectedAttribute;
            }
            if (_strSelect == "SelectPhysicalAttribute")
            {
                frmSelectAttribute frmPickAttribute = new frmSelectAttribute();
                frmPickAttribute.Description = LanguageManager.Instance.GetString("Title_SelectAttribute");

                List<string> strValue = new List<string>();
                strValue.Add("LOG");
                strValue.Add("WIL");
                strValue.Add("INT");
                strValue.Add("CHA");
                strValue.Add("EDG");
                strValue.Add("MAG");
                strValue.Add("RES");
                frmPickAttribute.RemoveFromList(strValue);

                frmPickAttribute.ShowDialog(this);

                if (frmPickAttribute.DialogResult == DialogResult.OK)
                    txtSelect.Text = frmPickAttribute.SelectedAttribute;
            }
            if (_strSelect == "SelectMentalAttribute")
            {
                frmSelectAttribute frmPickAttribute = new frmSelectAttribute();
                frmPickAttribute.Description = LanguageManager.Instance.GetString("Title_SelectAttribute");

                List<string> strValue = new List<string>();
                strValue.Add("BOD");
                strValue.Add("AGI");
                strValue.Add("REA");
                strValue.Add("STR");
                strValue.Add("EDG");
                strValue.Add("MAG");
                strValue.Add("RES");
                frmPickAttribute.RemoveFromList(strValue);

                frmPickAttribute.ShowDialog(this);

                if (frmPickAttribute.DialogResult == DialogResult.OK)
                    txtSelect.Text = frmPickAttribute.SelectedAttribute;
            }
            if (_strSelect == "SelectSkill")
            {
                frmSelectSkill frmPickSkill = new frmSelectSkill(_objCharacter);
                frmPickSkill.Description = LanguageManager.Instance.GetString("Title_SelectSkill");
                frmPickSkill.ShowDialog(this);

                if (frmPickSkill.DialogResult == DialogResult.OK)
                    txtSelect.Text = frmPickSkill.SelectedSkill;
            }
            if (_strSelect == "SelectKnowSkill")
            {
                frmSelectSkill frmPickSkill = new frmSelectSkill(_objCharacter);
                frmPickSkill.ShowKnowledgeSkills = true;
                frmPickSkill.Description = LanguageManager.Instance.GetString("Title_SelectSkill");
                frmPickSkill.ShowDialog(this);

                if (frmPickSkill.DialogResult == DialogResult.OK)
                    txtSelect.Text = frmPickSkill.SelectedSkill;
            }
            if (_strSelect == "SelectSkillCategory")
            {
                frmSelectSkillCategory frmPickSkillCategory = new frmSelectSkillCategory();
                frmPickSkillCategory.Description = LanguageManager.Instance.GetString("Title_SelectSkillCategory");
                frmPickSkillCategory.ShowDialog(this);

                if (frmPickSkillCategory.DialogResult == DialogResult.OK)
                    txtSelect.Text = frmPickSkillCategory.SelectedCategory;
            }
            if (_strSelect == "SelectSkillGroup")
            {
                frmSelectSkillGroup frmPickSkillGroup = new frmSelectSkillGroup();
                frmPickSkillGroup.Description = LanguageManager.Instance.GetString("Title_SelectSkillGroup");
                frmPickSkillGroup.ShowDialog(this);

                if (frmPickSkillGroup.DialogResult == DialogResult.OK)
                    txtSelect.Text = frmPickSkillGroup.SelectedSkillGroup;
            }
            if (_strSelect == "SelectWeaponCategory")
            {
                frmSelectWeaponCategory frmPickWeaponCategory = new frmSelectWeaponCategory();
                frmPickWeaponCategory.Description = LanguageManager.Instance.GetString("Title_SelectWeaponCategory");
                frmPickWeaponCategory.ShowDialog(this);

                if (frmPickWeaponCategory.DialogResult == DialogResult.OK)
                    txtSelect.Text = frmPickWeaponCategory.SelectedCategory;
            }
            if (_strSelect == "SelectSpellCategory")
            {
                frmSelectSpellCategory frmPickSpellCategory = new frmSelectSpellCategory();
                frmPickSpellCategory.Description = LanguageManager.Instance.GetString("Title_SelectSpellCategory");
                frmPickSpellCategory.ShowDialog(this);

                if (frmPickSpellCategory.DialogResult == DialogResult.OK)
                    txtSelect.Text = frmPickSpellCategory.SelectedCategory;
            }
        }
        private void cmdChangeSelection_Click(object sender, EventArgs e)
        {
            if (_strSelect == "SelectAttribute")
            {
                frmSelectAttribute frmPickAttribute = new frmSelectAttribute();
                frmPickAttribute.Description = LanguageManager.Instance.GetString("Title_SelectAttribute");
                if (_objCharacter.MAGEnabled)
                {
                    frmPickAttribute.AddMAG();
                }
                if (_objCharacter.RESEnabled)
                {
                    frmPickAttribute.AddRES();
                }
                frmPickAttribute.ShowDialog(this);

                if (frmPickAttribute.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickAttribute.SelectedAttribute;
                }
            }
            if (_strSelect == "SelectPhysicalAttribute")
            {
                frmSelectAttribute frmPickAttribute = new frmSelectAttribute();
                frmPickAttribute.Description = LanguageManager.Instance.GetString("Title_SelectAttribute");

                List <string> strValue = new List <string>();
                strValue.Add("LOG");
                strValue.Add("WIL");
                strValue.Add("INT");
                strValue.Add("CHA");
                strValue.Add("EDG");
                strValue.Add("MAG");
                strValue.Add("RES");
                frmPickAttribute.RemoveFromList(strValue);

                frmPickAttribute.ShowDialog(this);

                if (frmPickAttribute.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickAttribute.SelectedAttribute;
                }
            }
            if (_strSelect == "SelectMentalAttribute")
            {
                frmSelectAttribute frmPickAttribute = new frmSelectAttribute();
                frmPickAttribute.Description = LanguageManager.Instance.GetString("Title_SelectAttribute");

                List <string> strValue = new List <string>();
                strValue.Add("BOD");
                strValue.Add("AGI");
                strValue.Add("REA");
                strValue.Add("STR");
                strValue.Add("EDG");
                strValue.Add("MAG");
                strValue.Add("RES");
                frmPickAttribute.RemoveFromList(strValue);

                frmPickAttribute.ShowDialog(this);

                if (frmPickAttribute.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickAttribute.SelectedAttribute;
                }
            }
            if (_strSelect == "SelectSkill")
            {
                frmSelectSkill frmPickSkill = new frmSelectSkill(_objCharacter);
                frmPickSkill.Description = LanguageManager.Instance.GetString("Title_SelectSkill");
                frmPickSkill.ShowDialog(this);

                if (frmPickSkill.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickSkill.SelectedSkill;
                }
            }
            if (_strSelect == "SelectKnowSkill")
            {
                frmSelectSkill frmPickSkill = new frmSelectSkill(_objCharacter);
                frmPickSkill.ShowKnowledgeSkills = true;
                frmPickSkill.Description         = LanguageManager.Instance.GetString("Title_SelectSkill");
                frmPickSkill.ShowDialog(this);

                if (frmPickSkill.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickSkill.SelectedSkill;
                }
            }
            if (_strSelect == "SelectSkillCategory")
            {
                frmSelectSkillCategory frmPickSkillCategory = new frmSelectSkillCategory();
                frmPickSkillCategory.Description = LanguageManager.Instance.GetString("Title_SelectSkillCategory");
                frmPickSkillCategory.ShowDialog(this);

                if (frmPickSkillCategory.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickSkillCategory.SelectedCategory;
                }
            }
            if (_strSelect == "SelectSkillGroup")
            {
                frmSelectSkillGroup frmPickSkillGroup = new frmSelectSkillGroup();
                frmPickSkillGroup.Description = LanguageManager.Instance.GetString("Title_SelectSkillGroup");
                frmPickSkillGroup.ShowDialog(this);

                if (frmPickSkillGroup.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickSkillGroup.SelectedSkillGroup;
                }
            }
            if (_strSelect == "SelectWeaponCategory")
            {
                frmSelectWeaponCategory frmPickWeaponCategory = new frmSelectWeaponCategory();
                frmPickWeaponCategory.Description = LanguageManager.Instance.GetString("Title_SelectWeaponCategory");
                frmPickWeaponCategory.ShowDialog(this);

                if (frmPickWeaponCategory.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickWeaponCategory.SelectedCategory;
                }
            }
            if (_strSelect == "SelectSpellCategory")
            {
                frmSelectSpellCategory frmPickSpellCategory = new frmSelectSpellCategory();
                frmPickSpellCategory.Description = LanguageManager.Instance.GetString("Title_SelectSpellCategory");
                frmPickSpellCategory.ShowDialog(this);

                if (frmPickSpellCategory.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickSpellCategory.SelectedCategory;
                }
            }
        }
Example #5
0
        private void cmdChangeSelection_Click(object sender, EventArgs e)
        {
            switch (_strSelect)
            {
            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");
                }
                frmSelectAttribute frmPickAttribute = new frmSelectAttribute(lstAbbrevs.ToArray())
                {
                    Description = LanguageManager.GetString("Title_SelectAttribute", GlobalOptions.Language)
                };
                frmPickAttribute.ShowDialog(this);

                if (frmPickAttribute.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickAttribute.SelectedAttribute;
                }
            }
            break;

            case "SelectMentalAttribute":
            {
                frmSelectAttribute frmPickAttribute = new frmSelectAttribute(Backend.Attributes.AttributeSection.MentalAttributes.ToArray())
                {
                    Description = LanguageManager.GetString("Title_SelectAttribute", GlobalOptions.Language)
                };

                frmPickAttribute.ShowDialog(this);

                if (frmPickAttribute.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickAttribute.SelectedAttribute;
                }
            }
            break;

            case "SelectPhysicalAttribute":
            {
                frmSelectAttribute frmPickAttribute = new frmSelectAttribute(Backend.Attributes.AttributeSection.PhysicalAttributes.ToArray())
                {
                    Description = LanguageManager.GetString("Title_SelectAttribute", GlobalOptions.Language)
                };

                frmPickAttribute.ShowDialog(this);

                if (frmPickAttribute.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = 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");
                }

                frmSelectAttribute frmPickAttribute = new frmSelectAttribute(lstAbbrevs.ToArray())
                {
                    Description = LanguageManager.GetString("Title_SelectAttribute", GlobalOptions.Language)
                };

                frmPickAttribute.ShowDialog(this);

                if (frmPickAttribute.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickAttribute.SelectedAttribute;
                }
            }
            break;

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

                if (frmPickSkill.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickSkill.SelectedSkill;
                }
            }
            break;

            case "SelectKnowSkill":
            {
                frmSelectSkill frmPickSkill = new frmSelectSkill(_objCharacter)
                {
                    ShowKnowledgeSkills = true,
                    Description         = LanguageManager.GetString("Title_SelectSkill", GlobalOptions.Language)
                };
                frmPickSkill.ShowDialog(this);

                if (frmPickSkill.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickSkill.SelectedSkill;
                }
            }
            break;

            case "SelectSkillCategory":
                frmSelectSkillCategory frmPickSkillCategory = new frmSelectSkillCategory
                {
                    Description = LanguageManager.GetString("Title_SelectSkillCategory", GlobalOptions.Language)
                };
                frmPickSkillCategory.ShowDialog(this);

                if (frmPickSkillCategory.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickSkillCategory.SelectedCategory;
                }
                break;

            case "SelectSkillGroup":
                frmSelectSkillGroup frmPickSkillGroup = new frmSelectSkillGroup
                {
                    Description = LanguageManager.GetString("Title_SelectSkillGroup", GlobalOptions.Language)
                };
                frmPickSkillGroup.ShowDialog(this);

                if (frmPickSkillGroup.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickSkillGroup.SelectedSkillGroup;
                }
                break;

            case "SelectWeaponCategory":
                frmSelectWeaponCategory frmPickWeaponCategory = new frmSelectWeaponCategory
                {
                    Description = LanguageManager.GetString("Title_SelectWeaponCategory", GlobalOptions.Language)
                };
                frmPickWeaponCategory.ShowDialog(this);

                if (frmPickWeaponCategory.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickWeaponCategory.SelectedCategory;
                }
                break;

            case "SelectSpellCategory":
                frmSelectSpellCategory frmPickSpellCategory = new frmSelectSpellCategory
                {
                    Description = LanguageManager.GetString("Title_SelectSpellCategory", GlobalOptions.Language)
                };
                frmPickSpellCategory.ShowDialog(this);

                if (frmPickSpellCategory.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = frmPickSpellCategory.SelectedCategory;
                }
                break;

            case "SelectAdeptPower":
                frmSelectPower frmPickPower = new frmSelectPower(_objCharacter);
                frmPickPower.ShowDialog(this);

                if (frmPickPower.DialogResult == DialogResult.OK)
                {
                    txtSelect.Text = XmlManager.Load("powers.xml").SelectSingleNode("/chummer/powers/power[id = \"" + frmPickPower.SelectedPower + "\"]/name")?.InnerText;
                }
                break;
            }
        }