Skip to content

Commit 13bf345

Browse files
committed
Massive reworking of s2gs code.
1 parent 2837ce6 commit 13bf345

File tree

3 files changed

+286
-300
lines changed

3 files changed

+286
-300
lines changed

sc2reader/objects.py

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@
1414
ColorData = namedtuple('ColorData',['a','r','g','b'])
1515
BnetData = namedtuple('BnetData',['unknown1','unknown2','subregion','uid'])
1616

17+
class DepotHash(object):
18+
url_template = 'http://{0}.depot.battle.net:1119/{1}.{2}'
19+
20+
def __init__(self, bytes):
21+
self.server = bytes[4:8].strip('\x00 ')
22+
self.hash = bytes[8:].encode('hex')
23+
self.type = bytes[0:4]
24+
25+
def __str__(self):
26+
return self.url_template.format(self.server, self.hash, self.type)
27+
28+
1729
class Team(object):
1830
"""
1931
The team object primarily a container object for organizing :class:`Player`
@@ -228,22 +240,6 @@ def __repr__(self):
228240

229241

230242
class PlayerSummary():
231-
"""
232-
A class to represent a player in the game summary (.s2gs)
233-
"""
234-
stats_pretty_names = {
235-
'R' : 'Resources',
236-
'U' : 'Units',
237-
'S' : 'Structures',
238-
'O' : 'Overview',
239-
'AUR' : 'Average Unspent Resources',
240-
'RCR' : 'Resource Collection Rate',
241-
'WC' : 'Workers Created',
242-
'UT' : 'Units Trained',
243-
'KUC' : 'Killed Unit Count',
244-
'SB' : 'Structures Built',
245-
'SRC' : 'Structures Razed Count'
246-
}
247243

248244
#: The index of the player in the game
249245
pid = int()
@@ -283,8 +279,6 @@ class PlayerSummary():
283279

284280
def __init__(self, pid):
285281
self.unknown2 = dict()
286-
self.stats = dict()
287-
288282
self.pid = pid
289283

290284
def __str__(self):

0 commit comments

Comments
 (0)