Advertisement
Guest User

Untitled

a guest
Jan 21st, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.40 KB | None | 0 0
  1. def loginPlayer(this, playerName, password, startRoom):
  2. playerName = "Souris" if playerName == "" else playerName
  3. if password == "":
  4. playerName = this.server.checkAlreadyExistingGuest("*" + (playerName[0].isdigit() or len(playerName) > 12 or len(playerName) < 3 or "Souris" if "+" in playerName else playerName))
  5.  
  6. if not this.canLogin[0] and not this.canLogin[1]:
  7. this.transport.loseConnection()
  8. return
  9.  
  10. if not this.isGuest and playerName in this.server.userPermaBanCache:
  11. this.sendPacket(Identifiers.old.send.Player_Ban_Login, [])
  12. this.transport.loseConnection()
  13. return
  14.  
  15. if not this.isGuest and playerName in this.server.userTempBanCache:
  16. banInfo = this.server.getTempBanInfo(playerName)
  17. timeCalc = TFMUtils.getHoursDiff(int(banInfo[0]))
  18. if timeCalc <= 0:
  19. this.server.removeTempBan(playerName)
  20. else:
  21. this.sendPacket(Identifiers.old.send.Player_Ban_Login, [timeCalc * 3600000, str(banInfo[1])])
  22. this.transport.loseConnection()
  23. return
  24.  
  25. if this.server.checkConnectedAccount(playerName):
  26. this.sendPacket(Identifiers.send.Login_Result, chr(1))
  27. else:
  28. vipTime, letters, gifts, messages = 0, "", "", ""
  29. if not this.isGuest:
  30. this.Cursor.execute("select * from Users where Username = ? and Password = ?", [playerName, password])
  31. rs = this.Cursor.fetchone()
  32. if rs:
  33. this.privLevel = rs["PrivLevel"]
  34. this.playerID = rs["PlayerID"]
  35. this.TitleNumber = rs["TitleNumber"]
  36. this.firstCount = rs["FirstCount"]
  37. this.cheeseCount = rs["CheeseCount"]
  38. this.shamanCheeses = rs["ShamanCheeses"]
  39. this.shopCheeses = rs["ShopCheeses"]
  40. this.shopFraises = rs["ShopFraises"]
  41. this.shamanSaves = rs["ShamanSaves"]
  42. this.hardModeSaves = rs["HardModeSaves"]
  43. this.divineModeSaves = rs["DivineModeSaves"]
  44. this.bootcampCount = rs["BootcampCount"]
  45. this.shamanType = rs["ShamanType"]
  46. this.shopItems = rs["ShopItems"]
  47. this.shamanItems = rs["ShamanItems"]
  48. this.clothes = rs["Clothes"].split("|")
  49. this.playerLook = rs["Look"]
  50. this.shamanLook = rs["ShamanLook"]
  51. this.MouseColor = rs["MouseColor"]
  52. this.ShamanColor = rs["ShamanColor"]
  53. this.regDate = rs["RegDate"]
  54. this.shopBadges = rs["Badges"].split(",")
  55. this.cheeseTitleList = rs["CheeseTitleList"].split(",")
  56. this.firstTitleList = rs["FirstTitleList"].split(",")
  57. this.shamanTitleList = rs["ShamanTitleList"].split(",")
  58. this.shopTitleList = rs["ShopTitleList"].split(",")
  59. this.bootcampTitleList = rs["BootcampTitleList"].split(",")
  60. this.hardModeTitleList = rs["HardModeTitleList"].split(",")
  61. this.divineModeTitleList = rs["DivineModeTitleList"].split(",")
  62. this.specialTitleList = rs["SpecialTitleList"].split(",")
  63. this.banHours = rs["BanHours"]
  64. level = rs["ShamanLevel"].split("/")
  65. this.shamanLevel = int(level[0])
  66. this.shamanExp = int(level[1])
  67. this.shamanExpNext = int(level[2])
  68. for skill in rs["Skills"].split(";"):
  69. values = skill.split(":")
  70. if len(values) >= 2:
  71. this.playerSkills[int(values[0])] = int(values[1])
  72. this.lastOn = rs["LastOn"]
  73. this.friendsList = rs["FriendsList"].split(",")
  74. this.ignoredsList = rs["IgnoredsList"].split(",")
  75. this.gender = rs["Gender"]
  76. this.lastDivorceTimer = rs["LastDivorceTimer"]
  77. this.marriage = rs["Marriage"]
  78.  
  79. tribeInfo = rs["TribeInfo"].split("#")
  80. if len(tribeInfo) == 3:
  81. this.tribeCode = int(tribeInfo[0])
  82. this.tribeRank = int(tribeInfo[1])
  83. this.tribeJoined = int(tribeInfo[2])
  84. this.tribeData = this.server.getTribeInfo(this.tribeCode)
  85. this.tribeName = this.tribeData[0]
  86.  
  87. this.survivorStats = map(int, rs["SurvivorStats"].split(","))
  88. this.racingStats = map(int, rs["RacingStats"].split(","))
  89. this.nowCoins = rs["NowCoins"]
  90. this.nowTokens = rs["NowTokens"]
  91. for consumable in rs["Consumables"].split(";"):
  92. values = consumable.split(":")
  93. if len(values) >= 2:
  94. this.playerConsumables[int(values[0])] = int(values[1])
  95. this.equipedConsumables = rs["EquipedConsumables"].split("|")
  96. letters = rs["Letters"]
  97. this.pet = rs["Pet"]
  98. this.petEnd = 0 if this.pet == 0 else TFMUtils.getTime() + rs["PetEnd"]
  99. this.shamanBadges = rs["ShamanBadges"].split(",")
  100. this.equipedShamanBadge = rs["EquipedShamanBadge"]
  101. totem = this.server.getTotemData(playerName)
  102. if len(totem) == 2: this.STotem = [int(totem[0]), totem[1]]
  103. gifts = rs["Gifts"]
  104. message = rs["Messages"]
  105. vipTime = rs["VipTime"]
  106. this.custom = rs["customItens"].split(",")
  107. else:
  108. reactor.callLater(5, lambda: this.sendPacket(Identifiers.send.Login_Result, chr(2)))
  109. return
  110.  
  111. if this.privLevel == -1:
  112. this.sendPacket(Identifiers.old.send.Player_Ban_Login, [0, "Account Locked."])
  113. this.transport.loseConnection()
  114. return
  115.  
  116. this.server.lastPlayerCode += 1
  117. this.Username = playerName
  118. this.playerCode = this.server.lastPlayerCode
  119. this.Cursor.execute("insert into LoginLog select ?, ? where not exists (select 1 from LoginLog where Username = ? and IP = ?)", [playerName, this.ipAddress, playerName, this.ipAddress])
  120.  
  121. this.clothes = filter(None, this.clothes)
  122. this.shopBadges = filter(None, this.shopBadges)
  123. this.custom = filter(None, this.custom)
  124. this.shamanBadges = filter(None, this.shamanBadges)
  125. this.shopTitleList = filter(None, this.shopTitleList)
  126. this.firstTitleList = filter(None, this.firstTitleList)
  127. this.cheeseTitleList = filter(None, this.cheeseTitleList)
  128. this.shamanTitleList = filter(None, this.shamanTitleList)
  129. this.specialTitleList = filter(None, this.specialTitleList)
  130. this.bootcampTitleList = filter(None, this.bootcampTitleList)
  131. this.hardModeTitleList = filter(None, this.hardModeTitleList)
  132. this.divineModeTitleList = filter(None, this.divineModeTitleList)
  133.  
  134. for name in ["cheese", "first", "shaman", "shop", "bootcamp", "hardmode", "divinemode"]:
  135. this.checkAndRebuildTitleList(name)
  136.  
  137. this.sendCompleteTitleList()
  138. this.shopModule.checkAndRebuildBadges()
  139.  
  140. for title in this.titleList:
  141. if str(title).split(".")[0] == str(this.TitleNumber):
  142. this.TitleStars = int(str(title).split(".")[1])
  143. break
  144.  
  145. this.isMute = playerName in this.server.userMuteCache
  146. this.server.players[this.Username] = this
  147. this.skillModule.sendShamanSkills()
  148. this.skillModule.sendExp(this.shamanLevel, this.shamanExp, this.shamanExpNext)
  149. this.sendLogin()
  150. this.sendPlayerIdentification()
  151. this.shopModule.sendShamanItems()
  152. if this.shamanSaves >= 500:
  153. this.sendShamanType(this.shamanType, (this.shamanSaves >= 2500 and this.hardModeSaves >= 1000))
  154.  
  155. this.server.checkPromotionsEnd()
  156. this.sendTimeStamp()
  157. this.sendPromotions()
  158. this.sendPacket(Identifiers.send.Email_Confirmed, chr(1))
  159.  
  160. if this.privLevel == 2:
  161. this.checkVip(vipTime)
  162.  
  163. this.tribulle.sendPlayerInfo()
  164. this.tribulle.sendFriendsList(None)
  165. this.tribulle.sendIgnoredsList()
  166. this.tribulle.sendTribe(False)
  167.  
  168. for client in this.server.players.values():
  169. if this.Username in client.friendsList and client.Username in this.friendsList:
  170. client.tribulle.sendFriendConnected(this.Username)
  171.  
  172. if not this.tribeName == "":
  173. this.tribulle.sendTribeMemberConnected()
  174.  
  175. #if this.privLevel >= 1:
  176. # this.sendLangueMessage("", "<N>Welcome to <J>ZoneMice<N>!")
  177.  
  178. if this.privLevel >= 4:
  179. #this.server.sendStaffMessage(4, "<ROSE>" + ("[Admin]" if this.privLevel == 10 else "[Coord]" if this.privLevel == 9 else "[Smod]" if this.privLevel == 8 else "[Mod]" if this.privLevel == 7 else "[MapCrew]" if this.privLevel == 6 else "[Helper]" if this.privLevel == 5 else "[Divulgador]" if this.privLevel == 4 else "") + "["+this.Langue+"] <CH>" + this.Username + " <N>is online.")
  180. this.sendStaffLogin(False)
  181.  
  182. this.sendInventoryConsumables()
  183. this.checkLetters(letters)
  184. this.shopModule.checkGiftsAndMessages(gifts, messages)
  185.  
  186. if not startRoom == "" and not startRoom == "1":
  187. this.enterRoom(this.server.checkRoom(startRoom, this.Langue))
  188. else:
  189. this.enterRoom(this.server.recommendRoom(this.Langue))
  190.  
  191. this.resSkillsTimer = reactor.callLater(600, setattr, this, "canResSkill", True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement