public static JsonNPC BuildJsonNPC(NPC npc, ParsedEvtcLog log, RawFormatSettings settings, Dictionary <string, JsonLog.SkillDesc> skillDesc, Dictionary <string, JsonLog.BuffDesc> buffDesc)
        {
            var jsonNPC = new JsonNPC();

            JsonActorBuilder.FillJsonActor(jsonNPC, npc, log, settings, skillDesc, buffDesc);
            IReadOnlyList <PhaseData> phases = log.FightData.GetNonDummyPhases(log);

            //
            jsonNPC.Id = npc.ID;
            IReadOnlyList <HealthUpdateEvent> hpUpdates = log.CombatData.GetHealthUpdateEvents(npc.AgentItem);

            jsonNPC.FirstAware = (int)npc.FirstAware;
            jsonNPC.LastAware  = (int)npc.LastAware;
            double hpLeft = 100.0;

            if (log.FightData.Success)
            {
                hpLeft = 0;
            }
            else
            {
                if (hpUpdates.Count > 0)
                {
                    hpLeft = hpUpdates.Last().HPPercent;
                }
            }
            jsonNPC.HealthPercentBurned = 100.0 - hpLeft;
            jsonNPC.FinalHealth         = (int)Math.Round(jsonNPC.TotalHealth * hpLeft / 100.0);
            //
            jsonNPC.Buffs = GetNPCJsonBuffsUptime(npc, log, settings, buffDesc);
            // Breakbar
            if (settings.RawFormatTimelineArrays)
            {
                jsonNPC.BreakbarPercents = npc.GetBreakbarPercentUpdates(log).Select(x => new double[2] {
                    x.Start, x.Value
                }).ToList();
            }
            return(jsonNPC);
        }
Beispiel #2
0
        internal JsonNPC(NPC npc, ParsedEvtcLog log, RawFormatSettings settings, Dictionary <string, JsonLog.SkillDesc> skillDesc, Dictionary <string, JsonLog.BuffDesc> buffDesc) : base(npc, log, settings, skillDesc, buffDesc)
        {
            List <PhaseData> phases = log.FightData.GetPhases(log);

            //
            Id = npc.ID;
            List <HealthUpdateEvent> hpUpdates = log.CombatData.GetHealthUpdateEvents(npc.AgentItem);

            TotalHealth = npc.GetHealth(log.CombatData);
            FirstAware  = (int)npc.FirstAware;
            LastAware   = (int)npc.LastAware;
            double hpLeft = 0.0;

            if (log.FightData.Success)
            {
                hpLeft = 0;
            }
            else
            {
                if (hpUpdates.Count > 0)
                {
                    hpLeft = hpUpdates.Last().HPPercent;
                }
            }
            HealthPercentBurned = 100.0 - hpLeft;
            FinalHealth         = (int)Math.Round(TotalHealth * hpLeft / 100.0);
            //
            Buffs = GetNPCJsonBuffsUptime(npc, npc.GetBuffs(log), npc.GetBuffsDictionary(log), log, settings, buffDesc);
            // Breakbar
            List <BreakbarPercentEvent> breakbarPercentUpdates = log.CombatData.GetBreakbarPercentEvents(npc.AgentItem);

            if (settings.RawFormatTimelineArrays)
            {
                BreakbarPercents = breakbarPercentUpdates.Select(x => new double[2] {
                    x.Time, x.BreakbarPercent
                }).ToList();
            }
        }
Beispiel #3
0
        public static JsonPlayer BuildJsonPlayer(AbstractSingleActor player, ParsedEvtcLog log, RawFormatSettings settings, Dictionary <string, JsonLog.SkillDesc> skillDesc, Dictionary <string, JsonLog.BuffDesc> buffDesc, Dictionary <string, JsonLog.DamageModDesc> damageModDesc, Dictionary <string, HashSet <long> > personalBuffs)
        {
            var jsonPlayer = new JsonPlayer();

            JsonActorBuilder.FillJsonActor(jsonPlayer, player, log, settings, skillDesc, buffDesc);
            IReadOnlyList <PhaseData> phases = log.FightData.GetNonDummyPhases(log);

            //
            jsonPlayer.Account         = player.Account;
            jsonPlayer.Weapons         = player.GetWeaponsArray(log).Select(w => w ?? "Unknown").ToArray();
            jsonPlayer.Group           = player.Group;
            jsonPlayer.Profession      = player.Spec.ToString();
            jsonPlayer.FriendlyNPC     = player is NPC;
            jsonPlayer.NotInSquad      = player is PlayerNonSquad;
            jsonPlayer.ActiveTimes     = phases.Select(x => player.GetActiveDuration(log, x.Start, x.End)).ToList();
            jsonPlayer.HasCommanderTag = player.HasCommanderTag;
            //
            jsonPlayer.Support = phases.Select(phase => JsonStatisticsBuilder.BuildJsonPlayerSupport(player.GetToPlayerSupportStats(log, phase.Start, phase.End))).ToArray();
            var targetDamage1S          = new IReadOnlyList <int> [log.FightData.Logic.Targets.Count][];
            var targetPowerDamage1S     = new IReadOnlyList <int> [log.FightData.Logic.Targets.Count][];
            var targetConditionDamage1S = new IReadOnlyList <int> [log.FightData.Logic.Targets.Count][];
            var targetBreakbarDamage1S  = new IReadOnlyList <double> [log.FightData.Logic.Targets.Count][];
            var dpsTargets       = new JsonStatistics.JsonDPS[log.FightData.Logic.Targets.Count][];
            var statsTargets     = new JsonStatistics.JsonGameplayStats[log.FightData.Logic.Targets.Count][];
            var targetDamageDist = new IReadOnlyList <JsonDamageDist> [log.FightData.Logic.Targets.Count][];

            for (int j = 0; j < log.FightData.Logic.Targets.Count; j++)
            {
                AbstractSingleActor target     = log.FightData.Logic.Targets[j];
                var graph1SDamageList          = new IReadOnlyList <int> [phases.Count];
                var graph1SPowerDamageList     = new IReadOnlyList <int> [phases.Count];
                var graph1SConditionDamageList = new IReadOnlyList <int> [phases.Count];
                var graph1SBreakbarDamageList  = new IReadOnlyList <double> [phases.Count];
                var targetDamageDistList       = new IReadOnlyList <JsonDamageDist> [phases.Count];
                for (int i = 0; i < phases.Count; i++)
                {
                    PhaseData phase = phases[i];
                    if (settings.RawFormatTimelineArrays)
                    {
                        graph1SDamageList[i]          = player.Get1SDamageList(log, phase.Start, phase.End, target, DamageType.All);
                        graph1SPowerDamageList[i]     = player.Get1SDamageList(log, phase.Start, phase.End, target, DamageType.Power);
                        graph1SConditionDamageList[i] = player.Get1SDamageList(log, phase.Start, phase.End, target, DamageType.Condition);
                        graph1SBreakbarDamageList[i]  = player.Get1SBreakbarDamageList(log, phase.Start, phase.End, target);
                    }
                    targetDamageDistList[i] = JsonDamageDistBuilder.BuildJsonDamageDistList(player.GetJustActorDamageEvents(target, log, phase.Start, phase.End).GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList()), log, skillDesc, buffDesc);
                }
                if (settings.RawFormatTimelineArrays)
                {
                    targetDamage1S[j]          = graph1SDamageList;
                    targetPowerDamage1S[j]     = graph1SPowerDamageList;
                    targetConditionDamage1S[j] = graph1SConditionDamageList;
                    targetBreakbarDamage1S[j]  = graph1SBreakbarDamageList;
                }
                targetDamageDist[j] = targetDamageDistList;
                dpsTargets[j]       = phases.Select(phase => JsonStatisticsBuilder.BuildJsonDPS(player.GetDPSStats(target, log, phase.Start, phase.End))).ToArray();
                statsTargets[j]     = phases.Select(phase => JsonStatisticsBuilder.BuildJsonGameplayStats(player.GetGameplayStats(target, log, phase.Start, phase.End))).ToArray();
            }
            if (settings.RawFormatTimelineArrays)
            {
                jsonPlayer.TargetDamage1S          = targetDamage1S;
                jsonPlayer.TargetPowerDamage1S     = targetPowerDamage1S;
                jsonPlayer.TargetConditionDamage1S = targetConditionDamage1S;
                jsonPlayer.TargetBreakbarDamage1S  = targetBreakbarDamage1S;
                Dictionary <long, BuffsGraphModel> buffGraphs = player.GetBuffGraphs(log);
                if (buffGraphs.TryGetValue(Buff.NumberOfClonesID, out BuffsGraphModel states))
                {
                    jsonPlayer.ActiveClones = JsonBuffsUptimeBuilder.GetBuffStates(states);
                }
            }
            jsonPlayer.TargetDamageDist = targetDamageDist;
            jsonPlayer.DpsTargets       = dpsTargets;
            jsonPlayer.StatsTargets     = statsTargets;
            if (!log.CombatData.HasBreakbarDamageData)
            {
                jsonPlayer.TargetBreakbarDamage1S = null;
            }
            //
            jsonPlayer.BuffUptimes   = GetPlayerJsonBuffsUptime(player, phases.Select(phase => player.GetBuffs(BuffEnum.Self, log, phase.Start, phase.End)).ToList(), log, settings, buffDesc, personalBuffs);
            jsonPlayer.SelfBuffs     = GetPlayerBuffGenerations(phases.Select(phase => player.GetBuffs(BuffEnum.Self, log, phase.Start, phase.End)).ToList(), log, buffDesc);
            jsonPlayer.GroupBuffs    = GetPlayerBuffGenerations(phases.Select(phase => player.GetBuffs(BuffEnum.Group, log, phase.Start, phase.End)).ToList(), log, buffDesc);
            jsonPlayer.OffGroupBuffs = GetPlayerBuffGenerations(phases.Select(phase => player.GetBuffs(BuffEnum.OffGroup, log, phase.Start, phase.End)).ToList(), log, buffDesc);
            jsonPlayer.SquadBuffs    = GetPlayerBuffGenerations(phases.Select(phase => player.GetBuffs(BuffEnum.Squad, log, phase.Start, phase.End)).ToList(), log, buffDesc);
            //
            jsonPlayer.BuffUptimesActive   = GetPlayerJsonBuffsUptime(player, phases.Select(phase => player.GetActiveBuffs(BuffEnum.Self, log, phase.Start, phase.End)).ToList(), log, settings, buffDesc, personalBuffs);
            jsonPlayer.SelfBuffsActive     = GetPlayerBuffGenerations(phases.Select(phase => player.GetActiveBuffs(BuffEnum.Self, log, phase.Start, phase.End)).ToList(), log, buffDesc);
            jsonPlayer.GroupBuffsActive    = GetPlayerBuffGenerations(phases.Select(phase => player.GetActiveBuffs(BuffEnum.Group, log, phase.Start, phase.End)).ToList(), log, buffDesc);
            jsonPlayer.OffGroupBuffsActive = GetPlayerBuffGenerations(phases.Select(phase => player.GetActiveBuffs(BuffEnum.OffGroup, log, phase.Start, phase.End)).ToList(), log, buffDesc);
            jsonPlayer.SquadBuffsActive    = GetPlayerBuffGenerations(phases.Select(phase => player.GetActiveBuffs(BuffEnum.Squad, log, phase.Start, phase.End)).ToList(), log, buffDesc);
            //
            IReadOnlyList <Consumable> consumables = player.GetConsumablesList(log, 0, log.FightData.FightEnd);

            if (consumables.Any())
            {
                var consumablesJSON = new List <JsonConsumable>();
                foreach (Consumable food in consumables)
                {
                    if (!buffDesc.ContainsKey("b" + food.Buff.ID))
                    {
                        buffDesc["b" + food.Buff.ID] = JsonLogBuilder.BuildBuffDesc(food.Buff, log);
                    }
                    consumablesJSON.Add(JsonConsumableBuilder.BuildJsonConsumable(food));
                }
                jsonPlayer.Consumables = consumablesJSON;
            }
            //
            IReadOnlyList <DeathRecap> deathRecaps = player.GetDeathRecaps(log);

            if (deathRecaps.Any())
            {
                jsonPlayer.DeathRecap = deathRecaps.Select(x => JsonDeathRecapBuilder.BuildJsonDeathRecap(x)).ToList();
            }
            //
            jsonPlayer.DamageModifiers       = JsonDamageModifierDataBuilder.GetDamageModifiers(phases.Select(x => player.GetDamageModifierStats(null, log, x.Start, x.End)).ToList(), log, damageModDesc);
            jsonPlayer.DamageModifiersTarget = JsonDamageModifierDataBuilder.GetDamageModifiersTarget(player, log, damageModDesc, phases);
            if (log.CombatData.HasEXTHealing)
            {
                jsonPlayer.EXTHealingStats = EXTJsonPlayerHealingStatsBuilder.BuildPlayerHealingStats(player, log, settings, skillDesc, buffDesc);
            }
            return(jsonPlayer);
        }
        private static List <JsonBuffsUptime> GetPlayerJsonBuffsUptime(AbstractSingleActor player, List <IReadOnlyDictionary <long, FinalActorBuffs> > buffs, ParsedEvtcLog log, RawFormatSettings settings, Dictionary <string, JsonLog.BuffDesc> buffDesc, Dictionary <string, HashSet <long> > personalBuffs)
        {
            var res       = new List <JsonBuffsUptime>();
            var profEnums = new HashSet <ParserHelper.Source>(SpecToSources(player.Spec));
            IReadOnlyList <PhaseData> phases = log.FightData.GetNonDummyPhases(log);

            foreach (KeyValuePair <long, FinalActorBuffs> pair in buffs[0])
            {
                Buff buff = log.Buffs.BuffsByIds[pair.Key];
                var  data = new List <JsonBuffsUptimeData>();
                for (int i = 0; i < phases.Count; i++)
                {
                    PhaseData phase = phases[i];
                    Dictionary <long, FinalBuffsDictionary> buffsDictionary = player.GetBuffsDictionary(log, phase.Start, phase.End);
                    if (buffs[i].TryGetValue(pair.Key, out FinalActorBuffs val))
                    {
                        JsonBuffsUptimeData value = JsonBuffsUptimeBuilder.BuildJsonBuffsUptimeData(val, buffsDictionary[pair.Key]);
                        data.Add(value);
                    }
                    else
                    {
                        var value = new JsonBuffsUptimeData();
                        data.Add(value);
                    }
                }
                if (buff.Classification == Buff.BuffClassification.Other && profEnums.Contains(buff.Source))
                {
                    if (player.GetBuffDistribution(log, phases[0].Start, phases[0].End).GetUptime(pair.Key) > 0)
                    {
                        if (personalBuffs.TryGetValue(player.Spec.ToString(), out HashSet <long> list) && !list.Contains(pair.Key))
                        {
                            list.Add(pair.Key);
                        }
                        else
                        {
                            personalBuffs[player.Spec.ToString()] = new HashSet <long>()
                            {
                                pair.Key
                            };
                        }
                    }
                }
                res.Add(JsonBuffsUptimeBuilder.BuildJsonBuffsUptime(player, pair.Key, log, settings, data, buffDesc));
            }
            return(res);
        }
