Exemple #1
0
        public void populate_match()
        {
            if (show_last_match)
            {
                match_data = previous_match_data;
            }
            else
            {
                match_data = historical_match_data;
            }

            reset_screen_elements();
            assign_teams();
            TimeSpan duration = match_data.MatchEnd - match_data.MatchStart;

            //MessageBox.Show(match_data.game_play_value + Environment.NewLine + match_data.map_name + Environment.NewLine + Environment.NewLine +  string.Join(",", match_data.match_attributes.Select(x => x.attribute)));

            if (match_data.GameResult == "Win")
            {
                lb_game_result.Text = "Victory";
            }
            else if (match_data.GameResult == "Loss")
            {
                lb_game_result.Text = "Defeat";
            }
            else
            {
                lb_game_result.Text = match_data.GameResult;
            }

#if DEBUG
            lb_game_result.Text = match_data.ServerGUID.ToString();
#endif

            lb_match_type.Text = match_data.MatchTypeDesc;
            lb_map_name.Text   = Translate.TranslateString(match_data.MapName, session, translations);
            if (build_records.ContainsKey(match_data.LocalPlayer.BuildHash))
            {
                lb_build_name.Text = build_records[match_data.LocalPlayer.BuildHash].FullDescription;
            }
            else
            {
                lb_build_name.Text = "";
            }
            lb_duration.Text     = string.Format(@"{0}m {1}s", duration.Minutes, duration.Seconds);
            lb_kills.Text        = match_data.LocalPlayer.Stats.Kills.ToString();
            lb_assists.Text      = match_data.LocalPlayer.Stats.Assists.ToString();
            lb_drone_kills.Text  = match_data.LocalPlayer.Stats.DroneKills.ToString();
            lb_damage_dealt.Text = Math.Round(match_data.LocalPlayer.Stats.Damage, 1).ToString();
            lb_damage_rec.Text   = Math.Round(match_data.LocalPlayer.Stats.DamageTaken, 1).ToString();
            lb_score.Text        = match_data.LocalPlayer.Stats.Score.ToString();
            lb_medals.Text       = match_data.LocalPlayer.Stripes.Count().ToString();
            if (match_data.MatchRewards.ContainsKey("expFactionTotal"))
            {
                lb_xp.Text        = match_data.MatchRewards["expFactionTotal"].ToString();
                lb_resources.Text = string.Join(",", match_data.MatchRewards.Where(x => x.Key.ToLower().Contains("xp") == false && x.Key != "score").Select(x => Translate.TranslateString(x.Key, session, translations) + ":" + x.Value.ToString()));
            }
            else
            {
                lb_xp.Text        = "";
                lb_resources.Text = "";
            }

            lb_blue_team.Text = blue_team;
            lb_red_team.Text  = red_team;

            populate_medals_table();
            populate_score_table();
            populate_teams_tables();
            populate_damage_dealt();
            populate_damage_rec();
        }
