@@ -29,14 +29,15 @@ def add_round(self, data):
2929 teams = {}
3030 teams [self .team1_name ] = Team .from_json ({"name" : self .team1_name , "players" : {}})
3131 teams [self .team2_name ] = Team .from_json ({"name" : self .team2_name , "players" : {}})
32- self .rounds .append (Round .from_json ({"teams" : teams , "start_time" : data [2 ], "objective_captured" : [], "objective_progress" : []}))
32+ self .rounds .append (Round .from_json ({"teams" : teams , "start_time" : data [2 ], "end_time" : "" , " objective_captured" : [], "objective_progress" : []}))
3333
34- self .events .append ({"type" : "round_start" , "timestamp" : data [2 ], "value" : 1 , "description" : "Round {} start" .format (len (self .rounds ))})
34+ # self.events.append({"type": "round_start", "timestamp": data[2], "value": 1, "description": "Round {} start".format(len(self.rounds))})
3535
3636 self .actual_round += 1
3737
3838 print ("###### NEW ROUND {} #######" .format (self .actual_round ))
3939
40+
4041 def add_player (self , data ):
4142
4243 if data ["player_name" ] in self .rounds [self .actual_round ].teams [data ["team_name" ]].players :
@@ -78,17 +79,22 @@ def add_kill(self, data):
7879 self .rounds [self .actual_round ].teams [data [3 ]].players [data [4 ]].characters [data [5 ]].add_kill (killer_data )
7980 self .rounds [self .actual_round ].teams [data [6 ]].players [data [7 ]].characters [data [8 ]].add_death (victim_data )
8081
81- self . events . append ({ "type" : "kill" , "timestamp" : data [ 2 ], "value" : 1 , "description" : "{} kill {}" . format (data [4 ], data [ 7 ])} )
82+ team = self . find_team_for_player (data [4 ])
8283
84+ if team == list (self .rounds [self .actual_round ].teams .keys ())[0 ]:
85+ self .events .append ({"type" : "kill_team1" , "timestamp" : data [2 ], "value" : 1 , "description" : "{} kill {}" .format (data [4 ], data [7 ])})
86+ else :
87+ self .events .append ({"type" : "kill_team2" , "timestamp" : data [2 ], "value" : 1 ,
88+ "description" : "{} kill {}" .format (data [4 ], data [7 ])})
8389 def add_player_stat (self , data ):
8490
8591 # self.create_if_player_and_caracter_not_exist(data[4], data[5], data[6])
8692
87- player_data = {"eliminations" : data [6 ], "final_blows" : data [7 ], "deaths" : data [8 ], "damage" : data [9 ],
88- "barrier_damage" : data [10 ], "hero_damage" : data [11 ], "healing" : data [12 ], "healing_receive" : data [13 ],
89- "self_healing" : data [14 ], "damage_taken" : data [15 ], "damage_blocked" : data [16 ], "defensive_assist" : data [17 ],
90- "offensive_assists" : data [18 ], "ultimated_earn" : data [19 ], "ultimates_used" : data [20 ], "solo_kills" : data [23 ],
91- "critical_hits_accuracy" : data [28 ], "weapon_accuracy" : data [37 ], "hero_time_played" : data [38 ]}
93+ player_data = {"eliminations" : data [7 ], "final_blows" : data [8 ], "deaths" : data [9 ], "damage" : data [10 ],
94+ "barrier_damage" : data [11 ], "hero_damage" : data [12 ], "healing" : data [13 ], "healing_receive" : data [14 ],
95+ "self_healing" : data [15 ], "damage_taken" : data [16 ], "damage_blocked" : data [17 ], "defensive_assist" : data [18 ],
96+ "offensive_assists" : data [19 ], "ultimated_earn" : data [20 ], "ultimates_used" : data [21 ], "solo_kills" : data [24 ],
97+ "critical_hits_accuracy" : data [29 ], "weapon_accuracy" : data [38 ], "hero_time_played" : data [39 ]}
9298
9399 if player_data ["hero_time_played" ] != "0" and data [6 ] in self .rounds [self .actual_round ].teams [data [4 ]].players [data [5 ]].characters :
94100 self .rounds [self .actual_round ].teams [data [4 ]].players [data [5 ]].characters [data [6 ]].add_character_stats (player_data )
@@ -146,7 +152,7 @@ def add_objective_progress(self, data):
146152 def end_round (self , data ):
147153
148154 end_round_data = {"time" : data [2 ], "team1_score" : data [5 ], "team2_score" : data [6 ]}
149-
155+ self . rounds [ self . actual_round ]. end_time = data [ 2 ]
150156 for team in self .rounds [self .actual_round ].teams :
151157 for player in self .rounds [self .actual_round ].teams [team ].players :
152158 for character in self .rounds [self .actual_round ].teams [team ].players [player ].characters :
@@ -167,3 +173,12 @@ def end_map(self, data):
167173
168174 self .team1_score = end_map_data ["team1_score" ]
169175 self .team2_score = end_map_data ["team2_score" ]
176+
177+
178+ def find_team_for_player (self , player_name ):
179+
180+ for team in self .rounds [self .actual_round ].teams :
181+ if player_name in self .rounds [self .actual_round ].teams [team ].players :
182+ return team
183+
184+ return None
0 commit comments