Esempio n. 1
0
 public void Add(SkillItem skillItem)
 {
     if (!_skills.ContainsKey(skillItem.ID))
     {
         _skills.Add(skillItem.ID, skillItem);
     }
 }
Esempio n. 2
0
        // Public Methods

        public SkillItem Get(long ID)
        {
            if (_skills.TryGetValue(ID, out SkillItem value))
            {
                return(value);
            }
            SkillItem item = new SkillItem(ID, "UNKNOWN");

            Add(item);
            return(item);
        }
Esempio n. 3
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;
        }
        public String GetName(long ID)
        {
            // Custom
            if (_apiMissingID.ContainsKey(ID))
            {
                return(_apiMissingID[ID]);
            }

            // Normal
            SkillItem skillItem = Get(ID);

            if (skillItem != null)
            {
                return(skillItem.Name);
            }

            // Unknown
            return("uid: " + ID.ToString());
        }
Esempio n. 6
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;
        }
 // Public Methods
 public void addItem(SkillItem item)
 {
     skill_list.Add(item);
 }
Esempio n. 8
0
 public void Add(SkillItem skillItem)
 {
     _skills.Add(skillItem.ID, skillItem);
 }