Пример #1
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");
                }
            }
        }
Пример #2
0
        public static void AssignNemesisVictim(FileTraceManagment.SessionStats currentSession, OverlayWriter writer, Dictionary <string, Dictionary <string, Translate.Translation> > translation)
        {
            DateTime timeCutoff = DateTime.Now.AddDays(currentSession.TwitchSettings.OverviewTimeRange * -1);
            Dictionary <string, Opponent> opponentDictionary = new Dictionary <string, Opponent> {
            };
            int count;

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

                if (match.MatchData.MatchClassification == GlobalData.CUSTOM_CLASSIFICATION)
                {
                    continue;
                }

                if (match.MatchData.Nemesis != "")
                {
                    if (!opponentDictionary.ContainsKey(match.MatchData.Nemesis))
                    {
                        opponentDictionary.Add(match.MatchData.Nemesis, new Opponent {
                            Nickname = match.MatchData.Nemesis, BeenKilled = 1, Killed = 0
                        });
                    }
                    else
                    {
                        opponentDictionary[match.MatchData.Nemesis].BeenKilled += 1;
                    }
                }

                foreach (string victim in match.MatchData.Victims)
                {
                    if (!opponentDictionary.ContainsKey(victim))
                    {
                        opponentDictionary.Add(victim, new Opponent {
                            Nickname = victim, BeenKilled = 0, Killed = 1
                        });
                    }
                    else
                    {
                        opponentDictionary[victim].Killed += 1;
                    }
                }
            }

            if (currentSession.TwitchSettings.ShowNemesis)
            {
                count = 0;
                writer.AddEmptyRow();
                writer.AddHeader(string.Format(@"Top {0} Nemesis", currentSession.TwitchSettings.NemesisCount), "top_nemesis");
                writer.AddHorizontalRow();
                foreach (KeyValuePair <string, Opponent> nemesis in opponentDictionary.OrderByDescending(x => x.Value.Killed).ThenByDescending(x => x.Value.BeenKilled))
                {
                    if (count >= currentSession.TwitchSettings.NemesisCount)
                    {
                        break;
                    }

                    writer.AddLine(string.Format(@"{0,16} {1,4}/{2,-4}", nemesis.Key, nemesis.Value.Killed, nemesis.Value.BeenKilled), "top_nemesis entry"); //TODO add formatted input option for writer with divs for each entry
                    count += 1;
                }
            }

            if (currentSession.TwitchSettings.ShowVictims)
            {
                count = 0;
                writer.AddEmptyRow();
                writer.AddHeader(string.Format(@"Top {0} Victims", currentSession.TwitchSettings.NemesisCount), "top_victims");
                writer.AddHorizontalRow();
                foreach (KeyValuePair <string, Opponent> nemesis in opponentDictionary.OrderByDescending(x => x.Value.BeenKilled).ThenByDescending(x => x.Value.Killed))
                {
                    if (count >= currentSession.TwitchSettings.NemesisCount)
                    {
                        break;
                    }

                    writer.AddLine(string.Format(@"{0,16} {1,4}/{2,-4}", nemesis.Key, nemesis.Value.Killed, nemesis.Value.BeenKilled), "top_victims entry");
                    count += 1;
                }
            }
        }
Пример #3
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");
            }
        }