internal FinalGameplayStatsAll(ParsedEvtcLog log, long start, long end, AbstractSingleActor actor) : base(log, start, end, actor, null) { // If dummy actor, stop if (actor.IsFakeActor) { return; } long duration = end - start; foreach (AbstractCastEvent cl in actor.GetCastEvents(log, start, end)) { switch (cl.Status) { case AbstractCastEvent.AnimationStatus.Interrupted: Wasted++; TimeWasted += cl.SavedDuration; break; case AbstractCastEvent.AnimationStatus.Reduced: Saved++; TimeSaved += cl.SavedDuration; break; } if (cl.Skill.IsSwap) { SwapCount++; } } TimeSaved = Math.Round(TimeSaved / 1000.0, ParserHelper.TimeDigit); TimeWasted = -Math.Round(TimeWasted / 1000.0, ParserHelper.TimeDigit); double avgBoons = 0; foreach (long boonDuration in actor.GetBuffPresence(log, start, end).Where(x => log.Buffs.BuffsByIds[x.Key].Classification == BuffClassification.Boon).Select(x => x.Value)) { avgBoons += boonDuration; } AvgBoons = Math.Round(avgBoons / duration, ParserHelper.BuffDigit); long activeDuration = actor.GetActiveDuration(log, start, end); AvgActiveBoons = activeDuration > 0 ? Math.Round(avgBoons / activeDuration, ParserHelper.BuffDigit) : 0.0; double avgCondis = 0; foreach (long conditionDuration in actor.GetBuffPresence(log, start, end).Where(x => log.Buffs.BuffsByIds[x.Key].Classification == BuffClassification.Condition).Select(x => x.Value)) { avgCondis += conditionDuration; } AvgConditions = Math.Round(avgCondis / duration, ParserHelper.BuffDigit); AvgActiveConditions = activeDuration > 0 ? Math.Round(avgCondis / activeDuration, ParserHelper.BuffDigit) : 0.0; if (log.CombatData.HasMovementData && log.FriendlyAgents.Contains(actor.AgentItem) && actor.GetCombatReplayPolledPositions(log).Any(x => x.X > int.MinValue + 1)) { StackDist = GetDistanceToTarget(actor, log, start, end, log.StatisticsHelper.GetStackCenterPositions(log)); DistToCom = GetDistanceToTarget(actor, log, start, end, log.StatisticsHelper.GetStackCommanderPositions(log)); } }
internal static Dictionary <long, FinalActorBuffs>[] GetBuffsForSelf(ParsedEvtcLog log, AbstractSingleActor actor, long start, long end) { var buffs = new Dictionary <long, FinalActorBuffs>(); var activeBuffs = new Dictionary <long, FinalActorBuffs>(); BuffDistribution selfBuffs = actor.GetBuffDistribution(log, start, end); Dictionary <long, long> buffPresence = actor.GetBuffPresence(log, start, end); long phaseDuration = end - start; long playerActiveDuration = actor.GetActiveDuration(log, start, end); foreach (Buff boon in actor.GetTrackedBuffs(log)) { if (selfBuffs.HasBuffID(boon.ID)) { var uptime = new FinalActorBuffs { Uptime = 0, Generation = 0, Overstack = 0, Wasted = 0, UnknownExtended = 0, ByExtension = 0, Extended = 0 }; var uptimeActive = new FinalActorBuffs { Uptime = 0, Generation = 0, Overstack = 0, Wasted = 0, UnknownExtended = 0, ByExtension = 0, Extended = 0 }; buffs[boon.ID] = uptime; activeBuffs[boon.ID] = uptimeActive; double generationValue = selfBuffs.GetGeneration(boon.ID, actor.AgentItem); double uptimeValue = selfBuffs.GetUptime(boon.ID); double overstackValue = selfBuffs.GetOverstack(boon.ID, actor.AgentItem); double wasteValue = selfBuffs.GetWaste(boon.ID, actor.AgentItem); double unknownExtensionValue = selfBuffs.GetUnknownExtension(boon.ID, actor.AgentItem); double extensionValue = selfBuffs.GetExtension(boon.ID, actor.AgentItem); double extendedValue = selfBuffs.GetExtended(boon.ID, actor.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); } } } } } return(new Dictionary <long, FinalActorBuffs>[] { buffs, activeBuffs }); }