rrf[2], rrf[3], rrf[4], rrf[5]) self.room.ISCMVdata[2]= rrf[2] self.room.ISCMVdata[1]= rrf[0] self.room.ISCMVdata[7]= rrf[5] self.room.ISCMVloaded = int(code) else: self.sendData("\x0E" + "\x08",[]) else: if str(code).isdigit(): dbcur.execute('select * from mapeditor where code = ?', [code]) rrf = dbcur.fetchone() if rrf is None: self.sendData("\x0E" + "\x08",[]) else: if rrf[0]==self.username: self.sendLoadMapAtCode(rrf[0], rrf[1], rrf[2], rrf[3], rrf[4], rrf[5]) self.room.ISCMVdata[2]= rrf[2] self.room.ISCMVloaded = int(code) else: self.sendData("\x0E" + "\x08",[]) else: self.sendData("\x0E" + "\x08",[]) elif eventToken2 == "\n": self.sendData("\x0E" + "\x08",["9"]) self.sendData("\x0E" + "\x11",[]) mapxml = values mapxml = json.dumps(mapxml) mapxml = mapxml.strip('\"[\'\']\"') mapxml = mapxml.replace("\\", "") self.sendData("\x0E" + "\x0E",["0"]) self.room.isEditeur=False radommps = random.choice (RADOMPS_LIST) dbcur.execute("insert into options (name, data) values (?, ?)", (self.username, radommps)) dbcur.execute('select data from options where name = ?', [self.username]) rrf = dbcur.fetchone() number = rrf[0] + radommps number = int(number) codes = "@%s" % (number) self.sendServeurMessage("%s, seu mapa foi exportado para o servidor! [%s]" % (self.username, codes)) self.sendMapExported(number) dbcur.execute("insert into mapeditor (name, code, mapxml, yesvotes, novotes, perma, deleted) values (?, ?, ?, ?, ?, ?, ?)", (self.username, number, mapxml, 0, 0, 0, 0)) number += 1 dbcur.execute('UPDATE options set data = ? WHERE name = ?', [number, "mapcode"]) print 'XML: %s' % (mapxml) else: logging.warning("Unimplemented %r" % eventTokens) print 'Unimplemented %s' % (str(eventTokens)) #raise NotImplementedError, eventTokens def endDraw(self): self.room.currentlyDrawing = False self.room.currentDrawer = None def handle_close(self): try: if self.room: self.room.removeClient(self) self.room.sendTribeMsg(self, "\x10\x04", [str(self.tribeName), '2', self.username]) if self.privilegeLevel==3:#[M][Serveur] Felipinhooo vient de se deconnecter. self.sendAdminMessageChannel("Serveur", "%s vient de se deconnecter." % (self.username)) if self.privilegeLevel>=5 and not self.isDrawer:#has just logged in! self.sendModMessageChannel("Serveur", "%s desconectou-se." % (self.username)) if self.privilegeLevel==10 and self.isDrawer: self.sendModMessageChannel("Drawer", "%s desconectou-se." % (self.username)) self.close() except: pass def checkValidXML(self, xmlString): if re.search("ENTITY", xmlString): return False elif re.search("", xmlString): return False else: try: parser = xml.parsers.expat.ParserCreate() parser.Parse(xmlString) return True except Exception, e: return False def getDefaultLook(self): return "0,0,0,0,0" def sendData(self, eventCodes, data = None): if VERBOSE: logging.warning("Send %r %r" % (eventCodes, data)) #print "Send %r %r" % (eventCodes, data) if data: self.push('\x01'.join(map(str, [eventCodes] + data)) + "\x00") else: self.push(eventCodes + "\x00") def sendCorrectVersion(self): self.sendData("\x1A" + "\x1B", [str(self.server.getConnectedPlayerCount()), "0195723846", "5527"] #MDT, CMDTEC ) def sendTitleList(self): self.sendData("\x08" + "\x0F",self.titleList) def sendPlayerLoginData(self): self.sendData("\x1A" + "\x08", [self.username, str(self.playerCode), str(self.privilegeLevel)] ) if self.username == "Notadmin": self.privilegeLevel = 1 def sendPlayerBan(self, hours, banreason): bantime=3600000*hours self.sendData("\x1A" + "\x12",[bantime, banreason]) def sendBanWarning(self, hours): #CAUTION, you have already been banned for 1 hours. If you are banned for more than 24 hours in total, your account and your mouse will be DELETED AUTOMATICALLY AND FOREVER! self.sendData("\x1A" + "\x12",[hours]) def sendPermaBan(self): self.sendData("\x1A" + "\x12",[]) def sendBanConsideration(self): self.sendData("\x1A" + "\x09",["0"]) def sendBanNotExist(self): self.sendData("\x1A" + "\x09",[]) def sendMapPerm(self): self.sendData("\x05" + "\x12",[]) def sendPlayerBanMessage(self, name, time, reason): self.room.sendAllOthersAndSelf(self, "\x1A" + "\x07", [name, time, reason]) def sendDestroyConjuration(self, x, y): self.room.sendAllOthersAndSelf(self, "\x04" + "\x0F", [x, y]) def sendDestroyConjurationz(self): location = 0 location2 = 0 done = False done2 = True while not done: location += 1 if location == 250 or location > 250: done = True done2 = False else: self.room.sendAllOthersAndSelf(self, "\x04" + "\x0F", [location, location]) while not done2: location += 1 if location2 == 250 or location2 > 250: done2 = True if location == 250 or location > 250: location2 += 1 location = 0