Ejemplo n.º 1
0
        //load from data
        protected Skill(Character character, XmlNode n) : this(character, n?["skillgroup"]?.InnerText)
            //Ugly hack, needs by then
        {
            if (n == null)
            {
                return;
            }
            _name           = n["name"]?.InnerText; //No need to catch errors (for now), if missing we are fsked anyway
            AttributeObject = CharacterObject.GetAttribute(n["attribute"]?.InnerText);
            Category        = n["category"]?.InnerText;
            Default         = n["default"]?.InnerText.ToLower() == "yes";
            Source          = n["source"]?.InnerText;
            Page            = n["page"]?.InnerText;
            if (n["id"] != null)
            {
                SkillId = Guid.Parse(n["id"]?.InnerText);
            }

            _translatedName = n["translate"]?.InnerText;

            AttributeObject.PropertyChanged += OnLinkedAttributeChanged;

            SuggestedSpecializations = new List <ListItem>();
            foreach (XmlNode node in n["specs"]?.ChildNodes)
            {
                SuggestedSpecializations.Add(ListItem.AutoXml(node.InnerText, node));
            }
        }
Ejemplo n.º 2
0
        private void LoadSuggestedSpecializations(string name)
        {
            if (NameCategoryMap.ContainsKey(name))
            {
                Type = NameCategoryMap[name];
                SuggestedSpecializations.Clear();

                XmlNodeList list =
                    XmlManager.Instance.Load("skills.xml").SelectNodes($"chummer/knowledgeskills/skill[name = \"{name}\"]/specs/spec");
                foreach (XmlNode node in list)
                {
                    SuggestedSpecializations.Add(ListItem.AutoXml(node.InnerText, node));
                }
                OnPropertyChanged(nameof(CGLSpecializations));
                OnPropertyChanged(nameof(Type));
            }
        }
Ejemplo n.º 3
0
        private void LoadSuggestedSpecializations(string name)
        {
            string strNameValue;

            if (NameCategoryMap.TryGetValue(name, out strNameValue))
            {
                SuggestedSpecializations.Clear();

                XmlNodeList list = XmlManager.Load("skills.xml").SelectNodes($"chummer/knowledgeskills/skill[name = \"{name}\"]/specs/spec");
                foreach (XmlNode node in list)
                {
                    SuggestedSpecializations.Add(ListItem.AutoXml(node.InnerText, node));
                }

                SortListItem objSort = new SortListItem();
                SuggestedSpecializations.Sort(objSort.Compare);
                OnPropertyChanged(nameof(CGLSpecializations));
            }
        }