Exemple #2
0
        public static void AssignCurrentMatch(FileTraceManagment.SessionStats currentSession, LogFileManagment.SessionVariables session, OverlayWriter writer, Dictionary <string, Dictionary <string, Translate.Translation> > translation)
        {
            if (!currentSession.InMatch)
            {
                return;
            }

            FileTraceManagment.MatchData current_match = currentSession.CurrentMatch;

            if (!current_match.PlayerRecords.ContainsKey(currentSession.LocalUserUID))
            {
                return;
            }

            if (current_match == null)
            {
                return;
            }

            if (currentSession.TwitchSettings.InGameKD)
            {
                writer.AddHeader(string.Format(@"Current match on {0}", Translate.TranslateString(current_match.MapName, session, translation)), "current_match");
                writer.AddHorizontalRow();
                writer.AddLine(string.Format(@"{0,16} {1:N0}", "Kills", current_match.PlayerRecords[currentSession.LocalUserUID].Stats.Kills), "current_match kills");
                writer.AddLine(string.Format(@"{0,16} {1:N0}", "Assists", current_match.PlayerRecords[currentSession.LocalUserUID].Stats.Assists), "current_match assists");
                writer.AddLine(string.Format(@"{0,16} {1:N0}", "Deaths", current_match.PlayerRecords[currentSession.LocalUserUID].Stats.Deaths), "current_match deaths");
                writer.AddLine(string.Format(@"{0,16} {1:N0}", "Drone Kills", current_match.PlayerRecords[currentSession.LocalUserUID].Stats.DroneKills), "current_match drone_kils");
                writer.AddLine(string.Format(@"{0,16} {1:N0}", "Score", current_match.PlayerRecords[currentSession.LocalUserUID].Stats.Score), "current_match score");
            }

            if (currentSession.TwitchSettings.InGameDamage)
            {
                Dictionary <string, double> damageBreakdown = new Dictionary <string, double> {
                };

                if (current_match.PlayerRecords[currentSession.LocalUserUID].Stats.Damage > 0)
                {
                    writer.AddEmptyRow();
                    writer.AddHeader("Damage Breakdown", "damage_breakdown");
                    writer.AddHorizontalRow();
                    writer.AddLine(string.Format(@"{0,16} {1:N1}", "Total", current_match.PlayerRecords[currentSession.LocalUserUID].Stats.Damage), "damage_breakdown total");

                    foreach (FileTraceManagment.DamageRecord record in currentSession.CurrentMatch.DamageRecord.Where(x => x.Attacker == currentSession.LocalUser))
                    {
                        if (damageBreakdown.ContainsKey(record.Weapon))
                        {
                            damageBreakdown[record.Weapon] += record.Damage;
                        }
                        else
                        {
                            damageBreakdown.Add(record.Weapon, record.Damage);
                        }
                    }

                    if (damageBreakdown.Count > 0)
                    {
                        foreach (KeyValuePair <string, double> record in damageBreakdown)
                        {
                            writer.AddLine(string.Format(@"{0,16} {1:N1}", Translate.TranslateString(record.Key, session, translation), record.Value), "damage_breakdown weapon");
                        }
                    }
                }

                if (current_match.PlayerRecords[currentSession.LocalUserUID].Stats.DamageTaken > 0)
                {
                    damageBreakdown = new Dictionary <string, double> {
                    };
                    writer.AddEmptyRow();
                    writer.AddHeader("Damage Recieved Breakdown", "damage_recieved_breakdown");
                    writer.AddHorizontalRow();
                    writer.AddLine(string.Format(@"{0,16} {1:N1}", "Total", current_match.PlayerRecords[currentSession.LocalUserUID].Stats.DamageTaken), "damage_recieved_breakdown total");

                    foreach (FileTraceManagment.DamageRecord record in currentSession.CurrentMatch.DamageRecord.Where(x => x.Victim == currentSession.LocalUser))
                    {
                        if (damageBreakdown.ContainsKey(record.Weapon))
                        {
                            damageBreakdown[record.Weapon] += record.Damage;
                        }
                        else
                        {
                            damageBreakdown.Add(record.Weapon, record.Damage);
                        }
                    }

                    if (damageBreakdown.Count > 0)
                    {
                        foreach (KeyValuePair <string, double> record in damageBreakdown)
                        {
                            writer.AddLine(string.Format(@"{0,16} {1:N1}", Translate.TranslateString(record.Key, session, translation), record.Value), "damage_recieved_breakdown weapon");
                        }
                    }
                }
            }

            if (currentSession.TwitchSettings.InGameVictims && current_match.Victims.Count > 0)
            {
                writer.AddEmptyRow();
                writer.AddHeader("Victims", "victims");
                writer.AddHorizontalRow();
                foreach (string victim in current_match.Victims)
                {
                    writer.AddLine(string.Format(@"{0,16}", victim), "victims name");
                }

                if (current_match.PlayerRecords[currentSession.LocalUserUID].Stats.Kills - current_match.Victims.Count == 1)
                {
                    writer.AddLine(string.Format(@"{0,16}", "Bot"), "victims bot");
                }
                else if (current_match.PlayerRecords[currentSession.LocalUserUID].Stats.Kills - current_match.Victims.Count > 1)
                {
                    writer.AddLine(string.Format(@"{0,16}{1}", "Bots X", current_match.PlayerRecords[currentSession.LocalUserUID].Stats.Kills - current_match.Victims.Count), "victims bot");
                }
            }

            if (currentSession.TwitchSettings.InGameKiller && current_match.Nemesis != "")
            {
                writer.AddEmptyRow();
                writer.AddHeader("Killed by", "killed_by");
                writer.AddHorizontalRow();
                writer.AddLine(string.Format(@"{0,16}", current_match.Nemesis), "killed_by name");
            }
        }
