: all by default
This commit is contained in:
Wiktor Mazur
2020-03-12 20:33:59 +01:00
parent f5e69f9e0d
commit 80d87ee230
3 changed files with 11 additions and 19 deletions
+8 -9
View File
@@ -107,25 +107,24 @@ class FameStat:
self.fame_per_hour = fame_per_hour self.fame_per_hour = fame_per_hour
def zone_stats(with_damage=False): def zone_stats():
return get_stats(StatType.Zone, with_damage) return get_stats(StatType.Zone)
def overall_stats(with_damage=False): def overall_stats():
return get_stats(StatType.Overall, with_damage) return get_stats(StatType.Overall)
def last_fight_stats(with_damage=False): def last_fight_stats():
return get_stats(StatType.LastFight, with_damage) return get_stats(StatType.LastFight)
def get_stats(stat_type: StatType, with_damage: bool): def get_stats(stat_type: StatType):
fame = game_stats.fame_stats(stat_type) fame = game_stats.fame_stats(stat_type)
time = game_stats.time_stats(stat_type)['seconds_in_game'] time = game_stats.time_stats(stat_type)['seconds_in_game']
fame = FameStat(Number(fame['fame']), Number( fame = FameStat(Number(fame['fame']), Number(
fame['fame'] / time if time > 0.0 else 0.0)) fame['fame'] / time if time > 0.0 else 0.0))
players = list(filter(lambda p: p.value != players = game_stats.damage_stats(stat_type)
0.0 if with_damage else True, game_stats.damage_stats(stat_type)))
return players, fame, time return players, fame, time
+3 -9
View File
@@ -50,7 +50,6 @@ class ViewTypeWidget(QComboBox):
def __init__(self): def __init__(self):
QComboBox.__init__(self) QComboBox.__init__(self)
self.addItem(ViewType.DMG) self.addItem(ViewType.DMG)
self.addItem(ViewType.DMG_ALL)
def get_view_type(self): def get_view_type(self):
return self.currentText() return self.currentText()
@@ -130,14 +129,9 @@ class MainWidget(QWidget):
def damage_stats(self): def damage_stats(self):
stats = { stats = {
ViewType.DMG: { ViewType.DMG: {
StatsType.ZONE: functools.partial(engine.zone_stats, with_damage=True), StatsType.ZONE: functools.partial(engine.zone_stats),
StatsType.LAST_FIGHT: functools.partial(engine.last_fight_stats, with_damage=True), StatsType.LAST_FIGHT: functools.partial(engine.last_fight_stats),
StatsType.OVERALL: functools.partial(engine.overall_stats, with_damage=True), StatsType.OVERALL: functools.partial(engine.overall_stats),
},
ViewType.DMG_ALL: {
StatsType.ZONE: functools.partial(engine.zone_stats, with_damage=False),
StatsType.LAST_FIGHT: functools.partial(engine.last_fight_stats, with_damage=False),
StatsType.OVERALL: functools.partial(engine.overall_stats, with_damage=False),
} }
} }
-1
View File
@@ -1,3 +1,2 @@
class ViewType: class ViewType:
DMG = 'Stats (damage)' DMG = 'Stats (damage)'
DMG_ALL = 'Stats (damage all)'