in self.titleList and not int(titlenumber) in self.titleList: pass else: self.titleNumber = titlenumber self.sendNewTitle(titlenumber) dbcur.execute('UPDATE users SET currenttitle = ? WHERE name = ?', [titlenumber, self.username]) else: pass elif event.startswith("profil ") or event.startswith("profile "): if EVENTCOUNT == 2: username = event_raw.split(" ", 1)[1] self.sendProfile(username) else: pass elif event.startswith("busy "): if EVENTCOUNT == 2: busyz = event_raw.split(" ", 1)[1] if busyz == "1": self.busy = True dbcur.execute('UPDATE users SET busy = ? WHERE name = ?', [busyz, self.username]) if LANGUAGE == "EN": self.sendData("\x1A" + "\x04", ["You are now set to busy."]) else: self.sendData("\x1A" + "\x04", ["Agora voce esta ocupado."]) if busyz == "0": self.busy = False dbcur.execute('UPDATE users SET busy = ? WHERE name = ?', [busyz, self.username]) if LANGUAGE == "EN": self.sendData("\x1A" + "\x04", ["You are now set to not busy."]) else: self.sendData("\x1A" + "\x04", ["Voce nao esta mais ocupado."]) elif EVENTCOUNT >= 3: _, busyz, busyreason = event_raw.split(" ", 2) if busyz == "1": self.busy = True dbcur.execute('UPDATE users SET busy = ? WHERE name = ?', [busyz, self.username]) dbcur.execute('UPDATE users SET busyreason = ? WHERE name = ?', [busyreason, self.username]) if LANGUAGE == "EN": self.sendData("\x1A" + "\x04", ["You are now set to busy. For the reason of: %s" % (busyreason)]) else: self.sendData("\x1A" + "\x04", ["Agora voce esta ocupado. Pelo seguinte motivo: %s" % (busyreason)]) else: self.busy = False dbcur.execute('UPDATE users SET busy = ? WHERE name = ?', [busyz, self.username]) dbcur.execute('UPDATE users SET busyreason = ? WHERE name = ?', ["None", self.username]) if LANGUAGE == "EN": self.sendData("\x1A" + "\x04", ["You are now set to not busy." % (busyreason)]) else: self.sendData("\x1A" + "\x04", ["Voce nao esta mais ocupado."]) else: pass elif event.startswith("save "): if EVENTCOUNT == 4: if self.privilegeLevel == 10 and not self.isDrawer: _, usernamez, mapz, timez = event_raw.split(" ", 3) dbcur.execute('UPDATE racing SET time = ? WHERE map = ?', [timez, mapz]) dbcur.execute('UPDATE racing SET name = ? WHERE map = ?', [usernamez, mapz]) self.sendModMessage(0, "Congratulations to %s for their time of %ss!" % (usernamez, timez)) elif event == "ranking": Userlist = [] dbcur.execute('select name, saves, first, cheese from users') rrfRows = dbcur.fetchall() if rrfRows is None: pass else: for rrf in rrfRows: Userlist.append(rrf) #Saves SaveList={} SaveListDisp=[] for user in Userlist: SaveList[user[0]] = user[1] mSL=max(SaveList.iterkeys(), key=lambda k: SaveList[k]) SaveListDisp.append([1, mSL, SaveList[mSL]]) del SaveList[mSL] mSL=max(SaveList.iterkeys(), key=lambda k: SaveList[k]) SaveListDisp.append([2, mSL, SaveList[mSL]]) del SaveList[mSL] mSL=max(SaveList.iterkeys(), key=lambda k: SaveList[k]) SaveListDisp.append([3, mSL, SaveList[mSL]]) del SaveList[mSL] mSL=max(SaveList.iterkeys(), key=lambda k: SaveList[k]) SaveListDisp.append([4, mSL, SaveList[mSL]]) del SaveList[mSL] mSL=max(SaveList.iterkeys(), key=lambda k: SaveList[k]) SaveListDisp.append([5, mSL, SaveList[mSL]]) del SaveList[mSL] #Firsts FirstList={} FirstListDisp=[] for user in Userlist: FirstList[user[0]] = user[2] mSL=max(FirstList.iterkeys(), key=lambda k: FirstList[k]) FirstListDisp.append([1, mSL, FirstList[mSL]]) del FirstList[mSL] mSL=max(FirstList.iterkeys(), key=lambda k: FirstList[k]) FirstListDisp.append([2, mSL, FirstList[mSL]]) del FirstList[mSL] mSL=max(FirstList.iterkeys(), key=lambda k: FirstList[k]) FirstListDisp.append([3, mSL, FirstList[mSL]]) del FirstList[mSL] mSL=max(FirstList.iterkeys(), key=lambda k: FirstList[k]) FirstListDisp.append([4, mSL, FirstList[mSL]]) del FirstList[mSL] mSL=max(FirstList.iterkeys(), key=lambda k: FirstList[k]) FirstListDisp.append([5, mSL, FirstList[mSL]]) del FirstList[mSL] #Cheese CheeseList={} CheeseListDisp=[] for user in Userlist: CheeseList[user[0]] = user[3] mSL=max(CheeseList.iterkeys(), key=lambda k: CheeseList[k]) CheeseListDisp.append([1, mSL, CheeseList[mSL]]) del CheeseList[mSL] mSL=max(CheeseList.iterkeys(), key=lambda k: CheeseList[k]) CheeseListDisp.append([2, mSL, CheeseList[mSL]]) del CheeseList[mSL] mSL=max(CheeseList.iterkeys(), key=lambda k: CheeseList[k]) CheeseListDisp.append([3, mSL, CheeseList[mSL]]) del CheeseList[mSL] mSL=max(CheeseList.iterkeys(), key=lambda k: CheeseList[k]) CheeseListDisp.append([4, mSL, CheeseList[mSL]]) del CheeseList[mSL]