Some minor cleanup.

This commit is contained in:
Storm Dragon
2025-03-21 20:54:13 -04:00
parent cb69189c8e
commit 87d0764156
16 changed files with 193 additions and 193 deletions

View File

@@ -10,10 +10,10 @@ class StatTracker:
'Items collected': 0,
'Total time': 0
}
# Create level stats from total (shallow copy is fine here)
self.level = self.total.copy()
self.total['levelsCompleted'] = 0
def reset_level(self):
@@ -27,18 +27,18 @@ class StatTracker:
self.level[key] = []
elif self.level[key] is None:
self.level[key] = None
def update_stat(self, statName, value=1, levelOnly=False):
"""Update a stat in both level and total (unless levelOnly is True)"""
if statName in self.level:
self.level[statName] += value
if not levelOnly and statName in self.total:
self.total[statName] += value
def get_level_stat(self, statName):
"""Get a level stat"""
return self.level.get(statName, 0)
def get_total_stat(self, statName):
"""Get a total stat"""
return self.total.get(statName, 0)