Advertisement
booleando

Bootcamp do booleando

Aug 4th, 2015
595
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.08 KB | None | 0 0
  1. print("Carregando...")
  2. module={}
  3. module.time=os.time()
  4. module.text={
  5.     info="<b>Gravidade:<v>%s</v>\nVento:<v>%s</v>\nMelhor tempo:<j>%s</j>-<v>%s",
  6. }
  7. module.addText=function(self,id,txt,p,x,y)
  8.     ui.addTextArea(id,txt,p,x,y,nil,nil,1,1,0)
  9. end
  10.  
  11. function module:start(m,name,t)
  12.     self.data={}
  13.     self.record={}
  14.     self.name=name
  15.     self.mt=t
  16.     self.m=m
  17.     self.NewPlayer=function(self,p)
  18.         self.data[p]=not self.data[p] and {time=os.time()} or self.data[p]
  19.         tfm.exec.bindKeyboard(p,string.byte('X'),true,true)
  20.         tfm.exec.bindKeyboard(p,string.byte('C'),true,true)
  21.         self.data[p].CP=function(self,x,y)
  22.             if self.time<os.time()-1000 then
  23.                 self.x=x
  24.                 self.y=y
  25.                 tfm.exec.displayParticle(9,x,y,0,0,0,0,p)
  26.                 self.time=os.time()
  27.             end
  28.         end
  29.     end
  30.     self.Keyboard=function(self,p,k,d,x,y)
  31.         if string.byte('X')==k then
  32.             self.data[p]:CP(x,y)
  33.         elseif string.byte('C')==k then
  34.             if self.data[p].x then
  35.                 tfm.exec.movePlayer(p,self.data[p].x,self.data[p].y)
  36.             end
  37.         end
  38.     end
  39.     self.PlayerDied=function(self,p)
  40.         tfm.exec.respawnPlayer(p)
  41.     end
  42.     self.Chat=function(self,p,c)
  43.         clower=c:lower()
  44.         if clower=="mort" then
  45.             tfm.exec.killPlayer(p)
  46.         end
  47.     end
  48.     self.Loop=function(self,a,b)
  49.         if self.carregado then
  50.             if b<=0 then self:np() end
  51.             w,g=0,10
  52.             for a,b in self.xml.xml:gmatch('G="(.-),(.-)"') do
  53.                 w,g=a,b
  54.             end
  55.             if #self.record[self.xml.mapCode]>0 then
  56.                 table.sort(self.record[self.xml.mapCode],function(a,b) return a.t<b.t end)
  57.             end
  58.             top_tb=self.record[self.xml.mapCode][1] or {p="",t=""}
  59.             self:addText(0,self.text.info:format(g or 10,w or 0,top_tb.p,top_tb.t),nil,5,20)
  60.         end
  61.     end
  62.     self.NewGame=function(self,xml)
  63.         self.xml=xml
  64.         tfm.exec.setGameTime(self.mt)
  65.         self.record[xml.mapCode]=not self.record[xml.mapCode] and {} or self.record[xml.mapCode]
  66.     end
  67.     self.Won=function(self,player,_,time)
  68.         table.insert(self.record[self.xml.mapCode],{p=player,t=time/100})
  69.     end
  70.     self.np=function(self)
  71.         local pm=self.m
  72.         tfm.exec.newGame(pm[math.random(#pm)])
  73.     end
  74.     self.config=function()
  75.         tfm.exec.disableAutoShaman(true)
  76.         tfm.exec.disableAutoNewGame(true)
  77.         tfm.exec.disableAfkDeath(true)
  78.     end
  79.     self:config()
  80.     self:np()
  81.     _G.eventLoop=function(a,b) self:Loop(a,b) end
  82.     _G.eventNewPlayer=function(p) self:NewPlayer(p) end
  83.     _G.eventNewGame=function() self:NewGame(tfm.get.room.xmlMapInfo) end
  84.     _G.eventPlayerWon=function(p,_,t) self:Won(p,_,t) end
  85.     _G.eventPlayerDied=function(p) self:PlayerDied(p) end
  86.     _G.eventKeyboard=function(p,k,d,x,y) self:Keyboard(p,k,d,x,y) end
  87.     _G.eventChatCommand=function(p,c) self:Chat(p,c) end
  88.     table.foreach(tfm.get.room.playerList,function(k) self:NewPlayer(k) end)
  89.     self.carregado=true
  90. end
  91.  
  92. s_table={
  93.     {113156,124000,149422,149451,150651,150664,151655,152260,152733,153996,155480,155606,155611,155628,155765,156720,157004,157203,157805,157960,158345,158417,158909,159145,159187,159298,159932,160841,161023,161434,162482,163094,163159,163172,163506,163531,163596,164544,164916,165186,166032,166056,166271,166333,166361,166430,166805,167075,167903,168204,168754,169059,169076,169110,169139,169228,170514,171148,171480,171482,171776,172501,172512,172520,172547,172605,172621,172951,172976,173623,173816,174223,175204,175280,176253,176507,176619,176710,176729,177652,179005,179488,179492,179807,180801,182370,182769,183139,183141,184648,184817,184868,185289,185428,185529,185873,185887,186066,189819,190646,190996,191177,191203,191205,191443,191642,192158,192255,192560,192959,193662,195116,195672,197229,199210,199710,201000,202574,203664,204488,204647,205240,205506,206396,208056,208373,208653,208940,209848,213752,213755,213874,214631,214755,216171,216173,217261,220352,222377,222910,223947,225744,226266,227093,230588,231137,231921,232469,232675,232678,235037,236768,237091,242291,250153,254785,257218,257324,257715,258192,258908,259319,261298,261814,263819,263926,264091,268915,270143,270924,271193,271411,272402,272518,272689,277427,277513,277824,279337,281948,282584,286254,289865,293559,295465,295630,295932,297442,299942,299983,301610,302080,303151,303939,304861,305567,305614,305820,306365,306384,307324,313216,314743,315666,315800,316012,318129,319443,320483,320626,322582,327354,327743,329200,329318,329571,330933,330967,331344,331988,332130,332906,333002,336305,337644,342035,343456,354984,361500,365061,368839,372255,372419,373105,374995,375455,376704,378704,380516,391924,392240,394132,395216,395310,395961,397467,397469,397478,399364,401630,403755,403940,408577,408643,410040,410045,412467,412913,419335,419369,419635,420877,422981,423311,424604,424685,424900,425884,431433,431749,432501,435812,438333,438364,438449,439092,444589,447805,449496,454049,455271,457726,458528,460961,467137,476706,478236,492222,492399,496610,496886,497965,499986,500000,500690,500748,500894,504485,505619,506032,506613,506940,510996,511136,512887,514311,522719,523270,528032,531084,536905,541223,541693,541729,543010,549666,551317,552986,556575,556841,557066,557074,560526,560583,562897,563436,564198,568122,571683,574183,575497,584783,586901,587501,592189,593164,593431,593530,596239,605255,608368,612415,618999,654894,684566,692650,692740,721319,722837,729863,758595,783547,801683,815336,834297,842019,842167,868262,881158,886744,898934,919484,970919,976944,999963,1000006,1004622,1014313,1018394,1046877,1066607,1111252,1130256,1156092,1157281,1162831,1164086,1225867,1226207,1242584,1255359,1256085,1265789,1266330,1301649,1303323,1323048,1333846,1383297,1384078,1390405,1398609,1403454,1410539,1427980,1435902,1494499,1503203,1526894,1531604,1540221,1580356,1580835,1593066,1595965,1615753,1615949,1620703,1646448,1647131,1657819,1678634,1722755,1733211,1788490,1807217,1809410,1955745,1989803,1990413,2024960,2040569,2130169,2178800,2242899,2311703,2329940,2416969,2423300,2451444,2469365,2520540,2574744,2636519,2788517,2794566,2795201,2846829,2914456,2932238,2989803,3038589,3133917,3136410,3199998,3242049,3295967,3326197,3333223,3380788,3456260,3551333,3668866,3668888,3690269,3734991,3908151,3988424,4000000,4067327,4114521,4445580,5404791},
  94.     "#Bootcamp",
  95.     180,--Tempo
  96. }
  97. module:start(table.unpack(s_table))
  98. print(("\n<v>%s\n%s"):format(module.name,tostring(os.time()-module.time)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement