Skip to content

Commit 9dd2f94

Browse files
committed
Remove some old dead code.
1 parent 336f23f commit 9dd2f94

File tree

1 file changed

+0
-79
lines changed

1 file changed

+0
-79
lines changed

sc2reader/resources.py

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,6 @@ def __init__(self, summary_file, filename=None, lang='enUS', **options):
761761
self.load_map_info()
762762
self.load_settings()
763763
self.load_player_stats()
764-
# self.load_player_builds()
765764
self.load_players()
766765

767766
self.game_type = self.settings['Teams'].replace(" ","")
@@ -1033,7 +1032,6 @@ def load_players(self):
10331032
player.resource_collection_graph = stats.get('Resource Collection Rate', None)
10341033
player.income_graph = player.resource_collection_graph
10351034

1036-
10371035
# HotS Stats
10381036
# TODO: Add the XP stats?
10391037
# 'Units Produced XP'
@@ -1066,83 +1064,6 @@ def load_players(self):
10661064
self.players.append(player)
10671065
self.player[player.pid] = player
10681066

1069-
"""
1070-
def load_player_stats(self):
1071-
if len(self.parts) < 4: return
1072-
translation = self.translations[self.opt.lang]
1073-
1074-
# Part[3][0][:] and Part[4][0][1] are filled with summary stats
1075-
# for the players in the game.
1076-
# Each stat item is laid out as follows
1077-
#
1078-
# {0: {0:999, 1:translation_id}, 1: [ [{0: Value, 1:0, 2:871???}], [], ...]
1079-
#
1080-
# Value is as seen on the score screen in game.
1081-
stats_items = self.parts[3][0]
1082-
if len(self.parts) > 4:
1083-
stats_items.append(self.parts[4][0][0])
1084-
1085-
for item in stats_items:
1086-
stat_name = translation.get(item[0][1],"Unknown")
1087-
for index, value in enumerate(item[1]):
1088-
if value:
1089-
self.player_stats[index][stat_name] = value[0][0]
1090-
1091-
if len(self.parts) < 5: return
1092-
1093-
# Part[4][0] has entries for the army and income graphs
1094-
# Each point entry for the graph is laid out as follows
1095-
#
1096-
# {0:Value, 1:0, 2:Time}
1097-
#
1098-
# The 2nd part of the tuple appears to always be zero and
1099-
# the time is in seconds of game time.
1100-
for index, items in enumerate(self.parts[4][0][1][1]):
1101-
xy = [(o[2], o[0]) for o in items]
1102-
self.player_stats[index]['Income Graph'] = Graph([], [], xy_list=xy)
1103-
1104-
for index, items in enumerate(self.parts[4][0][2][1]):
1105-
xy = [(o[2], o[0]) for o in items]
1106-
self.player_stats[index]['Army Graph'] = Graph([], [], xy_list=xy)
1107-
1108-
def load_player_builds(self):
1109-
# Parse build orders only if it looks like we have build items
1110-
if len(self.parts) < 5: return
1111-
translation = self.translations[self.opt.lang]
1112-
1113-
# All the parts after part 5 appear to be designated for
1114-
# build order entries with a max of 10 per part
1115-
build_items = sum([x[0] for x in self.parts[5:]], [])
1116-
build_items.extend(self.parts[4][0][3:])
1117-
1118-
# Each build item represents one ability and contains
1119-
# a list of all the uses of that ability by each player
1120-
# up to the first 64 successful actions in the game.
1121-
BuildEntry = namedtuple('BuildEntry',['supply','total_supply','time','order','build_index'])
1122-
for build_item in build_items:
1123-
translation_key = build_item[0][1]
1124-
# Here instead of recording unknown entries we just skip them because
1125-
# it seems that unknown entries actually don't belong in the build order
1126-
# We should revisit this decision in the future.
1127-
if translation_key in translation:
1128-
order_name = translation[translation_key]
1129-
for pindex, commands in enumerate(build_item[1]):
1130-
for command in commands:
1131-
self.build_orders[pindex].append(BuildEntry(
1132-
supply=command[0],
1133-
total_supply=command[1]&0xff,
1134-
time=(command[2] >> 8) / 16,
1135-
order=order_name,
1136-
build_index=command[1] >> 16
1137-
))
1138-
else:
1139-
self.logger.warn("Unknown item in build order, key = {0}".format(translation_key))
1140-
1141-
# Once we've compiled all the build commands we need to make
1142-
# sure they are properly sorted for presentation.
1143-
for build_order in self.build_orders.values():
1144-
build_order.sort(key=lambda x: x.build_index)
1145-
"""
11461067

11471068
def __str__(self):
11481069
return "{0} - {1} {2}".format(self.start_time,self.game_length,

0 commit comments

Comments
 (0)