public void LoadSkills(string filename, Class c) { SkillConfigParser sp; Dispatcher.Invoke(() => { if (!File.Exists("resources/config/skills/" + filename)) { SkillUtils.BuildDefaultSkillConfig(filename, c); } try { sp = new SkillConfigParser(filename, c); } catch (Exception) { var res = TccMessageBox.Show("TCC", $"There was an error while reading {filename}. Manually correct the error and press Ok to try again, else press Cancel to build a default config file.", MessageBoxButton.OKCancel); if (res == MessageBoxResult.Cancel) { File.Delete("resources/config/skills/" + filename); } LoadSkills(filename, c); return; } foreach (var sk in sp.Main) { MainSkills.Add(sk); } foreach (var sk in sp.Secondary) { SecondarySkills.Add(sk); } foreach (var sk in sp.Hidden) { HiddenSkills.Add(sk.Skill); } Dispatcher.Invoke(() => { SkillChoiceList.Clear(); foreach (var skill in SkillsDatabase.SkillsForClass) { SkillChoiceList.Add(skill); } SkillsView = Utils.InitLiveView(null, SkillChoiceList, new string[] { }, new SortDescription[] { }); }); NPC(nameof(SkillsView)); NPC(nameof(MainSkills)); NPC(nameof(SecondarySkills)); SkillsLoaded?.Invoke(); }); }
public void LoadSkills(Class c) { if (c == Class.None) { return; } var filename = TccUtils.ClassEnumToString(c).ToLower() + "-skills.xml"; SkillConfigParser sp; //Dispatcher.Invoke(() => //{ if (!File.Exists(Path.Combine(App.ResourcesPath, "config/skills", filename))) { SkillUtils.BuildDefaultSkillConfig(filename, c); } try { sp = new SkillConfigParser(filename, c); } catch (Exception) { var res = TccMessageBox.Show("TCC", $"There was an error while reading {filename}. Manually correct the error and press Ok to try again, else press Cancel to build a default config file.", MessageBoxButton.OKCancel, MessageBoxImage.Warning); if (res == MessageBoxResult.Cancel) { File.Delete(Path.Combine(App.ResourcesPath, "config/skills/", filename)); } LoadSkills(c); return; } foreach (var sk in sp.Main) { MainSkills.Add(sk); } foreach (var sk in sp.Secondary) { SecondarySkills.Add(sk); } foreach (var sk in sp.Hidden) { HiddenSkills.Add(sk); } Dispatcher.Invoke(() => SkillsView = CollectionViewUtils.InitLiveView(null, SkillsDatabase.SkillsForClass, new string[] { }, new SortDescription[] { })); ((ICollectionView)SkillsView).CollectionChanged += GcStahp; N(nameof(SkillsView)); N(nameof(MainSkills)); N(nameof(SecondarySkills)); SkillsLoaded?.Invoke(); //}); }
internal void AddHiddenSkill(Cooldown context) { context.Dispose(); HiddenSkills.Add(context); Save(); }
internal void AddHiddenSkill(FixedSkillCooldown context) { HiddenSkills.Add(context.Skill); }