@@ -15,20 +15,24 @@ def __init__(self, path_csv, name) -> None:
1515
1616 self .actions = {"match_start" : self .process_match_start ,
1717 "round_start" : self .process_round_start ,
18- "hero_spawn" : self .process_hero_spawn }
18+ "hero_spawn" : self .process_hero_spawn ,
19+ "hero_swap" : self .process_hero_swap
20+ }
1921
2022 def run (self ):
2123
2224 with open (self .path_csv , encoding = 'utf-8' ) as my_file :
23- line = my_file .read ()
24- line_split = line .split ("," )
25- # print(line_split)
25+ file = my_file .read ()
26+ lines = file .split ("\n " )
27+ for line in lines :
28+ line_split = line .split ("," )
2629
27- timestamp = line_split [0 ]
28- type = line_split [1 ]
29-
30- if type in self .actions :
31- self .actions [type ](line_split )
30+ if len (line_split ) > 1 :
31+ type = line_split [1 ]
32+ if type in self .actions :
33+ self .actions [type ](line_split )
34+
35+ self .match .export_json ()
3236
3337
3438 def name2datetime (self ):
@@ -46,10 +50,10 @@ def process_kill(self):
4650 def process_ultimate_charged (self ):
4751 pass
4852
49- def process_round_start (self ):
53+ def process_round_start (self , data ):
5054
5155 self .match .add_round ()
52-
56+ # self.match.export_json()
5357 def process_round_stop (self ):
5458 pass
5559
@@ -62,11 +66,17 @@ def process_match_start(self, data):
6266 "team1_name" : data [5 ],
6367 "team2_name" : data [6 ]
6468 })
65-
69+
6670 def process_hero_spawn (self , data ):
67- pass
68-
69-
7071
71- la = LogAnalyser ('src/logs/Log-2023-12-22-21-12-32.txt' , "Log-2023-12-22-21-12-32.txt" )
72+ player_data = {"team_name" : data [3 ], "player_name" : data [4 ], "character_name" : data [5 ]}
73+ self .match .add_player (player_data )
74+
75+ def process_hero_swap (self , data ):
76+
77+ hero_data = {"team_name" : data [3 ], "player_name" : data [4 ], "character_name" : data [6 ]}
78+ self .match .add_player (hero_data )
79+
80+
81+ la = LogAnalyser ('../logs/Log-2023-12-22-21-12-32.txt' , "Log-2023-12-22-21-12-32.txt" )
7282la .run ()
0 commit comments