Advertisement
pepdroll_seven

Startup

May 30th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.88 KB | None | 0 0
  1. local w,h = term.getSize()
  2. local fgc = term.setTextColor
  3. local bgc = term.setBackgroundColor
  4. local passI = ""
  5. local userO = ""
  6. local passO = ""
  7. local data = ""
  8. local user = 0
  9. local pass = ""
  10. local login = 0
  11. local kod = ""
  12.  
  13. if fs.exists ("/pepdroll/.core/logo.nft") then
  14. shell.run ("move /pepdroll/.core/ikon/logo.nft")
  15. end
  16.  
  17. if not fs.exists ("/pepdroll/recovery/failstart.pep") then
  18. shell.run ("pastebin get U0SUc6at /pepdroll/recovery/failstart.pep")
  19. end
  20.  
  21. local function prc(text, y)
  22. local w = term.getSize()
  23. local _, cy = term.getCursorPos()
  24. term.setCursorPos(math.ceil((w-#text)/2), y or cy)
  25. write(text)
  26. end
  27.  
  28. function clear()
  29. term.clear()
  30. term.setBackgroundColor(colors.white)
  31. for i=1,w do
  32. for j=1,h do
  33. term.setCursorPos(i,j)
  34. write(" ")
  35. end
  36. end
  37. end
  38.  
  39. local nastaveni={barva=colors.blue}
  40. local f=fs.open("pepdroll/.core/colors","r")
  41. local cnt=f.readAll()
  42. f.close()
  43. local nastaveni=textutils.unserialize(cnt)
  44.  
  45. local f=fs.open("pepdroll/.core/textcol","r")
  46. local tnt=f.readAll()
  47. f.close()
  48. local text=textutils.unserialize(tnt)
  49.  
  50. function kontrola ()
  51. if not term.isColor() then
  52. term.setCursorPos(5,9)
  53. print "Sorry, you must have a Advanced computer"
  54. sleep (5)
  55. os.shutdown ()
  56. else
  57. boot ()
  58. end
  59. end
  60.  
  61.  
  62. if fs.exists ("/pepdroll/TEMP/startuplog") then
  63. fs.delete ("/pepdroll/TEMP/startuplog")
  64. heslo ()
  65. end
  66.  
  67.  
  68. function boot ()
  69. if not fs.exists ("/pepdroll/.core/modem") then
  70. back = "0"
  71. left = "0"
  72. right = "0"
  73. top = "1"
  74. bottom = "0"
  75. else
  76. data = fs.open ("/pepdroll/.core/modem", "r")
  77. back = data.readLine ()
  78. left = data.readLine ()
  79. right = data.readLine ()
  80. top = data.readLine ()
  81. bottom = data.readLine ()
  82. data.close ()
  83. end
  84.  
  85. if back == "1" then
  86. local function openRednet()
  87. for _,side in ipairs({"back"}) do
  88. if peripheral.isPresent(side) and peripheral.getType(side) == "modem" then
  89. rednet.open(side)
  90. return side
  91. end
  92. end
  93. print("no wifi present")
  94. end
  95.  
  96. modemSide = openRednet()
  97. if modemSide == nil then
  98. print("No modem connected")
  99. else
  100. print("Opened modem on "..modemSide)
  101. end
  102. end
  103.  
  104. if left == "1" then
  105. local function openRednet()
  106. for _,side in ipairs({"left"}) do
  107. if peripheral.isPresent(side) and peripheral.getType(side) == "modem" then
  108. rednet.open(side)
  109. return side
  110. end
  111. end
  112. print("no wifi present")
  113. end
  114.  
  115. modemSide = openRednet()
  116. if modemSide == nil then
  117. print("No modem connected")
  118. else
  119. print("Opened modem on "..modemSide)
  120. end
  121. end
  122.  
  123. if right == "1" then
  124. local function openRednet()
  125. for _,side in ipairs({"right"}) do
  126. if peripheral.isPresent(side) and peripheral.getType(side) == "modem" then
  127. rednet.open(side)
  128. return side
  129. end
  130. end
  131. print("no wifi present")
  132. end
  133.  
  134. modemSide = openRednet()
  135. if modemSide == nil then
  136. print("No modem connected")
  137. else
  138. print("Opened modem on "..modemSide)
  139. end
  140.  
  141. end
  142.  
  143. if top == "1" then
  144. local function openRednet()
  145. for _,side in ipairs({"top"}) do
  146. if peripheral.isPresent(side) and peripheral.getType(side) == "modem" then
  147. rednet.open(side)
  148. return side
  149. end
  150. end
  151. print("no wifi present")
  152. end
  153.  
  154. modemSide = openRednet()
  155. if modemSide == nil then
  156. print("No modem connected")
  157. else
  158. print("Opened modem on "..modemSide)
  159. end
  160.  
  161. end
  162.  
  163. if bottom == "1" then
  164. local function openRednet()
  165. for _,side in ipairs({"bottom"}) do
  166. if peripheral.isPresent(side) and peripheral.getType(side) == "modem" then
  167. rednet.open(side)
  168. return side
  169. end
  170. end
  171. print("no wifi present")
  172. end
  173.  
  174. modemSide = openRednet()
  175. if modemSide == nil then
  176. print("No modem connected")
  177. else
  178. print("Opened modem on "..modemSide)
  179. end
  180.  
  181. end
  182. havarie ()
  183.  
  184. end
  185.  
  186. function havarie ()
  187. if fs.exists("/pepdroll/TEMP/vypnuto") then
  188. fs.delete ("/pepdroll/TEMP")
  189. preskoklog ()
  190. else
  191. term.setBackgroundColor(colors.blue)
  192. term.setTextColor(colors.white)
  193. prc ("Fatal Error", 7)
  194. shell.run ("/pepdroll/recovery/failstart.pep")
  195. end
  196. end
  197.  
  198.  
  199. function preskoklog ()
  200. term.setBackgroundColor(colors.white)
  201. term.clear ()
  202. local uvod = paintutils.loadImage("/pepdroll/.core/ikon/logo.nft")
  203. paintutils.drawImage(uvod, 14, 2)
  204. term.setBackgroundColor(colors.white)
  205. term.setTextColor(colors.blue)
  206. prc("Starting Pepdroll", 14)
  207. term.setBackgroundColor(colors.lightBlue)
  208. term.setCursorPos(13,16)
  209. textutils.slowPrint " "
  210. if not fs.exists("/pepdroll/.core/Build") then
  211. verze = "First Use"
  212. else
  213. data = fs.open ("/pepdroll/.core/Build", "r")
  214. verze = data.readLine ()
  215. data.close ()
  216. end
  217. sleep (1)
  218. prc(verze, 16)
  219. sleep (1)
  220. if not fs.exists ("/pepdroll/.core/logon.cfg") then
  221. local n=fs.open("/pepdroll/.core/logon.cfg","w")
  222. n.writeLine ("0")
  223. n.close ()
  224. end
  225. local n=fs.open("/pepdroll/.core/logon.cfg","r")
  226. preskok = n.readLine ()
  227. n.close ()
  228.  
  229.  
  230. if preskok == "1" then
  231. stavlog = "Yes"
  232. local na=fs.open("/pepdroll/.core/defuser","r")
  233. user = na.readLine ()
  234. userI = user
  235. na.close()
  236. data = fs.open("/pepdroll/.ucet/"..userI.."/.data","r")
  237. user = data.readLine ()
  238. passI = data.readLine ()
  239. data.close()
  240. vitejte ()
  241. else
  242. stavlog = "NO"
  243. heslo ()
  244. end
  245. end
  246.  
  247. function createAccount()
  248. local next = false
  249. if login == 0 then
  250. user = 0
  251. term.setBackgroundColor(colors.white)
  252. term.clear()
  253. local myWindow = window.create(term.current(),4,6,46,9)
  254. myWindow.setBackgroundColor(nastaveni.barva)
  255. myWindow.clear()
  256.  
  257. paintutils.drawBox(3, 5, 49, 15, colors.black)
  258. term.setBackgroundColor(nastaveni.barva)
  259. term.setCursorPos(5,7)
  260. print"Register new user"
  261. term.setCursorPos(5,9)
  262. print("User name ")
  263. term.setCursorPos(5,11)
  264. print("Password ")
  265. term.setCursorPos(30,9)
  266. print "Code from Pastebin"
  267. term.setBackgroundColor(colors.white)
  268. term.setTextColor(colors.black)
  269. term.setCursorPos(18,9)
  270. print " "
  271. term.setCursorPos(18,11)
  272. print " "
  273. term.setCursorPos(38,11)
  274. print " "
  275. term.setCursorPos(18,13)
  276. print "Register"
  277. elseif login == 1 then
  278. end
  279.  
  280. while true do
  281. local event, button, x, y = os.pullEvent("mouse_click")
  282. xy = x..","..y
  283.  
  284. if x >= 18 and x <= 26 and y == 9 and button == 1 then
  285. term.setBackgroundColor(colors.lightGray)
  286. term.setTextColor(colors.white)
  287. term.setCursorPos(18,9)
  288. print " "
  289. term.setCursorPos(18,9)
  290. user = read()
  291. term.setBackgroundColor(colors.white)
  292. term.setTextColor(colors.black)
  293. term.setCursorPos(18,9)
  294. print " "
  295. term.setCursorPos(18,9)
  296. print (user)
  297. if user == 0 then
  298. term.setBackgroundColor(colors.white)
  299. fgc(colors.red)
  300. term.setCursorPos(5,13)
  301. print"Missing account data!"
  302. login = 0
  303. createAccount()
  304. elseif user == " " then
  305. term.setBackgroundColor(colors.white)
  306. fgc(colors.red)
  307. term.setCursorPos(5,13)
  308. print"Name is exist!"
  309. login = 0
  310. createAccount()
  311. else
  312. uzivatel = (user)
  313. login = 1
  314. createAccount()
  315. end
  316. elseif x >= 18 and x <= 26 and y == 11 and button == 1 then
  317. term.setBackgroundColor(colors.lightGray)
  318. term.setTextColor(colors.white)
  319. term.setCursorPos(18,11)
  320. print " "
  321. term.setCursorPos(18,11)
  322. pass = read("@")
  323. term.setBackgroundColor(colors.white)
  324. term.setTextColor(colors.black)
  325. term.setCursorPos(18,11)
  326. print " "
  327. term.setCursorPos(18,11)
  328. print "Password"
  329. login = 1
  330. createAccount()
  331. end
  332.  
  333. if x >= 38 and x <= 46 and y == 11 and button == 1 then
  334. term.setBackgroundColor(colors.lightGray)
  335. term.setTextColor(colors.white)
  336. term.setCursorPos(38,11)
  337. print " "
  338. term.setCursorPos (38,11)
  339. local kod = read ()
  340. term.setBackgroundColor(colors.white)
  341. term.setTextColor(colors.black)
  342. term.setCursorPos(38,11)
  343. print " "
  344. term.setCursorPos(38,11)
  345. print (kod)
  346.  
  347. if kod == "" then
  348. term.setCursorPos (38,11)
  349. print "error"
  350. elseif kod == "ccc" then
  351. user = "pepeksoft"
  352. pass = ""
  353. os.setComputerLabel("Pepek@Soft")
  354. registrace ()
  355. else
  356. term.setCursorPos(1,16)
  357. term.setBackgroundColor(colors.white)
  358. term.setTextColor(colors.white)
  359. shell.run ("pastebin get",kod,"/pepdroll/TEMP/puser")
  360. if fs.exists("/pepdroll/TEMP/puser") then
  361. data = fs.open ("/pepdroll/TEMP/puser", "r")
  362. user = data.readLine ()
  363. pass = data.readLine ()
  364. data.close ()
  365. registrace ()
  366. else
  367. createAccount()
  368. end
  369. end
  370. end
  371.  
  372. if x >= 18 and x <= 26 and y == 13 and button == 1 then
  373. registrace ()
  374. end
  375. end
  376. end
  377.  
  378. function registrace ()
  379. if user == 0 then
  380. term.setBackgroundColor(colors.white)
  381. fgc(colors.red)
  382. term.setCursorPos(5,13)
  383. print"Missing account data!"
  384. sleep (1)
  385. login = 0
  386. createAccount()
  387. elseif user == " " then
  388. term.setBackgroundColor(colors.white)
  389. fgc(colors.red)
  390. prc ("Name is exists!", 17)
  391. sleep (1)
  392. login = 0
  393. createAccount()
  394. end
  395. login = 0
  396. userI=user
  397.  
  398. if not fs.isDir(".ucet/"..user) then
  399. fs.makeDir("/pepdroll/.ucet/"..user)
  400. local file = fs.open("/pepdroll/.ucet/"..user.."/.data","w")
  401. file.writeLine(user)
  402. file.writeLine(pass)
  403. file.close()
  404. if not fs.exists("/pepdroll/.core/ucet") then
  405. fs.open("/pepdroll/.core/ucet","w")
  406. end
  407. term.setBackgroundColor(colors.white)
  408. fgc(colors.lime)
  409. term.setCursorPos(5,17)
  410. shell.run ("pastebin get C3MXEfYf /pepdroll/.ucet/"..user.."/bar.nfp")
  411. local myWindow = window.create(term.current(),1,17,51,2)
  412. myWindow.setBackgroundColor(colors.white)
  413. myWindow.clear()
  414. term.setCursorPos(5,17)
  415. shell.run ("pastebin get sc1LAE0x /pepdroll/.ucet/"..user.."/nastaveni.cfg")
  416. local myWindow = window.create(term.current(),1,17,51,2)
  417. myWindow.setBackgroundColor(colors.white)
  418. myWindow.clear()
  419. term.setCursorPos(5,17)
  420. shell.run ("pastebin get 2Rg15U0q /pepdroll/.ucet/"..user.."/user")
  421. local myWindow = window.create(term.current(),1,17,51,2)
  422. myWindow.setBackgroundColor(colors.white)
  423. myWindow.clear()
  424. prc ("Successful!", 17)
  425. heslo ()
  426. else
  427. term.setBackgroundColor(colors.white)
  428. fgc(colors.red)
  429. term.setCursorPos(5,13)
  430. prc ("Name is exists!", 17)
  431. end
  432. end
  433.  
  434.  
  435.  
  436. function heslo ()
  437. fs.delete ("/pepdroll/TEMP")
  438. local f=fs.open("pepdroll/.core/colors","r")
  439. local cnt=f.readAll()
  440. f.close()
  441. local nastaveni=textutils.unserialize(cnt)
  442.  
  443. local f=fs.open("pepdroll/.core/textcol","r")
  444. local tnt=f.readAll()
  445. f.close()
  446. local text=textutils.unserialize(tnt)
  447.  
  448. if fs.exists ("/pepdroll/TEMP/startuplog") then
  449. local data = fs.open ("/pepdroll/TEMP/startuplog", "r")
  450. login = data.readLine ()
  451. data.close ()
  452. end
  453.  
  454. local success = false
  455.  
  456. while not success do
  457.  
  458. if userI == nil then
  459. if fs.exists ("/pepdroll/.core/defuser") then
  460. local na=fs.open("/pepdroll/.core/defuser","r")
  461. userI = na.readLine ()
  462. na.close()
  463. if not fs.exists ("/pepdroll/.ucet/"..userI.."/user") then
  464. term.setCursorPos(5,13)
  465. shell.run ("pastebin get 2Rg15U0q /pepdroll/.ucet/"..userI.."/user")
  466. end
  467. userL = 1
  468. else
  469. userI = ""
  470. end
  471. end
  472.  
  473. if login == 0 then
  474.  
  475. term.setBackgroundColor(colors.white)
  476. term.setTextColor(colors.black)
  477. term.clear()
  478. local myWindow = window.create(term.current(),4,6,29,9)
  479. myWindow.setBackgroundColor(nastaveni.barva)
  480. myWindow.clear()
  481. paintutils.drawBox(3, 5, 33, 15, colors.black)
  482. if not fs.exists("/pepdroll/.core/ucet") then
  483. createAccount()
  484. local ucet = fs.open("/pepdroll/.core/ucet","w")
  485. ucet.close()
  486. end
  487. term.setCursorPos(1,17)
  488. term.setBackgroundColor(colors.red)
  489. term.setTextColor(colors.white)
  490. print " Power "
  491. pass=""
  492. term.setBackgroundColor(colors.yellow)
  493. term.setCursorPos(1,2)
  494. shell.run ("list /pepdroll/.ucet")
  495. term.setBackgroundColor(nastaveni.barva)
  496. term.setTextColor(text.barva)
  497. term.setCursorPos(5,7)
  498. print "Login"
  499. term.setCursorPos(5,9)
  500. print("User name: ")
  501. term.setCursorPos(5,11)
  502. print("Password:")
  503. term.setBackgroundColor(colors.white)
  504. term.setTextColor(colors.black)
  505. term.setCursorPos(18,9)
  506. print " "
  507. term.setCursorPos(18,11)
  508. print " "
  509. term.setCursorPos(18,13)
  510. print "Login"
  511. term.setCursorPos(18,9)
  512. print (userI)
  513. if passI == "" then
  514. term.setCursorPos(18,11)
  515. print ""
  516. else
  517. term.setCursorPos(18,11)
  518. print "Password"
  519. end
  520.  
  521.  
  522.  
  523.  
  524. if userL == 1 then
  525. if fs.exists ("/pepdroll/.ucet/"..userI.."/user") then
  526. local logouser = paintutils.loadImage("/pepdroll/.ucet/"..userI.."/user")
  527. paintutils.drawImage(logouser, 36, 6)
  528. paintutils.drawBox(35, 5, 48, 15, colors.black)
  529. paintutils.drawFilledBox(40, 12, 43, 14, nastaveni.barva)
  530. paintutils.drawFilledBox(37, 12, 38, 14, nastaveni.barva)
  531. paintutils.drawFilledBox(45, 12, 46, 14, nastaveni.barva)
  532. paintutils.drawPixel(39, 12, nastaveni.barva)
  533. paintutils.drawPixel(44, 12, nastaveni.barva)
  534. else
  535. paintutils.drawBox(35, 5, 48, 15, colors.black)
  536. paintutils.drawFilledBox(40, 12, 43, 14, nastaveni.barva)
  537. paintutils.drawFilledBox(37, 12, 38, 14, nastaveni.barva)
  538. paintutils.drawFilledBox(45, 12, 46, 14, nastaveni.barva)
  539. paintutils.drawPixel(39, 12, nastaveni.barva)
  540. paintutils.drawPixel(39, 13, colors.gray)
  541. paintutils.drawPixel(39, 14, colors.gray)
  542. paintutils.drawPixel(44, 13, colors.gray)
  543. paintutils.drawPixel(44, 14, colors.gray)
  544. paintutils.drawPixel(44, 12, nastaveni.barva)
  545. paintutils.drawPixel(41, 11, colors.orange)
  546. paintutils.drawPixel(42, 11, colors.orange)
  547. paintutils.drawFilledBox(38, 7, 45, 10, colors.brown)
  548. paintutils.drawFilledBox(39, 8, 44, 10, colors.orange)
  549. paintutils.drawPixel(39, 8, colors.brown)
  550. paintutils.drawPixel(44, 8, colors.brown)
  551. paintutils.drawPixel(40, 9, colors.lightBlue)
  552. paintutils.drawPixel(43, 9, colors.lightBlue)
  553. end
  554.  
  555.  
  556. end
  557.  
  558.  
  559. elseif login == 1 then
  560. term.setTextColor(colors.white)
  561. if userL == 1 then
  562. if not fs.exists ("/pepdroll/.ucet/"..userI.."/user") then
  563. shell.run ("pastebin get 2Rg15U0q ", "/pepdroll/.ucet/"..userI.."/user")
  564. os.reboot ()
  565. end
  566.  
  567. local logouser = paintutils.loadImage("/pepdroll/.ucet/"..userI.."/user")
  568. paintutils.drawImage(logouser, 36, 6)
  569. paintutils.drawBox(35, 5, 48, 15, colors.black)
  570. paintutils.drawFilledBox(40, 12, 43, 14, nastaveni.barva)
  571. paintutils.drawFilledBox(37, 12, 38, 14, nastaveni.barva)
  572. paintutils.drawFilledBox(45, 12, 46, 14, nastaveni.barva)
  573. paintutils.drawPixel(39, 12, nastaveni.barva)
  574. paintutils.drawPixel(44, 12, nastaveni.barva)
  575. end
  576. end
  577.  
  578. while true do
  579. local event, button, x, y = os.pullEvent("mouse_click")
  580. xy = x..","..y
  581.  
  582. if x >= 1 and x <= 7 and y == 17 and button == 1 then
  583. hotrezimy ()
  584. elseif x >= 18 and x <= 26 and y == 9 and button == 1 then
  585. term.setBackgroundColor(colors.lightGray)
  586. term.setTextColor(colors.white)
  587. term.setCursorPos(18,9)
  588. print " "
  589. term.setCursorPos(18,9)
  590. userI = read()
  591. term.setBackgroundColor(colors.white)
  592. term.setTextColor(colors.black)
  593. term.setCursorPos(18,9)
  594. print " "
  595. term.setCursorPos(18,9)
  596. print (userI)
  597. if userI == "" then
  598. uzivatel = "None"
  599. elseif userI == " " then
  600. uzivatel = "None"
  601. else
  602. uzivatel = (userI)
  603. login = 1
  604. heslo ()
  605. end
  606. elseif x >= 18 and x <= 26 and y == 11 and button == 1 then
  607. term.setBackgroundColor(colors.lightGray)
  608. term.setTextColor(colors.white)
  609. term.setCursorPos(18,11)
  610. print " "
  611. term.setCursorPos(18,11)
  612. passI = read("@")
  613. term.setBackgroundColor(colors.white)
  614. term.setTextColor(colors.black)
  615. term.setCursorPos(18,11)
  616. print " "
  617. term.setCursorPos(18,11)
  618. print "Password"
  619. login = 1
  620. heslo ()
  621. end
  622.  
  623. if x >= 18 and x <= 26 and y == 13 and button == 1 then
  624. login = 0
  625. if userI == "" then
  626. login = 1
  627. heslo ()
  628. elseif userI == " " then
  629. login = 1
  630. heslo ()
  631. end
  632.  
  633. if not fs.exists("/pepdroll/.ucet/"..userI) then
  634. term.setBackgroundColor(colors.white)
  635. fgc(colors.red)
  636. term.setCursorPos(5,13)
  637. prc ("Login failed: User not exists!", 17)
  638. passI = ""
  639. sleep (1)
  640. login = 0
  641. heslo ()
  642. end
  643.  
  644. if fs.isDir("/pepdroll/.ucet/"..userI) then
  645. if fs.exists("/pepdroll/.ucet/"..userI.."/.data") then
  646. data = fs.open("/pepdroll/.ucet/"..userI.."/.data","r")
  647. userO = data.readLine()
  648. passO = data.readLine()
  649. end
  650. if userI == userO and passI == passO then
  651. term.setBackgroundColor(colors.white)
  652. term.setCursorPos(6,13)
  653. fgc(colors.lime)
  654. prc ("Login successful!", 17)
  655. user = userI
  656. userDir = "/pepdroll/.ucet/"..userI
  657. success = true
  658. sleep (1)
  659. uss = userI
  660. data = fs.open ("/pepdroll/.core/defuser", "w")
  661. data.writeLine (user)
  662. data.close ()
  663. if not fs.exists ("/pepdroll/.ucet/"..userI.."/user") then
  664. term.setCursorPos(5,17)
  665. shell.run ("pastebin get 2Rg15U0q /pepdroll/.ucet/"..user.."/user")
  666. end
  667. vitejte ()
  668. else
  669. term.setBackgroundColor(colors.white)
  670. fgc(colors.red)
  671. term.setCursorPos(5,13)
  672. prc ("Login failed: Incorrect Username or Password!", 18)
  673. passI = ""
  674. sleep (1)
  675. login = 0
  676. heslo ()
  677. end
  678. end
  679. end
  680. end
  681. end
  682. end
  683.  
  684. function vitejte ()
  685. term.setBackgroundColor(colors.white)
  686. term.setTextColor(colors.black)
  687. term.clear ()
  688. data = fs.open ("/pepdroll/TEMP/user", "w")
  689. data.writeLine (user)
  690. data.writeLine (pass)
  691. data.close ()
  692. prc ("Welcome", 9)
  693. sleep (1)
  694. shell.run ("cd /pepdroll")
  695. term.setTextColor(colors.white)
  696. shell.run ("pastebin run x3Ea9Ywm")
  697.  
  698. if not fs.exists ("/pepdroll/recovery/bluescreen") then
  699. shell.run ("pastebin get firAx0rz /pepdroll/recovery/bluescreen")
  700. end
  701.  
  702. fs.delete("/pepdroll/TEMP/bluescreen")
  703. shell.run ("/pepdroll/recovery/bluescreen")
  704. end
  705.  
  706. function hotrezimy ()
  707. local myWindow = window.create(term.current(),2,17,12,9)
  708. myWindow.setBackgroundColor(colors.gray)
  709. myWindow.clear()
  710. local myWindow = window.create(term.current(),1,16,12,19)
  711. myWindow.setBackgroundColor(colors.lightBlue)
  712. myWindow.clear()
  713. term.setTextColor(colors.white)
  714. paintutils.drawPixel(1, 17, colors.red)
  715. term.setCursorPos(1,17)
  716. print "<"
  717. paintutils.drawLine(2, 17, 11, 17, colors.orange)
  718. term.setCursorPos(2,17)
  719. print "Restart"
  720. paintutils.drawLine(2, 18, 11, 18, colors.red)
  721. term.setCursorPos(2,18)
  722. print "Shut down"
  723.  
  724. while true do
  725. local event, button, x, y = os.pullEvent("mouse_click")
  726. xy = x..","..y
  727.  
  728. if x == 1 and y == 18 and button == 1 then
  729. heslo ()
  730. elseif x >= 2 and x <= 11 and y == 17 and button == 1 then
  731. restart ()
  732. elseif x >= 2 and x <= 11 and y == 18 and button == 1 then
  733. vypnout ()
  734. else
  735. heslo ()
  736. end
  737. end
  738. end
  739.  
  740. function vypnout ()
  741. term.setBackgroundColor(colors.lightGray)
  742. term.clear()
  743. sleep (0.1)
  744. term.setBackgroundColor(colors.gray)
  745. term.clear()
  746. sleep (0.1)
  747. term.setBackgroundColor(colors.white)
  748. term.setTextColor(colors.black)
  749. term.clear()
  750. term.setCursorPos(23, 7)
  751. prc "Shutting down..."
  752. term.setBackgroundColor(colors.white)
  753. term.setTextColor(colors.blue)
  754. term.setCursorPos(20,18)
  755. print" Pepek"
  756. term.setCursorPos(28,18)
  757. print"Soft "
  758. term.setCursorPos(27,18)
  759. term.setTextColor(colors.lime)
  760. print"@"
  761. sleep (2)
  762. local data = fs.open ("/pepdroll/TEMP/vypnuto", "w")
  763. data.close ()
  764. os.shutdown ()
  765. end
  766.  
  767. function restart ()
  768. term.setBackgroundColor(colors.white)
  769. term.setTextColor(colors.black)
  770. term.clear()
  771. term.setCursorPos(23, 7)
  772. prc "Restarting..."
  773. term.setBackgroundColor(colors.white)
  774. term.setTextColor(colors.blue)
  775. term.setCursorPos(20,18)
  776. print" Pepek"
  777. term.setCursorPos(28,18)
  778. print"Soft "
  779. term.setCursorPos(27,18)
  780. term.setTextColor(colors.lime)
  781. print"@"
  782. sleep (1)
  783. local data = fs.open ("/pepdroll/TEMP/vypnuto", "w")
  784. data.close ()
  785. os.reboot ()
  786. end
  787.  
  788. function start ()
  789. term.clear ()
  790. prc ("Pepdroll boot pepdroll", 3)
  791. term.setCursorPos (5,19)
  792. write "Press any key for run CraftOS"
  793. local FileList = fs.list("")
  794. x = 5
  795. y = 5
  796.  
  797. for _, folder in ipairs(FileList) do
  798. term.setCursorPos (x,y)
  799. if y == 10 then
  800. y = 5
  801. x = x + 10
  802. else
  803. y = y+1
  804. end
  805. print(folder)
  806. sleep (0.2)
  807. end
  808.  
  809. while true do
  810. os.startTimer(0.2)
  811. local event = os.pullEvent()
  812. if event == "timer" then
  813. kontrola ()
  814. else
  815. term.setCursorPos (1,1)
  816. term.clear ()
  817. print "Craft OS"
  818. break
  819. end
  820. end
  821. end
  822.  
  823. start ()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement