예제 #1
0
 public void Record(Record recordData)
 {
     Champion = recordData.Champion;
     Team = recordData.Team;
     Outcome = recordData.Outcome;
     Time = recordData.Time;
     OK = recordData.K;
     OD = recordData.D;
     OA = recordData.A;
     OG = recordData.G;
 }
예제 #2
0
 public static void Insert(Record data, MySqlConnection conn)
 {
     while (true)
     {
         try
         {
             conn.Open();
             using (MySqlCommand cmd = new MySqlCommand("INSERT INTO record (Champion, Team, ReportedTeam, Offender, Outcome, Time, K, D, A, G) VALUES (@Champion, @Team, @ReportedTeam, @Offender, @Outcome, @Time, @K, @D, @A, @G);", conn))
             {
                 cmd.Parameters.Add("@Champion", MySqlDbType.TinyText).Value = data.Champion;
                 cmd.Parameters.Add("@Team", MySqlDbType.Bit).Value = data.Team;
                 cmd.Parameters.Add("@ReportedTeam", MySqlDbType.Bit).Value = data.ReportedTeam;
                 cmd.Parameters.Add("@Offender", MySqlDbType.Bit).Value = data.Offender;
                 cmd.Parameters.Add("@Outcome", MySqlDbType.UByte).Value = data.Outcome;
                 cmd.Parameters.Add("@Time", MySqlDbType.UInt16).Value = data.Time;
                 cmd.Parameters.Add("@K", MySqlDbType.UByte).Value = data.K;
                 cmd.Parameters.Add("@D", MySqlDbType.UByte).Value = data.D;
                 cmd.Parameters.Add("@A", MySqlDbType.UByte).Value = data.A;
                 cmd.Parameters.Add("@G", MySqlDbType.UInt16).Value = data.G;
                 cmd.ExecuteNonQuery();
                 conn.Close();
                 break;
             }
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex.ToString());
             conn.Close();
         }
     }
 }
예제 #3
0
 public void AddKDA(Record recordData)
 {
     TK += (UInt16)recordData.K;
     TD += (UInt16)recordData.D;
     TA += (UInt16)recordData.A;
     TG += (UInt32)recordData.G;
 }
예제 #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);
     }
 }