private bool NormalMode_Update(Cooldown sk) { if (SettingsHolder.ClassWindowSettings.Enabled && ClassManager.StartSpecialSkill(sk)) { return(false); } if (!SettingsHolder.CooldownWindowSettings.Enabled) { return(false); } var other = new Cooldown(sk.Skill, sk.CooldownType == CooldownType.Item ? sk.OriginalDuration / 1000 : sk.OriginalDuration, sk.CooldownType, sk.Mode, Dispatcher); var hSkill = HiddenSkills.ToSyncList().FirstOrDefault(x => x.Skill.IconName == sk.Skill.IconName); if (hSkill != null) { return(false); } if (other.CooldownType == CooldownType.Item) { return(FindAndUpdate(ItemSkills, other)); } try { if (other.Duration < SkillManager.LongSkillTreshold) { return(FindAndUpdate(ShortSkills, other)); } else { var existing = LongSkills.ToSyncList().FirstOrDefault(x => x.Skill.IconName == other.Skill.IconName); if (existing == null) { existing = ShortSkills.ToSyncList().FirstOrDefault(x => x.Skill.IconName == other.Skill.IconName); if (existing == null) { LongSkills.Add(other); } else { existing.Refresh(other); } return(true); } else { existing.Refresh(other); } return(true); } } catch { Log.All($"[NormalMode_Update] Error in skill: {sk.Skill.Name}"); return(false); } }
private void NormalMode_Remove(Skill sk) { if (!SettingsHolder.CooldownWindowSettings.Enabled) { return; } try { var longSkill = LongSkills.ToSyncList().FirstOrDefault(x => x.Skill.IconName == sk.IconName); if (longSkill != null) { LongSkills.Remove(longSkill); longSkill.Dispose(); } var shortSkill = ShortSkills.ToSyncList().FirstOrDefault(x => x.Skill.IconName == sk.IconName); if (shortSkill != null) { ShortSkills.Remove(shortSkill); shortSkill.Dispose(); } var itemSkill = ItemSkills.ToSyncList().FirstOrDefault(x => x.Skill.Name == sk.Name); if (itemSkill != null) { ItemSkills.Remove(itemSkill); itemSkill.Dispose(); } } catch { // ignored } }
private bool NormalMode_Update(Cooldown sk) { if (Settings.SettingsHolder.ClassWindowSettings.Enabled && ClassManager.StartSpecialSkill(sk)) { return(false); } if (!Settings.SettingsHolder.CooldownWindowSettings.Enabled) { return(false); } var hSkill = HiddenSkills.ToSyncArray().FirstOrDefault(x => x.Skill.IconName == sk.Skill.IconName); if (hSkill != null) { return(false); } if (sk.CooldownType == CooldownType.Item) { return(FindAndUpdate(ItemSkills, sk)); } try { if (sk.Duration < SkillManager.LongSkillTreshold) { return(FindAndUpdate(ShortSkills, sk)); } else { var existing = LongSkills.ToSyncArray().FirstOrDefault(x => x.Skill.Name == sk.Skill.Name); if (existing == null) { existing = ShortSkills.ToSyncArray().FirstOrDefault(x => x.Skill.Name == sk.Skill.Name); if (existing == null) { LongSkills.Add(sk); } else { existing.Refresh(sk); } return(true); } else { existing.Refresh(sk); } return(true); } } catch { return(false); } }
public void ClearSkills() { ShortSkills.Clear(); LongSkills.Clear(); MainSkills.Clear(); SecondarySkills.Clear(); OtherSkills.Clear(); ItemSkills.Clear(); HiddenSkills.Clear(); }
private void NormalMode_Change(Skill skill, uint cd) { if (!SettingsHolder.CooldownWindowSettings.Enabled) { return; } if (ClassManager.ChangeSpecialSkill(skill, cd)) { return; } try { if (cd < SkillManager.LongSkillTreshold) { var existing = ShortSkills.ToSyncList().FirstOrDefault(x => x.Skill.IconName == skill.IconName); if (existing == null) { if (skill.Id % 10 != 0) { return; //TODO: check this; discards updates if new id is not base } ShortSkills.Add(new Cooldown(skill, cd)); } else { existing.Refresh(skill.Id, cd, CooldownMode.Normal); } } else { var existing = LongSkills.ToSyncList().FirstOrDefault(x => x.Skill.IconName == skill.IconName); if (existing == null) { existing = ShortSkills.ToSyncList().FirstOrDefault(x => x.Skill.IconName == skill.IconName); if (existing == null) { LongSkills.Add(new Cooldown(skill, cd)); } else { existing.Refresh(skill.Id, cd, CooldownMode.Normal); } return; } existing.Refresh(skill.Id, cd, CooldownMode.Normal); } } catch { Log.All($"Error while changing cd on {skill.Name}"); // ignored } }
private void NormalMode_Change(Skill skill, uint cd) { if (!Settings.CooldownWindowSettings.Enabled) { return; } if (ClassManager.ChangeSpecialSkill(skill, cd)) { return; } SkillCooldown sk; try { if (cd < SkillManager.LongSkillTreshold) { var existing = ShortSkills.ToSyncArray().FirstOrDefault(x => x.Skill.Name == skill.Name); if (existing == null) { sk = new SkillCooldown(skill, cd, CooldownType.Skill, Dispatcher); ShortSkills.Add(sk); return; } existing.Refresh(cd); } else { var existing = LongSkills.ToSyncArray().FirstOrDefault(x => x.Skill.Name == skill.Name); if (existing == null) { existing = ShortSkills.ToSyncArray().FirstOrDefault(x => x.Skill.Name == skill.Name); if (existing == null) { sk = new SkillCooldown(skill, cd, CooldownType.Skill, Dispatcher); LongSkills.Add(sk); } else { existing.Refresh(cd); } return; } existing.Refresh(cd); } } catch { // ignored } }
private void NormalMode_Change(Skill skill, uint cd) { if (!Settings.SettingsHolder.CooldownWindowSettings.Enabled) { return; } if (ClassManager.ChangeSpecialSkill(skill, cd)) { return; } try { if (cd < SkillManager.LongSkillTreshold) { var existing = ShortSkills.ToSyncArray().FirstOrDefault(x => x.Skill.Name == skill.Name); if (existing == null) { ShortSkills.Add(new Cooldown(skill, cd)); } else { existing.Refresh(skill.Id, cd, CooldownMode.Normal); } } else { var existing = LongSkills.ToSyncArray().FirstOrDefault(x => x.Skill.Name == skill.Name); if (existing == null) { existing = ShortSkills.ToSyncArray().FirstOrDefault(x => x.Skill.Name == skill.Name); if (existing == null) { LongSkills.Add(new Cooldown(skill, cd)); } else { existing.Refresh(skill.Id, cd, CooldownMode.Normal); } return; } existing.Refresh(skill.Id, cd, CooldownMode.Normal); } } catch { // ignored } }
public void ClearSkills() { ShortSkills.ToList().ForEach(sk => sk.Dispose()); LongSkills.ToList().ForEach(sk => sk.Dispose()); MainSkills.ToList().ForEach(sk => sk.Dispose()); SecondarySkills.ToList().ForEach(sk => sk.Dispose()); OtherSkills.ToList().ForEach(sk => sk.Dispose()); ItemSkills.ToList().ForEach(sk => sk.Dispose()); ShortSkills.Clear(); LongSkills.Clear(); MainSkills.Clear(); SecondarySkills.Clear(); OtherSkills.Clear(); ItemSkills.Clear(); HiddenSkills.Clear(); }
private void NormalMode_Update(SkillCooldown sk) { if (Settings.ClassWindowSettings.Enabled && ClassManager.StartSpecialSkill(sk)) { return; } if (!Settings.CooldownWindowSettings.Enabled) { return; } if (sk.Type == CooldownType.Item) { FindAndUpdate(ItemSkills, sk); return; } try { if (sk.Cooldown < SkillManager.LongSkillTreshold) { FindAndUpdate(ShortSkills, sk); } else { var existing = LongSkills.ToSyncArray().FirstOrDefault(x => x.Skill.Name == sk.Skill.Name); if (existing == null) { existing = ShortSkills.ToSyncArray().FirstOrDefault(x => x.Skill.Name == sk.Skill.Name); if (existing == null) { LongSkills.Add(sk); } else { existing.Refresh(sk.Cooldown); } return; } existing.Refresh(sk.Cooldown); } } catch { /* ignored*/ } }
public void ClearSkills() { Dispatcher.BeginInvoke(new Action(() => { ShortSkills.ToList().ForEach(sk => sk.Dispose()); LongSkills.ToList().ForEach(sk => sk.Dispose()); MainSkills.ToList().ForEach(sk => sk.Dispose()); SecondarySkills.ToList().ForEach(sk => sk.Dispose()); OtherSkills.ToList().ForEach(sk => sk.Dispose()); ItemSkills.ToList().ForEach(sk => sk.Dispose()); ShortSkills.Clear(); LongSkills.Clear(); MainSkills.Clear(); SecondarySkills.Clear(); OtherSkills.Clear(); ItemSkills.Clear(); HiddenSkills.Clear(); })); }