// 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); }
private static DmgDistributionDto BuildDMGDistDataMinionsInternal(ParsedLog log, FinalDPS dps, Minions minions, NPC target, int phaseIndex, Dictionary <long, SkillItem> usedSkills, Dictionary <long, Buff> usedBuffs) { var dto = new DmgDistributionDto(); PhaseData phase = log.FightData.GetPhases(log)[phaseIndex]; List <AbstractCastEvent> casting = minions.GetCastLogs(log, phase.Start, phase.End); List <AbstractDamageEvent> damageLogs = minions.GetDamageLogs(target, log, phase); dto.ContributedDamage = damageLogs.Count > 0 ? damageLogs.Sum(x => x.Damage) : 0; dto.ContributedShieldDamage = damageLogs.Count > 0 ? damageLogs.Sum(x => x.ShieldDamage) : 0; dto.TotalDamage = dps.Damage; dto.Distribution = BuildDMGDistBodyData(log, casting, damageLogs, usedSkills, usedBuffs); return(dto); }
private static List <object[]> BuildDMGDistBodyData(ParsedLog log, List <AbstractCastEvent> casting, List <AbstractDamageEvent> damageLogs, Dictionary <long, SkillItem> usedSkills, Dictionary <long, Buff> usedBuffs) { var list = new List <object[]>(); var castLogsBySkill = casting.GroupBy(x => x.Skill).ToDictionary(x => x.Key, x => x.ToList()); var damageLogsBySkill = damageLogs.GroupBy(x => x.Skill).ToDictionary(x => x.Key, x => x.ToList()); var conditionsById = log.Statistics.PresentConditions.ToDictionary(x => x.ID); foreach (KeyValuePair <SkillItem, List <AbstractDamageEvent> > entry in damageLogsBySkill) { list.Add(DmgDistributionDto.GetDMGDtoItem(entry, castLogsBySkill, usedSkills, usedBuffs, log.Buffs)); } // non damaging foreach (KeyValuePair <SkillItem, List <AbstractCastEvent> > entry in castLogsBySkill) { if (damageLogsBySkill.ContainsKey(entry.Key)) { continue; } if (!usedSkills.ContainsKey(entry.Key.ID)) { usedSkills.Add(entry.Key.ID, entry.Key); } int casts = entry.Value.Count; int timeswasted = 0, timessaved = 0; foreach (AbstractCastEvent cl in entry.Value) { if (cl.SavedDuration < 0) { timeswasted += cl.SavedDuration; } else { timessaved += cl.SavedDuration; } } object[] skillData = { false, entry.Key.ID, 0, -1, 0, casts, 0, 0, 0, 0, -timeswasted / 1000.0, timessaved / 1000.0, 0 }; list.Add(skillData); } return(list); }
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); }
private static ActorDetailsDto BuildPlayerMinionsData(ParsedLog log, Player player, Minions minion, Dictionary <long, SkillItem> usedSkills, Dictionary <long, Buff> usedBuffs) { var dto = new ActorDetailsDto { DmgDistributions = new List <DmgDistributionDto>(), DmgDistributionsTargets = new List <List <DmgDistributionDto> >() }; for (int i = 0; i < log.FightData.GetPhases(log).Count; i++) { var dmgTargetsDto = new List <DmgDistributionDto>(); foreach (NPC target in log.FightData.GetPhases(log)[i].Targets) { dmgTargetsDto.Add(DmgDistributionDto.BuildPlayerMinionDMGDistData(log, player, minion, target, i, usedSkills, usedBuffs)); } dto.DmgDistributionsTargets.Add(dmgTargetsDto); dto.DmgDistributions.Add(DmgDistributionDto.BuildPlayerMinionDMGDistData(log, player, minion, null, i, usedSkills, usedBuffs)); } return(dto); }
private static ActorDetailsDto BuildTargetsMinionsData(ParsedLog log, NPC target, Minions minion, Dictionary <long, SkillItem> usedSkills, Dictionary <long, Buff> usedBuffs) { var dto = new ActorDetailsDto { DmgDistributions = new List <DmgDistributionDto>() }; for (int i = 0; i < log.FightData.GetPhases(log).Count; i++) { if (log.FightData.GetPhases(log)[i].Targets.Contains(target)) { dto.DmgDistributions.Add(DmgDistributionDto.BuildTargetMinionDMGDistData(log, target, minion, i, usedSkills, usedBuffs)); } else { dto.DmgDistributions.Add(new DmgDistributionDto()); } } return(dto); }
public static DmgDistributionDto BuildDMGTakenDistData(ParsedLog log, AbstractSingleActor p, int phaseIndex, Dictionary <long, SkillItem> usedSkills, Dictionary <long, Buff> usedBuffs) { var dto = new DmgDistributionDto { Distribution = new List <object[]>() }; PhaseData phase = log.FightData.GetPhases(log)[phaseIndex]; List <AbstractDamageEvent> damageLogs = p.GetDamageTakenLogs(null, log, phase.Start, phase.End); var damageLogsBySkill = damageLogs.GroupBy(x => x.Skill).ToDictionary(x => x.Key, x => x.ToList()); dto.ContributedDamage = damageLogs.Count > 0 ? damageLogs.Sum(x => (long)x.Damage) : 0; dto.ContributedShieldDamage = damageLogs.Count > 0 ? damageLogs.Sum(x => (long)x.ShieldDamage) : 0; var conditionsById = log.Statistics.PresentConditions.ToDictionary(x => x.ID); foreach (KeyValuePair <SkillItem, List <AbstractDamageEvent> > entry in damageLogsBySkill) { dto.Distribution.Add(DmgDistributionDto.GetDMGDtoItem(entry, null, usedSkills, usedBuffs, log.Buffs)); } return(dto); }