Ejemplo n.º 1
0
        private List <JsonPlayerBuffs> BuildPlayerBuffUptimes(List <Dictionary <long, Statistics.FinalBuffs> > statUptimes, Player player)
        {
            var uptimes = new List <JsonPlayerBuffs>();
            int phases  = _phases.Count;

            foreach (var pair in statUptimes[0])
            {
                Boon buff = Boon.BoonsByIds[pair.Key];
                if (!_buffDesc.ContainsKey("b" + pair.Key))
                {
                    _buffDesc["b" + pair.Key] = new JsonLog.BuffDesc(buff);
                }
                if (buff.Nature == Boon.BoonNature.GraphOnlyBuff && buff.Source == Boon.ProfToEnum(player.Prof))
                {
                    if (player.GetBoonDistribution(_log, 0).GetUptime(pair.Key) > 0)
                    {
                        if (_personalBuffs.TryGetValue(player.Prof, out var list) && !list.Contains(pair.Key))
                        {
                            list.Add(pair.Key);
                        }
                        else
                        {
                            _personalBuffs[player.Prof] = new HashSet <long>()
                            {
                                pair.Key
                            };
                        }
                    }
                }
                List <JsonPlayerBuffsData> data = new List <JsonPlayerBuffsData>();
                for (int i = 0; i < _phases.Count; i++)
                {
                    data.Add(new JsonPlayerBuffsData(statUptimes[i][pair.Key], false));
                }
                JsonPlayerBuffs jsonBuffs = new JsonPlayerBuffs()
                {
                    States   = BuildBuffStates(player.GetBoonGraphs(_log)[pair.Key]),
                    BuffData = data,
                    Id       = pair.Key
                };
                uptimes.Add(jsonBuffs);
            }

            if (!uptimes.Any())
            {
                return(null);
            }

            return(uptimes);
        }
Ejemplo n.º 2
0
        private Dictionary <string, JsonBuffs> BuildBuffUptime(Dictionary <long, Statistics.FinalBuffs>[] statUptimes, Player player)
        {
            var uptimes = new Dictionary <string, JsonBuffs>();
            int phases  = _statistics.Phases.Count;

            var boonsFound    = new HashSet <long>();
            var boonsNotFound = new HashSet <long>();

            for (int phaseIndex = 0; phaseIndex < phases; phaseIndex++)
            {
                foreach (var boon in statUptimes[phaseIndex])
                {
                    Boon buff = Boon.BoonsByIds[boon.Key];
                    _buffNames["b" + boon.Key] = buff.Name;
                    if (buff.Nature == Boon.BoonNature.GraphOnlyBuff && buff.Source == Boon.ProfToEnum(player.Prof))
                    {
                        if (player.GetBoonDistribution(_log, 0).GetUptime(boon.Key) > 0)
                        {
                            if (_personalBuffs.TryGetValue(player.Prof, out var list) && !list.Contains(boon.Key))
                            {
                                list.Add(boon.Key);
                            }
                            else
                            {
                                _personalBuffs[player.Prof] = new HashSet <long>()
                                {
                                    boon.Key
                                };
                            }
                        }
                    }
                    if (boonsFound.Contains(boon.Key))
                    {
                        MakePhaseBoon(uptimes["b" + boon.Key], phaseIndex, boon.Value);
                    }
                    else if (!boonsNotFound.Contains(boon.Key))
                    {
                        if (ContainsBoon(boon.Key, statUptimes))
                        {
                            boonsFound.Add(boon.Key);

                            uptimes["b" + boon.Key] = new JsonBuffs(phases);
                            MakePhaseBoon(uptimes["b" + boon.Key], phaseIndex, boon.Value);
                            if (player.GetBoonGraphs(_log).TryGetValue(boon.Key, out var bgm))
                            {
                                uptimes["b" + boon.Key].states = BuildBuffStates(bgm);
                            }
                        }
                        else
                        {
                            boonsNotFound.Add(boon.Key);
                        }
                    }
                }
            }

            if (!uptimes.Any())
            {
                return(null);
            }

            foreach (var boon in uptimes)
            {
                RemoveZeroArrays(boon.Value);
            }

            return(uptimes);
        }
        private Dictionary <long, JsonBuffs> BuildBuffUptime(Dictionary <long, Statistics.FinalBoonUptime>[] statUptimes, Player player)
        {
            var uptimes = new Dictionary <long, JsonBuffs>();
            int phases  = _statistics.Phases.Count;

            var boonsFound    = new HashSet <long>();
            var boonsNotFound = new HashSet <long>();

            for (int phaseIndex = 0; phaseIndex < phases; phaseIndex++)
            {
                foreach (var boon in statUptimes[phaseIndex])
                {
                    _buffNames[boon.Key] = Boon.BoonsByIds[boon.Key].Name;
                    if (_devMode)
                    {
                        Boon buff = Boon.BoonsByIds[boon.Key];
                        _buffData[boon.Key] = new BuffDesc()
                        {
                            Icon     = buff.Link,
                            Stacking = buff.Type == Boon.BoonType.Intensity ? 1 : 0,
                            Table    = buff.Nature == Boon.BoonNature.Boon ? 0 : (buff.Nature == Boon.BoonNature.Condition ? 1 : (buff.Nature == Boon.BoonNature.OffensiveBuffTable ? 2 : (buff.Nature == Boon.BoonNature.DefensiveBuffTable ? 3 : -1)))
                        };
                        if (buff.Nature == Boon.BoonNature.GraphOnlyBuff && buff.Source == Boon.ProfToEnum(player.Prof))
                        {
                            if (player.GetBoonDistribution(_log, 0).GetUptime(boon.Key) > 0)
                            {
                                if (_personalBuffs.TryGetValue(player.Prof, out var list) && !list.Contains(boon.Key))
                                {
                                    list.Add(boon.Key);
                                }
                                else
                                {
                                    _personalBuffs[player.Prof] = new List <long>()
                                    {
                                        boon.Key
                                    };
                                }
                            }
                        }
                    }
                    if (boonsFound.Contains(boon.Key))
                    {
                        MakePhaseBoon(uptimes[boon.Key], phaseIndex, boon.Value);
                    }
                    else if (!boonsNotFound.Contains(boon.Key))
                    {
                        if (ContainsBoon(boon.Key, statUptimes))
                        {
                            boonsFound.Add(boon.Key);

                            uptimes[boon.Key] = new JsonBuffs(phases);
                            MakePhaseBoon(uptimes[boon.Key], phaseIndex, boon.Value);
                            if (player.GetBoonGraphs(_log).TryGetValue(boon.Key, out var bgm))
                            {
                                foreach (BoonsGraphModel.Segment seg in bgm.BoonChart)
                                {
                                    uptimes[boon.Key].States.Add(new int[2] {
                                        (int)seg.Start,
                                        seg.Value
                                    });
                                }
                            }
                        }
                        else
                        {
                            boonsNotFound.Add(boon.Key);
                        }
                    }
                }
            }

            if (!uptimes.Any())
            {
                return(null);
            }

            foreach (var boon in uptimes)
            {
                RemoveZeroArrays(boon.Value);
            }

            return(uptimes);
        }