Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #coding: utf-8
- import re, time, sys, os, subprocess
- from ByteArray import ByteArray
- from Identifiers import Identifiers
- class ParseCommands:
- def __init__(this, client, server):
- this.client = client
- this.server = client.server
- this.Cursor = client.Cursor
- this.currentArgsCount = 0
- def requireLevel(this, level, isVip=False):
- if this.client.privLevel < level:
- if not (isVip and this.client.privLevel == 2):
- raise UserWarning
- else:
- return True
- def requireNoSouris(this, playerName):
- if playerName.startswith("*"):
- raise UserWarning
- else:
- return True
- def requireArgs(this, argsCount):
- if this.currentArgsCount < argsCount:
- raise UserWarning
- else:
- return True
- def parseCommand(this, command):
- values = command.split(" ")
- command = values[0].lower()
- args = values[1:]
- argsCount = len(args)
- argsNotSplited = " ".join(args)
- this.currentArgsCount = argsCount
- if argsCount == 0:
- if command in ["profil", "perfil", "profile"]:
- this.client.sendProfile(this.client.Username)
- elif command in ["editeur"]:
- if this.client.privLevel >= 1:
- this.client.enterRoom(chr(3) + "[Editeur] " + this.client.Username)
- this.client.sendPacket(Identifiers.old.send.Editeur, [])
- this.client.sendPacket(Identifiers.send.Room_Type, chr(1), True)
- elif command in ["totem"]:
- if this.client.privLevel >= 1:
- if this.client.privLevel != 0 and this.client.shamanSaves >= 500:
- this.client.enterRoom(chr(3) + "[Totem] " + this.client.Username)
- elif command in ["sauvertotem"]:
- if this.client.room.isTotemEditeur:
- this.server.setTotemData(this.client.Username, int(str(this.client.Totem[0])), str(this.client.Totem[1]))
- this.client.STotem[0] = this.client.Totem[0]
- this.client.STotem[1] = this.client.Totem[1]
- this.client.sendPlayerDied()
- this.client.enterRoom(this.server.recommendRoom(this.client.Langue))
- elif command in ["resettotem"]:
- if this.client.room.isTotemEditeur:
- this.client.Totem[0] = 0
- this.client.Totem[1] = ""
- this.client.RTotem = True
- this.client.isDead = True
- this.client.sendPlayerDied()
- this.client.room.checkShouldChangeMap()
- elif command in ["mulodrome"]:
- can = this.client.privLevel == 10 or this.client.room.roomName.startswith(this.client.Username)
- if can and not this.client.room.isMulodrome:
- for player in this.client.room.clients.values():
- player.sendPacket(Identifiers.send.Mulodrome_Start, chr(1 if player.Username == this.client.Username else 0), True)
- elif command in ["skip"]:
- if this.client.canSkipMusic and this.client.room.isMusic and this.client.room.currentMusicID != 0:
- this.client.room.musicSkipVotes += 1
- this.client.checkMusicSkip()
- elif command in ["np", "map", "nextmap", "killall"]:
- if this.client.privLevel >= 6:
- this.client.room.killAll()
- elif command in ["pw"]:
- if this.client.room.roomName.startswith("*" + this.client.Username) or this.client.room.roomName.startswith(this.client.Username):
- this.client.room.roomPassword = ""
- this.client.sendClientMessage("Password Disabled.")
- elif command in ["hide"]:
- if this.client.privLevel >= 5:
- this.client.sendPlayerDisconnect()
- this.client.sendClientMessage("Você está invisível.")
- this.client.isHidden = True
- elif command in ["unhide"]:
- if this.client.privLevel >= 5:
- if this.client.isHidden:
- this.client.enterRoom(this.client.room.name)
- this.client.sendClientMessage("Você nao está mais invisível.")
- this.client.isHidden = False
- elif command in ["reboot"]:
- if this.client.privLevel == 10:
- this.server.sendServerReboot()
- elif command in ["shutdown"]:
- if this.client.privLevel == 10:
- this.server.sendServerShutdown()
- elif command in ["updatesql"]:
- if this.client.privLevel == 10:
- for player in this.server.players.values():
- if not player.isGuest:
- player.updateDatabase()
- this.server.sendModMessage(7, "Updatesql foi executado com sucesso.")
- elif command in ["ping"]:
- ping = subprocess.Popen(["ping", "-n", "1", this.client.ipAddress], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
- out, erro = ping.communicate()
- this.client.sendClientMessage(out.split(" ")[-4][:1])
- elif command in ["kill", "suicide", "mort", "die"]:
- if not this.client.isDead:
- this.client.isDead = True
- if not this.client.room.noAutoScore: this.client.playerScore += 1
- this.client.sendPlayerDied()
- this.client.room.checkShouldChangeMap()
- elif command in ["title"]:
- p = ByteArray()
- p2 = ByteArray()
- titlesCount = 0
- starTitlesCount = 0
- for title in this.client.titleList:
- if "." in str(title):
- titleInfo = str(title).split(".")
- titleNumber = int(titleInfo[0])
- stars = int(titleInfo[1])
- if stars <= 1:
- p2.writeShort(titleNumber)
- titlesCount += 1
- else:
- p.writeShort(titleNumber).writeByte(stars)
- starTitlesCount += 1
- this.client.sendPacket(Identifiers.send.Titles_List, ByteArray().writeShort(titlesCount).writeBytes(p2.toByteArray()).writeShort(starTitlesCount).writeBytes(p.toByteArray()).toByteArray(), True)
- elif command in ["sy?"]:
- if this.client.privLevel >= 5:
- this.client.sendMessageLangue("", "$SyncEnCours : <V>" + this.client.room.currentSyncName)
- elif re.match("p\\d+(\\.\\d+)?", command):
- if this.client.privLevel >= 6:
- mapCode = this.client.room.mapCode
- mapName = this.client.room.mapName
- if mapCode != -1:
- avaliablePerms = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 17, 18, 19, 22, 44]
- permCategory = int(command[1:])
- if permCategory in avaliablePerms:
- this.server.sendModMessage(6, "<V>"+this.client.Username+" <BL>avaliou o mapa @"+str(mapCode)+" - "+str(mapName)+" para a categoria P"+str(permCategory)+".")
- this.Cursor.execute("update MapEditor set Perma = ? where Code = ?", [permCategory, mapCode])
- elif re.match("lsp\\d+(\\.\\d+)?", command):
- if this.client.privLevel >= 6:
- permCategory = int(command[3:])
- result = ""
- mapList = ""
- mapCount = 0
- this.Cursor.execute("select * from MapEditor where Perma = ?", [permCategory])
- r = this.Cursor.fetchall()
- for rs in r:
- mapCount += 1
- playerName = rs["Name"]
- yesVotes = rs["YesVotes"]
- noVotes = rs["NoVotes"]
- totalVotes = yesVotes + noVotes
- if totalVotes < 1: totalVotes = 1
- Rating = (1.0 * yesVotes / totalVotes) * 100
- rate = str(Rating).split(".")[0]
- if rate == "Nan": rate = "0"
- mapList += "<br><N>"+str(playerName)+" - @"+str(rs["Code"])+" - "+str(totalVotes)+" - "+str(rate)+"% - P"+str(rs["Perma"])
- if len(mapList) != 0:
- result = str(mapList)
- try: this.client.sendLogMessage("<font size=\"12\"><N>Há <BL>"+str(mapCount)+"<N> mapas <V>P"+str(permCategory) + str(result)+"</font>")
- except: pass
- elif command in ["re", "respawn"]:
- if this.client.privLevel >= 7:
- this.client.room.respawnSpecific(this.client.Username)
- elif command in ["mapinfo"]:
- if this.client.privLevel >= 6:
- if this.client.room.mapCode != -1:
- totalVotes = this.client.room.mapYesVotes + this.client.room.mapNoVotes
- if totalVotes < 1: totalVotes = 1
- Rating = (1.0 * this.client.room.mapYesVotes / totalVotes) * 100
- rate = str(Rating).split(".")[0]
- if rate == "Nan": rate = "0"
- this.client.sendClientMessage("<V>"+str(this.client.room.mapName)+"<BL> - <V>@"+str(this.client.room.mapCode)+"<BL> - <V>"+str(totalVotes)+"<BL> - <V>"+str(rate)+"%<BL> - <V>P"+str(this.client.room.mapPerma)+"<BL>.")
- elif command in ["neige"]:
- if this.client.privLevel >= 8:
- this.client.room.startSnow(1000000, 60, not this.client.room.isSnowing)
- else:
- if not this.client.tribeName == "" and this.client.room.isTribeHouse:
- tribeRankings = this.client.tribeData[3]
- perm = tribeRankings[this.client.tribeRank].split("|")[2]
- if perm.split(",")[9] == "1":
- this.client.room.startSnow(1000000, 60, not this.client.room.isSnowing)
- elif command in ["music", "musique"]:
- if this.client.privLevel >= 8:
- this.client.room.sendAll(Identifiers.old.send.Music, [])
- else:
- if not this.client.tribeName == "" and this.client.room.isTribeHouse:
- tribeRankings = this.client.tribeData[3]
- perm = tribeRankings[this.client.tribeRank].split("|")[2]
- if perm.split(",")[7] == "1":
- this.client.room.sendAll(Identifiers.old.send.Music, [])
- elif command in ["clearreports"]:
- if this.client.privLevel == 10:
- this.server.reports = {"names": []}
- this.client.sendClientMessage("Feito.")
- this.server.sendModMessage(7, "<V>"+this.client.Username+"<BL> limpou os reports do ModoPwet.")
- elif command in ["clearcache"]:
- if this.client.privLevel == 10:
- this.server.ipPermaBanCache = []
- this.client.sendClientMessage("Feito.")
- this.server.sendModMessage(7, "<V>"+this.client.Username+"<BL> limpou o cache de ips do servidor.")
- elif command in ["cleariptempban"]:
- if this.client.privLevel == 10:
- this.server.tempIPBanList = []
- this.client.sendClientMessage("Feito.")
- this.server.sendModMessage(7, "<V>"+this.client.Username+"<BL> limpou a lista de ips banidos do servidor.")
- elif command in ["log"]:
- if this.client.privLevel >= 7:
- logList = []
- this.Cursor.execute("select * from BanLog order by Date desc limit 0, 200")
- r = this.Cursor.fetchall()
- for rs in r:
- if rs["Status"] == "Unban":
- logList += rs["Name"], "", rs["BannedBy"], "", "", rs["Date"].rjust(13, "0")
- else:
- logList += rs["Name"], rs["IP"], rs["BannedBy"], rs["Time"], rs["Reason"], rs["Date"].rjust(13, "0")
- this.client.sendPacket(Identifiers.old.send.Log, logList)
- elif command in ["mod"]:
- mods = {}
- modsList = "$ModoPasEnLigne"
- for player in this.server.players.values():
- if player.privLevel >= 4:
- if mods.has_key(player.Langue.lower()):
- names = mods[player.Langue.lower()]
- names.append(player.Username)
- mods[player.Langue.lower()] = names
- else:
- names = []
- names.append(player.Username)
- mods[player.Langue.lower()] = names
- if len(mods) >= 1:
- modsList = "$ModoEnLigne"
- for list, count in mods.items():
- modsList += "<br><BL>["+str(list)+"] <BV>"+str("<BL>, <BV>").join(count)
- this.client.sendMessageLangue("", modsList)
- elif command in ["ls"]:
- if this.client.privLevel >= 4:
- data = []
- for room in this.server.rooms.values():
- if room.name.startswith("*") and not room.name.startswith("*" + chr(3)):
- data.append(["ALL", room.name, room.getPlayerCount()])
- elif room.name.startswith(str(chr(3))) or room.name.startswith("*" + chr(3)):
- if room.name.startswith(("*" + chr(3))):
- data.append(["TRIBEHOUSE", room.name, room.getPlayerCount()])
- else:
- data.append(["PRIVATE", room.name, room.getPlayerCount()])
- else:
- data.append([room.community.upper(), room.roomName, room.getPlayerCount()])
- result = "\n"
- for roomInfo in data:
- result += "[<J>"+str(roomInfo[0])+"<BL>] <b>"+str(roomInfo[1])+"</b> : "+str(roomInfo[2])+"\n"
- result += "<font color='#00C0FF'>Total de jogadores/salas: </font><J><b>"+str(this.server.getConnectedPlayerCount())+"</b><font color='#00C0FF'>/</font><J><b>"+str(this.server.getRoomsCount())+"</b>"
- this.client.sendClientMessage(result)
- elif command in ["clearchat"]:
- if this.client.privLevel >= 5:
- this.client.room.sendAllBin(Identifiers.send.Message, ByteArray().writeUTF("<br>"*100).toByteArray())
- elif command in ["staff", "equipe"]:
- lists = ["<p align='center'>", "<p align='center'>", "<p align='center'>", "<p align='center'>", "<p align='center'>", "<p align='center'>", "<p align='center'>"]
- this.Cursor.execute("select Username, PrivLevel from Users where PrivLevel > 4")
- r = this.Cursor.fetchall()
- for rs in r:
- playerName = rs["Username"]
- privLevel = int(rs["PrivLevel"])
- lists[{10:0, 9:1, 8:2, 7:3, 6:4, 5:5, 4:6}[privLevel]] += "\n<V>" + playerName + "<N> - " + {10: "<ROSE>Administrador", 9:"<VI>Coordenador", 8:"<J>Super Moderador", 7:"<CE>Moderador", 6:"<CEP>MapCrew", 5:"<CS>Helper", 4:"<CH>Divulgador"}[privLevel] + "<N> - [" + ("<VP>Online" if this.server.checkConnectedAccount(playerName) else "<R>Offline") + "<N>]\n"
- this.client.sendLogMessage("<V><p align='center'><b>Equipe Transformice</b></p>" + "".join(lists) + "</p>")
- elif command in ["vips", "vipers"]:
- lists = "<V><p align='center'><b>Vips Transformice</b></p><p align='center'>"
- this.Cursor.execute("select Username from Users where PrivLevel = 2")
- r = this.Cursor.fetchall()
- for rs in r:
- playerName = rs["Username"]
- lists += "\n<N>" + str(playerName) + " - <N><J>VIP<V> - [<N>" + ("<VP>Online<N>" if this.server.checkConnectedAccount(playerName) else "<R>Offline<N>") + "<V>]<N>\n"
- this.client.sendLogMessage(lists + "</p>")
- elif command in ["teleport"]:
- if this.client.privLevel >= 9:
- this.client.isTeleport = not this.client.isTeleport
- this.client.room.bindMouse(this.client.Username, this.client.isTeleport)
- this.client.sendClientMessage("Teleport Hack: " + ("<VP>Ativado" if this.client.isTeleport else "<R>Destivado") + " !")
- elif command in ["fly"]:
- if this.client.privLevel >= 9:
- this.client.isFly = not this.client.isFly
- this.client.room.bindKeyBoard(this.client.Username, 32, False, this.client.isFly)
- this.client.sendClientMessage("Fly Hack: " + ("<VP>Ativado" if this.client.isFly else "<R>Destivado") + " !")
- elif command in ["speed"]:
- if this.client.privLevel >= 9:
- this.client.isSpeed = not this.client.isSpeed
- this.client.room.bindKeyBoard(this.client.Username, 32, False, this.client.isSpeed)
- this.client.sendClientMessage("Speed Hack: " + ("<VP>Ativado" if this.client.isSpeed else "<R>Destivado") + " !")
- elif command in ["vamp"]:
- if this.client.privLevel >= 4:
- if this.client.room.iceEnabled or this.client.privLevel >= 8:
- this.client.sendVampireMode(False)
- elif command in ["meep"]:
- if this.client.privLevel >= 4:
- this.client.canMeep = True
- if this.client.room.iceEnabled or this.client.privLevel >= 8:
- this.client.sendPacket(Identifiers.send.Can_Meep, chr(1), True)
- elif command in ["pink"]:
- if this.client.privLevel >= 4:
- this.client.room.sendAllBin(Identifiers.send.Halloween_Player_Damanged, ByteArray().writeInt(this.client.playerCode).toByteArray())
- elif command in ["don"]:
- this.client.room.sendAllBin(Identifiers.send.Don, ByteArray().writeInt(this.client.playerCode).toByteArray())
- elif command in ["vbig"]:
- if this.client.privLevel >= 8:
- this.client.sendPacket(Identifiers.send.Can_Transformation, chr(1), True)
- elif command in ["vsha"]:
- if this.client.privLevel >= 9:
- this.client.isShaman = True
- for player in this.client.room.clients.values():
- player.sendShamanCode(this.client.playerCode)
- elif command in ["freebadges"]:
- if this.client.privLevel >= 4:
- badges = [0, 1, 6, 7, 9, 16, 17, 18, 33, 34, 35, 42, 46, 47, 50, 51, 55, 57, 58, 59]
- for badge in badges:
- if not badge in this.client.shopBadges:
- this.client.shopBadges.append(badge)
- this.client.sendClientMessage("Você desbloqueou novas medalhas !")
- elif command in ["meusmapas", "mymaps", "lsmap"]:
- if this.client.privLevel >= 1:
- result = ""
- mapList = ""
- mapCount = 0
- this.Cursor.execute("select * from MapEditor where Name = ?", [this.client.Username])
- r = this.Cursor.fetchall()
- for rs in r:
- mapCount += 1
- yesVotes = rs["YesVotes"]
- noVotes = rs["NoVotes"]
- totalVotes = yesVotes + noVotes
- if totalVotes < 1: totalVotes = 1
- Rating = (1.0 * yesVotes / totalVotes) * 100
- rate = str(Rating).split(".")[0]
- if rate == "Nan": rate = "0"
- mapList += "<br><N>"+this.client.Username+" - @"+str(rs["Code"])+" - "+str(totalVotes)+" - "+str(rate)+"% - P"+str(rs["Perma"])
- if len(mapList) != 0:
- result = str(mapList)
- try: this.client.sendLogMessage("<font size= \"12\"><V>"+this.client.Username+"<N>'s maps: <BV>"+str(mapCount)+ str(result)+"</font>")
- except: pass
- elif command in ["ajuda", "help"]:
- if this.client.privLevel >= 1:
- message = "<p align = \"center\"><font size = \"15\"><J>Lista de comandos do Transformice</font></p><p align=\"left\"><font size = \"12\"><br><br>"
- message += " <CH>/perfil <N>- <VP>Mostra o seu perfil.<br>"
- message += " <CH>/perfil [Nome] <N>- <VP>Mostra o perfil de um usuário conectado.<br>"
- message += " <CH>/mulodrome <N>- <VP>Inicia um novo mulodrome.<br>"
- message += " <CH>/skip <N>- <VP>Da um voto para passar de música na sala music.<br>"
- message += " <CH>/pw [Senha] <N>- <VP>Ativa a senha de uma sala.<br>"
- message += " <CH>/pw <N>- <VP>Desativa a senha de uma sala.<br>"
- message += " <CH>/ping <N>- <VP>Mostra o seu ping.<br>"
- message += " <CH>/mort <N>- <VP>Mata o seu rato.<br>"
- message += " <CH>/title <N>- <VP>Mostra a sua lista de títulos.<br>"
- message += " <CH>/title [Número] <N>- <VP>Troca seu título.<br>"
- message += " <CH>/mod <N>- <VP>Mostra a lista de moderadores online.<br>"
- message += " <CH>/staff <N>- <VP>Mostra a equipe do servidor.<br>"
- message += " <CH>/vips <N>- <VP>Mostra a lista de vips do servidor.<br>"
- message += " <CH>/don <N>- <VP>Animação de dar um presente.<br>"
- message += " <CH>/lsmap <N>- <VP>Mostra uma lista de seus mapas.<br>"
- message += " <CH>/ajuda <N>- <VP>Lista de comandos do servidor.<br>"
- message += " <CH>/ban [Nome] <N>- <VP>Da um voto para banir um jogador.<br>"
- message += " <CH>/code <N>- <VP>Ative seu código VIP.<br>"
- message += " <CH>/cor [Cor] <N>- <VP>Altera a cor de seu rato.<br>"
- if this.client.privLevel == 2 or this.client.privLevel >= 4:
- message += " <CH>/vamp <N>- <VP>Transforma seu rato em um vampiro.<br>"
- message += " <CH>/meep <N>- <VP>Ativa o meep.<br>"
- message += " <CH>/pink <N>- <VP>Deixa o seu rato rosa.<br>"
- message += " <CH>/freebadges <N>- <VP>Desbloqueia novas medalhas.<br>"
- message += " <CH>/namecor [Cor] <N>- <VP>Altera a cor de seu nome.<br>"
- if this.client.privLevel == 2 or this.client.privLevel >= 7:
- message += " <CH>/re <N>- <VP>Revive o seu rato.<br>"
- message += " <CH>/vip [Mensagem] <N>- <VP>Envia uma mensagem para a sala como VIP.<br>"
- if this.client.privLevel >= 4:
- message += " <CH>/d [Mensagem] <N>- <VP>Manda uma mensagem no chat de divulgadores.<br>"
- if this.client.privLevel >= 5:
- message += " <CH>/sy? <N>- <VP>Mostra o usuário sync atual.<br>"
- message += " <CH>/ls <N>- <VP>Mostra a lista de salas do servidor.<br>"
- message += " <CH>/clearchat <N>- <VP>Limpa o chat.<br>"
- message += " <CH>/ban [Nome] [Horas] [Razão] <N>- <VP>Bane um jogador do servidor.<br>"
- message += " <CH>/iban [Nome] [Horas] [Razão] <N>- <VP>Bane um jogador do servidor (sem mensagem).<br>"
- message += " <CH>/mute [Nome] [Horas] [Razão] <N>- <VP>Muta um jogador.<br>"
- message += " <CH>/find [Nome] <N>- <VP>Mostra a sala atual de um usuário.<br>"
- message += " <CH>/hel [Mensagem] <N>- <VP>Envia uma mensagem no global de Helper.<br>"
- message += " <CH>/hide <N>- <VP>Torna o seu rato invisivel.<br>"
- message += " <CH>/unhide <N>- <VP>Tira a invisivilidade de seu rato.<br>"
- message += " <CH>/glbrm [Mensagem] <N>- <VP>Envia uma mensagem para a sala no global.<br>"
- if this.client.privLevel >= 6:
- message += " <CH>/np <N>- <VP>Pula para o próximo mapa.<br>"
- message += " <CH>/np [Código] <N>- <VP>Pula para um mapa específico.<br>"
- message += " <CH>/npp [Código] <N>- <VP>Escolhe o próximo mapa.<br>"
- message += " <CH>/p[Categoria] <N>- <VP>Avalia um mapa para certa categoria.<br>"
- message += " <CH>/lsp[Categoria] <N>- <VP>Mostra a lista de mapas de certa categoria.<br>"
- message += " <CH>/mapinfo <N>- <VP>Mostra as informações do mapa atual.<br>"
- message += " <CH>/kick [Nome] <N>- <VP>Expulsa um usuário do servidor.<br>"
- message += " <CH>/mapc [Mensagem] <N>- <VP>Envia uma mensagem no global de MapCrew.<br>"
- message += " <CH>/lsmaps [Nome] <N>- <VP>Mostra a lista de mapas de um usuário.<br>"
- if this.client.privLevel >= 7:
- message += " <CH>/log <N>- <VP>Mostra o log de bans do servidor.<br>"
- message += " <CH>/log [Nome] <N>- <VP>Mostra o log de bans de um jogador especifico.<br>"
- message += " <CH>/unban [Nome] <N>- <VP>Desane um jogador do servidor.<br>"
- message += " <CH>/unmute [Nome] <N>- <VP>Desmuta um jogador.<br>"
- message += " <CH>/sy [Nome] <N>- <VP>Altera o sync atual.<br>"
- message += " <CH>/clearban [Nome] <N>- <VP>Limpa os votos de ban de um usuário.<br>"
- message += " <CH>/ip [Nome] <N>- <VP>Mostra o IP de um usuário.<br>"
- message += " <CH>/ch [Nome] <N>- <VP>Escolhe o próximo shaman.<br>"
- message += " <CH>/mod [Mensagem] <N>- <VP>Envia uma mensagem no global de Moderador.<br>"
- message += " <CH>/lock [Nome] <N>- <VP>Bloqueia um usuário.<br>"
- message += " <CH>/unlock [Nome] <N>- <VP>Desbloqueia um usuário.<br>"
- message += " <CH>/nomip [Nome] <N>- <VP>Mostra o histórico de IPs de um usuário.<br>"
- message += " <CH>/ipnom [IP] <N>- <VP>Mostra o histórico de um IP.<br>"
- message += " <CH>/warn [Nome] [Motivo] <N>- <VP>Envia um alerta a um determinado usuário.<br>"
- if this.client.privLevel >= 8:
- message += " <CH>/neige <N>- <VP>Inicia / Para a neve na sala.<br>"
- message += " <CH>/music [Link] <N>- <VP>Inicia uma musica na sala.<br>"
- message += " <CH>/music <N>- <VP>Para a musica na sala.<br>"
- message += " <CH>/settime [Segundos] <N>- <VP>Altera o tempo do mapa atual.<br>"
- message += " <CH>/smod [Mensagem] <N>- <VP>Envia uma mensagem no global de Super Moderador.<br>"
- message += " <CH>/move [Nome da Sala] <N>- <VP>Move os usuários da sala atual para uma outra sala.<br>"
- message += " <CH>/give [Nome] [Tipo] [Quantidade] <N>- <VP>Da algo a um usuário.<br>"
- message += " <CH>/size [Nome] [Tamanho] <N>- <VP>Altera o tamanho de um rato.<br>"
- message += " <CH>/name [Nome] [Novo nome] <N>- <VP>Altera o nome de um rato.<br>"
- message += " <CH>/namecolor [Nome] [Cor] <N>- <VP>Altera a cor do nome de um rato.<br>"
- message += " <CH>/addimage [Imagem] [Alvo] [X] [Y] <N>- <VP>Adiciona uma imagem a algum lugar.<br>"
- if this.client.privLevel >= 9:
- message += " <CH>/teleport <N>- <VP>Ativa o modo teleport hack.<br>"
- message += " <CH>/fly <N>- <VP>Ativa o modo fly hack.<br>"
- message += " <CH>/speed <N>- <VP>Ativa o modo speed hack.<br>"
- message += " <CH>/vsha <N>- <VP>Transforma o seu rato no shaman.<br>"
- message += " <CH>/coord [Mensagem] <N>- <VP>Envia uma mensagem no global de Coordenador.<br>"
- if this.client.privLevel >= 10:
- message += " <CH>/reboot <N>- <VP>Reinicia o servidor.<br>"
- message += " <CH>/shutdown <N>- <VP>Desliga o servidor.<br>"
- message += " <CH>/clearcache <N>- <VP>Limpa o cache de ips do servidor.<br>"
- message += " <CH>/cleariptemban <N>- <VP>Limpa os ips banidos temporariamentes do servidor.<br>"
- message += " <CH>/clearreports <N>- <VP>Limpa os reports do ModoPwet.<br>"
- message += " <CH>/changepassword [Nome] [Senha] <N>- <VP>Muda a senha de um usuário.<br>"
- message += " <CH>/playersql [Nome] [Parâmetro] [Valor] <N>- <VP>Altera a SQL de um usuário.<br>"
- message += " <CH>/smn [Mensagem] <N>- <VP>Envia uma mensagem com seu nome ao servidor.<br>"
- message += " <CH>/mshtml [Mensagem] <N>- <VP>Envia uma mensagem em HTML.<br>"
- message += " <CH>/admin [Mensagem] <N>- <VP>Envia uma mensagem no global de Administrador.<br>"
- message += " <CH>/rank [Nome] [Rank] <N>- <VP>Muda o rank de um usuário.<br>"
- message += " <CH>/setvip [Nome] [Dias] <N>- <VP>Da VIP a um usuário.<br>"
- message += " <CH>/removevip [Nome] <N>- <VP>Tira o VIP de um usuário.<br>"
- message += " <CH>/addtext [Tipo] [Link] <N>- <VP>Adiciona um link a lista de servidores.<br>"
- message += " <CH>/removetext [Tipo] [Link] <N>- <VP>Remove um link a lista de servidores.<br>"
- message += " <CH>/giveforall [Tipo] [Quantidade] <N>- <VP>Da algo a todos usuários online.<br>"
- message += " <CH>/unrank [Nome] <N>- <VP>Zera o perfil de um usuário.<br>"
- message += " <CH>/luaadmin <N>- <VP>Habilita / Desabilida executar scripts no servidor pelo lua.<br>"
- message += " <CH>/updatesql <N>- <VP>Atualiza os dados na Database dos usuários onlines."
- message += "</font></p>"
- this.client.sendLogMessage(message.replace("&#", "&#").replace("<", "<"))
- elif command in ["luaadmin"]:
- if this.client.privLevel == 10:
- this.client.runLuaAsBot = not this.client.runLuaAsBot
- this.client.sendClientMessage("Você agora poderá usar scripts como administrador pelo lua." if this.client.runLuaAsBot else "Você não poderá usar mais scripts como administrador pelo lua.")
- elif command in ["racing", "survivor", "bootcamp", "vanilla", "tutorial"]:
- this.client.enterRoom("racing1" if command == "racing" else "survivor1" if command == "survivor" else "bootcamp1" if command == "bootcamp" else "vanilla1" if command == "vanilla" else (chr(3) + "[Tutorial] " + this.client.Username) if command == "tutorial" else "")
- elif command in ["lsc"]:
- if this.client.privLevel >= 7:
- result = {}
- for room in this.server.rooms.values():
- if result.has_key(room.community):
- result[room.community] = result[room.community] + room.getPlayerCount()
- else:
- result[room.community] = room.getPlayerCount()
- message = "\n"
- for community, count in result.items():
- message += "<V>"+str(community.upper())+"<BL> : <J>"+str(count)+"\n"
- message += "<V>ALL<BL> : <J>"+str(sum(result.values()))
- this.client.sendClientMessage(message)
- elif command in ["ranking"]:
- this.client.ranking.open()
- else:
- if command == "profil" or command == "perfil" or command == "profile":
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- this.client.sendProfile(playerName)
- elif command == "ban" or command == "iban":
- if this.client.privLevel >= 5:
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- time = args[1] if (argsCount >= 2) else "1"
- reason = argsNotSplited.split(" ", 2)[2] if (argsCount >= 3) else ""
- silent = command == "iban"
- hours = int(time) if (time.isdigit()) else 1
- hours = 100000 if (hours > 100000) else hours
- hours = 24 if (this.client.privLevel <= 6 and hours > 24) else hours
- if this.server.banPlayer(playerName, hours, reason, this.client.Username, silent):
- this.server.sendModMessage(5, "<V>"+this.client.Username+"<BL> baniu <V>"+playerName+"<BL> por <V>"+str(hours)+"<BL> horas. Motivo: <V>"+str(reason)+"<BL>." )
- else:
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- this.server.voteBanPopulaire(playerName, this.client.ipAddress)
- elif command == "unban":
- if this.client.privLevel >= 7:
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- this.requireNoSouris(playerName)
- found = False
- if this.server.checkExistingUser(playerName):
- if this.server.checkTempBan(playerName):
- this.server.removeTempBan(playerName)
- found = True
- if this.server.checkPermaBan(playerName):
- this.server.removePermaBan(playerName)
- found = True
- if found:
- this.Cursor.execute("update Users set BanHours = ? where Username = ?", [0, playerName])
- this.Cursor.execute("insert into BanLog (Name, BannedBy, Time, Reason, Date, Status, Room, IP) values (?, ?, ?, ?, ?, ?, ?, ?)", [playerName, this.client.Username, "", "", int(str(time.time())[:9]), "Unban", "", ""])
- this.server.sendModMessage(5, "<V>"+this.client.Username+"<N> desbaniu <V>"+playerName+"<BL>.")
- elif command == "mute":
- if this.client.privLevel >= 5:
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- time = args[1] if (argsCount >= 2) else "1"
- reason = argsNotSplited.split(" ", 2)[2] if (argsCount >= 3) else ""
- hours = int(time) if (time.isdigit()) else 1
- this.requireNoSouris(playerName)
- hours = 500 if (hours > 500) else hours
- hours = 24 if (this.client.privLevel <= 6 and hours > 24) else hours
- this.server.mutePlayer(playerName, hours, reason, this.client.Username)
- elif command == "unmute":
- if this.client.privLevel >= 7:
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- this.requireNoSouris(playerName)
- this.server.desmutePlayer(playerName, this.client.Username)
- elif command == "d":
- if this.client.privLevel >= 4:
- message = argsNotSplited
- this.client.sendAllModerationChat(9, message)
- elif command == "settime":
- if this.client.privLevel >= 8:
- time = args[0]
- if time.isdigit():
- iTime = int(time)
- iTime = 5 if iTime < 5 else (32767 if iTime > 32767 else iTime)
- for player in this.client.room.clients.values():
- player.sendRoundTime(iTime)
- this.client.room.changeMapTimers(iTime)
- elif command == "np" or command == "npp":
- if not this.client.room.isVotingMode:
- canUse = False
- code = args[0]
- if this.client.privLevel >= 6:
- canUse = True
- elif not this.client.tribeName == "" and this.client.room.isTribeHouse:
- tribeRankings = this.client.tribeData[3]
- perm = tribeRankings[this.client.tribeRank].split("|")[2]
- if perm.split(",")[8] == "1":
- canUse = True
- if canUse:
- if code.startswith("@"):
- mapInfo = this.client.room.getMapInfo(int(code[1:]))
- if mapInfo[0] == None:
- this.client.sendMessageLangue("", "$CarteIntrouvable")
- else:
- this.client.room.forceNextMap = code
- if command == "np":
- if this.client.room.changeMapTimer != None: this.client.room.changeMapTimer.cancel()
- this.client.room.mapChange()
- else:
- this.client.sendMessageLangue("", "$ProchaineCarte <V>" + code)
- elif code.isdigit():
- this.client.room.forceNextMap = code
- if command == "np":
- if this.client.room.changeMapTimer != None: this.client.room.changeMapTimer.cancel()
- this.client.room.mapChange()
- else:
- this.client.sendMessageLangue("", "$ProchaineCarte <V>" + code)
- elif command == "mjj":
- roomName = args[0]
- if roomName.startswith("#"):
- this.client.enterRoom(roomName)
- else:
- this.client.enterRoom(("" if this.client.lastGameMode == 1 else "vanilla" if this.client.lastGameMode == 3 else "survivor" if this.client.lastGameMode == 8 else "racing" if this.client.lastGameMode == 9 else "music" if this.client.lastGameMode == 11 else "bootcamp" if this.client.lastGameMode == 2 else "defilante") + roomName)
- elif command == "pw":
- password = args[0]
- if this.client.room.roomName.startswith("*" + this.client.Username) or this.client.room.roomName.startswith(this.client.Username):
- this.client.room.roomPassword = password
- this.client.sendClientMessage("Password : " + password)
- elif command == "changepassword":
- if this.client.privLevel == 10:
- this.requireArgs(2)
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- password = args[1]
- this.requireNoSouris(playerName)
- if not this.server.checkExistingUser(playerName):
- this.client.sendClientMessage("Não foi possível encontrar o usuário: <V>"+playerName+"<BL>.")
- else:
- this.Cursor.execute("update Users set Password = ? where Username = ?", [this.client.TFMUtils.getPass(password), playerName])
- this.client.sendClientMessage("Senha alterada com sucesso.")
- this.server.sendModMessage(7, "<V>"+this.client.Username+"<BL> alterou a senha do usuário: <V>"+playerName+"<BL>.")
- elif command == "playersql":
- if this.client.privLevel == 10:
- this.requireArgs(3)
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- paramter = args[1]
- values = args[2]
- this.requireNoSouris(playerName)
- player = this.server.players.get(playerName)
- if player != None:
- player.room.removeClient(player)
- player.transport.loseConnection()
- if not this.server.checkExistingUser(playerName):
- this.client.sendClientMessage("Não foi possível encontrar o usuário: <V>"+playerName+"<BL>.")
- else:
- try:
- this.Cursor.execute("update Users set " + paramter + " = ? where Username = ?", [value, playerName])
- this.server.sendModMessage(7, "SQL do usuário <V>"+playerName+"<BL> foi alterada. <T>"+str(paramter)+"<BL> -> <T>"+str(value)+"<BL>.")
- except:
- this.client.sendClientMessage("Parâmetros incorretos ou inexistentes.")
- elif command == "music" or command == "musique":
- if this.client.privLevel >= 8:
- this.client.room.sendAll(Identifiers.old.send.Music, [args[0]])
- else:
- if not this.client.tribeName == "" and this.client.room.isTribeHouse:
- tribeRankings = this.client.tribeData[3]
- perm = tribeRankings[this.client.tribeRank].split("|")[2]
- if perm.split(",")[7] == "1":
- this.client.room.sendAll(Identifiers.old.send.Music, [args[0]])
- elif command == "title" or command == "titulo":
- titleID = args[0]
- found = False
- for title in this.client.titleList:
- if str(title).split(".")[0] == titleID:
- found = True
- if found:
- this.client.TitleNumber = int(titleID)
- for title in this.client.titleList:
- if str(title).split(".")[0] == titleID:
- this.client.TitleStars = int(str(title).split(".")[1])
- this.client.sendPacket(Identifiers.old.send.Change_Title, [titleID])
- elif command == "sy":
- if this.client.privLevel >= 7:
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- player = this.server.players.get(playerName)
- if player != None:
- player.isSync = True
- this.client.room.currentSyncCode = player.playerCode
- this.client.room.currentSyncName = player.Username
- if this.client.room.mapCode != -1 or this.client.room.EMapCode != 0:
- this.client.room.sendAll(Identifiers.old.send.Sync, [player.playerCode, ""])
- else:
- this.client.room.sendAll(Identifiers.old.send.Sync, [player.playerCode])
- this.client.sendMessageLangue("", "$NouveauSync <V>" + playerName)
- elif command == "clearban":
- if this.client.privLevel >= 7:
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- player = this.server.players.get(playerName)
- if player != None:
- player.voteBan = []
- this.server.sendModMessage(7, "<V>"+this.client.Username+"<BL> limpou os votos de banido do usuário <V>"+playerName+"<BL>.")
- elif command == "ip":
- if this.client.privLevel >= 7:
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- player = this.server.players.get(playerName)
- if player != None:
- this.client.sendClientMessage("IP do usuário <V>"+playerName+"<BL> : <V>"+player.ipAddress+"<BL>.")
- elif command == "kick":
- if this.client.privLevel >= 6:
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- player = this.server.players.get(playerName)
- if player != None:
- player.room.removeClient(player)
- player.transport.loseConnection()
- this.server.sendModMessage(6, "<V>"+this.client.Username+"<BL> expulsou <V>"+playerName+"<BL> do servidor.")
- else:
- this.client.sendClientMessage("O usuário <V>"+playerName+"<BL> não está online.")
- elif command == "ch":
- if this.client.privLevel >= 7:
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- player = this.server.players.get(playerName)
- if player != None and player.roomName == this.client.roomName:
- if this.client.room.forceNextShaman == player.playerCode:
- this.client.sendMessageLangue("", "$PasProchaineChamane", player.Username)
- this.client.room.forceNextShaman = -1
- else:
- this.client.sendMessageLangue("", "$ProchaineChamane", player.Username)
- this.client.room.forceNextShaman = player.playerCode
- this.client.sendClientMessage("O usuário <V>"+playerName+"<BL> será proxímo Shaman.")
- else:
- this.client.sendClientMessage("O usuário <V>"+playerName+"<BL> não está online ou não está na mesma sala que você.")
- elif command == "search" or command == "find":
- if this.client.privLevel >= 5:
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- result = ""
- for player in this.server.players.values():
- if playerName in player.Username:
- result += "<br><V>"+player.Username+"<BL> -> <V>"+player.room.name
- this.client.sendClientMessage(result)
- elif command == "smn":
- if this.client.privLevel == 10:
- message = argsNotSplited
- this.client.sendAllModerationChat(-1, message)
- elif command == "mshtml":
- if this.client.privLevel == 10:
- message = argsNotSplited.replace("&#", "&#").replace("<", "<")
- this.client.sendAllModerationChat(0, message)
- elif command == "admin":
- if this.client.privLevel == 10:
- message = argsNotSplited
- this.client.sendStaffMessage("<V>• <font color='#00FF7F'>[Administrador <b>"+this.client.Username+"</b>]</font> <N>"+message)
- elif command == "coord":
- if this.client.privLevel >= 9:
- message = argsNotSplited
- this.client.sendStaffMessage("<V>• <font color='#FFFF00'>[Coordenador <b>"+this.client.Username+"</b>]</font> <N>"+message)
- elif command == "smod" or command == "sms":
- if this.client.privLevel >= 8:
- message = argsNotSplited
- this.client.sendStaffMessage("<V>• <font color='#15FA00'>[Super Moderador <b>"+this.client.Username+"</b>]</font> <N>"+message)
- elif command == "mod":
- if this.client.privLevel >= 7:
- message = argsNotSplited
- this.client.sendStaffMessage("<V>• <font color='#F39F04'>[Moderador <b>"+this.client.Username+"</b>]</font> <N>"+message)
- elif command == "mapc":
- if this.client.privLevel >= 6:
- message = argsNotSplited
- this.client.sendStaffMessage("<V>• <font color='#00FFFF'>[MapCrew <b>"+this.client.Username+"</b>]</font> <N>"+message)
- elif command == "hel":
- if this.client.privLevel >= 5:
- message = argsNotSplited
- this.client.sendStaffMessage("<V>• <font color='#FFF68F'>[Helper <b>"+this.client.Username+"</b>]</font> <N>"+message)
- elif command == "vip":
- if this.client.privLevel >= 7:
- message = argsNotSplited
- this.client.room.sendAllBin(Identifiers.send.Message, ByteArray().writeUTF("<V>• <font color='#FFFFFF'>[Vip <b>"+this.client.Username+"</b>]</font> <N>"+message).toByteArray())
- elif command == "glbrm":
- if this.client.privLevel >= 5:
- message = argsNotSplited
- this.client.room.sendAllBin(Identifiers.send.Message, ByteArray().writeUTF("<V>• <font color='#FFFFFF'>[<b>"+this.client.Username+"</b>] "+message+"</font>").toByteArray())
- elif command == "rank":
- if this.client.privLevel == 10:
- this.requireArgs(2)
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- rank = args[1].lower()
- this.requireNoSouris(playerName)
- if not this.server.checkExistingUser(playerName):
- this.client.sendClientMessage("Não foi possível encontrar o usuário: <V>"+playerName+"<BL>.")
- else:
- privLevel = 10 if rank.startswith("adm") else 9 if rank.startswith("coord") else 8 if rank.startswith("smod") else 7 if rank.startswith("mod") else 6 if rank.startswith("map") or rank.startswith("mc") else 5 if rank.startswith("hel") else 4 if rank.startswith("dv") or rank.startswith("div") else 3 if rank.startswith("dev") or rank.startswith("lua") else 2 if rank.startswith("vip") else 1
- rankName = "Administrador" if rank.startswith("adm") else "Coordenador" if rank.startswith("coord") else "Super Moderador" if rank.startswith("smod") else "Moderador" if rank.startswith("mod") else "MapCrew" if rank.startswith("map") or rank.startswith("mc") else "Helper" if rank.startswith("hel") else "Divulgador" if rank.startswith("dv") or rank.startswith("div") else "Lua Developer" if rank.startswith("dev") or rank.startswith("lua") else "Vip" if rank.startswith("vip") else "Player"
- player = this.server.players.get(playerName)
- if player != None:
- player.privLevel = privLevel
- player.TitleNumber = 0
- player.sendLogin()
- else:
- this.Cursor.execute("update Users set PrivLevel = ?, TitleNumber = 0 where Username = ?", [privLevel, playerName])
- this.server.sendModMessage(7, "<V>"+playerName+"<BL> ganhou o rank de <V>"+rankName+"<BL>.")
- elif command == "setvip":
- if this.client.privLevel == 10:
- this.requireArgs(2)
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- days = args[1]
- this.requireNoSouris(playerName)
- if not this.server.checkExistingUser(playerName):
- this.client.sendClientMessage("Não foi possível encontrar o usuário: <V>"+playerName+"<BL>.")
- else:
- this.server.setVip(playerName, int(days) if days.isdigit() else 1)
- elif command == "removevip":
- if this.client.privLevel == 10:
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- this.requireNoSouris(playerName)
- if not this.server.checkExistingUser(playerName):
- this.client.sendClientMessage("Não foi possível encontrar o usuário: <V>"+playerName+"<BL>.")
- else:
- player = this.server.players.get(playerName)
- if player != None:
- player.privLevel = 1
- if player.TitleNumber == 1100:
- player.TitleNumber = 0
- player.sendClientMessage("<CH>Você perdeu seu privilégio VIP do Transformice!")
- this.Cursor.execute("update Users set VipTime = 0 where Username = ?", [playerName])
- else:
- this.Cursor.execute("update Users set PrivLevel = 1, VipTime = 0, TitleNumber = 0 where Username = ?", [playerName])
- this.server.sendModMessage(7, "O jogador <V>"+playerName+"<BL> não é mais VIP.")
- elif command == "lock":
- if this.client.privLevel >= 7:
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- this.requireNoSouris(playerName)
- if not this.server.checkExistingUser(playerName):
- this.client.sendClientMessage("Não foi possível encontrar o usuário: <V>"+playerName+"<BL>.")
- else:
- playerLevel = this.server.getPlayerPrivlevel(playerName)
- if playerLevel < 4:
- player = this.server.players.get(playerName)
- if player != None:
- player.room.removeClient(player)
- player.transport.loseConnection()
- this.Cursor.execute("update Users set PrivLevel = -1 where Username = ?", [playerName])
- this.server.sendModMessage(7, "<V>"+playerName+"<BL> foi bloqueado por <V>"+this.client.Username)
- elif command == "unlock":
- if this.client.privLevel >= 7:
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- this.requireNoSouris(playerName)
- if not this.server.checkExistingUser(playerName):
- this.client.sendClientMessage("Não foi possível encontrar o usuário: <V>"+playerName+"<BL>.")
- else:
- playerLevel = this.server.getPlayerPrivlevel(playerName)
- if playerLevel == -1:
- this.Cursor.execute("update Users set PrivLevel = 1 where Username = ?", [playerName])
- this.server.sendModMessage(7, "<V>"+playerName+"<BL> foi desbloqueado por <V>"+this.client.Username)
- elif command == "log":
- if this.client.privLevel >= 7:
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- this.requireNoSouris(playerName)
- logList = []
- this.Cursor.execute("select * from BanLog where Name = ? order by Date desc limit 0, 200", [playerName])
- r = this.Cursor.fetchall()
- for rs in r:
- if rs["Status"] == "Unban":
- logList += rs["Name"], "", rs["BannedBy"], "", "", rs["Date"].rjust(13, "0")
- else:
- logList += rs["Name"], rs["IP"], rs["BannedBy"], rs["Time"], rs["Reason"], rs["Date"].rjust(13, "0")
- this.client.sendPacket(Identifiers.old.send.Log, logList)
- elif command == "move":
- if this.client.privLevel >= 8:
- roomName = args[0]
- for player in this.client.room.clients.values():
- player.enterRoom(roomName)
- elif command == "nomip":
- if this.client.privLevel >= 7:
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- ipList = "Lista de IPs do jogador: "+playerName
- this.Cursor.execute("select IP from LoginLog where Username = ?", [playerName])
- r = this.Cursor.fetchall()
- for rs in r:
- ipList += "<br>" + rs["IP"]
- this.client.sendClientMessage(ipList)
- elif command == "ipnom":
- if this.client.privLevel >= 7:
- ip = args[0]
- nameList = "Lista de jogdores usando o IP: "+ip
- historyList = "Histórico do IP:"
- for player in this.server.players.values():
- if player.ipAddress == ip:
- nameList += "<br>" + player.Username
- this.Cursor.execute("select Username from LoginLog where IP = ?", [ip])
- r = this.Cursor.fetchall()
- for rs in r:
- historyList += "<br>" + rs["Username"]
- this.client.sendClientMessage(nameList)
- this.client.sendClientMessage(historyList)
- elif command == "lsmaps":
- if this.client.privLevel >= 6:
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- result = ""
- mapList = ""
- mapCount = 0
- this.Cursor.execute("select * from MapEditor where Name = ?", [playerName])
- r = this.Cursor.fetchall()
- for rs in r:
- mapCount += 1
- yesVotes = rs["YesVotes"]
- noVotes = rs["NoVotes"]
- totalVotes = yesVotes + noVotes
- if totalVotes < 1: totalVotes = 1
- Rating = (1.0 * yesVotes / totalVotes) * 100
- rate = str(Rating).split(".")[0]
- if rate == "Nan": rate = "0"
- mapList += "<br><N>"+playerName+" - @"+str(rs["Code"])+" - "+str(totalVotes)+" - "+str(rate)+"% - P"+str(rs["Perma"])
- if len(mapList) != 0:
- result = str(mapList)
- try: this.client.sendLogMessage("<font size= \"12\"><V>"+playerName+"<N>'s maps: <BV>"+str(mapCount)+ str(result)+"</font>")
- except: pass
- elif command == "addtext":
- if this.client.privLevel == 10:
- text = args[0]
- blackList = this.server.blackList["list"]
- if not text in blackList:
- this.client.sendClientMessage("Este domínio já foi adiconado.")
- else:
- this.server.blackList["list"] = text
- this.server.updateBlackList()
- this.server.sendModMessage(7, "<V>"+this.client.Username+"<BL> adicionou <V>"+str(text)+"<BL> a blacklist do servidor")
- elif command == "removelink":
- if this.client.privLevel == 10:
- type = args[0]
- link = args[1].replace("https://", "").replace("http://", "").replace("www.", "").split("/")[0]
- blackList = this.server.blackList["list"]
- if not text in blackList:
- this.client.sendClientMessage("Este domínio não está na lista.")
- else:
- black = this.server.blackList["list"]
- i = 0
- while i < len(black):
- if black[i] == link:
- black.remove(i)
- break
- i += 1
- this.server.blackList["list"] = black
- this.server.updateBlackList()
- this.server.sendModMessage(7, "<V>"+this.client.Username+"<BL> removeu <V>"+str(link)+"<BL> da blacklist do servidor")
- elif command == "nomecor" or command == "namecor":
- if this.client.privLevel >= 4:
- color = args[0]
- hexColor = "025BF5" if color == "azul" else "F3FA1E" if color == "amarelo" else "D968C8" if color == "rosa" else "11F58B" if color == "verde" else "575355" if color == "cinza" else "FA0526" if color == "vermelho" else "FAA405" if color == "laranja" else "CFC5E8" if color == "lilas" else "05F6FA" if color == "azulclaro" else "7900FF" if color == "roxo" else "07E8BF" if color == "verdeescuro" else "B6FCC4" if color == "verdeclaro" else "000001" if color == "preto" else ""
- if not hexColor == "":
- this.client.sendClientMessage("A cor do seu nome foi alterada para <V>"+color+"<BL>.")
- this.client.room.setNameColor(this.client.Username, int(hexColor, 16))
- else:
- this.client.sendClientMessage("Esta cor não está disponível !")
- elif command == "giveforall":
- if this.client.privLevel == 10:
- this.requireArgs(2)
- type = args[0].lower()
- count = int(args[1]) if args[1].isdigit() else 0
- typeName = "queijos" if type.startswith("queijo") or type.startswith("cheese") else "fraises" if type.startswith("morango") or type.startswith("fraise") else "bootcamps" if type.startswith("bc") or type.startswith("bootcamp") else "firsts" if type.startswith("first") else "moedas" if type.startswith("moeda") or type.startswith("coin") else "fichas" if type.startswith("ficha") or type.startswith("tokens") else ""
- if count > 0 and not typeName == "":
- this.server.sendModMessage(7, "<V>"+this.client.Username+"<BL> doou <V>"+str(count)+" "+str(typeName)+"<BL> para todo o servidor.")
- for player in this.server.players.values():
- player.sendClientMessage("Você recebeu <V>"+str(count)+" "+str(typeName)+"<BL>.")
- if typeName == "queijos":
- player.shopCheeses += count
- elif typeName == "fraises":
- player.shopFraises += count
- elif typeName == "bootcamps":
- player.bootcampCount += count
- elif typeName == "firsts":
- player.cheeseCount += count
- player.firstCount += count
- elif typeName == "moedas":
- player.iceCoins += count
- elif typeName == "fichas":
- player.iceTokens += count
- elif command == "give":
- if this.client.privLevel >= 8:
- this.requireArgs(3)
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- type = args[1].lower()
- count = int(args[2]) if args[2].isdigit() else 0
- count = 10000 if count > 10000 else count
- this.requireNoSouris(playerName)
- typeName = "queijos" if type.startswith("queijo") or type.startswith("cheese") else "fraises" if type.startswith("morango") or type.startswith("fraise") else "bootcamps" if type.startswith("bc") or type.startswith("bootcamp") else "firsts" if type.startswith("first") else "moedas" if type.startswith("moeda") or type.startswith("coin") else "fichas" if type.startswith("ficha") or type.startswith("tokens") else ""
- if count > 0 and not typeName == "":
- player = this.server.players.get(playerName)
- if player != None:
- this.server.sendModMessage(7, "<V>"+this.client.Username+"<BL> doou <V>"+str(count)+" "+str(typeName)+"<BL> para <V>"+playerName+"<BL>.")
- player.sendClientMessage("Você recebeu <V>"+str(count)+" "+str(typeName)+"<BL>.")
- if typeName == "queijos":
- player.shopCheeses += count
- elif typeName == "fraises":
- player.shopFraises += count
- elif typeName == "bootcamps":
- player.bootcampCount += count
- elif typeName == "firsts":
- player.cheeseCount += count
- player.firstCount += count
- elif typeName == "moedas":
- player.iceCoins += count
- elif typeName == "fichas":
- player.iceTokens += count
- elif command == "unrank":
- if this.client.privLevel == 10:
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- if not this.server.checkExistingUser(playerName):
- this.client.sendClientMessage("Não foi possível encontrar o usuário: <V>"+playerName+"<BL>.")
- else:
- player = this.server.players.get(playerName)
- if player != None:
- player.room.removeClient(player)
- player.transport.loseConnection()
- this.Cursor.execute("update Users set FirstCount = 0, CheeseCount = 0, ShamanSaves = 0, HardModeSaves = 0, DivineModeSaves = 0, BootcampCount = 0, ShamanCheeses = 0 where Username = ?", [playerName])
- this.server.sendModMessage(7, "<V>"+playerName+"<BL> foi retirado do ranking por <V>"+this.client.Username+"<BL>.")
- elif command == "warn":
- if this.client.privLevel >= 7:
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- message = argsNotSplited.split(" ", 1)[1]
- if not this.server.checkExistingUser(playerName):
- this.client.sendClientMessage("Não foi possível encontrar o usuário: <V>"+playerName+"<BL>.")
- else:
- rank = "Helper" if this.client.privLevel == 5 else "MapCrew" if this.client.privLevel == 6 else "Moderador" if this.client.privLevel == 7 else "Super Moderador" if this.client.privLevel == 8 else "Coordenador" if this.client.privLevel == 9 else "Administrador" if this.client.privLevel == 10 else ""
- player = this.server.players.get(playerName)
- if player != None:
- player.sendClientMessage("<ROSE>[<b>ALERTA</b>] O "+str(rank)+" "+this.client.Username+" lhe enviou um alerta. Motivo: "+str(message))
- this.client.sendClientMessage("<BL>Seu alerta foi enviado com sucesso para <V>"+playerName+"<BL>.")
- this.server.sendModMessage(7, "<V>"+this.client.Username+"<BL> mandou um alerta para"+"<V> "+playerName+"<BL>. Motivo: <V>"+str(message))
- elif command == "cor" or command == "fur" or command == "color":
- if this.client.privLevel >= 1:
- hexColor = args[0][1:] if args[0].startswith("#") else args[0]
- try:
- value = int(hexColor, 16)
- this.client.MouseColor = hexColor
- this.client.sendClientMessage("A cor do seu rato foi alterada.")
- except:
- this.client.sendClientMessage("Cor inválida.")
- elif command == "size":
- if this.client.privLevel >= 8:
- this.requireArgs(2)
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- if args[1].isdigit():
- size = int(args[1])
- if playerName == "*":
- for player in this.client.room.clients.values():
- this.client.room.sendAllBin(Identifiers.send.Mouse_Size, ByteArray().writeInt(this.client.playerCode).writeShort(size).writeBool(False).toByteArray())
- else:
- player = this.server.players.get(playerName)
- if player != None:
- this.client.room.sendAllBin(Identifiers.send.Mouse_Size, ByteArray().writeInt(this.client.playerCode).writeShort(size).writeBool(False).toByteArray())
- elif command == "name":
- if this.client.privLevel >= 8:
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- player = this.server.players.get(playerName)
- if player != None:
- player.mouseName = argsNotSplited.split(" ", 1)[1] if len(args) > 1 else ""
- elif command == "namecolor":
- if this.client.privLevel >= 8:
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- hexColor = (args[1][1:] if args[1].startswith("#") else args[1]) if len(args) > 1 else ""
- if playerName == "*":
- for player in this.client.room.clients.values():
- this.client.room.setNameColor(player.Username, 0 if hexColor == "" else int(hexColor, 16))
- else:
- this.client.room.setNameColor(player.Username, 0 if hexColor == "" else int(hexColor, 16))
- elif command in ["addimage"]:
- if this.client.privLevel >= 8:
- this.requireArgs(4)
- imageName = args[0]
- target = args[1]
- xPosition = int(args[2]) if args[2].isdigit() else 0
- yPosition = int(args[3]) if args[3].isdigit() else 0
- if target.lower() == "$all" or target.lower() == "%all":
- for player in this.client.room.clients.values():
- this.client.room.addImage(imageName, target[0] + player.Username, xPosition, yPosition, "")
- else:
- this.client.room.addImage(imageName, target, xPosition, yPosition, "")
- elif command in ["moveplayer"]:
- if this.client.privLevel >= 8:
- this.requireArgs(2)
- playerName = this.client.TFMUtils.parsePlayerName(args[0])
- roomName = argsNotSplited.split(" ", 1)[1]
- player = this.server.players.get(playerName)
- if player != None:
- player.enterRoom(roomName)
- class UserWarning(Exception):
- pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement