Advertisement
Bolodefchoco_LUAXML

[Game] Grounds

Feb 6th, 2017
771
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 222.29 KB | None | 0 0
  1. --Creator: Bolodefchoco
  2. --Made in: 06/02/2017
  3. --Last update: 14/07/2017
  4.  
  5. --[[ Module ]]--
  6. local module = {
  7.     _VERSION = "3.6",
  8.     _NAME = "grounds",
  9.     _STATUS = "semi-official",
  10.     _AUTHOR = "Bolodefchoco",
  11.     _LICENSE = [[
  12.         MIT LICENSE
  13.        
  14.         Copyright (c) 2017 @Transformice + @Bolodefchoco
  15.        
  16.         Permission is hereby granted, free of charge, to any person obtaining
  17.         a copy of this software and associated documentation files (the
  18.         "Software"), to deal in the Software without restriction, including
  19.         without limitation the rights to use, copy, modify, merge, and to
  20.         permit persons to whom the Software is furnished to do so, subject to
  21.         the following conditions:
  22.  
  23.         The above copyright notice and this permission notice shall be included
  24.         in all copies or substantial portions of the Software.
  25.  
  26.         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  27.         OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF FITNESS FOR
  28.         A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  29.         IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  30.         CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  31.         TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  32.         SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  33.     ]],
  34.     _FREEACCESS = { -- Verified players
  35.         -- 3 : Commands + Room admin + Debug
  36.         Bolodefchoco = 3,
  37.         -- 2 : Commands
  38.         Bodykudo = 2,
  39.         Error_404 = 2,
  40.         Jordynl = 2,
  41.         Laagaadoo = 2,
  42.         Sebafrancuz = 2,
  43.         Tocutoeltuco = 2,
  44.         -- 1 : Some commands
  45.         Artinoe = 1,
  46.         Bapereira = 1,
  47.         Barberserk = 1,
  48.         Byontr = 1,
  49.         Claumiau = 1,
  50.         Drescen = 1,
  51.         Ekull = 1,
  52.         Elvismouse = 1,
  53.         Grastfetry = 1,
  54.         Mcqv = 1,
  55.         Mescouleur = 1,
  56.         Mquk = 1,
  57.         Reshman = 1,
  58.         Rikkeshang = 1,
  59.         Ruamorangos = 1,
  60.         Sammynya = 1,
  61.     },
  62. }
  63.  
  64. --[[ Optimization ]]--
  65.   --[[ String ]]--
  66. local stringlen,stringfind,stringgmatch,stringbyte,stringdump,stringreverse,stringupper,stringformat,stringrep,stringlower,stringsub,stringgsub,stringmatch,stringchar = string.len,string.find,string.gmatch,string.byte,string.dump,string.reverse,string.upper,string.format,string.rep,string.lower,string.sub,string.gsub,string.match,string.char
  67.   --[[ Math ]]--
  68. local mathdeg,mathfmod,mathrandom,mathasin,mathmax,mathmodf,mathfloor,mathcosh,mathldexp,mathatan2,mathpow,mathrandomseed,mathfrexp,mathabs,mathtanh,mathacos,mathlog,mathtan,mathmin,mathceil,mathsinh,mathsqrt,mathhuge,mathrad,mathsin,mathexp,mathcos,mathatan,mathpi = math.deg,math.fmod,math.random,math.asin,math.max,math.modf,math.floor,math.cosh,math.ldexp,math.atan2,math.pow,math.randomseed,math.frexp,math.abs,math.tanh,math.acos,math.log,math.tan,math.min,math.ceil,math.sinh,math.sqrt,math.huge,math.rad,math.sin,math.exp,math.cos,math.atan,math.pi
  69.   --[[ Table ]]--
  70. local tablepack,tableforeachi,tableforeach,tableremove,tableinsert,tableunpack,tableconcat,tablesort = table.pack,table.foreachi,table.foreach,table.remove,table.insert,table.unpack,table.concat,table.sort
  71.  
  72. --[[ API ]]--
  73.     -- Timers
  74. system.newGameTimer = 0
  75.  
  76.     -- Control
  77. system.officialMode = {"",""}
  78. system.setAdmins = function()
  79.     local out = {}
  80.     for k,v in next,module._FREEACCESS do
  81.         if v > 2 then
  82.             out[k] = true
  83.         end
  84.     end
  85.     return out
  86. end
  87.  
  88.     -- Improvements
  89. tableconcat = function(list,sep,f,i,j)
  90.     local txt = ""
  91.     sep = sep or ""
  92.     i,j = i or 1,j or #list
  93.     for k,v in next,list do
  94.         if type(k) ~= "number" and true or (k >= i and k <= j) then
  95.             txt = txt .. (f and f(k,v) or v) .. sep
  96.         end
  97.     end
  98.     return stringsub(txt,1,-1-#sep)
  99. end
  100. do
  101.     local newGame = tfm.exec.newGame
  102.     tfm.exec.newGame = function(code)
  103.         if os.time() > system.newGameTimer then
  104.             system.newGameTimer = os.time() + 6000
  105.             newGame(code)
  106.             return true
  107.         end
  108.         return false
  109.     end
  110.    
  111.     local addImage = tfm.exec.addImage
  112.     local removeImage = tfm.exec.removeImage
  113.     tfm.exec.addImage = function(...)
  114.         local id = addImage(...)
  115.         if id then
  116.             system.objects.image[id] = true
  117.         end
  118.         return id
  119.     end
  120.     tfm.exec.removeImage = function(id)
  121.         removeImage(id)
  122.         if system.objects.image[id] then
  123.             system.objects.image[id] = nil
  124.         end
  125.     end
  126.    
  127.     local addTextArea = ui.addTextArea
  128.     ui.addTextArea = function(id,...)
  129.         addTextArea(id,...)
  130.         if not system.objects.textarea[id] then
  131.             system.objects.textarea[id] = true
  132.         end
  133.     end
  134.    
  135.     local chatMessage = tfm.exec.chatMessage
  136.     tfm.exec.chatMessage = function(txt,n)
  137.         if #txt > 1000 then
  138.             local total = 0
  139.             while #txt > total do
  140.                 chatMessage(stringsub(txt,total,total + 1000),n)
  141.                 total = total + 1001
  142.             end
  143.         else
  144.             chatMessage(txt,n)
  145.         end
  146.     end
  147.    
  148.     local loadPlayerData = system.loadPlayerData
  149.     system.loadPlayerData = function(n)
  150.         if module._STATUS == "official" then
  151.             return loadPlayerData(n)
  152.         else
  153.             if _G["eventPlayerDataLoaded"] then
  154.                 eventPlayerDataLoaded(n,"")
  155.             end
  156.             return true
  157.         end
  158.     end
  159.    
  160.     local savePlayerData = system.savePlayerData
  161.     system.savePlayerData = function(n,data)
  162.         if module._STATUS == "official" then
  163.             savePlayerData(n,data)
  164.             return true
  165.         else
  166.             return false
  167.         end
  168.     end
  169. end
  170.  
  171.     -- Room
  172. system.isRoom = stringbyte(tfm.get.room.name,2) ~= 3
  173. system.roomAdmins = system.setAdmins()
  174. system.miscAttrib = 0
  175. system.roomNumber,system.roomAttributes = (function()
  176.     if system.isRoom then
  177.         local number,attribute = stringmatch(tfm.get.room.name,"%*?#"..module._NAME.."(%d+)(.*)")
  178.         return tonumber(number) or "",attribute or ""
  179.     else
  180.         return "",""
  181.     end
  182. end)()
  183.  
  184.     -- Player
  185. system.isPlayer = function(n)
  186.     --[[
  187.         The player must not be a souris;
  188.         The player must have played Transformice for at least 5 days
  189.     ]]
  190.     return tfm.get.room.playerList[n] and stringsub(n,1,1) ~= "*" and tfm.get.room.playerList[n].registrationDate and (os.time() - (tfm.get.room.playerList[n].registrationDate or 0) >= 432e6) or false
  191. end
  192. system.players = function(alivePlayers)
  193.     local alive,total = 0,0
  194.     if alivePlayers then
  195.         alive = {}
  196.     end
  197.     for k,v in next,tfm.get.room.playerList do
  198.         if system.isPlayer(k) then
  199.             if not v.isDead and not v.isVampire then
  200.                 if alivePlayers then
  201.                     alive[#alive + 1] = k
  202.                 else
  203.                     alive = alive + 1
  204.                 end
  205.             end
  206.             total = total + 1
  207.         end
  208.     end
  209.     if alivePlayers then
  210.         return alive
  211.     else
  212.         return alive,total
  213.     end
  214. end
  215.  
  216.     -- System
  217. currentTime,leftTime = 0,0
  218. system.loadTable = function(s)
  219.     -- "a.b.c.1" returns a[b][c][1]
  220.     local list
  221.     for tbl in stringgmatch(s,"[^%.]+") do
  222.         tbl = tonumber(tbl) and tonumber(tbl) or tbl
  223.         list = (list and list[tbl] or _G[tbl])
  224.     end
  225.     return list
  226. end
  227. system.getTranslation = function(index,n)
  228.     local t = stringformat("mode.%s.translations.%s.%s",system.gameMode,(n and mode[system.gameMode].info[n].langue or mode[system.gameMode].langue),index)
  229.     return system.loadTable(t) or system.loadTable(stringgsub(t,"translations%..-%.",function() return "translations.en." end))
  230. end
  231. system.looping = function(f,tick)
  232.     local s = 1000 / tick
  233.     local t = {}
  234.     for timer = 0,1000 - s,s do
  235.         system.newTimer(function()
  236.             t[#t+1] = system.newTimer(f,1000,true)
  237.         end,1000 + timer,false)
  238.     end
  239.     return t
  240. end
  241.  
  242.     -- Math
  243. mathisNegative = function(x,iN,iP)
  244.     return (x<0 and (iN or x) or (iP or x))
  245. end
  246. mathpercent = function(x,y,v)
  247.     v = (v or 100)
  248.     local m = x/y * v
  249.     return mathmin(m,v)
  250. end
  251. mathpythag = function(x1,y1,x2,y2,range)
  252.     return (x1-x2)^2 + (y1-y2)^2 <= (range^2)
  253. end
  254. mathsetLim = function(value,min,max)
  255.     return mathmax(min,mathmin(max,value))
  256. end
  257.  
  258.     -- String
  259. stringsplit = function(value,pattern,f)
  260.     local out = {}
  261.     for v in stringgmatch(value,pattern) do
  262.         out[#out + 1] = (f and f(v) or v)
  263.     end
  264.     return out
  265. end
  266. stringnick = function(player)
  267.     return stringgsub(stringlower(player),"%a",stringupper,1)
  268. end
  269.  
  270.     -- Table
  271. tablefind = function(list,value,index,f)
  272.     for k,v in next,list do
  273.         local i = (type(v) == "table" and index and v[index] or v)
  274.         if (f and f(i) or i) == value then
  275.             return true,k
  276.         end
  277.     end
  278.     return false,0
  279. end
  280. tableturnTable = function(x)
  281.     return (type(x)=="table" and x or {x})
  282. end
  283. tablerandom = function(t)
  284.     return (type(t) == "table" and t[mathrandom(#t)] or mathrandom())
  285. end
  286. tableshuffle = function(t)
  287.     local randomized = {}
  288.     for v = 1,#t do
  289.         tableinsert(randomized,mathrandom(#randomized),t[v])
  290.     end
  291.     return randomized
  292. end
  293.  
  294.     -- Others
  295. deactivateAccents=function(str)
  296.     local letters = {a = {"á","â","à","å","ã","ä"},e = {"é","ê","è","ë"},i = {"í","î","ì","ï"},o = {"ó","ô","ò","õ","ö"},u = {"ú","û","ù","ü"}}
  297.     for k,v in next,letters do
  298.         for i = 1,#v do
  299.             str = stringgsub(str,v[i],tostring(k))
  300.         end
  301.     end
  302.     return str
  303. end
  304. normalizeTime = function(time)
  305.     return mathfloor(time) + ((time - mathfloor(time)) >= .5 and .5 or 0)
  306. end
  307. disableChatCommand = function(command)
  308.     system.disableChatCommandDisplay(command,true)
  309.     system.disableChatCommandDisplay(stringlower(command),true)
  310.     system.disableChatCommandDisplay(stringupper(command),true)
  311. end
  312. normalizeTranslation = function()
  313.     local t = mode[system.gameMode].translations
  314.  
  315.     for k,v in next,t.en do
  316.         for i,j in next,t do
  317.             if i ~= "en" then
  318.                 if not j[k] then
  319.                     j[k] = v
  320.                 end
  321.             end
  322.         end
  323.     end
  324. end
  325.  
  326.     -- XML Dealer
  327. xml = {}
  328. xml.parse = function(currentXml)
  329.     currentXml = stringmatch(currentXml,"<P (.-)/>") or ""
  330.     local out = {}
  331.     for tag,_,value in stringgmatch(currentXml,"([%-%w]+)=([\"'])(.-)%2") do
  332.         out[tag] = value
  333.     end
  334.     return out
  335. end
  336. xml.attribFunc = function(currentXml,funcs)
  337.     local attributes = xml.parse(currentXml)
  338.     for k,v in next,funcs do
  339.         if attributes[v.attribute] then
  340.             v.func(attributes[v.attribute])
  341.         end
  342.     end
  343. end
  344. xml.addAttrib = function(currentXml,out,launch)
  345.     local parameters = stringmatch(currentXml,"<P (.-)/>") or ""
  346.     for k,v in next,out do
  347.         if not stringfind(parameters,v.tag) then
  348.             currentXml = stringgsub(currentXml,"<P (.-)/>",function(attribs)
  349.                 return stringformat("<P %s=\"%s\" %s/>",v.tag,v.value,attribs)
  350.             end)
  351.         end
  352.     end
  353.     if launch then
  354.         tfm.exec.newGame(currentXml)
  355.     else
  356.         return currentXml
  357.     end
  358. end
  359. xml.getCoordinates = function(s)
  360.     if stringfind(s,";") then
  361.         local x,y
  362.         local axis,value = stringmatch(s,"(%a);(%d+)")
  363.         value = tonumber(value)
  364.         if value then
  365.             if axis == "x" then x = value else y = value end
  366.         end
  367.         return x or 0,y or 0
  368.     else
  369.         local pos = {}
  370.         for x,y in stringgmatch(s,"(%d+) ?, ?(%d+)") do
  371.             pos[#pos+1] = {x = x,y = y}
  372.         end
  373.         return pos
  374.     end
  375. end
  376.  
  377. --[[ Game Mode System ]]--
  378. system.normalizedModeName = function(name,back)
  379.     if back then
  380.         name = stringgsub(name,"%+","P") -- Test+ = TestP
  381.     else
  382.         name = stringgsub(name,"P$","+") -- TestP = Test+
  383.     end
  384.     return name
  385. end
  386.  
  387. system.submodes = {}
  388.  
  389. system.gameMode = module._NAME
  390. system.modeChanged = os.time() + 10e3
  391.  
  392. system.getGameMode = function(value,notFirst)
  393.     local found,submode = tablefind(system.submodes,stringlower(value),nil,stringlower)
  394.     if found then
  395.         system.gameMode = system.normalizedModeName(system.submodes[submode],true)
  396.        
  397.         if notFirst then
  398.             eventModeChanged()
  399.         end
  400.        
  401.         system.modeChanged = os.time() + 10e3
  402.     end
  403.     return found
  404. end
  405.  
  406. --[[ Modes ]]--
  407. mode = setmetatable({},{
  408.     __newindex = function(list,key,value)
  409.         rawset(list,key,value)
  410.         system.submodes[#system.submodes+1] = system.normalizedModeName(key,false)
  411.     end
  412. })
  413.  
  414. --[[ Grounds ]]--
  415. mode.grounds = {
  416.     -- Translations
  417.     translations = {
  418.         en = {
  419.             -- Data
  420.             grounds = {
  421.                 -- Ground, Description
  422.                 [0] = {"Wood","?","?"},
  423.                 [1] = {"Ice","Increases your speed by pressing spacebar","Increases the speed in <BL>%s%%</BL>"},
  424.                 [2] = {"Trampoline","?","?"},
  425.                 [3] = {"Lava","Teleports you to the last Z indexed ground","?"},
  426.                 [4] = {"Chocolate","?","?"},
  427.                 [5] = {"Earth","?","?"},
  428.                 [6] = {"Grass","?","?"},
  429.                 [7] = {"Sand","Creates a sand storm","Decreases the storm in <BL>%s%%</BL>"},
  430.                 [8] = {"Cloud","Enables you to fly by pressing spacebar","Increases the fly in <BL>%s%%</BL>"},
  431.                 [9] = {"Water","Drowns you","Drowns you <BL>%s%%</BL> slower"},
  432.                 [10] = {"Stone","Creates a block of stone by pressing spacebar","Increases the block size in <BL>%s%%</BL>"},
  433.                 [11] = {"Snow","Shoots snowballs by pressing spacebar","Increases the snowball speed in <BL>%s%%</BL>"},
  434.                 [12] = {"Rectangle","Each color has its own function","?",{
  435.                     ["C90909"] = "Kills you",
  436.                     ["18C92B"] = "Revives all the enemies",
  437.                     ["555D77"] = "Respawning Checkpoint",
  438.                 }},
  439.                 [13] = {"Circle","Each color has its own function","?"},
  440.                 [14] = {"Invisible","?","?"},
  441.                 [15] = {"Spiderweb","Teleports you to the spawn point","?"},
  442.             },
  443.             categories = {
  444.                 [1] = "Often long maps that, in most of the cases, the players must pass the same obstacles more than once.",
  445.                 [2] = "Usually long maps with dodgeable spiderwebs or lavas, sometimes using invisible waters to simule a fly.",
  446.                 [3] = "Harder maps that requires multiple skills to be completed.",
  447.                 [4] = "Maps that has as main obstacle the water drowning.",
  448.                 [5] = "Maps based mainly on lava teleports.",
  449.                 [6] = "Maps that requires a new skill, with mechanisms or something that makes you think before act.",
  450.                 [7] = "Maps based on speed and agility, built mostly with ice grounds.",
  451.                 [8] = "Maps based on snowball mechanisms/technics.",
  452.                 [9] = "Maps with different gameplays that doesn't fit any other category, also locates the <i>vanilla maps</i>.",
  453.                 [10] = "Soloable (mostly) maps, but with faster paths when the players work together.",
  454.                 [11] = "Maps with vampires.",
  455.                 [12] = "Houses without gameplay, only a place for noobs.",
  456.             },
  457.  
  458.             -- Init
  459.             welcome = "Welcome to #%s! Can you be the fastest mouse using the ground effects? Try it!\n<PS>Press H for more info!",
  460.             developer = "Developed by %s",
  461.            
  462.             -- Shop
  463.             shop = {
  464.                 coin = "Coins",
  465.                 power = "Ground power",
  466.                 upgrade = "Upgrade",
  467.                 price = "Upgrade price",
  468.                 close = "Close",
  469.             },
  470.             bought = "You just spent %s coins for the ground %s!",
  471.             cantbuy = "You haven't coins enough in order to buy this upgrade! :(",
  472.            
  473.             -- Profile
  474.             profile = "Leaderboard : %s\n\n<N>Rounds : %s\n<N>Podiums : %s\n\n<N>Deaths : %s\n\n<N>Shop Coins : %s",
  475.            
  476.             -- Gameplay
  477.             gotcoin = "You just got %s coins! :D",
  478.             zombie = "Now you are a zombie!",
  479.             countstats = {
  480.                 mice = "At least 5 mice are needed to stats count",
  481.                 tribe = "Stats do not count in tribe houses"
  482.             },
  483.            
  484.             -- New map
  485.             powersenabled = "The ground powers were enabled! Good luck!",
  486.             tribehouse = "This is a House place. No stats, no gameplay. Enjoy with your friends",
  487.            
  488.             -- Language
  489.             language = "Current language : <J>%s",
  490.            
  491.             -- Settings
  492.             password = {
  493.                 on = "New password : %s",
  494.                 off = "Password disabled!"
  495.             },
  496.            
  497.             -- Commands
  498.             commands = {
  499.                 shop = "shop",
  500.                 profile = "profile",
  501.                 help = "help",
  502.                 langue = "langue",
  503.                 leaderboard = "leaderboard",
  504.                 info = "info",
  505.                 pw = "password",
  506.                 mapinfo = "mapinfo",
  507.             },
  508.            
  509.             -- Menu
  510.             menu = {
  511.                 [1] = {"%s","\tYour aim in this minigame is to collect the cheese the faster you can, using the effects each ground offers."},
  512.                 [2] = {"Ground effects","Click in the ground's name to read more.\n\n%s"},
  513.                 [3] = {"Commands",{
  514.                     [1] = {"\t<J>» User</J>\n",{
  515.                         [1] = "<VP>!%s</VP> <PS>playerName</PS> <R>or</R> <VP>Key P</VP> - Opens the profile!",
  516.                         [2] = "<VP>!%s</VP> <R>or</R> <VP>Key O</VP> - Opens the shop!",
  517.                         [3] = "<VP>!%s</VP> - Changes the language!",
  518.                     }},
  519.                     [2] = {"\n\t<J>» Others</J>\n",{
  520.                         [1] = "<VP>!%s</VP> <R>or</R> <VP>Key H</VP> - Opens the help menu!",
  521.                         [2] = "<VP>!%s</VP> - Opens the leaderboard!",
  522.                         [3] = "<VP>!%s</VP> - Opens the help according to the ground you are on!",
  523.                         [4] = "<VP>!%s</VP> - Displays the map info if it is in the rotation!",
  524.                     }},
  525.                     [3] = {"\n\t<J>» Room admin</J>\n",{
  526.                         [1] = "<VP>!%s</VP> <PS>password</PS> - Adds or removes a password in the room!",
  527.                     }},
  528.                 }},
  529.                 [4] = {"Maps","<J>Maps : %s\n\n\tAccess %s and send your map. Do not forget to read all the rules before!"},
  530.                 [5] = {"Thanks for","<R>%s <G>- <N>Developer\n%s <G>- <N>Translators\n%s <G>- <N>Map evaluators"},
  531.             },
  532.             max = "15a2df47d2e",
  533.         },
  534.         br = {
  535.             grounds = {
  536.                 [0] = {"Madeira","?","?"},
  537.                 [1] = {"Gelo","Aumenta sua velocidade ao pressionar a barra de espaço","Aumenta a velocidade em <BL>%s%%</BL>"},
  538.                 [2] = {"Trampolim","?","?"},
  539.                 [3] = {"Lava","Teletransporta-o para o piso de Z anterior","?"},
  540.                 [4] = {"Chocolate","?","?"},
  541.                 [5] = {"Terra","?","?"},
  542.                 [6] = {"Grama","?","?"},
  543.                 [7] = {"Areia","Cria uma tempestade de areia","Diminui a tempestade em <BL>%s%%</BL>"},
  544.                 [8] = {"Nuvem","Permite o voo ao pressionar a barra de espaço","Aumenta o voo em <BL>%s%%</BL>"},
  545.                 [9] = {"Água","Afoga-o","Afoga-o <BL>%s%%</BL> mais devagar"},
  546.                 [10] = {"Pedra","Cria um bloco de pedra ao pressionar a barra de espaço","Aumenta o tamanho do bloco em <BL>%s%%</BL>"},
  547.                 [11] = {"Neve","Atira bolas de neve ao pressionar a barra de espaço","Aumenta a velocidade da bola de neve em <BL>%s%%</BL>"},
  548.                 [12] = {"Retângulo","Cada cor tem sua própria função","?",{
  549.                     ["C90909"] = "Mata-o",
  550.                     ["18C92B"] = "Revive todos os inimigos",
  551.                     ["555D77"] = "Checkpoint para reviver",
  552.                 }},
  553.                 [13] = {"Círculo","Cada cor tem sua própria função","?","?"},
  554.                 [14] = {"Invisível","?","?"},
  555.                 [15] = {"Teia de aranha","Teletransporta-o para o ponto de spawn","?"},
  556.             },
  557.             categories = {
  558.                 [1] = "Geralmente mapas longos que, na maioria dos casos, os jogadores devem passar pelo mesmo obstáculo mais de uma vez.",
  559.                 [2] = "Geralmente mapas grandes com teias de aranha ou lavas desviáveis, às vezes usando águas invisíveis para simular voo.",
  560.                 [3] = "Mapas mais difíceis que requem múltiplas habilidades para serem completados.",
  561.                 [4] = "Mapas que tem como obstáculo principal o afogamento na água.",
  562.                 [5] = "Mapas baseados principalmente em teleportes de lava.",
  563.                 [6] = "Mapas que requerem novas habilidades, com mecanismos ou algo que o faça pensar antes de agir.",
  564.                 [7] = "Mapas baseados em velocidade e agilidade, construídos em sua maioria por pisos de gelo.",
  565.                 [8] = "Mapas baseados em mecanismos/técnicas com bolas de neve.",
  566.                 [9] = "Mapas com gameplays diferentes que não se encaixam em nenhuma outra categoria, também dá espaço aos <i>mapas vanilla</i>.",
  567.                 [10] = "Mapas em que você pode completar sozinho (em maioria), mas com caminhos mais rápidos quando há trabalho em equipe entre os jogadores.",
  568.                 [11] = "Mapas com vampiros.",
  569.                 [12] = "Casas sem jogabilidade, apenas um lugar para noobs.",
  570.             },
  571.            
  572.             welcome = "Bem-vindo ao #%s! Você pode ser o rato mais rápido usando os efeitos dos pisos? Prove!\n<PS>Pressione H para mais informações!",
  573.             developer = "Desenvolvido por %s",
  574.            
  575.             shop = {
  576.                 coin = "Moedas",
  577.                 power = "Poder do piso",
  578.                 upgrade = "Melhorar",
  579.                 price = "Preço de aprimoramento",
  580.                 close = "Fechar",
  581.             },
  582.             bought = "Você acaba de gastar %s moedas pelo piso %s!",
  583.             cantbuy = "Você não tem moedas suficientes para comprar esta atualização! :(",
  584.            
  585.             profile = "Rank : %s\n\n<N>Partidas : %s\n<N>Pódios : %s\n\n<N>Mortes : %s\n\n<N>Moedas na loja : %s",
  586.            
  587.             gotcoin = "Você acaba de conseguir %s moedas! :D",
  588.             zombie = "Agora você é um zumbi!",
  589.             countstats = {
  590.                 mice = "Ao menos 5 ratos são necessários para as estatísticas serem contabilizadas",
  591.                 tribe = "Estatísticas não são contabilizadas em cafofos de tribo"
  592.             },
  593.            
  594.             powersenabled = "Os poderes dos pisos foram ativados! Boa sorte!",
  595.             tribehouse = "Este lugar é uma casa. Sem estatísticas, sem gameplay. Divirta-se com seus amigos",
  596.            
  597.             language = "Idioma atual : <J>%s",
  598.            
  599.             password = {
  600.                 on = "Nova senha : %s",
  601.                 off = "Senha desativada!"
  602.             },
  603.  
  604.             commands = {
  605.                 shop = "loja",
  606.                 profile = "perfil",
  607.                 help = "ajuda",
  608.                 langue = "idioma",
  609.                 leaderboard = "rank",
  610.                 info = "info",
  611.                 pw = "senha",
  612.             },
  613.            
  614.             menu = {
  615.                 [1] = {"%s","\tSeu objetivo neste mini-game é coletar o queijo o mais rápido possível, utilizando os efeitos que cada piso oferecer."},
  616.                 [2] = {"Efeitos dos pisos","Clique no nome do piso para ler mais.\n\n%s"},
  617.                 [3] = {"Comandos",{
  618.                     [1] = {"\t<J>» Usuário</J>\n",{
  619.                         [1] = "<VP>!%s</VP> <PS>nomeDoJogador</PS> <R>ou</R> <VP>Tecla P</VP> - Abre o perfil!",
  620.                         [2] = "<VP>!%s</VP> <R>ou</R> <VP>Tecla O</VP> - Abre a loja!",
  621.                         [3] = "<VP>!%s</VP> - Altera o idioma!",
  622.                     }},
  623.                     [2] = {"\n\t<J>» Outros</J>\n",{
  624.                         [1] = "<VP>!%s</VP> <R>ou</R> <VP>Tecla H</VP> - Abre o menu de ajuda!",
  625.                         [2] = "<VP>!%s</VP> - Abre o ranking!",
  626.                         [3] = "<VP>!%s</VP> - Abre a ajuda de acordo com o piso que você está pisando!",
  627.                         [4] = "<VP>!%s</VP> - Mostra as informações do mapa se estiver na rotação!",
  628.                     }},
  629.                     [3] = {"\n\t<J>» Administrador da sala</J>\n",{
  630.                         [1] = "<VP>!%s</VP> <PS>senha</PS> - Adiciona ou remove uma senha na sala!",
  631.                     }},
  632.                 }},
  633.                 [4] = {"Mapas","<J>Mapas : %s\n\n\tAcesse %s e envie seu mapa. Não se esqueça de ler todas as regras antes!"},
  634.                 [5] = {"Agradecimentos","<R>%s <G>- <N>Desenvolvedor\n%s <G>- <N>Tradutores\n%s <G>- <N>Avaliadores de mapa"},
  635.             },
  636.             max = "15a2df3e699",
  637.         },
  638.         es = {
  639.             grounds = {
  640.                 [0] = {"Madera","?","?"},
  641.                 [1] = {"Hielo","Incrementa tu velocidad apretando espacio","Aumenta la velocidad en <BL>%s%%</BL>"},
  642.                 [2] = {"Trampolín","?","?"},
  643.                 [3] = {"Lava","Te teletransporta al suelo que tenga el último Z index","?"},
  644.                 [4] = {"Chocolate","?","?"},
  645.                 [5] = {"Tierra","?","?"},
  646.                 [6] = {"Hierba","?","?"},
  647.                 [7] = {"Arena","Crea una tormenta de arena","Disminuye la tormenta en <BL>%s%%</BL>"},
  648.                 [8] = {"Nube","Te permite volar presionando espacio","Aumenta el vuelo en <BL>%s%%</BL>"},
  649.                 [9] = {"Agua","Te ahogas","Te ahogas <BL>%s%%</BL> más lento"},
  650.                 [10] = {"Piedra","Crea un bloque de piedra presionando espacio","Aumenta el tamaño del bloque en <BL>%s%%</BL>"},
  651.                 [11] = {"Nieve","Dispara bolas de nieve presionando espacio","Aumenta la velocidad de la bola de nieve en <BL>%s%%</BL>"},
  652.                 [12] = {"Rectángulo","Cada color tiene su propia función","?",{
  653.                     ["C90909"] = "Te mata",
  654.                     ["18C92B"] = "Revive todos los enemigos",
  655.                     ["555D77"] = "Respawning Checkpoint", -- *
  656.                 }},
  657.                 [13] = {"Círculo","Cada color tiene su propia función","?"},
  658.                 [14] = {"Invisible","?","?"},
  659.                 [15] = {"Tela de araña","Te teletransporta al punto de aparición","?"},
  660.             },
  661.             categories = {
  662.                 [1] = "Mapas que, en la mayoría de los casos, los jugadores deben pasar obstaculos más de una vez.",
  663.                 [2] = "Usualmente mapas largos con telas de araña y lavas esquivables, algunas veces usando agua invisible para simular un vuelo.",
  664.                 [3] = "Mapas difíciles que necesitan una gran habilidad para completarlos.",
  665.                 [4] = "Mapas que tienen un obstáculo principal: el agua. ¡Te puedes ahogar!.",
  666.                 [5] = "Mapas basados principalmente en teletransportes de lava.",
  667.                 [6] = "Mapas que necesitan una nueva habilidad, con mecanismos o algo que te haga pensar antes de actuar.",
  668.                 [7] = "Mapas basados en la velocidad del jugador, construidos mayoritariamente con suelos de hielo.",
  669.                 [8] = "Mapas basados en mecanismos/técnicas con nieve.",
  670.                 [9] = "Mapas con un gameplay diferente que no entran en otra categoría, también localizados en los <i>mapas vanilla</i>.",
  671.                 [10] = "Mapas que (mayoritariamente) pueden ser completados solo, pero con patrones rápidos donde los jugadores necesitan trabajar juntos.",
  672.                 [11] = "Mapas con vampiros.",
  673.                 [12] = "Houses without gameplay, only a place for noobs",
  674.             },
  675.            
  676.             welcome = "Bienvenido a #%s! Podrás ser el más rápido usando los efectos de los suelos? Inténtalo!\n<PS>Presiona H para más información!",
  677.             developer = "Programado por %s",
  678.            
  679.             shop = {
  680.                 coin = "Monedas",
  681.                 power = "Potencia del suelo",
  682.                 upgrade = "Mejorar",
  683.                 price = "Precio de la mejora",
  684.                 close = "Cerrar",
  685.             },
  686.             bought = "Has gastado %s monedas para el suelo %s!",
  687.             cantbuy = "No tienes las suficientes monedas para comprar esta mejora! :(",
  688.  
  689.             profile = "Tabla de líderes : %s\n\n<N>Rondas : %s\n<N>Podios : %s\n\n<N>Muertes : %s\n\n<N>Monedas : %s",
  690.  
  691.             gotcoin = "Has obtenido %s monedas! :D",
  692.             zombie = "Ahora eres un Zombi!",
  693.             countstats = {
  694.                 mice = "Por lo menos 5 ratones son necesarios para contar estadísticas",
  695.                 tribe = "Las estadísticas no cuentan en casas de tribu"
  696.             },
  697.            
  698.             powersenabled = "Los poderes de los suelos han sido activados! Buena suerte!",
  699.             -- *
  700.            
  701.             language = "Idioma actual : <J>%s",
  702.            
  703.             password = {
  704.                 on = "Nueva contraseña : %s",
  705.                 off = "Contraseña desactivada!"
  706.             },
  707.            
  708.             commands = {
  709.                 shop = "tienda",
  710.                 profile = "perfil",
  711.                 help = "ayuda",
  712.                 langue = "idioma",
  713.                 leaderboard = "ranking",
  714.                 info = "info",
  715.                 pw = "contraseña",
  716.             },
  717.            
  718.             menu = {
  719.                 [1] = {"%s","\tTu objetivo en este juego es agarrar el queso lo más rápido que puedas, usando los efectos que cada suelo ofrece."},
  720.                 [2] = {"Efectos de suelo","Clickea en el nombre del suelo para leer más.\n\n%s"},
  721.                 [3] = {"Comandos",{
  722.                     [1] = {"\t<J>» Usuario</J>\n",{
  723.                         [1] = "<VP>!%s</VP> <PS>nombreDeUsuario</PS> <R>o</R> <VP>Tecla P</VP> - Abre el perfil!",
  724.                         [2] = "<VP>!%s</VP> <R>o</R> <VP>Tecla O</VP> - Abre la tienda!",
  725.                         [3] = "<VP>!%s</VP> - Cambia el idioma!\n",
  726.                     }},
  727.                     [2] = {"\t<J>» Otros</J>\n",{
  728.                         [1] = "<VP>!%s</VP> <R>o</R> <VP>Tecla H</VP> - Abre el menu de ayuda!",
  729.                         [2] = "<VP>!%s</VP> - Abre el ranking!",
  730.                         [3] = "<VP>!%s</VP> - Abre la guía del suelo en el que estás!",
  731.                         [4] = "<VP>!%s</VP> - Muestra la información del mapa si está en la rotación!",
  732.                     }},
  733.                     [3] = {"\n\t<J>» Admin de la sala</J>\n",{
  734.                         [1] = "<VP>!%s</VP> <PS>contraseña</PS> - Activa o desactiva la contraseña en la sala.",
  735.                     }},
  736.                 }},
  737.                 [4] = {"Mapas","<J>Mapas : %s\n\n\tEntra a %s y envía tu mapa. No olvides leer las reglas antes!"},
  738.                 [5] = {"Agradecimientos","<R>%s <G>- <N>Programador\n%s <G>- <N>Traductores\n%s <G>- <N>Evaluadores de mapas"},
  739.             },
  740.             max = "15a2df3e699",
  741.         },
  742.         fr = {
  743.             grounds = {
  744.                 [0] = {"Bois","?","?"},
  745.                 [1] = {"Glace","Augmente votre vitesse en appuyant sur Espace","Augmente la vitesse de <BL>%s%%</BL>"},
  746.                 [2] = {"Trampoline","?","?"},
  747.                 [3] = {"Lave","Vous téléporte au sol avec le dernier indice Z","?"},
  748.                 [4] = {"Chocolat","?","?"},
  749.                 [5] = {"Terre","?","?"},
  750.                 [6] = {"Herbe","?","?"},
  751.                 [7] = {"Sable","Crée une tempête de sable","Diminue la tempête de <BL>%s%%</BL>"},
  752.                 [8] = {"Nuage","Vous donne la possibilité de voler en appuyant sur Espace","Augmente le vol de <BL>%s%%</BL>"},
  753.                 [9] = {"Eau","Vous noie","Vous noie <BL>%s%%</BL> plus lentement"},
  754.                 [10] = {"Pierre","Crée un bloc de pierre en appuyant sur Espace","Augmente la taille du bloc de <BL>%s%%</BL>"},
  755.                 [11] = {"Neige","Tire des boules de neige en appuyant sur Espace","Augmente la vitesse de la boule de neige de <BL>%s%%</BL>"},
  756.                 [12] = {"Rectangle","Chaque couleur a sa propre fonction","?",{
  757.                     ["C90909"] = "Te tue",
  758.                     ["18C92B"] = "Ressuscite tous les ennemis",
  759.                     ["555D77"] = "Respawning Checkpoint", -- *
  760.                 }},
  761.                 [13] = {"Cercle","Chaque couleur a sa propre fonction","?"},
  762.                 [14] = {"Invisible","?","?"},
  763.                 [15] = {"Toile d'araignée","Vous téléporte au point de spawn","?"},
  764.             },
  765.             -- *
  766.            
  767.             welcome = "Bienvenue à #%s! Pouvez vous être la souris la plus rapide grâce aux effets des sols? Essayez!\n<PS>Appuyez sur H pour plus d'informations!",
  768.             developer = "Développé par %s",
  769.  
  770.             shop = {
  771.                 coin = "Pièces",
  772.                 power = "Force du sol",
  773.                 upgrade = "Améliorer",
  774.                 price = "Coût d'amélioration",
  775.                 close = "Fermer",
  776.             },
  777.             bought = "Vous venez de dépenser %s pièces pour le sol %s!",
  778.             cantbuy = "Vous n'avez pas assez de pièces pour acheter cette amélioration! :(",
  779.            
  780.             profile = "Leaderboard : %s\n\n<N>Parties : %s\n<N>Podiums : %s\n\n<N>Morts : %s\n\n<N>Shop Pièces : %s",
  781.            
  782.             gotcoin = "Vous venez de recevoir %s pièces! :D",
  783.             countstats = {
  784.                 mice = "Au moins 5 souris sont nécessaires pour que les statistiques comptent",
  785.                 tribe = "Les statistiques ne comptent pas en maison de tribu"
  786.             },
  787.             zombie = "Vous êtes maintenant un zombie!",
  788.            
  789.             powersenabled = "Les pouvoirs des sols ont été activés! Bonne chance!",
  790.             -- *
  791.    
  792.             language = "Langage actuel : <J>%s",
  793.            
  794.             password = {
  795.                 on = "Nouveau mot de passe : %s",
  796.                 off = "Mot de passe désactivé!"
  797.             },
  798.            
  799.             commands = {
  800.                 shop = "magasin",
  801.                 profile = "profil",
  802.                 help = "aide",
  803.                 langue = "langue",
  804.                 leaderboard = "leaderboard",
  805.                 info = "info",
  806.                 pw = "password",
  807.             },
  808.            
  809.             menu = {
  810.                 [1] = {"%s","\tVotre but dans ce minijeu est de collecter le fromage aussi vite que possible, en utilisant les effets des différents sols."},
  811.                 [2] = {"Effets du sol","Clique sur le nom du salon pour en lire plus.\n\n%s"},
  812.                 [3] = {"Commandes",{
  813.                     [1] = {"\t<J>» Joueur</J>\n",{
  814.                         [1] = "<VP>!%s</VP> <PS>playerName</PS> <R>ou</R> <VP>Touche P</VP> - Ouvre le profil !",
  815.                         [2] = "<VP>!%s</VP> <R>ou</R> <VP>Touche O</VP> - Ouvre le magasin !",
  816.                         [3] = "<VP>!%s</VP> - Change la langue !\n",
  817.                     }},
  818.                     [2] = {"\t<J>» Autres</J>\n",{
  819.                         [1] = "<VP>!%s</VP> <R>ou</R> <VP>Touche H</VP> - Ouvre le menu d'aide !",
  820.                         [2] = "<VP>!%s</VP> - Ouvre le leaderboard!",
  821.                         [3] = "<VP>!%s</VP> - Ouvre l'aide en fonction du sol sur lequel vous vous trouvez!",
  822.                         [4] = "<VP>!%s</VP> - Affiche les informations de la carte si elle est dans la rotation!"
  823.                     }},
  824.                     [3] = {"\n\t<J>» Place admin</J>\n",{
  825.                         [1] = "<VP>!%s</VP> <PS>mot de passe</PS> - Ajoute ou supprime un mot de passe dans la chambre.",
  826.                     }},
  827.                 }},
  828.                 [4] = {"Cartes","<J>Cartes : %s\n\n\tAccédez à %s et envoyez votre carte. N'oubliez pas de lire toutes les règles avant!"},
  829.                 [5] = {"Merci à","<R>%s <G>- <N>Développeur\n%s <G>- <N>Traducteurs\n%s <G>- <N>Evaluateurs de maps"},
  830.             },
  831.             -- *
  832.         },
  833.         pl = {
  834.             grounds = {
  835.                 [0] = {"Drewno","?","?"},
  836.                 [1] = {"Lód","Zwiększa twoją szybkość, gdy klikasz spację","Zwiększa prędkość w <BL>%s%%</BL>"},
  837.                 [2] = {"Trampolina","?","?"},
  838.                 [3] = {"Lawa","Przenosi ciebie do ostatniego indexu Z","?"},
  839.                 [4] = {"Czekolada","?","?"},
  840.                 [5] = {"Ziemia","?","?"},
  841.                 [6] = {"Trawa","?","?"},
  842.                 [7] = {"Piasek","Tworzy burzę piaskową","Zmniejsza storm w <BL>%s%%</BL>"},
  843.                 [8] = {"Chmura","Pozwala tobie latać, gdy klikasz spację","Zwiększa latanie w <BL>%s%%</BL>"},
  844.                 [9] = {"Woda","Topi ciebie","Topi <BL>%s%%</BL> wolniej"},
  845.                 [10] = {"Kamień","Powoduje, że możesz stworzyć blok kamienia, wciskając spację","Zwiększa wielkość bloku w <BL>%s%%</BL>"},
  846.                 [11] = {"Śnieg","Powoduje, że możesz strzelić śnieżką, wciskając spację","Zwiększa prędkość śnieżki w <BL>%s%%</BL>"},
  847.                 [12] = {"Trójkąt","Każdy kolor ma swoją funkcję","?",{
  848.                     ["C90909"] = "Zabija ciebie",
  849.                     ["18C92B"] = "Ożywia wszystkich przeciwników",
  850.                     ["555D77"] = "Ponowne spawnowanie Checkpointów",
  851.                 }},
  852.                 [13] = {"Koło","Każdy kolor ma swoją funkcję","?"},
  853.                 [14] = {"Niewidzialność","?","?"},
  854.                 [15] = {"Pajęcza sieć","Przenosi ciebie do miejsca spawnu","?"},
  855.             },
  856.             categories = {
  857.                 [1] = "Często długie mapy, w większości przypadków, gracze muszą przejść takie same przeszkody.",
  858.                 [2] = "Zwyczajnie długie mapy z lawami i pajęczynami, czasami używana woda aby zasymulować latanie.",
  859.                 [3] = "Trudniejsze mapy, które wymagają większej ilości zdolności, aby zostały ukończone.",
  860.                 [4] = "Mapy, które jako główną mapę mają wodę, w której myszki się topią.",
  861.                 [5] = "Mapy bazowane głównie na teleportacji z lawy.",
  862.                 [6] = "Mapy, które wymagają nowej zdolności, z mechanizmem albo czymś co powoduje, że musisz myśleć zanim coś zrobisz.",
  863.                 [7] = "Mapy bazowane na szybkości i zwinności, budowane najczęsciej z gruntów lodu.",
  864.                 [8] = "Mapy bazowane na technikach/mechanikach śnieżnych kulek.",
  865.                 [9] = "Mapy z zupełnie inną rozgrywką niż inne kategorie, również znaduje się w <I>mapach vanilliowych</I>.",
  866.                 [10] = "Mapy (w większości) zdolne do przejścia samemu, ale szybciej się ją przechodzi gdy gracze pracują wspólnie.",
  867.                 [11] = "Mapy z wampirami.",
  868.                 [12] = "Chatki plemienne bez rozgrywki, są miejscem tylko dla noobków.",
  869.             },
  870.            
  871.             welcome = "Witaj w #%s! Możesz zostać najszybszą myszką, używając moce gruntów? Spróbuj!\n<PS>Wciśnij H, aby otrzymać więcej informacji!",
  872.             developer = "Stworzone przez %s",
  873.            
  874.             shop = {
  875.                 coin = "Kredyty",
  876.                 power = "Moc gruntu",
  877.                 upgrade = "Ulepsz",
  878.                 price = "Cena ulepszenia",
  879.                 close = "Zamknij",
  880.             },
  881.             bought = "Wydałeś %s monet na %s!",
  882.             cantbuy = "Nie masz wystarczającej ilości monet, żeby zakupić to ulepszenie! :(",
  883.            
  884.             profile = "Ranking : %s\n\n<N>Rund : %s\n<N>Podia : %s\n\n<N>Zgony : %s\n\n<N>Monety : %s",
  885.  
  886.             gotcoin = "Masz %s monet! :D",
  887.             zombie = "Zostałeś/-aś zombie!",
  888.             countstats = {
  889.                 mice = "Przynajmniej 5 myszek jest potrzebnych aby statystyki były naliczane",
  890.                 tribe = "Statystyki nie są naliczane w chatkach plemiennych"
  891.             },
  892.  
  893.             powersenabled = "Moce gruntów są włączone! Powodzenia!",
  894.             tribehouse = "To jest miejsce chatki plemiennej. Bez statystyk, bez rozgrywki. Ciesz się ze swoimi znajomymi.",
  895.  
  896.             language = "Bieżący język : <J>%s",
  897.            
  898.             password = {
  899.                 on = "Nowe hasło : %s",
  900.                 off = "Hasło wyłączone!"
  901.             },
  902.            
  903.             commands = {
  904.                 shop = "sklep",
  905.                 profile = "profil",
  906.                 help = "pomoc",
  907.                 langue = "język",
  908.                 leaderboard = "ranking",
  909.                 info = "informacje",
  910.                 pw = "hasło",
  911.             },
  912.            
  913.             menu = {
  914.                 [1] = {"%s","\tTwoim zadaniem w tej minigrze jest zbieranie serka najszybciej jak potrafisz, wykorzystując moce gruntów."},
  915.                 [2] = {"Moce gruntu","Kliknij w nazwę gruntu, żeby uzyskać więcej informacji.\n\n%s"},
  916.                 [3] = {"Komendy",{
  917.                     [1] = {"\t<J>» Użytkowe</J>\n",{
  918.                         [1] = "<VP>!%s</VP> <PS>nazwaGracza</PS> <R>albo</R> <VP>Klawisz P</VP> - Otwiera profil!",
  919.                         [2] = "<VP>!%s</VP> <R>albo</R> <VP>Klawisz O</VP> - Otwiera Sklep!",
  920.                         [3] = "<VP>!%s</VP> - Zmienia język!",
  921.                     }},
  922.                     [2] = {"\t<J>» Inne</J>\n",{
  923.                         [1] = "<VP>!%s</VP> <R>albo</R> <VP>Klawisz H</VP> - Otwiera pomoc!",
  924.                         [2] = "<VP>!%s</VP> - Otwiera ranking!",
  925.                         [3] = "<VP>!%s</VP> - Otwiera pomoc zależnie, na którym gruncie jesteś!",
  926.                         [4] = "<VP>!%s</VP> - Pokazuje informacje o mapie jeżeli jest w rotacji!",
  927.                     }},
  928.                     [3] = {"\n\t<J>» Pokój z adminem</J>\n",{
  929.                         [1] = "<VP>!%s</VP> <PS>hasło</PS> - Dodaje lub usuwa hasło w pokoju.",
  930.                     }},
  931.                 }},
  932.                 [4] = {"Mapy","<J>Mapy : %s\n\n\tStwórz %s i prześlij swoją mapę. Nie zapomnij, aby najpierw przeczytać zasady!"},
  933.                 [5] = {"Podziękowania","<R>%s <G>- <N>Twórca\n%s <G>- <N>Tłumacze\n%s <G>- <N>Testerzy map"},
  934.             },
  935.             max = "15a2df4de75",
  936.         },
  937.         hu = {
  938.             grounds = {
  939.                 [0] = {"Fa","?","?"},
  940.                 [1] = {"Jég","Növeli a sebességedet, ha megnyomod a Szóközt","Növeli a sebességet <BL>%s%%</BL>-kal"},
  941.                 [2] = {"Trambulin","?","?"},
  942.                 [3] = {"Láva","Elteleportál téged a legutóbbi Z index talajhoz","?"},
  943.                 [4] = {"Csoki","?","?"},
  944.                 [5] = {"Föld","?","?"},
  945.                 [6] = {"Füves talaj","?","?"},
  946.                 [7] = {"Homok","Homokvihart hoz létre","Csökkenti a sebességet <BL>%s%%</BL>-kal"},
  947.                 [8] = {"Felhő","Lehetővé teszi számodra a repülést, ha megnyomod a Szóközt","Növeli a repülést <BL>%s%%</BL>-kal"},
  948.                 [9] = {"Víz","Megfullaszt téged","Megfullaszt <BL>%s%%</BL>-kal lassabban"},
  949.                 [10] = {"Kő","Egy kőtömböt hoz létre, ha megnyomod a Szóközt","Növeli a blokk méretét <BL>%s%%</BL>-kal"},
  950.                 [11] = {"Hó","Hógolyót lő, ha megnyomod a Szóközt","Növeli a hógolyó sebességét <BL>%s%%</BL>-kal"},
  951.                 [12] = {"Téglalap","Mindegyik színnek megvan a saját szerepe","?",{
  952.                     ["C90909"] = "Megöl téged",
  953.                     ["18C92B"] = "Újraéleszti az összes ellenséget",
  954.                     ["555D77"] = "Újraéledő Ellenőrzőpont",
  955.                 }},
  956.                 [13] = {"Kör","Mindegyik színnek megvan a saját szerepe","?"},
  957.                 [14] = {"Láthatatlan","?","?"},
  958.                 [15] = {"Pókháló","Elteleportál téged a kezdőpontra","?"},
  959.             },
  960.             -- *
  961.            
  962.             welcome = "Üdvözöllek a #%s! Sikerül neked a leggyorsabb egérré válni a talajhatások használatával? Próbáld ki!\n<PS>Nyomd meg a H betűt több információért!",
  963.             developer = "Fejlesztve %s által",
  964.            
  965.             shop = {
  966.                 coin = "Pénzérmék",
  967.                 power = "Talaj ereje",
  968.                 upgrade = "Frissítés",
  969.                 price = "Ár frissítése",
  970.                 close = "Bezárás",
  971.             },
  972.             bought = "Te most költöttél el %s pénzt a talajra %s!",
  973.             cantbuy = "Nincs elég pénzed ahhoz, hogy megvedd ezt a frissítést! :(",
  974.            
  975.             profile = "Ranglista : %s\n\n<N>Körök : %s\n<N>Dobogók : %s\n\n<N>Halálozások : %s\n\n<N>Bolti pénz : %s",
  976.            
  977.             gotcoin = "Te most szereztél %s pénzt! :D",
  978.             zombie = "Most egy zombi vagy!",
  979.             countstats = {
  980.                 mice = "Legalább 5 egérnek kell lennie, hogy statisztikát lehessen számolni",
  981.                 tribe = "A statisztika nem számít a törzsházakban"
  982.             },
  983.            
  984.             powersenabled = "A talajhatások engedélyezve lettek! Sok szerencsét!",
  985.             -- *
  986.            
  987.             language = "Jelenlegi nyelv : <J>%s",
  988.            
  989.             password = {
  990.                 on = "Új jelszó : %s",
  991.                 off = "Jelszó letiltva!"
  992.             },
  993.            
  994.             commands = {
  995.                 shop = "bolt",
  996.                 profile = "profil",
  997.                 help = "súgó",
  998.                 langue = "nyelv",
  999.                 leaderboard = "ranglistát",
  1000.                 info = "infó",
  1001.                 pw = "jelszó",
  1002.             },
  1003.            
  1004.             menu = {
  1005.                 [1] = {"%s","\tA te feladatod ebben a minijátékban az, hogy a lehető leggyorsabban összegyűjtsd a sajtot a talajhatások használatával."},
  1006.                 [2] = {"Talajhatások","Kattints a talaj nevére, hogy több mindent megtudhass.\n\n%s"},
  1007.                 [3] = {"Parancsok",{
  1008.                     [1] = {"\t<J>» Felhasználó</J>\n",{
  1009.                         [1] = "<VP>!%s</VP> <PS>játékosNeve</PS> <R>vagy</R> <VP>P billenytű</VP> - Megnyitja a profilt!",
  1010.                         [2] = "<VP>!%s</VP> <R>vagy</R> <VP>O billentyű</VP> - Megnyitja a boltot!",
  1011.                         [3] = "<VP>!%s</VP> - Megváltoztatja a nyelvet!\n",
  1012.                     }},
  1013.                     [2] = {"\t<J>» Egyebek</J>\n",{
  1014.                         [1] = "<VP>!%s</VP> <R>vagy</R> <VP>H billentyű</VP> - Megnyitja a Súgó menüpontot!",
  1015.                         [2] = "<VP>!%s</VP> - Megnyitja a ranglistát!",
  1016.                         [3] = "<VP>!%s</VP> - Megnyitja a Súgót aszerint, amelyik talajon állsz!",
  1017.                         [4] = "<VP>!%s</VP> - Displays the map info if it is in the rotation!",
  1018.                     }},
  1019.                     [3] = {"\n\t<J>» Szoba admin</J>\n",{
  1020.                         [1] = "<VP>!%s</VP> <PS>jelszó</PS> - Bekapcsolja vagy kikapcsolja a jelszót a szobában!",
  1021.                     }},
  1022.                 }},
  1023.                 [4] = {"Pályák","<J>Pályák : %s\n\n\tEngedélyezd a %s és küldd be a pályádat. Előtte ne felejtsd el elolvasni az összes szabály!"},
  1024.                 [5] = {"Köszönet","<R>%s - Nak <G>- <N>Fejlesztő\n%s <G>- <N>Fordítók\n%s <G>- <N>Pálya értékelők"},
  1025.             },
  1026.             -- *
  1027.         },
  1028.         ar = {
  1029.             grounds = {
  1030.                 [0] = {"خشب","?","?"},
  1031.                 [1] = {"جليد","تزيد من سرعتك عند الضغط على زر المسطرة","يزيد من السرعة ب <BL>%s%%</BL>"},
  1032.                 [2] = {"الترامبولين","?","?"},
  1033.                 [3] = {"الحمم","تنقلك إلى الأرضية التي لديها اَخر رقم في الـ Z","?"},
  1034.                 [4] = {"الشوكولاته","?","?"},
  1035.                 [5] = {"الأرض","?","?"},
  1036.                 [6] = {"العشب","?","?"},
  1037.                 [7] = {"الرمل","تصنع عاصفة رملية","يقلل من العاصفة ب <BL>%s%%</BL>"},
  1038.                 [8] = {"غيمة","تجعلك تطير عن طريق الضغط على زر المسطرة","يزيد من الطيران ب <BL>%s%%</BL>"},
  1039.                 [9] = {"المياه","تغرقك","يغرقك <BL>%s%%</BL> ببطئ"},
  1040.                 [10] = {"الحجارة","تصنع حاجو من الحجارة عن طريق الضغط على زر المسطرة","يزيد من حجم الارضية ب <BL>%s%%</BL>"},
  1041.                 [11] = {"الثلج","تطلق كرات ثلجية عن طريق الضغط على زر المسطرة","يزيد من سرعة كرة الثلج ب <BL>%s%%</BL>"},
  1042.                 [12] = {"مستطيل","كل لون له قوته الخاصة","?",{
  1043.                     ["C90909"] = "يقتلك",
  1044.                     ["18C92B"] = "إعادة الحياة إلى جميع أعدائك",
  1045.                     ["555D77"] = "نقطة العودة للحياة",
  1046.                 }},
  1047.                 [13] = {"الدائرة","كل لون له قوته الخاصة","?"},
  1048.                 [14] = {"الإختفاء","?","?"},
  1049.                 [15] = {"شبكة العنكبوت","تنقلك إلى نقطة البداية","?"},
  1050.             },
  1051.             -- *
  1052.            
  1053.             welcome = "مرحبا إلى #%s! هل يمكنك أن تكون أسرع فأر يستعمل قوى الأرض؟ قم بتجربتها!\n<PS>اضغط على الزر H لمعرفة المزيد!",
  1054.             developer = "مبرمجة من قبل %s",
  1055.            
  1056.             shop = {
  1057.                 coin = "النقود",
  1058.                 power = "طاقة الارضية",
  1059.                 upgrade = "ترقية",
  1060.                 price = "ترقبة السعر",
  1061.                 close = "اغلاق",
  1062.             },
  1063.             bought = "لقد قمت بإستعمال %s من النقود من أجل الأرضية %s!",
  1064.             cantbuy = "لا تملك النقود الكافية لشراء هذا! :(",
  1065.            
  1066.             profile = "لائحة المتقدمين : %s\n\n<N>الجولات : %s\n<N>المناصب : %s\n\n<N>الموت : %s\n\n<N>نقود المتجر : %s",
  1067.            
  1068.             gotcoin = "لقد حصلت على %s نقود! :D",
  1069.             zombie = "أصبحت الأن ميت حي!",
  1070.             countstats = {
  1071.                 mice = "تحتاج الاقل ل 5 فئران لاحصائيات الاعتماد",
  1072.                 tribe = "الاحصائيات لا تحسب بمنزل القبيلة"
  1073.             },
  1074.            
  1075.             powersenabled = "تم تفعيل قوى الأرض! حظا موفقا!",
  1076.             -- *
  1077.            
  1078.             language = "اللغة الحالية : <J>%s",
  1079.            
  1080.             password = {
  1081.                 on = "جديدة سر كلمة : %s",
  1082.                 off = "السر كلمة تعطيل!"
  1083.             },
  1084.            
  1085.             commands = {
  1086.                 shop = "المتجر",
  1087.                 profile = "لاعب",
  1088.                 help = "المساعدة",
  1089.                 langue = "اللغة",
  1090.                 leaderboard = "مراكز",
  1091.                 info = "معلومة",
  1092.                 pw = "password",
  1093.             },
  1094.            
  1095.             menu = {
  1096.                 [1] = {"%s","\tما عليك فعله في هذه اللعبة هو جمع الجبن بأسرع ما يمكن يمكنك إستخدام القوى التي  توفرها لك الأرضيات."},
  1097.                 [2] = {"تأثيرات الأراضي","أنقر على إسم الأرضية لمعرفة المزيد عنها\n\n%s"},
  1098.                 [3] = {"الأوامر",{
  1099.                     [1] = {"\t<J>» اللاعب</J>\n",{
  1100.                         [1] = "<VP>!%s</VP> <PS>إسم اللاعب</PS> <R>أو</R> <VP>زر P</VP> - لفتح الملف الشخصي!",
  1101.                         [2] = "<VP>!%s</VP> <R>أو</R> <VP>الزر O</VP> - لفتح المتجر!",
  1102.                         [3] = "<VP>!%s</VP> - لتغيير اللغة!\n",
  1103.                     }},
  1104.                     [2] = {"\t<J>» البقية</J>\n",{
  1105.                         [1] = "<VP>!%s</VP> <R>أو</R> <VP>الزر H</VP> - لقتح لائحة المساعدة!",
  1106.                         [2] = "<VP>!%s</VP> - فتح قائمة المراكز!",
  1107.                         [3] = "<VP>!%s</VP> - فتح المساعدة وفقا للمكان الذي انت عليه!",
  1108.                         [4] = "<VP>!%s</VP> - يعرض معلومات الخريطة إذا كانت في دوران",
  1109.                     }},
  1110.                     [3] = {"\n\t<J>» مشرف غرفة</J>\n",{
  1111.                         [1] = "<VP>!%s</VP> <PS>سر كلمة</PS> - إضافة أو إزالة كلمة مرور في الغرفة!",
  1112.                     }},
  1113.                 }},
  1114.                 [4] = {"الخرائط","<J>الخرائط : %s\n\n\tتفعيل %s وأرسل الخارطة. لا تنسى قراءة القوانين!"},
  1115.                 [5] = {"شكرا لـ","<R>%s <G>- <N>المبرمج\n%s <G>- <N>مترجمون\n%s <G>- <N>مقيموا الخرائط"},
  1116.             },
  1117.             -- *
  1118.         },
  1119.         nl = {
  1120.             grounds = {
  1121.                 [0] = {"Hout","?","?"},
  1122.                 [1] = {"Ijs","Verhoogt je snelheid door op de spatiebalk te drukken","Verhoogd de snelheid met <BL>%s%%</BL>"},
  1123.                 [2] = {"Trampoline","?","?"},
  1124.                 [3] = {"Lava","Teleport jou naar de laatst Z index grond","?"},
  1125.                 [4] = {"Chocolade","?","?"},
  1126.                 [5] = {"Aarde","?","?"},
  1127.                 [6] = {"Gras","?","?"},
  1128.                 [7] = {"Zand","Maakt een zandstorm","Vemindert de storm met <BL>%s%%</BL>"},
  1129.                 [8] = {"Wolk","Hiermee kun je vliegen door op de spatiebalk te drukken","Verhoogd de vlucht met <BL>%s%%</BL>"},
  1130.                 [9] = {"Water","Laat je verdrinken","Maakt je <BL>%s%%</BL> langzamer"},
  1131.                 [10] = {"Steen","Hiermee maak je een blok steen door op de spatiebalk te drukken","Vergroot de grootte van het blok met <BL>%s%%</BL>"},
  1132.                 [11] = {"Sneeuw","Schiet sneeuwballen door op de spatiebalk te drukken","Verhoogd de snelheid van de sneeuwbal met <BL>%s%%</BL>"},
  1133.                 [12] = {"Rechthoek","Elke kleur heeft zijn eigen functie","?",{
  1134.                     ["C90909"] = "Vermoordt jou",
  1135.                     ["18C92B"] = "Brengt alle tegenstanders weer tot leven",
  1136.                     ["555D77"] = "Respawning Checkpoint", -- *
  1137.                 }},
  1138.                 [13] = {"Cirkel","Elke kleur heeft zijn eigen functie","?"},
  1139.                 [14] = {"Onzichtbaar","?","?"},
  1140.                 [15] = {"Spinnenweb","Teleport je naar het beginpunt","?"},
  1141.             },
  1142.             -- *
  1143.            
  1144.            
  1145.             welcome = "Welkom bij #%s! Ben jij de snelste muis door grond effecten te gebruiken? Probeer het!",
  1146.             developer = "Gemaakt door %s",
  1147.            
  1148.             shop = {
  1149.                 coin = "Munten",
  1150.                 power = "Grondkracht",
  1151.                 upgrade = "Upgraden",
  1152.                 price = "Upgrade kosten",
  1153.                 close = "Sluit",
  1154.             },
  1155.             bought = "Je gaf net %s munten uit voor de grond %s!",
  1156.             cantbuy = "Je hebt niet genoeg munten om deze upgrade uit te voeren! :(",
  1157.  
  1158.             profile = "Ranglijst : %s\n\n<N>Rondes : %s\n<N>Podiums : %s\n\n<N>Sterfgevallen : %s\n\n<N>Winkel Munten : %s",
  1159.  
  1160.             gotcoin = "Je kreeg zojuist %s munten! :D",
  1161.             zombie = "Nu ben je een zombie!",
  1162.             countstats = {
  1163.                 mice = "Er zijn minstens 5 muizen nodig voordat de stats tellen",
  1164.                 tribe = "Stats tellen niet in stamhuizen"
  1165.             },
  1166.  
  1167.             powersenabled = "De grondkrachten zijn ingeschakeld! Succes!",
  1168.             -- *
  1169.  
  1170.             language = "Huidige taal : <J>%s",
  1171.  
  1172.             password = {
  1173.                 on = "Nieuwe wachtwoord : %s",
  1174.                 off = "Wachtwoord uitgezet!"
  1175.             },
  1176.  
  1177.             commands = {
  1178.                 shop = "winkel",
  1179.                 profile = "profiel",
  1180.                 help = "help",
  1181.                 langue = "taal",
  1182.                 leaderboard = "leaderboard",
  1183.                 info = "info",
  1184.                 pw = "wachtwoord",
  1185.             },
  1186.            
  1187.             menu = {
  1188.                 [1] = {"%s","\tJouw doel is om zoveel mogelijk kaas te verzamelen, met gebruik van verschillende grond-effecten."},
  1189.                 [2] = {"Grond effecten","Klik op de grond om meer info te lezen.\n\n%s"},
  1190.                 [3] = {"Commands",{
  1191.                     [1] = {"\t<J>» User</J>\n",{
  1192.                         [1] = "<VP>!%s</VP> <PS>playerName</PS> <R>or</R> <VP>Key P</VP> - Opent het profiel!",
  1193.                         [2] = "<VP>!%s</VP> <R>or</R> <VP>Key O</VP> - Opent de winkel!",
  1194.                         [3] = "<VP>!%s</VP> - Wijzigt de taal!\n",
  1195.                     }},
  1196.                     [2] = {"\t<J>» Others</J>\n",{
  1197.                         [1] = "<VP>!%s</VP> <R>or</R> <VP>Key H</VP> - Opent de Help menu!",
  1198.                         [2] = "<VP>!%s</VP> - Opent de leaderboard!",
  1199.                         [3] = "<VP>!%s</VP> - Opent help op basis van de grond waarop je staat!",
  1200.                         [4] = "<VP>!%s</VP> - Displays the map info if it is in the rotation!", -- *
  1201.                     }},
  1202.                     [3] = {"\n\t<J>» Kamer admin</J>\n",{
  1203.                         [1] = "<VP>!%s</VP> <PS>wachtwoord</PS> - Voegt of haalt een wachtwoord weg van een kamer!",
  1204.                     }},
  1205.                 }},
  1206.                 [4] = {"Maps","<J>Maps : %s\n\n\tBereik %s en verzend jouw map. Vergeet niet om alle regels te lezen voordat je begint!"},
  1207.                 [5] = {"Dank aan","<R>%s <G>- <N>Developer\n%s <G>- <N>Translators\n%s <G>- <N>Mapbeoordelaars"},
  1208.             },
  1209.             -- *
  1210.         },
  1211.         de = {
  1212.             grounds = {
  1213.                 [0] = {"Holz","?","?"},
  1214.                 [1] = {"Eis","Beschleunigt dich indem du die Leertaste drückst","Erhoht die geschwindigkeit in <BL>%s%%</BL>"},
  1215.                 [2] = {"Trampoline","?","?"},
  1216.                 [3] = {"Lava","Teleportiert dich zum letzen Z Index Boden","?"},
  1217.                 [4] = {"Schokolade","?","?"},
  1218.                 [5] = {"Erde","?","?"},
  1219.                 [6] = {"Gras","?","?"},
  1220.                 [7] = {"Sand","Kreiert einen Sandsturm","Verringert die sturm in <BL>%s%%</BL>"},
  1221.                 [8] = {"Wolke","Du kannst fliegen indem du die Leertaste drückst","Erhoht die fliege in <BL>%s%%</BL>"},
  1222.                 [9] = {"Wasser","Ertränkt dich","Ertrinkt dich <BL>%s%%</BL> langsamer"},
  1223.                 [10] = {"Stein","Erschaffe einen Stein indem du die Leertaste drückst","Erhoht die blockgrosse in <BL>%s%%</BL>"},
  1224.                 [11] = {"Schnee","Wirf Schneebälle indem du die Leertaste drückst","Erhoht die schneeball geschwindigkeit in <BL>%s%%</BL>"},
  1225.                 [12] = {"Rechteck","Jede Farbe hat seine eigene Funktion","?",{
  1226.                     ["C90909"] = "Tötet du",
  1227.                     ["18C92B"] = "Aufleben alle Feinde",
  1228.                     ["555D77"] = "Respawning Checkpoint", -- *
  1229.                 }},
  1230.                 [13] = {"Kreis","Jede Farbe hat seine eigene Funktion","?"},
  1231.                 [14] = {"Unsichtbar","?","?"},
  1232.                 [15] = {"Spinnweben","Teleportiert dich zum Startpunkt","?"},
  1233.             },
  1234.             -- *
  1235.            
  1236.             welcome = "Willkommen zu #%s! Kannst du die schnellste Maus mit den Bodeneffekten sein? Versuch es!\n<PS>Drück H für mehr informationen!",
  1237.             developer = "Entwickelt von %s",
  1238.            
  1239.             shop = {
  1240.                 coin = "Munzen",
  1241.                 power = "Bodenleistung",
  1242.                 upgrade = "Aktualisierung",
  1243.                 price = "Upgrade Preis",
  1244.                 close = "Schliessen",
  1245.             },
  1246.             bought = "Du hast %s Münzen für den Boden %s ausgegeben!",
  1247.             cantbuy = "Du hast nicht genügend Münzen um dieses Upgrade zu kaufen! :(",
  1248.            
  1249.             profile = "Bestenliste : %s\n\n<N>Runden: %s\n<N>Podiums: %s\n\n<N>Tode : %s\n\n<N>Shop Münzen: %s",
  1250.            
  1251.             gotcoin = "Du hast soeben %s Münzen erhalten! :D",
  1252.             zombie = "Du bist nun ein Zombie!",
  1253.             countstats = {
  1254.                 mice = "Es müssen mindestens 5 Mäuse im Raum sein damit die Stats zählen",
  1255.                 tribe = "Stats zählen in Stammeshäusern nicht"
  1256.             },
  1257.            
  1258.             powersenabled = "Der Effekt des Bodens wurde aktiviert! Viel Glück!",
  1259.             -- *
  1260.            
  1261.             language = "Aktuelle Sprache : <J>%s",
  1262.            
  1263.             password = {
  1264.                 on = "Neu passwort: : %s",
  1265.                 off = "Passwort deaktiviert!"
  1266.             },
  1267.            
  1268.             commands = {
  1269.                 shop = "shop",
  1270.                 profile = "profil",
  1271.                 help = "hilfe",
  1272.                 langue = "sprache",
  1273.                 leaderboard = "bestenliste",
  1274.                 info = "info",
  1275.                 pw = "passwort",
  1276.             },
  1277.            
  1278.             menu = {
  1279.                 [1] = {"%s","\tDein Ziel in diesem Minigame ist es den Käse so schnell wie möglich zu sammeln, indem du die verschiedenen Effekte der Böden ausnutzt."},
  1280.                 [2] = {"Bodeneffekte","Klicken in den bodens namen um mehr zu lesen.\n\n%s"},
  1281.                 [3] = {"Kommandos",{
  1282.                     [1] = {"\t<J>» Benutzer</J>\n",{
  1283.                         [1] = "<VP>!%s</VP> <PS>Spielername</PS> <R>oder</R> <VP>Taste P</VP> - Öffnet das Profil!",
  1284.                         [2] = "<VP>!%s</VP> <R>oder</R> <VP>Taste O</VP> - Öffnet den Shop!",
  1285.                         [3] = "<VP>!%s</VP> - Ändert die Sprache!\n",
  1286.                     }},
  1287.                     [2] = {"\t<J>» Anderes</J>\n",{
  1288.                         [1] = "<VP>!%s</VP> <R>oder</R> <VP>Taste H</VP> - Öffnet das Hilfsmenu!",
  1289.                         [2] = "<VP>!%s</VP> - Öffnet die Bestenliste!",
  1290.                         [3] = "<VP>!%s</VP> - Öffnet die hilfe nach dem boden auf dem du bist auf!",
  1291.                         [4] = "<VP>!%s</VP> - Displays the map info if it is in the rotation!", -- *
  1292.                     }},
  1293.                     [3] = {"\n\t<J>» Zimmer admin</J>\n",{
  1294.                         [1] = "<VP>!%s</VP> <PS>passwort</PS> - Hinzufugen oder entfernen eines passwortes im raum!",
  1295.                     }},
  1296.                 }},
  1297.                 [4] = {"Maps","<J>Maps : %s\n\n\tBesuche das Thema %s und reiche deine Map ein. Vergiss nicht zuvor alle Regeln zu lesen!"},
  1298.                 [5] = {"Danke an ","<R>%s <G>- <N>Entwickler\n%s <G>- <N>Übersetzer\n%s <G>- <N>Landkarte bewerter"},
  1299.             },
  1300.             -- *
  1301.         },
  1302.     },
  1303.     langue = "en",
  1304.     -- Info
  1305.     staff = {
  1306.         translators = {
  1307.             -- Name, Languages
  1308.             {"Bolodefchoco",{"EN","BR"}},
  1309.             {"Distances","NL"},
  1310.             {"Tocutoeltuco","ES"},
  1311.             {"Sebafrancuz","PL"},
  1312.             {"Doriiarvai","HU"},
  1313.             {"Error_404","AR"},
  1314.             {"Cheeselicious","NL"},
  1315.             {"Archaeron","DE"},
  1316.             {"Aewing","FR"},
  1317.             {"Fashionkid","DE"},
  1318.             {"Yuir","ES"},
  1319.             {"Mquk","FR"}
  1320.         },
  1321.         mapEvaluators = {
  1322.             -- Name, Joined
  1323.             {"Bolodefchoco","14/02/2017"},
  1324.             {"Error_404","11/03/2017"}
  1325.         },
  1326.     },
  1327.     -- Data
  1328.     bindKeys = {0,1,2,3,stringbyte("OPHK",1,4)},
  1329.     info = {},
  1330.     stormIntensities = {
  1331.         --[[ Opaque images
  1332.             [1] = "15a6d6fcd18",
  1333.             [2] = "15a6d6ff82f",
  1334.             [4] = "15a6d7015bc",
  1335.             [8] = "15a6d703149"
  1336.         ]]
  1337.         [1] = .75,
  1338.         [2] = .65,
  1339.         [4] = .5,
  1340.         [8] = .25
  1341.     },
  1342.     -- Maps (G Categories)
  1343.     maps = {},
  1344.     G = {
  1345.         --[[
  1346.             name = catName,
  1347.             queue{maps},
  1348.             id = 1,
  1349.             icon = {iconImage,x axis (from 360),y axis (from 123)}
  1350.             color = catColor,
  1351.             before = function executed before the map,
  1352.             after = function executed after the map
  1353.         ]]--
  1354.         [1] = {
  1355.             name = "Circuit",
  1356.             queue = {3099763,4612510,7078090,4493715,7102175,5921816,7127261,7102187},
  1357.             id = 1,
  1358.             icon = {"15c60371706",0,-1},
  1359.             color = "9A9ACE",
  1360.         },
  1361.         [2] = {
  1362.             name = "Flap Bird",
  1363.             queue = {7069835,2265250,6300148,5921754,2874090,2310427},
  1364.             id = 1,
  1365.             icon = {"15c603730a6",0,0},
  1366.             color = "E084D4",
  1367.         },
  1368.         [3] = {
  1369.             name = "Bootcamp",
  1370.             queue = {4592612,7079708,5921867,7087840,6391815,7090909,7011800,7069314,6333026,6000012,6990787,7100040},
  1371.             id = 1,
  1372.             icon = {"15c60382627",-5,-5},
  1373.             color = "A4CF9E",
  1374.         },
  1375.         [4] = {
  1376.             name = "Aquatic",
  1377.             queue = {6133469,3324284,6578479,7095393,5772226,2310447},
  1378.             id = 1,
  1379.             icon = {"15c603788c1",0,0},
  1380.             color = "2194D9",
  1381.         },
  1382.         [5] = {
  1383.             name = "Teleport",
  1384.             queue = {5168440,6987992,7069343,6945850,7090907,3326655,7069816,5921744,7071075,7071400,4509060,7118888},
  1385.             id = 1,
  1386.             icon = {"15c60376d57",2,-1},
  1387.             color = "E29E71",
  1388.         },
  1389.         [6] = {
  1390.             name = "Puzzle",
  1391.             queue = {5993927,7057010,5507021,6994066,6332986,7074686,3448597,2887357,6576282,4514386,7079827,7079880},
  1392.             id = 1,
  1393.             icon = {"15c6037edb7",0,-1},
  1394.             color = "CB56D8",
  1395.         },
  1396.         [7] = {
  1397.             name = "Racing",
  1398.             queue = {4140491,3324180,6564380,6600268,6987993,6726599,2283901,6568120,4055924,4361785,3851416,7079644,6347093,6620004,7086768,6797243,2030030,5198518,6230212,6340023,7069304,4362362,5981054,4364504,7086737,6623930},
  1399.             id = 1,
  1400.             icon = {"15c6037ccd7",-5,-5},
  1401.             color = "9DBCF2",
  1402.         },
  1403.         [8] = {
  1404.             name = "Snow",
  1405.             queue = {4396371,5632126,7079092,4531989,4509584},
  1406.             id = 1,
  1407.             icon = {"15c6037b089",5,1},
  1408.             color = "C4F4F6",
  1409.             after = function()
  1410.                 if os.date("%m") == "12" then
  1411.                     tfm.exec.chatMessage("<PS>Merry christmas :)")
  1412.                     tfm.exec.snow(60)
  1413.                 end
  1414.             end,
  1415.         },
  1416.         [9] = {
  1417.             name = "Miscellaneous",
  1418.             queue = {6226386,5425815,7047955,6558179,6961916,6968299,6935117,4802574,7087798,6335452,7093647,7145064},
  1419.             id = 1,
  1420.             icon = {"15c6036fb66",-10,-2},
  1421.             color = "DED963",
  1422.         },
  1423.         [10] = {
  1424.             name = "Cooperation",
  1425.             queue = {3326675,4184558,5198607,6988672},
  1426.             id = 1,
  1427.             icon = {"15c60374f1f",-3,-1},
  1428.             color = "2EBA7E",
  1429.         },
  1430.         [11] = {
  1431.             name = "Vampire",
  1432.             queue = {5043429,4361619,4633670},
  1433.             id = 1,
  1434.             icon = {"15c60380b12",-10,-5},
  1435.             color = "CB546B",
  1436.             after = function()
  1437.                 if os.date("%m") == "10" then
  1438.                     tfm.exec.chatMessage("<R>Happy Halloween :>")
  1439.                 end
  1440.             end,
  1441.         },
  1442.         [12] = {
  1443.             name = "House",
  1444.             queue = {510966},
  1445.             id = 1,
  1446.             icon = {"15cb6dbea83",-8,-4},
  1447.             color = "D1AB83",
  1448.             after = function()
  1449.                 tfm.exec.setGameTime(1800) -- 30 minutes
  1450.                 tfm.exec.chatMessage("<ROSE>" .. system.getTranslation("tribehouse"))
  1451.             end,
  1452.         },
  1453.     },
  1454.     rotation = {1,{9,7,4,1,5,7,10,8,6,11,2,1,3,5}},
  1455.     newMap = coroutine.wrap(function()
  1456.         while true do
  1457.             local map
  1458.             if os.time() > system.newGameTimer then
  1459.                 if mode.grounds.rotation[1] > #mode.grounds.rotation[2] then
  1460.                     mode.grounds.rotation[1] = 1
  1461.                 end
  1462.                
  1463.                 local category = mode.grounds.rotation[2][mode.grounds.rotation[1]]
  1464.                 mode.grounds.mapInfo[2] = category
  1465.                 category = mode.grounds.G[category]
  1466.                 mode.grounds.mapInfo[5] = category.color
  1467.                 map = category.queue[category.id]
  1468.                 mode.grounds.mapInfo[1] = map
  1469.                
  1470.                 category.id = category.id + 1
  1471.                
  1472.                 mode.grounds.afterFunction = category.after or (function() end)
  1473.                 if category.before then
  1474.                     category.before()
  1475.                 end
  1476.                
  1477.                 if category.id > #category.queue then
  1478.                     category.queue = tableshuffle(category.queue)
  1479.                     category.id = 1
  1480.                 end
  1481.                
  1482.                 mode.grounds.rotation[1] = mode.grounds.rotation[1] + 1
  1483.             end
  1484.             coroutine.yield(map)
  1485.         end
  1486.     end),
  1487.     -- New Map Settings
  1488.     review = false,
  1489.     afterFunction = (function() end),
  1490.     mapInfo = {0,0,0,0,"CAA4CF"}, -- Code, Category, Width, Height, Color
  1491.     respawn = 0,
  1492.     hasWater = false,
  1493.     podium = 0,
  1494.     availableRoom = false,
  1495.     alivePlayers = 0,
  1496.     totalPlayers = 0,
  1497.     spawnPoint = {0,0},
  1498.     -- Loop Settings
  1499.     despawnGrounds = {},
  1500.     announceTimer = 0,
  1501.     -- Misc Settings
  1502.     welcomeMessage = (function()
  1503.         if system.roomNumber == 666 then
  1504.             return {"<R>","<R>","<R>","<R>"}
  1505.         else
  1506.             return {"<BV>","<PT>","<BV>","<VP>"}   
  1507.         end
  1508.     end)(),
  1509.     isHouse = system.roomNumber == 801 or system.officialMode[1] == "village",
  1510.     -- Leaderboard Settings
  1511.     leaderboard = {update = 0,data = {}},
  1512.     -- Shop
  1513.     shop = {
  1514.         images = {
  1515.             [1] = {'15a2a340dd5','15a2a342b88','15a2a3449a9','15a2a3459e1','15a2a346953','15a2a3479a3','15a2a348ad3','15a2a349a89','15a2a34aa0d'},
  1516.             [3] = {'15a2a35fef7','15a2a36114b','15a2a36240d','15a2a36332f','15a2a3645f3'},
  1517.             [7] = {'15a2a3721bc','15a2a3731bb','15a2a3742b6','15a2a375439','15a2a376339'},
  1518.             [8] = {'15a2a31b8dc','15a2a31d292','15a2a323150','15a2a32815c','15a2a32af10','15a2a32ce03','15a2a32dc09','15a2a32ecde','15a2a32fc20'},
  1519.             [9] = {'15a2a3b475f','15a2a3b5996','15a2a3b6ab9','15a2a3b8250','15a2a3b924f'},
  1520.             [10] = {'15a2a3a0156','15a2a3a1229','15a2a3a2460','15a2a3a3702','15a2a3a4c70'},
  1521.             [11] = {'15a2a381307','15a2a3824c8','15a2a383682','15a2a384dc1','15a2a3865c5','15a2a38820d','15a2a38a3a8','15a2a38bbd6','15a2a38d0ec'},
  1522.             [15] = {'15a2a3c4442','15a2a3c54f3','15a2a3c69b7','15a2a3c78e7','15a2a3c873b'},
  1523.         },
  1524.         unpackImages = function(id,e)
  1525.             local t = {}
  1526.             for k,v in next,mode.grounds.shop.images[id] do
  1527.                 if #t < e then
  1528.                     t[#t+1] = v
  1529.                 end
  1530.             end
  1531.             return t
  1532.         end,
  1533.     },
  1534.     -- System functions
  1535.     concat = function(k,v)
  1536.         if type(v) == "table" then
  1537.             return tableconcat(v,"\n",function(i,j) return mode.grounds.concat(i,j) end)
  1538.         else
  1539.             return v
  1540.         end
  1541.     end,
  1542.     listener = function(t,st,from)
  1543.         from = (from and from.."." or "")
  1544.         for k,v in next,t do
  1545.             if type(v) == "table" then
  1546.                 mode.grounds.listener(v,st,from .. tostring(k))
  1547.             else
  1548.                 st[#st + 1] = from .. k
  1549.             end
  1550.         end
  1551.         return st
  1552.     end,
  1553.     -- Bar
  1554.     uibar = function(id,player,value,color,size,height)
  1555.         size = size or 100
  1556.         height = height or 20
  1557.  
  1558.         if value > size then
  1559.             value = size
  1560.         elseif value < 0 then
  1561.             value = 0
  1562.         end
  1563.  
  1564.         ui.addTextArea(id,"",player,5,(height+8) * id,size + 4,height,0xC7CED2,1,1,true)
  1565.         if value ~= 0 then
  1566.             ui.addTextArea(id+1,"",player,6,(height+8) * id + 2,value + 2,height - 4,color,color,1,true)
  1567.         end
  1568.         ui.addTextArea(id+2,"<p align='center'><B><font color='#0'>"..value.."%",player,5,(height+8) * id,size + 4,height,1,1,0,true)
  1569.     end,
  1570.     -- Shop
  1571.     uishop = function(n)
  1572.         if mode.grounds.info[n].groundsDataLoaded then
  1573.             for k,v in next,mode.grounds.info[n].shop.image do
  1574.                 tfm.exec.removeImage(v)
  1575.             end
  1576.             if not mode.grounds.info[n].shop.accessing then
  1577.                 local get,index = tablefind(mode.grounds.shop.grounds,mode.grounds.info[n].powersOP.GTYPE,1)
  1578.                 if get then
  1579.                     mode.grounds.info[n].shop.page = index
  1580.                 else
  1581.                     mode.grounds.info[n].shop.page = 1
  1582.                 end
  1583.                 mode.grounds.info[n].shop.accessing = true
  1584.             end
  1585.             if mode.grounds.info[n].shop.page < 1 then
  1586.                 mode.grounds.info[n].shop.page = #mode.grounds.shop.grounds
  1587.             elseif mode.grounds.info[n].shop.page > #mode.grounds.shop.grounds then
  1588.                 mode.grounds.info[n].shop.page = 1
  1589.             end
  1590.            
  1591.             local shopTxt = system.getTranslation("shop",n)
  1592.             local debuggedGround = mode.grounds.shop.grounds[mode.grounds.info[n].shop.page]
  1593.             local ground = system.getTranslation("grounds."..debuggedGround[1],n)
  1594.             local G = stringlower(mode.grounds.translations.en.grounds[debuggedGround[1]][1])
  1595.             local groundLevel = mode.grounds.info[n].stats.powers[G]
  1596.             groundLevel = groundLevel[#groundLevel]
  1597.            
  1598.             ui.addTextArea(4,"",n,160,50,480,320,0x1a2433,1,1,true)
  1599.  
  1600.             ui.addTextArea(5,"",n,171,56,240,15,0x1d5a78,0x1d5a78,1,true)
  1601.             ui.addTextArea(6,"<p align='center'><font size='13'>"..stringnick(mode.grounds.cmds.shop),n,170,53,240,25,1,1,0,true)
  1602.  
  1603.             ui.addTextArea(7,"<p align='center'><font size='12'><B><a href='event:shop.left'><BV>«</BV></a>  <font size='14'><a href='event:info.grounds."..stringgsub(ground[1],"'","#").."."..ground[2].."'>"..ground[1].."</a></font>  <a href='event:shop.right'><BV>»</BV></a>",n,170,87,240,25,0x073247,0x073247,1,true)
  1604.            
  1605.             mode.grounds.info[n].shop.image[1] = tfm.exec.addImage(debuggedGround[2][1]..".png","&0",435,70,n)
  1606.  
  1607.             local playerData = stringformat("<font size='12'><N>%s <G>: <J>$%s\n<N>%s\n<N>%s <G>: <BL>%s",shopTxt.coin,mode.grounds.info[n].stats.groundsCoins,"%s",shopTxt.power,mathfloor(mathpercent(groundLevel,#debuggedGround[2])).."%%")
  1608.             local groundData = ""
  1609.             local upgradeData = "<p align='center'><font size='15'><B>%s" .. shopTxt.upgrade
  1610.  
  1611.             if (groundLevel + 1) <= #debuggedGround[2] then
  1612.                 local price = (groundLevel + 1) * (120 * debuggedGround[3])
  1613.                 playerData = stringformat(playerData,shopTxt.price .. " <G>: <R>$" .. price)
  1614.                 local iniPerc = mathfloor(mathpercent(1,#mode.grounds.shop.grounds[mode.grounds.info[n].shop.page][2]))
  1615.                 groundData = stringformat(ground[3],iniPerc)
  1616.                 upgradeData = stringformat(upgradeData,"<a href='event:shop.buy."..price.."."..G.."'><PT>")
  1617.                
  1618.                 local gId = mode.grounds.info[n].stats.powers[G][#mode.grounds.info[n].stats.powers[G]]
  1619.                 mode.grounds.info[n].shop.image[2] = tfm.exec.addImage(debuggedGround[2][gId]..".png","&1",540,70,n)
  1620.                 mode.grounds.info[n].shop.image[3] = tfm.exec.addImage("15a2df6ab69.png","&2",440,205,n)
  1621.                 mode.grounds.info[n].shop.image[4] = tfm.exec.addImage(debuggedGround[2][gId+1]..".png","&3",540,210,n)
  1622.             else
  1623.                 playerData = stringformat(playerData,"<R>-")
  1624.                 upgradeData = stringformat(upgradeData,"<V>")
  1625.                
  1626.                 mode.grounds.info[n].shop.image[2] = tfm.exec.addImage(system.getTranslation("max",n)..".png","&2",175,215,n)
  1627.             end
  1628.            
  1629.             ui.addTextArea(8,playerData,n,170,130,240,52,0x073247,0x073247,1,true)
  1630.             ui.addTextArea(9,groundData,n,170,200,240,80,0x073247,0x073247,1,true)
  1631.  
  1632.             ui.addTextArea(10,upgradeData,n,170,298,240,24,0x073247,0x073247,1,true)
  1633.             ui.addTextArea(11,"<p align='center'><font size='15'><R><B><a href='event:shop.close'>"..shopTxt.close.."</a></B>",n,170,339,240,24,0x073247,0x073247,1,true)
  1634.  
  1635.             ui.addTextArea(12,"",n,430,62,200,300,0x073247,0x073247,1,true)
  1636.             ui.addTextArea(13,"",n,426,58,90,90,0x1a2433,0x1a2433,1,true)
  1637.         end
  1638.     end,
  1639.     -- Profile
  1640.     uiprofile = function(n,p)
  1641.         if mode.grounds.info[p].groundsDataLoaded then
  1642.             local nickSize = #p > 12 and 10 or 15
  1643.             ui.addTextArea(14,"<p align='center'><B><R><a href='event:profile.close'>X",n,513,115,20,20,1,1,1,true)
  1644.             ui.addTextArea(15,"<p align='center'><B><PS><a href='event:profile.open'>•",n,513,145,20,20,1,1,1,true)
  1645.             ui.addTextArea(16,"<p align='center'><font size='16'><B><V>"..p.."</V></B> "..(mode.grounds.info[p].isOnline and "<VP>" or "<R>").."•</font></p><p align='left'><font size='12'>\n<N>" .. stringformat(system.getTranslation("profile",n),"<V>#"..mode.grounds.info[p].ranking,"<V>"..mode.grounds.info[p].stats.rounds,"<V>"..mode.grounds.info[p].stats.podiums,"<V>"..mode.grounds.info[p].stats.deaths,"<J>$"..mode.grounds.info[p].stats.groundsCoins),n,290,115,220,160,0x073247,1,1,true)
  1646.         end
  1647.     end,
  1648.     -- Menu
  1649.     uimenu = function(n)
  1650.         if not mode.grounds.info[n].menu.accessing then
  1651.             mode.grounds.info[n].menu.page = 1
  1652.             mode.grounds.info[n].menu.accessing = true
  1653.         end
  1654.  
  1655.         local langue = system.getTranslation("menu",n)
  1656.  
  1657.         if mode.grounds.info[n].menu.page < 1 then
  1658.             mode.grounds.info[n].menu.page = #langue
  1659.         elseif mode.grounds.info[n].menu.page > #langue then
  1660.             mode.grounds.info[n].menu.page = 1
  1661.         end
  1662.  
  1663.         local popupFormat = "<%s><a href='event:menu.page.%d'>#%s</a>"
  1664.         local popups = {}
  1665.         for k,v in next,langue do
  1666.             popups[#popups+1] = stringformat(popupFormat,(k == mode.grounds.info[n].menu.page and "VP" or "J"),k,stringformat(v[1],stringnick(module._NAME)))
  1667.         end
  1668.  
  1669.         local popup = {
  1670.             x = {663,546},
  1671.             d = "«",
  1672.             txt = "<font size='11'><J>"..tableconcat(popups,"\n\n")
  1673.         }
  1674.         if not mode.grounds.info[n].menu.showPopup then
  1675.             popup = {
  1676.                 x = {552,435},
  1677.                 d = "»",
  1678.                 txt = "",
  1679.             }
  1680.         end
  1681.        
  1682.         local displayText = {tableunpack(langue[mode.grounds.info[n].menu.page])}
  1683.  
  1684.         if mode.grounds.info[n].menu.page == 1 then
  1685.             displayText[1] = stringformat(displayText[1],stringnick(module._NAME))
  1686.            
  1687.             local gameModes = "<PT>"
  1688.             for k,v in next,{"powers",tableunpack(system.submodes,2)} do
  1689.                 local room
  1690.                 if k > 1 then
  1691.                     room = stringformat("/room #%s%s@%s*%s",module._NAME,mathrandom(0,999),n,system.normalizedModeName(v,false))
  1692.                 else
  1693.                     room = stringformat("/room #%s%s%s",v,mathrandom(0,999),n)
  1694.                 end
  1695.                 gameModes = gameModes .. stringformat("<a href='event:print.&lt;ROSE>%s'>%s</a>\n",room,room)
  1696.             end
  1697.            
  1698.             displayText[2] = displayText[2] .. "\n\n" .. gameModes
  1699.         else
  1700.             local textFormat = nil
  1701.             if mode.grounds.info[n].menu.page == 2 then
  1702.                 textFormat = {{},system.getTranslation("grounds",n)}
  1703.                 for k,v in next,textFormat[2] do
  1704.                     if v[2] ~= "?" then
  1705.                         tableinsert(textFormat[1],stringformat("<a href='event:info.grounds.%s.%s'><B>%s</B></a>",stringgsub(v[1],"'","#"),stringgsub(v[2],"%.","@"),stringupper(v[1])))
  1706.                     end
  1707.                 end
  1708.                 displayText[2] = stringformat(displayText[2],"• "..tableconcat(textFormat[1],"\n• "))
  1709.             elseif mode.grounds.info[n].menu.page == 3 then
  1710.                 displayText[2] = tableconcat(displayText[2],"\n",function(k,v)
  1711.                     return mode.grounds.concat(k,v)
  1712.                 end)
  1713.                 displayText[2] = "<font size='10'>" .. stringformat(displayText[2],mode.grounds.cmds.profile,mode.grounds.cmds.shop,mode.grounds.cmds.langue,mode.grounds.cmds.help,mode.grounds.cmds.leaderboard,mode.grounds.cmds.info,mode.grounds.cmds.mapinfo,mode.grounds.cmds.pw)
  1714.             elseif mode.grounds.info[n].menu.page == 4 then
  1715.                 displayText[2] = stringformat(displayText[2] .. "\n\n%s",#mode.grounds.maps.."<N>","<BV><a href='event:print.atelier801¬com/topic?f=6&t=845005'>#"..stringupper(module._NAME).." MAP SUBMISSIONS</a></BV>",tableconcat(mode.grounds.G,"\n",function(k,v)
  1716.                     return stringformat("<font color='#%s'><a href='event:info.mapCategory.%s'>G%2d</a> : %3d</font>",v.color,k,k,#v.queue)
  1717.                 end))
  1718.             elseif mode.grounds.info[n].menu.page == 5 then
  1719.                 local concat = {}
  1720.                 for i,j in next,{{"translators","<CEP>"},{"mapEvaluators","<BV>"}} do
  1721.                     concat[#concat+1] = j[2] .. tableconcat(mode.grounds.staff[j[1]],"<G>, " .. j[2],function(k,v)
  1722.                         return stringformat("<a href='event:info.%s.%s'>%s</a>",j[1],k,v[1])
  1723.                     end)
  1724.                 end
  1725.                 displayText[2] = stringformat(displayText[2],"Bolodefchoco",concat[1],concat[2])
  1726.             end
  1727.         end
  1728.  
  1729.         ui.addTextArea(17,"<font size='1'>\n</font><p align='center'><J><B><a href='event:menu.right'>»</a>",n,543,352,40,20,1,1,1,true)
  1730.         ui.addTextArea(18,"<font size='1'>\n</font><p align='center'><J><B><a href='event:menu.left'>«</a>",n,217,352,40,20,1,1,1,true)
  1731.  
  1732.         ui.addTextArea(19,"<font size='1'>\n</font><p align='center'><PT><B><a href='event:menu.popup'>"..popup.d.."</a>",n,popup.x[1],137,20,20,1,1,1,true)
  1733.         ui.addTextArea(20,popup.txt,n,popup.x[2],137,115,125,0x123e54,1,1,true)
  1734.  
  1735.         ui.addTextArea(21,"<p align='center'><B><R><a href='event:menu.close'>X",n,543,42,20,20,1,1,1,true)
  1736.         ui.addTextArea(22,"<p align='center'><font size='20'><V><B>"..stringupper(displayText[1]).."</B></V><font size='15'>\n<R>_____________\n\n<font size='11'><N><p align='left'>"..displayText[2],n,260,42,280,330,0x073247,1,1,true)
  1737.     end,
  1738.     -- Info
  1739.     uidisplayInfo = function(n,data)
  1740.         local what = data[2]
  1741.         local title,text,color = "","",""
  1742.         if what == "grounds" then
  1743.             color = "<N>"
  1744.             title = stringgsub(data[3],"#","'")
  1745.             local info = stringgsub(data[4],"@",".")
  1746.             local groundTxt = system.getTranslation("grounds.12",n)
  1747.             if info == groundTxt[2] then
  1748.                 local colors = {}
  1749.                 for k,v in next,groundTxt[4] do
  1750.                     colors[#colors+1] = stringformat("<PT>[•] <N2><font color='#%s'>(#%s)</a> <BL>- <PS>%s",k,k,v)
  1751.                 end
  1752.                 text = tableconcat(colors,"\n")
  1753.             else
  1754.                 text = stringformat("<PT>[•] <PS>%s",info)
  1755.             end
  1756.         elseif what == "mapCategory" then
  1757.             data[3] = tonumber(data[3])
  1758.             color = "<S>"
  1759.             title = "G"..data[3]
  1760.             text = stringformat("%s\n# %s\n@ %s",mode.grounds.G[data[3]].name,#mode.grounds.G[data[3]].queue,system.getTranslation("categories." .. data[3],n))
  1761.             if mode.grounds.info[n].infoImage[#mode.grounds.info[n].infoImage] then
  1762.                 tfm.exec.removeImage(mode.grounds.info[n].infoImage[#mode.grounds.info[n].infoImage])
  1763.             end
  1764.             mode.grounds.info[n].infoImage[#mode.grounds.info[n].infoImage + 1] = tfm.exec.addImage(mode.grounds.G[data[3]].icon[1] .. ".png","&4",360 + mode.grounds.G[data[3]].icon[2],125 + mode.grounds.G[data[3]].icon[3],n)
  1765.         elseif mode.grounds.staff[what] then
  1766.             local comp = data[3]
  1767.             local info = mode.grounds.staff[what][tonumber(comp)]
  1768.             title = info[1]
  1769.             if what == "translators" then
  1770.                 color = "<CEP>"
  1771.                 text = stringformat("[•] !%s %s",mode.grounds.cmds.langue,tableconcat(tableturnTable(info[2]),", "))
  1772.             elseif what == "mapEvaluators" then
  1773.                 color = "<BV>"
  1774.                 text = stringformat("[•] %s",info[2])
  1775.             end
  1776.         end
  1777.         ui.addTextArea(37,"<p align='center'><B><R><a href='event:info.close'>X",n,528,115,20,20,1,1,1,true)
  1778.         ui.addTextArea(38,"<p align='center'><font size='20'><V><B>" .. title .. "</B>" .. color .. (mode.grounds.staff[what] and " •" or "") .. "\n\n<p align='left'><font size='13'>" .. text,n,275,115,250,160,0x073247,1,1,true)
  1779.     end,
  1780.     -- Leaderboard
  1781.     uileaderboard = function(n)
  1782.         if os.time() > mode.grounds.leaderboard.update or not n then
  1783.             mode.grounds.leaderboard = {update = os.time() + 180e3,data = {}}
  1784.            
  1785.             local players = {}
  1786.             for k,v in next,mode.grounds.info do
  1787.                 if stringsub(k,1,1) ~= "*" then
  1788.                     players[#players + 1] = {k,mathfloor((v.stats.rounds - v.stats.deaths)/10) * (v.stats.podiums + 1)}
  1789.                 end
  1790.             end
  1791.             tablesort(players,function(p1,p2) return p1[2] > p2[2] end)
  1792.  
  1793.             for k,v in next,players do
  1794.                 mode.grounds.info[v[1]].ranking = k
  1795.                 if k < 11 then
  1796.                     tableinsert(mode.grounds.leaderboard.data,"<J>"..k..". " .. (({"<BV>","<PS>","<CE>"})[k] or "<V>") .. "<a href='event:profile.open."..v[1].."'>".. v[1] .. "</a> <BL>- <VP>" .. v[2] .. "G")
  1797.                 end
  1798.             end
  1799.             if #mode.grounds.leaderboard.data == 0 then
  1800.                 mode.grounds.leaderboard.update = 0
  1801.             end
  1802.         end
  1803.  
  1804.         if n then
  1805.             mode.grounds.info[n].leaderboardAccessing = true
  1806.             local id,y = 25,100
  1807.             ui.addTextArea(23,"<p align='center'><B><R><a href='event:ranking.close'>X",n,603,35,20,20,1,1,1,true)
  1808.             ui.addTextArea(24,"<p align='center'><font size='45'>" .. stringnick(mode.grounds.cmds.leaderboard),n,200,35,400,350,0x073247,1,1,true)
  1809.  
  1810.             for i = 1,10 do
  1811.                 local v = mode.grounds.leaderboard.data[i] or ""
  1812.                 local color = id % 2 == 0 and 0x123e54 or 0x042636
  1813.                 if stringfind(v,n) then
  1814.                     v = stringgsub(v,"'>(.-)</a>",function(name)
  1815.                         return "'><a:active>"..name.."</a:active></a>"
  1816.                     end)
  1817.                 end
  1818.                 ui.addTextArea(id,v,n,245,y,315,20,color,color,1,true)
  1819.                 id = id + 1
  1820.                 y = y + 28
  1821.             end
  1822.  
  1823.             ui.addTextArea(id,"",n,230,90,10,285,0x073247,0x073247,1,true)
  1824.             ui.addTextArea(id + 1,"",n,565,90,10,285,0x073247,0x073247,1,true)
  1825.         end
  1826.     end,
  1827.     -- Grounds system
  1828.     gsys = {
  1829.         -- Ground system
  1830.         grounds = {},
  1831.         disabledGrounds = {},
  1832.         collisionArea = {34,40,50,50,40,34,34,35,0,0,40,35,35,23,0,0},
  1833.         getTpPos = function(g,center)
  1834.             if center then
  1835.                 return {g.X,g.Y}
  1836.             else
  1837.                 local ang = stringsplit(g.P,"[^,]+",tonumber)
  1838.                 ang = ang[5]
  1839.                 local hTP = {g.X,g.Y}
  1840.                 if ang == 90 or ang == -270 then
  1841.                     hTP[1] = hTP[1] + g.L/2
  1842.                 elseif ang == -90 or ang == 270 then
  1843.                     hTP[1] = hTP[1] - g.L/2
  1844.                 elseif mathabs(ang) == 180 then
  1845.                     hTP[2] = hTP[2] + g.H/2
  1846.                 else
  1847.                     hTP[2] = hTP[2] - g.H/2
  1848.                 end
  1849.                
  1850.                 return hTP
  1851.             end
  1852.         end,
  1853.         onGround = function(t,px,py)
  1854.             local prop = stringsplit(t.P,"[^,]+",tonumber)
  1855.  
  1856.             px,py = px or 0,py or 0
  1857.             local offset = {}
  1858.             local isOn = false
  1859.  
  1860.             local w = tonumber(t.L)
  1861.             local h = tonumber(t.H)
  1862.             local x = tonumber(t.X)
  1863.             local y = tonumber(t.Y)
  1864.             local gtype = tonumber(t.T)
  1865.             gtype = mathsetLim(gtype,0,15) -- mathmin(15,mathmax(0,gtype))
  1866.  
  1867.             if not tablefind({8,9,15},gtype) then
  1868.                 local area = mode.grounds.gsys.collisionArea[gtype + 1]
  1869.                 w = w + area
  1870.                 h = h + area
  1871.             end
  1872.  
  1873.             if gtype == 13 then
  1874.                 isOn = mathpythag(x,y,px,py,w)
  1875.             else
  1876.                 local ang = mathrad(prop[5])
  1877.  
  1878.                 local range = {w = w/2,h = h/2}
  1879.  
  1880.                 local cosA = mathcos(ang)
  1881.                 local sinA = mathsin(ang)
  1882.                
  1883.                 local vxA = {x = ((-range.w * cosA - (-range.h) * sinA) + x),y = ((-range.w * sinA + (-range.h) * cosA) + y)}
  1884.                 local vxB = {x = ((range.w * cosA - (-range.h) * sinA) + x),y = ((range.w * sinA + (-range.h) * cosA) + y)}
  1885.                 local vxC = {x = ((range.w * cosA - range.h * sinA) + x),y = ((range.w * sinA + range.h * cosA) + y)}
  1886.                 local vxD = {x = ((-range.w * cosA - range.h * sinA) + x),y = ((-range.w * sinA + range.h * cosA) + y)}
  1887.                 offset = {vxA,vxB,vxC,vxD}
  1888.  
  1889.                 local p = 4
  1890.                 for i = 1,4 do
  1891.                     if (offset[i].y < py and offset[p].y >= py) or (offset[p].y < py and offset[i].y >= py) then
  1892.                         if offset[i].x + (py - offset[i].y) / (offset[p].y - offset[i].y) * (offset[p].x - offset[i].x) < px then
  1893.                             isOn = not isOn
  1894.                         end
  1895.                     end
  1896.                     p = i
  1897.                 end
  1898.             end
  1899.  
  1900.             return isOn
  1901.         end,
  1902.         getGroundProperties = function(xml)
  1903.             mode.grounds.gsys.grounds = {}
  1904.             stringgsub(xml,"<S (.-)/>", function(parameters)
  1905.                 local attributes = {}
  1906.                 stringgsub(parameters,"([%-%w]+)=([\"'])(.-)%2",function(tag,_,value)
  1907.                     attributes[tag] = tonumber(value) or value
  1908.                 end)
  1909.                 mode.grounds.gsys.grounds[#mode.grounds.gsys.grounds + 1] = attributes
  1910.             end)
  1911.         end,
  1912.         groundEffects = function()
  1913.             for n,p in next,tfm.get.room.playerList do
  1914.                 if not p.isDead then
  1915.                     local affected = false
  1916.                     for id = 1,#mode.grounds.gsys.grounds do
  1917.                         local ground = mode.grounds.gsys.grounds[id]
  1918.                         local newId = id - 1
  1919.                         if (ground.disablepower or stringsub(ground.P,1,1) == "1" or (ground.v and (_G.currentTime - 3) == (tonumber(ground.v)/1000))) and not mode.grounds.gsys.disabledGrounds[newId] then
  1920.                             -- If the ground has the disablepower attribute, or is dynamic, or the v despawner attribute exists (after it disappear)
  1921.                             mode.grounds.gsys.disabledGrounds[newId] = true
  1922.                         end
  1923.                         if not mode.grounds.gsys.disabledGrounds[newId] and _G.currentTime >= 3 then
  1924.                             if mode.grounds.gsys.onGround(ground,p.x,p.y) then
  1925.                                 affected = true
  1926.                                 local gtype = ground.T
  1927.                                 local color = stringupper(tostring(ground.o or ""))
  1928.                                 mode.grounds.info[n].powersOP.GTYPE = gtype
  1929.                                 if gtype == 1 or color == "89A7F5" then -- ice
  1930.                                     system.bindKeyboard(n,32,true,true)
  1931.                                     if color ~= "" then
  1932.                                         mode.grounds.info[n].powersOP.GTYPE = 1
  1933.                                     end
  1934.                                 elseif gtype == 2 or color == "6D4E94" then -- trampoline
  1935.                                     if color ~= "" then
  1936.                                         mode.grounds.info[n].powersOP.GTYPE = 2
  1937.                                     end
  1938.                                 elseif gtype == 3 or color == "D84801" then -- lava
  1939.                                     if color ~= "" then
  1940.                                         mode.grounds.info[n].powersOP.GTYPE = 3
  1941.                                     end
  1942.                                     id = (id > 1 and id - 1 or #mode.grounds.gsys.grounds)
  1943.                                     local g = mode.grounds.gsys.grounds[id]
  1944.                                     local hTP = mode.grounds.gsys.getTpPos(g)
  1945.                                     tfm.exec.displayParticle(36,p.x,p.y,0,0,0,0,n)
  1946.                                     tfm.get.room.playerList[n].x = 0
  1947.                                     tfm.get.room.playerList[n].y = 0
  1948.                                     tfm.exec.movePlayer(n,hTP[1],hTP[2])
  1949.                                     tfm.exec.displayParticle(36,hTP[1],hTP[2],0,0,0,0,n)
  1950.                                 elseif gtype == 8 or color == "9BAABC" then -- cloud
  1951.                                     system.bindKeyboard(n,32,true,true)
  1952.                                 elseif gtype == 7 then -- sand
  1953.                                     ui.addTextArea(-1,"",n,-1500,-1500,3e3,3e3,0xE5CC5D,0xE5CC5D,mode.grounds.stormIntensities[mode.grounds.info[n].stats.powers.sand[1]],false)
  1954.                                     for i = 1,2 do
  1955.                                         tfm.exec.displayParticle(26,mathrandom(800),mathrandom(350),0,0,0,0,n)
  1956.                                         tfm.exec.displayParticle(27,mathrandom(800),mathrandom(350),0,0,0,0,n)
  1957.                                     end
  1958.                                 elseif gtype == 9 then -- water
  1959.                                     if mode.grounds.hasWater then
  1960.                                         mode.grounds.info[n].drown = mode.grounds.info[n].drown + mathrandom(1,mathfloor(mode.grounds.info[n].stats.powers.water[1]))
  1961.                                         mode.grounds.uibar(1,n,mode.grounds.info[n].drown,0x519DDA,100,20)
  1962.                                         if mode.grounds.info[n].drown > 99 then
  1963.                                             tfm.exec.killPlayer(n)
  1964.                                             mode.grounds.uibar(1,n,mode.grounds.info[n].drown,0xDA516D,100,20)
  1965.                                             mode.grounds.info[n].drown = 0
  1966.                                             for i = 1,8 do
  1967.                                                 tfm.exec.displayParticle(14,p.x+mathrandom(-50,50),p.y+mathrandom(-20,20),0,-1,0,0,n)
  1968.                                             end
  1969.                                         end
  1970.                                         for i = 1,mathrandom(2,4) do
  1971.                                             tfm.exec.displayParticle(14,p.x+mathrandom(-50,50),p.y+mathrandom(-20,20),0,-1,0,0,n)
  1972.                                         end
  1973.                                     end
  1974.                                 elseif gtype == 10 then -- stone
  1975.                                     system.bindKeyboard(n,32,true,true)
  1976.                                 elseif gtype == 11 or color == "E7F0F2" then -- snow
  1977.                                     system.bindKeyboard(n,32,true,true)
  1978.                                 elseif gtype == 12 or gtype == 13 then -- retangle or circle
  1979.                                     if color == "C90909" then
  1980.                                         tfm.exec.killPlayer(n)
  1981.                                     elseif color == "18C92B" then
  1982.                                         if os.time() > mode.grounds.respawn then
  1983.                                             mode.grounds.respawn = os.time() + 7e3
  1984.                                             for k,v in next,tfm.get.room.playerList do
  1985.                                                 if v.isVampire then
  1986.                                                     tfm.exec.killPlayer(k)
  1987.                                                 elseif v.isDead and mode.grounds.info[k].canRev then
  1988.                                                     tfm.exec.respawnPlayer(k)
  1989.                                                 end
  1990.                                             end
  1991.                                         end
  1992.                                     elseif color == "555D77" then
  1993.                                         mode.grounds.info[n].checkpoint = id
  1994.                                     end
  1995.                                 elseif gtype == 15 then -- web
  1996.                                     tfm.exec.movePlayer(n,mode.grounds.spawnPoint[1],mode.grounds.spawnPoint[2])
  1997.                                     tfm.get.room.playerList[n].x = 0
  1998.                                     tfm.get.room.playerList[n].y = 0
  1999.                                 end
  2000.                             end
  2001.                         end
  2002.                     end
  2003.                     if not affected then
  2004.                         mode.grounds.info[n].powersOP.GTYPE = -1
  2005.                     end
  2006.                 end
  2007.             end
  2008.         end,
  2009.     },
  2010.     -- Init
  2011.     reset = function()
  2012.         -- Settings and modes
  2013.         mode.grounds.welcomeMessage = (function()
  2014.             if system.roomNumber == 666 then
  2015.                 return {"<R>","<R>","<R>","<R>"}
  2016.             else
  2017.                 return {"<BV>","<PT>","<BV>","<VP>"}   
  2018.             end
  2019.         end)()
  2020.        
  2021.         mode.grounds.isHouse = system.roomNumber == 801 or system.officialMode[1] == "village"
  2022.        
  2023.         -- Data
  2024.         mode.grounds.info = {}
  2025.        
  2026.         -- Maps
  2027.         mode.grounds.rotation = {1,{9,7,4,1,5,7,10,8,6,11,2,1,3,5}}
  2028.     end,
  2029.     init = function()
  2030.         mode.grounds.translations.pt = mode.grounds.translations.br
  2031.    
  2032.         -- Sets the main language according to the community
  2033.         if mode.grounds.translations[tfm.get.room.community] then
  2034.             mode.grounds.langue = tfm.get.room.community
  2035.         end
  2036.  
  2037.         -- Shuffle the map rotation
  2038.         for k,v in next,mode.grounds.G do
  2039.             v.queue = tableshuffle(v.queue)
  2040.         end
  2041.        
  2042.         -- Map list
  2043.         for k,v in next,mode.grounds.G do
  2044.             for i,j in next,v.queue do
  2045.                 mode.grounds.maps[#mode.grounds.maps + 1] = {j,k}
  2046.             end
  2047.         end
  2048.    
  2049.         -- Organizates the staff table
  2050.         for k,v in next,mode.grounds.staff do
  2051.             tablesort(v,function(t1,t2) return t2[1] > t1[1] end)
  2052.         end
  2053.        
  2054.         -- Organizes the languages
  2055.         mode.grounds.langues = (function()
  2056.             local l = {}
  2057.             for id in next,mode.grounds.translations do
  2058.                 l[#l + 1] = stringupper(id)
  2059.             end
  2060.             tablesort(l)
  2061.             return l
  2062.         end)()
  2063.        
  2064.         -- Translation indexes
  2065.         mode.grounds.translationIndexes = mode.grounds.listener(mode.grounds.translations.en,{})
  2066.        
  2067.         -- Sets the shop prices, upgrades, etc
  2068.         mode.grounds.shop.grounds = {
  2069.             -- Ground ID, #Possible upgrades (Imgs), Price average, Upgrade average
  2070.             [1] = {1,mode.grounds.shop.unpackImages(1,3),1.05,1.5},
  2071.             [2] = {7,mode.grounds.shop.unpackImages(7,4),.4,2},
  2072.             [3] = {8,mode.grounds.shop.unpackImages(8,3),1.15,1.47},
  2073.             [4] = {9,mode.grounds.shop.unpackImages(9,3),1.6,.6},
  2074.             [5] = {10,mode.grounds.shop.unpackImages(10,3),1.1,1.65},
  2075.             [6] = {11,mode.grounds.shop.unpackImages(11,5),.5,1.42},
  2076.         }
  2077.        
  2078.         -- Sets the commands
  2079.         mode.grounds.cmds = system.getTranslation("commands")
  2080.        
  2081.         -- Disable commands
  2082.         for k,v in next,mode.grounds.cmds do
  2083.             disableChatCommand(v)
  2084.         end
  2085.         for k,v in next,{"o","p","h","k","?","pw","time","np","is","check","review","next","again"} do
  2086.             disableChatCommand(v)
  2087.         end
  2088.        
  2089.         -- Official modes running together
  2090.         if system.officialMode[1] == "racing" then
  2091.             mode.grounds.rotation = {1,{7}}
  2092.         elseif system.officialMode[1] == "bootcamp" then
  2093.             mode.grounds.rotation = {1,{3}}
  2094.         end
  2095.        
  2096.         -- House system
  2097.         if mode.grounds.isHouse then
  2098.             system.isRoom = false
  2099.             mode.grounds.rotation = {1,{12}}
  2100.             tfm.exec.disableAfkDeath()
  2101.         end
  2102.        
  2103.         -- Init
  2104.         for _,f in next,{"AutoShaman","AutoScore","AutoNewGame","AutoTimeLeft","MinimalistMode","PhysicalConsumables"} do
  2105.             tfm.exec["disable"..f]()
  2106.         end
  2107.         tfm.exec.setAutoMapFlipMode(false)
  2108.         tfm.exec.setRoomMaxPlayers(16)
  2109.        
  2110.         mode.grounds.alivePlayers,mode.grounds.totalPlayers = system.players()
  2111.        
  2112.         mode.grounds.uileaderboard()
  2113.         system.newTimer(function()
  2114.             tfm.exec.newGame(mode.grounds.newMap())
  2115.         end,1000,false)
  2116.     end,
  2117.     -- Callbacks
  2118.     eventTextAreaCallback = function(i,n,c)
  2119.         local p = stringsplit(c,"[^%.]+")
  2120.         if p[1] == "shop" and os.time() > mode.grounds.info[n].shop.timer then
  2121.             mode.grounds.info[n].shop.timer = os.time() + 900
  2122.             if p[2] == "left" then
  2123.                 mode.grounds.info[n].shop.page = mode.grounds.info[n].shop.page - 1
  2124.                 mode.grounds.uishop(n)
  2125.             elseif p[2] == "right" then
  2126.                 mode.grounds.info[n].shop.page = mode.grounds.info[n].shop.page + 1
  2127.                 mode.grounds.uishop(n)
  2128.             elseif p[2] == "buy" and mode.grounds.info[n].groundsDataLoaded then
  2129.                 p[3] = tonumber(p[3]) or 0
  2130.                 if mode.grounds.info[n].stats.groundsCoins >= p[3] then
  2131.                     mode.grounds.info[n].stats.groundsCoins = mode.grounds.info[n].stats.groundsCoins - p[3]
  2132.                     local loc = mode.grounds.info[n].stats.powers[p[4]]
  2133.                     mode.grounds.info[n].stats.powers[p[4]][#loc] = mode.grounds.info[n].stats.powers[p[4]][#loc] + 1
  2134.                     mode.grounds.info[n].stats.powers[p[4]][1] = mode.grounds.info[n].stats.powers[p[4]][1] * mode.grounds.shop.grounds[mode.grounds.info[n].shop.page][4]
  2135.                     tfm.exec.chatMessage(stringformat("<PT>[•] <BV>%s",stringformat(system.getTranslation("bought",n),"<J>$"..p[3].."</J>","<ROSE>"..system.getTranslation("grounds."..mode.grounds.shop.grounds[mode.grounds.info[n].shop.page][1],n)[1].."</ROSE>",n)),n)
  2136.                     mode.grounds.uishop(n)
  2137.                 else
  2138.                     tfm.exec.chatMessage(stringformat("<PT>[•] <R>%s",system.getTranslation("cantbuy",n)),n)
  2139.                 end
  2140.             elseif p[2] == "close" then
  2141.                 for i = 4,13 do
  2142.                     ui.removeTextArea(i,n)
  2143.                 end
  2144.                 mode.grounds.info[n].shop.accessing = false
  2145.                 for k,v in next,mode.grounds.info[n].shop.image do
  2146.                     tfm.exec.removeImage(v)
  2147.                 end
  2148.             end
  2149.         elseif p[1] == "profile" then
  2150.             if p[2] == "close" then
  2151.                 for i = 14,16 do
  2152.                     ui.removeTextArea(i,n)
  2153.                 end
  2154.                 mode.grounds.info[n].profileAccessing = false
  2155.             elseif p[2] == "open" then
  2156.                 if p[3] then
  2157.                     mode.grounds.uiprofile(n,p[3])
  2158.                 else
  2159.                     mode.grounds.uiprofile(n,n)
  2160.                 end
  2161.             end
  2162.         elseif p[1] == "menu" and os.time() > mode.grounds.info[n].menu.timer then
  2163.             mode.grounds.info[n].menu.timer = os.time() + 750
  2164.             if p[2] == "page" and p[3] then
  2165.                 mode.grounds.info[n].menu.page = tonumber(p[3])
  2166.                 mode.grounds.uimenu(n)
  2167.             elseif p[2] == "right" then
  2168.                 mode.grounds.info[n].menu.page = mode.grounds.info[n].menu.page + 1
  2169.                 mode.grounds.uimenu(n)
  2170.             elseif p[2] == "left" then
  2171.                 mode.grounds.info[n].menu.page = mode.grounds.info[n].menu.page - 1
  2172.                 mode.grounds.uimenu(n)
  2173.             elseif p[2] == "popup" then
  2174.                 mode.grounds.info[n].menu.showPopup = not mode.grounds.info[n].menu.showPopup
  2175.                 mode.grounds.uimenu(n)
  2176.             elseif p[2] == "close" then
  2177.                 for i = 22,17,-1 do
  2178.                     ui.removeTextArea(i,n)
  2179.                 end
  2180.                 mode.grounds.info[n].menu.accessing = false
  2181.                 if mode.grounds.info[n].showHelp then
  2182.                     mode.grounds.info[n].showHelp = false
  2183.                     ui.removeTextArea(0,n)
  2184.                 end
  2185.             end
  2186.         elseif p[1] == "print" then
  2187.             p[2] = stringgsub(p[2],"¬",".")
  2188.             tfm.exec.chatMessage(stringformat("<PT>[•] <BV>%s",p[2]),n)
  2189.         elseif p[1] == "ranking" then
  2190.             if p[2] == "close" then
  2191.                 mode.grounds.info[n].leaderboardAccessing = false
  2192.                 for i = 23,36 do
  2193.                     ui.removeTextArea(i,n)
  2194.                 end
  2195.             end
  2196.         elseif p[1] == "info" then
  2197.             if p[2] == "close" then
  2198.                 for i = 37,38 do
  2199.                     ui.removeTextArea(i,n)
  2200.                 end
  2201.                 for k,v in next,mode.grounds.info[n].infoImage do
  2202.                     tfm.exec.removeImage(v)
  2203.                 end
  2204.                 mode.grounds.info[n].infoImage = {}
  2205.             else
  2206.                 mode.grounds.uidisplayInfo(n,p)
  2207.             end
  2208.         end
  2209.     end,
  2210.     -- New Player
  2211.     eventNewPlayer = function(n)
  2212.         tfm.exec.chatMessage(stringformat("%s[•] %s%s\n\n<G>[^_^] %s%s",mode.grounds.welcomeMessage[2],mode.grounds.welcomeMessage[3],stringformat(system.getTranslation("welcome"),"<ROSE>" .. module._NAME .. mode.grounds.welcomeMessage[1]),mode.grounds.welcomeMessage[4],stringformat(system.getTranslation("developer"),"Bolodefchoco")),n)
  2213.         if mathrandom(10) < 3 then
  2214.             tfm.exec.chatMessage("<ROSE>[•] Play #powers at /room #powers",n)
  2215.         end
  2216.        
  2217.         if system.isPlayer(n) then
  2218.             for _,key in next,mode.grounds.bindKeys do
  2219.                 if key < 4 then
  2220.                     system.bindKeyboard(n,key,false,true)
  2221.                 end
  2222.                 system.bindKeyboard(n,key,true,true)
  2223.             end
  2224.         else
  2225.             tfm.exec.chatMessage("<R>Souris! :(",n)
  2226.         end
  2227.         if not mode.grounds.info[n] then
  2228.             mode.grounds.info[n] = {
  2229.                 groundsDataLoaded = true,
  2230.                 showHelp = true,
  2231.                 right = true,
  2232.                 langue = mode.grounds.langue,
  2233.                 isWalking = false,
  2234.                 drown = 0,
  2235.                 ranking = -1,
  2236.                 canRev = false,
  2237.                 checkpoint = -1,
  2238.                 shop = {
  2239.                     accessing = false,
  2240.                     page = 0,
  2241.                     timer = 0,
  2242.                     image = {},
  2243.                 },
  2244.                 menu = {
  2245.                     accessing = false,
  2246.                     page = 0,
  2247.                     timer = 0,
  2248.                     showPopup = true,
  2249.                 },
  2250.                 profileAccessing = false,
  2251.                 leaderboardAccessing = false,
  2252.                 profileTimer = 0,
  2253.                 leaderboardTimer = 0,
  2254.                 isOnline = true,
  2255.                 stats = {
  2256.                     groundsCoins = 1000,
  2257.                     rounds = 0,
  2258.                     podiums = 0,
  2259.                     deaths = 0,
  2260.                     powers = {
  2261.                         ice = {25,100,1}, -- power, timer, level
  2262.                         lava = {0,1}, -- power, level
  2263.                         sand = {1,1}, -- Txtarea opacity, level
  2264.                         cloud = {35,100,1}, -- power, timer, level
  2265.                         water = {5,1}, -- power, level
  2266.                         stone = {15,2500,700,1}, -- size, despawn timer, timer, level
  2267.                         snow = {5,100,1}, -- power, timer, level
  2268.                         spiderweb = {0,1}, -- power, level
  2269.                     },
  2270.                 },
  2271.                 powersOP = {
  2272.                     TIMER = 0,
  2273.                     GTYPE = -1,
  2274.                 },
  2275.                 infoImage = {},
  2276.             }
  2277.             if not mode.grounds.isHouse then
  2278.                 ui.addTextArea(0,"",n,-1500,-1500,3e3,3e3,1,1,.8,true)
  2279.                 mode.grounds.uimenu(n)
  2280.             end
  2281.         end
  2282.    
  2283.         mode.grounds.info[n].isOnline = true
  2284.         mode.grounds.info[n].canRev = false
  2285.     end,
  2286.     -- New Game
  2287.     eventNewGame = function()
  2288.         local mapName = {}
  2289.         if tablefind(mode.grounds.maps,tfm.get.room.xmlMapInfo.mapCode,1) then
  2290.             mapName[#mapName + 1] = "<font color='#".. mode.grounds.mapInfo[5] .."'>G" .. mode.grounds.mapInfo[2] .. "</font>"
  2291.         else
  2292.             mode.grounds.mapInfo = {0,0,0,0,"CAA4CF"}
  2293.             mode.grounds.afterFunction = (function() end)
  2294.         end
  2295.  
  2296.         tfm.exec.setGameTime(3 * 60)
  2297.  
  2298.         mode.grounds.podium = 0
  2299.         mode.grounds.availableRoom = system.isRoom and mode.grounds.totalPlayers > 2
  2300.         if not mode.grounds.availableRoom then
  2301.             if mathrandom(30) < 16 then
  2302.                 if not system.isRoom then
  2303.                     tfm.exec.chatMessage(stringformat("<PT>[•] <BV>%s",system.getTranslation("countstats.tribe")))
  2304.                 else
  2305.                     tfm.exec.chatMessage(stringformat("<PT>[•] <BV>%s",system.getTranslation("countstats.mice")))
  2306.                 end
  2307.             end
  2308.         end
  2309.  
  2310.         for k,v in next,mode.grounds.info do
  2311.             if not system.isPlayer(k) then
  2312.                 tfm.exec.killPlayer(k)
  2313.             end
  2314.             if v.groundsDataLoaded and mode.grounds.availableRoom then
  2315.                 v.stats.rounds = v.stats.rounds + 1
  2316.             end
  2317.             v.canRev = true
  2318.             v.right = true
  2319.             v.checkpoint = -1
  2320.         end
  2321.  
  2322.         mode.grounds.afterFunction()
  2323.        
  2324.         mode.grounds.hasWater = false
  2325.         local deactivateWater = mode.grounds.isHouse
  2326.  
  2327.         mode.grounds.despawnGrounds = {}
  2328.         mode.grounds.gsys.disabledGrounds = {}
  2329.         local currentXml = tfm.get.room.xmlMapInfo
  2330.  
  2331.         local xmlPowers = {}
  2332.             -- Info
  2333.         xmlPowers[1] = { -- Soulmate system
  2334.             attribute = "A", -- Soulmate not allowed for rooms with odd amount of players
  2335.             func = function()
  2336.                 if mode.grounds.totalPlayers % 2 ~= 0 then
  2337.                     tableforeach(mode.grounds.info,tfm.exec.killPlayer)
  2338.                 end
  2339.             end
  2340.         }
  2341.         xmlPowers[2] = { -- Map Width
  2342.             attribute = "L",
  2343.             func = function(size)
  2344.                 if size then
  2345.                     mode.grounds.mapInfo[3] = tonumber(size)
  2346.                 end
  2347.             end
  2348.         }
  2349.         xmlPowers[3] = { -- Map Height
  2350.             attribute = "H",
  2351.             func = function(size)
  2352.                 if size then
  2353.                     mode.grounds.mapInfo[4] = tonumber(size)
  2354.                 end
  2355.             end
  2356.         }
  2357.        
  2358.         mode.grounds.mapInfo[3] = mathmax(800,mode.grounds.mapInfo[3])
  2359.         mode.grounds.mapInfo[4] = mathmax(400,mode.grounds.mapInfo[4])
  2360.             -- Powers
  2361.         xmlPowers[4] = { -- mapname
  2362.             attribute = "mapname",
  2363.             func = function(t)
  2364.                 if t ~= "" then
  2365.                     mapName[#mapName + 1] = t
  2366.                 end
  2367.             end
  2368.         }
  2369.         xmlPowers[5] = { -- disablepower
  2370.             attribute = "disablepower",
  2371.             func = function(g)
  2372.                 for ground in stringgmatch(g,"[^,]+") do
  2373.                     ground = tonumber(ground)
  2374.                     if ground and not mode.grounds.gsys.disabledGrounds[ground] then
  2375.                         mode.grounds.gsys.disabledGrounds[ground] = true
  2376.                     end
  2377.                 end
  2378.             end
  2379.         }
  2380.         xmlPowers[6] = { -- cheese
  2381.             attribute = "cheese",
  2382.             func = function()
  2383.                 tableforeach(mode.grounds.info,tfm.exec.giveCheese)
  2384.             end
  2385.         }
  2386.         xmlPowers[7] = { -- meep
  2387.             attribute = "meep",
  2388.             func = function()
  2389.                 tableforeach(mode.grounds.info,tfm.exec.giveMeep)
  2390.             end
  2391.         }
  2392.         xmlPowers[8] = { -- addtime
  2393.             attribute = "addtime",
  2394.             func = function(minutes)
  2395.                 tfm.exec.setGameTime((3 + (tonumber(minutes) or 0)) * 60)
  2396.             end
  2397.         }
  2398.         xmlPowers[9] = { -- notwater
  2399.             attribute = "notwater",
  2400.             func = function()
  2401.                 deactivateWater = true
  2402.             end
  2403.         }
  2404.         xmlPowers[10] = { -- setvampire
  2405.             attribute = "setvampire",
  2406.             func = function(coordinates)
  2407.                 if mode.grounds.totalPlayers > 2 then
  2408.                     local coord,axY = xml.getCoordinates(coordinates)
  2409.  
  2410.                     local vampires,p = {},{}
  2411.                     for k,v in next,mode.grounds.info do
  2412.                         if v.isOnline then
  2413.                             p[#p + 1] = k
  2414.                         end
  2415.                     end
  2416.                     local randomVamp = ""
  2417.                     for i = 1,mathfloor(mode.grounds.totalPlayers/3) do
  2418.                         repeat
  2419.                             randomVamp = tablerandom(p)
  2420.                         until not tablefind(vampires,randomVamp)
  2421.                         vampires[#vampires + 1] = randomVamp
  2422.                     end
  2423.                     for k,v in next,vampires do
  2424.                         if type(coord) == "table" then
  2425.                             local c = tablerandom(coord)
  2426.                             tfm.exec.movePlayer(v,c.x,c.y)
  2427.                         else
  2428.                             if axY == 0 then
  2429.                                 tfm.exec.movePlayer(v,coord,mathrandom(10,mode.grounds.mapInfo[4] - 10))
  2430.                             else
  2431.                                 tfm.exec.movePlayer(v,mathrandom(10,mode.grounds.mapInfo[4] - 10),axY)
  2432.                             end
  2433.                         end
  2434.                         tfm.exec.setVampirePlayer(v)
  2435.                     end
  2436.                 else
  2437.                     tableforeach(mode.grounds.info,tfm.exec.setVampirePlayer)
  2438.                 end
  2439.             end
  2440.         }
  2441.         xmlPowers[11] = { -- shaman
  2442.             attribute = "shaman",
  2443.             func = function(t)
  2444.                 if t ~= "" then
  2445.                     ui.setShamanName(t)
  2446.                 end
  2447.             end
  2448.         }  
  2449.  
  2450.         xml.attribFunc(currentXml.xml or "",xmlPowers)
  2451.  
  2452.         mode.grounds.gsys.getGroundProperties(currentXml.xml)
  2453.  
  2454.         if not deactivateWater then
  2455.             for k,v in next,mode.grounds.gsys.grounds do
  2456.                 if v.T == 9 then
  2457.                     mode.grounds.hasWater = true
  2458.                     for k,v in next,mode.grounds.info do
  2459.                         v.drown = 0
  2460.                         mode.grounds.uibar(1,k,v.drown,0x519DDA,100,20)
  2461.                     end
  2462.                     break
  2463.                 end
  2464.             end
  2465.         end
  2466.         if not mode.grounds.hasWater then
  2467.             for i = 1,3 do
  2468.                 ui.removeTextArea(i)
  2469.             end
  2470.         end
  2471.        
  2472.         local ini = ""
  2473.         local D = stringmatch(tfm.get.room.xmlMapInfo.xml,"<D>(.-)</D>") or ""
  2474.         for k,v in next,{"DS","T"} do
  2475.             ini = stringmatch(D,"<"..v.." (.-)/>")
  2476.             if ini then
  2477.                 break
  2478.             end
  2479.         end
  2480.         ini = ini or ""
  2481.         local sX = stringmatch(ini,"X=\"(.-)\"")
  2482.         local sY = stringmatch(ini,"Y=\"(.-)\"")
  2483.         mode.grounds.spawnPoint = {tonumber(sX) or 0,tonumber(sY) or 0}
  2484.        
  2485.         ui.setMapName(tableconcat(mapName,"   <G>|<J>   ") .. (#mapName > 0 and "   <G>|<J>   " or "") .. currentXml.author .. " <BL>- " .. tfm.get.room.currentMap)
  2486.     end,
  2487.     -- Loop
  2488.     eventLoop = function()
  2489.         mode.grounds.gsys.groundEffects()
  2490.        
  2491.         if _G.currentTime % 5 == 0 then
  2492.             mode.grounds.alivePlayers,mode.grounds.totalPlayers = system.players()
  2493.         end
  2494.        
  2495.         if not mode.grounds.isHouse and _G.currentTime == 3 and mathrandom(50) < 16 and os.time() > mode.grounds.announceTimer then
  2496.             mode.grounds.announceTimer = os.time() + 5000
  2497.             tfm.exec.chatMessage(stringformat("<PT>[•] <BV>%s",system.getTranslation("powersenabled")))
  2498.         end
  2499.  
  2500.         if mode.grounds.isHouse then
  2501.             if _G.currentTime%5 == 0 then
  2502.                 if _G.leftTime <= 2 then
  2503.                     tfm.exec.newGame(mode.grounds.newMap())
  2504.                 end
  2505.             end
  2506.         else
  2507.             if _G.currentTime%2 == 0 and not mode.grounds.review then
  2508.                 if mode.grounds.alivePlayers < 1 or _G.leftTime <= 2 then
  2509.                     tfm.exec.newGame(mode.grounds.newMap())
  2510.                 elseif mode.grounds.alivePlayers == 1 and _G.leftTime > 50 and mode.grounds.totalPlayers > 1 then
  2511.                     tfm.exec.setGameTime(30)
  2512.                 elseif mode.grounds.podium > 5 and mode.grounds.alivePlayers > 3 then
  2513.                     tfm.exec.setGameTime(20,false)
  2514.                 end
  2515.             end
  2516.         end
  2517.  
  2518.         --[[
  2519.         local grounds = {}
  2520.         for k,v in next,mode.grounds.despawnGrounds do
  2521.             grounds[k] = v
  2522.         end
  2523.         for k,v in next,grounds do
  2524.             if os.time() > v[2] then
  2525.                 tfm.exec.removePhysicObject(v[1])
  2526.                 tableremove(mode.grounds.despawnGrounds,k)
  2527.             end
  2528.         end
  2529.         ]]
  2530.        
  2531.         for n,v in next,mode.grounds.info do
  2532.             v.isWalking = (tfm.get.room.playerList[n] and (tfm.get.room.playerList[n].movingRight or tfm.get.room.playerList[n].movingLeft) or false)
  2533.             v.right = (tfm.get.room.playerList[n] and (tfm.get.room.playerList[n].isFacingRight) or false)
  2534.             if v.powersOP.GTYPE ~= 7 then -- Sand
  2535.                 ui.removeTextArea(-1,n)
  2536.             end
  2537.             if mode.grounds.hasWater then
  2538.                 if _G.currentTime%2 == 0 then
  2539.                     if tfm.get.room.playerList[n] then
  2540.                         if not tfm.get.room.playerList[n].isDead and v.powersOP.GTYPE ~= 9 then -- Water
  2541.                             if v.drown > 0 then
  2542.                                 v.drown = v.drown - mathrandom(1,mathfloor(v.stats.powers.water[1]))
  2543.                                 mode.grounds.uibar(1,n,v.drown,0x519DDA,100,20)
  2544.                             end
  2545.                         end
  2546.                     end
  2547.                 end
  2548.             end
  2549.         end
  2550.     end,
  2551.     -- Keyboard
  2552.     eventKeyboard = function(n,k,d,x,y)
  2553.         tfm.get.room.playerList[n].x = x
  2554.         tfm.get.room.playerList[n].x = y
  2555.         if tablefind(mode.grounds.bindKeys,k) then
  2556.             if k < 4 then
  2557.                 if k == 0 then
  2558.                     mode.grounds.info[n].right = false
  2559.                 elseif k == 2 then
  2560.                     mode.grounds.info[n].right = true
  2561.                 end
  2562.             elseif k == stringbyte("O") then
  2563.                 mode.grounds.eventChatCommand(n,"o")
  2564.             elseif k == stringbyte("P") then
  2565.                 if mode.grounds.info[n].profileAccessing then
  2566.                     mode.grounds.eventTextAreaCallback(nil,n,"profile.close")
  2567.                 else
  2568.                     if os.time() > mode.grounds.info[n].profileTimer then
  2569.                         mode.grounds.info[n].profileTimer = os.time() + 1e3
  2570.                         mode.grounds.eventChatCommand(n,"p")
  2571.                     end
  2572.                 end
  2573.             elseif k == stringbyte("H") then
  2574.                 mode.grounds.eventChatCommand(n,"h")
  2575.             elseif k == stringbyte("K") then
  2576.                 mode.grounds.eventChatCommand(n,"k")
  2577.             end
  2578.         else
  2579.             if k == 32 and os.time() > mode.grounds.info[n].powersOP.TIMER then
  2580.                 local ms = 0
  2581.                 local power = {0,0}
  2582.                 if mode.grounds.info[n].powersOP.GTYPE == 8 then -- Cloud
  2583.                     power = mode.grounds.info[n].stats.powers.cloud
  2584.                     ms = power[2]
  2585.                     tfm.exec.movePlayer(n,0,0,true,0,-power[1],true)
  2586.                 elseif mode.grounds.info[n].powersOP.GTYPE == 1 and mode.grounds.info[n].isWalking then -- Ice
  2587.                     power = mode.grounds.info[n].stats.powers.ice
  2588.                     ms = power[2]
  2589.                     tfm.exec.movePlayer(n,0,0,false,(mode.grounds.info[n].right and power[1] or -power[1]),0,true)
  2590.                 elseif mode.grounds.info[n].powersOP.GTYPE == 11 and not mode.grounds.info[n].isWalking then -- Snow
  2591.                     power = mode.grounds.info[n].stats.powers.snow
  2592.                     ms = power[2]
  2593.                     tfm.exec.addShamanObject(34,x + (mode.grounds.info[n].right and 20 or -20),y - 5,0,(mode.grounds.info[n].right and power[1] or -power[1]))
  2594.                     tfm.exec.playEmote(n,26)
  2595.                 elseif mode.grounds.info[n].powersOP.GTYPE == 10 and not mode.grounds.info[n].isWalking then -- Stone
  2596.                     power = mode.grounds.info[n].stats.powers.stone
  2597.                     local id = tfm.get.room.playerList[n].id
  2598.                     if not mode.grounds.despawnGrounds[id] then--if not tablefind(mode.grounds.despawnGrounds,id,1) then
  2599.                         ms = power[3]
  2600.                         local halfSize = (power[1]/2) + 15
  2601.                         tfm.exec.addPhysicObject(id,x + (mode.grounds.info[n].right and halfSize or -halfSize),y + 32 - halfSize,{
  2602.                             type = 10,
  2603.                             miceCollision = true,
  2604.                             groundCollision = false,
  2605.                             width = power[1],
  2606.                             height = power[1],
  2607.                             friction = .3,
  2608.                             restitution = 0
  2609.                         })
  2610.                         mode.grounds.despawnGrounds[id] = true
  2611.  
  2612.                         system.newTimer(function()
  2613.                             tfm.exec.removePhysicObject(id)
  2614.                             mode.grounds.despawnGrounds[id] = nil
  2615.                         end,power[2],false)
  2616.                         --tableinsert(mode.grounds.despawnGrounds,{id,os.time() + power[2]})
  2617.                     end
  2618.                 end
  2619.                 mode.grounds.info[n].powersOP.TIMER = os.time() + ms
  2620.                 system.bindKeyboard(n,32,true,false)
  2621.             end
  2622.             mode.grounds.info[n].powersOP.GTYPE = -1
  2623.         end
  2624.     end,
  2625.     -- Commands
  2626.     eventChatCommand = function(n,c)
  2627.         if system.isPlayer(n) then
  2628.             c = deactivateAccents(c)
  2629.             system.disableChatCommandDisplay(c,true)
  2630.             local p = stringsplit(c,"[^%s]+",stringlower)
  2631.             disableChatCommand(p[1])
  2632.             if (p[1] == mode.grounds.cmds.shop or p[1] == "o") and not mode.grounds.isHouse then
  2633.                 if mode.grounds.info[n].shop.accessing then
  2634.                     mode.grounds.eventTextAreaCallback(nil,n,"shop.close")
  2635.                 else
  2636.                     if os.time() > mode.grounds.info[n].shop.timer then
  2637.                         mode.grounds.info[n].shop.timer = os.time() + 1200
  2638.                         mode.grounds.uishop(n)
  2639.                     end
  2640.                 end
  2641.             elseif (p[1] == mode.grounds.cmds.profile or p[1] == "p") and not mode.grounds.isHouse then
  2642.                 if p[2] then
  2643.                     p[2] = stringnick(p[2])
  2644.                     if mode.grounds.info[p[2]] then
  2645.                         mode.grounds.uiprofile(n,p[2])
  2646.                     end
  2647.                 else
  2648.                     mode.grounds.uiprofile(n,n)
  2649.                 end
  2650.                 mode.grounds.info[n].profileAccessing = true
  2651.             elseif p[1] == mode.grounds.cmds.help or p[1] == "h" then
  2652.                 if mode.grounds.info[n].menu.accessing then
  2653.                     mode.grounds.eventTextAreaCallback(nil,n,"menu.close")
  2654.                 else
  2655.                     if os.time() > mode.grounds.info[n].menu.timer then
  2656.                         mode.grounds.info[n].menu.timer = os.time() + 1e3
  2657.                         mode.grounds.uimenu(n)
  2658.                     end
  2659.                 end
  2660.             elseif p[1] == mode.grounds.cmds.langue then
  2661.                 p[2] = p[2] and stringlower(p[2]) or nil
  2662.                 if p[2] and (p[2] == "default" or mode.grounds.translations[p[2]]) then
  2663.                     if p[2] == "default" then
  2664.                         mode.grounds.info[n].langue = (mode.grounds.translations[tfm.get.room.playerList[n].community] and tfm.get.room.playerList[n].community or mode.grounds.langue)
  2665.                     else
  2666.                         mode.grounds.info[n].langue = stringlower(p[2])
  2667.                     end
  2668.                     tfm.exec.chatMessage(stringformat("<PT>[•] <BV>%s",stringformat(system.getTranslation("language",n),stringupper(mode.grounds.info[n].langue))),n)
  2669.                 else
  2670.                     tfm.exec.chatMessage(stringformat("<PT>[•] <J>!%s <PS>%s",p[1],tableconcat(mode.grounds.langues," <G>-</G> ")),n)
  2671.                 end
  2672.             elseif (p[1] == mode.grounds.cmds.leaderboard or p[1] == "k") and not mode.grounds.isHouse then
  2673.                 if mode.grounds.info[n].leaderboardAccessing then
  2674.                     mode.grounds.eventTextAreaCallback(nil,n,"ranking.close")
  2675.                 else
  2676.                     if os.time() > mode.grounds.info[n].leaderboardTimer then
  2677.                         mode.grounds.info[n].leaderboardTimer = os.time() + 1e3
  2678.                         mode.grounds.uileaderboard(n)
  2679.                     end
  2680.                 end
  2681.             elseif p[1] == mode.grounds.cmds.info or p[1] == "?" then
  2682.                 local grounds = system.getTranslation("grounds",n)
  2683.                 local ground = grounds[mode.grounds.info[n].powersOP.GTYPE]
  2684.                 if ground then
  2685.                     mode.grounds.uidisplayInfo(n,{"info","grounds",stringgsub(ground[1],"'","#"),ground[2]})
  2686.                 end
  2687.             elseif p[1] == "mapinfo" and mode.grounds.mapInfo[2] > 0 then
  2688.                 tfm.exec.chatMessage(stringformat("<PT>[•] <BV>G%s (%s) - %s - @%s",mode.grounds.mapInfo[2],mode.grounds.G[mode.grounds.mapInfo[2]].name,tfm.get.room.xmlMapInfo.author,mode.grounds.mapInfo[1]),n)
  2689.             else
  2690.                 local isAdmin,isMapEv,isTranslator = system.roomAdmins[n],tablefind(mode.grounds.staff.mapEvaluators,n,1),tablefind(mode.grounds.staff.translators,n,1)
  2691.                 if p[1] == mode.grounds.cmds.pw or p[1] == "pw" then
  2692.                     if isAdmin then
  2693.                         local newPassword = p[2] and tableconcat(p," ",nil,2) or ""
  2694.                         local pwMsg = system.getTranslation("password")
  2695.                         if newPassword == "" then
  2696.                             tfm.exec.chatMessage(stringformat("<R>[•] %s",pwMsg.off))
  2697.                         else
  2698.                             local xxx = stringrep("*",#newPassword)
  2699.                             for k in next,mode.grounds.info do
  2700.                                 if system.roomAdmins[k] and system.isPlayer(k) then
  2701.                                     tfm.exec.chatMessage(stringformat("<R>[•] %s",stringformat(pwMsg.on,newPassword)),k)
  2702.                                 else
  2703.                                     tfm.exec.chatMessage(stringformat("<R>[•] %s",stringformat(pwMsg.on,xxx)),k)
  2704.                                 end
  2705.                             end
  2706.                         end
  2707.                         tfm.exec.setRoomPassword(newPassword)
  2708.                     else
  2709.                         tfm.exec.chatMessage("<ROSE>[•] /room #" .. module._NAME .. mathrandom(0,999) .. "@" .. n,n)
  2710.                     end
  2711.                 end
  2712.                 if not system.isRoom then
  2713.                     local permission = (mode.grounds.isHouse and system.roomAdmins[n] or isMapEv)
  2714.                     if p[1] == "time" and permission then
  2715.                         tfm.exec.setGameTime(p[2] or 1e7)
  2716.                     elseif p[1] == "np" and p[2] and permission then
  2717.                         mode.grounds.mapInfo = {0,0,0,0,"CAA4CF"}
  2718.                         tfm.exec.newGame(p[2])
  2719.                     elseif p[1] == "review" and isMapEv then
  2720.                         mode.grounds.review = not mode.grounds.review
  2721.                         tfm.exec.chatMessage("<BV>[•] REVIEW MODE : " .. stringupper(tostring(mode.grounds.review)),n)
  2722.                         tfm.exec.disableAfkDeath(mode.grounds.review)
  2723.                         if mode.grounds.review then
  2724.                             tableforeach(mode.grounds.info,tfm.exec.respawnPlayer)
  2725.                         end
  2726.                     elseif p[1] == "next" and _G.currentTime > 10 and permission then
  2727.                         tfm.exec.newGame(mode.grounds.newMap())
  2728.                     elseif p[1] == "again" and _G.currentTime > 10 and permission then
  2729.                         if tfm.get.room.currentMap then
  2730.                             tfm.exec.newGame(tfm.get.room.currentMap)
  2731.                         end
  2732.                     end
  2733.                 end
  2734.                 if p[1] == "is" and (mode.grounds.isHouse or isMapEv) then
  2735.                     p[2] = p[2] or tfm.get.room.currentMap
  2736.                     p[2] = tonumber(stringmatch(p[2],"@?(%d+)")) or 0
  2737.                    
  2738.                     local exist,index = tablefind(mode.grounds.maps,p[2],1)
  2739.                     local cat = exist and mode.grounds.maps[index][2] or 0
  2740.                     tfm.exec.chatMessage(stringformat("<BV>[•] @%s : %s",p[2],stringupper(tostring(exist)) .. (exist and " (G"..cat..")" or "")),n)
  2741.                 end
  2742.                 if p[1] == "check" and isTranslator then
  2743.                     p[2] = p[2] and stringlower(p[2]) or nil
  2744.                     if p[2] and mode.grounds.translations[p[2]] then
  2745.                         local newP3 = p[3] and system.loadTable("mode.grounds.translations."..p[2].."."..p[3]) or {}
  2746.                         if newP3 and type(newP3) == "string" then
  2747.                             tfm.exec.chatMessage("<CEP>[•] [" .. p[3] .. "] : <N><VI>\"</VI>" .. newP3 .. "<VI>\"</VI>",n)
  2748.                         else
  2749.                             tfm.exec.chatMessage("<CEP>[•] " .. (p[3] and "Invalid! Try one of these indexes:" or "!" .. p[1] .. " " .. p[2] .. " <VI>id"),n)
  2750.                             for k,v in next,mode.grounds.translationIndexes do
  2751.                                 tfm.exec.chatMessage("<N>\t\t" .. v,n)
  2752.                             end
  2753.                         end
  2754.                     else
  2755.                         tfm.exec.chatMessage("<CEP>[•] !" .. p[1] .. " " .. tableconcat(mode.grounds.langues," <G>-</G> "),n)
  2756.                     end
  2757.                 end
  2758.             end
  2759.         end
  2760.     end,
  2761.     -- Victory
  2762.     eventPlayerWon = function(n)
  2763.         if mode.grounds.availableRoom and mode.grounds.info[n].groundsDataLoaded and system.isPlayer(n) then
  2764.             mode.grounds.podium = mode.grounds.podium + 1
  2765.            
  2766.             if mode.grounds.podium < 4 then
  2767.                 mode.grounds.info[n].stats.podiums = mode.grounds.info[n].stats.podiums + 1
  2768.                
  2769.                 local addedCoins = 20 - mode.grounds.podium * 5
  2770.                 mode.grounds.info[n].stats.groundsCoins = mode.grounds.info[n].stats.groundsCoins + addedCoins
  2771.                 tfm.exec.setPlayerScore(n,4-podium,true)
  2772.                 tfm.exec.chatMessage(stringformat("<PT>[•] <BV>%s",stringformat(system.getTranslation("gotcoin",n),"<J>+$"..addedCoins.."</J>")),n)
  2773.                
  2774.                 if mode.grounds.podium == 1 then
  2775.                     tfm.exec.setGameTime(60,false)
  2776.                 end
  2777.             else
  2778.                 if mode.grounds.podium == 4 then
  2779.                     tfm.exec.setGameTime(30,false)
  2780.                 end
  2781.                
  2782.                 mode.grounds.info[n].stats.groundsCoins = mode.grounds.info[n].stats.groundsCoins + 1
  2783.                 tfm.exec.setPlayerScore(n,1,true)
  2784.             end
  2785.            
  2786.             if mode.grounds.hasWater then
  2787.                 mode.grounds.uibar(1,n,mode.grounds.info[n].drown,0x6FDA51,100,20)
  2788.             end
  2789.            
  2790.             if system.miscAttrib ~= 0 then
  2791.                 if mode.grounds.podium == system.miscAttrib then
  2792.                     tfm.exec.setGameTime(0)
  2793.                 end
  2794.             end
  2795.         end
  2796.        
  2797.         if mode.grounds.review or mode.grounds.isHouse then
  2798.             tfm.exec.respawnPlayer(n)
  2799.         else
  2800.             mode.grounds.info[n].canRev = false
  2801.         end
  2802.     end,
  2803.     -- Died
  2804.     eventPlayerDied = function(n)
  2805.         if mode.grounds.info[n].groundsDataLoaded and mode.grounds.availableRoom then
  2806.             mode.grounds.info[n].stats.deaths = mode.grounds.info[n].stats.deaths + 1
  2807.         end
  2808.         if mode.grounds.hasWater then
  2809.             if mode.grounds.info[n].drown > 0 then
  2810.                 mode.grounds.uibar(1,n,mode.grounds.info[n].drown,0xDA516D,100,20)
  2811.             end
  2812.         end
  2813.        
  2814.         system.bindKeyboard(n,32,true,false)
  2815.         ui.removeTextArea(-1,n)
  2816.        
  2817.         if mode.grounds.review or mode.grounds.isHouse then
  2818.             tfm.exec.respawnPlayer(n)
  2819.         end
  2820.     end,
  2821.     -- Left
  2822.     eventPlayerLeft = function(n)
  2823.         if mode.grounds.info[n] then
  2824.             mode.grounds.info[n].isOnline = false
  2825.         end
  2826.     end,
  2827.     -- Respawn
  2828.     eventPlayerRespawn = function(n)
  2829.         if mode.grounds.info[n].checkpoint ~= -1 then
  2830.             local g = mode.grounds.gsys.grounds[mode.grounds.info[n].checkpoint]
  2831.             local hTP = mode.grounds.gsys.getTpPos(g,true)
  2832.             tfm.exec.movePlayer(n,hTP[1],hTP[2])
  2833.         end
  2834.         if mode.grounds.info[n].groundsDataLoaded and mode.grounds.availableRoom then
  2835.             mode.grounds.info[n].stats.rounds = mode.grounds.info[n].stats.rounds + 1
  2836.         end
  2837.         if mode.grounds.hasWater then
  2838.             mode.grounds.uibar(1,n,mode.grounds.info[n].drown,0x519DDA,100,20)
  2839.         end
  2840.        
  2841.         if not mode.grounds.isHouse then
  2842.             tfm.exec.chatMessage(stringformat("<R>[•] %s",system.getTranslation("zombie",n)),n)
  2843.         end
  2844.     end,
  2845. }
  2846.  
  2847. --[[ Jokenpo ]]--
  2848. mode.jokenpo = {
  2849.     -- Translations
  2850.     translations = {
  2851.         en = {
  2852.             -- Init
  2853.             welcome = "Welcome to <ROSE>#Jokenpo<CE>! Choose a chair, press space and start playing!\n\tReport any issue to Bolodefchoco",
  2854.            
  2855.             -- Simple words
  2856.             round = "Round",
  2857.             players = "Players",
  2858.             won = "won the round!",
  2859.             tie = "Tie!",
  2860.             victory = "won the game!",
  2861.            
  2862.             -- Info
  2863.             guide = "Press\n\t<PS>»</PS> %s<PT> - Rock</PT>\n\t<PS>»</PS> %s<PT> - Paper</PT>\n\t<PS>»</PS> %s<PT> - Scissor (Pufferfish)</PT>",
  2864.            
  2865.             -- Game
  2866.             items = {"Rock","Paper","Scissor"},
  2867.             selected = "You've selected the item %s!",
  2868.         },
  2869.         br = {
  2870.             welcome = "Bem-vindo ao <ROSE>#Jokenpo<CE>! Escolha uma cadeira, aperte espaço e comece a jogar!\n\tReporte qualquer problema para Bolodefchoco",
  2871.        
  2872.             round = "Partida",
  2873.             players = "Jogadores",
  2874.             won = "venceu a partida!",
  2875.             tie = "Empate!",
  2876.             victory = "ganhou!",
  2877.            
  2878.             guide = "Pressione\n\t<PS>»</PS> %s<PT> - Pedra</PT>\n\t<PS>»</PS> %s<PT> - Papel</PT>\n\t<PS>»</PS> %s<PT> - Tesoura (Baiacu)</PT>",
  2879.            
  2880.             items = {"Pedra","Papel","Tesoura"},
  2881.             selected = "Você selecionou o item %s!",
  2882.         },
  2883.     },
  2884.     langue = "en",
  2885.     -- Maps
  2886.     maps = {5198315,4093087},
  2887.     buildSquares = function(c)
  2888.         tfm.exec.removePhysicObject(1)
  2889.         for k,v in next,{{346,224},{454,224},{400,105}} do
  2890.             for i = 1,4 do
  2891.                 local x = i == 1 and v[1] + 28 or i == 2 and v[1] - 28 or v[1]
  2892.                 local y = i == 3 and v[2] + 28 or i == 4 and v[2] - 28 or v[2]
  2893.                
  2894.                 local w = x == v[1] and 46 or 10
  2895.                 local h = w == 10 and 66 or 10
  2896.                
  2897.                 tfm.exec.addPhysicObject(i..k,x,y,{
  2898.                     type = 12,
  2899.                     color = c[k],
  2900.                     width = w,
  2901.                     height = h,
  2902.                 })
  2903.             end
  2904.         end
  2905.     end,
  2906.     -- New Round Settings
  2907.     playing = false,
  2908.     players = {},
  2909.     colors = {0xE3454D,0x4577E3,0x45E374},
  2910.     timer = 9.5,
  2911.     partialTimer = 0,
  2912.     tie = 0,
  2913.     round = 0,
  2914.     roundsPerGame = 5,
  2915.     -- Game settings
  2916.     objects = {
  2917.         85,
  2918.         95,
  2919.         65,
  2920.     },
  2921.     -- Emotes
  2922.     emote = {
  2923.         sit = 8,
  2924.         victory = 24,
  2925.         fail = 5,
  2926.         tie = 4,
  2927.         no = 2
  2928.     },
  2929.     -- Battle
  2930.     decision = function()
  2931.         for i = 1,2 do
  2932.             mode.jokenpo.players[i].obj = mode.jokenpo.players[i].obj ~= 0 and mode.jokenpo.players[i].obj or false
  2933.             if mode.jokenpo.players[i].obj then
  2934.                 mode.jokenpo.players[i].remId = tfm.exec.addShamanObject(mode.jokenpo.objects[mode.jokenpo.players[i].obj],({350,455})[i],200)
  2935.             end
  2936.         end
  2937.  
  2938.         local winner = ((mode.jokenpo.players[1].obj and mode.jokenpo.players[2].obj) and ((3 + mode.jokenpo.players[1].obj - mode.jokenpo.players[2].obj) % 3) or mode.jokenpo.players[1].obj and 1 or mode.jokenpo.players[2].obj and 2 or 0)
  2939.        
  2940.         if winner == 0 then
  2941.             mode.jokenpo.tie = mode.jokenpo.tie + 1
  2942.             tfm.exec.chatMessage("<CE>[•] <J>" .. system.getTranslation("tie"))
  2943.            
  2944.             for k,v in next,mode.jokenpo.players do
  2945.                 tfm.exec.playEmote(v.name,mode.jokenpo.emote.tie)
  2946.             end
  2947.         else
  2948.             mode.jokenpo.players[winner].score = mode.jokenpo.players[winner].score + 1
  2949.             tfm.exec.playEmote(mode.jokenpo.players[winner].name,mode.jokenpo.emote.victory)
  2950.            
  2951.             local looser = (winner == 1 and 2 or 1)
  2952.             local looserEmote = mode.jokenpo.emote.fail
  2953.             if not mode.jokenpo.players[looser].obj then
  2954.                 looserEmote = mode.jokenpo.emote.no
  2955.             end
  2956.             tfm.exec.playEmote(mode.jokenpo.players[looser].name,looserEmote)
  2957.  
  2958.             tfm.exec.chatMessage("<CE>[•] " .. mode.jokenpo.players[winner].color .. mode.jokenpo.players[winner].name .. " " .. system.getTranslation("won"))
  2959.         end
  2960.        
  2961.         ui.addTextArea(5,stringformat("<font size='50'><p align='center'>%s%d <PT>| <J>%d <PT>| %s%s",mode.jokenpo.players[1].color,mode.jokenpo.players[1].score,mode.jokenpo.tie,mode.jokenpo.players[2].color,mode.jokenpo.players[2].score),nil,5,270,795,nil,1,1,0,true)
  2962.     end,
  2963.     -- Partial Next Round
  2964.     pNextRound = function()
  2965.         mode.jokenpo.playing = false
  2966.         mode.jokenpo.timer = 9.5
  2967.         mode.jokenpo.partialTimer = 3.5
  2968.         mode.jokenpo.decision()
  2969.         if mode.jokenpo.round == mode.jokenpo.roundsPerGame then
  2970.             tablesort(mode.jokenpo.players,function(p1,p2) return p1.score > p2.score end)
  2971.             if (mode.jokenpo.players[1].score == mode.jokenpo.players[2].score) or (mode.jokenpo.tie > mode.jokenpo.players[1].score) then
  2972.                 tfm.exec.chatMessage("<CE>[•] " .. system.getTranslation("tie"))
  2973.             else
  2974.                 tfm.exec.chatMessage("<CE>[•] " .. mode.jokenpo.players[1].color .. mode.jokenpo.players[1].name .. " " .. system.getTranslation("victory"))
  2975.             end
  2976.         end
  2977.     end,
  2978.     -- Next Round
  2979.     nextRound = function()
  2980.         for i = 1,2 do
  2981.             if mode.jokenpo.players[i].remId then
  2982.                 tfm.exec.removeObject(mode.jokenpo.players[i].remId)
  2983.             end
  2984.             mode.jokenpo.players[i].remId = nil
  2985.             mode.jokenpo.players[i].obj = 0
  2986.         end
  2987.         ui.removeTextArea(5,nil)
  2988.         mode.jokenpo.partialTimer = 0
  2989.         if mode.jokenpo.roundsPerGame > mode.jokenpo.round then
  2990.             mode.jokenpo.playing = true
  2991.             mode.jokenpo.round = mode.jokenpo.round + 1
  2992.         else
  2993.             mode.jokenpo.playing = false
  2994.             mode.jokenpo.round = 0
  2995.             mode.jokenpo.tie = 0
  2996.             mode.jokenpo.timer = 9.5
  2997.             mode.jokenpo.partialTimer = 0
  2998.             mode.jokenpo.players = {}
  2999.             tfm.exec.newGame(tablerandom(mode.jokenpo.maps))
  3000.             for i = 2,3 do
  3001.                 ui.removeTextArea(i,nil)
  3002.             end
  3003.         end
  3004.         mode.jokenpo.uiinfo()
  3005.     end,
  3006.     -- Display names
  3007.     displayNames = function()
  3008.         if #mode.jokenpo.players == 0 then
  3009.             return ""
  3010.         else
  3011.             return "   <G>|   <N>" .. system.getTranslation("players") .. " : " .. tableconcat(mode.jokenpo.players," <V>- ",function(k,v)
  3012.                 tfm.exec.setNameColor(v.name,mode.jokenpo.colors[v.id])
  3013.                 return v.color .. v.name
  3014.             end)
  3015.         end
  3016.     end,
  3017.     -- Info textareas
  3018.     uiinfo = function()
  3019.         ui.addTextArea(0,"<p align='center'><font size='35'><J>"..mathfloor(mode.jokenpo.timer),nil,380,85,40,40,1,1,0,true)
  3020.         ui.addTextArea(1,"<p align='center'><font size='25'><J><B>X</B><font size='13'>\n"..stringformat("%02d",mode.jokenpo.tie),nil,380,207,40,nil,1,1,0,true)
  3021.        
  3022.         for k,v in next,mode.jokenpo.players do
  3023.             ui.addTextArea(v.id + 1,"<p align='center'>"..v.name.."\n"..stringformat("%02d",v.score),nil,v.x,165,105,nil,1,1,0,true)
  3024.         end
  3025.        
  3026.         ui.setMapName("<PT>#Jokenpo   <G>|   <N>" .. system.getTranslation("round") .. " : <V>" .. mode.jokenpo.round .. mode.jokenpo.displayNames() .. "<")
  3027.     end,
  3028.     -- Init
  3029.     reset = function()
  3030.         -- Scores
  3031.         mode.jokenpo.tie = 0
  3032.         mode.jokenpo.round = 0
  3033.         mode.jokenpo.roundsPerGame = 5
  3034.        
  3035.         -- Data
  3036.         mode.jokenpo.players = {}
  3037.         mode.jokenpo.playing = false
  3038.        
  3039.         -- Timers
  3040.         mode.jokenpo.timer = 9.5
  3041.         mode.jokenpo.partialTimer = 0
  3042.     end,
  3043.     init = function()
  3044.         mode.jokenpo.translations.pt = mode.jokenpo.translations.br
  3045.    
  3046.         -- Sets the main language according to the community
  3047.         if mode.jokenpo.translations[tfm.get.room.community] then
  3048.             mode.jokenpo.langue = tfm.get.room.community
  3049.         end
  3050.        
  3051.         -- Sets the rounds per game
  3052.         mode.jokenpo.roundsPerGame = mathmax(5,system.miscAttrib)
  3053.        
  3054.         -- Init
  3055.         for _,f in next,{"AutoShaman","AutoNewGame","PhysicalConsumables","AfkDeath"} do
  3056.             tfm.exec["disable"..f]()
  3057.         end
  3058.         tfm.exec.setAutoMapFlipMode(false)
  3059.         tfm.exec.setRoomMaxPlayers(20)
  3060.  
  3061.         tfm.exec.newGame(tablerandom(mode.jokenpo.maps))
  3062.     end,
  3063.     -- New Player
  3064.     eventNewPlayer = function(n)
  3065.         tfm.exec.chatMessage("<CE>[•] " .. system.getTranslation("welcome"),n)
  3066.    
  3067.         for k,v in next,{32,stringbyte("BNM",1,3)} do
  3068.             system.bindKeyboard(n,v,true,true)
  3069.         end
  3070.        
  3071.         if mode.jokenpo.playing then
  3072.             mode.jokenpo.round = mode.jokenpo.round + 1
  3073.         else
  3074.             tfm.exec.respawnPlayer(n)
  3075.         end
  3076.        
  3077.         mode.jokenpo.buildSquares(mode.jokenpo.colors)
  3078.         mode.jokenpo.uiinfo()
  3079.     end,
  3080.     -- New Game
  3081.     eventNewGame = function()
  3082.         if mode.jokenpo.playing then
  3083.             for k,v in next,tfm.get.room.playerList do
  3084.                 if not tablefind(mode.jokenpo.players,k,"name") then
  3085.                     tfm.exec.killPlayer(k)
  3086.                 end
  3087.             end
  3088.         end
  3089.    
  3090.         mode.jokenpo.colors = {0xE3454D,0x4577E3,0x45E374} 
  3091.         xml.attribFunc(tfm.get.room.xmlMapInfo.xml or "",{
  3092.             [1] = {
  3093.                 attribute = "o",
  3094.                 func = function(color)
  3095.                     local c = stringsplit(color,"[^,]+",function(o)
  3096.                         return stringmatch(o,"#?(.+)")
  3097.                     end)
  3098.                    
  3099.                     for i = 1,#c do
  3100.                         mode.jokenpo.colors[i] = tonumber(c[i],16)
  3101.                     end
  3102.                 end
  3103.             }
  3104.         })
  3105.        
  3106.         mode.jokenpo.buildSquares(mode.jokenpo.colors)
  3107.         mode.jokenpo.uiinfo()
  3108.     end,
  3109.     -- Keyboard
  3110.     eventKeyboard = function(n,k,d,x,y)
  3111.         if k == 32 and #mode.jokenpo.players < 2 then
  3112.             for k,v in next,{{285,330,270},{515,330,425}} do
  3113.                 if mathpythag(v[1],v[2],x,y,30) then
  3114.                     if not tablefind(mode.jokenpo.players,n,"name") then
  3115.                         if not tablefind(mode.jokenpo.players,k,"id") then
  3116.                             mode.jokenpo.players[#mode.jokenpo.players + 1] = {
  3117.                                 name = n,
  3118.                                 x = v[3],
  3119.                                 score = 0,
  3120.                                 color = stringformat("<font color='#%s'>",stringformat("%x",mode.jokenpo.colors[k])),
  3121.                                 id = k,
  3122.                                 obj = 0,
  3123.                                 remId = nil,
  3124.                             }
  3125.                            
  3126.                             tfm.exec.chatMessage("<CE>[•] " .. mode.jokenpo.players[#mode.jokenpo.players].color .. stringformat(system.getTranslation("guide"),"B","N","M"),n)
  3127.                            
  3128.                             mode.jokenpo.uiinfo()
  3129.                             tfm.exec.playEmote(n,mode.jokenpo.emote.sit)
  3130.                         end
  3131.                     end
  3132.                 end
  3133.             end
  3134.            
  3135.             if #mode.jokenpo.players == 2 then
  3136.                 tablesort(mode.jokenpo.players,function(p1,p2) return p1.id < p2.id end)
  3137.                 mode.jokenpo.playing = true
  3138.  
  3139.                 mode.jokenpo.round = mode.jokenpo.round + 1
  3140.                 mode.jokenpo.uiinfo()
  3141.             end
  3142.         else
  3143.             if mode.jokenpo.playing then
  3144.                 local foundObject,objectIndex = tablefind({stringbyte("BNM",1,3)},k)
  3145.                 if foundObject then
  3146.                     local found,i = tablefind(mode.jokenpo.players,n,"name")
  3147.                     if found then
  3148.                         i = mode.jokenpo.players[i]
  3149.                         if i.obj == 0 then
  3150.                             i.obj = objectIndex
  3151.  
  3152.                             tfm.exec.chatMessage("<CE>[•] " .. i.color .. stringformat(system.getTranslation("selected"),system.getTranslation("items")[objectIndex]),n)
  3153.                         end
  3154.                     end
  3155.                 end
  3156.             end
  3157.         end
  3158.     end,
  3159.     -- Loop
  3160.     eventLoop = function()
  3161.         if mode.jokenpo.playing then
  3162.             if mode.jokenpo.timer > 0 then
  3163.                 mode.jokenpo.timer = mode.jokenpo.timer - .5
  3164.                 ui.addTextArea(0,"<p align='center'><font size='35'><J>"..mathfloor(mode.jokenpo.timer),nil,380,85,40,40,1,1,0,true)
  3165.                 for i = 1,2 do
  3166.                     tfm.exec.movePlayer(mode.jokenpo.players[i].name,({285,515})[i],330)
  3167.                     tfm.exec.playEmote(mode.jokenpo.players[i].name,26)
  3168.                 end
  3169.             else
  3170.                 mode.jokenpo.pNextRound()
  3171.             end
  3172.         else
  3173.             if mode.jokenpo.partialTimer > 0 then
  3174.                 mode.jokenpo.partialTimer = mode.jokenpo.partialTimer - .5
  3175.                 ui.addTextArea(0,"<p align='center'><font size='35'><PT>"..mathfloor(mode.jokenpo.partialTimer),nil,380,85,40,40,1,1,0,true)
  3176.                
  3177.                 if mode.jokenpo.partialTimer <= 0 then
  3178.                     mode.jokenpo.nextRound()
  3179.                 end
  3180.             end
  3181.         end
  3182.     end,
  3183.     -- Player Left
  3184.     eventPlayerLeft = function(n)
  3185.         if tablefind(mode.jokenpo.players,n,"name") then
  3186.             mode.jokenpo.round = mode.jokenpo.roundsPerGame
  3187.             mode.jokenpo.nextRound()
  3188.         end
  3189.     end,
  3190. }
  3191.  
  3192. --[[ Click ]]--
  3193. mode.click = {
  3194.     -- Translations
  3195.     translations = {
  3196.         en = {
  3197.             -- Init
  3198.             welcome = "<BV>Welcome to <CH><B>#click</B><BV>!\n\t» Type <B>!p Playername</B> to open the profile of the player\n\t» Report any issue to <B>Bolodefchoco</B>",
  3199.        
  3200.             -- Info
  3201.             newGame = "New game in %s seconds!",
  3202.             clickfast = "Click several times in the circle before %s seconds!",
  3203.            
  3204.             -- Simple words
  3205.             click = "CLICK!",
  3206.             won = "won!",
  3207.            
  3208.             -- Profile
  3209.             profile = "Total clicks <BL>: <V>%s\n<J>High Score <BL>: <V>%s\n\n<J>Victories <BL>: <V>%s",
  3210.         },
  3211.         br = {
  3212.             welcome = "<BV>Bem-vindo ao <CH><B>#click</B><BV>!\n\t\n\t» Digite <B>!p Jogador</B> para abrir o perfil do jogador\n\t» Reporte qualquer problema para <B>Bolodefchoco</B>",
  3213.            
  3214.             newGame = "Novo jogo em %s segundos!",
  3215.             clickfast = "Clique várias vezes no círculo antes de %s segundos!",
  3216.            
  3217.             click = "CLIQUE!",
  3218.             won = "venceu!",
  3219.            
  3220.             profile = "Cliques totais <BL>: <V>%s\n<J>Maior pontuação <BL>: <V>%s\n\n<J>Vitórias <BL>: <V>%s",
  3221.         },
  3222.     },
  3223.     langue = "en",
  3224.     -- Data
  3225.     info = {},
  3226.     -- System
  3227.     circle = {
  3228.         id = 0,
  3229.         status = false
  3230.     },
  3231.     spawnCircle = function(on)
  3232.         if mode.click.circle.id > 0 then
  3233.             tfm.exec.removeJoint(mode.click.circle)
  3234.         end
  3235.        
  3236.         mode.click.circle = {id = 1,status = on}
  3237.        
  3238.         local color = on and 0x53D08B or 0x555D77
  3239.        
  3240.         tfm.exec.addJoint(1,0,0,{
  3241.             type = 0,
  3242.             alpha = .9,
  3243.             color = color,
  3244.             foreground = false,
  3245.             line = 300,
  3246.             point1 = "400,200",
  3247.             point2 = "400,201"
  3248.         })
  3249.     end,
  3250.     -- Timers
  3251.     partialTimer = 1,
  3252.     counter = 0,
  3253.     -- Ranking
  3254.     uileaderboard = function()
  3255.         local data = {}
  3256.         for k,v in next,mode.click.info do
  3257.             if v.canPlay and v.roundClick > 0 then
  3258.                 data[#data + 1] = {k,v.roundClick}
  3259.             end
  3260.            
  3261.             if v.highScore < v.roundClick then
  3262.                 v.highScore = v.roundClick
  3263.             end
  3264.             v.totalClick = v.totalClick + v.roundClick
  3265.             v.roundClick = 0
  3266.         end
  3267.        
  3268.         tablesort(data,function(p1,p2) return p1[2] > p2[2] end)
  3269.        
  3270.         local str = ""
  3271.         for k,v in next,data do
  3272.             if k < 51 then
  3273.                 if k == 1 then
  3274.                     mode.click.info[v[1]].victories = mode.click.info[v[1]].victories + 1
  3275.                     tfm.exec.chatMessage("<J>" .. v[1] .. " <G>" .. system.getTranslation("won"))
  3276.                     tfm.exec.setPlayerScore(v[1],1,true)
  3277.                 end
  3278.                
  3279.                 str = str .. stringformat("<J>%s. <V>%s <BL>- <PT>%sP\n",k,v[1],v[2])
  3280.             end
  3281.         end
  3282.        
  3283.         ui.addTextArea(1,str,nil,5,30,250,330,1,1,.9,true)
  3284.     end,
  3285.     -- Init
  3286.     reset = function()
  3287.         -- Data
  3288.         mode.click.info = {}
  3289.     end,
  3290.     init = function()
  3291.         mode.click.translations.pt = mode.click.translations.br
  3292.  
  3293.         -- Sets the main language according to the community
  3294.         if mode.click.translations[tfm.get.room.community] then
  3295.             mode.click.langue = tfm.get.room.community
  3296.         end
  3297.        
  3298.         -- Init
  3299.         for _,f in next,{"AutoShaman","AutoScore","AutoNewGame","AfkDeath"} do
  3300.             tfm.exec["disable"..f]()
  3301.         end
  3302.  
  3303.         tfm.exec.newGame(5993911)
  3304.     end,
  3305.     -- New Player
  3306.     eventNewPlayer = function(n)
  3307.         system.bindMouse(n,true)
  3308.         if not mode.click.info[n] then
  3309.             mode.click.info[n] = {
  3310.                 canPlay = false,
  3311.                 totalClick = 0,
  3312.                 roundClick = 0,
  3313.                 highScore = 0,
  3314.                 victories = 0,
  3315.             }
  3316.         end
  3317.         if not mode.click.circle.status then
  3318.             tfm.exec.respawnPlayer(n)
  3319.             mode.click.info[n].canPlay = true
  3320.         end
  3321.         tfm.exec.chatMessage(system.getTranslation("welcome"),n)
  3322.     end,
  3323.     -- New Game
  3324.     eventNewGame = function()
  3325.         mode.click.spawnCircle(false)
  3326.         mode.click.partialTimer = 10.5
  3327.     end,
  3328.     -- Loop
  3329.     eventLoop = function()
  3330.         if mode.click.partialTimer > 0 then
  3331.             mode.click.partialTimer = mode.click.partialTimer - .5
  3332.             ui.setMapName(stringformat(system.getTranslation("newGame"),"<ROSE>"..mathfloor(mode.click.partialTimer).."<J>") .. "<")
  3333.             if mode.click.partialTimer <= 0 then
  3334.                 mode.click.spawnCircle(true)
  3335.                
  3336.                 mode.click.counter = mathmax(20,system.miscAttrib)
  3337.                
  3338.                 for k,v in next,mode.click.info do
  3339.                     v.canPlay = true
  3340.                     tfm.exec.respawnPlayer(k)
  3341.                 end
  3342.                
  3343.                 ui.removeTextArea(1,nil)
  3344.                 ui.setMapName(system.getTranslation("click") .. "<")
  3345.             end
  3346.         else
  3347.             if mode.click.counter > 0 then
  3348.                 mode.click.counter = mode.click.counter - .5
  3349.                 ui.addTextArea(0,"<p align='center'><font size='28'>" .. stringformat(system.getTranslation("clickfast"),mathfloor(mode.click.counter)),nil,0,30,800,50,1,1,0,true)
  3350.                 if mode.click.counter <= 0 then
  3351.                     mode.click.spawnCircle(false)
  3352.  
  3353.                     mode.click.partialTimer = 10.5
  3354.  
  3355.                     ui.removeTextArea(0,nil)
  3356.                     mode.click.uileaderboard()
  3357.                 end
  3358.             end
  3359.         end
  3360.     end,
  3361.     -- Mouse
  3362.     eventMouse = function(n,x,y)
  3363.         if mode.click.circle.status then
  3364.             if mode.click.info[n].canPlay then
  3365.                 if mathpythag(400,200,x,y,150) then
  3366.                     mode.click.info[n].roundClick = mode.click.info[n].roundClick + 1
  3367.                     tfm.exec.displayParticle(15,mathrandom(150,650),mathrandom(100,300),0,0,0,0,n)
  3368.                 end
  3369.             end
  3370.         end
  3371.     end,
  3372.     -- Commands
  3373.     eventChatCommand = function(n,c)
  3374.         local p = stringsplit(c,"[^%s]+",stringlower)
  3375.         if p[1] == "p" then
  3376.             p[2] = p[2] and stringnick(p[2]) or n
  3377.             if mode.click.info[p[2]] then
  3378.                 ui.addTextArea(2,"<p align='center'><font size='18'><a:active><a href='event:close'>"..p[2].."</a><p align='left'><font size='13'>\n<J>" .. stringformat(system.getTranslation("profile"),mode.click.info[p[2]].totalClick,mode.click.info[p[2]].highScore,mode.click.info[p[2]].victories),n,620,295,175,100,1,1,1,true)
  3379.             end
  3380.         end
  3381.     end,
  3382.     -- Callbacks
  3383.     eventTextAreaCallback = function(i,n,c)
  3384.         if c == "close" then
  3385.             ui.removeTextArea(2,n)
  3386.         end
  3387.     end,
  3388.     -- Respawn
  3389.     eventPlayerDied = function(n)
  3390.         tfm.exec.respawnPlayer(n)
  3391.     end,
  3392.     -- Player Left
  3393.     eventPlayerLeft = function(n)
  3394.         mode.click.info[n].canPlay = false
  3395.     end,
  3396. }
  3397.  
  3398. --[[ Presents ]]--
  3399. mode.presents = {
  3400.     -- Translations
  3401.     translations = {
  3402.         en = {
  3403.             -- Init
  3404.             welcome = "<J>Welcome to <VP><B>#presents</B><J>! Choose a gap according to the gift represented and good luck! You will win if your three-gifts-sequence is correct!\nType !p PlayerName to open the profile of the specified player\n\n<CE>Developed by Bolodefchoco and projected by Ruamorangos",
  3405.        
  3406.             -- Info
  3407.             choose = "Choose a gift before <PT>%s seconds!",
  3408.             kill = "Those who are out of the correct gift will be dead!",
  3409.             newGame = "New game in <PT>%s seconds!",
  3410.             nowinner = "No one won!",
  3411.             appear = "You will appear in the next game!",
  3412.            
  3413.             -- Simple words
  3414.             rival = "Rivals",
  3415.             won = "won!",
  3416.            
  3417.             -- Profile
  3418.             profile = "Rounds <BL>: <V>%s\n<J>Gifts <BL>: <V>%s\n\n<J>Victories <BL>: <V>%s",
  3419.         },
  3420.         br = {
  3421.             welcome = "<J>Bem-vindo ao <VP><B>#presents</B><J>! Escolha um buraco de acordo com o presente representado e boa sorte! Você ganhará se sua sequência nos três presentes estiver correta!\nDigite !p Jogador para abrir o perfil o jogador especificado\n\n<CE>Desenvolvido por Bolodefchoco, pedido por Ruamorangos",
  3422.        
  3423.             choose = "Escolha um presente antes de <PT>%s segundos!",
  3424.             kill = "Aqueles que estão fora do presente correto serão mortos!",
  3425.             newGame = "Novo jogo em <PT>%s segundos!",
  3426.             nowinner = "Ninguém ganhou!",
  3427.             appear = "Você irá aparecer no próximo jogo!",
  3428.            
  3429.             rival = "Rivais",
  3430.             won = "venceu!",
  3431.  
  3432.             profile = "Partidas <BL>: <V>%s\n<J>Presents <BL>: <V>%s\n\n<J>Vitórias <BL>: <V>%s",
  3433.         },
  3434.     },
  3435.     langue = "en",
  3436.     -- Data
  3437.     info = {},
  3438.     -- System
  3439.     isRunning = false,
  3440.     gifts = {},
  3441.     -- Timers
  3442.     chooseTimer = 15,
  3443.     blockTimer = 0,
  3444.     newMapTimer = 0,
  3445.     currentGift = 1,
  3446.     -- Map
  3447.     generateMap = function()
  3448.         mode.presents.isRunning = true
  3449.         mode.presents.gifts = {
  3450.             [1] = tablerandom({2104,2102,2100,2101,2103,2100,2104,2102,2103,2101,2104,2102,2100,2101,2103,2100,2104,2102,2103,2101,2104,2102,2100,2101,2103,2100,2104,2102,2103,2101}),
  3451.             [2] = tablerandom({2102,2100,2101,2103,2100,2104,2102,2103,2101,2104,2102,2100,2101,2103,2100,2104,2102,2103,2101,2104,2102,2100,2101,2103,2100,2104,2102,2103,2101,2104}),
  3452.             [3] = tablerandom({2100,2101,2103,2100,2104,2102,2103,2101,2104,2102,2100,2101,2103,2100,2104,2102,2103,2101,2104,2102,2100,2101,2103,2100,2104,2102,2103,2101,2104,2102})
  3453.         }
  3454.        
  3455.         tfm.exec.newGame('<C><P DS="m;250,120,400,120,550,120" D="x_transformice/x_inventaire/'..mode.presents.gifts[1]..'.jpg,230,60;x_transformice/x_inventaire/'..mode.presents.gifts[2]..'.jpg,380,60;x_transformice/x_inventaire/'..mode.presents.gifts[3]..'.jpg,530,60;x_transformice/x_inventaire/2100.jpg,140,320;x_transformice/x_inventaire/2101.jpg,260,320;x_transformice/x_inventaire/2102.jpg,380,320;x_transformice/x_inventaire/2103.jpg,500,320;x_transformice/x_inventaire/2104.jpg,620,320" /><Z><S><S P="1,0.0001,20,0.2,90,1,0,0" H="700" L="15" X="400" c="3" Y="161" T="4" /><S X="100" P="0,0,20,0.2,0,0,0,0" L="40" H="135" c="3" Y="335" T="4" /><S H="135" P="0,0,20,0.2,0,0,0,0" L="40" X="220" c="3" Y="335" T="4" /><S X="340" P="0,0,20,0.2,0,0,0,0" L="40" H="135" c="3" Y="335" T="4" /><S H="135" P="0,0,20,0.2,0,0,0,0" L="40" X="460" c="3" Y="335" T="4" /><S X="580" P="0,0,20,0.2,0,0,0,0" L="40" H="135" c="3" Y="335" T="4" /><S H="40" P="0,0,0.3,0.2,0,0,0,0" L="40" X="100" c="3" Y="160" T="0" /><S X="700" P="0,0,0.3,0.2,0,0,0,0" L="40" H="40" c="3" Y="160" T="0" /><S X="550" P="0,0,0.3,0.2,0,0,0,0" L="40" H="40" c="3" Y="160" T="0" /><S X="400" P="0,0,0.3,0.2,0,0,0,0" L="40" H="40" c="3" Y="160" T="0" /><S X="250" P="0,0,0.3,0.2,0,0,0,0" L="40" H="40" c="3" Y="160" T="0" /><S H="20" P="0,0,0.3,0.2,0,0,0,0" L="800" X="400" Y="10" T="0" /><S H="135" P="0,0,20,0.2,0,0,0,0" L="40" X="700" c="3" Y="335" T="4" /><S X="400" P="0,0,0.3,0.2,0,0,0,0" L="800" H="100" c="3" Y="415" T="0" /><S P="0,0,0.3,0.2,0,0,0,0" H="10" L="50" o="324650" X="745" c="3" Y="138" T="13" /><S X="55" P="0,0,0.3,0.2,0,0,0,0" L="50" o="324650" H="10" c="3" Y="138" T="13" /><S P="0,0,0.3,0.2,0,0,0,0" H="140" L="100" o="324650" X="55" c="3" Y="72" T="12" /><S X="745" P="0,0,0.3,0.2,0,0,0,0" L="100" o="324650" H="140" c="3" Y="72" T="12" /><S P="0,0,0,0,0,0,0,0" H="102" L="581" o="6a7495" X="401" c="4" v="3001" Y="78" T="12" /></S><D /><O /><L><JR M2="10" M1="0" /></L></Z></C>')
  3456.     end,
  3457.     -- Kill wrong gaps
  3458.     killOutOfRange = function()
  3459.         local gift = mode.presents.gifts[mode.presents.currentGift] - 2099
  3460.         for k,v in next,tfm.get.room.playerList do
  3461.             if not v.isDead then
  3462.                 if v.x >= (gift * 120) and v.x <= (gift * 120 + 80) and v.y > 267 then
  3463.                     mode.presents.info[k].gifts = mode.presents.info[k].gifts + 1
  3464.                     tfm.exec.setPlayerScore(k,1,true)
  3465.                 else
  3466.                     tfm.exec.killPlayer(k)
  3467.                 end
  3468.             end
  3469.         end
  3470.     end,
  3471.     -- Victory
  3472.     victory = function(noone)
  3473.         if noone then
  3474.             tfm.exec.chatMessage("<J>" .. system.getTranslation("nowinner"))
  3475.             mode.presents.chooseTimer = 0
  3476.             mode.presents.blockTimer = 0
  3477.         else
  3478.             tfm.exec.chatMessage("<S>" .. tableconcat(system.players(true),"<J>, <S>",function(k,v)
  3479.                 mode.presents.info[v].victories = mode.presents.info[v].victories + 1
  3480.                 return v
  3481.             end) .. " <J>" .. system.getTranslation("won"))
  3482.         end
  3483.         mode.presents.newMapTimer = 10.5
  3484.     end,
  3485.     -- Init
  3486.     reset = function()
  3487.         -- Data
  3488.         mode.presents.info = {}
  3489.     end,
  3490.     init = function()
  3491.         mode.presents.translations.pt = mode.presents.translations.br
  3492.  
  3493.         -- Sets the main language according to the community
  3494.         if mode.presents.translations[tfm.get.room.community] then
  3495.             mode.presents.langue = tfm.get.room.community
  3496.         end
  3497.        
  3498.         -- Init
  3499.         for _,f in next,{"AutoShaman","AutoNewGame","AutoScore","AfkDeath","MortCommand","DebugCommand","PhysicalConsumables"} do
  3500.             tfm.exec["disable"..f]()
  3501.         end
  3502.         tfm.exec.setRoomMaxPlayers(30)
  3503.  
  3504.         mode.presents.generateMap()
  3505.        
  3506.         -- Auto Admin
  3507.         system.roomAdmins.Ruamorangos = true
  3508.     end,
  3509.     -- New Player
  3510.     eventNewPlayer = function(n)
  3511.         if not mode.presents.info[n] then
  3512.             mode.presents.info[n] = {
  3513.                 rounds = 0,
  3514.                 gifts = 0,
  3515.                 victories = 0,
  3516.             }
  3517.         end
  3518.        
  3519.         tfm.exec.chatMessage(system.getTranslation("welcome"),n)
  3520.        
  3521.         if mode.presents.isRunning then
  3522.             local m = "<PT>" .. system.getTranslation("appear")
  3523.             ui.addTextArea(0,"<p align='center'><font size='20'><VP>" .. m,n,216,65,365,35,1,1,1,true)
  3524.             tfm.exec.chatMessage(m,n)
  3525.         else
  3526.             tfm.exec.respawnPlayer(n)
  3527.         end
  3528.     end,
  3529.     -- New Game
  3530.     eventNewGame = function()
  3531.         if mode.presents.isRunning then
  3532.             for i,x in next,{250,400,550} do
  3533.                 tfm.exec.addPhysicObject(i,x,75,{
  3534.                     type = 12,
  3535.                     height = 90,
  3536.                     width = 90,
  3537.                     miceCollision = false,
  3538.                     groundCollision = false,
  3539.                     color = 0x6A7495
  3540.                 })
  3541.             end
  3542.             for i = 0,1 do
  3543.                 ui.removeTextArea(i)
  3544.             end
  3545.             mode.presents.chooseTimer = 15
  3546.             mode.presents.blockTimer = 0
  3547.             mode.presents.newMapTimer = 0
  3548.             mode.presents.currentGift = 1
  3549.             for k,v in next,mode.presents.info do
  3550.                 v.rounds = v.rounds + 1
  3551.             end
  3552.         end
  3553.     end,
  3554.     -- Loop
  3555.     eventLoop = function()
  3556.         local mapName = "<N>" .. system.getTranslation("rival") .." : <V>" .. mathisNegative(system.players()-1,0)
  3557.         if _G.currentTime > 4 and mode.presents.isRunning then
  3558.             if mode.presents.chooseTimer > 0 then
  3559.                 mode.presents.chooseTimer = mode.presents.chooseTimer - .5
  3560.                
  3561.                 if mode.presents.chooseTimer <= 0 then
  3562.                     mode.presents.blockTimer = 5
  3563.                     tfm.exec.addPhysicObject(4,400,270,{
  3564.                         type = 4,
  3565.                         height = 10,
  3566.                         width = 640,
  3567.                         miceCollision = true,
  3568.                         groundCollision = false
  3569.                     })
  3570.                     tfm.exec.removePhysicObject(mode.presents.currentGift)
  3571.                 else
  3572.                     mapName = mapName .. "   <G>|   <J>" .. stringformat(system.getTranslation("choose"),mathfloor(mode.presents.chooseTimer).."<J>")
  3573.                 end
  3574.                
  3575.                 if system.players() == 0 then
  3576.                     mode.presents.victory(true)
  3577.                 end
  3578.             end
  3579.            
  3580.             if mode.presents.blockTimer > 0 then
  3581.                 mode.presents.blockTimer = mode.presents.blockTimer - .5
  3582.                
  3583.                 if mode.presents.blockTimer == 2 then
  3584.                     mode.presents.killOutOfRange()
  3585.                 end
  3586.                
  3587.                 if mode.presents.blockTimer <= 0 then
  3588.                     mode.presents.currentGift = mode.presents.currentGift + 1
  3589.                     if mode.presents.currentGift > 3 then
  3590.                         mode.presents.victory()
  3591.                     else
  3592.                         tfm.exec.removePhysicObject(4)
  3593.                         mode.presents.chooseTimer = 15
  3594.                     end
  3595.                 else
  3596.                     mapName = mapName .. "   <G>|   <R>" .. system.getTranslation("kill")
  3597.                 end
  3598.             end
  3599.            
  3600.             if mode.presents.newMapTimer > 0 then
  3601.                 mode.presents.newMapTimer = mode.presents.newMapTimer - .5
  3602.                
  3603.                 mapName = "<PS>" .. stringformat(system.getTranslation("newGame"),mathfloor(mode.presents.newMapTimer) .. "<PS>")
  3604.                 if mode.presents.newMapTimer <= 0 then
  3605.                     mode.presents.generateMap()
  3606.                 end
  3607.             end
  3608.         end
  3609.         ui.setMapName(mapName .. "<")
  3610.     end,
  3611.     -- Commands
  3612.     eventChatCommand = function(n,c)
  3613.         local p = stringsplit(c,"[^%s]+",stringlower)
  3614.         if p[1] == "p" then
  3615.             p[2] = p[2] and stringnick(p[2]) or n
  3616.             if mode.presents.info[p[2]] then
  3617.                 ui.addTextArea(1,"<p align='center'><font size='18'><a:active><a href='event:close'>"..p[2].."</a><p align='left'><font size='13'>\n<J>" .. stringformat(system.getTranslation("profile"),mode.presents.info[p[2]].rounds,mode.presents.info[p[2]].gifts,mode.presents.info[p[2]].victories),n,5,30,790,100,1,1,.8,true)
  3618.             end
  3619.         end
  3620.     end,
  3621.     -- Callbacks
  3622.     eventTextAreaCallback = function(i,n,c)
  3623.         if c == "close" then
  3624.             ui.removeTextArea(1,n)
  3625.         end
  3626.     end,
  3627. }
  3628.  
  3629. --[[ Chat ]]--
  3630. mode.chat = {
  3631.     -- Translations
  3632.     translations = {
  3633.         en = {
  3634.             -- Init
  3635.             welcome = "<J>Welcome to #chat. Enjoy while you are muted ?! Report any issue to Bolodefchoco.",
  3636.        
  3637.             -- Info
  3638.             loadmap = "loaded by",
  3639.             enabled = "enabled",
  3640.             disabled = "disabled",
  3641.            
  3642.             -- Cats
  3643.             shaman = "shaman",
  3644.             newGame = "Auto New Game",
  3645.            
  3646.             -- Misc
  3647.             title = "%s has just unlocked the «%s» title.\n<ROSE>Type /title to choose a title",
  3648.         },
  3649.         br = {
  3650.             welcome = "<J>Bem-vindo ao #chat. Aproveite enquanto você está mutado ?! Reporte qualquer problema para Bolodefchoco.",
  3651.        
  3652.             loadmap = "carregado por",
  3653.             enabled = "ativado",
  3654.             disabled = "desativado",
  3655.            
  3656.             shaman = "shaman",
  3657.             newGame = "Novo Jogo Automático",
  3658.            
  3659.             title = "%s Desbloqueou o título «%s»\n<ROSE>Digite /title para escolher um título.",
  3660.         },
  3661.         ar = {
  3662.             welcome = "<J>مرحبًا بك في #chat. استمتع بينما أنت مكتوم ?! بلغ عن أي مشكلة إلى Bolodefchoco.",
  3663.        
  3664.             loadmap = "شُغل بواسطة",
  3665.             enabled = "فُعل",
  3666.             disabled = "أُلغي",
  3667.            
  3668.             shaman = "الشامان",
  3669.             newGame = "جولة جديدة تلقائية",
  3670.            
  3671.             title = "%s has just unlocked the «%s» title.\n<ROSE>Type /title to choose a title",
  3672.         },
  3673.     },
  3674.     langue = "en",
  3675.     -- Data
  3676.     info = {},
  3677.     data = {},
  3678.     displayData = {},
  3679.     messageId = 0,
  3680.     -- New Game Settings
  3681.     hasShaman = false,
  3682.     autoNeWGame = false,
  3683.     -- Chat settings
  3684.     chatTitle = "Chat",
  3685.     -- Chat
  3686.     chat = function(n,message,update)
  3687.         if not update then
  3688.             ui.addPopup(0,2,"",n,107,325,565,true)
  3689.         end
  3690.         ui.addTextArea(0,"",n,108,73,564,253,0x212E35,0x212E35,1,true)
  3691.         ui.addTextArea(1,message,n,110,75,560,250,0x324650,0x324650,1,true)
  3692.         ui.addTextArea(2,"<p align='center'><B><V>" .. mode.chat.chatTitle,n,108,53,564,20,0x212E35,0x212E35,1,true)
  3693.         ui.addTextArea(3,"<p align='right'><B><R><a href='event:close'>X",n,110,54,560,20,1,1,0,true)
  3694.     end,
  3695.     getTextLength = function(line)
  3696.         return stringlen(stringgsub(line,"<.*>",""))
  3697.     end,
  3698.     loadData = function()
  3699.         local message = "<font size='7'>\n</font>"
  3700.         for i = 18,1,-1 do
  3701.             if #message < 1900 then
  3702.                 local line = mode.chat.displayData[i] or ""
  3703.                 message = message .. line
  3704.             end
  3705.         end
  3706.         return message
  3707.     end,
  3708.     updateToRead = function(n)
  3709.         ui.addTextArea(4,"<p align='center'><V><a href='event:open'><B>" .. stringsub(stringlower(mode.chat.chatTitle),1,8) .. "</B> <J>" .. mode.chat.info[n].toRead,n,712,378,80,nil,0x324650,0x212E35,1,true)
  3710.     end,
  3711.     displayChat = function(n,update)
  3712.         local loadedM = mode.chat.loadData()
  3713.         if not update then
  3714.             mode.chat.chat(n,loadedM)
  3715.         else
  3716.             for k,v in next,mode.chat.info do
  3717.                 if v.open then
  3718.                     mode.chat.chat(k,loadedM,k ~= n)
  3719.                 else
  3720.                     v.toRead = v.toRead + 1
  3721.                     mode.chat.updateToRead(k)
  3722.                 end
  3723.             end
  3724.         end
  3725.     end,
  3726.     newMessage = function(message,n)
  3727.         mode.chat.messageId = mode.chat.messageId + 1
  3728.         tableinsert(mode.chat.data,{mode.chat.messageId,n,stringgsub(stringgsub(message,"@%((.*)%)",function(text) return text end),"{.-:(.-)}",function(text) return text end)})
  3729.    
  3730.         if mode.chat.getTextLength(message) > 50 then
  3731.             message = stringsub(message,1,47) .. "..."
  3732.         end
  3733.         message = stringgsub(message,"<","&lt;") -- < to <
  3734.         message = stringgsub(message,"https?","") -- https to ""
  3735.         message = stringgsub(message,"://","") -- :// to ""
  3736.         message = stringgsub(message,"@%((.*)%)",function(text) -- @(link:text)
  3737.             return stringformat("<a href='event:display.%s'>%s</a>",mode.chat.messageId,text)
  3738.         end)
  3739.        
  3740.         if #message > 0 then
  3741.             if stringsub(message,1,1) == "/" then
  3742.                 mode.chat.eventChatCommand(n,stringsub(message,2))
  3743.             else
  3744.                 message = stringgsub(message,"{(.-):(.-)}",function(color,text) -- {colorTag:Text}
  3745.                     color = stringupper(color)
  3746.                     if tablefind({"BV","R","BL","J","N","N2","PT","CE","CEP","CS","S","PS","G","V","VP","VI","ROSE","CH","T"},color) then
  3747.                         return stringformat("<%s>%s</%s>",color,text,color)
  3748.                     else
  3749.                         return text
  3750.                     end
  3751.                 end)
  3752.                 tableinsert(mode.chat.displayData,1,stringformat("<V>[%s] <N>%s\n",n,message))
  3753.             end
  3754.         end
  3755.     end,
  3756.     -- Init
  3757.     init = function()
  3758.         mode.chat.translations.pt = mode.chat.translations.br
  3759.         mode.chat.langue = mode.chat.translations[tfm.get.room.community] and tfm.get.room.community or "en"
  3760.         tfm.exec.setRoomMaxPlayers(30)
  3761.         system.disableChatCommandDisplay("title",true)
  3762.         mode.chat.displayChat()
  3763.     end,
  3764.     -- New Player
  3765.     eventNewPlayer = function(n)
  3766.         mode.chat.info[n] = {
  3767.             open = true,
  3768.             toRead = 0,
  3769.         }
  3770.         mode.chat.displayChat(n)
  3771.         tfm.exec.chatMessage(system.getTranslation("welcome"),n)
  3772.     end,
  3773.     -- Answer bar
  3774.     eventPopupAnswer = function(i,n,a)
  3775.         if #stringgsub(a," ","") > 0 then
  3776.             mode.chat.newMessage(a,n)
  3777.             mode.chat.displayChat(n,true)
  3778.         else
  3779.             mode.chat.displayChat(n)
  3780.         end
  3781.     end,
  3782.     -- Callbacks
  3783.     eventTextAreaCallback = function(i,n,c)
  3784.         local p = stringsplit(c,"[^%.]+")
  3785.         if p[1] == "close" then
  3786.             ui.addPopup(0,2,"",n,1e7,1e7)
  3787.             for i = 0,3 do
  3788.                 ui.removeTextArea(i,n)
  3789.             end
  3790.             mode.chat.info[n].open = false
  3791.             mode.chat.updateToRead(n)
  3792.         elseif p[1] == "open" then
  3793.             mode.chat.info[n].open = true
  3794.             mode.chat.info[n].toRead = 0
  3795.             mode.chat.displayChat(n)
  3796.             ui.removeTextArea(4,n)
  3797.         elseif p[1] == "display" then
  3798.             local msg = mode.chat.data[tonumber(p[2])]     
  3799.             tfm.exec.chatMessage(stringformat("<N>> <V>[%s] <N>%s",msg[2],msg[3]),n)
  3800.         end
  3801.     end,
  3802.     -- Commands
  3803.     eventChatCommand = function(n,c)
  3804.         local p = stringsplit(c,"[^%s]+",stringlower)
  3805.         if p[1] == "title" and p[2] and system.roomAdmins[n] then
  3806.             mode.chat.chatTitle = stringsub(tableconcat(p," ",nil,2),1,40)
  3807.             mode.chat.displayChat()
  3808.         elseif p[1] == "np" and p[2] then
  3809.             tfm.exec.chatMessage(stringformat("<S>%s %s %s",stringsub(p[2],1,1) == "@" and p[2] or "@" .. p[2],system.getTranslation("loadmap"),n))
  3810.             tfm.exec.newGame(p[2])
  3811.         elseif p[1] == "sha" then
  3812.             mode.chat.hasShaman = not mode.chat.hasShaman
  3813.            
  3814.             tfm.exec.chatMessage("<S>• " .. system.getTranslation("shaman") .. " " .. system.getTranslation((mode.chat.hasShaman and "disabled" or "enabled")),n)
  3815.             tfm.exec.disableAutoShaman(mode.chat.hasShaman)
  3816.         elseif p[1] == "new" then
  3817.             mode.chat.autoNeWGame = not mode.chat.autoNeWGame
  3818.        
  3819.             tfm.exec.chatMessage("<S>• " .. system.getTranslation("newGame") .. " " .. system.getTranslation((mode.chat.autoNeWGame and "disabled" or "enabled")),n)
  3820.             tfm.exec.disableAutoNewGame(mode.chat.autoNeWGame)
  3821.             tfm.exec.disableAutoTimeLeft(mode.chat.autoNeWGame)
  3822.         elseif stringsub(c,1,6) == "unlock" then
  3823.             tfm.exec.chatMessage("<J>" .. stringformat(system.getTranslation("title"),n,stringsub(c,8)),n)
  3824.         end
  3825.     end,   
  3826. }
  3827.  
  3828. --[[ Cannonup ]]--
  3829. mode.cannonup = {
  3830.     -- Translations
  3831.     translations = {
  3832.         en = {
  3833.             -- Init
  3834.             welcome = "Welcome to #cannonup. Your aim is to be the survivor! <VP>Take care, watermelons are dangerous!\n\t<J>Report any issue to Bolodefchoco.",
  3835.  
  3836.             -- Info
  3837.             nowinner = "No one won!",
  3838.            
  3839.             -- Simple words
  3840.             won = "won!",
  3841.            
  3842.             -- Profile
  3843.             profile = "Rounds : <V>%d</V>\nCheeses : <V>%d</V>\n\nDeaths : <V>%d</V>",
  3844.         },
  3845.         br = {
  3846.             welcome = "Bem-vindo ao #cannonup. Seu objetivo é ser o sobrevivente! <VP>Tome cuidado, melancias são perigosas!\n\t<J>Reporte qualquer problema para Bolodefchoco.",
  3847.        
  3848.             nowinner = "Ninguém ganhou!",
  3849.        
  3850.             won = "venceu!",
  3851.            
  3852.             profile = "Rodadas : <V>%d</V>\nQueijos : <V>%d</V>\n\nMortes : <V>%d</V>",
  3853.         },
  3854.     },
  3855.     langue = "en",
  3856.     -- Data
  3857.     info = {},
  3858.     -- Maps
  3859.     maps = {3746497,6001536,3666224,4591929,"#10","#10","#10","#10","#10","#10","#10","#10","#10"},
  3860.     -- Settings
  3861.     isRunning = false,
  3862.     totalPlayers = 0,
  3863.     -- New Map Settings
  3864.     cannon = {
  3865.         x = 0,
  3866.         y = 0,
  3867.         time = 3,
  3868.         amount = 1,
  3869.         speed = 20,
  3870.     },
  3871.     canMessage = false,
  3872.     currentXml = -1,
  3873.     toDespawn = {},
  3874.     alivePlayers = {},
  3875.     -- Cannon ID
  3876.     getCannon = function()
  3877.         local currentMonth = tonumber(os.date("%m"))
  3878.        
  3879.         if currentMonth == 12 then
  3880.             return 1703 -- Christmas [Ornament]
  3881.         elseif currentMonth == 10 then
  3882.             return tablerandom({17,1701,1702}) -- Halloween [Normal, Glass, Lollipop]
  3883.         elseif currentMonth == 5 and tonumber(os.date("%d")) < 11 then
  3884.             return 1704 -- Transformice's Birthday [Shaman]
  3885.         elseif currentMonth == 7 then
  3886.             return tablerandom({17,1705,1706}) -- Vacations [Normal, Apple, Watermellon]
  3887.         else
  3888.             return tablerandom({17,17,17,1706}) -- Standard
  3889.         end
  3890.     end,
  3891.     -- Spawn Cannon
  3892.     newCannon = function()
  3893.         local alive = system.players(true)
  3894.         if #alive > 0 then
  3895.             local player
  3896.             repeat
  3897.                 player = tfm.get.room.playerList[tablerandom(alive)]
  3898.             until not player.isDead
  3899.            
  3900.             local coordinates = {
  3901.                 {player.x,mathrandom() * 700},
  3902.                 {player.y,mathrandom() * 300},
  3903.                 {false,false}
  3904.             }
  3905.            
  3906.             if mode.cannonup.cannon.x ~= 0 then
  3907.                 coordinates[1][2] = mode.cannonup.cannon.x
  3908.                 coordinates[3][1] = true
  3909.             end
  3910.             if mode.cannonup.cannon.y ~= 0 then
  3911.                 coordinates[2][2] = mode.cannonup.cannon.y
  3912.                 coordinates[3][2] = true
  3913.             end
  3914.            
  3915.             if not coordinates[3][2] and coordinates[2][2] > coordinates[2][1] then
  3916.                 coordinates[2][2] = coordinates[2][1] - mathrandom(100) - 35
  3917.             end
  3918.             if not coordinates[3][1] and mathabs(coordinates[1][2] - coordinates[1][1]) > 350 then
  3919.                 coordinates[1][2] = coordinates[1][1] + mathrandom(-100,100)
  3920.             end
  3921.            
  3922.             local ang = mathdeg(mathatan2(coordinates[2][2] - coordinates[2][1],coordinates[1][2] - coordinates[1][1]))
  3923.             tfm.exec.addShamanObject(0,coordinates[1][2] - (coordinates[3][1] and 0 or 10),coordinates[2][2] - (coordinates[3][2] and 0 or 10),ang + 90)
  3924.            
  3925.             --system.newTimer(function()
  3926.                 mode.cannonup.toDespawn[#mode.cannonup.toDespawn + 1] = {tfm.exec.addShamanObject(mode.cannonup.getCannon(),coordinates[1][2],coordinates[2][2],ang - 90,mode.cannonup.cannon.speed),os.time() + 5000}
  3927.             --end,mathisNegative((mode.cannonup.cannon.speed - 1) * 500,0),false)
  3928.         end
  3929.     end,
  3930.     -- Profile
  3931.     uiprofile = function(p,n)
  3932.         ui.addTextArea(1,"\n\n<font size='13'>\n" .. stringformat(system.getTranslation("profile"),mode.cannonup.info[p].round,mode.cannonup.info[p].victory,mode.cannonup.info[p].death),n,300,100,200,150,0x0B282E,0x1B282E,1,true)
  3933.         ui.addTextArea(2,"<p align='center'><font size='20'><VP><B><a href='event:close'>"..p.."</a>",n,305,105,190,30,0x244452,0x1B282E,.4,true)
  3934.     end,
  3935.     -- Update data
  3936.     updatePlayers = function()
  3937.         local alive,total = system.players()
  3938.         mode.cannonup.alivePlayers = system.players(true)
  3939.         mode.cannonup.totalPlayers = total
  3940.     end,
  3941.     -- Init
  3942.     reset = function()
  3943.         -- Data
  3944.         mode.cannonup.info = {}
  3945.     end,
  3946.     init = function()
  3947.         mode.cannonup.translations.pt = mode.cannonup.translations.br
  3948.        
  3949.         -- Sets the main language according to the community
  3950.         if mode.cannonup.translations[tfm.get.room.community] then
  3951.             mode.cannonup.langue = tfm.get.room.community
  3952.         end
  3953.        
  3954.         -- Init
  3955.         for _,f in next,{"AutoShaman","AutoScore","AutoNewGame","AutoTimeLeft","PhysicalConsumables"} do
  3956.             tfm.exec["disable"..f]()
  3957.         end
  3958.         tfm.exec.setRoomMaxPlayers(25)
  3959.         tfm.exec.newGame('<C><P /><Z><S><S L="800" o="324650" H="100" X="400" Y="400" T="12" P="0,0,0.3,0.2,0,0,0,0" /></S><D /><O /></Z></C>')
  3960.    
  3961.         -- Auto Admin
  3962.         system.roomAdmins.Byontr = true
  3963.     end,
  3964.     -- New Player
  3965.     eventNewPlayer = function(n)
  3966.         if not mode.cannonup.info[n] then
  3967.             mode.cannonup.info[n] = {
  3968.                 round = 0,
  3969.                 victory = 0,
  3970.                 death = 0
  3971.             }
  3972.         end
  3973.        
  3974.         tfm.exec.chatMessage("<J>" .. system.getTranslation("welcome"),n)
  3975.     end,
  3976.     -- New Game
  3977.     eventNewGame = function()
  3978.         ui.setMapName("#CannonUp")
  3979.        
  3980.         mode.cannonup.cannon = {
  3981.             x = 0,
  3982.             y = 0,
  3983.             time = 3,
  3984.             amount = ((mode.cannonup.totalPlayers - (mode.cannonup.totalPlayers % 10)) / 10) + mathsetLim(system.miscAttrib+1,1,5), -- mathmin(5,mathmax(1,system.miscAttrib+1))
  3985.             speed = 20,
  3986.         }
  3987.  
  3988.         mode.cannonup.toDespawn = {}
  3989.        
  3990.         if mode.cannonup.currentXml == -1 then
  3991.             mode.cannonup.currentXml = 0
  3992.         elseif mode.cannonup.currentXml == -2 then
  3993.             mode.cannonup.currentXml = -1
  3994.         end
  3995.        
  3996.         ui.removeTextArea(0,nil)
  3997.         if mode.cannonup.isRunning then
  3998.             if mode.cannonup.currentXml == 0 then
  3999.                 tfm.exec.setGameTime(5)
  4000.                
  4001.                 mode.cannonup.currentXml = xml.addAttrib(tfm.get.room.xmlMapInfo.xml or "",{
  4002.                     [1] = {
  4003.                         tag = "BH",
  4004.                         value = "",
  4005.                     }
  4006.                 },false)
  4007.                 ui.addTextArea(0,"",nil,-1500,-1500,3e3,3e3,0x6A7495,0x6A7495,1,true)
  4008.                
  4009.                 mode.cannonup.canMessage = false
  4010.             else
  4011.                 tfm.exec.setGameTime(125)
  4012.                 mode.cannonup.canMessage = true
  4013.                
  4014.                 if mode.cannonup.totalPlayers > 3 then
  4015.                     for k,v in next,mode.cannonup.info do
  4016.                         v.round = v.round + 1
  4017.                     end
  4018.                 end
  4019.                
  4020.                 xml.attribFunc(mode.cannonup.currentXml or "",{
  4021.                     [1] = {
  4022.                         attribute = "cn",
  4023.                         func = function(value)
  4024.                             local coord,axY = xml.getCoordinates(value)
  4025.                             if type(coord) == "table" then
  4026.                                 mode.cannonup.cannon.x = coord[1].x
  4027.                                 mode.cannonup.cannon.y = coord[1].y
  4028.                             else
  4029.                                 if axY == 0 then
  4030.                                     mode.cannonup.cannon.x = coord
  4031.                                 else
  4032.                                     mode.cannonup.cannon.y = coord
  4033.                                 end
  4034.                             end
  4035.                         end
  4036.                     },
  4037.                     [2] = {
  4038.                         attribute = "cheese",
  4039.                         func = function()
  4040.                             tableforeach(tfm.get.room.playerList,tfm.exec.giveCheese)
  4041.                         end,
  4042.                     },
  4043.                     [3] = {
  4044.                         attribute = "meep",
  4045.                         func = function()
  4046.                             tableforeach(tfm.get.room.playerList,tfm.exec.giveMeep)
  4047.                         end,
  4048.                     },
  4049.                 })
  4050.            
  4051.                 mode.cannonup.currentXml = 0
  4052.                 mode.cannonup.canMessage = true
  4053.             end
  4054.         else
  4055.             tfm.exec.setGameTime(1e7)
  4056.             mode.cannonup.currentXml = -1
  4057.             mode.cannonup.canMessage = false
  4058.         end
  4059.     end,
  4060.     -- Loop
  4061.     eventLoop = function()
  4062.         mode.cannonup.updatePlayers()
  4063.  
  4064.         if mode.cannonup.isRunning then
  4065.             if mode.cannonup.totalPlayers < 2 then
  4066.                 mode.cannonup.isRunning = false
  4067.                 mode.cannonup.canMessage = false
  4068.                 mode.cannonup.currentXml = -2
  4069.             else
  4070.                 if mode.cannonup.currentXml == -1 then
  4071.                     tfm.exec.newGame(tablerandom(mode.cannonup.maps))
  4072.                 elseif mode.cannonup.currentXml ~= 0 then
  4073.                     tfm.exec.newGame(mode.cannonup.currentXml)
  4074.                 else       
  4075.                     if _G.leftTime < 4 or #mode.cannonup.alivePlayers < 2 then
  4076.                         if mode.cannonup.canMessage and mode.cannonup.totalPlayers > 1  then
  4077.                             mode.cannonup.canMessage = false
  4078.                             if #mode.cannonup.alivePlayers > 0 then
  4079.                                 for k,v in next,mode.cannonup.alivePlayers do
  4080.                                     tfm.exec.giveCheese(v)
  4081.                                     tfm.exec.playerVictory(v)
  4082.                                     if mode.cannonup.totalPlayers > 3 then
  4083.                                         mode.cannonup.info[v].victory = mode.cannonup.info[v].victory + 1
  4084.                                     end
  4085.                                     tfm.exec.setPlayerScore(v,5,true)
  4086.                                 end
  4087.                                
  4088.                                 tfm.exec.chatMessage("<J>" .. tableconcat(mode.cannonup.alivePlayers,"<G>, <J>") .. " <J>" .. system.getTranslation("won"))
  4089.                             else
  4090.                                 tfm.exec.chatMessage("<J>" .. system.getTranslation("nowinner"))
  4091.                             end
  4092.                         end
  4093.                         tfm.exec.newGame(tablerandom(mode.cannonup.maps))
  4094.                     else
  4095.                         if _G.currentTime > 5 and mode.cannonup.currentXml == 0 then
  4096.                             if _G.currentTime % mode.cannonup.cannon.time == 0 then
  4097.                                 for i = 1,mode.cannonup.cannon.amount do
  4098.                                     mode.cannonup.newCannon()
  4099.                                 end
  4100.                             end
  4101.                            
  4102.                             if #mode.cannonup.toDespawn > 0 then
  4103.                                 for i = 1,#mode.cannonup.toDespawn do
  4104.                                     if os.time() > mode.cannonup.toDespawn[i][2] then
  4105.                                         tfm.exec.removeObject(mode.cannonup.toDespawn[i][1])
  4106.                                     end
  4107.                                 end
  4108.                             end
  4109.                            
  4110.                             if _G.currentTime % 20 == 0 then
  4111.                                 mode.cannonup.cannon.amount = ((mode.cannonup.totalPlayers - (mode.cannonup.totalPlayers % 10)) / 10) + mathsetLim(system.miscAttrib+1,1,5) --mathmin(5,mathmax(1,system.miscAttrib+1))
  4112.                                 mode.cannonup.cannon.speed = mode.cannonup.cannon.speed + 20
  4113.                                 mode.cannonup.cannon.time = mathmax(.5,mode.cannonup.cannon.time-.5)
  4114.                             end
  4115.                         end
  4116.                     end
  4117.                 end
  4118.             end
  4119.         else
  4120.             if mode.cannonup.currentXml == -2 then
  4121.                 tfm.exec.newGame('<C><P /><Z><S><S L="800" o="324650" H="100" X="400" Y="400" T="12" P="0,0,0.3,0.2,0,0,0,0" /></S><D /><O /></Z></C>')
  4122.             end
  4123.        
  4124.             if mode.cannonup.totalPlayers > 1 then
  4125.                 mode.cannonup.isRunning = true
  4126.             end
  4127.         end
  4128.     end,
  4129.     -- Commands
  4130.     eventChatCommand = function(n,c)
  4131.         local p = stringsplit(c,"[^%s]+",stringlower)
  4132.         if p[1] == "p" or p[1] == "profile" then
  4133.             if p[2] then
  4134.                 p[2] = stringnick(p[2])
  4135.                 if tfm.get.room.playerList[p[2]] then
  4136.                     mode.cannonup.uiprofile(p[2],n)
  4137.                 end
  4138.             else
  4139.                 mode.cannonup.uiprofile(n,n)
  4140.             end
  4141.         end
  4142.     end,
  4143.     -- Callbacks
  4144.     eventTextAreaCallback = function(i,n,c)
  4145.         if c == "close" then
  4146.             for i = 1,2 do
  4147.                 ui.removeTextArea(i,n)
  4148.             end
  4149.         end
  4150.     end,
  4151.     -- Player Left
  4152.     eventPlayerLeft = function()
  4153.         mode.cannonup.updatePlayers()
  4154.     end,
  4155.     -- Player Died
  4156.     eventPlayerDied = function(n)
  4157.         mode.cannonup.info[n].death = mode.cannonup.info[n].death + 1
  4158.     end,
  4159. }
  4160.  
  4161. --[[ Xmas ]]--
  4162. mode.xmas = {
  4163.     -- Translations
  4164.     translations = {
  4165.         en = {"Merry Christmas & Happy New Year!","Christmas is approaching and S4nt4 has a lot to do on his <I>paws</I>. He wants to give all the gifts on time, but he must be fast! Since our dear S4nt4 is clumsy, some gifts will fall and you will have to <CE>collect</CE> them by pressing the <I>space bar</I>! Give the gifts back to S4nt4 when he feels <CE>dizzy</CE> by pressing the <I>space bar</I>!"},
  4166.         fr = {"Joyeux Noël et Bonne Année!","Noël approche et S4nt4 en a plein les <I>pattes</I>. Il veut donner tous les cadeaux à temps, mais il doit être rapide ! Puisque notre cher S4nt4 est maladroix, certains cadeaux tombent et vous devrez les, <CE>collecter</CE> en appuyant sur la <I>barre d'espace</I>! Donnez les cadeaux à S4nt4 quand il se sent <CE>étourdi</CE> en appuyant sur la <I>barre d'espace</I>!"},
  4167.         br = {"Feliz Natal & Feliz Ano Novo!","O Natal está chegando e S4nt4 tem em suas <I>patas</I> muito o que fazer. Ele quer entregar todos os presentes a tempo, mas ele deve ser rápido! Uma vez que nosso querido S4NT4 é desajeitado, alguns presentes cairão e você terá que <CE>coletá-los</CE> pressionando a <I>barra de espaço</I>! Devolva os presentes ao S4nt4, pressionando a <I>barra de espaço</I>, quando ele se sentir <CE>tonto</CE>!"},
  4168.         es = {"¡Feliz Navidad y Próspero Año Nuevo!","La Navidad se está acercando y S4nt4 tiene muchas cosas que hacer con sus <I>patas</I>. Él quiere dar todos los regalos a tiempo, pero debe ser rápido! Puesto que nuestro querido S4nt4 es torpe, algunos regalos caerán y tendrás que <CE>recogerlos</CE> pulsando la <I>barra espaciadora</I>! Regrese los regalos a S4nt4 cuando se sienta <CE>mareado</CE> presionando la <I>barra de espacio</I>!"},
  4169.         tr = {"Mutlu Noeller & Mutlu Yıllar!","Noel geliyor ve S4nt4'nın <I>patilerinde</I> yapacağı çok işi var. Bütün hediyeleri zamanında vermek istiyor ama hızlı olması gerek! Sevgili S4nt4'mız sakar olduğu için, bazı hediyeler düşecek ve <I>boşluk tuşuna</I> basarak onları <CE>toplamanız</CE> gerekecek! S4nt4'nın <CE>başı döndüğünde</CE> <I>boşluk tuşuna</I> basarak hediyeleri ona geri verin!"},
  4170.         pl = {"Wesołych Świąt i Wesołego Nowego Roku!","Święta nadchodzą, a S4nt4 ma <I>łapki</I> pełne roboty. On chce dać wszystkim prezenty na czas, ale musi się pośpieszyć! Od kiedy nasz S4nt4 jest niezdarny, gubi prezenty, które musicie <CE>pozbierać</CE> wciskając <I>spację</I>! Oddajcie prezenty S4nt4 kiedy jest <CE>oszołomiony</CE> wciskając <I>spację</I>!"},
  4171.         ar = {"عيد ميلاد مجيدا و كل عام و أنتم بخير","عيد الميلاد اقترب و<I> يدى </I> سانتا مليئة. يريد سانتا تسليم جميع الهدايا على الوقت, ولكن يجب ان يكون سريعا! ولكن صديقنا العزيز سانتا غير بارع في تسليم الهدايا, بعض الهدايا ستسقط وعليك ان تقوم <CE> بجمع</CE>  الهدايا التي سقطت عن طريق الضغط على المسطرة ! وارجاع الهدايا الى صديقنا العزيز سانتا عندما يشعر <CE> بالدوار</CE> عن طريق الضغط على زر المسطرة!"},
  4172.         hu = {"Boldog Karácsonyt & Boldog Új Évet!","A Karácsony közeleg, és a Mikulásra pedig <I>rengeteg munka vár<I>. Oda akarja adni az összes ajándékot időben, de muszáj gyorsnak lennie! Mivel a mi Mikulásunk kétbalkezes, néhány ajándék lepottyan és Neked kell <CE>összegyűjteni</CE> azokat, a <I>Szóköz</I> megnyomásával! Vidd vissza a Mikulásnak az ajándékot a <I>Szóköz</I> megnyomásával, amikor Mikulás <CE>megszédül</CE>!"},
  4173.         ru = {"С новым годом и Рождеством!","Рождество приближается и S4nt4 направляется к вам! Он очень спешит, чтобы раздать все подарки вовремя! Но так как наш дорогой S4nt4 неуклюж, то некоторые подарки будут падать. Вы должны <CE>собрать</CE> их, нажимая клавишу <I>пробел</I>! Помогите S4nta. <CE>Верните</CE> ему подарки обратно с помощью <I>пробела</I>!"},
  4174.     },
  4175.     langue = "en",
  4176.     -- Data
  4177.     info = {},
  4178.     gifts = {
  4179.         [1] = {
  4180.             [1] = "158bb1db61b",
  4181.             [2] = 20000,
  4182.         };
  4183.         [2] = {
  4184.             [1] = "158bb1c95e0",
  4185.             [2] = 15000,
  4186.         };
  4187.         [3] = {
  4188.             [1] = "158bb1cc6ec",
  4189.             [2] = 10000,
  4190.         };
  4191.         [4] = {
  4192.             [1] = "158bb1ce1aa",
  4193.             [2] = 8000,
  4194.         };
  4195.         [5] = {
  4196.             [1] = "1591c9b3123",
  4197.             [2] = 6000,
  4198.         };
  4199.     },
  4200.     -- Maps
  4201.     xml = '<C><P DS="y;310" /><Z><S><S H="10" L="50" X="275" c="2" Y="165" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S L="200" X="100" H="80" Y="360" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S L="200" X="109" H="80" Y="379" T="12" P="0,0,0.3,0.2,-10,0,0,0" /><S X="391" L="230" H="80" c="3" Y="354" T="12" P="0,0,0.3,0.2,-2,0,0,0" /><S H="100" L="230" X="430" c="3" Y="411" T="12" P="0,0,0.3,0.2,-30,0,0,0" /><S H="80" L="180" X="705" c="3" Y="397" T="12" P="0,0,0.3,0.2,-2,0,0,0" /><S P="0,0,0.3,0.2,0,0,0,0" L="44" H="10" c="3" Y="361" T="13" X="237" /><S X="-5" L="10" H="3000" c="3" Y="100" T="12" P="0,0,0,0,0,0,0,0" /><S H="3000" L="10" X="805" c="3" Y="101" T="12" P="0,0,0,0,0,0,0,0" /><S L="10" X="400" H="3000" Y="-5" T="12" P="0,0,0,0,90,0,0,0" /><S L="80" H="10" X="96" Y="158" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S P="0,0,0.3,.9,0,0,0,0" L="50" X="275" c="3" Y="165" T="12" H="10" /><S L="130" X="527" H="10" Y="128" T="12" P="0,0,0.3,0.2,10,0,0,0" /><S L="90" H="10" X="632" Y="131" T="12" P="0,0,0.3,0.2,-10,0,0,0" /><S H="3000" L="10" o="23E9E9" X="805" c="2" Y="100" T="12" m="" P="0,0,0,2,0,0,0,0" /><S X="-5" L="10" o="23E9E9" H="3000" c="2" Y="100" T="12" m="" P="0,0,0,2,0,0,0,0" /><S P="0,0,0.3,0.2,-35,0,0,0" L="230" X="549" c="3" Y="467" T="12" H="100" /><S P="0,0,0.3,0.2,-55,0,0,0" L="230" H="100" c="3" Y="441" T="12" X="250" /><S L="230" X="125" H="100" Y="422" T="12" P="0,0,0.3,0.2,-30,0,0,0" /><S X="510" L="230" H="100" c="3" Y="477" T="12" P="0,0,0.3,0.2,-65,0,0,0" /><S L="50" X="91" H="50" Y="339" T="12" P="0,0,0.3,0.2,-45,0,0,0" /><S P="0,0,0.3,0.2,0,0,0,0" L="30" X="164" c="2" Y="325" T="12" H="50" /><S P="0,0,0.3,1.1,0,0,0,0" L="30" H="50" c="3" Y="325" T="12" X="164" /><S L="50" X="240" H="10" Y="158" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S L="50" H="10" X="443" Y="125" T="12" P="0,0,0.3,0.2,-20,0,0,0" /><S H="80" L="220" o="23E9E9" X="393" c="1" Y="359" T="12" m="" P="0,0,0.3,0.2,-2,0,0,0" /><S L="230" o="23E9E9" X="427" H="100" Y="416" T="12" m="" P="0,0,0.3,0.2,-30,0,0,0" /><S P="0,0,0.3,0.2,-65,0,0,0" L="230" o="23E9E9" H="100" Y="481" T="12" m="" X="501" /><S P="0,0,0.3,0.2,-35,0,0,0" L="230" o="23E9E9" H="100" Y="474" T="12" m="" X="550" /><S P="0,0,0.3,0.2,-2,0,0,0" L="180" o="23E9E9" X="706" Y="404" T="12" m="" H="80" /><S P="0,0,0.3,0.2,1,0,0,0" L="230" o="23E9E9" X="314" c="2" Y="373" T="12" m="" H="100" /></S><D><P X="241" Y="507" T="51" P="0,1" /><P X="566" Y="449" T="46" P="0,0" /></D><O /></Z></C>',
  4202.     initx = 240,
  4203.     inity = 140,
  4204.     -- New Game Settings
  4205.     aim = 8,
  4206.     start = true,
  4207.     amountPlayers = 20,
  4208.     despawnObjects = {},
  4209.     currentGifts = {},
  4210.     currentTime = 0,
  4211.     leftTime = 150,
  4212.     -- Player Settings
  4213.     setPlayerTools = function(k)
  4214.         mode.xmas.info[k] = {
  4215.             db = {
  4216.                 eventNoelGifts = {0,0},
  4217.             },
  4218.             catch = 0,
  4219.             lastColor = 0xB73535,
  4220.         }
  4221.         if not tfm.get.room.playerList[k].isDead then
  4222.             system.bindKeyboard(k,32,true,true)
  4223.         end
  4224.         mode.xmas.updateBar(k)
  4225.     end,
  4226.     -- Noel's AI
  4227.     noel = {
  4228.         x = 240,
  4229.         y = 140,
  4230.         id = -1,
  4231.         isEscaping = false,
  4232.         isDizzy = {0,false},
  4233.         timers = {
  4234.             teleport = 0,
  4235.             prize = 0
  4236.         },
  4237.         img = {
  4238.             dizzy = {"158bb1dccb6","158bb1cf9a8","158bb1d6489","158bb1e2518"},
  4239.             right = "158bb1d8069",
  4240.             left = "158bb1e0daf",
  4241.             jumping = "158bb1d470a",
  4242.             stop = "158bb1d9b67",
  4243.         },
  4244.         updateImage = function(img)
  4245.             tfm.exec.removeImage(mode.xmas.noel.imgId)
  4246.             mode.xmas.noel.imgId = tfm.exec.addImage(img..".png","#"..mode.xmas.noel.id,-23,-32)
  4247.         end,
  4248.         particles = function(id)
  4249.             for i = 1,5 do
  4250.                 tfm.exec.displayParticle(id,mode.xmas.noel.x + mathrandom(-50,50),mode.xmas.noel.y + mathrandom(-50,50),tablerandom({-.2,.2}),tablerandom({-.2,.2}))
  4251.             end
  4252.         end,
  4253.         move = function(x,y)
  4254.             tfm.exec.moveObject(mode.xmas.noel.id,0,0,false,x,y,false)
  4255.         end,
  4256.         nearMouse = function(range)
  4257.             local player = {"",{dist=mathrandom(800),x=0,y=0}}
  4258.             for k,v in next,tfm.get.room.playerList do
  4259.                 if not v.isDead then
  4260.                     if mathpythag(v.x,v.y,mode.xmas.noel.x,mode.xmas.noel.y,range) then
  4261.                         local m = v.x-mode.xmas.noel.x
  4262.                         if mathabs(m) < player[2].dist then
  4263.                             player = {k,{dist=m,x=v.x,y=v.y}}
  4264.                         end
  4265.                     end
  4266.                 end
  4267.             end
  4268.             mode.xmas.noel.isEscaping = player[1] ~= ""
  4269.             return player
  4270.         end,
  4271.         escape = function(id)
  4272.             local player = mode.xmas.noel.nearMouse(mathrandom(80,100))
  4273.             local mul = (player[1] ~= "" and mathisNegative(player[2].dist,1,-1) or tablerandom({-1,1}))
  4274.             local img = mathisNegative(mul,"left","right")
  4275.             local rand = 9 - mathrandom(0,9)
  4276.             if id == 0 or (rand < 6) then
  4277.                 mode.xmas.noel.move(mul * mathrandom(50,80),-mathrandom(1,10))
  4278.                 mode.xmas.noel.updateImage(mode.xmas.noel.img[img])
  4279.             elseif id == 1 or (rand < 9) then
  4280.                 mode.xmas.noel.move(mul * mathrandom(60,70),-80)
  4281.                 mode.xmas.noel.updateImage(tablerandom({mode.xmas.noel.img[img],mode.xmas.noel.img.jumping}))
  4282.             elseif id == 2 or rand == 9 then
  4283.                 mode.xmas.noel.move(mul * mathrandom(10,20),-mathrandom(70,100))
  4284.                 mode.xmas.noel.updateImage(mode.xmas.noel.img.jumping)
  4285.             end
  4286.         end,
  4287.         meep = function()
  4288.             tfm.exec.displayParticle(20,mode.xmas.noel.x,mode.xmas.noel.y)
  4289.             tfm.exec.explosion(mode.xmas.noel.x,mode.xmas.noel.y,20,50)
  4290.         end,
  4291.         cannon = function()
  4292.             local player = mode.xmas.noel.nearMouse(100)
  4293.             if player[1] ~= "" then
  4294.                 local x = mode.xmas.noel.x + (mode.xmas.noel.x > player[2].x and -40 or 40)
  4295.                 local y = mode.xmas.noel.y + (mode.xmas.noel.y > player[2].y and -40 or 40)
  4296.                 local angle = mathdeg(mathatan2(player[2].y-mode.xmas.noel.y,player[2].x-mode.xmas.noel.x)) + 90
  4297.                 tableinsert(mode.xmas.despawnObjects,{
  4298.                     [1] = tfm.exec.addShamanObject(1703,x,y,angle),
  4299.                     [2] = os.time() + 2500
  4300.                 })
  4301.                 local effect = function(id,sx,sy,xs,ys,e)
  4302.                     for i = 1,2 do
  4303.                         tfm.exec.displayParticle(id[i] and id[i] or id[1],x + sx * e,y - sy * e,xs/1.5,ys/1.5)
  4304.                     end
  4305.                 end
  4306.                 for i = 1,20 do
  4307.                     effect({9,11},mathcos(i),mathsin(i),mathcos(i),-mathsin(i),22)
  4308.                     effect({13},mathcos(i),mathsin(i),mathsin(i),mathcos(i),19)
  4309.                 end
  4310.             end
  4311.         end,
  4312.         teleport = function()
  4313.             if os.time() > mode.xmas.noel.timers.teleport then
  4314.                 mode.xmas.noel.timers.teleport = os.time() + 8000
  4315.                 tfm.exec.displayParticle(37,mode.xmas.noel.x,mode.xmas.noel.y)
  4316.                 local x,y = mathrandom(20,780),mathrandom(50,300)
  4317.                 tfm.exec.moveObject(mode.xmas.noel.id,x,y)
  4318.                 tfm.exec.displayParticle(37,x,y)
  4319.             else
  4320.                 mode.xmas.noel.escape(2)
  4321.             end
  4322.         end,
  4323.         gift = function()
  4324.             if os.time() > mode.xmas.noel.timers.prize then
  4325.                 mode.xmas.noel.timers.prize = os.time() + 5000
  4326.                 mode.xmas.noel.updateImage(mode.xmas.noel.img.stop)
  4327.                 local giftsAmount = mode.xmas.amountPlayers < 10 and 1 or mathfloor(mode.xmas.amountPlayers/10)
  4328.                 for i = 1,giftsAmount do
  4329.                     local gift = tablerandom({2,4,3,1,1,2,3,5,2,4})
  4330.                     for k,v in next,mode.xmas.gifts do
  4331.                         if gift == k then
  4332.                             gift = k
  4333.                             break
  4334.                         end
  4335.                     end
  4336.                     local gen = {}
  4337.                     gen[1] = tfm.exec.addShamanObject(6300,mode.xmas.noel.x,mode.xmas.noel.y,0,tablerandom({-13,-10,-5,5,10,13}))
  4338.                     gen[2] = os.time() + mode.xmas.gifts[gift][2]
  4339.                     gen[3] = tfm.exec.addImage(mode.xmas.gifts[gift][1]..".png","#"..gen[1],-15,-15)
  4340.                     gen[4] = gift
  4341.                     tableinsert(mode.xmas.currentGifts,gen)
  4342.                 end
  4343.             else
  4344.                 mode.xmas.noel.escape(0)
  4345.             end
  4346.         end,
  4347.         dizzy = function(timer)
  4348.             if os.time() > mode.xmas.noel.timers.prize then
  4349.                 mode.xmas.noel.isDizzy[1] = os.time() + 9500
  4350.             else
  4351.                 mode.xmas.noel.escape(2)
  4352.             end
  4353.         end,
  4354.     },
  4355.     resetNoel = function()
  4356.         mode.xmas.initx = 240
  4357.         mode.xmas.inity = 140
  4358.         mode.xmas.noel.x = mode.xmas.initx
  4359.         mode.xmas.noel.y = mode.xmas.inity
  4360.         mode.xmas.noel.id = -1
  4361.         mode.xmas.noel.isEscaping = false
  4362.         mode.xmas.noel.isDizzy = {0,false}
  4363.         mode.xmas.noel.timers = {
  4364.             teleport = 0,
  4365.             prize = 0
  4366.         }
  4367.     end,
  4368.     -- Bar
  4369.     displayBar = function(id,player,value,nvalue,color,sig,size,height)
  4370.         sig = sig or ""
  4371.         size = size or 100
  4372.         height = height or 20
  4373.  
  4374.         ui.addTextArea(id,"",player,5,(height+8) * id,size + 4,height,0xC7CED2,1,1,true)
  4375.         if value ~= 0 then
  4376.             ui.addTextArea(id.."0","",player,6,(height+8) * id + 2,nvalue + 2,height - 4,color,color,1,true)
  4377.         end
  4378.         ui.addTextArea(id + 2,"<B><font color='#0'>"..value..sig,player,(size-30)/2,(height+8) * id + 1,50,height,1,1,0,true)
  4379.     end,
  4380.     updateBar = function(n,giftColor)
  4381.         giftColor = giftColor or mode.xmas.info[n].lastColor
  4382.         mode.xmas.displayBar(1,n,mathfloor(mode.xmas.info[n].db.eventNoelGifts[2]) .. " / "..mode.xmas.aim,(mode.xmas.info[n].db.eventNoelGifts[2] > mode.xmas.aim and 100 or mathpercent(mode.xmas.info[n].db.eventNoelGifts[2],mode.xmas.aim,100)),0xFF0000)
  4383.         mode.xmas.displayBar(2,n,mode.xmas.info[n].db.eventNoelGifts[1],(mode.xmas.info[n].db.eventNoelGifts[1] > 50 and 50 or mathpercent(mode.xmas.info[n].db.eventNoelGifts[1],50,50)),giftColor,"G",50,20)
  4384.     end,
  4385.     -- Init
  4386.     init = function()
  4387.         mode.xmas.translations.pt = mode.xmas.translations.br
  4388.         mode.xmas.langue = mode.xmas.translations[tfm.get.room.community] and tfm.get.room.community or "en"
  4389.         for i,f in next,{"AutoShaman","AfkDeath","MortCommand","AutoTimeLeft","PhysicalConsumables","AutoNewGame","DebugCommand"} do
  4390.             tfm.exec["disable"..f]()
  4391.         end
  4392.         tfm.exec.setRoomMaxPlayers(25)
  4393.         tfm.exec.newGame(mode.xmas.xml)
  4394.         mode.xmas.aim = system.miscAttrib > 0 and system.miscAttrib or 8
  4395.     end,
  4396.     -- New Game
  4397.     eventNewGame = function()
  4398.         mode.xmas.resetNoel()
  4399.  
  4400.         mode.xmas.start = true
  4401.        
  4402.         local _,aP = system.players()
  4403.         mode.xmas.amountPlayers = aP
  4404.        
  4405.         tfm.exec.setGameTime(150)
  4406.         tfm.exec.snow(150)
  4407.         mode.xmas.currentTime = 0
  4408.         mode.xmas.leftTime = 150
  4409.        
  4410.         tfm.exec.addImage("158c1feaf90.png","?0",0,0)
  4411.        
  4412.         ui.setMapName("<J>"..tablerandom({"Nöel","Christmas","Bolodefchoco","Lua event","#xmas","Bogkitty"}).." <G>- @"..tablerandom({666,404,801,os.date("%Y"),0,1}))
  4413.         ui.setShamanName("<R>S4NT4 M4U5")
  4414.        
  4415.         for k,v in next,tfm.get.room.playerList do
  4416.             mode.xmas.setPlayerTools(k)
  4417.         end
  4418.         tfm.exec.chatMessage(stringformat("<V><B>[^_^]</B></V> <BV>%s</BV>\n<V><B>[S4NT4 M4U5]</B></V> <R>%s</R>",mode.xmas.translations[mode.xmas.langue][2],stringupper(mode.xmas.translations[mode.xmas.langue][1])))
  4419.     end,
  4420.     -- New Player
  4421.     eventNewPlayer = function(n)
  4422.         tfm.exec.addImage("158c1feaf90.png","?0",0,0,n)
  4423.         mode.xmas.setPlayerTools(n)
  4424.         tfm.exec.respawnPlayer(n)
  4425.     end,
  4426.     -- Loop
  4427.     eventLoop = function()
  4428.         mode.xmas.currentTime = mode.xmas.currentTime + .5
  4429.         mode.xmas.leftTime = mode.xmas.leftTime - .5
  4430.         if mode.xmas.start then
  4431.             if mode.xmas.currentTime > 4 then
  4432.                 if mode.xmas.noel.id == -1 then
  4433.                     mode.xmas.noel.id = tfm.exec.addShamanObject(6300,mode.xmas.noel.x,mode.xmas.noel.y)
  4434.                     mode.xmas.noel.updateImage(mode.xmas.noel.img.stop)
  4435.                 end
  4436.  
  4437.                 local ox,oy
  4438.                 if tfm.get.room.objectList[mode.xmas.noel.id] then
  4439.                     ox,oy = tfm.get.room.objectList[mode.xmas.noel.id].x,tfm.get.room.objectList[mode.xmas.noel.id].y
  4440.                 else
  4441.                     ox,oy = mode.xmas.noel.x,mode.xmas.noel.y
  4442.                 end
  4443.  
  4444.                 if (ox < -10 or ox > 810) or (oy > 400 or oy < -50) then
  4445.                     tfm.exec.removeObject(mode.xmas.noel.id)
  4446.                     mode.xmas.noel.x,mode.xmas.noel.y = mode.xmas.initx,mode.xmas.inity
  4447.                     mode.xmas.noel.id = nil
  4448.                 end
  4449.  
  4450.                 if mode.xmas.noel.id then
  4451.                     mode.xmas.noel.x = ox
  4452.                     mode.xmas.noel.y = oy
  4453.                 end
  4454.  
  4455.                 for k,v in ipairs(mode.xmas.despawnObjects) do
  4456.                     if os.time() > v[2] then
  4457.                         tfm.exec.removeObject(v[1])
  4458.                     end
  4459.                 end
  4460.                 for k,v in ipairs(mode.xmas.currentGifts) do
  4461.                     if os.time() > v[2] then
  4462.                         tfm.exec.removeObject(v[1])
  4463.                         tfm.exec.removeImage(v[3])
  4464.                     end
  4465.                 end
  4466.  
  4467.                 if os.time() > mode.xmas.noel.isDizzy[1] and mode.xmas.currentTime > 5 then
  4468.                     mode.xmas.noel.particles(13)
  4469.                     if mode.xmas.currentTime % 60 == 0 then
  4470.                         mode.xmas.noel.dizzy()
  4471.                     elseif mode.xmas.currentTime % 5 == 0 then
  4472.                         mode.xmas.noel.gift()
  4473.                         mode.xmas.noel.escape(1)
  4474.                     elseif mathfloor(mode.xmas.currentTime) % 2 == 0 then
  4475.                         local option = mathrandom((mode.xmas.noel.isEscaping and 15 or 12))
  4476.                         if option > 3 then
  4477.                             mode.xmas.noel.escape()
  4478.                         else
  4479.                             mode.xmas.noel.updateImage(mode.xmas.noel.img.stop)
  4480.                             if mode.xmas.currentTime > 7 and mathrandom(1,2) == 1 then
  4481.                                 if option == 3 then
  4482.                                     mode.xmas.noel.cannon()
  4483.                                 elseif option == 2 then
  4484.                                     mode.xmas.noel.teleport()
  4485.                                 elseif option == 1 then
  4486.                                     mode.xmas.noel.meep()
  4487.                                 end
  4488.                             end
  4489.                         end
  4490.                     else
  4491.                         mode.xmas.noel.updateImage(mode.xmas.noel.img.stop)
  4492.                     end
  4493.                 else
  4494.                     mode.xmas.noel.particles(1)
  4495.                     if not mode.xmas.noel.isDizzy[2] then
  4496.                         mode.xmas.noel.isDizzy[2] = true
  4497.                         mode.xmas.noel.timers.prize = os.time() + 5000
  4498.                         local imgId = #mode.xmas.noel.img.dizzy
  4499.                         local animation = {}
  4500.                         local numb = 1
  4501.                         animation = system.looping(function()
  4502.                             mode.xmas.noel.updateImage(mode.xmas.noel.img.dizzy[imgId])
  4503.  
  4504.                             if imgId == #mode.xmas.noel.img.dizzy or imgId == 1 then
  4505.                                 numb = -numb
  4506.                             end
  4507.  
  4508.                             imgId = imgId + numb
  4509.  
  4510.                             if (os.time()+250) > mode.xmas.noel.isDizzy[1] then
  4511.                                 for k,v in next,animation do
  4512.                                     system.removeTimer(v)
  4513.                                 end
  4514.                                 mode.xmas.noel.isDizzy = {0,false}
  4515.                             end
  4516.                         end,10)
  4517.                     end
  4518.                 end
  4519.             end
  4520.             if mode.xmas.leftTime < 2 then
  4521.                 mode.xmas.start = false
  4522.                 tfm.exec.newGame(mode.xmas.xml)
  4523.             end
  4524.         end
  4525.     end,
  4526.     -- Keyboard
  4527.     eventKeyboard = function(n,k,d,x,y)
  4528.         if mode.xmas.start then
  4529.             if os.time() > mode.xmas.info[n].catch and k == 32 then
  4530.                 if os.time() < mode.xmas.noel.isDizzy[1] then
  4531.                     if mathpythag(x,y,mode.xmas.noel.x,mode.xmas.noel.y,32) then
  4532.                         mode.xmas.info[n].db.eventNoelGifts[2] = (mode.xmas.info[n].db.eventNoelGifts[1]/10) + mode.xmas.info[n].db.eventNoelGifts[2]
  4533.                         mode.xmas.info[n].db.eventNoelGifts[1] = 0
  4534.  
  4535.                         mode.xmas.updateBar(n)
  4536.                     end
  4537.                 else
  4538.                     for k,v in next,mode.xmas.currentGifts do
  4539.                         local o = tfm.get.room.objectList[v[1]]
  4540.                         if o and mathpythag(x,y,o.x,o.y,25) then
  4541.                             if (mode.xmas.info[n].db.eventNoelGifts[1]+v[4]) <= 50 then
  4542.                                 tfm.exec.removeObject(v[1])
  4543.                                 tfm.exec.removeImage(v[3])
  4544.  
  4545.                                 mode.xmas.currentGifts[k][2] = 0
  4546.                                 mode.xmas.info[n].db.eventNoelGifts[1] = mode.xmas.info[n].db.eventNoelGifts[1] + v[4]
  4547.  
  4548.                                 mode.xmas.updateBar(n,({0xB73535,0x358CB7,0x35B765,0xB7B735,0xB73487})[v[4]])
  4549.                                 break
  4550.                             end
  4551.                         end
  4552.                     end
  4553.                 end
  4554.                 mode.xmas.info[n].catch = os.time() + 1000
  4555.             end
  4556.         end
  4557.     end,
  4558.     -- Player Died
  4559.     eventPlayerDied = function(n)
  4560.         if mode.xmas.start then
  4561.             system.bindKeyboard(n,32,true,false)
  4562.         end
  4563.     end,
  4564. }
  4565.  
  4566. --[[ Signal ]]--
  4567. mode.signal = {
  4568.     -- Translations
  4569.     translations = {
  4570.         en = {
  4571.             -- Init
  4572.             welcome = "<S>Welcome to <PS>#Signal<S>! Follow the signs and join the hole! Use !help to read more informations.\n\tReport any issue to Bolodefchoco",
  4573.            
  4574.             -- Info
  4575.             info = {
  4576.                 [1] = {"Run","Run the faster you can. Do not stop!"},
  4577.                 [2] = {"Attention","Pay attention! You can die in a few seconds!"},
  4578.                 [3] = {"Stop","Stop or die!"},
  4579.             },
  4580.             skip = "<PS>[•] <S>Impossible map? Type !skip",
  4581.             skipped = "Your vote to skip the map has been recorded.",
  4582.            
  4583.             -- Simple words
  4584.             close = "Close",
  4585.         },
  4586.         br = {
  4587.             welcome = "<S>Bem-vindo ao <PS>#Signal<S>! Siga os sinais e entre na toca!  Use !help para ler mais informações.\n\tReporte qualquer problema para Bolodefchoco",
  4588.  
  4589.             info = {
  4590.                 [1] = {"Corra","Corra o mais rápido que puder. Não pare!"},
  4591.                 [2] = {"Atenção","Preste atenção! Você poderá morrer a qualquer momento!"},
  4592.                 [3] = {"Pare","Pare ou morra!"},
  4593.             },
  4594.             skip = "<PS>[•] <S>Mapa impossível? Digite !skip",
  4595.             skipped = "Seu voto para passar o mapa foi registrado.",
  4596.  
  4597.             close = "Fechar",
  4598.         },
  4599.         pl = {
  4600.             welcome = "<S>Witaj w <PS>#Signal<S>! Patrz na tabliczke i wejdź do norki! Użyj komendy !help, aby przeczytać więcej informacji.\n\tZgłoś wszystkie błędy jakie znajdziesz do Bolodefchoco",
  4601.            
  4602.             info = {
  4603.                 [1] = {"Biegnij","Biegnij jak najszybciej do norki. Nie zatrzymuj się!"},
  4604.                 [2] = {"Uważaj","Uważaj! Możesz zginąć za kilka sekund!"},
  4605.                 [3] = {"Stój","Stój albo zgiń!"},
  4606.             },
  4607.             skip = "<PS>[•] <S>Niemożliwa mapa? Wpisz komendę !skip",
  4608.             skipped = "Twój głos na ominięcie mapy został policzony.",
  4609.            
  4610.             close = "Zamknij",
  4611.         },
  4612.     },
  4613.     langue = "en",
  4614.     -- Data
  4615.     info = {},
  4616.     -- Maps
  4617.     generateMap = function()
  4618.         local groundProperties = {[0] = {.3,.2},[4] = {20,.2},[5] = {.3,.2},[6] = {.3,.2},[7] = {.1,.2},[10] = {.3,0},[11] = {.05,.1},[3] = {5,20}}
  4619.         local groundDecorations = {[0] = {0,4,5},[4] = {1,42,51},[5] = {1,2,4,12,18,20,32,42,46},[6] = {0,1,2,3,4,5,11,42},[7] = {7,8,9,10},[10] = {42,103,118},[11] = {51,106},[3] = {}}
  4620.         local newGround = "<S L=\"%s\" H=\"%s\" X=\"%s\" Y=\"%s\" T=\"%s\" P=\"0,0,%s,%s,0,0,0,0\" />"
  4621.         local newDecoration = "<P P=\"%s,0\" X=\"%d\" Y=\"%d\" T=\"%d\" />"
  4622.         local object = "<%s X=\"%s\" Y=\"%s\"/>"
  4623.         local objects = {hole="T",mice="DS",cheese="F"}
  4624.  
  4625.         local mapHeight = mathrandom(1500,3000)
  4626.  
  4627.         local grounds = {}
  4628.         local decorations = {}
  4629.         for i = 1,mathceil(mapHeight/180) do
  4630.             local T = tablerandom({0,4,5,6,7,10,11,tablerandom({4,5,6,10,3})})
  4631.  
  4632.             local H = T==3 and mathrandom(10,20) or mathrandom(40,100)
  4633.  
  4634.             local Y = (#grounds > 1 and grounds[#grounds].Y < 320 and mathrandom(230,310) or mathrandom(300,350)) or mathrandom(290,350)
  4635.  
  4636.             local X,L
  4637.             repeat
  4638.                 X = (#grounds > 1 and (grounds[#grounds].X + ((mathrandom(-1,1) * 30) + 200)) or mathrandom(50,300))
  4639.                 X = X < 60 and 100 or X > mapHeight - 100 and mapHeight - 300 or X
  4640.                 L = T==3 and H or mathrandom(40,mathceil(mapHeight/18))
  4641.             until (X - (L/2)) > 50 and (X + (L/2)) < mapHeight - 50
  4642.  
  4643.             local properties = groundProperties[T]
  4644.             grounds[#grounds + 1] = {X=X,Y=Y,L=L,H=H,stringformat(newGround,L,H,X,Y,T,properties[1],properties[2])}
  4645.  
  4646.             if T ~= 3 and mathrandom(20) < 10 then
  4647.                 local decoList = groundDecorations[T]
  4648.                 decorations[#decorations + 1] = stringformat(newDecoration,tablerandom({0,0,0,mathrandom(0,1),1}),X - mathrandom(-((L/4)+1),((L/4)+1)),Y - (H/2),tablerandom(decoList))
  4649.             end
  4650.         end
  4651.        
  4652.         local cheeseX
  4653.         repeat
  4654.             cheeseX = mathrandom(200,mapHeight - 500)
  4655.         until (function()
  4656.             for k,v in next,grounds do
  4657.                 if (cheeseX + 10) > (v.X - v.L/2) and (cheeseX - 10) < (v.X + v.L/2) then
  4658.                     return false
  4659.                 end
  4660.             end
  4661.             return true
  4662.         end)()
  4663.  
  4664.         grounds[#grounds + 1] = {X=0,Y=0,L=0,H=0,stringformat(newGround,200,40,100,380,2,.3,.9)}
  4665.         grounds[#grounds + 1] = {X=0,Y=0,L=0,H=0,stringformat(newGround,300,40,mapHeight - 150,380,6,.3,.2)}
  4666.  
  4667.         tfm.exec.newGame(stringformat("<C><P G=\"0,%s\" F=\"%s\" L=\"%s\" /><Z><S>%s</S><D>%s%s%s%s</D><O /></Z></C>",tablerandom({mathrandom(7,12),10,11,9}),tablerandom({0,1,2,3,4,5,7,8}),mapHeight,tableconcat(grounds,"",function(k,v) return v[1] end),stringformat(object,objects.hole,mapHeight - 30,360),stringformat(object,objects.mice,10,365),stringformat(object,objects.cheese,cheeseX,mathrandom(280,340)),tableconcat(decorations)))
  4668.     end,
  4669.     -- Settings
  4670.     sys = {0,1},
  4671.     discrepancy = 0,
  4672.     lights = {"15b52f8717d","15b52f8583a","15b52f88765"},
  4673.     lightId = -1,
  4674.     skip = 0,
  4675.     rounds = 0,
  4676.     possible = false,
  4677.     -- Settings
  4678.     update = function(id)
  4679.         tfm.exec.removeImage(mode.signal.lightId)
  4680.         mode.signal.lightId = tfm.exec.addImage(mode.signal.lights[mode.signal.sys[2]] .. ".png","&0",375,30)
  4681.         local color = ({0x1CB70C,0xF4D400,0xEC0000})[mode.signal.sys[2]]
  4682.         for k,v in next,mode.signal.info do
  4683.             if id == 1 then
  4684.                 if not v.afk and v.canRev then
  4685.                     tfm.exec.respawnPlayer(k)
  4686.                 end
  4687.             end
  4688.             tfm.exec.setNameColor(k,color)
  4689.         end
  4690.     end,
  4691.     -- Help
  4692.     displayInfo = function(n,id)
  4693.         local color = ({"<VP>","<J>","<R>"})[id]
  4694.         ui.addTextArea(1,"<p align='center'><font size='25'>" .. color .. mode.signal.translations[mode.signal.langue].info[id][1] .. "\n</font></p><p align='left'><font size='14'>" .. mode.signal.translations[mode.signal.langue].info[id][2],n,250,110,300,181,0x324650,0x27343A,1,true)
  4695.         ui.addTextArea(2,"<font size='2'>\n</font><p align='center'><font size='16'><a href='event:close'>" .. mode.signal.translations[mode.signal.langue].close,n,250,300,300,30,0x27343A,0x27343A,1,true)
  4696.         ui.addTextArea(3,"<p align='center'><font size='20'><a href='event:info.1'><VP>•</a> <a href='event:info.2'><J>•</a> <a href='event:info.3'><R>•</a>",n,250,145,300,30,1,1,0,true)
  4697.         tfm.exec.removeImage(mode.signal.info[n].imageId)
  4698.         mode.signal.info[n].imageId = tfm.exec.addImage(mode.signal.lights[id] .. ".png","&1",375,200,n)
  4699.     end,
  4700.     -- Init
  4701.     reset = function()
  4702.         -- Data
  4703.         mode.signal.info = {}
  4704.     end,
  4705.     init = function()
  4706.         mode.signal.translations.pt = mode.signal.translations.br
  4707.         mode.signal.langue = mode.signal.translations[tfm.get.room.community] and tfm.get.room.community or "en"
  4708.  
  4709.         for _,f in next,{"AutoShaman","AutoNewGame","AutoTimeLeft","PhysicalConsumables"} do
  4710.             tfm.exec["disable"..f]()
  4711.         end
  4712.  
  4713.         mode.signal.generateMap()
  4714.     end,
  4715.     -- New Player
  4716.     eventNewPlayer = function(n)
  4717.         if not mode.signal.info[n] then
  4718.             mode.signal.info[n] = {
  4719.                 isMoving = {false,false,false,false},
  4720.                 imageId = -1,
  4721.                 afk = true,
  4722.                 skipped = false,
  4723.                 canRev = true,
  4724.             }
  4725.         end
  4726.         for i = 0,3 do
  4727.             system.bindKeyboard(n,i,true,true)
  4728.             system.bindKeyboard(n,i,false,true)
  4729.         end
  4730.         tfm.exec.chatMessage(mode.signal.translations[mode.signal.langue].welcome,n)
  4731.     end,
  4732.     -- New Game
  4733.     eventNewGame = function()
  4734.         mode.signal.skip = 0
  4735.         mode.signal.possible = false
  4736.         mode.signal.rounds = mode.signal.rounds + 1
  4737.        
  4738.         if mode.signal.rounds % 3 == 0 then
  4739.             tfm.exec.chatMessage(mode.signal.translations[mode.signal.langue].skip)
  4740.         end
  4741.        
  4742.         ui.setMapName("<BL>@" .. mathrandom(999) .. "   <G>|   <N>Round : <V>" .. mode.signal.rounds)
  4743.        
  4744.         for k,v in next,mode.signal.info do
  4745.             v.isMoving = {false,false,false,false}
  4746.             v.afk = true
  4747.             v.skipped = false
  4748.             v.canRev = true
  4749.         end
  4750.        
  4751.         mode.signal.sys = {0,1}
  4752.         mode.signal.update(mode.signal.sys[2])
  4753.     end,
  4754.     -- Keyboard
  4755.     eventKeyboard = function(n,k,d)
  4756.         if mode.signal.sys[2] == 3 and d and os.time() > mode.signal.discrepancy then
  4757.             tfm.exec.killPlayer(n)
  4758.         else
  4759.             mode.signal.info[n].isMoving[k + 1] = d
  4760.         end
  4761.         mode.signal.info[n].afk = false
  4762.     end,
  4763.     -- Loop
  4764.     eventLoop = function(currentTime,leftTime)
  4765.         if _G.currentTime > 8 then
  4766.             if os.time() > mode.signal.sys[1] then
  4767.                 mode.signal.sys[2] = (mode.signal.sys[2] % 3) + 1
  4768.                 mode.signal.sys[1] = os.time() + ({mathrandom(7,13),mathrandom(2,3),mathrandom(3,5)})[mode.signal.sys[2]] * 1000
  4769.                 mode.signal.update(mode.signal.sys[2])
  4770.                 mode.signal.discrepancy = os.time() + 520
  4771.             end
  4772.         end
  4773.  
  4774.         if _G.leftTime > 2 and system.players() > 0 then
  4775.             if mode.signal.sys[2] == 3 and os.time() > mode.signal.discrepancy then
  4776.                 for k,v in next,mode.signal.info do
  4777.                     for i,j in next,v.isMoving do
  4778.                         if j then
  4779.                             tfm.exec.killPlayer(k)
  4780.                             break
  4781.                         end
  4782.                     end
  4783.                 end
  4784.             end
  4785.         else
  4786.             mode.signal.generateMap()
  4787.         end
  4788.     end,
  4789.     -- Callbacks
  4790.     eventTextAreaCallback = function(i,n,c)
  4791.         local p = stringsplit(c,"[^%.]+")
  4792.         if p[1] == "info" then
  4793.             mode.signal.displayInfo(n,tonumber(p[2]))
  4794.         elseif p[1] == "close" then
  4795.             tfm.exec.removeImage(mode.signal.info[n].imageId)
  4796.             for i = 1,3 do
  4797.                 ui.removeTextArea(i,n)
  4798.             end
  4799.         end
  4800.     end,
  4801.     -- Commands
  4802.     eventChatCommand = function(n,c)
  4803.         if c == "info" or c == "help" or c == "?" then
  4804.             eventTextAreaCallback(nil,n,"info." .. mode.signal.sys[2])
  4805.         elseif c == "skip" and _G.currentTime > 8 and not mode.signal.possible and not mode.signal.info[n].skipped then
  4806.             mode.signal.skip = mode.signal.skip + 1
  4807.             tfm.exec.chatMessage(mode.signal.translations[mode.signal.langue].skipped,n)
  4808.            
  4809.             local alive,total = system.players()
  4810.             if mode.signal.skip == mathceil(.5 * total) then
  4811.                 tfm.exec.chatMessage("o/")
  4812.                 mode.signal.generateMap()
  4813.             end
  4814.         end
  4815.     end,
  4816.     -- Victory
  4817.     eventPlayerWon = function(n)
  4818.         mode.signal.possible = true
  4819.         mode.signal.info[n].canRev = false
  4820.         tfm.exec.setGameTime(40,false)
  4821.     end,
  4822. }
  4823.  
  4824. --[[ Bootcamp+ ]]--
  4825. mode.bootcampP = {
  4826.     -- Translations
  4827.     translations = {
  4828.         en = {
  4829.             -- Init
  4830.             welcome = "Welcome to <B>#Bootcamp+</B>! Type !info to check the commands\n\tReport any issue to Bolodefchoco!",
  4831.            
  4832.             -- Info
  4833.             info = "Checkpoint:\n\tIf the checkpoint system is enabled, press <B>E</B> to put a checkpoint and <B>Shift+E</B> to remove it.\nAdmin\n\tIf you are a room admin, there are some commands that you can execute:\n\tMaps\n\t\t!next <V>--> Pass the map</V>\n\t\t!again <V>--> Resets the current map</V>\n\t\t!np @Code <VP>or</VP> !map @Code <V>--> Loads a map</V>\n\t\t!queue clear <V>--> Clear the map queue</V>\n\t\t!queue add @Code <V>--> Adds a map in the map queue</V>\n\t\t!queue P3 <VP>or</VP> P13 <VP>or</VP> P23 <V>--> Adds the whole official rotation of P3 or P13 or P23 in the map queue</V>\n\tTime\n\t\t!time TimeInMinutes <V>--> Set the time of the current round in TimeInMinutes</V>\n\t\t!standtime TimeInMinutes <V>--> Set the time of all the rounds in TimeInMinutes</V>\n\tOthers\n\t\t<B>Shift+Click</B> in a ground to read its properties\n\t\t!checkpoint [[not] cheese] <V>--> Enables/Disables the checkpoint system</V>\n\t\tKey Delete <V>--> Kills you</V>",
  4834.             skip = "<VP>%s</VP> just skipped the map!",
  4835.             restart = "<VP>%s</VP> just restarted the current map!",
  4836.             loadmap = "<VP>%s</VP> just loaded the map %s!",
  4837.             settime = "The time has been set to %s minutes!",
  4838.             setstandtime = "The standard time of all the rounds has been set to %s minutes!",
  4839.             enabled = "enabled! Press <B>E</B> to put a checkpoint and <B>Shift+E</B> to remove it.",
  4840.             queuecleared = "%s just cleared the map queue",
  4841.             queuemapadded = "%s just added the map %s to the map queue",
  4842.             queueperm = "%s just added the category %s to the map queue",
  4843.             queuereset = "%s just reseted the queue to the main maps",
  4844.            
  4845.             -- Simple words
  4846.             disabled = "disabled!",
  4847.         },
  4848.         br = {
  4849.             welcome = "Bem-vindo ao <B>#Bootcamp+</B>! Digite !info para checar os comandos\n\tReporte quaisquer problemas para Bolodefchoco!",
  4850.            
  4851.             info = "Checkpoint:\n\tSe o sistema de checkpoint está ativado, pressione <B>E</B> para marcar um checkpoint e <B>Shift+E</B> para remove-lo.\nAdmin\n\tSe você é um administrador da sala, há alguns comandos que você pode executar:\n\tMapas\n\t\t!next <V>--> Passa o mapa</V>\n\t\t!again <V>--> Reinicia o mapa atual</V>\n\t\t!np @Código <VP>ou</VP> !map @Código <V>--> Carrega um mapa</V>\n\t\t!queue clear <V>--> Limpa a lista de mapas</V>\n\t\t!queue add @Código <V>--> Adiciona um mapa na lista de mapas</V>\n\t\t!queue P3 <VP>ou</VP> P13 <VP>ou</VP> P23 <V>--> Adiciona a rotação inteira de P3 ou P13 ou P23 na lista de mapas</V>\n\tTempo\n\t\t!time TempoEmMinutos <V>--> Define o tempo do mapa atual em TempoEmMinutos</V>\n\t\t!standtime TempoEmMinutos <V>--> Define o tempo de todas as partidas em TempoEmMinutos</V>\n\tOutros\n\t\t<B>Shift+Click</B> sobre um piso para ler suas propriedades\n\t\t!checkpoint [[not] cheese] <V>--> Ativa/Desativa o sistema de checkpoint</V>\n\t\tTecla Delete <V>--> Mata-o</V>",
  4852.             skip = "<VP>%s</VP> acabou de passar o mapa!",
  4853.             restart = "<VP>%s</VP> acabou de reiniciar o mapa atual!",
  4854.             loadmap = "<VP>%s</VP> acabou de carregar o mapa %s!",
  4855.             settime = "O tempo foi definido para %s minutos!",
  4856.             setstandtime = "O tempo padrão para todas as partidas foram definidas para %s minutos!",
  4857.             enabled = "ativado! Pressione <B>E</B> para marcar um checkpoint e <B>Shift+E</B> para remove-lo.",
  4858.             queuecleared = "%s acabou de limpar a rotação de mapas",
  4859.             queuemapadded = "%s acabou de adicionar o mapa %s na rotação de mapas",
  4860.             queueperm = "%s acabou de adicionar a categoria %s na rotação de mapas",
  4861.             queuereset = "%s acabou de resetar a rotação de mapas para os mapas principais",
  4862.            
  4863.             disabled = "desativado!",
  4864.         },
  4865.         pl = {
  4866.             welcome = "Witaj w <B>#Bootcamp+</B>! Wpisz !info na czacie aby sprawdzić jakie są komendy\n\tZgłaszaj wszelkie błędy do Bolodefchoco!",
  4867.    
  4868.             info = "Checkpoint:\n\tJeżeli system checkpointów jest włączony, kliknij <B>E</B>, aby ustawić checkpoint i <B>Shift+E</B>, aby go usunąć.\nAdmin\n\tJeżeli jesteś administratorem pokoju, jest kilka komend, które możesz użyć:\n\tMapy\n\t\t!next <V>--> Przełącza mapę</V>\n\t\t!again <V>--> Restartuje mapę</V>\n\t\t!np @Code <VP>albo</VP> !map @Code <V>--> Ładuje mapę</V>\n\t\t!queue clear <V>--> Czyści kolejkę map</V>\n\t\t!queue add @Code <V>--> Dodaję mapę do kolejki</V>\n\t\t!queue P3 <VP>albo</VP> P13 <VP>albo</VP> P23 <V>--> Dodaje wszystkie oficjalne rotacje z permów P3 albo P13 albo P23 do kolejki map</V>\n\tCzas\n\t\t!time CzasWMinutach <V>--> Ustawia czas obecnej mapy na CzasWMinutach</V>\n\t\t!standtime CzasWMinutach <V>--> Ustawia czas dla wszystkich rund na CzasWMinutach</V>\n\tInne\n\t\t<B>Shift+Click</B> na gruncie aby przeczytać jego właściwości\n\t\t!checkpoint [[not] cheese] <V>--> Włącza/Wyłącza system checkpointów</V>\n\t\tKey Delete <V>--> Kills you</V>",
  4869.             skip = "<VP>%s</VP> pominął/-ęła mapę!",
  4870.             restart = "<VP>%s</VP> zrestartował/-a mapę!",
  4871.             loadmap = "<VP>%s</VP> załadował/-a mapę %s!",
  4872.             settime = "Czas został ustawiony na %s minut!",
  4873.             setstandtime = "Standardowy czas dla wszystkich map został ustawiony na %s minut!",
  4874.             enabled = "włączony! Kliknij <B>E</B>, aby ustawić checkpoint i <B>Shift+E</B>, aby go usunąć.",
  4875.             queuecleared = "%s just cleared the map queue",
  4876.             queuemapadded = "%s just added the map %s to the map queue",
  4877.             queueperm = "%s just added the category %s to the map queue",
  4878.             queuereset = "%s just reseted the queue to the main maps",
  4879.            
  4880.             disabled = "wyłączony!",
  4881.         },
  4882.     },
  4883.     langue = "en",
  4884.     -- Data
  4885.     info = {},
  4886.     -- Maps
  4887.     maps = {},
  4888.     map = function()
  4889.         mode.bootcampP.maps = {6501305,6118143,2604997,2836937,6921682,3339586,5776126,5678468,6531399,5847160,5745650,7091808,7000003,6999993,4559999,4784241,3883780,4976520,4854044,6374076,3636206,6793803,4499335,4694197,5485847,6258690,3938895,1719709,4209243,6550335,5994088,3866650,3999455,4095418,4523127,1964971,1554670,4423047,764650,5562230,4883346,2978216,1947288,7025830,7108857,4766627,5888889,6782978,5699275,6422459,2634659,4808290,3620953,2973289,2604643,6591698,7134487,7054821,6900009,7159725,3737744,6933187,6864581,4701337,6631702,6761156,4212122,4160675,4623227,5191670,6377984,1132272,2781845,3460976,7167027,4834444,3734991,7138019,7037760,6521356,6502657,6469688,6092666,2749928,7175796,7142063,7167539,7173296,6995540,7151000,3931358,3374686,6324891,3704015,3937060,2429057,7192029,7192034,7192689}
  4890.     end,
  4891.     -- New Game Settings
  4892.     groundsData = {},
  4893.     mapData = {},
  4894.     standardTime = 6,
  4895.     checkpoint = false,
  4896.     -- Settings
  4897.     respawnCheese = false,
  4898.     -- Leaderboard
  4899.     rank = function(players,fromValue,showPos,showPoints,pointsName,lim)
  4900.         local p,rank = {},""
  4901.         fromValue,lim = fromValue or {tfm.get.room.playerList,"score"},tonumber(lim) or 100
  4902.         for n in next,players do
  4903.             p[#p+1] = {name=n,v=fromValue[1][n][fromValue[2]]}
  4904.         end
  4905.         tablesort(p,function(f,s) return f.v>s.v end)
  4906.         for o,n in next,p do
  4907.             if o <= lim then
  4908.                 rank = rank .. (showPos and "<J>"..o..". " or "") .. "<V>" .. n.name .. (showPoints and " <BL>- <VP>" .. n.v .. " "..(pointsName or "points") .."\n" or "\n")
  4909.             end
  4910.         end
  4911.         return rank
  4912.     end,
  4913.     -- Init
  4914.     reset = function()
  4915.         -- Data
  4916.         mode.bootcampP.info = {}
  4917.     end,
  4918.     init = function()
  4919.         -- Translations
  4920.         mode.bootcampP.translations.pt = mode.bootcampP.translations.br
  4921.         mode.bootcampP.langue = mode.bootcampP.translations[tfm.get.room.community] and tfm.get.room.community or "en"
  4922.        
  4923.         -- Settings
  4924.         mode.bootcampP.respawnCheese = system.miscAttrib == 1
  4925.        
  4926.         -- Init
  4927.         for _,f in next,{"AutoShaman","AutoScore","AutoTimeLeft","AutoNewGame","PhysicalConsumables","AfkDeath"} do
  4928.             tfm.exec["disable"..f]()
  4929.         end
  4930.         tfm.exec.setAutoMapFlipMode(false)
  4931.  
  4932.         mode.bootcampP.map()
  4933.         tfm.exec.newGame(tablerandom(mode.bootcampP.maps))
  4934.        
  4935.         -- Auto Admin
  4936.         system.roomAdmins.Mquk = true
  4937.     end,
  4938.     -- New Game
  4939.     eventNewGame = function()
  4940.         tfm.exec.setGameTime(mode.bootcampP.standardTime * 60)
  4941.         mode.bootcampP.groundsData = {}
  4942.         mode.bootcampP.mapData = {}
  4943.         for k,v in next,mode.bootcampP.info do
  4944.             v.cheese = false
  4945.             v.checkpoint = {false,0,0,false}
  4946.             ui.removeTextArea(1,n)
  4947.         end
  4948.        
  4949.         local xml = tfm.get.room.xmlMapInfo.xml
  4950.         if xml then
  4951.             local grounds = stringmatch(xml,"<S>(.-)</S>")
  4952.             local properties = stringmatch(xml,"<C><P (.-)/>.*<Z>")
  4953.             if properties then
  4954.                 mode.bootcampP.mapData = {
  4955.                     width = stringmatch(properties,'L="(%d+)"') or 800,
  4956.                     heigth = stringmatch(properties,'H="(%d+)"') or 400,
  4957.                 }
  4958.             else
  4959.                 mode.bootcampP.mapData = {
  4960.                     width = 800,
  4961.                     heigth = 400,
  4962.                 }
  4963.             end
  4964.  
  4965.             local data = {}
  4966.             stringgsub(grounds,"<S (.-)/>",function(attributes)
  4967.                 data[#data + 1] = attributes
  4968.             end)
  4969.             for i = 1,#data do
  4970.                 mode.bootcampP.groundsData[i] = {}
  4971.                
  4972.                 local type = stringmatch(data[i],'T="(%d+)"')
  4973.                 mode.bootcampP.groundsData[i].type = type and tonumber(type) or -1
  4974.  
  4975.                 local x = stringmatch(data[i],'X="(%d+)"')
  4976.                 mode.bootcampP.groundsData[i].x = x and tonumber(x) or 0
  4977.  
  4978.                 local y = stringmatch(data[i],'Y="(%d+)"')
  4979.                 mode.bootcampP.groundsData[i].y = y and tonumber(y) or 0
  4980.  
  4981.                 local width = stringmatch(data[i],'L="(%d+)"')
  4982.                 mode.bootcampP.groundsData[i].width = width and tonumber(width) or 0
  4983.  
  4984.                 local heigth = stringmatch(data[i],'H="(%d+)"')
  4985.                 mode.bootcampP.groundsData[i].heigth = heigth and tonumber(heigth) or 0
  4986.  
  4987.                 local info = stringmatch(data[i],'P="(.*)"')
  4988.                 info = stringsplit(info,"[^,]+")
  4989.  
  4990.                 mode.bootcampP.groundsData[i].friction = info[3] and tonumber(info[3]) or .3
  4991.                 mode.bootcampP.groundsData[i].restitution = info[3] and tonumber(info[4]) or .2
  4992.                 mode.bootcampP.groundsData[i].angle = info[3] and tonumber(info[5]) or 0
  4993.             end
  4994.         end
  4995.     end,
  4996.     -- New Player
  4997.     eventNewPlayer = function(n)
  4998.         if not mode.bootcampP.info[n] then
  4999.             mode.bootcampP.info[n] = {
  5000.                 shift = false,
  5001.                 checkpoint = {false,0,0,false},
  5002.                 cheese = false,
  5003.             }
  5004.         end
  5005.        
  5006.         system.bindMouse(n,true)
  5007.         for i = 1,2 do
  5008.             system.bindKeyboard(n,16,i==1,true)
  5009.             system.bindKeyboard(n,stringbyte("K"),i==1,true)
  5010.         end
  5011.        
  5012.         system.bindKeyboard(n,stringbyte("E"),true,true)
  5013.         system.bindKeyboard(n,46,true,true) -- Delete key
  5014.         tfm.exec.chatMessage("<T>" .. system.getTranslation("welcome") .. "\n\t<CEP>/w Mquk #bootcamp+ @mapCode",n)
  5015.        
  5016.         local id = tfm.exec.addImage("15c6ee6324d.png","&0",120,100,n)
  5017.         system.newTimer(function()
  5018.             tfm.exec.removeImage(id)
  5019.         end,5000,false)
  5020.     end,
  5021.     -- Mouse
  5022.     eventMouse = function(n,x,y)
  5023.         if mode.bootcampP.info[n].shift then
  5024.             for i = #mode.bootcampP.groundsData,1,-1 do
  5025.                 local g = mode.bootcampP.groundsData[i]
  5026.                 local rad = mathrad(g.angle)
  5027.                 local ax = {mathcos(rad),mathsin(rad)}
  5028.  
  5029.                 local gX = g.x + ax[1] * (x - g.x) - ax[2] * (y - g.y)
  5030.                 local gY = g.y + ax[2] * (x - g.x) + ax[1] * (y - g.y)
  5031.  
  5032.                 if (g.type == 13 and mathpythag(x,y,g.x,g.y,g.width/2) or (mathabs(gX - g.x) < g.width/2 and mathabs(gY - g.y) < g.heigth/2)) then
  5033.                     local properties = {"Type","ID","X","Y","Heigth","Width","Friction","Restitution","Angle"}
  5034.                     local info = ""
  5035.  
  5036.                     for k,v in next,properties do
  5037.                         info = info .. stringformat("<N>%s : <V>%s\n",v,(v == "ID" and i or v == "Type" and (({[0] = "Unknown","Wood","Ice","Trampoline","Lava","Chocolate","Earth","Grass","Sand","Cloud","Water","Stone","Snow","Rectangle","Circle","Spiderweb"})[g.type + 1]) or tostring(g[stringlower(v)])))
  5038.                     end
  5039.  
  5040.                     local mapW = tonumber(mode.bootcampP.mapData.width)
  5041.                     local mapH = tonumber(mode.bootcampP.mapData.heigth)
  5042.                     ui.addTextArea(0,info,n,(x + 150 <= mapW and x) or (x < 0 and 0) or (mapW - 150),(y + 180 <= mapH and y > 20 and y) or (y < 20 and 25) or (mapH - 180),nil,nil,nil,nil,.8,false)
  5043.                 end
  5044.             end
  5045.         else
  5046.             ui.removeTextArea(0,n)
  5047.         end
  5048.     end,
  5049.     -- Keyboard
  5050.     eventKeyboard = function(n,k,d,x,y)
  5051.         if k == 16 then
  5052.             mode.bootcampP.info[n].shift = d
  5053.         elseif k == stringbyte("E") and mode.bootcampP.checkpoint then
  5054.             if mode.bootcampP.info[n].shift then
  5055.                 mode.bootcampP.info[n].checkpoint = {false,0,0,mode.bootcampP.info[n].checkpoint[4]}
  5056.                 ui.removeTextArea(1,n)
  5057.             else
  5058.                 mode.bootcampP.info[n].checkpoint = {true,x,y,true}
  5059.                 ui.addTextArea(1,"",n,x-5,y-5,10,10,0x56A75A,0x56A75A,.5,true)
  5060.             end
  5061.         elseif k == stringbyte("K") then
  5062.             if d then
  5063.                 ui.addTextArea(2,mode.bootcampP.rank(tfm.get.room.playerList,{tfm.get.room.playerList,"score"},true,true,"points",20),n,5,30,nil,200,nil,nil,.8,true)
  5064.             else
  5065.                 ui.removeTextArea(2,n)
  5066.             end
  5067.         elseif k == 46 then
  5068.             tfm.exec.killPlayer(n)
  5069.         end
  5070.     end,
  5071.     -- Commands
  5072.     eventChatCommand = function(n,c)
  5073.         local p = stringsplit(c,"[^%s]+",stringlower)
  5074.         if p[1] == "info" then
  5075.             tfm.exec.chatMessage("<T>" .. system.getTranslation("info"),n)
  5076.         else
  5077.             if system.roomAdmins[n] then
  5078.                 if p[1] == "next" and os.time() > system.newGameTimer then
  5079.                     tfm.exec.newGame(tablerandom(mode.bootcampP.maps))
  5080.                     tfm.exec.chatMessage("<T>• " .. stringformat(system.getTranslation("skip"),n))
  5081.                 elseif p[1] == "again" and os.time() > system.newGameTimer then
  5082.                     tfm.exec.newGame(tfm.get.room.currentMap)
  5083.                     tfm.exec.chatMessage("<T>• " .. stringformat(system.getTranslation("restart"),n))
  5084.                 elseif (p[1] == "np" or p[1] == "map") and os.time() > system.newGameTimer then
  5085.                     tfm.exec.newGame(p[2])
  5086.                     tfm.exec.chatMessage("<T>• " .. stringformat(system.getTranslation("loadmap"),n,stringfind(p[2],"@") and p[2] or "@"..p[2]))
  5087.                 elseif p[1] == "time" then
  5088.                     tfm.exec.setGameTime(p[2] * 60)
  5089.                     tfm.exec.chatMessage(stringformat(system.getTranslation("settime"),p[2]))
  5090.                 elseif p[1] == "standtime" then
  5091.                     p[2] = p[2] and tonumber(p[2]) or 6
  5092.                     if p[2] > 0 and p[2] < 10 then
  5093.                         mode.bootcampP.standardTime = p[2]
  5094.                         tfm.exec.chatMessage(stringformat(system.getTranslation("setstandtime",p[2])))
  5095.                     end
  5096.                 elseif p[1] == "checkpoint" then
  5097.                     local attribute = false
  5098.                     if p[2] then
  5099.                         attribute = true
  5100.                         if p[2] == "not" and p[3] and p[3] == "cheese" then
  5101.                             mode.bootcampP.respawnCheese = false
  5102.                         elseif p[2] == "cheese" then
  5103.                             mode.bootcampP.respawnCheese = true
  5104.                         else
  5105.                             attribute = false
  5106.                         end
  5107.                     end
  5108.                    
  5109.                     if not (mode.bootcampP.checkpoint and attribute) then
  5110.                         mode.bootcampP.checkpoint = not mode.bootcampP.checkpoint
  5111.                         tfm.exec.chatMessage("<T>Checkpoint " .. system.getTranslation(mode.bootcampP.checkpoint and "enabled" or "disabled"))
  5112.                    
  5113.                         if not mode.bootcampP.checkpoint then
  5114.                             ui.removeTextArea(1,nil)
  5115.                             for k,v in next,mode.bootcampP.info do
  5116.                                 v.checkpoint = {false,0,0,v.checkpoint[4]}
  5117.                             end
  5118.                             if system.miscAttrib ~= 1 then
  5119.                                 mode.bootcampP.respawnCheese = false
  5120.                             end
  5121.                             for k,v in next,mode.bootcampP.info do
  5122.                                 v.cheese = false
  5123.                             end
  5124.                         end
  5125.                     end
  5126.                 elseif p[1] == "queue" then
  5127.                     if p[2] == "clear" then
  5128.                         mode.bootcampP.maps = {}
  5129.                         tfm.exec.chatMessage("• " .. stringformat(system.getTranslation("queuecleared"),n))
  5130.                     elseif p[2] == "add" then
  5131.                         mode.bootcampP.maps[#mode.bootcampP.maps + 1] = p[3]
  5132.                         tfm.exec.chatMessage("• " .. stringformat(system.getTranslation("queuemapadded"),n,stringfind(p[3],"@") and p[3] or "@"..p[3]))
  5133.                     elseif p[2] and stringsub(p[2],1,1) == "p" then
  5134.                         if p[2] == "p3" or p[2] == "p13" or p[2] == "p23" then
  5135.                             mode.bootcampP.maps[#mode.bootcampP.maps + 1] = "#" .. stringsub(p[2],2)
  5136.                             tfm.exec.chatMessage("• " .. stringformat(system.getTranslation("queueperm"),n,stringupper(p[2])))
  5137.                         end
  5138.                     else
  5139.                         mode.bootcampP.map()
  5140.                         tfm.exec.chatMessage("• " .. stringformat(system.getTranslation("queuereset"),n))
  5141.                     end
  5142.                 end
  5143.             end
  5144.         end
  5145.     end,
  5146.     -- Loop
  5147.     eventLoop = function()
  5148.         if _G.leftTime < 1 then
  5149.             tfm.exec.newGame(tablerandom(mode.bootcampP.maps))
  5150.         end
  5151.     end,
  5152.     -- Player Died
  5153.     eventPlayerDied = function(n)
  5154.         system.newTimer(function()
  5155.             tfm.exec.respawnPlayer(n)
  5156.            
  5157.             if mode.bootcampP.checkpoint and mode.bootcampP.info[n].checkpoint[1] then
  5158.                 tfm.exec.movePlayer(n,mode.bootcampP.info[n].checkpoint[2],mode.bootcampP.info[n].checkpoint[3])
  5159.             end
  5160.             if mode.bootcampP.checkpoint and mode.bootcampP.info[n].cheese and mode.bootcampP.respawnCheese then
  5161.                 tfm.exec.giveCheese(n)
  5162.             end
  5163.         end,1500,false)
  5164.     end,
  5165.     -- Victory
  5166.     eventPlayerWon = function(n,t,time)
  5167.         mode.bootcampP.info[n].cheese = false
  5168.         mode.bootcampP.info[n].checkpoint = {false,0,0,mode.bootcampP.info[n].checkpoint[4]}
  5169.         ui.removeTextArea(1,n)
  5170.  
  5171.         mode.bootcampP.eventPlayerDied(n)
  5172.         tfm.exec.setPlayerScore(n,1,true)
  5173.         tfm.exec.chatMessage(stringformat("<ROSE>%s (%ss <PT>(%scheckpoint)</PT>)",n,time/100,mode.bootcampP.info[n].checkpoint[4] and "" or "no "),n)
  5174.     end,
  5175.     -- Got Cheese
  5176.     eventPlayerGetCheese = function(n)
  5177.         if mode.bootcampP.checkpoint and mode.bootcampP.respawnCheese then
  5178.             mode.bootcampP.info[n].cheese = true
  5179.         end
  5180.     end,
  5181. }
  5182.  
  5183. --[[ Map ]]--
  5184. mode.map = {
  5185.     -- Translations
  5186.     translations = {
  5187.         en = {
  5188.             -- Init
  5189.             welcome = "Welcome to #map! Here you can test your maps in different categories and check its approvation in the community!\n\tAdd a map to the queue with the command <B>!maptest @Code PCategory</B> and check the map info using the command <B>!mapinfo</B>.\n\n\tReport any problem to Bolodefchoco.",
  5190.  
  5191.             -- Info
  5192.             savenewmap = "Your map %s is in the position %s",
  5193.             newmaptime = "Less than %s minutes",
  5194.             vote = "Your vote has been recorded.",
  5195.             dovote = "Hold P and vote according to your opinion about this map!",
  5196.  
  5197.             -- Map Info
  5198.             mapby = "Map %s loaded by %s as %s.",
  5199.  
  5200.             -- Security
  5201.             cantvote = "You cannot vote.",
  5202.            
  5203.             -- Simple words
  5204.             grounds = "Grounds",
  5205.             status = "Status",
  5206.             author = "Author",
  5207.         },
  5208.         br = {
  5209.             welcome = "Bem-vindo ao #map! Aqui você pode testar seus mapas em diferentes categorias e checar sua aprovação na comunidade!\n\tAdicione um mapa na lista de espera com o comando <B>!maptest @Código PCategoria</B> e cheque as informações do mapa usando o comando <B>!mapinfo</B>.\n\n\tReporte qualquer problema para Bolodefchoco.",
  5210.  
  5211.             savenewmap = "Seu mapa %s está na posição %s",
  5212.             newmaptime = "Menos de %s minutos",
  5213.             vote = "Seu voto foi registrado.",
  5214.             dovote = "Segure P e vote de acordo com sua opinião sobre este mapa!",
  5215.  
  5216.             mapby = "Mapa %s carregado por %s como %s.",
  5217.  
  5218.             cantvote = "Vote não pode votar.",
  5219.            
  5220.             grounds = "Pisos",
  5221.             status = "Estado",
  5222.             author = "Autor",
  5223.         }
  5224.     },
  5225.     langue = "en",
  5226.     -- Data
  5227.     info = {},
  5228.     -- Maps
  5229.     queue = {},
  5230.     -- Map Settings
  5231.     autoRespawn = false,
  5232.     category = -1,
  5233.     mapInfo = {},
  5234.     canInfo = false,
  5235.     totalPlayers = 0,
  5236.     skip = false,
  5237.     images = {},
  5238.     -- Next Map
  5239.     nextMap = function()
  5240.         if os.time() > system.newGameTimer and #mode.map.queue > 0 then
  5241.             local mapData = mode.map.queue[1]
  5242.  
  5243.             mode.map.mapInfo = {mapData[1],mapData[2],0,0}
  5244.             mode.map.category = mapData[3]
  5245.  
  5246.             mode.map.before()      
  5247.             tfm.exec.newGame(mapData[1])
  5248.         end
  5249.     end,
  5250.     -- Category rules
  5251.     before = function()
  5252.         if mode.map.category >= 0 then
  5253.             if tablefind({0,1,4,5,6,8,9},mode.map.category) then
  5254.                 tfm.exec.disableAutoShaman(false)
  5255.                 tfm.exec.disableAfkDeath(false)
  5256.                 mode.map.autoRespawn = false
  5257.             elseif tablefind({3,7,17},mode.map.category) then
  5258.                 tfm.exec.disableAutoShaman()
  5259.                 if mode.map.category == 3 then
  5260.                     mode.map.autoRespawn = true
  5261.                     tfm.exec.disableAfkDeath()
  5262.                 end
  5263.             end
  5264.         end
  5265.     end,
  5266.     after = function()
  5267.         if mode.map.category >= 0 then
  5268.             if tablefind({0,1,4,5,6,8,9},mode.map.category) then
  5269.                 tfm.exec.setGameTime(135)
  5270.                 if mode.map.category == 8 and mode.map.totalPlayers > 1 then
  5271.                     local newShaman
  5272.                     repeat
  5273.                         newShaman = tablerandom(system.players(true))
  5274.                     until not tfm.get.room.playerList[newShaman].isShaman
  5275.  
  5276.                     ui.setShamanName((function()
  5277.                         for k,v in next,tfm.get.room.playerList do
  5278.                             if v.isShaman then
  5279.                                 return k
  5280.                             end
  5281.                         end
  5282.                         return "?"
  5283.                     end)() .. " - <PS>" .. newShaman)
  5284.                     tfm.exec.setShaman(newShaman)
  5285.  
  5286.                     local xml = tfm.get.room.xmlMapInfo.xml
  5287.                     local attribute = stringmatch(xml,"<DC2 (.-)/>")
  5288.                     if attribute then
  5289.                         local x = stringmatch(attribute,"X=\"(%d+)\"")
  5290.                         local y = stringmatch(attribute,"Y=\"(%d+)\"")
  5291.                         if x and y then
  5292.                             tfm.exec.movePlayer(newShaman,x,y)
  5293.                         end
  5294.                     end
  5295.  
  5296.                     tfm.exec.setNameColor(newShaman,0xF1C4F6)
  5297.                 end
  5298.             elseif mode.map.category == 3 then
  5299.                 tfm.exec.setGameTime(360)
  5300.             elseif mode.map.category == 7 then
  5301.                 tfm.exec.setGameTime(120)
  5302.             elseif mode.map.category == 17 then
  5303.                 tfm.exec.setGameTime(63)
  5304.             end
  5305.         end
  5306.     end,
  5307.     -- Init
  5308.     init = function()
  5309.         mode.map.translations.pt = mode.map.translations.br
  5310.         mode.map.langue = mode.map.translations[tfm.get.room.community] and tfm.get.room.community or "en"
  5311.  
  5312.         tfm.exec.disableAutoNewGame()
  5313.         tfm.exec.setGameTime(10,false)
  5314.        
  5315.         local alive
  5316.         alive,mode.map.totalPlayers = system.players()
  5317.     end,
  5318.     -- New Player
  5319.     eventNewPlayer = function(n)
  5320.         if not mode.map.info[n] then
  5321.             mode.map.info[n] = {
  5322.                 hasVoted = false
  5323.             }
  5324.         end
  5325.  
  5326.         for i = 1,2 do
  5327.             system.bindKeyboard(n,stringbyte("P"),i == 1,true)
  5328.         end
  5329.  
  5330.         tfm.exec.chatMessage("<J>" .. system.getTranslation("welcome"),n)
  5331.     end,
  5332.     -- New Game
  5333.     eventNewGame = function()
  5334.         ui.removeTextArea(2,nil)
  5335.         mode.map.skip = false
  5336.         if mode.map.mapInfo[1] then
  5337.             mode.map.canInfo = true
  5338.            
  5339.             mode.map.after()
  5340.             mode.map.after = function() end
  5341.             tableremove(mode.map.queue,1)
  5342.  
  5343.             for k,v in next,mode.map.info do
  5344.                 v.hasVoted = false
  5345.             end
  5346.            
  5347.             for k,v in next,mode.map.images do
  5348.                 tfm.exec.removeImage(v)
  5349.             end
  5350.            
  5351.             xml.attribFunc(tfm.get.room.xmlMapInfo.xml,{
  5352.                 [1] = {
  5353.                     attribute = "img",
  5354.                     func = function(value)
  5355.                         local images = stringsplit(value,"[^;]+")
  5356.                         for k,v in next,images do
  5357.                             local info = stringsplit(v,"[^,]+")
  5358.                            
  5359.                             -- "img.png,x or 0,y or 0,0/1 (foreground)"
  5360.                             info[4] = tonumber(info[4]) or 0
  5361.                             if tablefind({0,1},info[4]) then
  5362.                                 mode.map.images[#mode.map.images + 1] = tfm.exec.addImage(info[1],(info[4] == 0 and "?" or info[4] == 1 and "&") .. k,tonumber(info[2]) or 5,tonumber(info[3]) or 30)
  5363.                             end
  5364.                         end
  5365.                     end
  5366.                 }
  5367.             })
  5368.  
  5369.             tfm.exec.chatMessage("<J>" .. stringformat(system.getTranslation("mapby"),"@" .. mode.map.mapInfo[1],mode.map.mapInfo[2],"P" .. mode.map.category))
  5370.             tfm.exec.chatMessage("<J>" .. system.getTranslation("dovote"))
  5371.         end
  5372.     end,
  5373.     -- Commands
  5374.     eventChatCommand = function(n,c)
  5375.         local p = stringsplit(c,"[^%s]+",stringlower)
  5376.         if system.isPlayer(n) and p[1] == "maptest" and p[2] then
  5377.             p[2] = tonumber(stringsub(p[2],(stringfind(p[2],"@") and 2 or 1),8))
  5378.             if p[2] and #tostring(p[2]) > 3 then
  5379.                 if #mode.map.mapInfo == 0 then
  5380.                     tfm.exec.setGameTime(10,false)
  5381.                 end
  5382.  
  5383.                 local pos = #mode.map.queue + 1
  5384.                 local category = (p[3] and tonumber(stringsub(p[3],(stringfind(p[3],"p") and 2 or 1))) or 0)
  5385.                 if tablefind({0,1,3,4,5,6,7,8,9,17,18},category) then
  5386.                     if category == 18 then
  5387.                         category = 1
  5388.                     end
  5389.                 else
  5390.                     category = 0
  5391.                 end
  5392.  
  5393.                 mode.map.queue[pos] = {p[2],n,category}
  5394.                 tfm.exec.chatMessage("<J><B>" .. stringformat(system.getTranslation("savenewmap"),stringformat("@%s (P%s)",p[2],category),"#" .. pos) .. "</B>. <ROSE>" .. stringformat("(%s)",stringformat(system.getTranslation("newmaptime"),pos * 2.5)),n)
  5395.             end
  5396.         elseif mode.map.mapInfo[1] and p[1] == "mapinfo" then
  5397.             local xml = tfm.get.room.xmlMapInfo
  5398.             xml = xml and xml.xml or "?"
  5399.            
  5400.             local attributes = stringmatch(xml,"<P (.-)/>") or "?"
  5401.            
  5402.             local totalGrounds = (function()
  5403.                 local g = stringmatch(xml,"<S>(.-)</S>") or "?"
  5404.  
  5405.                 local total = 0
  5406.                 stringgsub(g,"<S ",function()
  5407.                     total = total + 1      
  5408.                 end)
  5409.  
  5410.                 return total
  5411.             end)()
  5412.            
  5413.             local info = {attributes,system.getTranslation("grounds") .. ": " .. totalGrounds,system.getTranslation("author") .. ": " .. (tfm.get.room.xmlMapInfo.author or "?"),system.getTranslation("status") .. ": " .. ("P" .. tfm.get.room.xmlMapInfo.permCode or "?")}
  5414.             ui.addTextArea(2,"\t<J>" .. tableconcat(info,"   <G>|<J>   "),n,5,380,790,20,1,1,.7,true)
  5415.         elseif n == mode.map.mapInfo[2] and p[1] == "time" then
  5416.             tfm.exec.setGameTime(tonumber(stringsub(p[2],1,3)) or 60,false)
  5417.         elseif n == mode.map.mapInfo[2] and p[1] == "skip" then
  5418.             if os.time() > system.newGameTimer then
  5419.                 mode.map.skip = true
  5420.                 mode.map.mapInfo = {}
  5421.             end
  5422.         end
  5423.     end,
  5424.     eventKeyboard = function(n,k,d)
  5425.         if k == stringbyte("P") and _G.currentTime > 5 and #mode.map.mapInfo > 0 then
  5426.             if d and not mode.map.info[n].hasVoted then
  5427.                 if n == mode.map.mapInfo[2] or not system.isPlayer(n) then
  5428.                     tfm.exec.chatMessage("<R>" .. system.getTranslation("cantvote"),n)
  5429.                 else
  5430.                     local ic = {{"+","VP"},{"-","R"}}
  5431.                     for i = 0,1 do
  5432.                         ui.addTextArea(i,"<p align='center'><font size='6'>\n<font size='17'><" .. ic[i+1][2] .. "><a href='event:" .. ic[i+1][1] .. "'><B>" .. ic[i+1][1] .. "1",n,5 + i * 50,30,40,40,1,1,.7,true)
  5433.                     end
  5434.                 end
  5435.             else
  5436.                 for i = 0,1 do
  5437.                     ui.removeTextArea(i,n)
  5438.                 end
  5439.             end
  5440.         end
  5441.     end,
  5442.     -- Callbacks
  5443.     eventTextAreaCallback = function(i,n,c)
  5444.         mode.map.info[n].hasVoted = true
  5445.         if c == "+" then
  5446.             mode.map.mapInfo[3] = mode.map.mapInfo[3] + 1
  5447.         elseif c == "-" then
  5448.             mode.map.mapInfo[4] = mode.map.mapInfo[4] + 1
  5449.         end
  5450.         mode.map.eventKeyboard(n,stringbyte("P"),false)
  5451.  
  5452.         tfm.exec.chatMessage("• " .. system.getTranslation("vote"),n)
  5453.     end,
  5454.     -- Loop
  5455.     eventLoop = function()
  5456.         local alive = 100
  5457.         if _G.currentTime % 5 == 0 then
  5458.             alive,mode.map.totalPlayers = system.players()
  5459.         end
  5460.         if _G.leftTime < 1 or alive < 1 or mode.map.skip then
  5461.             if mode.map.mapInfo[1] and mode.map.canInfo then
  5462.                 mode.map.canInfo = false
  5463.                
  5464.                 local totalVotes = mode.map.mapInfo[3] + mode.map.mapInfo[4]
  5465.                 if totalVotes > 0 then
  5466.                     tfm.exec.chatMessage(stringformat("• [@%s] %s%% (%s)",mode.map.mapInfo[1],mathpercent(mode.map.mapInfo[3],totalVotes),totalVotes),mode.map.mapInfo[2])
  5467.                 end
  5468.             end
  5469.  
  5470.             if #mode.map.queue > 0 then
  5471.                 mode.map.nextMap()
  5472.             else
  5473.                 tfm.exec.newGame()
  5474.             end
  5475.         end
  5476.     end,
  5477.     -- Player Died
  5478.     eventPlayerDied = function(n)
  5479.         if mode.map.autoRespawn then
  5480.             tfm.exec.respawnPlayer(n)
  5481.         end
  5482.     end,
  5483.     -- Player Won
  5484.     eventPlayerWon = function(n)
  5485.         mode.map.eventPlayerDied(n)
  5486.     end,
  5487. }
  5488.  
  5489. --[[ Godmode ]]--
  5490. mode.godmode = {
  5491.     -- Translations
  5492.     translations = {
  5493.         en = {
  5494.             -- Init
  5495.             welcome = "Welcome to <B>#godmode</B>. Type !info to read the help message.\n\tReport any issue to Bolodefchoco.",
  5496.  
  5497.             -- Guide
  5498.             shaman = "Hello shaman! Try to build without nails! Good luck.",
  5499.  
  5500.             -- Info
  5501.             info = "Use your creativity and build WITHOUT nails in shaman maps! The more mice you save, the higher your score will be. Do not let the mice die.\nPress P or type !p [playername] to open a profile.",
  5502.             xp = "You've saved %s mice and %s died.",
  5503.  
  5504.             -- Warning
  5505.             nail = "You can use %s more nails. After that, you will die.",
  5506.             kill = "Try not to use nails in your buildings.",
  5507.             fail = "You failed!",
  5508.            
  5509.             -- Profile
  5510.             profile = "Title : <V>«%s»<N>\n\nRounds : %s\n<N>Shaman : %s <G>/ %s\n\n<N>Deaths : %s",
  5511.            
  5512.             -- Titles
  5513.             titles = {
  5514.                 "Shammy",
  5515.                 "Experienced Shaman",
  5516.                 "Evil Shaman",
  5517.                 "Angry Shaman",
  5518.                 "Spirit",
  5519.                 "Haunted Shaman",
  5520.                 "Troll Shaman",
  5521.                 "Scientist",
  5522.                 "Physics Master",
  5523.                 "Black Magic",
  5524.             },
  5525.             unlock = "%s just unlocked «%s»",
  5526.         },
  5527.         br = {
  5528.             welcome = "Bem-vindo ao <B>#godmode</B>. Digite !info para ler a mensagem de ajuda.\n\tReporte qualquer problema para Bolodefchoco.",
  5529.  
  5530.             shaman = "Olá shaman! Tente construir sem pregos! Boa sorte.",
  5531.  
  5532.             info = "Utilize sua criatividade e construa em mapas shaman SEM pregos! Quanto mais ratos você salvar, maior será sua pontuação. Não deixe nenhum rato morrer.\nPressione P ou digite !p [nome] para abrir um perfil.",
  5533.             xp = "Você salvou %s ratos e %s morreram.",
  5534.  
  5535.             nail = "Você pode usar mais %s pregos. Depois disso, você morrerá.",
  5536.             kill = "Tente não usar pregos em suas construções.",
  5537.             fail = "Você falhou!",
  5538.  
  5539.             profile = "Título : <V>«%s»<N>\n\nPartidas : %s\n<N>Shaman : %s <G>/ %s\n\n<N>Mortes : %s",
  5540.            
  5541.             titles = {
  5542.                 "Pequeno Shaman",
  5543.                 "Shaman Profissional",
  5544.                 "Shaman Mau",
  5545.                 "Shaman Bravo",
  5546.                 "Espírito",
  5547.                 "Shaman Assombado",
  5548.                 "Shaman Troll",
  5549.                 "Cientista",
  5550.                 "Mestre da Física",
  5551.                 "Magia Negra",
  5552.             },
  5553.             unlock = "%s acabou de desbloquear «%s»",
  5554.         },
  5555.     },
  5556.     langue = "en",
  5557.     -- Data
  5558.     info = {},
  5559.     -- Shaman
  5560.     getShaman = function()
  5561.         local s = {}
  5562.         for k,v in next,tfm.get.room.playerList do
  5563.             if v.isShaman then
  5564.                 s[#s + 1] = k
  5565.             end
  5566.         end
  5567.  
  5568.         return s
  5569.     end,
  5570.     -- New Game Settings
  5571.     savedMice = 0,
  5572.     deadMice = 0,
  5573.     lastShaman = {},
  5574.     -- Other Settings
  5575.     title = nil,
  5576.     titles = {0,10,20,30,40,50,60,70,80,90},
  5577.     -- Profile
  5578.     profile = function(n,p)
  5579.         ui.addTextArea(0,"<p align='center'><B><R><a href='event:profile.close'>X",n,513,115,20,20,1,1,1,true)
  5580.         ui.addTextArea(1,"<p align='center'><font size='16'><B><V>"..p.."</V></B></font></p><p align='left'><font size='12'>\n<N>" .. stringformat(system.getTranslation("profile"),mode.godmode.info[p].title,"<V>"..mode.godmode.info[p].roundSha,"<J>"..mode.godmode.info[p].cheeseMice,"<R>"..mode.godmode.info[p].deathMice,"<V>"..mode.godmode.info[p].deathSha),n,290,115,220,160,1,1,1,true)
  5581.     end,
  5582.     -- Update Menu Bar
  5583.     updateMenu = function()
  5584.         ui.setShamanName(tableconcat(mode.godmode.getShaman()," - <PS>") .. "   <G>|   <N>Status : <J>" .. mode.godmode.savedMice .. " <BL>/ <R>" ..  mode.godmode.deadMice)
  5585.     end,
  5586.     -- Init
  5587.     reset = function()
  5588.         -- Data
  5589.         mode.godmode.info = {}
  5590.     end,
  5591.     init = function()
  5592.         -- Translations
  5593.         mode.godmode.translations.pt = mode.godmode.translations.br
  5594.         mode.godmode.langue = mode.godmode.translations[tfm.get.room.community] and tfm.get.room.community or "en"
  5595.  
  5596.         -- Titles
  5597.         mode.godmode.title = system.getTranslation("titles")
  5598.        
  5599.         -- Init
  5600.         tfm.exec.disableAutoNewGame()
  5601.         tfm.exec.disableAllShamanSkills()
  5602.         tfm.exec.newGame("#4")
  5603.        
  5604.         -- Auto Admin
  5605.         system.roomAdmins.Mcqv = true
  5606.     end,
  5607.     -- New Player
  5608.     eventNewPlayer = function(n)
  5609.         if not mode.godmode.info[n] then
  5610.             mode.godmode.info[n] = {
  5611.                 usedNails = 0,
  5612.                 roundSha = 0,
  5613.                 deathSha = 0,
  5614.                 deathMice = 0,
  5615.                 cheeseMice = 0,
  5616.                 title = "Shammy",
  5617.             }
  5618.         end
  5619.  
  5620.         for k,v in next,{66,67,74,78,80,86} do
  5621.             system.bindKeyboard(n,v,true,true)
  5622.         end
  5623.  
  5624.         tfm.exec.chatMessage("<ROSE>" .. system.getTranslation("welcome"),n)
  5625.        
  5626.         local id = tfm.exec.addImage("15ca3f4a200.png","&0",5,150,n)
  5627.         system.newTimer(function()
  5628.             tfm.exec.removeImage(id)
  5629.         end,10000,false)
  5630.     end,
  5631.     -- New Game
  5632.     eventNewGame = function()
  5633.         if #mode.godmode.lastShaman > 0 then
  5634.             for k,v in next,mode.godmode.lastShaman do
  5635.                 mode.godmode.info[v].cheeseMice = mode.godmode.info[v].cheeseMice + mode.godmode.savedMice
  5636.                 mode.godmode.info[v].deathMice = mode.godmode.info[v].deathMice + mode.godmode.deadMice
  5637.                 tfm.exec.chatMessage("<CH>" .. stringformat(system.getTranslation("xp"),mode.godmode.savedMice,mode.godmode.deadMice),v)
  5638.                
  5639.                
  5640.                 for i = #mode.godmode.titles,1,-1 do
  5641.                     if mode.godmode.info[v].cheeseMice >= mode.godmode.titles[i] then
  5642.                         if mode.godmode.info[v].title ~= mode.godmode.title[i] then
  5643.                             mode.godmode.info[v].title = mode.godmode.title[i]
  5644.                             tfm.exec.chatMessage("<J>" .. stringformat(system.getTranslation("unlock"),v,mode.godmode.title[i]))
  5645.                         end
  5646.                         break  
  5647.                     end
  5648.                 end
  5649.             end
  5650.         end
  5651.        
  5652.         mode.godmode.savedMice = 0
  5653.         mode.godmode.deadMice = 0
  5654.        
  5655.         mode.godmode.updateMenu()
  5656.  
  5657.         for k,v in next,mode.godmode.info do
  5658.             v.usedNails = 0
  5659.         end
  5660.         for k,v in next,mode.godmode.getShaman() do
  5661.             mode.godmode.info[v].roundSha = mode.godmode.info[v].roundSha + 1
  5662.             tfm.exec.chatMessage("<CH>" .. system.getTranslation("shaman"),v)
  5663.         end
  5664.        
  5665.         tfm.exec.setGameTime(183)
  5666.     end,
  5667.     -- Keyboard
  5668.     eventKeyboard = function(n,k)
  5669.         if k == 80 then
  5670.             mode.godmode.profile(n,n)
  5671.         elseif not tfm.get.room.playerList[n].isDead and tfm.get.room.playerList[n].isShaman then
  5672.             if tablefind({66,67,74,78,86},k) then -- B;C;V;N;J
  5673.                 mode.godmode.info[n].usedNails = mode.godmode.info[n].usedNails + 1
  5674.                 if mode.godmode.info[n].usedNails > 4 then
  5675.                     tfm.exec.killPlayer(n)
  5676.                     tfm.exec.chatMessage("<R>" .. system.getTranslation("fail") .. " " .. system.getTranslation("kill"),n)
  5677.                 else
  5678.                     tfm.exec.chatMessage("<R>" .. stringformat(system.getTranslation("nail"),5 - mode.godmode.info[n].usedNails),n)
  5679.                 end
  5680.             end
  5681.         end
  5682.     end,
  5683.     -- Summoned
  5684.     eventSummoningEnd = function(n,o,x,y,a,i)
  5685.         tfm.exec.removeObject(i.id)
  5686.        
  5687.         tfm.exec.addShamanObject(o,x,y,a,i.vx,i.vy,i.ghost)
  5688.     end,
  5689.     -- Loop
  5690.     eventLoop = function()
  5691.         local alive,total = system.players()
  5692.         if _G.leftTime < 2 or (total > 1 and alive < 2) or alive == 0 then
  5693.             mode.godmode.lastShaman = mode.godmode.getShaman()
  5694.             tfm.exec.newGame("#4")
  5695.         end
  5696.     end,
  5697.     -- Player Died
  5698.     eventPlayerDied = function(n)
  5699.         if tfm.get.room.playerList[n].isShaman then
  5700.             tfm.exec.setGameTime(10,false)
  5701.             mode.godmode.info[n].deathSha = mode.godmode.info[n].deathSha + 1
  5702.             tfm.exec.chatMessage("<R>" .. system.getTranslation("fail"),n)
  5703.         else
  5704.             mode.godmode.deadMice = mode.godmode.deadMice + 1
  5705.             mode.godmode.updateMenu()
  5706.         end
  5707.     end,
  5708.     -- Player Won
  5709.     eventPlayerWon = function(n)
  5710.         if not tfm.get.room.playerList[n].isShaman then
  5711.             mode.godmode.savedMice = mode.godmode.savedMice + 1
  5712.             mode.godmode.updateMenu()
  5713.         end
  5714.     end,
  5715.     -- Commands
  5716.     eventChatCommand = function(n,c)
  5717.         local p = stringsplit(c,"[^%s]+",stringlower)
  5718.         if p[1] == "info" then
  5719.             tfm.exec.chatMessage("<J>" .. system.getTranslation("info"),n)
  5720.         elseif p[1] == "p" then
  5721.             if p[2] then
  5722.                 p[2] = stringnick(p[2])
  5723.                 if mode.godmode.info[p[2]] then
  5724.                     mode.godmode.profile(n,p[2])
  5725.                 end
  5726.             else
  5727.                 mode.godmode.profile(n,n)
  5728.             end
  5729.         end
  5730.     end,
  5731.     -- Callback
  5732.     eventTextAreaCallback = function(i,n,c)
  5733.         local p = stringsplit(c,"[^%.]+")
  5734.         if p[1] == "profile" then
  5735.             if p[2] == "close" then
  5736.                 for i = 0,1 do
  5737.                     ui.removeTextArea(i,n)
  5738.                 end
  5739.             end
  5740.         end
  5741.     end,
  5742. }
  5743.  
  5744. --[[ Sharpie ]]--
  5745. mode.sharpie = {
  5746.     -- Translations
  5747.     translations = {
  5748.         en = {
  5749.             -- Init
  5750.             welcome = "Welcome to #sharpie! Fly pressing space.",
  5751.  
  5752.             -- Warning
  5753.             nothacker = "The mice flying are NOT hackers!",
  5754.  
  5755.             -- Sample words
  5756.             won = "won",
  5757.            
  5758.             -- Messages
  5759.             first = {
  5760.                 "yay 2 in a row",
  5761.                 "super pro",
  5762.                 "oml are you playing alone or what",
  5763.                 "wooow 4 in a row!",
  5764.                 "getting hard? good luck pro!",
  5765.                 "you noob just unlocked the title lightning",
  5766.                 "woah speedmaster",
  5767.                 "formula 1",
  5768.                 "time traveler you sir",
  5769.                 "queen of the win",
  5770.                 "as pro as the developer",
  5771.                 "ILLUMINATI!",
  5772.                 "are you a real hacker?",
  5773.                 "I hope you dont loose the chance of seeing the last message",
  5774.                 "THIS IS A SHIT MESSAGE BECAUSE YOU DIDNT DESERVE IT",
  5775.             },
  5776.             hardMode = "The hard mode is activated this round!",
  5777.         },
  5778.         br = {
  5779.             welcome = "Bem-vindo ao #sharpie! Voe apertando espaço.",
  5780.  
  5781.             nothacker = "Os ratos voando NÃO são hackers!",
  5782.  
  5783.             won = "venceu",
  5784.  
  5785.             first = {
  5786.                 "yay 2 seguidas",
  5787.                 "super pro",
  5788.                 "omg você tá jogando sozinho ou o que",
  5789.                 "etaaa 4 seguidas!",
  5790.                 "ficando difícil? boa sorte mito!",
  5791.                 "vc noob acaba de desbloquear o título relâmpago",
  5792.                 "vuash mestre da corrida",
  5793.                 "relâmpago marquinhos",
  5794.                 "viajante do tempo vc senhor",
  5795.                 "rainha da vitória",
  5796.                 "tão pro quanto o criador do jogo",
  5797.                 "ILLUMINATI!",
  5798.                 "éres um hacker de verdade?",
  5799.                 "Espero que você não perca a chance de ler a última mensagem",
  5800.                 "ESSA É UMA MENSAGEM DE MERDA PQ VC N MERECEU ISSO",
  5801.             },
  5802.             hardMode = "O modo difícil está ativado nessa partida!",
  5803.         },
  5804.     },
  5805.     langue = "en",
  5806.     -- New Game Settings
  5807.     flyPower = -50,
  5808.     firstRow = {"",0}, -- Player, amount
  5809.     podium = 0,
  5810.     totalPlayers = 0,
  5811.     hardmode = false,
  5812.     modeImages = {"15cbdb3c427","15cbdb479ca","15cbdb4a1ca","15cbdb4cae5"},
  5813.     mapInfo = {800,400},
  5814.     -- Not Hacker Message
  5815.     uiborder = function(t,x,y)
  5816.         local colors = {
  5817.             {"#F7F918","#EC4848"},
  5818.             {"#4CE7F7","#2C9F5B"},
  5819.             {"#4BD9CD","#2A64E9"},
  5820.             {"#D4F31A","#8C8fA4"},
  5821.         }
  5822.         local color = tablerandom(colors)
  5823.  
  5824.         ui.addTextArea(0,"<font color='" .. color[2] .. "'><B>"..t,nil,x,y-1,900,25,1,1,0,true)
  5825.         ui.addTextArea(1,"<font color='" .. color[2] .. "'><B>"..t,nil,x,y+1,900,25,1,1,0,true)
  5826.         ui.addTextArea(2,"<font color='" .. color[2] .. "'><B>"..t,nil,x+1,y,900,25,1,1,0,true)
  5827.         ui.addTextArea(3,"<font color='" .. color[2] .. "'><B>"..t,nil,x-1,y,900,25,1,1,0,true)
  5828.         ui.addTextArea(4,"<font color='" .. color[1] .. "'><B>"..t,nil,x,y,900,25,1,1,0,true)
  5829.     end,
  5830.     -- Init
  5831.     init = function()
  5832.         -- Init
  5833.         tfm.exec.disableAutoShaman()
  5834.         tfm.exec.disableAutoScore()
  5835.        
  5836.         tfm.exec.newGame()
  5837.     end,
  5838.     -- New Game
  5839.     eventNewGame = function()
  5840.         mode.sharpie.podium = 0
  5841.        
  5842.         local currentXml = tfm.get.room.xmlMapInfo
  5843.         currentXml = currentXml and currentXml.xml or ""
  5844.        
  5845.         mode.sharpie.mapInfo = {800,400}
  5846.         mode.sharpie.flyPower = -50
  5847.        
  5848.         xml.attribFunc(currentXml or "",{
  5849.             [1] = {
  5850.                 attribute = "G",
  5851.                 func = function(value)
  5852.                     value = stringsplit(value,"[^,]+")
  5853.                     value = tonumber(value[2]) or value
  5854.                     mode.sharpie.flyPower = value < 0 and 50 or -50
  5855.                 end
  5856.             },
  5857.             [2] = {
  5858.                 attribute = "L",
  5859.                 func = function(value)
  5860.                     value = tonumber(value)
  5861.                     if value then
  5862.                         mode.sharpie.mapInfo[1] = value
  5863.                     end
  5864.                 end
  5865.             },
  5866.             [3] = {
  5867.                 attribute = "H",
  5868.                 func = function(value)
  5869.                     value = tonumber(value)
  5870.                     if value then
  5871.                         mode.sharpie.mapInfo[2] = value
  5872.                     end
  5873.                 end
  5874.             },
  5875.            
  5876.         })
  5877.        
  5878.         mode.sharpie.hardmode = mathrandom(10) == 6
  5879.         if mode.sharpie.hardmode then
  5880.             tfm.exec.chatMessage("<CH>" .. system.getTranslation("hardMode"))
  5881.         end
  5882.     end,
  5883.     -- New Player
  5884.     eventNewPlayer = function(n)
  5885.         tfm.exec.chatMessage("<CE>" .. system.getTranslation("welcome"),n)
  5886.  
  5887.         system.bindKeyboard(n,32,true,true)
  5888.     end,
  5889.     -- Keyboard
  5890.     eventKeyboard = function(n,k,d,x,y)
  5891.         if k == 32 then
  5892.            
  5893.             tfm.exec.movePlayer(n,0,0,true,0,mode.sharpie.flyPower,true)
  5894.         end
  5895.     end,
  5896.     -- Victory
  5897.     eventPlayerWon = function(n)
  5898.         mode.sharpie.podium = mode.sharpie.podium + 1
  5899.         if mode.sharpie.podium == 1 then
  5900.             if mode.sharpie.firstRow[1] == n then
  5901.                 mode.sharpie.firstRow[2] = mode.sharpie.firstRow[2] + 1
  5902.                
  5903.                 if mode.sharpie.totalPlayers > 3 then
  5904.                     local msg = system.getTranslation("first")
  5905.                     tfm.exec.chatMessage("<G># <ROSE>" .. (msg[mode.sharpie.firstRow[2] - 1] or tablerandom({msg[2],msg[3],msg[6],msg[13],msg[15]})),n)
  5906.                 end
  5907.             else
  5908.                 mode.sharpie.firstRow = {n,1}
  5909.             end
  5910.  
  5911.             tfm.exec.setPlayerScore(n,(mode.sharpie.firstRow[2]+1) * 5,true)
  5912.  
  5913.             tfm.exec.chatMessage(stringformat("<J>%s %s! %s",n,system.getTranslation("won"),mode.sharpie.firstRow[2] > 1 and "("..mode.sharpie.firstRow[2]..")" or ""))
  5914.         else
  5915.             tfm.exec.setPlayerScore(n,5,true)
  5916.         end
  5917.     end,
  5918.     -- Loop
  5919.     eventLoop = function()
  5920.         if _G.currentTime % 5 == 0 then
  5921.             local alive,total = system.players()
  5922.             mode.sharpie.totalPlayers = total
  5923.            
  5924.             -- Warning
  5925.             mode.sharpie.uiborder(system.getTranslation("nothacker"),10,382)
  5926.         end
  5927.  
  5928.         if mode.sharpie.hardmode and _G.currentTime % 14 == 0 then
  5929.             system.newTimer(function()
  5930.                 local x,y = mathrandom(0,mode.sharpie.mapInfo[1]),mathrandom(0,mode.sharpie.mapInfo[2])
  5931.                 local id = tfm.exec.addImage(tablerandom(mode.sharpie.modeImages) .. ".png","&0",x - 56,y - 51) -- 112x103 img
  5932.                 system.newTimer(function()
  5933.                     tfm.exec.removeImage(id)
  5934.  
  5935.                     tfm.exec.displayParticle(24,x,y)
  5936.                     tfm.exec.explosion(x,y,50,100)
  5937.                 end,1250,false)
  5938.             end,1000,false)
  5939.         end
  5940.     end,
  5941. }
  5942.  
  5943. --[[ Non-official Events ]]--
  5944. system.objects = {
  5945.     image = {},
  5946.     textarea = {}
  5947. }
  5948. eventModeChanged = function()
  5949.     -- Remove content
  5950.     for k in next,system.objects.image do
  5951.         tfm.exec.removeImage(k)
  5952.     end
  5953.    
  5954.     for k in next,system.objects.textarea do
  5955.         ui.removeTextArea(k,nil)
  5956.     end
  5957.    
  5958.     system.objects = {
  5959.         image = {},
  5960.         textarea = {}
  5961.     }
  5962.    
  5963.     ui.addPopup(0,0,"",nil,-1500,-1500)
  5964.    
  5965.     -- Unbind keyboard and mouse, also normalize color name and scores
  5966.     for k in next,tfm.get.room.playerList do
  5967.         for i = 0,255 do
  5968.             for v = 0,1 do
  5969.                 system.bindKeyboard(k,i,v == 0,false)
  5970.             end
  5971.         end
  5972.        
  5973.         system.bindMouse(k,false)
  5974.        
  5975.         tfm.exec.setNameColor(k,-1)
  5976.         tfm.exec.setPlayerScore(k,0)
  5977.     end
  5978.    
  5979.     -- Set admin back
  5980.     system.roomAdmins = system.setAdmins()
  5981.    
  5982.     -- Reset settings
  5983.     for k,v in next,{"AutoScore","WatchCommand","AutoNewGame","AutoShaman","AllShamanSkills","MortCommand","DebugCommand","MinimalistMode","AfkDeath","PhysicalConsumables","AutoTimeLeft"} do
  5984.         tfm.exec["disable" .. v](false)
  5985.     end
  5986.     tfm.exec.setAutoMapFlipMode()
  5987.    
  5988.     tfm.exec.setRoomMaxPlayers(25)
  5989.     tfm.exec.setRoomPassword("")   
  5990. end
  5991.  
  5992. --[[ Event Functions ]]--
  5993. events = {}
  5994.  
  5995. events.eventLoop = function(currentTime,leftTime)
  5996.     _G.currentTime = normalizeTime(currentTime / 1e3)
  5997.     _G.leftTime = normalizeTime(leftTime / 1e3)
  5998. end
  5999.  
  6000. events.eventChatCommand = function(n,c)
  6001.     disableChatCommand(c)
  6002.     if module._FREEACCESS[n] then
  6003.         if c == "refresh" and (not system.isRoom or module._FREEACCESS[n] > 1) then
  6004.             eventModeChanged()
  6005.             system.init(true)
  6006.         elseif stringsub(c,1,4) == "room" and (not system.isRoom or module._FREEACCESS[n] > 1) then
  6007.             system.roomNumber = tonumber(stringsub(c,6)) or 0
  6008.             if _G["eventChatCommand"] then
  6009.                 eventChatCommand(n,"refresh")
  6010.             end
  6011.         elseif stringsub(c,1,4) == "load" and (not system.isRoom or module._FREEACCESS[n] > 2) then
  6012.             if os.time() > system.modeChanged and os.time() > system.newGameTimer then
  6013.                 local newMode = system.getGameMode(stringsub(c,6),true)
  6014.                 if newMode then
  6015.                     system.init(system.isRoom)
  6016.                 end
  6017.             end
  6018.         end
  6019.     end
  6020.     if stringsub(c,1,6) == "module" then
  6021.         c = stringupper(stringsub(c,8))
  6022.         if module["_" .. c] then
  6023.             tfm.exec.chatMessage(c .. " : " .. tableconcat(tableturnTable(module["_" .. c]),"\n",function(k,v)
  6024.                 return (c == "FREEACCESS" and stringformat("%s(%s)",k,v) or v)
  6025.             end),n)
  6026.         else
  6027.             tfm.exec.chatMessage(stringformat("VERSION : %s\nNAME : %s\nSTATUS : %s\nAUTHOR : %s\n\nMODE : %s",module._VERSION,module._NAME,module._STATUS,module._AUTHOR,system.gameMode),n)
  6028.         end
  6029.     elseif c == "modes" then
  6030.         tfm.exec.chatMessage(tableconcat(system.submodes,"\n",function(k,v)
  6031.             return "#" .. system.normalizedModeName(v)
  6032.         end),n)
  6033.     elseif c == "admin" then
  6034.         tfm.exec.chatMessage(tableconcat(system.roomAdmins,", ",tostring),n)
  6035.     elseif c == "stop" and system.roomAdmins[n] then
  6036.         system.exit()
  6037.     elseif stringsub(c,1,3) == "adm" and (system.roomAdmins[n] or module._FREEACCESS[n] > 2) then
  6038.         system.roomAdmins[stringnick(stringsub(c,5))] = true
  6039.     end
  6040. end
  6041.  
  6042. events.eventNewPlayer = function(n)
  6043.     tfm.exec.lowerSyncDelay(n)
  6044.    
  6045.     if system.officialMode[2] ~= "" then
  6046.         tfm.exec.chatMessage(system.officialMode[2],n)
  6047.     end
  6048. end
  6049.  
  6050. --[[ Room Settings ]]--
  6051. system.roomSettings = {
  6052.     ["@"] = function(n)
  6053.         system.roomAdmins[stringnick(n)] = true
  6054.     end,
  6055.     ["#"] = function(id)
  6056.         system.miscAttrib = tonumber(id) or 1
  6057.         system.miscAttrib = mathsetLim(system.miscAttrib,1,99) -- mathmax(1,mathmin(system.miscAttrib,99))
  6058.     end,
  6059.     ["*"] = function(name)
  6060.         local game = system.getGameMode(name)
  6061.         if not game then
  6062.             system.gameMode = "grounds"
  6063.         end
  6064.     end
  6065. }
  6066. system.setRoom = function()
  6067.     if system.isRoom and system.roomAttributes then
  6068.         local chars = ""
  6069.         for k in next,system.roomSettings do
  6070.             chars = chars .. k
  6071.         end
  6072.  
  6073.         for char,value in stringgmatch(system.roomAttributes,"(["..chars.."])([^"..chars.."]+)") do
  6074.             value = stringmatch(value,"[^%s]+")
  6075.             for k,v in next,system.roomSettings do
  6076.                 if k == char then
  6077.                     v(value)
  6078.                     break
  6079.                 end
  6080.             end
  6081.         end
  6082.        
  6083.         local officialModes = {
  6084.             {"vanilla","<VP>Enjoy your vanilla (: .. okno"},
  6085.             {"survivor","<R>Aw, you cannot play survivor on #grounds"},
  6086.             {"racing","<CH>Uh, racing? Good luck!"},
  6087.             {"music","<BV>Music? Nice choice! Why don't you try a rock'n'roll?"},
  6088.             {"bootcamp","<PT>Bootcamp? Ok. This is unfair and your data won't be saved out of the room."},
  6089.             {"defilante","<R>Aw, you cannot play defilante on #grounds"},
  6090.             {"village","<R>You cannot play village on #grounds. Please, change your room."},
  6091.         }
  6092.         for k,v in next,officialModes do
  6093.             if stringfind(system.roomAttributes,v[1] .. "$") then
  6094.                 system.officialMode = {v[1],v[2]}
  6095.                 break
  6096.             end
  6097.         end
  6098.     end
  6099. end
  6100.  
  6101. --[[ Initialize ]]--
  6102. execute = {}
  6103. system.setRoom()
  6104.  
  6105. system.init = function(refresh)
  6106.     for i,event in next,{"Loop","NewGame","PlayerDied","PlayerGetCheese","PlayerVampire","PlayerWon","PlayerLeft","EmotePlayed","Keyboard","Mouse","PopupAnswer","TextAreaCallback","ChatCommand","ChatMessage","SummoningStart","SummoningEnd","SummoningCancel","NewPlayer","PlayerRespawn","ColorPicked"} do
  6107.         local e = "event" .. event
  6108.        
  6109.         local found = false
  6110.         for k,v in next,mode[system.gameMode] do
  6111.             if k == e then
  6112.                 execute[e] = v
  6113.                 found = true
  6114.                 break
  6115.             end
  6116.         end
  6117.         if not found then
  6118.             execute[e] = function() end
  6119.         end
  6120.  
  6121.         _G[e] = function(...)
  6122.             if events[e] then
  6123.                 events[e](...)
  6124.             end
  6125.             execute[e](...)
  6126.         end
  6127.     end
  6128.  
  6129.     if refresh then
  6130.         if mode[system.gameMode].reset then
  6131.             mode[system.gameMode].reset()
  6132.         end
  6133.     end
  6134.    
  6135.     if _G["eventNewPlayer"] then
  6136.         tableforeach(tfm.get.room.playerList,eventNewPlayer)
  6137.     end
  6138.    
  6139.     normalizeTranslation()
  6140.     mode[system.gameMode].init()
  6141. end
  6142. system.init()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement