eventTokens, value = self.lastPhysicsStateEvent client.sendData(eventTokens, value) for sendThing, value in self.sateLog: if type(sendThing) == types.FunctionType: sendThing(client, *value) else: client.sendData(sendThing, value) if len(self.anchors) > 0: client.sendSetAnchors(self.anchors) class TransformiceRoomHandler(object): def __init__(self, server, name): self.server = server self.name = name.strip() self.clients = {} #self.stateRecorder = TransformiceStateRecorder(self) self.currentShamanCode = None self.currentSyncroniserCode = None self.isSandbox = False self.isCustom = False self.customMap = None self.isEditeur = False self.editeurMap = "" self.isTesting = False self.customShaman = None self.isCustomsh = False self.isPlay = False self.racing = False self.isBootcamp = False self.specificMap = False self.isSnowing = False self.properNoShamanMaps = True self.isCatchTheCheeseMap = False self.currentTime = 0 self.alreadySet = False self.currentlyDrawing = False self.currentDrawer = None # Code[0], Name[1], XML[2], YesVotes[3], NoVotes[4], Perma[5], Deleted[6] self.ISCMdata = [0, "Invalid", "", 0, 0, 0, 0] self.ISCM = 0 self.ISCMstatus = 0 # Code[0], Name[1], XML[2], YesVotes[3], NoVotes[4], Perma[5], Deleted[6], Validated[7] self.ISCMVdata =[0, "Invalid", "null", 0, 0, 0, 0, 0] self.ISCMV = 0 self.ISCMVloaded = 0 self.snowStormStartTimer = threading.Timer(random.randrange(900, 1500), self.startSnowStorm) self.snowStormStartTimer.start() #self.currentWorld = random.choice(LEVEL_LIST) runthismap = random.choice(LEVEL_LIST) self.currentWorld = runthismap if self.name == "repeat": self.specificMap = True self.isPlay = True self.currentWorld = "0" if self.name == "sandbox": self.specificMap = True self.isSandbox = True self.currentWorld = "444" if 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