From bb1d15395b3fc16ca4371ffe1d53db064e182f3a Mon Sep 17 00:00:00 2001 From: James Scott Date: Mon, 17 Dec 2012 20:18:46 -0500 Subject: [PATCH] fixed voting maybe? useing tally logic for score keeping, this will be fun to watch ;-) --- plugin.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/plugin.py b/plugin.py index 6e08391..a53ea87 100644 --- a/plugin.py +++ b/plugin.py @@ -180,18 +180,16 @@ class Cah(callbacks.Plugin): schedule.addEvent(self.endround, time.time() + 60, "round_%s" % channel) except Exception: #TODO: add no more round logic - scores = cah.score + #playerScores = sorted(cah.score.iteritems(), key=operator.itemgetter(1), reverse=True) #scores = [] winner = None formattedScores = [] - for name, score in scores.iteritems(): - if winner == None: - winner = (name, score) - elif winner[1] < score: - winner = (name, score) + winner = _tallyVotes(cah.score) + for name, score in cah.score.iteritems(): formattedScores.append("%s: %d" % (name, score)) - self.msg(channel, "Game Over! %s is the Winner! Scores: %s " % (winner[0], ", ".join(formattedScores))) + self.msg(channel, "Game Over! %s is the Winner! Scores: %s " % (winner[0][0], ", ".join(formattedScores))) + def endround(self): channel = self.channel @@ -372,7 +370,7 @@ class Cah(callbacks.Plugin): schedule.removeEvent("vote_%s" % self.channel) except: pass - self.endvote() + self.games[channel].endvote() else: irc.reply("Game not running.")