Advertisement
suxonov

Untitled

Apr 23rd, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.60 KB | None | 0 0
  1. -- welcome_image 154389890f4.png
  2.  
  3. tfm.exec.disableAutoScore(true)
  4. tfm.exec.disableAutoShaman(true)
  5. tfm.exec.disableAfkDeath(true)
  6. tfm.exec.disableAutoNewGame(true)
  7. system.disableChatCommandDisplay ("profile", true)
  8. system.disableChatCommandDisplay ("help", true)
  9. system.disableChatCommandDisplay ("q^", true)
  10.  
  11. players = {}
  12.  
  13. --stuff
  14. translators = {'Restgato', '+Jullyy', 'Skittlesuni'}
  15. admin = {'Aviener'}
  16. mapCrew = {'Kaysha'}
  17.  
  18. maplist={'@6561339', '@6534430', '@6636186', '@6636419', '@6636186', '@6637399'}
  19.  
  20. mes = {
  21.  
  22. en =
  23. {
  24.  
  25. chat_welcome = '<J>Welcome to #darkroom, %s! Type !help for more information.';
  26. chat_win = '<V>%s<BL> has won!';
  27. chat_help = '<BL>Your main purpose is <J>finding an escape from the labyrinth. <BL>Find it first or die. Commands:\n<J>!profile nickname <BL>- open player\'s profile\n<J>!q^ <BL>- information about version and etc';
  28. chat_info = '<J>#<BL>darkroom: version 1.1\n<J>#<BL>Disscussion thread:\n<J>#<BL>Map Submissions thread:\n\n<J>#<BL>Created by <V>Aviener';
  29. profile_ratio = '<N> • Ratio: <V>';
  30. profile_rounds = '<N> • Total rounds played: <V>';
  31. profile_wins = '<N> • Wins: <V>';
  32. profile_close = 'Close';
  33.  
  34. };
  35.  
  36. e2 =
  37. {
  38.  
  39. chat_welcome = '<J>Welcome to #darkroom, %s! Type !help for more information.';
  40. chat_win = '<V>%s<BL> has won!';
  41. chat_help = '<BL>Your main purpose is <J>finding an escape from the labyrinth. <BL>Find it first or die. Commands:\n<J>!profile nickname <BL>- open player\'s profile\n<J>!q^ <BL>- information about version and etc';
  42. chat_info = '<J>#<BL>darkroom: version 1.1\n<J>#<BL>Disscussion thread:\n<J>#<BL>Map Submissions thread:\n\n<J>#<BL>Created by <V>Aviener';
  43. profile_ratio = '<N> • Ratio: <V>';
  44. profile_rounds = '<N> • Total rounds played: <V>';
  45. profile_wins = '<N> • Wins: <V>';
  46. profile_close = 'Close';
  47.  
  48. };
  49.  
  50. br =
  51. {
  52.  
  53. chat_welcome = '<J>Bem-vindo(a) ao #darkroom, %s! Digite !help para maiores informações.';
  54. chat_win = '<V>%s<BL> venceu!';
  55. chat_help = '<BL>Seu principal objetivo é <J>procurar uma saída para o labirinto, <BL>encontre a saída ou fique no escuro. Comandos:\n<J>!profile nome do jogador <BL>- para abrir o perfil de um jogador\'s profile\n<J>!q^ <BL>- informações sobre a versão do jogo e etc';
  56. chat_info = '<J>#<BL>darkroom: versão 1.1\n<J>#<BL>Tópico de discussões:\n<J>#<BL>Tópico de submissão de mapas:\n\n<J>#<BL>Minigame criado pelo <V>Aviener';
  57. profile_ratio = '<N> • Estatísticas: <V>';
  58. profile_rounds = '<N> • Partidas jogadas: <V>';
  59. profile_wins = '<N> • Partidas vencidas: <V>';
  60. profile_close = 'Fechar';
  61.  
  62. };
  63.  
  64. fr =
  65. {
  66.  
  67. chat_welcome = '<J>Bienvenue au #darkroom, %s! Écris !help pour plus d\'informations.';
  68. chat_win = '<V>%s<BL> a gagné!';
  69. chat_help = '<BL>Ton objectif principal est <J>de trouver la sortie du labyrinthe. <BL>Trouve la en premier ou meurs. Commandes:\n<J>!profile nickname <BL>- ouvre le profil du joueur\n<J>!q^ <BL>- informations à propos de la version etc';
  70. chat_info = '<J>#<BL>darkroom: version 1.1\n<J>#<BL>Topic de discussion:\n<J>#<BL>Topic pour proposer des cartes:\n\n<J>#<BL>Créé par <V>Aviener';
  71. profile_ratio = ' • Ratio: <V>';
  72. profile_rounds = ' • Total des parties jouées: <V>';
  73. profile_wins = ' • Parties gagnées: <V>';
  74. profile_close = 'Fermer';
  75.  
  76. };
  77.  
  78. ro =
  79. {
  80.  
  81. chat_welcome = '<J>Bine ai venit în #darkroom, &s! Scrie !help pentru mai multe informații.';
  82. chat_win = '<V>&s<BL> a câștigat!' ;
  83. chat_help = '<BL>Obiectivul tău este <J> să găsești o scăpare din labirint. <BL>Gasește-o primul sau mori. Comenzi: \n<J>!profile nickname <BL>- deschide profilul jucătorul\n<J>!q^ <BL>- informații despre versiune etc';
  84. chat_info = '<J>#<BL>darkroom: versiunea 1.1\n<J>#<BL>Thread-ul de discuții :\n<J>#<BL>Thread-ul de trimitere a mapelor: \n\n<J>#<BL>Creat de <V>Aviener';
  85. profile_ratio = ' • Ratio: <V>';
  86. profile_rounds = ' • Totalul de runde jucate: <V>';
  87. profile_wins = ' • Runde câștigate: <V>';
  88. profile_close ='Închidere';
  89.  
  90. };
  91.  
  92. ru =
  93. {
  94.  
  95. chat_welcome = '<J>Добро пожаловать в #darkroom, %s! Напиши !help, чтобы узнать подробнее.';
  96. chat_win = '<V>%s<BL> выиграл!';
  97. chat_help = '<BL>Ваша главная задача - <J>найти выход из лабиринта. <BL>Найдите его первым или проиграйте. Команды: \n<J>!profile ник - открывает профиль игрока\n!q^ - информация про версию и т. д.';
  98. chat_info = '<J>#<BL>darkroom: версия 1.1\n<J>#<BL>Тема обсуждения игры:\n<J>#<BL>Прием карт:\n\n<J>#<BL>Создано <V>Aviener\'ом';
  99. profile_ratio = '<N> • Соотношение: <V>';
  100. profile_rounds = '<N> • Сыграно раундов: <V>';
  101. profile_wins = '<N> • Выиграно раундов: <V>';
  102. profile_close = 'Закрыть';
  103.  
  104. };
  105. }
  106.  
  107.  
  108. Module = {
  109.  
  110. ['TitleGenerator'] = function ()
  111.  
  112. for name,player in pairs(tfm.get.room.playerList) do
  113. players[name]={rounds=0; wins = 0; title = '<V>Player'}
  114. end
  115.  
  116. for player,name in pairs(translators) do
  117. players[name]={rounds=0; wins = 0; title = '<BV>★ Translator ★'}
  118. end
  119.  
  120. for player,name in pairs(admin) do
  121. players[name]={rounds=0; wins = 0; title = '<ROSE>★★★ Little Boy ★★★'}
  122. end
  123.  
  124. for player,name in pairs(mapCrew) do
  125. players[name]={rounds=0; wins = 0; title = '<PT>★ Staff ★'}
  126. end
  127. end;
  128.  
  129. ['Start'] = function (arg)
  130.  
  131. tfm.exec.newGame(arg)
  132. Module.TitleGenerator()
  133.  
  134. end;
  135.  
  136.  
  137. ['Check'] = function(var, arg)
  138. --
  139. local flag = true
  140. for i,v in pairs (arg) do
  141. if v == var then
  142. flag = false
  143. break
  144. end
  145. end
  146.  
  147. return flag
  148. end;
  149.  
  150. ['GetPoints'] = function (xml)
  151.  
  152. local obj={}
  153. local i= 1
  154. local blacklist={"0","1","2","4","5","6","7","8","10","12","13","14","15","16","17","18","19","20","21","22","23","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","40","47","48","49","50","51","52","53","54","55","56","57","58","59","60","61","62","63","64","65","66","67","68","69","70","71","72","73","74","75","76","77","78","79","80","81","82","83","84","85","86","87","88","89","90","91","92","93","94","95","96","97","98","99","100","101","102","103","104","105","106","107","108","109","110","111","112","113","114","115","116","117","118","119","120","121","122","123","124","125","126","127","128","129","130","131"}
  155.  
  156. for w in string.gmatch(xml, "<P.-T.->") do
  157. local tmps=string.sub(w, string.find(w, 'X="[-]?%d+"'))
  158. xO=string.sub(tmps,string.find(tmps,"[-]?%d+"))
  159. tmps=string.sub(w, string.find(w, 'Y="[-]?%d+"'))
  160. yO=string.sub(tmps,string.find(tmps,"[-]?%d+"))
  161. idO=string.gsub(string.sub(w, string.find(w, 'T="%d+"')),"%D","")
  162.  
  163. if Module.Check(idO, blacklist) then
  164. obj[i]={x=xO;y=yO;id=idO}
  165. i=i+1
  166. end
  167.  
  168. end
  169.  
  170. return obj
  171. end;
  172.  
  173. ['PlacePortals'] = function ()
  174.  
  175. myVar = Module.GetPoints(xml)
  176. local tmpO=myVar[math.random(#myVar)]
  177. tfm.exec.addShamanObject (27, tmpO.x, tmpO.y-50, 0, 0, 0, false)
  178. tfm.exec.addShamanObject (26, 830, 334, 0, 0, 0, false)
  179.  
  180. end;
  181.  
  182. --players--
  183.  
  184. ['ProfileLanguage'] = function ()
  185.  
  186. lang = tfm.get.room.community
  187.  
  188. if lang == 'xx' then
  189. lang = 'en'
  190. return lang
  191. end
  192.  
  193. return lang
  194.  
  195. end;
  196.  
  197. ['OpenProfile'] = function (a, r)
  198.  
  199. Module.ProfileLanguage()
  200.  
  201. local ratio = players[a].wins / players[a].rounds
  202. ui.addTextArea(8, "", r, 275, 104, 258, 212, 0x151819, 0x54585a, 1, true)
  203. ui.addTextArea(10, "<p align='center'><font size='25' face='Arial Black, Soopafresh'>"..a.."</p></font>", r, 283, 111, 240, 45, 0x151819, 0x151819, 1, true)
  204. ui.addTextArea(11, "Title: "..players[a].title,r, 281, 157, 248, 21, 0x151819, 0x151819, 1, true)
  205. ui.addTextArea(12, "<V>Statistics:<br><br>"..mes[lang].profile_rounds..players[a].rounds.."<br>"..mes[lang].profile_wins..players[a].wins.."<br><br>"..mes[lang].profile_ratio..ratio, r, 286, 189, 236, 90, 0x151819, 0x151819, 1, true)
  206. ui.addTextArea(9, "<a href='event:closeProfile'><p align=\"center\">"..mes[lang].profile_close.."</p></a>", r, 281, 294, 246, 16, 0x151819, 0x54585a, 1, true)
  207.  
  208.  
  209. end;
  210.  
  211.  
  212. ['CloseProfile'] = function ()
  213.  
  214. for x,a in ipairs({8,10,11,12,9}) do
  215. ui.removeTextArea(a)
  216. end
  217.  
  218. end;
  219. }
  220.  
  221. Player = {
  222.  
  223. ['GetTitle'] = function (name)
  224.  
  225. if Module.Check(name, translators) then
  226. players[name]={rounds=0; wins = 0; title = '<V>Player'}
  227. else players[name]={rounds=0; wins = 0; title = '<BV>★ Translator ★'}
  228. end
  229.  
  230. if Module.Check(name, mapCrew) then
  231. players[name]={rounds=0; wins = 0; title = '<V>Player'}
  232. else players[name]={rounds=0; wins = 0; title = '<PT>★ Staff ★'}
  233. end
  234.  
  235. if Module.Check(name, admin) then
  236. players[name]={rounds=0; wins = 0; title = '<V>Player'}
  237. else players[name]={rounds=0; wins = 0; title = '<ROSE>★★★ Little Boy ★★★'}
  238. end
  239.  
  240. end;
  241.  
  242. }
  243.  
  244.  
  245. MsgBox = {
  246.  
  247. ['SendMessage'] = function (message, name)
  248.  
  249. print(message)
  250. --ui.addTextArea(98989, message, nil, 8, 329, 787, 65, 0x324650, 0x0, 0.9)
  251. --tfm.exec.chatMessage(message, name)
  252.  
  253. end;
  254.  
  255. ['LanguageSwitcher'] = function (name)
  256. lang = tfm.get.room.playerList[name].community
  257.  
  258. if mes[lang]~= nil then
  259. return lang
  260. end
  261.  
  262. end;
  263.  
  264. }
  265.  
  266.  
  267. function eventNewGame()
  268.  
  269. for name,player in pairs(tfm.get.room.playerList) do
  270. players[name].rounds = players[name].rounds + 1
  271. xml = tfm.get.room.xmlMapInfo.xml
  272. Module.PlacePortals()
  273. end
  274.  
  275. for z,q in ipairs({6, 99, 889}) do
  276. ui.removeTextArea(q)
  277. end
  278.  
  279. end
  280.  
  281.  
  282. -- player win
  283. function eventPlayerWon(name)
  284.  
  285. players[name].wins = players[name].wins + 1
  286. ui.addTextArea(6, "", name, 6, 25, 788, 366, 0xe0e0e, 0xe0e0e)
  287. tfm.exec.setGameTime(2)
  288.  
  289. if MsgBox.LanguageSwitcher(name) then
  290. MsgBox.SendMessage(string.format(mes[lang].chat_win, name), nil)
  291. end
  292. end
  293.  
  294.  
  295. --new player
  296. function eventNewPlayer(name)
  297.  
  298. ui.addTextArea(99, "", name, 1, 2, 800, 400, 0x010101)
  299. tfm.exec.addImage("154389890f4.png", "&0", 14, -10);
  300.  
  301. tfm.exec.newTimer(function() ui.RemoveTextArea(99) tfm.exec.removeImage ("154389890f4.png") end, 2000, false)
  302.  
  303. Player.GetTitle(name)
  304.  
  305. if MsgBox.LanguageSwitcher(name) then
  306. MsgBox.SendMessage(string.format(mes[lang].chat_welcome, name), name)
  307. else MsgBox.SendMessage(string.format(mes.en.chat_welcome, name), name)
  308. end
  309.  
  310. tfm.exec.respawnPlayer(name)
  311.  
  312. end
  313.  
  314. --died
  315. function eventPlayerDied(name)
  316. ui.addTextArea(889, "", name, 6, 25, 788, 366, 0x010101)
  317. end
  318.  
  319. --comms
  320. function eventChatCommand(name, c)
  321. local atr = {}
  322.  
  323. for argument in c:gmatch("[^%s]+") do
  324. table.insert(atr,argument)
  325. end
  326.  
  327. if atr[1] == 'help' then if MsgBox.LanguageSwitcher(name) then
  328. MsgBox.SendMessage(mes[lang].chat_help, name) else MsgBox.SendMessage(mes.en.chat_help, name)
  329. end
  330.  
  331. elseif atr[1] == 'profile' and atr[2]~= nil and players[atr[2]] ~= nil then
  332. Module.OpenProfile(atr[2], name)
  333.  
  334. elseif atr[1] == 'q^' then
  335.  
  336. if MsgBox.LanguageSwitcher(name) then
  337. MsgBox.SendMessage(mes[lang].chat_info, name)
  338.  
  339. else MsgBox.SendMessage(mes.en.chat_info, name)
  340. end
  341.  
  342. end
  343. end
  344.  
  345.  
  346. function eventTextAreaCallback(id, name, callback)
  347.  
  348. if callback == 'closeProfile' then
  349. Module.CloseProfile()
  350. end
  351.  
  352. end
  353.  
  354.  
  355. function eventLoop(t1, t2)
  356.  
  357. if t2<=0 then
  358. tfm.exec.newGame(maplist[math.random(#maplist)])
  359. end
  360.  
  361. end
  362.  
  363. Module.Start(maplist[math.random(#maplist)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement