public JsonBuffsUptimeData(FinalBuffs buffs, FinalBuffsDictionary buffsDictionary) { Uptime = buffs.Uptime; Presence = buffs.Presence; Generated = ConvertKeys(buffsDictionary.Generated); Overstacked = ConvertKeys(buffsDictionary.Overstacked); Wasted = ConvertKeys(buffsDictionary.Wasted); UnknownExtended = ConvertKeys(buffsDictionary.UnknownExtension); ByExtension = ConvertKeys(buffsDictionary.Extension); Extended = ConvertKeys(buffsDictionary.Extended); }
public static JsonBuffsUptimeData BuildJsonBuffsUptimeData(FinalBuffs buffs, FinalBuffsDictionary buffsDictionary) { var jsonBuffsUptimeData = new JsonBuffsUptimeData(); jsonBuffsUptimeData.Uptime = buffs.Uptime; jsonBuffsUptimeData.Presence = buffs.Presence; jsonBuffsUptimeData.Generated = ConvertKeys(buffsDictionary.Generated); jsonBuffsUptimeData.Overstacked = ConvertKeys(buffsDictionary.Overstacked); jsonBuffsUptimeData.Wasted = ConvertKeys(buffsDictionary.Wasted); jsonBuffsUptimeData.UnknownExtended = ConvertKeys(buffsDictionary.UnknownExtension); jsonBuffsUptimeData.ByExtension = ConvertKeys(buffsDictionary.Extension); jsonBuffsUptimeData.Extended = ConvertKeys(buffsDictionary.Extended); return(jsonBuffsUptimeData); }
private void CalculateBoons() { foreach (Player player in _log.PlayerList) { // Boons applied to self Dictionary <long, FinalBuffs>[] selfUptimesByPhase = new Dictionary <long, FinalBuffs> [_statistics.Phases.Count]; for (int phaseIndex = 0; phaseIndex < _statistics.Phases.Count; phaseIndex++) { Dictionary <long, FinalBuffs> final = new Dictionary <long, FinalBuffs>(); PhaseData phase = _statistics.Phases[phaseIndex]; BoonDistribution selfBoons = player.GetBoonDistribution(_log, phaseIndex); Dictionary <long, long> boonPresence = player.GetBoonPresence(_log, phaseIndex); Dictionary <long, long> condiPresence = player.GetCondiPresence(_log, phaseIndex); long fightDuration = phase.End - phase.Start; foreach (Boon boon in player.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, player.AgentItem); if (boon.Type == Boon.BoonType.Duration) { uptime.Uptime = Math.Round(100.0 * selfBoons.GetUptime(boon.ID) / fightDuration, 2); uptime.Generation = Math.Round(100.0 * generation / fightDuration, 2); uptime.Overstack = Math.Round(100.0 * (selfBoons.GetOverstack(boon.ID, player.AgentItem) + generation) / fightDuration, 2); uptime.Wasted = Math.Round(100.0 * selfBoons.GetWaste(boon.ID, player.AgentItem) / fightDuration, 2); uptime.UnknownExtended = Math.Round(100.0 * selfBoons.GetUnknownExtension(boon.ID, player.AgentItem) / fightDuration, 2); uptime.ByExtension = Math.Round(100.0 * selfBoons.GetExtension(boon.ID, player.AgentItem) / fightDuration, 2); uptime.Extended = Math.Round(100.0 * selfBoons.GetExtended(boon.ID, player.AgentItem) / fightDuration, 2); } else if (boon.Type == Boon.BoonType.Intensity) { uptime.Uptime = Math.Round((double)selfBoons.GetUptime(boon.ID) / fightDuration, 2); uptime.Generation = Math.Round((double)generation / fightDuration, 2); uptime.Overstack = Math.Round((double)(selfBoons.GetOverstack(boon.ID, player.AgentItem) + generation) / fightDuration, 2); uptime.Wasted = Math.Round((double)selfBoons.GetWaste(boon.ID, player.AgentItem) / fightDuration, 2); uptime.UnknownExtended = Math.Round((double)selfBoons.GetUnknownExtension(boon.ID, player.AgentItem) / fightDuration, 2); uptime.ByExtension = Math.Round((double)selfBoons.GetExtension(boon.ID, player.AgentItem) / fightDuration, 2); uptime.Extended = Math.Round((double)selfBoons.GetExtended(boon.ID, player.AgentItem) / fightDuration, 2); if (boonPresence.TryGetValue(boon.ID, out long presenceValueBoon)) { uptime.Presence = Math.Round(100.0 * presenceValueBoon / fightDuration, 2); } else if (condiPresence.TryGetValue(boon.ID, out long presenceValueCondi)) { uptime.Presence = Math.Round(100.0 * presenceValueCondi / fightDuration, 2); } } } } selfUptimesByPhase[phaseIndex] = final; } _statistics.SelfBuffs[player] = selfUptimesByPhase; // Boons applied to player's group var otherPlayersInGroup = _log.PlayerList .Where(p => p.Group == player.Group && player.InstID != p.InstID) .ToList(); _statistics.GroupBuffs[player] = GetBoonsForPlayers(otherPlayersInGroup, player); // Boons applied to other groups var offGroupPlayers = _log.PlayerList.Where(p => p.Group != player.Group).ToList(); _statistics.OffGroupBuffs[player] = GetBoonsForPlayers(offGroupPlayers, player); // Boons applied to squad var otherPlayers = _log.PlayerList.Where(p => p.InstID != player.InstID).ToList(); _statistics.SquadBuffs[player] = GetBoonsForPlayers(otherPlayers, player); } }
private Dictionary <long, FinalBuffs>[] GetBoonsForPlayers(List <Player> playerList, Player player) { Dictionary <long, FinalBuffs>[] uptimesByPhase = new Dictionary <long, FinalBuffs> [_statistics.Phases.Count]; for (int phaseIndex = 0; phaseIndex < _statistics.Phases.Count; phaseIndex++) { PhaseData phase = _statistics.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 => Boon.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, player.AgentItem); totalGeneration += boons.GetGeneration(boon.ID, player.AgentItem); totalOverstack += boons.GetOverstack(boon.ID, player.AgentItem); totalWasted += boons.GetWaste(boon.ID, player.AgentItem); totalUnknownExtension += boons.GetUnknownExtension(boon.ID, player.AgentItem); totalExtension += boons.GetExtension(boon.ID, player.AgentItem); totalExtended += boons.GetExtended(boon.ID, player.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, 2); uptime.Overstack = Math.Round(100.0 * (totalOverstack + totalGeneration) / fightDuration / playerList.Count, 2); uptime.Wasted = Math.Round(100.0 * (totalWasted) / fightDuration / playerList.Count, 2); uptime.UnknownExtended = Math.Round(100.0 * (totalUnknownExtension) / fightDuration / playerList.Count, 2); uptime.ByExtension = Math.Round(100.0 * (totalExtension) / fightDuration / playerList.Count, 2); uptime.Extended = Math.Round(100.0 * (totalExtended) / fightDuration / playerList.Count, 2); } else if (boon.Type == Boon.BoonType.Intensity) { uptime.Generation = Math.Round((double)totalGeneration / fightDuration / playerList.Count, 2); uptime.Overstack = Math.Round((double)(totalOverstack + totalGeneration) / fightDuration / playerList.Count, 2); uptime.Wasted = Math.Round((double)(totalWasted) / fightDuration / playerList.Count, 2); uptime.UnknownExtended = Math.Round((double)(totalUnknownExtension) / fightDuration / playerList.Count, 2); uptime.ByExtension = Math.Round((double)(totalExtension) / fightDuration / playerList.Count, 2); uptime.Extended = Math.Round((double)(totalExtended) / fightDuration / playerList.Count, 2); } } } uptimesByPhase[phaseIndex] = final; } return(uptimesByPhase); }
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); }