= [8] for user in friendsList: found = self.server.findPlayer(user) if found == "Offline": sendList.append(user) else: friends = self.server.getUserFriends(user) if self.username in friends: sendList.append("%s %s"%(user,found)) else: sendList.append("%s -"%(user)) #self.sendData("\x08" + "\x0C",[8, "Notfriend -", "Connected Yes", "Offline"]) self.sendData("\x08" + "\x0C",sendList) #pass elif eventToken2 == "\x0e": #remove friend #print values user = str(values).title().replace("['", "").replace("']", "") friendsList = self.server.getUserFriends(self.username).split(",") print "User: "+str(user) friendsList.remove(user) newlist = "" for users in friendsList: if newlist == "": newlist = users else: old = newlist newlist = "%s,%s"%(old,users) dbcur.execute('UPDATE users SET friends = ? WHERE name = ?', [newlist, self.username]) self.sendRemovedFriend(user) elif eventToken2 == "\x18": #open avatar selection #playercode self.sendData("\x08" + "\x18",["INVALID"]) #pass elif eventToken2 == "\x10": #attach baloon to player #playerCode, = values self.room.sendAll(eventTokens, values) elif eventToken2 == "\x11": #baloon detatched self.room.sendAllOthersAndSelf(self, "\x08\x10", [self.playerCode, "0"]) #unknown?? else: logging.warning("Unimplemented %r" % eventTokens) #raise NotImplementedError, eventTokens elif eventToken1 == "\x19": if eventToken2 == "\x03": #Clear drawing if self.privilegeLevel!=10: self.room.informAll(TransformiceClientHandler.sendPlayerDisconnect, [self.playerCode]) self.room.removeClient(self) hmessage = "["+self.address[0]+" - "+self.username+"] Attempted to clear drawing." self.sendAdminMessageChannel("Hack Detect", hmessage) self.close() else: self.room.sendAllOthersAndSelf(self, eventTokens, values) elif eventToken2 == "\x04": #Start drawing #x,y = values #print 'Start drawing: %s'%(str(values)) if self.privilegeLevel!=10: self.room.informAll(TransformiceClientHandler.sendPlayerDisconnect, [self.playerCode]) self.room.removeClient(self) hmessage = "["+self.address[0]+" - "+self.username+"] Attempted to draw." self.sendAdminMessageChannel("Hack Detect", hmessage) self.close() else: self.room.sendAllOthers(self, eventTokens, values) elif eventToken2 == "\x05": #Draw point #x,y = values #print 'Draw point: %s'%(str(values)) if self.privilegeLevel!=10: self.room.informAll(TransformiceClientHandler.sendPlayerDisconnect, [self.playerCode]) self.room.removeClient(self) hmessage = "["+self.address[0]+" - "+self.username+"] Attempted to draw." 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