Skip to content

Commit 367ed4d

Browse files
fixes
1 parent 16000b9 commit 367ed4d

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

mgz/model/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323

2424
TC_IDS = [71, 109, 141, 142]
25+
AI_ACTIONS = [ActionEnum.AI_ORDER]
2526

2627

2728
def enrich_action(action, action_data, dataset, consts):
@@ -256,10 +257,11 @@ def parse_match(handle):
256257
elif op_type is fast.Operation.ACTION:
257258
action_type, action_data = op_data
258259
action = Action(timedelta(milliseconds=timestamp), action_type, action_data)
259-
if action_type is fast.Action.RESIGN:
260+
if action_type is fast.Action.RESIGN and action_data['player_id'] in players:
260261
resigned.append(players[action_data['player_id']])
261262
if 'player_id' in action_data and action_data['player_id'] in players:
262-
eapm[action_data['player_id']] += 1
263+
if action_type not in AI_ACTIONS:
264+
eapm[action_data['player_id']] += 1
263265
action.player = players[action_data['player_id']]
264266
del action.payload['player_id']
265267
enrich_action(action, action_data, dataset, consts)

mgz/summary/full.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
LOGGER = logging.getLogger(__name__)
3535
CHECKSUMS = 4
3636
MAX_SYNCS = 2000
37+
AI_ACTIONS = [fast.Action.AI_ORDER]
3738

3839

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

0 commit comments

Comments
 (0)