public SkillItem(long ID, string name, GW2APIController apiController)
 {
     this.ID   = ID;
     Name      = name.Replace("\0", "");
     _apiSkill = apiController.GetSkill(ID);
     CompleteItem();
 }
Пример #2
0
        //setter
        public void SetGW2APISkill(GW2APIController apiController)
        {
            if (ApiSkill == null)
            {
                GW2APISkill skillAPI = apiController.GetSkill(ID);

                if (skillAPI != null)
                {
                    ApiSkill = skillAPI;
                    _name    = skillAPI.name;
                }
            }
        }
 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;
         }
     }
 }
        public void findName(SkillData skill_data, int id)
        {
            name  = "";
            skill = null;
            List <SkillItem> s_list = skill_data.getSkillList();

            if (s_list.FirstOrDefault(x => x.getID() == id) != null)
            {
                skill = s_list.FirstOrDefault(x => x.getID() == id).GetGW2APISkill();
            }
            if (id == -2)
            {
                name = "Weapon Swap";
            }
            if (skill == null)
            {
                name = skill_data.getName(id);
            }
            else
            {
                name = skill.name;
            }
            name = name.Replace("\"", "");
        }
Пример #5
0
        // Private Methods
        private void EstimateWeapons(ParsedLog log)
        {
            string[]         weapons   = new string[4];//first 2 for first set next 2 for second set
            List <SkillItem> s_list    = log.getSkillData().getSkillList();
            List <CastLog>   casting   = getCastLogs(log, 0, log.getBossData().getAwareDuration());
            int            swapped     = 0;//4 for first set and 5 for next
            long           swappedTime = 0;
            List <CastLog> swaps       = casting.Where(x => x.getID() == -2).Take(2).ToList();

            // If the player never swapped, assume they are on their first set
            if (swaps.Count == 0)
            {
                swapped = 4;
            }
            // if the player swapped once, check on which set they started
            else if (swaps.Count == 1)
            {
                swapped = swaps.First().getExpDur() == 4 ? 5 : 4;
            }
            foreach (CastLog cl in casting)
            {
                GW2APISkill apiskill = null;
                SkillItem   skill    = s_list.FirstOrDefault(x => x.getID() == cl.getID());
                if (skill != null)
                {
                    apiskill = skill.GetGW2APISkill();
                }
                if (apiskill != null && cl.getTime() > swappedTime)
                {
                    if (apiskill.type == "Weapon" && apiskill.professions.Count() > 0 && (apiskill.categories == null || (apiskill.categories.Count() == 1 && apiskill.categories[0] == "Phantasm")))
                    {
                        if (apiskill.weapon_type == "Greatsword" || apiskill.weapon_type == "Staff" || apiskill.weapon_type == "Rifle" || apiskill.weapon_type == "Longbow" || apiskill.weapon_type == "Shortbow" || apiskill.weapon_type == "Hammer")
                        {
                            if (swapped == 4 && (weapons[0] == null && weapons[1] == null))
                            {
                                weapons[0] = apiskill.weapon_type;
                                weapons[1] = "2Hand";
                                continue;
                            }
                            else if (swapped == 5 && (weapons[2] == null && weapons[3] == null))
                            {
                                weapons[2] = apiskill.weapon_type;
                                weapons[3] = "2Hand";
                                continue;
                            }
                            continue;
                        }//2 handed
                        if (apiskill.weapon_type == "Focus" || apiskill.weapon_type == "Shield" || apiskill.weapon_type == "Torch" || apiskill.weapon_type == "Warhorn")
                        {
                            if (swapped == 4 && (weapons[1] == null))
                            {
                                weapons[1] = apiskill.weapon_type;
                                continue;
                            }
                            else if (swapped == 5 && (weapons[3] == null))
                            {
                                weapons[3] = apiskill.weapon_type;
                                continue;
                            }
                            continue;
                        }//OffHand
                        if (apiskill.weapon_type == "Axe" || apiskill.weapon_type == "Dagger" || apiskill.weapon_type == "Mace" || apiskill.weapon_type == "Pistol" || apiskill.weapon_type == "Sword" || apiskill.weapon_type == "Scepter")
                        {
                            if (apiskill.slot == "Weapon_1" || apiskill.slot == "Weapon_2" || apiskill.slot == "Weapon_3")
                            {
                                if (swapped == 4 && (weapons[0] == null))
                                {
                                    weapons[0] = apiskill.weapon_type;
                                    continue;
                                }
                                else if (swapped == 5 && (weapons[2] == null))
                                {
                                    weapons[2] = apiskill.weapon_type;
                                    continue;
                                }
                                continue;
                            }
                            if (apiskill.slot == "Weapon_4" || apiskill.slot == "Weapon_5")
                            {
                                if (swapped == 4 && (weapons[1] == null))
                                {
                                    weapons[1] = apiskill.weapon_type;
                                    continue;
                                }
                                else if (swapped == 5 && (weapons[3] == null))
                                {
                                    weapons[3] = apiskill.weapon_type;
                                    continue;
                                }
                                continue;
                            }
                        }// 1 handed
                    }
                }
                else if (cl.getID() == -2)
                {
                    //wepswap
                    swapped     = cl.getExpDur();
                    swappedTime = cl.getTime();
                    continue;
                }
                if (weapons[0] != null && weapons[1] != null && weapons[2] != null && weapons[3] != null)
                {
                    break;
                }
            }
            weapons_array = weapons;
        }
Пример #6
0
        private void EstimateWeapons(ParsedLog log)
        {
            if (Prof == "Sword")
            {
                _weaponsArray = new string[]
                {
                    "Sword",
                    "2Hand",
                    null,
                    null
                };
                return;
            }
            string[]       weapons     = new string[4];//first 2 for first set next 2 for second set
            SkillData      skillList   = log.SkillData;
            List <CastLog> casting     = GetCastLogs(log, 0, log.FightData.FightDuration);
            int            swapped     = 0;//4 for first set and 5 for next
            long           swappedTime = 0;
            List <CastLog> swaps       = casting.Where(x => x.SkillId == SkillItem.WeaponSwapId).Take(2).ToList();

            // If the player never swapped, assume they are on their first set
            if (swaps.Count == 0)
            {
                swapped = 4;
            }
            // if the player swapped, check on which set they started
            else
            {
                swapped = swaps.First().ExpectedDuration == 4 ? 5 : 4;
            }
            foreach (CastLog cl in casting)
            {
                if (cl.ActualDuration == 0 && cl.SkillId != SkillItem.WeaponSwapId)
                {
                    continue;
                }
                GW2APISkill apiskill = skillList.Get(cl.SkillId)?.ApiSkill;
                if (apiskill != null && cl.Time > swappedTime)
                {
                    if (apiskill.Type == "Weapon" && apiskill.Professions.Count() > 0 && (apiskill.Categories == null || (apiskill.Categories.Count() == 1 && (apiskill.Categories[0] == "Phantasm" || apiskill.Categories[0] == "DualWield"))))
                    {
                        if (apiskill.DualWield != null && apiskill.DualWield != "None" && apiskill.DualWield != "Nothing")
                        {
                            if (swapped == 4)
                            {
                                weapons[0] = apiskill.WeaponType;
                                weapons[1] = apiskill.DualWield;
                            }
                            else if (swapped == 5)
                            {
                                weapons[2] = apiskill.WeaponType;
                                weapons[3] = apiskill.DualWield;
                            }
                        }
                        else if (apiskill.WeaponType == "Greatsword" || apiskill.WeaponType == "Staff" || apiskill.WeaponType == "Rifle" || apiskill.WeaponType == "Longbow" || apiskill.WeaponType == "Shortbow" || apiskill.WeaponType == "Hammer")
                        {
                            if (swapped == 4)
                            {
                                weapons[0] = apiskill.WeaponType;
                                weapons[1] = "2Hand";
                            }
                            else if (swapped == 5)
                            {
                                weapons[2] = apiskill.WeaponType;
                                weapons[3] = "2Hand";
                            }
                        }//2 handed
                        else if (apiskill.WeaponType == "Focus" || apiskill.WeaponType == "Shield" || apiskill.WeaponType == "Torch" || apiskill.WeaponType == "Warhorn")
                        {
                            if (swapped == 4)
                            {
                                weapons[1] = apiskill.WeaponType;
                            }
                            else if (swapped == 5)
                            {
                                weapons[3] = apiskill.WeaponType;
                            }
                        }//OffHand
                        else if (apiskill.WeaponType == "Axe" || apiskill.WeaponType == "Dagger" || apiskill.WeaponType == "Mace" || apiskill.WeaponType == "Pistol" || apiskill.WeaponType == "Sword" || apiskill.WeaponType == "Scepter")
                        {
                            if (apiskill.Slot == "Weapon_1" || apiskill.Slot == "Weapon_2" || apiskill.Slot == "Weapon_3")
                            {
                                if (swapped == 4)
                                {
                                    weapons[0] = apiskill.WeaponType;
                                }
                                else if (swapped == 5)
                                {
                                    weapons[2] = apiskill.WeaponType;
                                }
                            }
                            if (apiskill.Slot == "Weapon_4" || apiskill.Slot == "Weapon_5")
                            {
                                if (swapped == 4)
                                {
                                    weapons[1] = apiskill.WeaponType;
                                }
                                else if (swapped == 5)
                                {
                                    weapons[3] = apiskill.WeaponType;
                                }
                            }
                        }// 1 handed
                    }
                }
                else if (cl.SkillId == SkillItem.WeaponSwapId)
                {
                    //wepswap
                    swapped     = cl.ExpectedDuration;
                    swappedTime = cl.Time;
                    continue;
                }
            }
            _weaponsArray = weapons;
        }