Advertisement
Guest User

package

a guest
Jun 18th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.74 KB | None | 0 0
  1. local c="{\
  2.  template = \"                             8\\\
  3.                             8\\\
  4.                             8\\\
  5.                             8\\\
  6.                             8\\\
  7.                             8\\\
  8.                             8\\\
  9.                             8\\\
  10.                             8\\\
  11.                             8\\\
  12.                             8\\\
  13.                             8\\\
  14.                             8\\\
  15.                             8\\\
  16.                             8\\\
  17.                             8\\\
  18.                             8\\\
  19.                             8\",\
  20.  startup = \"os.pullEvent = os.pullEventRaw\\\
  21. \\\
  22. os.loadAPI(\\\"gui\\\")\\\
  23. server = 24\\\
  24. \\\
  25. while true do\\\
  26.  term.setTextColor(colors.black)\\\
  27.  term.setBackgroundColor(colors.lightBlue)\\\
  28.  gui.clear()\\\
  29.  \\\
  30.  term.setCursorPos(20,1)\\\
  31.  term.write(\\\"Welcome!\\\")\\\
  32.  \\\
  33.  term.setBackgroundColor(colors.gray)\\\
  34.  \\\
  35.  createAccount = gui.newButton(3,3,16,3,\\\"create_account\\\",colors.gray)\\\
  36.  term.setCursorPos(4,4)\\\
  37.  term.write(\\\"Create Account\\\")\\\
  38.  \\\
  39.  help = gui.newButton(3,7,6,3,\\\"help\\\",colors.gray)\\\
  40.  term.setCursorPos(4,8)\\\
  41.  term.write(\\\"Help\\\")\\\
  42.  \\\
  43.  choice = gui.waitForButtons(createAccount,help)\\\
  44.  \\\
  45.  if choice == \\\"create_account\\\" then\\\
  46.    username = \\\"\\\"\\\
  47.    password = \\\"\\\"\\\
  48.    term.setBackgroundColor(colors.lightBlue)\\\
  49.    gui.clear()\\\
  50.      \\\
  51.    gui.newButton(2,3,14,3,\\\" \\\",colors.gray)\\\
  52.    term.setCursorPos(5,3)\\\
  53.    term.setBackgroundColor(colors.gray)\\\
  54.    term.write(\\\"Username\\\")\\\
  55.    usernameBox = gui.newButton(3,4,12,1,\\\"username_box\\\",colors.lightGray)\\\
  56.      \\\
  57.    gui.newButton(2,7,14,3,\\\" \\\",colors.gray)\\\
  58.    term.setCursorPos(5,7)\\\
  59.    term.write(\\\"Password\\\")\\\
  60.    passwordBox = gui.newButton(3,8,12,1,\\\"password_box\\\",colors.lightGray)\\\
  61.      \\\
  62.    submit = gui.newButton(2,11,8,3,\\\"submit\\\",colors.gray)\\\
  63.    term.setCursorPos(3,12)\\\
  64.    term.write(\\\"Submit\\\")\\\
  65.    while true do\\\
  66.      choice = gui.waitForButtons(submit,usernameBox,passwordBox)\\\
  67.      \\\
  68.      if choice == \\\"username_box\\\" then\\\
  69.        username = gui.inputField(3,4,username,12,colors.lightGray)\\\
  70.      elseif choice == \\\"password_box\\\" then\\\
  71.        password = gui.inputField(3,8,password,12,colors.lightGray,\\\"*\\\")\\\
  72.      elseif choice == \\\"submit\\\" then\\\
  73.        shell.run(\\\"flagMaker\\\",username)\\\
  74.        rednet.send(server,{\\\"register_user\\\",username,password,paintutils.loadImage(username..\\\".flag\\\")})\\\
  75.        id,msg,d = rednet.receive()\\\
  76.        if id == server then\\\
  77.          if msg then\\\
  78.            term.setBackgroundColor(colors.lightBlue)\\\
  79.            gui.clear()\\\
  80.            print(\\\"USER CREATED\\\")\\\
  81.            print(\\\"Press any key to continue\\\")\\\
  82.            os.pullEvent(\\\"key\\\")\\\
  83.          else\\\
  84.            term.setBackgroundColor(colors.lightBlue)\\\
  85.            gui.clear()\\\
  86.            print(\\\"USER ALREADY EXISTS\\\")\\\
  87.            print(\\\"Press any key to continue\\\")\\\
  88.            os.pullEvent(\\\"key\\\")\\\
  89.          end\\\
  90.        else\\\
  91.          term.setBackgroundColor(colors.lightBlue)\\\
  92.          gui.clear()\\\
  93.          print(\\\"SERVER ERROR\\\")\\\
  94.          print(\\\"Press any key to continue\\\")\\\
  95.          os.pullEvent(\\\"key\\\")\\\
  96.        end\\\
  97.        \\\
  98.        break\\\
  99.      end\\\
  100.    end\\\
  101.  elseif choice == \\\"help\\\" then\\\
  102.    term.setBackgroundColor(colors.lightBlue)\\\
  103.    gui.clear()\\\
  104.    print(\\\"Welcome to Capture the Fort!\\\")\\\
  105.    print()\\\
  106.    print(\\\"Create an account here. This will be the account you use to sign into your forts. Do NOT make your password something that you use for other accounts. The server is secure but there is always a risk.\\\")\\\
  107.    print()\\\
  108.    print(\\\"Press any key to continue\\\")\\\
  109.    os.pullEvent(\\\"key\\\")\\\
  110.  end\\\
  111. end\",\
  112.  flagMaker = \"args = {...}\\\
  113. name = args[1]\\\
  114. \\\
  115. if fs.exists(name..\\\".flag\\\") then\\\
  116.  print(\\\"FLAG EXISTS\\\")\\\
  117.  return false\\\
  118. end\\\
  119. \\\
  120. fs.copy(\\\"template\\\",name..\\\".flag\\\")\\\
  121. \\\
  122. shell.run(\\\"paint\\\",name..\\\".flag\\\")\",\
  123. }"function makeDir(table,dir) if not fs.exists(dir) then fs.makeDir(dir) end for k, v in pairs(table) do if type(v)=='table' then makeDir(v,dir..'/'..k) else local fileH=fs.open(dir..'/'..k,'w') fileH.write(v) fileH.close() end end end tArgs={...} if #tArgs<1 then print('Usage: unpackager <destination>') else makeDir(textutils.unserialize(c),shell.resolve(tArgs[1])) print('Succ: Successfully extracted package') end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement