self.look = self.look.replace("\"","") self.look = self.look.replace(" ","") self.sendData("\x14" + "\x14",[str(self.shopcheese),self.shoplist,self.look,self.shopitems]) elif itemcategory==1: if shopcheese < itemcat1[int(item)]: self.sendData("\x14" + "\x06", []) if shopcheese >= itemcat1[int(item)]: if self.shopitems=="": self.shopitems=str(fullitem) self.shopcheese=self.shopcheese-itemcat1[int(item)] looklist[1]=str(item) self.look=json.dumps(looklist) self.look = self.look.strip('[]') self.look = self.look.replace("\"","") self.look = self.look.replace(" ","") self.sendData("\x14" + "\x14",[str(self.shopcheese),self.shoplist,self.look,self.shopitems]) else: self.shopitems=self.shopitems+","+str(fullitem) self.shopcheese=self.shopcheese-itemcat1[int(item)] looklist[1]=str(item) self.look = json.dumps(looklist) self.look = self.look.strip('[]') self.look = self.look.replace("\"","") self.look = self.look.replace(" ","") self.sendData("\x14" + "\x14",[str(self.shopcheese),self.shoplist,self.look,self.shopitems]) elif itemcategory==2: if shopcheese < itemcat2[int(item)]: self.sendData("\x14" + "\x06", []) if shopcheese >= itemcat2[int(item)]: if self.shopitems=="": self.shopitems=str(fullitem) self.shopcheese=self.shopcheese-itemcat2[int(item)] looklist[2]=str(item) self.look=json.dumps(looklist) self.look = self.look.strip('[]') self.look = self.look.replace("\"","") self.look = self.look.replace(" ","") self.sendData("\x14" + "\x14",[str(self.shopcheese),self.shoplist,self.look,self.shopitems]) else: self.shopitems=self.shopitems+","+str(fullitem) self.shopcheese=self.shopcheese-itemcat2[int(item)] looklist[2]=str(item) self.look = json.dumps(looklist) self.look = self.look.strip('[]') self.look = self.look.replace("\"","") self.look = self.look.replace(" ","") self.sendData("\x14" + "\x14",[str(self.shopcheese),self.shoplist,self.look,self.shopitems]) elif itemcategory==3: if shopcheese < itemcat3[int(item)]: self.sendData("\x14" + "\x06", []) if shopcheese >= itemcat3[int(item)]: if self.shopitems=="": self.shopitems=str(fullitem) self.shopcheese=self.shopcheese-itemcat3[int(item)] looklist[3]=str(item) self.look=json.dumps(looklist) self.look = self.look.strip('[]') self.look = self.look.replace("\"","") self.look = self.look.replace(" ","") self.sendData("\x14" + "\x14",[str(self.shopcheese),self.shoplist,self.look,self.shopitems]) else: self.shopitems=self.shopitems+","+str(fullitem) self.shopcheese=self.shopcheese-itemcat3[int(item)] looklist[3]=str(item) self.look = json.dumps(looklist) self.look = self.look.strip('[]') self.look = self.look.replace("\"","") self.look = self.look.replace(" ","") self.sendData("\x14" + "\x14",[str(self.shopcheese),self.shoplist,self.look,self.shopitems]) elif itemcategory==4: if shopcheese < itemcat4[int(item)]: self.sendData("\x14" + "\x06", []) if shopcheese >= itemcat4[int(item)]: if self.shopitems=="": self.shopitems=str(fullitem) self.shopcheese=self.shopcheese-itemcat4[int(item)] looklist[4]=str(item) self.look=json.dumps(looklist) self.look = self.look.strip('[]') self.look = self.look.replace("\"","") self.look = self.look.replace(" ","") self.sendData("\x14" + "\x14",[str(self.shopcheese),self.shoplist,self.look,self.shopitems]) else: self.shopitems=self.shopitems+","+str(fullitem) self.shopcheese=self.shopcheese-itemcat4[int(item)] looklist[4]=str(item) self.look = json.dumps(looklist) self.look = self.look.strip('[]') self.look = self.look.replace("\"","") self.look = self.look.replace(" ","") self.sendData("\x14" + "\x14",[str(self.shopcheese),self.shoplist,self.look,self.shopitems]) else: pass elif eventToken1 == "\x18": if eventToken2 == "\x0F": #open forums pass else: logging.warning("Unimplemented %r" % eventTokens) #raise NotImplementedError, eventTokens elif eventToken1 == "\x08": if eventToken2 == "\x0D": #open friends #if room == "Offline": #self.sendData("\x1A" + "\x04", ["[Serveur] %s is offline." % (username)]) #else: #self.sendData("\x1A" + "\x04", ["[Serveur] %s -> %s" % (username, room)]) #room = self.server.findPlayer(username) #room = self.server.findPlayer(username) friendsList = self.server.getUserFriends(self.username).split(",") sendList = [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-", "ConnectedYes", "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."