Exemple #1
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;
                }
                SkillItem skill = skillList.Get(cl.SkillId);
                if (!skill.EstimateWeapons(weapons, swapped, cl.Time > swappedTime) && cl.SkillId == SkillItem.WeaponSwapId)
                {
                    //wepswap
                    swapped     = cl.ExpectedDuration;
                    swappedTime = cl.Time;
                }
            }
            _weaponsArray = weapons;
        }
        private void EstimateWeapons(ParsedLog log)
        {
            if (Prof == "Sword")
            {
                _weaponsArray = new string[]
                {
                    "Sword",
                    "2Hand",
                    null,
                    null,
                    null,
                    null,
                    null,
                    null
                };
                return;
            }
            string[]       weapons     = new string[8];//first 2 for first set next 2 for second set, second sets of 4 for underwater
            SkillData      skillList   = log.SkillData;
            List <CastLog> casting     = GetCastLogs(log, 0, log.FightData.FightDuration);
            int            swapped     = -1;
            long           swappedTime = 0;
            List <int>     swaps       = casting.Where(x => x.SkillId == SkillItem.WeaponSwapId).Select(x => x.ExpectedDuration).ToList();

            foreach (CastLog cl in casting)
            {
                if (cl.ActualDuration == 0 && cl.SkillId != SkillItem.WeaponSwapId)
                {
                    continue;
                }
                SkillItem skill = skillList.Get(cl.SkillId);
                // first iteration
                if (swapped == -1)
                {
                    swapped = skill.FindWeaponSlot(swaps);
                }
                if (!skill.EstimateWeapons(weapons, swapped, cl.Time > swappedTime) && cl.SkillId == SkillItem.WeaponSwapId)
                {
                    //wepswap
                    swapped     = cl.ExpectedDuration;
                    swappedTime = cl.Time;
                }
            }
            _weaponsArray = weapons;
        }
        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;
        }