Advertisement
pepeknamornik

Pepdroll 6.2 Build 2240

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