Advertisement
Guest User

Compiled

a guest
May 23rd, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 16.45 KB | None | 0 0
  1. local tbl={
  2.   [ "/startup" ] = "shell.run('run')\
  3. ",
  4.   [ "/Shop/run" ] = "local Dir = 'Shop'\
  5. local FlareVersion = '1.2'\
  6. -- Check and install Flare --\
  7. \
  8. if not fs.isDir( \"Flare/version/\" .. FlareVersion ) then\
  9.     fs.delete( \"Flare/version/\" .. FlareVersion )\
  10.     print \"Installing Flare\"\
  11.     local h = http.get( \"https://raw.githubusercontent.com/awsumben13/Flare/master/version/\" .. FlareVersion .. \"/install.lua\" )\
  12.     if h then\
  13.         local content = h.readAll()\
  14.         h.close()\
  15. \
  16.         local f, err = loadstring( content, \"Flare Installer\" )\
  17.         if f then\
  18.             f()\
  19.         else\
  20.             print( err )\
  21.             return\
  22.         end\
  23.     else\
  24.         print \"Failed to install Flare\"\
  25.         return\
  26.     end\
  27. end\
  28. \
  29. if not fs.isDir( Dir ) then\
  30.     Dir = fs.getDir( shell.getRunningProgram() )\
  31. end\
  32. \
  33. local FDK = dofile( \"Flare/version/\" .. FlareVersion .. \"/FDK.lua\" )\
  34. \
  35. FDK.setup( Dir ) -- set up relative paths\
  36. FDK.dofile \"main\" -- load the starting file\
  37. FDK.begin() -- begin running Flare",
  38.   [ "/Shop/States/Items.lua" ] = "local StateLib = FDK.require('lib.state')\
  39. local State = StateLib.names.Init\
  40. local Main = StateLib.names.Main\
  41. local Search = StateLib.names.Search\
  42. local Account = StateLib.names.Account\
  43. local Items = StateLib.names.Items\
  44. \
  45. local Field = FDK.require('lib.UI.elements.Field')\
  46. local Text = FDK.require('lib.UI.elements.Text')\
  47. local Button = FDK.require('lib.UI.elements.Button')\
  48. local ScrollBar = FDK.require('lib.UI.elements.ScrollBar')\
  49. local Frame = FDK.require('lib.UI.elements.ClippingFrame')\
  50. \
  51. -- Main Field\
  52. Items.frame:newChild(Field(1, 1, Items.frame.width, Items.frame.height, colors.white))\
  53. -- Header Field\
  54. Items.frame:newChild(Field(1, 1, Items.frame.width, 3, colors.lightGray))\
  55. \
  56. local back = Items.frame:newChild( Button( 1, 1, 8, 3, \"< back\" ) )\
  57. back.bc = colors.lightGray\
  58. back.tc = colors.white\
  59. \
  60. function back:onClick()\
  61.  Main:show()\
  62. end\
  63. \
  64. local ItemsFrame = Items.frame:newChild(Frame(1, 4,\
  65.  Items.frame.width-2,\
  66.  Items.frame.height-3\
  67. ))\
  68. local ItemsBar = Items.frame:newChild(ScrollBar(Items.frame.width, 4, 1, Items.frame.height-3, ItemsFrame))\
  69. -- Add every Item from the database\
  70. \
  71. for k,v  in pairs(_G.DB.Items) do\
  72. \
  73. \
  74. end",
  75.   [ "/Shop/main.lua" ] = "_G.DB = {}\
  76. _G.DB.Items = {}\
  77. \
  78. function Decompile(CompiledTbl)\
  79.  local Str = ''\
  80.  for k, v in pairs(CompiledTbl) do\
  81.    Str = Str .. string.char(v)\
  82.  end\
  83.  return Str\
  84. end\
  85. \
  86. function Compile(Str)\
  87.  local Compiled = {string.byte(Str,1,#tostring(Str))}\
  88.  return Compiled, table.concat(Compiled, ',')\
  89. end\
  90. \
  91. Modem = peripheral.wrap('top')\
  92. Modem.open(2773)\
  93. \
  94. FDK.process:spawnThread(function()\
  95.     coroutine.yield('terminate')\
  96.     --os.reboot()\
  97.  FDK.running = false\
  98. end)\
  99. \
  100. local State = FDK.require('lib.state')\
  101. \
  102. State:new('Init')\
  103. State:new('Main')\
  104. State:new('Search')\
  105. State:new('Account')\
  106. State:new('Items')\
  107. \
  108. FDK.dofile('States.Init')\
  109. FDK.dofile('States.Main')\
  110. FDK.dofile('States.Search')\
  111. FDK.dofile('States.Account')\
  112. FDK.dofile('States.Items')\
  113. \
  114. --[[\
  115. local GotData = false\
  116. \
  117. local StateLib = FDK.require('lib.state')\
  118. local State = StateLib.names.init\
  119. \
  120. local Field = FDK.require('lib.UI.elements.Field')\
  121. local Text = FDK.require('lib.UI.elements.Text')\
  122. local Button = FDK.require('lib.UI.elements.Button')\
  123. \
  124. -- Main Field\
  125. State.frame:newChild(Field(1, 1, State.frame.width, State.frame.height, colours.grey))\
  126. -- Header Field\
  127. State.frame:newChild(Field(1, 1, State.frame.width, 3, colors.lightGray))\
  128. \
  129. -- Header Text\
  130. local Header = State.frame:newChild(Text(0, 0, 13, 1, '&b8&t0Shop - Client'))\
  131. Header:alignX('centre')\
  132. Header.width = #Header.text - #'&b7&t8'\
  133. Header.y = 2\
  134. \
  135. local Desc = State.frame:newChild(Text(0, 0, 17, 1, '&b7&t8Requesting data..'))\
  136. Desc:alignX('centre')\
  137. Desc.width = #Desc.text - #'&b7&t8'\
  138. Desc.y = math.ceil(State.frame.height/2.3)\
  139. \
  140. local CurrentRead = State.frame:newChild(Text(0, 0, 0, 1, '&b7&tfNo data available'))\
  141. CurrentRead.width = #CurrentRead.text - #'&b7&t8'\
  142. CurrentRead.y = math.ceil(State.frame.height/2)+1\
  143. CurrentRead:alignX('centre')\
  144. \
  145. \
  146. ]]\
  147. \
  148. \
  149. \
  150. -- Hello\
  151. --[[\
  152. State.process:spawnThread(function()\
  153.  while not GotData do\
  154.    -- File Event System --\
  155.    if fs.exists('.Call') then\
  156.      local File = fs.open('.Call', 'r')\
  157.      local Call = textutils.unserialize(File.readAll())\
  158.      File.close()\
  159.      \
  160.      if #Call > 0 then\
  161.        for i, J in pairs(Call) do\
  162.          local Line = ''\
  163.          for k, v in pairs(J) do\
  164.            Line = Line .. tostring(v) .. ','\
  165.            -- Process File\
  166.          end\
  167.          CurrentRead.text = '&b7&tfRemote://' .. Line\
  168.          CurrentRead.width = #CurrentRead.text - #'&b7&t8'\
  169. \
  170.          CurrentRead.x = 2\
  171.          sleep(.5)\
  172.        end\
  173.        local File = fs.open('.Call', 'w')\
  174.        File.writeLine('{}')\
  175.        File.close()\
  176.      else\
  177.        CurrentRead.text = '&b7&tfNo data available'\
  178.        CurrentRead.width = #CurrentRead.text - #'&b7&t8'\
  179.        CurrentRead:alignX('centre')\
  180.      end\
  181.    end\
  182.    sleep(.05)\
  183.  end\
  184. end)\
  185. --]]",
  186.   [ "/Shop/States/Account.lua" ] = "local StateLib = FDK.require('lib.state')\
  187. local State = StateLib.names.Init\
  188. local Main = StateLib.names.Main\
  189. local Search = StateLib.names.Search\
  190. local Account = StateLib.names.Account\
  191. local Items = StateLib.names.Items\
  192. \
  193. local Field = FDK.require('lib.UI.elements.Field')\
  194. local Text = FDK.require('lib.UI.elements.Text')\
  195. local Button = FDK.require('lib.UI.elements.Button')\
  196. \
  197. -- Main Field\
  198. Account.frame:newChild(Field(1, 1, Account.frame.width, Account.frame.height, colors.white))\
  199. -- Header Field\
  200. Account.frame:newChild(Field(1, 1, Account.frame.width, 3, colors.lightGray))\
  201. \
  202. local back = Account.frame:newChild( Button( 1, 1, 8, 3, \"< back\" ) )\
  203. back.bc = colors.lightGray\
  204. back.tc = colors.white\
  205. \
  206. function back:onClick()\
  207.  Main:show()\
  208. end\
  209. \
  210. local Header = Account.frame:newChild(Text(0, 0, 13, 1, '&b8&t0Account info'))\
  211. Header.y = 2\
  212. Header.width = #Header.text - #'&b7&t8'\
  213. Header:alignX('centre')\
  214. \
  215. local Data = {\
  216.  User = nil,\
  217.  Balance = 100.00,\
  218.  Position = {X = 1, Y = 50, Z = 100},\
  219.  SkyblockPosition = {X = 1, Y = 50, Z = 100},\
  220. }\
  221. \
  222. local Texts = {\
  223.  Username = Account.frame:newChild(Text(1, 1, 0, 1, '&b0&t7Username:')),\
  224.  _Username = Account.frame:newChild(Text(1, 1, 0, 1, '&b0&td' .. tostring(Data.User)..'                ')),\
  225.  Balance = Account.frame:newChild(Text(1, 1, 0, 1, '&b0&t7Balance:')),\
  226.  _Balance = Account.frame:newChild(Text(1, 1, 0, 1, '&b0&t1' .. tostring(Data.Balance)..'                ')),\
  227.  Position = Account.frame:newChild(Text(1, 1, 0, 1, '&b0&t7Position')),\
  228.  PositionX = Account.frame:newChild(Text(1, 1, 0, 1, '&b0&t7X:&b0&tb' .. tostring(Data.Position.X)..'                ')),\
  229.  PositionY = Account.frame:newChild(Text(1, 1, 0, 1, '&b0&t7Y:&b0&tb' .. tostring(Data.Position.Y)..'                ')),\
  230.  PositionZ = Account.frame:newChild(Text(1, 1, 0, 1, '&b0&t7Z:&b0&tb' .. tostring(Data.Position.Z)..'                ')),\
  231.  SkyblockPosition = Account.frame:newChild(Text(1, 1, 0, 1, '&b0&t7Skyblock Location')),\
  232.  SkyblockPositionX = Account.frame:newChild(Text(1, 1, 0, 1, '&b0&t7X:&b0&tb' .. tostring(Data.SkyblockPosition.X)..'   ')),\
  233.  SkyblockPositionY = Account.frame:newChild(Text(1, 1, 0, 1, '&b0&t7Y:&b0&tb' .. tostring(Data.SkyblockPosition.Y)..'   ')),\
  234.  SkyblockPositionZ = Account.frame:newChild(Text(1, 1, 0, 1, '&b0&t7Z:&b0&tb' .. tostring(Data.SkyblockPosition.Z)..'   ')),\
  235. }\
  236. function SetData(Name, Y, X, _D)\
  237.  local D = 6\
  238.  if _D then\
  239.    D = 12\
  240.  end\
  241.  Texts[Name].width = #Texts[Name].text - D\
  242.  Texts[Name].y, Texts[Name].x = Y, X\
  243. end\
  244. function SetText(Name, Text)\
  245.  Texts[Name].text = Text\
  246. end\
  247. \
  248. SetData('Username', 5, 2)\
  249. SetData('Position', 9, 2)\
  250. SetData('Balance', 7, 2)\
  251. SetData('SkyblockPosition', 9, 33)\
  252. SetData('_Username', 5, #Texts.Username.text - 3)\
  253. SetData('_Balance', 7, #Texts.Balance.text - 3)\
  254. SetData('PositionX', 10, 6, true)\
  255. SetData('PositionY', 11, 6, true)\
  256. SetData('PositionZ', 12, 6, true)\
  257. SetData('SkyblockPositionX', 10, 39, true)\
  258. SetData('SkyblockPositionY', 11, 39, true)\
  259. SetData('SkyblockPositionZ', 12, 39, true)\
  260. \
  261. \
  262. Account.process:spawnThread(function()\
  263.  while true do\
  264.    FDK.sleep(1)\
  265.    SetText('_Username', '&b0&td'..tostring(Data.User))\
  266.    SetText('_Balance',  '&b0&t1'..tostring(Data.Balance))\
  267.    SetText('PositionX', '&b0&t7X:&b0&tb'..tostring(Data.Position.X))\
  268.    SetText('PositionY', '&b0&t7X:&b0&tb'..tostring(Data.Position.Y))\
  269.    SetText('PositionZ', '&b0&t7X:&b0&tb'..tostring(Data.Position.Z))\
  270.    SetText('SkyblockPositionX', '&b0&t7X:&b0&tb'..tostring(Data.SkyblockPosition.X))\
  271.    SetText('SkyblockPositionY', '&b0&t7X:&b0&tb'..tostring(Data.SkyblockPosition.Y))\
  272.    SetText('SkyblockPositionZ', '&b0&t7X:&b0&tb'..tostring(Data.SkyblockPosition.Z))\
  273. \
  274.    SetData('_Username', 5, #Texts.Username.text - 3)\
  275.    SetData('_Balance', 7, #Texts.Balance.text - 3)\
  276.    SetData('PositionX', 10, 6, true)\
  277.    SetData('PositionY', 11, 6, true)\
  278.    SetData('PositionZ', 12, 6, true)\
  279.    SetData('SkyblockPositionX', 10, 39, true)\
  280.    SetData('SkyblockPositionY', 11, 39, true)\
  281.    SetData('SkyblockPositionZ', 12, 39, true)\
  282.  end\
  283. end)\
  284. \
  285. Account.process:spawnThread(function()\
  286.  while true do\
  287.    local Event, Side, SenderID, ReceiverID, Msg, Distance = coroutine.yield()\
  288.    if Event == 'modem_message' then\
  289.      if SenderID == 2773 then\
  290.        --local File = fs.open('log','a')\
  291.        --File.writeLine(Decompile(textutils.unserialize(Msg)))\
  292.        --File.close()\
  293.        Data = textutils.unserialize(Msg)\
  294.      end\
  295.    end\
  296.  end\
  297. end)\
  298. \
  299.    \
  300. ",
  301.   [ "/Shop/States/Main.lua" ] = "local StateLib = FDK.require('lib.state')\
  302. local State = StateLib.names.Init\
  303. local Main = StateLib.names.Main\
  304. local Search = StateLib.names.Search\
  305. local Account = StateLib.names.Account\
  306. local Items = StateLib.names.Items\
  307. \
  308. local Field = FDK.require('lib.UI.elements.Field')\
  309. local Text = FDK.require('lib.UI.elements.Text')\
  310. local Button = FDK.require('lib.UI.elements.Button')\
  311. \
  312. -- Main Field\
  313. Main.frame:newChild(Field(1, 1, Main.frame.width, Main.frame.height, colors.white))\
  314. -- Header Field\
  315. Main.frame:newChild(Field(1, 1, Main.frame.width, 3, colors.lightGray))\
  316. \
  317. local Header = Main.frame:newChild(Text(0, 0, 13, 1, '&b8&t0Menu'))\
  318. Header.y = 2\
  319. Header.width = #Header.text - #'&b7&t8'\
  320. Header:alignX('centre')\
  321. \
  322. -- Buttons --\
  323. local Buttons = {\
  324.  _Search = {func=Search, Frame=Main.frame:newChild(Button(0, 5, 18, 3, '&t0Search'))},\
  325.  _Items = {func=Items, Frame=Main.frame:newChild(Button(0, 10, 18, 3, '&t0Items'))},\
  326.  _Account = {func=Account, Frame=Main.frame:newChild(Button(0, 15, 18, 3, '&t0Account'))},\
  327.  --Search = Main.frame:newChild(Button(2, 5, 18, 3, '&t0Search')),\
  328. }\
  329. \
  330. for k, v in pairs(Buttons) do\
  331.  v.Frame.bc = colors.gray\
  332.  v.Frame:alignX('centre')\
  333.  function v.Frame:onClick()\
  334.    v.func:show()\
  335.  end\
  336. end\
  337. \
  338. \
  339. --Buttons.Search:align('centre', 'centre')\
  340. \
  341. --Main.frame:newChild( Text( 2, 5, 46, 3, '&t7What would you like to see a demonstration of?' ) )",
  342.   [ "/run" ] = "shell.run('Shop/run')",
  343.   [ "/Shop/States/Search.lua" ] = "local StateLib = FDK.require('lib.state')\
  344. local State = StateLib.names.Init\
  345. local Main = StateLib.names.Main\
  346. local Search = StateLib.names.Search\
  347. local Account = StateLib.names.Account\
  348. local Items = StateLib.names.Items\
  349. \
  350. local Field = FDK.require('lib.UI.elements.Field')\
  351. local Text = FDK.require('lib.UI.elements.Text')\
  352. local Button = FDK.require('lib.UI.elements.Button')\
  353. local ScrollBar = FDK.require('lib.UI.elements.ScrollBar')\
  354. local Frame = FDK.require('lib.UI.elements.ClippingFrame')\
  355. \
  356. -- Main Field\
  357. Search.frame:newChild(Field(1, 1, Search.frame.width, Search.frame.height, colors.white))\
  358. -- Header Field\
  359. Search.frame:newChild(Field(1, 1, Search.frame.width, 3, colors.lightGray))\
  360. \
  361. local back = Search.frame:newChild( Button( 1, 1, 8, 3, \"< back\" ) )\
  362. back.bc = colors.lightGray\
  363. back.tc = colors.white\
  364. \
  365. function back:onClick()\
  366.  Main:show()\
  367. end\
  368. \
  369. local SearchFrame = Search.frame:newChild(Frame(1, 4,\
  370.  Search.frame.width-2,\
  371.  Search.frame.height-3\
  372. ))\
  373. local SearchBar = Search.frame:newChild(ScrollBar(Search.frame.width, 4, 1, Search.frame.height-3, SearchFrame))",
  374.   [ "/Shop/States/Init.lua" ] = "\
  375. local StateLib = FDK.require('lib.state')\
  376. local State = StateLib.names.Init\
  377. local Main = StateLib.names.Main\
  378. \
  379. local Field = FDK.require('lib.UI.elements.Field')\
  380. local Text = FDK.require('lib.UI.elements.Text')\
  381. local Button = FDK.require('lib.UI.elements.Button')\
  382. \
  383. -- Main Field\
  384. State.frame:newChild(Field(1, 1, State.frame.width, State.frame.height, colors.gray))\
  385. -- Header Field\
  386. State.frame:newChild(Field(1, 1, State.frame.width, 3, colors.lightGray))\
  387. \
  388. -- Header Text\
  389. local Header = State.frame:newChild(Text(0, 0, 13, 1, '&b8&t0Shop - Client'))\
  390. Header.width = #Header.text - #'&b7&t8'\
  391. Header.y = 2\
  392. Header:alignX('centre')\
  393. \
  394. local Desc = State.frame:newChild(Text(0, 0, 17, 1, '&b7&t8Requesting data..'))\
  395. Desc.width = #Desc.text - #'&b7&t8'\
  396. Desc.y = math.ceil(State.frame.height/2.3)\
  397. Desc:alignX('centre')\
  398. local CurrentRead = State.frame:newChild(Text(0, 0, 0, 1, '&b7&tfNo data available'))\
  399. CurrentRead.width = #CurrentRead.text - #'&b7&t8'\
  400. CurrentRead.y = math.ceil(State.frame.height/2)+1 \
  401. CurrentRead:alignX('centre')\
  402.  \
  403. State.process:spawnThread(function()\
  404.  while true do\
  405.    -- Gather data --\
  406.    Modem.transmit(2773, 2773, '@RequestData')\
  407.    local Events, Side, Channel, Channel, Msg, Dist = coroutine.yield('modem_message')\
  408.    --_G.DB = textutils.unserialize(Decompile(textutils.unserialize(Msg)))\
  409.    break\
  410.  end\
  411.  Main:show()\
  412. end)",
  413.   [ "/compress" ] = "term.clear()\
  414. term.setCursorPos(1,1)\
  415. local function Decompile(CompiledTbl)\
  416.  local Str = ''\
  417.  for k, v in pairs(CompiledTbl) do\
  418.    Str = Str .. string.char(v)\
  419.  end\
  420.  return Str\
  421. end\
  422. \
  423. local function Compile(Str)\
  424.  local Compiled = {string.byte(Str,1,#tostring(Str))}\
  425.  return Compiled, table.concat(Compiled, ',')\
  426. end\
  427. \
  428. local Blacklist={\
  429.  'Flare/*',\
  430.  'rom/*',\
  431.  ''..shell.getRunningProgram() .. \"/*\",\
  432. }\
  433. \
  434. local function wildcardpat( path, t )\
  435.    if t then\
  436.        return \"^/*\" .. path:gsub( \"%*$\", \"/*\" ) .. \"$\"\
  437.    end\
  438.    return \"^/*\" .. path:gsub( \"%*\", \"%.%+\" ) .. \"$\"\
  439. end\
  440. \
  441. local function Blacklisted(Path)\
  442.    for i, v in ipairs( Blacklist ) do\
  443.        if Path:find( wildcardpat( v ) ) or Path:find( wildcardpat( v, true ) ) then\
  444.            printError(Path)\
  445.            return true\
  446.        end\
  447.    end\
  448.    term.setTextColor(colors.white)\
  449.    return false\
  450. end\
  451. \
  452. local Args = {...}\
  453. \
  454. --[[if Args[1] ~= '-String' or Args[1] ~= '-File' then\
  455. \
  456. end]]\
  457. if Args[1] == '-String' then\
  458.  String = Args[2]\
  459. elseif Args[1] == '-File' then\
  460.  print('loading files...')\
  461.  print(textutils.serialize(Blacklist))\
  462.  sleep(2.5)\
  463. \
  464.  local Path = '/'\
  465.  local Contents = {}\
  466. \
  467.  local function GetDir(Path)\
  468.    if not Blacklisted(Path) then\
  469.      local List = fs.list(Path or '/')\
  470.      for k, v in pairs(List) do\
  471. \
  472.        local CurrentPath = Path..fs.getName(\
  473.          fs.combine(\
  474.            Path,\
  475.            v\
  476.          )\
  477.        )\
  478.        if fs.isDir(CurrentPath) then\
  479.          CurrentPath = CurrentPath .. '/'\
  480.        end\
  481.        if fs.isDir(CurrentPath) then\
  482.          GetDir(CurrentPath)\
  483.        else\
  484.          local File = fs.open(CurrentPath, 'r')\
  485.          if File then\
  486.            local Data = File.readAll()\
  487.            -- Compile data --\
  488.            --Data = --{string.byte(Data,1,#tostring(Data))}\
  489.            --print(table.concat(Data, ', '))\
  490.            --os.pullEvent()\
  491.            File.close()\
  492.            Contents[CurrentPath] = Data\
  493.            os.queueEvent('Ping')\
  494.            os.pullEvent('Ping')\
  495.          end\
  496.        end\
  497.      end\
  498.    end\
  499.  end\
  500. \
  501. \
  502.  GetDir(Path)\
  503.  local Pre = [[local tbl=]]\
  504.  local Extra = [[\
  505.  print('Extracting...')\
  506. for k, v in pairs(tbl) do\
  507.  print(k)\
  508.  local X = fs.open(k, 'w')\
  509.  print(string.len(tostring(X)))\
  510.  X.write(v)\
  511.  X.close()\
  512. end\
  513.  ]]\
  514.  Compiled = fs.open('Compiled', 'w')\
  515.  Compiled.write(Pre..textutils.serialize(Contents)..Extra)\
  516.  Compiled.close()\
  517. end",
  518. }  print('Extracting...')
  519. for k, v in pairs(tbl) do
  520.   print(k)
  521.   local X = fs.open(k, 'w')
  522.   print(string.len(tostring(X)))
  523.   X.write(v)
  524.   X.close()
  525. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement