public static LogDataDto BuildLogData(ParsedEvtcLog log, Dictionary <long, SkillItem> usedSkills, Dictionary <long, Buff> usedBuffs, HashSet <DamageModifier> usedDamageMods, bool cr, bool light, Version parserVersion, string[] uploadLinks) { StatisticsHelper statistics = log.StatisticsHelper; log.UpdateProgressWithCancellationCheck("HTML: building Log Data"); var logData = new LogDataDto { EncounterStart = log.LogData.LogStartStd, EncounterEnd = log.LogData.LogEndStd, ArcVersion = log.LogData.ArcVersion, Gw2Build = log.LogData.GW2Build, FightID = log.FightData.TriggerID, Parser = "Elite Insights " + parserVersion.ToString(), RecordedBy = log.LogData.PoVName, UploadLinks = uploadLinks.ToList() }; if (cr) { logData.CrData = new CombatReplayDto(log); } log.UpdateProgressWithCancellationCheck("HTML: building Players"); foreach (Player player in log.PlayerList) { logData.HasCommander = logData.HasCommander || player.HasCommanderTag; logData.Players.Add(new PlayerDto(player, log, ActorDetailsDto.BuildPlayerData(log, player, usedSkills, usedBuffs))); } log.UpdateProgressWithCancellationCheck("HTML: building Enemies"); foreach (AbstractSingleActor enemy in log.MechanicData.GetEnemyList(log, log.FightData.FightStart, log.FightData.FightEnd)) { logData.Enemies.Add(new EnemyDto() { Name = enemy.Character }); } log.UpdateProgressWithCancellationCheck("HTML: building Targets"); foreach (NPC target in log.FightData.Logic.Targets) { var targetDto = new TargetDto(target, log, ActorDetailsDto.BuildTargetData(log, target, usedSkills, usedBuffs, cr)); logData.Targets.Add(targetDto); } // log.UpdateProgressWithCancellationCheck("HTML: building Skill/Buff dictionaries"); Dictionary <string, List <Buff> > persBuffDict = BuildPersonalBoonData(log, logData.PersBuffs, usedBuffs); Dictionary <string, List <DamageModifier> > persDamageModDict = BuildPersonalDamageModData(log, logData.DmgModifiersPers, usedDamageMods); var allDamageMods = new HashSet <string>(); foreach (Player p in log.PlayerList) { allDamageMods.UnionWith(p.GetPresentDamageModifier(log)); } var commonDamageModifiers = new List <DamageModifier>(); if (log.DamageModifiers.DamageModifiersPerSource.TryGetValue(ParserHelper.Source.Common, out IReadOnlyList <DamageModifier> list)) { foreach (DamageModifier dMod in list) { if (allDamageMods.Contains(dMod.Name)) { commonDamageModifiers.Add(dMod); logData.DmgModifiersCommon.Add(dMod.ID); usedDamageMods.Add(dMod); } } } if (log.DamageModifiers.DamageModifiersPerSource.TryGetValue(ParserHelper.Source.FightSpecific, out list)) { foreach (DamageModifier dMod in list) { if (allDamageMods.Contains(dMod.Name)) { commonDamageModifiers.Add(dMod); logData.DmgModifiersCommon.Add(dMod.ID); usedDamageMods.Add(dMod); } } } var itemDamageModifiers = new List <DamageModifier>(); if (log.DamageModifiers.DamageModifiersPerSource.TryGetValue(ParserHelper.Source.Item, out list)) { foreach (DamageModifier dMod in list) { if (allDamageMods.Contains(dMod.Name)) { itemDamageModifiers.Add(dMod); logData.DmgModifiersItem.Add(dMod.ID); usedDamageMods.Add(dMod); } } } foreach (Buff boon in statistics.PresentBoons) { logData.Boons.Add(boon.ID); usedBuffs[boon.ID] = boon; } foreach (Buff boon in statistics.PresentConditions) { logData.Conditions.Add(boon.ID); usedBuffs[boon.ID] = boon; } foreach (Buff boon in statistics.PresentOffbuffs) { logData.OffBuffs.Add(boon.ID); usedBuffs[boon.ID] = boon; } foreach (Buff boon in statistics.PresentSupbuffs) { logData.SupBuffs.Add(boon.ID); usedBuffs[boon.ID] = boon; } foreach (Buff boon in statistics.PresentDefbuffs) { logData.DefBuffs.Add(boon.ID); usedBuffs[boon.ID] = boon; } foreach (Buff boon in statistics.PresentFractalInstabilities) { logData.FractalInstabilities.Add(boon.ID); usedBuffs[boon.ID] = boon; } // log.UpdateProgressWithCancellationCheck("HTML: building Phases"); IReadOnlyList <PhaseData> phases = log.FightData.GetPhases(log); for (int i = 0; i < phases.Count; i++) { PhaseData phase = phases[i]; var phaseDto = new PhaseDto(phase, phases, log) { DpsStats = PhaseDto.BuildDPSData(log, phase), DpsStatsTargets = PhaseDto.BuildDPSTargetsData(log, phase), DmgStatsTargets = PhaseDto.BuildDMGStatsTargetsData(log, phase), DmgStats = PhaseDto.BuildDMGStatsData(log, phase), DefStats = PhaseDto.BuildDefenseData(log, phase), SupportStats = PhaseDto.BuildSupportData(log, phase), // BoonStats = BuffData.BuildBuffUptimeData(log, statistics.PresentBoons, phase), OffBuffStats = BuffData.BuildBuffUptimeData(log, statistics.PresentOffbuffs, phase), SupBuffStats = BuffData.BuildBuffUptimeData(log, statistics.PresentSupbuffs, phase), DefBuffStats = BuffData.BuildBuffUptimeData(log, statistics.PresentDefbuffs, phase), PersBuffStats = BuffData.BuildPersonalBuffUptimeData(log, persBuffDict, phase), BoonGenSelfStats = BuffData.BuildBuffGenerationData(log, statistics.PresentBoons, phase, BuffEnum.Self), BoonGenGroupStats = BuffData.BuildBuffGenerationData(log, statistics.PresentBoons, phase, BuffEnum.Group), BoonGenOGroupStats = BuffData.BuildBuffGenerationData(log, statistics.PresentBoons, phase, BuffEnum.OffGroup), BoonGenSquadStats = BuffData.BuildBuffGenerationData(log, statistics.PresentBoons, phase, BuffEnum.Squad), OffBuffGenSelfStats = BuffData.BuildBuffGenerationData(log, statistics.PresentOffbuffs, phase, BuffEnum.Self), OffBuffGenGroupStats = BuffData.BuildBuffGenerationData(log, statistics.PresentOffbuffs, phase, BuffEnum.Group), OffBuffGenOGroupStats = BuffData.BuildBuffGenerationData(log, statistics.PresentOffbuffs, phase, BuffEnum.OffGroup), OffBuffGenSquadStats = BuffData.BuildBuffGenerationData(log, statistics.PresentOffbuffs, phase, BuffEnum.Squad), SupBuffGenSelfStats = BuffData.BuildBuffGenerationData(log, statistics.PresentSupbuffs, phase, BuffEnum.Self), SupBuffGenGroupStats = BuffData.BuildBuffGenerationData(log, statistics.PresentSupbuffs, phase, BuffEnum.Group), SupBuffGenOGroupStats = BuffData.BuildBuffGenerationData(log, statistics.PresentSupbuffs, phase, BuffEnum.OffGroup), SupBuffGenSquadStats = BuffData.BuildBuffGenerationData(log, statistics.PresentSupbuffs, phase, BuffEnum.Squad), DefBuffGenSelfStats = BuffData.BuildBuffGenerationData(log, statistics.PresentDefbuffs, phase, BuffEnum.Self), DefBuffGenGroupStats = BuffData.BuildBuffGenerationData(log, statistics.PresentDefbuffs, phase, BuffEnum.Group), DefBuffGenOGroupStats = BuffData.BuildBuffGenerationData(log, statistics.PresentDefbuffs, phase, BuffEnum.OffGroup), DefBuffGenSquadStats = BuffData.BuildBuffGenerationData(log, statistics.PresentDefbuffs, phase, BuffEnum.Squad), // BoonActiveStats = BuffData.BuildActiveBuffUptimeData(log, statistics.PresentBoons, phase), OffBuffActiveStats = BuffData.BuildActiveBuffUptimeData(log, statistics.PresentOffbuffs, phase), SupBuffActiveStats = BuffData.BuildActiveBuffUptimeData(log, statistics.PresentSupbuffs, phase), DefBuffActiveStats = BuffData.BuildActiveBuffUptimeData(log, statistics.PresentDefbuffs, phase), PersBuffActiveStats = BuffData.BuildActivePersonalBuffUptimeData(log, persBuffDict, phase), BoonGenActiveSelfStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentBoons, phase, BuffEnum.Self), BoonGenActiveGroupStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentBoons, phase, BuffEnum.Group), BoonGenActiveOGroupStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentBoons, phase, BuffEnum.OffGroup), BoonGenActiveSquadStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentBoons, phase, BuffEnum.Squad), OffBuffGenActiveSelfStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentOffbuffs, phase, BuffEnum.Self), OffBuffGenActiveGroupStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentOffbuffs, phase, BuffEnum.Group), OffBuffGenActiveOGroupStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentOffbuffs, phase, BuffEnum.OffGroup), OffBuffGenActiveSquadStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentOffbuffs, phase, BuffEnum.Squad), SupBuffGenActiveSelfStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentSupbuffs, phase, BuffEnum.Self), SupBuffGenActiveGroupStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentSupbuffs, phase, BuffEnum.Group), SupBuffGenActiveOGroupStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentSupbuffs, phase, BuffEnum.OffGroup), SupBuffGenActiveSquadStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentSupbuffs, phase, BuffEnum.Squad), DefBuffGenActiveSelfStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentDefbuffs, phase, BuffEnum.Self), DefBuffGenActiveGroupStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentDefbuffs, phase, BuffEnum.Group), DefBuffGenActiveOGroupStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentDefbuffs, phase, BuffEnum.OffGroup), DefBuffGenActiveSquadStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentDefbuffs, phase, BuffEnum.Squad), // DmgModifiersCommon = DamageModData.BuildDmgModifiersData(log, i, commonDamageModifiers), DmgModifiersItem = DamageModData.BuildDmgModifiersData(log, i, itemDamageModifiers), DmgModifiersPers = DamageModData.BuildPersonalDmgModifiersData(log, i, persDamageModDict), TargetsCondiStats = new List <List <BuffData> >(), TargetsCondiTotals = new List <BuffData>(), TargetsBoonTotals = new List <BuffData>(), MechanicStats = MechanicDto.BuildPlayerMechanicData(log, phase), EnemyMechanicStats = MechanicDto.BuildEnemyMechanicData(log, phase) }; foreach (NPC target in phase.Targets) { phaseDto.TargetsCondiStats.Add(BuffData.BuildTargetCondiData(log, phase.Start, phase.End, target)); phaseDto.TargetsCondiTotals.Add(BuffData.BuildTargetCondiUptimeData(log, phase, target)); phaseDto.TargetsBoonTotals.Add(HasBoons(log, phase, target) ? BuffData.BuildTargetBoonData(log, phase, target) : null); } logData.Phases.Add(phaseDto); } // log.UpdateProgressWithCancellationCheck("HTML: building Meta Data"); logData.EncounterDuration = log.FightData.DurationString; logData.Success = log.FightData.Success; logData.Wvw = log.FightData.Logic.Mode == FightLogic.ParseMode.WvW; logData.Targetless = log.FightData.Logic.Targetless; logData.FightName = log.FightData.GetFightName(log); logData.FightIcon = log.FightData.Logic.Icon; logData.LightTheme = light; logData.SingleGroup = log.PlayerList.Where(x => !x.IsFakeActor).Select(x => x.Group).Distinct().Count() == 1; logData.HasBreakbarDamage = log.CombatData.HasBreakbarDamageData; logData.NoMechanics = log.FightData.Logic.HasNoFightSpecificMechanics; if (log.LogData.LogErrors.Count > 0) { logData.LogErrors = new List <string>(log.LogData.LogErrors); } // SkillDto.AssembleSkills(usedSkills.Values, logData.SkillMap, log.SkillData); DamageModDto.AssembleDamageModifiers(usedDamageMods, logData.DamageModMap); BuffDto.AssembleBoons(usedBuffs.Values, logData.BuffMap, log); MechanicDto.BuildMechanics(log.MechanicData.GetPresentMechanics(log, log.FightData.FightStart, log.FightData.FightEnd), logData.MechanicMap); return(logData); }
public PhaseDto(PhaseData phase, IReadOnlyList <PhaseData> phases, ParsedEvtcLog log, IReadOnlyDictionary <Spec, IReadOnlyList <Buff> > persBuffDict, IReadOnlyList <DamageModifier> commonDamageModifiers, IReadOnlyList <DamageModifier> itemDamageModifiers, IReadOnlyDictionary <Spec, IReadOnlyList <DamageModifier> > persDamageModDict) { Name = phase.Name; Duration = phase.DurationInMS; Start = phase.Start / 1000.0; End = phase.End / 1000.0; BreakbarPhase = phase.BreakbarPhase; Dummy = phase.Dummy; foreach (AbstractSingleActor target in phase.Targets) { Targets.Add(log.FightData.Logic.Targets.IndexOf(target)); } PlayerActiveTimes = new List <long>(); foreach (AbstractSingleActor actor in log.Friendlies) { PlayerActiveTimes.Add(actor.GetActiveDuration(log, phase.Start, phase.End)); } // add phase markup MarkupLines = new List <double>(); MarkupAreas = new List <AreaLabelDto>(); if (!BreakbarPhase) { for (int j = 1; j < phases.Count; j++) { PhaseData curPhase = phases[j]; if (curPhase.Start < phase.Start || curPhase.End > phase.End || (curPhase.Start == phase.Start && curPhase.End == phase.End) || !curPhase.CanBeSubPhase) { continue; } if (SubPhases == null) { SubPhases = new List <int>(); } SubPhases.Add(j); long start = curPhase.Start - phase.Start; long end = curPhase.End - phase.Start; if (curPhase.DrawStart) { MarkupLines.Add(start / 1000.0); } if (curPhase.DrawEnd) { MarkupLines.Add(end / 1000.0); } var phaseArea = new AreaLabelDto { Start = start / 1000.0, End = end / 1000.0, Label = curPhase.DrawLabel ? curPhase.Name : null, Highlight = curPhase.DrawArea }; MarkupAreas.Add(phaseArea); } } if (MarkupAreas.Count == 0) { MarkupAreas = null; } if (MarkupLines.Count == 0) { MarkupLines = null; } StatisticsHelper statistics = log.StatisticsHelper; DpsStats = PhaseDto.BuildDPSData(log, phase); DpsStatsTargets = PhaseDto.BuildDPSTargetsData(log, phase); OffensiveStatsTargets = PhaseDto.BuildOffensiveStatsTargetsData(log, phase); OffensiveStats = PhaseDto.BuildOffensiveStatsData(log, phase); GameplayStats = PhaseDto.BuildGameplayStatsData(log, phase); DefStats = PhaseDto.BuildDefenseData(log, phase); SupportStats = PhaseDto.BuildSupportData(log, phase); // BoonStats = BuffData.BuildBuffUptimeData(log, statistics.PresentBoons, phase); OffBuffStats = BuffData.BuildBuffUptimeData(log, statistics.PresentOffbuffs, phase); SupBuffStats = BuffData.BuildBuffUptimeData(log, statistics.PresentSupbuffs, phase); DefBuffStats = BuffData.BuildBuffUptimeData(log, statistics.PresentDefbuffs, phase); PersBuffStats = BuffData.BuildPersonalBuffUptimeData(log, persBuffDict, phase); GearBuffStats = BuffData.BuildBuffUptimeData(log, statistics.PresentGearbuffs, phase); DebuffStats = BuffData.BuildBuffUptimeData(log, statistics.PresentDebuffs, phase); ConditionsStats = BuffData.BuildBuffUptimeData(log, statistics.PresentConditions, phase); BoonGenSelfStats = BuffData.BuildBuffGenerationData(log, statistics.PresentBoons, phase, BuffEnum.Self); BoonGenGroupStats = BuffData.BuildBuffGenerationData(log, statistics.PresentBoons, phase, BuffEnum.Group); BoonGenOGroupStats = BuffData.BuildBuffGenerationData(log, statistics.PresentBoons, phase, BuffEnum.OffGroup); BoonGenSquadStats = BuffData.BuildBuffGenerationData(log, statistics.PresentBoons, phase, BuffEnum.Squad); OffBuffGenSelfStats = BuffData.BuildBuffGenerationData(log, statistics.PresentOffbuffs, phase, BuffEnum.Self); OffBuffGenGroupStats = BuffData.BuildBuffGenerationData(log, statistics.PresentOffbuffs, phase, BuffEnum.Group); OffBuffGenOGroupStats = BuffData.BuildBuffGenerationData(log, statistics.PresentOffbuffs, phase, BuffEnum.OffGroup); OffBuffGenSquadStats = BuffData.BuildBuffGenerationData(log, statistics.PresentOffbuffs, phase, BuffEnum.Squad); SupBuffGenSelfStats = BuffData.BuildBuffGenerationData(log, statistics.PresentSupbuffs, phase, BuffEnum.Self); SupBuffGenGroupStats = BuffData.BuildBuffGenerationData(log, statistics.PresentSupbuffs, phase, BuffEnum.Group); SupBuffGenOGroupStats = BuffData.BuildBuffGenerationData(log, statistics.PresentSupbuffs, phase, BuffEnum.OffGroup); SupBuffGenSquadStats = BuffData.BuildBuffGenerationData(log, statistics.PresentSupbuffs, phase, BuffEnum.Squad); DefBuffGenSelfStats = BuffData.BuildBuffGenerationData(log, statistics.PresentDefbuffs, phase, BuffEnum.Self); DefBuffGenGroupStats = BuffData.BuildBuffGenerationData(log, statistics.PresentDefbuffs, phase, BuffEnum.Group); DefBuffGenOGroupStats = BuffData.BuildBuffGenerationData(log, statistics.PresentDefbuffs, phase, BuffEnum.OffGroup); DefBuffGenSquadStats = BuffData.BuildBuffGenerationData(log, statistics.PresentDefbuffs, phase, BuffEnum.Squad); // BoonActiveStats = BuffData.BuildActiveBuffUptimeData(log, statistics.PresentBoons, phase); OffBuffActiveStats = BuffData.BuildActiveBuffUptimeData(log, statistics.PresentOffbuffs, phase); SupBuffActiveStats = BuffData.BuildActiveBuffUptimeData(log, statistics.PresentSupbuffs, phase); DefBuffActiveStats = BuffData.BuildActiveBuffUptimeData(log, statistics.PresentDefbuffs, phase); PersBuffActiveStats = BuffData.BuildActivePersonalBuffUptimeData(log, persBuffDict, phase); GearBuffActiveStats = BuffData.BuildActiveBuffUptimeData(log, statistics.PresentGearbuffs, phase); DebuffActiveStats = BuffData.BuildActiveBuffUptimeData(log, statistics.PresentDebuffs, phase); ConditionsActiveStats = BuffData.BuildActiveBuffUptimeData(log, statistics.PresentConditions, phase); BoonGenActiveSelfStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentBoons, phase, BuffEnum.Self); BoonGenActiveGroupStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentBoons, phase, BuffEnum.Group); BoonGenActiveOGroupStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentBoons, phase, BuffEnum.OffGroup); BoonGenActiveSquadStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentBoons, phase, BuffEnum.Squad); OffBuffGenActiveSelfStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentOffbuffs, phase, BuffEnum.Self); OffBuffGenActiveGroupStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentOffbuffs, phase, BuffEnum.Group); OffBuffGenActiveOGroupStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentOffbuffs, phase, BuffEnum.OffGroup); OffBuffGenActiveSquadStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentOffbuffs, phase, BuffEnum.Squad); SupBuffGenActiveSelfStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentSupbuffs, phase, BuffEnum.Self); SupBuffGenActiveGroupStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentSupbuffs, phase, BuffEnum.Group); SupBuffGenActiveOGroupStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentSupbuffs, phase, BuffEnum.OffGroup); SupBuffGenActiveSquadStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentSupbuffs, phase, BuffEnum.Squad); DefBuffGenActiveSelfStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentDefbuffs, phase, BuffEnum.Self); DefBuffGenActiveGroupStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentDefbuffs, phase, BuffEnum.Group); DefBuffGenActiveOGroupStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentDefbuffs, phase, BuffEnum.OffGroup); DefBuffGenActiveSquadStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentDefbuffs, phase, BuffEnum.Squad); // DmgModifiersCommon = DamageModData.BuildDmgModifiersData(log, phase, commonDamageModifiers); DmgModifiersItem = DamageModData.BuildDmgModifiersData(log, phase, itemDamageModifiers); DmgModifiersPers = DamageModData.BuildPersonalDmgModifiersData(log, phase, persDamageModDict); TargetsCondiStats = new List <List <BuffData> >(); TargetsCondiTotals = new List <BuffData>(); TargetsBoonTotals = new List <BuffData>(); MechanicStats = MechanicDto.BuildPlayerMechanicData(log, phase); EnemyMechanicStats = MechanicDto.BuildEnemyMechanicData(log, phase); foreach (AbstractSingleActor target in phase.Targets) { TargetsCondiStats.Add(BuffData.BuildTargetCondiData(log, phase.Start, phase.End, target)); TargetsCondiTotals.Add(BuffData.BuildTargetCondiUptimeData(log, phase, target)); TargetsBoonTotals.Add(BuffData.BuildTargetBoonData(log, phase, target)); } }