-
Notifications
You must be signed in to change notification settings - Fork 0
/
hotsparser.py
30 lines (22 loc) · 1.04 KB
/
hotsparser.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
__author__ = 'Rodrigo Duenas, Cristian Orellana'
from replay import *
def processEvents(protocol=None, replayFile=None, team1=None, team2=None, event=None, stage=None):
""""
This is the main loop, reads a replayFile and applies available decoders (trackerEvents, gameEvents, msgEvents, etc)
Receives the protocol and the replayFile as an mpyq file object
"""
if not protocol or not replayFile:
print "Error - Protocol and replayFile are needed"
return -1
replay_data = Replay(protocol, replayFile, team1, team2, event, stage)
if not replay_data.process_replay_details():
raise ValueError('invalid replay')
if not replay_data.replayInfo.is_allowed_game_type():
raise ValueError('invalid replay')
replay_data.process_replay_initdata()
replay_data.process_replay()
replay_data.process_replay_attributes()
#replay_data.calculate_army_strength()
#replay_data.process_map_events()
#replay_data.process_generic_events() throws errors
return replay_data