Пример #1
0
        private void ForEachControl(Control parent, LogFileManagment.SessionVariables session)
        {
            foreach (Control ctrl in parent.Controls)
            {
                ctrl.ForeColor = session.ForeColor;
                ctrl.BackColor = session.BackColor;

                if (ctrl is DataGridView)
                {
                    StyleDataGridView(((DataGridView)ctrl), session);
                }

                if (ctrl is Chart)
                {
                    StyleChart(((Chart)ctrl), session);
                }

                if (ctrl is LinkLabel)
                {
                    StyleLink(((LinkLabel)ctrl), session);
                }

                if (ctrl is ProgressBar)
                {
                    StyleProgressBar(((ProgressBar)ctrl), session);
                }

                ForEachControl(ctrl, session);
            }
            parent.ForeColor = session.ForeColor;
            parent.BackColor = session.BackColor;
        }
Пример #2
0
        public static MarketData LoadPreviousMarketData(LogFileManagment.SessionVariables session, MarketData market)
        {
            if (!File.Exists(session.MarketDataLocation + @"\crossoutdb_data.json"))
            {
                return(market);
            }

            MarketData newData = new MarketData {
            };

            try
            {
                using (StreamReader file = File.OpenText(session.MarketDataLocation + @"\crossoutdb_data.json"))
                {
                    JsonSerializer serializer = new JsonSerializer();
                    newData = (MarketData)serializer.Deserialize(file, typeof(MarketData));
                    if (newData.last_update != null)
                    {
                        return(newData);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Problems loading previous market data " + ex.Message);
            }
            return(market);
        }
Пример #3
0
 public static void PopulateFilters(FilterSelections filter, List <FileTraceManagment.MatchRecord> matchs, Dictionary <string, FileTraceManagment.BuildRecord> buildRecords,
                                    LogFileManagment.SessionVariables session, Dictionary <string, Dictionary <string, Translate.Translation> > translations)
 {
     foreach (FileTraceManagment.MatchRecord match in matchs)
     {
         PopulateFiltersForMatch(filter, match, buildRecords, session, translations);
     }
 }
Пример #4
0
 public static void SaveMarketData(LogFileManagment.SessionVariables session, MarketData market)
 {
     using (StreamWriter file = File.CreateText(session.MarketDataLocation + @"\crossoutdb_data.json"))
     {
         JsonSerializer serializer = new JsonSerializer();
         serializer.Serialize(file, market);
     }
 }
Пример #5
0
        private void StyleChart(Chart chart, LogFileManagment.SessionVariables session)
        {
            foreach (Legend leg in chart.Legends)
            {
                leg.ForeColor      = session.ForeColor;
                leg.BackColor      = session.BackColor;
                leg.TitleForeColor = session.ForeColor;
                leg.TitleBackColor = session.BackColor;
            }

            foreach (ChartArea area in chart.ChartAreas)
            {
                area.BackColor = session.BackColor;

                area.AxisX.TitleForeColor       = session.ForeColor;
                area.AxisX.LineColor            = session.ForeColor;
                area.AxisX.InterlacedColor      = session.ForeColor;
                area.AxisX.MajorGrid.LineColor  = session.BackColor;
                area.AxisX.LabelStyle.ForeColor = session.ForeColor;

                area.AxisX2.TitleForeColor       = session.ForeColor;
                area.AxisX2.LineColor            = session.ForeColor;
                area.AxisX2.InterlacedColor      = session.ForeColor;
                area.AxisX2.MajorGrid.LineColor  = session.BackColor;
                area.AxisX2.LabelStyle.ForeColor = session.ForeColor;

                area.AxisY.TitleForeColor       = session.ForeColor;
                area.AxisY.LineColor            = session.ForeColor;
                area.AxisY.InterlacedColor      = session.ForeColor;
                area.AxisY.MajorGrid.LineColor  = session.BackColor;
                area.AxisY.LabelStyle.ForeColor = session.ForeColor;

                area.AxisY2.TitleForeColor       = session.ForeColor;
                area.AxisY2.LineColor            = session.ForeColor;
                area.AxisY2.InterlacedColor      = session.ForeColor;
                area.AxisY2.MajorGrid.LineColor  = session.BackColor;
                area.AxisY2.LabelStyle.ForeColor = session.ForeColor;
            }
        }
Пример #6
0
        public trace_view(string trace_type, LogFileManagment.SessionVariables session)
        {
            InitializeComponent();

            local_session_variables = session;

            this.lbl_trace_name.Text = string.Format(@"{0}.log Trace", trace_type);

            FileInfo trace_file;

            try
            {
                trace_file = new DirectoryInfo(session.LogFileLocation).GetFiles(trace_type + "*.log", SearchOption.AllDirectories).OrderByDescending(p => p.CreationTime).ToArray().First();
            }
            catch (Exception ex)
            {
                this.lbl_current_file_name.Text = string.Format(@"File ""{0}.log"" not found at path  ""{1}"". Please check path in settings.", trace_type, local_session_variables.LogFileLocation);
                return;
            }

            this.lbl_current_file_name.Text = string.Format(@"Tracing File ""{0}""", trace_file.FullName);
            this.bw_file_tracer.RunWorkerAsync();
        }
Пример #7
0
        private void StyleDataGridView(DataGridView dgv, LogFileManagment.SessionVariables session)
        {
            dgv.GridColor                                        = session.ForeColor;
            dgv.BackgroundColor                                  = session.BackColor;
            dgv.DefaultCellStyle.ForeColor                       = session.ForeColor;
            dgv.DefaultCellStyle.BackColor                       = session.BackColor;
            dgv.DefaultCellStyle.SelectionForeColor              = session.BackColor;
            dgv.DefaultCellStyle.SelectionBackColor              = session.ForeColor;
            dgv.ColumnHeadersDefaultCellStyle.ForeColor          = session.ForeColor;
            dgv.ColumnHeadersDefaultCellStyle.BackColor          = session.BackColor;
            dgv.ColumnHeadersDefaultCellStyle.SelectionForeColor = session.BackColor;
            dgv.ColumnHeadersDefaultCellStyle.SelectionBackColor = session.ForeColor;
            dgv.RowHeadersDefaultCellStyle.ForeColor             = session.ForeColor;
            dgv.RowHeadersDefaultCellStyle.BackColor             = session.BackColor;
            dgv.RowHeadersDefaultCellStyle.SelectionForeColor    = session.BackColor;
            dgv.RowHeadersDefaultCellStyle.SelectionBackColor    = session.ForeColor;
            dgv.RowsDefaultCellStyle.ForeColor                   = session.ForeColor;
            dgv.RowsDefaultCellStyle.BackColor                   = session.BackColor;
            dgv.RowsDefaultCellStyle.SelectionForeColor          = session.BackColor;
            dgv.RowsDefaultCellStyle.SelectionBackColor          = session.ForeColor;
            dgv.RowTemplate.DefaultCellStyle.ForeColor           = session.ForeColor;
            dgv.RowTemplate.DefaultCellStyle.BackColor           = session.BackColor;
            dgv.RowTemplate.DefaultCellStyle.SelectionForeColor  = session.BackColor;
            dgv.RowTemplate.DefaultCellStyle.SelectionBackColor  = session.ForeColor;

            foreach (DataGridViewRow row in dgv.Rows)
            {
                foreach (DataGridViewCell cell in row.Cells)
                {
                    cell.Style.ForeColor          = session.ForeColor;
                    cell.Style.BackColor          = session.BackColor;
                    cell.Style.SelectionForeColor = session.BackColor;
                    cell.Style.SelectionBackColor = session.ForeColor;
                }
            }
        }
Пример #8
0
        public static MarketData PopulateCrossoutDBData(LogFileManagment.SessionVariables session)
        {
            MarketData data = new MarketData {
            };

            data = LoadPreviousMarketData(session, data);

            if (data.last_update > DateTime.Now.AddHours(-1))
            {
                return(data);
            }

            data.last_update = DateTime.Now;
            try
            {
                data.market_items = LoadCrossoutDBData();
                SaveMarketData(session, data);
            }
            catch
            {
            }

            return(data);
        }
Пример #9
0
        public static void ResolveOverlayAction(FileTraceManagment.SessionStats currentSession, LogFileManagment.SessionVariables session, Dictionary <string, Dictionary <string, Translate.Translation> > translation)
        {
            if (session.TwitchMode != true)
            {
                return;
            }

            if (currentSession.LiveTraceData != true)
            {
                return;
            }


            foreach (OverlayAction action in currentSession.OverlayActions)
            {
                bool draw;

                if (action.ClearConditions.Contains(currentSession.CurrentEvent))
                {
                    draw = false;
                }
                else if (action.DrawConditions.Contains(currentSession.CurrentEvent))
                {
                    draw = true;
                }
                else
                {
                    continue;
                }

                switch (action.Overlay)
                {
                case IN_MATCH_OVERLAY:
                    DrawInGameRecapCard(currentSession, session, translation, draw);
                    break;

                case STAT_CARD_OVERLAY:
                    DrawStatCard(currentSession, session, translation, draw);
                    break;

                case TEAM_PREVIEW_OVERLAY:
                    DrawTeamPreviewCard(currentSession, session, translation, draw);
                    break;

                default:
                    break;
                }
            }
        }
Пример #10
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");
        }
Пример #11
0
        public static void PopulateFiltersForMatch(FilterSelections filter, FileTraceManagment.MatchRecord match, Dictionary <string, FileTraceManagment.BuildRecord> buildRecords,
                                                   LogFileManagment.SessionVariables session, Dictionary <string, Dictionary <string, Translate.Translation> > translations)
        {
            if (!filter.GameModes.Contains(match.MatchData.MatchTypeDesc))
            {
                filter.GameModes.Add((match.MatchData.MatchTypeDesc));
            }

            if (!filter.GameModes.Contains("PvP") && match.MatchData.MatchClassification == GlobalData.PVP_CLASSIFICATION)
            {
                filter.GameModes.Add("PvP");
            }

            if (!filter.GameModes.Contains("PvE") && match.MatchData.MatchClassification == GlobalData.PVE_CLASSIFICATION)
            {
                filter.GameModes.Add("PvE");
            }

            if (!filter.GameModes.Contains("Brawl") && match.MatchData.MatchClassification == GlobalData.BRAWL_CLASSIFICATION)
            {
                filter.GameModes.Add("Brawl");
            }

            if (match.MatchData.MatchClassification == GlobalData.PVP_CLASSIFICATION && !filter.GameModes.Contains("PvP"))
            {
                filter.GameModes.Add("PvP");
            }

            if (match.MatchData.MatchClassification == GlobalData.PVE_CLASSIFICATION && !filter.GameModes.Contains("PvE"))
            {
                filter.GameModes.Add("PvE");
            }

            if (match.MatchData.MatchClassification == GlobalData.BRAWL_CLASSIFICATION && !filter.GameModes.Contains("Brawl"))
            {
                filter.GameModes.Add("Brawl");
            }

            if (match.MatchData.LocalPlayer.PartyID == 0 && !filter.Grouped.Contains("Solo"))
            {
                filter.Grouped.Add("Solo");
            }

            if (match.MatchData.LocalPlayer.PartyID > 0 && !filter.Grouped.Contains("Grouped"))
            {
                filter.Grouped.Add("Grouped");
            }

            if (match.MatchData.LocalPlayer.PowerScore >= 0 && match.MatchData.LocalPlayer.PowerScore <= 2499 && !filter.PowerScores.Contains("0-2499"))
            {
                filter.PowerScores.Add("0-2499");
            }

            if (match.MatchData.LocalPlayer.PowerScore >= 2500 && match.MatchData.LocalPlayer.PowerScore <= 2499 && !filter.PowerScores.Contains("2500-3499"))
            {
                filter.PowerScores.Add("2500-3499");
            }

            if (match.MatchData.LocalPlayer.PowerScore >= 3500 && match.MatchData.LocalPlayer.PowerScore <= 4499 && !filter.PowerScores.Contains("3500-4499"))
            {
                filter.PowerScores.Add("3500-4499");
            }

            if (match.MatchData.LocalPlayer.PowerScore >= 4500 && match.MatchData.LocalPlayer.PowerScore <= 5499 && !filter.PowerScores.Contains("4500-5499"))
            {
                filter.PowerScores.Add("4500-5499");
            }

            if (match.MatchData.LocalPlayer.PowerScore >= 5500 && match.MatchData.LocalPlayer.PowerScore <= 6499 && !filter.PowerScores.Contains("5500-6499"))
            {
                filter.PowerScores.Add("5500-6499");
            }

            if (match.MatchData.LocalPlayer.PowerScore >= 6500 && match.MatchData.LocalPlayer.PowerScore <= 7499 && !filter.PowerScores.Contains("6500-7499"))
            {
                filter.PowerScores.Add("6500-7499");
            }

            if (match.MatchData.LocalPlayer.PowerScore >= 7500 && match.MatchData.LocalPlayer.PowerScore <= 8499 && !filter.PowerScores.Contains("7500-8499"))
            {
                filter.PowerScores.Add("7500-8499");
            }

            if (match.MatchData.LocalPlayer.PowerScore >= 8500 && match.MatchData.LocalPlayer.PowerScore <= 9499 && !filter.PowerScores.Contains("8500-9499"))
            {
                filter.PowerScores.Add("8500-9499");
            }

            if (match.MatchData.LocalPlayer.PowerScore >= 9500 && match.MatchData.LocalPlayer.PowerScore <= 12999 && !filter.PowerScores.Contains("9500-12999"))
            {
                filter.PowerScores.Add("9500-12999");
            }

            if (match.MatchData.LocalPlayer.PowerScore >= 13000 && match.MatchData.LocalPlayer.PowerScore <= 22000 && !filter.PowerScores.Contains("13000+"))
            {
                filter.PowerScores.Add("13000+");
            }

            if (match.MatchData.LocalPlayer.PowerScore >= 22000 && !filter.PowerScores.Contains("Leviathan"))
            {
                filter.PowerScores.Add("Leviathan");
            }

            if (!filter.ClientVersions.Contains(match.MatchData.ClientVersion))
            {
                filter.ClientVersions.Add((match.MatchData.ClientVersion));
            }

            if (buildRecords.ContainsKey(match.MatchData.LocalPlayer.BuildHash))
            {
                if (!string.IsNullOrEmpty(Translate.TranslateString(buildRecords[match.MatchData.LocalPlayer.BuildHash].Cabin.Name, session, translations)))
                {
                    if (!filter.Cabins.Contains(Translate.TranslateString(buildRecords[match.MatchData.LocalPlayer.BuildHash].Cabin.Name, session, translations)))
                    {
                        filter.Cabins.Add(Translate.TranslateString(buildRecords[match.MatchData.LocalPlayer.BuildHash].Cabin.Name, session, translations));
                    }
                }

                foreach (PartLoader.Weapon weapon in buildRecords[match.MatchData.LocalPlayer.BuildHash].Weapons)
                {
                    if (!filter.Weapons.Contains(Translate.TranslateString(weapon.Name, session, translations)))
                    {
                        filter.Weapons.Add(Translate.TranslateString(weapon.Name, session, translations));
                    }
                }

                foreach (PartLoader.Movement movement in buildRecords[match.MatchData.LocalPlayer.BuildHash].Movement)
                {
                    if (!filter.MovementParts.Contains(Translate.TranslateString(movement.Name, session, translations)))
                    {
                        filter.MovementParts.Add(Translate.TranslateString(movement.Name, session, translations));
                    }
                }

                foreach (PartLoader.Module module in buildRecords[match.MatchData.LocalPlayer.BuildHash].Modules)
                {
                    if (!filter.ModuleParts.Contains(Translate.TranslateString(module.Name, session, translations)))
                    {
                        filter.ModuleParts.Add(Translate.TranslateString(module.Name, session, translations));
                    }
                }
            }
        }
Пример #12
0
        public static bool CheckFilters(FilterSelections filter, FileTraceManagment.MatchRecord match, Dictionary <string, FileTraceManagment.BuildRecord> buildRecords,
                                        LogFileManagment.SessionVariables session, Dictionary <string, Dictionary <string, Translate.Translation> > translations)
        {
            PopulateFiltersForMatch(filter, match, buildRecords, session, translations);

            if (filter.GameModeFilter != GlobalData.GAME_MODE_FILTER_DEFAULT && filter.GameModeFilter != "PvP" && filter.GameModeFilter != "PvE" && filter.GameModeFilter != "Brawl" && filter.GameModeFilter != match.MatchData.MatchTypeDesc)
            {
                return(false);
            }

            if (filter.GameModeFilter == "PvP" && match.MatchData.MatchClassification != GlobalData.PVP_CLASSIFICATION)
            {
                return(false);
            }

            if (filter.GameModeFilter == "PvE" && match.MatchData.MatchClassification != GlobalData.PVE_CLASSIFICATION)
            {
                return(false);
            }

            if (filter.GameModeFilter == "Brawl" && match.MatchData.MatchClassification != GlobalData.BRAWL_CLASSIFICATION)
            {
                return(false);
            }

            if (filter.GroupFilter == "Solo" && match.MatchData.LocalPlayer.PartyID > 0)
            {
                return(false);
            }

            if (filter.GroupFilter == "Grouped" && match.MatchData.LocalPlayer.PartyID == 0)
            {
                return(false);
            }

            if (filter.ClientVersionFilter != GlobalData.CLIENT_VERSION_FILTER_DEFAULT && filter.ClientVersionFilter != match.MatchData.ClientVersion)
            {
                return(false);
            }

            if (filter.StartDate.Date != DateTime.Now.Date && match.MatchData.MatchStart.Date < filter.StartDate)
            {
                return(false);
            }

            if (filter.EndDate.Date != DateTime.Now.Date && match.MatchData.MatchStart.Date > filter.EndDate)
            {
                return(false);
            }

            if (filter.PowerScoreFilter != GlobalData.POWER_SCORE_FILTER_DEFAULT)
            {
                if (filter.PowerScoreFilter == "0-2499" && (match.MatchData.LocalPlayer.PowerScore < 0 || match.MatchData.LocalPlayer.PowerScore > 2499))
                {
                    return(false);
                }

                if (filter.PowerScoreFilter == "2500-3499" && (match.MatchData.LocalPlayer.PowerScore < 2500 || match.MatchData.LocalPlayer.PowerScore > 3499))
                {
                    return(false);
                }

                if (filter.PowerScoreFilter == "3500-4499" && (match.MatchData.LocalPlayer.PowerScore < 3500 || match.MatchData.LocalPlayer.PowerScore > 4499))
                {
                    return(false);
                }

                if (filter.PowerScoreFilter == "4500-5499" && (match.MatchData.LocalPlayer.PowerScore < 4500 || match.MatchData.LocalPlayer.PowerScore > 5499))
                {
                    return(false);
                }

                if (filter.PowerScoreFilter == "5500-6499" && (match.MatchData.LocalPlayer.PowerScore < 5500 || match.MatchData.LocalPlayer.PowerScore > 6499))
                {
                    return(false);
                }

                if (filter.PowerScoreFilter == "6500-7499" && (match.MatchData.LocalPlayer.PowerScore < 6500 || match.MatchData.LocalPlayer.PowerScore > 7499))
                {
                    return(false);
                }

                if (filter.PowerScoreFilter == "7500-8499" && (match.MatchData.LocalPlayer.PowerScore < 7500 || match.MatchData.LocalPlayer.PowerScore > 8499))
                {
                    return(false);
                }

                if (filter.PowerScoreFilter == "8500-9499" && (match.MatchData.LocalPlayer.PowerScore < 8500 || match.MatchData.LocalPlayer.PowerScore > 9499))
                {
                    return(false);
                }

                if (filter.PowerScoreFilter == "9500-12999" && (match.MatchData.LocalPlayer.PowerScore < 9500 || match.MatchData.LocalPlayer.PowerScore > 12999))
                {
                    return(false);
                }

                if (filter.PowerScoreFilter == "13000+" && (match.MatchData.LocalPlayer.PowerScore < 13000 || match.MatchData.LocalPlayer.PowerScore > 22000))
                {
                    return(false);
                }

                if (filter.PowerScoreFilter == "Leviathan" && match.MatchData.LocalPlayer.PowerScore < 22000)
                {
                    return(false);
                }
            }

            if (buildRecords.ContainsKey(match.MatchData.LocalPlayer.BuildHash))
            {
                if (filter.WeaponsFilter != GlobalData.WEAPONS_FILTER_DEFAULT && buildRecords[match.MatchData.LocalPlayer.BuildHash].Weapons.Select(x => Translate.TranslateString(x.Name, session, translations)).Where(x => x == filter.WeaponsFilter).Count() == 0)
                {
                    return(false);
                }

                if (filter.MovementFilter != GlobalData.MOVEMENT_FILTER_DEFAULT && buildRecords[match.MatchData.LocalPlayer.BuildHash].Movement.Select(x => Translate.TranslateString(x.Name, session, translations)).Where(x => x == filter.MovementFilter).Count() == 0)
                {
                    return(false);
                }

                if (filter.CabinFilter != GlobalData.CABIN_FILTER_DEFAULT && Translate.TranslateString(buildRecords[match.MatchData.LocalPlayer.BuildHash].Cabin.Name, session, translations) != filter.CabinFilter)
                {
                    return(false);
                }

                if (filter.ModuleFilter != GlobalData.MODULE_FILTER_DEFAULT && buildRecords[match.MatchData.LocalPlayer.BuildHash].Modules.Select(x => Translate.TranslateString(x.Name, session, translations)).Where(x => x == filter.ModuleFilter).Count() == 0)
                {
                    return(false);
                }
            }
            else
            {
                if (filter.WeaponsFilter != GlobalData.WEAPONS_FILTER_DEFAULT)
                {
                    return(false);
                }

                if (filter.MovementFilter != GlobalData.MOVEMENT_FILTER_DEFAULT)
                {
                    return(false);
                }

                if (filter.CabinFilter != GlobalData.CABIN_FILTER_DEFAULT)
                {
                    return(false);
                }

                if (filter.ModuleFilter != GlobalData.MODULE_FILTER_DEFAULT)
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #13
0
        public static void AssignRevenue(FileTraceManagment.SessionStats Current_session, LogFileManagment.SessionVariables session, OverlayWriter writer, Dictionary <string, Dictionary <string, Translate.Translation> > translation)
        {
            DateTime time_cutoff             = DateTime.Now.AddDays(Current_session.TwitchSettings.OverviewTimeRange * -1);
            Dictionary <string, int> rewards = new Dictionary <string, int> {
            };

            foreach (FileTraceManagment.MatchRecord match in Current_session.MatchHistory)
            {
                if (match.MatchData.MatchStart < time_cutoff)
                {
                    continue;
                }

                if (match.MatchData.MatchRewards.Count() == 0)
                {
                    continue;
                }

                foreach (KeyValuePair <string, int> value in match.MatchData.MatchRewards.Where(x => !x.Key.Contains("exp") && x.Key != "score"))
                {
                    if (rewards.ContainsKey(value.Key))
                    {
                        rewards[value.Key] += value.Value;
                    }
                    else
                    {
                        rewards.Add(value.Key, value.Value);
                    }
                }
            }
            if (rewards.Count > 0)
            {
                writer.AddEmptyRow();
                writer.AddHeader("Resource Breakdown", "resource_breakdown");
                writer.AddHorizontalRow();

                foreach (KeyValuePair <string, int> value in rewards.OrderByDescending(x => x.Value))
                {
                    writer.AddLine(string.Format(@"{0,16} {1}", Translate.TranslateString(value.Key, session, translation), value.Value), "resource_breakdown reward");
                }
            }
        }
Пример #14
0
        public static void DrawInGameRecapCard(FileTraceManagment.SessionStats Current_session, LogFileManagment.SessionVariables session, Dictionary <string, Dictionary <string, Translate.Translation> > translation, bool draw)
        {
            OverlayWriter writer = new OverlayWriter(Current_session.TwitchSettings.OverlayFormat);

            if (draw)
            {
                AssignCurrentMatch(Current_session, session, writer, translation);
            }
            writer.WriteToFile(Current_session.FileData.StreamOverlayOutputLocation + @"\in_game_report");
        }
Пример #15
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");
            }
        }
Пример #16
0
 public void ApplyTheme(Control userControl, LogFileManagment.SessionVariables session)
 {
     ForEachControl(userControl, session);
 }
Пример #17
0
        public static void DrawStatCard(FileTraceManagment.SessionStats currentSession, LogFileManagment.SessionVariables session, Dictionary <string, Dictionary <string, Translate.Translation> > translation, bool draw)
        {
            OverlayWriter writer = new OverlayWriter(currentSession.TwitchSettings.OverlayFormat);

            if (draw)
            {
                if (currentSession.TwitchSettings.ShowStats)
                {
                    AssignStats(currentSession, writer, translation, currentSession.MatchHistory.FirstOrDefault().MatchData.MatchTypeDesc);
                }

                if (currentSession.TwitchSettings.ShowRevenue)
                {
                    AssignRevenue(currentSession, session, writer, translation);
                }

                if (currentSession.TwitchSettings.ShowNemesis || currentSession.TwitchSettings.ShowVictims)
                {
                    AssignNemesisVictim(currentSession, writer, translation);
                }
            }
            writer.WriteToFile(currentSession.FileData.StreamOverlayOutputLocation + @"\gamemode_recap_card");
        }
Пример #18
0
 private void StyleProgressBar(ProgressBar pb, LogFileManagment.SessionVariables session)
 {
 }
Пример #19
0
 private void StyleLink(LinkLabel link, LogFileManagment.SessionVariables session)
 {
     link.ActiveLinkColor   = session.ForeColor;
     link.DisabledLinkColor = session.ForeColor;
     link.LinkColor         = session.ForeColor;
 }