Advertisement
pepeknamornik

[P] Pepdroll 6.2 lates

Nov 14th, 2014 (edited)
645
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 109.01 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2. local verze = "2400"
  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 = ""
  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 3R3M6XeK /system.lua")
  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.  
  1073. if not fs.exists("/.core/language") then
  1074. shell.run ("pastebin get sh70PdPx /.core/language")
  1075. end
  1076.  
  1077. data = fs.open("/.core/language","r")
  1078. var1 = data.readLine()
  1079. var2 = data.readLine()
  1080. var3 = data.readLine()
  1081. var4 = data.readLine()
  1082. var5 = data.readLine()
  1083. var6 = data.readLine()
  1084. var7 = data.readLine()
  1085. var8 = data.readLine()
  1086. var9 = data.readLine()
  1087. var10 = data.readLine()
  1088. var11 = data.readLine()
  1089. var12 = data.readLine()
  1090. var13 = data.readLine()
  1091. var14 = data.readLine()
  1092. var15 = data.readLine()
  1093. var16 = data.readLine()
  1094. var17 = data.readLine()
  1095. var18 = data.readLine()
  1096. var19 = data.readLine()
  1097. var20 = data.readLine()
  1098. var21 = data.readLine()
  1099. var22 = data.readLine()
  1100. var23 = data.readLine()
  1101. var24 = data.readLine()
  1102. var25 = data.readLine()
  1103. var26 = data.readLine()
  1104. var27 = data.readLine()
  1105. var28 = data.readLine()
  1106. var29 = data.readLine()
  1107. var30 = data.readLine()
  1108. var31 = data.readLine()
  1109. var32 = data.readLine()
  1110. var33 = data.readLine()
  1111. var34 = data.readLine()
  1112. var35 = data.readLine()
  1113. var36 = data.readLine()
  1114. var37 = data.readLine()
  1115. var38 = data.readLine()
  1116. var39 = data.readLine()
  1117. var40     = data.readLine()
  1118. var41     = data.readLine()
  1119. var42     = data.readLine()
  1120. var43     = data.readLine()
  1121. var44     = data.readLine()
  1122. var45     = data.readLine()
  1123. var46     = data.readLine()
  1124. var47     = data.readLine()
  1125. var48     = data.readLine()
  1126. var49     = data.readLine()
  1127. var50     = data.readLine()
  1128. var51     = data.readLine()
  1129. var52     = data.readLine()
  1130. var53     = data.readLine()
  1131. var54     = data.readLine()
  1132. var55     = data.readLine()
  1133. var56     = data.readLine()
  1134. var57     = data.readLine()
  1135. var58     = data.readLine()
  1136. var59     = data.readLine()
  1137. var60     = data.readLine()
  1138. var61     = data.readLine()
  1139. var62     = data.readLine()
  1140. var63     = data.readLine()
  1141. var64     = data.readLine()
  1142. var65     = data.readLine()
  1143. var66     = data.readLine()
  1144. var67     = data.readLine()
  1145. var68     = data.readLine()
  1146. var69     = data.readLine()
  1147. var70     = data.readLine()
  1148. var71     = data.readLine()
  1149. var72     = data.readLine()
  1150. var73     = data.readLine()
  1151. var74     = data.readLine()
  1152. var75     = data.readLine()
  1153. var76     = data.readLine()
  1154. var77     = data.readLine()
  1155. var78     = data.readLine()
  1156. var79     = data.readLine()
  1157. var80     = data.readLine()
  1158. var81     = data.readLine()
  1159. var82     = data.readLine()
  1160. var83     = data.readLine()
  1161. var84     = data.readLine()
  1162. var85     = data.readLine()
  1163. var86     = data.readLine()
  1164. var87     = data.readLine()
  1165. var88     = data.readLine()
  1166. var89     = data.readLine()
  1167. var90     = data.readLine()
  1168. var91     = data.readLine()
  1169. var92     = data.readLine()
  1170. var93     = data.readLine()
  1171. var94     = data.readLine()
  1172. var95     = data.readLine()
  1173. var96     = data.readLine()
  1174. var97     = data.readLine()
  1175. var98     = data.readLine()
  1176. var99     = data.readLine()
  1177. data.close()
  1178.  
  1179. term.setBackgroundColor(colors.white)
  1180. term.setTextColor(colors.black)
  1181. term.clear()
  1182. term.setBackgroundColor(colors.white)
  1183. term.setTextColor(colors.blue)
  1184. term.setCursorPos(20,18)
  1185. print"  Pepek"
  1186. term.setCursorPos(28,18)
  1187. print"Soft  "
  1188. term.setCursorPos(27,18)
  1189. term.setTextColor(colors.lime)
  1190. print"@"
  1191. term.setCursorPos(5, 14)
  1192. print ("Build "..verze)
  1193. term.setBackgroundColor(colors.white)
  1194. term.setTextColor(colors.black)
  1195. term.setCursorPos(16,7)
  1196. prc "Pepdroll 6.2 Professional"
  1197. term.setCursorPos(14,9)
  1198. term.setBackgroundColor(colors.lightBlue)
  1199. textutils.slowPrint "                        "
  1200. term.setCursorPos(14,9)
  1201. term.setBackgroundColor(colors.lightGray)
  1202. textutils.slowPrint "                        "
  1203. term.setCursorPos(14,9)
  1204. term.setBackgroundColor(colors.lightBlue)
  1205. textutils.slowPrint "          "
  1206. preskoklog ()
  1207. end
  1208.  
  1209. function deaktiv ()
  1210. shell.run ("delete aktiv")
  1211. os.reboot ()
  1212. heslo ()
  1213. end
  1214.  
  1215. function createAccount()
  1216.   local next = false
  1217. if login == 0 then
  1218. user = 0
  1219. term.setBackgroundColor(colors.white)
  1220.   term.setTextColor(colors.black)
  1221.   term.clear()
  1222.   term.setCursorPos(5,7)
  1223.   print(var22)
  1224.   term.setCursorPos(5,9)
  1225.   print(var20.." ")
  1226.   term.setCursorPos(5,11)
  1227.   print(var21.." ")
  1228.   term.setBackgroundColor(colors.lightBlue)
  1229.   term.setCursorPos(18,9)
  1230.   print "         "
  1231.   term.setCursorPos(18,11)
  1232.   print "         "
  1233.     term.setCursorPos(18,13)
  1234.   print (var23)
  1235.  elseif login == 1 then
  1236. end
  1237.  
  1238. while true do
  1239. local event, button, x, y = os.pullEvent("mouse_click")
  1240. xy = x..","..y
  1241.  
  1242. if x >= 18 and x <= 26 and y == 9 and button == 1 then
  1243.   term.setBackgroundColor(colors.cyan)
  1244.   term.setCursorPos(18,9)
  1245.   print "         "
  1246.   term.setCursorPos(18,9)
  1247.   user = read()
  1248.   term.setBackgroundColor(colors.lightBlue)
  1249.   term.setCursorPos(18,9)
  1250.   print "         "
  1251.   term.setCursorPos(18,9)
  1252.   print (user)
  1253.     if user == 0 then
  1254.     term.setBackgroundColor(colors.white)
  1255.     fgc(colors.red)
  1256.     term.setCursorPos(5,13)
  1257.     print(var30)
  1258.     login = 0
  1259.   createAccount()
  1260.   elseif user == " " then
  1261.     term.setBackgroundColor(colors.white)
  1262.     fgc(colors.red)
  1263.     term.setCursorPos(5,13)
  1264.     print(var25)
  1265.   login = 0
  1266.   createAccount()
  1267.   else
  1268.   uzivatel = (user)
  1269.   login = 1
  1270.   createAccount()
  1271.   end
  1272. elseif x >= 18 and x <= 26 and y == 11 and button == 1 then
  1273.   term.setBackgroundColor(colors.cyan)
  1274.   term.setCursorPos(18,11)
  1275.   print "         "
  1276.   term.setCursorPos(18,11)
  1277.   pass = read("@")
  1278.   term.setBackgroundColor(colors.lightBlue)
  1279.   term.setCursorPos(18,11)
  1280.   print "         "
  1281.   term.setCursorPos(18,11)
  1282.   print (var27)
  1283.   login = 1
  1284.   createAccount()
  1285. end
  1286.  
  1287. if x >= 18 and x <= 26 and y == 13 and button == 1 then
  1288. if user == 0 then
  1289.     term.setBackgroundColor(colors.white)
  1290.     fgc(colors.red)
  1291.     term.setCursorPos(5,13)
  1292.     print(var30)
  1293.     sleep (1)
  1294.     login = 0
  1295.   createAccount()
  1296.   elseif user == " " then
  1297.     term.setBackgroundColor(colors.white)
  1298.     fgc(colors.red)
  1299.     term.setCursorPos(5,13)
  1300.     print(var25)
  1301.     sleep (1)
  1302.   login = 0
  1303.   createAccount()
  1304.   end
  1305. login = 0
  1306. userI=user
  1307.  
  1308.   if not fs.isDir("/.ucet/"..user) then
  1309.     fs.makeDir("/.ucet/"..user)
  1310.     local file = fs.open(".ucet/"..user.."/.data","w")
  1311.     file.writeLine(user)
  1312.     file.writeLine(pass)
  1313.     file.close()
  1314.     if not fs.exists("/.core/ucet") then
  1315.       fs.open("/.core/ucet","w")
  1316.     end
  1317.    
  1318.     local o=fs.open("//.core/logon.cfg","w")
  1319.     o.writeLine("0")
  1320.     o.writeLine(user)
  1321.     o.close()
  1322.    
  1323.     term.setBackgroundColor(colors.white)
  1324.     fgc(colors.lime)
  1325.     term.setCursorPos(5,13)
  1326.     shell.run ("pastebin get YHGDzX5a ", ".ucet/"..user.."/bar.nfp")
  1327.     term.setCursorPos(5,13)
  1328.     shell.run ("pastebin get sc1LAE0x ", ".ucet/"..user.."/nastaveni.cfg")
  1329.     term.setCursorPos(5,13)
  1330.     shell.run ("pastebin get sh70PdPx /.ucet/"..user.."/language")
  1331.     term.setCursorPos(5,13)
  1332.     print(var24)
  1333.     sleep (1)
  1334.     heslo ()
  1335.   else
  1336.     term.setBackgroundColor(colors.white)
  1337.     fgc(colors.red)
  1338.     term.setCursorPos(5,13)
  1339.     print(var25)
  1340.   end
  1341. end
  1342. end
  1343. end
  1344.  
  1345. function preskoklog ()
  1346. local n=fs.open("//.core/logon.cfg","r")
  1347. preskok = n.readLine ()
  1348. n.close ()
  1349.  
  1350.  
  1351.   if preskok == "1" then
  1352.     stavlog = "Yes"
  1353.     local na=fs.open("/.core/defuser","r")
  1354.     user = na.readLine ()
  1355.     userI = user
  1356.     na.close()
  1357.     data = fs.open("/.ucet/"..userI.."/.data","r")
  1358.     user = data.readLine ()
  1359.     passI = data.readLine ()
  1360.     data.close()
  1361.     vitejte ()
  1362.     else
  1363.     stavlog = "NO"
  1364.     heslo ()
  1365. end
  1366. end
  1367.  
  1368. function heslo ()
  1369.   if not fs.exists("/.core/ucet") then
  1370.     createAccount()
  1371.     local ucet = fs.open("/.core/ucet","w")
  1372.     ucet.close()
  1373.   end
  1374.   local success = false
  1375.  
  1376.   while not success do
  1377.   if login == 0 then
  1378.   pass=""
  1379.   term.setBackgroundColor(colors.white)
  1380.   term.setTextColor(colors.black)
  1381.   term.clear()
  1382.   term.clear()
  1383.   term.setBackgroundColor(colors.yellow)
  1384.   term.setCursorPos(1,2)
  1385.   shell.run ("list /.ucet")
  1386.   term.setBackgroundColor(colors.white)
  1387.   term.setTextColor(colors.black)
  1388.   term.setCursorPos(5,7)
  1389.   print(var26)
  1390.   term.setCursorPos(5,9)
  1391.   print(var20.." ")
  1392.   term.setCursorPos(5,11)
  1393.   print(var21.."")
  1394.   term.setBackgroundColor(colors.lightBlue)
  1395.   term.setCursorPos(18,9)
  1396.   print "         "
  1397.   term.setCursorPos(18,11)
  1398.   print "         "
  1399.   term.setCursorPos(18,13)
  1400.   print(var26)
  1401.   term.setCursorPos(18,9)
  1402.   print (userI)
  1403.   if passI == "" then
  1404.   term.setCursorPos(18,11)
  1405.   print ""
  1406.   else
  1407.   term.setCursorPos(18,11)
  1408.   print (var27)
  1409.   end
  1410.  
  1411. elseif login == 1 then
  1412. term.setTextColor(colors.black)
  1413. end
  1414.  
  1415. while true do
  1416. local event, button, x, y = os.pullEvent("mouse_click")
  1417. xy = x..","..y
  1418.  
  1419. if x >= 18 and x <= 26 and y == 9 and button == 1 then
  1420.   term.setBackgroundColor(colors.cyan)
  1421.   term.setCursorPos(18,9)
  1422.   print "         "
  1423.   term.setCursorPos(18,9)
  1424.   userI = read()
  1425.   term.setBackgroundColor(colors.lightBlue)
  1426.   term.setCursorPos(18,9)
  1427.   print "         "
  1428.   term.setCursorPos(18,9)
  1429.   print (userI)
  1430.     if userI == "" then
  1431.   uzivatel = "None"
  1432.   elseif userI == " " then
  1433.   uzivatel = "None"
  1434.   else
  1435.   uzivatel = (userI)
  1436.   login = 1
  1437.     heslo ()
  1438.   end
  1439. elseif x >= 18 and x <= 26 and y == 11 and button == 1 then
  1440.   term.setBackgroundColor(colors.cyan)
  1441.   term.setCursorPos(18,11)
  1442.   print "         "
  1443.   term.setCursorPos(18,11)
  1444.   passI = read("@")
  1445.   term.setBackgroundColor(colors.lightBlue)
  1446.   term.setCursorPos(18,11)
  1447.   print "         "
  1448.   term.setCursorPos(18,11)
  1449.   print (var27)
  1450.   login = 1
  1451.   heslo ()
  1452. end
  1453.  
  1454. if x >= 18 and x <= 26 and y == 13 and button == 1 then
  1455. login = 0
  1456.     if userI == "" then
  1457.         login = 1
  1458.         heslo ()
  1459.     elseif userI == " " then
  1460.     login = 1
  1461.         heslo ()
  1462.     end
  1463.    
  1464.     if fs.isDir("/.ucet/"..userI) then
  1465.       if fs.exists("/.ucet/"..userI.."/.data") then
  1466.         data = fs.open("/.ucet/"..userI.."/.data","r")
  1467.         userO = data.readLine()
  1468.         passO = data.readLine()
  1469.         end
  1470.         if userI == userO and passI == passO then
  1471.           term.setBackgroundColor(colors.white)
  1472.           term.setCursorPos(5,13)
  1473.           fgc(colors.lime)
  1474.           print(var28)
  1475.           user = userI
  1476.           userDir = "/.ucet/"..userI
  1477.           success = true
  1478.           sleep (1)
  1479.           uss = userI
  1480.           vitejte ()
  1481.       else
  1482.           term.setBackgroundColor(colors.white)
  1483.           fgc(colors.red)
  1484.           term.setCursorPos(5,13)
  1485.           print(var29)
  1486.           passI = ""
  1487.           sleep (1)
  1488.           login = 0
  1489.           heslo ()
  1490.         end
  1491.   end
  1492. end
  1493. end
  1494. end
  1495. end
  1496.  
  1497. function clear()
  1498.   term.clear()
  1499.   term.setBackgroundColor(colors.white)
  1500.   for i=1,w do
  1501.     for j=1,h do
  1502.       term.setCursorPos(i,j)
  1503.       write(" ")
  1504.     end
  1505.   end
  1506. end
  1507.  
  1508. function vitejte ()
  1509. if not fs.exists ("/.ucet/"..userI.."/language") then
  1510.           shell.run ("pastebin get sh70PdPx /.ucet/"..userI.."/language")
  1511.           vitejte ()
  1512.           else
  1513.           data = fs.open("/.ucet/"..userI.."/language","r")
  1514. var1 = data.readLine()
  1515. var2 = data.readLine()
  1516. var3 = data.readLine()
  1517. var4 = data.readLine()
  1518. var5 = data.readLine()
  1519. var6 = data.readLine()
  1520. var7 = data.readLine()
  1521. var8 = data.readLine()
  1522. var9 = data.readLine()
  1523. var10 = data.readLine()
  1524. var11 = data.readLine()
  1525. var12 = data.readLine()
  1526. var13 = data.readLine()
  1527. var14 = data.readLine()
  1528. var15 = data.readLine()
  1529. var16 = data.readLine()
  1530. var17 = data.readLine()
  1531. var18 = data.readLine()
  1532. var19 = data.readLine()
  1533. var20 = data.readLine()
  1534. var21 = data.readLine()
  1535. var22 = data.readLine()
  1536. var23 = data.readLine()
  1537. var24 = data.readLine()
  1538. var25 = data.readLine()
  1539. var26 = data.readLine()
  1540. var27 = data.readLine()
  1541. var28 = data.readLine()
  1542. var29 = data.readLine()
  1543. var30 = data.readLine()
  1544. var31 = data.readLine()
  1545. var32 = data.readLine()
  1546. var33 = data.readLine()
  1547. var34 = data.readLine()
  1548. var35 = data.readLine()
  1549. var36 = data.readLine()
  1550. var37 = data.readLine()
  1551. var38 = data.readLine()
  1552. var39 = data.readLine()
  1553. var40     = data.readLine()
  1554. var41     = data.readLine()
  1555. var42     = data.readLine()
  1556. var43     = data.readLine()
  1557. var44     = data.readLine()
  1558. var45     = data.readLine()
  1559. var46     = data.readLine()
  1560. var47     = data.readLine()
  1561. var48     = data.readLine()
  1562. var49     = data.readLine()
  1563. var50     = data.readLine()
  1564. var51     = data.readLine()
  1565. var52     = data.readLine()
  1566. var53     = data.readLine()
  1567. var54     = data.readLine()
  1568. var55     = data.readLine()
  1569. var56     = data.readLine()
  1570. var57     = data.readLine()
  1571. var58     = data.readLine()
  1572. var59     = data.readLine()
  1573. var60     = data.readLine()
  1574. var61     = data.readLine()
  1575. var62     = data.readLine()
  1576. var63     = data.readLine()
  1577. var64     = data.readLine()
  1578. var65     = data.readLine()
  1579. var66     = data.readLine()
  1580. var67     = data.readLine()
  1581. var68     = data.readLine()
  1582. var69     = data.readLine()
  1583. var70     = data.readLine()
  1584. var71     = data.readLine()
  1585. var72     = data.readLine()
  1586. var73     = data.readLine()
  1587. var74     = data.readLine()
  1588. var75     = data.readLine()
  1589. var76     = data.readLine()
  1590. var77     = data.readLine()
  1591. var78     = data.readLine()
  1592. var79     = data.readLine()
  1593. var80     = data.readLine()
  1594. var81     = data.readLine()
  1595. var82     = data.readLine()
  1596. var83     = data.readLine()
  1597. var84     = data.readLine()
  1598. var85     = data.readLine()
  1599. var86     = data.readLine()
  1600. var87     = data.readLine()
  1601. var88     = data.readLine()
  1602. var89     = data.readLine()
  1603. var90     = data.readLine()
  1604. var91     = data.readLine()
  1605. var92     = data.readLine()
  1606. var93     = data.readLine()
  1607. var94     = data.readLine()
  1608. var95     = data.readLine()
  1609. var96     = data.readLine()
  1610. var97     = data.readLine()
  1611. var98     = data.readLine()
  1612. var99     = data.readLine()
  1613. data.close()
  1614. end
  1615. term.setBackgroundColor(colors.white)
  1616. term.setTextColor(colors.black)
  1617. term.clear()
  1618. term.setCursorPos(1, 7)
  1619. prc (var31)
  1620. term.setCursorPos(1, 9)
  1621. prc (userI)
  1622. term.setBackgroundColor(colors.white)
  1623. term.setTextColor(colors.blue)
  1624. term.setCursorPos(20,18)
  1625. print"  Pepek"
  1626. term.setCursorPos(28,18)
  1627. print"Soft  "
  1628. term.setCursorPos(27,18)
  1629. term.setTextColor(colors.lime)
  1630. print"@"
  1631. sleep (1)
  1632. term.setBackgroundColor(colors.lightGray)
  1633. term.clear()
  1634. sleep (0.1)
  1635. term.setBackgroundColor(colors.gray)
  1636. term.clear()
  1637. sleep (0.1)
  1638. plocha ()
  1639. end
  1640.  
  1641. local function redrawTime()
  1642.     l(47,19,51,19,256)
  1643.     tg(32768)
  1644.     tim = os.time()
  1645.     tpr(textutils.formatTime(tim,true),1,18)
  1646. end
  1647.  
  1648.  
  1649. function plocha ()
  1650. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  1651. local cnt=f.readAll()
  1652. f.close()
  1653. local nastaveni=textutils.unserialize(cnt)
  1654. local ACL = fs.list("/.ucet")
  1655. if anim == 1 then
  1656. term.setBackgroundColor(colors.gray)
  1657. term.clear()
  1658. sleep (0.1)
  1659. term.setBackgroundColor(colors.lightGray)
  1660. term.clear()
  1661. sleep (0.1)
  1662. anim = 0
  1663. end
  1664. term.setBackgroundColor(colors.white)
  1665. term.setTextColor(colors.white)
  1666. term.clear()
  1667. if not fs.exists("/.ucet/"..user.."/bar.nfp") then
  1668. term.setBackgroundColor(colors.black)
  1669. term.clear()
  1670. prc (var32)
  1671. term.setBackgroundColor(colors.white)
  1672. else
  1673. term.setCursorPos(1,1)
  1674. term.setBackgroundColor(nastaveni.barva)
  1675. local image = paintutils.loadImage("/.ucet/"..user.."/bar.nfp")
  1676. paintutils.drawImage(image, 3, 2)
  1677. end
  1678. term.setCursorPos(1,1)
  1679. term.setBackgroundColor(nastaveni.barva)
  1680. term.setTextColor(colors.black)
  1681. term.setCursorPos(45,17)
  1682. if #tArgs > 0 then
  1683.     sDrive = tostring( tArgs[1] )
  1684. end
  1685.  
  1686. if sDrive == nil then
  1687.     term.setTextColor(colors.white)
  1688.     print( "ID "..os.getComputerID() )
  1689.    
  1690.     local label = os.getComputerLabel()
  1691.     if label then
  1692.     term.setCursorPos(6,18)
  1693.     term.setTextColor(colors.white)
  1694.         print( " Label \""..label.."\"" )
  1695.     end
  1696.  
  1697. else
  1698.     local bData = disk.hasData( sDrive )
  1699.     if not bData then
  1700.         print( "No disk in drive "..sDrive )
  1701.         return
  1702.     end
  1703.    
  1704.     print( "The disk is #"..disk.getID( sDrive ) )
  1705.  
  1706.     local label = disk.getLabel( sDrive )
  1707.     if label then
  1708.         print( "The disk is labelled \""..label.."\"" )
  1709.     end
  1710. end
  1711. term.setTextColor(colors.white)
  1712. term.setCursorPos (42,14)
  1713. print (var33)
  1714. term.setCursorPos(1,1)
  1715. print "                                                   "
  1716. print"  "
  1717. print"  "
  1718. print"  "
  1719. print"  "
  1720. print"  "
  1721. print"  "
  1722. print"  "
  1723. print"  "
  1724. print"  "
  1725. print"  "
  1726. print"  "
  1727. print"  "
  1728. print"  "
  1729. print"  "
  1730. print"  "
  1731. print"  "
  1732. print"  "
  1733. paintutils.drawPixel(1, 19, nastaveni.barva)
  1734. paintutils.drawPixel(2, 19, nastaveni.barva)
  1735. term.setCursorPos(15,1)
  1736. prc ("Pepdroll 6.2 Professional Build "..verze)
  1737. term.setCursorPos(14,2)
  1738. print"                         "
  1739. term.setCursorPos(1,1)
  1740. term.setBackgroundColor(colors.orange)
  1741. term.setTextColor(colors.black)
  1742. print "Menu"
  1743. term.setBackgroundColor(colors.orange)
  1744. term.setCursorPos(1,18)
  1745. print "     "
  1746. local time = os.time()
  1747. local formattedTime = textutils.formatTime(time, true)
  1748. term.setCursorPos(1,18)
  1749. print("" .. formattedTime)
  1750.  
  1751. if fs.exists ("/.core/tut") then
  1752.     local myWindow = window.create(term.current(),14,5,26,10)
  1753.     myWindow.setBackgroundColor(colors.gray)
  1754.     myWindow.clear()
  1755.     data = fs.open("/.core/tut","r")
  1756.     upo1     = data.readLine()
  1757.     upo2     = data.readLine()
  1758.     upo3     = data.readLine()
  1759.     upo4     = data.readLine()
  1760.     upo5     = data.readLine()
  1761.     term.setTextColor(colors.black)
  1762.     term.setCursorPos(15,7)
  1763.     print (upo1)
  1764.     term.setCursorPos(15,8)
  1765.     print (upo2)
  1766.     term.setCursorPos(15,9)
  1767.     print (upo3)
  1768.     term.setCursorPos(15,10)
  1769.     print (upo4)
  1770.     term.setCursorPos(15,13)
  1771.     print (upo5)
  1772.     data.close()
  1773.    
  1774.     while true do
  1775.     local event, button, x, y = os.pullEvent("mouse_click")
  1776.     xy = x..","..y
  1777.    
  1778.     if x >= 16 and x <= 18 and y == 13 and button == 1 then
  1779.     fs.delete("/.core/tut")
  1780.     jazyky ()
  1781.     end
  1782.     if x >= 33 and x <= 34 and y == 13 and button == 1 then
  1783.     fs.delete("/.core/tut")
  1784.     plocha ()
  1785.     end
  1786. end
  1787. end
  1788.  
  1789. while true do
  1790. local event = { os.pullEvent() }
  1791. if event[ 1 ] == "mouse_click" then
  1792.     term.setCursorPos(40,18)
  1793.     print "Mouse click"
  1794.     term.setBackgroundColor(colors.red)
  1795.     term.setCursorPos(1,1)
  1796.     print "Menu"
  1797.     term.setBackgroundColor(colors.orange)
  1798.     local event, button, x, y = os.pullEvent("mouse_click")
  1799.     xy = x..","..y
  1800.    
  1801.     if x >= 1 and x <= 4 and y == 1 and button == 1 then
  1802.     menu ()
  1803.     elseif x >= 42 and x <= 51 and y == 14 and button == 1 then
  1804.     kalkulacka ()
  1805.     end
  1806. elseif event[ 1 ] == "key" then
  1807.     term.setCursorPos(40,18)
  1808.     print "   Key Event"
  1809. local event, key = os.pullEvent("key")
  1810.   if key == keys.q then
  1811.   rezim = 1
  1812.   menu ()
  1813.   elseif key == keys.leftCtrl then
  1814.   menu ()
  1815.   end
  1816. end
  1817. end
  1818. end
  1819.  
  1820. function menu ()
  1821. term.setBackgroundColor(colors.white)
  1822. term.setCursorPos(5,1)
  1823. print "       "
  1824. term.setCursorPos(1,2)
  1825. print (var34)
  1826. term.setCursorPos(1,3)
  1827. print (var35)
  1828. term.setCursorPos(1,4)
  1829. print (var36)
  1830. term.setCursorPos(1,5)
  1831. print (var37)
  1832. term.setCursorPos(1,6)
  1833. print (var38)
  1834. term.setCursorPos(1,7)
  1835. print (var39)
  1836. term.setCursorPos(1,8)
  1837. print (var40)
  1838. term.setBackgroundColor(colors.orange)
  1839. term.setCursorPos(1,9)
  1840. print "           "
  1841. paintutils.drawPixel(12, 2, colors.orange)    
  1842. paintutils.drawPixel(12, 3, colors.orange)
  1843. paintutils.drawPixel(12, 1, colors.orange)
  1844. paintutils.drawPixel(12, 4, colors.orange)
  1845. paintutils.drawPixel(12, 5, colors.orange)
  1846. paintutils.drawPixel(12, 6, colors.orange)
  1847. paintutils.drawPixel(12, 7, colors.orange)
  1848. paintutils.drawPixel(12, 8, colors.orange)
  1849. paintutils.drawPixel(12, 9, colors.red)
  1850. term.setCursorPos(12, 9)
  1851. print "Q"
  1852. paintutils.drawPixel(51, 1, colors.red)
  1853. term.setCursorPos(51, 1)
  1854. print "Q"
  1855. term.setBackgroundColor(colors.orange)
  1856. local time = os.time()
  1857. local formattedTime = textutils.formatTime(time, true)
  1858. term.setCursorPos(1,18)
  1859. print("" .. formattedTime)
  1860. if rezim == 1 then
  1861. rezim = 0
  1862. rezimy ()
  1863. end
  1864.  
  1865. while true do
  1866. local event, button, x, y = os.pullEvent("mouse_click")
  1867. xy = x..","..y
  1868.  
  1869. if x >= 1 and x <= 11 and y == 2 and button == 1 then
  1870. web ()
  1871. elseif x >= 1 and x <= 8 and y == 8 and button == 1 then
  1872. pastebin ()
  1873. elseif x >= 1 and x <= 10 and y == 7 and button == 1 then
  1874. anim = 1
  1875. obrnastaveni ()
  1876. elseif x >= 1 and x <= 11 and y == 6 and button == 1 then
  1877. textovani ()
  1878. elseif x >= 1 and x <= 11 and y == 5 and button == 1 then
  1879. malovani ()
  1880. elseif x >= 1 and x <= 10 and y == 4 and button == 1 then
  1881. prehravac ()
  1882. elseif x >= 1 and x <= 10 and y == 3 and button == 1 then
  1883. prohlizec ()
  1884. elseif xy == "12,9" and button == 1 then
  1885. rezimy ()
  1886. elseif xy == "12,9" and button == 2 then
  1887. plocha ()
  1888. elseif xy == "51,1" and button == 1 then
  1889. vypnout ()
  1890. elseif xy == "51,1" and button == 2 then
  1891. restart ()
  1892. elseif x >= 42 and x <= 51 and y == 14 and button == 1 then
  1893. kalkulacka ()
  1894. else
  1895. plocha ()
  1896. break
  1897. end
  1898. end
  1899. end
  1900.  
  1901. function rezimy ()
  1902. term.setBackgroundColor(colors.orange)
  1903. term.setTextColor(colors.black)
  1904. term.setCursorPos(13, 8)
  1905. print "          "
  1906. term.setCursorPos(13, 9)
  1907. print "          "
  1908. term.setCursorPos(12, 10)
  1909. print "           "
  1910. term.setCursorPos(12, 11)
  1911. print "           "
  1912. term.setCursorPos(12, 12)
  1913. print "           "
  1914. term.setCursorPos(12, 13)
  1915. print "           "
  1916. term.setCursorPos(12, 14)
  1917. print "           "
  1918. term.setCursorPos(12, 15)
  1919. print "           "
  1920. term.setBackgroundColor(colors.white)
  1921. term.setCursorPos(13, 9)
  1922. print (var41)
  1923. term.setCursorPos(13, 10)
  1924. term.setBackgroundColor(colors.lightBlue)
  1925. print (var42)
  1926. term.setCursorPos(13, 11)
  1927. term.setBackgroundColor(colors.lightGray)
  1928. term.setTextColor(colors.white)
  1929. print (var43)
  1930. term.setTextColor(colors.black)
  1931. term.setCursorPos(13, 12)
  1932. term.setBackgroundColor(colors.white)
  1933. print "         "
  1934. term.setCursorPos(13, 13)
  1935. term.setBackgroundColor(colors.yellow)
  1936. print (var44)
  1937. term.setCursorPos(13, 14)
  1938. term.setBackgroundColor(colors.red)
  1939. print (var45)
  1940. paintutils.drawPixel(12, 9, colors.gray)
  1941. term.setCursorPos(12, 9)
  1942. print "Q"
  1943. term.setBackgroundColor(colors.orange)
  1944. local time = os.time()
  1945. local formattedTime = textutils.formatTime(time, true)
  1946. term.setCursorPos(1,18)
  1947. print("" .. formattedTime)
  1948.  
  1949. while true do
  1950.  
  1951. local event = { os.pullEvent() }
  1952. if event[ 1 ] == "mouse_click" then
  1953.  
  1954. local event, button, x, y = os.pullEvent("mouse_click")
  1955. xy = x..","..y
  1956.  
  1957. if xy == "12,9" and button == 1 then
  1958. plocha ()
  1959. elseif x >= 14 and x <= 20 and y == 10 and button == 1 then
  1960. odhlasit ()
  1961. elseif x >= 14 and x <= 20 and y == 11 and button == 1 then
  1962. spanek ()
  1963. elseif x >= 14 and x <= 20 and y == 13 and button == 1 then
  1964. restart ()
  1965. elseif x >= 14 and x <= 20 and y == 14 and button == 1 then
  1966. vypnout ()
  1967. elseif x >= 42 and x <= 51 and y == 14 and button == 1 then
  1968. kalkulacka ()
  1969. else
  1970. plocha ()
  1971. break
  1972. end
  1973. elseif event[ 1 ] == "key" then
  1974. local event, key = os.pullEvent("key")
  1975.  
  1976.   if key == keys.q then
  1977.   plocha ()
  1978.   end
  1979. end
  1980. end
  1981. end
  1982.  
  1983. function spanek ()
  1984. term.setBackgroundColor(colors.lightGray)
  1985. term.clear()
  1986. sleep (0.1)
  1987. term.setBackgroundColor(colors.gray)
  1988. term.clear()
  1989. sleep (0.1)
  1990. term.setBackgroundColor(colors.black)
  1991. term.setTextColor(colors.black)
  1992. term.clear()
  1993. while true do
  1994.   local event, button, xPos, yPos = os.pullEvent("mouse_click")
  1995.   preskoklog ()
  1996. end
  1997. end
  1998.  
  1999. function vypnout ()
  2000. term.setBackgroundColor(colors.lightGray)
  2001. term.clear()
  2002. sleep (0.1)
  2003. term.setBackgroundColor(colors.gray)
  2004. term.clear()
  2005. sleep (0.1)
  2006. term.setBackgroundColor(colors.white)
  2007. term.setTextColor(colors.black)
  2008. term.clear()
  2009. term.setCursorPos(23, 7)
  2010. prc (var46)
  2011. term.setBackgroundColor(colors.white)
  2012. term.setTextColor(colors.blue)
  2013. term.setCursorPos(20,18)
  2014. print"  Pepek"
  2015. term.setCursorPos(28,18)
  2016. print"Soft  "
  2017. term.setCursorPos(27,18)
  2018. term.setTextColor(colors.lime)
  2019. print"@"
  2020. sleep (2)
  2021. os.shutdown ()
  2022. end
  2023.  
  2024. function odhlasit ()
  2025. term.setBackgroundColor(colors.lightGray)
  2026. term.clear()
  2027. sleep (0.1)
  2028. term.setBackgroundColor(colors.gray)
  2029. term.clear()
  2030. sleep (0.1)
  2031. term.setBackgroundColor(colors.white)
  2032. term.setTextColor(colors.black)
  2033. term.clear()
  2034. term.setCursorPos(23, 7)
  2035. prc (var47)
  2036. term.setBackgroundColor(colors.white)
  2037. term.setTextColor(colors.blue)
  2038. term.setCursorPos(20,18)
  2039. print"  Pepek"
  2040. term.setCursorPos(28,18)
  2041. print"Soft  "
  2042. term.setCursorPos(27,18)
  2043. term.setTextColor(colors.lime)
  2044. print"@"
  2045. sleep (2)
  2046. heslo ()
  2047. end
  2048.  
  2049. function restart ()
  2050. term.setBackgroundColor(colors.lightGray)
  2051. term.clear()
  2052. sleep (0.1)
  2053. term.setBackgroundColor(colors.gray)
  2054. term.clear()
  2055. sleep (0.1)
  2056. term.setBackgroundColor(colors.white)
  2057. term.setTextColor(colors.black)
  2058. term.clear()
  2059. term.setCursorPos(23, 7)
  2060. prc (var46)
  2061. term.setBackgroundColor(colors.white)
  2062. term.setTextColor(colors.blue)
  2063. term.setCursorPos(20,18)
  2064. print"  Pepek"
  2065. term.setCursorPos(28,18)
  2066. print"Soft  "
  2067. term.setCursorPos(27,18)
  2068. term.setTextColor(colors.lime)
  2069. print"@"
  2070. sleep (1)
  2071. term.setBackgroundColor(colors.white)
  2072. term.setTextColor(colors.black)
  2073. term.clear()
  2074. term.setCursorPos(23, 7)
  2075. prc (var47)
  2076. term.setBackgroundColor(colors.white)
  2077. term.setTextColor(colors.blue)
  2078. term.setCursorPos(20,18)
  2079. print"  Pepek"
  2080. term.setCursorPos(28,18)
  2081. print"Soft  "
  2082. term.setCursorPos(27,18)
  2083. term.setTextColor(colors.lime)
  2084. print"@"
  2085. sleep (1)
  2086. os.reboot ()
  2087. end
  2088.  
  2089. function prohlizec ()
  2090. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  2091. local cnt=f.readAll()
  2092. f.close()
  2093. local nastaveni=textutils.unserialize(cnt)
  2094. local version = "1.2"
  2095. w,h = term.getSize()
  2096. local dir = ""
  2097. shell.setDir(dir)
  2098. local tProgram = shell.getRunningProgram()
  2099. local buttonAPI = "button"
  2100. local selected = 0
  2101. local menuS = false
  2102. local input
  2103. local path
  2104. local ypos
  2105. local tempvar
  2106.  
  2107. filePos = {
  2108.   [1] = {3,3},
  2109.   [2] = {15,3},
  2110.   [3] = {27,3},
  2111.   [4] = {39,3},
  2112.   [5] = {3,7},
  2113.   [6] = {15,7},
  2114.   [7] = {27,7},
  2115.   [8] = {39,7},
  2116.   [9] = {3,11},
  2117.   [10] = {15,11},
  2118.   [11]= {27,11},
  2119.   [12]= {39,11},
  2120.   [13] = {3,15},
  2121.   [14]= {15,15},
  2122.   [15]= {27,15},
  2123.   [16]= {39,15}
  2124. }
  2125. local cPage = 1
  2126. local nPage = 1
  2127. local run = true
  2128.  
  2129. --Checks
  2130. if not term.isColor() then
  2131.   print("This program can only run on an advanced computer")
  2132.   return
  2133. --[[elseif os.version() ~= "CraftOS 1.5" then
  2134.   print("This program is designed for CraftOS 1.5")
  2135.   print("Your version is "..os.version())
  2136.   print("Newer or older version may not work")
  2137.   print("Run anyways?")
  2138.   print("y/n")
  2139.   while true do
  2140.     event,par1,par2,par3 = os.pullEvent()
  2141.     if par1 == keys.y then run = true break end
  2142.     if par1 == keys.n then run = false break end
  2143.   end]]
  2144. end
  2145.  
  2146. if not run then os.pullEvent() return end
  2147.  
  2148.  
  2149. --Functions--
  2150. function clear(color)
  2151.   if color then
  2152.     term.setBackgroundColor(color)
  2153.   end
  2154.   term.clear()
  2155.   term.setCursorPos(1,1)
  2156. end
  2157.  
  2158. function sColor(color)
  2159.   term.setBackgroundColor(color)
  2160. end
  2161.  
  2162. function drawS(x,y,state)
  2163.   if state then sColor(colors.cyan) else sColor(colors.white) end
  2164.   term.setCursorPos(x-1,y-1)
  2165.   print(string.rep(" ",13))
  2166.   term.setCursorPos(x-1,y)
  2167.   term.write(" ")
  2168.   term.setCursorPos(x-1,y+1)
  2169.   term.write(" ")
  2170.   term.setCursorPos(x-1,y+2)
  2171.   term.write(" ")
  2172.   term.setCursorPos(x-1,y+3)
  2173.   print(string.rep(" ",13))
  2174.   term.setCursorPos(x+11,y)
  2175.   term.write(" ")
  2176.   term.setCursorPos(x+11,y+1)
  2177.   term.write(" ")
  2178.   term.setCursorPos(x+11,y+2)
  2179.   term.write(" ")
  2180.   term.setCursorPos(x+11,y+3)
  2181.   term.write(" ")
  2182. end
  2183.  
  2184. function printC(text,y)
  2185.   if not y then
  2186.     error("printC:No Y value specified")
  2187.   end
  2188.   term.setCursorPos(math.ceil(w/2-#tostring(text)/2),y)
  2189.   term.write(text)
  2190. end
  2191.  
  2192. function window(_w,_h,head,ypos)
  2193.   if not _w or not _h then
  2194.     error("Window:Missing width (w) or height (h)")
  2195.   end
  2196.   if not ypos or type(ypos) ~= "number" then ypos = 5 end
  2197.   sColor(colors.white)
  2198.   term.setCursorPos(1,h)
  2199.   term.write(string.rep(" ",w))
  2200.   sColor(nastaveni.barva)
  2201.   term.setCursorPos(w,1)
  2202.   term.write(" ")
  2203.   printC(string.rep(" ",_w),ypos)
  2204.   term.setTextColor(colors.white)
  2205.   if head then
  2206.     printC(head,ypos)
  2207.   end
  2208.   sColor(colors.gray)
  2209.   for i = 1, _h do
  2210.     printC(string.rep(" ",_w),i+ypos)
  2211.   end
  2212. end
  2213.  
  2214. function testSpot(x,y)
  2215.   if y > 1 then
  2216.     if #cDir < 17 then
  2217.       _rep = #cDir
  2218.     else
  2219.       _rep = 16
  2220.     end
  2221.     for _c = 1, _rep do
  2222.       if x >= filePos[_c][1] and x <= filePos[_c][1]+10 and y >= filePos[_c][2] and y <= filePos[_c][2]+2 then
  2223.         return _c
  2224.       end
  2225.     end
  2226.   end
  2227.   return false
  2228. end
  2229.  
  2230. function bar()
  2231.   sColor(nastaveni.barva)
  2232.   term.setCursorPos(1,1)
  2233.   term.write(string.rep(" ",w-1))
  2234.   sColor(colors.red)
  2235.   term.setTextColor(colors.white)
  2236.   term.write("Q")
  2237. end
  2238.  
  2239. function drawDir()
  2240.   clear(colors.white)
  2241.   bar ()
  2242.   sColor(nastaveni.barva)
  2243.   cDir = fs.list(shell.dir())
  2244.   if shell.dir() == "" then
  2245.     printC("C: - File Manager "..version,1)
  2246.   else
  2247.     printC("/"..shell.dir(),1)
  2248.   end
  2249.   for i = 1, #cDir do
  2250.     local num = i
  2251.     local a = i+16*(cPage-1)
  2252.     local name = tostring(cDir[a])
  2253.     if name == "nil" then break end
  2254.     if #name > 9 then
  2255.       text = string.sub(name,1,6).."..."
  2256.     else
  2257.       text = name
  2258.     end
  2259.     if fs.isDir(shell.dir().."/"..name) then
  2260.       sColor(colors.orange)
  2261.     else
  2262.       sColor(colors.lightGray)
  2263.     end
  2264.     if shell.dir() == "" then
  2265.       location = "C:/"..name
  2266.     else
  2267.       location = tostring("C:/"..shell.dir().."/"..name)
  2268.     end
  2269.     if i > 16 then break end
  2270.     x = filePos[i][1]
  2271.     y = filePos[i][2]
  2272.     term.setCursorPos(x,y)
  2273.     term.write(string.rep(" ",11))
  2274.     term.setCursorPos(x,y+1)
  2275.     term.write(string.rep(" ",math.floor(5.5-#tostring(text)/2)))
  2276.     term.write(text)
  2277.     term.write(string.rep(" ",math.ceil(5.5-#tostring(text)/2)))
  2278.     term.setCursorPos(x,y+2)
  2279.     term.write(string.rep(" ",11))
  2280.   end
  2281.   if #cDir > 16 then
  2282.     nPage = math.ceil(#cDir/16)
  2283.     term.setTextColor(colors.black)
  2284.     sColor(colors.white)
  2285.     printC("Page "..cPage.." of "..nPage,2)
  2286.     nSelect = cDir[selected+16*(cPage-1)]
  2287.   else
  2288.     nSelect = cDir[selected]
  2289.   end
  2290.   if selected > 0 then
  2291.     drawS(filePos[selected][1],filePos[selected][2],true)
  2292.     sType = fs.isDir(shell.resolve(nSelect))
  2293.     menuS = true
  2294.   else
  2295.     menuS = false
  2296.   end
  2297. end
  2298.  
  2299. function confirm(text)
  2300.   if not text or #text <= 8 then
  2301.     window(8,3,text)
  2302.   else
  2303.     window(#text+2,3,text)
  2304.   end    
  2305.   term.setCursorPos(23,7)
  2306.   sColor(colors.lime)
  2307.   term.write("Yes")
  2308.   term.setCursorPos(27,7)
  2309.   sColor(colors.red)
  2310.   term.write("No")
  2311.   while true do
  2312.     event,par1,par2,par3 = os.pullEvent("mouse_click")
  2313.     if par3 == 7 then
  2314.       if par2 >= 23 and par2 <=25 then
  2315.         return true
  2316.       elseif par2 >= 27 and par2 <= 28 then
  2317.         return false
  2318.       end
  2319.     end
  2320.   end
  2321. end
  2322.  
  2323. function changeDir()
  2324.   window(26,4,"Change Directory")
  2325.   printC("Use '/' for root",8)
  2326.   sColor(colors.black)
  2327.   repeat    
  2328.     printC(string.rep(" ",18),7)  
  2329.     term.setCursorPos(17,7)
  2330.     input = read()
  2331.   until input ~= ""
  2332.   path = shell.resolve(input)
  2333.   if fs.exists(path) and fs.isDir(path) then
  2334.     shell.setDir(path)
  2335.   else
  2336.     sColor(colors.gray)
  2337.     term.setTextColor(colors.red)
  2338.     printC("Doesn't Exist!",9)
  2339.     sleep(1)
  2340.   end
  2341. end
  2342.  
  2343. function info(_path)
  2344.   if not _path then
  2345.     error("No path")
  2346.   end
  2347.   name = cDir[_path]
  2348.   clear(colors.white)
  2349.   term.setTextColor(colors.white)
  2350.   sColor(nastaveni.barva)
  2351.   term.write(string.rep(" ",w))
  2352.   printC(name,1)
  2353.   term.setCursorPos(w,1)
  2354.   sColor(colors.red)
  2355.   print("Q")
  2356.   term.setCursorPos(1,2)
  2357.   term.setTextColor(colors.black)
  2358.   sColor(colors.white)
  2359.   print(" ")
  2360.   term.write("File Path:")
  2361.   path = shell.resolve(name)
  2362.   print("/"..path)
  2363.   term.write("Type:")
  2364.   if fs.isDir(path) then
  2365.     print("Folder")
  2366.   else
  2367.     print("File")
  2368.     print("Size:"..fs.getSize(path))
  2369.   end
  2370.   if fs.isReadOnly(shell.resolve(nSelect)) then
  2371.     print("This is a read-only item")
  2372.   end
  2373.   if shell.resolve(nSelect) == tProgram then
  2374.     term.setTextColor(colors.orange)
  2375.     print("This program is currently running")
  2376.   end
  2377.   while true do
  2378.     event,par1,par2,par3 = os.pullEvent()
  2379.     if event == "mouse_click" then
  2380.       if par2 == w and par3 == 1 then
  2381.         break
  2382.       end
  2383.     end
  2384.   end
  2385. end
  2386.  
  2387. function addItem()
  2388.   window(8,7,"Add...")
  2389.   term.setTextColor(colors.white)
  2390.   sColor(colors.lime)
  2391.   printC("Folder",7)
  2392.   printC("File",9)
  2393.   sColor(colors.red)
  2394.   printC("Cancel",11)
  2395.   local choice = nil
  2396.   while true do
  2397.     event,par1,par2,par3 = os.pullEvent("mouse_click")
  2398.     if par3 == 7 and par2 >= 23 and par2 <= 28 then
  2399.       choice = 1
  2400.       break
  2401.     elseif par3 == 9 and par2 >= 24 and par2 <= 27 then
  2402.       choice = 2
  2403.       break
  2404.     elseif par3 == 11 and par2 >= 23 and par2 <=28 then
  2405.       choice = 3
  2406.       break
  2407.     end
  2408.   end
  2409.   if choice ~= 3 then
  2410.     window(26,3,"Enter name")
  2411.     sColor(colors.black)
  2412.     repeat
  2413.       printC(string.rep(" ",22),7)
  2414.       term.setCursorPos(15,7)
  2415.       input = read()
  2416.     until input ~= ""
  2417.     if fs.exists(shell.resolve(input)) then
  2418.       sColor(colors.gray)
  2419.       term.setTextColor(colors.red)
  2420.       printC("Already Exists!",8)
  2421.       sleep(2)
  2422.     elseif choice == 1 then
  2423.       fs.makeDir(shell.dir().."/"..input)
  2424.     elseif choice == 2 then
  2425.       f = fs.open(shell.dir().."/"..input,"w")
  2426.       f.close()
  2427.     end
  2428.   end
  2429. end
  2430.  
  2431. function move(item)
  2432.   path = shell.resolve(item)
  2433.   if #path <= 26 then
  2434.     window(26,5,"Move item")
  2435.   else
  2436.     window(#path+2,5,"Move item")
  2437.   end
  2438.   printC("Current path:",6)
  2439.   printC(path,7)
  2440.   printC("New path:",8)
  2441.   printC("Use 'cancel' to cancel",10)
  2442.   sColor(colors.black)
  2443.   repeat
  2444.     printC(string.rep(" ",22),9)
  2445.     term.setCursorPos(15,9)
  2446.     input = read()
  2447.   until input ~= ""
  2448.   sColor(colors.gray)
  2449.   printC(string.rep(" ",26),10)
  2450.   term.setTextColor(colors.red)
  2451.   if fs.exists(input) then
  2452.     printC("Already Exists!",10)
  2453.     sleep(2)
  2454.   elseif input == "cancel" then
  2455.     printC("Canceled",10)
  2456.     sleep(2)
  2457.   else
  2458.     fs.move(path,input)
  2459.     term.setTextColor(colors.lime)
  2460.     printC("Success",10)
  2461.     sleep(2)
  2462.   end    
  2463. end
  2464.  
  2465. function cRename(item)
  2466.   path = shell.resolve(item)
  2467.   if #path <= 26 then
  2468.     window(26,5,"Rename item")
  2469.   else
  2470.     window(#path+2,5,"Rename item")
  2471.   end
  2472.   printC("Current name:",6)
  2473.   printC(item,7)
  2474.   printC("New name:",8)
  2475.   printC("Use 'cancel' to cancel",10)
  2476.   sColor(colors.black)
  2477.   repeat
  2478.     printC(string.rep(" ",22),9)
  2479.     term.setCursorPos(15,9)
  2480.     input = read()
  2481.   until input ~= ""
  2482.   sColor(colors.gray)
  2483.   printC(string.rep(" ",26),10)
  2484.   term.setTextColor(colors.red)
  2485.   if fs.exists(shell.resolve(input)) then
  2486.     printC("Already Exists!",10)
  2487.     sleep(2)
  2488.   elseif string.find(input,"/") then
  2489.     printC("Cannot contain '/'",10)
  2490.     sleep(2)
  2491.   elseif input == "cancel" then
  2492.     printC("Canceled",10)
  2493.     sleep(2)
  2494.   else
  2495.     fs.move(path,input)
  2496.     term.setTextColor(colors.lime)
  2497.     printC("Success",10)
  2498.     sleep(2)
  2499.   end
  2500. end
  2501.  
  2502. --Main loop program--
  2503. function main()
  2504.   while true do
  2505.     drawDir()
  2506.     if menuS then
  2507.       term.setTextColor(colors.black)
  2508.       sColor(colors.white)
  2509.       printC(nSelect,h-1)
  2510.       if sType then  --If the item is a folder
  2511.         if fs.isReadOnly(shell.resolve(nSelect)) then  --If the folder is read-only
  2512.           printC("This is a read-only folder  O:Open Tab:Info",h)
  2513.         else  --Normal folder
  2514.           printC("O:Open  D:Delete  M:Move  N:Rename  Tab:Info",h)
  2515.         end
  2516.       else  --If the item is a file
  2517.         if shell.resolve(nSelect) == tProgram then  --If the file is this program
  2518.           printC("This program is currently running  Tab:Info",h)
  2519.         elseif fs.isReadOnly(shell.resolve(nSelect)) then  --If the file is read-only
  2520.           printC("This is a read-only file  R:Run P:Preview Tab:Info",h)
  2521.         else  --Normal file
  2522.           printC("R:Run E:Edit D:Delete M:Move N:Rename Tab:Info",h)
  2523.         end
  2524.       end
  2525.       term.setTextColor(colors.white)
  2526.     else
  2527.       term.setTextColor(colors.black)
  2528.       sColor(colors.white)
  2529.       if fs.isReadOnly(shell.dir()) then --If folder is read--only
  2530.         if #cDir > 16 then
  2531.           printC("B:Back  Tab:Enter Path  Page:PgUp/Down",h)
  2532.         else
  2533.           printC("B:Back  Tab:Enter Path",h)
  2534.           cPage = 1
  2535.         end
  2536.       else  --Normal Folder
  2537.         if #cDir > 16 then
  2538.           printC("C:Create... B:Back Tab:Enter path Page:PgUp/Down",h)
  2539.         else
  2540.           printC("C:Create...  B:Back  Tab:Enter path",h)
  2541.           cPage = 1
  2542.         end
  2543.       end
  2544.       term.setTextColor(colors.white)
  2545.     end
  2546.     event,par1,par2,par3,par4 = os.pullEvent()  --Main pullEvent--
  2547.     if event == "mouse_click" then
  2548.       if par2 == w and par3 == 1 then
  2549.         break
  2550.       else
  2551.         click = testSpot(par2,par3)
  2552.         if click then
  2553.           selected = click
  2554.         else
  2555.           selected = 0
  2556.         end
  2557.       end
  2558.     elseif event == "key" then
  2559.       if selected > 0 then  --If an item is selected
  2560.         if par1 == keys.tab then
  2561.           info(selected)
  2562.         end
  2563.         if shell.resolve(nSelect) ~= tProgram then
  2564.           if par1 == keys.d and not fs.isReadOnly(shell.resolve(nSelect)) then
  2565.             if confirm(" Delete? ") then
  2566.               fs.delete(shell.resolve(nSelect))
  2567.               selected = 0
  2568.             end          
  2569.           elseif par1 == keys.m and not fs.isReadOnly(shell.resolve(nSelect)) then
  2570.             os.pullEvent()
  2571.             move(nSelect)
  2572.             selected = 0
  2573.           elseif par1 == keys.n and not fs.isReadOnly(shell.resolve(nSelect)) then
  2574.             os.pullEvent()
  2575.             cRename(nSelect)
  2576.             selected = 0
  2577.           end
  2578.           if sType then --If the item is a directory
  2579.             if par1 == keys.o then
  2580.               shell.setDir(shell.resolve(nSelect))
  2581.               selected = 0          
  2582.             end
  2583.           else  --If the item is a file
  2584.             if par1 == keys.r then
  2585.               clear(colors.black)
  2586.               print("Begin program:")
  2587.               state,err = pcall(function() shell.run(nSelect) end )
  2588.               if err then
  2589.                 clear(colors.white)
  2590.                 bar()
  2591.                 printC("Program Error Report",1)
  2592.                 term.setCursorPos(1,3)
  2593.                 term.setTextColor(colors.black)
  2594.                 print("An error occured while running "..nSelect)
  2595.                 print(err)
  2596.                 while true do
  2597.                   event,par1,par2,par3 = os.pullEvent("mouse_click")
  2598.                   if par2 == w and par3 == 1 then
  2599.                     break
  2600.                   end
  2601.                 end
  2602.               else
  2603.                 term.setTextColor(colors.white)
  2604.                 print("End of program")
  2605.                 print("Press any key...")
  2606.                 term.setTextColor(colors.black)
  2607.                 print("End of program")
  2608.                 print("Press any key...")
  2609.                 os.pullEvent("key")
  2610.               end
  2611.               selected = 0
  2612.             elseif par1 == keys.e or par1 == keys.p then
  2613.               os.pullEvent()
  2614.               shell.run("edit "..nSelect)
  2615.               selected = 0
  2616.             end
  2617.           end
  2618.         end
  2619.       else  --If nothing is selected
  2620.         if par1 == keys.tab then
  2621.           changeDir()
  2622.         elseif par1 == keys.c and not fs.isReadOnly(shell.resolve(shell.dir())) then
  2623.           addItem()
  2624.         elseif par1 == keys.b then
  2625.           shell.run("cd ..")
  2626.         elseif par1 == 209 then
  2627.           if cPage > 1 then cPage = cPage-1 end
  2628.         elseif par1 == 201 then
  2629.           if cPage < nPage then cPage = cPage+1 end
  2630.         end
  2631.       end
  2632.     end
  2633.   end
  2634. end
  2635.  
  2636.  
  2637.  
  2638. --Program--
  2639. state,err = pcall(function() main() end)
  2640.  
  2641. if err then
  2642.   if not string.find("Terminated",err) then
  2643.     term.setTextColor(colors.white)
  2644.     sColor(colors.black)
  2645.     print("CRITICAL ERROR:")
  2646.     print(err)
  2647.     print("Press any key to continue")
  2648.     os.pullEvent("key")
  2649.   end
  2650. end
  2651.  
  2652. --after program ends
  2653. plocha ()
  2654.  
  2655. end
  2656.  
  2657. function prehravac ()
  2658. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  2659. local cnt=f.readAll()
  2660. f.close()
  2661. local nastaveni=textutils.unserialize(cnt)
  2662.  
  2663. term.setBackgroundColor(colors.white)
  2664. term.setTextColor(colors.black)
  2665. term.clear()
  2666. term.setCursorPos(1,1)
  2667. term.setBackgroundColor(nastaveni.barva)
  2668. term.setTextColor(colors.white)
  2669. print "                                                   "
  2670. term.setCursorPos(19,1)
  2671. prc (var48)
  2672. term.setTextColor(colors.black)
  2673.  
  2674. term.setCursorPos(5,8)
  2675. term.setBackgroundColor(colors.yellow)
  2676. term.setTextColor(colors.black)
  2677. print" Play "
  2678. term.setCursorPos(41,8)
  2679. print" Stop "
  2680. paintutils.drawPixel(51, 1, colors.red)
  2681. term.setTextColor(colors.white)
  2682. term.setCursorPos(51, 1)
  2683. print "Q"
  2684.  
  2685.  
  2686.  
  2687. while true do
  2688. local event, button, x, y = os.pullEvent("mouse_click")
  2689. xy = x..","..y
  2690.  
  2691. if xy == "51,1" and button == 1 then
  2692. plocha ()
  2693. break
  2694. end
  2695.  
  2696. if xy == "6,8" and button == 1 then
  2697. disk.playAudio("left")
  2698. disk.playAudio("right")
  2699. disk.playAudio("bottom")
  2700. prehravac ()
  2701. break
  2702. end
  2703.  
  2704. if xy == "7,8" and button == 1 then
  2705. disk.playAudio("left")
  2706. disk.playAudio("right")
  2707. disk.playAudio("bottom")
  2708. prehravac ()
  2709. break
  2710. end
  2711.  
  2712. if xy == "8,8" and button == 1 then
  2713. disk.playAudio("left")
  2714. disk.playAudio("right")
  2715. disk.playAudio("bottom")
  2716. prehravac ()
  2717. break
  2718. end
  2719.  
  2720. if xy == "9,8" and button == 1 then
  2721. disk.playAudio("left")
  2722. disk.playAudio("right")
  2723. disk.playAudio("bottom")
  2724. prehravac ()
  2725. break
  2726. end
  2727.  
  2728. if xy == "10,8" and button == 1 then
  2729. disk.playAudio("left")
  2730. disk.playAudio("right")
  2731. disk.playAudio("bottom")
  2732. prehravac ()
  2733. break
  2734. end
  2735.  
  2736. if xy == "11,8" and button == 1 then
  2737. disk.playAudio("left")
  2738. disk.playAudio("right")
  2739. disk.playAudio("bottom")
  2740. prehravac ()
  2741. break
  2742. end
  2743.  
  2744. if xy == "12,8" and button == 1 then
  2745. disk.playAudio("left")
  2746. disk.playAudio("right")
  2747. disk.playAudio("bottom")
  2748. prehravac ()
  2749. break
  2750. end
  2751.  
  2752. if xy == "45,8" and button == 1 then
  2753. print("Stop")
  2754. disk.stopAudio("left")
  2755. disk.stopAudio("right")
  2756. disk.stopAudio("bottom")
  2757. prehravac ()
  2758. break
  2759. end
  2760.  
  2761. if xy == "42,8" and button == 1 then
  2762. print("Stop")
  2763. disk.stopAudio("left")
  2764. disk.stopAudio("right")
  2765. disk.stopAudio("bottom")
  2766. prehravac ()
  2767. break
  2768. end
  2769.  
  2770. if xy == "43,8" and button == 1 then
  2771. print("Stop")
  2772. disk.stopAudio("left")
  2773. disk.stopAudio("right")
  2774. disk.stopAudio("bottom")
  2775. prehravac ()
  2776. break
  2777. end
  2778.  
  2779. if xy == "44,8" and button == 1 then
  2780. print("Stop")
  2781. disk.stopAudio("left")
  2782. disk.stopAudio("right")
  2783. disk.stopAudio("bottom")
  2784. prehravac ()
  2785. break
  2786. end
  2787. end
  2788. end
  2789.  
  2790. function malovani ()
  2791. if fs.exists ("/np")then
  2792. shell.run ("np")
  2793. else
  2794. prc (var49, 10)
  2795. sleep (1)
  2796. plocha ()
  2797. end
  2798. end
  2799.  
  2800. function textovani ()
  2801. if fs.exists ("/ink")then
  2802. shell.run ("ink")
  2803. else
  2804. prc (var49, 10)
  2805. sleep (1)
  2806. plocha ()
  2807. end
  2808. end
  2809.  
  2810. function pastebin ()
  2811. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  2812. local cnt=f.readAll()
  2813. f.close()
  2814. local nastaveni=textutils.unserialize(cnt)
  2815. term.setBackgroundColor(colors.white)
  2816. term.clear ()
  2817. term.setBackgroundColor(nastaveni.barva)
  2818. term.setCursorPos(1,1)
  2819. print "                                                   "
  2820. term.setTextColor(colors.white)
  2821. prc ("Pastebin Manager", 1)
  2822. term.setTextColor(colors.black)
  2823. term.setBackgroundColor(colors.lightBlue)
  2824. term.setCursorPos(5,4)
  2825. print "- Run "
  2826. term.setCursorPos(5,6)
  2827. print "- Get "
  2828. term.setCursorPos(5,8)
  2829. print "- Put "
  2830. term.setBackgroundColor(colors.red)
  2831. term.setCursorPos(51, 1)
  2832. print " "
  2833. term.setTextColor(colors.white)
  2834. term.setCursorPos(51, 1)
  2835. print "Q"
  2836. term.setTextColor(colors.black)
  2837. term.setBackgroundColor(colors.white)
  2838.  
  2839. while true do
  2840. local event, button, x, y = os.pullEventRaw()
  2841. if event == "mouse_click" then
  2842. if x >= 5 and x <= 10 and y == 4 and button == 1 then
  2843. spustit ()
  2844. elseif x >= 5 and x <= 10 and y == 6 and button == 1 then
  2845. ulozit ()
  2846. elseif x >= 5 and x <= 10 and y == 8 and button == 1 then
  2847. nahrat ()
  2848. elseif x == 51 and y == 1 and button == 1 then
  2849. plocha ()
  2850. end
  2851. end
  2852. end
  2853. end
  2854.  
  2855. function spustit ()
  2856. term.setCursorPos(4,12)
  2857. print "enter the code"
  2858. term.setCursorPos(4,13)
  2859. term.setBackgroundColor(colors.lightBlue)
  2860. print "          "
  2861. term.setCursorPos(4,13)
  2862. kod1 = io.read ()
  2863. if kod1 == "" then
  2864. pastebin ()
  2865. else
  2866. shell.run ("pastebin run",kod1)
  2867. plocha ()
  2868. end
  2869.  
  2870. while true do
  2871. if x == 51 and y == 1 and button == 1 then
  2872. plocha ()
  2873. end
  2874. end
  2875. end
  2876.  
  2877. function ulozit ()
  2878. term.setCursorPos(4,12)
  2879. print "enter the code"
  2880. term.setCursorPos(4,13)
  2881. term.setBackgroundColor(colors.lightBlue)
  2882. print "          "
  2883. term.setCursorPos(4,13)
  2884. kod1 = io.read ()
  2885. if kod1 == "" then
  2886. pastebin ()
  2887. else
  2888. term.setBackgroundColor(colors.white)
  2889. term.setCursorPos(4,12)
  2890. print "Name:  |Path: /Downloaded/NAME"
  2891. print "                                     "
  2892. end
  2893. term.setCursorPos(4,13)
  2894. term.setBackgroundColor(colors.lightBlue)
  2895. print "          "
  2896. term.setCursorPos(4,13)
  2897. kod2 = io.read ()
  2898. if kod2 == "" then
  2899. pastebin ()
  2900. else
  2901. shell.run ("pastebin get",kod1,"/Downloaded/"..kod2)
  2902. prohlizec ()
  2903. end
  2904. while true do
  2905. if x == 51 and y == 1 and button == 1 then
  2906. plocha ()
  2907. end
  2908. end
  2909. end
  2910.  
  2911. function nahrat ()
  2912. term.setCursorPos(4,12)
  2913. print "enter the path"
  2914. term.setCursorPos(4,13)
  2915. term.setBackgroundColor(colors.lightBlue)
  2916. print "          "
  2917. term.setCursorPos(4,13)
  2918. kod1 = io.read ()
  2919. if kod1 == "" then
  2920. pastebin ()
  2921. else
  2922. shell.run ("pastebin put",kod1)
  2923. end
  2924. pokr = io.read ()
  2925. if pokr == "" then
  2926. plocha ()
  2927. else
  2928. plocha ()
  2929. end
  2930. while true do
  2931. if x == 51 and y == 1 and button == 1 then
  2932. plocha ()
  2933. end
  2934. end
  2935. end
  2936.  
  2937. function obrnastaveni ()
  2938. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  2939. local cnt=f.readAll()
  2940. f.close()
  2941. local nastaveni=textutils.unserialize(cnt)
  2942. if anim == 1 then
  2943. term.setBackgroundColor(colors.gray)
  2944. term.clear()
  2945. sleep (0.1)
  2946. term.setBackgroundColor(colors.lightGray)
  2947. term.clear()
  2948. sleep (0.1)
  2949. anim = 0
  2950. end
  2951. term.setBackgroundColor(colors.white)
  2952. term.setTextColor(colors.black)
  2953. term.clear()
  2954. term.setCursorPos(1,1)
  2955. term.setBackgroundColor(nastaveni.barva)
  2956. term.setTextColor(colors.white)
  2957. print "                                                   "
  2958. paintutils.drawPixel(51, 1, colors.red)
  2959. term.setTextColor(colors.white)
  2960. term.setCursorPos(51, 1)
  2961. print "Q"
  2962. term.setBackgroundColor(nastaveni.barva)
  2963. term.setCursorPos(1, 1)
  2964. print "                   "
  2965. print "                   "
  2966. print " Command Line      "
  2967. print "                   "
  2968. print (var51)
  2969. print "                   "
  2970. print (var52)
  2971. print "                   "
  2972. print (var53)
  2973. print "                   "
  2974. print (var54)
  2975. print "                   "
  2976. print (var55)
  2977. print "                   "
  2978. print (var81)
  2979. print "                   "
  2980. print (var91)
  2981. print "                   "
  2982. term.setBackgroundColor(colors.white)
  2983. term.setTextColor(colors.black)
  2984. prc (var56, 3)
  2985. term.setCursorPos(21, 5)
  2986. print ("- NPaint")
  2987. term.setCursorPos(21, 7)
  2988. print ("- File Manager v1.2")
  2989. term.setCursorPos(21, 9)
  2990. print ("- Ink by oeed")
  2991. term.setCursorPos(21, 11)
  2992. print ("- Pepdroll addons")
  2993. term.setCursorPos(21, 13)
  2994. print ("- Dynet client by Laurens Weyn")
  2995. term.setCursorPos(21, 15)
  2996. print "- Advanced calculator Immicalc"
  2997. term.setBackgroundColor(nastaveni.barva)
  2998. term.setTextColor(colors.white)
  2999. term.setCursorPos(23,1)
  3000. prc (var50)
  3001.  
  3002. while true do
  3003. local event, button, x, y = os.pullEvent("mouse_click")
  3004. xy = x..","..y
  3005.  
  3006. if xy == "51,1" and button == 1 then
  3007. plocha ()
  3008. break
  3009. end
  3010.  
  3011. if x >= 0 and x <= 19 and y == 5 and button == 1 then
  3012. uzivatele ()
  3013. break
  3014. end
  3015.  
  3016. if x >= 0 and x <= 19 and y == 7 and button == 1 then
  3017. network ()
  3018. break
  3019. end
  3020.  
  3021. if x >= 0 and x <= 19 and y == 9 and button == 1 then
  3022. pozadi ()
  3023. break
  3024. end
  3025.  
  3026. if x >= 0 and x <= 19 and y == 11 and button == 1 then
  3027. pocitac ()
  3028. break
  3029. end
  3030.  
  3031. if x >= 0 and x <= 19 and y == 13 and button == 1 then
  3032. system ()
  3033. break
  3034. end
  3035.  
  3036. if x >= 0 and x <= 19 and y == 15 and button == 1 then
  3037. jazyky ()
  3038. break
  3039. end
  3040.  
  3041. if x >= 0 and x <= 19 and y == 17 and button == 1 then
  3042. biosn ()
  3043. break
  3044. end
  3045.  
  3046. if x >= 0 and x <= 19 and y == 3 and button == 1 then
  3047.     term.setBackgroundColor(colors.black)
  3048.     term.clear ()
  3049.     term.setCursorPos(1,1)
  3050. shell.run ("/.core/shell")
  3051. break
  3052. end
  3053.  
  3054. end
  3055. end
  3056.  
  3057. function biosn ()
  3058.  
  3059. if bios == "1" then
  3060.     local data= fs.open ("/.core/biosset", "r")
  3061.     a = data.readLine()
  3062.     b = data.readLine()
  3063.     c = data.readLine()
  3064.     d = data.readLine()
  3065.     e = data.readLine()
  3066.     f = data.readLine()
  3067.     g = data.readLine()
  3068.     h = data.readLine()
  3069.     data.close ()
  3070. end
  3071.     if a == "0" and b == "0" and c == "0" then
  3072.         fass = "Enable"
  3073.         else
  3074.         fass = "Disable"
  3075.         end
  3076.        
  3077.     if a == "1" then
  3078.         as = "Enabled"
  3079.     else
  3080.         as = "Disabled"
  3081.     end
  3082.    
  3083.     if b == "1" then
  3084.         bs = "Enabled"
  3085.     else
  3086.         bs = "Disabled"
  3087.     end
  3088.    
  3089.     if c == "1" then
  3090.         cs = "Enabled"
  3091.     else
  3092.         cs = "Disabled"
  3093.     end
  3094.    
  3095.    local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  3096. local cnt=f.readAll()
  3097. f.close()
  3098. local nastaveni=textutils.unserialize(cnt)
  3099. term.setBackgroundColor(colors.white)
  3100. term.setTextColor(colors.black)
  3101. term.clear()
  3102. term.setCursorPos(1,1)
  3103. term.setBackgroundColor(nastaveni.barva)
  3104. term.setTextColor(colors.white)
  3105. print "                                                   "
  3106. term.setCursorPos(23,1)
  3107. prc (var91)
  3108. paintutils.drawPixel(51, 1, colors.red)
  3109. term.setTextColor(colors.white)
  3110. term.setCursorPos(51, 1)
  3111. print "Q"
  3112. paintutils.drawPixel(1, 1, colors.yellow)
  3113. paintutils.drawPixel(2, 1, colors.yellow)
  3114. term.setTextColor(colors.white)
  3115. term.setCursorPos(1, 1)
  3116. print "<-"
  3117. term.setBackgroundColor(colors.lightBlue)
  3118. term.setTextColor(colors.black)
  3119. term.setCursorPos (45,18)
  3120. print "apply"
  3121. term.setCursorPos(5, 4)
  3122. print ("- "..var92.." "..fass)
  3123. term.setCursorPos(5, 6)
  3124. print ("- "..var93.." "..as)
  3125. term.setCursorPos(5, 8)
  3126. print ("- "..var94.." "..bs)
  3127. term.setCursorPos(5, 10)
  3128. print ("- Disk list "..cs)
  3129.    
  3130.  while true do
  3131. local event, button, x, y = os.pullEvent("mouse_click")
  3132. xy = x..","..y
  3133.  
  3134. if xy == "51,1" and button == 1 then
  3135. plocha ()
  3136. break
  3137. end
  3138.  
  3139. if x >= 1 and x <= 2 and y == 1 and button == 1 then
  3140. obrnastaveni ()
  3141. break
  3142. end
  3143.  
  3144. if x >= 45 and x <= 51 and y == 18 and button == 1 then
  3145.     local data= fs.open ("/.core/biosset", "w")
  3146.         local x = "1"
  3147.         data.writeLine (a)
  3148.         data.writeLine (b)
  3149.         data.writeLine (c)
  3150.         data.writeLine (d)
  3151.         data.writeLine (e)
  3152.         data.writeLine (f)
  3153.         data.writeLine (g)
  3154.         data.writeLine (h)
  3155.         data.close ()
  3156.         obrnastaveni ()
  3157.         end
  3158. if x >= 5 and x <= 51 and y == 4 and button == 1 then
  3159.     a = "0"
  3160.     b = "0"
  3161.     c = "0"
  3162.     d = "0"
  3163.     e = "0"
  3164.     f = "0"
  3165.     biosn ()
  3166.     end
  3167. if x >= 5 and x <= 51 and y == 6 and button == 1 then
  3168.     bios = 0
  3169.     if a == "1" then
  3170.         a = "0"
  3171.         biosn ()
  3172.     elseif a == "0" then
  3173.         a = "1"
  3174.         biosn ()
  3175.     end
  3176. end
  3177.  
  3178. if x >= 5 and x <= 51 and y == 8 and button == 1 then
  3179.     print "test"
  3180.     bios = 0
  3181.     if b == "1" then
  3182.         b = "0"
  3183.         biosn ()
  3184.     elseif b == "0" then
  3185.         b = "1"
  3186.         biosn ()
  3187.     end
  3188. end
  3189.  
  3190. if x >= 5 and x <= 51 and y == 10 and button == 1 then
  3191.     print "test"
  3192.     bios = 0
  3193.     if c == "1" then
  3194.         c = "0"
  3195.         biosn ()
  3196.     elseif c == "0" then
  3197.         c = "1"
  3198.         biosn ()
  3199.     end
  3200. end
  3201. end
  3202. end
  3203.    
  3204.  
  3205. function cmd()
  3206.     term.setTextColor(colors.white)
  3207.     term.clear ()
  3208.         term.setCursorPos (1,1)
  3209.         print "Enter 'exit' to exit"
  3210.     term.setCursorPos (1,2)
  3211.     prikaz = read()
  3212.     if prikaz == "exit" then
  3213.         obrnastaveni ()
  3214.     end
  3215.         if prikaz == "delete system" then
  3216.         obrnastaveni ()
  3217.     end
  3218.     shell.run (prikaz)
  3219.     sleep (1)
  3220.     cmd ()
  3221.  end
  3222.  
  3223. function jazyky ()
  3224. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  3225. local cnt=f.readAll()
  3226. f.close()
  3227. local nastaveni=textutils.unserialize(cnt)
  3228. term.setBackgroundColor(colors.white)
  3229. term.setTextColor(colors.black)
  3230. term.clear()
  3231. term.setCursorPos(1,1)
  3232. term.setBackgroundColor(nastaveni.barva)
  3233. term.setTextColor(colors.white)
  3234. print "                                                   "
  3235. term.setCursorPos(23,1)
  3236. prc (var82)
  3237. paintutils.drawPixel(51, 1, colors.red)
  3238. term.setTextColor(colors.white)
  3239. term.setCursorPos(51, 1)
  3240. print "Q"
  3241. paintutils.drawPixel(1, 1, colors.yellow)
  3242. paintutils.drawPixel(2, 1, colors.yellow)
  3243. term.setTextColor(colors.white)
  3244. term.setCursorPos(1, 1)
  3245. print "<-"
  3246. term.setBackgroundColor(colors.lightBlue)
  3247. term.setTextColor(colors.black)
  3248. term.setCursorPos(5, 4)
  3249. print ("- "..var84)
  3250. term.setCursorPos(5, 6)
  3251. print ("- "..var85)
  3252.  
  3253. while true do
  3254. local event, button, x, y = os.pullEvent("mouse_click")
  3255. xy = x..","..y
  3256.  
  3257. if xy == "51,1" and button == 1 then
  3258. plocha ()
  3259. break
  3260. end
  3261.  
  3262. if x >= 1 and x <= 2 and y == 1 and button == 1 then
  3263. obrnastaveni ()
  3264. break
  3265. end
  3266.  
  3267. if x >= 5 and x <= 50 and y == 4 and button == 1 then
  3268. jazykya ()
  3269. break
  3270. end
  3271.  
  3272. if x >= 5 and x <= 50 and y == 6 and button == 1 then
  3273. jazykypc ()
  3274. break
  3275. end
  3276.  
  3277. end
  3278. end
  3279.  
  3280. function jazykya ()
  3281. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  3282. local cnt=f.readAll()
  3283. f.close()
  3284. local nastaveni=textutils.unserialize(cnt)
  3285. term.setBackgroundColor(colors.white)
  3286. term.setTextColor(colors.black)
  3287. term.clear()
  3288. term.setCursorPos(1,1)
  3289. term.setBackgroundColor(nastaveni.barva)
  3290. term.setTextColor(colors.white)
  3291. print "                                                   "
  3292. term.setCursorPos(23,1)
  3293. prc (var84)
  3294. paintutils.drawPixel(51, 1, colors.red)
  3295. term.setTextColor(colors.white)
  3296. term.setCursorPos(51, 1)
  3297. print "Q"
  3298. paintutils.drawPixel(1, 1, colors.yellow)
  3299. paintutils.drawPixel(2, 1, colors.yellow)
  3300. term.setTextColor(colors.white)
  3301. term.setCursorPos(1, 1)
  3302. print "<-"
  3303. term.setBackgroundColor(colors.lightBlue)
  3304. term.setTextColor(colors.black)
  3305. term.setCursorPos(5, 4)
  3306. print "- English"
  3307. term.setCursorPos(5, 6)
  3308. print "- Deutsch"
  3309. term.setCursorPos(5, 8)
  3310. print "- Cestina"
  3311. term.setCursorPos(5, 10)
  3312. print "- Slovencina"
  3313.  
  3314. while true do
  3315. local event, button, x, y = os.pullEvent("mouse_click")
  3316. xy = x..","..y
  3317.  
  3318. if xy == "51,1" and button == 1 then
  3319. plocha ()
  3320. break
  3321. end
  3322.  
  3323. if x >= 1 and x <= 2 and y == 1 and button == 1 then
  3324. jazyky ()
  3325. break
  3326. end
  3327.  
  3328. if x >= 5 and x <= 12 and y == 4 and button == 1 then
  3329. shell.run ("delete /.ucet/"..user.."/language")
  3330. shell.run ("pastebin get sh70PdPx /.ucet/"..user.."/language")
  3331. jazyky ()
  3332. break
  3333. end
  3334.  
  3335. if x >= 5 and x <= 12 and y == 6 and button == 1 then
  3336. shell.run ("delete /.ucet/"..user.."/language")
  3337. shell.run ("pastebin get 2QDGWDfM /.ucet/"..user.."/language")
  3338. jazyky ()
  3339. break
  3340. end
  3341.  
  3342. if x >= 5 and x <= 12 and y == 8 and button == 1 then
  3343. shell.run ("delete /.ucet/"..user.."/language")
  3344. shell.run ("pastebin get g8w9iiQj /.ucet/"..user.."/language")
  3345. jazyky ()
  3346. break
  3347. end
  3348.  
  3349. if x >= 5 and x <= 16 and y == 10 and button == 1 then
  3350. shell.run ("delete /.ucet/"..user.."/language")
  3351. shell.run ("pastebin get MMsETUui /.ucet/"..user.."/language")
  3352. jazyky ()
  3353. break
  3354. end
  3355.  
  3356. end
  3357. end
  3358.  
  3359. function jazykypc ()
  3360. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  3361. local cnt=f.readAll()
  3362. f.close()
  3363. local nastaveni=textutils.unserialize(cnt)
  3364. term.setBackgroundColor(colors.white)
  3365. term.setTextColor(colors.black)
  3366. term.clear()
  3367. term.setCursorPos(1,1)
  3368. term.setBackgroundColor(nastaveni.barva)
  3369. term.setTextColor(colors.white)
  3370. print "                                                   "
  3371. term.setCursorPos(23,1)
  3372. prc (var85)
  3373. paintutils.drawPixel(51, 1, colors.red)
  3374. term.setTextColor(colors.white)
  3375. term.setCursorPos(51, 1)
  3376. print "Q"
  3377. paintutils.drawPixel(1, 1, colors.yellow)
  3378. paintutils.drawPixel(2, 1, colors.yellow)
  3379. term.setTextColor(colors.white)
  3380. term.setCursorPos(1, 1)
  3381. print "<-"
  3382. term.setBackgroundColor(colors.lightBlue)
  3383. term.setTextColor(colors.black)
  3384. term.setCursorPos(5, 4)
  3385. print "- English"
  3386. term.setCursorPos(5, 6)
  3387. print "- Deutsch"
  3388. term.setCursorPos(5, 8)
  3389. print "- Cestina"
  3390. term.setCursorPos(5, 10)
  3391. print "- Slovencina"
  3392.  
  3393. while true do
  3394. local event, button, x, y = os.pullEvent("mouse_click")
  3395. xy = x..","..y
  3396.  
  3397. if xy == "51,1" and button == 1 then
  3398. plocha ()
  3399. break
  3400. end
  3401.  
  3402. if x >= 1 and x <= 2 and y == 1 and button == 1 then
  3403. jazyky ()
  3404. break
  3405. end
  3406.  
  3407. if x >= 5 and x <= 12 and y == 4 and button == 1 then
  3408. shell.run ("delete /.core/language")
  3409. shell.run ("pastebin get sh70PdPx /.core/language")
  3410. jazyky ()
  3411. break
  3412. end
  3413.  
  3414. if x >= 5 and x <= 12 and y == 6 and button == 1 then
  3415. shell.run ("delete /.core/language")
  3416. shell.run ("pastebin get 2QDGWDfM /.core/language")
  3417. jazyky ()
  3418. break
  3419. end
  3420.  
  3421. if x >= 5 and x <= 12 and y == 8 and button == 1 then
  3422. shell.run ("delete /.core/language")
  3423. shell.run ("pastebin get g8w9iiQj /.core/language")
  3424. jazyky ()
  3425. break
  3426. end
  3427.  
  3428. if x >= 5 and x <= 16 and y == 10 and button == 1 then
  3429. shell.run ("delete /.core/language")
  3430. shell.run ("pastebin get MMsETUui /.core/language")
  3431. jazyky ()
  3432. break
  3433. end
  3434.  
  3435. end
  3436. end
  3437.  
  3438. function network ()
  3439. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  3440. local cnt=f.readAll()
  3441. f.close()
  3442. local nastaveni=textutils.unserialize(cnt)
  3443. term.setBackgroundColor(colors.white)
  3444. term.setTextColor(colors.black)
  3445. term.clear()
  3446. term.setCursorPos(1,1)
  3447. term.setBackgroundColor(nastaveni.barva)
  3448. term.setTextColor(colors.white)
  3449. print "                                                   "
  3450. term.setCursorPos(23,1)
  3451. prc (var57)
  3452. paintutils.drawPixel(51, 1, colors.red)
  3453. term.setTextColor(colors.white)
  3454. term.setCursorPos(51, 1)
  3455. print "Q"
  3456. paintutils.drawPixel(1, 1, colors.yellow)
  3457. paintutils.drawPixel(2, 1, colors.yellow)
  3458. term.setTextColor(colors.white)
  3459. term.setCursorPos(1, 1)
  3460. print "<-"
  3461. term.setBackgroundColor(colors.lightBlue)
  3462. term.setTextColor(colors.black)
  3463. term.setCursorPos(5, 6)
  3464. print "- Label"
  3465. term.setCursorPos(5, 12)
  3466. print "- Rednet"
  3467.  
  3468. while true do
  3469. local event, button, x, y = os.pullEvent("mouse_click")
  3470. xy = x..","..y
  3471.  
  3472. if xy == "51,1" and button == 1 then
  3473. plocha ()
  3474. break
  3475. end
  3476.  
  3477. if x >= 1 and x <= 2 and y == 1 and button == 1 then
  3478. obrnastaveni()
  3479. break
  3480. end
  3481.  
  3482. if x >= 5 and x <= 12 and y == 6 and button == 1 then
  3483. propojeni ()
  3484. break
  3485. end
  3486.  
  3487. if x >= 5 and x <= 11 and y == 12 and button == 1 then
  3488. modem ()
  3489. break
  3490. end
  3491. end
  3492. end
  3493. -----------------------------
  3494. function modem ()
  3495. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  3496. local cnt=f.readAll()
  3497. f.close()
  3498. local nastaveni=textutils.unserialize(cnt)
  3499. term.setBackgroundColor(colors.white)
  3500. term.clear ()
  3501. term.setBackgroundColor(nastaveni.barva)
  3502. term.setCursorPos(1,1)
  3503. print "                                                   "
  3504. term.setTextColor(colors.white)
  3505. prc (var57.." - Rednet", 1)
  3506. term.setTextColor(colors.black)
  3507. term.setBackgroundColor(colors.lightBlue)
  3508. term.setCursorPos(5,6)
  3509. print "- Open  "
  3510. term.setCursorPos(5,12)
  3511. print "- Close "
  3512. term.setBackgroundColor(colors.red)
  3513. term.setCursorPos(51, 1)
  3514. print " "
  3515. term.setTextColor(colors.white)
  3516. term.setCursorPos(51, 1)
  3517. print "Q"
  3518. paintutils.drawPixel(1, 1, colors.yellow)
  3519. paintutils.drawPixel(2, 1, colors.yellow)
  3520. term.setTextColor(colors.white)
  3521. term.setCursorPos(1, 1)
  3522. print "<-"
  3523. term.setTextColor(colors.black)
  3524. term.setBackgroundColor(colors.white)
  3525.  
  3526.  
  3527. while true do
  3528. local event, button, x, y = os.pullEventRaw()
  3529. if event == "mouse_click" then
  3530.  
  3531. while true do
  3532. local event, button, x, y = os.pullEventRaw()
  3533. if event == "mouse_click" then
  3534. if x >= 5 and x <= 10 and y == 6 and button == 1 then
  3535. modemSide = openRednet()
  3536. if modemSide == nil then
  3537.   term.setBackgroundColor(colors.white)
  3538.   term.setTextColor(colors.red)
  3539.   print(var18)
  3540.   sleep (1)
  3541. else
  3542.   term.setBackgroundColor(colors.white)
  3543.   term.setTextColor(colors.lime)
  3544.   term.setCursorPos (5,4)
  3545.   print ("Open "..modemSide)
  3546.   sleep (1)
  3547.   network ()
  3548.   end
  3549. elseif x >= 5 and x <= 10 and y == 12 and button == 1 then
  3550. modemSide = closeRednet()
  3551. if modemSide == nil then
  3552.   term.setBackgroundColor(colors.white)
  3553.   term.setTextColor(colors.red)
  3554.   print(var17)
  3555.   sleep (1)
  3556. else
  3557.   term.setBackgroundColor(colors.white)
  3558.   term.setTextColor(colors.red)
  3559.   term.setCursorPos (5,4)
  3560.   print("Close "..modemSide)
  3561.   sleep (1)
  3562. network ()
  3563. end
  3564. elseif x == 51 and y == 1 and button == 1 then
  3565. plocha ()
  3566. end
  3567.  
  3568. if x >= 1 and x <= 2 and y == 1 and button == 1 then
  3569. network()
  3570. break
  3571. end
  3572. end
  3573. end
  3574. end
  3575. end
  3576. end
  3577.  -----------------------------
  3578. function propojeni ()
  3579. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  3580. local cnt=f.readAll()
  3581. f.close()
  3582. local nastaveni=textutils.unserialize(cnt)
  3583. term.setBackgroundColor(colors.white)
  3584. term.clear ()
  3585. term.setBackgroundColor(nastaveni.barva)
  3586. term.setCursorPos(1,1)
  3587. print "                                                   "
  3588. term.setTextColor(colors.white)
  3589. prc (var57.." - Label", 1)
  3590. term.setTextColor(colors.black)
  3591. term.setBackgroundColor(colors.lightBlue)
  3592. term.setCursorPos(5,6)
  3593. print "- Set "
  3594. term.setCursorPos(5,12)
  3595. print "- Clear "
  3596. term.setBackgroundColor(colors.red)
  3597. term.setCursorPos(51, 1)
  3598. print " "
  3599. term.setTextColor(colors.white)
  3600. term.setCursorPos(51, 1)
  3601. print "Q"
  3602. paintutils.drawPixel(1, 1, colors.yellow)
  3603. paintutils.drawPixel(2, 1, colors.yellow)
  3604. term.setTextColor(colors.white)
  3605. term.setCursorPos(1, 1)
  3606. print "<-"
  3607. term.setTextColor(colors.black)
  3608. term.setBackgroundColor(colors.white)
  3609.  
  3610. while true do
  3611. local event, button, x, y = os.pullEventRaw()
  3612. if event == "mouse_click" then
  3613. if x >= 5 and x <= 10 and y == 6 and button == 1 then
  3614. term.setBackgroundColor(colors.lightBlue)
  3615. term.setCursorPos(15,6)
  3616. print "                 "
  3617. term.setCursorPos(16,6)
  3618. jmeno = read ()
  3619. term.setCursorPos(16,7)
  3620. os.setComputerLabel(jmeno)
  3621. term.setBackgroundColor(colors.lime)
  3622. term.setCursorPos(15,6)
  3623. print "     Labeled     "
  3624. sleep (1)
  3625. network ()
  3626. elseif x >= 5 and x <= 10 and y == 12 and button == 1 then
  3627. term.setCursorPos(10,13)
  3628. shell.run ("label clear")
  3629. term.setBackgroundColor(colors.red)
  3630. term.setCursorPos(10,12)
  3631. print "     Removed     "
  3632. sleep (1)
  3633. network ()
  3634. elseif x == 51 and y == 1 and button == 1 then
  3635. plocha ()
  3636. end
  3637.  
  3638. if x >= 1 and x <= 2 and y == 1 and button == 1 then
  3639. network()
  3640. break
  3641. end
  3642.  
  3643. end
  3644. end
  3645. end
  3646. -------------------------------------
  3647.  
  3648. function pocitac ()
  3649. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  3650. local cnt=f.readAll()
  3651. f.close()
  3652. local nastaveni=textutils.unserialize(cnt)
  3653. term.setBackgroundColor(colors.white)
  3654. term.setTextColor(colors.black)
  3655. term.clear()
  3656. term.setCursorPos(1,1)
  3657. term.setBackgroundColor(nastaveni.barva)
  3658. term.setTextColor(colors.white)
  3659. print "                                                   "
  3660. term.setCursorPos(23,1)
  3661. prc (var58)
  3662. paintutils.drawPixel(51, 1, colors.red)
  3663. term.setTextColor(colors.white)
  3664. term.setCursorPos(51, 1)
  3665. print "Q"
  3666. paintutils.drawPixel(1, 1, colors.yellow)
  3667. paintutils.drawPixel(2, 1, colors.yellow)
  3668. term.setTextColor(colors.white)
  3669. term.setCursorPos(1, 1)
  3670. print "<-"
  3671. term.setBackgroundColor(colors.white)
  3672. term.setTextColor(colors.black)
  3673. term.setCursorPos(5, 3)
  3674. print ("Pepdroll 6.2 Pro: "..verze)
  3675. term.setCursorPos(5,5)
  3676. print( "Label: "..var59)
  3677. term.setCursorPos(5, 4)
  3678. if #tArgs > 0 then
  3679.     sDrive = tostring( tArgs[1] )
  3680. end
  3681.  
  3682. if sDrive == nil then
  3683.     print( "ID: "..os.getComputerID() )
  3684.    
  3685.     local label = os.getComputerLabel()
  3686.     if label then
  3687.     term.setCursorPos(5,5)
  3688.         print( "Label: \""..label.."\"" )
  3689.     end
  3690.  
  3691. else
  3692.     local bData = disk.hasData( sDrive )
  3693.     if not bData then
  3694.         print( "No disk in drive "..sDrive )
  3695.         return
  3696.     end
  3697.     term.setCursorPos(32,18)
  3698.     print( "ID disk #"..disk.getID( sDrive ) )
  3699.  
  3700.     local label = disk.getLabel( sDrive )
  3701.     if label then
  3702.         print( "The disk is labelled \""..label.."\"" )
  3703.     end
  3704. end
  3705. term.setCursorPos(5, 6)
  3706. print (var60)
  3707. paintutils.drawPixel(30, 6, nastaveni.barva)
  3708. term.setBackgroundColor(colors.white)
  3709. term.setCursorPos(5, 7)
  3710. print (var61)
  3711. term.setCursorPos(30, 7)
  3712. term.setBackgroundColor(colors.yellow)
  3713. print (user)
  3714. term.setBackgroundColor(colors.white)
  3715. term.setCursorPos(5, 8)
  3716. print (var62)
  3717. term.setBackgroundColor(colors.black)
  3718. print "                                                   "
  3719. print "                                                   "
  3720. print "                                                   "
  3721. print "                                                   "
  3722. print "                                                   "
  3723. print "                                                   "
  3724. print "                                                   "
  3725. print "                                                   "
  3726. print "                                                   "
  3727. print "                                                   "
  3728. term.setTextColor(colors.white)
  3729. term.setCursorPos(5, 9)
  3730. shell.run ("list")
  3731.  
  3732. while true do
  3733. local event, button, x, y = os.pullEvent("mouse_click")
  3734. xy = x..","..y
  3735.  
  3736. if xy == "51,1" and button == 1 then
  3737. plocha ()
  3738. break
  3739. end
  3740.  
  3741. if x >= 1 and x <= 2 and y == 1 and button == 1 then
  3742. obrnastaveni()
  3743. break
  3744. end
  3745. end
  3746. end
  3747. -----------------------------
  3748.  
  3749. function system ()
  3750. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  3751. local cnt=f.readAll()
  3752. f.close()
  3753. local nastaveni=textutils.unserialize(cnt)
  3754. term.setBackgroundColor(colors.white)
  3755. term.setTextColor(colors.black)
  3756. term.clear()
  3757. term.setCursorPos(1,1)
  3758. term.setBackgroundColor(nastaveni.barva)
  3759. term.setTextColor(colors.white)
  3760. print "                                                   "
  3761. term.setCursorPos(23,1)
  3762. prc (" System ")
  3763. paintutils.drawPixel(51, 1, colors.red)
  3764. term.setTextColor(colors.white)
  3765. term.setCursorPos(51, 1)
  3766. print "Q"
  3767. paintutils.drawPixel(1, 1, colors.yellow)
  3768. paintutils.drawPixel(2, 1, colors.yellow)
  3769. term.setTextColor(colors.white)
  3770. term.setCursorPos(1, 1)
  3771. print "<-"
  3772. term.setBackgroundColor(colors.lightBlue)
  3773. term.setTextColor(colors.black)
  3774. term.setCursorPos(5, 6)
  3775. print (var63)
  3776. term.setCursorPos(5, 12)
  3777. print (var64)
  3778. term.setCursorPos(5, 18)
  3779. print (var65)
  3780.  
  3781. while true do
  3782. local event, button, x, y = os.pullEvent("mouse_click")
  3783. xy = x..","..y
  3784.  
  3785. if xy == "51,1" and button == 1 then
  3786. plocha ()
  3787. break
  3788. end
  3789.  
  3790. if x >= 1 and x <= 2 and y == 1 and button == 1 then
  3791. obrnastaveni()
  3792. break
  3793. end
  3794.  
  3795. if x >= 5 and x <= 25 and y == 6 and button == 1 then
  3796. fs.delete ("/startup")
  3797. shell.run ("pastebin get 3R3M6XeK /startup")
  3798. systems ()
  3799. break
  3800. end
  3801.  
  3802. if x >= 5 and x <= 25 and y == 12 and button == 1 then
  3803. aktualizace()
  3804. break
  3805. end
  3806.  
  3807. if x >= 5 and x <= 25 and y == 18 and button == 1 then
  3808. data = fs.open("/.core/cmh","r")
  3809. computerpass = data.readLine()
  3810. data.close()
  3811. textutils.unserialize (computerpass)
  3812. term.setCursorPos(5, 16)
  3813. print (var66)
  3814. term.setCursorPos(24, 16)
  3815. term.setBackgroundColor(colors.lightBlue)
  3816. print "               "
  3817. term.setBackgroundColor(colors.lightBlue)
  3818. term.setCursorPos(24, 16)
  3819. cpass = read ("@")
  3820.  if cpass == computerpass then
  3821.     fs.delete ("/ink")
  3822.     fs.delete ("/np")
  3823.     fs.delete ("/startup")
  3824.     fs.delete ("/Downloaded")
  3825.     shell.run ("pastebin get QhDLVu1R startup")
  3826.     os.reboot ()
  3827.     else
  3828.     term.setBackgroundColor(colors.red)
  3829.     term.setCursorPos(5, 17)
  3830.     print (var67)
  3831.     sleep (1)
  3832.     system ()
  3833. end
  3834. break
  3835. end
  3836.  
  3837. end
  3838. end
  3839.  
  3840. -----------------------------
  3841. function uzivatele ()
  3842. local f = fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  3843. local cnt = f.readAll()
  3844. f.close()
  3845. local nastaveni=textutils.unserialize(cnt)
  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.setCursorPos(23,1)
  3854. prc (var51)
  3855. paintutils.drawPixel(51, 1, colors.red)
  3856. term.setTextColor(colors.white)
  3857. term.setCursorPos(51, 1)
  3858. print "Q"
  3859. paintutils.drawPixel(1, 1, colors.yellow)
  3860. paintutils.drawPixel(2, 1, colors.yellow)
  3861. term.setTextColor(colors.white)
  3862. term.setCursorPos(1, 1)
  3863. print "<-"
  3864. term.setCursorPos(21,3)
  3865. shell.run ("list /.ucet")
  3866.  
  3867. term.setBackgroundColor(colors.white)
  3868. term.setTextColor(colors.black)
  3869. term.setBackgroundColor(colors.lightBlue)
  3870. term.setCursorPos(5, 5)
  3871. print (var86)
  3872. term.setCursorPos(5, 7)
  3873. print (var68)
  3874. term.setCursorPos(5, 9)
  3875. print (var69.." "..stavlog)
  3876. term.setCursorPos(5, 11)
  3877. print (var70)
  3878. term.setCursorPos(5, 13)
  3879. print (var71)
  3880. term.setCursorPos(5, 15)
  3881. print (var72)
  3882.  
  3883. while true do
  3884. local event, button, x, y = os.pullEvent("mouse_click")
  3885. xy = x..","..y
  3886.  
  3887. if xy == "51,1" and button == 1 then
  3888. plocha ()
  3889. break
  3890. end
  3891.  
  3892. if x >= 1 and x <= 2 and y == 1 and button == 1 then
  3893. obrnastaveni()
  3894. break
  3895. end
  3896.  
  3897. if x >= 5 and x <= 21 and y == 5 and button == 1 then
  3898. zmenahesla()
  3899. break
  3900. end
  3901.  
  3902. if x >= 5 and x <= 21 and y == 7 and button == 1 then
  3903. registrace()
  3904. break
  3905. end
  3906.  
  3907. if x >= 5 and x <= 21 and y == 11 and button == 1 then
  3908. smazaniuctu ()
  3909. break
  3910. end
  3911.  
  3912. if x >= 5 and x <= 21 and y == 13 and button == 1 then
  3913. odhlasit ()
  3914. break
  3915. end
  3916.  
  3917. if x >= 5 and x <= 21 and y == 15 and button == 1 then
  3918. restart ()
  3919. break
  3920. end
  3921.  
  3922. if x >= 5 and x <= 21 and y == 9 and button == 1 then
  3923. local n=fs.open("//.core/logon.cfg","r")
  3924. preskoclog = n.readLine ()
  3925. n.close ()
  3926.  
  3927.  
  3928.     if preskoclog == "1" then
  3929.     stavlog = "No "
  3930.     preskoclog = "0"
  3931.     else
  3932.     stavlog = "Yes"
  3933.     preskoclog = "1"
  3934.     end
  3935. local n=fs.open("//.core/logon.cfg","w")
  3936. n.writeLine(preskoclog)
  3937. n.writeLine(user)
  3938. n.close()
  3939. data = fs.open("/.core/defuser","w")
  3940. data.writeLine(user)
  3941. data.close()
  3942. uzivatele ()
  3943. end
  3944. end
  3945. end
  3946.  
  3947. function zmenahesla()
  3948. if hesla == 0 then
  3949. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  3950. local cnt=f.readAll()
  3951. f.close()
  3952. local nastaveni=textutils.unserialize(cnt)
  3953. term.setCursorPos(1,1)
  3954. term.setBackgroundColor(colors.white)
  3955. term.setTextColor(colors.black)
  3956. term.clear()
  3957. term.setCursorPos(1,1)
  3958. term.setBackgroundColor(nastaveni.barva)
  3959. term.setTextColor(colors.white)
  3960. print "                                                   "
  3961. term.setBackgroundColor(nastaveni.barva)
  3962. term.setTextColor(colors.white)
  3963. term.setCursorPos(19, 1)
  3964. prc(var88)
  3965. paintutils.drawPixel(51, 1, colors.red)
  3966. term.setTextColor(colors.white)
  3967. term.setCursorPos(51, 1)
  3968. print "Q"
  3969. paintutils.drawPixel(1, 1, colors.yellow)
  3970. paintutils.drawPixel(2, 1, colors.yellow)
  3971. term.setTextColor(colors.white)
  3972. term.setCursorPos(1, 1)
  3973. print "<-"
  3974.   term.setTextColor(colors.black)
  3975.   term.setBackgroundColor(colors.lightBlue)
  3976.   term.setCursorPos(18,7)
  3977.   print "         "
  3978.   term.setCursorPos(18,9)
  3979.   print "         "
  3980.   term.setCursorPos(18,11)
  3981.   print "         "
  3982.     term.setCursorPos(18,13)
  3983.   print (var90)
  3984. hesla = 1
  3985. zmenahesla ()
  3986. elseif hesla == 1 then
  3987. term.setTextColor(colors.black)
  3988. term.setBackgroundColor(colors.white)
  3989.   term.setCursorPos(5,7)
  3990.   print(var87.." ")
  3991.   term.setCursorPos(5,9)
  3992.   print(var88.." ")
  3993.   term.setCursorPos(5,11)
  3994.   print(var89.." ")
  3995. end
  3996. while true do
  3997. local event, button, x, y = os.pullEvent("mouse_click")
  3998. xy = x..","..y
  3999.  
  4000. if x >= 1 and x <= 2 and y == 1 and button == 1 then
  4001. hesla = 0
  4002. uzivatele()
  4003. break
  4004. end
  4005.  
  4006. if xy == "51,1" and button == 1 then
  4007. hesla = 0
  4008. plocha ()
  4009. break
  4010. end
  4011.  
  4012. if x >= 18 and x <= 26 and y == 7 and button == 1 then
  4013.   term.setBackgroundColor(colors.cyan)
  4014.   term.setCursorPos(18,7)
  4015.   print "         "
  4016.   term.setCursorPos(18,7)
  4017.   heslo1 = read("@")
  4018.   term.setBackgroundColor(colors.lightBlue)
  4019.   term.setCursorPos(18,7)
  4020.   print "         "
  4021.   term.setCursorPos(18,7)
  4022.   print (var27)
  4023.   zmenahesla ()
  4024.  elseif x >= 18 and x <= 26 and y == 9 and button == 1 then
  4025.   term.setBackgroundColor(colors.cyan)
  4026.   term.setCursorPos(18,9)
  4027.   print "         "
  4028.   term.setCursorPos(18,9)
  4029.   heslo2 = read("@")
  4030.   term.setBackgroundColor(colors.lightBlue)
  4031.   term.setCursorPos(18,9)
  4032.   print "         "
  4033.   term.setCursorPos(18,9)
  4034.   print (var27)
  4035.   zmenahesla ()
  4036. elseif x >= 18 and x <= 26 and y == 11 and button == 1 then
  4037.   term.setBackgroundColor(colors.cyan)
  4038.   term.setCursorPos(18,11)
  4039.   print "         "
  4040.   term.setCursorPos(18,11)
  4041.   heslo3 = read("@")
  4042.   term.setBackgroundColor(colors.lightBlue)
  4043.   term.setCursorPos(18,11)
  4044.   print "         "
  4045.   term.setCursorPos(18,11)
  4046.   print (var27)
  4047.   zmenahesla ()
  4048. elseif x >= 18 and x <= 23 and y == 13 and button == 1 then
  4049.   if heslo1 == "" and heslo2 == "" and heslo3 == "" then
  4050.     zmenahesla ()
  4051.     end
  4052.    
  4053.   if heslo1 == passI then
  4054.     if heslo2 == heslo3 then
  4055.      local file = fs.open(".ucet/"..user.."/.data","w")
  4056.      file.writeLine(userI)
  4057.      file.writeLine(heslo2)
  4058.      file.close()
  4059.      passI = heslo2
  4060.      hesla = 0
  4061.      heslo1 = ""
  4062.      heslo2 = ""
  4063.      heslo3 = ""
  4064.      uzivatele ()
  4065.   else
  4066.      prc ("Error comfirm password failed.", 15)
  4067.      heslo3 = ""
  4068.      sleep (1)
  4069.      hesla = 0
  4070.      zmenahesla ()
  4071.      end
  4072.   else
  4073.   prc ("Error - Bad old password.", 15)
  4074.   heslo1 = ""
  4075.   sleep (1)
  4076.   hesla = 0
  4077.   zmenahesla ()
  4078.   end
  4079. end
  4080. end
  4081. end
  4082.  
  4083.  
  4084. function smazaniuctu ()
  4085. term.setCursorPos(24,11)
  4086. print "               "
  4087. term.setCursorPos(25,11)
  4088. sucet = read ()
  4089.         if sucet == "" then
  4090.             uzivatele ()
  4091.         elseif sucet == " " then
  4092.             uzivatele ()
  4093.         elseif sucet == user then
  4094.         term.setBackgroundColor(colors.red)
  4095.         term.setCursorPos(24,11)
  4096.         print (var73)
  4097.         term.setCursorPos(24,12)
  4098.         print (var74)
  4099.         sleep (1)
  4100.         uzivatele ()
  4101.         else
  4102.         smazani ()
  4103.         end
  4104.         end
  4105.        
  4106.         function smazani ()
  4107.                     if fs.exists ("/.ucet/"..sucet) then
  4108.                         fs.delete("/.ucet/"..sucet)
  4109.                         term.setBackgroundColor(colors.lime)
  4110.                         term.setCursorPos(24,11)
  4111.                         print (var75)
  4112.                         sleep (1)
  4113.                         uzivatele ()
  4114.                         else
  4115.                         term.setBackgroundColor(colors.red)
  4116.                         term.setCursorPos(24,11)
  4117.                         print (var76)
  4118.                         sleep (1)
  4119.                         uzivatele ()
  4120.                         end
  4121.                         end
  4122.                        
  4123. function registrace()
  4124.   local next = false
  4125. if login == 0 then
  4126.   term.setBackgroundColor(colors.white)
  4127.   term.setTextColor(colors.black)
  4128.   term.clear()
  4129.   term.setCursorPos(5,7)
  4130.   print(var22)
  4131.   term.setCursorPos(5,9)
  4132.   print(var20.." ")
  4133.   term.setCursorPos(5,11)
  4134.   print(var21.." ")
  4135.   term.setBackgroundColor(colors.lightBlue)
  4136.   term.setCursorPos(18,9)
  4137.   print "         "
  4138.   term.setCursorPos(18,11)
  4139.   print "         "
  4140.     term.setCursorPos(18,13)
  4141.   print (var23)
  4142. elseif login == 1 then
  4143.  
  4144. end
  4145.  
  4146. while true do
  4147. local event, button, x, y = os.pullEvent("mouse_click")
  4148. xy = x..","..y
  4149.  
  4150. if x >= 18 and x <= 26 and y == 9 and button == 1 then
  4151.   term.setBackgroundColor(colors.cyan)
  4152.   term.setCursorPos(18,9)
  4153.   print "         "
  4154.   term.setCursorPos(18,9)
  4155.   userI = read()
  4156.   term.setBackgroundColor(colors.lightBlue)
  4157.   term.setCursorPos(18,9)
  4158.   print "         "
  4159.   term.setCursorPos(18,9)
  4160.   print (userI)
  4161.     if userI == "" then
  4162.     login = 0
  4163.   registrace()
  4164.   elseif userI == " " then
  4165.   login = 0
  4166.   registrace()
  4167.   else
  4168.   login = 1
  4169.   registrace()
  4170.   end
  4171. elseif x >= 18 and x <= 26 and y == 11 and button == 1 then
  4172.   term.setBackgroundColor(colors.cyan)
  4173.   term.setCursorPos(18,11)
  4174.   print "         "
  4175.   term.setCursorPos(18,11)
  4176.   pass = read("@")
  4177.   term.setBackgroundColor(colors.lightBlue)
  4178.   term.setCursorPos(18,11)
  4179.   print "         "
  4180.   term.setCursorPos(18,11)
  4181.   print (pass)
  4182.   login = 1
  4183.   registrace ()
  4184. end
  4185.  
  4186. if x >= 18 and x <= 26 and y == 13 and button == 1 then
  4187. if userI == 0 then
  4188.     term.setBackgroundColor(colors.white)
  4189.     fgc(colors.red)
  4190.     term.setCursorPos(5,13)
  4191.     print(var30)
  4192.     sleep (1)
  4193.     login = 0
  4194.     registrace ()
  4195.   elseif userI == " " then
  4196.     term.setBackgroundColor(colors.white)
  4197.     fgc(colors.red)
  4198.     term.setCursorPos(5,13)
  4199.     print(var25)
  4200.     sleep (1)
  4201.   login = 0
  4202.   registrace()
  4203.   end
  4204.  
  4205. login = 0
  4206.   if not fs.isDir("/.ucet/"..userI) then
  4207.     fs.makeDir("/.ucet/"..userI)
  4208.     local file = fs.open(".ucet/"..userI.."/.data","w")
  4209.     file.writeLine(userI)
  4210.     file.writeLine(pass)
  4211.     file.close()
  4212.     if not fs.exists("/.core/ucet") then
  4213.       fs.open("/.core/ucet","w")
  4214.     end
  4215.     term.setBackgroundColor(colors.white)
  4216.     fgc(colors.lime)
  4217.     term.setCursorPos(5,13)
  4218.     shell.run ("pastebin get YHGDzX5a ", ".ucet/"..userI.."/bar.nfp")
  4219.     term.setCursorPos(5,13)
  4220.     shell.run ("pastebin get sc1LAE0x ", ".ucet/"..userI.."/nastaveni.cfg")
  4221.     term.setCursorPos(5,13)
  4222.     shell.run ("pastebin get sh70PdPx /.ucet/"..userI.."/language")
  4223.     term.setCursorPos(5,13)
  4224.     print(var24)
  4225.     sleep (1)
  4226.     userI = uss
  4227.     uzivatele ()
  4228.   else
  4229.     term.setBackgroundColor(colors.white)
  4230.     fgc(colors.red)
  4231.     term.setCursorPos(5,13)
  4232.     print(var25)
  4233.     sleep (1)
  4234.     uzivatele ()
  4235.   end
  4236. end
  4237. end
  4238. end
  4239.  
  4240. function pozadi ()
  4241. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  4242. local cnt=f.readAll()
  4243. f.close()
  4244. local nastaveni=textutils.unserialize(cnt)
  4245. term.setCursorPos(1,1)
  4246. term.setBackgroundColor(colors.white)
  4247. term.setTextColor(colors.black)
  4248. term.clear()
  4249. term.setCursorPos(1,1)
  4250. term.setBackgroundColor(nastaveni.barva)
  4251. term.setTextColor(colors.white)
  4252. print "                                                   "
  4253. term.setBackgroundColor(nastaveni.barva)
  4254. term.setTextColor(colors.white)
  4255. term.setCursorPos(19, 1)
  4256. prc(var77)
  4257. paintutils.drawPixel(51, 1, colors.red)
  4258. term.setTextColor(colors.white)
  4259. term.setCursorPos(51, 1)
  4260. print "Q"
  4261. paintutils.drawPixel(1, 1, colors.yellow)
  4262. paintutils.drawPixel(2, 1, colors.yellow)
  4263. term.setTextColor(colors.white)
  4264. term.setCursorPos(1, 1)
  4265. print "<-"
  4266.  
  4267. term.setBackgroundColor(colors.white)
  4268. term.setTextColor(colors.black)
  4269. term.setBackgroundColor(colors.lightBlue)
  4270. term.setCursorPos(5, 7)
  4271. print (var78)
  4272. term.setCursorPos(5, 9)
  4273. print "- Pepdroll"
  4274. term.setCursorPos(5, 11)
  4275. print "- Farm    "
  4276. term.setCursorPos(5, 13)
  4277. print "- Island  "
  4278. term.setCursorPos(5, 5)
  4279. print (var83)
  4280. term.setCursorPos(5, 15)
  4281. print "- Win XP  "
  4282. term.setCursorPos(5, 17)
  4283. print "- Nothing "
  4284.  
  4285. while true do
  4286. local event, button, x, y = os.pullEvent("mouse_click")
  4287. xy = x..","..y
  4288.  
  4289. if x >= 1 and x <= 2 and y == 1 and button == 1 then
  4290. obrnastaveni()
  4291. break
  4292. end
  4293.  
  4294. if xy == "51,1" and button == 1 then
  4295. plocha ()
  4296. break
  4297. end
  4298.  
  4299. if x >= 5 and x <= 12 and y == 5 and button == 1 then
  4300. barvapozadi ()
  4301. break
  4302. end
  4303.  
  4304. if x >= 5 and x <= 12 and y == 7 and button == 1 then
  4305. namalovat ()
  4306. break
  4307. end
  4308.  
  4309. if x >= 5 and x <= 12 and y == 9 and button == 1 then
  4310. pepdroll ()
  4311. break
  4312. end
  4313.  
  4314. if x >= 5 and x <= 12 and y ==11 and button == 1 then
  4315. statek ()
  4316. end
  4317.  
  4318. if x >= 5 and x <= 12 and y ==13 and button == 1 then
  4319. ostrov ()
  4320. end
  4321.  
  4322. if x >= 5 and x <= 12 and y ==15 and button == 1 then
  4323. xp ()
  4324. end
  4325.  
  4326. if x >= 5 and x <= 12 and y ==17 and button == 1 then
  4327. shell.run ("delete /.ucet/"..user.."/bar.nfp")
  4328. pozadi ()
  4329. end
  4330. end
  4331. end
  4332.  
  4333. function xp ()
  4334. shell.run ("delete /.ucet/"..user.."/bar.nfp")
  4335. shell.run ("pastebin get iy3EcA4Z /.ucet/"..user.."/bar.nfp")
  4336. pozadi ()
  4337. end
  4338.  
  4339. function ostrov ()
  4340. shell.run ("delete /.ucet/"..user.."/bar.nfp")
  4341. shell.run ("pastebin get vm1p8DXs /.ucet/"..user.."/bar.nfp")
  4342. pozadi ()
  4343. end
  4344.  
  4345. function pepdroll ()
  4346. shell.run ("delete /.ucet/"..user.."/bar.nfp")
  4347. shell.run ("pastebin get YHGDzX5a /.ucet/"..user.."/bar.nfp")
  4348. pozadi ()
  4349. end
  4350.  
  4351. function statek ()
  4352. shell.run ("delete /.ucet/"..user.."/bar.nfp")
  4353. shell.run ("pastebin get K0zXPiKn /.ucet/"..user.."/bar.nfp")
  4354. pozadi ()
  4355. end
  4356.  
  4357. function namalovat ()
  4358. shell.run (".core/paint /.ucet/"..user.."/bar.nfp")
  4359. end
  4360.  
  4361. function aktualizace ()
  4362. shell.run ("pastebin get Ge2p5qgQ /.core/verze")
  4363. data = fs.open("/.core/verze","r")
  4364. verzeup     = data.readLine()
  4365. data.close()
  4366. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
  4367. local cnt=f.readAll()
  4368. f.close()
  4369. local nastaveni=textutils.unserialize(cnt)
  4370. term.setCursorPos(1,1)
  4371. term.setBackgroundColor(colors.white)
  4372. term.setTextColor(colors.black)
  4373. term.clear()
  4374. term.setCursorPos(1,1)
  4375. term.setBackgroundColor(nastaveni.barva)
  4376. term.setTextColor(colors.white)
  4377. print "                                                   "
  4378. term.setBackgroundColor(nastaveni.barva)
  4379. term.setTextColor(colors.white)
  4380. term.setCursorPos(20, 1)
  4381. prc(var79)
  4382. paintutils.drawPixel(51, 1, colors.red)
  4383. term.setTextColor(colors.white)
  4384. term.setCursorPos(51, 1)
  4385. print "Q"
  4386. paintutils.drawPixel(1, 1, colors.yellow)
  4387. paintutils.drawPixel(2, 1, colors.yellow)
  4388. term.setTextColor(colors.white)
  4389. term.setCursorPos(1, 1)
  4390. print "<-"
  4391. term.setBackgroundColor(colors.white)
  4392. term.setTextColor(colors.black)
  4393. term.setCursorPos(5, 14)
  4394. print ("Current Build: "..verze)
  4395. term.setCursorPos(5, 16)
  4396. print ("Lates Build: "..verzeup)
  4397. term.setBackgroundColor(colors.lightBlue)
  4398. term.setCursorPos(5, 7)
  4399. if verze > verzeup then
  4400. print ("- Downdate")
  4401. else
  4402. print ("- "..var79)
  4403. end
  4404. term.setCursorPos(5, 9)
  4405. write("- Upgrade to Pepdroll 6.3")
  4406. term.setCursorPos(5, 11)
  4407. if var64 == "- Aktualizace" then write ("- Prejit na Pepdroll 7 standard") else write ("- Upgrade to Pepdroll 7 standard") end
  4408.  
  4409. if verze == verzeup then
  4410. term.setCursorPos(10, 15)
  4411. term.setBackgroundColor(colors.lime)
  4412. print ("You have got a lates build")
  4413. end
  4414. if verze < verzeup then
  4415. term.setCursorPos(10, 15)
  4416. term.setBackgroundColor(colors.green)
  4417. print ("New version available")
  4418. end
  4419. if verze > verzeup then
  4420. term.setCursorPos(10, 15)
  4421. term.setBackgroundColor(colors.yellow)
  4422. print ("You have unreleased version!")
  4423. end
  4424.  
  4425. while true do
  4426. local event, button, x, y = os.pullEvent("mouse_click")
  4427. xy = x..","..y
  4428.  
  4429. if xy == "51,1" and button == 1 then
  4430. fs.delete ("/.core/verze")
  4431. plocha ()
  4432. break
  4433. end
  4434.  
  4435. if x >= 1 and x <= 2 and y == 1 and button == 1 then
  4436. fs.delete ("/.core/verze")
  4437. system()
  4438. break
  4439. end
  4440.  
  4441. if x >= 5 and x <= 18 and y ==7 and button == 1 then
  4442. shell.run ("delete startup")
  4443. shell.run ("pastebin get ttiWhJPk startup")
  4444. shell.run ("delete /.ucet/"..user.."/language")
  4445. shell.run ("delete /.core/language")
  4446. if var33 == Kalkulacka then
  4447. shell.run("pastebin get AJULjcwC /.core/tut")
  4448. else
  4449. shell.run("pastebin get CyxwuZRw /.core/tut")
  4450. end
  4451. os.reboot ()
  4452. break
  4453. end
  4454.  
  4455. if x >= 5 and x <= 40 and y ==9 and button == 1 then
  4456. shell.run("delete /system.lua")
  4457. shell.run("pastebin get TnegkUDL /system.lua")
  4458. restart ()
  4459. end
  4460.  
  4461. if x >= 5 and x <= 40 and y ==11 and button == 1 then
  4462. shell.run("pastebin run wVFmZz9m")
  4463. end
  4464.  
  4465. end
  4466. end
  4467.  
  4468. function barvapozadi ()
  4469. term.setBackgroundColor(colors.white)
  4470. term.setTextColor(colors.black)
  4471. local nastaveni={barva=colors.blue}
  4472. term.setCursorPos (5, 17)
  4473. print (var80)
  4474. term.setCursorPos (5, 18)
  4475. local novaBarva=read() --#precist hodnotu od uzivatele
  4476. if colors[novaBarva:lower()] then
  4477.   nastaveni.barva=colors[novaBarva:lower()]
  4478. else
  4479.   print"Barva nenalezena, ponechano puvodni nastaveni"
  4480. end
  4481. --#ulozime
  4482. local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","w")
  4483. f.write(textutils.serialize(nastaveni))
  4484. f.close()
  4485. pozadi ()
  4486. end
  4487.  
  4488. rozhodnutiins ()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement