Ejemplo n.º 1
0
        private static JsonRotation BuildJsonRotation(ParsedEvtcLog log, long skillID, List <AbstractCastEvent> skillCasts, Dictionary <string, JsonLog.SkillDesc> skillDesc)
        {
            var jsonRotation = new JsonRotation();

            if (!skillDesc.ContainsKey("s" + skillID))
            {
                SkillItem skill = skillCasts.First().Skill;
                skillDesc["s" + skillID] = JsonLogBuilder.BuildSkillDesc(skill, log);
            }
            jsonRotation.Id     = skillID;
            jsonRotation.Skills = skillCasts.Select(x => BuildJsonSkill(x)).ToList();
            return(jsonRotation);
        }
        internal JsonMinions(Minions minions, ParsedEvtcLog log, Dictionary <string, JsonLog.SkillDesc> skillDesc, Dictionary <string, JsonLog.BuffDesc> buffDesc)
        {
            List <PhaseData> phases      = log.FightData.GetPhases(log);
            bool             isNPCMinion = minions.Master is NPC;

            //
            Name = minions.Character;
            //
            var totalDamage       = new List <int>();
            var totalShieldDamage = new List <int>();

            foreach (PhaseData phase in phases)
            {
                int tot    = 0;
                int shdTot = 0;
                foreach (AbstractDamageEvent de in minions.GetDamageLogs(null, log, phase.Start, phase.End))
                {
                    tot   += de.Damage;
                    shdTot = de.ShieldDamage;
                }
                totalDamage.Add(tot);
                totalShieldDamage.Add(shdTot);
            }
            TotalDamage       = totalDamage;
            TotalShieldDamage = totalShieldDamage;
            if (!isNPCMinion)
            {
                var totalTargetDamage       = new List <int> [log.FightData.Logic.Targets.Count];
                var totalTargetShieldDamage = new List <int> [log.FightData.Logic.Targets.Count];
                for (int i = 0; i < log.FightData.Logic.Targets.Count; i++)
                {
                    NPC tar                  = log.FightData.Logic.Targets[i];
                    var totalTarDamage       = new List <int>();
                    var totalTarShieldDamage = new List <int>();
                    foreach (PhaseData phase in phases)
                    {
                        int tot    = 0;
                        int shdTot = 0;
                        foreach (AbstractDamageEvent de in minions.GetDamageLogs(tar, log, phase.Start, phase.End))
                        {
                            tot   += de.Damage;
                            shdTot = de.ShieldDamage;
                        }
                        totalTarDamage.Add(tot);
                        totalTarShieldDamage.Add(shdTot);
                    }
                    totalTargetDamage[i]       = totalTarDamage;
                    totalTargetShieldDamage[i] = totalTarShieldDamage;
                }
                TotalTargetShieldDamage = totalTargetShieldDamage;
                TotalTargetDamage       = totalTargetDamage;
            }
            //
            var skillByID = minions.GetIntersectingCastLogs(log, 0, log.FightData.FightEnd).GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList());

            if (skillByID.Any())
            {
                Rotation = JsonRotation.BuildJsonRotationList(log, skillByID, skillDesc);
            }
            //
            TotalDamageDist = new List <JsonDamageDist> [phases.Count];
            for (int i = 0; i < phases.Count; i++)
            {
                PhaseData phase = phases[i];
                TotalDamageDist[i] = JsonDamageDist.BuildJsonDamageDistList(minions.GetDamageLogs(null, log, phase.Start, phase.End).GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList()), log, skillDesc, buffDesc);
            }
            if (!isNPCMinion)
            {
                TargetDamageDist = new List <JsonDamageDist> [log.FightData.Logic.Targets.Count][];
                for (int i = 0; i < log.FightData.Logic.Targets.Count; i++)
                {
                    NPC target = log.FightData.Logic.Targets[i];
                    TargetDamageDist[i] = new List <JsonDamageDist> [phases.Count];
                    for (int j = 0; j < phases.Count; j++)
                    {
                        PhaseData phase = phases[j];
                        TargetDamageDist[i][j] = JsonDamageDist.BuildJsonDamageDistList(minions.GetDamageLogs(target, log, phase.Start, phase.End).GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList()), log, skillDesc, buffDesc);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        protected JsonActor(AbstractSingleActor actor, ParsedEvtcLog log, RawFormatSettings settings, Dictionary <string, JsonLog.SkillDesc> skillDesc, Dictionary <string, JsonLog.BuffDesc> buffDesc)
        {
            IReadOnlyList <PhaseData> phases = log.FightData.GetPhases(log);

            //
            Name          = actor.Character;
            Toughness     = actor.Toughness;
            Healing       = actor.Healing;
            Concentration = actor.Concentration;
            Condition     = actor.Condition;
            HitboxHeight  = actor.HitboxHeight;
            HitboxWidth   = actor.HitboxWidth;
            InstanceID    = actor.InstID;
            //
            DpsAll   = phases.Select(phase => new JsonStatistics.JsonDPS(actor.GetDPSStats(log, phase.Start, phase.End))).ToArray();
            StatsAll = phases.Select(phase => new JsonStatistics.JsonGameplayStatsAll(actor.GetGameplayStats(log, phase.Start, phase.End))).ToArray();
            Defenses = phases.Select(phase => new JsonStatistics.JsonDefensesAll(actor.GetDefenseStats(log, phase.Start, phase.End))).ToArray();
            //
            IReadOnlyDictionary <long, Minions> minionsList = actor.GetMinions(log);

            if (minionsList.Values.Any())
            {
                Minions = minionsList.Values.Select(x => new JsonMinions(x, log, skillDesc, buffDesc)).ToList();
            }
            //
            var skillByID = actor.GetIntersectingCastEvents(log, 0, log.FightData.FightEnd).GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList());

            if (skillByID.Any())
            {
                Rotation = JsonRotation.BuildJsonRotationList(log, skillByID, skillDesc);
            }
            //
            if (settings.RawFormatTimelineArrays)
            {
                var damage1S          = new IReadOnlyList <int> [phases.Count];
                var powerDamage1S     = new IReadOnlyList <int> [phases.Count];
                var conditionDamage1S = new IReadOnlyList <int> [phases.Count];
                var breakbarDamage1S  = new IReadOnlyList <double> [phases.Count];
                for (int i = 0; i < phases.Count; i++)
                {
                    PhaseData phase = phases[i];
                    damage1S[i]          = actor.Get1SDamageList(log, phase.Start, phase.End, null, ParserHelper.DamageType.All);
                    powerDamage1S[i]     = actor.Get1SDamageList(log, phase.Start, phase.End, null, ParserHelper.DamageType.Power);
                    conditionDamage1S[i] = actor.Get1SDamageList(log, phase.Start, phase.End, null, ParserHelper.DamageType.Condition);
                    breakbarDamage1S[i]  = actor.Get1SBreakbarDamageList(log, phase.Start, phase.End, null);
                }
                Damage1S          = damage1S;
                PowerDamage1S     = powerDamage1S;
                ConditionDamage1S = conditionDamage1S;
                BreakbarDamage1S  = breakbarDamage1S;
            }
            if (!log.CombatData.HasBreakbarDamageData)
            {
                BreakbarDamage1S = null;
            }
            //
            TotalDamageDist  = BuildDamageDistData(actor, phases, log, skillDesc, buffDesc);
            TotalDamageTaken = BuildDamageTakenDistData(actor, phases, log, skillDesc, buffDesc);
            //
            if (settings.RawFormatTimelineArrays)
            {
                Dictionary <long, BuffsGraphModel> buffGraphs = actor.GetBuffGraphs(log);
                BoonsStates      = JsonBuffsUptime.GetBuffStates(buffGraphs[Buff.NumberOfBoonsID]);
                ConditionsStates = JsonBuffsUptime.GetBuffStates(buffGraphs[Buff.NumberOfConditionsID]);
                if (buffGraphs.TryGetValue(Buff.NumberOfActiveCombatMinions, out BuffsGraphModel states))
                {
                    ActiveCombatMinions = JsonBuffsUptime.GetBuffStates(states);
                }
                // Health
                HealthPercents = actor.GetHealthUpdates(log).Select(x => new double[2] {
                    x.Start, x.Value
                }).ToList();
                BarrierPercents = actor.GetBarrierUpdates(log).Select(x => new double[2] {
                    x.Start, x.Value
                }).ToList();
            }
        }
Ejemplo n.º 4
0
        protected JsonActor(AbstractSingleActor actor, ParsedEvtcLog log, RawFormatSettings settings, Dictionary <string, JsonLog.SkillDesc> skillDesc, Dictionary <string, JsonLog.BuffDesc> buffDesc)
        {
            List <PhaseData> phases = log.FightData.GetPhases(log);

            //
            Name          = actor.Character;
            Toughness     = actor.Toughness;
            Healing       = actor.Healing;
            Concentration = actor.Concentration;
            Condition     = actor.Condition;
            HitboxHeight  = actor.HitboxHeight;
            HitboxWidth   = actor.HitboxWidth;
            InstanceID    = actor.InstID;
            //
            DpsAll   = actor.GetDPSAll(log).Select(x => new JsonStatistics.JsonDPS(x)).ToArray();
            StatsAll = actor.GetGameplayStats(log).Select(x => new JsonStatistics.JsonGameplayStatsAll(x)).ToArray();
            Defenses = actor.GetDefenses(log).Select(x => new JsonStatistics.JsonDefensesAll(x)).ToArray();
            //
            Dictionary <long, Minions> minionsList = actor.GetMinions(log);

            if (minionsList.Values.Any())
            {
                Minions = minionsList.Values.Select(x => new JsonMinions(x, log, skillDesc, buffDesc)).ToList();
            }
            //
            var skillByID = actor.GetIntersectingCastLogs(log, 0, log.FightData.FightEnd).GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList());

            if (skillByID.Any())
            {
                Rotation = JsonRotation.BuildJsonRotationList(log, skillByID, skillDesc);
            }
            //
            if (settings.RawFormatTimelineArrays)
            {
                Damage1S = new List <int> [phases.Count];
                for (int i = 0; i < phases.Count; i++)
                {
                    Damage1S[i] = actor.Get1SDamageList(log, i, phases[i], null);
                }
            }
            //
            TotalDamageDist  = BuildDamageDistData(actor, null, phases, log, skillDesc, buffDesc);
            TotalDamageTaken = BuildDamageTakenDistData(actor, null, phases, log, skillDesc, buffDesc);
            //
            if (settings.RawFormatTimelineArrays)
            {
                Dictionary <long, BuffsGraphModel> buffGraphs = actor.GetBuffGraphs(log);
                BoonsStates      = JsonBuffsUptime.GetBuffStates(buffGraphs[Buff.NumberOfBoonsID]);
                ConditionsStates = JsonBuffsUptime.GetBuffStates(buffGraphs[Buff.NumberOfConditionsID]);
                if (buffGraphs.TryGetValue(Buff.NumberOfActiveCombatMinions, out BuffsGraphModel states))
                {
                    ActiveCombatMinions = JsonBuffsUptime.GetBuffStates(states);
                }
            }
            // Health
            List <HealthUpdateEvent> hpUpdates = log.CombatData.GetHealthUpdateEvents(actor.AgentItem);

            if (settings.RawFormatTimelineArrays)
            {
                HealthPercents = hpUpdates.Select(x => new double[2] {
                    x.Time, x.HPPercent
                }).ToList();
            }
        }