restart10(self): try: self.timer1.cancel() except: pass self.sendRestartMessage("O servidor ira reiniciar em 10 segundos") self.timer1 = threading.Timer(1, self.restart9) self.timer1.start() def restart9(self): try: self.timer1.cancel() except: pass self.sendRestartMessage("O servidor ira reinicar em in 9 segundos") self.timer1 = threading.Timer(1, self.restart8) self.timer1.start() def restart8(self): try: self.timer1.cancel() except: pass self.sendRestartMessage("O servidor ira reinicar em 8 segundos") self.timer1 = threading.Timer(1, self.restart7) self.timer1.start() def restart7(self): try: self.timer1.cancel() except: pass self.sendRestartMessage("O servidor ira reinicar em 7 segundos") self.timer1 = threading.Timer(1, self.restart6) self.timer1.start() def restart6(self): try: self.timer1.cancel() except: pass self.sendRestartMessage("O servidor ira reinicar em 6 segundos") self.timer1 = threading.Timer(1, self.restart5) self.timer1.start() def restart5(self): try: self.timer1.cancel() except: pass self.sendRestartMessage("O servidor ira reinicar em 5 segundos") self.timer1 = threading.Timer(1, self.restart4) self.timer1.start() def restart4(self): try: self.timer1.cancel() except: pass self.sendRestartMessage("O servidor ira reinicar em 4 segundos") self.timer1 = threading.Timer(1, self.restart3) self.timer1.start() def restart3(self): try: self.timer1.cancel() except: pass self.sendRestartMessage("O servidor ira reinicar em 3 segundos") self.timer1 = threading.Timer(1, self.restart2) self.timer1.start() def restart2(self): try: self.timer1.cancel() except: pass self.sendRestartMessage("O servidor ira reinicar em 2 segundos") for room in self.server.rooms.itervalues(): for player in room.clients.itervalues(): try:room.updatesqlserver() except: pass self.server.disconnectPlayer(player) def rested(self, time): self.restartTimer(time) def parseData(self, data): MDT_stuff = data[:4] data = data[4:] #print data values = data.split("\x01") #print repr(MDT_stuff), values #logging.warning("DATA: %s" % data) #logging.warning("DATAD: %s" % repr(MDT_stuff)) #logging.warning("DATAV: %s" % values) eventTokens = values.pop(0) eventToken1, eventToken2 = eventTokens if eventToken1 == "\x1A": if eventToken2 == "\x02": #awake timer unknownTime, = values unknownTime = int(unknownTime) elif eventToken2 == "\x03": #create account username, passwordHash = values username = username.replace("<","") if self.server.checkExistingUsers(username): self.sendData("\x1A" + "\x03", ) #Nickname Already Taken message else: passwordHash=hashlib.sha512(passwordHash).hexdigest() self.server.createAccount(username, passwordHash) self.login(username, passwordHash, "1") elif eventToken2 == "\x0E": #Sent Change Password if self.privilegeLevel!=0: utfLength=struct.unpack('!h', data[:2])[0] PassHash=data[2:utfLength+2] data=data[utfLength+2:] utfLength=struct.unpack('!h', data[:2])[0] ForumPassHash=data[2:utfLength+2] data=data[utfLength+2:] utfLength=struct.unpack('!h', data[:2])[0] ForumSalt=data[2:utfLength+2] if self.ValidatedPassChange: self.ValidatedPassChange=False passwordHash=hashlib.sha512(PassHash).hexdigest() dbcur.execute('UPDATE users SET password = ? WHERE name = ?', [passwordHash, self.username]) elif eventToken2 == "\x04": #login username, passwordHash, startRoom = values if passwordHash != "": passwordHash=hashlib.sha512(passwordHash).hexdigest() username = username.replace("<","") self.login(username, passwordHash, startRoom) else: logging.warning("Unimplemented %r" % eventTokens) #raise NotImplementedError, eventTokens elif eventToken1 == "\x04": if eventToken2 == "\x03": #print 'values: '+str(values) #world physics update #CodePartieEnCours = values.pop(0) #for objectData in values: # if objectData == 'x': # continue # objectType, x, y, dx, dy, rotation, angularVelocity, isSolid, valuea = objectData.split(',') if self.isSyncroniser: self.room.sendAllOthersAndSelf(self, eventTokens, values) #self.room.stateRecorder.setPhyscisState(eventTokens, values) elif eventToken2 == "\x04": #position update #isMovingRight, isMovingLeft, x, y, dx, dy, isJumping, jumpAnimation = values #self.room.sendAllOthers(self, eventTokens, values + [self.playerCode]) self.room.sendAll(eventTokens, values + [self.playerCode]) elif eventToken2 == "\x05": #player went out of bounds self.isDead = True #score #self.score = self.score-1 #if self.score < 0: # self.score = 0 #end self.score -= 1 if self.score < 0: self.score = 0 self.room.informAll(TransformiceClientHandler.sendPlayerDied, [self.playerCode, self.score]) self.room.checkShouldChangeWorld() elif eventToken2 == "\x06": # "Demande_Giclage" #objectCode, = values self.room.sendAll(eventTokens, values) elif eventToken2 == "\x08": #direction, = values #direction = int(direction) self.room.sendAllOthersAndSelf(self, eventTokens, [self.playerCode] + values) elif eventToken2 == "\n": #unknown, happens on first move on current map self.isAfk=False #pass elif eventToken2 == "\x0C": #unknown, happens on start conjuration self.isAfk=False #pass elif eventToken2 == "\r": #unknown, happens on end conjuration pass elif eventToken2 == "\x07": #unknown, happens on jumping. pass elif eventToken2 == "\x0E": #conjuration x, y = values self.DestroyConjurationTimer =