= values[0] newpermissions = "" dbcur.execute('UPDATE tribes set options = ? WHERE name = ?', [newpermissions, self.tribeName]) self.tribeSettings = newpermissions self.room.sendTribes(self, "\x10\x12", ["2", self.tribeName, "0", self.tribeGreeting, self.tribeSettings, "Unknown"]) #self.room.sendTribes(self, "\x10\x12", ["2", self.tribeName, "0", self.tribeGreeting, self.tribeSettings, "Unknown"]) elif eventToken2 == "\x14": #Greeting greeting = str(values[0]) #self.sendData("\x10" + "\x12", #["2", self.tribeName, "0", greeting, "", "9"]) self.tribeGreeting = str(greeting) self.room.sendTribes(self, "\x10\x12", ["2", self.tribeName, "0", self.tribeGreeting, self.tribeSettings, "Unknown"]) dbcur.execute('UPDATE tribes set greeting = ? WHERE name = ?', [greeting, self.tribeName]) elif eventToken2 == "\x10": #Whirledians.3.0.0.whirledRoom #"Oly 9 0 0 1","Test 1 0 0 1" users = self.server.getTribeUsers(self.tribeName).split(',') onlinelist = [] for user in users: found = self.server.findPlayer(user) if found == "Offline": pass else: priv = self.server.getTribeRank(user) onlinelist.append("%s %s 0 0 %s"%(user,priv,found)) self.sendData("\x10" + "\x10", onlinelist) else: print 'Unimplemented %r'%(eventTokens) elif eventToken1 == "\x13": if eventToken2 == "\x14": #Got gift self.room.sendAllOthersAndSelf(self, "\x13\x15", [self.playerCode]) self.gotGift=1 #print values elif eventToken1 == "\x0E": if eventToken2 == "\x1A": #Exit Editor self.sendData("\x0E" + "\x0E",["0"]) self.room.isEditeur=False self.enterRoom("1") elif eventToken2 == "\x09": #Client keeps sending this try: print 'x09: %s' % (values) except: print 'x09: No values' elif eventToken2 == "\x04": #Vote if not self.Voted and not self.SPEC and self.room.votingMode and self.QualifiedVoter: if len(values)==1: if int(values[0])==1: self.Voted=True self.room.recievedYes+=1 elif len(values)==0: self.Voted=True self.room.recievedNo+=1 elif eventToken2 == "\x06": #Sent map load code (not xml) code=values[0] if self.privilegeLevel==10 or self.privilegeLevel==6 or self.privilegeLevel==5: if str(code).isdigit(): dbcur.execute('select * from mapeditor where code = ?', [code]) rrf = dbcur.fetchone() if rrf is None: self.sendData("\x0E" + "\x08",[]) else: self.sendLoadMapAtCode(rrf[0], rrf[1], 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: