Skip to content

Commit a5f4791

Browse files
committed
started localization of actual_race
1 parent be8cf30 commit a5f4791

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

sc2reader/data.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Encoding: UTF-8
2+
13
abilities = {
24

35
#Zerg Create Unit
@@ -307,3 +309,10 @@
307309
0x003d01: 'Mineral Field',
308310
0x022b01: 'Rich Mineral Field',
309311
}
312+
313+
# question mark means not confirmed data
314+
races = {
315+
# KR?
316+
'프로토스': 'Protoss', #?
317+
'테란': 'Terran' #?
318+
}

sc2reader/objects.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from data import races
2+
13
class Attribute(object):
24

35
def __init__(self, data):
@@ -183,6 +185,10 @@ def __init__(self, pid, data, realm="us"):
183185
self.subregion = data[1][2]
184186
self.url = self.url_template % (self.realm, self.uid, self.subregion, self.name)
185187
self.actual_race = data[2].decode("hex")
188+
189+
# Actual race seems to be localized, so try to convert to english if possible
190+
if self.actual_race in races:
191+
self.actual_race = races[self.actual_race]
186192
self.choosen_race = "" # Populated from the replay.attribute.events file
187193
self.color_rgba = dict([
188194
['r', data[3][1]],

0 commit comments

Comments
 (0)