Skip to content

Commit 336f23f

Browse files
committed
Use resource_collection_ rate and graph now.
Keep income_graph around for backwards compatibility.
1 parent 11ea132 commit 336f23f

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

sc2reader/resources.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,8 +1028,11 @@ def load_players(self):
10281028
player.structures_razed = stats.get('Structures Razed Count', None)
10291029

10301030
# Graphs Tab
1031+
# Keep income_graph for backwards compatibility
10311032
player.army_graph = stats.get('Army Value')
1032-
player.income_graph = stats.get('Resource Collection Rate', None)
1033+
player.resource_collection_graph = stats.get('Resource Collection Rate', None)
1034+
player.income_graph = player.resource_collection_graph
1035+
10331036

10341037
# HotS Stats
10351038
# TODO: Add the XP stats?
@@ -1045,13 +1048,13 @@ def load_players(self):
10451048
player.apm = stats.get('APM', None)
10461049

10471050
# Economic Breakdown Tab
1048-
if isinstance(player.income_graph, Graph):
1049-
# TODO: Is this algorithm right?
1050-
values = player.income_graph.values
1051-
player.income_rate = sum(values)/len(values)
1051+
if isinstance(player.resource_collection_graph, Graph):
1052+
values = player.resource_collection_graph.values
1053+
player.resource_collection_rate = sum(values)/len(values)
10521054
else:
10531055
# In old s2gs files the field with this name was actually a number not a graph
1054-
player.income_rate = player.income_graph
1056+
player.resource_collection_rate = player.resource_collection_graph
1057+
player.resource_collection_graph = None
10551058
player.income_graph = None
10561059

10571060
player.avg_unspent_resources = stats.get('Average Unspent Resources', None)

0 commit comments

Comments
 (0)