mapslist = "" dbcur.execute('select * from mapeditor where name = ?', [username]) rrfRows = dbcur.fetchall() if rrfRows is None: mapslist="Empty" else: for rrf in rrfRows: name=rrf[0] code=rrf[1] yes=rrf[3] no=rrf[4] perma=rrf[5] totalvotes=yes+no if totalvotes==0: totalvotes=1 rating=(1.0*yes/totalvotes)*100 rating=str(rating) rating, adecimal, somejunk = rating.partition(".") mapslist=mapslist+""+str(name)+" - @"+str(code)+" - "+str(totalvotes)+" - "+str(rating)+"% - P"+str(perma) #maplist.append(rrf[0]) #maplist = str(json.dumps(maplist)).replace("[","").replace("]","").replace("\"","").replace(" ", "").replace(",",", ") #if maplist=="": # maplist="Empty" self.sendData("\x06" + "\x14",[mapslist]) elif event == "restart2": if self.privilegeLevel==10 and not self.isDrawer: if self.username == "Alex" or self.username == "Oly": #self.room.updatesqlserver() self.startRestart("120") else: self.sendData("\x1A" + "\x04", ["[Serveur] Command is disabled."]) elif event == "restart": if self.privilegeLevel==10 and not self.isDrawer: if self.username == "Alex" or self.username == "Oly": #self.room.updatesqlserver() self.timer1 = threading.Timer(1, self.restart10) self.timer1.start() else: self.sendData("\x1A" + "\x04", ["[Serveur] Command is disabled."]) elif event == "shutdown": if self.privilegeLevel==10 and not self.isDrawer: self.sendServerMessage("Server shutting down.") self.server.stopServer() elif event == "party": if self.privilegeLevel==10 and not self.isDrawer: self.sendEverybodyDance() elif event == "npcspam": if self.privilegeLevel==10 and not self.isDrawer: acount=0 while acount<100: x = random.randrange(1, 800) y = random.randrange(1, 400) npcid = random.randrange(1, 1000000000) npcid = 0-npcid self.room.sendAllOthersAndSelf(self, "\x15\x15", [npcid, "Noob", "0,0,0,0,0", x, y, "1", "0"]) acount+=1 #elif event == "playercount": # if self.privilegeLevel==10: # playercountm = self.room.getPlayerCount() # modsendmessage = 'There are %d online.' % playercountm # self.room.informAll(TransformiceClientHandler.sendModMessage, ["~Moderation", modsendmessage]) else: pass else: if event.startswith("room ") or event.startswith("salon ") or event.startswith("sala "): roomname = event_raw.split(" ", 1)[1] if roomname == self.room.name: pass else: self.enterRoom(roomname) dbcur.execute('UPDATE users set lastroom = ? WHERE name = ?', [roomname, self.username]) elif event.startswith("restart "): roomname = event_raw.split(" ", 1)[1] if self.privilegeLevel==10 and not self.isDrawer: if self.username == "Alex" or self.username == "Oly": self.sendServeurMessage("[%s] Server is going to restart in %s seconds"%(self.username,roomname)) self.startRestart(roomname) else: self.sendServeurMessage("[%s] You cannot restart the server."%(self.username)) elif event.startswith("rt "): if self.privilegeLevel!=0: user = event_raw.split(" ", 1)[1] tribename = self.server.getTribeName(user) if tribename == "": tribe = self.tribeName self.room.sendRecruit(self, "\x10\x0E", [self.username, tribe, user]) self.server.recruitTribe = self.tribeName self.sendData("\x10" + "\x04",[5, "Oly"]) else: self.sendData("\x10" + "\x04",[4, "Oly"]) else: pass elif event.startswith("c "): if self.privilegeLevel!=0: if EVENTCOUNT >= 3: _, username, message = event_raw.split(" ", 2) username = username.title() dbcur.execute('select busy from users where name = ?', [username]) rrf = dbcur.fetchone() whisperz = str(rrf).replace("(u'", "") whisperz = str(whisperz).replace("',)", "") dbcur.execute('select busyreason from users where name = ?', [username]) rrf6 = str(dbcur.fetchone()) busysreasons = str(rrf6).replace("(u'", "") busysreasons = str(busysreasons).replace("',)", "") if whisperz == "1": if busysreasons == "None": if LANGUAGE == "EN": self.sendData("\x1A" + "\x04", ["This user is busy and cannot read whispers."]) else: self.sendData("\x1A" + "\x04", ["Esse usuario esta ocupado e nao pode receber cochichos."]) else: if LANGUAGE == "EN": self.sendData("\x1A" + "\x04", ["This user is busy and cannot read whispers. Reason: %s" % (busysreasons)]) else: self.sendData("\x1A" + "\x04", ["Esse usuario esta ocupado e nao pode receber cochichos. Motivo: %s" % (busysreasons)]) else: if not self.server.sendPrivMsg(self.username, username, message): self.sendPlayerNotFound() else: self.sendSentPrivMsg(username, message) if EVENTCOUNT == 1: self.sendPlayerNotFound() if EVENTCOUNT == 2: _, username = event_raw.split(" ", 1) message = "" if not self.server.sendPrivMsg(self.username, username, message): self.sendPlayerNotFound() else: self.sendSentPrivMsg(username, message) else: pass elif event.startswith("title ") or event.startswith("titre "): if EVENTCOUNT == 2: _, titlenumber = event_raw.split(" ", 2) if titlenumber.isdigit(): titlenumber=str(int(str(titlenumber))) if not str(titlenumber)