Пример #1
0
        // Constructor

        public SkillItem(long ID, string name)
        {
            this.ID   = ID;
            Name      = name.Replace("\0", "");
            _apiSkill = GW2APIController.GetAPISkill(ID);
            CompleteItem();
        }
Пример #2
0
        private Dictionary <string, List <JsonSkill> > BuildRotation(List <CastLog> cls)
        {
            Dictionary <string, List <JsonSkill> > res = new Dictionary <string, List <JsonSkill> >();
            SkillData skillList = _log.SkillData;

            foreach (CastLog cl in cls)
            {
                SkillItem   skill     = skillList.Get(cl.SkillId);
                GW2APISkill skillApi  = skill?.ApiSkill;
                string      skillName = skill.Name;
                _skillNames["s" + cl.SkillId] = skillName;
                int timeGained = 0;
                if (cl.EndActivation == ParseEnum.Activation.CancelFire && cl.ActualDuration < cl.ExpectedDuration)
                {
                    timeGained = cl.ExpectedDuration - cl.ActualDuration;
                }
                else if (cl.EndActivation == ParseEnum.Activation.CancelCancel)
                {
                    timeGained = -cl.ActualDuration;
                }
                JsonSkill jSkill = new JsonSkill
                {
                    time       = (int)cl.Time,
                    duration   = cl.ActualDuration,
                    timeGained = timeGained,
                    autoAttack = skillApi != null && skillApi.Slot == "Weapon_1",
                    quickness  = cl.StartActivation == ParseEnum.Activation.Quickness
                };
                if (res.TryGetValue("s" + cl.SkillId, out var list))
                {
                    list.Add(jSkill);
                }
                else
                {
                    res["s" + cl.SkillId] = new List <JsonSkill>()
                    {
                        jSkill
                    };
                }
            }

            return(res);
        }
Пример #3
0
 public WeaponDescriptor(GW2APISkill apiSkill)
 {
     if (apiSkill.WeaponType == "Trident" || apiSkill.WeaponType == "Speargun" || apiSkill.WeaponType == "Spear")
     {
         IsLand     = false;
         WeaponSlot = Hand.TwoHand;
     }
     else
     {
         IsLand = true;
         if (apiSkill.DualWield != null && apiSkill.DualWield != "None" && apiSkill.DualWield != "Nothing")
         {
             WeaponSlot = Hand.Dual;
         }
         else if (apiSkill.WeaponType == "Greatsword" || apiSkill.WeaponType == "Staff" || apiSkill.WeaponType == "Rifle" || apiSkill.WeaponType == "Longbow" || apiSkill.WeaponType == "Shortbow" || apiSkill.WeaponType == "Hammer")
         {
             WeaponSlot = Hand.TwoHand;
         }
         else
         {
             WeaponSlot = apiSkill.Slot == "Weapon_1" || apiSkill.Slot == "Weapon_2" || apiSkill.Slot == "Weapon_3" ? Hand.MainHand : Hand.OffHand;
         }
     }
 }
        internal void SetWeapons(WeaponDescriptor weaponDescriptor, GW2APISkill ApiSkill, int swapped)
        {
            if (weaponDescriptor.WeaponSlot == WeaponDescriptor.Hand.Dual)
            {
                switch (swapped)
                {
                case ParserHelper.WeaponSetIDs.FirstLandSet:
                    SetLand1MainHand(ApiSkill.WeaponType);
                    SetLand1OffHand(ApiSkill.DualWield);
                    break;

                case ParserHelper.WeaponSetIDs.SecondLandSet:
                    SetLand2MainHand(ApiSkill.WeaponType);
                    SetLand2OffHand(ApiSkill.DualWield);
                    break;

                case ParserHelper.WeaponSetIDs.FirstWaterSet:
                    SetWater1MainHand(ApiSkill.WeaponType);
                    SetWater1OffHand(ApiSkill.DualWield);
                    break;

                case ParserHelper.WeaponSetIDs.SecondWaterSet:
                    SetWater2MainHand(ApiSkill.WeaponType);
                    SetWater2OffHand(ApiSkill.DualWield);
                    break;
                }
            }
            else if (weaponDescriptor.WeaponSlot == WeaponDescriptor.Hand.TwoHand)
            {
                switch (swapped)
                {
                case ParserHelper.WeaponSetIDs.FirstLandSet:
                    SetLand1TwoHand(ApiSkill.WeaponType);
                    break;

                case ParserHelper.WeaponSetIDs.SecondLandSet:
                    SetLand2TwoHand(ApiSkill.WeaponType);
                    break;

                case ParserHelper.WeaponSetIDs.FirstWaterSet:
                    SetWater1TwoHand(ApiSkill.WeaponType);
                    break;

                case ParserHelper.WeaponSetIDs.SecondWaterSet:
                    SetWater2TwoHand(ApiSkill.WeaponType);
                    break;
                }
            }
            else if (weaponDescriptor.WeaponSlot == WeaponDescriptor.Hand.MainHand)
            {
                switch (swapped)
                {
                case ParserHelper.WeaponSetIDs.FirstLandSet:
                    SetLand1MainHand(ApiSkill.WeaponType);
                    break;

                case ParserHelper.WeaponSetIDs.SecondLandSet:
                    SetLand2MainHand(ApiSkill.WeaponType);
                    break;

                case ParserHelper.WeaponSetIDs.FirstWaterSet:
                    SetWater1MainHand(ApiSkill.WeaponType);
                    break;

                case ParserHelper.WeaponSetIDs.SecondWaterSet:
                    SetWater2MainHand(ApiSkill.WeaponType);
                    break;
                }
            }
            else
            {
                switch (swapped)
                {
                case ParserHelper.WeaponSetIDs.FirstLandSet:
                    SetLand1OffHand(ApiSkill.WeaponType);
                    break;

                case ParserHelper.WeaponSetIDs.SecondLandSet:
                    SetLand2OffHand(ApiSkill.WeaponType);
                    break;

                case ParserHelper.WeaponSetIDs.FirstWaterSet:
                    SetWater1OffHand(ApiSkill.WeaponType);
                    break;

                case ParserHelper.WeaponSetIDs.SecondWaterSet:
                    SetWater2OffHand(ApiSkill.WeaponType);
                    break;
                }
            }
        }
Пример #5
0
        public static GW2APISkill GetSkill(long id)
        {
            GW2APISkill skill = GetSkillList().Items.FirstOrDefault(x => x.Id == id);

            return(skill);
        }