self.name == "801": self.specificMap = True self.isSandbox = True self.currentWorld = "801" if self.name == "racing": self.specificMap = True self.racing = True self.maps = ["@16","@22", "@29", "@42", "@18", "@93", "@94", "@95", "@96", "@97", "@98" , "@99", "@100" ] if self.name.startswith("bootcamp"): self.countStats = False self.currentWorld = "@122429" #self.specificMap = True self.isBootcamp = True self.autoRespawn = True self.roundTime = 360 self.never20secTimer = True if self.name.startswith("\x03"+"[Editeur] "): self.countStats = False self.currentWorld = 0 #self.specificMap = True self.isEditeur = True self.roundTime = 120 self.never20secTimer = True self.everybodyIsShaman = self.isSandbox self.nobodyIsShaman = self.isBootcamp self.worldChangeTimer = None self.bootcampRespawnt = None self.killAfkTimer= None if not self.isSandbox: if self.currentWorld==888: self.worldChangeTimer = threading.Timer(60, self.worldChange) elif self.isBootcamp: self.worldChangeTimer = threading.Timer(360, self.worldChange) self.bootcampRespawnt = threading.Timer(15, self.bootcampRespawn) else: self.worldChangeTimer = threading.Timer(120, self.worldChange) self.worldChangeTimer.start() try: self.bootcampRespawnt.start() except: pass self.killAfkTimer = threading.Timer(30, self.killAfk) self.killAfkTimer.start() #self.world20 = threading.Timer(20, self.worldChange) self.gameStartTime = time.time() self.numCompleted = 0 self.numGotCheese = 0 def close(self): if self.worldChangeTimer: self.worldChangeTimer.cancel() if self.killAfkTimer: self.killAfkTimer.cancel() if self.snowStormStartTimer: self.snowStormStartTimer.cancel() def worldChange(self): #self.stateRecorder.reset() try: self.worldChangeTimerz.cancel() except: pass self.alreadySet = False self.currentSyncroniserCode = None for playerCode, client in self.clients.iteritems(): client.isAfk=True for playerCode, client in self.clients.iteritems(): if client.playerCode == self.currentShamanCode: client.score = 0 if self.clients.has_key(self.currentShamanCode): currentShaman = self.clients[self.currentShamanCode] for playerCode, client in self.clients.iteritems(): try: if self.isCatchTheCheeseMap==True: self.isCatchTheCheeseMap=False else: numCompleted = self.numCompleted-1 if numCompleted < 0: numCompleted = 0 client.sendShamanPerformance(currentShaman.username, numCompleted) except: pass currentShamanCode = None for playerCode, client in self.clients.iteritems(): client.resetPlay() if not self.specificMap: runthismap = random.choice(LEVEL_LIST) if runthismap == self.currentWorld: runthismap = random.choice(LEVEL_LIST) self.currentWorld = runthismap print self.currentWorld, self.specificMap for playerCode, client in self.clients.iteritems(): client.startPlay() if self.currentWorld==888: self.worldChangeTimer = threading.Timer(60, self.worldChange) elif self.isBootcamp: self.worldChangeTimer = threading.Timer(360, self.worldChange) self.bootcampRespawnt = threading.Timer(15, self.bootcampRespawn) self.bootcampRespawnt.start() else: self.worldChangeTimer = threading.Timer(120, self.worldChange) #self.worldChangeTimer = threading.Timer(120, self.worldChange) self.worldChangeTimer.start() self.killAfkTimer = threading.Timer(30, self.killAfk) self.killAfkTimer.start() if self.isSandbox: self.worldChangeTimer.cancel() self.killAfkTimer.cancel() self.gameStartTime = time.time() self.numCompleted = 0 self.numGotCheese = 0 def worldChangeSpecific(self, mapnumber): self.alreadySet = False try: self.worldChangeTimerz.cancel() except: pass mapnumber = int(mapnumber) if self.worldChangeTimer: self.worldChangeTimer.cancel() if self.killAfkTimer: self.killAfkTimer.cancel() #self.stateRecorder.reset() self.currentSyncroniserCode = None for playerCode, client in self.clients.iteritems(): client.isAfk=True if self.clients.has_key(self.currentShamanCode): currentShaman = self.clients[self.currentShamanCode] for playerCode, client in self.clients.iteritems(): try: if self.isCatchTheCheeseMap==True: self.isCatchTheCheeseMap=False else: client.sendShamanPerformance(currentShaman.username, self.numCompleted) except: pass currentShaman.micesaves = self.numCompleted + currentShaman.micesaves self.currentShamanCode = None for playerCode, client in self.clients.iteritems(): client.resetPlay() self.currentWorld = mapnumber for playerCode, client in self.clients.iteritems(): client.startPlay() if self.currentWorld==888: self.worldChangeTimer = threading.Timer(60, self.worldChange) elif self.racing: self.worldChangeTimer = threading.Timer(60, self.worldChange) self.Timerz = threading.Timer(58, self.changingMap1) self.Timerz2 = threading.Timer(59, self.changingMap1) self.Timerz.start() self.Timerz2.start() else: self.worldChangeTimer = threading.Timer(120, self.worldChange) self.worldChangeTimer.start() self.killAfkTimer = threading.Timer(30, self.killAfk) self.killAfkTimer.start() if self.isSandbox: self.worldChangeTimer.cancel() self.killAfkTimer.cancel() self.gameStartTime = time.time() self.numCompleted = 0 self.numGotCheese = 0 def checkShouldChangeWorld(self): if not self.isSandbox: if not self.isBootcamp: if all(client.isDead for client in self.clients.itervalues()): self.worldChangeTimer.cancel() self.killAfkTimer.cancel() self.worldChange() def checkIfShamanCanGoIn(self): allgone=1 #if all(client.isDead for client in self.clients.itervalues()): for playerCode, client in self.clients.iteritems(): if client.playerCode != self.currentShamanCode: if client.isDead: pass else: allgone=0 if allgone==1: return 1 else: return 0 def setTimer(self): print 'setTimer() called(alreadySet: %s)'%(str(self.alreadySet)) if self.alreadySet: pass else: print 'changing Timer...' try: self.worldChangeTimer.cancel() except: pass try: self.worldChangeTimerz.cancel() except: pass self.worldChangeTimerz = threading.Timer(20, self.worldChange) self.worldChangeTimerz.start() print ':20 Set' self.alreadySet = True def resetSandbox(self): if self.isSandbox: for playerCode, client in self.clients.iteritems(): resetpscore=0 self.informAll(TransformiceClientHandler.sendPlayerDied, [playerCode, resetpscore]) client.isDead=True if all(client.isDead for client in self.clients.itervalues()): #self.worldChangeTimer.cancel() #self.worldChange() for