Пример #1
0
        private void SetConsumablesList(ParsedLog log)
        {
            List <Boon> consumableList = Boon.GetConsumableList();

            _consumeList = new List <Consumable>();
            long fightDuration = log.FightData.FightDuration;

            foreach (Boon consumable in consumableList)
            {
                foreach (CombatItem c in log.CombatData.GetBoonData(consumable.ID))
                {
                    if (c.IsBuffRemove != ParseEnum.BuffRemove.None || (c.IsBuff != 18 && c.IsBuff != 1) || AgentItem.InstID != c.DstInstid)
                    {
                        continue;
                    }
                    long time = 0;
                    if (c.IsBuff != 18)
                    {
                        time = log.FightData.ToFightSpace(c.Time);
                    }
                    if (time <= fightDuration)
                    {
                        Consumable existing = _consumeList.Find(x => x.Time == time && x.Buff.ID == consumable.ID);
                        if (existing != null)
                        {
                            existing.Stack++;
                        }
                        else
                        {
                            _consumeList.Add(new Consumable(consumable, time, c.Value));
                        }
                    }
                }
            }
            _consumeList.Sort((x, y) => x.Time.CompareTo(y.Time));
        }
        /// <summary>
        /// Checks the combat data and gets buffs that were present during the fight
        /// </summary>
        private void SetPresentBoons()
        {
            List <CombatItem> combatList = _log.CombatData.AllCombatItems;
            var skillIDs = new HashSet <long>(combatList.Select(x => x.SkillID));

            // Main boons
            foreach (Boon boon in Boon.GetBoonList())
            {
                if (skillIDs.Contains(boon.ID))
                {
                    _statistics.PresentBoons.Add(boon);
                }
            }
            // Main Conditions
            foreach (Boon boon in Boon.GetCondiBoonList())
            {
                if (skillIDs.Contains(boon.ID))
                {
                    _statistics.PresentConditions.Add(boon);
                }
            }

            // Important class specific boons
            foreach (Boon boon in Boon.GetOffensiveTableList())
            {
                if (skillIDs.Contains(boon.ID))
                {
                    _statistics.PresentOffbuffs.Add(boon);
                }
            }

            foreach (Boon boon in Boon.GetDefensiveTableList())
            {
                if (skillIDs.Contains(boon.ID))
                {
                    _statistics.PresentDefbuffs.Add(boon);
                }
            }

            var players = _log.PlayerList;
            Dictionary <ushort, Player> playersById = new Dictionary <ushort, Player>();

            foreach (Player player in players)
            {
                _statistics.PresentPersonalBuffs[player.InstID] = new HashSet <Boon>();
                playersById.Add(player.InstID, player);
            }
            // All class specific boons
            List <Boon> remainingBuffs = new List <Boon>(Boon.GetRemainingBuffsList());

            remainingBuffs.AddRange(Boon.GetConsumableList());
            Dictionary <long, Boon> remainingBuffsByIds = remainingBuffs.GroupBy(x => x.ID).ToDictionary(x => x.Key, x => x.ToList().FirstOrDefault());

            foreach (CombatItem item in combatList)
            {
                if (playersById.TryGetValue(item.DstInstid, out Player player))
                {
                    if (remainingBuffsByIds.TryGetValue(item.SkillID, out Boon boon))
                    {
                        _statistics.PresentPersonalBuffs[player.InstID].Add(boon);
                    }
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Checks the combat data and gets buffs that were present during the fight
        /// </summary>
        private void SetPresentBoons()
        {
            List <CombatItem> combatList = _log.CombatData.AllCombatItems;
            var skillIDs = new HashSet <long>(combatList.Select(x => x.SkillID));

            if (_settings.PlayerBoonsUniversal)
            {
                // Main boons
                foreach (Boon boon in Boon.GetBoonList())
                {
                    if (skillIDs.Contains(boon.ID))
                    {
                        _statistics.PresentBoons.Add(boon);
                    }
                }
                // Main Conditions
                foreach (Boon boon in Boon.GetCondiBoonList())
                {
                    if (skillIDs.Contains(boon.ID))
                    {
                        _statistics.PresentConditions.Add(boon);
                    }
                }
            }

            if (_settings.PlayerBoonsImpProf)
            {
                // Important class specific boons
                foreach (Boon boon in Boon.GetOffensiveTableList())
                {
                    if (skillIDs.Contains(boon.ID))
                    {
                        _statistics.PresentOffbuffs.Add(boon);
                    }
                }

                foreach (Boon boon in Boon.GetDefensiveTableList())
                {
                    if (skillIDs.Contains(boon.ID))
                    {
                        _statistics.PresentDefbuffs.Add(boon);
                    }
                }
            }

            var players = _log.PlayerList;

            if (_settings.PlayerBoonsAllProf)
            {
                var playersById = new Dictionary <ushort, Player>();
                foreach (var player in players)
                {
                    _statistics.PresentPersonalBuffs[player.InstID] = new List <Boon>();
                    playersById.Add(player.InstID, player);
                }
                // All class specific boons
                var remainingBoons = new List <Boon>(Boon.GetRemainingBuffsList());
                remainingBoons.AddRange(Boon.GetConsumableList());
                var classSpecificBoonsById = new Dictionary <long, Boon>();
                foreach (var boon in remainingBoons)
                {
                    if (boon.ID == -1)
                    {
                        continue;
                    }

                    classSpecificBoonsById.Add(boon.ID, boon);
                }

                foreach (var item in combatList)
                {
                    if (playersById.TryGetValue(item.DstInstid, out Player player))
                    {
                        if (classSpecificBoonsById.TryGetValue(item.SkillID, out Boon boon))
                        {
                            _statistics.PresentPersonalBuffs[player.InstID].Add(boon);
                        }
                    }
                }
            }
            foreach (Player player in players)
            {
                player.BoonToTrack.AddRange(_statistics.PresentBoons);
                player.BoonToTrack.AddRange(_statistics.PresentConditions);
                player.BoonToTrack.AddRange(_statistics.PresentOffbuffs);
                player.BoonToTrack.AddRange(_statistics.PresentDefbuffs);
                if (_settings.PlayerBoonsAllProf)
                {
                    player.BoonToTrack.AddRange(_statistics.PresentPersonalBuffs[player.InstID]);
                }
            }
            // target boons
            foreach (Target target in _log.FightData.Logic.Targets)
            {
                target.BoonToTrack.AddRange(_statistics.PresentBoons);
                target.BoonToTrack.AddRange(_statistics.PresentConditions);
                foreach (Boon boon in Boon.BoonsBySource[Boon.BoonSource.Enemy])
                {
                    if (_log.CombatData.BoonData.ContainsKey(boon.ID))
                    {
                        target.BoonToTrack.Add(boon);
                    }
                }
            }
        }