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 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); }