Beispiel #5
0
 internal JsonBuffsUptime(AbstractSingleActor actor, long buffID, ParsedEvtcLog log, RawFormatSettings settings, List <JsonBuffsUptimeData> buffData, Dictionary <string, JsonLog.BuffDesc> buffDesc)
 {
     Id       = buffID;
     BuffData = buffData;
     if (!buffDesc.ContainsKey("b" + buffID))
     {
         buffDesc["b" + buffID] = new JsonLog.BuffDesc(log.Buffs.BuffsByIds[buffID], log);
     }
     if (settings.RawFormatTimelineArrays)
     {
         States = GetBuffStates(actor.GetBuffGraphs(log)[buffID]);
     }
 }
        public static JsonLog BuildJsonLog(ParsedEvtcLog log, RawFormatSettings settings, Version parserVersion, string[] uploadLinks)
        {
            var jsonLog = new JsonLog();

            //
            log.UpdateProgressWithCancellationCheck("Raw Format: Building Meta Data");
            jsonLog.TriggerID            = log.FightData.TriggerID;
            jsonLog.FightName            = log.FightData.FightName;
            jsonLog.FightIcon            = log.FightData.Logic.Icon;
            jsonLog.EliteInsightsVersion = parserVersion.ToString();
            jsonLog.ArcVersion           = log.LogData.ArcVersion;
            jsonLog.RecordedBy           = log.LogData.PoVName;
            jsonLog.TimeStart            = log.LogData.LogStart;
            jsonLog.TimeEnd      = log.LogData.LogEnd;
            jsonLog.TimeStartStd = log.LogData.LogStartStd;
            jsonLog.TimeEndStd   = log.LogData.LogEndStd;
            jsonLog.Duration     = log.FightData.DurationString;
            jsonLog.Success      = log.FightData.Success;
            jsonLog.GW2Build     = log.LogData.GW2Build;
            jsonLog.UploadLinks  = uploadLinks;
            jsonLog.Language     = log.LogData.Language;
            jsonLog.LanguageID   = (byte)log.LogData.LanguageID;
            jsonLog.IsCM         = log.FightData.IsCM;
            var personalBuffs = new Dictionary <string, HashSet <long> >();
            var skillMap      = new Dictionary <string, SkillDesc>();
            var buffMap       = new Dictionary <string, BuffDesc>();
            var damageModMap  = new Dictionary <string, DamageModDesc>();

            if (log.StatisticsHelper.PresentFractalInstabilities.Any())
            {
                var presentFractalInstabilities = new List <long>();
                foreach (Buff fractalInstab in log.StatisticsHelper.PresentFractalInstabilities)
                {
                    presentFractalInstabilities.Add(fractalInstab.ID);
                    if (!buffMap.ContainsKey("b" + fractalInstab.ID))
                    {
                        buffMap["b" + fractalInstab.ID] = BuildBuffDesc(fractalInstab, log);
                    }
                }
                jsonLog.PresentFractalInstabilities = presentFractalInstabilities;
            }
            //
            log.UpdateProgressWithCancellationCheck("Raw Format: Building Mechanics");
            MechanicData mechanicData = log.MechanicData;
            var          mechanicLogs = new List <MechanicEvent>();

            foreach (List <MechanicEvent> mLog in mechanicData.GetAllMechanics(log))
            {
                mechanicLogs.AddRange(mLog);
            }
            if (mechanicLogs.Any())
            {
                jsonLog.Mechanics = JsonMechanicsBuilder.GetJsonMechanicsList(mechanicLogs);
            }
            //
            log.UpdateProgressWithCancellationCheck("Raw Format: Building Phases");
            jsonLog.Phases = log.FightData.GetNonDummyPhases(log).Select(x => JsonPhaseBuilder.BuildJsonPhase(x, log)).ToList();
            //
            log.UpdateProgressWithCancellationCheck("Raw Format: Building Targets");
            jsonLog.Targets = log.FightData.Logic.Targets.Select(x => JsonNPCBuilder.BuildJsonNPC(x, log, settings, skillMap, buffMap)).ToList();
            //
            log.UpdateProgressWithCancellationCheck("Raw Format: Building Players");
            jsonLog.Players = log.Friendlies.Select(x => JsonPlayerBuilder.BuildJsonPlayer(x, log, settings, skillMap, buffMap, damageModMap, personalBuffs)).ToList();
            //
            if (log.LogData.LogErrors.Any())
            {
                jsonLog.LogErrors = new List <string>(log.LogData.LogErrors);
            }
            if (log.LogData.UsedExtensions.Any())
            {
                var usedExtensions = new List <ExtensionDesc>();
                foreach (AbstractExtensionHandler extension in log.LogData.UsedExtensions)
                {
                    var set = new HashSet <string>();
                    if (log.LogData.PoV != null)
                    {
                        set.Add(log.FindActor(log.LogData.PoV).Character);
                        foreach (AgentItem agent in extension.RunningExtension)
                        {
                            set.Add(log.FindActor(agent).Character);
                        }
                    }
                    usedExtensions.Add(new ExtensionDesc()
                    {
                        Name             = extension.Name,
                        Version          = extension.Version,
                        Signature        = extension.Signature,
                        Revision         = extension.Revision,
                        RunningExtension = set.ToList()
                    });
                }
                jsonLog.UsedExtensions = usedExtensions;
            }
            //
            jsonLog.PersonalBuffs = personalBuffs.ToDictionary(x => x.Key, x => (IReadOnlyCollection <long>)x.Value);
            jsonLog.SkillMap      = skillMap;
            jsonLog.BuffMap       = buffMap;
            jsonLog.DamageModMap  = damageModMap;
            //
            if (log.CanCombatReplay)
            {
                jsonLog.CombatReplayMetaData = JsonCombatReplayMetaDataBuilder.BuildJsonCombatReplayMetaData(log, settings);
            }
            return(jsonLog);
        }
        public static JsonCombatReplayMetaData BuildJsonCombatReplayMetaData(ParsedEvtcLog log, RawFormatSettings settings)
        {
            CombatReplayMap map = log.FightData.Logic.GetCombatReplayMap(log);

            (int width, int height) = map.GetPixelMapSize();
            var maps   = new List <JsonCombatReplayMetaData.CombatReplayMap>();
            var jsonCR = new JsonCombatReplayMetaData()
            {
                InchToPixel = map.GetInchToPixel(),
                Sizes       = new int[2] {
                    width, height
                },
                PollingRate = ParserHelper.CombatReplayPollingRate,
                Maps        = maps
            };

            //
            foreach (CombatReplayMap.MapItem mapItem in map.Maps)
            {
                maps.Add(new JsonCombatReplayMetaData.CombatReplayMap()
                {
                    Url      = mapItem.Link,
                    Interval = new long[2] {
                        mapItem.Start, mapItem.End
                    }
                });
            }
            //
            return(jsonCR);
        }
Beispiel #8
0
        internal JsonPlayer(Player player, ParsedEvtcLog log, RawFormatSettings settings, Dictionary <string, JsonLog.SkillDesc> skillDesc, Dictionary <string, JsonLog.BuffDesc> buffDesc, Dictionary <string, JsonLog.DamageModDesc> damageModDesc, Dictionary <string, HashSet <long> > personalBuffs) : base(player, log, settings, skillDesc, buffDesc)
        {
            IReadOnlyList <PhaseData> phases = log.FightData.GetPhases(log);

            //
            Account         = player.Account;
            Weapons         = player.GetWeaponsArray(log).Select(w => w ?? "Unknown").ToArray();
            Group           = player.Group;
            Profession      = player.Prof;
            ActiveTimes     = phases.Select(x => player.GetActiveDuration(log, x.Start, x.End)).ToList();
            HasCommanderTag = player.HasCommanderTag;
            //
            Support = phases.Select(phase => new JsonStatistics.JsonPlayerSupport(player.GetPlayerSupportStats(log, phase.Start, phase.End))).ToArray();
            var targetDamage1S          = new IReadOnlyList <int> [log.FightData.Logic.Targets.Count][];
            var targetPowerDamage1S     = new IReadOnlyList <int> [log.FightData.Logic.Targets.Count][];
            var targetConditionDamage1S = new IReadOnlyList <int> [log.FightData.Logic.Targets.Count][];
            var targetBreakbarDamage1S  = new IReadOnlyList <double> [log.FightData.Logic.Targets.Count][];
            var dpsTargets       = new JsonStatistics.JsonDPS[log.FightData.Logic.Targets.Count][];
            var statsTargets     = new JsonStatistics.JsonGameplayStats[log.FightData.Logic.Targets.Count][];
            var targetDamageDist = new IReadOnlyList <JsonDamageDist> [log.FightData.Logic.Targets.Count][];

            for (int j = 0; j < log.FightData.Logic.Targets.Count; j++)
            {
                NPC target                     = log.FightData.Logic.Targets[j];
                var graph1SDamageList          = new IReadOnlyList <int> [phases.Count];
                var graph1SPowerDamageList     = new IReadOnlyList <int> [phases.Count];
                var graph1SConditionDamageList = new IReadOnlyList <int> [phases.Count];
                var graph1SBreakbarDamageList  = new IReadOnlyList <double> [phases.Count];
                var targetDamageDistList       = new IReadOnlyList <JsonDamageDist> [phases.Count];
                for (int i = 0; i < phases.Count; i++)
                {
                    PhaseData phase = phases[i];
                    if (settings.RawFormatTimelineArrays)
                    {
                        graph1SDamageList[i]          = player.Get1SDamageList(log, phase.Start, phase.End, target, DamageType.All);
                        graph1SPowerDamageList[i]     = player.Get1SDamageList(log, phase.Start, phase.End, target, DamageType.Power);
                        graph1SConditionDamageList[i] = player.Get1SDamageList(log, phase.Start, phase.End, target, DamageType.Condition);
                        graph1SBreakbarDamageList[i]  = player.Get1SBreakbarDamageList(log, phase.Start, phase.End, target);
                    }
                    targetDamageDistList[i] = JsonDamageDist.BuildJsonDamageDistList(player.GetDamageEvents(target, log, phase.Start, phase.End).GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList()), log, skillDesc, buffDesc);
                }
                if (settings.RawFormatTimelineArrays)
                {
                    targetDamage1S[j]          = graph1SDamageList;
                    targetPowerDamage1S[j]     = graph1SPowerDamageList;
                    targetConditionDamage1S[j] = graph1SConditionDamageList;
                    targetBreakbarDamage1S[j]  = graph1SBreakbarDamageList;
                }
                targetDamageDist[j] = targetDamageDistList;
                dpsTargets[j]       = phases.Select(phase => new JsonStatistics.JsonDPS(player.GetDPSStats(target, log, phase.Start, phase.End))).ToArray();
                statsTargets[j]     = phases.Select(phase => new JsonStatistics.JsonGameplayStats(player.GetGameplayStats(target, log, phase.Start, phase.End))).ToArray();
            }
            if (settings.RawFormatTimelineArrays)
            {
                TargetDamage1S          = targetDamage1S;
                TargetPowerDamage1S     = targetPowerDamage1S;
                TargetConditionDamage1S = targetConditionDamage1S;
                TargetBreakbarDamage1S  = targetBreakbarDamage1S;
            }
            TargetDamageDist = targetDamageDist;
            DpsTargets       = dpsTargets;
            StatsTargets     = statsTargets;
            if (!log.CombatData.HasBreakbarDamageData)
            {
                TargetBreakbarDamage1S = null;
            }
            //
            BuffUptimes   = GetPlayerJsonBuffsUptime(player, phases.Select(phase => player.GetBuffs(BuffEnum.Self, log, phase.Start, phase.End)).ToList(), log, settings, buffDesc, personalBuffs);
            SelfBuffs     = GetPlayerBuffGenerations(phases.Select(phase => player.GetBuffs(BuffEnum.Self, log, phase.Start, phase.End)).ToList(), log, buffDesc);
            GroupBuffs    = GetPlayerBuffGenerations(phases.Select(phase => player.GetBuffs(BuffEnum.Group, log, phase.Start, phase.End)).ToList(), log, buffDesc);
            OffGroupBuffs = GetPlayerBuffGenerations(phases.Select(phase => player.GetBuffs(BuffEnum.OffGroup, log, phase.Start, phase.End)).ToList(), log, buffDesc);
            SquadBuffs    = GetPlayerBuffGenerations(phases.Select(phase => player.GetBuffs(BuffEnum.Squad, log, phase.Start, phase.End)).ToList(), log, buffDesc);
            //
            BuffUptimesActive   = GetPlayerJsonBuffsUptime(player, phases.Select(phase => player.GetActiveBuffs(BuffEnum.Self, log, phase.Start, phase.End)).ToList(), log, settings, buffDesc, personalBuffs);
            SelfBuffsActive     = GetPlayerBuffGenerations(phases.Select(phase => player.GetActiveBuffs(BuffEnum.Self, log, phase.Start, phase.End)).ToList(), log, buffDesc);
            GroupBuffsActive    = GetPlayerBuffGenerations(phases.Select(phase => player.GetActiveBuffs(BuffEnum.Group, log, phase.Start, phase.End)).ToList(), log, buffDesc);
            OffGroupBuffsActive = GetPlayerBuffGenerations(phases.Select(phase => player.GetActiveBuffs(BuffEnum.OffGroup, log, phase.Start, phase.End)).ToList(), log, buffDesc);
            SquadBuffsActive    = GetPlayerBuffGenerations(phases.Select(phase => player.GetActiveBuffs(BuffEnum.Squad, log, phase.Start, phase.End)).ToList(), log, buffDesc);
            //
            IReadOnlyList <Consumable> consumables = player.GetConsumablesList(log, 0, log.FightData.FightEnd);

            if (consumables.Any())
            {
                var consumablesJSON = new List <JsonConsumable>();
                foreach (Consumable food in consumables)
                {
                    if (!buffDesc.ContainsKey("b" + food.Buff.ID))
                    {
                        buffDesc["b" + food.Buff.ID] = new JsonLog.BuffDesc(food.Buff, log);
                    }
                    consumablesJSON.Add(new JsonConsumable(food));
                }
                Consumables = consumablesJSON;
            }
            //
            IReadOnlyList <DeathRecap> deathRecaps = player.GetDeathRecaps(log);

            if (deathRecaps.Any())
            {
                DeathRecap = deathRecaps.Select(x => new JsonDeathRecap(x)).ToList();
            }
            //
            DamageModifiers       = JsonDamageModifierData.GetDamageModifiers(player.GetDamageModifierStats(log, null), log, damageModDesc);
            DamageModifiersTarget = JsonDamageModifierData.GetDamageModifiersTarget(player, log, damageModDesc);
        }
Beispiel #9
0
        internal JsonLog(ParsedEvtcLog log, RawFormatSettings settings, string[] uploadLinks)
        {
            //
            log.UpdateProgressWithCancellationCheck("Raw Format: Building Meta Data");
            TriggerID            = log.FightData.TriggerID;
            FightName            = log.FightData.GetFightName(log);
            FightIcon            = log.FightData.Logic.Icon;
            EliteInsightsVersion = log.ParserVersion.ToString();
            ArcVersion           = log.LogData.ArcVersion;
            RecordedBy           = log.LogData.PoVName;
            TimeStart            = log.LogData.LogStart;
            TimeEnd      = log.LogData.LogEnd;
            TimeStartStd = log.LogData.LogStartStd;
            TimeEndStd   = log.LogData.LogEndStd;
            Duration     = log.FightData.DurationString;
            Success      = log.FightData.Success;
            GW2Build     = log.LogData.GW2Build;
            UploadLinks  = uploadLinks;
            Language     = log.LogData.Language;
            LanguageID   = (byte)log.LogData.LanguageID;
            IsCM         = log.FightData.IsCM;
            if (log.Statistics.PresentFractalInstabilities.Any())
            {
                PresentFractalInstabilities = new List <long>();
                foreach (Buff fractalInstab in log.Statistics.PresentFractalInstabilities)
                {
                    PresentFractalInstabilities.Add(fractalInstab.ID);
                    if (!BuffMap.ContainsKey("b" + fractalInstab.ID))
                    {
                        BuffMap["b" + fractalInstab.ID] = new BuffDesc(fractalInstab, log);
                    }
                }
            }
            //
            log.UpdateProgressWithCancellationCheck("Raw Format: Building Mechanics");
            MechanicData mechanicData = log.MechanicData;
            var          mechanicLogs = new List <MechanicEvent>();

            foreach (List <MechanicEvent> mLog in mechanicData.GetAllMechanics(log))
            {
                mechanicLogs.AddRange(mLog);
            }
            if (mechanicLogs.Any())
            {
                Mechanics = GetJsonMechanicsList(mechanicLogs);
            }
            //
            log.UpdateProgressWithCancellationCheck("Raw Format: Building Phases");
            Phases = log.FightData.GetPhases(log).Select(x => new JsonPhase(x, log)).ToList();
            //
            log.UpdateProgressWithCancellationCheck("Raw Format: Building Targets");
            Targets = log.FightData.Logic.Targets.Select(x => new JsonNPC(x, log, settings, SkillMap, BuffMap)).ToList();
            //
            log.UpdateProgressWithCancellationCheck("Raw Format: Building Players");
            Players = log.PlayerList.Select(x => new JsonPlayer(x, log, settings, SkillMap, BuffMap, DamageModMap, PersonalBuffs)).ToList();
            //
            if (log.LogData.LogErrors.Count > 0)
            {
                LogErrors = new List <string>(log.LogData.LogErrors);
            }
        }
Beispiel #10
0
        private static List <JsonBuffsUptime> GetNPCJsonBuffsUptime(NPC npc, List <Dictionary <long, FinalBuffs> > buffs, List <Dictionary <long, FinalBuffsDictionary> > buffsDictionary, ParsedEvtcLog log, RawFormatSettings settings, Dictionary <string, JsonLog.BuffDesc> buffDesc)
        {
            var res = new List <JsonBuffsUptime>();
            List <PhaseData> phases = log.FightData.GetPhases(log);

            foreach (KeyValuePair <long, FinalBuffs> pair in buffs[0])
            {
                var data = new List <JsonBuffsUptimeData>();
                for (int i = 0; i < phases.Count; i++)
                {
                    if (buffs[i].TryGetValue(pair.Key, out FinalBuffs val))
                    {
                        var value = new JsonBuffsUptimeData(val, buffsDictionary[i][pair.Key]);
                        data.Add(value);
                    }
                    else
                    {
                        var value = new JsonBuffsUptimeData();
                        data.Add(value);
                    }
                }
                res.Add(new JsonBuffsUptime(npc, pair.Key, log, settings, data, buffDesc));
            }
            return(res);
        }
        public static EXTJsonPlayerHealingStats BuildPlayerHealingStats(AbstractSingleActor a, ParsedEvtcLog log, RawFormatSettings settings, Dictionary <string, JsonLog.SkillDesc> skillDesc, Dictionary <string, JsonLog.BuffDesc> buffDesc)
        {
            var outgoingHealingAllies            = new List <List <EXTJsonHealingStatistics.EXTJsonOutgoingHealingStatistics> >();
            var outgoingHealing                  = new List <EXTJsonHealingStatistics.EXTJsonOutgoingHealingStatistics>();
            var incomingHealing                  = new List <EXTJsonHealingStatistics.EXTJsonIncomingHealingStatistics>();
            var alliedHealing1S                  = new List <List <IReadOnlyList <int> > >();
            var alliedHealingPowerHealing1S      = new List <List <IReadOnlyList <int> > >();
            var alliedConversionHealingHealing1S = new List <List <IReadOnlyList <int> > >();
            var alliedHybridHealing1S            = new List <List <IReadOnlyList <int> > >();
            var healing1S                  = new List <IReadOnlyList <int> >();
            var healingPowerHealing1S      = new List <IReadOnlyList <int> >();
            var conversionHealingHealing1S = new List <IReadOnlyList <int> >();
            var hybridHealing1S            = new List <IReadOnlyList <int> >();
            var alliedHealingDist          = new List <List <List <EXTJsonHealingDist> > >();
            var totalHealingDist           = new List <List <EXTJsonHealingDist> >();
            var totalIncomingHealingDist   = new List <List <EXTJsonHealingDist> >();
            var res = new EXTJsonPlayerHealingStats()
            {
                OutgoingHealing                  = outgoingHealing,
                OutgoingHealingAllies            = outgoingHealingAllies,
                IncomingHealing                  = incomingHealing,
                AlliedHealing1S                  = alliedHealing1S,
                AlliedConversionHealingHealing1S = alliedConversionHealingHealing1S,
                AlliedHealingPowerHealing1S      = alliedHealingPowerHealing1S,
                AlliedHybridHealing1S            = alliedHybridHealing1S,
                Healing1S                  = healing1S,
                HealingPowerHealing1S      = healingPowerHealing1S,
                ConversionHealingHealing1S = conversionHealingHealing1S,
                HybridHealing1S            = hybridHealing1S,
                AlliedHealingDist          = alliedHealingDist,
                TotalHealingDist           = totalHealingDist,
                TotalIncomingHealingDist   = totalIncomingHealingDist
            };
            IReadOnlyList <PhaseData> phases = log.FightData.GetPhases(log);

            foreach (AbstractSingleActor friendly in log.Friendlies)
            {
                //
                var outgoingHealingAlly = new List <EXTJsonHealingStatistics.EXTJsonOutgoingHealingStatistics>();
                outgoingHealingAllies.Add(outgoingHealingAlly);
                //
                var allyHealing1S = new List <IReadOnlyList <int> >();
                alliedHealing1S.Add(allyHealing1S);
                var allyHealingPowerHealing1S = new List <IReadOnlyList <int> >();
                alliedHealingPowerHealing1S.Add(allyHealingPowerHealing1S);
                var allyConversionHealingHealing1S = new List <IReadOnlyList <int> >();
                alliedConversionHealingHealing1S.Add(allyConversionHealingHealing1S);
                var allyHybridHealing1S = new List <IReadOnlyList <int> >();
                alliedHybridHealing1S.Add(allyConversionHealingHealing1S);
                //
                var allyHealingDist = new List <List <EXTJsonHealingDist> >();
                alliedHealingDist.Add(allyHealingDist);
                foreach (PhaseData phase in phases)
                {
                    outgoingHealingAlly.Add(EXTJsonStatsBuilderCommons.BuildOutgoingHealingStatistics(a.EXTHealing.GetOutgoingHealStats(friendly, log, phase.Start, phase.End)));
                    if (settings.RawFormatTimelineArrays)
                    {
                        allyHealing1S.Add(a.EXTHealing.Get1SHealingList(log, phase.Start, phase.End, friendly, HealingStatsExtensionHandler.EXTHealingType.All));
                        allyHealingPowerHealing1S.Add(a.EXTHealing.Get1SHealingList(log, phase.Start, phase.End, friendly, HealingStatsExtensionHandler.EXTHealingType.HealingPower));
                        allyConversionHealingHealing1S.Add(a.EXTHealing.Get1SHealingList(log, phase.Start, phase.End, friendly, HealingStatsExtensionHandler.EXTHealingType.ConversionBased));
                        allyHybridHealing1S.Add(a.EXTHealing.Get1SHealingList(log, phase.Start, phase.End, friendly, HealingStatsExtensionHandler.EXTHealingType.Hybrid));
                    }
                    allyHealingDist.Add(EXTJsonStatsBuilderCommons.BuildHealingDistList(a.EXTHealing.GetOutgoingHealEvents(friendly, log, phase.Start, phase.End).GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList()), log, skillDesc, buffDesc));
                }
            }
            foreach (PhaseData phase in phases)
            {
                outgoingHealing.Add(EXTJsonStatsBuilderCommons.BuildOutgoingHealingStatistics(a.EXTHealing.GetOutgoingHealStats(null, log, phase.Start, phase.End)));
                incomingHealing.Add(EXTJsonStatsBuilderCommons.BuildIncomingHealingStatistics(a.EXTHealing.GetIncomingHealStats(null, log, phase.Start, phase.End)));
                if (settings.RawFormatTimelineArrays)
                {
                    healing1S.Add(a.EXTHealing.Get1SHealingList(log, phase.Start, phase.End, null, HealingStatsExtensionHandler.EXTHealingType.All));
                    healingPowerHealing1S.Add(a.EXTHealing.Get1SHealingList(log, phase.Start, phase.End, null, HealingStatsExtensionHandler.EXTHealingType.HealingPower));
                    conversionHealingHealing1S.Add(a.EXTHealing.Get1SHealingList(log, phase.Start, phase.End, null, HealingStatsExtensionHandler.EXTHealingType.ConversionBased));
                    hybridHealing1S.Add(a.EXTHealing.Get1SHealingList(log, phase.Start, phase.End, null, HealingStatsExtensionHandler.EXTHealingType.Hybrid));
                }
                totalHealingDist.Add(EXTJsonStatsBuilderCommons.BuildHealingDistList(a.EXTHealing.GetOutgoingHealEvents(null, log, phase.Start, phase.End).GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList()), log, skillDesc, buffDesc));
                totalIncomingHealingDist.Add(EXTJsonStatsBuilderCommons.BuildHealingDistList(a.EXTHealing.GetIncomingHealEvents(null, log, phase.Start, phase.End).GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList()), log, skillDesc, buffDesc));
            }
            if (!settings.RawFormatTimelineArrays)
            {
                res.AlliedHealing1S                  = null;
                res.AlliedHealingPowerHealing1S      = null;
                res.AlliedConversionHealingHealing1S = null;
                res.Healing1S                  = null;
                res.HealingPowerHealing1S      = null;
                res.ConversionHealingHealing1S = null;
            }
            return(res);
        }
Beispiel #12
0
        public static JsonActorCombatReplayData BuildJsonActorCombatReplayDataBuilder(AbstractSingleActor actor, ParsedEvtcLog log, RawFormatSettings settings)
        {
            CombatReplayMap map = log.FightData.Logic.GetCombatReplayMap(log);
            AbstractSingleActorCombatReplayDescription description = actor.GetCombatReplayDescription(map, log);
            var actorCombatReplayData = new JsonActorCombatReplayData()
            {
                IconURL = description.Img,
                Start   = description.Start,
                End     = description.End
            };

            if (settings.RawFormatTimelineArrays)
            {
                //
                var jsonPositions = new List <float[]>();
                for (int i = 0; i < description.Positions.Count; i += 2)
                {
                    jsonPositions.Add(new float[2] {
                        description.Positions[i], description.Positions[i + 1]
                    });
                }
                actorCombatReplayData.Positions = jsonPositions;
                //
                if (description.Dead != null)
                {
                    var jsonDeads = new List <long[]>();
                    for (int i = 0; i < description.Dead.Count; i += 2)
                    {
                        jsonDeads.Add(new long[2] {
                            description.Dead[i], description.Dead[i + 1]
                        });
                    }
                    actorCombatReplayData.Dead = jsonDeads;
                }
                if (description.Dc != null)
                {
                    var jsonDcs = new List <long[]>();
                    for (int i = 0; i < description.Dc.Count; i += 2)
                    {
                        jsonDcs.Add(new long[2] {
                            description.Dc[i], description.Dc[i + 1]
                        });
                    }
                    actorCombatReplayData.Dc = jsonDcs;
                }
                if (description.Down != null)
                {
                    var jsonDowns = new List <long[]>();
                    for (int i = 0; i < description.Down.Count; i += 2)
                    {
                        jsonDowns.Add(new long[2] {
                            description.Down[i], description.Down[i + 1]
                        });
                    }
                    actorCombatReplayData.Down = jsonDowns;
                }
                //
                IReadOnlyList <GenericDecoration> decorations = actor.GetCombatReplayDecorations(log);
                foreach (GenericDecoration decoration in decorations)
                {
                    GenericDecorationCombatReplayDescription decDescription = decoration.GetCombatReplayDescription(map, log);
                    if (decDescription is FacingDecorationCombatReplayDescription facingDescription)
                    {
                        actorCombatReplayData.Orientations = facingDescription.FacingData;
                    }
                }
            }

            //
            return(actorCombatReplayData);
        }
