|
|
@@ -20,12 +20,13 @@ def do_command(self, connection, event):
|
|
|
|
|
|
if command == "cmd" or command == "cmds" or command == "commands":
|
|
|
if cmdtype == "cmd":
|
|
|
- connection.privmsg(replyto, grey + "Games: " + CH.ccc(self, "8ball") + CH.ccc(self, "dice")[:-2] + ".")
|
|
|
+ connection.privmsg(replyto, grey + "Games: " + CH.ccc(self, "8ball") + CH.ccc(self, "dice") + CH.ccc(self, "players")[:-2] + ".")
|
|
|
|
|
|
elif command.split()[0] == "8ball":
|
|
|
if cmdtype == "help": #Display help text.
|
|
|
connection.privmsg(replyto, "Ask a question of the mighty and illusive 8-Ball.")
|
|
|
connection.privmsg(replyto, grey + "Usage: " + blue + "!8ball " + reset + italic + "question")
|
|
|
+
|
|
|
elif cmdtype == "cmd":
|
|
|
if len(command.split()) < 2: # Command contains only !8ball.
|
|
|
messages = [
|
|
|
@@ -125,3 +126,66 @@ def do_command(self, connection, event):
|
|
|
connection.privmsg(replyto, ", ".join(str(rolls) for rolls in GameHelpers.roll_dice(diceamount, dicetype)) + ".") # Roll x amount of x type dice.
|
|
|
else: # Invalid amount of arguments.
|
|
|
connection.privmsg(replyto, "Too many arguments. For help type: " + blue + self.helpchar + "dice" + reset + ".")
|
|
|
+
|
|
|
+ elif command.split()[0] == "players":
|
|
|
+ if cmdtype == "help": #Display help text.
|
|
|
+ connection.privmsg(replyto, "Displays a users game info. User optional.")
|
|
|
+
|
|
|
+ elif cmdtype == "cmd":
|
|
|
+ if len(command.split()) == 1:
|
|
|
+ user = event.source.nick.lower()
|
|
|
+ message = "Your info. "
|
|
|
+ elif len(command.split()) == 2:
|
|
|
+ user = command.split()[1]
|
|
|
+ if not self.db.one("SELECT id FROM users WHERE LOWER(name)=%s AND network='" + self.network + "'", (user, )):
|
|
|
+ connection.action(replyto, "does not know of a " + red + trigger.split()[1] + reset + ".")
|
|
|
+ return
|
|
|
+ if user == connection.get_nickname().lower():
|
|
|
+ connection.privmsg(replyto, "The game does not play the master.")
|
|
|
+ return
|
|
|
+ if user == event.source.nick.lower():
|
|
|
+ message = "Your info. "
|
|
|
+ else:
|
|
|
+ message = "Info for " + red + trigger.split()[1] + reset + ". "
|
|
|
+ all_joins = self.db.all("SELECT joins FROM joins WHERE LOWER(\"user\")=%s AND user_network='" + self.network + "'", (user, ))
|
|
|
+ all_kicks = self.db.all("SELECT given, received FROM kicks WHERE LOWER(\"user\")=%s AND user_network='" + self.network + "'", (user, ))
|
|
|
+ all_messages = self.db.all("SELECT messages, messages_words, messages_characters, actions, actions_words, actions_characters, notices, notices_words, notices_characters FROM messages WHERE LOWER(\"user\")=%s AND user_network='" + self.network + "'", (user, ))
|
|
|
+ joins =0
|
|
|
+ for record in all_joins:
|
|
|
+ joins += record
|
|
|
+ given = 0
|
|
|
+ received = 0
|
|
|
+ for record in all_kicks:
|
|
|
+ given += int(record[0])
|
|
|
+ received += int(record[1])
|
|
|
+ messages = 0
|
|
|
+ messages_words = 0
|
|
|
+ messages_characters = 0
|
|
|
+ actions = 0
|
|
|
+ actions_words = 0
|
|
|
+ actions_characters = 0
|
|
|
+ notices = 0
|
|
|
+ notices_words = 0
|
|
|
+ notices_characters = 0
|
|
|
+ for record in all_messages:
|
|
|
+ messages += int(record[0])
|
|
|
+ messages_words += int(record[1])
|
|
|
+ messages_characters += int(record[2])
|
|
|
+ actions += int(record[3])
|
|
|
+ actions_words += int(record[4])
|
|
|
+ actions_characters += int(record[5])
|
|
|
+ notices += int(record[6])
|
|
|
+ notices_words += int(record[7])
|
|
|
+ notices_characters += int(record[8])
|
|
|
+ userrecord = self.db.one("SELECT xp_spent, level FROM users WHERE LOWER(name)=%s AND network='" + self.network + "'", (user, ))
|
|
|
+ total_xp = (joins + (given * received) + messages + (messages_words / 4) + (messages_characters / 10) + ((actions + (actions_words / 4) + (actions_characters / 10)) * 2) + ((notices + (notices_words / 4) + (notices_characters / 10)) / 2)) / 20
|
|
|
+ xp = total_xp - userrecord[0]
|
|
|
+ total_messages = messages + actions + notices
|
|
|
+ total_words = messages_words + actions_words + notices_words
|
|
|
+ if joins < 1:
|
|
|
+ joins = 1
|
|
|
+ if total_messages < 1:
|
|
|
+ total_messages = 1
|
|
|
+ karma = ((((messages / 10) - joins) / 5) + ((total_words / 5) - total_messages) / 40) - (given * received)
|
|
|
+
|
|
|
+ connection.privmsg(replyto, message + "Level: " + str(userrecord[1]) + ", XP: " + str(xp) + ", karma: " + str(karma))
|