diff --git a/modules/wolfgame.py b/modules/wolfgame.py index 49cb772..25c7312 100644 --- a/modules/wolfgame.py +++ b/modules/wolfgame.py @@ -1048,21 +1048,10 @@ def stats(cli, nick, chan, rest): if var.ROLES[k]] l2 = [k for k in var.ORIGINAL_ROLES.keys() if var.ORIGINAL_ROLES[k]] - rs = list(set(l1+l2)) + rs = set(l1+l2) + rs = [role for role in var.role_order() if role in rs] - # Due to popular demand, picky ordering - if "wolf" in rs: - rs.remove("wolf") - rs.insert(0, "wolf") - if "augur" in rs: - rs.remove("augur") - rs.insert(1, "augur") - if "oracle" in rs: - rs.remove("oracle") - rs.insert(1, "oracle") - if "seer" in rs: - rs.remove("seer") - rs.insert(1, "seer") + # picky ordering: villager always last if var.DEFAULT_ROLE in rs: rs.remove(var.DEFAULT_ROLE) rs.append(var.DEFAULT_ROLE) diff --git a/settings/wolfgame.py b/settings/wolfgame.py index f1b59e4..77aa256 100644 --- a/settings/wolfgame.py +++ b/settings/wolfgame.py @@ -311,6 +311,7 @@ def get_templates(nick): return tpl +#order goes: wolfteam roles, then other roles in alphabetical order, then templates def role_order(): templates = list(TEMPLATE_RESTRICTIONS.keys()) vils = [role for role in ROLE_GUIDE.keys() if role not in WOLFTEAM_ROLES+templates] @@ -983,7 +984,11 @@ def get_player_totals(acc): role_tmp[row[0]] += row[1] else: break - role_totals = ["\u0002{0}\u0002: {1}".format(role, count) for role, count in role_tmp.items()] + order = role_order() + #ordered role stats + role_totals = ["\u0002{0}\u0002: {1}".format(role, role_tmp[role]) for role in order if role in role_tmp] + #lover or any other special stats + role_totals += ["\u0002{0}\u0002: {1}".format(role, count) for role, count in role_tmp.items() if role not in order] c.execute("SELECT SUM(totalgames) from rolestats WHERE player=? COLLATE NOCASE AND role!='cursed villager' AND role!='gunner'", (acc,)) row = c.fetchone() return "\u0002{0}\u0002's totals | \u0002{1}\u0002 games | {2}".format(player[0], row[0], break_long_message(role_totals, ", "))