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] mSL=max(CheeseList.iterkeys(), key=lambda k: CheeseList[k]) CheeseListDisp.append([5, mSL, CheeseList[mSL]]) del CheeseList[mSL] self.sendData("\x1A" + "\x04", ["Shaman (Mice saved)"]) self.sendData("\x1A" + "\x04", [""+str(SaveListDisp[0][0])+" - "+str(SaveListDisp[0][1])+" - "+str(SaveListDisp[0][2])]) self.sendData("\x1A" + "\x04", [""+str(SaveListDisp[1][0])+" - "+str(SaveListDisp[1][1])+" - "+str(SaveListDisp[1][2])]) self.sendData("\x1A" + "\x04", [""+str(SaveListDisp[2][0])+" - "+str(SaveListDisp[2][1])+" - "+str(SaveListDisp[2][2])]) self.sendData("\x1A" + "\x04", [""+str(SaveListDisp[3][0])+" - "+str(SaveListDisp[3][1])+" - "+str(SaveListDisp[3][2])]) self.sendData("\x1A" + "\x04", [""+str(SaveListDisp[4][0])+" - "+str(SaveListDisp[4][1])+" - "+str(SaveListDisp[4][2])]) self.sendData("\x1A" + "\x04", ["Mouse (Cheese gathered)"]) self.sendData("\x1A" + "\x04", [""+str(CheeseListDisp[0][0])+" - "+str(CheeseListDisp[0][1])+" - "+str(CheeseListDisp[0][2])]) self.sendData("\x1A" + "\x04", [""+str(CheeseListDisp[1][0])+" - "+str(CheeseListDisp[1][1])+" - "+str(CheeseListDisp[1][2])]) self.sendData("\x1A" + "\x04", [""+str(CheeseListDisp[2][0])+" - "+str(CheeseListDisp[2][1])+" - "+str(CheeseListDisp[2][2])]) self.sendData("\x1A" + "\x04", [""+str(CheeseListDisp[3][0])+" - "+str(CheeseListDisp[3][1])+" - "+str(CheeseListDisp[3][2])]) self.sendData("\x1A" + "\x04", [""+str(CheeseListDisp[4][0])+" - "+str(CheeseListDisp[4][1])+" - "+str(CheeseListDisp[4][2])]) self.sendData("\x1A" + "\x04", ["Mouse (First places)"]) self.sendData("\x1A" + "\x04", [""+str(FirstListDisp[0][0])+" - "+str(FirstListDisp[0][1])+" - "+str(FirstListDisp[0][2])]) self.sendData("\x1A" + "\x04", [""+str(FirstListDisp[1][0])+" - "+str(FirstListDisp[1][1])+" - "+str(FirstListDisp[1][2])]) self.sendData("\x1A" + "\x04", [""+str(FirstListDisp[2][0])+" - "+str(FirstListDisp[2][1])+" - "+str(FirstListDisp[2][2])]) self.sendData("\x1A" + "\x04", [""+str(FirstListDisp[3][0])+" - "+str(FirstListDisp[3][1])+" - "+str(FirstListDisp[3][2])]) self.sendData("\x1A" + "\x04", [""+str(FirstListDisp[4][0])+" - "+str(FirstListDisp[4][1])+" - "+str(FirstListDisp[4][2])]) elif event.startswith("retrieve "): if EVENTCOUNT == 2: if self.privilegeLevel == 10 and not self.isDrawer: mapz = event_raw.split(" ", 1)[1] dbcur.execute('select time from racing where map = ?', [mapz]) rrf = str(dbcur.fetchone()) timez = str(rrf).replace("(u'", "") timez = str(timez).replace("',)", "") dbcur.execute('select name from racing where map = ?', [mapz]) rrf2 = str(dbcur.fetchone()) usernamez = str(rrf2).replace("(u'", "") usernamez = str(usernamez).replace("',)", "") self.sendModMessage(0, 'Best time on this map was %ss by %s!' % (timez, usernamez)) elif event.startswith("ls "): username = event_raw.split(" ", 1)[1] if EVENTCOUNT == 2: if self.privilegeLevel >= 3 and not self.isDrawer: room = self.server.findPlayer(username) if room == "Offline": self.sendData("\x1A" + "\x04", ["[Serveur] %s is offline." % (username)]) else: self.sendData("\x1A" + "\x04", ["[Serveur] %s -> %s" % (username, room)]) elif event.startswith("givetitle "): if EVENTCOUNT == 4: if self.privilegeLevel == 10 and not self.isDrawer: _, playerCode, titlenum, username = event_raw.split(" ", 3)