public static JsonGameplayStats BuildJsonGameplayStats(FinalGameplayStats stats) { var jsonGameplayStats = new JsonGameplayStats(); FillJsonGamePlayStats(jsonGameplayStats, stats); return(jsonGameplayStats); }
private static void FillJsonGamePlayStats(JsonGameplayStats jsonGameplayStats, FinalGameplayStats stats) { jsonGameplayStats.TotalDamageCount = stats.TotalDamageCount; jsonGameplayStats.DirectDamageCount = stats.DirectDamageCount; jsonGameplayStats.ConnectedDirectDamageCount = stats.ConnectedDirectDamageCount; jsonGameplayStats.CritableDirectDamageCount = stats.CritableDirectDamageCount; jsonGameplayStats.CriticalRate = stats.CriticalCount; jsonGameplayStats.CriticalDmg = stats.CriticalDmg; jsonGameplayStats.FlankingRate = stats.FlankingCount; jsonGameplayStats.GlanceRate = stats.GlanceCount; jsonGameplayStats.Missed = stats.Missed; jsonGameplayStats.Blocked = stats.Blocked; jsonGameplayStats.Evaded = stats.Evaded; jsonGameplayStats.Interrupts = stats.Interrupts; jsonGameplayStats.Invulned = stats.Invulned; jsonGameplayStats.Killed = stats.Killed; jsonGameplayStats.Downed = stats.Downed; }
public JsonPlayer(Player player, ParsedLog log, Dictionary <string, JsonLog.SkillDesc> skillDesc, Dictionary <string, JsonLog.BuffDesc> buffDesc, Dictionary <string, JsonLog.DamageModDesc> damageModDesc, Dictionary <string, HashSet <long> > personalBuffs) : base(player, log, skillDesc, buffDesc) { List <PhaseData> phases = log.FightData.GetPhases(log); // Account = player.Account; Weapons = player.GetWeaponsArray(log).Select(w => w ?? "Unknown").ToArray(); Group = player.Group; Profession = player.Prof; ActiveTimes = phases.Select(x => x.GetActorActiveDuration(player, log)).ToList(); // Support = player.GetPlayerSupport(log).Select(x => new JsonPlayerSupport(x)).ToArray(); TargetDamage1S = new List <int> [log.FightData.Logic.Targets.Count][]; DpsTargets = new JsonDPS[log.FightData.Logic.Targets.Count][]; StatsTargets = new JsonGameplayStats[log.FightData.Logic.Targets.Count][]; TargetDamageDist = new List <JsonDamageDist> [log.FightData.Logic.Targets.Count][]; for (int j = 0; j < log.FightData.Logic.Targets.Count; j++) { NPC target = log.FightData.Logic.Targets[j]; var dpsGraphList = new List <int> [phases.Count]; var targetDamageDistList = new List <JsonDamageDist> [phases.Count]; for (int i = 0; i < phases.Count; i++) { PhaseData phase = phases[i]; if (log.ParserSettings.RawTimelineArrays) { dpsGraphList[i] = player.Get1SDamageList(log, i, phase, target); } targetDamageDistList[i] = JsonDamageDist.BuildJsonDamageDistList(player.GetDamageLogs(target, log, phase).Where(x => !x.HasDowned).GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList()), log, skillDesc, buffDesc); } if (log.ParserSettings.RawTimelineArrays) { TargetDamage1S[j] = dpsGraphList; } TargetDamageDist[j] = targetDamageDistList; DpsTargets[j] = player.GetDPSTarget(log, target).Select(x => new JsonDPS(x)).ToArray(); StatsTargets[j] = player.GetGameplayStats(log, target).Select(x => new JsonGameplayStats(x)).ToArray(); } // BuffUptimes = GetPlayerJsonBuffsUptime(player, player.GetBuffs(log, BuffEnum.Self), player.GetBuffsDictionary(log), log, buffDesc, personalBuffs); SelfBuffs = GetPlayerBuffGenerations(player.GetBuffs(log, BuffEnum.Self), log, buffDesc); GroupBuffs = GetPlayerBuffGenerations(player.GetBuffs(log, BuffEnum.Group), log, buffDesc); OffGroupBuffs = GetPlayerBuffGenerations(player.GetBuffs(log, BuffEnum.OffGroup), log, buffDesc); SquadBuffs = GetPlayerBuffGenerations(player.GetBuffs(log, BuffEnum.Squad), log, buffDesc); // BuffUptimesActive = GetPlayerJsonBuffsUptime(player, player.GetActiveBuffs(log, BuffEnum.Self), player.GetBuffsDictionary(log), log, buffDesc, personalBuffs); SelfBuffsActive = GetPlayerBuffGenerations(player.GetActiveBuffs(log, BuffEnum.Self), log, buffDesc); GroupBuffsActive = GetPlayerBuffGenerations(player.GetActiveBuffs(log, BuffEnum.Group), log, buffDesc); OffGroupBuffsActive = GetPlayerBuffGenerations(player.GetActiveBuffs(log, BuffEnum.OffGroup), log, buffDesc); SquadBuffsActive = GetPlayerBuffGenerations(player.GetActiveBuffs(log, BuffEnum.Squad), log, buffDesc); // List <Consumable> consumables = player.GetConsumablesList(log, 0, log.FightData.FightEnd); if (consumables.Any()) { Consumables = new List <JsonConsumable>(); foreach (Consumable food in consumables) { if (!buffDesc.ContainsKey("b" + food.Buff.ID)) { buffDesc["b" + food.Buff.ID] = new JsonLog.BuffDesc(food.Buff); } Consumables.Add(new JsonConsumable(food)); } } // List <DeathRecap> deathRecaps = player.GetDeathRecaps(log); if (deathRecaps.Any()) { DeathRecap = deathRecaps.Select(x => new JsonDeathRecap(x)).ToList(); } // DamageModifiers = JsonDamageModifierData.GetDamageModifiers(player.GetDamageModifierStats(log, null), log, damageModDesc); DamageModifiersTarget = JsonDamageModifierData.GetDamageModifiersTarget(player, log, damageModDesc); }