From 3eb2714534cfffe17546e6ba0abb5b79ba18d056 Mon Sep 17 00:00:00 2001 From: Jylpah Date: Sun, 25 Oct 2020 12:47:30 +0200 Subject: [PATCH] mk_battle_modes(): helper for Battle modes --- analyze_wotb_replays.py | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/analyze_wotb_replays.py b/analyze_wotb_replays.py index 0c50c58..5a93a2e 100755 --- a/analyze_wotb_replays.py +++ b/analyze_wotb_replays.py @@ -91,15 +91,41 @@ def def_value_BattleRecord(): return BattleRecord() class BattleRecordCategory(): + + @staticmethod + def mk_battle_modes(modes: dict): + """Make a list of battle modes as required for the _result_categories""" + mode_ids = modes.values() + id_max = max(mode_ids) + ret_modes = ['-'] * (id_max+16) # create a list of '-' elements + + for mode in modes: + id = modes[mode] + ret_modes[id] = mode + + return ret_modes + + _battle_modes = { + 'Any' : 0, + 'Random' : 1, + 'Training Room' : 2, + 'Tournament' : 4, + 'Rating' : 7, + 'Mad Games' : 8, + 'Realistic Battles' : 22, + 'Gravity Mode' : 24, + 'Burning Games' : 26 + } + + _BATTLE_MODES = mk_battle_modes.__func__(_battle_modes) + _result_categories = { 'total' : [ 'TOTAL', 'total' ], 'battle_result' : [ 'Result', [ 'Loss', 'Win', 'Draw']], 'battle_type' : [ 'Battle Type', ['Encounter', 'Supremacy']], 'tank_tier' : [ 'Tank Tier', 'number' ], 'top_tier' : [ 'Tier', ['Bottom tier', 'Top tier']], - 'room_type' : [ 'Battle Mode', ['Any', 'Random', 'Training Room', '-', 'Tournament', '-', '-', 'Rating', 'Mad Games', '-', \ - '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', \ - '-', '-','Realistic Battles', '-', 'Gravity Mode', '-', 'Burning Games', '-', '-', '-'] ], + 'room_type' : [ 'Battle Mode', _BATTLE_MODES ], 'mastery_badge' : [ 'Battle Medal', ['-', '3rd Class', '2nd Class', '1st Class', 'Mastery' ]], 'team_result' : [ 'Team Result', 'string' ], 'map_name' : [ 'Map', 'string' ], @@ -132,6 +158,7 @@ class BattleRecordCategory(): RESULT_CAT_FRMT = '{:>20s}' + @classmethod def get_default_categories(cls): return cls._result_categories_default