Advertisement
Guest User

Comandos lolmice

a guest
Feb 11th, 2016
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 71.68 KB | None | 0 0
  1. #coding: utf-8
  2. import re, time, sys, os, subprocess
  3.  
  4. from ByteArray import ByteArray
  5. from Identifiers import Identifiers
  6.  
  7. class ParseCommands:
  8. def __init__(this, client, server):
  9. this.client = client
  10. this.server = client.server
  11. this.Cursor = client.Cursor
  12. this.currentArgsCount = 0
  13.  
  14. def requireLevel(this, level, isVip=False):
  15. if this.client.privLevel < level:
  16. if not (isVip and this.client.privLevel == 2):
  17. raise UserWarning
  18. else:
  19. return True
  20.  
  21. def requireNoSouris(this, playerName):
  22. if playerName.startswith("*"):
  23. raise UserWarning
  24. else:
  25. return True
  26.  
  27. def requireArgs(this, argsCount):
  28. if this.currentArgsCount < argsCount:
  29. raise UserWarning
  30. else:
  31. return True
  32.  
  33. def parseCommand(this, command):
  34. values = command.split(" ")
  35. command = values[0].lower()
  36. args = values[1:]
  37. argsCount = len(args)
  38. argsNotSplited = " ".join(args)
  39. this.currentArgsCount = argsCount
  40.  
  41. if argsCount == 0:
  42. if command in ["profil", "perfil", "profile"]:
  43. this.client.sendProfile(this.client.Username)
  44.  
  45. elif command in ["editeur"]:
  46. if this.client.privLevel >= 1:
  47. this.client.enterRoom(chr(3) + "[Editeur] " + this.client.Username)
  48.  
  49. this.client.sendPacket(Identifiers.old.send.Editeur, [])
  50. this.client.sendPacket(Identifiers.send.Room_Type, chr(1), True)
  51.  
  52. elif command in ["totem"]:
  53. if this.client.privLevel >= 1:
  54. if this.client.privLevel != 0 and this.client.shamanSaves >= 500:
  55. this.client.enterRoom(chr(3) + "[Totem] " + this.client.Username)
  56.  
  57. elif command in ["sauvertotem"]:
  58. if this.client.room.isTotemEditeur:
  59. this.server.setTotemData(this.client.Username, int(str(this.client.Totem[0])), str(this.client.Totem[1]))
  60. this.client.STotem[0] = this.client.Totem[0]
  61. this.client.STotem[1] = this.client.Totem[1]
  62.  
  63. this.client.sendPlayerDied()
  64. this.client.enterRoom(this.server.recommendRoom(this.client.Langue))
  65.  
  66. elif command in ["resettotem"]:
  67. if this.client.room.isTotemEditeur:
  68. this.client.Totem[0] = 0
  69. this.client.Totem[1] = ""
  70. this.client.RTotem = True
  71.  
  72. this.client.isDead = True
  73. this.client.sendPlayerDied()
  74. this.client.room.checkShouldChangeMap()
  75.  
  76. elif command in ["mulodrome"]:
  77. can = this.client.privLevel == 10 or this.client.room.roomName.startswith(this.client.Username)
  78.  
  79. if can and not this.client.room.isMulodrome:
  80. for player in this.client.room.clients.values():
  81. player.sendPacket(Identifiers.send.Mulodrome_Start, chr(1 if player.Username == this.client.Username else 0), True)
  82.  
  83. elif command in ["skip"]:
  84. if this.client.canSkipMusic and this.client.room.isMusic and this.client.room.currentMusicID != 0:
  85. this.client.room.musicSkipVotes += 1
  86. this.client.checkMusicSkip()
  87.  
  88. elif command in ["np", "map", "nextmap", "killall"]:
  89. if this.client.privLevel >= 6:
  90. this.client.room.killAll()
  91.  
  92. elif command in ["pw"]:
  93. if this.client.room.roomName.startswith("*" + this.client.Username) or this.client.room.roomName.startswith(this.client.Username):
  94. this.client.room.roomPassword = ""
  95. this.client.sendClientMessage("Password Disabled.")
  96.  
  97. elif command in ["hide"]:
  98. if this.client.privLevel >= 5:
  99. this.client.sendPlayerDisconnect()
  100. this.client.sendClientMessage("Você está invisível.")
  101. this.client.isHidden = True
  102.  
  103. elif command in ["unhide"]:
  104. if this.client.privLevel >= 5:
  105. if this.client.isHidden:
  106. this.client.enterRoom(this.client.room.name)
  107. this.client.sendClientMessage("Você nao está mais invisível.")
  108. this.client.isHidden = False
  109.  
  110. elif command in ["reboot"]:
  111. if this.client.privLevel == 10:
  112. this.server.sendServerReboot()
  113.  
  114. elif command in ["shutdown"]:
  115. if this.client.privLevel == 10:
  116. this.server.sendServerShutdown()
  117.  
  118. elif command in ["updatesql"]:
  119. if this.client.privLevel == 10:
  120. for player in this.server.players.values():
  121. if not player.isGuest:
  122. player.updateDatabase()
  123.  
  124. this.server.sendModMessage(7, "Updatesql foi executado com sucesso.")
  125.  
  126. elif command in ["ping"]:
  127. ping = subprocess.Popen(["ping", "-n", "1", this.client.ipAddress], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
  128. out, erro = ping.communicate()
  129. this.client.sendClientMessage(out.split(" ")[-4][:1])
  130.  
  131. elif command in ["kill", "suicide", "mort", "die"]:
  132. if not this.client.isDead:
  133. this.client.isDead = True
  134. if not this.client.room.noAutoScore: this.client.playerScore += 1
  135. this.client.sendPlayerDied()
  136. this.client.room.checkShouldChangeMap()
  137.  
  138. elif command in ["title"]:
  139. p = ByteArray()
  140. p2 = ByteArray()
  141. titlesCount = 0
  142. starTitlesCount = 0
  143.  
  144. for title in this.client.titleList:
  145. if "." in str(title):
  146. titleInfo = str(title).split(".")
  147. titleNumber = int(titleInfo[0])
  148. stars = int(titleInfo[1])
  149.  
  150. if stars <= 1:
  151. p2.writeShort(titleNumber)
  152. titlesCount += 1
  153. else:
  154. p.writeShort(titleNumber).writeByte(stars)
  155. starTitlesCount += 1
  156.  
  157. this.client.sendPacket(Identifiers.send.Titles_List, ByteArray().writeShort(titlesCount).writeBytes(p2.toByteArray()).writeShort(starTitlesCount).writeBytes(p.toByteArray()).toByteArray(), True)
  158.  
  159. elif command in ["sy?"]:
  160. if this.client.privLevel >= 5:
  161. this.client.sendMessageLangue("", "$SyncEnCours : <V>" + this.client.room.currentSyncName)
  162.  
  163. elif re.match("p\\d+(\\.\\d+)?", command):
  164. if this.client.privLevel >= 6:
  165. mapCode = this.client.room.mapCode
  166. mapName = this.client.room.mapName
  167. if mapCode != -1:
  168. avaliablePerms = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 17, 18, 19, 22, 44]
  169. permCategory = int(command[1:])
  170. if permCategory in avaliablePerms:
  171. this.server.sendModMessage(6, "<V>"+this.client.Username+" <BL>avaliou o mapa @"+str(mapCode)+" - "+str(mapName)+" para a categoria P"+str(permCategory)+".")
  172.  
  173. this.Cursor.execute("update MapEditor set Perma = ? where Code = ?", [permCategory, mapCode])
  174.  
  175. elif re.match("lsp\\d+(\\.\\d+)?", command):
  176. if this.client.privLevel >= 6:
  177. permCategory = int(command[3:])
  178. result = ""
  179. mapList = ""
  180. mapCount = 0
  181.  
  182. this.Cursor.execute("select * from MapEditor where Perma = ?", [permCategory])
  183. r = this.Cursor.fetchall()
  184. for rs in r:
  185. mapCount += 1
  186. playerName = rs["Name"]
  187. yesVotes = rs["YesVotes"]
  188. noVotes = rs["NoVotes"]
  189. totalVotes = yesVotes + noVotes
  190. if totalVotes < 1: totalVotes = 1
  191. Rating = (1.0 * yesVotes / totalVotes) * 100
  192. rate = str(Rating).split(".")[0]
  193. if rate == "Nan": rate = "0"
  194. mapList += "<br><N>"+str(playerName)+" - @"+str(rs["Code"])+" - "+str(totalVotes)+" - "+str(rate)+"% - P"+str(rs["Perma"])
  195.  
  196. if len(mapList) != 0:
  197. result = str(mapList)
  198.  
  199. try: this.client.sendLogMessage("<font size=\"12\"><N>Há <BL>"+str(mapCount)+"<N> mapas <V>P"+str(permCategory) + str(result)+"</font>")
  200. except: pass
  201.  
  202. elif command in ["re", "respawn"]:
  203. if this.client.privLevel >= 7:
  204. this.client.room.respawnSpecific(this.client.Username)
  205.  
  206. elif command in ["mapinfo"]:
  207. if this.client.privLevel >= 6:
  208. if this.client.room.mapCode != -1:
  209. totalVotes = this.client.room.mapYesVotes + this.client.room.mapNoVotes
  210. if totalVotes < 1: totalVotes = 1
  211. Rating = (1.0 * this.client.room.mapYesVotes / totalVotes) * 100
  212. rate = str(Rating).split(".")[0]
  213. if rate == "Nan": rate = "0"
  214. 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>.")
  215.  
  216. elif command in ["neige"]:
  217. if this.client.privLevel >= 8:
  218. this.client.room.startSnow(1000000, 60, not this.client.room.isSnowing)
  219. else:
  220. if not this.client.tribeName == "" and this.client.room.isTribeHouse:
  221. tribeRankings = this.client.tribeData[3]
  222. perm = tribeRankings[this.client.tribeRank].split("|")[2]
  223. if perm.split(",")[9] == "1":
  224. this.client.room.startSnow(1000000, 60, not this.client.room.isSnowing)
  225.  
  226. elif command in ["music", "musique"]:
  227. if this.client.privLevel >= 8:
  228. this.client.room.sendAll(Identifiers.old.send.Music, [])
  229. else:
  230. if not this.client.tribeName == "" and this.client.room.isTribeHouse:
  231. tribeRankings = this.client.tribeData[3]
  232. perm = tribeRankings[this.client.tribeRank].split("|")[2]
  233. if perm.split(",")[7] == "1":
  234. this.client.room.sendAll(Identifiers.old.send.Music, [])
  235.  
  236. elif command in ["clearreports"]:
  237. if this.client.privLevel == 10:
  238. this.server.reports = {"names": []}
  239. this.client.sendClientMessage("Feito.")
  240. this.server.sendModMessage(7, "<V>"+this.client.Username+"<BL> limpou os reports do ModoPwet.")
  241.  
  242. elif command in ["clearcache"]:
  243. if this.client.privLevel == 10:
  244. this.server.ipPermaBanCache = []
  245. this.client.sendClientMessage("Feito.")
  246. this.server.sendModMessage(7, "<V>"+this.client.Username+"<BL> limpou o cache de ips do servidor.")
  247.  
  248. elif command in ["cleariptempban"]:
  249. if this.client.privLevel == 10:
  250. this.server.tempIPBanList = []
  251. this.client.sendClientMessage("Feito.")
  252. this.server.sendModMessage(7, "<V>"+this.client.Username+"<BL> limpou a lista de ips banidos do servidor.")
  253.  
  254. elif command in ["log"]:
  255. if this.client.privLevel >= 7:
  256. logList = []
  257. this.Cursor.execute("select * from BanLog order by Date desc limit 0, 200")
  258. r = this.Cursor.fetchall()
  259. for rs in r:
  260. if rs["Status"] == "Unban":
  261. logList += rs["Name"], "", rs["BannedBy"], "", "", rs["Date"].rjust(13, "0")
  262. else:
  263. logList += rs["Name"], rs["IP"], rs["BannedBy"], rs["Time"], rs["Reason"], rs["Date"].rjust(13, "0")
  264.  
  265. this.client.sendPacket(Identifiers.old.send.Log, logList)
  266.  
  267. elif command in ["mod"]:
  268. mods = {}
  269. modsList = "$ModoPasEnLigne"
  270.  
  271. for player in this.server.players.values():
  272. if player.privLevel >= 4:
  273. if mods.has_key(player.Langue.lower()):
  274. names = mods[player.Langue.lower()]
  275. names.append(player.Username)
  276. mods[player.Langue.lower()] = names
  277. else:
  278. names = []
  279. names.append(player.Username)
  280. mods[player.Langue.lower()] = names
  281.  
  282. if len(mods) >= 1:
  283. modsList = "$ModoEnLigne"
  284. for list, count in mods.items():
  285. modsList += "<br><BL>["+str(list)+"] <BV>"+str("<BL>, <BV>").join(count)
  286.  
  287. this.client.sendMessageLangue("", modsList)
  288.  
  289. elif command in ["ls"]:
  290. if this.client.privLevel >= 4:
  291. data = []
  292.  
  293. for room in this.server.rooms.values():
  294. if room.name.startswith("*") and not room.name.startswith("*" + chr(3)):
  295. data.append(["ALL", room.name, room.getPlayerCount()])
  296. elif room.name.startswith(str(chr(3))) or room.name.startswith("*" + chr(3)):
  297. if room.name.startswith(("*" + chr(3))):
  298. data.append(["TRIBEHOUSE", room.name, room.getPlayerCount()])
  299. else:
  300. data.append(["PRIVATE", room.name, room.getPlayerCount()])
  301. else:
  302. data.append([room.community.upper(), room.roomName, room.getPlayerCount()])
  303.  
  304. result = "\n"
  305. for roomInfo in data:
  306. result += "[<J>"+str(roomInfo[0])+"<BL>] <b>"+str(roomInfo[1])+"</b> : "+str(roomInfo[2])+"\n"
  307.  
  308. 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>"
  309. this.client.sendClientMessage(result)
  310.  
  311. elif command in ["clearchat"]:
  312. if this.client.privLevel >= 5:
  313. this.client.room.sendAllBin(Identifiers.send.Message, ByteArray().writeUTF("<br>"*100).toByteArray())
  314.  
  315. elif command in ["staff", "equipe"]:
  316. lists = ["<p align='center'>", "<p align='center'>", "<p align='center'>", "<p align='center'>", "<p align='center'>", "<p align='center'>", "<p align='center'>"]
  317. this.Cursor.execute("select Username, PrivLevel from Users where PrivLevel > 4")
  318. r = this.Cursor.fetchall()
  319. for rs in r:
  320. playerName = rs["Username"]
  321. privLevel = int(rs["PrivLevel"])
  322. 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"
  323. this.client.sendLogMessage("<V><p align='center'><b>Equipe Transformice</b></p>" + "".join(lists) + "</p>")
  324.  
  325. elif command in ["vips", "vipers"]:
  326. lists = "<V><p align='center'><b>Vips Transformice</b></p><p align='center'>"
  327. this.Cursor.execute("select Username from Users where PrivLevel = 2")
  328. r = this.Cursor.fetchall()
  329. for rs in r:
  330. playerName = rs["Username"]
  331. 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"
  332. this.client.sendLogMessage(lists + "</p>")
  333.  
  334. elif command in ["teleport"]:
  335. if this.client.privLevel >= 9:
  336. this.client.isTeleport = not this.client.isTeleport
  337. this.client.room.bindMouse(this.client.Username, this.client.isTeleport)
  338. this.client.sendClientMessage("Teleport Hack: " + ("<VP>Ativado" if this.client.isTeleport else "<R>Destivado") + " !")
  339.  
  340. elif command in ["fly"]:
  341. if this.client.privLevel >= 9:
  342. this.client.isFly = not this.client.isFly
  343. this.client.room.bindKeyBoard(this.client.Username, 32, False, this.client.isFly)
  344. this.client.sendClientMessage("Fly Hack: " + ("<VP>Ativado" if this.client.isFly else "<R>Destivado") + " !")
  345.  
  346. elif command in ["speed"]:
  347. if this.client.privLevel >= 9:
  348. this.client.isSpeed = not this.client.isSpeed
  349. this.client.room.bindKeyBoard(this.client.Username, 32, False, this.client.isSpeed)
  350. this.client.sendClientMessage("Speed Hack: " + ("<VP>Ativado" if this.client.isSpeed else "<R>Destivado") + " !")
  351.  
  352. elif command in ["vamp"]:
  353. if this.client.privLevel >= 4:
  354. if this.client.room.iceEnabled or this.client.privLevel >= 8:
  355. this.client.sendVampireMode(False)
  356.  
  357. elif command in ["meep"]:
  358. if this.client.privLevel >= 4:
  359. this.client.canMeep = True
  360. if this.client.room.iceEnabled or this.client.privLevel >= 8:
  361. this.client.sendPacket(Identifiers.send.Can_Meep, chr(1), True)
  362.  
  363. elif command in ["pink"]:
  364. if this.client.privLevel >= 4:
  365. this.client.room.sendAllBin(Identifiers.send.Halloween_Player_Damanged, ByteArray().writeInt(this.client.playerCode).toByteArray())
  366.  
  367. elif command in ["don"]:
  368. this.client.room.sendAllBin(Identifiers.send.Don, ByteArray().writeInt(this.client.playerCode).toByteArray())
  369.  
  370. elif command in ["vbig"]:
  371. if this.client.privLevel >= 8:
  372. this.client.sendPacket(Identifiers.send.Can_Transformation, chr(1), True)
  373.  
  374. elif command in ["vsha"]:
  375. if this.client.privLevel >= 9:
  376. this.client.isShaman = True
  377. for player in this.client.room.clients.values():
  378. player.sendShamanCode(this.client.playerCode)
  379.  
  380. elif command in ["freebadges"]:
  381. if this.client.privLevel >= 4:
  382. badges = [0, 1, 6, 7, 9, 16, 17, 18, 33, 34, 35, 42, 46, 47, 50, 51, 55, 57, 58, 59]
  383. for badge in badges:
  384. if not badge in this.client.shopBadges:
  385. this.client.shopBadges.append(badge)
  386. this.client.sendClientMessage("Você desbloqueou novas medalhas !")
  387.  
  388. elif command in ["meusmapas", "mymaps", "lsmap"]:
  389. if this.client.privLevel >= 1:
  390. result = ""
  391. mapList = ""
  392. mapCount = 0
  393.  
  394. this.Cursor.execute("select * from MapEditor where Name = ?", [this.client.Username])
  395. r = this.Cursor.fetchall()
  396. for rs in r:
  397. mapCount += 1
  398. yesVotes = rs["YesVotes"]
  399. noVotes = rs["NoVotes"]
  400. totalVotes = yesVotes + noVotes
  401. if totalVotes < 1: totalVotes = 1
  402. Rating = (1.0 * yesVotes / totalVotes) * 100
  403. rate = str(Rating).split(".")[0]
  404. if rate == "Nan": rate = "0"
  405. mapList += "<br><N>"+this.client.Username+" - @"+str(rs["Code"])+" - "+str(totalVotes)+" - "+str(rate)+"% - P"+str(rs["Perma"])
  406.  
  407. if len(mapList) != 0:
  408. result = str(mapList)
  409.  
  410. try: this.client.sendLogMessage("<font size= \"12\"><V>"+this.client.Username+"<N>'s maps: <BV>"+str(mapCount)+ str(result)+"</font>")
  411. except: pass
  412.  
  413. elif command in ["ajuda", "help"]:
  414. if this.client.privLevel >= 1:
  415. message = "<p align = \"center\"><font size = \"15\"><J>Lista de comandos do Transformice</font></p><p align=\"left\"><font size = \"12\"><br><br>"
  416. message += " <CH>/perfil <N>- <VP>Mostra o seu perfil.<br>"
  417. message += " <CH>/perfil [Nome] <N>- <VP>Mostra o perfil de um usuário conectado.<br>"
  418. message += " <CH>/mulodrome <N>- <VP>Inicia um novo mulodrome.<br>"
  419. message += " <CH>/skip <N>- <VP>Da um voto para passar de música na sala music.<br>"
  420. message += " <CH>/pw [Senha] <N>- <VP>Ativa a senha de uma sala.<br>"
  421. message += " <CH>/pw <N>- <VP>Desativa a senha de uma sala.<br>"
  422. message += " <CH>/ping <N>- <VP>Mostra o seu ping.<br>"
  423. message += " <CH>/mort <N>- <VP>Mata o seu rato.<br>"
  424. message += " <CH>/title <N>- <VP>Mostra a sua lista de títulos.<br>"
  425. message += " <CH>/title [Número] <N>- <VP>Troca seu título.<br>"
  426. message += " <CH>/mod <N>- <VP>Mostra a lista de moderadores online.<br>"
  427. message += " <CH>/staff <N>- <VP>Mostra a equipe do servidor.<br>"
  428. message += " <CH>/vips <N>- <VP>Mostra a lista de vips do servidor.<br>"
  429. message += " <CH>/don <N>- <VP>Animação de dar um presente.<br>"
  430. message += " <CH>/lsmap <N>- <VP>Mostra uma lista de seus mapas.<br>"
  431. message += " <CH>/ajuda <N>- <VP>Lista de comandos do servidor.<br>"
  432. message += " <CH>/ban [Nome] <N>- <VP>Da um voto para banir um jogador.<br>"
  433. message += " <CH>/code <N>- <VP>Ative seu código VIP.<br>"
  434. message += " <CH>/cor [Cor] <N>- <VP>Altera a cor de seu rato.<br>"
  435.  
  436. if this.client.privLevel == 2 or this.client.privLevel >= 4:
  437. message += " <CH>/vamp <N>- <VP>Transforma seu rato em um vampiro.<br>"
  438. message += " <CH>/meep <N>- <VP>Ativa o meep.<br>"
  439. message += " <CH>/pink <N>- <VP>Deixa o seu rato rosa.<br>"
  440. message += " <CH>/freebadges <N>- <VP>Desbloqueia novas medalhas.<br>"
  441. message += " <CH>/namecor [Cor] <N>- <VP>Altera a cor de seu nome.<br>"
  442.  
  443. if this.client.privLevel == 2 or this.client.privLevel >= 7:
  444. message += " <CH>/re <N>- <VP>Revive o seu rato.<br>"
  445. message += " <CH>/vip [Mensagem] <N>- <VP>Envia uma mensagem para a sala como VIP.<br>"
  446.  
  447. if this.client.privLevel >= 4:
  448. message += " <CH>/d [Mensagem] <N>- <VP>Manda uma mensagem no chat de divulgadores.<br>"
  449.  
  450. if this.client.privLevel >= 5:
  451. message += " <CH>/sy? <N>- <VP>Mostra o usuário sync atual.<br>"
  452. message += " <CH>/ls <N>- <VP>Mostra a lista de salas do servidor.<br>"
  453. message += " <CH>/clearchat <N>- <VP>Limpa o chat.<br>"
  454. message += " <CH>/ban [Nome] [Horas] [Razão] <N>- <VP>Bane um jogador do servidor.<br>"
  455. message += " <CH>/iban [Nome] [Horas] [Razão] <N>- <VP>Bane um jogador do servidor (sem mensagem).<br>"
  456. message += " <CH>/mute [Nome] [Horas] [Razão] <N>- <VP>Muta um jogador.<br>"
  457. message += " <CH>/find [Nome] <N>- <VP>Mostra a sala atual de um usuário.<br>"
  458. message += " <CH>/hel [Mensagem] <N>- <VP>Envia uma mensagem no global de Helper.<br>"
  459. message += " <CH>/hide <N>- <VP>Torna o seu rato invisivel.<br>"
  460. message += " <CH>/unhide <N>- <VP>Tira a invisivilidade de seu rato.<br>"
  461. message += " <CH>/glbrm [Mensagem] <N>- <VP>Envia uma mensagem para a sala no global.<br>"
  462.  
  463. if this.client.privLevel >= 6:
  464. message += " <CH>/np <N>- <VP>Pula para o próximo mapa.<br>"
  465. message += " <CH>/np [Código] <N>- <VP>Pula para um mapa específico.<br>"
  466. message += " <CH>/npp [Código] <N>- <VP>Escolhe o próximo mapa.<br>"
  467. message += " <CH>/p[Categoria] <N>- <VP>Avalia um mapa para certa categoria.<br>"
  468. message += " <CH>/lsp[Categoria] <N>- <VP>Mostra a lista de mapas de certa categoria.<br>"
  469. message += " <CH>/mapinfo <N>- <VP>Mostra as informações do mapa atual.<br>"
  470. message += " <CH>/kick [Nome] <N>- <VP>Expulsa um usuário do servidor.<br>"
  471. message += " <CH>/mapc [Mensagem] <N>- <VP>Envia uma mensagem no global de MapCrew.<br>"
  472. message += " <CH>/lsmaps [Nome] <N>- <VP>Mostra a lista de mapas de um usuário.<br>"
  473.  
  474. if this.client.privLevel >= 7:
  475. message += " <CH>/log <N>- <VP>Mostra o log de bans do servidor.<br>"
  476. message += " <CH>/log [Nome] <N>- <VP>Mostra o log de bans de um jogador especifico.<br>"
  477. message += " <CH>/unban [Nome] <N>- <VP>Desane um jogador do servidor.<br>"
  478. message += " <CH>/unmute [Nome] <N>- <VP>Desmuta um jogador.<br>"
  479. message += " <CH>/sy [Nome] <N>- <VP>Altera o sync atual.<br>"
  480. message += " <CH>/clearban [Nome] <N>- <VP>Limpa os votos de ban de um usuário.<br>"
  481. message += " <CH>/ip [Nome] <N>- <VP>Mostra o IP de um usuário.<br>"
  482. message += " <CH>/ch [Nome] <N>- <VP>Escolhe o próximo shaman.<br>"
  483. message += " <CH>/mod [Mensagem] <N>- <VP>Envia uma mensagem no global de Moderador.<br>"
  484. message += " <CH>/lock [Nome] <N>- <VP>Bloqueia um usuário.<br>"
  485. message += " <CH>/unlock [Nome] <N>- <VP>Desbloqueia um usuário.<br>"
  486. message += " <CH>/nomip [Nome] <N>- <VP>Mostra o histórico de IPs de um usuário.<br>"
  487. message += " <CH>/ipnom [IP] <N>- <VP>Mostra o histórico de um IP.<br>"
  488. message += " <CH>/warn [Nome] [Motivo] <N>- <VP>Envia um alerta a um determinado usuário.<br>"
  489.  
  490. if this.client.privLevel >= 8:
  491. message += " <CH>/neige <N>- <VP>Inicia / Para a neve na sala.<br>"
  492. message += " <CH>/music [Link] <N>- <VP>Inicia uma musica na sala.<br>"
  493. message += " <CH>/music <N>- <VP>Para a musica na sala.<br>"
  494. message += " <CH>/settime [Segundos] <N>- <VP>Altera o tempo do mapa atual.<br>"
  495. message += " <CH>/smod [Mensagem] <N>- <VP>Envia uma mensagem no global de Super Moderador.<br>"
  496. message += " <CH>/move [Nome da Sala] <N>- <VP>Move os usuários da sala atual para uma outra sala.<br>"
  497. message += " <CH>/give [Nome] [Tipo] [Quantidade] <N>- <VP>Da algo a um usuário.<br>"
  498. message += " <CH>/size [Nome] [Tamanho] <N>- <VP>Altera o tamanho de um rato.<br>"
  499. message += " <CH>/name [Nome] [Novo nome] <N>- <VP>Altera o nome de um rato.<br>"
  500. message += " <CH>/namecolor [Nome] [Cor] <N>- <VP>Altera a cor do nome de um rato.<br>"
  501. message += " <CH>/addimage [Imagem] [Alvo] [X] [Y] <N>- <VP>Adiciona uma imagem a algum lugar.<br>"
  502.  
  503. if this.client.privLevel >= 9:
  504. message += " <CH>/teleport <N>- <VP>Ativa o modo teleport hack.<br>"
  505. message += " <CH>/fly <N>- <VP>Ativa o modo fly hack.<br>"
  506. message += " <CH>/speed <N>- <VP>Ativa o modo speed hack.<br>"
  507. message += " <CH>/vsha <N>- <VP>Transforma o seu rato no shaman.<br>"
  508. message += " <CH>/coord [Mensagem] <N>- <VP>Envia uma mensagem no global de Coordenador.<br>"
  509.  
  510. if this.client.privLevel >= 10:
  511. message += " <CH>/reboot <N>- <VP>Reinicia o servidor.<br>"
  512. message += " <CH>/shutdown <N>- <VP>Desliga o servidor.<br>"
  513. message += " <CH>/clearcache <N>- <VP>Limpa o cache de ips do servidor.<br>"
  514. message += " <CH>/cleariptemban <N>- <VP>Limpa os ips banidos temporariamentes do servidor.<br>"
  515. message += " <CH>/clearreports <N>- <VP>Limpa os reports do ModoPwet.<br>"
  516. message += " <CH>/changepassword [Nome] [Senha] <N>- <VP>Muda a senha de um usuário.<br>"
  517. message += " <CH>/playersql [Nome] [Parâmetro] [Valor] <N>- <VP>Altera a SQL de um usuário.<br>"
  518. message += " <CH>/smn [Mensagem] <N>- <VP>Envia uma mensagem com seu nome ao servidor.<br>"
  519. message += " <CH>/mshtml [Mensagem] <N>- <VP>Envia uma mensagem em HTML.<br>"
  520. message += " <CH>/admin [Mensagem] <N>- <VP>Envia uma mensagem no global de Administrador.<br>"
  521. message += " <CH>/rank [Nome] [Rank] <N>- <VP>Muda o rank de um usuário.<br>"
  522. message += " <CH>/setvip [Nome] [Dias] <N>- <VP>Da VIP a um usuário.<br>"
  523. message += " <CH>/removevip [Nome] <N>- <VP>Tira o VIP de um usuário.<br>"
  524. message += " <CH>/addtext [Tipo] [Link] <N>- <VP>Adiciona um link a lista de servidores.<br>"
  525. message += " <CH>/removetext [Tipo] [Link] <N>- <VP>Remove um link a lista de servidores.<br>"
  526. message += " <CH>/giveforall [Tipo] [Quantidade] <N>- <VP>Da algo a todos usuários online.<br>"
  527. message += " <CH>/unrank [Nome] <N>- <VP>Zera o perfil de um usuário.<br>"
  528. message += " <CH>/luaadmin <N>- <VP>Habilita / Desabilida executar scripts no servidor pelo lua.<br>"
  529. message += " <CH>/updatesql <N>- <VP>Atualiza os dados na Database dos usuários onlines."
  530.  
  531. message += "</font></p>"
  532. this.client.sendLogMessage(message.replace("&#", "&amp;#").replace("&lt;", "<"))
  533.  
  534. elif command in ["luaadmin"]:
  535. if this.client.privLevel == 10:
  536. this.client.runLuaAsBot = not this.client.runLuaAsBot
  537. 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.")
  538.  
  539. elif command in ["racing", "survivor", "bootcamp", "vanilla", "tutorial"]:
  540. 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 "")
  541.  
  542. elif command in ["lsc"]:
  543. if this.client.privLevel >= 7:
  544. result = {}
  545. for room in this.server.rooms.values():
  546. if result.has_key(room.community):
  547. result[room.community] = result[room.community] + room.getPlayerCount()
  548. else:
  549. result[room.community] = room.getPlayerCount()
  550.  
  551. message = "\n"
  552. for community, count in result.items():
  553. message += "<V>"+str(community.upper())+"<BL> : <J>"+str(count)+"\n"
  554. message += "<V>ALL<BL> : <J>"+str(sum(result.values()))
  555. this.client.sendClientMessage(message)
  556.  
  557. elif command in ["ranking"]:
  558. this.client.ranking.open()
  559. else:
  560. if command == "profil" or command == "perfil" or command == "profile":
  561. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  562. this.client.sendProfile(playerName)
  563.  
  564. elif command == "ban" or command == "iban":
  565. if this.client.privLevel >= 5:
  566. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  567. time = args[1] if (argsCount >= 2) else "1"
  568. reason = argsNotSplited.split(" ", 2)[2] if (argsCount >= 3) else ""
  569. silent = command == "iban"
  570. hours = int(time) if (time.isdigit()) else 1
  571. hours = 100000 if (hours > 100000) else hours
  572. hours = 24 if (this.client.privLevel <= 6 and hours > 24) else hours
  573. if this.server.banPlayer(playerName, hours, reason, this.client.Username, silent):
  574. this.server.sendModMessage(5, "<V>"+this.client.Username+"<BL> baniu <V>"+playerName+"<BL> por <V>"+str(hours)+"<BL> horas. Motivo: <V>"+str(reason)+"<BL>." )
  575. else:
  576. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  577. this.server.voteBanPopulaire(playerName, this.client.ipAddress)
  578.  
  579. elif command == "unban":
  580. if this.client.privLevel >= 7:
  581. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  582. this.requireNoSouris(playerName)
  583. found = False
  584.  
  585. if this.server.checkExistingUser(playerName):
  586. if this.server.checkTempBan(playerName):
  587. this.server.removeTempBan(playerName)
  588. found = True
  589.  
  590. if this.server.checkPermaBan(playerName):
  591. this.server.removePermaBan(playerName)
  592. found = True
  593.  
  594. if found:
  595. this.Cursor.execute("update Users set BanHours = ? where Username = ?", [0, playerName])
  596. 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", "", ""])
  597.  
  598. this.server.sendModMessage(5, "<V>"+this.client.Username+"<N> desbaniu <V>"+playerName+"<BL>.")
  599.  
  600. elif command == "mute":
  601. if this.client.privLevel >= 5:
  602. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  603. time = args[1] if (argsCount >= 2) else "1"
  604. reason = argsNotSplited.split(" ", 2)[2] if (argsCount >= 3) else ""
  605. hours = int(time) if (time.isdigit()) else 1
  606. this.requireNoSouris(playerName)
  607. hours = 500 if (hours > 500) else hours
  608. hours = 24 if (this.client.privLevel <= 6 and hours > 24) else hours
  609. this.server.mutePlayer(playerName, hours, reason, this.client.Username)
  610.  
  611. elif command == "unmute":
  612. if this.client.privLevel >= 7:
  613. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  614. this.requireNoSouris(playerName)
  615. this.server.desmutePlayer(playerName, this.client.Username)
  616.  
  617. elif command == "d":
  618. if this.client.privLevel >= 4:
  619. message = argsNotSplited
  620. this.client.sendAllModerationChat(9, message)
  621.  
  622. elif command == "settime":
  623. if this.client.privLevel >= 8:
  624. time = args[0]
  625. if time.isdigit():
  626. iTime = int(time)
  627. iTime = 5 if iTime < 5 else (32767 if iTime > 32767 else iTime)
  628.  
  629. for player in this.client.room.clients.values():
  630. player.sendRoundTime(iTime)
  631.  
  632. this.client.room.changeMapTimers(iTime)
  633.  
  634. elif command == "np" or command == "npp":
  635. if not this.client.room.isVotingMode:
  636. canUse = False
  637. code = args[0]
  638.  
  639. if this.client.privLevel >= 6:
  640. canUse = True
  641. elif not this.client.tribeName == "" and this.client.room.isTribeHouse:
  642. tribeRankings = this.client.tribeData[3]
  643. perm = tribeRankings[this.client.tribeRank].split("|")[2]
  644. if perm.split(",")[8] == "1":
  645. canUse = True
  646.  
  647. if canUse:
  648. if code.startswith("@"):
  649. mapInfo = this.client.room.getMapInfo(int(code[1:]))
  650. if mapInfo[0] == None:
  651. this.client.sendMessageLangue("", "$CarteIntrouvable")
  652. else:
  653. this.client.room.forceNextMap = code
  654. if command == "np":
  655. if this.client.room.changeMapTimer != None: this.client.room.changeMapTimer.cancel()
  656. this.client.room.mapChange()
  657. else:
  658. this.client.sendMessageLangue("", "$ProchaineCarte <V>" + code)
  659.  
  660. elif code.isdigit():
  661. this.client.room.forceNextMap = code
  662. if command == "np":
  663. if this.client.room.changeMapTimer != None: this.client.room.changeMapTimer.cancel()
  664. this.client.room.mapChange()
  665. else:
  666. this.client.sendMessageLangue("", "$ProchaineCarte <V>" + code)
  667.  
  668. elif command == "mjj":
  669. roomName = args[0]
  670. if roomName.startswith("#"):
  671. this.client.enterRoom(roomName)
  672. else:
  673. 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)
  674.  
  675. elif command == "pw":
  676. password = args[0]
  677. if this.client.room.roomName.startswith("*" + this.client.Username) or this.client.room.roomName.startswith(this.client.Username):
  678. this.client.room.roomPassword = password
  679. this.client.sendClientMessage("Password : " + password)
  680.  
  681. elif command == "changepassword":
  682. if this.client.privLevel == 10:
  683. this.requireArgs(2)
  684. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  685. password = args[1]
  686. this.requireNoSouris(playerName)
  687.  
  688. if not this.server.checkExistingUser(playerName):
  689. this.client.sendClientMessage("Não foi possível encontrar o usuário: <V>"+playerName+"<BL>.")
  690. else:
  691. this.Cursor.execute("update Users set Password = ? where Username = ?", [this.client.TFMUtils.getPass(password), playerName])
  692. this.client.sendClientMessage("Senha alterada com sucesso.")
  693. this.server.sendModMessage(7, "<V>"+this.client.Username+"<BL> alterou a senha do usuário: <V>"+playerName+"<BL>.")
  694.  
  695. elif command == "playersql":
  696. if this.client.privLevel == 10:
  697. this.requireArgs(3)
  698. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  699. paramter = args[1]
  700. values = args[2]
  701. this.requireNoSouris(playerName)
  702.  
  703. player = this.server.players.get(playerName)
  704. if player != None:
  705. player.room.removeClient(player)
  706. player.transport.loseConnection()
  707.  
  708. if not this.server.checkExistingUser(playerName):
  709. this.client.sendClientMessage("Não foi possível encontrar o usuário: <V>"+playerName+"<BL>.")
  710. else:
  711. try:
  712. this.Cursor.execute("update Users set " + paramter + " = ? where Username = ?", [value, playerName])
  713. this.server.sendModMessage(7, "SQL do usuário <V>"+playerName+"<BL> foi alterada. <T>"+str(paramter)+"<BL> -> <T>"+str(value)+"<BL>.")
  714. except:
  715. this.client.sendClientMessage("Parâmetros incorretos ou inexistentes.")
  716.  
  717. elif command == "music" or command == "musique":
  718. if this.client.privLevel >= 8:
  719. this.client.room.sendAll(Identifiers.old.send.Music, [args[0]])
  720. else:
  721. if not this.client.tribeName == "" and this.client.room.isTribeHouse:
  722. tribeRankings = this.client.tribeData[3]
  723. perm = tribeRankings[this.client.tribeRank].split("|")[2]
  724. if perm.split(",")[7] == "1":
  725. this.client.room.sendAll(Identifiers.old.send.Music, [args[0]])
  726.  
  727. elif command == "title" or command == "titulo":
  728. titleID = args[0]
  729. found = False
  730. for title in this.client.titleList:
  731. if str(title).split(".")[0] == titleID:
  732. found = True
  733.  
  734. if found:
  735. this.client.TitleNumber = int(titleID)
  736. for title in this.client.titleList:
  737. if str(title).split(".")[0] == titleID:
  738. this.client.TitleStars = int(str(title).split(".")[1])
  739.  
  740. this.client.sendPacket(Identifiers.old.send.Change_Title, [titleID])
  741.  
  742. elif command == "sy":
  743. if this.client.privLevel >= 7:
  744. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  745. player = this.server.players.get(playerName)
  746. if player != None:
  747. player.isSync = True
  748. this.client.room.currentSyncCode = player.playerCode
  749. this.client.room.currentSyncName = player.Username
  750. if this.client.room.mapCode != -1 or this.client.room.EMapCode != 0:
  751. this.client.room.sendAll(Identifiers.old.send.Sync, [player.playerCode, ""])
  752. else:
  753. this.client.room.sendAll(Identifiers.old.send.Sync, [player.playerCode])
  754.  
  755. this.client.sendMessageLangue("", "$NouveauSync <V>" + playerName)
  756.  
  757. elif command == "clearban":
  758. if this.client.privLevel >= 7:
  759. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  760.  
  761. player = this.server.players.get(playerName)
  762. if player != None:
  763. player.voteBan = []
  764. this.server.sendModMessage(7, "<V>"+this.client.Username+"<BL> limpou os votos de banido do usuário <V>"+playerName+"<BL>.")
  765.  
  766. elif command == "ip":
  767. if this.client.privLevel >= 7:
  768. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  769.  
  770. player = this.server.players.get(playerName)
  771. if player != None:
  772. this.client.sendClientMessage("IP do usuário <V>"+playerName+"<BL> : <V>"+player.ipAddress+"<BL>.")
  773.  
  774. elif command == "kick":
  775. if this.client.privLevel >= 6:
  776. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  777.  
  778. player = this.server.players.get(playerName)
  779. if player != None:
  780. player.room.removeClient(player)
  781. player.transport.loseConnection()
  782. this.server.sendModMessage(6, "<V>"+this.client.Username+"<BL> expulsou <V>"+playerName+"<BL> do servidor.")
  783. else:
  784. this.client.sendClientMessage("O usuário <V>"+playerName+"<BL> não está online.")
  785.  
  786. elif command == "ch":
  787. if this.client.privLevel >= 7:
  788. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  789.  
  790. player = this.server.players.get(playerName)
  791. if player != None and player.roomName == this.client.roomName:
  792.  
  793. if this.client.room.forceNextShaman == player.playerCode:
  794. this.client.sendMessageLangue("", "$PasProchaineChamane", player.Username)
  795. this.client.room.forceNextShaman = -1
  796. else:
  797. this.client.sendMessageLangue("", "$ProchaineChamane", player.Username)
  798. this.client.room.forceNextShaman = player.playerCode
  799. this.client.sendClientMessage("O usuário <V>"+playerName+"<BL> será proxímo Shaman.")
  800. else:
  801. this.client.sendClientMessage("O usuário <V>"+playerName+"<BL> não está online ou não está na mesma sala que você.")
  802.  
  803. elif command == "search" or command == "find":
  804. if this.client.privLevel >= 5:
  805. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  806. result = ""
  807. for player in this.server.players.values():
  808. if playerName in player.Username:
  809. result += "<br><V>"+player.Username+"<BL> -> <V>"+player.room.name
  810.  
  811. this.client.sendClientMessage(result)
  812.  
  813. elif command == "smn":
  814. if this.client.privLevel == 10:
  815. message = argsNotSplited
  816. this.client.sendAllModerationChat(-1, message)
  817.  
  818. elif command == "mshtml":
  819. if this.client.privLevel == 10:
  820. message = argsNotSplited.replace("&#", "&amp;#").replace("&lt;", "<")
  821. this.client.sendAllModerationChat(0, message)
  822.  
  823. elif command == "admin":
  824. if this.client.privLevel == 10:
  825. message = argsNotSplited
  826. this.client.sendStaffMessage("<V>• <font color='#00FF7F'>[Administrador <b>"+this.client.Username+"</b>]</font> <N>"+message)
  827.  
  828. elif command == "coord":
  829. if this.client.privLevel >= 9:
  830. message = argsNotSplited
  831. this.client.sendStaffMessage("<V>• <font color='#FFFF00'>[Coordenador <b>"+this.client.Username+"</b>]</font> <N>"+message)
  832.  
  833. elif command == "smod" or command == "sms":
  834. if this.client.privLevel >= 8:
  835. message = argsNotSplited
  836. this.client.sendStaffMessage("<V>• <font color='#15FA00'>[Super Moderador <b>"+this.client.Username+"</b>]</font> <N>"+message)
  837.  
  838. elif command == "mod":
  839. if this.client.privLevel >= 7:
  840. message = argsNotSplited
  841. this.client.sendStaffMessage("<V>• <font color='#F39F04'>[Moderador <b>"+this.client.Username+"</b>]</font> <N>"+message)
  842.  
  843. elif command == "mapc":
  844. if this.client.privLevel >= 6:
  845. message = argsNotSplited
  846. this.client.sendStaffMessage("<V>• <font color='#00FFFF'>[MapCrew <b>"+this.client.Username+"</b>]</font> <N>"+message)
  847.  
  848. elif command == "hel":
  849. if this.client.privLevel >= 5:
  850. message = argsNotSplited
  851. this.client.sendStaffMessage("<V>• <font color='#FFF68F'>[Helper <b>"+this.client.Username+"</b>]</font> <N>"+message)
  852.  
  853. elif command == "vip":
  854. if this.client.privLevel >= 7:
  855. message = argsNotSplited
  856. this.client.room.sendAllBin(Identifiers.send.Message, ByteArray().writeUTF("<V>• <font color='#FFFFFF'>[Vip <b>"+this.client.Username+"</b>]</font> <N>"+message).toByteArray())
  857.  
  858. elif command == "glbrm":
  859. if this.client.privLevel >= 5:
  860. message = argsNotSplited
  861. this.client.room.sendAllBin(Identifiers.send.Message, ByteArray().writeUTF("<V>• <font color='#FFFFFF'>[<b>"+this.client.Username+"</b>] "+message+"</font>").toByteArray())
  862.  
  863. elif command == "rank":
  864. if this.client.privLevel == 10:
  865. this.requireArgs(2)
  866. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  867. rank = args[1].lower()
  868. this.requireNoSouris(playerName)
  869.  
  870. if not this.server.checkExistingUser(playerName):
  871. this.client.sendClientMessage("Não foi possível encontrar o usuário: <V>"+playerName+"<BL>.")
  872. else:
  873. 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
  874. 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"
  875.  
  876. player = this.server.players.get(playerName)
  877. if player != None:
  878. player.privLevel = privLevel
  879. player.TitleNumber = 0
  880. player.sendLogin()
  881. else:
  882. this.Cursor.execute("update Users set PrivLevel = ?, TitleNumber = 0 where Username = ?", [privLevel, playerName])
  883.  
  884. this.server.sendModMessage(7, "<V>"+playerName+"<BL> ganhou o rank de <V>"+rankName+"<BL>.")
  885.  
  886. elif command == "setvip":
  887. if this.client.privLevel == 10:
  888. this.requireArgs(2)
  889. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  890. days = args[1]
  891. this.requireNoSouris(playerName)
  892.  
  893. if not this.server.checkExistingUser(playerName):
  894. this.client.sendClientMessage("Não foi possível encontrar o usuário: <V>"+playerName+"<BL>.")
  895. else:
  896. this.server.setVip(playerName, int(days) if days.isdigit() else 1)
  897.  
  898. elif command == "removevip":
  899. if this.client.privLevel == 10:
  900. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  901. this.requireNoSouris(playerName)
  902.  
  903. if not this.server.checkExistingUser(playerName):
  904. this.client.sendClientMessage("Não foi possível encontrar o usuário: <V>"+playerName+"<BL>.")
  905. else:
  906. player = this.server.players.get(playerName)
  907. if player != None:
  908. player.privLevel = 1
  909. if player.TitleNumber == 1100:
  910. player.TitleNumber = 0
  911.  
  912. player.sendClientMessage("<CH>Você perdeu seu privilégio VIP do Transformice!")
  913. this.Cursor.execute("update Users set VipTime = 0 where Username = ?", [playerName])
  914. else:
  915. this.Cursor.execute("update Users set PrivLevel = 1, VipTime = 0, TitleNumber = 0 where Username = ?", [playerName])
  916.  
  917. this.server.sendModMessage(7, "O jogador <V>"+playerName+"<BL> não é mais VIP.")
  918.  
  919. elif command == "lock":
  920. if this.client.privLevel >= 7:
  921. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  922. this.requireNoSouris(playerName)
  923.  
  924. if not this.server.checkExistingUser(playerName):
  925. this.client.sendClientMessage("Não foi possível encontrar o usuário: <V>"+playerName+"<BL>.")
  926. else:
  927. playerLevel = this.server.getPlayerPrivlevel(playerName)
  928. if playerLevel < 4:
  929. player = this.server.players.get(playerName)
  930. if player != None:
  931. player.room.removeClient(player)
  932. player.transport.loseConnection()
  933.  
  934. this.Cursor.execute("update Users set PrivLevel = -1 where Username = ?", [playerName])
  935.  
  936. this.server.sendModMessage(7, "<V>"+playerName+"<BL> foi bloqueado por <V>"+this.client.Username)
  937.  
  938. elif command == "unlock":
  939. if this.client.privLevel >= 7:
  940. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  941. this.requireNoSouris(playerName)
  942.  
  943. if not this.server.checkExistingUser(playerName):
  944. this.client.sendClientMessage("Não foi possível encontrar o usuário: <V>"+playerName+"<BL>.")
  945. else:
  946. playerLevel = this.server.getPlayerPrivlevel(playerName)
  947. if playerLevel == -1:
  948. this.Cursor.execute("update Users set PrivLevel = 1 where Username = ?", [playerName])
  949.  
  950. this.server.sendModMessage(7, "<V>"+playerName+"<BL> foi desbloqueado por <V>"+this.client.Username)
  951.  
  952. elif command == "log":
  953. if this.client.privLevel >= 7:
  954. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  955. this.requireNoSouris(playerName)
  956.  
  957. logList = []
  958. this.Cursor.execute("select * from BanLog where Name = ? order by Date desc limit 0, 200", [playerName])
  959. r = this.Cursor.fetchall()
  960. for rs in r:
  961. if rs["Status"] == "Unban":
  962. logList += rs["Name"], "", rs["BannedBy"], "", "", rs["Date"].rjust(13, "0")
  963. else:
  964. logList += rs["Name"], rs["IP"], rs["BannedBy"], rs["Time"], rs["Reason"], rs["Date"].rjust(13, "0")
  965. this.client.sendPacket(Identifiers.old.send.Log, logList)
  966.  
  967. elif command == "move":
  968. if this.client.privLevel >= 8:
  969. roomName = args[0]
  970. for player in this.client.room.clients.values():
  971. player.enterRoom(roomName)
  972.  
  973. elif command == "nomip":
  974. if this.client.privLevel >= 7:
  975. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  976. ipList = "Lista de IPs do jogador: "+playerName
  977.  
  978. this.Cursor.execute("select IP from LoginLog where Username = ?", [playerName])
  979. r = this.Cursor.fetchall()
  980. for rs in r:
  981. ipList += "<br>" + rs["IP"]
  982.  
  983. this.client.sendClientMessage(ipList)
  984.  
  985. elif command == "ipnom":
  986. if this.client.privLevel >= 7:
  987. ip = args[0]
  988. nameList = "Lista de jogdores usando o IP: "+ip
  989. historyList = "Histórico do IP:"
  990. for player in this.server.players.values():
  991. if player.ipAddress == ip:
  992. nameList += "<br>" + player.Username
  993.  
  994. this.Cursor.execute("select Username from LoginLog where IP = ?", [ip])
  995. r = this.Cursor.fetchall()
  996. for rs in r:
  997. historyList += "<br>" + rs["Username"]
  998.  
  999. this.client.sendClientMessage(nameList)
  1000. this.client.sendClientMessage(historyList)
  1001.  
  1002. elif command == "lsmaps":
  1003. if this.client.privLevel >= 6:
  1004. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  1005. result = ""
  1006. mapList = ""
  1007. mapCount = 0
  1008.  
  1009. this.Cursor.execute("select * from MapEditor where Name = ?", [playerName])
  1010. r = this.Cursor.fetchall()
  1011. for rs in r:
  1012. mapCount += 1
  1013. yesVotes = rs["YesVotes"]
  1014. noVotes = rs["NoVotes"]
  1015. totalVotes = yesVotes + noVotes
  1016. if totalVotes < 1: totalVotes = 1
  1017. Rating = (1.0 * yesVotes / totalVotes) * 100
  1018. rate = str(Rating).split(".")[0]
  1019. if rate == "Nan": rate = "0"
  1020. mapList += "<br><N>"+playerName+" - @"+str(rs["Code"])+" - "+str(totalVotes)+" - "+str(rate)+"% - P"+str(rs["Perma"])
  1021.  
  1022. if len(mapList) != 0:
  1023. result = str(mapList)
  1024.  
  1025. try: this.client.sendLogMessage("<font size= \"12\"><V>"+playerName+"<N>'s maps: <BV>"+str(mapCount)+ str(result)+"</font>")
  1026. except: pass
  1027.  
  1028. elif command == "addtext":
  1029. if this.client.privLevel == 10:
  1030. text = args[0]
  1031. blackList = this.server.blackList["list"]
  1032. if not text in blackList:
  1033. this.client.sendClientMessage("Este domínio já foi adiconado.")
  1034. else:
  1035. this.server.blackList["list"] = text
  1036. this.server.updateBlackList()
  1037. this.server.sendModMessage(7, "<V>"+this.client.Username+"<BL> adicionou <V>"+str(text)+"<BL> a blacklist do servidor")
  1038.  
  1039. elif command == "removelink":
  1040. if this.client.privLevel == 10:
  1041. type = args[0]
  1042. link = args[1].replace("https://", "").replace("http://", "").replace("www.", "").split("/")[0]
  1043. blackList = this.server.blackList["list"]
  1044. if not text in blackList:
  1045. this.client.sendClientMessage("Este domínio não está na lista.")
  1046. else:
  1047. black = this.server.blackList["list"]
  1048. i = 0
  1049. while i < len(black):
  1050. if black[i] == link:
  1051. black.remove(i)
  1052. break
  1053. i += 1
  1054.  
  1055. this.server.blackList["list"] = black
  1056. this.server.updateBlackList()
  1057. this.server.sendModMessage(7, "<V>"+this.client.Username+"<BL> removeu <V>"+str(link)+"<BL> da blacklist do servidor")
  1058.  
  1059. elif command == "nomecor" or command == "namecor":
  1060. if this.client.privLevel >= 4:
  1061. color = args[0]
  1062. 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 ""
  1063. if not hexColor == "":
  1064. this.client.sendClientMessage("A cor do seu nome foi alterada para <V>"+color+"<BL>.")
  1065. this.client.room.setNameColor(this.client.Username, int(hexColor, 16))
  1066. else:
  1067. this.client.sendClientMessage("Esta cor não está disponível !")
  1068.  
  1069. elif command == "giveforall":
  1070. if this.client.privLevel == 10:
  1071. this.requireArgs(2)
  1072. type = args[0].lower()
  1073. count = int(args[1]) if args[1].isdigit() else 0
  1074. 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 ""
  1075. if count > 0 and not typeName == "":
  1076.  
  1077. this.server.sendModMessage(7, "<V>"+this.client.Username+"<BL> doou <V>"+str(count)+" "+str(typeName)+"<BL> para todo o servidor.")
  1078. for player in this.server.players.values():
  1079. player.sendClientMessage("Você recebeu <V>"+str(count)+" "+str(typeName)+"<BL>.")
  1080. if typeName == "queijos":
  1081. player.shopCheeses += count
  1082.  
  1083. elif typeName == "fraises":
  1084. player.shopFraises += count
  1085.  
  1086. elif typeName == "bootcamps":
  1087. player.bootcampCount += count
  1088.  
  1089. elif typeName == "firsts":
  1090. player.cheeseCount += count
  1091. player.firstCount += count
  1092.  
  1093. elif typeName == "moedas":
  1094. player.iceCoins += count
  1095.  
  1096. elif typeName == "fichas":
  1097. player.iceTokens += count
  1098.  
  1099. elif command == "give":
  1100. if this.client.privLevel >= 8:
  1101. this.requireArgs(3)
  1102. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  1103. type = args[1].lower()
  1104. count = int(args[2]) if args[2].isdigit() else 0
  1105. count = 10000 if count > 10000 else count
  1106. this.requireNoSouris(playerName)
  1107. 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 ""
  1108. if count > 0 and not typeName == "":
  1109. player = this.server.players.get(playerName)
  1110. if player != None:
  1111. this.server.sendModMessage(7, "<V>"+this.client.Username+"<BL> doou <V>"+str(count)+" "+str(typeName)+"<BL> para <V>"+playerName+"<BL>.")
  1112. player.sendClientMessage("Você recebeu <V>"+str(count)+" "+str(typeName)+"<BL>.")
  1113. if typeName == "queijos":
  1114. player.shopCheeses += count
  1115.  
  1116. elif typeName == "fraises":
  1117. player.shopFraises += count
  1118.  
  1119. elif typeName == "bootcamps":
  1120. player.bootcampCount += count
  1121.  
  1122. elif typeName == "firsts":
  1123. player.cheeseCount += count
  1124. player.firstCount += count
  1125.  
  1126. elif typeName == "moedas":
  1127. player.iceCoins += count
  1128.  
  1129. elif typeName == "fichas":
  1130. player.iceTokens += count
  1131.  
  1132. elif command == "unrank":
  1133. if this.client.privLevel == 10:
  1134. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  1135. if not this.server.checkExistingUser(playerName):
  1136. this.client.sendClientMessage("Não foi possível encontrar o usuário: <V>"+playerName+"<BL>.")
  1137. else:
  1138. player = this.server.players.get(playerName)
  1139. if player != None:
  1140. player.room.removeClient(player)
  1141. player.transport.loseConnection()
  1142.  
  1143. this.Cursor.execute("update Users set FirstCount = 0, CheeseCount = 0, ShamanSaves = 0, HardModeSaves = 0, DivineModeSaves = 0, BootcampCount = 0, ShamanCheeses = 0 where Username = ?", [playerName])
  1144.  
  1145. this.server.sendModMessage(7, "<V>"+playerName+"<BL> foi retirado do ranking por <V>"+this.client.Username+"<BL>.")
  1146.  
  1147. elif command == "warn":
  1148. if this.client.privLevel >= 7:
  1149. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  1150. message = argsNotSplited.split(" ", 1)[1]
  1151.  
  1152. if not this.server.checkExistingUser(playerName):
  1153. this.client.sendClientMessage("Não foi possível encontrar o usuário: <V>"+playerName+"<BL>.")
  1154. else:
  1155. 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 ""
  1156. player = this.server.players.get(playerName)
  1157. if player != None:
  1158. player.sendClientMessage("<ROSE>[<b>ALERTA</b>] O "+str(rank)+" "+this.client.Username+" lhe enviou um alerta. Motivo: "+str(message))
  1159. this.client.sendClientMessage("<BL>Seu alerta foi enviado com sucesso para <V>"+playerName+"<BL>.")
  1160. this.server.sendModMessage(7, "<V>"+this.client.Username+"<BL> mandou um alerta para"+"<V> "+playerName+"<BL>. Motivo: <V>"+str(message))
  1161.  
  1162. elif command == "cor" or command == "fur" or command == "color":
  1163. if this.client.privLevel >= 1:
  1164. hexColor = args[0][1:] if args[0].startswith("#") else args[0]
  1165.  
  1166. try:
  1167. value = int(hexColor, 16)
  1168. this.client.MouseColor = hexColor
  1169. this.client.sendClientMessage("A cor do seu rato foi alterada.")
  1170. except:
  1171. this.client.sendClientMessage("Cor inválida.")
  1172.  
  1173. elif command == "size":
  1174. if this.client.privLevel >= 8:
  1175. this.requireArgs(2)
  1176. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  1177. if args[1].isdigit():
  1178. size = int(args[1])
  1179. if playerName == "*":
  1180. for player in this.client.room.clients.values():
  1181. this.client.room.sendAllBin(Identifiers.send.Mouse_Size, ByteArray().writeInt(this.client.playerCode).writeShort(size).writeBool(False).toByteArray())
  1182. else:
  1183. player = this.server.players.get(playerName)
  1184. if player != None:
  1185. this.client.room.sendAllBin(Identifiers.send.Mouse_Size, ByteArray().writeInt(this.client.playerCode).writeShort(size).writeBool(False).toByteArray())
  1186.  
  1187. elif command == "name":
  1188. if this.client.privLevel >= 8:
  1189. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  1190. player = this.server.players.get(playerName)
  1191. if player != None:
  1192. player.mouseName = argsNotSplited.split(" ", 1)[1] if len(args) > 1 else ""
  1193.  
  1194. elif command == "namecolor":
  1195. if this.client.privLevel >= 8:
  1196. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  1197. hexColor = (args[1][1:] if args[1].startswith("#") else args[1]) if len(args) > 1 else ""
  1198. if playerName == "*":
  1199. for player in this.client.room.clients.values():
  1200. this.client.room.setNameColor(player.Username, 0 if hexColor == "" else int(hexColor, 16))
  1201. else:
  1202. this.client.room.setNameColor(player.Username, 0 if hexColor == "" else int(hexColor, 16))
  1203.  
  1204. elif command in ["addimage"]:
  1205. if this.client.privLevel >= 8:
  1206. this.requireArgs(4)
  1207. imageName = args[0]
  1208. target = args[1]
  1209. xPosition = int(args[2]) if args[2].isdigit() else 0
  1210. yPosition = int(args[3]) if args[3].isdigit() else 0
  1211.  
  1212. if target.lower() == "$all" or target.lower() == "%all":
  1213. for player in this.client.room.clients.values():
  1214. this.client.room.addImage(imageName, target[0] + player.Username, xPosition, yPosition, "")
  1215. else:
  1216. this.client.room.addImage(imageName, target, xPosition, yPosition, "")
  1217.  
  1218. elif command in ["moveplayer"]:
  1219. if this.client.privLevel >= 8:
  1220. this.requireArgs(2)
  1221. playerName = this.client.TFMUtils.parsePlayerName(args[0])
  1222. roomName = argsNotSplited.split(" ", 1)[1]
  1223. player = this.server.players.get(playerName)
  1224. if player != None:
  1225. player.enterRoom(roomName)
  1226.  
  1227. class UserWarning(Exception):
  1228. pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement