private static List <JsonBuffsUptime> GetNPCJsonBuffsUptime(AbstractSingleActor npc, ParsedEvtcLog log, RawFormatSettings settings, Dictionary <string, JsonLog.BuffDesc> buffDesc) { var res = new List <JsonBuffsUptime>(); IReadOnlyList <PhaseData> phases = log.FightData.GetNonDummyPhases(log); var buffs = phases.Select(x => npc.GetBuffs(ParserHelper.BuffEnum.Self, log, x.Start, x.End)).ToList(); foreach (KeyValuePair <long, FinalActorBuffs> pair in buffs[0]) { var data = new List <JsonBuffsUptimeData>(); for (int i = 0; i < phases.Count; i++) { PhaseData phase = phases[i]; Dictionary <long, FinalBuffsDictionary> buffsDictionary = npc.GetBuffsDictionary(log, phase.Start, phase.End); if (buffs[i].TryGetValue(pair.Key, out FinalActorBuffs val)) { JsonBuffsUptimeData value = JsonBuffsUptimeBuilder.BuildJsonBuffsUptimeData(val, buffsDictionary[pair.Key]); data.Add(value); } else { var value = new JsonBuffsUptimeData(); data.Add(value); } } res.Add(JsonBuffsUptimeBuilder.BuildJsonBuffsUptime(npc, pair.Key, log, settings, data, buffDesc)); } return(res); }
private static List <JsonBuffsUptime> GetPlayerJsonBuffsUptime(AbstractSingleActor player, List <IReadOnlyDictionary <long, FinalActorBuffs> > buffs, ParsedEvtcLog log, RawFormatSettings settings, Dictionary <string, JsonLog.BuffDesc> buffDesc, Dictionary <string, HashSet <long> > personalBuffs) { var res = new List <JsonBuffsUptime>(); var profEnums = new HashSet <ParserHelper.Source>(SpecToSources(player.Spec)); IReadOnlyList <PhaseData> phases = log.FightData.GetNonDummyPhases(log); foreach (KeyValuePair <long, FinalActorBuffs> pair in buffs[0]) { Buff buff = log.Buffs.BuffsByIds[pair.Key]; var data = new List <JsonBuffsUptimeData>(); for (int i = 0; i < phases.Count; i++) { PhaseData phase = phases[i]; Dictionary <long, FinalBuffsDictionary> buffsDictionary = player.GetBuffsDictionary(log, phase.Start, phase.End); if (buffs[i].TryGetValue(pair.Key, out FinalActorBuffs val)) { JsonBuffsUptimeData value = JsonBuffsUptimeBuilder.BuildJsonBuffsUptimeData(val, buffsDictionary[pair.Key]); data.Add(value); } else { var value = new JsonBuffsUptimeData(); data.Add(value); } } if (buff.Classification == Buff.BuffClassification.Other && profEnums.Contains(buff.Source)) { if (player.GetBuffDistribution(log, phases[0].Start, phases[0].End).GetUptime(pair.Key) > 0) { if (personalBuffs.TryGetValue(player.Spec.ToString(), out HashSet <long> list) && !list.Contains(pair.Key)) { list.Add(pair.Key); } else { personalBuffs[player.Spec.ToString()] = new HashSet <long>() { pair.Key }; } } } res.Add(JsonBuffsUptimeBuilder.BuildJsonBuffsUptime(player, pair.Key, log, settings, data, buffDesc)); } return(res); }