SHARE
TWEET

Untitled

L3monz1 Jan 19th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.    def mapChange(this):
  2.         this.isEventMap = False
  3.         if this.changeMapTimer != None: this.changeMapTimer.cancel()
  4.  
  5.         for room in this.server.rooms.values():
  6.             for playerCode, client in room.clients.items():
  7.                 if this.isDeathmatch:
  8.                     if not this.contagemDeath is None:
  9.                         this.contagemDeath.cancel()
  10.        
  11.         if not this.canChangeMap:
  12.             this.changeMapAttemps += 1
  13.             if this.changeMapAttemps < 5:
  14.                 this.changeMapTimer = reactor.callLater(1, this.mapChange)
  15.                 return
  16.  
  17.         for timer in this.roomTimers:
  18.             timer.cancel()
  19.  
  20.         this.roomTimers = []
  21.  
  22.         for timer in [this.voteCloseTimer, this.killAfkTimer, this.autoRespawnTimer, this.startTimerLeft]:
  23.             if timer != None:
  24.                 timer.cancel()
  25.  
  26.         this.eventMap += 1
  27.  
  28.         if this.initVotingMode:
  29.             if not this.isVotingBox and (this.mapPerma == 0 and this.mapCode != -1) and this.getPlayerCount() >= 2:
  30.                 this.isVotingMode = True
  31.                 this.isVotingBox = True
  32.                 this.voteCloseTimer = reactor.callLater(8, this.closeVoting)
  33.                 for client in this.clients.values():
  34.                     client.sendPacket(Identifiers.old.send.Vote_Box, [this.mapName, this.mapYesVotes, this.mapNoVotes])
  35.             else:
  36.                 this.votingMode = False
  37.                 this.closeVoting()
  38.  
  39.         elif this.isTribeHouse and this.isTribeHouseMap:
  40.             pass
  41.         else:
  42.             if this.isVotingMode:
  43.                 TotalYes = this.mapYesVotes + this.receivedYes
  44.                 TotalNo = this.mapNoVotes + this.receivedNo
  45.                 isDel = False
  46.  
  47.                 if TotalYes + TotalNo >= 100:
  48.                     TotalVotes = TotalYes + TotalNo
  49.                     Rating = (1.0 * TotalYes / TotalNo) * 100
  50.                     rate = str(Rating).split(".")
  51.                     if int(rate[0]) < 50:
  52.                         isDel = True
  53.                 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])
  54.                 this.isVotingMode = False
  55.                 this.receivedNo = 0
  56.                 this.receivedYes = 0
  57.                 for client in this.clients.values():
  58.                     client.qualifiedVoted = False
  59.                     client.isVoted = False
  60.  
  61.             this.initVotingMode = True
  62.  
  63.             this.lastRoundCode += 1
  64.             this.lastRoundCode %= 127
  65.  
  66.             if this.isSurvivor:
  67.                 for client in this.clients.values():
  68.                     if not client.isDead and (not client.isVampire if this.isSurvivorVamp else not client.isShaman):
  69.                         if not this.noAutoScore: client.playerScore += 10
  70.  
  71.             if this.catchTheCheeseMap:
  72.                 this.catchTheCheeseMap = False
  73.             else:
  74.                 numCom = this.FSnumCompleted - 1 if this.isDoubleMap else this.numCompleted - 1
  75.                 numCom2 = this.SSnumCompleted - 1 if this.isDoubleMap else 0
  76.                 if numCom < 0: numCom = 0
  77.                 if numCom2 < 0: numCom2 = 0
  78.  
  79.                 player = this.clients.get(this.currentShamanName)
  80.                 if player != None:
  81.                     this.sendAll(Identifiers.old.send.Shaman_Perfomance, [this.currentShamanName, numCom])
  82.                     if not this.noAutoScore: player.playerScore = numCom
  83.                     if numCom > 0:
  84.                         player.skillModule.earnExp(True, numCom)
  85.  
  86.                 player2 = this.clients.get(this.currentSecondShamanName)
  87.                 if player2 != None:
  88.                     this.sendAll(Identifiers.old.send.Shaman_Perfomance, [this.currentSecondShamanName, numCom2])
  89.                     if not this.noAutoScore: player2.playerScore = numCom2
  90.                     if numCom2 > 0:
  91.                         player2.skillModule.earnExp(True, numCom2)
  92.  
  93.             if this.isSurvivor and this.getPlayerCount() >= this.server.needToFirst:
  94.                 this.giveSurvivorStats()
  95.             elif this.isRacing or this.isFastRacing and this.getPlayerCount() >= this.server.needToFirst:
  96.                 this.giveRacingStats()
  97.  
  98.             this.currentSyncCode = -1
  99.             this.currentSyncName = ""
  100.             this.currentShamanCode = -1
  101.             this.currentSecondShamanCode = -1
  102.             this.currentShamanName = ""
  103.             this.currentSecondShamanName = ""
  104.             this.currentShamanType = -1
  105.             this.currentSecondShamanType = -1
  106.             this.currentShamanSkills = {}
  107.             this.currentSecondShamanSkills = {}
  108.             this.changed20secTimer = False
  109.             this.isDoubleMap = False
  110.             this.isNoShamanMap = False
  111.             this.FSnumCompleted = 0
  112.             this.SSnumCompleted = 0
  113.             this.objectID = 0
  114.             this.tempTotemCount = -1
  115.             this.addTime = 0
  116.             this.cloudID = -1
  117.             this.companionBox = -1
  118.             this.lastHandymouse = [-1, -1]
  119.             this.isTribeHouseMap = False
  120.             this.canChangeMap = True
  121.             this.changeMapAttemps = 0
  122.  
  123.             this.getSyncCode()
  124.  
  125.             this.anchors = []
  126.  
  127.             this.mapStatus += 1
  128.             this.mapStatus %= 13
  129.             this.musicMapStatus += 1
  130.             this.musicMapStatus %= 6
  131.             this.survivorMapStatus += 1
  132.             this.survivorMapStatus %= 11
  133.  
  134.             this.isRacingP17 = not this.isRacingP17
  135.             this.isBootcampP13 = not this.isBootcampP13
  136.  
  137.             this.numCompleted = 0
  138.             this.canChangeMusic = True
  139.  
  140.             this.currentMap = this.selectMap()
  141.             this.checkVanillaXML()
  142.  
  143.             if not this.noShamanSkills:
  144.                 player = this.clients.get(this.currentShamanName)
  145.                 if player != None:
  146.                     if this.currentShamanName != None:
  147.                         player.skillModule.getTimeSkill()
  148.  
  149.                     if this.currentSecondShamanName != None:
  150.                         player.skillModule.getTimeSkill()
  151.  
  152.             if this.currentMap in [range(44, 54), range(138, 144)] or this.mapPerma == 8 and this.getPlayerCount() >= 2:
  153.                 this.isDoubleMap = True
  154.  
  155.             if this.mapPerma == 7 or this.mapPerma == 42 or this.isSurvivorVamp:
  156.                 this.isNoShamanMap = True
  157.  
  158.             if this.currentMap in range(108, 114):
  159.                 this.catchTheCheeseMap = True
  160.  
  161.             this.gameStartTime = TFMUtils.getTime()
  162.             this.gameStartTimeMillis = time.time()
  163.             this.isCurrentlyPlay = False
  164.  
  165.             for player in this.clients.values():
  166.                 player.resetPlay()
  167.  
  168.             for player in this.clients.values():
  169.                 player.startPlay()
  170.                 if player.isHidden:
  171.                     player.sendPlayerDisconnect()
  172.  
  173.             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:
  174.                 CursorMaps.execute('select TopTime,TopTimeNick from mapeditor where code = ?', [this.mapCode])
  175.                 rs = CursorMaps.fetchone()
  176.                 try:
  177.                     if rs[0] > 0:
  178.                         if rs[0] > 100:
  179.                             t = rs[0] / 100.0
  180.                         else:
  181.                             t = rs[0] / 10.0
  182.                         for client in this.clients.values():
  183.                             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>')
  184. ##                            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)!')
  185.                     else: client.sendMessage('<font color="#C38B50">This map has no record.')
  186.                 except: pass
  187.  
  188.             if this.getPlayerCount() >= 1:
  189.                 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:
  190.                     for player in this.clients.values():
  191.                         player.sendPacket([5, 51], ByteArray().writeByte(52).writeByte(1).writeShort(1).writeShort(random.randint(0, 30)).writeShort(-100).toByteArray())
  192.                         player.sendPacket([100, 101], "\x01\x01")  
  193.  
  194.             for player in this.clients.values():
  195.                 if player.pet != 0:
  196.                     if TFMUtils.getSecondsDiff(player.petEnd) >= 0:
  197.                         player.pet = 0
  198.                         player.petEnd = 0
  199.                     else:
  200.                         this.sendAll(Identifiers.send.Pet, ByteArray().writeInt(player.playerCode).writeByte(player.pet).toByteArray())
  201.  
  202.             if this.isSurvivorVamp:
  203.                 reactor.callLater(5, this.sendVampireMode)
  204.  
  205.             if this.isMulodrome:
  206.                 this.mulodromeRoundCount += 1
  207.                 this.sendMulodromeRound()
  208.  
  209.                 if this.mulodromeRoundCount <= 10:
  210.                     for client in this.clients.values():
  211.                         if client.Username in this.blueTeam:
  212.                             this.setNameColor(client.Username, int("979EFF", 16))
  213.                         else:
  214.                             this.setNameColor(client.Username, int("FF9396", 16))
  215.             else:
  216.                 this.sendAll(Identifiers.send.Mulodrome_End)
  217.  
  218.             if this.isDeathmatch:
  219.                this.canCannon = False
  220.                for client in this.clients.values():
  221.                   client.travarRato()
  222.                   client.sendContagem()
  223.  
  224.             if this.isRacing or this.isFastRacing or this.isDefilante:
  225.                 this.roundsCount = (this.roundsCount + 1) % 10
  226.                 player = this.clients.get(this.getHighestScore())
  227.                 this.sendAll(Identifiers.send.Rounds_Count, ByteArray().writeByte(this.roundsCount).writeInt(player.playerCode if player != None else 0).toByteArray())
  228.                 if this.roundsCount == 9:
  229.                     for client in this.clients.values():
  230.                         client.playerScore = 0
  231.  
  232.             this.startTimerLeft = reactor.callLater(3, this.startTimer)
  233.             this.closeRoomRoundJoinTimer = reactor.callLater(3, setattr, this, "isCurrentlyPlay", True)
  234.             if not this.isFixedMap and not this.isTribeHouse and not this.isTribeHouseMap:
  235.                 this.changeMapTimer = reactor.callLater(this.roundTime + this.addTime, this.mapChange)
  236.            
  237.             this.killAfkTimer = reactor.callLater(30, this.killAfk)
  238.             if this.autoRespawn or this.isTribeHouseMap:
  239.                 this.autoRespawnTimer = reactor.callLater(2, this.respawnMice)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top