Changed config file format to TOML

This commit is contained in:
Collin R
2020-02-03 18:53:23 -08:00
parent 5b3a3d8f1f
commit 107e5f6bfb
6 changed files with 167 additions and 88 deletions

View File

@@ -3,9 +3,9 @@ from collections import namedtuple
### Data Structures ###
# A (string, int) tuple
Level = namedtuple('Level', 'name points')
Level = namedtuple('Level', 'name points flair_template_id')
# A ([Level], Level, Level) tuple;
# A ([Level], Level, Level) tuple
# previous can be empty, and exactly one of current and next can be None
LevelInfo = namedtuple('LevelInfo', 'previous current next')
@@ -25,8 +25,7 @@ def user_level_info(points, levels):
past_levels, cur_level, next_level = [], None, None
for level in levels:
lvlname, lvlpoints = level
if points < lvlpoints:
if points < level.points:
next_level = level
break
if cur_level: