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[0].isdigit() or len(playerName) > 12 or len(playerName) < 3 or "Souris" if "+" in playerName else playerName))
- if not this.canLogin[0] and not this.canLogin[1]:
- this.transport.loseConnection()
- return
- if not this.isGuest and playerName in this.server.userPermaBanCache:
- this.sendPacket(Identifiers.old.send.Player_Ban_Login, [])
- this.transport.loseConnection()
- return
- if not this.isGuest and 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.sendPacket(Identifiers.old.send.Player_Ban_Login, [timeCalc * 3600000, str(banInfo[1])])
- this.transport.loseConnection()
- return
- if this.server.checkConnectedAccount(playerName):
- this.sendPacket(Identifiers.send.Login_Result, chr(1))
- else:
- vipTime, letters, gifts, messages = 0, "", "", ""
- 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.survivorStats = map(int, rs["SurvivorStats"].split(","))
- this.racingStats = map(int, rs["RacingStats"].split(","))
- this.nowCoins = rs["NowCoins"]
- this.nowTokens = rs["NowTokens"]
- for consumable in rs["Consumables"].split(";"):
- values = consumable.split(":")
- if len(values) >= 2:
- this.playerConsumables[int(values[0])] = int(values[1])
- this.equipedConsumables = rs["EquipedConsumables"].split("|")
- letters = rs["Letters"]
- this.pet = rs["Pet"]
- this.petEnd = 0 if this.pet == 0 else TFMUtils.getTime() + rs["PetEnd"]
- this.shamanBadges = rs["ShamanBadges"].split(",")
- this.equipedShamanBadge = rs["EquipedShamanBadge"]
- totem = this.server.getTotemData(playerName)
- if len(totem) == 2: this.STotem = [int(totem[0]), totem[1]]
- gifts = rs["Gifts"]
- message = rs["Messages"]
- vipTime = rs["VipTime"]
- this.custom = rs["customItens"].split(",")
- else:
- reactor.callLater(5, lambda: this.sendPacket(Identifiers.send.Login_Result, chr(2)))
- return
- if this.privLevel == -1:
- this.sendPacket(Identifiers.old.send.Player_Ban_Login, [0, "Account Locked."])
- this.transport.loseConnection()
- return
- this.server.lastPlayerCode += 1
- this.Username = playerName
- this.playerCode = this.server.lastPlayerCode
- this.Cursor.execute("insert into LoginLog 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.custom = filter(None, this.custom)
- this.shamanBadges = filter(None, this.shamanBadges)
- 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)
- for name in ["cheese", "first", "shaman", "shop", "bootcamp", "hardmode", "divinemode"]:
- this.checkAndRebuildTitleList(name)
- this.sendCompleteTitleList()
- this.shopModule.checkAndRebuildBadges()
- for title in this.titleList:
- if str(title).split(".")[0] == str(this.TitleNumber):
- this.TitleStars = int(str(title).split(".")[1])
- break
- this.isMute = playerName in this.server.userMuteCache
- 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 this.shamanSaves >= 500:
- this.sendShamanType(this.shamanType, (this.shamanSaves >= 2500 and this.hardModeSaves >= 1000))
- this.server.checkPromotionsEnd()
- this.sendTimeStamp()
- this.sendPromotions()
- this.sendPacket(Identifiers.send.Email_Confirmed, chr(1))
- if this.privLevel == 2:
- this.checkVip(vipTime)
- this.tribulle.sendPlayerInfo()
- this.tribulle.sendFriendsList(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()
- #if this.privLevel >= 1:
- # this.sendLangueMessage("", "<N>Welcome to <J>ZoneMice<N>!")
- if this.privLevel >= 4:
- #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.")
- this.sendStaffLogin(False)
- this.sendInventoryConsumables()
- this.checkLetters(letters)
- this.shopModule.checkGiftsAndMessages(gifts, messages)
- 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