fixed voting maybe?

useing tally logic for score keeping, this will be fun to watch ;-)
This commit is contained in:
James Scott 2012-12-17 20:18:46 -05:00
parent 5577bb691d
commit bb1d15395b
1 changed files with 6 additions and 8 deletions

View File

@ -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.")