Advertisement
Bolodefchoco_LUAXML

[Game] Voodoo Runner (Beta)

Apr 3rd, 2016
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 15.04 KB | None | 0 0
  1. --Bolodefchoco
  2. --03/04/2016
  3.  
  4. maps={155517,157098,159116,167333,170007,175454,176615,186855,187035,195453,197368,208548,212322,215933,229974,235717,249760,253469,255943,257092,258289,259854,266398,267971,277631,277835,280949,281668,281985,285589,285961,292668,292808,293306,293658,294478,295487,296020,298424,301559,305680,313138,313214,315283,320607,322649,322922,330827,342640,343875,346684,353356,355336,357837,366260,366809,368585,371579,383358,392861,394125,431873,503679,507884,515684,532860,544695,549759,554154,591528,593003,597348,597804,600212,613277,621850,639878,651656,655207,658960,720672,733146,763368,814311,823329,1102513,1110982,1134969,1296299,1526368,1551020,1568331,1584555,1610638,1636814,1642725,1705006,1719709,1737297,1737800,1737914,1802012,1802528,1852910,1853529,1869912,1872179,1914925,1923584,1939604,1949730,1952415,1962695,1972688,2009003,2031184,2033229,2036898,2050389,2080400,2082776,2128560,2202628,2208924,2239788,2297260,2309030,2341982,2346943,2357991,2362046,2378364,2395201,2420714,2427910,2432090,2444812,2448730,2466489,2470461,2474044,2484316,2574960,2601214,2605186,2636207,2643916,2668918,2669415,2673019,2682583,2693344,2693587,2704483,2708585,2718406,2719419,2747525,2750014,2758747,2772507,2777168,2789121,2797076,2803483,2805938,2811229,2817711,2818330,2819876,2828481,2844637,2850177,2854813,2858882,2860211,2860683,2869337,2877042,2884392,2887929,2890123,2901717,2918822,2920826,2925531,2933011,2933390,2941840,2945156,2947140,2961800,2963166,2967631,2974387,2996951,2998268,2999994,3000006,3008319,3008515,3012178,3012311,3016226,3024238,3024606,3041105,3042080,3043779,3075090,3076903,3085218,3099302,3118161,3118286,3137929,3139767,3142783,3146209,3149125,3161324,3163166,3182006,3182487,3185979,3200001,3219400,3242050,3243455,3264848,3281758,3292308,3293485,3295954,3295960,3311534,3330219,3337127,3338283,3343092,3395605,3404894,3428069,3430712,3434941,3459986,3471016,3473704,3483300,3484437,3493456,3493490,3500000,3500755,3513929,3527399,3530999,3535850,3558682,3560999,3561333,3576303,3588395,3603631,3637540,3645415,3659983,3668877,3707630,3734984,3734988,3734989,3734990,3734996,3734997,3734998,3734999,3747520,3750360,3759157,3767893,3779861,3780618,3799357,3804078,3815568,3820501,3826546,3838020,3846632,3849999,3860578,3866660,3866663,3920916,3937567,3938895,3939000,3958217,3963960,3964892,3969628,3976766,3976977,3984871,3985463,3999110,3999455,3999979,3999991,3999992,3999997,4000007,4000008,4000009,4000010,4000662,4027263,4039451,4058168,4093488,4107909,4117513,4121359,4209243,4220381,4234558,4237910,4241333,4249695,4295473,4311255,4313858,4317592,4333895,4334509,4337732,4362335,4365527,4373748,4390388,4398794,4413656,4484685,4506542,4538472,4578236,4593355,4594304,4644584,4660408,4675691,4697673,4720851,4794517,4822672,4834444,4889180,4948551,4948659,5036934,5085011,5092739,5132197,5134116,5263927,5284625,5292798,5340984,5342889,5348692,5356911,5384241,5444444,5460041,5473125,5489869,5505990,5522262,5553707,5598943,5616777,5616978,5706542,5720741,5758150,5761507,5819555,5876254,5914063,5931069,5998000,6041917,6045500,6075471,6079100,6087408,6254869,6284671,6289411,6296348,6462982}
  5.  
  6. --[[
  7. < [Victorruanpk] Teleport único no mapa (Só pode se for num raio de 200px do rato) (2)
  8. < [Victorruanpk] Speed pros lados (2)
  9. < [Victorruanpk] Aumento de tamanho de impulso quando sobe,desce,vai pros lados (2)
  10. < [Victorruanpk] Particulas de efeito sobre o seu voodoo/controlador (2)
  11. < [Victorruanpk] Fusão (2)
  12. < [Victorruanpk] (troca quem controla pra quem é controlado se os dois digitarem) (2)
  13. ]]
  14.  
  15. --[[ 0 = Mensagem
  16.      -1,-2,-3 = Perfil
  17.      -4,-5 = Botão help
  18.      -6,-7,-8,-9 = Help
  19. ]]
  20.  
  21. first=0
  22. timer=-1
  23. _minusTwo=false
  24. playersQ=2
  25. inTribeHouse=(tfm.get.room.name:find("#") and false or true)
  26.  
  27. for _,f in next,{"AutoShaman","AfkDeath","AutoScore","AutoNewGame","AutoTimeLeft"} do
  28.     tfm.exec["disable"..f]()
  29. end
  30.  
  31. mice={}
  32. eventNewPlayer=function(n)
  33.     if not mice[n] then
  34.         mice[n]={
  35.             voodoo="",
  36.             control="",
  37.             timer="",
  38.             vStat={0,0,0},
  39.             cStat={0,0,0,0},
  40.             breakMove={false,0},
  41.             round=0,
  42.             skillPoints=0,
  43.             tCE=0,
  44.             tC=0,
  45.             afk=false,
  46.             profileOn=false,
  47.             helpF={false,1},
  48.             nextControler="",
  49.         }
  50.     end
  51.     for _,k in next,{1,0,3,2,80,72,79} do
  52.         system.bindKeyboard(n,k,true,true)
  53.     end
  54.     ui.addTextArea(-4,"",n,780,380,13,13,0x324650,0x324650,1,true)
  55.     ui.addTextArea(-5,"<B><a href='event:button?'><VP>?</a>",n,781,378,nil,nil,1,1,0,true)
  56.     if _minusTwo then
  57.         tfm.exec.setGameTime(0)
  58.         playersQ=playersQ+1
  59.     end
  60. end
  61. table.foreach(tfm.get.room.playerList,eventNewPlayer)
  62.  
  63. table.destroy=function(_table,value)
  64.     for _,__ in next,_table do
  65.         if value==__ then table.remove(_table,_);break end
  66.     end
  67. end
  68.  
  69. string.nick=function(player)
  70.     local _=1
  71.     if player:find("^%p") then _=2 end
  72.     return player:sub(1,_):upper()..player:sub(_+1):lower()
  73. end
  74.  
  75. text=function(txt,name)
  76.     ui.addTextArea(0,"<p align='center'>"..txt,name,5,380,790,nil,0x324650,0x141D22,1,true)
  77.     if not inTribeHouse then tfm.exec.chatMessage(txt,name) end
  78. end
  79.  
  80. voodooThem=function()
  81.     local players={}
  82.     table.foreach(tfm.get.room.playerList,function(n) table.insert(players,n) end)
  83.     playersQ=#players
  84.     if #players>1 then
  85.         if #players%2~=0 then tfm.exec.killPlayer(players[#players]);table.remove(players,#players) end
  86.         for q = 1,#players do
  87.             if q%2~=0 then
  88.                 mice[players[q]].voodoo=players[q+1]
  89.                 mice[players[q+1]].control=players[q]
  90.                 mice[players[q]].tCE=mice[players[q]].tCE+1
  91.                 mice[players[q+1]].tC=mice[players[q+1]].tC+1
  92.                 mice[players[q]].timer=os.time()+10000;mice[players[q+1]].timer=os.time()+10000
  93.                 text("<ROSE>"..players[q+1].." agora é a sua cobaia!",players[q])
  94.                 text("<CH>"..players[q].." agora é o seu carcereiro espiritual!",players[q+1])
  95.                 table.remove(players,q);table.remove(players,q+1)
  96.             end
  97.         end
  98.     else
  99.         text("<R> É necessário 2 ou mais jogadores para o jogo iniciar-se.",nil)
  100.         _minusTwo=true
  101.     end
  102. end
  103.  
  104. profile=function(n,p)
  105.     ui.addTextArea(-1,("\nRounds : <V>%d</V>\n<J>Skills <N>: <PT>%d\n\n<VP>Carcereiro Espiritual : (%d)</VP>\n\tCobaias Salvas : <V>%d</V>\n\tCobaias Mortas : <V>%d</V>\n\tBreaks : <V>%d</V>\n\tAfk : <V>%d</V>\n\n<VP>Cobaia : (%d)</VP>\n\tFirst : <V>%d</V>\n\tSecond : <V>%d</V>\n\tThird : <V>%d</V>\n\tCheese : <V>%d</V>"):format(mice[p].round,mice[p].skillPoints,mice[p].tCE,mice[p].vStat[1],mice[p].vStat[2],mice[p].breakMove[2],mice[p].vStat[3],mice[p].tC,mice[p].cStat[1],mice[p].cStat[2],mice[p].cStat[3],mice[p].cStat[4]),n,310,103,180,208,0x324650,1,1,true)
  106.     ui.addTextArea(-2,"<font size='20' face='Impact'><p align='center'>"..p,n,307,80,186,30,0x324650,1,1,true)
  107.     ui.addTextArea(-3,"<font size='20' face='Impact'><p align='center'><R><a href='event:closeProfile'>Fechar</a>",n,307,310,186,30,0x324650,1,1,true)
  108. end
  109.  
  110. help=function(n,t1,t2)
  111.     local titles={
  112.         [1] = "Voodoo Runner!",
  113.         [2] = "Carcereiro Espiritual",
  114.         [3] = "Cobaia",
  115.         [4] = "Árvore de Habilidades",
  116.         [5] = "Comandos",
  117.         [6] = "Créditos",
  118.     }
  119.     local texts={
  120.         [1] = "<p align='center'><font size='25'>Bem-vindo ao Jogo!</font>\n"..(":"):rep(55).."</p><p align='left'><font size='14'>\n<J>Há duas possibilidades de jogo:</J>\n          <CH>Carcereiro Espiritual</CH>;\n          <ROSE>Cobaia</ROSE>;\n<J>Seu objetivo aqui é bem simples:\n          <PT>Seja o melhor Mestre Voodoo do mundo Transformice!\n\n<p align='center'><CE>Este jogo foi desenvolvido por Bolodefchoco",
  121.         [2] = "<p align='center'>"..(":"):rep(55).."</p><p align='left'><font size='14'>\n<CH>Seus poderes são ilimitados!\n\nSeu dever é garantir que sua alma, cobaia, seja entregue à toca em segurança o mais rápido possível!\n\nNão se esqueça que seus pontos podem diminuir/aumentar dependendo da sua ação em jogo :)",
  122.         [3] = "<p align='center'>"..(":"):rep(55).."</p><p align='left'><font size='14'>\n<S>Oh não! :(\n\nVocê foi capturado pela magia Voodoo do seu controlador!\n\nSirva de cobaia e entre na toca o mais rápido possível. Quanto mais você ajudar seu controlador, <ROSE>mais chances</ROSE> de se vingar você terá :)",
  123.         [4] = "<p align='center'>"..(":"):rep(55).."</p><p align='left'><font size='14'>\n<J>Na Árvore de Habilidades você tem o <CE>direito</CE> de melhorar suas habilidades o máximo possível, usando as famosas <S>$V Koins</s>, a moeda oficial do Voodop, e você pode obtê-las jogando duro e estando entre um dos três primeiros no mapa!\n\n<VI>Abrindo todas as habilidades, uma nova e <PT>secreta</PT> será desbloqueada para você.",
  124.         [5] = "<p align='center'>"..(":"):rep(55).."\n<p align='left'><font size='5'>\n</font><font size='14'>   <CE>Ξ</CE> <CH>Carcereiros Espirituais</CH>\n   <CE>Ξ</CE> <J>Todos</J></font><p align='left'><font size='14'>\n<CH>!afk - Simboliza que o carcereiro está afk.\n!break - Ativa um break, fazendo com que o carcereiro não possa mais se mover. (Remove 2 pontos cada vez que é ativado)\n<J>!p [Nome] - Mostra o perfil\n<CH>←↑→↓ - Move a cobaia\n<J>P - Abre o seu perfil\n<J>H - Abre a ajuda\n<J>O - Abre a Árvore de Habilidades",
  125.         [6] = "<p align='center'>"..(":"):rep(55).."</p><p align='left'><font size='14'>\n• <J>Jogo desenvolvido por Bolodefchoco\n</J>• <VI>Árvore de Habilidades idealizada parcialmente por Victorruanpk",
  126.     }
  127.     ui.addTextArea(-6,"\n"..texts[mice[n].helpF[2]],n,250,80,300,250,0x324650,1,1,true)
  128.     ui.addTextArea(-7,"<font size='30' face='Impact'><p align='center'>"..titles[mice[n].helpF[2]],n,240,40,330,40,0x324650,1,1,true)
  129.     ui.addTextArea(-8,"",n,235,335,330,40,0x324650,1,1,true)
  130.     ui.addTextArea(-9,"<font size='35'><p align='center'><J>"..(t1 and "<a href='event:help_leftPage'>«</a>" or "").."   <R><font size='35' face='impact'><a href='event:help_close'>Fechar</a></font><J>   "..(t2 and "<a href='event:help_rightPage'>»</a>" or ""),n,291,332,nil,40,1,1,0,0x324650,1,1,true)
  131. end
  132.  
  133. eventTextAreaCallback=function(i,n,c)
  134.     if c=='closeProfile' then
  135.         for i = -3,-1 do
  136.             ui.removeTextArea(i,n)
  137.         end
  138.     end
  139.     if c=='button?' then
  140.         mice[n].helpF[1]=true
  141.         mice[n].helpF[2]=1
  142.         help(n,false,true)
  143.     end
  144.     if c=='help_rightPage' then
  145.         mice[n].helpF[2]=mice[n].helpF[2]+1
  146.         help(n,true,(mice[n].helpF[2]<6 and true or false))
  147.     end
  148.     if c=='help_leftPage' then
  149.         mice[n].helpF[2]=mice[n].helpF[2]-1
  150.         help(n,(mice[n].helpF[2]>1 and true or false),true)
  151.     end
  152.     if c=='help_close' then
  153.         for i=-9,-6 do
  154.             ui.removeTextArea(i,n)
  155.         end
  156.     end
  157. end
  158.  
  159. newMap=""
  160. findPattern=function(xml)
  161.     local a1,a2 = 0,0
  162.     for _,p in next,{'DS','T','DC'} do
  163.         a1,a2=xml:match('.<'..p..' X="(%d+)" Y="(%d+)" />.')
  164.         if a1==nil and a2==nil then
  165.             a2,a1=xml:match('.<'..p..' Y="(%d+)" X="(%d+)" />.')
  166.         end
  167.         if a1~=nil and a2~=nil then
  168.             return a1,a2
  169.         end
  170.     end
  171.     return 0,0
  172. end
  173. eventNewGame=function()
  174.     table.foreach(tfm.get.room.playerList,function(n,v) if not v.isDead then mice[n].round=mice[n].round+1 end end)
  175.     timer=os.time()+2000
  176.     if type(newMap)=="table" then
  177.         ui.setMapName("<J>"..newMap[1].." <BL>- "..newMap[2])
  178.     else
  179.         table.destroy(maps,tfm.get.room.xmlMapInfo.mapCode)
  180.         table.insert(maps,{tfm.get.room.xmlMapInfo.author,tfm.get.room.currentMap,tfm.get.room.xmlMapInfo.xml})
  181.     end
  182.     first=0
  183.     voodooThem()
  184.     posX,posY=findPattern(tfm.get.room.xmlMapInfo.xml)
  185. end
  186.  
  187. eventLoop=function(ts,tr)
  188.     _G.ts=ts
  189.     if timer~=-1 then
  190.         if os.time()<timer then
  191.             if inTribeHouse then
  192.                 table.foreach(tfm.get.room.playerList,function(n)
  193.                     tfm.exec.movePlayer(n,posX,posY)
  194.                 end)
  195.             end
  196.         else
  197.             timer=-1
  198.         end
  199.     end
  200.     table.foreach(tfm.get.room.playerList,function(n)
  201.         if mice[n].timer~="" then
  202.             if os.time()>mice[n].timer then
  203.                 for i=0,1 do
  204.                     ui.removeTextArea(i,n)
  205.                 end
  206.                 mice[n].timer=""
  207.             end
  208.         end
  209.         if mice[n].breakMove[1] then
  210.             tfm.exec.movePlayer(n,posX,posY)
  211.         end
  212.     end)
  213.     local i=0
  214.     for _,v in next,tfm.get.room.playerList do if not v.isDead then i=i+1 end end
  215.     if ((i<=1 or tr<=0) and playersQ>1) or i==0 then
  216.         newMap = maps[math.random(#maps)]
  217.         tfm.exec.newGame((type(newMap)=="table" and newMap[3] or newMap))
  218.     end
  219. end
  220.  
  221. if not inTribeHouse then
  222.     local pS=10
  223.     local pSNL=1000/pS
  224.     for tm = 0,1000-pSNL,pSNL do
  225.         system.newTimer(function()
  226.             system.newTimer(eventFasterLoop,1000,true)
  227.         end,1000+tm,true)
  228.     end
  229. end
  230. eventFasterLoop=function()
  231.     if timer~=-1 then
  232.         if os.time()<timer then
  233.             table.foreach(tfm.get.room.playerList,function(n)
  234.                 tfm.exec.movePlayer(n,posX,posY)
  235.             end)
  236.         end
  237.     end
  238. end
  239.  
  240. eventKeyboard=function(n,k,d)
  241.     if ts/1000>4 then
  242.         for i,v in next,{1,0,3,2} do
  243.             if v==k and not tfm.get.room.playerList[n].isDead then
  244.                 local dir={0,-40,-40,0,0,40,40,0}
  245.                 tfm.exec.movePlayer(mice[n].voodoo,0,0,false,dir[i*2-1],dir[i*2],false)
  246.             end
  247.         end
  248.     end
  249.     if k==80 then
  250.         if mice[n].profileOn then
  251.             eventTextAreaCallback(nil,n,"closeProfile")
  252.         else
  253.             profile(n,n)
  254.         end
  255.         mice[n].profileOn=not mice[n].profileOn
  256.     end
  257.     if k==72 then
  258.         if mice[n].helpF[1] then
  259.             mice[n].helpF[1]=false
  260.             eventTextAreaCallback(nil,n,"help_close")
  261.         else
  262.             mice[n].helpF[1]=true
  263.             eventTextAreaCallback(nil,n,"button?")
  264.         end
  265.     end
  266. end
  267.  
  268. eventChatCommand=function(n,c)
  269.     if c:lower()=="afk" and mice[n].voodoo~="" then
  270.         if not mice[n].afk then
  271.             local voodoo=mice[n].voodoo
  272.             tfm.exec.killPlayer(n)
  273.             tfm.exec.killPlayer(voodoo)
  274.             text("<R>Seu carcereiro espiritual, "..n..", está afk!",voodoo)
  275.             mice[voodoo].timer=os.time()+6000
  276.             mice[n].vStat[3]=mice[n].vStat[3]+1
  277.         end
  278.         mice[n].afk=not mice[n].afk    
  279.     end
  280.     if c:lower()=="break" and mice[n].voodoo~="" then
  281.         mice[n].breakMove[1]=not mice[n].breakMove[1]
  282.         mice[n].breakMove[2]=mice[n].breakMove[2]+1
  283.     end
  284.     if c:sub(1,1):lower()=="p" then
  285.         if #c>4 and tfm.get.room.playerList[string.nick(c:sub(3))] then
  286.             profile(n,string.nick(c:sub(3)))
  287.         else
  288.             profile(n,n)
  289.         end
  290.         mice[n].profileOn=true
  291.     end
  292. end
  293.  
  294. eventPlayerWon=function(n)
  295.     if playersQ>1 and mice[n].voodoo=="" then
  296.         local control=mice[n].control
  297.         first=first+1
  298.         if first==1 then
  299.             tfm.exec.setPlayerScore(control,10,true)
  300.             tfm.exec.setPlayerScore(n,10,true)
  301.         elseif first==3 or first==5 then
  302.             tfm.exec.setPlayerScore(control,5,true)
  303.             tfm.exec.setPlayerScore(n,5,true)
  304.         else
  305.             tfm.exec.setPlayerScore(control,1,true)
  306.             tfm.exec.setPlayerScore(n,1,true)
  307.         end
  308.         local tableNumber=(first==1 and 1 or first==3 and 2 or first==5 and 3 or 4)
  309.         print('f'..first) print('t'..tableNumber)
  310.         mice[n].cStat[(tableNumber)]=mice[n].cStat[(tableNumber)]+1
  311.         pcall(function() mice[control].vStat[1]=mice[control].vStat[1]+1 end)
  312.         tfm.exec.giveCheese(control)
  313.         tfm.exec.playerVictory(control)
  314.     end
  315. end
  316.  
  317. eventPlayerDied=function(n)
  318.     if mice[n].voodoo=="" then
  319.         pcall(function()
  320.             mice[mice[n].control].vStat[2]=mice[mice[n].control].vStat[2]+1
  321.             mice[mice[n].control].nextControler=n
  322.         end)       
  323.     end
  324. end
  325.  
  326. eventPlayerLeft=function(n)
  327.     if mice[n].voodoo ~= "" then
  328.         local voodoo=mice[n].voodoo
  329.         mice[voodoo].control = ""
  330.         mice[n].voodoo = ""
  331.         tfm.exec.killPlayer(voodoo)
  332.         text("<R>Seu carcereiro espiritual deixou a sala! :(",voodoo)
  333.     else
  334.         local control=mice[n].control
  335.         mice[control].voodoo = ""
  336.         mice[n].control = ""
  337.         tfm.exec.killPlayer(control)
  338.         text("<R>Sua cobaia deixou a sala! :(",control)
  339.     end
  340. end
  341.  
  342. tfm.exec.setGameTime(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement