// helpers public static ActorDetailsDto BuildPlayerData(ParsedLog log, Player player, Dictionary <long, SkillItem> usedSkills, Dictionary <long, Buff> usedBuffs) { var dto = new ActorDetailsDto { DmgDistributions = new List <DmgDistributionDto>(), DmgDistributionsTargets = new List <List <DmgDistributionDto> >(), DmgDistributionsTaken = new List <DmgDistributionDto>(), BoonGraph = new List <List <BuffChartDataDto> >(), Rotation = new List <List <object[]> >(), Food = FoodDto.BuildPlayerFoodData(log, player, usedBuffs), Minions = new List <ActorDetailsDto>(), DeathRecap = DeathRecapDto.BuildDeathRecap(log, player) }; for (int i = 0; i < log.FightData.GetPhases(log).Count; i++) { dto.Rotation.Add(SkillDto.BuildRotationData(log, player, i, usedSkills)); dto.DmgDistributions.Add(DmgDistributionDto.BuildPlayerDMGDistData(log, player, null, i, usedSkills, usedBuffs)); var dmgTargetsDto = new List <DmgDistributionDto>(); foreach (NPC target in log.FightData.GetPhases(log)[i].Targets) { dmgTargetsDto.Add(DmgDistributionDto.BuildPlayerDMGDistData(log, player, target, i, usedSkills, usedBuffs)); } dto.DmgDistributionsTargets.Add(dmgTargetsDto); dto.DmgDistributionsTaken.Add(DmgDistributionDto.BuildDMGTakenDistData(log, player, i, usedSkills, usedBuffs)); dto.BoonGraph.Add(BuffChartDataDto.BuildBoonGraphData(log, player, i, usedBuffs)); } foreach (KeyValuePair <long, Minions> pair in player.GetMinions(log)) { dto.Minions.Add(BuildPlayerMinionsData(log, player, pair.Value, usedSkills, usedBuffs)); } return(dto); }
public static ActorDetailsDto BuildTargetData(ParsedLog log, NPC target, Dictionary <long, SkillItem> usedSkills, Dictionary <long, Buff> usedBuffs, bool cr) { var dto = new ActorDetailsDto { DmgDistributions = new List <DmgDistributionDto>(), DmgDistributionsTaken = new List <DmgDistributionDto>(), BoonGraph = new List <List <BuffChartDataDto> >(), Rotation = new List <List <object[]> >() }; for (int i = 0; i < log.FightData.GetPhases(log).Count; i++) { if (log.FightData.GetPhases(log)[i].Targets.Contains(target)) { dto.DmgDistributions.Add(DmgDistributionDto.BuildTargetDMGDistData(log, target, i, usedSkills, usedBuffs)); dto.DmgDistributionsTaken.Add(DmgDistributionDto.BuildDMGTakenDistData(log, target, i, usedSkills, usedBuffs)); dto.Rotation.Add(SkillDto.BuildRotationData(log, target, i, usedSkills)); dto.BoonGraph.Add(BuffChartDataDto.BuildBoonGraphData(log, target, i, usedBuffs)); } // rotation + buff graph for CR else if (i == 0 && cr) { dto.DmgDistributions.Add(new DmgDistributionDto()); dto.DmgDistributionsTaken.Add(new DmgDistributionDto()); dto.Rotation.Add(SkillDto.BuildRotationData(log, target, i, usedSkills)); dto.BoonGraph.Add(BuffChartDataDto.BuildBoonGraphData(log, target, i, usedBuffs)); } else { dto.DmgDistributions.Add(new DmgDistributionDto()); dto.DmgDistributionsTaken.Add(new DmgDistributionDto()); dto.Rotation.Add(new List <object[]>()); dto.BoonGraph.Add(new List <BuffChartDataDto>()); } } dto.Minions = new List <ActorDetailsDto>(); foreach (KeyValuePair <long, Minions> pair in target.GetMinions(log)) { dto.Minions.Add(BuildTargetsMinionsData(log, target, pair.Value, usedSkills, usedBuffs)); } return(dto); }
public static LogDataDto BuildLogData(ParsedLog log, Dictionary <long, SkillItem> usedSkills, Dictionary <long, Buff> usedBuffs, HashSet <DamageModifier> usedDamageMods, bool cr, bool light) { GeneralStatistics statistics = log.Statistics; log.UpdateProgressWithCancellationCheck("HTML: building Log Data"); var logData = new LogDataDto(); 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, cr, ActorDetailsDto.BuildPlayerData(log, player, usedSkills, usedBuffs))); } log.UpdateProgressWithCancellationCheck("HTML: building Enemies"); foreach (AbstractActor enemy in log.MechanicData.GetEnemyList(log, 0)) { 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, cr, 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(GeneralHelper.Source.Common, out List <DamageModifier> list)) { foreach (DamageModifier dMod in list) { if (allDamageMods.Contains(dMod.Name)) { commonDamageModifiers.Add(dMod); logData.DmgModifiersCommon.Add(dMod.Name.GetHashCode()); usedDamageMods.Add(dMod); } } } if (log.DamageModifiers.DamageModifiersPerSource.TryGetValue(GeneralHelper.Source.FightSpecific, out list)) { foreach (DamageModifier dMod in list) { if (allDamageMods.Contains(dMod.Name)) { commonDamageModifiers.Add(dMod); logData.DmgModifiersCommon.Add(dMod.Name.GetHashCode()); usedDamageMods.Add(dMod); } } } var itemDamageModifiers = new List <DamageModifier>(); if (log.DamageModifiers.DamageModifiersPerSource.TryGetValue(GeneralHelper.Source.Item, out list)) { foreach (DamageModifier dMod in list) { if (allDamageMods.Contains(dMod.Name)) { itemDamageModifiers.Add(dMod); logData.DmgModifiersItem.Add(dMod.Name.GetHashCode()); 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.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"); List <PhaseData> phases = log.FightData.GetPhases(log); for (int i = 0; i < phases.Count; i++) { PhaseData phaseData = phases[i]; var phaseDto = new PhaseDto(phaseData, phases, log) { DpsStats = PhaseDto.BuildDPSData(log, i), DpsStatsTargets = PhaseDto.BuildDPSTargetsData(log, i), DmgStatsTargets = PhaseDto.BuildDMGStatsTargetsData(log, i), DmgStats = PhaseDto.BuildDMGStatsData(log, i), DefStats = PhaseDto.BuildDefenseData(log, i), SupportStats = PhaseDto.BuildSupportData(log, i), // BoonStats = BuffData.BuildBuffUptimeData(log, statistics.PresentBoons, i), OffBuffStats = BuffData.BuildBuffUptimeData(log, statistics.PresentOffbuffs, i), DefBuffStats = BuffData.BuildBuffUptimeData(log, statistics.PresentDefbuffs, i), PersBuffStats = BuffData.BuildPersonalBuffUptimeData(log, persBuffDict, i), BoonGenSelfStats = BuffData.BuildBuffGenerationData(log, statistics.PresentBoons, i, BuffEnum.Self), BoonGenGroupStats = BuffData.BuildBuffGenerationData(log, statistics.PresentBoons, i, BuffEnum.Group), BoonGenOGroupStats = BuffData.BuildBuffGenerationData(log, statistics.PresentBoons, i, BuffEnum.OffGroup), BoonGenSquadStats = BuffData.BuildBuffGenerationData(log, statistics.PresentBoons, i, BuffEnum.Squad), OffBuffGenSelfStats = BuffData.BuildBuffGenerationData(log, statistics.PresentOffbuffs, i, BuffEnum.Self), OffBuffGenGroupStats = BuffData.BuildBuffGenerationData(log, statistics.PresentOffbuffs, i, BuffEnum.Group), OffBuffGenOGroupStats = BuffData.BuildBuffGenerationData(log, statistics.PresentOffbuffs, i, BuffEnum.OffGroup), OffBuffGenSquadStats = BuffData.BuildBuffGenerationData(log, statistics.PresentOffbuffs, i, BuffEnum.Squad), DefBuffGenSelfStats = BuffData.BuildBuffGenerationData(log, statistics.PresentDefbuffs, i, BuffEnum.Self), DefBuffGenGroupStats = BuffData.BuildBuffGenerationData(log, statistics.PresentDefbuffs, i, BuffEnum.Group), DefBuffGenOGroupStats = BuffData.BuildBuffGenerationData(log, statistics.PresentDefbuffs, i, BuffEnum.OffGroup), DefBuffGenSquadStats = BuffData.BuildBuffGenerationData(log, statistics.PresentDefbuffs, i, BuffEnum.Squad), // BoonActiveStats = BuffData.BuildActiveBuffUptimeData(log, statistics.PresentBoons, i), OffBuffActiveStats = BuffData.BuildActiveBuffUptimeData(log, statistics.PresentOffbuffs, i), DefBuffActiveStats = BuffData.BuildActiveBuffUptimeData(log, statistics.PresentDefbuffs, i), PersBuffActiveStats = BuffData.BuildActivePersonalBuffUptimeData(log, persBuffDict, i), BoonGenActiveSelfStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentBoons, i, BuffEnum.Self), BoonGenActiveGroupStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentBoons, i, BuffEnum.Group), BoonGenActiveOGroupStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentBoons, i, BuffEnum.OffGroup), BoonGenActiveSquadStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentBoons, i, BuffEnum.Squad), OffBuffGenActiveSelfStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentOffbuffs, i, BuffEnum.Self), OffBuffGenActiveGroupStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentOffbuffs, i, BuffEnum.Group), OffBuffGenActiveOGroupStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentOffbuffs, i, BuffEnum.OffGroup), OffBuffGenActiveSquadStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentOffbuffs, i, BuffEnum.Squad), DefBuffGenActiveSelfStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentDefbuffs, i, BuffEnum.Self), DefBuffGenActiveGroupStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentDefbuffs, i, BuffEnum.Group), DefBuffGenActiveOGroupStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentDefbuffs, i, BuffEnum.OffGroup), DefBuffGenActiveSquadStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentDefbuffs, i, 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, i), EnemyMechanicStats = MechanicDto.BuildEnemyMechanicData(log, i) }; foreach (NPC target in phaseData.Targets) { phaseDto.TargetsCondiStats.Add(BuffData.BuildTargetCondiData(log, i, target)); phaseDto.TargetsCondiTotals.Add(BuffData.BuildTargetCondiUptimeData(log, i, target)); phaseDto.TargetsBoonTotals.Add(HasBoons(log, i, target) ? BuffData.BuildTargetBoonData(log, i, 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.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); DamageModDto.AssembleDamageModifiers(usedDamageMods, logData.DamageModMap); BuffDto.AssembleBoons(usedBuffs.Values, logData.BuffMap, log); MechanicDto.BuildMechanics(log.MechanicData.GetPresentMechanics(log, 0), logData.MechanicMap); return(logData); }