Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local maps = {
- 203664, 375455, 394132, 173816, 171776, 199210, 562897, 172951, 171148, 166430, 169076, 330933, 179488, 172621, 168754, 159145,
- 163596, 152733, 410040, 158909, 261814, 195453, 281985, 191205, 159932, 2176211, 586901, 285589, 257324, 236768, 303151, 270924,
- 1324259, 1225867, 563436, 424604, 523270, 172547, 2693587, 168204, 2693344, 193662, 1788490, 305680, 149451, 176253, 342035, 2466489,
- 292808, 176615, 438333, 394125, 162482, 304861, 458528, 159298, 184648, 268915, 329318, 373105, 261298, 302080, 449496, 159187, 176710,
- 161023, 366260, 1852910, 201172, 549759, 257715, 397478, 261298, 177652, 408643, 447805, 155606, 176619, 460961, 455271, 172512, 320607,
- 166271, 299942, 150664, 186066, 152260, 155628, 166805, 178297, 313138, 167903, 223947, 191177, 185873, 113156, 156720, 163159, 197229,
- 204647, 163531, 232675, 216173, 166361, 169059, 271411, 277824, 306365, 172520, 157098, 225744, 608368, 215933, 266398, 343875, 327354,
- 331344, 333002, 223174, 332130, 254785, 295487, 184817, 159691, 235717, 169228, 191203, 503679, 506032, 2747525, 192255, 208056, 171480,
- 182681, 219956, 270143, 2887929, 247329, 250610, 2118599, 445133, 149853, 212903, 220737, 397296, 2617003, 629731, 329627, 221767, 422655,
- 417816, 164931, 245152, 371072, 2458243, 214788, 274963, 2439335, 269534, 8679, 321268, 398041, 5591416, 5650343, 5650250, 161730, 4273207,
- 4091580, 5650303, 5172709, 5650469, 214660, 3579335, 4003729, 508451, 314205, 156510, 5545443, 606723, 3946626, 332467, 1665516, 1614563,
- 3679884, 414899, 1531388, 905496, 3834905, 3821104, 1851411, 3816991, 2331474, 313245, 266854, 193588, 2141379, 3738767, 232791, 285752,
- 278506, 406266, 1976857, 301315, 180469, 3693822, 280896, 403698, 259604, 418022, 323366, 594883, 477603, 437860, 590641, 3688419, 3682405,
- 645288, 419374, 664949, 704015, 398942, 195720, 314159, 613985, 3683383, 3683201, 3680223, 3680221, 363625, 1693705, 319524, 3667358, 1718723,
- 1490438, 3630433, 3620542, 3617674, 3556489, 3548406, 3548376, 3408247, 2953315, 2883986, 2683170, 2645615, 2536577, 2453022, 2372538, 2287914,
- 2286056, 2223685, 2150335, 2150335, 2101747, 2018511, 2007205, 1975684, 1964752, 1964700, 1956555, 1923785, 1862800, 1716949, 1674534, 1658171,
- 1659639, 1657360, 1657021, 1654105, 1651658, 1643157, 1634741, 1632706, 1622737, 1619934, 1618110, 1613550, 1612796, 1612436, 1608638, 6212895,
- 1602654, 1601492, 1586439, 1588884, 1573997, 1567620, 1542618, 1539791, 1513407, 1509474, 1503393, 1487161, 1450554, 1425101, 1394120, 1393405,
- 1373000, 1371239, 1368222, 1359797, 1358446, 1352534, 1346440, 1321664, 1321417, 1281981, 1255130, 1222899, 1214182, 1195842, 1143815, 1132357,
- 1058681, 979179, 829657, 813156, 798953, 749102, 737841, 627609, 624721, 608459, 616373, 594049, 606719, 586688, 580031, 564033, 558790, 551126,
- 545493, 536235, 528428, 511275, 508106, 501711, 496945, 496091, 483924, 472665, 472379, 447556, 445133, 444490, 441047, 438154, 436447, 436107,
- 431373, 430145, 429822, 428517, 427300, 425806, 424795, 422361, 421302, 420956, 420806, 418658, 418600, 416142, 412316, 410813, 412211, 410565,
- 410532, 410230, 407457, 407455, 407230, 407165, 406982, 406881, 406486, 405295, 403910, 401995, 401945, 401778, 397938, 397812, 397296, 396861,
- 396645, 391625, 387270, 387180, 386046, 385295, 386029, 379745, 378826, 379866, 364998, 359055, 352885, 352710, 350251, 344952, 340069, 339896,
- 339643, 337774, 323600, 319841, 317754, 309029, 308711, 308435, 306213, 292348, 278916, 277784, 275514, 270819, 1017676, 160762, 2089069, 234039,
- 267187, 263163, 262144, 330590, 403698, 396105, 6538564, 396105, 419735, 6547536, 355658, 6607378, 191716, 292348, 6456247, 5326916, 6077025,
- 356722, 2564883, 1450554, 494706, 254291, 1503393, 6467947, 6263285, 2953315, 6114281, 412752, 4038817, 5461992, 319841, 359901, 191716, 452016,
- 1450554, 397296, 250610, 499684, 5848412, 238791, 2283, 232274, 1716693, 330590, 459349, 6583596, 455167, 6460747, 251459, 244888, 5755208,
- 240973, 235501, 235034, 234039, 233398, 232274, 230510, 216735, 216439, 216505, 214037, 212542, 211565, 198715, 193936, 191716, 186604, 180274,
- 176263, 178657, 146801, 145020, 3154, 2283, 5382692, 5249500, 4412890, 5163891, 789128, 2245005, 2030343, 5712914, 372401, 5087373, 4953687,
- 2369254, 4853690, 226069, 422509, 5436200, 732880, 4038817, 400866, 3730656, 3985806, 355658, 5175727, 5699298, 5588646, 3921436, 3639993, 3984750,
- 508796, 1985019, 4734427, 1703617, 289068, 197219, 333666, 6077025, 5710586, 322321, 331572, 4741601, 158128, 6310411, 6312498, 6310396, 6312188,
- 6473912, 6389619, 6854536, 6854539, 6312173, 6315208, 6312203, 6310370, 6310383, 6853060, 6310440, 6547670, 7062105, 6545742, 6985344, 960547
- }
- local tribes = {}
- local scores = {}
- local mice = {}
- local round = 0
- local rounds = 2
- local miceAlive
- local places
- local particles
- local xIni
- local yIni
- function main()
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoTimeLeft(true)
- table.foreach(tfm.get.room.playerList, eventNewPlayer)
- startNewGame()
- math.randomseed(os.time())
- end
- function startNewGame()
- if round < rounds then
- local newMap
- repeat
- newMap = maps[math.random(#maps)]
- until newMap ~= tfm.get.room.currentMap
- tfm.exec.newGame (newMap)
- else
- tfm.exec.newGame(0)
- end
- end
- function eventNewPlayer(name)
- local tribeName = tfm.get.room.playerList[name].tribeName
- if tribeName ~= nil then
- if not tribes[tribeName] then
- tribes[tribeName] = {
- name = tribeName,
- members = {name},
- points = 0
- }
- else
- table.insert(tribes[tribeName].members, name)
- end
- end
- if not mice[name] then
- mice[name] = {
- help = false
- }
- end
- for i = 1, 1000 do
- system.bindKeyboard(name, i, true, true)
- end
- end
- function eventNewGame()
- scores = {}
- places = 0
- miceAlive = 0
- round = round + 1
- particles = false
- tfm.exec.setUIMapName("<J>".. tfm.get.room.xmlMapInfo.author .. "<G> - " .. tfm.get.room.currentMap .. " | <BV>Rondas: <CH>"..round .. "<BL><b>/</b><BV>" .. rounds)
- if (round == rounds + 1) then
- local ladder = getWinners()
- for i = 1, math.min(#ladder, 3) do
- if ladder[i].points <= 0 then
- ladder[i].name = "Nobody :("
- end
- if ladder[i].name ~= "Nobody :(" then
- print("<G> ("..i..") </G><BV><b>"..ladder[i].name.."</b></BV><G> with " .. ladder[i].points .. " points")
- end
- end
- if ladder[1].name == "Nobody :(" then
- print("Nobody won :(")
- end
- xIni = math.random(400-100*4, 400+10*4)
- yIni = math.random(100-100*2, 100+100*2)
- particles = true
- round = 0
- tfm.exec.setUIMapName("<J>".. tfm.get.room.xmlMapInfo.author .. "<G> - " .. tfm.get.room.currentMap .. " | <J>WINNERS!!!! ")
- tfm.exec.setGameTime(20)
- for name, tribe in pairs(tribes) do
- tribe.points = 0
- end
- end
- for name in pairs(tfm.get.room.playerList) do
- miceAlive = miceAlive + 1
- end
- end
- function eventLoop(time, left)
- if left <= 0 then
- startNewGame()
- end
- if particles then
- i = true
- if i then
- i = false
- for i = 0,30 do
- tfm.exec.displayParticle(21, xIni, yIni,0, math.random(0,4), 0, 0, name)
- tfm.exec.displayParticle(22, xIni, yIni,0, math.random(0,4), 0, 0, name)
- tfm.exec.displayParticle(23, xIni, yIni,0, math.random(0,4), 0, 0, name)
- xIni = math.random(400-100*4, 400+100*4)
- yIni = math.random(100-100*2, 100+100*2)
- end
- end
- end
- end
- function eventKeyboard(name, key, down, x, y)
- if key == 72 then
- if mice[name].help then
- for i = 0, 3 do
- ui.removeTextArea(i, name)
- end
- mice[name].help = false
- else
- ui.addTextArea(0, "<p align='center'><font size='20'>¡</font><font size='20' color='#FF9602'>Bienvenido a </font><font size='20' color='#3D1149'><b>#tribewar</b></font><font size='30'>!</font></p>\n\n<font size='13'><p align='justify'><b>#tribewar</b> es un minijuego en donde competirás con otras tribus para ver quién es la mejor. Asegúrate de tener en cuenta lo siguiente:\n\n • Los primeros lugares recibirán: <b>3 2 1</b> puntos, respectivamente.\n • <b>No</b> cuentan los firsts.\n • <b>10</b> rondas para juntar la mayor cantidad de puntos, la tribu que tenga mayor cantidad de puntos al finalizar las <b>10</b> rondas gana.\n</p></font>\n\n\n<font size='10'><p align='right'>Para saber la lista de comandos disponibles \npasa a la siguiente página.</p></font>", name, 150, 58, 497, 248, 0x526E9A, 0x081B5D, 1, true)
- ui.addTextArea(1, "<font size='30'><p align='center'><a href='event:page2'>></p></font>", name, 663, 263, 44, 43, 0x526E9A, 0x081B5D, 1, true)
- ui.addTextArea(3, "<font size='30'><p align='center'><a href='event:close'>X</a></p></font>", name, 663, 59, 44, 43, 0xc22323, 0xf00000, 1, true)
- mice[name].help = true
- end
- end
- end
- function eventTextAreaCallback(id, name, callback)
- if callback == "page1" then
- ui.updateTextArea(0, "<p align='center'><font size='20'>¡</font><font size='20' color='#FF9602'>Bienvenido a </font><font size='20' color='#3D1149'><b>#tribewar</b></font><font size='30'>!</font></p>\n\n<font size='13'><p align='justify'><b>#tribewar</b> es un minijuego en donde competirás con otras tribus para ver quién es la mejor. Asegúrate de tener en cuenta lo siguiente:\n\n • Los primeros lugares recibirán: <b>3 2 1</b> puntos, respectivamente.\n • <b>No</b> cuentan los firsts.\n • <b>10</b> rondas para juntar la mayor cantidad de puntos, la tribu que tenga mayor cantidad de puntos al finalizar las <b>10</b> rondas gana.\n</p></font>\n\n\n<font size='10'><p align='right'>Para saber la lista de comandos disponibles \npasa a la siguiente página.</p></font>", name)
- ui.updateTextArea(1, "<font size='30'><p align='center'><a href='event:page2'>></p></font>", name)
- ui.removeTextArea(2, name)
- elseif callback == "page2" then
- ui.updateTextArea(0, "<p align='center'><font size='20'>¡</font><font size='20' color='#FF9602'>Comandos </font><font size='20' color='#3D1149'><b>#tribewar</b></font><font size='30'>!</font></p>\n\n<font size='13'><p align='justify'><b>•!help</b>: Muestra esta ayuda.\n\n<b>•!profile [player]</b>: Revisa el perfil de un jugador junto al de su tribu.\n\n<b>•!tribe [tribe]</b>: Revisa el perfil de una tribu.\n\n<b>•!compare [player] [player2]:</b> Compara perfiles personales y de tribu.\n</p></font>\n\n\n<font size='10'><p align='right'>Para ver otra información \npasa a la siguiente página</p></font>", name)
- ui.addTextArea(2, "<font size='30'><p align='center'><a href='event:page1'><</a></p></font>", name, 663, 199, 44, 43, 0x526E9A, 0x081B5D, 1, true)
- ui.updateTextArea(1, "<font size='30'><p align='center'><a href='event:page3'>></p></font>", name)
- elseif callback == "page3" then
- ui.updateTextArea(0, "<p align='center'><font size='20'>¡</font><font size='20' color='#FF9602'>Bienvenido a </font><font size='20' color='#3D1149'><b>#tribewar</b></font><font size='30'>!</font></p>\n\n<font size='13'><p align = 'justify'>Colocar más texto acá</p></font>", name)
- ui.updateTextArea(1, "<font size='30'><p align='center'><a href='event:page2'><</p></font>", name)
- ui.removeTextArea(2, name)
- elseif callback == "close" then
- for i=0, 3 do
- ui.removeTextArea(i, name)
- end
- end
- end
- function eventPlayerWon(name)
- local tribeName = tfm.get.room.playerList[name].tribeName
- local points = 0
- places = places + 1
- if places <= 3 then
- if places == 1 then
- points = 3
- elseif places == 2 then
- points = 2
- elseif places == 3 then
- points = 1
- end
- tribes[tribeName].points = tribes[tribeName].points + points
- print(name.. " ha sumado ".. points .. " puntos para la tribu: " .. tribeName .. " (".. tribes[tribeName].points .. ")")
- end
- checkAlives()
- end
- function eventPlayerLeft(name)
- checkAlives()
- end
- function eventPlayerDied(name)
- checkAlives()
- end
- function checkAlives()
- miceAlive = miceAlive - 1
- if miceAlive == 1 then
- tfm.exec.setGameTime(20)
- elseif miceAlive == 0 then
- startNewGame()
- end
- end
- function getWinners()
- local score = {}
- for name, tribe in pairs(tribes) do
- table.insert(score, tribe)
- end
- table.sort(score, function(a, b) return a.points > b.points end)
- return score
- end
- function table.contains(table, element)
- for k, v in pairs(table) do
- if v == element then
- return true
- end
- end
- return nil
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement