public static void AssembleDamageModifiers(ICollection <DamageModifier> damageMods, Dictionary <string, DamageModDto> dict) { foreach (DamageModifier mod in damageMods) { int id = mod.Name.GetHashCode(); dict["d" + id] = new DamageModDto() { Id = id, Name = mod.Name, Icon = mod.Icon, Tooltip = mod.Tooltip, NonMultiplier = !mod.Multiplier, SkillBased = mod.SkillBased }; } }
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); }