public static void LoadFeats() { List <Feat> set = XmlListLoader <Feat> .Load("Feats.xml"); featMap = new Dictionary <string, Feat>(); altFeatMap = new Dictionary <string, string>(); types = new SortedDictionary <String, String>(); foreach (Feat feat in set) { bool changed; string commaName = CMStringUtilities.DecommaText(feat.Name, out changed); if (changed) { feat.AltName = feat.Name; feat.Name = commaName; altFeatMap.Add(feat.AltName, feat.Name); } featMap[feat.Name] = feat; //add to types list foreach (string type in feat.Types) { types[type] = type; } if (feat.Types.Count == 0) { Debug.WriteLine(feat.Name); } feats = new ObservableCollection <Feat>(); foreach (Feat f in Feat.FeatMap.Values) { feats.Add(f); } } if (DBSettings.UseDB) { _FeatsDB = new DBLoader <Feat>("feats.db"); foreach (Feat f in _FeatsDB.Items) { feats.Add(f); if (!FeatMap.ContainsKey(f.Name)) { FeatMap[f.Name] = f; } } } _FeatsLoaded = true; }
public static void RemoveCustomFeat(Feat f) { _FeatsDB.DeleteItem(f); feats.Remove(f); Feat old; if (FeatMap.TryGetValue(f.Name, out old)) { if (old == f) { FeatMap.Remove(f.Name); Feat replace = feats.FirstOrDefault(a => a.Name == f.Name); if (replace != null) { FeatMap[replace.Name] = replace; } } } }