private void PopulateBuildRecords() { buildStats = new Dictionary <string, BuildStats> { }; foreach (FileTraceManagment.MatchRecord match in matchHistory.MatchHistory.ToList()) { if (!Filter.CheckFilters(filterSelections, match, buildRecords, session, translations)) { continue; } if (!buildStats.ContainsKey(match.MatchData.LocalPlayer.BuildHash)) { buildStats.Add(match.MatchData.LocalPlayer.BuildHash, new BuildStats { buildHash = match.MatchData.LocalPlayer.BuildHash, powerScore = match.MatchData.LocalPlayer.PowerScore, stats = match.MatchData.LocalPlayer.Stats }); } else { buildStats[match.MatchData.LocalPlayer.BuildHash].stats = FileTraceManagment.SumStats(buildStats[match.MatchData.LocalPlayer.BuildHash].stats, match.MatchData.LocalPlayer.Stats); } } Filter.PopulateFilters(filterSelections, cb_game_modes, cb_grouped, cb_power_score, cb_versions, cb_weapons, cb_movement, cb_cabins, cb_modules); }
public void refersh_history_table() { if (!force_refresh) { new_selection = Filter.FilterString(filter_selections); if (new_selection == previous_selection) { return; } } force_refresh = false; previous_selection = new_selection; Filter.ResetFilters(filter_selections); dg_match_history_view.Rows.Clear(); dg_match_history_view.AllowUserToAddRows = true; foreach (FileTraceManagment.MatchRecord match in history.ToList()) { if (!Filter.CheckFilters(filter_selections, match, build_records, session, translations)) { continue; } DataGridViewRow row = (DataGridViewRow)dg_match_history_view.Rows[0].Clone(); TimeSpan duration = match.MatchData.MatchEnd - match.MatchData.MatchStart; row.Cells[0].Value = FileTraceManagment.DecodeMatchType(match.MatchData.MatchType); row.Cells[1].Value = match.MatchData.MatchStart; row.Cells[2].Value = match.MatchData.MatchEnd - match.MatchData.MatchStart; row.Cells[3].Value = Translate.TranslateString(match.MatchData.MapDesc, session, translations); row.Cells[4].Value = match.MatchData.LocalPlayer.BuildHash; row.Cells[5].Value = match.MatchData.LocalPlayer.PowerScore; row.Cells[6].Value = match.MatchData.LocalPlayer.Stats.Score; row.Cells[7].Value = match.MatchData.LocalPlayer.Stats.Kills; row.Cells[8].Value = match.MatchData.LocalPlayer.Stats.Assists; row.Cells[9].Value = match.MatchData.LocalPlayer.Stats.DroneKills; row.Cells[10].Value = Math.Round(match.MatchData.LocalPlayer.Stats.Damage, 1); row.Cells[11].Value = Math.Round(match.MatchData.LocalPlayer.Stats.DamageTaken, 1); row.Cells[12].Value = match.MatchData.GameResult; row.Cells[13].Value = string.Join(",", match.MatchData.MatchRewards.Where(x => x.Key.ToLower().Contains("xp") == false && x.Key != "score").Select(x => Translate.TranslateString(x.Key, session, translations) + ":" + x.Value.ToString())); dg_match_history_view.Rows.Add(row); } dg_match_history_view.AllowUserToAddRows = false; dg_match_history_view.Sort(dg_match_history_view.SortedColumn ?? dg_match_history_view.Columns[1], ((int)dg_match_history_view.SortOrder) != 1 ? ListSortDirection.Descending : ListSortDirection.Ascending); Filter.PopulateFilters(filter_selections, cb_game_modes, cb_grouped, cb_power_score, cb_versions, cb_weapons, cb_movement, cb_cabins, cb_modules); }
public void populate_parts_list() { this.dg_available_parts.Rows.Clear(); List <unique_parts> part_list = new List <unique_parts> { }; FileTraceManagment ftm = new FileTraceManagment { }; int engineer_level = session.EngineerLevel; int lunatics_level = session.LunaticsLevel; int nomads_level = session.NomadsLevel; int scavengers_level = session.ScavengersLevel; int steppenwolfs_level = session.SteppenWolfLevel; int dawns_children_level = session.DawnsChildrenLevel; int firestarts_level = session.FireStartersLevel; int founders_level = session.FoundersLevel; bool prestigue_parts = session.IncludePresitgueParts; for (int i = 0; i < master_part_list.Count(); i++) { if (master_part_list[i].Faction == GlobalData.ENGINEER_FACTION && master_part_list[i].Level > engineer_level) { continue; } if (master_part_list[i].Faction == GlobalData.LUNATICS_FACTION && master_part_list[i].Level > lunatics_level) { continue; } if (master_part_list[i].Faction == GlobalData.NOMADS_FACTION && master_part_list[i].Level > nomads_level) { continue; } if (master_part_list[i].Faction == GlobalData.SCAVENGERS_FACTION && master_part_list[i].Level > scavengers_level) { continue; } if (master_part_list[i].Faction == GlobalData.STEPPENWOLFS_FACTION && master_part_list[i].Level > steppenwolfs_level) { continue; } if (master_part_list[i].Faction == GlobalData.DAWNS_CHILDREN_FACTION && master_part_list[i].Level > dawns_children_level) { continue; } if (master_part_list[i].Faction == GlobalData.FIRESTARTERS_FACTION && master_part_list[i].Level > firestarts_level) { continue; } if (master_part_list[i].Faction == GlobalData.FOUNDERS_FACTION && master_part_list[i].Level > founders_level) { continue; } //if (master_part_list[i].faction == global_data.PRESTIGUE_PACK_FACTION && prestigue_parts == true) // continue; if ((int)num_min_dura.Value != 0 && master_part_list[i].PartDurability < num_min_dura.Value) { continue; } if (!chk_include_bumpers.Checked && master_part_list[i].HullDurability == 0) { continue; } if (part_list.Exists(x => x.part.Description.Contains(master_part_list[i].Description))) { part_list.Find(x => x.part.Description.Contains(master_part_list[i].Description)).part_count++; continue; } part_list.Add(new unique_parts { part_count = 1, part = master_part_list[i] }); } this.dg_available_parts.AllowUserToAddRows = true; foreach (unique_parts part in part_list) { DataGridViewRow row = (DataGridViewRow)this.dg_available_parts.Rows[0].Clone(); row.Cells[0].Value = part.part.Description.ToString(); row.Cells[1].Value = part.part_count; row.Cells[2].Value = part.part.Faction == GlobalData.PRESTIGUE_PACK_FACTION ? ftm.DecodeFactionName(part.part.Level) + " - Prestigue" : ftm.DecodeFactionName(part.part.Faction); row.Cells[3].Value = part.part.Faction == GlobalData.PRESTIGUE_PACK_FACTION ? 0 : part.part.Level; row.Cells[4].Value = part.part.PartDurability; row.Cells[5].Value = part.part.HullDurability; row.Cells[6].Value = part.part.Mass; row.Cells[7].Value = part.part.PowerScore; row.Cells[8].Value = part.part.PassThrough; row.Cells[9].Value = part.part.BulletResistance; row.Cells[10].Value = part.part.MeleeResistance; row.Cells[11].Value = Math.Round((double)part.part.PartDurability / (double)part.part.PowerScore, 2); row.Cells[12].Value = Math.Round((double)part.part.PartDurability / (double)part.part.Mass, 2); row.Cells[13].Value = Math.Round((double)part.part.Mass / (double)part.part.PowerScore, 2); row.Cells[14].Value = Math.Round((double)part.part.Mass / (double)part.part.PartDurability, 2); row.Cells[15].Value = Math.Round((double)part.part.PowerScore / (double)part.part.PartDurability, 2); row.Cells[16].Value = Math.Round((double)part.part.PowerScore / (double)part.part.Mass, 2); this.dg_available_parts.Rows.Add(row); } this.dg_available_parts.AllowUserToAddRows = false; }
public void populate_meta_detail_screen() { if (!force_refresh) { new_selection = Filter.FilterString(filter_selections); if (new_selection == previous_selection) { return; } } force_refresh = false; total_games = 0; total_wins = 0; master_groupings = new List <master_meta_grouping> { }; previous_selection = new_selection; Filter.ResetFilters(filter_selections); initialize_user_profile(); foreach (FileTraceManagment.MatchRecord match in match_history.ToList()) { if (!Filter.CheckFilters(filter_selections, match, build_records, session, translations)) { continue; } /* begin calc */ total_games += 1; List <meta_grouping> match_level_grouping = new List <meta_grouping> { }; if (match.MatchData.LocalPlayer.Team != match.MatchData.WinningTeam && match.MatchData.WinningTeam != -1) { total_wins += 1; /* enemy wins */ } foreach (FileTraceManagment.RoundRecord round in match.MatchData.RoundRecords) { List <meta_grouping> round_level_grouping = new List <meta_grouping> { }; foreach (FileTraceManagment.Player player in round.Players) { #region player_level if (player.Team == match.MatchData.LocalPlayer.Team) { continue; } if (!build_records.ContainsKey(player.BuildHash)) { continue; } if (!chk_bot_filter.Checked && player.Bot == 1) { continue; } if (!chk_bot_filter.Checked && player.PowerScore >= 22000) { continue; } if (!round.Players.Any(x => x.Nickname == player.Nickname)) { continue; } if (!build_records.ContainsKey(round.Players.FirstOrDefault(x => x.Nickname == player.Nickname).BuildHash)) { continue; } List <meta_grouping> player_level_grouping = new List <meta_grouping> { }; FileTraceManagment.BuildRecord build = build_records[round.Players.First(x => x.Nickname == player.Nickname).BuildHash]; if (chk_weapon_filter.Checked) { foreach (PartLoader.Weapon weapon in build.Weapons) { meta_grouping new_group = new_grouping(); new_group.weapon = Translate.TranslateString(weapon.Name, session, translations); new_group.stats = round.Players.First(x => x.Nickname == player.Nickname).Stats; player_level_grouping.Add(new_group); } } if (chk_movement_filter.Checked) { if (player_level_grouping == null || !player_level_grouping.Any()) { foreach (PartLoader.Movement movement in build.Movement) { meta_grouping new_group = new_grouping(); new_group.movement = Translate.TranslateString(movement.Name, session, translations); new_group.stats = round.Players.First(x => x.Nickname == player.Nickname).Stats; player_level_grouping.Add(new_group); } } else { foreach (meta_grouping sub_group in player_level_grouping.ToList()) { for (int i = 0; i < build.Movement.Count(); i++) { if (i == 0) { sub_group.movement = Translate.TranslateString(build.Movement[i].Name, session, translations); } else { meta_grouping new_group = new_grouping(); new_group.weapon = sub_group.weapon; new_group.movement = Translate.TranslateString(build.Movement[i].Name, session, translations); new_group.stats = round.Players.First(x => x.Nickname == player.Nickname).Stats; player_level_grouping.Add(new_group); } } } } } if (chk_cabin_filter.Checked) { if (player_level_grouping == null || !player_level_grouping.Any()) { meta_grouping new_group = new_grouping(); new_group.cabin = Translate.TranslateString(build.Cabin.Name, session, translations); new_group.stats = round.Players.First(x => x.Nickname == player.Nickname).Stats; player_level_grouping.Add(new_group); } else { foreach (meta_grouping sub_group in player_level_grouping) { sub_group.cabin = Translate.TranslateString(build.Cabin.Name, session, translations); } } } if (chk_map_filter.Checked) { if (player_level_grouping == null || !player_level_grouping.Any()) { meta_grouping new_group = new_grouping(); new_group.map = Translate.TranslateString(match.MatchData.MapName, session, translations); new_group.stats = round.Players.First(x => x.Nickname == player.Nickname).Stats; player_level_grouping.Add(new_group); } else { foreach (meta_grouping sub_group in player_level_grouping) { sub_group.map = Translate.TranslateString(match.MatchData.MapName, session, translations); } } } #endregion foreach (meta_grouping sub_group in player_level_grouping) { bool found = false; for (int i = 0; i < round_level_grouping.Count(); i++) { if (round_level_grouping[i].cabin == sub_group.cabin && round_level_grouping[i].movement == sub_group.movement && round_level_grouping[i].weapon == sub_group.weapon && round_level_grouping[i].map == sub_group.map) { found = true; round_level_grouping[i].total_seen += 1; round_level_grouping[i].stats = FileTraceManagment.SumStats(round_level_grouping[i].stats, round.Players.First(x => x.Nickname == player.Nickname).Stats); } } if (!found) { round_level_grouping.Add(sub_group); } } } foreach (meta_grouping sub_group in round_level_grouping) { bool found = false; for (int i = 0; i < match_level_grouping.Count(); i++) { if (match_level_grouping[i].cabin == sub_group.cabin && match_level_grouping[i].movement == sub_group.movement && match_level_grouping[i].weapon == sub_group.weapon && match_level_grouping[i].map == sub_group.map) { found = true; match_level_grouping[i].rounds += 1; match_level_grouping[i].total_seen += sub_group.total_seen; match_level_grouping[i].stats = FileTraceManagment.SumStats(match_level_grouping[i].stats, sub_group.stats); } } if (!found) { match_level_grouping.Add(sub_group); } } } foreach (meta_grouping sub_group in match_level_grouping) { bool found = false; for (int i = 0; i < master_groupings.Count(); i++) { if (master_groupings[i].group.cabin == sub_group.cabin && master_groupings[i].group.movement == sub_group.movement && master_groupings[i].group.weapon == sub_group.weapon && master_groupings[i].group.map == sub_group.map) { found = true; master_groupings[i].games += 1; master_groupings[i].rounds += sub_group.rounds; master_groupings[i].total_seen += sub_group.total_seen; if (match.MatchData.LocalPlayer.Team != match.MatchData.WinningTeam && match.MatchData.WinningTeam != -1) { master_groupings[i].wins += 1; } master_groupings[i].group.stats = FileTraceManagment.SumStats(master_groupings[i].group.stats, sub_group.stats); } } if (!found) { if (match.MatchData.LocalPlayer.Team != match.MatchData.WinningTeam && match.MatchData.WinningTeam != -1) { master_groupings.Add(new master_meta_grouping { games = 1, wins = 1, rounds = sub_group.rounds, group = sub_group }); } else { master_groupings.Add(new master_meta_grouping { games = 1, wins = 0, rounds = sub_group.rounds, group = sub_group }); } } } } global_enemy_win_percent = (double)total_games > 0 ? (double)total_wins / (double)total_games : 0.0; lb_global_percentage.Text = string.Format("{0}%", Math.Round(global_enemy_win_percent * 100, 1)); lb_total_game.Text = total_games.ToString(); populate_meta_detail_screen_elements(); Filter.PopulateFilters(filter_selections, cb_game_modes, cb_grouped, cb_power_score, cb_versions, cb_weapons, cb_movement, cb_cabins, cb_modules); }
private meta_grouping new_grouping() { return(new meta_grouping { map = "", cabin = "", movement = "", weapon = "", rounds = 1, total_seen = 1, stats = FileTraceManagment.NewStats() }); }
public static void AssignStats(FileTraceManagment.SessionStats currentSession, OverlayWriter writer, Dictionary <string, Dictionary <string, Translate.Translation> > translation, string game_mode) { FileTraceManagment.Stats stats = FileTraceManagment.NewStats(); if (currentSession.TwitchSettings.ToggleOverviewTimeRanges) { if (currentSession.TwitchSettings.OverviewTimeRange == 7.0) { currentSession.TwitchSettings.OverviewTimeRange = 31.0; } else if (currentSession.TwitchSettings.OverviewTimeRange == 31.0) { currentSession.TwitchSettings.OverviewTimeRange = 365.0; } else if (currentSession.TwitchSettings.OverviewTimeRange == 365.0) { currentSession.TwitchSettings.OverviewTimeRange = 1.0; } else if (currentSession.TwitchSettings.OverviewTimeRange == 1.0) { currentSession.TwitchSettings.OverviewTimeRange = 7.0; } } else { currentSession.TwitchSettings.OverviewTimeRange = currentSession.TwitchSettings.DefaultTimeRange; } DateTime timeCutoff = DateTime.Now.AddDays(currentSession.TwitchSettings.OverviewTimeRange * -1); foreach (FileTraceManagment.MatchRecord match in currentSession.MatchHistory) { if (match.MatchData.MatchStart < timeCutoff) { continue; } if (match.MatchData.MatchTypeDesc != game_mode) { continue; } stats = FileTraceManagment.SumStats(stats, match.MatchData.LocalPlayer.Stats); } if (stats.Games > 0) { writer.AddHeader(string.Format(@"{0,3} Day Stats for {1}", currentSession.TwitchSettings.OverviewTimeRange, game_mode), "day_stats"); writer.AddHorizontalRow(); writer.AddLine(string.Format(@"{0,16} {1,8}", "Games", stats.Games), "day_stats games"); writer.AddLine(string.Format(@"{0,16} {1,8} {2:P1}", "W/L %", string.Format(@"{0,4}/{1,-4}", stats.Wins, stats.Losses), (double)stats.Wins / (double)stats.Games), "day_stats win_lose_ratio"); writer.AddLine(string.Format(@"{0,16} {1,8} {2:N1}", "K/D ", string.Format(@"{0,4}/{1,-4}", stats.Kills, stats.Deaths), (double)stats.Kills / (double)stats.Deaths), "day_stats kill_death_ratio"); writer.AddLine(string.Format(@"{0,16} {1,8} {2:N1}", "K/G ", string.Format(@"{0,4}/{1,-4}", stats.Kills, stats.Games), (double)stats.Kills / (double)stats.Games), "day_stats kill_game_ratio"); writer.AddLine(string.Format(@"{0,16} {1,8:N1}", "Avg Dmg", stats.Damage / (double)stats.Rounds), "day_stats avg_dmg"); writer.AddLine(string.Format(@"{0,16} {1,8:N1}", "Avg Dmg Rec", stats.DamageTaken / (double)stats.Rounds), "day_stats avg_dmg_rec"); writer.AddLine(string.Format(@"{0,16} {1,8:N1}", "Avg Score", stats.Score / (double)stats.Rounds), "day_stats avg_score"); } }