Advertisement
pepeknamornik

Pepdroll six Start-Pro 2300

May 31st, 2015
445
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 105.74 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2. local verze = "2300"
  3. local w,h = term.getSize()
  4. local fgc = term.setTextColor
  5. local bgc = term.setBackgroundColor
  6. local user
  7. local userDir
  8. local sDrive = nil
  9. local tArgs = { ... }
  10. local chybas = 0
  11. local arg={...}--command line arguments
  12. local opravak = 0
  13. local vsechno = 0
  14. local nastavenis = 0
  15. local stavlogon = 0
  16. local nula = 0
  17. local proc = 6.25
  18. local expr
  19. local spacechars = " \t\n\r"
  20. local anim = 1
  21. local rezim = 0
  22. local login = 0
  23. local userI = "Guest"
  24. local passI = ""
  25. local userO = ""
  26. local passO = ""
  27. local data = ""
  28. local user = 0
  29. local pass = ""
  30. local computerpass = ""
  31. local f = fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  32. local jazyk = en
  33. local hesla = 0
  34. local heslo1 = ""
  35. local heslo2 = ""
  36. local heslo3 = ""
  37. local bios = 1
  38.  
  39. local function openRednet()
  40.   for _,side in ipairs({"top", "bottom", "front", "left", "right", "back"}) do
  41.     if peripheral.isPresent(side) and peripheral.getType(side) == "modem" then
  42.       rednet.open(side)
  43.       local modem = peripheral.wrap(side)
  44.       modem.open(5)
  45.       return side
  46.     end
  47.   end
  48. end
  49.  
  50. local function closeRednet()
  51.   for _,side in ipairs({"top", "bottom", "front", "left", "right", "back"}) do
  52.     if peripheral.isPresent(side) and peripheral.getType(side) == "modem" then
  53.       rednet.close(side)
  54.       local modem = peripheral.wrap(side)
  55.       modem.close(5)
  56.       return side
  57.     end
  58.   end
  59. end
  60.  
  61. local function prc(text, y)
  62.   local w = term.getSize()
  63.   local _, cy = term.getCursorPos()
  64.   term.setCursorPos(math.ceil((w-#text)/2), y or cy)
  65.   write(text)
  66. end
  67.  
  68. function kalkulacka ()
  69.  
  70. local function skipspaces()
  71.  while spacechars:find(expr:sub(1, 1),1,true) ~= nil and expr:len() > 0 do
  72.   expr = expr:sub(2)
  73.  end
  74. end
  75.  
  76. local function acceptch(ch)
  77.  skipspaces()
  78.  if expr:sub(1,1) == ch then
  79.   expr = expr:sub(2)
  80.   return true
  81.  else
  82.   return false
  83.  end
  84. end
  85.  
  86. local function acceptnum()
  87.  skipspaces()
  88.  -- I'm sure there's a better way
  89.  for len = expr:len(), 1, -1 do
  90.   local success, n = pcall(tonumber, expr:sub(1, len))
  91.   if success and n ~= nil then
  92.    expr = expr:sub(len + 1)
  93.    return n
  94.   end
  95.  end
  96.  return nil
  97. end
  98.  
  99. local alpha = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
  100. local alnum = alpha .. "0123456789"
  101.  
  102. local function acceptident()
  103.  local n = 0
  104.  skipspaces()
  105.  if alpha:find(expr:sub(1, 1),1,true) == nil then return nil end
  106.  while alnum:find(expr:sub(n+1, n+1),1,true) ~= nil and expr:len() > n do
  107.   n = n + 1
  108.  end
  109.  local ident = expr:sub(1, n)
  110.  expr = expr:sub(n+1)
  111.  return ident
  112. end
  113.  
  114. local function parse_error(s)
  115.  error(s and ("parse error: " .. s) or "parse error")
  116. end
  117.  
  118. local expression_root
  119.  
  120. local math_functions = {
  121. abs = math.abs,
  122. acos = math.acos,
  123. asin = math.asin,
  124. atan = math.atan,
  125. atan2 = math.atan2,
  126. ceil = math.ceil,
  127. floor = math.floor,
  128. cos = math.cos,
  129. sin = math.sin,
  130. tan = math.tan,
  131. cosh = math.cosh,
  132. sinh = math.sinh,
  133. tanh = math.tanh,
  134. -- math.deg, math.rad
  135. exp = math.exp,
  136. ln = math.log,
  137. log = math.log10,
  138. pow = math.pow,
  139. min = math.min,
  140. max = math.max,
  141. sqrt = math.sqrt,
  142. random = math.random
  143. }
  144.  
  145. local math_constants = {
  146. pi = math.pi,
  147. e = math.exp(1),
  148. inf = math.huge,
  149. nan = math.huge - math.huge
  150. }
  151.  
  152. local function call_function(id, arglist)
  153.  if math_functions[id] == nil then
  154.   error("no such function: " .. id)
  155.  end
  156.  return math_functions[id](unpack(arglist))
  157. end
  158.  
  159. local function get_constant(id)
  160.  return math_constants[id] or error("no such constant: "..id)
  161. end
  162.  
  163. local function num_or_brackets()
  164.  if acceptch("(") then
  165.   local n = expression_root()
  166.   if not acceptch(")") then parse_error("non-matching parentheses") end
  167.   return n
  168.  elseif acceptch("-") then
  169.   return -expression_root()
  170.  else
  171.   local id = acceptident()
  172.   if id ~= nil then
  173.    if not acceptch("(") then
  174.     return get_constant(id)
  175.    elseif acceptch(")") then
  176.     return call_function(id, {})
  177.    else
  178.     local arglist = {}
  179.     local done = false
  180.     while not done do
  181.      table.insert(arglist, expression_root())
  182.      if acceptch(")") then
  183.       done = true
  184.      elseif not acceptch(",") then
  185.       parse_error("expected , or )")
  186.      end
  187.     end
  188.     return call_function(id, arglist)
  189.    end
  190.   else
  191.    local n = acceptnum()
  192.    if n == nil then parse_error("expected number or bracketed expression") end
  193.    return n
  194.   end
  195.  end
  196. end
  197.  
  198. local function division()
  199.  local n1 = num_or_brackets()
  200.  while acceptch("/") do
  201.   n1 = n1 / num_or_brackets()
  202.  end
  203.  return n1
  204. end
  205.  
  206. local function multiplication()
  207.  local n1 = division()
  208.  while acceptch("*") do
  209.   n1 = n1 * division()
  210.  end
  211.  return n1
  212. end
  213. local function subtraction()
  214.  local n1 = multiplication()
  215.  while acceptch("-") do
  216.   n1 = n1 - multiplication()
  217.  end
  218.  return n1
  219. end
  220. local function addition()
  221.  local n1 = subtraction()
  222.  while acceptch("+") do
  223.   n1 = n1 + subtraction()
  224.  end
  225.  return n1
  226. end
  227. expression_root = addition
  228.  
  229. local function parse(e)
  230.  expr = e
  231.  local success, result = pcall(expression_root)
  232.  if success and expr ~= "" then
  233.   print("Garbage after expression?")
  234.  end
  235.  if success then
  236.   print("= " .. tostring(result))
  237.  else
  238.   print(result)
  239.   print("Near: " .. (expr == "" and "end of expression" or expr))
  240.  end
  241. end
  242.  
  243. local function mainloop()
  244.    term.setCursorPos(17,12)
  245. term.setBackgroundColor(colors.white)
  246. term.setTextColor(colors.black)
  247. term.clear ()
  248.  local quitting = false
  249. prc (var1, 10)
  250. print ""
  251.  while not quitting do
  252.   local line = io.read()
  253.   if line == "quit" then
  254.    plocha ()
  255.    quitting = true
  256.   else
  257.    parse(line)
  258.    print("")
  259.   end
  260.  end
  261. end
  262.  
  263. mainloop ()
  264.  
  265. end
  266.  
  267. function rozhodnutiins ()
  268. if not fs.exists("/.core/cmh") then
  269. instalace ()
  270. elseif not fs.exists("/.core/biosset") then
  271. instalace ()
  272. elseif not fs.exists("/.core/shell") then
  273. instalace ()
  274. else
  275. data = fs.open("/.core/cmh","r")
  276. computerpass = data.readLine()
  277. data.close()
  278. shell.run ("delete /.core/cmh")
  279. data = fs.open("/.core/cmh","w")
  280. data.writeLine(computerpass)
  281. data.close()
  282. end
  283. data = fs.open("/.core/cmh","r")
  284. computerpass = data.readLine()
  285. data.close()
  286.     if not fs.exists("/startup") then
  287.         instalace ()
  288.         else
  289.         systems ()
  290.     end
  291. end
  292.  
  293. function instalace ()
  294. term.setBackgroundColor(colors.purple)
  295. term.setTextColor(colors.white)
  296. term.clear()
  297. prc ("Pepdroll Six Pro Install", 2)
  298. term.setCursorPos(5,3)
  299. prc ("please select instalation language", 6)
  300. prc ("EN  /  CZ", 7)
  301. while true do
  302. local event, button, x, y = os.pullEvent("mouse_click")
  303. xy = x..","..y
  304.  
  305. if x >= 21 and x <= 23 and y == 7 and button == 1 then
  306. term.setCursorPos(1,11)
  307. jazyk = en
  308. fs.delete ("/.core/language")
  309. shell.run ("pastebin get sh70PdPx /.core/language")
  310. break
  311. end
  312.  
  313. if x >= 27 and x <= 29 and y == 7 and button == 1 then
  314. term.setCursorPos(1,11)
  315. jazyk = ("cz")
  316. fs.delete ("/.core/language")
  317. shell.run ("pastebin get g8w9iiQj /.core/language")
  318. break
  319. end
  320. end
  321. term.setCursorPos(14,10)
  322. term.setBackgroundColor(colors.lightBlue) ----------
  323. textutils.slowPrint ("         Downloading         ")
  324. term.setBackgroundColor(colors.purple)
  325. term.setTextColor(colors.white)
  326. term.clear()
  327. prc ("Pepdroll Six Install", 2)
  328. if jazyk == ("cz") then
  329. prc ("Vitejte v PepSys", 4)
  330. term.setCursorPos(1,6)
  331. print "+ Jednoduchy operacni system."
  332. print "+ System, ktery se prizpusobi."
  333. print "+ Vhodne pro vetsinu pocitacu."
  334. print "+ Ceska kvalita."
  335. print "+ Pro vice uzivatelu."
  336. print "+ Rychla prace."
  337. prc ("-------------------", 13)
  338. prc ("Chcete instalovat nyni?", 14)
  339. prc ("  Ano             Ne  ", 16)
  340. else
  341. prc ("Welcome to PepSys", 4)
  342. term.setCursorPos(1,6)
  343. print "+ Easy operating system."
  344. print "+ A system which will adapted."
  345. print "+ Suitable for most computers."
  346. print "+ Czech quality."
  347. print "+ Many uses for you."
  348. print "+ Speed works."
  349. prc ("-------------------", 13)
  350. prc ("Do you want install ?", 14)
  351. prc ("  Yes             No  ", 16)
  352. end
  353.  
  354. term.setCursorPos(45,17)
  355. if #tArgs > 0 then
  356.         sDrive = tostring( tArgs[1] )
  357. end
  358.  
  359. if sDrive == nil then
  360.         print( "ID "..os.getComputerID() )
  361.        
  362.         local label = os.getComputerLabel()
  363.         if label then
  364.         term.setCursorPos(6,18)
  365.         term.setTextColor(colors.white)
  366.                 print( " Label \""..label.."\"" )
  367.         end
  368. end
  369. while true do
  370. local event, button, x, y = os.pullEvent("mouse_click")
  371. xy = x..","..y
  372.  
  373. if x >= 17 and x <= 18 and y == 16 and button == 1 then
  374. stavba ()
  375. break
  376. end
  377.  
  378. if x >= 33 and x <= 34 and y == 16 and button == 1 then
  379. term.setBackgroundColor(colors.black)
  380. term.setTextColor(colors.white)
  381. term.clear ()
  382. term.setCursorPos(1,1)
  383. break
  384. end
  385. end
  386. end
  387.  
  388. function stavba ()
  389. term.setBackgroundColor(colors.purple)
  390. term.setTextColor(colors.white)
  391. term.clear()
  392. prc ("Pepdroll Six Pro Install", 2)
  393. prc ("System will be instaled to you PC", 4)
  394. term.setCursorPos (5,7)
  395. if jazyk == ("cz") then
  396. print "nove pocitacove heslo"
  397. else
  398. print "new computer password"
  399. end
  400. term.setCursorPos (5,8)
  401. term.setBackgroundColor(colors.white)
  402. term.setTextColor(colors.black)
  403. print "               "
  404. term.setCursorPos (5,8)
  405. computerpass = read ("@")
  406. term.setBackgroundColor(colors.purple)
  407. term.setTextColor(colors.white)
  408. term.clear()
  409.  
  410. prc ("Pepdroll Six Pro Install", 2)
  411. if jazyk == ("cz") then
  412. prc ("System se nainstaluje do vaseho pocitace", 4)
  413. else
  414. prc ("System will be instaled to you PC", 4)
  415. end
  416. term.setCursorPos(14,10)
  417. term.setBackgroundColor(colors.lightBlue)
  418. textutils.slowPrint ("         "..proc.." %        ")-- 6.25
  419. proc = (proc+6.25)
  420. term.setCursorPos(14,10)
  421. term.setBackgroundColor(colors.lightGray)
  422. textutils.slowPrint ("         "..proc.." %        ")-- 12.5
  423. proc = (proc+6.25)
  424. term.setBackgroundColor(colors.purple)
  425.         term.setCursorPos(1,11)
  426.         print "                                       "
  427.         print "                                       "
  428.         term.setCursorPos(1,11)
  429. shell.run ("delete startup")
  430. shell.run ("pastebin get ttiWhJPk startup")
  431.         if not fs.exists("/.core/cmh") then
  432.             data = fs.open("/.core/cmh","w")
  433.             data.writeLine(computerpass)
  434.             data.close()
  435.         end
  436. term.setCursorPos(14,10)
  437. term.setBackgroundColor(colors.lightBlue)
  438. textutils.slowPrint ("         "..proc.." %       ")-- 18,75
  439. proc = (proc+6.25)
  440. term.setBackgroundColor(colors.purple)
  441.         term.setCursorPos(1,11)
  442.         print "                                       "
  443.         print "                                       "
  444.         print "                                       "
  445.         print "                                       "
  446.         term.setCursorPos(1,11)
  447.         shell.run ("pastebin get 1QjZQzuN /np")
  448. term.setCursorPos(14,10)
  449. term.setBackgroundColor(colors.lightGray)
  450. textutils.slowPrint ("         "..proc.." %          ")-- 25
  451. proc = (proc+6.25)
  452. term.setBackgroundColor(colors.purple)
  453.         term.setCursorPos(1,11)
  454.         print "                                       "
  455.         print "                                       "
  456.         term.setCursorPos(1,11)
  457.         shell.run ("pastebin get tbnzb7rH /ink")
  458. term.setCursorPos(14,10)
  459. term.setBackgroundColor(colors.lightBlue)
  460. textutils.slowPrint ("         "..proc.." %       ")-- 31,25
  461. proc = (proc+6.25)
  462. term.setBackgroundColor(colors.purple)
  463.         term.setCursorPos(1,11)
  464.         print "                                       "
  465.         print "                                       "
  466.         term.setCursorPos(1,11)
  467.         shell.run ("pastebin get zGtP59jJ /.core/paint")
  468. term.setCursorPos(14,10)
  469. term.setBackgroundColor(colors.lightGray)
  470. textutils.slowPrint ("         "..proc.." %        ")-- 37,5
  471. proc = (proc+6.25)
  472. term.setBackgroundColor(colors.purple)
  473.         term.setCursorPos(1,11)
  474.         print "                                       "
  475.         print "                                       "
  476.         local proc = (proc+12)
  477.         shell.run ("pastebin get 4bRDGg0P /.core/shell")
  478. term.setCursorPos(14,10)
  479. term.setBackgroundColor(colors.lightBlue)
  480. textutils.slowPrint ("         "..proc.." %       ")-- 55,75
  481. proc = (proc+6.25)
  482. term.setBackgroundColor(colors.purple)
  483.         term.setCursorPos(1,11)
  484.         print "                                       "
  485.         print "                                       "
  486.         proc = (proc+13)
  487.         shell.run ("pastebin get SDu2A1WG /system")
  488.         term.setCursorPos(14,10)
  489. term.setBackgroundColor(colors.lightGray)
  490. textutils.slowPrint ("         "..proc.." %          ")-- 75
  491. proc = (proc+6.25)
  492. term.setBackgroundColor(colors.purple)
  493.         term.setCursorPos(1,11)
  494.         print "                                       "
  495.         print "                                       "
  496.         term.setCursorPos(1,11)
  497.         print "                                       "
  498.         print "                                       "
  499.         if jazyk == ("cz") then
  500.         prc ("priprava plochy a nastaveni", 12)
  501.         else
  502.         prc ("preparation desktop and setting",12)
  503.         end
  504. term.setCursorPos(14,10)
  505. term.setBackgroundColor(colors.lightBlue)
  506. textutils.slowPrint ("         "..proc.." %       ")-- 81,25
  507. proc = (proc+18.75)
  508. term.setBackgroundColor(colors.purple)
  509.         sleep (0.5)
  510. term.setCursorPos(14,10)
  511. term.setBackgroundColor(colors.lightGray)
  512. textutils.slowPrint ("         "..proc.." %         ")-- 100
  513. term.setBackgroundColor(colors.purple)
  514.         if jazyk == ("cz") then
  515.         prc ("Instalace hotova.", 16)
  516.         prc ("Pocitac bude restartovan", 17)
  517.         else
  518.         prc ("Instalation complete.", 16)
  519.         prc ("Computer will be restarted.", 17)
  520.         end
  521.        
  522.         disk.eject("top")
  523.         disk.eject("left")
  524.         disk.eject("right")
  525.         disk.eject("back")
  526.         disk.eject("bottom")
  527.         disk.eject("forward")
  528.         sleep (3)
  529.         os.reboot()
  530. end
  531.  
  532.  
  533.  
  534. function chyba ()
  535. term.setBackgroundColor(colors.blue)
  536. term.setTextColor(colors.yellow)
  537. term.clear()
  538. prc (var2)
  539. term.setCursorPos(5,4)
  540. term.setTextColor(colors.red)
  541. term.setBackgroundColor(colors.white)
  542. prc (var8.." ".. chybas, 6)
  543. term.setBackgroundColor(colors.blue)
  544. term.setTextColor(colors.yellow)
  545.  
  546. if vsechno == 1 then
  547. opravaks ()
  548. elseif vsechno == 0 then
  549. prc (var4, 10)
  550. prc (var9, 12)
  551. term.setCursorPos(45,17)
  552. if #tArgs > 0 then
  553.     sDrive = tostring( tArgs[1] )
  554. end
  555.  
  556. if sDrive == nil then
  557.     print( "ID "..os.getComputerID() )
  558.    
  559.     local label = os.getComputerLabel()
  560.     if label then
  561.     term.setCursorPos(6,18)
  562.         print( " Label \""..label.."\"" )
  563.     end
  564.  
  565. else
  566.     local bData = disk.hasData( sDrive )
  567.     if not bData then
  568.         print( "No disk in drive "..sDrive )
  569.         return
  570.     end
  571.     term.setCursorPos(32,18)
  572.     print( "ID disk #"..disk.getID( sDrive ) )
  573.  
  574.     local label = disk.getLabel( sDrive )
  575.     if label then
  576.         print( "The disk is labelled \""..label.."\"" )
  577.     end
  578. end
  579. end
  580. while true do
  581. local event, button, x, y = os.pullEvent("mouse_click")
  582. xy = x..","..y
  583.  
  584. if x >= 17 and x <= 18 and y == 12 and button == 1 then
  585. oprava = 1
  586. break
  587. end
  588.  
  589. if x >= 32 and x <= 33 and y == 12 and button == 1 then
  590. oprava = 0
  591. break
  592. end
  593.  
  594. if x >= 25 and x <= 27 and y == 12 and button == 1 then
  595. vsechno = 1
  596. chyba ()
  597. break
  598. end
  599. end
  600.  
  601.  
  602. if oprava == 1 then
  603. opravaks ()
  604. elseif oprava == 0 then
  605. os.reboot ()
  606. end
  607. end
  608.  
  609.  
  610. function systems ()
  611. if not fs.exists("/startup") then
  612. instalace ()
  613. elseif not fs.exists("/.core/logon.cfg") then
  614.     local o=fs.open("//.core/logon.cfg","w")
  615.     o.write(textutils.serialize(nula))
  616.     o.close()
  617.     systems ()
  618. elseif not fs.exists("/ink") then
  619. chybas = "ink"
  620. chyba ()
  621. elseif not fs.exists("/np") then
  622. chybas = "np"
  623. chyba ()
  624. elseif not fs.exists("/.core/paint") then
  625. chybas = "paint"
  626. chyba ()
  627. else
  628. spousteni1 ()
  629. end
  630. end
  631.  
  632. function kontrolovani ()
  633. prc "kontrola"
  634. systems ()
  635. end
  636.  
  637.  
  638. function opravaks ()
  639. term.setBackgroundColor(colors.blue)
  640. term.setTextColor(colors.yellow)
  641. term.clear()
  642. term.setCursorPos(5,4)
  643. print (var10)
  644. term.setCursorPos(13,4)
  645. print (chybas)
  646. term.setCursorPos(5,6)
  647. if chybas == ("startup") then
  648. shell.run ("delete startup")
  649. instalace ()
  650. elseif chybas == ("np") then
  651. shell.run ("pastebin get 1QjZQzuN /np")
  652. elseif chybas == ("ink") then
  653. shell.run ("pastebin get tbnzb7rH /ink")
  654. elseif chybas == ("bar.nfp") then
  655. shell.run ("pastebin get vm1p8DXs /bar.nfp")
  656. elseif chybas == ("paint") then
  657. shell.run ("pastebin get zGtP59jJ /.core/paint")
  658. elseif chybas == ("nastaveni.cfg") then
  659. shell.run ("pastebin get sc1LAE0x /.core/nastaveni.cfg")
  660. shell.run ("delete startup")
  661. shell.run ("pastebin get 3R3M6XeK startup")
  662. end
  663. sleep (2)
  664. if opravak == 0 then
  665. kontrolovani ()
  666. elseif opravak == 1 then
  667. kontrolovani ()
  668. term.setBackgroundColor(colors.blue)
  669. term.setTextColor(colors.yellow)
  670. term.clear()
  671. prc ("No problem", 10)
  672. sleep (1)
  673. plocha ()
  674. end
  675. end
  676.  
  677. function web ()
  678. term.setBackgroundColor(colours.white)
  679. term.setTextColor(colours.black)
  680. term.clear()
  681. term.setCursorPos(1,1)
  682. term.setCursorBlink(false)
  683. version="dynet browser 1.0"
  684. siteName=""
  685. currentSite=""
  686. siteID=-1
  687. pageName=""
  688. currentX=1
  689. currentY=1
  690. menuMode=false
  691. ddns=true
  692. ddnsID=-1
  693. webType=0--0=no site, 1=normal site, 2=menu
  694. -------------------------
  695. --web related functions--
  696. -------------------------
  697.  
  698. function whois(name)--returns ID if found, -1 if not on dns, and nil if no dns
  699.     --prevent unnecessary communication
  700.     if name~=currentSite then
  701.         if ddns==true then rednet.send(ddnsID,"@whois "..name)
  702.         else rednet.broadcast("@whois "..name) end
  703.         _,webID=rednet.receive(1)
  704.         siteID=tonumber(webID)--convert it to a number
  705.         currentSite=name
  706.     end
  707.     return siteID
  708. end
  709. function getColour(value)
  710.     --TODO prevent crashing on invalid number
  711.     number=tonumber(value)
  712.     if number==nil then--convert hexadecimal
  713.         if value=="A" then
  714.             number=10
  715.         elseif value=="B" then
  716.             number=11
  717.         elseif value=="C" then
  718.             number=12
  719.         elseif value=="D" then
  720.             number=13
  721.         elseif value=="E" then
  722.             number=14
  723.         elseif value=="F" then
  724.             number=15
  725.         else
  726.             return colours.black
  727.         end
  728.     end
  729.     return bit.blshift(1,number)
  730. end
  731. function loadPage(webID,page)
  732.     rednet.send(webID,page or "/home")
  733.     pagetext=""
  734.     for i=1,17 do
  735.         from,text=rednet.receive(0.5)
  736.         if text==nil then break end
  737.         pagetext=pagetext..text.."\n"
  738.     end
  739.    
  740.     --term.write(pagetext)--doesn't support newline apparently
  741.     --print(pagetext)
  742.     line=1
  743.     term.setCursorPos(2,line)
  744.     colourmode=0--1=^ detected 2=nextchar text 3=nextchar backround
  745.     term.setBackgroundColor(colours.white)
  746.     term.setTextColor(colours.black)
  747.     --my slow and tedious method of rendering the page
  748.     for current=1,string.len(pagetext) do
  749.         letter=string.sub(pagetext,current,current)--TODO surely an easier way?
  750.         if letter==nil then letter=" " end
  751.         if colourmode==0 then --normal
  752.             if letter=="^" then
  753.                 colourmode=1
  754.             elseif letter=="\n" then
  755.                 line=line+1--next line
  756.                 if line==17 then break end--too much! TODO tweak this value
  757.                 term.setCursorPos(2,line)
  758.                 term.setBackgroundColor(colours.white)
  759.                 term.setTextColor(colours.black)--reset colours for next line
  760.             else
  761.                 term.write(letter)--nothing special
  762.             end
  763.         elseif colourmode==1 then --might be a colour
  764.             if letter=="f" then--foreground colour
  765.                 colourmode=2--next char will set foreground
  766.             elseif letter=="b" then--background colour
  767.                 colourmode=3--next char will set background
  768.             else--not correct, probably not intended as a colour
  769.                 term.write("^"..letter)--put ^ back as well
  770.             end
  771.         elseif colourmode==2 then--set text colour
  772.             --print(letter)--debug
  773.             term.setTextColor(getColour(letter))
  774.             colourmode=0--back to normal
  775.         elseif colourmode==3 then--set background colour
  776.             term.setBackgroundColor(getColour(letter))
  777.             colourmode=0--back to normal
  778.         end
  779.     end
  780. end
  781.  
  782. -----------------
  783. --GUI functions--
  784. -----------------
  785. function drawError(text)
  786.     term.setBackgroundColor(colours.white)
  787.     term.setTextColor(colours.red)
  788.     term.setCursorPos(2,1)
  789.     term.write("ERROR:")
  790.     term.setCursorPos(2,2)
  791.     term.write(text)
  792.     webType=0
  793. end
  794. function drawButton(x,y,text,conditionA,conditionB,active)
  795.     term.setCursorPos(x,y)
  796.     if conditionA==conditionB and active then
  797.         term.setBackgroundColor(colours.grey)
  798.         term.write("[")
  799.     else
  800.         term.setBackgroundColor(colours.lightGrey)
  801.         term.write(" ")
  802.     end
  803.    
  804.     term.write(text)
  805.    
  806.     if conditionA==conditionB and active then
  807.         term.write("]")
  808.     else
  809.         --term.write(" ")
  810.     end
  811. end
  812.  
  813. function renderGUI()
  814.     --draw left bar
  815.     term.setTextColor(colours.white)
  816.     term.setBackgroundColor(colours.lightGrey)
  817.     for line=1,18 do
  818.         term.setCursorPos(1,line)
  819.         term.write(" ")
  820.     end
  821.     --draw right cursor
  822.     if menuMode==false then
  823.         term.setCursorPos(1,currentY)
  824.         term.setBackgroundColor(colours.grey)
  825.         term.write(">")
  826.     end
  827.     --draw bottom bar
  828.     term.setBackgroundColor(colours.lightGrey)
  829.     term.setCursorPos(1,19)
  830.     for line=1,51 do
  831.         term.write(" ")
  832.     end
  833.     --term.setCursorPos(1,19)
  834.     --term.write(siteName..pageName)
  835.     --draw menu bar items
  836.     drawButton(42,19,"refresh",currentX,3,menuMode)
  837.     drawButton(36,19,"quit",currentX,2,menuMode)
  838.     drawButton(1,19,siteName..pageName,currentX,1,menuMode)
  839. end
  840.  
  841. function popup(text)--a nice GUI popup asking for text
  842. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  843. local cnt=f.readAll()
  844. f.close()
  845. local nastaveni = textutils.unserialize(cnt)
  846. term.setBackgroundColor(nastaveni.barva)
  847.     term.setTextColor(colours.white)
  848.     term.setCursorPos(7,5)
  849.     term.setBackgroundColor(nastaveni.barva)
  850.     for y=5,13 do
  851.         term.setCursorPos(7,y)
  852.         for x=7,47 do
  853.             if y==8 then--user input row
  854.                 if x==7 or x== 47 then
  855.                     term.setBackgroundColor(colours.lightGrey)
  856.                 else
  857.                     term.setBackgroundColor(colours.grey)
  858.                 end
  859.             end
  860.             term.write(" ")
  861.         end
  862.         term.setBackgroundColor(colours.lightGrey)
  863.     end
  864.     --finished drawing window. add text
  865.     term.setBackgroundColor(nastaveni.barva)
  866.     term.setCursorPos(7,5)--TODO: center text
  867.     term.write(text)
  868.     term.setBackgroundColor(colours.grey)
  869.     term.setCursorPos(8,8)
  870.     return io.read()
  871. end
  872.  
  873. function refresh()
  874.     webType=1--website
  875.     term.setTextColor(colours.black)
  876.     term.setBackgroundColor(colours.white)
  877.    
  878.     term.clear()
  879.     term.setCursorPos(1,1)
  880.    
  881.     renderGUI()
  882.    
  883.     webID=whois(siteName)
  884.     if webID==nil or webID==-1 then--find what went wrong
  885.             if webID==nil and ddns==false then drawError("server not found (spelt wrong?)")
  886.         elseif webID==nil and ddns==true then drawError("no response from ddns")
  887.         elseif webID==-1 and ddns==true then drawError("site not found on ddns (spelt wrong?)")
  888.         else drawError("I honestly have no idea what happened") end
  889.        
  890.     else loadPage(webID,pageName) end
  891.    
  892.     renderGUI()
  893. end
  894. -------------------
  895. --other functions--
  896. -------------------
  897. function getDeviceSide(deviceType)
  898.   -- List of all sides
  899.   local lstSides = {"left","right","top","bottom","front","back"};
  900.   -- Now loop through all the sides
  901.   for i, side in pairs(lstSides) do
  902.     if (peripheral.isPresent(side)) then
  903.       -- Yup, there is something on this side
  904.       if (peripheral.getType(side) == string.lower(deviceType)) then
  905.         -- Yes, this is the device type we need, so return the side
  906.         return side;
  907.       end
  908.     end
  909.   end
  910.   --nothing found, return nill
  911.   return nil;
  912. end
  913. function split(text,splitAt)
  914.     state=false
  915.     outA=""
  916.     outB=""
  917.     for i=1,string.len(text) do
  918.         if string.sub(text,i,i)==splitAt then
  919.             state=true
  920.         end
  921.         if state==false then
  922.             outA=outA..string.sub(text,i,i)
  923.         else
  924.             outB=outB..string.sub(text,i,i)
  925.         end
  926.     end
  927.     return outA,outB
  928. end
  929. --like split, but removes extra char
  930. function split2(text,splitAt)
  931.     outA,outB=split(text,splitAt)
  932.     outB=string.sub(outB,2,-1)--remove first char (= to splitAt)
  933.     return outA,outB
  934. end
  935.  
  936. function interpret(text)
  937.     command,args=split2(text,":")
  938.     if command=="glob" then
  939.         siteName,pageName=split2(args,"/")
  940.         pageName="/"..pageName
  941.         refresh()
  942.     end
  943.     if command=="loc" then
  944.         pageName="/"..args
  945.         refresh()
  946.     end
  947.     if command=="ref" then
  948.         refresh()
  949.     end
  950.     if command=="ask" then
  951.         arg1,arg2=split2(args,":")--expected format: ask:cookie:question
  952.         rednet.send(siteID,"ans:"..arg1..":"..popup(arg2))
  953.         print("please wait...")--TODO place this nicely in the text entry field
  954.         --note: server should send refresh as soon as it is done
  955.     end
  956.     --TODO add input command
  957. end
  958. function enterPage()
  959.     siteName,pageName=split(popup(var11),"/")
  960.     if pageName==nil or pageName=="" then
  961.         pageName="/home"
  962.     end
  963.     refresh()
  964. end
  965. function renderMenu()
  966.     term.setTextColor(colours.black)
  967.     term.setBackgroundColor(colours.white)
  968.  
  969.     term.clear()
  970.     term.setCursorPos(1,1)
  971.     plocha ()
  972.     --add one space before every line due to side bar
  973.     print(" "..version)
  974.     print(" by Laurens Weyn")
  975.     print("")
  976.     if ddnsID~=nil then print(" ID of dedicated DNS: "..ddnsID) end
  977.     if siteID~=nil then print(" ID of current website: "..siteID) end
  978.     print(" using modem on side: "..portSide)
  979.     renderGUI()
  980. end
  981. function handleSelect()
  982.     if menuMode==true then
  983.         --edit web adress
  984.         if currentX==1 then
  985.             enterPage()
  986.         end
  987.         if currentX==2 then
  988.             renderMenu()
  989.         end
  990.         --refresh
  991.         if currentX==3 then
  992.             refresh()
  993.         end
  994.     else--clicked on site
  995.         if webType==1 then
  996.             rednet.send(siteID,"exec:"..pageName..":"..currentY)
  997.         end
  998.         --TODO add interactive menu
  999.     end
  1000. end
  1001. -----------------------
  1002. --program begins here--
  1003. -----------------------
  1004. portSide=getDeviceSide("modem")
  1005. if portSide==nil then
  1006.     print(var12)
  1007. end
  1008. rednet.broadcast("@ddns")--search for dedicated dns
  1009. ddnsID,result=rednet.receive(1)
  1010. if result==nil then
  1011. ddns=false
  1012. print(var13)
  1013. end
  1014. renderGUI()
  1015. enterPage()
  1016. renderGUI()
  1017. while true do
  1018.     event, p1, p2, p3 = os.pullEventRaw()
  1019.     if event=="key" or event=="char" then
  1020.         --up
  1021.         if p1==200 then
  1022.             if currentY~=1 then currentY=currentY-1 end
  1023.             menuMode=false
  1024.         end
  1025.         --down
  1026.         if p1==208  then
  1027.             if currentY~=18 then currentY=currentY+1 end
  1028.             menuMode=false
  1029.         end
  1030.        
  1031.         --left
  1032.         if p1==203 then
  1033.             if currentX~=1 then currentX=currentX-1 end
  1034.             menuMode=true
  1035.         end
  1036.         --right
  1037.         if p1==205 then
  1038.             if currentX~=3 then currentX=currentX+1 end
  1039.             menuMode=true
  1040.         end
  1041.         --enter or space (select)
  1042.         if p1==28 or p1==" "  then --removed 57
  1043.             handleSelect()
  1044.         end
  1045.         renderGUI()
  1046.     elseif event=="mouse_click" then
  1047.         if p3==19 then
  1048.             menuMode=true
  1049.             currentX=1--default if below is false
  1050.             if p2>36 then currentX=2 end
  1051.             if p2>42 then currentX=3 end
  1052.         else
  1053.             menuMode=false
  1054.             currentY=p3
  1055.         end
  1056.         handleSelect()
  1057.         renderGUI()
  1058.     --only receive messages from current website
  1059.     elseif event=="rednet_message" and p1==siteID then
  1060.         interpret(p2)
  1061.     elseif event=="terminate" then
  1062.         plocha ()
  1063.     break
  1064.     end
  1065.  
  1066.     --TODO make an options menu
  1067.     --TODO add error handling
  1068. end
  1069. end
  1070.  
  1071. function spousteni1 ()
  1072. term.setBackgroundColor(colors.white)
  1073. term.setTextColor(colors.black)
  1074. term.clear()
  1075. term.setBackgroundColor(colors.white)
  1076. term.setTextColor(colors.blue)
  1077. term.setCursorPos(20,18)
  1078. print"  Pepek"
  1079. term.setCursorPos(28,18)
  1080. print"Soft  "
  1081. term.setCursorPos(27,18)
  1082. term.setTextColor(colors.lime)
  1083. print"@"
  1084. term.setCursorPos(5, 14)
  1085. print ("Build "..verze)
  1086. term.setBackgroundColor(colors.white)
  1087. term.setTextColor(colors.black)
  1088. term.setCursorPos(16,7)
  1089. prc "Pepdroll 6.2 Pro-Starter"
  1090. term.setCursorPos(14,9)
  1091. term.setBackgroundColor(colors.lightBlue)
  1092. textutils.slowPrint "                        "
  1093. term.setCursorPos(14,9)
  1094. term.setBackgroundColor(colors.lightGray)
  1095. textutils.slowPrint "                        "
  1096. term.setCursorPos(14,9)
  1097. term.setBackgroundColor(colors.lightBlue)
  1098. textutils.slowPrint "          "
  1099. preskoklog ()
  1100. end
  1101.  
  1102. function deaktiv ()
  1103. shell.run ("delete aktiv")
  1104. os.reboot ()
  1105. heslo ()
  1106. end
  1107.  
  1108. function createAccount()
  1109.   local next = false
  1110. if login == 0 then
  1111. user = 0
  1112. term.setBackgroundColor(colors.white)
  1113.   term.setTextColor(colors.black)
  1114.   term.clear()
  1115.   term.setCursorPos(5,7)
  1116.   print(var22)
  1117.   term.setCursorPos(5,9)
  1118.   print(var20.." ")
  1119.   term.setCursorPos(5,11)
  1120.   print(var21.." ")
  1121.   term.setBackgroundColor(colors.lightBlue)
  1122.   term.setCursorPos(18,9)
  1123.   print "         "
  1124.   term.setCursorPos(18,11)
  1125.   print "         "
  1126.     term.setCursorPos(18,13)
  1127.   print (var23)
  1128.  elseif login == 1 then
  1129. end
  1130.  
  1131. while true do
  1132. local event, button, x, y = os.pullEvent("mouse_click")
  1133. xy = x..","..y
  1134.  
  1135. if x >= 18 and x <= 26 and y == 9 and button == 1 then
  1136.   term.setBackgroundColor(colors.cyan)
  1137.   term.setCursorPos(18,9)
  1138.   print "         "
  1139.   term.setCursorPos(18,9)
  1140.   user = read()
  1141.   term.setBackgroundColor(colors.lightBlue)
  1142.   term.setCursorPos(18,9)
  1143.   print "         "
  1144.   term.setCursorPos(18,9)
  1145.   print (user)
  1146.     if user == 0 then
  1147.     term.setBackgroundColor(colors.white)
  1148.     fgc(colors.red)
  1149.     term.setCursorPos(5,13)
  1150.     print(var30)
  1151.     login = 0
  1152.   createAccount()
  1153.   elseif user == " " then
  1154.     term.setBackgroundColor(colors.white)
  1155.     fgc(colors.red)
  1156.     term.setCursorPos(5,13)
  1157.     print(var25)
  1158.   login = 0
  1159.   createAccount()
  1160.   else
  1161.   uzivatel = (user)
  1162.   login = 1
  1163.   createAccount()
  1164.   end
  1165. elseif x >= 18 and x <= 26 and y == 11 and button == 1 then
  1166.   term.setBackgroundColor(colors.cyan)
  1167.   term.setCursorPos(18,11)
  1168.   print "         "
  1169.   term.setCursorPos(18,11)
  1170.   pass = read("@")
  1171.   term.setBackgroundColor(colors.lightBlue)
  1172.   term.setCursorPos(18,11)
  1173.   print "         "
  1174.   term.setCursorPos(18,11)
  1175.   print (var27)
  1176.   login = 1
  1177.   createAccount()
  1178. end
  1179.  
  1180. if x >= 18 and x <= 26 and y == 13 and button == 1 then
  1181. if user == 0 then
  1182.     term.setBackgroundColor(colors.white)
  1183.     fgc(colors.red)
  1184.     term.setCursorPos(5,13)
  1185.     print(var30)
  1186.     sleep (1)
  1187.     login = 0
  1188.   createAccount()
  1189.   elseif user == " " then
  1190.     term.setBackgroundColor(colors.white)
  1191.     fgc(colors.red)
  1192.     term.setCursorPos(5,13)
  1193.     print(var25)
  1194.     sleep (1)
  1195.   login = 0
  1196.   createAccount()
  1197.   end
  1198. login = 0
  1199. userI=user
  1200.  
  1201.   if not fs.isDir("/.ucet/"..user) then
  1202.     fs.makeDir("/.ucet/"..user)
  1203.     local file = fs.open(".ucet/"..user.."/.data","w")
  1204.     file.writeLine(user)
  1205.     file.writeLine(pass)
  1206.     file.close()
  1207.     if not fs.exists("/.core/ucet") then
  1208.       fs.open("/.core/ucet","w")
  1209.     end
  1210.     term.setBackgroundColor(colors.white)
  1211.     fgc(colors.lime)
  1212.     term.setCursorPos(5,13)
  1213.     shell.run ("pastebin get YHGDzX5a ", ".ucet/"..user.."/bar.nfp")
  1214.     term.setCursorPos(5,13)
  1215.     shell.run ("pastebin get sc1LAE0x ", ".ucet/"..user.."/nastaveni.cfg")
  1216.     term.setCursorPos(5,13)
  1217.     shell.run ("pastebin get sh70PdPx /.ucet/"..user.."/language")
  1218.     term.setCursorPos(5,13)
  1219.     print(var24)
  1220.     sleep (1)
  1221.     heslo ()
  1222.   else
  1223.     term.setBackgroundColor(colors.white)
  1224.     fgc(colors.red)
  1225.     term.setCursorPos(5,13)
  1226.     print(var25)
  1227.   end
  1228. end
  1229. end
  1230. end
  1231.  
  1232. function preskoklog ()
  1233. local n=fs.open("//.core/logon.cfg","r")
  1234. preskok = n.readLine ()
  1235. n.close ()
  1236.  
  1237.  
  1238.   if preskok == "1" then
  1239.     stavlog = "Yes"
  1240.     local na=fs.open("/.core/defuser","r")
  1241.     user = na.readLine ()
  1242.     userI = user
  1243.     na.close()
  1244.     data = fs.open("/.ucet/"..userI.."/.data","r")
  1245.     user = data.readLine ()
  1246.     passI = data.readLine ()
  1247.     data.close()
  1248.     vitejte ()
  1249.     else
  1250.     stavlog = "NO"
  1251.     heslo ()
  1252. end
  1253. end
  1254.  
  1255. function heslo ()
  1256.   if not fs.exists("/.core/ucet") then
  1257.     createAccount()
  1258.     local ucet = fs.open("/.core/ucet","w")
  1259.     ucet.close()
  1260.   end
  1261.   local success = false
  1262.  
  1263.   while not success do
  1264.   if login == 0 then
  1265.   pass=""
  1266.   term.setBackgroundColor(colors.white)
  1267.   term.setTextColor(colors.black)
  1268.   term.clear()
  1269.   term.clear()
  1270.   term.setBackgroundColor(colors.yellow)
  1271.   term.setCursorPos(1,2)
  1272.   shell.run ("list /.ucet")
  1273.   term.setBackgroundColor(colors.white)
  1274.   term.setTextColor(colors.black)
  1275.   term.setCursorPos(5,7)
  1276.   print(var26)
  1277.   term.setCursorPos(5,9)
  1278.   print(var20.." ")
  1279.   term.setCursorPos(5,11)
  1280.   print(var21.."")
  1281.   term.setBackgroundColor(colors.lightBlue)
  1282.   term.setCursorPos(18,9)
  1283.   print "         "
  1284.   term.setCursorPos(18,11)
  1285.   print "         "
  1286.   term.setCursorPos(18,13)
  1287.   print(var26)
  1288.   term.setCursorPos(18,9)
  1289.   print (userI)
  1290.   if passI == "" then
  1291.   term.setCursorPos(18,11)
  1292.   print ""
  1293.   else
  1294.   term.setCursorPos(18,11)
  1295.   print (var27)
  1296.   end
  1297.  
  1298. elseif login == 1 then
  1299. term.setTextColor(colors.black)
  1300. end
  1301.  
  1302. while true do
  1303. local event, button, x, y = os.pullEvent("mouse_click")
  1304. xy = x..","..y
  1305.  
  1306. if x >= 18 and x <= 26 and y == 9 and button == 1 then
  1307.   term.setBackgroundColor(colors.cyan)
  1308.   term.setCursorPos(18,9)
  1309.   print "         "
  1310.   term.setCursorPos(18,9)
  1311.   userI = read()
  1312.   term.setBackgroundColor(colors.lightBlue)
  1313.   term.setCursorPos(18,9)
  1314.   print "         "
  1315.   term.setCursorPos(18,9)
  1316.   print (userI)
  1317.     if userI == "" then
  1318.   uzivatel = "None"
  1319.   elseif userI == " " then
  1320.   uzivatel = "None"
  1321.   else
  1322.   uzivatel = (userI)
  1323.   login = 1
  1324.     heslo ()
  1325.   end
  1326. elseif x >= 18 and x <= 26 and y == 11 and button == 1 then
  1327.   term.setBackgroundColor(colors.cyan)
  1328.   term.setCursorPos(18,11)
  1329.   print "         "
  1330.   term.setCursorPos(18,11)
  1331.   passI = read("@")
  1332.   term.setBackgroundColor(colors.lightBlue)
  1333.   term.setCursorPos(18,11)
  1334.   print "         "
  1335.   term.setCursorPos(18,11)
  1336.   print (var27)
  1337.   login = 1
  1338.   heslo ()
  1339. end
  1340.  
  1341. if x >= 18 and x <= 26 and y == 13 and button == 1 then
  1342. login = 0
  1343.     if userI == "" then
  1344.         login = 1
  1345.         heslo ()
  1346.     elseif userI == " " then
  1347.     login = 1
  1348.         heslo ()
  1349.     end
  1350.    
  1351.     if fs.isDir("/.ucet/"..userI) then
  1352.       if fs.exists("/.ucet/"..userI.."/.data") then
  1353.         data = fs.open("/.ucet/"..userI.."/.data","r")
  1354.         userO = data.readLine()
  1355.         passO = data.readLine()
  1356.         end
  1357.         if userI == userO and passI == passO then
  1358.           term.setBackgroundColor(colors.white)
  1359.           term.setCursorPos(5,13)
  1360.           fgc(colors.lime)
  1361.           print(var28)
  1362.           user = userI
  1363.           userDir = "/.ucet/"..userI
  1364.           success = true
  1365.           sleep (1)
  1366.           uss = userI
  1367.           vitejte ()
  1368.       else
  1369.           term.setBackgroundColor(colors.white)
  1370.           fgc(colors.red)
  1371.           term.setCursorPos(5,13)
  1372.           print(var29)
  1373.           passI = ""
  1374.           sleep (1)
  1375.           login = 0
  1376.           heslo ()
  1377.         end
  1378.   end
  1379. end
  1380. end
  1381. end
  1382. end
  1383.  
  1384. function clear()
  1385.   term.clear()
  1386.   term.setBackgroundColor(colors.white)
  1387.   for i=1,w do
  1388.     for j=1,h do
  1389.       term.setCursorPos(i,j)
  1390.       write(" ")
  1391.     end
  1392.   end
  1393. end
  1394.  
  1395. function vitejte ()
  1396. if not fs.exists ("/.ucet/"..userI.."/language") then
  1397.           shell.run ("pastebin get sh70PdPx /.ucet/"..userI.."/language")
  1398.           vitejte ()
  1399.           else
  1400.           data = fs.open("/.ucet/"..userI.."/language","r")
  1401. var1 = data.readLine()
  1402. var2 = data.readLine()
  1403. var3 = data.readLine()
  1404. var4 = data.readLine()
  1405. var5 = data.readLine()
  1406. var6 = data.readLine()
  1407. var7 = data.readLine()
  1408. var8 = data.readLine()
  1409. var9 = data.readLine()
  1410. var10 = data.readLine()
  1411. var11 = data.readLine()
  1412. var12 = data.readLine()
  1413. var13 = data.readLine()
  1414. var14 = data.readLine()
  1415. var15 = data.readLine()
  1416. var16 = data.readLine()
  1417. var17 = data.readLine()
  1418. var18 = data.readLine()
  1419. var19 = data.readLine()
  1420. var20 = data.readLine()
  1421. var21 = data.readLine()
  1422. var22 = data.readLine()
  1423. var23 = data.readLine()
  1424. var24 = data.readLine()
  1425. var25 = data.readLine()
  1426. var26 = data.readLine()
  1427. var27 = data.readLine()
  1428. var28 = data.readLine()
  1429. var29 = data.readLine()
  1430. var30 = data.readLine()
  1431. var31 = data.readLine()
  1432. var32 = data.readLine()
  1433. var33 = data.readLine()
  1434. var34 = data.readLine()
  1435. var35 = data.readLine()
  1436. var36 = data.readLine()
  1437. var37 = data.readLine()
  1438. var38 = data.readLine()
  1439. var39 = data.readLine()
  1440. var40     = data.readLine()
  1441. var41     = data.readLine()
  1442. var42     = data.readLine()
  1443. var43     = data.readLine()
  1444. var44     = data.readLine()
  1445. var45     = data.readLine()
  1446. var46     = data.readLine()
  1447. var47     = data.readLine()
  1448. var48     = data.readLine()
  1449. var49     = data.readLine()
  1450. var50     = data.readLine()
  1451. var51     = data.readLine()
  1452. var52     = data.readLine()
  1453. var53     = data.readLine()
  1454. var54     = data.readLine()
  1455. var55     = data.readLine()
  1456. var56     = data.readLine()
  1457. var57     = data.readLine()
  1458. var58     = data.readLine()
  1459. var59     = data.readLine()
  1460. var60     = data.readLine()
  1461. var61     = data.readLine()
  1462. var62     = data.readLine()
  1463. var63     = data.readLine()
  1464. var64     = data.readLine()
  1465. var65     = data.readLine()
  1466. var66     = data.readLine()
  1467. var67     = data.readLine()
  1468. var68     = data.readLine()
  1469. var69     = data.readLine()
  1470. var70     = data.readLine()
  1471. var71     = data.readLine()
  1472. var72     = data.readLine()
  1473. var73     = data.readLine()
  1474. var74     = data.readLine()
  1475. var75     = data.readLine()
  1476. var76     = data.readLine()
  1477. var77     = data.readLine()
  1478. var78     = data.readLine()
  1479. var79     = data.readLine()
  1480. var80     = data.readLine()
  1481. var81     = data.readLine()
  1482. var82     = data.readLine()
  1483. var83     = data.readLine()
  1484. var84     = data.readLine()
  1485. var85     = data.readLine()
  1486. var86     = data.readLine()
  1487. var87     = data.readLine()
  1488. var88     = data.readLine()
  1489. var89     = data.readLine()
  1490. var90     = data.readLine()
  1491. var91     = data.readLine()
  1492. var92     = data.readLine()
  1493. var93     = data.readLine()
  1494. var94     = data.readLine()
  1495. var95     = data.readLine()
  1496. var96     = data.readLine()
  1497. var97     = data.readLine()
  1498. var98     = data.readLine()
  1499. var99     = data.readLine()
  1500. data.close()
  1501. end
  1502. term.setBackgroundColor(colors.white)
  1503. term.setTextColor(colors.black)
  1504. term.clear()
  1505. term.setCursorPos(1, 7)
  1506. prc (var31)
  1507. term.setCursorPos(1, 9)
  1508. prc (userI)
  1509. term.setBackgroundColor(colors.white)
  1510. term.setTextColor(colors.blue)
  1511. term.setCursorPos(20,18)
  1512. print"  Pepek"
  1513. term.setCursorPos(28,18)
  1514. print"Soft  "
  1515. term.setCursorPos(27,18)
  1516. term.setTextColor(colors.lime)
  1517. print"@"
  1518. sleep (1)
  1519. term.setBackgroundColor(colors.lightGray)
  1520. term.clear()
  1521. sleep (0.1)
  1522. term.setBackgroundColor(colors.gray)
  1523. term.clear()
  1524. sleep (0.1)
  1525. plocha ()
  1526. end
  1527.  
  1528. local function redrawTime()
  1529.     l(47,19,51,19,256)
  1530.     tg(32768)
  1531.     tim = os.time()
  1532.     tpr(textutils.formatTime(tim,true),1,18)
  1533. end
  1534.  
  1535.  
  1536. function plocha ()
  1537. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  1538. local cnt=f.readAll()
  1539. f.close()
  1540. local nastaveni=textutils.unserialize(cnt)
  1541. local ACL = fs.list("/.ucet")
  1542. if anim == 1 then
  1543. term.setBackgroundColor(colors.gray)
  1544. term.clear()
  1545. sleep (0.1)
  1546. term.setBackgroundColor(colors.lightGray)
  1547. term.clear()
  1548. sleep (0.1)
  1549. anim = 0
  1550. end
  1551. term.setBackgroundColor(colors.white)
  1552. term.setTextColor(colors.white)
  1553. term.clear()
  1554. if not fs.exists("/.ucet/"..user.."/bar.nfp") then
  1555. term.setBackgroundColor(colors.black)
  1556. term.clear()
  1557. prc (var32)
  1558. term.setBackgroundColor(colors.white)
  1559. else
  1560. term.setCursorPos(1,1)
  1561. term.setBackgroundColor(nastaveni.barva)
  1562. local image = paintutils.loadImage("/.ucet/"..user.."/bar.nfp")
  1563. paintutils.drawImage(image, 3, 2)
  1564. end
  1565. term.setCursorPos(1,1)
  1566. term.setBackgroundColor(nastaveni.barva)
  1567. term.setTextColor(colors.black)
  1568. term.setCursorPos(45,17)
  1569. if #tArgs > 0 then
  1570.     sDrive = tostring( tArgs[1] )
  1571. end
  1572.  
  1573. if sDrive == nil then
  1574.     term.setTextColor(colors.white)
  1575.     print( "ID "..os.getComputerID() )
  1576.    
  1577.     local label = os.getComputerLabel()
  1578.     if label then
  1579.     term.setCursorPos(6,18)
  1580.     term.setTextColor(colors.white)
  1581.         print( " Label \""..label.."\"" )
  1582.     end
  1583.  
  1584. else
  1585.     local bData = disk.hasData( sDrive )
  1586.     if not bData then
  1587.         print( "No disk in drive "..sDrive )
  1588.         return
  1589.     end
  1590.    
  1591.     print( "The disk is #"..disk.getID( sDrive ) )
  1592.  
  1593.     local label = disk.getLabel( sDrive )
  1594.     if label then
  1595.         print( "The disk is labelled \""..label.."\"" )
  1596.     end
  1597. end
  1598. term.setTextColor(colors.white)
  1599. term.setCursorPos (42,14)
  1600. print (var33)
  1601. term.setCursorPos(1,1)
  1602. print "                                                   "
  1603. print"  "
  1604. print"  "
  1605. print"  "
  1606. print"  "
  1607. print"  "
  1608. print"  "
  1609. print"  "
  1610. print"  "
  1611. print"  "
  1612. print"  "
  1613. print"  "
  1614. print"  "
  1615. print"  "
  1616. print"  "
  1617. print"  "
  1618. print"  "
  1619. print"  "
  1620. paintutils.drawPixel(1, 19, nastaveni.barva)
  1621. paintutils.drawPixel(2, 19, nastaveni.barva)
  1622. term.setCursorPos(15,1)
  1623. prc ("Pepdroll 6.2 Pro-Starter Build "..verze)
  1624. term.setCursorPos(14,2)
  1625. print"                         "
  1626. term.setCursorPos(1,1)
  1627. term.setBackgroundColor(colors.orange)
  1628. term.setTextColor(colors.black)
  1629. print "Menu"
  1630. term.setBackgroundColor(colors.orange)
  1631. term.setCursorPos(1,18)
  1632. print "     "
  1633. local time = os.time()
  1634. local formattedTime = textutils.formatTime(time, true)
  1635. term.setCursorPos(1,18)
  1636. print("" .. formattedTime)
  1637.  
  1638. if fs.exists ("/.core/tut") then
  1639.     local myWindow = window.create(term.current(),14,5,26,10)
  1640.     myWindow.setBackgroundColor(colors.gray)
  1641.     myWindow.clear()
  1642.     data = fs.open("/.core/tut","r")
  1643.     upo1     = data.readLine()
  1644.     upo2     = data.readLine()
  1645.     upo3     = data.readLine()
  1646.     upo4     = data.readLine()
  1647.     upo5     = data.readLine()
  1648.     term.setTextColor(colors.black)
  1649.     term.setCursorPos(15,7)
  1650.     print (upo1)
  1651.     term.setCursorPos(15,8)
  1652.     print (upo2)
  1653.     term.setCursorPos(15,9)
  1654.     print (upo3)
  1655.     term.setCursorPos(15,10)
  1656.     print (upo4)
  1657.     term.setCursorPos(15,13)
  1658.     print (upo5)
  1659.     data.close()
  1660.    
  1661.     while true do
  1662.     local event, button, x, y = os.pullEvent("mouse_click")
  1663.     xy = x..","..y
  1664.    
  1665.     if x >= 16 and x <= 18 and y == 13 and button == 1 then
  1666.     fs.delete("/.core/tut")
  1667.     jazyky ()
  1668.     end
  1669.     if x >= 33 and x <= 34 and y == 13 and button == 1 then
  1670.     fs.delete("/.core/tut")
  1671.     plocha ()
  1672.     end
  1673. end
  1674. end
  1675.  
  1676. while true do
  1677. local event = { os.pullEvent() }
  1678. if event[ 1 ] == "mouse_click" then
  1679.     term.setCursorPos(40,18)
  1680.     print "Mouse click"
  1681.     term.setBackgroundColor(colors.red)
  1682.     term.setCursorPos(1,1)
  1683.     print "Menu"
  1684.     term.setBackgroundColor(colors.orange)
  1685.     local event, button, x, y = os.pullEvent("mouse_click")
  1686.     xy = x..","..y
  1687.    
  1688.     if x >= 1 and x <= 4 and y == 1 and button == 1 then
  1689.     menu ()
  1690.     elseif x >= 42 and x <= 51 and y == 14 and button == 1 then
  1691.     kalkulacka ()
  1692.     end
  1693. elseif event[ 1 ] == "key" then
  1694.     term.setCursorPos(40,18)
  1695.     print "   Key Event"
  1696. local event, key = os.pullEvent("key")
  1697.   if key == keys.q then
  1698.   rezim = 1
  1699.   menu ()
  1700.   elseif key == keys.leftCtrl then
  1701.   menu ()
  1702.   end
  1703. end
  1704. end
  1705. end
  1706.  
  1707. function menu ()
  1708. term.setBackgroundColor(colors.white)
  1709. term.setCursorPos(5,1)
  1710. print "       "
  1711. term.setCursorPos(1,2)
  1712. print (var34)
  1713. term.setCursorPos(1,3)
  1714. print (var35)
  1715. term.setCursorPos(1,4)
  1716. print (var36)
  1717. term.setCursorPos(1,5)
  1718. print (var37)
  1719. term.setCursorPos(1,6)
  1720. print (var38)
  1721. term.setCursorPos(1,7)
  1722. print (var39)
  1723. term.setCursorPos(1,8)
  1724. print (var40)
  1725. term.setBackgroundColor(colors.orange)
  1726. term.setCursorPos(1,9)
  1727. print "           "
  1728. paintutils.drawPixel(12, 2, colors.orange)    
  1729. paintutils.drawPixel(12, 3, colors.orange)
  1730. paintutils.drawPixel(12, 1, colors.orange)
  1731. paintutils.drawPixel(12, 4, colors.orange)
  1732. paintutils.drawPixel(12, 5, colors.orange)
  1733. paintutils.drawPixel(12, 6, colors.orange)
  1734. paintutils.drawPixel(12, 7, colors.orange)
  1735. paintutils.drawPixel(12, 8, colors.orange)
  1736. paintutils.drawPixel(12, 9, colors.red)
  1737. term.setCursorPos(12, 9)
  1738. print "Q"
  1739. paintutils.drawPixel(51, 1, colors.red)
  1740. term.setCursorPos(51, 1)
  1741. print "Q"
  1742. term.setBackgroundColor(colors.orange)
  1743. local time = os.time()
  1744. local formattedTime = textutils.formatTime(time, true)
  1745. term.setCursorPos(1,18)
  1746. print("" .. formattedTime)
  1747. if rezim == 1 then
  1748. rezim = 0
  1749. rezimy ()
  1750. end
  1751.  
  1752. while true do
  1753. local event, button, x, y = os.pullEvent("mouse_click")
  1754. xy = x..","..y
  1755.  
  1756. if x >= 1 and x <= 11 and y == 2 and button == 1 then
  1757. web ()
  1758. elseif x >= 1 and x <= 8 and y == 8 and button == 1 then
  1759. pastebin ()
  1760. elseif x >= 1 and x <= 10 and y == 7 and button == 1 then
  1761. anim = 1
  1762. obrnastaveni ()
  1763. elseif x >= 1 and x <= 11 and y == 6 and button == 1 then
  1764. textovani ()
  1765. elseif x >= 1 and x <= 11 and y == 5 and button == 1 then
  1766. malovani ()
  1767. elseif x >= 1 and x <= 10 and y == 4 and button == 1 then
  1768. prehravac ()
  1769. elseif x >= 1 and x <= 10 and y == 3 and button == 1 then
  1770. prohlizec ()
  1771. elseif xy == "12,9" and button == 1 then
  1772. rezimy ()
  1773. elseif xy == "12,9" and button == 2 then
  1774. plocha ()
  1775. elseif xy == "51,1" and button == 1 then
  1776. vypnout ()
  1777. elseif xy == "51,1" and button == 2 then
  1778. restart ()
  1779. elseif x >= 42 and x <= 51 and y == 14 and button == 1 then
  1780. kalkulacka ()
  1781. else
  1782. plocha ()
  1783. break
  1784. end
  1785. end
  1786. end
  1787.  
  1788. function rezimy ()
  1789. term.setBackgroundColor(colors.orange)
  1790. term.setTextColor(colors.black)
  1791. term.setCursorPos(13, 8)
  1792. print "          "
  1793. term.setCursorPos(13, 9)
  1794. print "          "
  1795. term.setCursorPos(12, 10)
  1796. print "           "
  1797. term.setCursorPos(12, 11)
  1798. print "           "
  1799. term.setCursorPos(12, 12)
  1800. print "           "
  1801. term.setCursorPos(12, 13)
  1802. print "           "
  1803. term.setCursorPos(12, 14)
  1804. print "           "
  1805. term.setCursorPos(12, 15)
  1806. print "           "
  1807. term.setBackgroundColor(colors.white)
  1808. term.setCursorPos(13, 9)
  1809. print (var41)
  1810. term.setCursorPos(13, 10)
  1811. term.setBackgroundColor(colors.lightBlue)
  1812. print (var42)
  1813. term.setCursorPos(13, 11)
  1814. term.setBackgroundColor(colors.lightGray)
  1815. term.setTextColor(colors.white)
  1816. print (var43)
  1817. term.setTextColor(colors.black)
  1818. term.setCursorPos(13, 12)
  1819. term.setBackgroundColor(colors.white)
  1820. print "         "
  1821. term.setCursorPos(13, 13)
  1822. term.setBackgroundColor(colors.yellow)
  1823. print (var44)
  1824. term.setCursorPos(13, 14)
  1825. term.setBackgroundColor(colors.red)
  1826. print (var45)
  1827. paintutils.drawPixel(12, 9, colors.gray)
  1828. term.setCursorPos(12, 9)
  1829. print "Q"
  1830. term.setBackgroundColor(colors.orange)
  1831. local time = os.time()
  1832. local formattedTime = textutils.formatTime(time, true)
  1833. term.setCursorPos(1,18)
  1834. print("" .. formattedTime)
  1835.  
  1836. while true do
  1837.  
  1838. local event = { os.pullEvent() }
  1839. if event[ 1 ] == "mouse_click" then
  1840.  
  1841. local event, button, x, y = os.pullEvent("mouse_click")
  1842. xy = x..","..y
  1843.  
  1844. if xy == "12,9" and button == 1 then
  1845. plocha ()
  1846. elseif x >= 14 and x <= 20 and y == 10 and button == 1 then
  1847. odhlasit ()
  1848. elseif x >= 14 and x <= 20 and y == 11 and button == 1 then
  1849. spanek ()
  1850. elseif x >= 14 and x <= 20 and y == 13 and button == 1 then
  1851. restart ()
  1852. elseif x >= 14 and x <= 20 and y == 14 and button == 1 then
  1853. vypnout ()
  1854. elseif x >= 42 and x <= 51 and y == 14 and button == 1 then
  1855. kalkulacka ()
  1856. else
  1857. plocha ()
  1858. break
  1859. end
  1860. elseif event[ 1 ] == "key" then
  1861. local event, key = os.pullEvent("key")
  1862.  
  1863.   if key == keys.q then
  1864.   plocha ()
  1865.   end
  1866. end
  1867. end
  1868. end
  1869.  
  1870. function spanek ()
  1871. term.setBackgroundColor(colors.lightGray)
  1872. term.clear()
  1873. sleep (0.1)
  1874. term.setBackgroundColor(colors.gray)
  1875. term.clear()
  1876. sleep (0.1)
  1877. term.setBackgroundColor(colors.black)
  1878. term.setTextColor(colors.black)
  1879. term.clear()
  1880. while true do
  1881.   local event, button, xPos, yPos = os.pullEvent("mouse_click")
  1882.   preskoklog ()
  1883. end
  1884. end
  1885.  
  1886. function vypnout ()
  1887. term.setBackgroundColor(colors.lightGray)
  1888. term.clear()
  1889. sleep (0.1)
  1890. term.setBackgroundColor(colors.gray)
  1891. term.clear()
  1892. sleep (0.1)
  1893. term.setBackgroundColor(colors.white)
  1894. term.setTextColor(colors.black)
  1895. term.clear()
  1896. term.setCursorPos(23, 7)
  1897. prc (var46)
  1898. term.setBackgroundColor(colors.white)
  1899. term.setTextColor(colors.blue)
  1900. term.setCursorPos(20,18)
  1901. print"  Pepek"
  1902. term.setCursorPos(28,18)
  1903. print"Soft  "
  1904. term.setCursorPos(27,18)
  1905. term.setTextColor(colors.lime)
  1906. print"@"
  1907. sleep (2)
  1908. os.shutdown ()
  1909. end
  1910.  
  1911. function odhlasit ()
  1912. term.setBackgroundColor(colors.lightGray)
  1913. term.clear()
  1914. sleep (0.1)
  1915. term.setBackgroundColor(colors.gray)
  1916. term.clear()
  1917. sleep (0.1)
  1918. term.setBackgroundColor(colors.white)
  1919. term.setTextColor(colors.black)
  1920. term.clear()
  1921. term.setCursorPos(23, 7)
  1922. prc (var47)
  1923. term.setBackgroundColor(colors.white)
  1924. term.setTextColor(colors.blue)
  1925. term.setCursorPos(20,18)
  1926. print"  Pepek"
  1927. term.setCursorPos(28,18)
  1928. print"Soft  "
  1929. term.setCursorPos(27,18)
  1930. term.setTextColor(colors.lime)
  1931. print"@"
  1932. sleep (2)
  1933. heslo ()
  1934. end
  1935.  
  1936. function restart ()
  1937. term.setBackgroundColor(colors.lightGray)
  1938. term.clear()
  1939. sleep (0.1)
  1940. term.setBackgroundColor(colors.gray)
  1941. term.clear()
  1942. sleep (0.1)
  1943. term.setBackgroundColor(colors.white)
  1944. term.setTextColor(colors.black)
  1945. term.clear()
  1946. term.setCursorPos(23, 7)
  1947. prc (var46)
  1948. term.setBackgroundColor(colors.white)
  1949. term.setTextColor(colors.blue)
  1950. term.setCursorPos(20,18)
  1951. print"  Pepek"
  1952. term.setCursorPos(28,18)
  1953. print"Soft  "
  1954. term.setCursorPos(27,18)
  1955. term.setTextColor(colors.lime)
  1956. print"@"
  1957. sleep (1)
  1958. term.setBackgroundColor(colors.white)
  1959. term.setTextColor(colors.black)
  1960. term.clear()
  1961. term.setCursorPos(23, 7)
  1962. prc (var47)
  1963. term.setBackgroundColor(colors.white)
  1964. term.setTextColor(colors.blue)
  1965. term.setCursorPos(20,18)
  1966. print"  Pepek"
  1967. term.setCursorPos(28,18)
  1968. print"Soft  "
  1969. term.setCursorPos(27,18)
  1970. term.setTextColor(colors.lime)
  1971. print"@"
  1972. sleep (1)
  1973. os.reboot ()
  1974. end
  1975.  
  1976. function prohlizec ()
  1977. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  1978. local cnt=f.readAll()
  1979. f.close()
  1980. local nastaveni=textutils.unserialize(cnt)
  1981. local version = "1.2"
  1982. w,h = term.getSize()
  1983. local dir = ""
  1984. shell.setDir(dir)
  1985. local tProgram = shell.getRunningProgram()
  1986. local buttonAPI = "button"
  1987. local selected = 0
  1988. local menuS = false
  1989. local input
  1990. local path
  1991. local ypos
  1992. local tempvar
  1993.  
  1994. filePos = {
  1995.   [1] = {3,3},
  1996.   [2] = {15,3},
  1997.   [3] = {27,3},
  1998.   [4] = {39,3},
  1999.   [5] = {3,7},
  2000.   [6] = {15,7},
  2001.   [7] = {27,7},
  2002.   [8] = {39,7},
  2003.   [9] = {3,11},
  2004.   [10] = {15,11},
  2005.   [11]= {27,11},
  2006.   [12]= {39,11},
  2007.   [13] = {3,15},
  2008.   [14]= {15,15},
  2009.   [15]= {27,15},
  2010.   [16]= {39,15}
  2011. }
  2012. local cPage = 1
  2013. local nPage = 1
  2014. local run = true
  2015.  
  2016. --Checks
  2017. if not term.isColor() then
  2018.   print("This program can only run on an advanced computer")
  2019.   return
  2020. --[[elseif os.version() ~= "CraftOS 1.5" then
  2021.   print("This program is designed for CraftOS 1.5")
  2022.   print("Your version is "..os.version())
  2023.   print("Newer or older version may not work")
  2024.   print("Run anyways?")
  2025.   print("y/n")
  2026.   while true do
  2027.     event,par1,par2,par3 = os.pullEvent()
  2028.     if par1 == keys.y then run = true break end
  2029.     if par1 == keys.n then run = false break end
  2030.   end]]
  2031. end
  2032.  
  2033. if not run then os.pullEvent() return end
  2034.  
  2035.  
  2036. --Functions--
  2037. function clear(color)
  2038.   if color then
  2039.     term.setBackgroundColor(color)
  2040.   end
  2041.   term.clear()
  2042.   term.setCursorPos(1,1)
  2043. end
  2044.  
  2045. function sColor(color)
  2046.   term.setBackgroundColor(color)
  2047. end
  2048.  
  2049. function drawS(x,y,state)
  2050.   if state then sColor(colors.cyan) else sColor(colors.white) end
  2051.   term.setCursorPos(x-1,y-1)
  2052.   print(string.rep(" ",13))
  2053.   term.setCursorPos(x-1,y)
  2054.   term.write(" ")
  2055.   term.setCursorPos(x-1,y+1)
  2056.   term.write(" ")
  2057.   term.setCursorPos(x-1,y+2)
  2058.   term.write(" ")
  2059.   term.setCursorPos(x-1,y+3)
  2060.   print(string.rep(" ",13))
  2061.   term.setCursorPos(x+11,y)
  2062.   term.write(" ")
  2063.   term.setCursorPos(x+11,y+1)
  2064.   term.write(" ")
  2065.   term.setCursorPos(x+11,y+2)
  2066.   term.write(" ")
  2067.   term.setCursorPos(x+11,y+3)
  2068.   term.write(" ")
  2069. end
  2070.  
  2071. function printC(text,y)
  2072.   if not y then
  2073.     error("printC:No Y value specified")
  2074.   end
  2075.   term.setCursorPos(math.ceil(w/2-#tostring(text)/2),y)
  2076.   term.write(text)
  2077. end
  2078.  
  2079. function window(_w,_h,head,ypos)
  2080.   if not _w or not _h then
  2081.     error("Window:Missing width (w) or height (h)")
  2082.   end
  2083.   if not ypos or type(ypos) ~= "number" then ypos = 5 end
  2084.   sColor(colors.white)
  2085.   term.setCursorPos(1,h)
  2086.   term.write(string.rep(" ",w))
  2087.   sColor(nastaveni.barva)
  2088.   term.setCursorPos(w,1)
  2089.   term.write(" ")
  2090.   printC(string.rep(" ",_w),ypos)
  2091.   term.setTextColor(colors.white)
  2092.   if head then
  2093.     printC(head,ypos)
  2094.   end
  2095.   sColor(colors.gray)
  2096.   for i = 1, _h do
  2097.     printC(string.rep(" ",_w),i+ypos)
  2098.   end
  2099. end
  2100.  
  2101. function testSpot(x,y)
  2102.   if y > 1 then
  2103.     if #cDir < 17 then
  2104.       _rep = #cDir
  2105.     else
  2106.       _rep = 16
  2107.     end
  2108.     for _c = 1, _rep do
  2109.       if x >= filePos[_c][1] and x <= filePos[_c][1]+10 and y >= filePos[_c][2] and y <= filePos[_c][2]+2 then
  2110.         return _c
  2111.       end
  2112.     end
  2113.   end
  2114.   return false
  2115. end
  2116.  
  2117. function bar()
  2118.   sColor(nastaveni.barva)
  2119.   term.setCursorPos(1,1)
  2120.   term.write(string.rep(" ",w-1))
  2121.   sColor(colors.red)
  2122.   term.setTextColor(colors.white)
  2123.   term.write("Q")
  2124. end
  2125.  
  2126. function drawDir()
  2127.   clear(colors.white)
  2128.   bar ()
  2129.   sColor(nastaveni.barva)
  2130.   cDir = fs.list(shell.dir())
  2131.   if shell.dir() == "" then
  2132.     printC("C: - File Manager "..version,1)
  2133.   else
  2134.     printC("/"..shell.dir(),1)
  2135.   end
  2136.   for i = 1, #cDir do
  2137.     local num = i
  2138.     local a = i+16*(cPage-1)
  2139.     local name = tostring(cDir[a])
  2140.     if name == "nil" then break end
  2141.     if #name > 9 then
  2142.       text = string.sub(name,1,6).."..."
  2143.     else
  2144.       text = name
  2145.     end
  2146.     if fs.isDir(shell.dir().."/"..name) then
  2147.       sColor(colors.orange)
  2148.     else
  2149.       sColor(colors.lightGray)
  2150.     end
  2151.     if shell.dir() == "" then
  2152.       location = "C:/"..name
  2153.     else
  2154.       location = tostring("C:/"..shell.dir().."/"..name)
  2155.     end
  2156.     if i > 16 then break end
  2157.     x = filePos[i][1]
  2158.     y = filePos[i][2]
  2159.     term.setCursorPos(x,y)
  2160.     term.write(string.rep(" ",11))
  2161.     term.setCursorPos(x,y+1)
  2162.     term.write(string.rep(" ",math.floor(5.5-#tostring(text)/2)))
  2163.     term.write(text)
  2164.     term.write(string.rep(" ",math.ceil(5.5-#tostring(text)/2)))
  2165.     term.setCursorPos(x,y+2)
  2166.     term.write(string.rep(" ",11))
  2167.   end
  2168.   if #cDir > 16 then
  2169.     nPage = math.ceil(#cDir/16)
  2170.     term.setTextColor(colors.black)
  2171.     sColor(colors.white)
  2172.     printC("Page "..cPage.." of "..nPage,2)
  2173.     nSelect = cDir[selected+16*(cPage-1)]
  2174.   else
  2175.     nSelect = cDir[selected]
  2176.   end
  2177.   if selected > 0 then
  2178.     drawS(filePos[selected][1],filePos[selected][2],true)
  2179.     sType = fs.isDir(shell.resolve(nSelect))
  2180.     menuS = true
  2181.   else
  2182.     menuS = false
  2183.   end
  2184. end
  2185.  
  2186. function confirm(text)
  2187.   if not text or #text <= 8 then
  2188.     window(8,3,text)
  2189.   else
  2190.     window(#text+2,3,text)
  2191.   end    
  2192.   term.setCursorPos(23,7)
  2193.   sColor(colors.lime)
  2194.   term.write("Yes")
  2195.   term.setCursorPos(27,7)
  2196.   sColor(colors.red)
  2197.   term.write("No")
  2198.   while true do
  2199.     event,par1,par2,par3 = os.pullEvent("mouse_click")
  2200.     if par3 == 7 then
  2201.       if par2 >= 23 and par2 <=25 then
  2202.         return true
  2203.       elseif par2 >= 27 and par2 <= 28 then
  2204.         return false
  2205.       end
  2206.     end
  2207.   end
  2208. end
  2209.  
  2210. function changeDir()
  2211.   window(26,4,"Change Directory")
  2212.   printC("Use '/' for root",8)
  2213.   sColor(colors.black)
  2214.   repeat    
  2215.     printC(string.rep(" ",18),7)  
  2216.     term.setCursorPos(17,7)
  2217.     input = read()
  2218.   until input ~= ""
  2219.   path = shell.resolve(input)
  2220.   if fs.exists(path) and fs.isDir(path) then
  2221.     shell.setDir(path)
  2222.   else
  2223.     sColor(colors.gray)
  2224.     term.setTextColor(colors.red)
  2225.     printC("Doesn't Exist!",9)
  2226.     sleep(1)
  2227.   end
  2228. end
  2229.  
  2230. function info(_path)
  2231.   if not _path then
  2232.     error("No path")
  2233.   end
  2234.   name = cDir[_path]
  2235.   clear(colors.white)
  2236.   term.setTextColor(colors.white)
  2237.   sColor(nastaveni.barva)
  2238.   term.write(string.rep(" ",w))
  2239.   printC(name,1)
  2240.   term.setCursorPos(w,1)
  2241.   sColor(colors.red)
  2242.   print("Q")
  2243.   term.setCursorPos(1,2)
  2244.   term.setTextColor(colors.black)
  2245.   sColor(colors.white)
  2246.   print(" ")
  2247.   term.write("File Path:")
  2248.   path = shell.resolve(name)
  2249.   print("/"..path)
  2250.   term.write("Type:")
  2251.   if fs.isDir(path) then
  2252.     print("Folder")
  2253.   else
  2254.     print("File")
  2255.     print("Size:"..fs.getSize(path))
  2256.   end
  2257.   if fs.isReadOnly(shell.resolve(nSelect)) then
  2258.     print("This is a read-only item")
  2259.   end
  2260.   if shell.resolve(nSelect) == tProgram then
  2261.     term.setTextColor(colors.orange)
  2262.     print("This program is currently running")
  2263.   end
  2264.   while true do
  2265.     event,par1,par2,par3 = os.pullEvent()
  2266.     if event == "mouse_click" then
  2267.       if par2 == w and par3 == 1 then
  2268.         break
  2269.       end
  2270.     end
  2271.   end
  2272. end
  2273.  
  2274. function addItem()
  2275.   window(8,7,"Add...")
  2276.   term.setTextColor(colors.white)
  2277.   sColor(colors.lime)
  2278.   printC("Folder",7)
  2279.   printC("File",9)
  2280.   sColor(colors.red)
  2281.   printC("Cancel",11)
  2282.   local choice = nil
  2283.   while true do
  2284.     event,par1,par2,par3 = os.pullEvent("mouse_click")
  2285.     if par3 == 7 and par2 >= 23 and par2 <= 28 then
  2286.       choice = 1
  2287.       break
  2288.     elseif par3 == 9 and par2 >= 24 and par2 <= 27 then
  2289.       choice = 2
  2290.       break
  2291.     elseif par3 == 11 and par2 >= 23 and par2 <=28 then
  2292.       choice = 3
  2293.       break
  2294.     end
  2295.   end
  2296.   if choice ~= 3 then
  2297.     window(26,3,"Enter name")
  2298.     sColor(colors.black)
  2299.     repeat
  2300.       printC(string.rep(" ",22),7)
  2301.       term.setCursorPos(15,7)
  2302.       input = read()
  2303.     until input ~= ""
  2304.     if fs.exists(shell.resolve(input)) then
  2305.       sColor(colors.gray)
  2306.       term.setTextColor(colors.red)
  2307.       printC("Already Exists!",8)
  2308.       sleep(2)
  2309.     elseif choice == 1 then
  2310.       fs.makeDir(shell.dir().."/"..input)
  2311.     elseif choice == 2 then
  2312.       f = fs.open(shell.dir().."/"..input,"w")
  2313.       f.close()
  2314.     end
  2315.   end
  2316. end
  2317.  
  2318. function move(item)
  2319.   path = shell.resolve(item)
  2320.   if #path <= 26 then
  2321.     window(26,5,"Move item")
  2322.   else
  2323.     window(#path+2,5,"Move item")
  2324.   end
  2325.   printC("Current path:",6)
  2326.   printC(path,7)
  2327.   printC("New path:",8)
  2328.   printC("Use 'cancel' to cancel",10)
  2329.   sColor(colors.black)
  2330.   repeat
  2331.     printC(string.rep(" ",22),9)
  2332.     term.setCursorPos(15,9)
  2333.     input = read()
  2334.   until input ~= ""
  2335.   sColor(colors.gray)
  2336.   printC(string.rep(" ",26),10)
  2337.   term.setTextColor(colors.red)
  2338.   if fs.exists(input) then
  2339.     printC("Already Exists!",10)
  2340.     sleep(2)
  2341.   elseif input == "cancel" then
  2342.     printC("Canceled",10)
  2343.     sleep(2)
  2344.   else
  2345.     fs.move(path,input)
  2346.     term.setTextColor(colors.lime)
  2347.     printC("Success",10)
  2348.     sleep(2)
  2349.   end    
  2350. end
  2351.  
  2352. function cRename(item)
  2353.   path = shell.resolve(item)
  2354.   if #path <= 26 then
  2355.     window(26,5,"Rename item")
  2356.   else
  2357.     window(#path+2,5,"Rename item")
  2358.   end
  2359.   printC("Current name:",6)
  2360.   printC(item,7)
  2361.   printC("New name:",8)
  2362.   printC("Use 'cancel' to cancel",10)
  2363.   sColor(colors.black)
  2364.   repeat
  2365.     printC(string.rep(" ",22),9)
  2366.     term.setCursorPos(15,9)
  2367.     input = read()
  2368.   until input ~= ""
  2369.   sColor(colors.gray)
  2370.   printC(string.rep(" ",26),10)
  2371.   term.setTextColor(colors.red)
  2372.   if fs.exists(shell.resolve(input)) then
  2373.     printC("Already Exists!",10)
  2374.     sleep(2)
  2375.   elseif string.find(input,"/") then
  2376.     printC("Cannot contain '/'",10)
  2377.     sleep(2)
  2378.   elseif input == "cancel" then
  2379.     printC("Canceled",10)
  2380.     sleep(2)
  2381.   else
  2382.     fs.move(path,input)
  2383.     term.setTextColor(colors.lime)
  2384.     printC("Success",10)
  2385.     sleep(2)
  2386.   end
  2387. end
  2388.  
  2389. --Main loop program--
  2390. function main()
  2391.   while true do
  2392.     drawDir()
  2393.     if menuS then
  2394.       term.setTextColor(colors.black)
  2395.       sColor(colors.white)
  2396.       printC(nSelect,h-1)
  2397.       if sType then  --If the item is a folder
  2398.         if fs.isReadOnly(shell.resolve(nSelect)) then  --If the folder is read-only
  2399.           printC("This is a read-only folder  O:Open Tab:Info",h)
  2400.         else  --Normal folder
  2401.           printC("O:Open  D:Delete  M:Move  N:Rename  Tab:Info",h)
  2402.         end
  2403.       else  --If the item is a file
  2404.         if shell.resolve(nSelect) == tProgram then  --If the file is this program
  2405.           printC("This program is currently running  Tab:Info",h)
  2406.         elseif fs.isReadOnly(shell.resolve(nSelect)) then  --If the file is read-only
  2407.           printC("This is a read-only file  R:Run P:Preview Tab:Info",h)
  2408.         else  --Normal file
  2409.           printC("R:Run E:Edit D:Delete M:Move N:Rename Tab:Info",h)
  2410.         end
  2411.       end
  2412.       term.setTextColor(colors.white)
  2413.     else
  2414.       term.setTextColor(colors.black)
  2415.       sColor(colors.white)
  2416.       if fs.isReadOnly(shell.dir()) then --If folder is read--only
  2417.         if #cDir > 16 then
  2418.           printC("B:Back  Tab:Enter Path  Page:PgUp/Down",h)
  2419.         else
  2420.           printC("B:Back  Tab:Enter Path",h)
  2421.           cPage = 1
  2422.         end
  2423.       else  --Normal Folder
  2424.         if #cDir > 16 then
  2425.           printC("C:Create... B:Back Tab:Enter path Page:PgUp/Down",h)
  2426.         else
  2427.           printC("C:Create...  B:Back  Tab:Enter path",h)
  2428.           cPage = 1
  2429.         end
  2430.       end
  2431.       term.setTextColor(colors.white)
  2432.     end
  2433.     event,par1,par2,par3,par4 = os.pullEvent()  --Main pullEvent--
  2434.     if event == "mouse_click" then
  2435.       if par2 == w and par3 == 1 then
  2436.         break
  2437.       else
  2438.         click = testSpot(par2,par3)
  2439.         if click then
  2440.           selected = click
  2441.         else
  2442.           selected = 0
  2443.         end
  2444.       end
  2445.     elseif event == "key" then
  2446.       if selected > 0 then  --If an item is selected
  2447.         if par1 == keys.tab then
  2448.           info(selected)
  2449.         end
  2450.         if shell.resolve(nSelect) ~= tProgram then
  2451.           if par1 == keys.d and not fs.isReadOnly(shell.resolve(nSelect)) then
  2452.             if confirm(" Delete? ") then
  2453.               fs.delete(shell.resolve(nSelect))
  2454.               selected = 0
  2455.             end          
  2456.           elseif par1 == keys.m and not fs.isReadOnly(shell.resolve(nSelect)) then
  2457.             os.pullEvent()
  2458.             move(nSelect)
  2459.             selected = 0
  2460.           elseif par1 == keys.n and not fs.isReadOnly(shell.resolve(nSelect)) then
  2461.             os.pullEvent()
  2462.             cRename(nSelect)
  2463.             selected = 0
  2464.           end
  2465.           if sType then --If the item is a directory
  2466.             if par1 == keys.o then
  2467.               shell.setDir(shell.resolve(nSelect))
  2468.               selected = 0          
  2469.             end
  2470.           else  --If the item is a file
  2471.             if par1 == keys.r then
  2472.               clear(colors.black)
  2473.               print("Begin program:")
  2474.               state,err = pcall(function() shell.run(nSelect) end )
  2475.               if err then
  2476.                 clear(colors.white)
  2477.                 bar()
  2478.                 printC("Program Error Report",1)
  2479.                 term.setCursorPos(1,3)
  2480.                 term.setTextColor(colors.black)
  2481.                 print("An error occured while running "..nSelect)
  2482.                 print(err)
  2483.                 while true do
  2484.                   event,par1,par2,par3 = os.pullEvent("mouse_click")
  2485.                   if par2 == w and par3 == 1 then
  2486.                     break
  2487.                   end
  2488.                 end
  2489.               else
  2490.                 term.setTextColor(colors.white)
  2491.                 print("End of program")
  2492.                 print("Press any key...")
  2493.                 term.setTextColor(colors.black)
  2494.                 print("End of program")
  2495.                 print("Press any key...")
  2496.                 os.pullEvent("key")
  2497.               end
  2498.               selected = 0
  2499.             elseif par1 == keys.e or par1 == keys.p then
  2500.               os.pullEvent()
  2501.               shell.run("edit "..nSelect)
  2502.               selected = 0
  2503.             end
  2504.           end
  2505.         end
  2506.       else  --If nothing is selected
  2507.         if par1 == keys.tab then
  2508.           changeDir()
  2509.         elseif par1 == keys.c and not fs.isReadOnly(shell.resolve(shell.dir())) then
  2510.           addItem()
  2511.         elseif par1 == keys.b then
  2512.           shell.run("cd ..")
  2513.         elseif par1 == 209 then
  2514.           if cPage > 1 then cPage = cPage-1 end
  2515.         elseif par1 == 201 then
  2516.           if cPage < nPage then cPage = cPage+1 end
  2517.         end
  2518.       end
  2519.     end
  2520.   end
  2521. end
  2522.  
  2523.  
  2524.  
  2525. --Program--
  2526. state,err = pcall(function() main() end)
  2527.  
  2528. if err then
  2529.   if not string.find("Terminated",err) then
  2530.     term.setTextColor(colors.white)
  2531.     sColor(colors.black)
  2532.     print("CRITICAL ERROR:")
  2533.     print(err)
  2534.     print("Press any key to continue")
  2535.     os.pullEvent("key")
  2536.   end
  2537. end
  2538.  
  2539. --after program ends
  2540. plocha ()
  2541.  
  2542. end
  2543.  
  2544. function prehravac ()
  2545. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  2546. local cnt=f.readAll()
  2547. f.close()
  2548. local nastaveni=textutils.unserialize(cnt)
  2549.  
  2550. term.setBackgroundColor(colors.white)
  2551. term.setTextColor(colors.black)
  2552. term.clear()
  2553. term.setCursorPos(1,1)
  2554. term.setBackgroundColor(nastaveni.barva)
  2555. term.setTextColor(colors.white)
  2556. print "                                                   "
  2557. term.setCursorPos(19,1)
  2558. prc (var48)
  2559. term.setTextColor(colors.black)
  2560.  
  2561. term.setCursorPos(5,8)
  2562. term.setBackgroundColor(colors.yellow)
  2563. term.setTextColor(colors.black)
  2564. print" Play "
  2565. term.setCursorPos(41,8)
  2566. print" Stop "
  2567. paintutils.drawPixel(51, 1, colors.red)
  2568. term.setTextColor(colors.white)
  2569. term.setCursorPos(51, 1)
  2570. print "Q"
  2571.  
  2572.  
  2573.  
  2574. while true do
  2575. local event, button, x, y = os.pullEvent("mouse_click")
  2576. xy = x..","..y
  2577.  
  2578. if xy == "51,1" and button == 1 then
  2579. plocha ()
  2580. break
  2581. end
  2582.  
  2583. if xy == "6,8" and button == 1 then
  2584. disk.playAudio("left")
  2585. disk.playAudio("right")
  2586. disk.playAudio("bottom")
  2587. prehravac ()
  2588. break
  2589. end
  2590.  
  2591. if xy == "7,8" and button == 1 then
  2592. disk.playAudio("left")
  2593. disk.playAudio("right")
  2594. disk.playAudio("bottom")
  2595. prehravac ()
  2596. break
  2597. end
  2598.  
  2599. if xy == "8,8" and button == 1 then
  2600. disk.playAudio("left")
  2601. disk.playAudio("right")
  2602. disk.playAudio("bottom")
  2603. prehravac ()
  2604. break
  2605. end
  2606.  
  2607. if xy == "9,8" and button == 1 then
  2608. disk.playAudio("left")
  2609. disk.playAudio("right")
  2610. disk.playAudio("bottom")
  2611. prehravac ()
  2612. break
  2613. end
  2614.  
  2615. if xy == "10,8" and button == 1 then
  2616. disk.playAudio("left")
  2617. disk.playAudio("right")
  2618. disk.playAudio("bottom")
  2619. prehravac ()
  2620. break
  2621. end
  2622.  
  2623. if xy == "11,8" and button == 1 then
  2624. disk.playAudio("left")
  2625. disk.playAudio("right")
  2626. disk.playAudio("bottom")
  2627. prehravac ()
  2628. break
  2629. end
  2630.  
  2631. if xy == "12,8" and button == 1 then
  2632. disk.playAudio("left")
  2633. disk.playAudio("right")
  2634. disk.playAudio("bottom")
  2635. prehravac ()
  2636. break
  2637. end
  2638.  
  2639. if xy == "45,8" and button == 1 then
  2640. print("Stop")
  2641. disk.stopAudio("left")
  2642. disk.stopAudio("right")
  2643. disk.stopAudio("bottom")
  2644. prehravac ()
  2645. break
  2646. end
  2647.  
  2648. if xy == "42,8" and button == 1 then
  2649. print("Stop")
  2650. disk.stopAudio("left")
  2651. disk.stopAudio("right")
  2652. disk.stopAudio("bottom")
  2653. prehravac ()
  2654. break
  2655. end
  2656.  
  2657. if xy == "43,8" and button == 1 then
  2658. print("Stop")
  2659. disk.stopAudio("left")
  2660. disk.stopAudio("right")
  2661. disk.stopAudio("bottom")
  2662. prehravac ()
  2663. break
  2664. end
  2665.  
  2666. if xy == "44,8" and button == 1 then
  2667. print("Stop")
  2668. disk.stopAudio("left")
  2669. disk.stopAudio("right")
  2670. disk.stopAudio("bottom")
  2671. prehravac ()
  2672. break
  2673. end
  2674. end
  2675. end
  2676.  
  2677. function malovani ()
  2678. if fs.exists ("/np")then
  2679. shell.run ("np")
  2680. else
  2681. prc (var49, 10)
  2682. sleep (1)
  2683. plocha ()
  2684. end
  2685. end
  2686.  
  2687. function textovani ()
  2688. if fs.exists ("/ink")then
  2689. shell.run ("ink")
  2690. else
  2691. prc (var49, 10)
  2692. sleep (1)
  2693. plocha ()
  2694. end
  2695. end
  2696.  
  2697. function pastebin ()
  2698. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  2699. local cnt=f.readAll()
  2700. f.close()
  2701. local nastaveni=textutils.unserialize(cnt)
  2702. term.setBackgroundColor(colors.white)
  2703. term.clear ()
  2704. term.setBackgroundColor(nastaveni.barva)
  2705. term.setCursorPos(1,1)
  2706. print "                                                   "
  2707. term.setTextColor(colors.white)
  2708. prc ("Pastebin Manager", 1)
  2709. term.setTextColor(colors.black)
  2710. term.setBackgroundColor(colors.lightBlue)
  2711. term.setCursorPos(5,4)
  2712. print "- Run "
  2713. term.setCursorPos(5,6)
  2714. print "- Get "
  2715. term.setCursorPos(5,8)
  2716. print "- Put "
  2717. term.setBackgroundColor(colors.red)
  2718. term.setCursorPos(51, 1)
  2719. print " "
  2720. term.setTextColor(colors.white)
  2721. term.setCursorPos(51, 1)
  2722. print "Q"
  2723. term.setTextColor(colors.black)
  2724. term.setBackgroundColor(colors.white)
  2725.  
  2726. while true do
  2727. local event, button, x, y = os.pullEventRaw()
  2728. if event == "mouse_click" then
  2729. if x >= 5 and x <= 10 and y == 4 and button == 1 then
  2730. spustit ()
  2731. elseif x >= 5 and x <= 10 and y == 6 and button == 1 then
  2732. ulozit ()
  2733. elseif x >= 5 and x <= 10 and y == 8 and button == 1 then
  2734. nahrat ()
  2735. elseif x == 51 and y == 1 and button == 1 then
  2736. plocha ()
  2737. end
  2738. end
  2739. end
  2740. end
  2741.  
  2742. function spustit ()
  2743. term.setCursorPos(4,12)
  2744. print "enter the code"
  2745. term.setCursorPos(4,13)
  2746. term.setBackgroundColor(colors.lightBlue)
  2747. print "          "
  2748. term.setCursorPos(4,13)
  2749. kod1 = io.read ()
  2750. if kod1 == "" then
  2751. pastebin ()
  2752. else
  2753. term.setCursorPos(4,18)
  2754. print "The service is disabled on this pc!!"
  2755. sleep (1)
  2756. plocha ()
  2757. end
  2758.  
  2759. while true do
  2760. if x == 51 and y == 1 and button == 1 then
  2761. plocha ()
  2762. end
  2763. end
  2764. end
  2765.  
  2766. function ulozit ()
  2767. term.setCursorPos(4,12)
  2768. print "enter the code"
  2769. term.setCursorPos(4,13)
  2770. term.setBackgroundColor(colors.lightBlue)
  2771. print "          "
  2772. term.setCursorPos(4,13)
  2773. kod1 = io.read ()
  2774. if kod1 == "" then
  2775. pastebin ()
  2776. else
  2777. term.setBackgroundColor(colors.white)
  2778. term.setCursorPos(4,12)
  2779. print "Name:  |Path: /Downloaded/NAME"
  2780. print "                                     "
  2781. end
  2782. term.setCursorPos(4,13)
  2783. term.setBackgroundColor(colors.lightBlue)
  2784. print "          "
  2785. term.setCursorPos(4,13)
  2786. kod2 = io.read ()
  2787. if kod2 == "" then
  2788. pastebin ()
  2789. else
  2790. term.setCursorPos(4,18)
  2791. print "The service is disabled on this pc!!"
  2792. sleep (1)
  2793. prohlizec ()
  2794. end
  2795. while true do
  2796. if x == 51 and y == 1 and button == 1 then
  2797. plocha ()
  2798. end
  2799. end
  2800. end
  2801.  
  2802. function nahrat ()
  2803. term.setCursorPos(4,12)
  2804. print "enter the path"
  2805. term.setCursorPos(4,13)
  2806. term.setBackgroundColor(colors.lightBlue)
  2807. print "          "
  2808. term.setCursorPos(4,13)
  2809. kod1 = io.read ()
  2810. if kod1 == "" then
  2811. pastebin ()
  2812. else
  2813. shell.run ("pastebin put",kod1)
  2814. end
  2815. pokr = io.read ()
  2816. if pokr == "" then
  2817. plocha ()
  2818. else
  2819. plocha ()
  2820. end
  2821. while true do
  2822. if x == 51 and y == 1 and button == 1 then
  2823. plocha ()
  2824. end
  2825. end
  2826. end
  2827.  
  2828. function obrnastaveni ()
  2829. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  2830. local cnt=f.readAll()
  2831. f.close()
  2832. local nastaveni=textutils.unserialize(cnt)
  2833. if anim == 1 then
  2834. term.setBackgroundColor(colors.gray)
  2835. term.clear()
  2836. sleep (0.1)
  2837. term.setBackgroundColor(colors.lightGray)
  2838. term.clear()
  2839. sleep (0.1)
  2840. anim = 0
  2841. end
  2842. term.setBackgroundColor(colors.white)
  2843. term.setTextColor(colors.black)
  2844. term.clear()
  2845. term.setCursorPos(1,1)
  2846. term.setBackgroundColor(nastaveni.barva)
  2847. term.setTextColor(colors.white)
  2848. print "                                                   "
  2849. paintutils.drawPixel(51, 1, colors.red)
  2850. term.setTextColor(colors.white)
  2851. term.setCursorPos(51, 1)
  2852. print "Q"
  2853. term.setBackgroundColor(nastaveni.barva)
  2854. term.setCursorPos(1, 1)
  2855. print "                   "
  2856. print "                   "
  2857. print " Command Line      "
  2858. print "                   "
  2859. print (var51)
  2860. print "                   "
  2861. print (var52)
  2862. print "                   "
  2863. print (var53)
  2864. print "                   "
  2865. print (var54)
  2866. print "                   "
  2867. print (var55)
  2868. print "                   "
  2869. print (var81)
  2870. print "                   "
  2871. print (var91)
  2872. print "                   "
  2873. term.setBackgroundColor(colors.white)
  2874. term.setTextColor(colors.black)
  2875. prc (var56, 3)
  2876. term.setCursorPos(21, 5)
  2877. print ("- NPaint")
  2878. term.setCursorPos(21, 7)
  2879. print ("- File Manager v1.2")
  2880. term.setCursorPos(21, 9)
  2881. print ("- Ink by oeed")
  2882. term.setCursorPos(21, 11)
  2883. print ("- Pepdroll addons")
  2884. term.setCursorPos(21, 13)
  2885. print ("- Dynet client by Laurens Weyn")
  2886. term.setCursorPos(21, 15)
  2887. print "- Advanced calculator Immicalc"
  2888. term.setBackgroundColor(nastaveni.barva)
  2889. term.setTextColor(colors.white)
  2890. term.setCursorPos(23,1)
  2891. prc (var50)
  2892.  
  2893. while true do
  2894. local event, button, x, y = os.pullEvent("mouse_click")
  2895. xy = x..","..y
  2896.  
  2897. if xy == "51,1" and button == 1 then
  2898. plocha ()
  2899. break
  2900. end
  2901.  
  2902. if x >= 0 and x <= 19 and y == 5 and button == 1 then
  2903. uzivatele ()
  2904. break
  2905. end
  2906.  
  2907. if x >= 0 and x <= 19 and y == 7 and button == 1 then
  2908. network ()
  2909. break
  2910. end
  2911.  
  2912. if x >= 0 and x <= 19 and y == 9 and button == 1 then
  2913. pozadi ()
  2914. break
  2915. end
  2916.  
  2917. if x >= 0 and x <= 19 and y == 11 and button == 1 then
  2918. pocitac ()
  2919. break
  2920. end
  2921.  
  2922. if x >= 0 and x <= 19 and y == 13 and button == 1 then
  2923. system ()
  2924. break
  2925. end
  2926.  
  2927. if x >= 0 and x <= 19 and y == 15 and button == 1 then
  2928. jazyky ()
  2929. break
  2930. end
  2931.  
  2932. if x >= 0 and x <= 19 and y == 17 and button == 1 then
  2933. biosn ()
  2934. break
  2935. end
  2936.  
  2937. if x >= 0 and x <= 19 and y == 3 and button == 1 then
  2938.     term.setBackgroundColor(colors.black)
  2939.     term.clear ()
  2940.     term.setCursorPos(1,1)
  2941. shell.run ("/.core/shell")
  2942. break
  2943. end
  2944.  
  2945. end
  2946. end
  2947.  
  2948. function biosn ()
  2949.  
  2950. if bios == "1" then
  2951.     local data= fs.open ("/.core/biosset", "r")
  2952.     a = data.readLine()
  2953.     b = data.readLine()
  2954.     c = data.readLine()
  2955.     d = data.readLine()
  2956.     e = data.readLine()
  2957.     f = data.readLine()
  2958.     g = data.readLine()
  2959.     h = data.readLine()
  2960.     data.close ()
  2961. end
  2962.     if a == "0" and b == "0" and c == "0" then
  2963.         fass = "Enable"
  2964.         else
  2965.         fass = "Disable"
  2966.         end
  2967.        
  2968.     if a == "1" then
  2969.         as = "Enabled"
  2970.     else
  2971.         as = "Disabled"
  2972.     end
  2973.    
  2974.     if b == "1" then
  2975.         bs = "Enabled"
  2976.     else
  2977.         bs = "Disabled"
  2978.     end
  2979.    
  2980.     if c == "1" then
  2981.         cs = "Enabled"
  2982.     else
  2983.         cs = "Disabled"
  2984.     end
  2985.    
  2986.    local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  2987. local cnt=f.readAll()
  2988. f.close()
  2989. local nastaveni=textutils.unserialize(cnt)
  2990. term.setBackgroundColor(colors.white)
  2991. term.setTextColor(colors.black)
  2992. term.clear()
  2993. term.setCursorPos(1,1)
  2994. term.setBackgroundColor(nastaveni.barva)
  2995. term.setTextColor(colors.white)
  2996. print "                                                   "
  2997. term.setCursorPos(23,1)
  2998. prc (var91)
  2999. paintutils.drawPixel(51, 1, colors.red)
  3000. term.setTextColor(colors.white)
  3001. term.setCursorPos(51, 1)
  3002. print "Q"
  3003. paintutils.drawPixel(1, 1, colors.yellow)
  3004. paintutils.drawPixel(2, 1, colors.yellow)
  3005. term.setTextColor(colors.white)
  3006. term.setCursorPos(1, 1)
  3007. print "<-"
  3008. term.setBackgroundColor(colors.lightBlue)
  3009. term.setTextColor(colors.black)
  3010. term.setCursorPos (45,18)
  3011. print "apply"
  3012. term.setCursorPos(5, 4)
  3013. print ("- "..var92.." "..fass)
  3014. term.setCursorPos(5, 6)
  3015. print ("- "..var93.." "..as)
  3016. term.setCursorPos(5, 8)
  3017. print ("- "..var94.." "..bs)
  3018. term.setCursorPos(5, 10)
  3019. print ("- Disk list "..cs)
  3020.    
  3021.  while true do
  3022. local event, button, x, y = os.pullEvent("mouse_click")
  3023. xy = x..","..y
  3024.  
  3025. if xy == "51,1" and button == 1 then
  3026. plocha ()
  3027. break
  3028. end
  3029.  
  3030. if x >= 1 and x <= 2 and y == 1 and button == 1 then
  3031. obrnastaveni ()
  3032. break
  3033. end
  3034.  
  3035. if x >= 45 and x <= 51 and y == 18 and button == 1 then
  3036.     local data= fs.open ("/.core/biosset", "w")
  3037.         local x = "1"
  3038.         data.writeLine (a)
  3039.         data.writeLine (b)
  3040.         data.writeLine (c)
  3041.         data.writeLine (d)
  3042.         data.writeLine (e)
  3043.         data.writeLine (f)
  3044.         data.writeLine (g)
  3045.         data.writeLine (h)
  3046.         data.close ()
  3047.         obrnastaveni ()
  3048.         end
  3049. if x >= 5 and x <= 51 and y == 4 and button == 1 then
  3050.     a = "0"
  3051.     b = "0"
  3052.     c = "0"
  3053.     d = "0"
  3054.     e = "0"
  3055.     f = "0"
  3056.     biosn ()
  3057.     end
  3058. if x >= 5 and x <= 51 and y == 6 and button == 1 then
  3059.     bios = 0
  3060.     if a == "1" then
  3061.         a = "0"
  3062.         biosn ()
  3063.     elseif a == "0" then
  3064.         a = "1"
  3065.         biosn ()
  3066.     end
  3067. end
  3068.  
  3069. if x >= 5 and x <= 51 and y == 8 and button == 1 then
  3070.     print "test"
  3071.     bios = 0
  3072.     if b == "1" then
  3073.         b = "0"
  3074.         biosn ()
  3075.     elseif b == "0" then
  3076.         b = "1"
  3077.         biosn ()
  3078.     end
  3079. end
  3080.  
  3081. if x >= 5 and x <= 51 and y == 10 and button == 1 then
  3082.     print "test"
  3083.     bios = 0
  3084.     if c == "1" then
  3085.         c = "0"
  3086.         biosn ()
  3087.     elseif c == "0" then
  3088.         c = "1"
  3089.         biosn ()
  3090.     end
  3091. end
  3092. end
  3093. end
  3094.    
  3095.  
  3096. function cmd()
  3097.     term.setTextColor(colors.white)
  3098.     term.clear ()
  3099.         term.setCursorPos (1,1)
  3100.         print "Enter 'exit' to exit"
  3101.     term.setCursorPos (1,2)
  3102.     prikaz = read()
  3103.     if prikaz == "exit" then
  3104.         obrnastaveni ()
  3105.     end
  3106.         if prikaz == "delete system" then
  3107.         obrnastaveni ()
  3108.     end
  3109.     shell.run (prikaz)
  3110.     sleep (1)
  3111.     cmd ()
  3112.  end
  3113.  
  3114. function jazyky ()
  3115. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  3116. local cnt=f.readAll()
  3117. f.close()
  3118. local nastaveni=textutils.unserialize(cnt)
  3119. term.setBackgroundColor(colors.white)
  3120. term.setTextColor(colors.black)
  3121. term.clear()
  3122. term.setCursorPos(1,1)
  3123. term.setBackgroundColor(nastaveni.barva)
  3124. term.setTextColor(colors.white)
  3125. print "                                                   "
  3126. term.setCursorPos(23,1)
  3127. prc (var82)
  3128. paintutils.drawPixel(51, 1, colors.red)
  3129. term.setTextColor(colors.white)
  3130. term.setCursorPos(51, 1)
  3131. print "Q"
  3132. paintutils.drawPixel(1, 1, colors.yellow)
  3133. paintutils.drawPixel(2, 1, colors.yellow)
  3134. term.setTextColor(colors.white)
  3135. term.setCursorPos(1, 1)
  3136. print "<-"
  3137. term.setBackgroundColor(colors.lightBlue)
  3138. term.setTextColor(colors.black)
  3139. term.setCursorPos(5, 4)
  3140. print ("- "..var84)
  3141. term.setCursorPos(5, 6)
  3142. print ("- "..var85)
  3143.  
  3144. while true do
  3145. local event, button, x, y = os.pullEvent("mouse_click")
  3146. xy = x..","..y
  3147.  
  3148. if xy == "51,1" and button == 1 then
  3149. plocha ()
  3150. break
  3151. end
  3152.  
  3153. if x >= 1 and x <= 2 and y == 1 and button == 1 then
  3154. obrnastaveni ()
  3155. break
  3156. end
  3157.  
  3158. if x >= 5 and x <= 50 and y == 4 and button == 1 then
  3159. jazykya ()
  3160. break
  3161. end
  3162.  
  3163. if x >= 5 and x <= 50 and y == 6 and button == 1 then
  3164. jazykypc ()
  3165. break
  3166. end
  3167.  
  3168. end
  3169. end
  3170.  
  3171. function jazykya ()
  3172. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  3173. local cnt=f.readAll()
  3174. f.close()
  3175. local nastaveni=textutils.unserialize(cnt)
  3176. term.setBackgroundColor(colors.white)
  3177. term.setTextColor(colors.black)
  3178. term.clear()
  3179. term.setCursorPos(1,1)
  3180. term.setBackgroundColor(nastaveni.barva)
  3181. term.setTextColor(colors.white)
  3182. print "                                                   "
  3183. term.setCursorPos(23,1)
  3184. prc (var84)
  3185. paintutils.drawPixel(51, 1, colors.red)
  3186. term.setTextColor(colors.white)
  3187. term.setCursorPos(51, 1)
  3188. print "Q"
  3189. paintutils.drawPixel(1, 1, colors.yellow)
  3190. paintutils.drawPixel(2, 1, colors.yellow)
  3191. term.setTextColor(colors.white)
  3192. term.setCursorPos(1, 1)
  3193. print "<-"
  3194. term.setBackgroundColor(colors.lightBlue)
  3195. term.setTextColor(colors.black)
  3196. term.setCursorPos(5, 4)
  3197. print "- English"
  3198. term.setCursorPos(5, 6)
  3199. print "- Deutsch"
  3200. term.setCursorPos(5, 8)
  3201. print "- Cestina"
  3202. term.setCursorPos(5, 10)
  3203. print "- Slovencina"
  3204.  
  3205. while true do
  3206. local event, button, x, y = os.pullEvent("mouse_click")
  3207. xy = x..","..y
  3208.  
  3209. if xy == "51,1" and button == 1 then
  3210. plocha ()
  3211. break
  3212. end
  3213.  
  3214. if x >= 1 and x <= 2 and y == 1 and button == 1 then
  3215. jazyky ()
  3216. break
  3217. end
  3218.  
  3219. if x >= 5 and x <= 12 and y == 4 and button == 1 then
  3220. shell.run ("delete /.ucet/"..user.."/language")
  3221. shell.run ("pastebin get sh70PdPx /.ucet/"..user.."/language")
  3222. jazyky ()
  3223. break
  3224. end
  3225.  
  3226. if x >= 5 and x <= 12 and y == 6 and button == 1 then
  3227. shell.run ("delete /.ucet/"..user.."/language")
  3228. shell.run ("pastebin get 2QDGWDfM /.ucet/"..user.."/language")
  3229. jazyky ()
  3230. break
  3231. end
  3232.  
  3233. if x >= 5 and x <= 12 and y == 8 and button == 1 then
  3234. shell.run ("delete /.ucet/"..user.."/language")
  3235. shell.run ("pastebin get g8w9iiQj /.ucet/"..user.."/language")
  3236. jazyky ()
  3237. break
  3238. end
  3239.  
  3240. if x >= 5 and x <= 16 and y == 10 and button == 1 then
  3241. shell.run ("delete /.ucet/"..user.."/language")
  3242. shell.run ("pastebin get MMsETUui /.ucet/"..user.."/language")
  3243. jazyky ()
  3244. break
  3245. end
  3246.  
  3247. end
  3248. end
  3249.  
  3250. function jazykypc ()
  3251. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  3252. local cnt=f.readAll()
  3253. f.close()
  3254. local nastaveni=textutils.unserialize(cnt)
  3255. term.setBackgroundColor(colors.white)
  3256. term.setTextColor(colors.black)
  3257. term.clear()
  3258. term.setCursorPos(1,1)
  3259. term.setBackgroundColor(nastaveni.barva)
  3260. term.setTextColor(colors.white)
  3261. print "                                                   "
  3262. term.setCursorPos(23,1)
  3263. prc (var85)
  3264. paintutils.drawPixel(51, 1, colors.red)
  3265. term.setTextColor(colors.white)
  3266. term.setCursorPos(51, 1)
  3267. print "Q"
  3268. paintutils.drawPixel(1, 1, colors.yellow)
  3269. paintutils.drawPixel(2, 1, colors.yellow)
  3270. term.setTextColor(colors.white)
  3271. term.setCursorPos(1, 1)
  3272. print "<-"
  3273. term.setBackgroundColor(colors.lightBlue)
  3274. term.setTextColor(colors.black)
  3275. term.setCursorPos(5, 4)
  3276. print "- English"
  3277. term.setCursorPos(5, 6)
  3278. print "- Deutsch"
  3279. term.setCursorPos(5, 8)
  3280. print "- Cestina"
  3281. term.setCursorPos(5, 10)
  3282. print "- Slovencina"
  3283.  
  3284. while true do
  3285. local event, button, x, y = os.pullEvent("mouse_click")
  3286. xy = x..","..y
  3287.  
  3288. if xy == "51,1" and button == 1 then
  3289. plocha ()
  3290. break
  3291. end
  3292.  
  3293. if x >= 1 and x <= 2 and y == 1 and button == 1 then
  3294. jazyky ()
  3295. break
  3296. end
  3297.  
  3298. if x >= 5 and x <= 12 and y == 4 and button == 1 then
  3299. shell.run ("delete /.core/language")
  3300. shell.run ("pastebin get sh70PdPx /.core/language")
  3301. jazyky ()
  3302. break
  3303. end
  3304.  
  3305. if x >= 5 and x <= 12 and y == 6 and button == 1 then
  3306. shell.run ("delete /.core/language")
  3307. shell.run ("pastebin get 2QDGWDfM /.core/language")
  3308. jazyky ()
  3309. break
  3310. end
  3311.  
  3312. if x >= 5 and x <= 12 and y == 8 and button == 1 then
  3313. shell.run ("delete /.core/language")
  3314. shell.run ("pastebin get g8w9iiQj /.core/language")
  3315. jazyky ()
  3316. break
  3317. end
  3318.  
  3319. if x >= 5 and x <= 16 and y == 10 and button == 1 then
  3320. shell.run ("delete /.core/language")
  3321. shell.run ("pastebin get MMsETUui /.core/language")
  3322. jazyky ()
  3323. break
  3324. end
  3325.  
  3326. end
  3327. end
  3328.  
  3329. function network ()
  3330. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  3331. local cnt=f.readAll()
  3332. f.close()
  3333. local nastaveni=textutils.unserialize(cnt)
  3334. term.setBackgroundColor(colors.white)
  3335. term.setTextColor(colors.black)
  3336. term.clear()
  3337. term.setCursorPos(1,1)
  3338. term.setBackgroundColor(nastaveni.barva)
  3339. term.setTextColor(colors.white)
  3340. print "                                                   "
  3341. term.setCursorPos(23,1)
  3342. prc (var57)
  3343. paintutils.drawPixel(51, 1, colors.red)
  3344. term.setTextColor(colors.white)
  3345. term.setCursorPos(51, 1)
  3346. print "Q"
  3347. paintutils.drawPixel(1, 1, colors.yellow)
  3348. paintutils.drawPixel(2, 1, colors.yellow)
  3349. term.setTextColor(colors.white)
  3350. term.setCursorPos(1, 1)
  3351. print "<-"
  3352. term.setBackgroundColor(colors.lightBlue)
  3353. term.setTextColor(colors.black)
  3354. term.setCursorPos(5, 6)
  3355. print "- Label"
  3356. term.setCursorPos(5, 12)
  3357. print "- Rednet"
  3358.  
  3359. while true do
  3360. local event, button, x, y = os.pullEvent("mouse_click")
  3361. xy = x..","..y
  3362.  
  3363. if xy == "51,1" and button == 1 then
  3364. plocha ()
  3365. break
  3366. end
  3367.  
  3368. if x >= 1 and x <= 2 and y == 1 and button == 1 then
  3369. obrnastaveni()
  3370. break
  3371. end
  3372.  
  3373. if x >= 5 and x <= 12 and y == 6 and button == 1 then
  3374. propojeni ()
  3375. break
  3376. end
  3377.  
  3378. if x >= 5 and x <= 11 and y == 12 and button == 1 then
  3379. modem ()
  3380. break
  3381. end
  3382. end
  3383. end
  3384. -----------------------------
  3385. function modem ()
  3386. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  3387. local cnt=f.readAll()
  3388. f.close()
  3389. local nastaveni=textutils.unserialize(cnt)
  3390. term.setBackgroundColor(colors.white)
  3391. term.clear ()
  3392. term.setBackgroundColor(nastaveni.barva)
  3393. term.setCursorPos(1,1)
  3394. print "                                                   "
  3395. term.setTextColor(colors.white)
  3396. prc (var57.." - Rednet", 1)
  3397. term.setTextColor(colors.black)
  3398. term.setBackgroundColor(colors.lightBlue)
  3399. term.setCursorPos(5,6)
  3400. print "- Open  "
  3401. term.setCursorPos(5,12)
  3402. print "- Close "
  3403. term.setBackgroundColor(colors.red)
  3404. term.setCursorPos(51, 1)
  3405. print " "
  3406. term.setTextColor(colors.white)
  3407. term.setCursorPos(51, 1)
  3408. print "Q"
  3409. paintutils.drawPixel(1, 1, colors.yellow)
  3410. paintutils.drawPixel(2, 1, colors.yellow)
  3411. term.setTextColor(colors.white)
  3412. term.setCursorPos(1, 1)
  3413. print "<-"
  3414. term.setTextColor(colors.black)
  3415. term.setBackgroundColor(colors.white)
  3416.  
  3417.  
  3418. while true do
  3419. local event, button, x, y = os.pullEventRaw()
  3420. if event == "mouse_click" then
  3421.  
  3422. while true do
  3423. local event, button, x, y = os.pullEventRaw()
  3424. if event == "mouse_click" then
  3425. if x >= 5 and x <= 10 and y == 6 and button == 1 then
  3426. modemSide = openRednet()
  3427. if modemSide == nil then
  3428.   term.setBackgroundColor(colors.white)
  3429.   term.setTextColor(colors.red)
  3430.   print(var18)
  3431.   sleep (1)
  3432. else
  3433.   term.setBackgroundColor(colors.white)
  3434.   term.setTextColor(colors.lime)
  3435.   term.setCursorPos (5,4)
  3436.   print ("Open "..modemSide)
  3437.   sleep (1)
  3438.   network ()
  3439.   end
  3440. elseif x >= 5 and x <= 10 and y == 12 and button == 1 then
  3441. modemSide = closeRednet()
  3442. if modemSide == nil then
  3443.   term.setBackgroundColor(colors.white)
  3444.   term.setTextColor(colors.red)
  3445.   print(var17)
  3446.   sleep (1)
  3447. else
  3448.   term.setBackgroundColor(colors.white)
  3449.   term.setTextColor(colors.red)
  3450.   term.setCursorPos (5,4)
  3451.   print("Close "..modemSide)
  3452.   sleep (1)
  3453. network ()
  3454. end
  3455. elseif x == 51 and y == 1 and button == 1 then
  3456. plocha ()
  3457. end
  3458.  
  3459. if x >= 1 and x <= 2 and y == 1 and button == 1 then
  3460. network()
  3461. break
  3462. end
  3463. end
  3464. end
  3465. end
  3466. end
  3467. end
  3468.  -----------------------------
  3469. function propojeni ()
  3470. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  3471. local cnt=f.readAll()
  3472. f.close()
  3473. local nastaveni=textutils.unserialize(cnt)
  3474. term.setBackgroundColor(colors.white)
  3475. term.clear ()
  3476. term.setBackgroundColor(nastaveni.barva)
  3477. term.setCursorPos(1,1)
  3478. print "                                                   "
  3479. term.setTextColor(colors.white)
  3480. prc (var57.." - Label", 1)
  3481. term.setTextColor(colors.black)
  3482. term.setBackgroundColor(colors.lightBlue)
  3483. term.setCursorPos(5,6)
  3484. print "- Set "
  3485. term.setCursorPos(5,12)
  3486. print "- Clear "
  3487. term.setBackgroundColor(colors.red)
  3488. term.setCursorPos(51, 1)
  3489. print " "
  3490. term.setTextColor(colors.white)
  3491. term.setCursorPos(51, 1)
  3492. print "Q"
  3493. paintutils.drawPixel(1, 1, colors.yellow)
  3494. paintutils.drawPixel(2, 1, colors.yellow)
  3495. term.setTextColor(colors.white)
  3496. term.setCursorPos(1, 1)
  3497. print "<-"
  3498. term.setTextColor(colors.black)
  3499. term.setBackgroundColor(colors.white)
  3500.  
  3501. while true do
  3502. local event, button, x, y = os.pullEventRaw()
  3503. if event == "mouse_click" then
  3504. if x >= 5 and x <= 10 and y == 6 and button == 1 then
  3505. term.setBackgroundColor(colors.lightBlue)
  3506. term.setCursorPos(15,6)
  3507. print "                 "
  3508. term.setCursorPos(16,6)
  3509. jmeno = read ()
  3510. term.setCursorPos(16,7)
  3511. os.setComputerLabel(jmeno)
  3512. term.setBackgroundColor(colors.lime)
  3513. term.setCursorPos(15,6)
  3514. print "     Labeled     "
  3515. sleep (1)
  3516. network ()
  3517. elseif x >= 5 and x <= 10 and y == 12 and button == 1 then
  3518. term.setCursorPos(10,13)
  3519. shell.run ("label clear")
  3520. term.setBackgroundColor(colors.red)
  3521. term.setCursorPos(10,12)
  3522. print "     Removed     "
  3523. sleep (1)
  3524. network ()
  3525. elseif x == 51 and y == 1 and button == 1 then
  3526. plocha ()
  3527. end
  3528.  
  3529. if x >= 1 and x <= 2 and y == 1 and button == 1 then
  3530. network()
  3531. break
  3532. end
  3533.  
  3534. end
  3535. end
  3536. end
  3537. -------------------------------------
  3538.  
  3539. function pocitac ()
  3540. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  3541. local cnt=f.readAll()
  3542. f.close()
  3543. local nastaveni=textutils.unserialize(cnt)
  3544. term.setBackgroundColor(colors.white)
  3545. term.setTextColor(colors.black)
  3546. term.clear()
  3547. term.setCursorPos(1,1)
  3548. term.setBackgroundColor(nastaveni.barva)
  3549. term.setTextColor(colors.white)
  3550. print "                                                   "
  3551. term.setCursorPos(23,1)
  3552. prc (var58)
  3553. paintutils.drawPixel(51, 1, colors.red)
  3554. term.setTextColor(colors.white)
  3555. term.setCursorPos(51, 1)
  3556. print "Q"
  3557. paintutils.drawPixel(1, 1, colors.yellow)
  3558. paintutils.drawPixel(2, 1, colors.yellow)
  3559. term.setTextColor(colors.white)
  3560. term.setCursorPos(1, 1)
  3561. print "<-"
  3562. term.setBackgroundColor(colors.white)
  3563. term.setTextColor(colors.black)
  3564. term.setCursorPos(5, 3)
  3565. print ("Pepdroll 6.2 Pro: "..verze)
  3566. term.setCursorPos(5,5)
  3567. print( "Label: "..var59)
  3568. term.setCursorPos(5, 4)
  3569. if #tArgs > 0 then
  3570.     sDrive = tostring( tArgs[1] )
  3571. end
  3572.  
  3573. if sDrive == nil then
  3574.     print( "ID: "..os.getComputerID() )
  3575.    
  3576.     local label = os.getComputerLabel()
  3577.     if label then
  3578.     term.setCursorPos(5,5)
  3579.         print( "Label: \""..label.."\"" )
  3580.     end
  3581.  
  3582. else
  3583.     local bData = disk.hasData( sDrive )
  3584.     if not bData then
  3585.         print( "No disk in drive "..sDrive )
  3586.         return
  3587.     end
  3588.     term.setCursorPos(32,18)
  3589.     print( "ID disk #"..disk.getID( sDrive ) )
  3590.  
  3591.     local label = disk.getLabel( sDrive )
  3592.     if label then
  3593.         print( "The disk is labelled \""..label.."\"" )
  3594.     end
  3595. end
  3596. term.setCursorPos(5, 6)
  3597. print (var60)
  3598. paintutils.drawPixel(30, 6, nastaveni.barva)
  3599. term.setBackgroundColor(colors.white)
  3600. term.setCursorPos(5, 7)
  3601. print (var61)
  3602. term.setCursorPos(30, 7)
  3603. term.setBackgroundColor(colors.yellow)
  3604. print (user)
  3605. term.setBackgroundColor(colors.white)
  3606. term.setCursorPos(5, 8)
  3607. print (var62)
  3608. term.setBackgroundColor(colors.black)
  3609. print "                                                   "
  3610. print "                                                   "
  3611. print "                                                   "
  3612. print "                                                   "
  3613. print "                                                   "
  3614. print "                                                   "
  3615. print "                                                   "
  3616. print "                                                   "
  3617. print "                                                   "
  3618. print "                                                   "
  3619. term.setTextColor(colors.white)
  3620. term.setCursorPos(5, 9)
  3621. shell.run ("list")
  3622.  
  3623. while true do
  3624. local event, button, x, y = os.pullEvent("mouse_click")
  3625. xy = x..","..y
  3626.  
  3627. if xy == "51,1" and button == 1 then
  3628. plocha ()
  3629. break
  3630. end
  3631.  
  3632. if x >= 1 and x <= 2 and y == 1 and button == 1 then
  3633. obrnastaveni()
  3634. break
  3635. end
  3636. end
  3637. end
  3638. -----------------------------
  3639.  
  3640. function system ()
  3641. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  3642. local cnt=f.readAll()
  3643. f.close()
  3644. local nastaveni=textutils.unserialize(cnt)
  3645. term.setBackgroundColor(colors.white)
  3646. term.setTextColor(colors.black)
  3647. term.clear()
  3648. term.setCursorPos(1,1)
  3649. term.setBackgroundColor(nastaveni.barva)
  3650. term.setTextColor(colors.white)
  3651. print "                                                   "
  3652. term.setCursorPos(23,1)
  3653. prc (" System ")
  3654. paintutils.drawPixel(51, 1, colors.red)
  3655. term.setTextColor(colors.white)
  3656. term.setCursorPos(51, 1)
  3657. print "Q"
  3658. paintutils.drawPixel(1, 1, colors.yellow)
  3659. paintutils.drawPixel(2, 1, colors.yellow)
  3660. term.setTextColor(colors.white)
  3661. term.setCursorPos(1, 1)
  3662. print "<-"
  3663. term.setBackgroundColor(colors.lightBlue)
  3664. term.setTextColor(colors.black)
  3665. term.setCursorPos(5, 6)
  3666. print (var63)
  3667. term.setCursorPos(5, 12)
  3668. print (var64)
  3669. term.setCursorPos(5, 18)
  3670. print (var65)
  3671.  
  3672. while true do
  3673. local event, button, x, y = os.pullEvent("mouse_click")
  3674. xy = x..","..y
  3675.  
  3676. if xy == "51,1" and button == 1 then
  3677. plocha ()
  3678. break
  3679. end
  3680.  
  3681. if x >= 1 and x <= 2 and y == 1 and button == 1 then
  3682. obrnastaveni()
  3683. break
  3684. end
  3685.  
  3686. if x >= 5 and x <= 25 and y == 6 and button == 1 then
  3687. fs.delete ("/startup")
  3688. shell.run ("pastebin get 3R3M6XeK /startup")
  3689. systems ()
  3690. break
  3691. end
  3692.  
  3693. if x >= 5 and x <= 25 and y == 12 and button == 1 then
  3694. aktualizace()
  3695. break
  3696. end
  3697.  
  3698. if x >= 5 and x <= 25 and y == 18 and button == 1 then
  3699. data = fs.open("/.core/cmh","r")
  3700. computerpass = data.readLine()
  3701. data.close()
  3702. textutils.unserialize (computerpass)
  3703. term.setCursorPos(5, 16)
  3704. print (var66)
  3705. term.setCursorPos(24, 16)
  3706. term.setBackgroundColor(colors.lightBlue)
  3707. print "               "
  3708. term.setBackgroundColor(colors.lightBlue)
  3709. term.setCursorPos(24, 16)
  3710. cpass = read ("@")
  3711.  if cpass == computerpass then
  3712.     fs.delete ("/ink")
  3713.     fs.delete ("/np")
  3714.     fs.delete ("/startup")
  3715.     fs.delete ("/Downloaded")
  3716.     shell.run ("pastebin get QhDLVu1R startup")
  3717.     os.reboot ()
  3718.     else
  3719.     term.setBackgroundColor(colors.red)
  3720.     term.setCursorPos(5, 17)
  3721.     print (var67)
  3722.     sleep (1)
  3723.     system ()
  3724. end
  3725. break
  3726. end
  3727.  
  3728. end
  3729. end
  3730.  
  3731. -----------------------------
  3732. function uzivatele ()
  3733. local f = fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  3734. local cnt = f.readAll()
  3735. f.close()
  3736. local nastaveni=textutils.unserialize(cnt)
  3737. term.setBackgroundColor(colors.white)
  3738. term.setTextColor(colors.black)
  3739. term.clear()
  3740. term.setCursorPos(1,1)
  3741. term.setBackgroundColor(nastaveni.barva)
  3742. term.setTextColor(colors.white)
  3743. print "                                                   "
  3744. term.setCursorPos(23,1)
  3745. prc (var51)
  3746. paintutils.drawPixel(51, 1, colors.red)
  3747. term.setTextColor(colors.white)
  3748. term.setCursorPos(51, 1)
  3749. print "Q"
  3750. paintutils.drawPixel(1, 1, colors.yellow)
  3751. paintutils.drawPixel(2, 1, colors.yellow)
  3752. term.setTextColor(colors.white)
  3753. term.setCursorPos(1, 1)
  3754. print "<-"
  3755. term.setCursorPos(21,3)
  3756. shell.run ("list /.ucet")
  3757.  
  3758. term.setBackgroundColor(colors.white)
  3759. term.setTextColor(colors.black)
  3760. term.setBackgroundColor(colors.lightBlue)
  3761. term.setCursorPos(5, 5)
  3762. print (var86)
  3763. term.setCursorPos(5, 7)
  3764. print (var68)
  3765. term.setCursorPos(5, 9)
  3766. print (var69.." "..stavlog)
  3767. term.setCursorPos(5, 11)
  3768. print (var70)
  3769. term.setCursorPos(5, 13)
  3770. print (var71)
  3771. term.setCursorPos(5, 15)
  3772. print (var72)
  3773.  
  3774. while true do
  3775. local event, button, x, y = os.pullEvent("mouse_click")
  3776. xy = x..","..y
  3777.  
  3778. if xy == "51,1" and button == 1 then
  3779. plocha ()
  3780. break
  3781. end
  3782.  
  3783. if x >= 1 and x <= 2 and y == 1 and button == 1 then
  3784. obrnastaveni()
  3785. break
  3786. end
  3787.  
  3788. if x >= 5 and x <= 21 and y == 5 and button == 1 then
  3789. zmenahesla()
  3790. break
  3791. end
  3792.  
  3793. if x >= 5 and x <= 21 and y == 7 and button == 1 then
  3794. registrace()
  3795. break
  3796. end
  3797.  
  3798. if x >= 5 and x <= 21 and y == 11 and button == 1 then
  3799. smazaniuctu ()
  3800. break
  3801. end
  3802.  
  3803. if x >= 5 and x <= 21 and y == 13 and button == 1 then
  3804. odhlasit ()
  3805. break
  3806. end
  3807.  
  3808. if x >= 5 and x <= 21 and y == 15 and button == 1 then
  3809. restart ()
  3810. break
  3811. end
  3812.  
  3813. if x >= 5 and x <= 21 and y == 9 and button == 1 then
  3814. local n=fs.open("//.core/logon.cfg","r")
  3815. preskoclog = n.readLine ()
  3816. n.close ()
  3817.  
  3818.  
  3819.     if preskoclog == "1" then
  3820.     stavlog = "No "
  3821.     preskoclog = "0"
  3822.     else
  3823.     stavlog = "Yes"
  3824.     preskoclog = "1"
  3825.     n.close()
  3826.     end
  3827. local n=fs.open("//.core/logon.cfg","w")
  3828. n.writeLine(preskoclog)
  3829. n.writeLine(user)
  3830. n.close()
  3831. data = fs.open("/.core/defuser","w")
  3832. data.writeLine(user)
  3833. data.close()
  3834. uzivatele ()
  3835. end
  3836. end
  3837. end
  3838.  
  3839. function zmenahesla()
  3840. if hesla == 0 then
  3841. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  3842. local cnt=f.readAll()
  3843. f.close()
  3844. local nastaveni=textutils.unserialize(cnt)
  3845. term.setCursorPos(1,1)
  3846. term.setBackgroundColor(colors.white)
  3847. term.setTextColor(colors.black)
  3848. term.clear()
  3849. term.setCursorPos(1,1)
  3850. term.setBackgroundColor(nastaveni.barva)
  3851. term.setTextColor(colors.white)
  3852. print "                                                   "
  3853. term.setBackgroundColor(nastaveni.barva)
  3854. term.setTextColor(colors.white)
  3855. term.setCursorPos(19, 1)
  3856. prc(var88)
  3857. paintutils.drawPixel(51, 1, colors.red)
  3858. term.setTextColor(colors.white)
  3859. term.setCursorPos(51, 1)
  3860. print "Q"
  3861. paintutils.drawPixel(1, 1, colors.yellow)
  3862. paintutils.drawPixel(2, 1, colors.yellow)
  3863. term.setTextColor(colors.white)
  3864. term.setCursorPos(1, 1)
  3865. print "<-"
  3866.   term.setTextColor(colors.black)
  3867.   term.setBackgroundColor(colors.lightBlue)
  3868.   term.setCursorPos(18,7)
  3869.   print "         "
  3870.   term.setCursorPos(18,9)
  3871.   print "         "
  3872.   term.setCursorPos(18,11)
  3873.   print "         "
  3874.     term.setCursorPos(18,13)
  3875.   print (var90)
  3876. hesla = 1
  3877. zmenahesla ()
  3878. elseif hesla == 1 then
  3879. term.setTextColor(colors.black)
  3880. term.setBackgroundColor(colors.white)
  3881.   term.setCursorPos(5,7)
  3882.   print(var87.." ")
  3883.   term.setCursorPos(5,9)
  3884.   print(var88.." ")
  3885.   term.setCursorPos(5,11)
  3886.   print(var89.." ")
  3887. end
  3888. while true do
  3889. local event, button, x, y = os.pullEvent("mouse_click")
  3890. xy = x..","..y
  3891.  
  3892. if x >= 1 and x <= 2 and y == 1 and button == 1 then
  3893. hesla = 0
  3894. uzivatele()
  3895. break
  3896. end
  3897.  
  3898. if xy == "51,1" and button == 1 then
  3899. hesla = 0
  3900. plocha ()
  3901. break
  3902. end
  3903.  
  3904. if x >= 18 and x <= 26 and y == 7 and button == 1 then
  3905.   term.setBackgroundColor(colors.cyan)
  3906.   term.setCursorPos(18,7)
  3907.   print "         "
  3908.   term.setCursorPos(18,7)
  3909.   heslo1 = read("@")
  3910.   term.setBackgroundColor(colors.lightBlue)
  3911.   term.setCursorPos(18,7)
  3912.   print "         "
  3913.   term.setCursorPos(18,7)
  3914.   print (var27)
  3915.   zmenahesla ()
  3916.  elseif x >= 18 and x <= 26 and y == 9 and button == 1 then
  3917.   term.setBackgroundColor(colors.cyan)
  3918.   term.setCursorPos(18,9)
  3919.   print "         "
  3920.   term.setCursorPos(18,9)
  3921.   heslo2 = read("@")
  3922.   term.setBackgroundColor(colors.lightBlue)
  3923.   term.setCursorPos(18,9)
  3924.   print "         "
  3925.   term.setCursorPos(18,9)
  3926.   print (var27)
  3927.   zmenahesla ()
  3928. elseif x >= 18 and x <= 26 and y == 11 and button == 1 then
  3929.   term.setBackgroundColor(colors.cyan)
  3930.   term.setCursorPos(18,11)
  3931.   print "         "
  3932.   term.setCursorPos(18,11)
  3933.   heslo3 = read("@")
  3934.   term.setBackgroundColor(colors.lightBlue)
  3935.   term.setCursorPos(18,11)
  3936.   print "         "
  3937.   term.setCursorPos(18,11)
  3938.   print (var27)
  3939.   zmenahesla ()
  3940. elseif x >= 18 and x <= 23 and y == 13 and button == 1 then
  3941.   if heslo1 == "" and heslo2 == "" and heslo3 == "" then
  3942.     zmenahesla ()
  3943.     end
  3944.    
  3945.   if heslo1 == passI then
  3946.     if heslo2 == heslo3 then
  3947.      local file = fs.open(".ucet/"..user.."/.data","w")
  3948.      file.writeLine(userI)
  3949.      file.writeLine(heslo2)
  3950.      file.close()
  3951.      passI = heslo2
  3952.      hesla = 0
  3953.      heslo1 = ""
  3954.      heslo2 = ""
  3955.      heslo3 = ""
  3956.      uzivatele ()
  3957.   else
  3958.      prc ("Error comfirm password failed.", 15)
  3959.      heslo3 = ""
  3960.      sleep (1)
  3961.      hesla = 0
  3962.      zmenahesla ()
  3963.      end
  3964.   else
  3965.   prc ("Error - Bad old password.", 15)
  3966.   heslo1 = ""
  3967.   sleep (1)
  3968.   hesla = 0
  3969.   zmenahesla ()
  3970.   end
  3971. end
  3972. end
  3973. end
  3974.  
  3975.  
  3976. function smazaniuctu ()
  3977. term.setCursorPos(24,11)
  3978. print "               "
  3979. term.setCursorPos(25,11)
  3980. sucet = read ()
  3981.         if sucet == "" then
  3982.             uzivatele ()
  3983.         elseif sucet == " " then
  3984.             uzivatele ()
  3985.         elseif sucet == user then
  3986.         term.setBackgroundColor(colors.red)
  3987.         term.setCursorPos(24,11)
  3988.         print (var73)
  3989.         term.setCursorPos(24,12)
  3990.         print (var74)
  3991.         sleep (1)
  3992.         uzivatele ()
  3993.         else
  3994.         smazani ()
  3995.         end
  3996.         end
  3997.        
  3998.         function smazani ()
  3999.                     if fs.exists ("/.ucet/"..sucet) then
  4000.                         fs.delete("/.ucet/"..sucet)
  4001.                         term.setBackgroundColor(colors.lime)
  4002.                         term.setCursorPos(24,11)
  4003.                         print (var75)
  4004.                         sleep (1)
  4005.                         uzivatele ()
  4006.                         else
  4007.                         term.setBackgroundColor(colors.red)
  4008.                         term.setCursorPos(24,11)
  4009.                         print (var76)
  4010.                         sleep (1)
  4011.                         uzivatele ()
  4012.                         end
  4013.                         end
  4014.                        
  4015. function registrace()
  4016.   local next = false
  4017. if login == 0 then
  4018.   term.setBackgroundColor(colors.white)
  4019.   term.setTextColor(colors.black)
  4020.   term.clear()
  4021.   term.setCursorPos(5,7)
  4022.   print(var22)
  4023.   term.setCursorPos(5,9)
  4024.   print(var20.." ")
  4025.   term.setCursorPos(5,11)
  4026.   print(var21.." ")
  4027.   term.setBackgroundColor(colors.lightBlue)
  4028.   term.setCursorPos(18,9)
  4029.   print "         "
  4030.   term.setCursorPos(18,11)
  4031.   print "         "
  4032.     term.setCursorPos(18,13)
  4033.   print (var23)
  4034. elseif login == 1 then
  4035.  
  4036. end
  4037.  
  4038. while true do
  4039. local event, button, x, y = os.pullEvent("mouse_click")
  4040. xy = x..","..y
  4041.  
  4042. if x >= 18 and x <= 26 and y == 9 and button == 1 then
  4043.   term.setBackgroundColor(colors.cyan)
  4044.   term.setCursorPos(18,9)
  4045.   print "         "
  4046.   term.setCursorPos(18,9)
  4047.   userI = read()
  4048.   term.setBackgroundColor(colors.lightBlue)
  4049.   term.setCursorPos(18,9)
  4050.   print "         "
  4051.   term.setCursorPos(18,9)
  4052.   print (userI)
  4053.     if userI == "" then
  4054.     login = 0
  4055.   registrace()
  4056.   elseif userI == " " then
  4057.   login = 0
  4058.   registrace()
  4059.   else
  4060.   login = 1
  4061.   registrace()
  4062.   end
  4063. elseif x >= 18 and x <= 26 and y == 11 and button == 1 then
  4064.   term.setBackgroundColor(colors.cyan)
  4065.   term.setCursorPos(18,11)
  4066.   print "         "
  4067.   term.setCursorPos(18,11)
  4068.   pass = read("@")
  4069.   term.setBackgroundColor(colors.lightBlue)
  4070.   term.setCursorPos(18,11)
  4071.   print "         "
  4072.   term.setCursorPos(18,11)
  4073.   print (pass)
  4074.   login = 1
  4075.   registrace ()
  4076. end
  4077.  
  4078. if x >= 18 and x <= 26 and y == 13 and button == 1 then
  4079. if userI == 0 then
  4080.     term.setBackgroundColor(colors.white)
  4081.     fgc(colors.red)
  4082.     term.setCursorPos(5,13)
  4083.     print(var30)
  4084.     sleep (1)
  4085.     login = 0
  4086.     registrace ()
  4087.   elseif userI == " " then
  4088.     term.setBackgroundColor(colors.white)
  4089.     fgc(colors.red)
  4090.     term.setCursorPos(5,13)
  4091.     print(var25)
  4092.     sleep (1)
  4093.   login = 0
  4094.   registrace()
  4095.   end
  4096.  
  4097. login = 0
  4098.   if not fs.isDir("/.ucet/"..userI) then
  4099.     fs.makeDir("/.ucet/"..userI)
  4100.     local file = fs.open(".ucet/"..userI.."/.data","w")
  4101.     file.writeLine(userI)
  4102.     file.writeLine(pass)
  4103.     file.close()
  4104.     if not fs.exists("/.core/ucet") then
  4105.       fs.open("/.core/ucet","w")
  4106.     end
  4107.     term.setBackgroundColor(colors.white)
  4108.     fgc(colors.lime)
  4109.     term.setCursorPos(5,13)
  4110.     shell.run ("pastebin get YHGDzX5a ", ".ucet/"..userI.."/bar.nfp")
  4111.     term.setCursorPos(5,13)
  4112.     shell.run ("pastebin get sc1LAE0x ", ".ucet/"..userI.."/nastaveni.cfg")
  4113.     term.setCursorPos(5,13)
  4114.     shell.run ("pastebin get sh70PdPx /.ucet/"..userI.."/language")
  4115.     term.setCursorPos(5,13)
  4116.     print(var24)
  4117.     sleep (1)
  4118.     userI = uss
  4119.     uzivatele ()
  4120.   else
  4121.     term.setBackgroundColor(colors.white)
  4122.     fgc(colors.red)
  4123.     term.setCursorPos(5,13)
  4124.     print(var25)
  4125.     sleep (1)
  4126.     uzivatele ()
  4127.   end
  4128. end
  4129. end
  4130. end
  4131.  
  4132. function pozadi ()
  4133. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  4134. local cnt=f.readAll()
  4135. f.close()
  4136. local nastaveni=textutils.unserialize(cnt)
  4137. term.setCursorPos(1,1)
  4138. term.setBackgroundColor(colors.white)
  4139. term.setTextColor(colors.black)
  4140. term.clear()
  4141. term.setCursorPos(1,1)
  4142. term.setBackgroundColor(nastaveni.barva)
  4143. term.setTextColor(colors.white)
  4144. print "                                                   "
  4145. term.setBackgroundColor(nastaveni.barva)
  4146. term.setTextColor(colors.white)
  4147. term.setCursorPos(19, 1)
  4148. prc(var77)
  4149. paintutils.drawPixel(51, 1, colors.red)
  4150. term.setTextColor(colors.white)
  4151. term.setCursorPos(51, 1)
  4152. print "Q"
  4153. paintutils.drawPixel(1, 1, colors.yellow)
  4154. paintutils.drawPixel(2, 1, colors.yellow)
  4155. term.setTextColor(colors.white)
  4156. term.setCursorPos(1, 1)
  4157. print "<-"
  4158.  
  4159. term.setBackgroundColor(colors.white)
  4160. term.setTextColor(colors.black)
  4161. term.setBackgroundColor(colors.lightBlue)
  4162. term.setCursorPos(5, 7)
  4163. print (var78)
  4164. term.setCursorPos(5, 9)
  4165. print "- Pepdroll"
  4166. term.setCursorPos(5, 11)
  4167. print "- Farm    "
  4168. term.setCursorPos(5, 13)
  4169. print "- Island  "
  4170. term.setCursorPos(5, 5)
  4171. print (var83)
  4172. term.setCursorPos(5, 15)
  4173. print "- Win XP  "
  4174. term.setCursorPos(5, 17)
  4175. print "- Nothing "
  4176.  
  4177. while true do
  4178. local event, button, x, y = os.pullEvent("mouse_click")
  4179. xy = x..","..y
  4180.  
  4181. if x >= 1 and x <= 2 and y == 1 and button == 1 then
  4182. obrnastaveni()
  4183. break
  4184. end
  4185.  
  4186. if xy == "51,1" and button == 1 then
  4187. plocha ()
  4188. break
  4189. end
  4190.  
  4191. if x >= 5 and x <= 12 and y == 5 and button == 1 then
  4192. barvapozadi ()
  4193. break
  4194. end
  4195.  
  4196. if x >= 5 and x <= 12 and y == 7 and button == 1 then
  4197. namalovat ()
  4198. break
  4199. end
  4200.  
  4201. if x >= 5 and x <= 12 and y == 9 and button == 1 then
  4202. pepdroll ()
  4203. break
  4204. end
  4205.  
  4206. if x >= 5 and x <= 12 and y ==11 and button == 1 then
  4207. statek ()
  4208. end
  4209.  
  4210. if x >= 5 and x <= 12 and y ==13 and button == 1 then
  4211. ostrov ()
  4212. end
  4213.  
  4214. if x >= 5 and x <= 12 and y ==15 and button == 1 then
  4215. xp ()
  4216. end
  4217.  
  4218. if x >= 5 and x <= 12 and y ==17 and button == 1 then
  4219. shell.run ("delete /.ucet/"..user.."/bar.nfp")
  4220. pozadi ()
  4221. end
  4222. end
  4223. end
  4224.  
  4225. function xp ()
  4226. shell.run ("delete /.ucet/"..user.."/bar.nfp")
  4227. shell.run ("pastebin get iy3EcA4Z /.ucet/"..user.."/bar.nfp")
  4228. pozadi ()
  4229. end
  4230.  
  4231. function ostrov ()
  4232. shell.run ("delete /.ucet/"..user.."/bar.nfp")
  4233. shell.run ("pastebin get vm1p8DXs /.ucet/"..user.."/bar.nfp")
  4234. pozadi ()
  4235. end
  4236.  
  4237. function pepdroll ()
  4238. shell.run ("delete /.ucet/"..user.."/bar.nfp")
  4239. shell.run ("pastebin get YHGDzX5a /.ucet/"..user.."/bar.nfp")
  4240. pozadi ()
  4241. end
  4242.  
  4243. function statek ()
  4244. shell.run ("delete /.ucet/"..user.."/bar.nfp")
  4245. shell.run ("pastebin get K0zXPiKn /.ucet/"..user.."/bar.nfp")
  4246. pozadi ()
  4247. end
  4248.  
  4249. function namalovat ()
  4250. shell.run (".core/paint /.ucet/"..user.."/bar.nfp")
  4251. end
  4252.  
  4253. function aktualizace ()
  4254. shell.run ("pastebin get Ge2p5qgQ /.core/verze")
  4255. data = fs.open("/.core/verze","r")
  4256. verzeup     = data.readLine()
  4257. data.close()
  4258. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  4259. local cnt=f.readAll()
  4260. f.close()
  4261. local nastaveni=textutils.unserialize(cnt)
  4262. term.setCursorPos(1,1)
  4263. term.setBackgroundColor(colors.white)
  4264. term.setTextColor(colors.black)
  4265. term.clear()
  4266. term.setCursorPos(1,1)
  4267. term.setBackgroundColor(nastaveni.barva)
  4268. term.setTextColor(colors.white)
  4269. print "                                                   "
  4270. term.setBackgroundColor(nastaveni.barva)
  4271. term.setTextColor(colors.white)
  4272. term.setCursorPos(20, 1)
  4273. prc(var79)
  4274. paintutils.drawPixel(51, 1, colors.red)
  4275. term.setTextColor(colors.white)
  4276. term.setCursorPos(51, 1)
  4277. print "Q"
  4278. paintutils.drawPixel(1, 1, colors.yellow)
  4279. paintutils.drawPixel(2, 1, colors.yellow)
  4280. term.setTextColor(colors.white)
  4281. term.setCursorPos(1, 1)
  4282. print "<-"
  4283. term.setBackgroundColor(colors.white)
  4284. term.setTextColor(colors.black)
  4285. term.setCursorPos(5, 14)
  4286. print ("Current Build: "..verze)
  4287. term.setCursorPos(5, 16)
  4288. print ("Lates Build: "..verzeup)
  4289. term.setBackgroundColor(colors.lightBlue)
  4290. term.setCursorPos(5, 7)
  4291. if verze > verzeup then
  4292. print ("- Downdate")
  4293. else
  4294. print ("- "..var79)
  4295. end
  4296.  
  4297. if verze == verzeup then
  4298. term.setCursorPos(10, 15)
  4299. term.setBackgroundColor(colors.lime)
  4300. print ("You have got a lates build")
  4301. end
  4302. if verze < verzeup then
  4303. term.setCursorPos(10, 15)
  4304. term.setBackgroundColor(colors.green)
  4305. print ("New version available")
  4306. end
  4307. if verze > verzeup then
  4308. term.setCursorPos(10, 15)
  4309. term.setBackgroundColor(colors.yellow)
  4310. print ("You have unreleased version!")
  4311. end
  4312.  
  4313. while true do
  4314. local event, button, x, y = os.pullEvent("mouse_click")
  4315. xy = x..","..y
  4316.  
  4317. if xy == "51,1" and button == 1 then
  4318. fs.delete ("/.core/verze")
  4319. plocha ()
  4320. break
  4321. end
  4322.  
  4323. if x >= 1 and x <= 2 and y == 1 and button == 1 then
  4324. fs.delete ("/.core/verze")
  4325. system()
  4326. break
  4327. end
  4328.  
  4329. if x >= 5 and x <= 18 and y ==7 and button == 1 then
  4330. shell.run ("delete startup")
  4331. shell.run ("pastebin get 3R3M6XeK startup")
  4332. shell.run ("delete /.ucet/"..user.."/language")
  4333. shell.run ("delete /.core/language")
  4334. if var33 == Kalkulacka then
  4335. shell.run("pastebin get AJULjcwC /.core/tut")
  4336. else
  4337. shell.run("pastebin get CyxwuZRw /.core/tut")
  4338. end
  4339. os.reboot ()
  4340. break
  4341. end
  4342. end
  4343. end
  4344.  
  4345. function barvapozadi ()
  4346. term.setBackgroundColor(colors.white)
  4347. term.setTextColor(colors.black)
  4348. local nastaveni={barva=colors.blue}
  4349. term.setCursorPos (5, 17)
  4350. print (var80)
  4351. term.setCursorPos (5, 18)
  4352. local novaBarva=read() --#precist hodnotu od uzivatele
  4353. if colors[novaBarva:lower()] then
  4354.   nastaveni.barva=colors[novaBarva:lower()]
  4355. else
  4356.   print"Barva nenalezena, ponechano puvodni nastaveni"
  4357. end
  4358. --#ulozime
  4359. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","w")
  4360. f.write(textutils.serialize(nastaveni))
  4361. f.close()
  4362. pozadi ()
  4363. end
  4364.  
  4365. rozhodnutiins ()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement