Skip to content

Commit 751704d

Browse files
committed
Grouped player's color related thing with a prefix color_ for consistency
1 parent d9c209f commit 751704d

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

sc2reader/objects.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,14 @@ def __init__(self, pid, data, realm="us"):
168168
self.url = self.url_template % (self.realm, self.uid, self.subregion, self.name)
169169
self.actual_race = data[2].decode("hex")
170170
self.choosen_race = "" # Populated from the replay.attribute.events file
171-
self.rgba = dict([
171+
self.color_rgba = dict([
172172
['r', data[3][1]],
173173
['g', data[3][2]],
174174
['b', data[3][3]],
175175
['a', data[3][0]],
176176
])
177-
self.hex_color = "%02X%02X%02X" % (data[3][1], data[3][2], data[3][3])
177+
self.color_hex = "%02X%02X%02X" % (data[3][1], data[3][2], data[3][3])
178+
self.color_text = "" # The text of the player color (Red, Blue, etc) to be supplied later
178179
self.recorder = True # Actual recorder will be determined using the replay.message.events file
179180
self.handicap = data[6]
180181
self.team = None # A number to be supplied later

sc2reader/parsers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def load(self, replay, filecontents):
111111
for pid, attributes in data.iteritems():
112112
if pid == 16: continue
113113
player = replay.player[pid]
114-
player.color = attributes['Color']
114+
player.color_text = attributes['Color']
115115
player.team = attributes['Teams'+replay.type]
116116
player.choosen_race = attributes['Race']
117117
player.difficulty = attributes['Difficulty']

shell.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
# print replay.players[0].rgba
1111
# print "%02X%02X%02X" % (replay.players[0].rgba['r'], replay.players[0].rgba['g'], replay.players[0].rgba['b'])
1212

13-
replay = Replay("94.sc2replay")
13+
replay = Replay("1.sc2replay")

0 commit comments

Comments
 (0)