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: if self.currentWorld in [7, 8, 54, 55, 57, 70, 77, 78, 87, 88, 89, 92, 99, 1007, 888]: self.currentShamanCode = 0 else: #self.currentShamanCode = random.choice(self.clients.keys()) if self.isCustomsh: self.currentShamanCode = self.customShaman self.isCustomsh = False else: self.currentShamanCode = self.getHighestShaman() return self.currentShamanCode def getSyncroniserCode(self): if self.currentSyncroniserCode is None: self.currentSyncroniserCode = random.choice(self.clients.keys()) return self.currentSyncroniserCodeclass TransformiceClientHandler(asynchat.async_chat): def __init__(self, server, sock, address): self.server = server self.address = address asynchat.async_chat.__init__(self, sock=sock) self.buffer = "" self.set_terminator("\x00") self.validatingVersion = True self.username = "" self.playerCode = -1 self.privilegeLevel = 0 #0 - Guest #1 - Normal player #3 - Arb #5 - Mod #6 - Super Mod #8 - Mega Mod #10 - Admin self.room = None self.isShaman = False self.isDead = False self.isAfk = True self.isSyncroniser = False self.score = 0 self.fur = '78583a' self.busy = False self.lastmessage = "" self.isDrawer = False #Tribes self.haveTribe = False self.tribeName = "" self.musicOff = False self.tribeMuted = False self.tribeGreeting = "" self.tribeSettings = "" self.tribeRank = "" # self.isinit = True self.sentinelle = False self.wrongPasswordAttempts=0 self.giftCount = 0 self.gotGift = 0 self.titleNumber = 0 self.Tellfirsttime = 0 self.shoplist = "0,3,20;0,5,100;0,2,200;0,4,200;0,1,500;0,6,500;1,1,200;1,2,200;0,7,200;0,8,5000;0,9,500;0,10,100;0,11,500;1,4,200;0,12,200;0,13,500;0,14,0;1,3,200;1,5,300;0,15,200;3,1,999;3,2,25;3,3,150;3,4,400;0,16,300;0,17,200;0,18,300;0,19,300;0,20,500;0,21,200;2,1,100;3,5,300;0,22,300;0,23,400;0,24,50;0,25,250;0,26,300;0,27,800;0,28,300;0,29,500;4,1,200;4,2,200;0,30,200;0,31,300;0,32,800;0,33,150;0,34,400;0,35,5000;0,36,500;0,37,200;0,38,800;1,6,800;2,2,50;0,39,200;0,40,500;0,41,800;0,42,500;4,3,200;2,3,20;0,43,200;0,44,250;0,45,300;0,46,100;0,47,1500;1,7,50;2,4,20;3,6,300;3,7,300;4,4,50" self.cheeseTitleCheckList = [5, 20, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 2000, 2300, 2700, 3200, 3800, 4600, 6000, 7000, 8000, 9001, 10000, 14000, 18000, 22000, 26000, 30000, 34000, 38000, 42000, 46000, 50000, 55000, 60000, 65000, 70000, 75000, 80000] self.cheeseTitleDictionary = {5:5, 20:6, 100:7, 200:8, 300:35, 400:36, 500:37, 600:26, 700:27, 800:28, 900:29, 1000:30, 1100:31, 1200:32, 1300:33, 1400:34, 1500:38, 1600:39, 1700:40, 1800:41, 2000:72, 2300:73, 2700:74, 3200:75, 3800:76, 4600:77, 6000:78, 7000:79, 8000:80, 9001:81, 10000:82, 14000:83, 18000:84, 22000:85, 26000:86, 30000:87, 34000:88, 38000:89, 42000:90, 46000:91, 50000:92, 55000:234, 60000:235, 65000:236, 70000:237, 75000:238, 80000:93} self.firstTitleCheckList = [1, 10, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1400, 1600, 1800, 2000, 2200, 2400, 2600, 2800, 3000, 3200, 3400, 3600, 3800, 4000, 4500, 5000, 5500, 6000, 7000, 8000, 9000, 10000, 12000, 14000, 16000, 18000, 20000, 25000, 30000, 35000, 40000] self.firstTitleDictionary = {1:9, 10:10, 100:11, 200:12, 300:42, 400:43, 500:44, 600:45, 700:46, 800:47, 900:48, 1000:49, 1100:50, 1200:51, 1400:52, 1600:53, 1800:54, 2000:55, 2200:56, 2400:57, 2600:58, 2800:59, 3000:60, 3200:61, 3400:62, 3600:63, 3800:64, 4000:65, 4500:66, 5000:67, 5500:68, 6000:69, 7000:231, 8000:232, 9000:233, 10000:70, 12000:224, 14000:225, 16000:226, 18000:227, 20000:202, 25000:228, 30000:229, 35000:230, 40000:71} self.shamanTitleCheckList = [10, 100, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 11000, 12000, 13000, 14000, 15000, 16000, 18000, 20000, 22000, 24000, 26000, 28000, 30000, 35000, 40000, 45000, 50000, 55000, 60000, 65000, 70000, 75000, 80000, 85000,