private void NormalMode_Remove(Skill sk)
        {
            if (!Settings.SettingsHolder.CooldownWindowSettings.Enabled)
            {
                return;
            }

            try
            {
                var longSkill = LongSkills.ToSyncArray().FirstOrDefault(x => x.Skill.Name == sk.Name);
                if (longSkill != null)
                {
                    LongSkills.Remove(longSkill);
                    longSkill.Dispose();
                }
                var shortSkill = ShortSkills.ToSyncArray().FirstOrDefault(x => x.Skill.Name == sk.Name);
                if (shortSkill != null)
                {
                    ShortSkills.Remove(shortSkill);
                    shortSkill.Dispose();
                }
                var itemSkill = ItemSkills.ToSyncArray().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);
            }
        }
Exemple #3
0
        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
            }
        }
Exemple #5
0
 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*/ }
 }