self.sendAdminMessageChannel("Hack Detect", hmessage) self.close() else: self.room.sendAllOthers(self, eventTokens, values) else: logging.warning("Unimplemented %r" % eventTokens) elif eventToken1 == "\x10": if eventToken2 == "\x08": #create tribe #Fail #self.sendData("\x10" + "\x04",[10]) tribename = values[0] self.sendData("\x10" + "\x12", ["2", tribename, "0", "None", "", "9"]) self.haveTribe = True self.tribeName = tribename self.tribeGreeting = "None" dbcur.execute('UPDATE users set tribe = ? WHERE name = ?', [tribename, self.username]) dbcur.execute('UPDATE users set triberank = ? WHERE name = ?', ["9", self.username]) dbcur.execute("insert into tribes (name, greeting, users, options) values (?, ?, ?, ?)", (tribename, "None", self.username, "")) elif eventToken2 == "\x16": #Change Rank print values name = values[0] rank = values[1] dbcur.execute('UPDATE users set triberank = ? WHERE name = ?', [rank, name]) self.room.sendTribeMsg(self, "\x10\x04", [str(self.tribeName), '12', name, rank]) elif eventToken2 == "\x15": player = values[0] users = self.server.getTribeUsers(self.tribeName).split(',') users.remove(player) newlist = "" for user in users: if newlist == "": newlist = user else: old = newlist newlist = "%s,%s"%(old,user) dbcur.execute('UPDATE tribes set users = ? WHERE name = ?', [newlist, self.tribeName]) dbcur.execute('UPDATE users set tribe = ? WHERE name = ?', ["", player]) self.room.sendTribeMsg(self, "\x10\x04", [str(self.tribeName), '11', player]) self.room.sendTribeMsg(self, "\x10\x04", [str(self.tribeName), '2', player]) elif eventToken2 == "\r": if values[0] == "2": #print 'Recruited to tribe %s'%(self.server.recruitTribe if self.tribeName == "": dbcur.execute('UPDATE users set tribe = ? WHERE name = ?', [self.server.recruitTribe, self.username]) dbcur.execute('UPDATE users set triberank = ? WHERE name = ?', ["0", self.username]) users = self.server.getTribeUsers(self.server.recruitTribe) newuser = "%s,%s"%(users,self.username) dbcur.execute('UPDATE tribes set users = ? WHERE name = ?', [newuser, self.server.recruitTribe]) self.tribeName = self.server.getTribeName(self.username) self.tribeGreeting = self.server.getTribeGreeting(self.tribeName) self.tribeSettings = self.server.getTribeSettings(self.tribeName) self.tribeRank = "1" self.sendData("\x10" + "\x12", ["2", self.tribeName, "0", self.tribeGreeting, self.tribeSettings, "1"]) self.room.sendTribeMsg(self, "\x10\x04", [str(self.tribeName), '6', self.username, self.tribeName]) self.room.sendTribeMsg(self, "\x10\x04", [str(self.tribeName), '1', self.username]) elif eventToken2 == "\x13": #Permissions permissions = 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 #"Oly9001","Test1001" 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%s00%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],