Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def mapChange(this):
- this.isEventMap = False
- if this.changeMapTimer != None: this.changeMapTimer.cancel()
- for room in this.server.rooms.values():
- for playerCode, client in room.clients.items():
- if this.isDeathmatch:
- if not this.contagemDeath is None:
- this.contagemDeath.cancel()
- if not this.canChangeMap:
- this.changeMapAttemps += 1
- if this.changeMapAttemps < 5:
- this.changeMapTimer = reactor.callLater(1, this.mapChange)
- return
- for timer in this.roomTimers:
- timer.cancel()
- this.roomTimers = []
- for timer in [this.voteCloseTimer, this.killAfkTimer, this.autoRespawnTimer, this.startTimerLeft]:
- if timer != None:
- timer.cancel()
- this.eventMap += 1
- if this.initVotingMode:
- if not this.isVotingBox and (this.mapPerma == 0 and this.mapCode != -1) and this.getPlayerCount() >= 2:
- this.isVotingMode = True
- this.isVotingBox = True
- this.voteCloseTimer = reactor.callLater(8, this.closeVoting)
- for client in this.clients.values():
- client.sendPacket(Identifiers.old.send.Vote_Box, [this.mapName, this.mapYesVotes, this.mapNoVotes])
- else:
- this.votingMode = False
- this.closeVoting()
- elif this.isTribeHouse and this.isTribeHouseMap:
- pass
- else:
- if this.isVotingMode:
- TotalYes = this.mapYesVotes + this.receivedYes
- TotalNo = this.mapNoVotes + this.receivedNo
- isDel = False
- if TotalYes + TotalNo >= 100:
- TotalVotes = TotalYes + TotalNo
- Rating = (1.0 * TotalYes / TotalNo) * 100
- rate = str(Rating).split(".")
- if int(rate[0]) < 50:
- isDel = True
- CursorMaps.execute("update MapEditor set YesVotes = ?, NoVotes = ?, Perma = 44 where Code = ?", [TotalYes, TotalNo, this.mapCode]) if isDel else this.Cursor.execute("update MapEditor set YesVotes = ?, NoVotes = ? where Code = ?", [TotalYes, TotalNo, this.mapCode])
- this.isVotingMode = False
- this.receivedNo = 0
- this.receivedYes = 0
- for client in this.clients.values():
- client.qualifiedVoted = False
- client.isVoted = False
- this.initVotingMode = True
- this.lastRoundCode += 1
- this.lastRoundCode %= 127
- if this.isSurvivor:
- for client in this.clients.values():
- if not client.isDead and (not client.isVampire if this.isSurvivorVamp else not client.isShaman):
- if not this.noAutoScore: client.playerScore += 10
- if this.catchTheCheeseMap:
- this.catchTheCheeseMap = False
- else:
- numCom = this.FSnumCompleted - 1 if this.isDoubleMap else this.numCompleted - 1
- numCom2 = this.SSnumCompleted - 1 if this.isDoubleMap else 0
- if numCom < 0: numCom = 0
- if numCom2 < 0: numCom2 = 0
- player = this.clients.get(this.currentShamanName)
- if player != None:
- this.sendAll(Identifiers.old.send.Shaman_Perfomance, [this.currentShamanName, numCom])
- if not this.noAutoScore: player.playerScore = numCom
- if numCom > 0:
- player.skillModule.earnExp(True, numCom)
- player2 = this.clients.get(this.currentSecondShamanName)
- if player2 != None:
- this.sendAll(Identifiers.old.send.Shaman_Perfomance, [this.currentSecondShamanName, numCom2])
- if not this.noAutoScore: player2.playerScore = numCom2
- if numCom2 > 0:
- player2.skillModule.earnExp(True, numCom2)
- if this.isSurvivor and this.getPlayerCount() >= this.server.needToFirst:
- this.giveSurvivorStats()
- elif this.isRacing or this.isFastRacing and this.getPlayerCount() >= this.server.needToFirst:
- this.giveRacingStats()
- this.currentSyncCode = -1
- this.currentSyncName = ""
- this.currentShamanCode = -1
- this.currentSecondShamanCode = -1
- this.currentShamanName = ""
- this.currentSecondShamanName = ""
- this.currentShamanType = -1
- this.currentSecondShamanType = -1
- this.currentShamanSkills = {}
- this.currentSecondShamanSkills = {}
- this.changed20secTimer = False
- this.isDoubleMap = False
- this.isNoShamanMap = False
- this.FSnumCompleted = 0
- this.SSnumCompleted = 0
- this.objectID = 0
- this.tempTotemCount = -1
- this.addTime = 0
- this.cloudID = -1
- this.companionBox = -1
- this.lastHandymouse = [-1, -1]
- this.isTribeHouseMap = False
- this.canChangeMap = True
- this.changeMapAttemps = 0
- this.getSyncCode()
- this.anchors = []
- this.mapStatus += 1
- this.mapStatus %= 13
- this.musicMapStatus += 1
- this.musicMapStatus %= 6
- this.survivorMapStatus += 1
- this.survivorMapStatus %= 11
- this.isRacingP17 = not this.isRacingP17
- this.isBootcampP13 = not this.isBootcampP13
- this.numCompleted = 0
- this.canChangeMusic = True
- this.currentMap = this.selectMap()
- this.checkVanillaXML()
- if not this.noShamanSkills:
- player = this.clients.get(this.currentShamanName)
- if player != None:
- if this.currentShamanName != None:
- player.skillModule.getTimeSkill()
- if this.currentSecondShamanName != None:
- player.skillModule.getTimeSkill()
- if this.currentMap in [range(44, 54), range(138, 144)] or this.mapPerma == 8 and this.getPlayerCount() >= 2:
- this.isDoubleMap = True
- if this.mapPerma == 7 or this.mapPerma == 42 or this.isSurvivorVamp:
- this.isNoShamanMap = True
- if this.currentMap in range(108, 114):
- this.catchTheCheeseMap = True
- this.gameStartTime = TFMUtils.getTime()
- this.gameStartTimeMillis = time.time()
- this.isCurrentlyPlay = False
- for player in this.clients.values():
- player.resetPlay()
- for player in this.clients.values():
- player.startPlay()
- if player.isHidden:
- player.sendPlayerDisconnect()
- if not this.mapPerma == -1 and not this.isRacing and not this.isMinigame and not this.isFly and not this.isDeathmatch and not this.isVillage and not this.isSurvivor and not this.isVanilla and not this.isDefilante and not this.isBootcamp and not this.isMusic and not this.isNormRoom:
- CursorMaps.execute('select TopTime,TopTimeNick from mapeditor where code = ?', [this.mapCode])
- rs = CursorMaps.fetchone()
- try:
- if rs[0] > 0:
- if rs[0] > 100:
- t = rs[0] / 100.0
- else:
- t = rs[0] / 10.0
- for client in this.clients.values():
- client.sendMessage('<font color="#C38B50">By:</font>' '<font color="#B5B0AB"> ' + str(rs[1]) + '\n<font color="#C38B50">Time </font><font color="#B5B0AB">(' + str(t) + 's)</font>')
- ## client.sendMessage('<font color="#cdb38b">[FR]</font> <font color="#A9A9A9">The best record in entry map made by</font>' '<J> ' + str(rs[1]) + '<font color="#A9A9A9">(</font><font color="#91C5D4">' + str(t) + '</font><font color="#A9A9A9">s)!')
- else: client.sendMessage('<font color="#C38B50">This map has no record.')
- except: pass
- if this.getPlayerCount() >= 1:
- if not this.isDefilante and not this.isSurvivor and not this.isTutorial and not this.isTotemEditeur and not this.isTribeHouse and not this.isMulodrome and not this.isMusic and not this.isEditeur and not this.isMinigame:
- for player in this.clients.values():
- player.sendPacket([5, 51], ByteArray().writeByte(52).writeByte(1).writeShort(1).writeShort(random.randint(0, 30)).writeShort(-100).toByteArray())
- player.sendPacket([100, 101], "\x01\x01")
- for player in this.clients.values():
- if player.pet != 0:
- if TFMUtils.getSecondsDiff(player.petEnd) >= 0:
- player.pet = 0
- player.petEnd = 0
- else:
- this.sendAll(Identifiers.send.Pet, ByteArray().writeInt(player.playerCode).writeByte(player.pet).toByteArray())
- if this.isSurvivorVamp:
- reactor.callLater(5, this.sendVampireMode)
- if this.isMulodrome:
- this.mulodromeRoundCount += 1
- this.sendMulodromeRound()
- if this.mulodromeRoundCount <= 10:
- for client in this.clients.values():
- if client.Username in this.blueTeam:
- this.setNameColor(client.Username, int("979EFF", 16))
- else:
- this.setNameColor(client.Username, int("FF9396", 16))
- else:
- this.sendAll(Identifiers.send.Mulodrome_End)
- if this.isDeathmatch:
- this.canCannon = False
- for client in this.clients.values():
- client.travarRato()
- client.sendContagem()
- if this.isRacing or this.isFastRacing or this.isDefilante:
- this.roundsCount = (this.roundsCount + 1) % 10
- player = this.clients.get(this.getHighestScore())
- this.sendAll(Identifiers.send.Rounds_Count, ByteArray().writeByte(this.roundsCount).writeInt(player.playerCode if player != None else 0).toByteArray())
- if this.roundsCount == 9:
- for client in this.clients.values():
- client.playerScore = 0
- this.startTimerLeft = reactor.callLater(3, this.startTimer)
- this.closeRoomRoundJoinTimer = reactor.callLater(3, setattr, this, "isCurrentlyPlay", True)
- if not this.isFixedMap and not this.isTribeHouse and not this.isTribeHouseMap:
- this.changeMapTimer = reactor.callLater(this.roundTime + this.addTime, this.mapChange)
- this.killAfkTimer = reactor.callLater(30, this.killAfk)
- if this.autoRespawn or this.isTribeHouseMap:
- this.autoRespawnTimer = reactor.callLater(2, this.respawnMice)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement