/// <summary>
        /// Checks the combat data and gets buffs that were present during the fight
        /// </summary>
        private void SetPresentBoons()
        {
            HashSet <long> skillIDs = _log.CombatData.GetSkills();

            // 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);
                }
            }

            // All class specific boons
            Dictionary <long, Boon> remainingBuffsByIds = Boon.GetRemainingBuffsList().GroupBy(x => x.ID).ToDictionary(x => x.Key, x => x.ToList().FirstOrDefault());
            var players = _log.PlayerList;

            foreach (Player player in players)
            {
                _statistics.PresentPersonalBuffs[player.InstID] = new HashSet <Boon>();
                foreach (CombatItem item in _log.CombatData.GetBoonDataByDst(player.InstID, player.FirstAware, player.LastAware))
                {
                    if (item.DstInstid == player.InstID && item.IsBuffRemove == ParseEnum.BuffRemove.None && remainingBuffsByIds.TryGetValue(item.SkillID, out Boon boon))
                    {
                        _statistics.PresentPersonalBuffs[player.InstID].Add(boon);
                    }
                }
            }
        }
        /// <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);
                    }
                }
            }
        }
Beispiel #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);
                    }
                }
            }
        }