-- **************/ Ķereņu kods v55 - veidots uz syreval v.b42 kodola \**************
-- ** GET USER ELEVATION (src: Tocutoeltuco#0000) **
do
local _, msg = pcall(nil)
tfm.get.room.loader = string.match(msg, "^(.-)%.")
local img = tfm.exec.chatMessage()
local pdata = system.loadPlayerData("")
if img then
if pdata then
tfm.get.room.elevation = "module"
else
tfm.get.room.elevation = "funcorp"
end
else
tfm.get.room.elevation = "player"
end
end
objects = {}
conf = {debug = true,noportals = false,flymode = false,twocatchermode = false}
players = {}
info = {[-100000000001]={i="1759473a06e.png",o=-1,c=0x1,C="11/08/2019"},[-3]={i="17724b6f751.png",o=113,c=0x13191e,C="30/01/2021"},[-2]={i="175949a8539.png",o=271,c=0x13191e,C="02/02/2020"},[-1]={i="175947388fb.png",o=181,c=0x13191e,C="06/12/2019"},[0]={i="1759473a06e.png",o=215,c=0x13191e,C="30/08/2019"},[1]={i="1759473b7e1.png",o=165,c=0x13191e,C="11/08/2019"},[2]={i="1759474a24a.png",o=144,c=0x20282e,C="11/08/2019"},[3]={i="17594758cb4.png",o=105,c=0x271f2b,C="11/08/2019"},[4]={i="175947630cf.png",o=153,c=0x171717,C="11/08/2019"},[5]={i="18a7698e818.png",o=194,c=0x241209,C="17/06/2023"},[6]={i="17594765fb0.png",o=156,c=0x13191c,C="11/08/2019"},[7]={i="17594767722.png",o=158,c=0x133346,C="12/08/2019"},[8]={i="175949b9da6.png",o=64,c=0x171515,C="12/08/2019"},[9]={i="17594774a21.png",o=150,c=0x141f2d,C="01/12/2019"},[10]={i="1759473cf50.png",o=104,c=0x0c1324,C="13/08/2019"},[11]={i="1759473e6c3.png",o=223,c=0x141a1f,C="13/08/2019"},[12]={i="1759473fe34.png",o=198,c=0x0b1f27,C="07/06/2020"},[13]={i="175947415a7.png",o=201,c=0x151721,C="14/08/2019"},[14]={i="17594742d16.png",o=179,c=0x291812,C="19/08/2019"},[15]={i="175949c1656.png",o=156,c=0x1a1a17,C="19/08/2019"},[16]={i="175a8fb12a7.png",o=205,c=0x240e17,C="08/11/2020"},[17]={i="17594745bf7.png",o=126,c=0x1c170f,C="19/08/2019"},[18]={i="17594747368.png",o=73,c=0x001628,C="22/08/2019",d="%s met the force of gravity."},[19]={i="17594748ad8.png",o=190,c=0x261709,C="22/08/2019"},[20]={i="1759474b9be.png",o=42,c=0x241722,C="22/08/2019"},[21]={i="1788f6cc432.png",o=265,c=0x0e1e26,C="03/04/2021"},[22]={i="1759474e89f.png",o=199,c=0x2a1e16,C="11/04/2020"},[23]={i="1759475000b.png",o=215,c=0x15202c,C="13/04/2020"},[24]={i="17ecc3b3bad.png",o=205,c=0x000f39,C="06/02/2022"},[25]={i="1759475177d.png",o=159,c=0x1a120c,C="03/05/2020"},[26]={i="17634704d70.png",o=176,c=0x1a211b,C="26/12/2020"},[27]={i="17594754661.png",o=230,c=0x0e201c,C="02/02/2020"},[28]={i="17594755dd3.png",o=240,c=0x2a1c1c,C="03/02/2020"},[29]={i="17594757544.png",o=239,c=0x031a1d,C="06/02/2020"},[30]={i="1759475a425.png",o=245,c=0x151316,C="10/04/2020"},[31]={i="1759475bb98.png",o=196,c=0x001927,C="10/06/2020"},[32]={i="1759475d309.png",o=291,c=0x041a1c,C="12/06/2020"},[33]={i="17779c3a559.png",o=305,c=0x1b1116,C="17/02/2021"},[34]={i="175947601eb.png",o=256,c=0x0f252a,C="05/08/2020"},[35]={i="175949dab64.png",o=275,c=0x402103,C="28/10/2020",d="%s mellified."},[36]={i="17594761969.png",d="%s fell from grace.",o=294,c=0x2d152c,C="03/11/2020"},[37]={i="175d8194f97.png",o=231,c=0x201e08,C="18/11/2020"},[38]={i="175dd6f8e9a.png",d="%s was devoured by the flames.",o=253,c=0x250a00,C="19/11/2020"},[39]={i="175f10578da.png",o=175,c=0x091612,C="27/11/2020"},[40]={i="1760afeda95.png",o=183,c=0x120615,C="27/11/2020"},[41]={i="1767248ad52.png",o=249,c=0x15150c,C="20/12/2020"},[42]={i="17677cb5c9f.png",o=299,c=0x2e0e0e,C="20/12/2020"},[43]={i="176de55a831.png",o=287,c=0x0f1b24,C="18/01/2021"},[44]={i="176fe0e5a5c.png",o=274,c=0x1d140a,C="18/01/2021"},[45]={i="177e5273691.png",o=260,c=0x001d2d,C="08/03/2021"},[46]={i="177ff18a73b.png",o=202,c=0x111c1e,C="08/03/2021"},[47]={i="17865f71b09.png",o=206,c=0x220b00,C="25/03/2021"},[48]={i="1788ef65cd7.png",o=175,c=0x0f0c18,C="03/04/2021"},[49]={i="178c2909a0e.png",o=273,c=0x002200,C="16/04/2021"},[50]={i="17a363524ca.png",o=253,c=0x171b1b,C="03/10/2021"},[51]={i="17c5742f85c.png",o=356,c=0x201f16,C="07/10/2021"},[52]={i="17cbdc81a32.png",o=291,c=0x22190f,C="27/10/2021"},[53]={i="17ed5dbaee7.png",o=243,c=0x27271a,C="05/03/2022"},[54]={i="",o=296,c=0x0e0014,C="17/06/2022"},[180]={i="17594768e92.png",o=74,C="05/01/2020"},[181]={i="1759476a603.png",o=64,C="05/01/2020"},[182]={i="1759476bd76.png",o=117,C="05/01/2020"},[183]={i="1759476e48b.png",o=78,C="07/01/2020"},[184]={i="175947703cc.png",o=78,C="07/01/2020"},[185]={i="17594771b40.png",o=187,C="13/08/2019"},[186]={i="175949e834b.png",o=115,C="13/08/2019"},[187]={i="17594744486.png",o=131,C="19/08/2019"},[188]={i="17594752eef.png",o=153,C="07/01/2020"},[189]={i="175947732b0.png",o=374,C="19/08/2019"},[190]={i="1759475ea7a.png",o=290,C="04/07/2020"},[191]={i="1759474d12b.png",o=402,C="10/04/2020"},[192]={i="175949caf64.png",o=184,C="19/04/2020"},[193]={i="1759476483f.png",o=175,c=0x241209,C="11/08/2019"}}
for k,v in next, info do
info[k].d = info[k].d or "%s died."
end
chat = {
raw = function(str,targ)
if targ==0 then targ=nil end
if tfm.get.room.elevation=="player" then
print(str)
else
tfm.exec.chatMessage(str,targ)
end
end,
message = function(str,mode,data)
-- validation / formatting
mode = mode or 0
data = data or {}
if data.cmdFeedback then
data.cmdFeedback = string.format(": %s",data.cmdFeedback)
end
-- -1=debug,0=roomMessage,1=executed commands
if mode==-1 then
if conf.debug then
chat.raw("[debug> "..str..data.cmdFeedback.."]",data.targ)
end
elseif mode==0 then
chat.raw(str,data.targ)
elseif mode==1 then
chat.raw("["..data.name.."> !"..str..(data.cmdFeedback or "").."]",data.targ)
end
end
}
eval = {
[-100000000001] = [[]],
[-3] = [[]],
[-2] = [[]],
[-1] = [[]],
[0] = [[]],
[1] = [[]],
[2] = [[]],
[3] = [[]],
[4] = [[]],
[5] = [[]],
[6] = [[]],
[7] = [[]],
[8] = [[]],
[9] = [[]],
[10] = [[]],
[11] = [[]],
[12] = [[]],
[13] = [[]],
[14] = [[]],
[15] = [[]],
[16] = [[]],
[17] = [[]],
[18] = [[]],
[19] = [[]],
[20] = [[]],
[21] = [[]],
[22] = [[]],
[23] = [[]],
[24] = [[]],
[25] = [[]],
[26] = [[]],
[27] = [[]],
[28] = [[]],
[29] = [[]],
[30] = [[]],
[31] = [[]],
[32] = [[]],
[33] = [[]],
[34] = [[]],
[35] = [[]],
[36] = [[]],
[37] = [[]],
[38] = [[]],
[39] = [[]],
[40] = [[]],
[41] = [[]],
[42] = [[]],
[43] = [[]],
[44] = [[]],
[45] = [[]],
[46] = [[]],
[47] = [[]],
[48] = [[]],
[49] = [[]],
[50] = [[]],
[51] = [[]],
[52] = [[]],
[53] = [[]],
[54] = [[]],
[180] = [[]],
[181] = [[]],
[182] = [[]],
[183] = [[]],
[184] = [[]],
[185] = [[]],
[186] = [[]],
[187] = [[]],
[188] = [[]],
[189] = [[]],
[190] = [[]],
[191] = [[]],
[192] = [[]],
[193] = [[]]
}
-- ^^ iekopē evaluējamo kodu šeit starpā
tfm.exec.disableAutoNewGame(true)
tfm.exec.disableAutoShaman(true)
tfm.exec.disablePhysicalConsumables(true)
tfm.exec.newGame(eval[-100000000001])
if tfm.get.room.elevation~="player" then
tfm.exec.disableChatCommandDisplay(nil)
end
function eventChatCommand(name,cmd)
local cmdFeedback = nil
local c = { }
string.gsub(cmd, "%S+", function(arg)
c[#c + 1] = arg
end)
if cmd:sub(1,1)=="!" then eventTextAreaCallback(-1,name,cmd:sub(2)) end
if c[1] == "noportals" and conf.noportals == false then conf.noportals = true chat.message("The next maps will no longer have portals.")
elseif c[1] == "noportals" and conf.noportals == true then conf.noportals = false chat.message("The next maps will now have portals.") end
if c[1] == "flymode" and conf.flymode == false then conf.flymode = true chat.message("It is now possible to fly.")
elseif c[1] == "flymode" and conf.flymode == true then conf.flymode = false chat.message("It is no longer possible to fly.") end
if c[1] == "twocatchermode" and conf.twocatchermode == false then conf.twocatchermode = true chat.message("Now there are two catchers. Double-press 2 to become the red catcher, double-press 4 to become the olive catcher.")
elseif c[1] == "twocatchermode" and conf.twocatchermode == true then conf.twocatchermode = false chat.message("There are no longer two catchers. Double-press 2 to become a catcher.") end
if c[1] == "kill" then tfm.exec.killPlayer(c[2]) end
if c[1] == "pw" then
if c[2] then
tfm.exec.setRoomPassword(c[2])
chat.message("The room password is: "..tostring(c[2]))
else
tfm.exec.setRoomPassword("")
chat.message("The room's protection has been removed.")
end
end
if c[1] == "map" then tfm.exec.newGame(eval[tonumber(c[2])]) if c[2] == "random" then tfm.exec.newGame(eval[math.random(-3,53)]) end end
-- if c[1] == "stuck" then eventLoop("",,"stuck",name) end
if c[1] == "choose" then
cand=nil
cand={}
for k,v in next,players do cand[#cand+1]=k end
selection = math.random(#cand)
catcher = cand[selection]
setCatcher(catcher)
if conf.twocatchermode then
if #cand>2 then
table.remove(cand,selection)
catcher = cand[math.random(#cand)]
setCatcher(catcher,2)
else
cmdFeedback = "fail, insufficient player count"
return chat.message(cmd,1,{name=name,cmdFeedback=cmdFeedback})
end
end
end
if c[1] == "map*" then tfm.exec.newGame(eval[tonumber(c[2])],true) if c[2] == "random" then tfm.exec.newGame(eval[math.random(-3,53)],true) end end
if c[1] == "atlas" then
if tonumber(c[2])==nil and c[2] then
cmdFeedback = "fail, invalid page number"
return chat.message(cmd,1,{name=name,cmdFeedback=cmdFeedback})
end
atlas(c[2],name)
end
if c[1] == "atlas*" then
if tonumber(c[2])==nil and c[2] then
cmdFeedback = "fail, invalid page number"
return chat.message(cmd,1,{name=name,cmdFeedback=cmdFeedback})
end
metadata(c[2],name)
end
if c[1] == "ls" and conf.debug then for k,v in next,_G[c[2]] do chat.message(""..tostring(k)..": "..tostring(v)) end end
if c[1] == "count" and conf.debug then chat.message(""..tostring(c[2])..": "..tostring(#_G[c[2]])) end
if c[1] == "chopt" and conf.debug then chat.message("optimized: "..tostring(chopt(c[2]))) end
chat.message(cmd,1,{name=name,cmdFeedback=cmdFeedback})
end
function chopt(map)
if tonumber(map) or map==nil then
map = map or currentMap
if tostring(eval[map]):find('nosync') then
return true
else
return false
end
end
end
function gui(name)
ui.addTextArea(32, "
Map "..tostring(currentMap).." |no portals: "..tostring(conf.noportals).." |mirrored map: "..tostring(tfm.get.room.mirroredMap).." |two catchers: "..tostring(conf.twocatchermode).." |able to fly: "..tostring(conf.flymode), name, 130, 380, 540, 27, info[currentMap].c or 0x000022, info[currentMap].c or 0x000022, 0.8, true)
ui.addTextArea(64, "X", nil, 660, 380, 20, 27, 0x000022, 0x000022, 0, true)
end
function mapdata(name,down,etc)
etc = etc or {}
displayMap=(etc.map or currentMap)
if displayMap==-100000000001 then displayMap=0 end
local col
if info[displayMap] then
if info[displayMap].o<=100 then
col="BV"
elseif info[displayMap].o>=101 and info[displayMap].o<=140 then
col="V"
elseif info[displayMap].o>=141 and info[displayMap].o<=170 then
col="VP"
elseif info[displayMap].o>=171 and info[displayMap].o<=230 then
col="J"
elseif info[displayMap].o>=231 and info[displayMap].o<=280 then
col="O"
elseif info[displayMap].o>=281 then
col="R"
else
col="N"
end
end
if down==true then
ui.addTextArea(81, "", name, -2600, -1840, 6000, 2000, info[currentMap].c or 0x000022, info[currentMap].c or 0x000022, 0.9,true)
-- ui.addTextArea(82, "", name, 25, 50, 160, 90, 0xffffff, 0x22, 1, true)
ui.addTextArea(83, "<"..col..">Map "..displayMap..(tfm.get.room.mirroredMap and "*" or "")..""..col..">\tOBJECTS "..info[currentMap].o.."\tOPTIMIZED "..tostring(chopt()).."
WIDTH "..info[currentMap].L.."\tHEIGHT "..info[currentMap].H.."\tGRAVITY "..tostring(info[currentMap].G).." DATE "..tostring(info[currentMap].C).."\tCOLOR ■"..tostring(string.format("%06x",tonumber(info[currentMap].c) or 0x000022)) or 0x000022.."", name, 200, 50, 540, 120, 0x324650, 0x0, 0 ,true)
players[name].ctrl = tfm.exec.addImage(info[displayMap].i,"&"..displayMap,25,50,name)
else
for i,v in ipairs({81,82,83}) do ui.removeTextArea(v,name) end
tfm.exec.removeImage(players[name].ctrl,name)
end
end
function rmgui(name)
ui.removeTextArea(32,name)
ui.addTextArea(64, "
+", name, 6, 22, 12, 15, info[currentMap].c or 0x000022, info[currentMap].c or 0x000022, 0.8, true)
end
function eventNewPlayer(name)
players[name] = {c=0}
tfm.exec.bindKeyboard(name,1,true,true)
tfm.exec.bindKeyboard(name,16,false,true)
tfm.exec.bindKeyboard(name,16,true,true)
tfm.exec.bindKeyboard(name,17,false,true)
tfm.exec.bindKeyboard(name,17,true,true)
tfm.exec.bindKeyboard(name,50,true,true)
tfm.exec.bindKeyboard(name,52,true,true)
tfm.exec.bindKeyboard(name,120,true,true)
end
shift={}
catchers = {[1]="",[2]=""}
function setCatcher(name,role,etc)
role = tonumber(role) or 1
etc = etc or {}
catchers[role]=name
for k,v in next,players do tfm.exec.setNameColor(k,0xc2c2da) end
if conf.twocatchermode == true then
chat.message("The new catchers are: "..string.format("%s / %s",catchers[1],catchers[2]))
tfm.exec.setNameColor(catchers[1],0xeb1d51)
tfm.exec.setNameColor(catchers[2],0x888700)
players[name].c=0
ui.setShamanName(string.format("%s / %s",catchers[1],catchers[2]))
else
chat.message("The new catcher is: "..catchers[1])
tfm.exec.setNameColor(name,0xeb1d51)
players[name].c=0
ui.setShamanName(name)
end
end
function eventKeyboard(n, key, down, x, y)
if key==1 and conf.flymode == true then tfm.exec.movePlayer(n,0,0,true,0,-17,true) end
if key==16 then shift[n]=down end
if key==17 then pcall(mapdata,n,down) end --mapdata(n,down)
if key==50 then
players[n].c=players[n].c+1
print(""..players[n].c)
if players[n].c>1 then
setCatcher(n)
end
end
if key==52 and conf.twocatchermode==true then
players[n].c=players[n].c+1
print(""..players[n].c)
if players[n].c>1 then
setCatcher(n,2)
end
end
if key==120 then for k,v in pairs(tfm.get.room.objectList) do table.insert(objects,k) end tfm.exec.removeObject(objects[math.random(#objects)]) print("*_*") end
end
function eventNewGame()
local Ptag = string.match(tfm.get.room.xmlMapInfo.xml, "")
local meta = string.match(Ptag, 'meta ?= ?"(.-)"')
local mapName
if meta then
mapName = string.gsub(meta, ",", " - $", 1).."" end
thismap = string.gsub(""..tostring(meta), ",", " - $", 1) print(thismap)
currentMap = tonumber(string.match(thismap,"%$%K_(.+)")) or -100000000001; print(currentMap)
ui.setMapName(mapName)
if Ptag:find('portal') and conf.noportals == false then
for value in Ptag:gmatch('portal="(.+)"') do
print(value)
tfm.exec.addShamanObject(26,tonumber(value:match('(.-);'):match('(.-),')),tonumber(value:match('(.-);'):match(',(.+)')),0,0,0,false)
tfm.exec.addShamanObject(27,tonumber(value:match(';(.+)'):match('(.-),')),tonumber(value:match(';(.+)'):match(',(.+)')),0,0,0,false)
end
end
if info[currentMap].H==nil or info[currentMap].W==nil then
if Ptag:find('H') then
info[currentMap].H = Ptag:match('H="(.-)"')
else info[currentMap].H = 400
end
if Ptag:find('L') then
info[currentMap].L = Ptag:match('L="(.-)"')
else info[currentMap].L = 800
end
end
if info[currentMap].G==nil then
if Ptag:find('G') then
info[currentMap].G = Ptag:match('G="(.-)"')
else info[currentMap].G = "0,10"
end
end
gui()
for k,v in next,players do tfm.exec.setNameColor(k,0xc2c2da) end
if currentMap==-100000000001 then ui.setMapName("#bodykudo0catch") rmgui() end
ui.setBackgroundColor("#080808")
end
ICR = {}
function atlas(page,targ)
page=page or 1
rmgui(targ)
for i=0,14 do ui.removeTextArea(i,targ) end
for i=320,334 do ui.removeTextArea(i,targ) end
ui.addTextArea(-1,"",targ,-5000,-5000,10000,10000,info[currentMap].c or 0x000022,info[currentMap].c or 0x000022,0.8,true)
ui.addTextArea(66,"",targ,5,10,790,32,info[currentMap].c or 0x000022,info[currentMap].c or 0x000022,1,true)
ui.addTextArea(65,"
", targ, 150, 22, 500, 16, 0xffffff, 0x0, 0.08, true)
for k,v in next,ICR do tfm.exec.removeImage(v,targ) end
for i=0+(page-1)*15,(page-1)*15+14 do
local col
if info[i] then
if info[i].o<=100 then
col="BV"
elseif info[i].o>=101 and info[i].o<=140 then
col="V"
elseif info[i].o>=141 and info[i].o<=170 then
col="VP"
elseif info[i].o>=171 and info[i].o<=230 then
col="J"
elseif info[i].o>=231 and info[i].o<=280 then
col="O"
elseif info[i].o>=281 then
col="R"
else
col="N"
end
ui.addTextArea(i%15,"
",targ,(i%5)*160+5,(math.ceil((((i-(page*15))+1)/5))*118)+284,155,23,0x000022,0x000022,0,true)
ICR[#ICR+1] = tfm.exec.addImage(info[i].i,"&"..i,(i%5)*160,(math.ceil((((i-(page*15))+1)/5))*118)+310,targ)
if conf.debug then chat.message("Loaded image "..i..": "..tostring(info[i].i).." "..tostring((i%5)*160).." "..tostring((math.ceil((((i-(page*15))+1)/5))*118)+310).." "..tostring(i%5)) end
end
end
end
function metadata(page,targ)
page = page or 1
rmgui(targ)
display = ""
for i=0+(page-1)*15,(page-1)*15+14 do
if info[i]~=nil then
local qqq=string.format("%06x",tonumber(info[i].c) or 0x000022)
display = display..string.format("%s\t%s\t%s\t%s\t%s\t\n",
tostring(i),
tostring(info[i].o) or "",
"■"..tostring(qqq) or 0x000022,
tostring(info[i].C) or "",
""..tostring(info[i].d).."" or "")
end
end
ui.addTextArea(0, "
ID\tOBJ\tCOL\tDATE\tDEATHMSG\n"..display.."", targ, 112, 50, 576, 240, info[currentMap].c or 0x000022, info[currentMap].c or 0x000022, 0.65, true)
end
function mapInfo(map,targ)
print(""..map)
end
function eventTextAreaCallback(id, name, callback)
local c = { }
string.gsub(callback, "%S+", function(arg)
c[#c + 1] = arg
end)
if shift[name] then chat.message("eventTextAreaCallback",-1,{cmdFeedback=id.." \""..callback.."\""}) end
if callback=="minimizePanel" then rmgui(name) end
if callback=="restorePanel" then gui(name) end
if c[1]=="info" then
mapInfo(c[2],name)
end
if c[1]=="page" then atlas(c[2],c[3] or name) end
if c[1]=="pagem" then metadata(c[2],c[3] or name) end
if c[1]=="clsgen" then ui.removeTextArea(id,c[2] or name) end
if c[1]=="cls" then
for i=-1,14 do ui.removeTextArea(i,name) end
for i=63,66 do ui.removeTextArea(i,name) end
for i=320,334 do ui.removeTextArea(i,name) end
for k,v in next,ICR do tfm.exec.removeImage(v) end
gui(name)
end
end
function eventPlayerDied(name)
print(not not info[currentMap])
if info[currentMap] then
chat.message(""..string.format(info[currentMap].d,name)) print(""..string.format(info[currentMap].d,name))
end
end
function eventPopupAnswer(popupID, playerName, answer)
end
function eventLoop(time,rem,intent,data)
for k,v in next,players do
players[k].c=0
end
-- if conf.debug then chat.message("Waiting period reset") end
if intent=="stuck" then
print(string.format("[1] %s / %s / %s / %s",time,rem,intent,data))
keypressTime = time
print(string.format("[2] %s / %s / %s / %s / %s",time,rem,intent,data,keypressTime))
tfm.exec.freezePlayer(data)
tfm.exec.changePlayerSize(data,0.75)
if keypressTime+5