private void SetSupport(ParsedLog log) { _support = new List <FinalSupport>(); List <PhaseData> phases = log.FightData.GetPhases(log); for (int phaseIndex = 0; phaseIndex < phases.Count; phaseIndex++) { FinalSupport final = new FinalSupport(); _support.Add(final); PhaseData phase = phases[phaseIndex]; int[] resArray = GetReses(log, phase.Start, phase.End); int[] cleanseArray = GetCleanses(log, phaseIndex); //List<DamageLog> healingLogs = player.getHealingLogs(log, phase.getStart(), phase.getEnd()); //final.allHeal = healingLogs.Sum(x => x.getDamage()); final.Resurrects = resArray[0]; final.ResurrectTime = resArray[1] / 1000.0; final.CondiCleanse = cleanseArray[0]; final.CondiCleanseTime = cleanseArray[1] / 1000.0; } }
public List <DamageLog> GetJustPlayerDamageLogs(AbstractActor target, ParsedLog log, PhaseData phase) { if (!_selfDamageLogsPerPhasePerTarget.TryGetValue(phase, out Dictionary <AbstractActor, List <DamageLog> > targetDict)) { targetDict = new Dictionary <AbstractActor, List <DamageLog> >(); _selfDamageLogsPerPhasePerTarget[phase] = targetDict; } if (!targetDict.TryGetValue(target ?? GeneralHelper.NullActor, out List <DamageLog> dls)) { dls = GetDamageLogs(target, log, phase).Where(x => x.SrcInstId == InstID).ToList(); targetDict[target ?? GeneralHelper.NullActor] = dls; } return(dls); }
protected FinalDPS GetFinalDPS(ParsedLog log, PhaseData phase, Target target) { double phaseDuration = (phase.DurationInMS) / 1000.0; int damage; double dps = 0.0; FinalDPS final = new FinalDPS(); //DPS damage = GetDamageLogs(target, log, phase).Sum(x => x.Damage); if (phaseDuration > 0) { dps = damage / phaseDuration; } final.Dps = (int)Math.Round(dps); final.Damage = damage; //Condi DPS damage = GetDamageLogs(target, log, phase).Sum(x => x.IsCondi ? x.Damage : 0); if (phaseDuration > 0) { dps = damage / phaseDuration; } final.CondiDps = (int)Math.Round(dps); final.CondiDamage = damage; //Power DPS damage = final.Damage - final.CondiDamage; if (phaseDuration > 0) { dps = damage / phaseDuration; } final.PowerDps = (int)Math.Round(dps); final.PowerDamage = damage; // Actor DPS damage = GetJustPlayerDamageLogs(target, log, phase).Sum(x => x.Damage); if (phaseDuration > 0) { dps = damage / phaseDuration; } final.ActorDps = (int)Math.Round(dps); final.ActorDamage = damage; //Actor Condi DPS damage = GetJustPlayerDamageLogs(target, log, phase).Sum(x => x.IsCondi ? x.Damage : 0); if (phaseDuration > 0) { dps = damage / phaseDuration; } final.ActorCondiDps = (int)Math.Round(dps); final.ActorCondiDamage = damage; //Actor Power DPS damage = final.ActorDamage - final.ActorCondiDamage; if (phaseDuration > 0) { dps = damage / phaseDuration; } final.ActorPowerDps = (int)Math.Round(dps); final.ActorPowerDamage = damage; return(final); }
private void SetBuffs(ParsedLog log) { // Boons applied to self _selfBuffs = new List <Dictionary <long, FinalBuffs> >(); List <PhaseData> phases = log.FightData.GetPhases(log); for (int phaseIndex = 0; phaseIndex < phases.Count; phaseIndex++) { Dictionary <long, FinalBuffs> final = new Dictionary <long, FinalBuffs>(); PhaseData phase = phases[phaseIndex]; BoonDistribution selfBoons = GetBoonDistribution(log, phaseIndex); Dictionary <long, long> buffPresence = GetBuffPresence(log, phaseIndex); long fightDuration = phase.End - phase.Start; foreach (Boon boon in TrackedBoons) { if (selfBoons.ContainsKey(boon.ID)) { FinalBuffs uptime = new FinalBuffs { Uptime = 0, Generation = 0, Overstack = 0, Wasted = 0, UnknownExtended = 0, ByExtension = 0, Extended = 0 }; final[boon.ID] = uptime; long generation = selfBoons.GetGeneration(boon.ID, AgentItem); if (boon.Type == Boon.BoonType.Duration) { uptime.Uptime = Math.Round(100.0 * selfBoons.GetUptime(boon.ID) / fightDuration, GeneralHelper.BoonDigit); uptime.Generation = Math.Round(100.0 * generation / fightDuration, GeneralHelper.BoonDigit); uptime.Overstack = Math.Round(100.0 * (selfBoons.GetOverstack(boon.ID, AgentItem) + generation) / fightDuration, GeneralHelper.BoonDigit); uptime.Wasted = Math.Round(100.0 * selfBoons.GetWaste(boon.ID, AgentItem) / fightDuration, GeneralHelper.BoonDigit); uptime.UnknownExtended = Math.Round(100.0 * selfBoons.GetUnknownExtension(boon.ID, AgentItem) / fightDuration, GeneralHelper.BoonDigit); uptime.ByExtension = Math.Round(100.0 * selfBoons.GetExtension(boon.ID, AgentItem) / fightDuration, GeneralHelper.BoonDigit); uptime.Extended = Math.Round(100.0 * selfBoons.GetExtended(boon.ID, AgentItem) / fightDuration, GeneralHelper.BoonDigit); } else if (boon.Type == Boon.BoonType.Intensity) { uptime.Uptime = Math.Round((double)selfBoons.GetUptime(boon.ID) / fightDuration, GeneralHelper.BoonDigit); uptime.Generation = Math.Round((double)generation / fightDuration, GeneralHelper.BoonDigit); uptime.Overstack = Math.Round((double)(selfBoons.GetOverstack(boon.ID, AgentItem) + generation) / fightDuration, GeneralHelper.BoonDigit); uptime.Wasted = Math.Round((double)selfBoons.GetWaste(boon.ID, AgentItem) / fightDuration, GeneralHelper.BoonDigit); uptime.UnknownExtended = Math.Round((double)selfBoons.GetUnknownExtension(boon.ID, AgentItem) / fightDuration, GeneralHelper.BoonDigit); uptime.ByExtension = Math.Round((double)selfBoons.GetExtension(boon.ID, AgentItem) / fightDuration, GeneralHelper.BoonDigit); uptime.Extended = Math.Round((double)selfBoons.GetExtended(boon.ID, AgentItem) / fightDuration, GeneralHelper.BoonDigit); if (buffPresence.TryGetValue(boon.ID, out long presenceValueBoon)) { uptime.Presence = Math.Round(100.0 * presenceValueBoon / fightDuration, GeneralHelper.BoonDigit); } } } } _selfBuffs.Add(final); } // Boons applied to player's group var otherPlayersInGroup = log.PlayerList .Where(p => p.Group == Group && InstID != p.InstID) .ToList(); _groupBuffs = GetBoonsForPlayers(otherPlayersInGroup, log); // Boons applied to other groups var offGroupPlayers = log.PlayerList.Where(p => p.Group != Group).ToList(); _offGroupBuffs = GetBoonsForPlayers(offGroupPlayers, log); // Boons applied to squad var otherPlayers = log.PlayerList.Where(p => p.InstID != InstID).ToList(); _squadBuffs = GetBoonsForPlayers(otherPlayers, log); }
private List <Dictionary <long, FinalBuffs> > GetBoonsForPlayers(List <Player> playerList, ParsedLog log) { List <Dictionary <long, FinalBuffs> > uptimesByPhase = new List <Dictionary <long, FinalBuffs> >(); List <PhaseData> phases = log.FightData.GetPhases(log); for (int phaseIndex = 0; phaseIndex < phases.Count; phaseIndex++) { PhaseData phase = phases[phaseIndex]; long fightDuration = phase.End - phase.Start; Dictionary <Player, BoonDistribution> boonDistributions = new Dictionary <Player, BoonDistribution>(); foreach (Player p in playerList) { boonDistributions[p] = p.GetBoonDistribution(log, phaseIndex); } HashSet <Boon> boonsToTrack = new HashSet <Boon>(boonDistributions.SelectMany(x => x.Value).Select(x => log.Boons.BoonsByIds[x.Key])); Dictionary <long, FinalBuffs> final = new Dictionary <long, FinalBuffs>(); foreach (Boon boon in boonsToTrack) { long totalGeneration = 0; long totalOverstack = 0; long totalWasted = 0; long totalUnknownExtension = 0; long totalExtension = 0; long totalExtended = 0; bool hasGeneration = false; foreach (BoonDistribution boons in boonDistributions.Values) { if (boons.ContainsKey(boon.ID)) { hasGeneration = hasGeneration || boons.HasSrc(boon.ID, AgentItem); totalGeneration += boons.GetGeneration(boon.ID, AgentItem); totalOverstack += boons.GetOverstack(boon.ID, AgentItem); totalWasted += boons.GetWaste(boon.ID, AgentItem); totalUnknownExtension += boons.GetUnknownExtension(boon.ID, AgentItem); totalExtension += boons.GetExtension(boon.ID, AgentItem); totalExtended += boons.GetExtended(boon.ID, AgentItem); } } if (hasGeneration) { FinalBuffs uptime = new FinalBuffs(); final[boon.ID] = uptime; if (boon.Type == Boon.BoonType.Duration) { uptime.Generation = Math.Round(100.0 * totalGeneration / fightDuration / playerList.Count, GeneralHelper.BoonDigit); uptime.Overstack = Math.Round(100.0 * (totalOverstack + totalGeneration) / fightDuration / playerList.Count, GeneralHelper.BoonDigit); uptime.Wasted = Math.Round(100.0 * (totalWasted) / fightDuration / playerList.Count, GeneralHelper.BoonDigit); uptime.UnknownExtended = Math.Round(100.0 * (totalUnknownExtension) / fightDuration / playerList.Count, GeneralHelper.BoonDigit); uptime.ByExtension = Math.Round(100.0 * (totalExtension) / fightDuration / playerList.Count, GeneralHelper.BoonDigit); uptime.Extended = Math.Round(100.0 * (totalExtended) / fightDuration / playerList.Count, GeneralHelper.BoonDigit); } else if (boon.Type == Boon.BoonType.Intensity) { uptime.Generation = Math.Round((double)totalGeneration / fightDuration / playerList.Count, GeneralHelper.BoonDigit); uptime.Overstack = Math.Round((double)(totalOverstack + totalGeneration) / fightDuration / playerList.Count, GeneralHelper.BoonDigit); uptime.Wasted = Math.Round((double)(totalWasted) / fightDuration / playerList.Count, GeneralHelper.BoonDigit); uptime.UnknownExtended = Math.Round((double)(totalUnknownExtension) / fightDuration / playerList.Count, GeneralHelper.BoonDigit); uptime.ByExtension = Math.Round((double)(totalExtension) / fightDuration / playerList.Count, GeneralHelper.BoonDigit); uptime.Extended = Math.Round((double)(totalExtended) / fightDuration / playerList.Count, GeneralHelper.BoonDigit); } } } uptimesByPhase.Add(final); } return(uptimesByPhase); }