private void SetBuffs(ParsedEvtcLog log) { _buffs = new List <Dictionary <long, FinalBuffs> >(); List <PhaseData> phases = log.FightData.GetPhases(log); for (int phaseIndex = 0; phaseIndex < phases.Count; phaseIndex++) { BuffDistribution buffDistribution = GetBuffDistribution(log, phaseIndex); var rates = new Dictionary <long, FinalBuffs>(); _buffs.Add(rates); Dictionary <long, long> buffPresence = GetBuffPresence(log, phaseIndex); PhaseData phase = phases[phaseIndex]; long phaseDuration = phase.DurationInMS; foreach (Buff buff in TrackedBuffs) { if (buffDistribution.ContainsKey(buff.ID)) { rates[buff.ID] = new FinalBuffs(buff, buffDistribution, buffPresence, phaseDuration); } } } }
private static double GetDistanceToTarget(Player player, ParsedEvtcLog log, PhaseData phase, List <Point3D> reference) { var positions = player.GetCombatReplayPolledPositions(log).Where(x => x.Time >= phase.Start && x.Time <= phase.End).ToList(); int offset = player.GetCombatReplayPolledPositions(log).Count(x => x.Time < phase.Start); if (positions.Count > 1 && reference.Count > 0) { var distances = new List <float>(); for (int time = 0; time < positions.Count; time++) { float deltaX = positions[time].X - reference[time + offset].X; float deltaY = positions[time].Y - reference[time + offset].Y; //float deltaZ = positions[time].Z - StackCenterPositions[time].Z; distances.Add((float)Math.Sqrt(deltaX * deltaX + deltaY * deltaY)); } return(distances.Sum() / distances.Count); } else { return(-1); } }
internal FinalSupportAll(ParsedEvtcLog log, PhaseData phase, AbstractSingleActor actor) : base(log, phase, actor, null) { long[] resArray = GetReses(log, actor, phase.Start, phase.End); Resurrects = (int)resArray[0]; ResurrectTime = resArray[1]; }
/// <summary> /// cached method for damage modifiers /// </summary> internal List <AbstractDamageEvent> GetHitDamageLogs(AbstractActor target, ParsedEvtcLog log, PhaseData phase) { if (!_damageLogsPerPhasePerTarget.TryGetValue(phase, out Dictionary <AbstractActor, List <AbstractDamageEvent> > targetDict)) { targetDict = new Dictionary <AbstractActor, List <AbstractDamageEvent> >(); _damageLogsPerPhasePerTarget[phase] = targetDict; } if (!targetDict.TryGetValue(target ?? ParserHelper._nullActor, out List <AbstractDamageEvent> dls)) { dls = GetDamageLogs(target, log, phase.Start, phase.End).Where(x => x.HasHit).ToList(); targetDict[target ?? ParserHelper._nullActor] = dls; } return(dls); }
internal FinalDPS(ParsedEvtcLog log, PhaseData phase, AbstractSingleActor actor, AbstractSingleActor target) { double phaseDuration = (phase.DurationInMS) / 1000.0; int damage; double dps = 0.0; List <AbstractDamageEvent> damageLogs = actor.GetDamageLogs(target, log, phase.Start, phase.End); //DPS damage = damageLogs.Sum(x => x.Damage); if (phaseDuration > 0) { dps = damage / phaseDuration; } Dps = (int)Math.Round(dps); Damage = damage; //Condi DPS damage = damageLogs.Sum(x => x.IsCondi(log) ? x.Damage : 0); if (phaseDuration > 0) { dps = damage / phaseDuration; } CondiDps = (int)Math.Round(dps); CondiDamage = damage; //Power DPS damage = Damage - CondiDamage; if (phaseDuration > 0) { dps = damage / phaseDuration; } PowerDps = (int)Math.Round(dps); PowerDamage = damage; List <AbstractDamageEvent> actorDamageLogs = actor.GetJustActorDamageLogs(target, log, phase.Start, phase.End); // Actor DPS damage = actorDamageLogs.Sum(x => x.Damage); if (phaseDuration > 0) { dps = damage / phaseDuration; } ActorDps = (int)Math.Round(dps); ActorDamage = damage; //Actor Condi DPS damage = actorDamageLogs.Sum(x => x.IsCondi(log) ? x.Damage : 0); if (phaseDuration > 0) { dps = damage / phaseDuration; } ActorCondiDps = (int)Math.Round(dps); ActorCondiDamage = damage; //Actor Power DPS damage = ActorDamage - ActorCondiDamage; if (phaseDuration > 0) { dps = damage / phaseDuration; } ActorPowerDps = (int)Math.Round(dps); ActorPowerDamage = damage; }
public List <AbstractDamageEvent> GetHitDamageLogs(Player p, ParsedEvtcLog log, NPC t, PhaseData phase) { switch (_srcType) { case DamageType.All: return(_dmgSrc == DamageSource.All ? p.GetHitDamageLogs(t, log, phase) : p.GetJustActorHitDamageLogs(t, log, phase)); case DamageType.Condition: return((_dmgSrc == DamageSource.All ? p.GetHitDamageLogs(t, log, phase) : p.GetJustActorHitDamageLogs(t, log, phase)).Where(x => x.IsCondi(log)).ToList()); case DamageType.Power: default: return((_dmgSrc == DamageSource.All ? p.GetHitDamageLogs(t, log, phase) : p.GetJustActorHitDamageLogs(t, log, phase)).Where(x => !x.IsCondi(log)).ToList()); } }
internal static (List <Dictionary <long, FinalPlayerBuffs> >, List <Dictionary <long, FinalPlayerBuffs> >) GetBuffsForPlayers(List <Player> playerList, ParsedEvtcLog log, AgentItem agentItem) { var uptimesByPhase = new List <Dictionary <long, FinalPlayerBuffs> >(); var uptimesActiveByPhase = new List <Dictionary <long, FinalPlayerBuffs> >(); List <PhaseData> phases = log.FightData.GetPhases(log); for (int phaseIndex = 0; phaseIndex < phases.Count; phaseIndex++) { PhaseData phase = phases[phaseIndex]; long phaseDuration = phase.DurationInMS; var boonDistributions = new Dictionary <Player, BuffDistribution>(); foreach (Player p in playerList) { boonDistributions[p] = p.GetBuffDistribution(log, phaseIndex); } var boonsToTrack = new HashSet <Buff>(boonDistributions.SelectMany(x => x.Value).Select(x => log.Buffs.BuffsByIds[x.Key])); var final = new Dictionary <long, FinalPlayerBuffs>(); var finalActive = new Dictionary <long, FinalPlayerBuffs>(); foreach (Buff boon in boonsToTrack) { double totalGeneration = 0; double totalOverstack = 0; double totalWasted = 0; double totalUnknownExtension = 0; double totalExtension = 0; double totalExtended = 0; // double totalActiveGeneration = 0; double totalActiveOverstack = 0; double totalActiveWasted = 0; double totalActiveUnknownExtension = 0; double totalActiveExtension = 0; double totalActiveExtended = 0; bool hasGeneration = false; int activePlayerCount = 0; foreach (KeyValuePair <Player, BuffDistribution> pair in boonDistributions) { BuffDistribution boons = pair.Value; long playerActiveDuration = phase.GetActorActiveDuration(pair.Key, log); if (boons.ContainsKey(boon.ID)) { hasGeneration = hasGeneration || boons.HasSrc(boon.ID, agentItem); double generation = boons.GetGeneration(boon.ID, agentItem); double overstack = boons.GetOverstack(boon.ID, agentItem); double wasted = boons.GetWaste(boon.ID, agentItem); double unknownExtension = boons.GetUnknownExtension(boon.ID, agentItem); double extension = boons.GetExtension(boon.ID, agentItem); double extended = boons.GetExtended(boon.ID, agentItem); totalGeneration += generation; totalOverstack += overstack; totalWasted += wasted; totalUnknownExtension += unknownExtension; totalExtension += extension; totalExtended += extended; if (playerActiveDuration > 0) { activePlayerCount++; totalActiveGeneration += generation / playerActiveDuration; totalActiveOverstack += overstack / playerActiveDuration; totalActiveWasted += wasted / playerActiveDuration; totalActiveUnknownExtension += unknownExtension / playerActiveDuration; totalActiveExtension += extension / playerActiveDuration; totalActiveExtended += extended / playerActiveDuration; } } } totalGeneration /= phaseDuration; totalOverstack /= phaseDuration; totalWasted /= phaseDuration; totalUnknownExtension /= phaseDuration; totalExtension /= phaseDuration; totalExtended /= phaseDuration; if (hasGeneration) { var uptime = new FinalPlayerBuffs(); var uptimeActive = new FinalPlayerBuffs(); final[boon.ID] = uptime; finalActive[boon.ID] = uptimeActive; if (boon.Type == BuffType.Duration) { uptime.Generation = Math.Round(100.0 * totalGeneration / playerList.Count, ParserHelper.BuffDigit); uptime.Overstack = Math.Round(100.0 * (totalOverstack + totalGeneration) / playerList.Count, ParserHelper.BuffDigit); uptime.Wasted = Math.Round(100.0 * (totalWasted) / playerList.Count, ParserHelper.BuffDigit); uptime.UnknownExtended = Math.Round(100.0 * (totalUnknownExtension) / playerList.Count, ParserHelper.BuffDigit); uptime.ByExtension = Math.Round(100.0 * (totalExtension) / playerList.Count, ParserHelper.BuffDigit); uptime.Extended = Math.Round(100.0 * (totalExtended) / playerList.Count, ParserHelper.BuffDigit); // if (activePlayerCount > 0) { uptimeActive.Generation = Math.Round(100.0 * totalActiveGeneration / activePlayerCount, ParserHelper.BuffDigit); uptimeActive.Overstack = Math.Round(100.0 * (totalActiveOverstack + totalActiveGeneration) / activePlayerCount, ParserHelper.BuffDigit); uptimeActive.Wasted = Math.Round(100.0 * (totalActiveWasted) / activePlayerCount, ParserHelper.BuffDigit); uptimeActive.UnknownExtended = Math.Round(100.0 * (totalActiveUnknownExtension) / activePlayerCount, ParserHelper.BuffDigit); uptimeActive.ByExtension = Math.Round(100.0 * (totalActiveExtension) / activePlayerCount, ParserHelper.BuffDigit); uptimeActive.Extended = Math.Round(100.0 * (totalActiveExtended) / activePlayerCount, ParserHelper.BuffDigit); } } else if (boon.Type == BuffType.Intensity) { uptime.Generation = Math.Round(totalGeneration / playerList.Count, ParserHelper.BuffDigit); uptime.Overstack = Math.Round((totalOverstack + totalGeneration) / playerList.Count, ParserHelper.BuffDigit); uptime.Wasted = Math.Round((totalWasted) / playerList.Count, ParserHelper.BuffDigit); uptime.UnknownExtended = Math.Round((totalUnknownExtension) / playerList.Count, ParserHelper.BuffDigit); uptime.ByExtension = Math.Round((totalExtension) / playerList.Count, ParserHelper.BuffDigit); uptime.Extended = Math.Round((totalExtended) / playerList.Count, ParserHelper.BuffDigit); // if (activePlayerCount > 0) { uptimeActive.Generation = Math.Round(totalActiveGeneration / activePlayerCount, ParserHelper.BuffDigit); uptimeActive.Overstack = Math.Round((totalActiveOverstack + totalActiveGeneration) / activePlayerCount, ParserHelper.BuffDigit); uptimeActive.Wasted = Math.Round((totalActiveWasted) / activePlayerCount, ParserHelper.BuffDigit); uptimeActive.UnknownExtended = Math.Round((totalActiveUnknownExtension) / activePlayerCount, ParserHelper.BuffDigit); uptimeActive.ByExtension = Math.Round((totalActiveExtension) / activePlayerCount, ParserHelper.BuffDigit); uptimeActive.Extended = Math.Round((totalActiveExtended) / activePlayerCount, ParserHelper.BuffDigit); } } } } uptimesByPhase.Add(final); uptimesActiveByPhase.Add(finalActive); } return(uptimesByPhase, uptimesActiveByPhase); }
internal static (List <Dictionary <long, FinalPlayerBuffs> >, List <Dictionary <long, FinalPlayerBuffs> >) GetBuffsForSelf(ParsedEvtcLog log, Player player) { var selfBuffsActive = new List <Dictionary <long, FinalPlayerBuffs> >(); var selfBuffs = new List <Dictionary <long, FinalPlayerBuffs> >(); List <PhaseData> phases = log.FightData.GetPhases(log); for (int phaseIndex = 0; phaseIndex < phases.Count; phaseIndex++) { var final = new Dictionary <long, FinalPlayerBuffs>(); var finalActive = new Dictionary <long, FinalPlayerBuffs>(); PhaseData phase = phases[phaseIndex]; BuffDistribution selfBoons = player.GetBuffDistribution(log, phaseIndex); Dictionary <long, long> buffPresence = player.GetBuffPresence(log, phaseIndex); long phaseDuration = phase.DurationInMS; long playerActiveDuration = phase.GetActorActiveDuration(player, log); foreach (Buff boon in player.TrackedBuffs) { if (selfBoons.ContainsKey(boon.ID)) { var uptime = new FinalPlayerBuffs { Uptime = 0, Generation = 0, Overstack = 0, Wasted = 0, UnknownExtended = 0, ByExtension = 0, Extended = 0 }; var uptimeActive = new FinalPlayerBuffs { Uptime = 0, Generation = 0, Overstack = 0, Wasted = 0, UnknownExtended = 0, ByExtension = 0, Extended = 0 }; final[boon.ID] = uptime; finalActive[boon.ID] = uptimeActive; double generationValue = selfBoons.GetGeneration(boon.ID, player.AgentItem); double uptimeValue = selfBoons.GetUptime(boon.ID); double overstackValue = selfBoons.GetOverstack(boon.ID, player.AgentItem); double wasteValue = selfBoons.GetWaste(boon.ID, player.AgentItem); double unknownExtensionValue = selfBoons.GetUnknownExtension(boon.ID, player.AgentItem); double extensionValue = selfBoons.GetExtension(boon.ID, player.AgentItem); double extendedValue = selfBoons.GetExtended(boon.ID, player.AgentItem); if (boon.Type == BuffType.Duration) { uptime.Uptime = Math.Round(100.0 * uptimeValue / phaseDuration, ParserHelper.BuffDigit); uptime.Generation = Math.Round(100.0 * generationValue / phaseDuration, ParserHelper.BuffDigit); uptime.Overstack = Math.Round(100.0 * (overstackValue + generationValue) / phaseDuration, ParserHelper.BuffDigit); uptime.Wasted = Math.Round(100.0 * wasteValue / phaseDuration, ParserHelper.BuffDigit); uptime.UnknownExtended = Math.Round(100.0 * unknownExtensionValue / phaseDuration, ParserHelper.BuffDigit); uptime.ByExtension = Math.Round(100.0 * extensionValue / phaseDuration, ParserHelper.BuffDigit); uptime.Extended = Math.Round(100.0 * extendedValue / phaseDuration, ParserHelper.BuffDigit); // if (playerActiveDuration > 0) { uptimeActive.Uptime = Math.Round(100.0 * uptimeValue / playerActiveDuration, ParserHelper.BuffDigit); uptimeActive.Generation = Math.Round(100.0 * generationValue / playerActiveDuration, ParserHelper.BuffDigit); uptimeActive.Overstack = Math.Round(100.0 * (overstackValue + generationValue) / playerActiveDuration, ParserHelper.BuffDigit); uptimeActive.Wasted = Math.Round(100.0 * wasteValue / playerActiveDuration, ParserHelper.BuffDigit); uptimeActive.UnknownExtended = Math.Round(100.0 * unknownExtensionValue / playerActiveDuration, ParserHelper.BuffDigit); uptimeActive.ByExtension = Math.Round(100.0 * extensionValue / playerActiveDuration, ParserHelper.BuffDigit); uptimeActive.Extended = Math.Round(100.0 * extendedValue / playerActiveDuration, ParserHelper.BuffDigit); } } else if (boon.Type == BuffType.Intensity) { uptime.Uptime = Math.Round(uptimeValue / phaseDuration, ParserHelper.BuffDigit); uptime.Generation = Math.Round(generationValue / phaseDuration, ParserHelper.BuffDigit); uptime.Overstack = Math.Round((overstackValue + generationValue) / phaseDuration, ParserHelper.BuffDigit); uptime.Wasted = Math.Round(wasteValue / phaseDuration, ParserHelper.BuffDigit); uptime.UnknownExtended = Math.Round(unknownExtensionValue / phaseDuration, ParserHelper.BuffDigit); uptime.ByExtension = Math.Round(extensionValue / phaseDuration, ParserHelper.BuffDigit); uptime.Extended = Math.Round(extendedValue / phaseDuration, ParserHelper.BuffDigit); // if (playerActiveDuration > 0) { uptimeActive.Uptime = Math.Round(uptimeValue / playerActiveDuration, ParserHelper.BuffDigit); uptimeActive.Generation = Math.Round(generationValue / playerActiveDuration, ParserHelper.BuffDigit); uptimeActive.Overstack = Math.Round((overstackValue + generationValue) / playerActiveDuration, ParserHelper.BuffDigit); uptimeActive.Wasted = Math.Round(wasteValue / playerActiveDuration, ParserHelper.BuffDigit); uptimeActive.UnknownExtended = Math.Round(unknownExtensionValue / playerActiveDuration, ParserHelper.BuffDigit); uptimeActive.ByExtension = Math.Round(extensionValue / playerActiveDuration, ParserHelper.BuffDigit); uptimeActive.Extended = Math.Round(extendedValue / playerActiveDuration, ParserHelper.BuffDigit); } // if (buffPresence.TryGetValue(boon.ID, out long presenceValueBoon)) { uptime.Presence = Math.Round(100.0 * presenceValueBoon / phaseDuration, ParserHelper.BuffDigit); // if (playerActiveDuration > 0) { uptimeActive.Presence = Math.Round(100.0 * presenceValueBoon / playerActiveDuration, ParserHelper.BuffDigit); } } } } } selfBuffs.Add(final); selfBuffsActive.Add(finalActive); } return(selfBuffs, selfBuffsActive); }
internal FinalGameplayStats(ParsedEvtcLog log, PhaseData phase, AbstractSingleActor actor, AbstractSingleActor target) { List <AbstractDamageEvent> dls = actor.GetJustActorDamageLogs(target, log, phase.Start, phase.End); foreach (AbstractDamageEvent dl in dls) { if (!(dl is NonDirectDamageEvent)) { if (dl.HasHit) { if (SkillItem.CanCrit(dl.SkillId, log.LogData.GW2Build)) { if (dl.HasCrit) { CriticalCount++; CriticalDmg += dl.Damage; } CritableDirectDamageCount++; } if (dl.IsFlanking) { FlankingCount++; } if (dl.HasGlanced) { GlanceCount++; } ConnectedDirectDamageCount++; } if (dl.HasInterrupted) { Interrupts++; } if (dl.IsBlind) { Missed++; } if (dl.IsEvaded) { Evaded++; } if (dl.IsBlocked) { Blocked++; } if (!dl.DoubleProcHit) { DirectDamageCount++; } } if (dl.IsAbsorbed) { Invulned++; } if (!dl.DoubleProcHit) { TotalDamageCount++; } } }