data): for room in self.server.rooms.itervalues(): for playerCode, client in room.clients.iteritems(): client.sendData(eventTokens, data) def sendTribeMsg(self, sendClient, eventTokens, data): for room in self.server.rooms.itervalues(): for playerCode, client in room.clients.iteritems(): #self.room.sendTribeMsg(self, "\x10\x14", ['6', self.username, self.tribeName]) #print data if client.tribeName == data[0]: lol = data if lol[1] == "6": lol = data #[self.username, tribe, user]) data2 = [lol[1], lol[2], lol[3]] elif lol[1] == '12': #self.room.sendTribeMsg(self, "\x10\x04", ['12', name, rank]) lol = data data2 = [lol[1], lol[2], lol[3]] #print 'Sent: '+str(data2) elif lol[1] == '13': #[str(self.tribeName), '13', '1', name]) lol = data data2 = [lol[1], lol[2], lol[3]] elif lol[1] == '11': #[str(self.tribeName), '11', player]) lol = data data2 = [lol[1], lol[2]] if lol[2] == client.username: client.tribeName = "" else: lol = data data2 = [lol[1], lol[2]] client.sendData(eventTokens, data2) def sendTribeChat(self, senderClient, eventTokens, data): for room in self.server.rooms.itervalues(): for playerCode, client in room.clients.iteritems(): try: #[tmessage, self.username, self.tribeName) tribe = data[2] lol = [data[1], data[0]] if client.tribeName == tribe: if client.tribeMuted: pass else: client.sendData(eventTokens, lol) except: pass def sendRecruit(self, senderClient, eventTokens, data): for room in self.server.rooms.itervalues(): for playerCode, client in room.clients.iteritems(): #[self.username, tribe, user]) try: if client.username == data[2]: lol = data data = [2, lol[0], lol[1]] client.sendData(eventTokens, data) except: print '[ERROR] Recruit: %s'%(str(data)) def sendAdminChat(self, senderClient, eventTokens, data): for room in self.server.rooms.itervalues(): for playerCode, client in room.clients.iteritems(): if client.privilegeLevel>=3 and not client.isDrawer: client.sendData(eventTokens, data) def sendServeur(self, senderClient, eventTokens, data): for room in self.server.rooms.itervalues(): for playerCode, client in room.clients.iteritems(): if client.privilegeLevel>=5 and not client.isDrawer: client.sendData(eventTokens, data) def sendFriend(self, senderClient, eventTokens, data): for room in self.server.rooms.itervalues(): for playerCode, client in room.clients.iteritems(): friendList = self.server.getUserFriends(client.username).split(",") user = str(data).replace("['", "").replace("']", "") if user in friendList: client.sendData(eventTokens, data) def sendTribes(self, senderClient, eventTokens, data): for room in self.server.rooms.itervalues(): for playerCode, client in room.clients.iteritems(): users = self.server.getTribeUsers(data[1]).split(",") if client.username in users: data[5] = client.tribeRank #print 'Data: '+str(data) client.sendData(eventTokens, data) else: pass def sendModChat(self, senderClient, eventTokens, data): for room in self.server.rooms.itervalues(): for playerCode, client in room.clients.iteritems(): if client.privilegeLevel>=5 and not client.isDrawer: client.sendData(eventTokens, data) def killAfk(self): for playerCode, client in self.clients.iteritems(): if client.isAfk == True: client.isDead = True client.score -= 1 if client.score < 0: client.score = 0 self.informAll(TransformiceClientHandler.sendPlayerDied, [playerCode, client.score]) self.checkShouldChangeWorld() else: pass def killAll(self): for playerCode, client in self.clients.iteritems(): resetpscore=client.score+1 self.informAll(TransformiceClientHandler.sendPlayerDied, [playerCode, resetpscore]) client.isDead=True self.checkShouldChangeWorld() def killShaman(self): for playerCode, client in self.clients.iteritems(): if client.playerCode == self.currentShamanCode: client.score -= 1 if client.score < 0: client.score = 0 self.informAll(TransformiceClientHandler.sendPlayerDied, [playerCode, client.score]) client.isDead=True self.checkShouldChangeWorld() def getPlayerCount(self): return len(self.clients) def getPlayerList(self): for playerCode, client in self.clients.iteritems(): yield client.getPlayerData() def getHighestShaman(self): clientscores = [] clientcode = 0 for playerCode, client in self.clients.iteritems(): clientscores.append(client.score) for playerCode, client in self.clients.iteritems(): if client.score==max(clientscores): clientcode=playerCode clientname=client.username return clientcode def getHighestShamanTwo(self): clientscores = [] clientcode = 0 for playerCode, client in self.clients.iteritems(): clientscores.append(client.score) for playerCode, client in self.clients.iteritems(): if client.score==max(clientscores): clientcode=playerCode clientname=client.username clientscores.remove(client.score) #print 'client scores 2: '+str(clientscores) for playerCode, client in self.clients.iteritems(): # print 'Client Scores: '+str(clientscores) try: # print 'before max' if client.score==max(clientscores): clientcode=playerCode #print 'clientcode: '+str(clientcode) clientname=client.username except: print 'Error o0' clientcode = 0 return clientcode def getDoubleShamanCode(self, number): if number == 1: shamanOne = self.getHighestShaman() return shamanOne if number == 2: shamanTwo = self.getHighestShamanTwo() return shamanTwo def getShamanCode(self): if self.currentShamanCode is None: