snow' % (self.username) elif event == "mt": if self.tribeName == "": pass else: if self.tribeMuted: self.room.sendTribeMsg(self, "\x10\x04", [str(self.tribeName), '13', '1', self.username]) self.tribeMuted = False else: self.room.sendTribeMsg(self, "\x10\x04", [str(self.tribeName), '13', '0', self.username]) self.tribeMuted = True elif event == "rsandbox": if self.privilegeLevel==10 and not self.isDrawer: self.room.resetSandbox() #elif event == "up": # if self.privilegeLevel==10: # self.room.getHighestShaman() elif event == "music": if self.musicOff: self.musicOff = False self.sendData("\x1A" + "\x04", ["Musica on"]) else: self.musicOff = True self.sendPlayMusic("stop") self.sendData("\x1A" + "\x04", ["Musica off"]) elif event.startswith("password "): if self.privilegeLevel>=6 and not self.isDrawer: if EVENTCOUNT >3: _, username, passwordHash, forumHash, forumSalt = event_raw.split(" ", 4) if not username.startswith("*"): username=username.lower().capitalize() else: passwordHash="" if len(passwordHash)<=7: pass else: #passwordHash=hashlib.sha256(password).hexdigest() passwordHash=hashlib.sha512(passwordHash).hexdigest() if self.server.checkExistingUsers(username): if username.lower() in ("oly", "alex"): if self.username == username: dbcur.execute('UPDATE users SET password = ? WHERE name = ?', [passwordHash, username]) #self.sendData("\x06" + "\x14",["Mot de passe de User modifie"]) self.server.sendModChat(self, "\x06\x14", ["Mot de passe de "+username+" modifie"]) #self.server.sendModChat(self, "\x06\x14", ["Mot de passe de User modifie"]) else: self.server.sendModChat(self, "\x06\x14", [self.username+" tried to change "+username+" pass."]) else: dbcur.execute('UPDATE users SET password = ? WHERE name = ?', [passwordHash, username]) #self.sendData("\x06" + "\x14",["Mot de passe de User modifie"]) self.server.sendModChat(self, "\x06\x14", ["Mot de passe de "+username+" modifie"]) #self.server.sendModChat(self, "\x06\x14", ["Mot de passe de User modifie"]) elif event.startswith("lsmap "): if self.privilegeLevel>=5 and not self.isDrawer: if EVENTCOUNT == 2: username = event_raw.split(" ", 1)[1] username = username.lower().capitalize() maplist = [] 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 =