Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --darkroom
- --#darkroom
- tfm.exec.disableAutoScore(true)
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAfkDeath(true)
- tfm.exec.disableAutoNewGame(true)
- system.disableChatCommandDisplay ("profile", true)
- system.disableChatCommandDisplay ("help", true)
- players = {}
- mes = {
- en = {
- welcome = '<J>Welcome to #darkroom, %s! Type !help for more information.';
- win = '<V>%s<BL> has won!';
- help = '<J>Your main purpose is finding an escape from the labyrinth. Find it first or die. Commands:\n!profile nickname';
- };
- e2 = {
- welcome = '<J>Welcome to #darkroom, %s! Type !help for more information.';
- win = '<V>%s<BL> has won!';
- help = '<J>Your main purpose is finding an escape from the labyrinth. Find it first or die. Commands:\n!profile nickname';
- };
- ru = {
- welcome = '<J>Добро пожаловать в #darkroom, %s! Напиши !help, чтобы узнать подробнее.';
- win = '<V>%s<BL> выиграл!';
- help = '<J>Ваша главная задача - найти выход из лабиринта. Найдите его первым или проиграйте. Команды: \n!profile ник - открывает профиль игрока';
- };
- }
- maplist={'@6561339', '@6534430'}
- Module = {
- ['Start'] = function (arg)
- tfm.exec.newGame(arg)
- for name,player in pairs(tfm.get.room.playerList) do
- players[name]={rounds=0; wins = 0}
- end
- end;
- ['BlaclistCh'] = function(var, arg)
- local flag = true
- for i,v in pairs (arg) do
- if v == var then
- flag = false
- break
- end
- end
- return flag
- end;
- ['GetPoints'] = function (xml)
- local obj={}
- local i= 1
- 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"}
- for w in string.gmatch(xml, "<P.-T.->") do
- local tmps=string.sub(w, string.find(w, 'X="[-]?%d+"'))
- xO=string.sub(tmps,string.find(tmps,"[-]?%d+"))
- tmps=string.sub(w, string.find(w, 'Y="[-]?%d+"'))
- yO=string.sub(tmps,string.find(tmps,"[-]?%d+"))
- idO=string.gsub(string.sub(w, string.find(w, 'T="%d+"')),"%D","")
- if Module.BlaclistCh(idO, blacklist) then
- obj[i]={x=xO;y=yO;id=idO}
- i=i+1
- end end;
- return obj
- end;
- ['PlacePortals'] = function ()
- myVar = Module.GetPoints(xml)
- local tmpO=myVar[math.random(#myVar)]
- tfm.exec.addShamanObject (27, tmpO.x, tmpO.y-50, 0, 0, 0, false)
- tfm.exec.addShamanObject (26, 830, 334, 0, 0, 0, false)
- end;
- --players--
- ['OpenProfile'] = function (a, r)
- local ratio = players[a].wins / players[a].rounds
- ui.addTextArea(1, "", r, 301, 90, 220, 184, 0x1d1d1d, 0x1d1d1d)
- ui.addTextArea(2, "<V><font size='20'><p align='center'>"..a.."</p></font>", r, 315, 109, 192, 33, 0x324650, 0x425661)
- ui.addTextArea(3, "Total rounds played: <V>"..players[a].rounds.."<N>;<br><br>Wins: <V>"..players[a].wins.."<N>;<br>Ratio: <V>"..ratio..'<N>;', r, 315, 176, 192, 80, 0x324650, 0x425661)
- ui.addTextArea(4, "<a href='event:closeProfile'><p align='center'>Закрыть</p><a>", r, 301, 292, 220, 26, 0x1d1d1d, 0x1d1d1d)
- end;
- ['CloseProfile'] = function ()
- for i,key in ipairs({1,2,3,4}) do
- ui.removeTextArea(i)
- end end;
- }
- MsgBox = {
- ['SendMessage'] = function (message, name)
- --print(message)
- tfm.exec.chatMessage(message, name)
- end;
- ['LanguageSwitcher'] = function (name)
- lang = tfm.get.room.playerList[name].community
- if mes[lang]~=nil then
- end end;
- }
- function eventNewGame()
- for name,player in pairs(tfm.get.room.playerList) do
- players[name].rounds = players[name].rounds + 1
- xml = tfm.get.room.xmlMapInfo.xml
- Module.PlacePortals()
- ui.removeTextArea(6)
- end end
- -- player win
- function eventPlayerWon(name)
- players[name].wins = players[name].wins + 1
- ui.addTextArea(6, "", name, 6, 25, 788, 366, 0xe0e0e, 0xe0e0e)
- tfm.exec.setGameTime(2)
- if MsgBox.LanguageSwitcher(name) then
- MsgBox.SendMessage(string.format(mes[lang].win, name), nil)
- end end
- --new player
- function eventNewPlayer(name)
- player[name] = {rounds = 0; wins = 0}
- if MsgBox.LanguageSwitcher(name) then
- MsgBox.SendMessage(string.format(mes[lang].welcome, name), name)
- else MsgBox.SendMessage(string.format(mes.en.welcome, name), name)
- tfm.exec.respawnPlayer(name)
- end end
- function eventChatCommand(name, c)
- local atr = {}
- for argument in c:gmatch("[^%s]+") do
- table.insert(atr,argument)
- end
- if atr[1] == 'help' then if MsgBox.LanguageSwitcher(name) then
- MsgBox.SendMessage(mes[lang].help, name) else MsgBox.SendMessage(mes.en.help, name) end
- elseif atr[1] == 'profile' and atr[2]~= nil and players[atr[2]] ~= nil then
- Module.OpenProfile(atr[2], name) end end
- function eventTextAreaCallback(id, name, callback)
- if callback == 'closeProfile' then Module.CloseProfile() end end
- function eventLoop(t1, t2)
- if t2<=0 then tfm.exec.newGame(maplist[math.random(#maplist)]) end end
- Module.Start(maplist[math.random(#maplist)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement