diff --git a/Code/irc/banterbot.py b/Code/irc/banterbot.py
index e62cf2b..7bfbc6e 100755
--- a/Code/irc/banterbot.py
+++ b/Code/irc/banterbot.py
@@ -52,20 +52,25 @@ def score_banter(channel, user, messageText):
if re.sub('[^a-z0-9]+','',word.lower()) == bword[0]:
score += int(bword[1])
- score += messageText.count('!') * 2
- score += messageText.count('#') * 3
+ score += messageText.count('!') * 2 #hype is banter
+ score -= messageText.count('!!!') * 6 #too much hype is not banter
+ score += messageText.count('#') * 3 #hashs are mad bantz
+ score -= messageText.count('##') * 6 #but too many is garbage
+ names = ['mate', 'lad', 'my best boy']
+ compliment = ['top-drawer', 'top-shelf', 'bangin\'', 'legendary', 'smashing', 'incredible', 'impeccable', 'stunning']
- score = score * 100 / len(messageText)
msg = ""
if score > 100:
- msg = "Top drawer, mate! That was some #banter! You earned a " + str(score)
+ msg = "Truely " + random.choice(compliment).capitalize() + ", " + random.choice(names) \
+ + "! That was some #banter! You earned a " + str(score) + " for that!"
elif score > 50:
- msg = "Bangin' #banter! You got a " + str(score)
+ msg = random.choice(compliment).capitalize() + " #banter! You get a " + str(score) + " from me!"
elif score > 10:
- msg = "Acceptible #banter. You get a " + str(score)
+ msg = random.choice(["acceptible", "reasonable", "passable"]).capitalize() + " #banter. You get a " + str(score)
else:
- msg = "That was hardly #banter. You get a " + str(score) + ". Maybe try again?"
+ msg = "That " + random.choice(["was hardly", "was barely", "wasn't", "won't pass for", "was awful"]) \
+ + " #banter" + random.choice([", lad",", lah",", boy","",""]) + ". I'll give you a " + str(score) + ". Maybe try again?"
ircsock.send("PRIVMSG " + channel + " :" + msg + "\n")
diff --git a/Code/irc/banterscores.txt b/Code/irc/banterscores.txt
index ee9f3db..af821a0 100644
--- a/Code/irc/banterscores.txt
+++ b/Code/irc/banterscores.txt
@@ -1,8 +1,9 @@
+banterville|20
lah|20
boys|5
-boyz|-20
-b8|-10
-g8|-10
+boyz|-10
+b8|-5
+g8|-5
bantamino|15
banter|-5
bantz|-5
@@ -40,3 +41,4 @@ great|5
legendary|15
minge|4
listen|2
+the|1
diff --git a/Code/irc/run_banter.py b/Code/irc/run_banter.sh
similarity index 77%
rename from Code/irc/run_banter.py
rename to Code/irc/run_banter.sh
index 9050c4f..e1cd714 100755
--- a/Code/irc/run_banter.py
+++ b/Code/irc/run_banter.sh
@@ -2,4 +2,3 @@
nohup ./banterbot.py -s 127.0.0.1 -n banterbot -c \#tildetown >> banterlog 2>> banterlog &
#nohup ./banterbot.py -s 127.0.0.1 -n banterbot -c \#bot_test >> banterlog 2>> banterlog &
-#./topic_bot.py -s 127.0.0.1 -n topic_bot -c \#bot_test
diff --git a/Code/irc/run_wang.sh b/Code/irc/run_wang.sh
new file mode 100755
index 0000000..3a6ef54
--- /dev/null
+++ b/Code/irc/run_wang.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+nohup ./wangbot.py -s 127.0.0.1 -n numberwang_bot -c \#tildetown >> wanglog 2>> wanglog &
+#nohup ./wangbot.py -s 127.0.0.1 -n numberwang_bot -c \#bot_test >> wanglog 2>> wanglog &
diff --git a/Code/irc/tildescores.txt b/Code/irc/tildescores.txt
index 5be99ab..1847e3a 100644
--- a/Code/irc/tildescores.txt
+++ b/Code/irc/tildescores.txt
@@ -1,5 +1,12 @@
-krowbar&^%3&^%1421862086
-karlen&^%4&^%1421862449
-endorphant&^%6&^%1421862524
-jumblesale&^%4&^%14261885
-marcus&^%5&^%1421863976
+krowbar&^%7&^%1421953955
+karlen&^%11&^%1421948093
+endorphant&^%14&^%1421954148
+jumblesale&^%10&^%1421943491
+marcus&^%10&^%1421954915
+papa&^%3&^%1421936555
+epicmorphism&^%3&^%1421937744
+audy&^%9&^%1421950247
+kc&^%2&^%1421890581
+vilmibm&^%3&^%1421887627
+cmr&^%1&^%1421888980
+imt&^%4&^%1421953072
diff --git a/Code/irc/topicscores.txt b/Code/irc/topicscores.txt
index e12c903..a0915bf 100644
--- a/Code/irc/topicscores.txt
+++ b/Code/irc/topicscores.txt
@@ -1,5 +1,5 @@
-krowbar&^%20&^%20
+krowbar&^%21&^%22
um&^%11&^%8
-kc&^%0&^%21
+kc&^%0&^%22
marcus&^%3&^%1
-khoi&^%1&^%0karlen&^%0&^%1karlen&^%0&^%1jumblesale&^%1&^%0karlen&^%0&^%1karlen&^%0&^%1karlen&^%0&^%1dan&^%1&^%0datagrok&^%0&^%1vilmibm&^%0&^%1papa&^%1&^%0vilmibm&^%1&^%0vilmibm&^%0&^%1jumblesale&^%1&^%0selfsame&^%1&^%0karlen&^%0&^%1jumblesale&^%0&^%1
\ No newline at end of file
+khoi&^%1&^%0karlen&^%0&^%1karlen&^%0&^%1jumblesale&^%1&^%0karlen&^%0&^%1karlen&^%0&^%1karlen&^%0&^%1dan&^%1&^%0datagrok&^%0&^%1vilmibm&^%0&^%1papa&^%1&^%0vilmibm&^%1&^%0vilmibm&^%0&^%1jumblesale&^%1&^%0selfsame&^%1&^%0karlen&^%0&^%1jumblesale&^%0&^%1karlen&^%0&^%1
\ No newline at end of file
diff --git a/Code/irc/wangbot.py b/Code/irc/wangbot.py
new file mode 100755
index 0000000..521c9d1
--- /dev/null
+++ b/Code/irc/wangbot.py
@@ -0,0 +1,277 @@
+#!/usr/bin/python
+# http://wiki.shellium.org/w/Writing_an_IRC_bot_in_Python
+
+# Import some necessary libraries.
+import socket
+import os
+import sys
+from optparse import OptionParser
+import fileinput
+import random
+import time
+import re
+import operator
+
+import formatter
+import get_users
+import mentions
+import pretty_date
+import inflect
+
+parser = OptionParser()
+
+parser.add_option("-s", "--server", dest="server", default='127.0.0.1',
+ help="the server to connect to", metavar="SERVER")
+parser.add_option("-c", "--channel", dest="channel", default='#bot_test',
+ help="the channel to join", metavar="CHANNEL")
+parser.add_option("-n", "--nick", dest="nick", default='numberwang_bot',
+ help="the nick to use", metavar="NICK")
+
+(options, args) = parser.parse_args()
+
+p = inflect.engine()
+LIMIT_GUESSING = True
+MIN_ROUNDS = 2
+MAX_ROUNDS = 4
+SCORE_FILE = "numberwangscores.txt"
+SHOW_TOP_NUM = 5
+
+roundsLeft = 0
+bonusRound = 0
+guesses = 0
+lastGuesser = ""
+currentScores = {}
+
+def resetGlobals():
+ global roundsLeft
+ global bonusRound
+ global guesses
+ global lastGuesser
+ global currentScores
+ roundsLeft = 0
+ bonusRound = 0
+ guesses = 0
+ lastGuesser = ""
+ currentScores.clear()
+
+
+def ping():
+ ircsock.send("PONG :pingis\n")
+
+def sendmsg(chan , msg):
+ ircsock.send("PRIVMSG "+ chan +" :"+ msg +"\n")
+
+def joinchan(chan):
+ ircsock.send("JOIN "+ chan +"\n")
+
+def hello():
+ ircsock.send("PRIVMSG "+ channel +" :Hello!\n")
+
+def start_numberwang(channel, user):
+ print user + " started a game"
+ resetGlobals()
+ ircsock.send("PRIVMSG " + channel + " :It's time for Numberwang!\n")
+ time.sleep(1)
+ ircsock.send("PRIVMSG " + channel + " :Here's how to play:\n")
+
+ ircsock.send("PRIVMSG " + channel + " :1. There are 10 rounds\n")
+ ircsock.send("PRIVMSG " + channel + " :2. Each round lasts 10 seconds. You're up against the clock!\n")
+ ircsock.send("PRIVMSG " + channel + " :3. Play your numbers, as long as they're between 0 and 99.\n")
+ ircsock.send("PRIVMSG " + channel + " :4. That's Numberwang!\n")
+ time.sleep(2)
+ ircsock.send("PRIVMSG " + channel + " :Let's get started!\n")
+ global roundsLeft
+ global bonusRound
+ roundsLeft = random.randint(MIN_ROUNDS,MAX_ROUNDS)
+ bonusRound = random.randint(2,roundsLeft-1)
+ print "There will be " + str(roundsLeft) + " rounds with the bonus on round " + str(roundsLeft - bonusRound + 1)
+
+def print_scores(channel):
+ scoreStrs = []
+ first = True
+ for name in currentScores:
+ scoreStrs.append(name + " is " + ("also " if not first and random.randint(1,3) == 3 else "") + "on " + str(currentScores[name]))
+ first = False
+ ircsock.send("PRIVMSG " + channel + " :" + p.join(scoreStrs) + "!\n")
+
+def guess_numberwang(channel, user, messageText):
+ global guesses
+ global lastGuesser
+ global currentScores
+ global roundsLeft
+ print user + " guessed '" + messageText + "'"
+ guess = re.sub('[^0-9]','',messageText.split()[0]) #must have a number in the first 'word'
+ if(guess):
+ if(LIMIT_GUESSING and user == lastGuesser):
+ ircsock.send("PRIVMSG " + channel + " :" + user + ", you just guessed! Give another player a try!\n")
+ else:
+ guesses += 1
+ lastGuesser = user
+ ###CORRECT GUESS###
+ if(random.randint(0,10) > 10 - guesses): #the more guesses, the higher the probability
+ guesses = 0
+ lastGuesser = ""
+ ircsock.send("PRIVMSG " + channel + " :" + user + ": THAT'S NUMBERWANG!\n")
+ points = random.randint(2,10) * (random.randint(2,4) if roundsLeft == bonusRound else 1)
+ if user in currentScores.keys():
+ currentScores[user] += points
+ else:
+ currentScores[user] = points
+ roundsLeft -= 1
+ time.sleep(2)
+ if(roundsLeft == 0):
+ ircsock.send("PRIVMSG " + channel + " :Numberwang is now over. Thank you for playing!\n")
+ ircsock.send("PRIVMSG " + channel + " :Final scores:\n")
+ print_scores(channel)
+ save_scores()
+ else:
+ print_scores(channel)
+ newRoundStr = ""
+ if(roundsLeft == 1):
+ newRoundStr += "The last round is Wangernumb!"
+ elif(roundsLeft == bonusRound):
+ newRoundStr += "**Bonus Round!**"
+ else:
+ newRoundStr += "New Round!"
+ if(random.randint(1,10) > 8):
+ newRoundStr += " Let's rotate the board!"
+ ircsock.send("PRIVMSG " + channel + " :" + newRoundStr + " Start guessing!\n")
+
+
+ ###INCORRECT GUESS###
+ else:
+ ircsock.send("PRIVMSG " + channel + " :" + random.choice(["Sorry", "I'm sorry", "No", "Nope"]) + ", " + user + ", " \
+ + random.choice(["that's not", "that is not", "that isn't", "that is not", "that won't make", "that will not make"])\
+ + " Numberwang!\n")
+
+def stop_numberwang(channel, user):
+ print user + " stopped a game"
+ resetGlobals()
+ ircsock.send("PRIVMSG " + channel + " :Numberwang has been stopped. No points have been awarded. " + user + " is such a party pooper!\n")
+
+def save_scores():
+ with open(SCORE_FILE, "r+") as scorefile:
+ scores = scorefile.readlines()
+ scorefile.seek(0)
+ scorefile.truncate()
+ for name in currentScores:
+ found = False
+ for line in scores:
+ score = line.strip("\n").split("&^%")
+ if(score[0] == name):
+ found = True
+ line = score[0] + "&^%" + str(int(score[1]) + currentScores[name]) + "\n"
+ scorefile.write(line)
+ if(not found):
+ line = name + "&^%" + str(currentScores[name]) + "\n"
+ scorefile.write(line)
+
+def show_highscores(channel):
+ with open(SCORE_FILE, "r") as scorefile:
+ scores = []
+ for line in scorefile.readlines():
+ sline = line.strip("\n").split("&^%")
+ scores.append((int(sline[1]), sline[0]))
+ scores = sorted(scores, reverse=True)[:SHOW_TOP_NUM]
+
+ ircsock.send("PRIVMSG " + channel + " : ====TOP WANGERS====\n")
+ for score in scores:
+ ircsock.send("PRIVMSG " + channel + " :== ~" + score[1] + " (" + str(score[0]) + " points!) ==\n")
+
+
+def show_user_score(channel, user):
+ with open(SCORE_FILE, "r") as scorefile:
+ for line in scorefile.readlines():
+ score = line.strip("\n").split("&^%")
+ if(user == score[0]):
+ ircsock.send("PRIVMSG " + channel + " :" + user + ": Your global numberwang score is " + str(score[1]) + "!\n")
+ return
+ #if we don't find a score line
+ ircsock.send("PRIVMSG " + channel + " :" + user + ": You haven't scored any points yet!\n")
+
+def give_tilde(channel, user, time):
+ found = False
+ with open("tildescores.txt", "r+") as scorefile:
+ scores = scorefile.readlines()
+ scorefile.seek(0)
+ scorefile.truncate()
+ for score in scores:
+ person = score.strip("\n").split("&^%")
+ if(person[0] == user):
+ found = True
+ if(too_recent(time, person[2])):
+ ircsock.send("PRIVMSG " + channel + " :You have asked for a tilde too recently. Try again later.\n")
+ else:
+ prize = get_prize(user)
+ score = person[0] + "&^%" + str(int(person[1]) + prize[0]) + "&^%" + time + "\n"
+ ircsock.send("PRIVMSG " + channel + " :" + prize[1] + "\n")
+ scorefile.write(score)
+ if(not found):
+ prize = get_prize(user)
+ ircsock.send("PRIVMSG " + channel + " :Welcome to the tilde game! Here's " + p.number_to_words(prize[0]+1) + " free tilde(s) to start you off.\n")
+ scorefile.write(user + "&^%" + str(prize[0]+1) + "&^%" + time + "\n")
+
+
+def rollcall(channel):
+ ircsock.send("PRIVMSG "+ channel +" :Is it time for Numberwang? It might be! Start a new game with !numberwang or stop a current game with !wangernumb Get your score with !myscore and the list of top wangers with !topwangers\n")
+
+def connect(server, channel, botnick):
+ ircsock.connect((server, 6667))
+ ircsock.send("USER "+ botnick +" "+ botnick +" "+ botnick +" :krowbar\n") # user authentication
+ ircsock.send("NICK "+ botnick +"\n")
+
+ joinchan(channel)
+
+def get_user_from_message(msg):
+ try:
+ i1 = msg.index(':') + 1
+ i2 = msg.index('!')
+ return msg[i1:i2]
+ except ValueError:
+ return ""
+
+def listen():
+ while 1:
+
+ ircmsg = ircsock.recv(2048)
+ ircmsg = ircmsg.strip('\n\r')
+
+ if ircmsg.find("PING :") != -1:
+ ping()
+
+ formatted = formatter.format_message(ircmsg)
+
+ if "" == formatted:
+ continue
+
+ # print formatted
+
+ split = formatted.split("\t")
+ time = split[0]
+ user = split[1]
+ command = split[2]
+ channel = split[3]
+ messageText = split[4]
+
+ if ircmsg.find(":!numberwang") != -1 and roundsLeft == 0:
+ start_numberwang(channel, user)
+ if ircmsg.find(":!wangernumb") != -1 and roundsLeft > 0:
+ stop_numberwang(channel, user)
+ if roundsLeft > 0:
+ guess_numberwang(channel, user, messageText)
+ if ircmsg.find(":!topwangers") != -1:
+ show_highscores(channel)
+ if ircmsg.find(":!myscore") != -1:
+ show_user_score(channel, user)
+
+ if ircmsg.find(":!rollcall") != -1:
+ rollcall(channel)
+
+ if ircmsg.find("PING :") != -1:
+ ping()
+
+ sys.stdout.flush()
+
+ircsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+connect(options.server, options.channel, options.nick)
+listen()
diff --git a/ttitt/macros.twee b/ttitt/macros.twee
index 6f72a87..f5fb8eb 100644
--- a/ttitt/macros.twee
+++ b/ttitt/macros.twee
@@ -97,13 +97,13 @@ try {
handler: function(place, macroName, params, parser)
{
var msg = "";
- var stats = state.history[0].variables.skills;
- if (stats == undefined) {
+ var skills = state.history[0].variables.skills;
+ if (skills == undefined) {
new Wikifier(place, "no skills");
return;
}
- for(var stat in stats) {
- msg += stat + ": " + stats[stat]+"
";
+ for(var skill in skills) {
+ msg += skill + ": " + skills[skill]+"
";
}
new Wikifier(place, msg);
},
@@ -226,13 +226,14 @@ try {
if(p.slice(-6) == "-start") {
if(tale.passages[p+"Description"]) {
console.log("Found " + p + "Description");
+ msg += "==== ~" + p.slice(0, -6) + " start~ ====\n";
msg += "<>";
}
else {
console.log("Found " + p);
msg += "[[" + p + "]]"
}
- msg += "\n\n";
+ msg += "\n----\n";
}
}
new Wikifier(place, msg);
diff --git a/ttitt/twineGuidelines.txt b/ttitt/twineGuidelines.txt
index ce9f879..0f64691 100644
--- a/ttitt/twineGuidelines.txt
+++ b/ttitt/twineGuidelines.txt
@@ -33,7 +33,6 @@ Written by ~krowbar, managed by ~jumblesale
[inv] - will show ":: Inventory" at the bottom of the passage
[stats] - will show ":: PlayerStats" at the bottom of the passage
[skills] - will show ":: PlayerSkills" at the bottom of the passage
-[playerProfile] - will show ":: PlayerProfile" at the bottom of the passage
[item] - will append a "[[Return|previous()]]" to the passage
## The Player ##