Advertisement
Guest User

Untitled

a guest
Mar 14th, 2016
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.06 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)
  5. startRoom = chr(3) + "[Tutorial] " + playerName
  6. this.isGuest = True
  7.  
  8. if not this.canLogin[0] and not this.canLogin[1] or this.ipAddress in this.server.tempIPBanList:
  9. this.transport.loseConnection()
  10. return
  11.  
  12. if not this.isGuest:
  13. if playerName in this.server.userPermaBanCache:
  14. this.sendPermaBan()
  15. this.transport.loseConnection()
  16. return
  17.  
  18. if not this.isGuest:
  19. if playerName in this.server.userTempBanCache:
  20. banInfo = this.server.getTempBanInfo(playerName)
  21. timeCalc = TFMUtils.getHoursDiff(int(banInfo[0]))
  22. if timeCalc <= 0:
  23. this.server.removeTempBan(playerName)
  24. else:
  25. this.sendPlayerBanLogin(timeCalc, (banInfo[1]))
  26. this.transport.loseConnection()
  27. return
  28.  
  29. if len(playerName) < 3 or len(playerName) > 12:
  30. reactor.callLater(5, lambda: this.sendPacket(Identifiers.send.Login_Result, chr(2), True))
  31. elif this.server.checkConnectedAccount(playerName):
  32. this.sendPacket(Identifiers.send.Login_Result, chr(1), True)
  33. else:
  34. if not this.isGuest:
  35. this.Cursor.execute("select * from Users where Username = ? and Password = ?", [playerName, password])
  36. rs = this.Cursor.fetchone()
  37. if rs:
  38. this.privLevel = rs["PrivLevel"]
  39. this.playerID = rs["PlayerID"]
  40. this.TitleNumber = rs["TitleNumber"]
  41. this.firstCount = rs["FirstCount"]
  42. this.cheeseCount = rs["CheeseCount"]
  43. this.shamanCheeses = rs["ShamanCheeses"]
  44. this.shopCheeses = rs["ShopCheeses"]
  45. this.shopFraises = rs["ShopFraises"]
  46. this.shamanSaves = rs["ShamanSaves"]
  47. this.hardModeSaves = rs["HardModeSaves"]
  48. this.divineModeSaves = rs["DivineModeSaves"]
  49. this.bootcampCount = rs["BootcampCount"]
  50. this.shamanType = rs["ShamanType"]
  51. this.shopItems = rs["ShopItems"]
  52. this.shamanItems = rs["ShamanItems"]
  53. this.clothes = rs["Clothes"].split("|")
  54. this.playerLook = rs["Look"]
  55. this.shamanLook = rs["ShamanLook"]
  56. this.MouseColor = rs["MouseColor"]
  57. this.ShamanColor = rs["ShamanColor"]
  58. this.regDate = rs["RegDate"]
  59. this.shopBadges = rs["Badges"].split(",")
  60. this.cheeseTitleList = rs["CheeseTitleList"].split(",")
  61. this.firstTitleList = rs["FirstTitleList"].split(",")
  62. this.shamanTitleList = rs["ShamanTitleList"].split(",")
  63. this.shopTitleList = rs["ShopTitleList"].split(",")
  64. this.bootcampTitleList = rs["BootcampTitleList"].split(",")
  65. this.hardModeTitleList = rs["HardModeTitleList"].split(",")
  66. this.divineModeTitleList = rs["DivineModeTitleList"].split(",")
  67. this.specialTitleList = rs["SpecialTitleList"].split(",")
  68. this.banHours = rs["BanHours"]
  69. level = rs["ShamanLevel"].split("/")
  70. this.shamanLevel = int(level[0])
  71. this.shamanExp = int(level[1])
  72. this.shamanExpNext = int(level[2])
  73.  
  74. for skill in rs["Skills"].split(";"):
  75. values = skill.split(":")
  76. if len(values) >= 2:
  77. this.playerSkills[int(values[0])] = int(values[1])
  78.  
  79. this.lastOn = rs["LastOn"]
  80. this.friendsList = rs["FriendsList"].split(",")
  81. this.ignoredsList = rs["IgnoredsList"].split(",")
  82. this.gender = rs["Gender"]
  83. this.lastDivorceTimer = rs["LastDivorceTimer"]
  84. this.marriage = rs["Marriage"]
  85.  
  86. tribeInfo = rs["TribeInfo"].split("#")
  87. if len(tribeInfo) == 3:
  88. this.tribeCode = int(tribeInfo[0])
  89. this.tribeRank = int(tribeInfo[1])
  90. this.tribeJoined = int(tribeInfo[2])
  91. this.tribeData = this.server.getTribeInfo(this.tribeCode)
  92. this.tribeName = this.tribeData[0]
  93.  
  94. this.emailAddress = rs["Email"]
  95. survivor = rs["SurvivorStats"].split(",")
  96. racing = rs["RacingStats"].split(",")
  97. this.survivorStats = [int(survivor[0]), int(survivor[1]), int(survivor[2]), int(survivor[3])]
  98. this.racingStats = [int(racing[0]), int(racing[1]), int(racing[2]), int(racing[3])]
  99. this.iceCoins = rs["IceCoins"]
  100. this.iceTokens = rs["IceTokens"]
  101.  
  102. for consumable in rs["Consumables"].split(";"):
  103. values = consumable.split(":")
  104. if len(values) >= 2:
  105. this.playerConsumables[int(values[0])] = int(values[1])
  106.  
  107. for EquipedConsumables in rs["EquipedConsumables"].split(","):
  108. consumable.split(":")
  109. this.shamanSymbol = rs["ShamanSymbol"]
  110. this.equipedShamanSymbol = rs["EquipedSymbol"]
  111.  
  112. totem = this.server.getTotemData(playerName)
  113. if len(totem) == 2:
  114. this.STotem = [int(totem[0]), totem[1]]
  115.  
  116. this.modMute = playerName in this.server.userMuteCache
  117.  
  118. this.shopModule.checkGiftsAndMessages(rs["LastReceivedGifts"], rs["LastReceivedMessages"])
  119.  
  120. else:
  121. reactor.callLater(5, lambda: this.sendPacket(Identifiers.send.Login_Result, chr(2), True))
  122. return
  123.  
  124. this.Username = playerName
  125. this.playerCode = this.server.generatePlayerCode()
  126. this.Cursor.execute("insert into LoginLog (Username, IP) select ?, ? where not exists (select 1 from LoginLog where Username = ? and IP = ?)", [playerName, this.ipAddress, playerName, this.ipAddress])
  127.  
  128. this.clothes = filter(None, this.clothes)
  129. this.shopBadges = filter(None, this.shopBadges)
  130. this.friendsList = filter(None, this.friendsList)
  131. this.ignoredsList = filter(None, this.ignoredsList)
  132. this.shopTitleList = filter(None, this.shopTitleList)
  133. this.firstTitleList = filter(None, this.firstTitleList)
  134. this.cheeseTitleList = filter(None, this.cheeseTitleList)
  135. this.shamanTitleList = filter(None, this.shamanTitleList)
  136. this.specialTitleList = filter(None, this.specialTitleList)
  137. this.bootcampTitleList = filter(None, this.bootcampTitleList)
  138. this.hardModeTitleList = filter(None, this.hardModeTitleList)
  139. this.divineModeTitleList = filter(None, this.divineModeTitleList)
  140.  
  141. if this.MouseColor == "":
  142. this.MouseColor = "78583a"
  143.  
  144. if this.ShamanColor == "":
  145. this.ShamanColor = "fade55" if this.shamanSaves >= 1000 else "95d9d6"
  146.  
  147. for name in ["cheese", "first", "shaman", "shop", "bootcamp", "hardmode", "divinemode"]:
  148. this.checkAndRebuildTitleList(name)
  149.  
  150. this.shopModule.checkAndRebuildBadges()
  151.  
  152. this.sendCompleteTitleList()
  153.  
  154. for title in this.titleList:
  155. if str(title).split(".")[0] == str(this.TitleNumber):
  156. this.TitleStars = int(str(title).split(".")[1])
  157.  
  158. this.server.players[this.Username] = this
  159. this.skillModule.sendShamanSkills()
  160. this.skillModule.sendExp(this.shamanLevel, this.shamanExp, this.shamanExpNext)
  161. this.sendLogin()
  162. this.sendPlayerIdentification()
  163. this.shopModule.sendShamanItems()
  164. if not this.emailAddress == "":
  165. this.shopModule.sendCanGift()
  166.  
  167. this.server.checkPromotionEndTime()
  168. this.sendTimeStamp()
  169. this.sendPromotions()
  170. if this.privLevel == 2:
  171. this.checkVip()
  172.  
  173. if not this.emailAddress == "":
  174. this.sendPacket(Identifiers.send.Email_Confirmed, chr(1), True)
  175.  
  176. this.tribulle.sendPlayerInfo()
  177. this.tribulle.sendFriendList(None)
  178. this.tribulle.sendIgnoredsList()
  179. this.tribulle.sendTribe(False)
  180.  
  181. for client in this.server.players.values():
  182. if this.Username in client.friendsList and client.Username in this.friendsList:
  183. client.tribulle.sendFriendConnected(this.Username)
  184.  
  185. if not this.tribeName == "":
  186. this.tribulle.sendTribeMemberConnected()
  187.  
  188. this.sendMessage("<N>Olá <ROSE>"+this.Username+"<N>, Bem-vindo ao <ROSE>Transformice<N>.");
  189.  
  190. if this.privLevel >= 4:
  191. this.sendStaffLogin(False)
  192.  
  193. if this.shamanSaves >= 500:
  194. this.sendShamanType(this.shamanType, (this.shamanSaves >= 2500 and this.hardModeSaves >= 1000))
  195.  
  196. this.sendInventoryConsumables()
  197.  
  198. if not startRoom == "" and not startRoom == "1":
  199. this.enterRoom(this.server.checkRoom(startRoom, this.Langue))
  200. else:
  201. this.enterRoom(this.server.recommendRoom(this.Langue))
  202.  
  203. this.resSkillsTimer = reactor.callLater(600, setattr, this, "canResSkill", True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement