// Private Methods 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 once, check on which set they started else if (swaps.Count == 1) { swapped = swaps.First().ExpectedDuration == 4 ? 5 : 4; } foreach (CastLog cl in casting) { 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"))) { if (apiskill.dual_wield != null) { if (swapped == 4) { weapons[0] = apiskill.weapon_type; weapons[1] = apiskill.dual_wield; } else if (swapped == 5) { weapons[2] = apiskill.weapon_type; weapons[3] = apiskill.dual_wield; } } else 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] = apiskill.weapon_type; weapons[1] = "2Hand"; } else if (swapped == 5) { weapons[2] = apiskill.weapon_type; weapons[3] = "2Hand"; } }//2 handed else if (apiskill.weapon_type == "Focus" || apiskill.weapon_type == "Shield" || apiskill.weapon_type == "Torch" || apiskill.weapon_type == "Warhorn") { if (swapped == 4) { weapons[1] = apiskill.weapon_type; } else if (swapped == 5) { weapons[3] = apiskill.weapon_type; } }//OffHand else 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] = apiskill.weapon_type; } else if (swapped == 5) { weapons[2] = apiskill.weapon_type; } } if (apiskill.slot == "Weapon_4" || apiskill.slot == "Weapon_5") { if (swapped == 4) { weapons[1] = apiskill.weapon_type; } else if (swapped == 5) { weapons[3] = apiskill.weapon_type; } } }// 1 handed } } else if (cl.SkillId == SkillItem.WeaponSwapId) { //wepswap swapped = cl.ExpectedDuration; swappedTime = cl.Time; continue; } } _weaponsArray = weapons; }