コード例 #1
0
        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
            }
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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
            }
        }