Advertisement
Guest User

game

a guest
Feb 19th, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.21 KB | None | 0 0
  1. function clear()
  2.     term.clear()
  3.     term.setCursorPos(1,1)
  4. end
  5.  
  6. function displayServer()
  7.   term.setBackgroundColor(colors.black)
  8.   Server1Login = paintutils.loadImage("/server1login")
  9.   paintutils.drawImage(Server1Login, 1, 1)
  10.   term.setCursorPos(18, 12)
  11.   print("Username")
  12.   term.setCursorPos(18, 15)
  13.   print("Password")
  14.   term.setBackgroundColor(colors.black)
  15. end
  16.  
  17. function freeroam()
  18. while true do
  19.     w, h = term.getSize()
  20.     local serverNames = {"Blocksburg", "Intek. Inc"}
  21.     local serverPasswords = {"spass", "dogdog66", "intek", "verygoodpassword", "password"}
  22.     term.setBackgroundColor(colors.black)
  23.     term.setTextColor(colors.white)
  24.     clear()
  25.     background = paintutils.loadImage("/server1login")
  26.     paintutils.drawImage(background, 1, 1)
  27.     term.setCursorPos(19, 7)
  28.     sNameSec = math.random(1, 2)
  29.     sPassSec = math.random(1, 5)
  30.     cServerName = serverNames[sNameSec]
  31.     cServerPass = serverPasswords[sPassSec]
  32.     term.setBackgroundColor(colors.black)
  33.     print(cServerName)
  34.     term.setCursorPos(1,1)
  35.     term.setTextColor(colors.green)
  36.     term.clearLine()
  37.     if sNameSec == 1 then
  38.         textutils.slowPrint("Connected to server 'Blocksburg Incorporated'...")
  39.     else
  40.         textutils.slowPrint("Connected to server 'Intek. Incorporated'...")
  41.     end
  42.     term.setTextColor(colors.white)
  43.     term.setBackgroundColor(colors.gray)
  44.     term.setCursorPos(18, 12)
  45.     print("Username")
  46.     term.setCursorPos(18, 15)
  47.     print("Password")
  48.     term.setBackgroundColor(colors.black)
  49.     term.setCursorPos(1, math.floor(h - 1))
  50.     term.clearLine()
  51.     write("> ")
  52.     comm = read()
  53.     if comm == "crack" then
  54.         term.setTextColor(colors.green)
  55.         term.setCursorPos(1,1)
  56.         term.clearLine()
  57.         textutils.slowPrint("Cracking password...")
  58.         sleep(0.5)
  59.         term.setCursorPos(1,1)
  60.         term.clearLine()
  61.         textutils.slowPrint("Password found: '"..cServerPass.."'")
  62.         term.setTextColor(colors.white)
  63.         term.setCursorPos(1, math.floor(h - 1))
  64.         term.clearLine()
  65.         write("> ")
  66.         comm = read()
  67.         if true then
  68.             clear()
  69.             term.setCursorPos(1,1)
  70.             term.setTextColor(colors.green)
  71.             if string.find(comm, "login ") and string.find(comm, cServerPass) then
  72.                 term.setCursorPos(1,1)
  73.                 term.clearLine()
  74.                 textutils.slowPrint("Password Entered: '"..cServerPass.."'...")
  75.                 sleep(0.5)
  76.                 clear()
  77.                 term.setCursorPos(1,1)
  78.                 term.clearLine()
  79.                 textutils.slowPrint("Login Attempt Success")
  80.                 term.setTextColor(colors.white)
  81.                 term.setCursorPos(1, 3)
  82.                 print("File List:")
  83.                 term.setCursorPos(3, 4)
  84.                 print("os.properties")
  85.                 term.setCursorPos(3, 5)
  86.                 print("Documents")
  87.                 term.setCursorPos(1, math.floor(h - 1))
  88.                 term.clearLine()
  89.                 write("> ")
  90.                 comm = read()
  91.                 if comm == "del os.properties" then
  92.                     term.setCursorPos(1,1)
  93.                     term.setTextColor(colors.green)
  94.                     term.clearLine()
  95.                     textutils.slowPrint("Deleting file 'os.properties'...")
  96.                     sleep(0.5)
  97.                     term.setCursorPos(1,1)
  98.                     term.clearLine()
  99.                     textutils.slowPrint("Done.")
  100.                     term.setTextColor(colors.white)
  101.                     term.setCursorPos(3, 4)
  102.                     term.clearLine()
  103.                     print("<Deleted>")
  104.                     term.setCursorPos(1, math.floor(h - 1))
  105.                     term.clearLine()
  106.                     write("> ")
  107.                     comm = read()
  108.                     if comm == "reboot -i" then
  109.                         clear()
  110.                         sleep(0.5)
  111.                         term.setCursorPos(1,3)
  112.                         term.setTextColor(colors.red)
  113.                         print("Internal Server Error: No such file")
  114.                         sleep(1)
  115.                     end
  116.                 end
  117.             end
  118.         end
  119.     end
  120. end
  121. end
  122.  
  123. local tArgs = {...}
  124. local server1 = false
  125.  
  126. clear()
  127.  
  128. if tArgs[1] == nil then
  129.   print("What would you like your username to be?")
  130.   write("Username: ")
  131.   uname = read()
  132.   print(" ")
  133.   print("What would you like your password to be?")
  134.   write("Password: ")
  135.   pword = read("*")
  136. elseif tArgs[1] == "-nologin" then
  137.     uname = "username"
  138.     pword = "password"
  139. elseif tArgs[1] == "-server1" then
  140.     server1 = true
  141.     uname = "username"
  142.     pword = "password"
  143. elseif tArgs[1] == "-crash" and tArgs[2] ~= nil then
  144.     error("Error code "..tArgs[2])
  145. elseif tArgs[1] == "-freeroam" then
  146.     server1 = true
  147.     freeroamEnabled = true
  148.     freeroam()
  149. end
  150.  
  151. w, h = term.getSize()
  152.  
  153. if server1 == false then
  154.   clear()
  155.   term.setCursorPos(math.floor(w / 2 - string.len("-= GenieChat =-")), 1)
  156.   print("-= GenieChat =-")
  157.   print(" ")
  158.   print("Please Login to GenieChat")
  159.   print(" ")
  160.   write("Username: ")
  161.   unameIn = read()
  162.   if unameIn == uname then
  163.     print(" ")
  164.     write("Password: ")
  165.     pwordIn = read("*")
  166.     if pwordIn == pword then
  167.       clear()
  168.       term.setCursorPos(math.floor(w / 2 - string.len("-= GenieChat =-")), 1)
  169.       print("-= GenieChat =-")
  170.       print("Moved to channel #4724")
  171.       print(" ")
  172.       print("<agentli>: Hi!")
  173.       sleep(1.5)
  174.       print("<You>: Hey.")
  175.       sleep(1.5)
  176.       print("<agentli>: So, what do you want to do?")
  177.       sleep(1.5)
  178.       print("<You>: I dunno.")
  179.       sleep(1)
  180.       term.setBackgroundColor(colors.red)
  181.       clear()
  182.       sleep(0.25)
  183.       term.setBackgroundColor(colors.black)
  184.       clear()
  185.       term.setCursorPos(math.floor(w / 2 - string.len("-= GenieChat =-")), 1)
  186.       print("-= GenieChat =-")
  187.       print(" ")
  188.       print("Moved to channel #666")
  189.       print(" ")
  190.       print("<agentls>: What just happened?")
  191.       sleep(1.5)
  192.       print("<You>: I dunno. Your username changed.")
  193.       sleep(1.5)
  194.       print("<agentli>: Better now?")
  195.       sleep(1.5)
  196.       print("<You>: Umm... Yeah, I guess...")
  197.       sleep(1.5)
  198.       print("<agentli>: Ok. Back to the job.")
  199.       sleep(1.5)
  200.       print("<You>: 'job'...?")
  201.       sleep(1.5)
  202.       print("<agentli>: You don't know? I want you to gain access to a server and... let's just say do some damage...")
  203.       sleep(1.5)
  204.       print("<You>: You mean hacking? I don't want to do that!")
  205.       sleep(1.5)
  206.       print("<agentli>: Well... too bad, I guess. Just press a key please.")
  207.       sleep(1)
  208.       print(" ")
  209.       print("-= Please press a key to continue... =-")
  210.       os.pullEvent("key")
  211.       print(" ")
  212.       print("-= Error: Unstability Detected! =-")
  213.       sleep(0.75)
  214.       term.setBackgroundColor(colors.lightBlue)
  215.       sleep(0.75)
  216.       clear()
  217.       term.setBackgroundColor(colors.black)
  218.       clear()
  219.     else
  220.       print(" ")
  221.       print("Incorrect Password.")
  222.       sleep(2)
  223.       os.reboot()
  224.       end
  225.   else
  226.       print(" ")
  227.       print("Invalid Username.")
  228.       sleep(2)
  229.       os.reboot()
  230.   end
  231. end
  232.  
  233. displayServer()
  234. term.setBackgroundColor(colors.black)
  235. term.setCursorPos(1, math.floor(h - 2))
  236. print("This is the server.")
  237. sleep(2)
  238. clear()
  239. displayServer()
  240. term.setCursorPos(1, math.floor(h - 2))
  241. print("Type 'crack' to crack the password.")
  242. term.setCursorPos(1, math.floor(h - 1))
  243. write("> ")
  244. comm = read()
  245. if comm == "crack" then
  246.     term.setCursorPos(1, 1)
  247.     term.setTextColor(colors.green)
  248.     textutils.slowPrint("Cracking password...")
  249.     term.setCursorPos(1,1)
  250.     sleep(0.5)
  251.     term.clearLine()
  252.     textutils.slowPrint("Password Found: 'spass'")
  253.     term.setTextColor(colors.white)
  254.     term.setCursorPos(1, math.floor(h - 2))
  255.     term.clearLine()
  256.     print("Well done. Now, type 'login spass' to login.")
  257.     term.setCursorPos(1, math.floor(h - 1))
  258.     term.clearLine()
  259.     write("> ")
  260.     comm = read()
  261.     if comm == "login spass" then
  262.         term.setCursorPos(1, 1)
  263.         term.setTextColor(colors.green)
  264.         term.clearLine()
  265.         textutils.slowPrint("Password Entered: 'spass'...")
  266.         sleep(0.5)
  267.         clear()
  268.         term.setCursorPos(1,1)
  269.         term.clearLine()
  270.         textutils.slowPrint("Login Attempt Success")
  271.         term.setTextColor(colors.white)
  272.         term.setCursorPos(1, 3)
  273.         print("File List:")
  274.         term.setCursorPos(3, 4)
  275.         print("os.properties")
  276.         term.setCursorPos(3, 5)
  277.         print("Documents")
  278.         term.setCursorPos(1, math.floor(h - 2))
  279.         print("So, type 'del os.properties' to delete the file.")
  280.         term.setCursorPos(1, math.floor(h - 1))
  281.         write("> ")
  282.         comm = read()
  283.         if comm == "del os.properties" then
  284.             term.setCursorPos(1,1)
  285.             term.setTextColor(colors.green)
  286.             term.clearLine()
  287.             textutils.slowPrint("Deleting file 'os.properties'...")
  288.             sleep(0.5)
  289.             term.setCursorPos(1,1)
  290.             term.clearLine()
  291.             textutils.slowPrint("Done.")
  292.             term.setTextColor(colors.white)
  293.             term.setCursorPos(3, 4)
  294.             term.clearLine()
  295.             print("<Deleted>")
  296.             term.setCursorPos(1, math.floor(h - 2))
  297.             print("Now, type 'reboot -i' to reboot the server.")
  298.             term.setCursorPos(1, math.floor(h - 1))
  299.             term.clearLine()
  300.             write("> ")
  301.             comm = read()
  302.             if comm == "reboot -i" then
  303.                 clear()
  304.                 sleep(0.5)
  305.                 term.setCursorPos(1,3)
  306.                 term.setTextColor(colors.red)
  307.                 print("Internal Server Error: No such file")
  308.                 sleep(0.5)
  309.                 term.setCursorPos(1, math.floor(h - 2))
  310.                 term.setTextColor(colors.white)
  311.                 print("Okay. Well done. Just a second, don't type 'exit'!")
  312.                 term.setCursorPos(1, math.floor(h - 1))
  313.                 write("> ")
  314.                 comm = read()
  315.                 if comm == "exit" then
  316.                     freeroamEnabled = true
  317.                 end
  318.             end
  319.         end
  320.     end
  321. end
  322.  
  323. if freeroamEnabled == true then
  324.     freeroam()
  325.     --clear()
  326.     --term.setTextColor(colors.white)
  327.     --print("You have completed the demo.")
  328. else -- Error Code 001 = freeroam not enabled, but reached
  329.     error("Error code 001")
  330. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement