self.room.sendAllOthersAndSelf(self, eventTokens, [self.playerCode] + values) #pass elif eventToken2 == "\x13": self.room.sendAllOthersAndSelf(self, eventTokens, [self.playerCode]) #pass elif eventToken2 == "\x14": print 'x14' else: logging.warning("Unimplemented %r" % eventTokens) #raise NotImplementedError, eventTokens elif eventToken1 == "\x06": if eventToken2 == "\x06": #sent chat message message, = values message = message.replace("<","") #print 'Message: '+str(message) #if "shit" in str(message).lower(): # print 'Shit detected' # message = message.replace("shit", "shyte") hackdetect = 0 if self.privilegeLevel == 0: self.room.informAll(TransformiceClientHandler.sendPlayerDisconnect, [self.playerCode]) self.room.removeClient(self) hmessage = "["+self.address[0]+" - "+self.username+"] Guest tried to send chat message." self.sendAdminMessageChannel("Hack Detect", hmessage) self.close() hackdetect = 1 logging.info("(%s) %s: %r" % (self.room.name, self.username, message)) print '(%s) %s: %r' % (self.room.name, self.username, message) if message.strip()==self.lastmessage: pass elif hackdetect==1: pass else: self.lastmessage=message.strip() self.room.sendAll(eventTokens, [self.playerCode, self.username, message.strip()]) elif eventToken2 == "\x1A": #sent command event, = values event_raw = event.strip() event = event_raw.lower() EVENTRAWSPLIT = event_raw.split(" ") EVENTCOUNT = len(EVENTRAWSPLIT) logging.info("(%s) [c] %s: %r" % (self.room.name, self.username, event)) print '(%s) [c] %s: %r' % (self.room.name, self.username, event) if len(event) == 1: event = "INVALID" if EVENTCOUNT == 1: if event in ("dance", "danse"): self.room.informAll(TransformiceClientHandler.sendPlayerAction, [self.playerCode, 1]) elif event in ("laugh", "rire"): self.room.informAll(TransformiceClientHandler.sendPlayerAction, [self.playerCode, 2]) elif event in ("cry", "pleurer"): self.room.informAll(TransformiceClientHandler.sendPlayerAction, [self.playerCode, 3]) elif event in ("kiss", "bisou"): self.room.informAll(TransformiceClientHandler.sendPlayerAction, [self.playerCode, 4]) elif event == "disconnect": self.room.informAll(TransformiceClientHandler.sendPlayerDisconnect, [self.playerCode]) self.room.removeClient(self) self.close() elif event == "titlepls": playerCode = self.room.getPlayerCode(self.username) titlenum = '440' self.sendUnlockedTitle(playerCode, titlenum) titleList = self.server.getTitleList(self.username) print titleList lol = array('c', titleList) print lol lol.append('440') print lol elif event == "back": self.sendData("\x0E" + "\x0E",[self.room.editeurMap]) elif event == "lsmodo": #"\x1A\x05", [name, message]) for room in self.server.rooms.itervalues(): for player in room.clients.itervalues(): if player.privilegeLevel>=5: if player.privilegeLevel==5: priv = "Modo" elif player.privilegeLevel==6: priv = "SuperModo" elif player.privilegeLevel==8: priv = "MegaModo" elif player.privilegeLevel==10 and not player.isDrawer: priv = "Admin" elif player.privilegeLevel==10 and player.isDrawer: priv = "Drawer" else: priv = "Unknown" self.sendData("\x1A" + "\x05", ["Serveur", "%s[%s] : %s"%(player.username, priv, room.name)]) elif event == "clear": self.sendData("\x1A" + "\x04", [""]) elif event == "hide": if self.privilegeLevel == 10 and not self.isDrawer: self.room.informAll(TransformiceClientHandler.sendPlayerDisconnect, [self.playerCode]) #self.sendData("\x1A" + "\x04", ["[Serveur] You are now hiding, Remember that after this round you won't be hidden anymore"]) self.sendData("\x06" + "\x14", ["Voce esta agora escondido/invisivel.Lembre-se que apos esta rodada nao vai ser escondido mais"]) elif event == "teste": if self.privilegeLevel == 10 and not self.isDrawer: self.sendServeurMessage("Teste Complete, Proness ^_^") elif event == "stop": if self.privilegeLevel == 10 and not self.isDrawer: musicmessage = "stop" self.room.informAll(TransformiceClientHandler.sendPlayMusic, [musicmessage]) elif event == "vanilla": self.enterRoom("vanilla1") elif event == "bootcamp": self.enterRoom("bootcamp1") elif event == "playercount": count = 0 for room in self.room.itervalues(): for player in room.clients.itervalues(): count = count+1 self.sendAdminMessageChannel("PlayerCount", count) elif event == "ranking": if self.privilegeLevel==1: self.sendData("\x1A" + "\x04", ["""Ranking:Rank em Construcao, Aguardem ^.^!!Shaman (Mice saved)Em Construcao!Mouse (Cheese gathered)Em Construcao!Mouse (First places)Em Construcao!"""]) elif event == "ranking1": if self.privilegeLevel==10: self.sendData("\x1A" + "\x04", ["""Ranking:Rank em Construcao, Aguardem ^.^!!Shaman (Mice saved)Em Construcao!Mouse (Cheese gathered)Em Construcao!Mouse (First places)Em Construcao!"""]) elif event == "ranking2": if self.privilegeLevel==8: self.sendData("\x1A" + "\x04", ["""Ranking:Rank em Construcao, Aguardem ^.^!!Shaman (Mice saved)Em Construcao!Mouse (Cheese gathered)Em Construcao!Mouse (First places)Em Construcao!"""]) elif event == "ranking3": if self.privilegeLevel==6: self.sendData("\x1A" + "\x04", ["""Ranking:Rank em Construcao, Aguardem ^.^!!Shaman (Mice saved)Em Construcao!Mouse (Cheese gathered)Em Construcao!Mouse (First places)Em Construcao!"""]) elif event == "ranking4": if