Ejemplo n.º 1
0
        public static int GetPointsInDate(List<CsgoMatch> matches,
            List<CsgoTeam> teams,
            CsgoTeam team, DateTime date)
        {
            List<TempTeam> tempTeams = InitiateTeams(teams);

            foreach (CsgoMatch match in matches.OrderBy(m => m.Date))
            {
                if (match.Date > date) { break; }
                if (match.FirstTeamId == -1 && match.SecondTeamId == -1) { continue; }

                TempTeam firstTeam = tempTeams.Find(t => t.Id == match.FirstTeamId);
                TempTeam secondTeam = tempTeams.Find(t => t.Id == match.SecondTeamId);

                CalculateMods(firstTeam, secondTeam);

                if (match.FirstScore == 0) { match.FirstScore = 1; }
                if (match.SecondScore == 0) { match.SecondScore = 1; }

                int points = 0;
                if (match.FirstScore >= match.SecondScore)
                {
                    points = 10 * Convert.ToInt32(
                        ((float)match.FirstScore / (float)match.SecondScore) * firstTeam.Mod);
                    firstTeam.Points += points;
                    secondTeam.Points -= points;
                }
                else
                {
                    points = 10 * Convert.ToInt32(
                        ((float)match.SecondScore / (float)match.FirstScore) * secondTeam.Mod);
                    secondTeam.Points += points;
                    firstTeam.Points -= points;
                }
            }

            return tempTeams.Find(t => t.Id == team.Id).Points;
        }
Ejemplo n.º 2
0
        private int CurrentCommandScale(CsgoMatch match, CsgoTeam team, int score)
        {
            if (IsEnemyTeam(match, team.Name))
            {
                if (match.FirstTeamId == team.Id)
                {
                    if (match.FirstScore > match.SecondScore)
                    {
                        score = Convert.ToInt32((float)score * 1.5f);
                    }
                    else if (match.FirstScore <= match.SecondScore)
                    {
                        score = Convert.ToInt32((float)score * 0.7f);
                    }
                }
                else
                {
                    if (match.SecondScore > match.FirstScore)
                    {
                        score = Convert.ToInt32((float)score * 1.5f);
                    }
                    else if (match.SecondScore <= match.FirstScore)
                    {
                        score = Convert.ToInt32((float)score * 0.7f);
                    }
                }
            }

            return score;
        }