Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def loginPlayer(this, playerName, password, startRoom):
- playerName = "Souris" if playerName == "" else playerName
- if password == "":
- playerName = this.server.checkAlreadyExistingGuest("*" + playerName)
- startRoom = chr(3) + "[Tutorial] " + playerName
- this.isGuest = True
- if not this.canLogin[0] and not this.canLogin[1] or this.ipAddress in this.server.tempIPBanList:
- this.transport.loseConnection()
- return
- if not this.isGuest:
- if playerName in this.server.userPermaBanCache:
- this.sendPermaBan()
- this.transport.loseConnection()
- return
- if not this.isGuest:
- if playerName in this.server.userTempBanCache:
- banInfo = this.server.getTempBanInfo(playerName)
- timeCalc = TFMUtils.getHoursDiff(int(banInfo[0]))
- if timeCalc <= 0:
- this.server.removeTempBan(playerName)
- else:
- this.sendPlayerBanLogin(timeCalc, (banInfo[1]))
- this.transport.loseConnection()
- return
- if len(playerName) < 3 or len(playerName) > 12:
- reactor.callLater(5, lambda: this.sendPacket(Identifiers.send.Login_Result, chr(2), True))
- elif this.server.checkConnectedAccount(playerName):
- this.sendPacket(Identifiers.send.Login_Result, chr(1), True)
- else:
- if not this.isGuest:
- this.Cursor.execute("select * from Users where Username = ? and Password = ?", [playerName, password])
- rs = this.Cursor.fetchone()
- if rs:
- this.privLevel = rs["PrivLevel"]
- this.playerID = rs["PlayerID"]
- this.TitleNumber = rs["TitleNumber"]
- this.firstCount = rs["FirstCount"]
- this.cheeseCount = rs["CheeseCount"]
- this.shamanCheeses = rs["ShamanCheeses"]
- this.shopCheeses = rs["ShopCheeses"]
- this.shopFraises = rs["ShopFraises"]
- this.shamanSaves = rs["ShamanSaves"]
- this.hardModeSaves = rs["HardModeSaves"]
- this.divineModeSaves = rs["DivineModeSaves"]
- this.bootcampCount = rs["BootcampCount"]
- this.shamanType = rs["ShamanType"]
- this.shopItems = rs["ShopItems"]
- this.shamanItems = rs["ShamanItems"]
- this.clothes = rs["Clothes"].split("|")
- this.playerLook = rs["Look"]
- this.shamanLook = rs["ShamanLook"]
- this.MouseColor = rs["MouseColor"]
- this.ShamanColor = rs["ShamanColor"]
- this.regDate = rs["RegDate"]
- this.shopBadges = rs["Badges"].split(",")
- this.cheeseTitleList = rs["CheeseTitleList"].split(",")
- this.firstTitleList = rs["FirstTitleList"].split(",")
- this.shamanTitleList = rs["ShamanTitleList"].split(",")
- this.shopTitleList = rs["ShopTitleList"].split(",")
- this.bootcampTitleList = rs["BootcampTitleList"].split(",")
- this.hardModeTitleList = rs["HardModeTitleList"].split(",")
- this.divineModeTitleList = rs["DivineModeTitleList"].split(",")
- this.specialTitleList = rs["SpecialTitleList"].split(",")
- this.banHours = rs["BanHours"]
- level = rs["ShamanLevel"].split("/")
- this.shamanLevel = int(level[0])
- this.shamanExp = int(level[1])
- this.shamanExpNext = int(level[2])
- for skill in rs["Skills"].split(";"):
- values = skill.split(":")
- if len(values) >= 2:
- this.playerSkills[int(values[0])] = int(values[1])
- this.lastOn = rs["LastOn"]
- this.friendsList = rs["FriendsList"].split(",")
- this.ignoredsList = rs["IgnoredsList"].split(",")
- this.gender = rs["Gender"]
- this.lastDivorceTimer = rs["LastDivorceTimer"]
- this.marriage = rs["Marriage"]
- tribeInfo = rs["TribeInfo"].split("#")
- if len(tribeInfo) == 3:
- this.tribeCode = int(tribeInfo[0])
- this.tribeRank = int(tribeInfo[1])
- this.tribeJoined = int(tribeInfo[2])
- this.tribeData = this.server.getTribeInfo(this.tribeCode)
- this.tribeName = this.tribeData[0]
- this.emailAddress = rs["Email"]
- survivor = rs["SurvivorStats"].split(",")
- racing = rs["RacingStats"].split(",")
- this.survivorStats = [int(survivor[0]), int(survivor[1]), int(survivor[2]), int(survivor[3])]
- this.racingStats = [int(racing[0]), int(racing[1]), int(racing[2]), int(racing[3])]
- this.iceCoins = rs["IceCoins"]
- this.iceTokens = rs["IceTokens"]
- for consumable in rs["Consumables"].split(";"):
- values = consumable.split(":")
- if len(values) >= 2:
- this.playerConsumables[int(values[0])] = int(values[1])
- for EquipedConsumables in rs["EquipedConsumables"].split(","):
- consumable.split(":")
- this.shamanSymbol = rs["ShamanSymbol"]
- this.equipedShamanSymbol = rs["EquipedSymbol"]
- totem = this.server.getTotemData(playerName)
- if len(totem) == 2:
- this.STotem = [int(totem[0]), totem[1]]
- this.modMute = playerName in this.server.userMuteCache
- this.shopModule.checkGiftsAndMessages(rs["LastReceivedGifts"], rs["LastReceivedMessages"])
- else:
- reactor.callLater(5, lambda: this.sendPacket(Identifiers.send.Login_Result, chr(2), True))
- return
- this.Username = playerName
- this.playerCode = this.server.generatePlayerCode()
- 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])
- this.clothes = filter(None, this.clothes)
- this.shopBadges = filter(None, this.shopBadges)
- this.friendsList = filter(None, this.friendsList)
- this.ignoredsList = filter(None, this.ignoredsList)
- this.shopTitleList = filter(None, this.shopTitleList)
- this.firstTitleList = filter(None, this.firstTitleList)
- this.cheeseTitleList = filter(None, this.cheeseTitleList)
- this.shamanTitleList = filter(None, this.shamanTitleList)
- this.specialTitleList = filter(None, this.specialTitleList)
- this.bootcampTitleList = filter(None, this.bootcampTitleList)
- this.hardModeTitleList = filter(None, this.hardModeTitleList)
- this.divineModeTitleList = filter(None, this.divineModeTitleList)
- if this.MouseColor == "":
- this.MouseColor = "78583a"
- if this.ShamanColor == "":
- this.ShamanColor = "fade55" if this.shamanSaves >= 1000 else "95d9d6"
- for name in ["cheese", "first", "shaman", "shop", "bootcamp", "hardmode", "divinemode"]:
- this.checkAndRebuildTitleList(name)
- this.shopModule.checkAndRebuildBadges()
- this.sendCompleteTitleList()
- for title in this.titleList:
- if str(title).split(".")[0] == str(this.TitleNumber):
- this.TitleStars = int(str(title).split(".")[1])
- this.server.players[this.Username] = this
- this.skillModule.sendShamanSkills()
- this.skillModule.sendExp(this.shamanLevel, this.shamanExp, this.shamanExpNext)
- this.sendLogin()
- this.sendPlayerIdentification()
- this.shopModule.sendShamanItems()
- if not this.emailAddress == "":
- this.shopModule.sendCanGift()
- this.server.checkPromotionEndTime()
- this.sendTimeStamp()
- this.sendPromotions()
- if this.privLevel == 2:
- this.checkVip()
- if not this.emailAddress == "":
- this.sendPacket(Identifiers.send.Email_Confirmed, chr(1), True)
- this.tribulle.sendPlayerInfo()
- this.tribulle.sendFriendList(None)
- this.tribulle.sendIgnoredsList()
- this.tribulle.sendTribe(False)
- for client in this.server.players.values():
- if this.Username in client.friendsList and client.Username in this.friendsList:
- client.tribulle.sendFriendConnected(this.Username)
- if not this.tribeName == "":
- this.tribulle.sendTribeMemberConnected()
- this.sendMessage("<N>Olá <ROSE>"+this.Username+"<N>, Bem-vindo ao <ROSE>Transformice<N>.");
- if this.privLevel >= 4:
- this.sendStaffLogin(False)
- if this.shamanSaves >= 500:
- this.sendShamanType(this.shamanType, (this.shamanSaves >= 2500 and this.hardModeSaves >= 1000))
- this.sendInventoryConsumables()
- if not startRoom == "" and not startRoom == "1":
- this.enterRoom(this.server.checkRoom(startRoom, this.Langue))
- else:
- this.enterRoom(this.server.recommendRoom(this.Langue))
- this.resSkillsTimer = reactor.callLater(600, setattr, this, "canResSkill", True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement