Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
happyleavesaoc committed Nov 14, 2022
1 parent 16000b9 commit 367ed4d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions mgz/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@


TC_IDS = [71, 109, 141, 142]
AI_ACTIONS = [ActionEnum.AI_ORDER]


def enrich_action(action, action_data, dataset, consts):
Expand Down Expand Up @@ -256,10 +257,11 @@ def parse_match(handle):
elif op_type is fast.Operation.ACTION:
action_type, action_data = op_data
action = Action(timedelta(milliseconds=timestamp), action_type, action_data)
if action_type is fast.Action.RESIGN:
if action_type is fast.Action.RESIGN and action_data['player_id'] in players:
resigned.append(players[action_data['player_id']])
if 'player_id' in action_data and action_data['player_id'] in players:
eapm[action_data['player_id']] += 1
if action_type not in AI_ACTIONS:
eapm[action_data['player_id']] += 1
action.player = players[action_data['player_id']]
del action.payload['player_id']
enrich_action(action, action_data, dataset, consts)
Expand Down
3 changes: 2 additions & 1 deletion mgz/summary/full.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
LOGGER = logging.getLogger(__name__)
CHECKSUMS = 4
MAX_SYNCS = 2000
AI_ACTIONS = [fast.Action.AI_ORDER]


class FullSummary: # pylint: disable=too-many-public-methods
Expand Down Expand Up @@ -110,7 +111,7 @@ def _process_body(self): # pylint: disable=too-many-locals, too-many-statements,
if payload[1] and len(checksums) < CHECKSUMS:
checksums.append(payload[1].to_bytes(8, 'big', signed=True))
elif operation == fast.Operation.ACTION:
if 'player_id' in payload[1]:
if 'player_id' in payload[1] and payload[0] not in AI_ACTIONS:
self._eapm[payload[1]['player_id']] += 1
self._actions.append((duration, *payload))
if payload[0] == fast.Action.POSTGAME:
Expand Down

0 comments on commit 367ed4d

Please sign in to comment.