Skip to content

Commit

Permalink
Merge pull request #314 from tannn/testing
Browse files Browse the repository at this point in the history
TriviaTime v1.1
  • Loading branch information
tannn committed Jan 17, 2015
2 parents cafbc04 + 4c92bd1 commit 80a7b8e
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
5. Copy over the changed files.
* Version v1.03 to v1.07 files changed: **README.md, plugin.py, __init__.py, config.py, samplequestions** (the changes to config only involded descriptions; no changes to database).
* Version v1.05, v1.06 to v1.07 files changed: **README.md, plugin.py, __init__.py, samplequestions**
* Version v1.1 files changed: **README.md, plugin.py, __init__.py, config.py** (changes to config only adds new value)
6. If there were any changes to the database, they should be updated automatically. Otherwise, further instructions for updating that version will appear here.
7. If config.py was changed, you will need to manually add your desired values again. You can compare the previous file (the backup) to the new file.
7. If config.py was changed, you will need to manually add your desired values again. You can compare the previous file (the backup) to the new file. (v1.1)
8. Load TriviaTime again. If you followed the instructions correctly, you won't have an error.
9. If everything went smoothly, you have now sucessfully updated the plugin to the latest version. Use .info to verify you are on the latest version.

Expand Down
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# Use this for the version of this plugin. You may wish to put a CVS keyword
# in here if you're keeping the plugin in CVS or some similar system.
__version__ = "v1.07"
__version__ = "v1.1"

# XXX Replace this with an appropriate author or supybot.Author instance.
__author__ = supybot.Author('Tanner', 'tann',
Expand Down
5 changes: 5 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,5 +165,10 @@ def configure(advanced):
registry.Integer(5,
"""The streak needed to use the Next command""")
)

conf.registerChannelValue(TriviaTime.general, 'minBreakStreak',
registry.Integer(4,
"""The streak needed to award breaking the streak""")
)

# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
43 changes: 42 additions & 1 deletion plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,43 @@ def voiceUser(self, irc, nick, username, channel):
usernameCanonical = ircutils.toLower(username)
irc.queueMsg(ircmsgs.voice(channel, nick))
self.voiceTimeouts.append(usernameCanonical)

#The following functions are not ready and still in testing. Actually, they haven't even been tested yet. Use at your own risk.
"""
def checkLevel(self, irc, nick, username, channel):
usernameCanonical = ircutils.toLower(username)
#RETRIEVE # questions answers
if USERLEVEL == NONE:
changeLevel(noob)
elif QUESTIONS_ANSWERED > 6000000:
changeLevel(Trivia God)
elif QUESTIONS_ANSWERED > 4500000:
changeLevel(All Is KAOS)
elif QUESTIONS_ANSWERED > 4000000:
changeLevel(Elite)
elif QUESTIONS_ANSWERED > 3000000:
changelevel(Addicted)
elif QUESTIONS_ANSWERED > 2500000:
changelevel(Distinguished)
elif QUESTIONS_ANSWERED > 2000000:
changelevel(Genius)
elif QUESTIONS_ANSWERED > 1500000:
changelevel(Master)
elif QUESTIONS_ANSWERED > 1000000:
changelevel(Player)
elif QUESTIONS_ANSWERED > 500000:
changelevel(Student)
elif QUESTIONS_ANSWERED > 100000:
changelevel(Guesser)
elif QUESTIONS_ANSWERED > 1:
changelLevel(noob)
def changeLevel(self, irc, nick, username, channel):
usernameCanonical - ircutils.toLower(username)
USERLEVEL = NEWUSERLEVEL
irc.sendMsg(ircmsgs.privmsg(channel, 'Congratulations %s, you\'ve answered %q questions and leveled up to %l!' % (username, questions, newlevel)))
"""
def handleVoice(self, irc, nick, username, channel):
if not self.registryValue('voice.enableVoice'):
return
Expand Down Expand Up @@ -803,7 +839,7 @@ def info(self, irc, msg, arg, channel):
threadStorage = self.Storage(dbLocation)
totalUsersEver = threadStorage.getNumUser(channel)
numActiveThisWeek = threadStorage.getNumActiveThisWeek(channel)
infoText = ' TriviaTime v1.07 by Trivialand on Freenode: https://github.com/tannn/TriviaTime '
infoText = ' TriviaTime v1.1 by Trivialand on Freenode: https://github.com/tannn/TriviaTime '
self.reply(irc, msg, infoText, prefixNick=False)
infoText = ' Time is %s ' % (time.asctime(time.localtime(),))
self.reply(irc, msg, infoText, prefixNick=False)
Expand Down Expand Up @@ -1618,8 +1654,13 @@ def checkAnswer(self, msg):
else:
# Normal question solved
streakBonus = 0
minStreak = self.registryValue('general.minBreakStreak', channel)
# update streak info
if ircutils.toLower(self.lastWinner) != ircutils.toLower(username):
#streakbreak
if self.streak > minStreak:
streakBonus = pointsAdded * .05
self.sendMessage('\x02%s\x02 broke \x02%s\x02\'s streak!' % (username, self.lastWinner,))
self.lastWinner = ircutils.toLower(username)
self.streak = 1
else:
Expand Down

0 comments on commit 80a7b8e

Please # to comment.