Exemple #3
0
        public static void AssignTeams(FileTraceManagment.MatchData match, ref string blueTeam, ref string redTeam)
        {
            blueTeam = "";
            Random randomNumber = new Random();

            if (match.MatchClassification == GlobalData.PVE_CLASSIFICATION)
            {
                redTeam = "A bunch of robots.";
            }
            else
            if (match.MatchClassification == GlobalData.FREE_PLAY_CLASSIFICATION)
            {
                redTeam = "The elite of Bedlam.";
            }
            else
            {
                redTeam = SoloQueueNames[randomNumber.Next(SoloQueueNames.Count())];
            }

            Dictionary <int, List <string> > blueTeams = new Dictionary <int, List <string> > {
            };
            Dictionary <int, List <string> > redTeams  = new Dictionary <int, List <string> > {
            };

            blueTeams.Add(match.LocalPlayer.PartyID, new List <string> {
                match.LocalPlayer.Nickname
            });

            foreach (KeyValuePair <int, FileTraceManagment.Player> player in match.PlayerRecords.ToList())
            {
                if (player.Value.PartyID == 0 || player.Value.Nickname == match.LocalPlayer.Nickname)
                {
                    continue;
                }

                if (player.Value.Team != match.LocalPlayer.Team)
                {
                    if (!redTeams.ContainsKey(player.Value.PartyID))
                    {
                        redTeams.Add(player.Value.PartyID, new List <string> {
                            player.Value.Nickname
                        });
                    }
                    else
                    {
                        redTeams[player.Value.PartyID].Add(player.Value.Nickname);
                    }
                }
                else
                {
                    if (!blueTeams.ContainsKey(player.Value.PartyID))
                    {
                        blueTeams.Add(player.Value.PartyID, new List <string> {
                            player.Value.Nickname
                        });
                    }
                    else
                    {
                        blueTeams[player.Value.PartyID].Add(player.Value.Nickname);
                    }
                }
            }

            foreach (KeyValuePair <int, List <string> > team in blueTeams)
            {
                blueTeam += string.Format("({0})", string.Join(",", team.Value));
            }

            if (redTeams.Count > 0)
            {
                redTeam = "";
            }

            foreach (KeyValuePair <int, List <string> > team in redTeams)
            {
                redTeam += string.Format("({0})", string.Join(",", team.Value));
            }
        }
Exemple #4
0
        public static void DrawTeamPreviewCard(FileTraceManagment.SessionStats currentSession, LogFileManagment.SessionVariables session, Dictionary <string, Dictionary <string, Translate.Translation> > translation, bool draw)
        {
            OverlayWriter writerBlue = new OverlayWriter(currentSession.TwitchSettings.OverlayFormat);
            OverlayWriter writerRed  = new OverlayWriter(currentSession.TwitchSettings.OverlayFormat);

            if (draw && currentSession.CurrentMatch.PlayerRecords.Any(x => x.Value.PartyID != 0))
            {
                Random random_number = new Random();
                FileTraceManagment.MatchData current_match = currentSession.CurrentMatch;

                if (!current_match.PlayerRecords.ContainsKey(currentSession.LocalUserUID))
                {
                    return;
                }

                Dictionary <int, List <string> > blue_teams = new Dictionary <int, List <string> > {
                };
                Dictionary <int, List <string> > red_teams  = new Dictionary <int, List <string> > {
                };

                blue_teams.Add(current_match.PlayerRecords[currentSession.LocalUserUID].PartyID, new List <string> {
                    current_match.PlayerRecords[currentSession.LocalUserUID].Nickname
                });

                foreach (KeyValuePair <int, FileTraceManagment.Player> player in current_match.PlayerRecords.ToList())
                {
                    if (player.Value.PartyID == 0 || player.Value.Nickname == current_match.PlayerRecords[currentSession.LocalUserUID].Nickname)
                    {
                        continue;
                    }

                    if (player.Value.Team != current_match.PlayerRecords[currentSession.LocalUserUID].Team)
                    {
                        if (!red_teams.ContainsKey(player.Value.PartyID))
                        {
                            red_teams.Add(player.Value.PartyID, new List <string> {
                                player.Value.Nickname
                            });
                        }
                        else
                        {
                            red_teams[player.Value.PartyID].Add(player.Value.Nickname);
                        }
                    }
                    else
                    {
                        if (!blue_teams.ContainsKey(player.Value.PartyID))
                        {
                            blue_teams.Add(player.Value.PartyID, new List <string> {
                                player.Value.Nickname
                            });
                        }
                        else
                        {
                            blue_teams[player.Value.PartyID].Add(player.Value.Nickname);
                        }
                    }
                }

                //TODO separate methods for css purposes
                foreach (KeyValuePair <int, List <string> > team in blue_teams)
                {
                    writerBlue.AddLine(string.Format("{0}", string.Join(",", team.Value)), "player blue_player");
                }

                foreach (KeyValuePair <int, List <string> > team in red_teams)
                {
                    writerRed.AddLine(string.Format("{0}", string.Join(",", team.Value)), "player red_player");
                }
            }
            writerBlue.WriteToFile(currentSession.FileData.StreamOverlayOutputLocation + @"\blue_team_squads");
            writerRed.WriteToFile(currentSession.FileData.StreamOverlayOutputLocation + @"\red_team_squads");
        }