internal static void AssembleDamageModifiers(ICollection <DamageModifier> damageMods, Dictionary <string, DamageModDto> dict) { foreach (DamageModifier mod in damageMods) { int id = mod.ID; 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(ParsedEvtcLog log, bool cr, bool light, Version parserVersion, string[] uploadLinks) { var usedBuffs = new Dictionary <long, Buff>(); var usedDamageMods = new HashSet <DamageModifier>(); var usedSkills = new Dictionary <long, SkillItem>(); log.UpdateProgressWithCancellationCheck("HTML: building Log Data"); var logData = new LogDataDto(log, light, parserVersion, uploadLinks); if (cr) { log.UpdateProgressWithCancellationCheck("HTML: building Combat Replay"); logData.CrData = new CombatReplayDto(log); } log.UpdateProgressWithCancellationCheck("HTML: building Graph Data"); logData.GraphData = new ChartDataDto(log); log.UpdateProgressWithCancellationCheck("HTML: building Players"); foreach (AbstractSingleActor actor in log.Friendlies) { logData.HasCommander = logData.HasCommander || actor.HasCommanderTag; logData.Players.Add(new PlayerDto(actor, log, ActorDetailsDto.BuildPlayerData(log, actor, usedSkills, usedBuffs))); } log.UpdateProgressWithCancellationCheck("HTML: building Enemies"); foreach (AbstractSingleActor enemy in log.MechanicData.GetEnemyList(log, 0, log.FightData.FightEnd)) { logData.Enemies.Add(new EnemyDto() { Name = enemy.Character }); } log.UpdateProgressWithCancellationCheck("HTML: building Targets"); foreach (AbstractSingleActor 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 <Spec, IReadOnlyList <Buff> > persBuffDict = BuildPersonalBuffData(log, logData.PersBuffs, usedBuffs); Dictionary <Spec, IReadOnlyList <DamageModifier> > persDamageModDict = BuildPersonalDamageModData(log, logData.DmgModifiersPers, usedDamageMods); var allDamageMods = new HashSet <string>(); var commonDamageModifiers = new List <DamageModifier>(); var itemDamageModifiers = new List <DamageModifier>(); BuildDictionaries(log, usedBuffs, usedDamageMods, logData, allDamageMods, commonDamageModifiers, itemDamageModifiers); // 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, persBuffDict, commonDamageModifiers, itemDamageModifiers, persDamageModDict); logData.Phases.Add(phaseDto); } // if (log.CombatData.HasEXTHealing) { log.UpdateProgressWithCancellationCheck("HTML: building Healing Extension"); logData.HealingStatsExtension = new HealingStatsExtension(log, usedSkills, usedBuffs); } // SkillDto.AssembleSkills(usedSkills.Values, logData.SkillMap, log); DamageModDto.AssembleDamageModifiers(usedDamageMods, logData.DamageModMap); BuffDto.AssembleBoons(usedBuffs.Values, logData.BuffMap, log); MechanicDto.BuildMechanics(log.MechanicData.GetPresentMechanics(log, 0, log.FightData.FightEnd), logData.MechanicMap); return(logData); }
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); }