Beispiel #13
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();
            }
        }
        private static List <JsonBuffsUptime> GetNPCJsonBuffsUptime(NPC npc, ParsedEvtcLog log, RawFormatSettings settings, Dictionary <string, JsonLog.BuffDesc> buffDesc)
        {
            var res = new List <JsonBuffsUptime>();
            IReadOnlyList <PhaseData> phases = log.FightData.GetNonDummyPhases(log);
            var buffs = phases.Select(x => npc.GetBuffs(log, x.Start, x.End)).ToList();

            foreach (KeyValuePair <long, FinalBuffs> pair in buffs[0])
            {
                var data = new List <JsonBuffsUptimeData>();
                for (int i = 0; i < phases.Count; i++)
                {
                    PhaseData phase = phases[i];
                    Dictionary <long, FinalBuffsDictionary> buffsDictionary = npc.GetBuffsDictionary(log, phase.Start, phase.End);
                    if (buffs[i].TryGetValue(pair.Key, out FinalBuffs val))
                    {
                        JsonBuffsUptimeData value = JsonBuffsUptimeBuilder.BuildJsonBuffsUptimeData(val, buffsDictionary[pair.Key]);
                        data.Add(value);
                    }
                    else
                    {
                        var value = new JsonBuffsUptimeData();
                        data.Add(value);
                    }
                }
                res.Add(JsonBuffsUptimeBuilder.BuildJsonBuffsUptime(npc, pair.Key, log, settings, data, buffDesc));
            }
            return(res);
        }
        internal JsonPlayer(Player player, ParsedEvtcLog log, RawFormatSettings settings, Dictionary <string, JsonLog.SkillDesc> skillDesc, Dictionary <string, JsonLog.BuffDesc> buffDesc, Dictionary <string, JsonLog.DamageModDesc> damageModDesc, Dictionary <string, HashSet <long> > personalBuffs) : base(player, log, settings, skillDesc, buffDesc)
        {
            List <PhaseData> phases = log.FightData.GetPhases(log);

            //
            Account         = player.Account;
            Weapons         = player.GetWeaponsArray(log).Select(w => w ?? "Unknown").ToArray();
            Group           = player.Group;
            Profession      = player.Prof;
            ActiveTimes     = phases.Select(x => x.GetActorActiveDuration(player, log)).ToList();
            HasCommanderTag = player.HasCommanderTag;
            //
            Support          = player.GetPlayerSupport(log).Select(x => new JsonStatistics.JsonPlayerSupport(x)).ToArray();
            TargetDamage1S   = new List <int> [log.FightData.Logic.Targets.Count][];
            DpsTargets       = new JsonStatistics.JsonDPS[log.FightData.Logic.Targets.Count][];
            StatsTargets     = new JsonStatistics.JsonGameplayStats[log.FightData.Logic.Targets.Count][];
            TargetDamageDist = new List <JsonDamageDist> [log.FightData.Logic.Targets.Count][];
            for (int j = 0; j < log.FightData.Logic.Targets.Count; j++)
            {
                NPC target               = log.FightData.Logic.Targets[j];
                var dpsGraphList         = new List <int> [phases.Count];
                var targetDamageDistList = new List <JsonDamageDist> [phases.Count];
                for (int i = 0; i < phases.Count; i++)
                {
                    PhaseData phase = phases[i];
                    if (settings.RawFormatTimelineArrays)
                    {
                        dpsGraphList[i] = player.Get1SDamageList(log, i, phase, target);
                    }
                    targetDamageDistList[i] = JsonDamageDist.BuildJsonDamageDistList(player.GetDamageLogs(target, log, phase.Start, phase.End).GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList()), log, skillDesc, buffDesc);
                }
                if (settings.RawFormatTimelineArrays)
                {
                    TargetDamage1S[j] = dpsGraphList;
                }
                TargetDamageDist[j] = targetDamageDistList;
                DpsTargets[j]       = player.GetDPSTarget(log, target).Select(x => new JsonStatistics.JsonDPS(x)).ToArray();
                StatsTargets[j]     = player.GetGameplayStats(log, target).Select(x => new JsonStatistics.JsonGameplayStats(x)).ToArray();
            }
            //
            BuffUptimes   = GetPlayerJsonBuffsUptime(player, player.GetBuffs(log, BuffEnum.Self), player.GetBuffsDictionary(log), log, settings, buffDesc, personalBuffs);
            SelfBuffs     = GetPlayerBuffGenerations(player.GetBuffs(log, BuffEnum.Self), log, buffDesc);
            GroupBuffs    = GetPlayerBuffGenerations(player.GetBuffs(log, BuffEnum.Group), log, buffDesc);
            OffGroupBuffs = GetPlayerBuffGenerations(player.GetBuffs(log, BuffEnum.OffGroup), log, buffDesc);
            SquadBuffs    = GetPlayerBuffGenerations(player.GetBuffs(log, BuffEnum.Squad), log, buffDesc);
            //
            BuffUptimesActive   = GetPlayerJsonBuffsUptime(player, player.GetActiveBuffs(log, BuffEnum.Self), player.GetBuffsDictionary(log), log, settings, buffDesc, personalBuffs);
            SelfBuffsActive     = GetPlayerBuffGenerations(player.GetActiveBuffs(log, BuffEnum.Self), log, buffDesc);
            GroupBuffsActive    = GetPlayerBuffGenerations(player.GetActiveBuffs(log, BuffEnum.Group), log, buffDesc);
            OffGroupBuffsActive = GetPlayerBuffGenerations(player.GetActiveBuffs(log, BuffEnum.OffGroup), log, buffDesc);
            SquadBuffsActive    = GetPlayerBuffGenerations(player.GetActiveBuffs(log, BuffEnum.Squad), log, buffDesc);
            //
            List <Consumable> consumables = player.GetConsumablesList(log, 0, log.FightData.FightEnd);

            if (consumables.Any())
            {
                Consumables = new List <JsonConsumable>();
                foreach (Consumable food in consumables)
                {
                    if (!buffDesc.ContainsKey("b" + food.Buff.ID))
                    {
                        buffDesc["b" + food.Buff.ID] = new JsonLog.BuffDesc(food.Buff, log);
                    }
                    Consumables.Add(new JsonConsumable(food));
                }
            }
            //
            List <DeathRecap> deathRecaps = player.GetDeathRecaps(log);

            if (deathRecaps.Any())
            {
                DeathRecap = deathRecaps.Select(x => new JsonDeathRecap(x)).ToList();
            }
            //
            DamageModifiers       = JsonDamageModifierData.GetDamageModifiers(player.GetDamageModifierStats(log, null), log, damageModDesc);
            DamageModifiersTarget = JsonDamageModifierData.GetDamageModifiersTarget(player, log, damageModDesc);
        }
Beispiel #16
0
        public static void FillJsonActor(JsonActor jsonActor, AbstractSingleActor actor, ParsedEvtcLog log, RawFormatSettings settings, Dictionary <string, JsonLog.SkillDesc> skillDesc, Dictionary <string, JsonLog.BuffDesc> buffDesc)
        {
            IReadOnlyList <PhaseData> phases = log.FightData.GetNonDummyPhases(log);

            //
            jsonActor.Name          = actor.Character;
            jsonActor.TotalHealth   = actor.GetHealth(log.CombatData);
            jsonActor.Toughness     = actor.Toughness;
            jsonActor.Healing       = actor.Healing;
            jsonActor.Concentration = actor.Concentration;
            jsonActor.Condition     = actor.Condition;
            jsonActor.HitboxHeight  = actor.HitboxHeight;
            jsonActor.HitboxWidth   = actor.HitboxWidth;
            jsonActor.InstanceID    = actor.AgentItem.InstID;
            jsonActor.IsFake        = actor.IsFakeActor;
            //
            jsonActor.DpsAll   = phases.Select(phase => JsonStatisticsBuilder.BuildJsonDPS(actor.GetDPSStats(log, phase.Start, phase.End))).ToArray();
            jsonActor.StatsAll = phases.Select(phase => JsonStatisticsBuilder.BuildJsonGameplayStatsAll(actor.GetGameplayStats(log, phase.Start, phase.End))).ToArray();
            jsonActor.Defenses = phases.Select(phase => JsonStatisticsBuilder.BuildJsonDefensesAll(actor.GetDefenseStats(log, phase.Start, phase.End))).ToArray();
            //
            IReadOnlyDictionary <long, Minions> minionsList = actor.GetMinions(log);

            if (minionsList.Values.Any())
            {
                jsonActor.Minions = minionsList.Values.Select(x => JsonMinionsBuilder.BuildJsonMinions(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())
            {
                jsonActor.Rotation = JsonRotationBuilder.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);
                }
                jsonActor.Damage1S          = damage1S;
                jsonActor.PowerDamage1S     = powerDamage1S;
                jsonActor.ConditionDamage1S = conditionDamage1S;
                jsonActor.BreakbarDamage1S  = breakbarDamage1S;
            }
            if (!log.CombatData.HasBreakbarDamageData)
            {
                jsonActor.BreakbarDamage1S = null;
            }
            //
            jsonActor.TotalDamageDist  = BuildDamageDistData(actor, phases, log, skillDesc, buffDesc);
            jsonActor.TotalDamageTaken = BuildDamageTakenDistData(actor, phases, log, skillDesc, buffDesc);
            //
            if (settings.RawFormatTimelineArrays)
            {
                Dictionary <long, BuffsGraphModel> buffGraphs = actor.GetBuffGraphs(log);
                jsonActor.BoonsStates      = JsonBuffsUptimeBuilder.GetBuffStates(buffGraphs[Buff.NumberOfBoonsID]);
                jsonActor.ConditionsStates = JsonBuffsUptimeBuilder.GetBuffStates(buffGraphs[Buff.NumberOfConditionsID]);
                if (buffGraphs.TryGetValue(Buff.NumberOfActiveCombatMinionsID, out BuffsGraphModel states))
                {
                    jsonActor.ActiveCombatMinions = JsonBuffsUptimeBuilder.GetBuffStates(states);
                }
                // Health
                jsonActor.HealthPercents = actor.GetHealthUpdates(log).Select(x => new double[2] {
                    x.Start, x.Value
                }).ToList();
                jsonActor.BarrierPercents = actor.GetBarrierUpdates(log).Select(x => new double[2] {
                    x.Start, x.Value
                }).ToList();
            }
            if (log.CanCombatReplay)
            {
                jsonActor.CombatReplayData = JsonActorCombatReplayDataBuilder.BuildJsonActorCombatReplayDataBuilder(actor, log, settings);
            }
        }
