public static void ChangeSkillCooldown(uint id, int cd)
        {
            if (SkillsDatabase.TryGetSkill(id, SessionManager.CurrentPlayer.Class, out Skill skill))
            {
                Changed?.Invoke(new SkillCooldown(skill, cd, CooldownType.Skill));
            }

            //if (sk.Cooldown > SkillManager.LongSkillTreshold)
            //{
            //    if (LongSkillsQueue.Where(X => X.Id == sk.Id).Count() > 0)
            //    {
            //        if (sk.Cooldown == 0)
            //        {
            //            ResetSkill(sk.Id);
            //        }
            //        else
            //        {
            //            LongSkillsQueue.Where(x => x.Id == sk.Id).Single().Timer.Interval = sk.Cooldown;

            //            Changed?.Invoke(null, null, sk);
            //        }
            //    }
            //}
            //else
            //{
            //    if (NormalSkillsQueue.Where(X => X.Id == sk.Id).Count() > 0)
            //    {
            //        if (sk.Cooldown == 0)
            //        {
            //            ResetSkill(sk.Id);
            //        }
            //        else
            //        {
            //            try
            //            {
            //                NormalSkillsQueue.Where(x => x.Id == sk.Id).Single().Timer.Interval = sk.Cooldown;

            //            }
            //            catch (Exception)
            //            {

            //            }

            //            Changed?.Invoke(null, null, sk);
            //        }
            //    }

            //}

            //try
            //{
            //    //Console.WriteLine("{0} cooldown reduced.", SkillsDatabase.GetSkill(sk.Id, PacketParser.CurrentClass).Name);

            //}
            //catch (Exception)
            //{

            //    Console.WriteLine("{0}'s skill cooldown reduced.", sk.Id);
            //}
        }
 public static void ChangeSkillCooldown(uint id, uint cd)
 {
     if (SkillsDatabase.TryGetSkill(id, SessionManager.CurrentPlayer.Class, out Skill skill))
     {
         CooldownWindowViewModel.Instance.Change(skill, cd);
     }
 }
 public static void AddSkill(uint id, uint cd)
 {
     if (SkillsDatabase.TryGetSkill(id, SessionManager.CurrentPlayer.Class, out Skill skill))
     {
         if (!Filter(skill.Name))
         {
             return;
         }
         RouteSkill(new SkillCooldown(skill, (int)cd, CooldownType.Skill));
     }
 }
Exemple #4
0
 public static void CheckHurricane(S_ABNORMALITY_BEGIN msg)
 {
     if (msg.id == HURRICANE_ID)
     {
         Console.WriteLine("Checking hurricane; id={0} caster={1} player={2}", msg.id, msg.casterId, SessionManager.CurrentPlayer.EntityId);
     }
     if (msg.id == HURRICANE_ID && msg.casterId == SessionManager.CurrentPlayer.EntityId)
     {
         SkillsDatabase.TryGetSkill(HURRICANE_ID, Class.Common, out Skill hurricane);
         SkillManager.AddSkillDirectly(hurricane, HURRICANE_DURATION);
     }
 }
 public static void AddSkill(uint id, ulong cd)
 {
     if (SkillsDatabase.TryGetSkill(id, SessionManager.CurrentPlayer.Class, out Skill skill))
     {
         if (!Filter(skill.Name))
         {
             return;
         }
         RouteSkill(new SkillCooldown(skill, cd, CooldownType.Skill, CooldownWindowViewModel.Instance.GetDispatcher()));
         //WindowManager.SkillsEnded = false;
     }
 }
Exemple #6
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;
                        }
                    }
                }
            }
        }