Skip to content

Commit da1b863

Browse files
committed
attempt to merge graylinkim/sc2reader hots branch into master branch of ggtracker/sc2reader
2 parents d45e468 + ac1e114 commit da1b863

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+7850
-4880
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@ dist
44
build
55
sc2reader.egg-info
66
replay_profile
7-
PKG-INFO.txt
7+
PKG-INFO.txt
8+
sc2reader/bin
9+
sc2reader/include
10+
sc2reader/lib

STYLE_GUIDE.rst

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
STYLE GUIDE
2+
==============
3+
4+
Use your common sense and have some decency. Also try to stick to the following where reasonable.
5+
6+
7+
Absolute Imports
8+
----------------------
9+
10+
Always use absolute imports::
11+
12+
from __future__ import absolute_import
13+
14+
That means imports should always start with sc2reader... instead of being relative to the current module.
15+
16+
from sc2reader.utils import ReplayBuffer
17+
18+
19+
Explicit Imports
20+
---------------------
21+
22+
Prefer explicit imports to globbed imports
23+
24+
from sc2reader.events import ChatEvent
25+
26+
is better than
27+
28+
from sc2reader.events import *
29+
30+
31+
Formatting Strings
32+
-----------------------
33+
34+
Use string.format(args) instead string % (args).
35+
36+
To support python 2.6, use numerical indexes even though it is a pain in the ass::
37+
38+
"{0} minerals, {1} gas, {2} terrazine, and {3} custom".format(self.minerals, self.vespene, self.terrazine, self.custom)
39+

sc2reader/constants.py

Lines changed: 119 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -50,71 +50,14 @@
5050
# ptBR - Brazilian Portuguese
5151
}
5252

53-
#
54-
# Codes as found in bytestream
55-
#
56-
57-
RACE_CODES = {
58-
'Terr': 'Terran',
59-
'Zerg': 'Zerg',
60-
'Prot': 'Protoss',
61-
'RAND': 'Random',
62-
}
6353
MESSAGE_CODES = {
6454
'0': 'All',
6555
'2': 'Allies',
6656
'128': 'Header',
6757
'125': 'Ping',
6858
}
69-
TEAM_COLOR_CODES = {
70-
'tc01': "Red",
71-
'tc02': "Blue",
72-
'tc03': "Teal",
73-
'tc04': "Purple",
74-
'tc05': "Yellow",
75-
'tc06': "Orange",
76-
'tc07': "Green",
77-
'tc08': "Light Pink",
78-
'tc09': "Violet",
79-
'tc10': "Light Grey",
80-
'tc11': "Dark Green",
81-
'tc12': "Brown",
82-
'tc13': "Light Green",
83-
'tc14': "Dark Grey",
84-
'tc15': "Pink",
85-
'tc16': "??",
86-
}
87-
DIFFICULTY_CODES = {
88-
'VyEy': 'Very easy',
89-
'Easy': 'Easy',
90-
'Medi': 'Medium',
91-
'Hard': 'Hard',
92-
'VyHd': 'Very hard',
93-
'Insa': 'Insane',
94-
}
95-
GAME_TYPE_CODES = {
96-
'Priv': 'Private',
97-
'Pub': 'Public',
98-
'Amm': 'Ladder',
99-
'': 'Single',
100-
}
101-
# (name, key for team ids)
102-
GAME_FORMAT_CODES = {
103-
'1v1': '1v1',
104-
'2v2': '2v2',
105-
'3v3': '3v3',
106-
'4v4': '4v4',
107-
'5v5': '5v5',
108-
'6v6': '6v6',
109-
'FFA': 'FFA',
110-
}
111-
GAME_SPEED_CODES = {
112-
'Slor': 'Slower',
113-
'Slow': 'Slow',
114-
'Norm': 'Normal',
115-
'Fast': 'Fast',
116-
'Fasr': 'Faster',
117-
}
59+
60+
11861

11962
GAME_SPEED_FACTOR = {
12063
'Slower': 0.6,
@@ -124,12 +67,6 @@
12467
'Faster': 1.4
12568
}
12669

127-
PLAYER_TYPE_CODES = {
128-
'Humn': 'Human',
129-
'Comp': 'Computer',
130-
'Open': 'Open',
131-
'Clsd': 'Closed',
132-
}
13370
GATEWAY_CODES = {
13471
'US': 'Americas',
13572
'KR': 'Asia',
@@ -355,3 +292,120 @@
355292
1: 'xx',
356293
},
357294
}
295+
296+
""" Still unknown
297+
bbe: 3, 5, 7, 10, 15, 20, 25, 30
298+
"""
299+
LOBBY_PROPERTIES = {
300+
# Default seems to be the only value possible.
301+
# This arcade entry is just a hunch, need to confirm with an arcade game
302+
0x03E8: ("???", {
303+
'Dflt': 'Default'
304+
}),
305+
0x03E9: ("Arcade", {
306+
'no':'no',
307+
'yes':'yes'
308+
}),
309+
310+
0x01F4: ("Player Type", {
311+
'Humn': 'Human',
312+
'Comp': 'Computer',
313+
'Open': 'Open',
314+
'Clsd': 'Closed',
315+
}),
316+
317+
0x07D1: ("Game Mode", {
318+
'1v1': '1v1',
319+
'2v2': '2v2',
320+
'3v3': '3v3',
321+
'4v4': '4v4',
322+
'5v5': '5v5',
323+
'6v6': '6v6',
324+
'FFA': 'FFA',
325+
}),
326+
327+
0x07D0: ("Team Count", lambda value: value), #T1,2,3,4,5,6, or Custom
328+
0x07D2: ("Teams1v1", lambda value: int(value[1:])),
329+
0x07D3: ("Teams2v2", lambda value: int(value[1:])),
330+
0x07D4: ("Teams3v3", lambda value: int(value[1:])),
331+
0x07D5: ("Teams4v4", lambda value: int(value[1:])),
332+
0x07D6: ("TeamsFFA", lambda value: int(value[1:])),
333+
0x07D7: ("Teams5v5", lambda value: int(value[1:])),
334+
0x07D8: ("Teams6v6", lambda value: int(value[1:])),
335+
336+
0x07DB: ("2 Teams", lambda value: int(value[1:])),
337+
0x07DC: ("3 Teams", lambda value: int(value[1:])),
338+
0x07DD: ("4 Teams", lambda value: int(value[1:])),
339+
0x07DE: ("5 Teams", lambda value: int(value[1:])),
340+
341+
0x07E1: ("FFA Teams", lambda value: int(value[1:])),
342+
0x07E2: ("Custom Teams", lambda value: int(value[1:])),
343+
344+
0x0BB8: ("Game Speed", {
345+
'Slor': 'Slower',
346+
'Slow': 'Slow',
347+
'Norm': 'Normal',
348+
'Fast': 'Fast',
349+
'Fasr': 'Faster',
350+
}),
351+
0x0BB9: ("Race", {
352+
'Terr': 'Terran',
353+
'Zerg': 'Zerg',
354+
'Prot': 'Protoss',
355+
'RAND': 'Random',
356+
}),
357+
0x0BBA: ("Color", {
358+
'tc01': "Red",
359+
'tc02': "Blue",
360+
'tc03': "Teal",
361+
'tc04': "Purple",
362+
'tc05': "Yellow",
363+
'tc06': "Orange",
364+
'tc07': "Green",
365+
'tc08': "Light Pink",
366+
'tc09': "Violet",
367+
'tc10': "Light Grey",
368+
'tc11': "Dark Green",
369+
'tc12': "Brown",
370+
'tc13': "Light Green",
371+
'tc14': "Dark Grey",
372+
'tc15': "Pink",
373+
'tc16': "??",
374+
}),
375+
0x0BBB: ("Handicap", {
376+
'50': '50',
377+
'60': '60',
378+
'70': '70',
379+
'80': '80',
380+
'90': '90',
381+
'100': '100',
382+
}),
383+
0x0BBC: ("Difficulty", {
384+
'VyEy': 'Very easy',
385+
'Easy': 'Easy',
386+
'Medi': 'Medium',
387+
'Hard': 'Hard',
388+
'VyHd': 'Very hard',
389+
'Insa': 'Insane',
390+
}),
391+
392+
393+
0x0BBF: ("Player Type", {
394+
'Part':'Participant',
395+
'Watc':'Watcher'
396+
}),
397+
0x0BC0: ("Watcher Type", {
398+
'Obs': 'Observer',
399+
'Ref':'Referee'
400+
}),
401+
0x0BC1: ("Category", {
402+
'Priv': 'Private',
403+
'Pub': 'Public',
404+
'Amm': 'Ladder',
405+
'': 'Single',
406+
}),
407+
0x0BC2: ("Alliances", {
408+
'no':'unlocked',
409+
'yes':'locked',
410+
})
411+
}

0 commit comments

Comments
 (0)