Beispiel #1
0
 public static void Insert(Tribunal data, MySqlConnection conn)
 {
     while (true)
     {
         try
         {
             conn.Open();
             using (MySqlCommand cmd = new MySqlCommand("INSERT INTO tribunal (Champion, Team, Outcome, Time, Report, OK, OD, OA, OG, TK, TD, TA, TG) VALUES (@Champion, @Team, @Outcome, @Time, @Report, @OK, @OD, @OA, @OG, @TK, @TD, @TA, @TG);", conn))
             {
                 cmd.Parameters.Add("@Champion", MySqlDbType.TinyText).Value = data.Champion;
                 cmd.Parameters.Add("@Team", MySqlDbType.Bit).Value          = data.Team;
                 cmd.Parameters.Add("@Outcome", MySqlDbType.UByte).Value     = data.Outcome;
                 cmd.Parameters.Add("@Time", MySqlDbType.UInt16).Value       = data.Time;
                 cmd.Parameters.Add("@Report", MySqlDbType.TinyText).Value   = data.Report;
                 cmd.Parameters.Add("@OK", MySqlDbType.UByte).Value          = data.OK;
                 cmd.Parameters.Add("@OD", MySqlDbType.UByte).Value          = data.OD;
                 cmd.Parameters.Add("@OA", MySqlDbType.UByte).Value          = data.OA;
                 cmd.Parameters.Add("@OG", MySqlDbType.UInt16).Value         = data.OG;
                 cmd.Parameters.Add("@TK", MySqlDbType.UInt16).Value         = data.TK;
                 cmd.Parameters.Add("@TD", MySqlDbType.UInt16).Value         = data.TD;
                 cmd.Parameters.Add("@TA", MySqlDbType.UInt16).Value         = data.TA;
                 cmd.Parameters.Add("@TG", MySqlDbType.UInt32).Value         = data.TG;
                 cmd.ExecuteNonQuery();
                 conn.Close();
                 break;
             }
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex.ToString());
             conn.Close();
         }
     }
 }
Beispiel #2
0
        public void ParseGame(UInt32 ID)
        {
            Console.Title = "Case: " + ID + " - Key: " + KeyID;
            if (LoLKeep.Check(ID, conn))
            {
                Case caseData = new Case(ID);
                for (int game = 1; game <= 5; game++)
                {
                    GameRecord gameData;
                    Tribunal   tribunalData = new Tribunal();
                    caseData.Games++;
                    if ((gameData = GetGame(ID, game)) != null)
                    {
                        if (gameData.game_mode == "Classic" && gameData.game_mode_raw == "Classic" && gameData.players.Count == 10)
                        {
                            for (int n = 0; n < 10; n++)
                            {
                                Record recordData = new Record();
                                Player temp       = gameData.players[n];
                                recordData.Champion     = temp.champion_name;
                                recordData.Team         = temp.team != "Team1";
                                recordData.ReportedTeam = temp.association_to_offender != "enemy";
                                recordData.Offender     = temp.association_to_offender == "offender";
                                switch (temp.outcome)
                                {
                                case "Win":
                                    recordData.Outcome = 0;
                                    break;

                                case "Loss":
                                    recordData.Outcome = 1;
                                    break;

                                case "Leave":
                                    recordData.Outcome = 2;
                                    break;
                                }
                                recordData.Time = temp.time_played;
                                recordData.K    = temp.scores.kills;
                                recordData.D    = temp.scores.deaths;
                                recordData.A    = temp.scores.assists;
                                recordData.G    = temp.gold_earned;
                                LoLKeep.Insert(recordData, conn);
                                if (recordData.Offender)
                                {
                                    tribunalData.Record(recordData);
                                }
                                if (recordData.ReportedTeam)
                                {
                                    tribunalData.AddKDA(recordData);
                                }
                            }
                            tribunalData.Report = gameData.most_common_report_reason;
                            LoLKeep.Insert(tribunalData, conn);
                        }
                        caseData.Ally  += gameData.allied_report_count;
                        caseData.Enemy += gameData.enemy_report_count;
                        int count = gameData.reports.Count;
                        for (int n = 0; n < count; n++)
                        {
                            switch (gameData.reports[n].offense)
                            {
                            case "OFFENSIVE_LANGUAGE":
                                caseData.OFFENSIVE_LANGUAGE++;
                                break;

                            case "VERBAL_ABUSE":
                                caseData.VERBAL_ABUSE++;
                                break;

                            case "INTENTIONAL_FEEDING":
                                caseData.INTENTIONAL_FEEDING++;
                                break;

                            case "ASSISTING_ENEMY":
                                caseData.ASSISTING_ENEMY++;
                                break;

                            case "UNSKILLED_PLAYER":
                                caseData.UNSKILLED_PLAYER++;
                                break;

                            case "NO_COMMUNICATION_WITH_TEAM":
                                caseData.NO_COMMUNICATION_WITH_TEAM++;
                                break;

                            case "LEAVING_AFK":
                                caseData.LEAVING_AFK++;
                                break;

                            case "NEGATIVE_ATTITUDE":
                                caseData.NEGATIVE_ATTITUDE++;
                                break;

                            case "INAPPROPRIATE_NAME":
                                caseData.INAPPROPRIATE_NAME++;
                                break;

                            case "SPAMMING":
                                caseData.SPAMMING++;
                                break;
                            }
                        }
                    }
                    else if (game > 1)
                    {
                        break;
                    }
                    else
                    {
                        Console.WriteLine("Key: " + KeyID + " - Ended at " + ID);
                        LoLKeep.TerminateKey(KeyID);
                        return;
                    }
                }
                if (GetDecision(ID, caseData))
                {
                    caseData.Decided = true;
                }
                caseData.Reports = (byte)(caseData.Ally + caseData.Enemy);
                LoLKeep.Insert(caseData, conn);
            }
        }
Beispiel #3
0
 public static void Insert(Tribunal data, MySqlConnection conn)
 {
     while (true)
     {
         try
         {
             conn.Open();
             using (MySqlCommand cmd = new MySqlCommand("INSERT INTO tribunal (Champion, Team, Outcome, Time, Report, OK, OD, OA, OG, TK, TD, TA, TG) VALUES (@Champion, @Team, @Outcome, @Time, @Report, @OK, @OD, @OA, @OG, @TK, @TD, @TA, @TG);", conn))
             {
                 cmd.Parameters.Add("@Champion", MySqlDbType.TinyText).Value = data.Champion;
                 cmd.Parameters.Add("@Team", MySqlDbType.Bit).Value = data.Team;
                 cmd.Parameters.Add("@Outcome", MySqlDbType.UByte).Value = data.Outcome;
                 cmd.Parameters.Add("@Time", MySqlDbType.UInt16).Value = data.Time;
                 cmd.Parameters.Add("@Report", MySqlDbType.TinyText).Value = data.Report;
                 cmd.Parameters.Add("@OK", MySqlDbType.UByte).Value = data.OK;
                 cmd.Parameters.Add("@OD", MySqlDbType.UByte).Value = data.OD;
                 cmd.Parameters.Add("@OA", MySqlDbType.UByte).Value = data.OA;
                 cmd.Parameters.Add("@OG", MySqlDbType.UInt16).Value = data.OG;
                 cmd.Parameters.Add("@TK", MySqlDbType.UInt16).Value = data.TK;
                 cmd.Parameters.Add("@TD", MySqlDbType.UInt16).Value = data.TD;
                 cmd.Parameters.Add("@TA", MySqlDbType.UInt16).Value = data.TA;
                 cmd.Parameters.Add("@TG", MySqlDbType.UInt32).Value = data.TG;
                 cmd.ExecuteNonQuery();
                 conn.Close();
                 break;
             }
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex.ToString());
             conn.Close();
         }
     }
 }
Beispiel #4
0
 public void ParseGame(UInt32 ID)
 {
     Console.Title = "Case: " + ID + " - Key: " + KeyID;
     if (LoLKeep.Check(ID, conn))
     {
         Case caseData = new Case(ID);
         for (int game = 1; game <= 5; game++)
         {
             GameRecord gameData;
             Tribunal tribunalData = new Tribunal();
             caseData.Games++;
             if ((gameData = GetGame(ID, game)) != null)
             {
                 if (gameData.game_mode == "Classic" && gameData.game_mode_raw == "Classic" && gameData.players.Count == 10)
                 {
                     for (int n = 0; n < 10; n++)
                     {
                         Record recordData = new Record();
                         Player temp = gameData.players[n];
                         recordData.Champion = temp.champion_name;
                         recordData.Team = temp.team != "Team1";
                         recordData.ReportedTeam = temp.association_to_offender != "enemy";
                         recordData.Offender = temp.association_to_offender == "offender";
                         switch (temp.outcome)
                         {
                             case "Win":
                                 recordData.Outcome = 0;
                                 break;
                             case "Loss":
                                 recordData.Outcome = 1;
                                 break;
                             case "Leave":
                                 recordData.Outcome = 2;
                                 break;
                         }
                         recordData.Time = temp.time_played;
                         recordData.K = temp.scores.kills;
                         recordData.D = temp.scores.deaths;
                         recordData.A = temp.scores.assists;
                         recordData.G = temp.gold_earned;
                         LoLKeep.Insert(recordData, conn);
                         if (recordData.Offender)
                             tribunalData.Record(recordData);
                         if (recordData.ReportedTeam)
                             tribunalData.AddKDA(recordData);
                     }
                     tribunalData.Report = gameData.most_common_report_reason;
                     LoLKeep.Insert(tribunalData, conn);
                 }
                 caseData.Ally += gameData.allied_report_count;
                 caseData.Enemy += gameData.enemy_report_count;
                 int count = gameData.reports.Count;
                 for (int n = 0; n < count; n++)
                 {
                     switch (gameData.reports[n].offense)
                     {
                         case "OFFENSIVE_LANGUAGE":
                             caseData.OFFENSIVE_LANGUAGE++;
                             break;
                         case "VERBAL_ABUSE":
                             caseData.VERBAL_ABUSE++;
                             break;
                         case "INTENTIONAL_FEEDING":
                             caseData.INTENTIONAL_FEEDING++;
                             break;
                         case "ASSISTING_ENEMY":
                             caseData.ASSISTING_ENEMY++;
                             break;
                         case "UNSKILLED_PLAYER":
                             caseData.UNSKILLED_PLAYER++;
                             break;
                         case "NO_COMMUNICATION_WITH_TEAM":
                             caseData.NO_COMMUNICATION_WITH_TEAM++;
                             break;
                         case "LEAVING_AFK":
                             caseData.LEAVING_AFK++;
                             break;
                         case "NEGATIVE_ATTITUDE":
                             caseData.NEGATIVE_ATTITUDE++;
                             break;
                         case "INAPPROPRIATE_NAME":
                             caseData.INAPPROPRIATE_NAME++;
                             break;
                         case "SPAMMING":
                             caseData.SPAMMING++;
                             break;
                     }
                 }
             }
             else if (game > 1)
                 break;
             else
             {
                 Console.WriteLine("Key: " + KeyID + " - Ended at " + ID);
                 LoLKeep.TerminateKey(KeyID);
                 return;
             }
         }
         if (GetDecision(ID, caseData))
             caseData.Decided = true;
         caseData.Reports = (byte)(caseData.Ally + caseData.Enemy);
         LoLKeep.Insert(caseData, conn);
     }
 }