FirstSkyler1

Slots - install.lua

Jul 9th, 2015
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 20.39 KB | None | 0 0
  1. local component = require("component")
  2. local gpu = component.gpu
  3. local w, h = gpu.getResolution()
  4.  
  5. local shell = require("shell")
  6. local event = require("event")
  7. local computer = require("computer")
  8. local term = require("term")
  9. local internet = require("internet")
  10. local fs = require("filesystem")
  11.  
  12. local maxw, maxh = gpu.maxResolution()
  13. if maxh < 40 then
  14.   gpu.set(1, 1, "Sorry, your computer doesn't meet them minimum requirements.")
  15.   term.setCursor(1, 2)
  16. end
  17.  
  18. gpu.setBackground(0xCCCCCC)
  19. gpu.setForeground(0x000000)
  20. gpu.setResolution(100, 50)
  21.  
  22. gpu.fill(1, 1, 100, 50, " ")
  23. gpu.set(1, 1, "╔════════════════╦═════════════════════════════════════════════════════════════════════════════════╗")
  24. gpu.set(1, 2, "║                ║                                                                                 ║")
  25. gpu.set(1, 3, "║                ║                                                                                 ║")
  26. gpu.set(1, 4, "║                ║                                                                                 ║")
  27. gpu.set(1, 5, "║                ║                                                                                 ║")
  28. gpu.set(1, 6, "║                ║                                                                                 ║")
  29. gpu.set(1, 7, "║                ║                                                                                 ║")
  30. gpu.set(1, 8, "║                ║                                                                                 ║")
  31. gpu.set(1, 9, "║                ║                                                                                 ║")
  32. gpu.set(1, 10, "║                ║                                                                                 ║")
  33. gpu.set(1, 11, "║                ║                                                                                 ║")
  34. gpu.set(1, 12, "║                ║                                                                                 ║")
  35. gpu.set(1, 13, "║                ║                                                                                 ║")
  36. gpu.set(1, 14, "║                ║                                                                                 ║")
  37. gpu.set(1, 15, "║                ║                                                                                 ║")
  38. gpu.set(1, 16, "║                ║                                                                                 ║")
  39. gpu.set(1, 17, "║                ║                                                                                 ║")
  40. gpu.set(1, 18, "║                ║                                                                                 ║")
  41. gpu.set(1, 19, "║                ║                                                                                 ║")
  42. gpu.set(1, 20, "║                ║                                                                                 ║")
  43. gpu.set(1, 21, "║                ║                                                                                 ║")
  44. gpu.set(1, 22, "║                ║                                                                                 ║")
  45. gpu.set(1, 23, "║                ║                                                                                 ║")
  46. gpu.set(1, 24, "║                ║                                                                                 ║")
  47. gpu.set(1, 25, "║                ║                                                                                 ║")
  48. gpu.set(1, 26, "║                ║                                                                                 ║")
  49. gpu.set(1, 27, "║                ║                                                                                 ║")
  50. gpu.set(1, 28, "║                ║                                                                                 ║")
  51. gpu.set(1, 29, "║                ║                                                                                 ║")
  52. gpu.set(1, 30, "║                ║                                                                                 ║")
  53. gpu.set(1, 31, "║                ║                                                                                 ║")
  54. gpu.set(1, 32, "║                ║                                                                                 ║")
  55. gpu.set(1, 33, "║                ║                                                                                 ║")
  56. gpu.set(1, 34, "║                ║                                                                                 ║")
  57. gpu.set(1, 35, "║                ║                                                                                 ║")
  58. gpu.set(1, 36, "║                ║                                                                                 ║")
  59. gpu.set(1, 37, "║                ║                                                                                 ║")
  60. gpu.set(1, 38, "║                ║                                                                                 ║")
  61. gpu.set(1, 39, "║                ║                                                                                 ║")
  62. gpu.set(1, 40, "║                ║                                                                                 ║")
  63. gpu.set(1, 41, "║                ║                                                                                 ║")
  64. gpu.set(1, 42, "║                ║                                                                                 ║")
  65. gpu.set(1, 43, "║                ║                                                                                 ║")
  66. gpu.set(1, 44, "║                ║                                                                                 ║")
  67. gpu.set(1, 45, "║                ║                                                                                 ║")
  68. gpu.set(1, 46, "║                ║                                                                                 ║")
  69. gpu.set(1, 47, "║                ║                                                                                 ║")
  70. gpu.set(1, 48, "║                ║                                                                                 ║")
  71. gpu.set(1, 49, "║                ║                                                                                 ║")
  72. gpu.set(1, 50, "╚════════════════╩═════════════════════════════════════════════════════════════════════════════════╝")
  73. gpu.setBackground(0x000099)
  74. gpu.setForeground(0xCC0000)
  75.  
  76. gpu.set(3, 1, "I")
  77. gpu.fill(2, 2, 16, 48, " ")
  78. gpu.setBackground(0xCC0000)
  79. gpu.setForeground(0xFFFFFF)
  80. gpu.set(98, 1, "X")
  81. gpu.setBackground(0xCCCCCC)
  82. gpu.setForeground(0x000000)
  83. gpu.set(5, 1, "╣Setup - Eko Slots╠")
  84.  
  85. gpu.setBackground(0xEEEEEE)
  86. gpu.set(21, 3, "Welcome to the Eko Slots Setup Wizard")
  87. gpu.setBackground(0xCCCCCC)
  88.  
  89. gpu.set(21, 5, "This will install Eko Slots on your computer.")
  90. gpu.set(21, 7, "In order to install Eko Slots, your computer must be at or above the")
  91. gpu.set(21, 8, "requirements, which are as follows:")
  92. gpu.set(21, 9, " •Tier 3 Screen")
  93. gpu.set(21, 10, " •Tier 3 Graphics Card")
  94. gpu.set(21, 11, " •Tier 1 Lua 5.2 CPU")
  95. gpu.set(21, 12, " •1 Tier 2 Memory Card")
  96. gpu.set(21, 13, " •An Internet Card")
  97.  
  98. if not component.isAvailable("internet") then
  99.   gpu.set(21, 43, "You do not meet the requirements. Missing:")
  100.   gpu.set(21, 44, "Internet Card")
  101.   gpu.set(21, 45, "Your computer will now restart.")
  102.   os.sleep(3)
  103.   computer.shutdown(true)
  104. end
  105.  
  106. gpu.setBackground(0x333333)
  107. gpu.setForeground(0xFFFFFF)
  108. gpu.fill(21, 44, 8, 3, " ")
  109. gpu.fill(31, 44, 7, 3, " ")
  110. gpu.set(22, 45, "Cancel")
  111. gpu.set(33, 45, "Next")
  112.  
  113. gpu.setBackground(0xCCCCCC)
  114. gpu.setForeground(0x000000)
  115.  
  116. while true do
  117.   local _, _, x, y, _, player = event.pull('touch')
  118.  
  119.   if x > 20 and x < 30 and y < 48 and y > 43 then
  120.     gpu.fill(18, 2, 98, 48, " ")
  121.     gpu.set(21, 3, "Your computer will now restart.")
  122.     os.sleep(3)
  123.     computer.shutdown(true)
  124.   elseif x > 30 and x < 39 and y < 48 and y > 43 then
  125.     gpu.fill(1, 1, 50, 25, " ")
  126.     gpu.set(1, 1, "╔══════════════════════════════════════════════════════════════════════════════════════════════════╗")
  127.     gpu.set(1, 2, "║                                                                                                  ║")
  128.     gpu.set(1, 3, "║                                                                                                  ║")
  129.     gpu.set(1, 4, "╠══════════════════════════════════════════════════════════════════════════════════════════════════╣")
  130.     gpu.set(1, 5, "║                                                                                                  ║")
  131.     gpu.set(1, 6, "║                                                                                                  ║")
  132.     gpu.set(1, 7, "║                                                                                                  ║")
  133.     gpu.set(1, 8, "║                                                                                                  ║")
  134.     gpu.set(1, 9, "║                                                                                                  ║")
  135.     gpu.set(1, 10, "║                                                                                                  ║")
  136.     gpu.set(1, 11, "║                                                                                                  ║")
  137.     gpu.set(1, 12, "║                                                                                                  ║")
  138.     gpu.set(1, 13, "║                                                                                                  ║")
  139.     gpu.set(1, 14, "║                                                                                                  ║")
  140.     gpu.set(1, 15, "║                                                                                                  ║")
  141.     gpu.set(1, 16, "║                                                                                                  ║")
  142.     gpu.set(1, 17, "║                                                                                                  ║")
  143.     gpu.set(1, 18, "║                                                                                                  ║")
  144.     gpu.set(1, 19, "║                                                                                                  ║")
  145.     gpu.set(1, 20, "║                                                                                                  ║")
  146.     gpu.set(1, 21, "║                                                                                                  ║")
  147.     gpu.set(1, 22, "║                                                                                                  ║")
  148.     gpu.set(1, 23, "║                                                                                                  ║")
  149.     gpu.set(1, 24, "║                                                                                                  ║")
  150.     gpu.set(1, 25, "║                                                                                                  ║")
  151.     gpu.set(1, 26, "║                                                                                                  ║")
  152.     gpu.set(1, 27, "║                                                                                                  ║")
  153.     gpu.set(1, 28, "║                                                                                                  ║")
  154.     gpu.set(1, 29, "║                                                                                                  ║")
  155.     gpu.set(1, 30, "║                                                                                                  ║")
  156.     gpu.set(1, 31, "║                                                                                                  ║")
  157.     gpu.set(1, 32, "║                                                                                                  ║")
  158.     gpu.set(1, 33, "║                                                                                                  ║")
  159.     gpu.set(1, 34, "║                                                                                                  ║")
  160.     gpu.set(1, 35, "║                                                                                                  ║")
  161.     gpu.set(1, 36, "║                                                                                                  ║")
  162.     gpu.set(1, 37, "║                                                                                                  ║")
  163.     gpu.set(1, 38, "║                                                                                                  ║")
  164.     gpu.set(1, 39, "║                                                                                                  ║")
  165.     gpu.set(1, 40, "║                                                                                                  ║")
  166.     gpu.set(1, 41, "║                                                                                                  ║")
  167.     gpu.set(1, 42, "║                                                                                                  ║")
  168.     gpu.set(1, 43, "║                                                                                                  ║")
  169.     gpu.set(1, 44, "║                                                                                                  ║")
  170.     gpu.set(1, 45, "║                                                                                                  ║")
  171.     gpu.set(1, 46, "║                                                                                                  ║")
  172.     gpu.set(1, 47, "║                                                                                                  ║")
  173.     gpu.set(1, 48, "║                                                                                                  ║")
  174.     gpu.set(1, 49, "║                                                                                                  ║")
  175.     gpu.set(1, 50, "╚══════════════════════════════════════════════════════════════════════════════════════════════════╝")
  176.     gpu.setBackground(0x000099)
  177.     gpu.fill(95, 2, 99, 4, " ")
  178.     gpu.setBackground(0xCCCCCC)
  179.     gpu.set(3, 2, "License Agreement")
  180.     gpu.set(5, 3, "Please read the following important information before continuing.")
  181.     gpu.setBackground(0xFFFFFF)
  182.     gpu.fill(3, 6, 96, 34, " ")
  183.     gpu.set(4, 8, "Don't claim my software as your own and use common sense.")
  184.     gpu.set(4, 9, "Also, installation starts the instant you click Agree.")
  185.     gpu.set(4, 10, "It installs to bin/slots and also puts a shortcut in the main")
  186.     gpu.set(4, 11, "bin folder so you don't have to do \"bin/slots/binaries/main.lua\"")
  187.     goto install
  188.   end
  189. end
  190.  
  191. --Yes, I know there is a more efficient way to do this, but I don't want people lecturing me on how goto sucks.
  192. ::install::
  193. gpu.setBackground(0x333333)
  194. gpu.setForeground(0xFFFFFF)
  195. gpu.fill(3, 44, 8, 3, " ")
  196. gpu.fill(13, 44, 7, 3, " ")
  197. gpu.set(4, 45, "Cancel")
  198. gpu.set(14, 45, "Agree")
  199.  
  200. while true do
  201.   local _, _, x, y, _, player = event.pull('touch')
  202.  
  203.   if x > 2 and x < 14 and y > 43 and y < 47 then
  204.     gpu.fill(18, 2, 98, 48, " ")
  205.     gpu.set(21, 3, "Your computer will now restart.")
  206.     os.sleep(3)
  207.     computer.shutdown(true)
  208.   elseif x > 12 and x < 21 and y < 47 and y > 43 then
  209.     gpu.fill(2, 2, 98, 3, " ")
  210.     gpu.fill(2, 5, 98, 48, " ")
  211.     gpu.setBackground(0x000099)
  212.     gpu.fill(95, 2, 99, 4, " ")
  213.     gpu.setBackground(0xCCCCCC)
  214.     gpu.set(3, 2, "Installing Eko Slots")
  215.     gpu.set(5, 3, "Do not shut down your computer")
  216.    
  217.         local f, reason = io.open(filename, "w")
  218.         if not f then
  219.           computer.shutdown(true)
  220.         end
  221.  
  222.     gpu.set(4, 8, "Downloading...")
  223.     fs.makeDirectory("bin/slots")
  224.     fs.makeDirectory("bin/slots/binaries")
  225.     fs.makeDirectory("bin/slots/resource")
  226.     local file = "bin/slots/binaries/main.lua"
  227.     local f, reason = io.open(file)
  228.     local url = "http://pastebin.com/raw.php?i=d8gr7mQF"
  229.     local result, response = pcall(internet.request, url)
  230.     if result then
  231.       for chunk in response do
  232.         string.gsub(chunk, "\r\n", "\n")
  233.         f:write(chunk)
  234.       f:close()()
  235.     end
  236.     gpu.set(4, 10, "Downloading QFSERAAc to resource/chery")
  237.     file = "bin/slots/resource/chery"
  238.     f, reason = io.open(file)
  239.     url = "http://pastebin.com/raw.php?i=QFSERAAc"
  240.     result, response = pcall(internet.request, url)
  241.     if result then
  242.       for chunk in response do
  243.         string.gsub(chunk, "\r\n", "\n")
  244.         f:write(chunk)
  245.       f:close()
  246.     end
  247.     gpu.set(4, 11, "Downloading 5Y8mhTSd to resource/berry")
  248.     file = "bin/slots/resource/berry"
  249.     f, reason = io.open(file)
  250.     url = "http://pastebin.com/raw.php?i=5Y8mhTSd"
  251.     result, response = pcall(internet.request, url)
  252.     if result then
  253.       for chunk in response do
  254.         string.gsub(chunk, "\r\n", "\n")
  255.         f:write(chunk)
  256.     end
  257.     gpu.set(4, 11, "Downloading dANxa1j0 to resource/base")
  258.     file = "bin/slots/resource/base"
  259.     f, reason = io.open(file)
  260.     url = "http://pastebin.com/raw.php?i=dANxa1j0"
  261.     result, response = pcall(internet.request, url)
  262.     if result then
  263.       for chunk in response do
  264.         string.gsub(chunk, "\r\n", "\n")
  265.         f:write(chunk)
  266.     end
  267.     gpu.set(4, 12, "Downloading D0TxLjZC to resource/title")
  268.     file = "bin/slots/resource/title"
  269.     f, reason = io.open(file)
  270.     url = "http://pastebin.com/raw.php?i=D0TxLjZC"
  271.     result, response = pcall(internet.request, url)
  272.     if result then
  273.       for chunk in response do
  274.         string.gsub(chunk, "\r\n", "\n")
  275.         f:write(chunk)
  276.     end
  277.     gpu.set(4, 13, "Downloading sztVKV2R to resource/spin")
  278.     file = "bin/slots/resource/spin"
  279.     f, reason = io.open(file)
  280.     url = "http://pastebin.com/raw.php?i=sztVKV2R"
  281.     result, response = pcall(internet.request, url)
  282.     if result then
  283.       for chunk in response do
  284.         string.gsub(chunk, "\r\n", "\n")
  285.         f:write(chunk)
  286.     end
  287.     gpu.set(4, 14, "Downloading tEuhBce7 to resource/melon")
  288.     file = "bin/slots/resource/melon"
  289.     f, reason = io.open(file)
  290.     url = "http://pastebin.com/raw.php?i=tEuhBce7"
  291.     result, response = pcall(internet.request, url)
  292.     if result then
  293.       for chunk in response do
  294.         string.gsub(chunk, "\r\n", "\n")
  295.         f:write(chunk)
  296.         end
  297.     gpu.set(4, 15, "Downloading PYfStCRb to resource/lemon")
  298.     file = "bin/slots/resource/lemon"
  299.     f, reason = io.open(file)
  300.     url = "http://pastebin.com/raw.php?i=PYfStCRb"
  301.     result, response = pcall(internet.request, url)
  302.     if result then
  303.       for chunk in response do
  304.         if not options.k then
  305.           string.gsub(chunk, "\r\n", "\n")
  306.         end
  307.         f:write(chunk)
  308.       f:close()
  309.     end
  310.   gpu.set(4, 16, "Downloading g5GNwMAm to resource/eagle")
  311.     file = "bin/slots/resource/eagle"
  312.     f, reason = io.open(file)
  313.     url = "http://pastebin.com/raw.php?i=g5GNwMAm"
  314.     result, response = pcall(internet.request, url)
  315.     if result then
  316.       for chunk in response do
  317.         string.gsub(chunk, "\r\n", "\n")
  318.         f:write(chunk)
  319.     end
  320.     gpu.set(4, 18, "Install finished. Rebooting...")
  321.     os.sleep(3)
  322.     computer.shutdown(true)
  323.   end
  324. end
  325. end
  326. end
  327. end
  328. end
  329. end
  330. end
  331. end
  332. end
  333. end
Add Comment
Please, Sign In to add comment