Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tbl={
- [ "/startup" ] = "shell.run('run')\
- ",
- [ "/Shop/run" ] = "local Dir = 'Shop'\
- local FlareVersion = '1.2'\
- -- Check and install Flare --\
- \
- if not fs.isDir( \"Flare/version/\" .. FlareVersion ) then\
- fs.delete( \"Flare/version/\" .. FlareVersion )\
- print \"Installing Flare\"\
- local h = http.get( \"https://raw.githubusercontent.com/awsumben13/Flare/master/version/\" .. FlareVersion .. \"/install.lua\" )\
- if h then\
- local content = h.readAll()\
- h.close()\
- \
- local f, err = loadstring( content, \"Flare Installer\" )\
- if f then\
- f()\
- else\
- print( err )\
- return\
- end\
- else\
- print \"Failed to install Flare\"\
- return\
- end\
- end\
- \
- if not fs.isDir( Dir ) then\
- Dir = fs.getDir( shell.getRunningProgram() )\
- end\
- \
- local FDK = dofile( \"Flare/version/\" .. FlareVersion .. \"/FDK.lua\" )\
- \
- FDK.setup( Dir ) -- set up relative paths\
- FDK.dofile \"main\" -- load the starting file\
- FDK.begin() -- begin running Flare",
- [ "/Shop/States/Items.lua" ] = "local StateLib = FDK.require('lib.state')\
- local State = StateLib.names.Init\
- local Main = StateLib.names.Main\
- local Search = StateLib.names.Search\
- local Account = StateLib.names.Account\
- local Items = StateLib.names.Items\
- \
- local Field = FDK.require('lib.UI.elements.Field')\
- local Text = FDK.require('lib.UI.elements.Text')\
- local Button = FDK.require('lib.UI.elements.Button')\
- local ScrollBar = FDK.require('lib.UI.elements.ScrollBar')\
- local Frame = FDK.require('lib.UI.elements.ClippingFrame')\
- \
- -- Main Field\
- Items.frame:newChild(Field(1, 1, Items.frame.width, Items.frame.height, colors.white))\
- -- Header Field\
- Items.frame:newChild(Field(1, 1, Items.frame.width, 3, colors.lightGray))\
- \
- local back = Items.frame:newChild( Button( 1, 1, 8, 3, \"< back\" ) )\
- back.bc = colors.lightGray\
- back.tc = colors.white\
- \
- function back:onClick()\
- Main:show()\
- end\
- \
- local ItemsFrame = Items.frame:newChild(Frame(1, 4,\
- Items.frame.width-2,\
- Items.frame.height-3\
- ))\
- local ItemsBar = Items.frame:newChild(ScrollBar(Items.frame.width, 4, 1, Items.frame.height-3, ItemsFrame))\
- -- Add every Item from the database\
- \
- for k,v in pairs(_G.DB.Items) do\
- \
- \
- end",
- [ "/Shop/main.lua" ] = "_G.DB = {}\
- _G.DB.Items = {}\
- \
- function Decompile(CompiledTbl)\
- local Str = ''\
- for k, v in pairs(CompiledTbl) do\
- Str = Str .. string.char(v)\
- end\
- return Str\
- end\
- \
- function Compile(Str)\
- local Compiled = {string.byte(Str,1,#tostring(Str))}\
- return Compiled, table.concat(Compiled, ',')\
- end\
- \
- Modem = peripheral.wrap('top')\
- Modem.open(2773)\
- \
- FDK.process:spawnThread(function()\
- coroutine.yield('terminate')\
- --os.reboot()\
- FDK.running = false\
- end)\
- \
- local State = FDK.require('lib.state')\
- \
- State:new('Init')\
- State:new('Main')\
- State:new('Search')\
- State:new('Account')\
- State:new('Items')\
- \
- FDK.dofile('States.Init')\
- FDK.dofile('States.Main')\
- FDK.dofile('States.Search')\
- FDK.dofile('States.Account')\
- FDK.dofile('States.Items')\
- \
- --[[\
- local GotData = false\
- \
- local StateLib = FDK.require('lib.state')\
- local State = StateLib.names.init\
- \
- local Field = FDK.require('lib.UI.elements.Field')\
- local Text = FDK.require('lib.UI.elements.Text')\
- local Button = FDK.require('lib.UI.elements.Button')\
- \
- -- Main Field\
- State.frame:newChild(Field(1, 1, State.frame.width, State.frame.height, colours.grey))\
- -- Header Field\
- State.frame:newChild(Field(1, 1, State.frame.width, 3, colors.lightGray))\
- \
- -- Header Text\
- local Header = State.frame:newChild(Text(0, 0, 13, 1, '&b8&t0Shop - Client'))\
- Header:alignX('centre')\
- Header.width = #Header.text - #'&b7&t8'\
- Header.y = 2\
- \
- local Desc = State.frame:newChild(Text(0, 0, 17, 1, '&b7&t8Requesting data..'))\
- Desc:alignX('centre')\
- Desc.width = #Desc.text - #'&b7&t8'\
- Desc.y = math.ceil(State.frame.height/2.3)\
- \
- local CurrentRead = State.frame:newChild(Text(0, 0, 0, 1, '&b7&tfNo data available'))\
- CurrentRead.width = #CurrentRead.text - #'&b7&t8'\
- CurrentRead.y = math.ceil(State.frame.height/2)+1\
- CurrentRead:alignX('centre')\
- \
- \
- ]]\
- \
- \
- \
- -- Hello\
- --[[\
- State.process:spawnThread(function()\
- while not GotData do\
- -- File Event System --\
- if fs.exists('.Call') then\
- local File = fs.open('.Call', 'r')\
- local Call = textutils.unserialize(File.readAll())\
- File.close()\
- \
- if #Call > 0 then\
- for i, J in pairs(Call) do\
- local Line = ''\
- for k, v in pairs(J) do\
- Line = Line .. tostring(v) .. ','\
- -- Process File\
- end\
- CurrentRead.text = '&b7&tfRemote://' .. Line\
- CurrentRead.width = #CurrentRead.text - #'&b7&t8'\
- \
- CurrentRead.x = 2\
- sleep(.5)\
- end\
- local File = fs.open('.Call', 'w')\
- File.writeLine('{}')\
- File.close()\
- else\
- CurrentRead.text = '&b7&tfNo data available'\
- CurrentRead.width = #CurrentRead.text - #'&b7&t8'\
- CurrentRead:alignX('centre')\
- end\
- end\
- sleep(.05)\
- end\
- end)\
- --]]",
- [ "/Shop/States/Account.lua" ] = "local StateLib = FDK.require('lib.state')\
- local State = StateLib.names.Init\
- local Main = StateLib.names.Main\
- local Search = StateLib.names.Search\
- local Account = StateLib.names.Account\
- local Items = StateLib.names.Items\
- \
- local Field = FDK.require('lib.UI.elements.Field')\
- local Text = FDK.require('lib.UI.elements.Text')\
- local Button = FDK.require('lib.UI.elements.Button')\
- \
- -- Main Field\
- Account.frame:newChild(Field(1, 1, Account.frame.width, Account.frame.height, colors.white))\
- -- Header Field\
- Account.frame:newChild(Field(1, 1, Account.frame.width, 3, colors.lightGray))\
- \
- local back = Account.frame:newChild( Button( 1, 1, 8, 3, \"< back\" ) )\
- back.bc = colors.lightGray\
- back.tc = colors.white\
- \
- function back:onClick()\
- Main:show()\
- end\
- \
- local Header = Account.frame:newChild(Text(0, 0, 13, 1, '&b8&t0Account info'))\
- Header.y = 2\
- Header.width = #Header.text - #'&b7&t8'\
- Header:alignX('centre')\
- \
- local Data = {\
- User = nil,\
- Balance = 100.00,\
- Position = {X = 1, Y = 50, Z = 100},\
- SkyblockPosition = {X = 1, Y = 50, Z = 100},\
- }\
- \
- local Texts = {\
- Username = Account.frame:newChild(Text(1, 1, 0, 1, '&b0&t7Username:')),\
- _Username = Account.frame:newChild(Text(1, 1, 0, 1, '&b0&td' .. tostring(Data.User)..' ')),\
- Balance = Account.frame:newChild(Text(1, 1, 0, 1, '&b0&t7Balance:')),\
- _Balance = Account.frame:newChild(Text(1, 1, 0, 1, '&b0&t1' .. tostring(Data.Balance)..' ')),\
- Position = Account.frame:newChild(Text(1, 1, 0, 1, '&b0&t7Position')),\
- PositionX = Account.frame:newChild(Text(1, 1, 0, 1, '&b0&t7X:&b0&tb' .. tostring(Data.Position.X)..' ')),\
- PositionY = Account.frame:newChild(Text(1, 1, 0, 1, '&b0&t7Y:&b0&tb' .. tostring(Data.Position.Y)..' ')),\
- PositionZ = Account.frame:newChild(Text(1, 1, 0, 1, '&b0&t7Z:&b0&tb' .. tostring(Data.Position.Z)..' ')),\
- SkyblockPosition = Account.frame:newChild(Text(1, 1, 0, 1, '&b0&t7Skyblock Location')),\
- SkyblockPositionX = Account.frame:newChild(Text(1, 1, 0, 1, '&b0&t7X:&b0&tb' .. tostring(Data.SkyblockPosition.X)..' ')),\
- SkyblockPositionY = Account.frame:newChild(Text(1, 1, 0, 1, '&b0&t7Y:&b0&tb' .. tostring(Data.SkyblockPosition.Y)..' ')),\
- SkyblockPositionZ = Account.frame:newChild(Text(1, 1, 0, 1, '&b0&t7Z:&b0&tb' .. tostring(Data.SkyblockPosition.Z)..' ')),\
- }\
- function SetData(Name, Y, X, _D)\
- local D = 6\
- if _D then\
- D = 12\
- end\
- Texts[Name].width = #Texts[Name].text - D\
- Texts[Name].y, Texts[Name].x = Y, X\
- end\
- function SetText(Name, Text)\
- Texts[Name].text = Text\
- end\
- \
- SetData('Username', 5, 2)\
- SetData('Position', 9, 2)\
- SetData('Balance', 7, 2)\
- SetData('SkyblockPosition', 9, 33)\
- SetData('_Username', 5, #Texts.Username.text - 3)\
- SetData('_Balance', 7, #Texts.Balance.text - 3)\
- SetData('PositionX', 10, 6, true)\
- SetData('PositionY', 11, 6, true)\
- SetData('PositionZ', 12, 6, true)\
- SetData('SkyblockPositionX', 10, 39, true)\
- SetData('SkyblockPositionY', 11, 39, true)\
- SetData('SkyblockPositionZ', 12, 39, true)\
- \
- \
- Account.process:spawnThread(function()\
- while true do\
- FDK.sleep(1)\
- SetText('_Username', '&b0&td'..tostring(Data.User))\
- SetText('_Balance', '&b0&t1'..tostring(Data.Balance))\
- SetText('PositionX', '&b0&t7X:&b0&tb'..tostring(Data.Position.X))\
- SetText('PositionY', '&b0&t7X:&b0&tb'..tostring(Data.Position.Y))\
- SetText('PositionZ', '&b0&t7X:&b0&tb'..tostring(Data.Position.Z))\
- SetText('SkyblockPositionX', '&b0&t7X:&b0&tb'..tostring(Data.SkyblockPosition.X))\
- SetText('SkyblockPositionY', '&b0&t7X:&b0&tb'..tostring(Data.SkyblockPosition.Y))\
- SetText('SkyblockPositionZ', '&b0&t7X:&b0&tb'..tostring(Data.SkyblockPosition.Z))\
- \
- SetData('_Username', 5, #Texts.Username.text - 3)\
- SetData('_Balance', 7, #Texts.Balance.text - 3)\
- SetData('PositionX', 10, 6, true)\
- SetData('PositionY', 11, 6, true)\
- SetData('PositionZ', 12, 6, true)\
- SetData('SkyblockPositionX', 10, 39, true)\
- SetData('SkyblockPositionY', 11, 39, true)\
- SetData('SkyblockPositionZ', 12, 39, true)\
- end\
- end)\
- \
- Account.process:spawnThread(function()\
- while true do\
- local Event, Side, SenderID, ReceiverID, Msg, Distance = coroutine.yield()\
- if Event == 'modem_message' then\
- if SenderID == 2773 then\
- --local File = fs.open('log','a')\
- --File.writeLine(Decompile(textutils.unserialize(Msg)))\
- --File.close()\
- Data = textutils.unserialize(Msg)\
- end\
- end\
- end\
- end)\
- \
- \
- ",
- [ "/Shop/States/Main.lua" ] = "local StateLib = FDK.require('lib.state')\
- local State = StateLib.names.Init\
- local Main = StateLib.names.Main\
- local Search = StateLib.names.Search\
- local Account = StateLib.names.Account\
- local Items = StateLib.names.Items\
- \
- local Field = FDK.require('lib.UI.elements.Field')\
- local Text = FDK.require('lib.UI.elements.Text')\
- local Button = FDK.require('lib.UI.elements.Button')\
- \
- -- Main Field\
- Main.frame:newChild(Field(1, 1, Main.frame.width, Main.frame.height, colors.white))\
- -- Header Field\
- Main.frame:newChild(Field(1, 1, Main.frame.width, 3, colors.lightGray))\
- \
- local Header = Main.frame:newChild(Text(0, 0, 13, 1, '&b8&t0Menu'))\
- Header.y = 2\
- Header.width = #Header.text - #'&b7&t8'\
- Header:alignX('centre')\
- \
- -- Buttons --\
- local Buttons = {\
- _Search = {func=Search, Frame=Main.frame:newChild(Button(0, 5, 18, 3, '&t0Search'))},\
- _Items = {func=Items, Frame=Main.frame:newChild(Button(0, 10, 18, 3, '&t0Items'))},\
- _Account = {func=Account, Frame=Main.frame:newChild(Button(0, 15, 18, 3, '&t0Account'))},\
- --Search = Main.frame:newChild(Button(2, 5, 18, 3, '&t0Search')),\
- }\
- \
- for k, v in pairs(Buttons) do\
- v.Frame.bc = colors.gray\
- v.Frame:alignX('centre')\
- function v.Frame:onClick()\
- v.func:show()\
- end\
- end\
- \
- \
- --Buttons.Search:align('centre', 'centre')\
- \
- --Main.frame:newChild( Text( 2, 5, 46, 3, '&t7What would you like to see a demonstration of?' ) )",
- [ "/run" ] = "shell.run('Shop/run')",
- [ "/Shop/States/Search.lua" ] = "local StateLib = FDK.require('lib.state')\
- local State = StateLib.names.Init\
- local Main = StateLib.names.Main\
- local Search = StateLib.names.Search\
- local Account = StateLib.names.Account\
- local Items = StateLib.names.Items\
- \
- local Field = FDK.require('lib.UI.elements.Field')\
- local Text = FDK.require('lib.UI.elements.Text')\
- local Button = FDK.require('lib.UI.elements.Button')\
- local ScrollBar = FDK.require('lib.UI.elements.ScrollBar')\
- local Frame = FDK.require('lib.UI.elements.ClippingFrame')\
- \
- -- Main Field\
- Search.frame:newChild(Field(1, 1, Search.frame.width, Search.frame.height, colors.white))\
- -- Header Field\
- Search.frame:newChild(Field(1, 1, Search.frame.width, 3, colors.lightGray))\
- \
- local back = Search.frame:newChild( Button( 1, 1, 8, 3, \"< back\" ) )\
- back.bc = colors.lightGray\
- back.tc = colors.white\
- \
- function back:onClick()\
- Main:show()\
- end\
- \
- local SearchFrame = Search.frame:newChild(Frame(1, 4,\
- Search.frame.width-2,\
- Search.frame.height-3\
- ))\
- local SearchBar = Search.frame:newChild(ScrollBar(Search.frame.width, 4, 1, Search.frame.height-3, SearchFrame))",
- [ "/Shop/States/Init.lua" ] = "\
- local StateLib = FDK.require('lib.state')\
- local State = StateLib.names.Init\
- local Main = StateLib.names.Main\
- \
- local Field = FDK.require('lib.UI.elements.Field')\
- local Text = FDK.require('lib.UI.elements.Text')\
- local Button = FDK.require('lib.UI.elements.Button')\
- \
- -- Main Field\
- State.frame:newChild(Field(1, 1, State.frame.width, State.frame.height, colors.gray))\
- -- Header Field\
- State.frame:newChild(Field(1, 1, State.frame.width, 3, colors.lightGray))\
- \
- -- Header Text\
- local Header = State.frame:newChild(Text(0, 0, 13, 1, '&b8&t0Shop - Client'))\
- Header.width = #Header.text - #'&b7&t8'\
- Header.y = 2\
- Header:alignX('centre')\
- \
- local Desc = State.frame:newChild(Text(0, 0, 17, 1, '&b7&t8Requesting data..'))\
- Desc.width = #Desc.text - #'&b7&t8'\
- Desc.y = math.ceil(State.frame.height/2.3)\
- Desc:alignX('centre')\
- local CurrentRead = State.frame:newChild(Text(0, 0, 0, 1, '&b7&tfNo data available'))\
- CurrentRead.width = #CurrentRead.text - #'&b7&t8'\
- CurrentRead.y = math.ceil(State.frame.height/2)+1 \
- CurrentRead:alignX('centre')\
- \
- State.process:spawnThread(function()\
- while true do\
- -- Gather data --\
- Modem.transmit(2773, 2773, '@RequestData')\
- local Events, Side, Channel, Channel, Msg, Dist = coroutine.yield('modem_message')\
- --_G.DB = textutils.unserialize(Decompile(textutils.unserialize(Msg)))\
- break\
- end\
- Main:show()\
- end)",
- [ "/compress" ] = "term.clear()\
- term.setCursorPos(1,1)\
- local function Decompile(CompiledTbl)\
- local Str = ''\
- for k, v in pairs(CompiledTbl) do\
- Str = Str .. string.char(v)\
- end\
- return Str\
- end\
- \
- local function Compile(Str)\
- local Compiled = {string.byte(Str,1,#tostring(Str))}\
- return Compiled, table.concat(Compiled, ',')\
- end\
- \
- local Blacklist={\
- 'Flare/*',\
- 'rom/*',\
- ''..shell.getRunningProgram() .. \"/*\",\
- }\
- \
- local function wildcardpat( path, t )\
- if t then\
- return \"^/*\" .. path:gsub( \"%*$\", \"/*\" ) .. \"$\"\
- end\
- return \"^/*\" .. path:gsub( \"%*\", \"%.%+\" ) .. \"$\"\
- end\
- \
- local function Blacklisted(Path)\
- for i, v in ipairs( Blacklist ) do\
- if Path:find( wildcardpat( v ) ) or Path:find( wildcardpat( v, true ) ) then\
- printError(Path)\
- return true\
- end\
- end\
- term.setTextColor(colors.white)\
- return false\
- end\
- \
- local Args = {...}\
- \
- --[[if Args[1] ~= '-String' or Args[1] ~= '-File' then\
- \
- end]]\
- if Args[1] == '-String' then\
- String = Args[2]\
- elseif Args[1] == '-File' then\
- print('loading files...')\
- print(textutils.serialize(Blacklist))\
- sleep(2.5)\
- \
- local Path = '/'\
- local Contents = {}\
- \
- local function GetDir(Path)\
- if not Blacklisted(Path) then\
- local List = fs.list(Path or '/')\
- for k, v in pairs(List) do\
- \
- local CurrentPath = Path..fs.getName(\
- fs.combine(\
- Path,\
- v\
- )\
- )\
- if fs.isDir(CurrentPath) then\
- CurrentPath = CurrentPath .. '/'\
- end\
- if fs.isDir(CurrentPath) then\
- GetDir(CurrentPath)\
- else\
- local File = fs.open(CurrentPath, 'r')\
- if File then\
- local Data = File.readAll()\
- -- Compile data --\
- --Data = --{string.byte(Data,1,#tostring(Data))}\
- --print(table.concat(Data, ', '))\
- --os.pullEvent()\
- File.close()\
- Contents[CurrentPath] = Data\
- os.queueEvent('Ping')\
- os.pullEvent('Ping')\
- end\
- end\
- end\
- end\
- end\
- \
- \
- GetDir(Path)\
- local Pre = [[local tbl=]]\
- local Extra = [[\
- print('Extracting...')\
- for k, v in pairs(tbl) do\
- print(k)\
- local X = fs.open(k, 'w')\
- print(string.len(tostring(X)))\
- X.write(v)\
- X.close()\
- end\
- ]]\
- Compiled = fs.open('Compiled', 'w')\
- Compiled.write(Pre..textutils.serialize(Contents)..Extra)\
- Compiled.close()\
- end",
- } print('Extracting...')
- for k, v in pairs(tbl) do
- print(k)
- local X = fs.open(k, 'w')
- print(string.len(tostring(X)))
- X.write(v)
- X.close()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement