Skip to content

Commit 4d971f0

Browse files
committed
Patch AbilityEvent logging and __str__.
1 parent b4f1eaa commit 4d971f0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

sc2reader/events.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,18 +132,17 @@ def load_context(self, replay):
132132
self.logger.error("Release String: "+replay.release_string)
133133
for player in replay.players:
134134
self.logger.error("\t"+str(player))
135-
self.logger.error("{0}\t{1}\tMissing ability {2} from {3}".format(self.frame, self.player.name, hex(self.ability), replay.datapack.__class__.__name__))
135+
self.logger.error("{0}\t{1}\tMissing ability {2} from {3}".format(self.frame, self.player.name, hex(self.ability_code), replay.datapack.__class__.__name__))
136136

137137
else:
138138
self.ability_name = replay.datapack.abilities[self.ability_code]
139139

140140

141141
def __str__(self):
142-
if not self.ability:
142+
if not self.ability_code:
143143
return self._str_prefix() + "Move"
144144
else:
145-
ability_name = self.data.ability(self.ability) if self.ability in self.data.abilities else "UNKNOWN"
146-
return self._str_prefix() + "Ability (%s) - %s" % (hex(self.ability), ability_name)
145+
return self._str_prefix() + "Ability (%s) - %s" % (hex(self.ability_code), self.ability_name)
147146

148147
class TargetAbilityEvent(AbilityEvent):
149148
def __init__(self, framestamp, player, type, code, ability, target):

0 commit comments

Comments
 (0)