public static void AddItemSkill(uint id, uint cd)
 {
     if (ItemSkillsDatabase.TryGetItemSkill(id, out Skill brooch))
     {
         try
         {
             RouteSkill(new SkillCooldown(brooch, cd, CooldownType.Item, CooldownWindowViewModel.Instance.GetDispatcher()));
         }
         catch (Exception e)
         {
             Console.WriteLine(e);
         }
     }
 }
Beispiel #2
0
        void ParseSkillConfig(string filename, Class c)
        {
            XDocument skillsDoc = XDocument.Load("resources/config/skills/" + filename);

            foreach (XElement skillElement in skillsDoc.Descendants("Skills").Descendants())
            {
                var type = CooldownType.Skill;
                if (skillElement.Name == "Item")
                {
                    type = CooldownType.Item;
                }
                if (skillElement.Name == "Passive")
                {
                    type = CooldownType.Passive;
                }

                var skillId = Convert.ToUInt32(skillElement.Attribute("id").Value);
                var row     = Convert.ToInt32(skillElement.Attribute("row").Value);
                if (type == CooldownType.Skill)
                {
                    if (SkillsDatabase.TryGetSkill(skillId, c, out var sk))
                    {
                        switch (row)
                        {
                        case 1:
                            Main.Add(new FixedSkillCooldown(sk, type, CooldownWindowViewModel.Instance.GetDispatcher(), false));
                            break;

                        case 2:
                            Secondary.Add(new FixedSkillCooldown(sk, type, CooldownWindowViewModel.Instance.GetDispatcher(), false));
                            break;

                        case 3:
                            Hidden.Add(new FixedSkillCooldown(sk, type, CooldownWindowViewModel.Instance.GetDispatcher(), false));
                            break;
                        }
                    }
                }
                else if (type == CooldownType.Item)
                {
                    if (ItemSkillsDatabase.TryGetItemSkill(skillId, out var sk))
                    {
                        switch (row)
                        {
                        case 1:
                            Main.Add(new FixedSkillCooldown(sk, type, CooldownWindowViewModel.Instance.GetDispatcher(), false));
                            break;

                        case 2:
                            Secondary.Add(new FixedSkillCooldown(sk, type, CooldownWindowViewModel.Instance.GetDispatcher(), false));
                            break;

                        case 3:
                            Hidden.Add(new FixedSkillCooldown(sk, type, CooldownWindowViewModel.Instance.GetDispatcher(), false));
                            break;
                        }
                    }
                }
                else if (type == CooldownType.Passive)
                {
                    if (PassivityDatabase.TryGetPassivitySkill(skillId, out var sk))
                    {
                        switch (row)
                        {
                        case 1:
                            Main.Add(new FixedSkillCooldown(sk, type, CooldownWindowViewModel.Instance.GetDispatcher(), false));
                            break;

                        case 2:
                            Secondary.Add(new FixedSkillCooldown(sk, type, CooldownWindowViewModel.Instance.GetDispatcher(), false));
                            break;

                        case 3:
                            Hidden.Add(new FixedSkillCooldown(sk, type, CooldownWindowViewModel.Instance.GetDispatcher(), false));
                            break;
                        }
                    }
                }
            }
        }