Beispiel #17
0
        public static JsonBuffsUptime BuildJsonBuffsUptime(AbstractSingleActor actor, long buffID, ParsedEvtcLog log, RawFormatSettings settings, List <JsonBuffsUptimeData> buffData, Dictionary <string, JsonLog.BuffDesc> buffDesc)
        {
            var jsonBuffsUptime = new JsonBuffsUptime();

            jsonBuffsUptime.Id       = buffID;
            jsonBuffsUptime.BuffData = buffData;
            if (!buffDesc.ContainsKey("b" + buffID))
            {
                buffDesc["b" + buffID] = JsonLogBuilder.BuildBuffDesc(log.Buffs.BuffsByIds[buffID], log);
            }
            if (settings.RawFormatTimelineArrays)
            {
                jsonBuffsUptime.States = GetBuffStates(actor.GetBuffGraphs(log)[buffID]);
            }
            return(jsonBuffsUptime);
        }
Beispiel #18
0
        private static List <JsonBuffsUptime> GetPlayerJsonBuffsUptime(Player player, List <IReadOnlyDictionary <long, FinalPlayerBuffs> > buffs, ParsedEvtcLog log, RawFormatSettings settings, Dictionary <string, JsonLog.BuffDesc> buffDesc, Dictionary <string, HashSet <long> > personalBuffs)
        {
            var res       = new List <JsonBuffsUptime>();
            var profEnums = new HashSet <ParserHelper.Source>(ParserHelper.ProfToEnum(player.Prof));
            IReadOnlyList <PhaseData> phases = log.FightData.GetPhases(log);

            foreach (KeyValuePair <long, FinalPlayerBuffs> pair in buffs[0])
            {
                Buff buff = log.Buffs.BuffsByIds[pair.Key];
                var  data = new List <JsonBuffsUptimeData>();
                for (int i = 0; i < phases.Count; i++)
                {
                    PhaseData phase = phases[i];
                    Dictionary <long, FinalBuffsDictionary> buffsDictionary = player.GetBuffsDictionary(log, phase.Start, phase.End);
                    if (buffs[i].TryGetValue(pair.Key, out FinalPlayerBuffs val))
                    {
                        var value = new JsonBuffsUptimeData(val, buffsDictionary[pair.Key]);
                        data.Add(value);
                    }
                    else
                    {
                        var value = new JsonBuffsUptimeData();
                        data.Add(value);
                    }
                }
                if (buff.Nature == Buff.BuffNature.GraphOnlyBuff && profEnums.Contains(buff.Source))
                {
                    if (player.GetBuffDistribution(log, phases[0].Start, phases[0].End).GetUptime(pair.Key) > 0)
                    {
                        if (personalBuffs.TryGetValue(player.Prof, out HashSet <long> list) && !list.Contains(pair.Key))
                        {
                            list.Add(pair.Key);
                        }
                        else
                        {
                            personalBuffs[player.Prof] = new HashSet <long>()
                            {
                                pair.Key
                            };
                        }
                    }
                }
                res.Add(new JsonBuffsUptime(player, pair.Key, log, settings, data, buffDesc));
            }
            return(res);
        }
Beispiel #19
0
        public static EXTJsonPlayerBarrierStats BuildPlayerBarrierStats(AbstractSingleActor a, ParsedEvtcLog log, RawFormatSettings settings, Dictionary <string, JsonLog.SkillDesc> skillDesc, Dictionary <string, JsonLog.BuffDesc> buffDesc)
        {
            var outgoingBarrierAllies    = new List <List <EXTJsonBarrierStatistics.EXTJsonOutgoingBarrierStatistics> >();
            var outgoingBarrier          = new List <EXTJsonBarrierStatistics.EXTJsonOutgoingBarrierStatistics>();
            var incomingBarrier          = new List <EXTJsonBarrierStatistics.EXTJsonIncomingBarrierStatistics>();
            var alliedBarrier1S          = new List <List <IReadOnlyList <int> > >();
            var barrier1S                = new List <IReadOnlyList <int> >();
            var alliedBarrierDist        = new List <List <List <EXTJsonBarrierDist> > >();
            var totalBarrierDist         = new List <List <EXTJsonBarrierDist> >();
            var totalIncomingBarrierDist = new List <List <EXTJsonBarrierDist> >();
            var res = new EXTJsonPlayerBarrierStats()
            {
                OutgoingBarrier          = outgoingBarrier,
                OutgoingBarrierAllies    = outgoingBarrierAllies,
                IncomingBarrier          = incomingBarrier,
                AlliedBarrier1S          = alliedBarrier1S,
                Barrier1S                = barrier1S,
                AlliedBarrierDist        = alliedBarrierDist,
                TotalBarrierDist         = totalBarrierDist,
                TotalIncomingBarrierDist = totalIncomingBarrierDist,
            };
            IReadOnlyList <PhaseData> phases = log.FightData.GetPhases(log);

            foreach (AbstractSingleActor friendly in log.Friendlies)
            {
                //
                var outgoingBarrierAlly = new List <EXTJsonBarrierStatistics.EXTJsonOutgoingBarrierStatistics>();
                outgoingBarrierAllies.Add(outgoingBarrierAlly);
                //
                var allyBarrier1S = new List <IReadOnlyList <int> >();
                alliedBarrier1S.Add(allyBarrier1S);
                //
                var allyBarrierDist = new List <List <EXTJsonBarrierDist> >();
                alliedBarrierDist.Add(allyBarrierDist);
                foreach (PhaseData phase in phases)
                {
                    outgoingBarrierAlly.Add(EXTJsonBarrierStatsBuilderCommons.BuildOutgoingBarrierStatistics(a.EXTBarrier.GetOutgoingBarrierStats(friendly, log, phase.Start, phase.End)));
                    if (settings.RawFormatTimelineArrays)
                    {
                        allyBarrier1S.Add(a.EXTBarrier.Get1SBarrierList(log, phase.Start, phase.End, friendly));
                    }
                    allyBarrierDist.Add(EXTJsonBarrierStatsBuilderCommons.BuildBarrierDistList(a.EXTBarrier.GetOutgoingBarrierEvents(friendly, log, phase.Start, phase.End).GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList()), log, skillDesc, buffDesc));
                }
            }
            foreach (PhaseData phase in phases)
            {
                outgoingBarrier.Add(EXTJsonBarrierStatsBuilderCommons.BuildOutgoingBarrierStatistics(a.EXTBarrier.GetOutgoingBarrierStats(null, log, phase.Start, phase.End)));
                incomingBarrier.Add(EXTJsonBarrierStatsBuilderCommons.BuildIncomingBarrierStatistics(a.EXTBarrier.GetIncomingBarrierStats(null, log, phase.Start, phase.End)));
                if (settings.RawFormatTimelineArrays)
                {
                    barrier1S.Add(a.EXTBarrier.Get1SBarrierList(log, phase.Start, phase.End, null));
                }
                totalBarrierDist.Add(EXTJsonBarrierStatsBuilderCommons.BuildBarrierDistList(a.EXTBarrier.GetOutgoingBarrierEvents(null, log, phase.Start, phase.End).GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList()), log, skillDesc, buffDesc));
                totalIncomingBarrierDist.Add(EXTJsonBarrierStatsBuilderCommons.BuildBarrierDistList(a.EXTBarrier.GetIncomingBarrierEvents(null, log, phase.Start, phase.End).GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList()), log, skillDesc, buffDesc));
            }
            if (!settings.RawFormatTimelineArrays)
            {
                res.AlliedBarrier1S = null;
                res.Barrier1S       = null;
            }
            return(res);
        }