From 28f153eb8ad454d1fb45039868a1782908d22739 Mon Sep 17 00:00:00 2001 From: jcao219 Date: Fri, 8 Jul 2011 11:09:03 -0500 Subject: [PATCH] polished !stats more --- wolfgame.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/wolfgame.py b/wolfgame.py index 11ba791..ed083f9 100644 --- a/wolfgame.py +++ b/wolfgame.py @@ -230,17 +230,19 @@ def stats(cli, nick, chan, rest): message = [] f = False - for role in set(list(var.ROLES.keys())+list(var.ORIGINAL_ROLES.keys())): - if not var.ROLES[role]: - continue # Never had this role, don't list it. + l1 = [k for k in var.ROLES.keys() + if var.ROLES[k]] + l2 = [k for k in var.ORIGINAL_ROLES.keys() + if var.ORIGINAL_ROLES[k]] + for role in set(l1+l2): count = len(var.ROLES[role]) - if not f: - if count>1: - vb = "are" - else: - vb = "is" - if count > 1 or count == 0: - message.append("\u0002{0}\u0002 {1}".format(count if count else "no", var.plural(role))) + if not f and count>1: + vb = "are" + f = True + else: + vb = "is" + if count > 1: + message.append("\u0002{0}\u0002 {1}".format(count, var.plural(role))) else: message.append("\u0002{0}\u0002 {1}".format(count if count else "no", role)) cli.msg(chan, "{0}: There {3} {1}, and {2}.".format(nick,