Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent = os.pullEventRaw
- local verze = "2240"
- local w,h = term.getSize()
- local fgc = term.setTextColor
- local bgc = term.setBackgroundColor
- local user
- local userDir
- local sDrive = nil
- local tArgs = { ... }
- local chybas = 0
- os.pullEvent = os.pullEventRaw
- local arg={...}--command line arguments
- local opravak = 0
- local vsechno = 0
- local nastavenis = 0
- local stavlogon = 0
- local nula = 0
- local proc = 6.25
- local expr
- local spacechars = " \t\n\r"
- local anim = 1
- local rezim = 0
- local login = 0
- local userI = ""
- local passI = ""
- local userO = ""
- local passO = ""
- local data = ""
- local user = 0
- local pass = ""
- local computerpass = ""
- local f = fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
- local jazyk = en
- local hesla = 0
- local heslo1 = ""
- local heslo2 = ""
- local heslo3 = ""
- local function prc(text, y)
- local w = term.getSize()
- local _, cy = term.getCursorPos()
- term.setCursorPos(math.ceil((w-#text)/2), y or cy)
- write(text)
- end
- function kalkulacka ()
- local function skipspaces()
- while spacechars:find(expr:sub(1, 1),1,true) ~= nil and expr:len() > 0 do
- expr = expr:sub(2)
- end
- end
- local function acceptch(ch)
- skipspaces()
- if expr:sub(1,1) == ch then
- expr = expr:sub(2)
- return true
- else
- return false
- end
- end
- local function acceptnum()
- skipspaces()
- -- I'm sure there's a better way
- for len = expr:len(), 1, -1 do
- local success, n = pcall(tonumber, expr:sub(1, len))
- if success and n ~= nil then
- expr = expr:sub(len + 1)
- return n
- end
- end
- return nil
- end
- local alpha = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
- local alnum = alpha .. "0123456789"
- local function acceptident()
- local n = 0
- skipspaces()
- if alpha:find(expr:sub(1, 1),1,true) == nil then return nil end
- while alnum:find(expr:sub(n+1, n+1),1,true) ~= nil and expr:len() > n do
- n = n + 1
- end
- local ident = expr:sub(1, n)
- expr = expr:sub(n+1)
- return ident
- end
- local function parse_error(s)
- error(s and ("parse error: " .. s) or "parse error")
- end
- local expression_root
- local math_functions = {
- abs = math.abs,
- acos = math.acos,
- asin = math.asin,
- atan = math.atan,
- atan2 = math.atan2,
- ceil = math.ceil,
- floor = math.floor,
- cos = math.cos,
- sin = math.sin,
- tan = math.tan,
- cosh = math.cosh,
- sinh = math.sinh,
- tanh = math.tanh,
- -- math.deg, math.rad
- exp = math.exp,
- ln = math.log,
- log = math.log10,
- pow = math.pow,
- min = math.min,
- max = math.max,
- sqrt = math.sqrt,
- random = math.random
- }
- local math_constants = {
- pi = math.pi,
- e = math.exp(1),
- inf = math.huge,
- nan = math.huge - math.huge
- }
- local function call_function(id, arglist)
- if math_functions[id] == nil then
- error("no such function: " .. id)
- end
- return math_functions[id](unpack(arglist))
- end
- local function get_constant(id)
- return math_constants[id] or error("no such constant: "..id)
- end
- local function num_or_brackets()
- if acceptch("(") then
- local n = expression_root()
- if not acceptch(")") then parse_error("non-matching parentheses") end
- return n
- elseif acceptch("-") then
- return -expression_root()
- else
- local id = acceptident()
- if id ~= nil then
- if not acceptch("(") then
- return get_constant(id)
- elseif acceptch(")") then
- return call_function(id, {})
- else
- local arglist = {}
- local done = false
- while not done do
- table.insert(arglist, expression_root())
- if acceptch(")") then
- done = true
- elseif not acceptch(",") then
- parse_error("expected , or )")
- end
- end
- return call_function(id, arglist)
- end
- else
- local n = acceptnum()
- if n == nil then parse_error("expected number or bracketed expression") end
- return n
- end
- end
- end
- local function division()
- local n1 = num_or_brackets()
- while acceptch("/") do
- n1 = n1 / num_or_brackets()
- end
- return n1
- end
- local function multiplication()
- local n1 = division()
- while acceptch("*") do
- n1 = n1 * division()
- end
- return n1
- end
- local function subtraction()
- local n1 = multiplication()
- while acceptch("-") do
- n1 = n1 - multiplication()
- end
- return n1
- end
- local function addition()
- local n1 = subtraction()
- while acceptch("+") do
- n1 = n1 + subtraction()
- end
- return n1
- end
- expression_root = addition
- local function parse(e)
- expr = e
- local success, result = pcall(expression_root)
- if success and expr ~= "" then
- print("Garbage after expression?")
- end
- if success then
- print("= " .. tostring(result))
- else
- print(result)
- print("Near: " .. (expr == "" and "end of expression" or expr))
- end
- end
- local function mainloop()
- term.setCursorPos(17,12)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear ()
- local quitting = false
- prc (var1, 10)
- print ""
- while not quitting do
- local line = io.read()
- if line == "quit" then
- plocha ()
- quitting = true
- else
- parse(line)
- print("")
- end
- end
- end
- mainloop ()
- end
- function rozhodnutiins ()
- if not fs.exists("/.core/language") then
- shell.run ("pastebin get sh70PdPx /.core/language")
- end
- data = fs.open("/.core/language","r")
- var1 = data.readLine()
- var2 = data.readLine()
- var3 = data.readLine()
- var4 = data.readLine()
- var5 = data.readLine()
- var6 = data.readLine()
- var7 = data.readLine()
- var8 = data.readLine()
- var9 = data.readLine()
- var10 = data.readLine()
- var11 = data.readLine()
- var12 = data.readLine()
- var13 = data.readLine()
- var14 = data.readLine()
- var15 = data.readLine()
- var16 = data.readLine()
- var17 = data.readLine()
- var18 = data.readLine()
- var19 = data.readLine()
- var20 = data.readLine()
- var21 = data.readLine()
- var22 = data.readLine()
- var23 = data.readLine()
- var24 = data.readLine()
- var25 = data.readLine()
- var26 = data.readLine()
- var27 = data.readLine()
- var28 = data.readLine()
- var29 = data.readLine()
- var30 = data.readLine()
- var31 = data.readLine()
- var32 = data.readLine()
- var33 = data.readLine()
- var34 = data.readLine()
- var35 = data.readLine()
- var36 = data.readLine()
- var37 = data.readLine()
- var38 = data.readLine()
- var39 = data.readLine()
- var40 = data.readLine()
- var41 = data.readLine()
- var42 = data.readLine()
- var43 = data.readLine()
- var44 = data.readLine()
- var45 = data.readLine()
- var46 = data.readLine()
- var47 = data.readLine()
- var48 = data.readLine()
- var49 = data.readLine()
- var50 = data.readLine()
- var51 = data.readLine()
- var52 = data.readLine()
- var53 = data.readLine()
- var54 = data.readLine()
- var55 = data.readLine()
- var56 = data.readLine()
- var57 = data.readLine()
- var58 = data.readLine()
- var59 = data.readLine()
- var60 = data.readLine()
- var61 = data.readLine()
- var62 = data.readLine()
- var63 = data.readLine()
- var64 = data.readLine()
- var65 = data.readLine()
- var66 = data.readLine()
- var67 = data.readLine()
- var68 = data.readLine()
- var69 = data.readLine()
- var70 = data.readLine()
- var71 = data.readLine()
- var72 = data.readLine()
- var73 = data.readLine()
- var74 = data.readLine()
- var75 = data.readLine()
- var76 = data.readLine()
- var77 = data.readLine()
- var78 = data.readLine()
- var79 = data.readLine()
- var80 = data.readLine()
- var81 = data.readLine()
- var82 = data.readLine()
- var83 = data.readLine()
- var84 = data.readLine()
- var85 = data.readLine()
- var86 = data.readLine()
- var87 = data.readLine()
- var88 = data.readLine()
- var89 = data.readLine()
- var90 = data.readLine()
- var91 = data.readLine()
- var92 = data.readLine()
- var93 = data.readLine()
- var94 = data.readLine()
- var95 = data.readLine()
- var96 = data.readLine()
- var97 = data.readLine()
- var98 = data.readLine()
- var99 = data.readLine()
- data.close()
- if not fs.exists("/.core/cmh") then
- instalace ()
- else
- data = fs.open("/.core/cmh","r")
- computerpass = data.readLine()
- data.close()
- shell.run ("delete /.core/cmh")
- data = fs.open("/.core/cmh","w")
- data.writeLine(computerpass)
- data.close()
- end
- data = fs.open("/.core/cmh","r")
- computerpass = data.readLine()
- data.close()
- if not fs.exists("/startup") then
- instalace ()
- else
- systems ()
- end
- end
- function instalace ()
- term.setBackgroundColor(colors.purple)
- term.setTextColor(colors.white)
- term.clear()
- prc ("Pepdroll Six Pro Install", 2)
- term.setCursorPos(5,3)
- prc ("please select instalation language", 6)
- prc ("EN / CZ", 7)
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if x >= 21 and x <= 23 and y == 7 and button == 1 then
- term.setCursorPos(1,11)
- jazyk = en
- fs.delete ("/.core/language")
- shell.run ("pastebin get sh70PdPx /.core/language")
- break
- end
- if x >= 27 and x <= 29 and y == 7 and button == 1 then
- term.setCursorPos(1,11)
- jazyk = ("cz")
- fs.delete ("/.core/language")
- shell.run ("pastebin get g8w9iiQj /.core/language")
- break
- end
- end
- term.setCursorPos(14,10)
- term.setBackgroundColor(colors.lightBlue) ----------
- textutils.slowPrint (" Downloading ")
- term.setBackgroundColor(colors.purple)
- term.setTextColor(colors.white)
- term.clear()
- prc ("Pepdroll Six Install", 2)
- if jazyk == ("cz") then
- prc ("Vitejte v PepSys", 4)
- term.setCursorPos(1,6)
- print "+ Jednoduchy operacni system."
- print "+ System, ktery se prizpusobi."
- print "+ Vhodne pro vetsinu pocitacu."
- print "+ Ceska kvalita."
- print "+ Pro vice uzivatelu."
- print "+ Rychla prace."
- prc ("-------------------", 13)
- prc ("Chcete instalovat nyni?", 14)
- prc (" Ano Ne ", 16)
- else
- prc ("Welcome to PepSys", 4)
- term.setCursorPos(1,6)
- print "+ Easy operating system."
- print "+ A system which will adapted."
- print "+ Suitable for most computers."
- print "+ Czech quality."
- print "+ Many uses for you."
- print "+ Speed works."
- prc ("-------------------", 13)
- prc ("Do you want install ?", 14)
- prc (" Yes No ", 16)
- end
- term.setCursorPos(45,17)
- if #tArgs > 0 then
- sDrive = tostring( tArgs[1] )
- end
- if sDrive == nil then
- print( "ID "..os.getComputerID() )
- local label = os.getComputerLabel()
- if label then
- term.setCursorPos(6,18)
- term.setTextColor(colors.white)
- print( " Label \""..label.."\"" )
- end
- end
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if x >= 17 and x <= 18 and y == 16 and button == 1 then
- stavba ()
- break
- end
- if x >= 33 and x <= 34 and y == 16 and button == 1 then
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.clear ()
- term.setCursorPos(1,1)
- break
- end
- end
- end
- function stavba ()
- term.setBackgroundColor(colors.purple)
- term.setTextColor(colors.white)
- term.clear()
- prc ("Pepdroll Six Pro Install", 2)
- prc ("System will be instaled to you PC", 4)
- term.setCursorPos (5,7)
- if jazyk == ("cz") then
- print "nove pocitacove heslo"
- else
- print "new computer password"
- end
- term.setCursorPos (5,8)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- print " "
- term.setCursorPos (5,8)
- computerpass = read ("@")
- term.setBackgroundColor(colors.purple)
- term.setTextColor(colors.white)
- term.clear()
- prc ("Pepdroll Six Pro Install", 2)
- if jazyk == ("cz") then
- prc ("System se nainstaluje do vaseho pocitace", 4)
- else
- prc ("System will be instaled to you PC", 4)
- end
- term.setCursorPos(14,10)
- term.setBackgroundColor(colors.lightBlue)
- textutils.slowPrint (" "..proc.." % ")-- 6.25
- proc = (proc+6.25)
- term.setCursorPos(14,10)
- term.setBackgroundColor(colors.lightGray)
- textutils.slowPrint (" "..proc.." % ")-- 12.5
- proc = (proc+6.25)
- term.setBackgroundColor(colors.purple)
- term.setCursorPos(1,11)
- print " "
- print " "
- term.setCursorPos(1,11)
- shell.run ("delete startup")
- shell.run ("pastebin get 6zPyzHHN startup")
- if not fs.exists("/.core/cmh") then
- data = fs.open("/.core/cmh","w")
- data.writeLine(computerpass)
- data.close()
- end
- term.setCursorPos(14,10)
- term.setBackgroundColor(colors.lightBlue)
- textutils.slowPrint (" "..proc.." % ")-- 18,75
- proc = (proc+6.25)
- term.setBackgroundColor(colors.purple)
- term.setCursorPos(1,11)
- print " "
- print " "
- print " "
- print " "
- term.setCursorPos(1,11)
- shell.run ("pastebin get 1QjZQzuN /np")
- term.setCursorPos(14,10)
- term.setBackgroundColor(colors.lightGray)
- textutils.slowPrint (" "..proc.." % ")-- 25
- proc = (proc+6.25)
- term.setBackgroundColor(colors.purple)
- term.setCursorPos(1,11)
- print " "
- print " "
- term.setCursorPos(1,11)
- shell.run ("pastebin get tbnzb7rH /ink")
- term.setCursorPos(14,10)
- term.setBackgroundColor(colors.lightBlue)
- textutils.slowPrint (" "..proc.." % ")-- 31,25
- proc = (proc+6.25)
- term.setBackgroundColor(colors.purple)
- term.setCursorPos(1,11)
- print " "
- print " "
- term.setCursorPos(1,11)
- shell.run ("pastebin get zGtP59jJ /.core/paint")
- term.setCursorPos(14,10)
- term.setBackgroundColor(colors.lightGray)
- textutils.slowPrint (" "..proc.." % ")-- 37,5
- proc = (proc+6.25)
- term.setBackgroundColor(colors.purple)
- term.setCursorPos(1,11)
- print " "
- print " "
- local proc = (proc+12)
- term.setCursorPos(14,10)
- term.setBackgroundColor(colors.lightBlue)
- textutils.slowPrint (" "..proc.." % ")-- 55,75
- proc = (proc+6.25)
- term.setBackgroundColor(colors.purple)
- term.setCursorPos(1,11)
- print " "
- print " "
- proc = (proc+13)
- term.setCursorPos(14,10)
- term.setBackgroundColor(colors.lightGray)
- textutils.slowPrint (" "..proc.." % ")-- 75
- proc = (proc+6.25)
- term.setBackgroundColor(colors.purple)
- term.setCursorPos(1,11)
- print " "
- print " "
- term.setCursorPos(1,11)
- print " "
- print " "
- if jazyk == ("cz") then
- prc ("priprava plochy a nastaveni", 12)
- else
- prc ("preparation desktop and setting",12)
- end
- term.setCursorPos(14,10)
- term.setBackgroundColor(colors.lightBlue)
- textutils.slowPrint (" "..proc.." % ")-- 81,25
- proc = (proc+18.75)
- term.setBackgroundColor(colors.purple)
- sleep (0.5)
- term.setCursorPos(14,10)
- term.setBackgroundColor(colors.lightGray)
- textutils.slowPrint (" "..proc.." % ")-- 100
- term.setBackgroundColor(colors.purple)
- if jazyk == ("cz") then
- prc ("Instalace hotova.", 16)
- prc ("Pocitac bude restartovan", 17)
- else
- prc ("Instalation complete.", 16)
- prc ("Computer will be restarted.", 17)
- end
- disk.eject("top")
- disk.eject("left")
- disk.eject("right")
- disk.eject("back")
- disk.eject("bottom")
- disk.eject("forward")
- sleep (3)
- os.reboot()
- end
- function chyba ()
- term.setBackgroundColor(colors.blue)
- term.setTextColor(colors.yellow)
- term.clear()
- prc (var2)
- term.setCursorPos(5,4)
- term.setTextColor(colors.red)
- term.setBackgroundColor(colors.white)
- prc (var8.." ".. chybas, 6)
- term.setBackgroundColor(colors.blue)
- term.setTextColor(colors.yellow)
- if vsechno == 1 then
- opravaks ()
- elseif vsechno == 0 then
- prc (var4, 10)
- prc (var9, 12)
- term.setCursorPos(45,17)
- if #tArgs > 0 then
- sDrive = tostring( tArgs[1] )
- end
- if sDrive == nil then
- print( "ID "..os.getComputerID() )
- local label = os.getComputerLabel()
- if label then
- term.setCursorPos(6,18)
- print( " Label \""..label.."\"" )
- end
- else
- local bData = disk.hasData( sDrive )
- if not bData then
- print( "No disk in drive "..sDrive )
- return
- end
- term.setCursorPos(32,18)
- print( "ID disk #"..disk.getID( sDrive ) )
- local label = disk.getLabel( sDrive )
- if label then
- print( "The disk is labelled \""..label.."\"" )
- end
- end
- end
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if x >= 17 and x <= 18 and y == 12 and button == 1 then
- oprava = 1
- break
- end
- if x >= 32 and x <= 33 and y == 12 and button == 1 then
- oprava = 0
- break
- end
- if x >= 25 and x <= 27 and y == 12 and button == 1 then
- vsechno = 1
- chyba ()
- break
- end
- end
- if oprava == 1 then
- opravaks ()
- elseif oprava == 0 then
- boot ()
- end
- end
- function systems ()
- if not fs.exists("/startup") then
- instalace ()
- elseif not fs.exists("/.core/logon.cfg") then
- local o=fs.open("//.core/logon.cfg","w")
- o.write(textutils.serialize(nula))
- o.close()
- systems ()
- elseif not fs.exists("/ink") then
- chybas = "ink"
- chyba ()
- elseif not fs.exists("/np") then
- chybas = "np"
- chyba ()
- elseif not fs.exists("/.core/paint") then
- chybas = "paint"
- chyba ()
- else
- boot ()
- end
- end
- function kontrolovani ()
- prc "kontrola"
- systems ()
- end
- function opravaks ()
- term.setBackgroundColor(colors.blue)
- term.setTextColor(colors.yellow)
- term.clear()
- term.setCursorPos(5,4)
- print (var10)
- term.setCursorPos(13,4)
- print (chybas)
- term.setCursorPos(5,6)
- if chybas == ("startup") then
- shell.run ("delete startup")
- instalace ()
- elseif chybas == ("np") then
- shell.run ("pastebin get 1QjZQzuN /np")
- elseif chybas == ("ink") then
- shell.run ("pastebin get tbnzb7rH /ink")
- elseif chybas == ("bar.nfp") then
- shell.run ("pastebin get vm1p8DXs /bar.nfp")
- elseif chybas == ("paint") then
- shell.run ("pastebin get zGtP59jJ /.core/paint")
- elseif chybas == ("nastaveni.cfg") then
- shell.run ("pastebin get sc1LAE0x /.core/nastaveni.cfg")
- shell.run ("delete startup")
- shell.run ("pastebin get 6zPyzHHN startup")
- end
- sleep (2)
- if opravak == 0 then
- kontrolovani ()
- elseif opravak == 1 then
- kontrolovani ()
- term.setBackgroundColor(colors.blue)
- term.setTextColor(colors.yellow)
- term.clear()
- prc ("No problem", 10)
- sleep (1)
- plocha ()
- end
- end
- function web ()
- term.setBackgroundColor(colours.white)
- term.setTextColor(colours.black)
- term.clear()
- term.setCursorPos(1,1)
- term.setCursorBlink(false)
- version="dynet browser 1.0"
- siteName=""
- currentSite=""
- siteID=-1
- pageName=""
- currentX=1
- currentY=1
- menuMode=false
- ddns=true
- ddnsID=-1
- webType=0--0=no site, 1=normal site, 2=menu
- -------------------------
- --web related functions--
- -------------------------
- function whois(name)--returns ID if found, -1 if not on dns, and nil if no dns
- --prevent unnecessary communication
- if name~=currentSite then
- if ddns==true then rednet.send(ddnsID,"@whois "..name)
- else rednet.broadcast("@whois "..name) end
- _,webID=rednet.receive(1)
- siteID=tonumber(webID)--convert it to a number
- currentSite=name
- end
- return siteID
- end
- function getColour(value)
- --TODO prevent crashing on invalid number
- number=tonumber(value)
- if number==nil then--convert hexadecimal
- if value=="A" then
- number=10
- elseif value=="B" then
- number=11
- elseif value=="C" then
- number=12
- elseif value=="D" then
- number=13
- elseif value=="E" then
- number=14
- elseif value=="F" then
- number=15
- else
- return colours.black
- end
- end
- return bit.blshift(1,number)
- end
- function loadPage(webID,page)
- rednet.send(webID,page or "/home")
- pagetext=""
- for i=1,17 do
- from,text=rednet.receive(0.5)
- if text==nil then break end
- pagetext=pagetext..text.."\n"
- end
- --term.write(pagetext)--doesn't support newline apparently
- --print(pagetext)
- line=1
- term.setCursorPos(2,line)
- colourmode=0--1=^ detected 2=nextchar text 3=nextchar backround
- term.setBackgroundColor(colours.white)
- term.setTextColor(colours.black)
- --my slow and tedious method of rendering the page
- for current=1,string.len(pagetext) do
- letter=string.sub(pagetext,current,current)--TODO surely an easier way?
- if letter==nil then letter=" " end
- if colourmode==0 then --normal
- if letter=="^" then
- colourmode=1
- elseif letter=="\n" then
- line=line+1--next line
- if line==17 then break end--too much! TODO tweak this value
- term.setCursorPos(2,line)
- term.setBackgroundColor(colours.white)
- term.setTextColor(colours.black)--reset colours for next line
- else
- term.write(letter)--nothing special
- end
- elseif colourmode==1 then --might be a colour
- if letter=="f" then--foreground colour
- colourmode=2--next char will set foreground
- elseif letter=="b" then--background colour
- colourmode=3--next char will set background
- else--not correct, probably not intended as a colour
- term.write("^"..letter)--put ^ back as well
- end
- elseif colourmode==2 then--set text colour
- --print(letter)--debug
- term.setTextColor(getColour(letter))
- colourmode=0--back to normal
- elseif colourmode==3 then--set background colour
- term.setBackgroundColor(getColour(letter))
- colourmode=0--back to normal
- end
- end
- end
- -----------------
- --GUI functions--
- -----------------
- function drawError(text)
- term.setBackgroundColor(colours.white)
- term.setTextColor(colours.red)
- term.setCursorPos(2,1)
- term.write("ERROR:")
- term.setCursorPos(2,2)
- term.write(text)
- webType=0
- end
- function drawButton(x,y,text,conditionA,conditionB,active)
- term.setCursorPos(x,y)
- if conditionA==conditionB and active then
- term.setBackgroundColor(colours.grey)
- term.write("[")
- else
- term.setBackgroundColor(colours.lightGrey)
- term.write(" ")
- end
- term.write(text)
- if conditionA==conditionB and active then
- term.write("]")
- else
- --term.write(" ")
- end
- end
- function renderGUI()
- --draw left bar
- term.setTextColor(colours.white)
- term.setBackgroundColor(colours.lightGrey)
- for line=1,18 do
- term.setCursorPos(1,line)
- term.write(" ")
- end
- --draw right cursor
- if menuMode==false then
- term.setCursorPos(1,currentY)
- term.setBackgroundColor(colours.grey)
- term.write(">")
- end
- --draw bottom bar
- term.setBackgroundColor(colours.lightGrey)
- term.setCursorPos(1,19)
- for line=1,51 do
- term.write(" ")
- end
- --term.setCursorPos(1,19)
- --term.write(siteName..pageName)
- --draw menu bar items
- drawButton(42,19,"refresh",currentX,3,menuMode)
- drawButton(36,19,"quit",currentX,2,menuMode)
- drawButton(1,19,siteName..pageName,currentX,1,menuMode)
- end
- function popup(text)--a nice GUI popup asking for text
- local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
- local cnt=f.readAll()
- f.close()
- local nastaveni = textutils.unserialize(cnt)
- term.setBackgroundColor(nastaveni.barva)
- term.setTextColor(colours.white)
- term.setCursorPos(7,5)
- term.setBackgroundColor(nastaveni.barva)
- for y=5,13 do
- term.setCursorPos(7,y)
- for x=7,47 do
- if y==8 then--user input row
- if x==7 or x== 47 then
- term.setBackgroundColor(colours.lightGrey)
- else
- term.setBackgroundColor(colours.grey)
- end
- end
- term.write(" ")
- end
- term.setBackgroundColor(colours.lightGrey)
- end
- --finished drawing window. add text
- term.setBackgroundColor(nastaveni.barva)
- term.setCursorPos(7,5)--TODO: center text
- term.write(text)
- term.setBackgroundColor(colours.grey)
- term.setCursorPos(8,8)
- return io.read()
- end
- function refresh()
- webType=1--website
- term.setTextColor(colours.black)
- term.setBackgroundColor(colours.white)
- term.clear()
- term.setCursorPos(1,1)
- renderGUI()
- webID=whois(siteName)
- if webID==nil or webID==-1 then--find what went wrong
- if webID==nil and ddns==false then drawError("server not found (spelt wrong?)")
- elseif webID==nil and ddns==true then drawError("no response from ddns")
- elseif webID==-1 and ddns==true then drawError("site not found on ddns (spelt wrong?)")
- else drawError("I honestly have no idea what happened") end
- else loadPage(webID,pageName) end
- renderGUI()
- end
- -------------------
- --other functions--
- -------------------
- function getDeviceSide(deviceType)
- -- List of all sides
- local lstSides = {"left","right","top","bottom","front","back"};
- -- Now loop through all the sides
- for i, side in pairs(lstSides) do
- if (peripheral.isPresent(side)) then
- -- Yup, there is something on this side
- if (peripheral.getType(side) == string.lower(deviceType)) then
- -- Yes, this is the device type we need, so return the side
- return side;
- end
- end
- end
- --nothing found, return nill
- return nil;
- end
- function split(text,splitAt)
- state=false
- outA=""
- outB=""
- for i=1,string.len(text) do
- if string.sub(text,i,i)==splitAt then
- state=true
- end
- if state==false then
- outA=outA..string.sub(text,i,i)
- else
- outB=outB..string.sub(text,i,i)
- end
- end
- return outA,outB
- end
- --like split, but removes extra char
- function split2(text,splitAt)
- outA,outB=split(text,splitAt)
- outB=string.sub(outB,2,-1)--remove first char (= to splitAt)
- return outA,outB
- end
- function interpret(text)
- command,args=split2(text,":")
- if command=="glob" then
- siteName,pageName=split2(args,"/")
- pageName="/"..pageName
- refresh()
- end
- if command=="loc" then
- pageName="/"..args
- refresh()
- end
- if command=="ref" then
- refresh()
- end
- if command=="ask" then
- arg1,arg2=split2(args,":")--expected format: ask:cookie:question
- rednet.send(siteID,"ans:"..arg1..":"..popup(arg2))
- print("please wait...")--TODO place this nicely in the text entry field
- --note: server should send refresh as soon as it is done
- end
- --TODO add input command
- end
- function enterPage()
- siteName,pageName=split(popup(var11),"/")
- if pageName==nil or pageName=="" then
- pageName="/home"
- end
- refresh()
- end
- function renderMenu()
- term.setTextColor(colours.black)
- term.setBackgroundColor(colours.white)
- term.clear()
- term.setCursorPos(1,1)
- plocha ()
- --add one space before every line due to side bar
- print(" "..version)
- print(" by Laurens Weyn")
- print("")
- if ddnsID~=nil then print(" ID of dedicated DNS: "..ddnsID) end
- if siteID~=nil then print(" ID of current website: "..siteID) end
- print(" using modem on side: "..portSide)
- renderGUI()
- end
- function handleSelect()
- if menuMode==true then
- --edit web adress
- if currentX==1 then
- enterPage()
- end
- if currentX==2 then
- renderMenu()
- end
- --refresh
- if currentX==3 then
- refresh()
- end
- else--clicked on site
- if webType==1 then
- rednet.send(siteID,"exec:"..pageName..":"..currentY)
- end
- --TODO add interactive menu
- end
- end
- -----------------------
- --program begins here--
- -----------------------
- portSide=getDeviceSide("modem")
- if portSide==nil then
- print(var12)
- end
- rednet.broadcast("@ddns")--search for dedicated dns
- ddnsID,result=rednet.receive(1)
- if result==nil then
- ddns=false
- print(var13)
- end
- renderGUI()
- enterPage()
- renderGUI()
- while true do
- event, p1, p2, p3 = os.pullEventRaw()
- if event=="key" or event=="char" then
- --up
- if p1==200 then
- if currentY~=1 then currentY=currentY-1 end
- menuMode=false
- end
- --down
- if p1==208 then
- if currentY~=18 then currentY=currentY+1 end
- menuMode=false
- end
- --left
- if p1==203 then
- if currentX~=1 then currentX=currentX-1 end
- menuMode=true
- end
- --right
- if p1==205 then
- if currentX~=3 then currentX=currentX+1 end
- menuMode=true
- end
- --enter or space (select)
- if p1==28 or p1==" " then --removed 57
- handleSelect()
- end
- renderGUI()
- elseif event=="mouse_click" then
- if p3==19 then
- menuMode=true
- currentX=1--default if below is false
- if p2>36 then currentX=2 end
- if p2>42 then currentX=3 end
- else
- menuMode=false
- currentY=p3
- end
- handleSelect()
- renderGUI()
- --only receive messages from current website
- elseif event=="rednet_message" and p1==siteID then
- interpret(p2)
- elseif event=="terminate" then
- plocha ()
- break
- end
- --TODO make an options menu
- --TODO add error handling
- end
- end
- function boot ()
- data = fs.open("/.core/cmh","r")
- computerpass = data.readLine()
- data.close()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- shell.run ("list")
- local function openRednet()
- for _,side in ipairs({"top", "bottom", "front", "left", "right", "back"}) do
- if peripheral.isPresent(side) and peripheral.getType(side) == "modem" then
- rednet.open(side)
- local modem = peripheral.wrap(side)
- modem.open(5)
- return side
- end
- end
- term.setTextColor(colors.red)
- print(var14)
- end
- modemSide = openRednet()
- if modemSide == nil then
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.red)
- print(var15)
- sleep (1)
- else
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.lime)
- print( var16.." "..modemSide)
- sleep (1)
- end
- local function openRednet()
- for _,side in ipairs({"bottom", "front", "left", "right", "back"}) do
- if peripheral.isPresent(side) and peripheral.getType(side) == "modem" then
- rednet.open(side)
- local modem = peripheral.wrap(side)
- modem.open(5)
- return side
- end
- end
- term.setTextColor(colors.red)
- print(var17)
- end
- modemSide = openRednet()
- if modemSide == nil then
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.red)
- print(var18)
- sleep (1)
- else
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.lime)
- print(var19.." "..modemSide)
- sleep (1)
- end
- sleep (1)
- spousteni1 ()
- end
- function spousteni1 ()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.blue)
- term.setCursorPos(20,18)
- print" Pepek"
- term.setCursorPos(28,18)
- print"Soft "
- term.setCursorPos(27,18)
- term.setTextColor(colors.lime)
- print"@"
- term.setCursorPos(5, 14)
- print ("Build "..verze)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.setCursorPos(16,7)
- prc "Pepdroll 6.2 Profesional"
- term.setCursorPos(14,9)
- term.setBackgroundColor(colors.lightBlue)
- textutils.slowPrint " "
- term.setCursorPos(14,9)
- term.setBackgroundColor(colors.lightGray)
- textutils.slowPrint " "
- term.setCursorPos(14,9)
- term.setBackgroundColor(colors.lightBlue)
- textutils.slowPrint " "
- preskoklog ()
- end
- function deaktiv ()
- shell.run ("delete aktiv")
- os.reboot ()
- heslo ()
- end
- function createAccount()
- local next = false
- if login == 0 then
- user = 0
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(5,7)
- print(var22)
- term.setCursorPos(5,9)
- print(var20.." ")
- term.setCursorPos(5,11)
- print(var21.." ")
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(18,9)
- print " "
- term.setCursorPos(18,11)
- print " "
- term.setCursorPos(18,13)
- print (var23)
- elseif login == 1 then
- end
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if x >= 18 and x <= 26 and y == 9 and button == 1 then
- term.setBackgroundColor(colors.cyan)
- term.setCursorPos(18,9)
- print " "
- term.setCursorPos(18,9)
- user = read()
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(18,9)
- print " "
- term.setCursorPos(18,9)
- print (user)
- if user == 0 then
- term.setBackgroundColor(colors.white)
- fgc(colors.red)
- term.setCursorPos(5,13)
- print(var30)
- login = 0
- createAccount()
- elseif user == " " then
- term.setBackgroundColor(colors.white)
- fgc(colors.red)
- term.setCursorPos(5,13)
- print(var25)
- login = 0
- createAccount()
- else
- uzivatel = (user)
- login = 1
- createAccount()
- end
- elseif x >= 18 and x <= 26 and y == 11 and button == 1 then
- term.setBackgroundColor(colors.cyan)
- term.setCursorPos(18,11)
- print " "
- term.setCursorPos(18,11)
- pass = read("@")
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(18,11)
- print " "
- term.setCursorPos(18,11)
- print (var27)
- login = 1
- createAccount()
- end
- if x >= 18 and x <= 26 and y == 13 and button == 1 then
- if user == 0 then
- term.setBackgroundColor(colors.white)
- fgc(colors.red)
- term.setCursorPos(5,13)
- print(var30)
- sleep (1)
- login = 0
- createAccount()
- elseif user == " " then
- term.setBackgroundColor(colors.white)
- fgc(colors.red)
- term.setCursorPos(5,13)
- print(var25)
- sleep (1)
- login = 0
- createAccount()
- end
- login = 0
- if not fs.isDir("/.ucet/"..user) then
- fs.makeDir("/.ucet/"..user)
- local file = fs.open(".ucet/"..user.."/.data","w")
- file.writeLine(user)
- file.writeLine(pass)
- file.close()
- if not fs.exists("/.core/ucet") then
- fs.open("/.core/ucet","w")
- end
- term.setBackgroundColor(colors.white)
- fgc(colors.lime)
- term.setCursorPos(5,13)
- shell.run ("pastebin get YHGDzX5a ", ".ucet/"..user.."/bar.nfp")
- term.setCursorPos(5,13)
- shell.run ("pastebin get sc1LAE0x ", ".ucet/"..user.."/nastaveni.cfg")
- term.setCursorPos(5,13)
- shell.run ("pastebin get sh70PdPx /.ucet/"..user.."/language")
- term.setCursorPos(5,13)
- print(var24)
- sleep (1)
- heslo ()
- else
- term.setBackgroundColor(colors.white)
- fgc(colors.red)
- term.setCursorPos(5,13)
- print(var25)
- end
- end
- end
- end
- function preskoklog ()
- local n=fs.open("//.core/logon.cfg","r")
- preskok = n.readLine ()
- if preskok == "1" then
- stavlog = "Yes"
- local na=fs.open("/.core/defuser","r")
- user = na.readLine ()
- userI = user
- na.close()
- data = fs.open("/.ucet/"..userI.."/.data","r")
- user = data.readLine ()
- passI = data.readLine ()
- data.close()
- vitejte ()
- else
- stavlog = "NO"
- heslo ()
- end
- end
- function heslo ()
- if not fs.exists("/.core/ucet") then
- createAccount()
- local ucet = fs.open("/.core/ucet","w")
- ucet.close()
- end
- local success = false
- while not success do
- if login == 0 then
- pass=""
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.clear()
- term.setBackgroundColor(colors.yellow)
- term.setCursorPos(1,2)
- shell.run ("list /.ucet")
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.setCursorPos(5,7)
- print(var26)
- term.setCursorPos(5,9)
- print(var20.." ")
- term.setCursorPos(5,11)
- print(var21.."")
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(18,9)
- print " "
- term.setCursorPos(18,11)
- print " "
- term.setCursorPos(18,13)
- print(var26)
- term.setCursorPos(18,9)
- print (userI)
- if passI == "" then
- term.setCursorPos(18,11)
- print ""
- else
- term.setCursorPos(18,11)
- print (var27)
- end
- elseif login == 1 then
- term.setTextColor(colors.black)
- end
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if x >= 18 and x <= 26 and y == 9 and button == 1 then
- term.setBackgroundColor(colors.cyan)
- term.setCursorPos(18,9)
- print " "
- term.setCursorPos(18,9)
- userI = read()
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(18,9)
- print " "
- term.setCursorPos(18,9)
- print (userI)
- if userI == "" then
- uzivatel = "None"
- elseif userI == " " then
- uzivatel = "None"
- else
- uzivatel = userI
- login = 1
- heslo ()
- end
- elseif x >= 18 and x <= 26 and y == 11 and button == 1 then
- term.setBackgroundColor(colors.cyan)
- term.setCursorPos(18,11)
- print " "
- term.setCursorPos(18,11)
- passI = read("@")
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(18,11)
- print " "
- term.setCursorPos(18,11)
- print (var27)
- login = 1
- heslo ()
- end
- if x >= 18 and x <= 26 and y == 13 and button == 1 then
- login = 0
- if userI == "" then
- login = 1
- heslo ()
- elseif userI == " " then
- login = 1
- heslo ()
- end
- if fs.isDir("/.ucet/"..userI) then
- if fs.exists("/.ucet/"..userI.."/.data") then
- data = fs.open("/.ucet/"..userI.."/.data","r")
- userO = data.readLine()
- passO = data.readLine()
- end
- if userI == userO and passI == passO then
- term.setBackgroundColor(colors.white)
- term.setCursorPos(5,13)
- fgc(colors.lime)
- print(var28)
- user = userI
- userDir = "/.ucet/"..userI
- success = true
- sleep (1)
- uss = userI
- vitejte ()
- else
- term.setBackgroundColor(colors.white)
- fgc(colors.red)
- term.setCursorPos(5,13)
- print(var29)
- passI = ""
- sleep (1)
- login = 0
- heslo ()
- end
- end
- end
- end
- end
- end
- function clear()
- term.clear()
- term.setBackgroundColor(colors.white)
- for i=1,w do
- for j=1,h do
- term.setCursorPos(i,j)
- write(" ")
- end
- end
- end
- function vitejte ()
- if not fs.exists ("/.ucet/"..userI.."/language") then
- shell.run ("pastebin get sh70PdPx /.ucet/"..userI.."/language")
- vitejte ()
- else
- data = fs.open("/.ucet/"..userI.."/language","r")
- var1 = data.readLine()
- var2 = data.readLine()
- var3 = data.readLine()
- var4 = data.readLine()
- var5 = data.readLine()
- var6 = data.readLine()
- var7 = data.readLine()
- var8 = data.readLine()
- var9 = data.readLine()
- var10 = data.readLine()
- var11 = data.readLine()
- var12 = data.readLine()
- var13 = data.readLine()
- var14 = data.readLine()
- var15 = data.readLine()
- var16 = data.readLine()
- var17 = data.readLine()
- var18 = data.readLine()
- var19 = data.readLine()
- var20 = data.readLine()
- var21 = data.readLine()
- var22 = data.readLine()
- var23 = data.readLine()
- var24 = data.readLine()
- var25 = data.readLine()
- var26 = data.readLine()
- var27 = data.readLine()
- var28 = data.readLine()
- var29 = data.readLine()
- var30 = data.readLine()
- var31 = data.readLine()
- var32 = data.readLine()
- var33 = data.readLine()
- var34 = data.readLine()
- var35 = data.readLine()
- var36 = data.readLine()
- var37 = data.readLine()
- var38 = data.readLine()
- var39 = data.readLine()
- var40 = data.readLine()
- var41 = data.readLine()
- var42 = data.readLine()
- var43 = data.readLine()
- var44 = data.readLine()
- var45 = data.readLine()
- var46 = data.readLine()
- var47 = data.readLine()
- var48 = data.readLine()
- var49 = data.readLine()
- var50 = data.readLine()
- var51 = data.readLine()
- var52 = data.readLine()
- var53 = data.readLine()
- var54 = data.readLine()
- var55 = data.readLine()
- var56 = data.readLine()
- var57 = data.readLine()
- var58 = data.readLine()
- var59 = data.readLine()
- var60 = data.readLine()
- var61 = data.readLine()
- var62 = data.readLine()
- var63 = data.readLine()
- var64 = data.readLine()
- var65 = data.readLine()
- var66 = data.readLine()
- var67 = data.readLine()
- var68 = data.readLine()
- var69 = data.readLine()
- var70 = data.readLine()
- var71 = data.readLine()
- var72 = data.readLine()
- var73 = data.readLine()
- var74 = data.readLine()
- var75 = data.readLine()
- var76 = data.readLine()
- var77 = data.readLine()
- var78 = data.readLine()
- var79 = data.readLine()
- var80 = data.readLine()
- var81 = data.readLine()
- var82 = data.readLine()
- var83 = data.readLine()
- var84 = data.readLine()
- var85 = data.readLine()
- var86 = data.readLine()
- var87 = data.readLine()
- var88 = data.readLine()
- var89 = data.readLine()
- var90 = data.readLine()
- var91 = data.readLine()
- var92 = data.readLine()
- var93 = data.readLine()
- var94 = data.readLine()
- var95 = data.readLine()
- var96 = data.readLine()
- var97 = data.readLine()
- var98 = data.readLine()
- var99 = data.readLine()
- data.close()
- end
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(1, 7)
- prc (var31)
- term.setCursorPos(1, 9)
- prc (userI)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.blue)
- term.setCursorPos(20,18)
- print" Pepek"
- term.setCursorPos(28,18)
- print"Soft "
- term.setCursorPos(27,18)
- term.setTextColor(colors.lime)
- print"@"
- sleep (1)
- term.setBackgroundColor(colors.lightGray)
- term.clear()
- sleep (0.1)
- term.setBackgroundColor(colors.gray)
- term.clear()
- sleep (0.1)
- plocha ()
- end
- local function redrawTime()
- l(47,19,51,19,256)
- tg(32768)
- tim = os.time()
- tpr(textutils.formatTime(tim,true),1,18)
- end
- function plocha ()
- local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
- local cnt=f.readAll()
- f.close()
- local nastaveni=textutils.unserialize(cnt)
- local ACL = fs.list("/.ucet")
- if anim == 1 then
- term.setBackgroundColor(colors.gray)
- term.clear()
- sleep (0.1)
- term.setBackgroundColor(colors.lightGray)
- term.clear()
- sleep (0.1)
- anim = 0
- end
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.white)
- term.clear()
- if not fs.exists("/.ucet/"..user.."/bar.nfp") then
- term.setBackgroundColor(colors.black)
- term.clear()
- prc (var32)
- term.setBackgroundColor(colors.white)
- else
- term.setCursorPos(1,1)
- term.setBackgroundColor(nastaveni.barva)
- local image = paintutils.loadImage("/.ucet/"..user.."/bar.nfp")
- paintutils.drawImage(image, 3, 2)
- end
- term.setCursorPos(1,1)
- term.setBackgroundColor(nastaveni.barva)
- term.setTextColor(colors.black)
- term.setCursorPos(45,17)
- if #tArgs > 0 then
- sDrive = tostring( tArgs[1] )
- end
- if sDrive == nil then
- term.setTextColor(colors.white)
- print( "ID "..os.getComputerID() )
- local label = os.getComputerLabel()
- if label then
- term.setCursorPos(6,18)
- term.setTextColor(colors.white)
- print( " Label \""..label.."\"" )
- end
- else
- local bData = disk.hasData( sDrive )
- if not bData then
- print( "No disk in drive "..sDrive )
- return
- end
- print( "The disk is #"..disk.getID( sDrive ) )
- local label = disk.getLabel( sDrive )
- if label then
- print( "The disk is labelled \""..label.."\"" )
- end
- end
- term.setTextColor(colors.white)
- term.setCursorPos (42,14)
- print (var33)
- term.setCursorPos(1,1)
- print " "
- print" "
- print" "
- print" "
- print" "
- print" "
- print" "
- print" "
- print" "
- print" "
- print" "
- print" "
- print" "
- print" "
- print" "
- print" "
- print" "
- print" "
- paintutils.drawPixel(1, 19, nastaveni.barva)
- paintutils.drawPixel(2, 19, nastaveni.barva)
- term.setCursorPos(15,1)
- prc ("Pepdroll 6.2 Professional Build "..verze)
- term.setCursorPos(14,2)
- print" "
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.orange)
- term.setTextColor(colors.black)
- print "Menu"
- term.setBackgroundColor(colors.orange)
- term.setCursorPos(1,18)
- print " "
- local time = os.time()
- local formattedTime = textutils.formatTime(time, true)
- term.setCursorPos(1,18)
- print("" .. formattedTime)
- if fs.exists ("/.core/tut") then
- local myWindow = window.create(term.current(),14,5,26,10)
- myWindow.setBackgroundColor(colors.gray)
- myWindow.clear()
- data = fs.open("/.core/tut","r")
- upo1 = data.readLine()
- upo2 = data.readLine()
- upo3 = data.readLine()
- upo4 = data.readLine()
- upo5 = data.readLine()
- term.setTextColor(colors.black)
- term.setCursorPos(15,7)
- print (upo1)
- term.setCursorPos(15,8)
- print (upo2)
- term.setCursorPos(15,9)
- print (upo3)
- term.setCursorPos(15,10)
- print (upo4)
- term.setCursorPos(15,13)
- print (upo5)
- data.close()
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if x >= 16 and x <= 18 and y == 13 and button == 1 then
- fs.delete("/.core/tut")
- jazyky ()
- end
- if x >= 33 and x <= 34 and y == 13 and button == 1 then
- fs.delete("/.core/tut")
- plocha ()
- end
- end
- end
- while true do
- local event = { os.pullEvent() }
- if event[ 1 ] == "mouse_click" then
- term.setCursorPos(40,18)
- print "Mouse click"
- term.setBackgroundColor(colors.red)
- term.setCursorPos(1,1)
- print "Menu"
- term.setBackgroundColor(colors.orange)
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if x >= 1 and x <= 4 and y == 1 and button == 1 then
- menu ()
- elseif x >= 42 and x <= 51 and y == 14 and button == 1 then
- kalkulacka ()
- end
- elseif event[ 1 ] == "key" then
- term.setCursorPos(40,18)
- print " Key Event"
- local event, key = os.pullEvent("key")
- if key == keys.q then
- rezim = 1
- menu ()
- elseif key == keys.leftCtrl then
- menu ()
- end
- end
- end
- end
- function menu ()
- term.setBackgroundColor(colors.white)
- term.setCursorPos(5,1)
- print " "
- term.setCursorPos(1,2)
- print (var34)
- term.setCursorPos(1,3)
- print (var35)
- term.setCursorPos(1,4)
- print (var36)
- term.setCursorPos(1,5)
- print (var37)
- term.setCursorPos(1,6)
- print (var38)
- term.setCursorPos(1,7)
- print (var39)
- term.setCursorPos(1,8)
- print (var40)
- term.setBackgroundColor(colors.orange)
- term.setCursorPos(1,9)
- print " "
- paintutils.drawPixel(12, 2, colors.orange)
- paintutils.drawPixel(12, 3, colors.orange)
- paintutils.drawPixel(12, 1, colors.orange)
- paintutils.drawPixel(12, 4, colors.orange)
- paintutils.drawPixel(12, 5, colors.orange)
- paintutils.drawPixel(12, 6, colors.orange)
- paintutils.drawPixel(12, 7, colors.orange)
- paintutils.drawPixel(12, 8, colors.orange)
- paintutils.drawPixel(12, 9, colors.red)
- term.setCursorPos(12, 9)
- print "Q"
- term.setBackgroundColor(colors.orange)
- local time = os.time()
- local formattedTime = textutils.formatTime(time, true)
- term.setCursorPos(1,18)
- print("" .. formattedTime)
- if rezim == 1 then
- rezim = 0
- rezimy ()
- end
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if x >= 1 and x <= 11 and y == 2 and button == 1 then
- web ()
- elseif x >= 1 and x <= 8 and y == 8 and button == 1 then
- pastebin ()
- elseif x >= 1 and x <= 10 and y == 7 and button == 1 then
- anim = 1
- obrnastaveni ()
- elseif x >= 1 and x <= 11 and y == 6 and button == 1 then
- textovani ()
- elseif x >= 1 and x <= 11 and y == 5 and button == 1 then
- malovani ()
- elseif x >= 1 and x <= 10 and y == 4 and button == 1 then
- prehravac ()
- elseif x >= 1 and x <= 10 and y == 3 and button == 1 then
- prohlizec ()
- elseif xy == "12,9" and button == 1 then
- rezimy ()
- elseif xy == "12,9" and button == 2 then
- plocha ()
- elseif xy == "51,1" and button == 1 then
- vypnout ()
- elseif xy == "51,1" and button == 2 then
- restart ()
- elseif x >= 42 and x <= 51 and y == 14 and button == 1 then
- kalkulacka ()
- else
- plocha ()
- break
- end
- end
- end
- function rezimy ()
- term.setBackgroundColor(colors.orange)
- term.setTextColor(colors.black)
- term.setCursorPos(13, 8)
- print " "
- term.setCursorPos(13, 9)
- print " "
- term.setCursorPos(12, 10)
- print " "
- term.setCursorPos(12, 11)
- print " "
- term.setCursorPos(12, 12)
- print " "
- term.setCursorPos(12, 13)
- print " "
- term.setCursorPos(12, 14)
- print " "
- term.setCursorPos(12, 15)
- print " "
- term.setBackgroundColor(colors.white)
- term.setCursorPos(13, 9)
- print (var41)
- term.setCursorPos(13, 10)
- term.setBackgroundColor(colors.lightBlue)
- print (var42)
- term.setCursorPos(13, 11)
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.white)
- print (var43)
- term.setTextColor(colors.black)
- term.setCursorPos(13, 12)
- term.setBackgroundColor(colors.white)
- print " "
- term.setCursorPos(13, 13)
- term.setBackgroundColor(colors.yellow)
- print (var44)
- term.setCursorPos(13, 14)
- term.setBackgroundColor(colors.red)
- print (var45)
- paintutils.drawPixel(12, 9, colors.gray)
- term.setCursorPos(12, 9)
- print "Q"
- term.setBackgroundColor(colors.orange)
- local time = os.time()
- local formattedTime = textutils.formatTime(time, true)
- term.setCursorPos(1,18)
- print("" .. formattedTime)
- while true do
- local event = { os.pullEvent() }
- if event[ 1 ] == "mouse_click" then
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if xy == "12,9" and button == 1 then
- plocha ()
- elseif x >= 14 and x <= 20 and y == 10 and button == 1 then
- odhlasit ()
- elseif x >= 14 and x <= 20 and y == 11 and button == 1 then
- spanek ()
- elseif x >= 14 and x <= 20 and y == 13 and button == 1 then
- restart ()
- elseif x >= 14 and x <= 20 and y == 14 and button == 1 then
- vypnout ()
- elseif x >= 42 and x <= 51 and y == 14 and button == 1 then
- kalkulacka ()
- else
- plocha ()
- break
- end
- elseif event[ 1 ] == "key" then
- local event, key = os.pullEvent("key")
- if key == keys.q then
- plocha ()
- end
- end
- end
- end
- function spanek ()
- term.setBackgroundColor(colors.lightGray)
- term.clear()
- sleep (0.1)
- term.setBackgroundColor(colors.gray)
- term.clear()
- sleep (0.1)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.black)
- term.clear()
- while true do
- local event, button, xPos, yPos = os.pullEvent("mouse_click")
- preskoklog ()
- end
- end
- function vypnout ()
- term.setBackgroundColor(colors.lightGray)
- term.clear()
- sleep (0.1)
- term.setBackgroundColor(colors.gray)
- term.clear()
- sleep (0.1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(23, 7)
- prc (var46)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.blue)
- term.setCursorPos(20,18)
- print" Pepek"
- term.setCursorPos(28,18)
- print"Soft "
- term.setCursorPos(27,18)
- term.setTextColor(colors.lime)
- print"@"
- sleep (2)
- os.shutdown ()
- end
- function odhlasit ()
- term.setBackgroundColor(colors.lightGray)
- term.clear()
- sleep (0.1)
- term.setBackgroundColor(colors.gray)
- term.clear()
- sleep (0.1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(23, 7)
- prc (var47)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.blue)
- term.setCursorPos(20,18)
- print" Pepek"
- term.setCursorPos(28,18)
- print"Soft "
- term.setCursorPos(27,18)
- term.setTextColor(colors.lime)
- print"@"
- sleep (2)
- heslo ()
- end
- function restart ()
- term.setBackgroundColor(colors.lightGray)
- term.clear()
- sleep (0.1)
- term.setBackgroundColor(colors.gray)
- term.clear()
- sleep (0.1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(23, 7)
- prc (var46)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.blue)
- term.setCursorPos(20,18)
- print" Pepek"
- term.setCursorPos(28,18)
- print"Soft "
- term.setCursorPos(27,18)
- term.setTextColor(colors.lime)
- print"@"
- sleep (1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(23, 7)
- prc (var47)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.blue)
- term.setCursorPos(20,18)
- print" Pepek"
- term.setCursorPos(28,18)
- print"Soft "
- term.setCursorPos(27,18)
- term.setTextColor(colors.lime)
- print"@"
- sleep (1)
- os.reboot ()
- end
- function prohlizec ()
- local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
- local cnt=f.readAll()
- f.close()
- local nastaveni=textutils.unserialize(cnt)
- local version = "1.2"
- w,h = term.getSize()
- local dir = ""
- shell.setDir(dir)
- local tProgram = shell.getRunningProgram()
- local buttonAPI = "button"
- local selected = 0
- local menuS = false
- local input
- local path
- local ypos
- local tempvar
- filePos = {
- [1] = {3,3},
- [2] = {15,3},
- [3] = {27,3},
- [4] = {39,3},
- [5] = {3,7},
- [6] = {15,7},
- [7] = {27,7},
- [8] = {39,7},
- [9] = {3,11},
- [10] = {15,11},
- [11]= {27,11},
- [12]= {39,11},
- [13] = {3,15},
- [14]= {15,15},
- [15]= {27,15},
- [16]= {39,15}
- }
- local cPage = 1
- local nPage = 1
- local run = true
- --Checks
- if not term.isColor() then
- print("This program can only run on an advanced computer")
- return
- --[[elseif os.version() ~= "CraftOS 1.5" then
- print("This program is designed for CraftOS 1.5")
- print("Your version is "..os.version())
- print("Newer or older version may not work")
- print("Run anyways?")
- print("y/n")
- while true do
- event,par1,par2,par3 = os.pullEvent()
- if par1 == keys.y then run = true break end
- if par1 == keys.n then run = false break end
- end]]
- end
- if not run then os.pullEvent() return end
- --Functions--
- function clear(color)
- if color then
- term.setBackgroundColor(color)
- end
- term.clear()
- term.setCursorPos(1,1)
- end
- function sColor(color)
- term.setBackgroundColor(color)
- end
- function drawS(x,y,state)
- if state then sColor(colors.cyan) else sColor(colors.white) end
- term.setCursorPos(x-1,y-1)
- print(string.rep(" ",13))
- term.setCursorPos(x-1,y)
- term.write(" ")
- term.setCursorPos(x-1,y+1)
- term.write(" ")
- term.setCursorPos(x-1,y+2)
- term.write(" ")
- term.setCursorPos(x-1,y+3)
- print(string.rep(" ",13))
- term.setCursorPos(x+11,y)
- term.write(" ")
- term.setCursorPos(x+11,y+1)
- term.write(" ")
- term.setCursorPos(x+11,y+2)
- term.write(" ")
- term.setCursorPos(x+11,y+3)
- term.write(" ")
- end
- function printC(text,y)
- if not y then
- error("printC:No Y value specified")
- end
- term.setCursorPos(math.ceil(w/2-#tostring(text)/2),y)
- term.write(text)
- end
- function window(_w,_h,head,ypos)
- if not _w or not _h then
- error("Window:Missing width (w) or height (h)")
- end
- if not ypos or type(ypos) ~= "number" then ypos = 5 end
- sColor(colors.white)
- term.setCursorPos(1,h)
- term.write(string.rep(" ",w))
- sColor(nastaveni.barva)
- term.setCursorPos(w,1)
- term.write(" ")
- printC(string.rep(" ",_w),ypos)
- term.setTextColor(colors.white)
- if head then
- printC(head,ypos)
- end
- sColor(colors.gray)
- for i = 1, _h do
- printC(string.rep(" ",_w),i+ypos)
- end
- end
- function testSpot(x,y)
- if y > 1 then
- if #cDir < 17 then
- _rep = #cDir
- else
- _rep = 16
- end
- for _c = 1, _rep do
- if x >= filePos[_c][1] and x <= filePos[_c][1]+10 and y >= filePos[_c][2] and y <= filePos[_c][2]+2 then
- return _c
- end
- end
- end
- return false
- end
- function bar()
- sColor(nastaveni.barva)
- term.setCursorPos(1,1)
- term.write(string.rep(" ",w-1))
- sColor(colors.red)
- term.setTextColor(colors.white)
- term.write("Q")
- end
- function drawDir()
- clear(colors.white)
- bar ()
- sColor(nastaveni.barva)
- cDir = fs.list(shell.dir())
- if shell.dir() == "" then
- printC("C: - File Manager "..version,1)
- else
- printC("/"..shell.dir(),1)
- end
- for i = 1, #cDir do
- local num = i
- local a = i+16*(cPage-1)
- local name = tostring(cDir[a])
- if name == "nil" then break end
- if #name > 9 then
- text = string.sub(name,1,6).."..."
- else
- text = name
- end
- if fs.isDir(shell.dir().."/"..name) then
- sColor(colors.orange)
- else
- sColor(colors.lightGray)
- end
- if shell.dir() == "" then
- location = "C:/"..name
- else
- location = tostring("C:/"..shell.dir().."/"..name)
- end
- if i > 16 then break end
- x = filePos[i][1]
- y = filePos[i][2]
- term.setCursorPos(x,y)
- term.write(string.rep(" ",11))
- term.setCursorPos(x,y+1)
- term.write(string.rep(" ",math.floor(5.5-#tostring(text)/2)))
- term.write(text)
- term.write(string.rep(" ",math.ceil(5.5-#tostring(text)/2)))
- term.setCursorPos(x,y+2)
- term.write(string.rep(" ",11))
- end
- if #cDir > 16 then
- nPage = math.ceil(#cDir/16)
- term.setTextColor(colors.black)
- sColor(colors.white)
- printC("Page "..cPage.." of "..nPage,2)
- nSelect = cDir[selected+16*(cPage-1)]
- else
- nSelect = cDir[selected]
- end
- if selected > 0 then
- drawS(filePos[selected][1],filePos[selected][2],true)
- sType = fs.isDir(shell.resolve(nSelect))
- menuS = true
- else
- menuS = false
- end
- end
- function confirm(text)
- if not text or #text <= 8 then
- window(8,3,text)
- else
- window(#text+2,3,text)
- end
- term.setCursorPos(23,7)
- sColor(colors.lime)
- term.write("Yes")
- term.setCursorPos(27,7)
- sColor(colors.red)
- term.write("No")
- while true do
- event,par1,par2,par3 = os.pullEvent("mouse_click")
- if par3 == 7 then
- if par2 >= 23 and par2 <=25 then
- return true
- elseif par2 >= 27 and par2 <= 28 then
- return false
- end
- end
- end
- end
- function changeDir()
- window(26,4,"Change Directory")
- printC("Use '/' for root",8)
- sColor(colors.black)
- repeat
- printC(string.rep(" ",18),7)
- term.setCursorPos(17,7)
- input = read()
- until input ~= ""
- path = shell.resolve(input)
- if fs.exists(path) and fs.isDir(path) then
- shell.setDir(path)
- else
- sColor(colors.gray)
- term.setTextColor(colors.red)
- printC("Doesn't Exist!",9)
- sleep(1)
- end
- end
- function info(_path)
- if not _path then
- error("No path")
- end
- name = cDir[_path]
- clear(colors.white)
- term.setTextColor(colors.white)
- sColor(nastaveni.barva)
- term.write(string.rep(" ",w))
- printC(name,1)
- term.setCursorPos(w,1)
- sColor(colors.red)
- print("Q")
- term.setCursorPos(1,2)
- term.setTextColor(colors.black)
- sColor(colors.white)
- print(" ")
- term.write("File Path:")
- path = shell.resolve(name)
- print("/"..path)
- term.write("Type:")
- if fs.isDir(path) then
- print("Folder")
- else
- print("File")
- print("Size:"..fs.getSize(path))
- end
- if fs.isReadOnly(shell.resolve(nSelect)) then
- print("This is a read-only item")
- end
- if shell.resolve(nSelect) == tProgram then
- term.setTextColor(colors.orange)
- print("This program is currently running")
- end
- while true do
- event,par1,par2,par3 = os.pullEvent()
- if event == "mouse_click" then
- if par2 == w and par3 == 1 then
- break
- end
- end
- end
- end
- function addItem()
- window(8,7,"Add...")
- term.setTextColor(colors.white)
- sColor(colors.lime)
- printC("Folder",7)
- printC("File",9)
- sColor(colors.red)
- printC("Cancel",11)
- local choice = nil
- while true do
- event,par1,par2,par3 = os.pullEvent("mouse_click")
- if par3 == 7 and par2 >= 23 and par2 <= 28 then
- choice = 1
- break
- elseif par3 == 9 and par2 >= 24 and par2 <= 27 then
- choice = 2
- break
- elseif par3 == 11 and par2 >= 23 and par2 <=28 then
- choice = 3
- break
- end
- end
- if choice ~= 3 then
- window(26,3,"Enter name")
- sColor(colors.black)
- repeat
- printC(string.rep(" ",22),7)
- term.setCursorPos(15,7)
- input = read()
- until input ~= ""
- if fs.exists(shell.resolve(input)) then
- sColor(colors.gray)
- term.setTextColor(colors.red)
- printC("Already Exists!",8)
- sleep(2)
- elseif choice == 1 then
- fs.makeDir(shell.dir().."/"..input)
- elseif choice == 2 then
- f = fs.open(shell.dir().."/"..input,"w")
- f.close()
- end
- end
- end
- function move(item)
- path = shell.resolve(item)
- if #path <= 26 then
- window(26,5,"Move item")
- else
- window(#path+2,5,"Move item")
- end
- printC("Current path:",6)
- printC(path,7)
- printC("New path:",8)
- printC("Use 'cancel' to cancel",10)
- sColor(colors.black)
- repeat
- printC(string.rep(" ",22),9)
- term.setCursorPos(15,9)
- input = read()
- until input ~= ""
- sColor(colors.gray)
- printC(string.rep(" ",26),10)
- term.setTextColor(colors.red)
- if fs.exists(input) then
- printC("Already Exists!",10)
- sleep(2)
- elseif input == "cancel" then
- printC("Canceled",10)
- sleep(2)
- else
- fs.move(path,input)
- term.setTextColor(colors.lime)
- printC("Success",10)
- sleep(2)
- end
- end
- function cRename(item)
- path = shell.resolve(item)
- if #path <= 26 then
- window(26,5,"Rename item")
- else
- window(#path+2,5,"Rename item")
- end
- printC("Current name:",6)
- printC(item,7)
- printC("New name:",8)
- printC("Use 'cancel' to cancel",10)
- sColor(colors.black)
- repeat
- printC(string.rep(" ",22),9)
- term.setCursorPos(15,9)
- input = read()
- until input ~= ""
- sColor(colors.gray)
- printC(string.rep(" ",26),10)
- term.setTextColor(colors.red)
- if fs.exists(shell.resolve(input)) then
- printC("Already Exists!",10)
- sleep(2)
- elseif string.find(input,"/") then
- printC("Cannot contain '/'",10)
- sleep(2)
- elseif input == "cancel" then
- printC("Canceled",10)
- sleep(2)
- else
- fs.move(path,input)
- term.setTextColor(colors.lime)
- printC("Success",10)
- sleep(2)
- end
- end
- --Main loop program--
- function main()
- while true do
- drawDir()
- if menuS then
- term.setTextColor(colors.black)
- sColor(colors.white)
- printC(nSelect,h-1)
- if sType then --If the item is a folder
- if fs.isReadOnly(shell.resolve(nSelect)) then --If the folder is read-only
- printC("This is a read-only folder O:Open Tab:Info",h)
- else --Normal folder
- printC("O:Open D:Delete M:Move N:Rename Tab:Info",h)
- end
- else --If the item is a file
- if shell.resolve(nSelect) == tProgram then --If the file is this program
- printC("This program is currently running Tab:Info",h)
- elseif fs.isReadOnly(shell.resolve(nSelect)) then --If the file is read-only
- printC("This is a read-only file R:Run P:Preview Tab:Info",h)
- else --Normal file
- printC("R:Run E:Edit D:Delete M:Move N:Rename Tab:Info",h)
- end
- end
- term.setTextColor(colors.white)
- else
- term.setTextColor(colors.black)
- sColor(colors.white)
- if fs.isReadOnly(shell.dir()) then --If folder is read--only
- if #cDir > 16 then
- printC("B:Back Tab:Enter Path Page:PgUp/Down",h)
- else
- printC("B:Back Tab:Enter Path",h)
- cPage = 1
- end
- else --Normal Folder
- if #cDir > 16 then
- printC("C:Create... B:Back Tab:Enter path Page:PgUp/Down",h)
- else
- printC("C:Create... B:Back Tab:Enter path",h)
- cPage = 1
- end
- end
- term.setTextColor(colors.white)
- end
- event,par1,par2,par3,par4 = os.pullEvent() --Main pullEvent--
- if event == "mouse_click" then
- if par2 == w and par3 == 1 then
- break
- else
- click = testSpot(par2,par3)
- if click then
- selected = click
- else
- selected = 0
- end
- end
- elseif event == "key" then
- if selected > 0 then --If an item is selected
- if par1 == keys.tab then
- info(selected)
- end
- if shell.resolve(nSelect) ~= tProgram then
- if par1 == keys.d and not fs.isReadOnly(shell.resolve(nSelect)) then
- if confirm(" Delete? ") then
- fs.delete(shell.resolve(nSelect))
- selected = 0
- end
- elseif par1 == keys.m and not fs.isReadOnly(shell.resolve(nSelect)) then
- os.pullEvent()
- move(nSelect)
- selected = 0
- elseif par1 == keys.n and not fs.isReadOnly(shell.resolve(nSelect)) then
- os.pullEvent()
- cRename(nSelect)
- selected = 0
- end
- if sType then --If the item is a directory
- if par1 == keys.o then
- shell.setDir(shell.resolve(nSelect))
- selected = 0
- end
- else --If the item is a file
- if par1 == keys.r then
- clear(colors.black)
- print("Begin program:")
- state,err = pcall(function() shell.run(nSelect) end )
- if err then
- clear(colors.white)
- bar()
- printC("Program Error Report",1)
- term.setCursorPos(1,3)
- term.setTextColor(colors.black)
- print("An error occured while running "..nSelect)
- print(err)
- while true do
- event,par1,par2,par3 = os.pullEvent("mouse_click")
- if par2 == w and par3 == 1 then
- break
- end
- end
- else
- term.setTextColor(colors.white)
- print("End of program")
- print("Press any key...")
- term.setTextColor(colors.black)
- print("End of program")
- print("Press any key...")
- os.pullEvent("key")
- end
- selected = 0
- elseif par1 == keys.e or par1 == keys.p then
- os.pullEvent()
- shell.run("edit "..nSelect)
- selected = 0
- end
- end
- end
- else --If nothing is selected
- if par1 == keys.tab then
- changeDir()
- elseif par1 == keys.c and not fs.isReadOnly(shell.resolve(shell.dir())) then
- addItem()
- elseif par1 == keys.b then
- shell.run("cd ..")
- elseif par1 == 209 then
- if cPage > 1 then cPage = cPage-1 end
- elseif par1 == 201 then
- if cPage < nPage then cPage = cPage+1 end
- end
- end
- end
- end
- end
- --Program--
- state,err = pcall(function() main() end)
- if err then
- if not string.find("Terminated",err) then
- term.setTextColor(colors.white)
- sColor(colors.black)
- print("CRITICAL ERROR:")
- print(err)
- print("Press any key to continue")
- os.pullEvent("key")
- end
- end
- --after program ends
- plocha ()
- end
- function prehravac ()
- local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
- local cnt=f.readAll()
- f.close()
- local nastaveni=textutils.unserialize(cnt)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- term.setBackgroundColor(nastaveni.barva)
- term.setTextColor(colors.white)
- print " "
- term.setCursorPos(19,1)
- prc (var48)
- term.setTextColor(colors.black)
- term.setCursorPos(5,8)
- term.setBackgroundColor(colors.yellow)
- term.setTextColor(colors.black)
- print" Play "
- term.setCursorPos(41,8)
- print" Stop "
- paintutils.drawPixel(51, 1, colors.red)
- term.setTextColor(colors.white)
- term.setCursorPos(51, 1)
- print "Q"
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if xy == "51,1" and button == 1 then
- plocha ()
- break
- end
- if xy == "6,8" and button == 1 then
- disk.playAudio("left")
- disk.playAudio("right")
- disk.playAudio("bottom")
- prehravac ()
- break
- end
- if xy == "7,8" and button == 1 then
- disk.playAudio("left")
- disk.playAudio("right")
- disk.playAudio("bottom")
- prehravac ()
- break
- end
- if xy == "8,8" and button == 1 then
- disk.playAudio("left")
- disk.playAudio("right")
- disk.playAudio("bottom")
- prehravac ()
- break
- end
- if xy == "9,8" and button == 1 then
- disk.playAudio("left")
- disk.playAudio("right")
- disk.playAudio("bottom")
- prehravac ()
- break
- end
- if xy == "10,8" and button == 1 then
- disk.playAudio("left")
- disk.playAudio("right")
- disk.playAudio("bottom")
- prehravac ()
- break
- end
- if xy == "11,8" and button == 1 then
- disk.playAudio("left")
- disk.playAudio("right")
- disk.playAudio("bottom")
- prehravac ()
- break
- end
- if xy == "12,8" and button == 1 then
- disk.playAudio("left")
- disk.playAudio("right")
- disk.playAudio("bottom")
- prehravac ()
- break
- end
- if xy == "45,8" and button == 1 then
- print("Stop")
- disk.stopAudio("left")
- disk.stopAudio("right")
- disk.stopAudio("bottom")
- prehravac ()
- break
- end
- if xy == "42,8" and button == 1 then
- print("Stop")
- disk.stopAudio("left")
- disk.stopAudio("right")
- disk.stopAudio("bottom")
- prehravac ()
- break
- end
- if xy == "43,8" and button == 1 then
- print("Stop")
- disk.stopAudio("left")
- disk.stopAudio("right")
- disk.stopAudio("bottom")
- prehravac ()
- break
- end
- if xy == "44,8" and button == 1 then
- print("Stop")
- disk.stopAudio("left")
- disk.stopAudio("right")
- disk.stopAudio("bottom")
- prehravac ()
- break
- end
- end
- end
- function malovani ()
- if fs.exists ("/np")then
- shell.run ("np")
- else
- prc (var49, 10)
- sleep (1)
- plocha ()
- end
- end
- function textovani ()
- if fs.exists ("/ink")then
- shell.run ("ink")
- else
- prc (var49, 10)
- sleep (1)
- plocha ()
- end
- end
- function pastebin ()
- local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
- local cnt=f.readAll()
- f.close()
- local nastaveni=textutils.unserialize(cnt)
- term.setBackgroundColor(colors.white)
- term.clear ()
- term.setBackgroundColor(nastaveni.barva)
- term.setCursorPos(1,1)
- print " "
- term.setTextColor(colors.white)
- prc ("Pastebin Manager", 1)
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(5,4)
- print "- Run "
- term.setCursorPos(5,6)
- print "- Get "
- term.setCursorPos(5,8)
- print "- Put "
- term.setBackgroundColor(colors.red)
- term.setCursorPos(51, 1)
- print " "
- term.setTextColor(colors.white)
- term.setCursorPos(51, 1)
- print "Q"
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.white)
- while true do
- local event, button, x, y = os.pullEventRaw()
- if event == "mouse_click" then
- if x >= 5 and x <= 10 and y == 4 and button == 1 then
- spustit ()
- elseif x >= 5 and x <= 10 and y == 6 and button == 1 then
- ulozit ()
- elseif x >= 5 and x <= 10 and y == 8 and button == 1 then
- nahrat ()
- elseif x == 51 and y == 1 and button == 1 then
- plocha ()
- end
- end
- end
- end
- function spustit ()
- term.setCursorPos(4,12)
- print "enter the code"
- term.setCursorPos(4,13)
- term.setBackgroundColor(colors.lightBlue)
- print " "
- term.setCursorPos(4,13)
- kod1 = io.read ()
- if kod1 == "" then
- pastebin ()
- else
- shell.run ("pastebin run",kod1)
- plocha ()
- end
- while true do
- if x == 51 and y == 1 and button == 1 then
- plocha ()
- end
- end
- end
- function ulozit ()
- term.setCursorPos(4,12)
- print "enter the code"
- term.setCursorPos(4,13)
- term.setBackgroundColor(colors.lightBlue)
- print " "
- term.setCursorPos(4,13)
- kod1 = io.read ()
- if kod1 == "" then
- pastebin ()
- else
- term.setBackgroundColor(colors.white)
- term.setCursorPos(4,12)
- print "Name: |Path: /Downloaded/NAME"
- print " "
- end
- term.setCursorPos(4,13)
- term.setBackgroundColor(colors.lightBlue)
- print " "
- term.setCursorPos(4,13)
- kod2 = io.read ()
- if kod2 == "" then
- pastebin ()
- else
- shell.run ("pastebin get",kod1,"/Downloaded/"..kod2)
- prohlizec ()
- end
- while true do
- if x == 51 and y == 1 and button == 1 then
- plocha ()
- end
- end
- end
- function nahrat ()
- term.setCursorPos(4,12)
- print "enter the path"
- term.setCursorPos(4,13)
- term.setBackgroundColor(colors.lightBlue)
- print " "
- term.setCursorPos(4,13)
- kod1 = io.read ()
- if kod1 == "" then
- pastebin ()
- else
- shell.run ("pastebin put",kod1)
- end
- pokr = io.read ()
- if pokr == "" then
- plocha ()
- else
- plocha ()
- end
- while true do
- if x == 51 and y == 1 and button == 1 then
- plocha ()
- end
- end
- end
- function obrnastaveni ()
- local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
- local cnt=f.readAll()
- f.close()
- local nastaveni=textutils.unserialize(cnt)
- if anim == 1 then
- term.setBackgroundColor(colors.gray)
- term.clear()
- sleep (0.1)
- term.setBackgroundColor(colors.lightGray)
- term.clear()
- sleep (0.1)
- anim = 0
- end
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- term.setBackgroundColor(nastaveni.barva)
- term.setTextColor(colors.white)
- print " "
- paintutils.drawPixel(51, 1, colors.red)
- term.setTextColor(colors.white)
- term.setCursorPos(51, 1)
- print "Q"
- term.setBackgroundColor(nastaveni.barva)
- term.setCursorPos(1, 1)
- print " "
- print " "
- print " "
- print " "
- print (var51)
- print " "
- print (var52)
- print " "
- print (var53)
- print " "
- print (var54)
- print " "
- print (var55)
- print " "
- print (var81)
- print " "
- print " "
- print " "
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- prc (var56, 3)
- term.setCursorPos(21, 5)
- print ("- NPaint")
- term.setCursorPos(21, 7)
- print ("- File Manager v1.2")
- term.setCursorPos(21, 9)
- print ("- Ink by oeed")
- term.setCursorPos(21, 11)
- print ("- Pepdroll addons")
- term.setCursorPos(21, 13)
- print ("- Dynet client by Laurens Weyn")
- term.setCursorPos(21, 15)
- print "- Advanced calculator Immicalc"
- term.setBackgroundColor(nastaveni.barva)
- term.setTextColor(colors.white)
- term.setCursorPos(23,1)
- prc (var50)
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if xy == "51,1" and button == 1 then
- plocha ()
- break
- end
- if x >= 0 and x <= 19 and y == 5 and button == 1 then
- uzivatele ()
- break
- end
- if x >= 0 and x <= 19 and y == 7 and button == 1 then
- network ()
- break
- end
- if x >= 0 and x <= 19 and y == 9 and button == 1 then
- pozadi ()
- break
- end
- if x >= 0 and x <= 19 and y == 11 and button == 1 then
- pocitac ()
- break
- end
- if x >= 0 and x <= 19 and y == 13 and button == 1 then
- system ()
- break
- end
- if x >= 0 and x <= 19 and y == 15 and button == 1 then
- jazyky ()
- break
- end
- end
- end
- function jazyky ()
- local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
- local cnt=f.readAll()
- f.close()
- local nastaveni=textutils.unserialize(cnt)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- term.setBackgroundColor(nastaveni.barva)
- term.setTextColor(colors.white)
- print " "
- term.setCursorPos(23,1)
- prc (var82)
- paintutils.drawPixel(51, 1, colors.red)
- term.setTextColor(colors.white)
- term.setCursorPos(51, 1)
- print "Q"
- paintutils.drawPixel(1, 1, colors.yellow)
- paintutils.drawPixel(2, 1, colors.yellow)
- term.setTextColor(colors.white)
- term.setCursorPos(1, 1)
- print "<-"
- term.setBackgroundColor(colors.lightBlue)
- term.setTextColor(colors.black)
- term.setCursorPos(5, 4)
- print ("- "..var84)
- term.setCursorPos(5, 6)
- print ("- "..var85)
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if xy == "51,1" and button == 1 then
- plocha ()
- break
- end
- if x >= 1 and x <= 2 and y == 1 and button == 1 then
- obrnastaveni ()
- break
- end
- if x >= 5 and x <= 50 and y == 4 and button == 1 then
- jazykya ()
- break
- end
- if x >= 5 and x <= 50 and y == 6 and button == 1 then
- jazykypc ()
- break
- end
- end
- end
- function jazykya ()
- local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
- local cnt=f.readAll()
- f.close()
- local nastaveni=textutils.unserialize(cnt)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- term.setBackgroundColor(nastaveni.barva)
- term.setTextColor(colors.white)
- print " "
- term.setCursorPos(23,1)
- prc (var84)
- paintutils.drawPixel(51, 1, colors.red)
- term.setTextColor(colors.white)
- term.setCursorPos(51, 1)
- print "Q"
- paintutils.drawPixel(1, 1, colors.yellow)
- paintutils.drawPixel(2, 1, colors.yellow)
- term.setTextColor(colors.white)
- term.setCursorPos(1, 1)
- print "<-"
- term.setBackgroundColor(colors.lightBlue)
- term.setTextColor(colors.black)
- term.setCursorPos(5, 4)
- print "- English"
- term.setCursorPos(5, 6)
- print "- Deutsch"
- term.setCursorPos(5, 8)
- print "- Cestina"
- term.setCursorPos(5, 10)
- print "- Slovencina"
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if xy == "51,1" and button == 1 then
- plocha ()
- break
- end
- if x >= 1 and x <= 2 and y == 1 and button == 1 then
- jazyky ()
- break
- end
- if x >= 5 and x <= 12 and y == 4 and button == 1 then
- shell.run ("delete /.ucet/"..user.."/language")
- shell.run ("pastebin get sh70PdPx /.ucet/"..user.."/language")
- jazyky ()
- break
- end
- if x >= 5 and x <= 12 and y == 6 and button == 1 then
- shell.run ("delete /.ucet/"..user.."/language")
- shell.run ("pastebin get 2QDGWDfM /.ucet/"..user.."/language")
- jazyky ()
- break
- end
- if x >= 5 and x <= 12 and y == 8 and button == 1 then
- shell.run ("delete /.ucet/"..user.."/language")
- shell.run ("pastebin get g8w9iiQj /.ucet/"..user.."/language")
- jazyky ()
- break
- end
- if x >= 5 and x <= 16 and y == 10 and button == 1 then
- shell.run ("delete /.ucet/"..user.."/language")
- shell.run ("pastebin get MMsETUui /.ucet/"..user.."/language")
- jazyky ()
- break
- end
- end
- end
- function jazykypc ()
- local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
- local cnt=f.readAll()
- f.close()
- local nastaveni=textutils.unserialize(cnt)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- term.setBackgroundColor(nastaveni.barva)
- term.setTextColor(colors.white)
- print " "
- term.setCursorPos(23,1)
- prc (var85)
- paintutils.drawPixel(51, 1, colors.red)
- term.setTextColor(colors.white)
- term.setCursorPos(51, 1)
- print "Q"
- paintutils.drawPixel(1, 1, colors.yellow)
- paintutils.drawPixel(2, 1, colors.yellow)
- term.setTextColor(colors.white)
- term.setCursorPos(1, 1)
- print "<-"
- term.setBackgroundColor(colors.lightBlue)
- term.setTextColor(colors.black)
- term.setCursorPos(5, 4)
- print "- English"
- term.setCursorPos(5, 6)
- print "- Deutsch"
- term.setCursorPos(5, 8)
- print "- Cestina"
- term.setCursorPos(5, 10)
- print "- Slovencina"
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if xy == "51,1" and button == 1 then
- plocha ()
- break
- end
- if x >= 1 and x <= 2 and y == 1 and button == 1 then
- jazyky ()
- break
- end
- if x >= 5 and x <= 12 and y == 4 and button == 1 then
- shell.run ("delete /.core/language")
- shell.run ("pastebin get sh70PdPx /.core/language")
- jazyky ()
- break
- end
- if x >= 5 and x <= 12 and y == 6 and button == 1 then
- shell.run ("delete /.core/language")
- shell.run ("pastebin get 2QDGWDfM /.core/language")
- jazyky ()
- break
- end
- if x >= 5 and x <= 12 and y == 8 and button == 1 then
- shell.run ("delete /.core/language")
- shell.run ("pastebin get g8w9iiQj /.core/language")
- jazyky ()
- break
- end
- if x >= 5 and x <= 16 and y == 10 and button == 1 then
- shell.run ("delete /.core/language")
- shell.run ("pastebin get MMsETUui /.core/language")
- jazyky ()
- break
- end
- end
- end
- function network ()
- local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
- local cnt=f.readAll()
- f.close()
- local nastaveni=textutils.unserialize(cnt)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- term.setBackgroundColor(nastaveni.barva)
- term.setTextColor(colors.white)
- print " "
- term.setCursorPos(23,1)
- prc (var57)
- paintutils.drawPixel(51, 1, colors.red)
- term.setTextColor(colors.white)
- term.setCursorPos(51, 1)
- print "Q"
- paintutils.drawPixel(1, 1, colors.yellow)
- paintutils.drawPixel(2, 1, colors.yellow)
- term.setTextColor(colors.white)
- term.setCursorPos(1, 1)
- print "<-"
- term.setBackgroundColor(colors.lightBlue)
- term.setTextColor(colors.black)
- term.setCursorPos(5, 6)
- print "- Label"
- term.setCursorPos(5, 12)
- print "- Rednet"
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if xy == "51,1" and button == 1 then
- plocha ()
- break
- end
- if x >= 1 and x <= 2 and y == 1 and button == 1 then
- obrnastaveni()
- break
- end
- if x >= 5 and x <= 12 and y == 6 and button == 1 then
- propojeni ()
- break
- end
- if x >= 5 and x <= 11 and y == 12 and button == 1 then
- modem ()
- break
- end
- end
- end
- -----------------------------
- function modem ()
- local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
- local cnt=f.readAll()
- f.close()
- local nastaveni=textutils.unserialize(cnt)
- term.setBackgroundColor(colors.white)
- term.clear ()
- term.setBackgroundColor(nastaveni.barva)
- term.setCursorPos(1,1)
- print " "
- term.setTextColor(colors.white)
- prc (var57.." - Rednet", 1)
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(5,6)
- print "- Open "
- term.setCursorPos(5,12)
- print "- Close "
- term.setBackgroundColor(colors.red)
- term.setCursorPos(51, 1)
- print " "
- term.setTextColor(colors.white)
- term.setCursorPos(51, 1)
- print "Q"
- paintutils.drawPixel(1, 1, colors.yellow)
- paintutils.drawPixel(2, 1, colors.yellow)
- term.setTextColor(colors.white)
- term.setCursorPos(1, 1)
- print "<-"
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.white)
- while true do
- local event, button, x, y = os.pullEventRaw()
- if event == "mouse_click" then
- while true do
- local event, button, x, y = os.pullEventRaw()
- if event == "mouse_click" then
- if x >= 5 and x <= 10 and y == 6 and button == 1 then
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(15,6)
- print " "
- term.setCursorPos(16,6)
- jmeno = read ()
- term.setCursorPos(16,7)
- rednet.open (jmeno)
- term.setBackgroundColor(colors.lime)
- term.setCursorPos(15,6)
- print " Opened "
- sleep (1)
- network ()
- elseif x >= 5 and x <= 10 and y == 12 and button == 1 then
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(15,12)
- print " "
- term.setCursorPos(16,12)
- jmeno = read ()
- term.setCursorPos(16,13)
- rednet.close (jmeno)
- term.setBackgroundColor(colors.red)
- term.setCursorPos(15,12)
- print " Closed "
- sleep (1)
- network ()
- elseif x == 51 and y == 1 and button == 1 then
- plocha ()
- end
- if x >= 1 and x <= 2 and y == 1 and button == 1 then
- network()
- break
- end
- end
- end
- end
- end
- end
- -----------------------------
- function propojeni ()
- local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
- local cnt=f.readAll()
- f.close()
- local nastaveni=textutils.unserialize(cnt)
- term.setBackgroundColor(colors.white)
- term.clear ()
- term.setBackgroundColor(nastaveni.barva)
- term.setCursorPos(1,1)
- print " "
- term.setTextColor(colors.white)
- prc (var57.." - Label", 1)
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(5,6)
- print "- Set "
- term.setCursorPos(5,12)
- print "- Clear "
- term.setBackgroundColor(colors.red)
- term.setCursorPos(51, 1)
- print " "
- term.setTextColor(colors.white)
- term.setCursorPos(51, 1)
- print "Q"
- paintutils.drawPixel(1, 1, colors.yellow)
- paintutils.drawPixel(2, 1, colors.yellow)
- term.setTextColor(colors.white)
- term.setCursorPos(1, 1)
- print "<-"
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.white)
- while true do
- local event, button, x, y = os.pullEventRaw()
- if event == "mouse_click" then
- if x >= 5 and x <= 10 and y == 6 and button == 1 then
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(15,6)
- print " "
- term.setCursorPos(16,6)
- jmeno = read ()
- term.setCursorPos(16,7)
- os.setComputerLabel(jmeno)
- term.setBackgroundColor(colors.lime)
- term.setCursorPos(15,6)
- print " Labeled "
- sleep (1)
- network ()
- elseif x >= 5 and x <= 10 and y == 12 and button == 1 then
- term.setCursorPos(10,13)
- shell.run ("label clear")
- term.setBackgroundColor(colors.red)
- term.setCursorPos(10,12)
- print " Removed "
- sleep (1)
- network ()
- elseif x == 51 and y == 1 and button == 1 then
- plocha ()
- end
- if x >= 1 and x <= 2 and y == 1 and button == 1 then
- network()
- break
- end
- end
- end
- end
- -------------------------------------
- function pocitac ()
- local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
- local cnt=f.readAll()
- f.close()
- local nastaveni=textutils.unserialize(cnt)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- term.setBackgroundColor(nastaveni.barva)
- term.setTextColor(colors.white)
- print " "
- term.setCursorPos(23,1)
- prc (var58)
- paintutils.drawPixel(51, 1, colors.red)
- term.setTextColor(colors.white)
- term.setCursorPos(51, 1)
- print "Q"
- paintutils.drawPixel(1, 1, colors.yellow)
- paintutils.drawPixel(2, 1, colors.yellow)
- term.setTextColor(colors.white)
- term.setCursorPos(1, 1)
- print "<-"
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.setCursorPos(5, 3)
- print ("Pepdroll 6.2 Pro: "..verze)
- term.setCursorPos(5,5)
- print( "Label: "..var59)
- term.setCursorPos(5, 4)
- if #tArgs > 0 then
- sDrive = tostring( tArgs[1] )
- end
- if sDrive == nil then
- print( "ID: "..os.getComputerID() )
- local label = os.getComputerLabel()
- if label then
- term.setCursorPos(5,5)
- print( "Label: \""..label.."\"" )
- end
- else
- local bData = disk.hasData( sDrive )
- if not bData then
- print( "No disk in drive "..sDrive )
- return
- end
- term.setCursorPos(32,18)
- print( "ID disk #"..disk.getID( sDrive ) )
- local label = disk.getLabel( sDrive )
- if label then
- print( "The disk is labelled \""..label.."\"" )
- end
- end
- term.setCursorPos(5, 6)
- print (var60)
- paintutils.drawPixel(30, 6, nastaveni.barva)
- term.setBackgroundColor(colors.white)
- term.setCursorPos(5, 7)
- print (var61)
- term.setCursorPos(30, 7)
- term.setBackgroundColor(colors.yellow)
- print (user)
- term.setBackgroundColor(colors.white)
- term.setCursorPos(5, 8)
- print (var62)
- term.setBackgroundColor(colors.black)
- print " "
- print " "
- print " "
- print " "
- print " "
- print " "
- print " "
- print " "
- print " "
- print " "
- term.setTextColor(colors.white)
- term.setCursorPos(5, 9)
- shell.run ("list")
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if xy == "51,1" and button == 1 then
- plocha ()
- break
- end
- if x >= 1 and x <= 2 and y == 1 and button == 1 then
- obrnastaveni()
- break
- end
- end
- end
- -----------------------------
- function system ()
- local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
- local cnt=f.readAll()
- f.close()
- local nastaveni=textutils.unserialize(cnt)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- term.setBackgroundColor(nastaveni.barva)
- term.setTextColor(colors.white)
- print " "
- term.setCursorPos(23,1)
- prc (" System ")
- paintutils.drawPixel(51, 1, colors.red)
- term.setTextColor(colors.white)
- term.setCursorPos(51, 1)
- print "Q"
- paintutils.drawPixel(1, 1, colors.yellow)
- paintutils.drawPixel(2, 1, colors.yellow)
- term.setTextColor(colors.white)
- term.setCursorPos(1, 1)
- print "<-"
- term.setBackgroundColor(colors.lightBlue)
- term.setTextColor(colors.black)
- term.setCursorPos(5, 6)
- print (var63)
- term.setCursorPos(5, 12)
- print (var64)
- term.setCursorPos(5, 18)
- print (var65)
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if xy == "51,1" and button == 1 then
- plocha ()
- break
- end
- if x >= 1 and x <= 2 and y == 1 and button == 1 then
- obrnastaveni()
- break
- end
- if x >= 5 and x <= 25 and y == 6 and button == 1 then
- fs.delete ("/startup")
- shell.run ("pastebin get 6zPyzHHN /startup")
- systems ()
- break
- end
- if x >= 5 and x <= 25 and y == 12 and button == 1 then
- aktualizace()
- break
- end
- if x >= 5 and x <= 25 and y == 18 and button == 1 then
- data = fs.open("/.core/cmh","r")
- computerpass = data.readLine()
- data.close()
- textutils.unserialize (computerpass)
- term.setCursorPos(5, 16)
- print (var66)
- term.setCursorPos(24, 16)
- term.setBackgroundColor(colors.lightBlue)
- print " "
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(24, 16)
- cpass = read ("@")
- if cpass == computerpass then
- fs.delete ("/ink")
- fs.delete ("/np")
- fs.delete ("/startup")
- fs.delete ("/Downloaded")
- shell.run ("pastebin get QhDLVu1R startup")
- os.reboot ()
- else
- term.setBackgroundColor(colors.red)
- term.setCursorPos(5, 17)
- print (var67)
- sleep (1)
- system ()
- end
- break
- end
- end
- end
- -----------------------------
- function uzivatele ()
- local f = fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
- local cnt = f.readAll()
- f.close()
- local nastaveni=textutils.unserialize(cnt)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- term.setBackgroundColor(nastaveni.barva)
- term.setTextColor(colors.white)
- print " "
- term.setCursorPos(23,1)
- prc (var51)
- paintutils.drawPixel(51, 1, colors.red)
- term.setTextColor(colors.white)
- term.setCursorPos(51, 1)
- print "Q"
- paintutils.drawPixel(1, 1, colors.yellow)
- paintutils.drawPixel(2, 1, colors.yellow)
- term.setTextColor(colors.white)
- term.setCursorPos(1, 1)
- print "<-"
- term.setCursorPos(21,3)
- shell.run ("list /.ucet")
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(5, 5)
- print (var86)
- term.setCursorPos(5, 7)
- print (var68)
- term.setCursorPos(5, 9)
- print (var69.." "..stavlog)
- term.setCursorPos(5, 11)
- print (var70)
- term.setCursorPos(5, 13)
- print (var71)
- term.setCursorPos(5, 15)
- print (var72)
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if xy == "51,1" and button == 1 then
- plocha ()
- break
- end
- if x >= 1 and x <= 2 and y == 1 and button == 1 then
- obrnastaveni()
- break
- end
- if x >= 5 and x <= 21 and y == 5 and button == 1 then
- zmenahesla()
- break
- end
- if x >= 5 and x <= 21 and y == 7 and button == 1 then
- registrace()
- break
- end
- if x >= 5 and x <= 21 and y == 11 and button == 1 then
- smazaniuctu ()
- break
- end
- if x >= 5 and x <= 21 and y == 13 and button == 1 then
- odhlasit ()
- break
- end
- if x >= 5 and x <= 21 and y == 15 and button == 1 then
- restart ()
- break
- end
- if x >= 5 and x <= 21 and y == 9 and button == 1 then
- local n=fs.open("//.core/logon.cfg","r")
- preskoclog = n.readLine ()
- if preskoclog == "1" then
- stavlog = "No "
- preskoclog = "0"
- else
- stavlog = "Yes"
- preskoclog = "1"
- n.close()
- end
- local n=fs.open("//.core/logon.cfg","w")
- n.writeLine(preskoclog)
- n.writeLine(user)
- n.close()
- data = fs.open("/.core/defuser","w")
- data.writeLine(user)
- data.close()
- uzivatele ()
- end
- end
- end
- function zmenahesla()
- if hesla == 0 then
- local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
- local cnt=f.readAll()
- f.close()
- local nastaveni=textutils.unserialize(cnt)
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- term.setBackgroundColor(nastaveni.barva)
- term.setTextColor(colors.white)
- print " "
- term.setBackgroundColor(nastaveni.barva)
- term.setTextColor(colors.white)
- term.setCursorPos(19, 1)
- prc(var88)
- paintutils.drawPixel(51, 1, colors.red)
- term.setTextColor(colors.white)
- term.setCursorPos(51, 1)
- print "Q"
- paintutils.drawPixel(1, 1, colors.yellow)
- paintutils.drawPixel(2, 1, colors.yellow)
- term.setTextColor(colors.white)
- term.setCursorPos(1, 1)
- print "<-"
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(18,7)
- print " "
- term.setCursorPos(18,9)
- print " "
- term.setCursorPos(18,11)
- print " "
- term.setCursorPos(18,13)
- print (var90)
- hesla = 1
- zmenahesla ()
- elseif hesla == 1 then
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.white)
- term.setCursorPos(5,7)
- print(var87.." ")
- term.setCursorPos(5,9)
- print(var88.." ")
- term.setCursorPos(5,11)
- print(var89.." ")
- end
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if x >= 1 and x <= 2 and y == 1 and button == 1 then
- hesla = 0
- uzivatele()
- break
- end
- if xy == "51,1" and button == 1 then
- hesla = 0
- plocha ()
- break
- end
- if x >= 18 and x <= 26 and y == 7 and button == 1 then
- term.setBackgroundColor(colors.cyan)
- term.setCursorPos(18,7)
- print " "
- term.setCursorPos(18,7)
- heslo1 = read("@")
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(18,7)
- print " "
- term.setCursorPos(18,7)
- print (var27)
- zmenahesla ()
- elseif x >= 18 and x <= 26 and y == 9 and button == 1 then
- term.setBackgroundColor(colors.cyan)
- term.setCursorPos(18,9)
- print " "
- term.setCursorPos(18,9)
- heslo2 = read("@")
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(18,9)
- print " "
- term.setCursorPos(18,9)
- print (var27)
- zmenahesla ()
- elseif x >= 18 and x <= 26 and y == 11 and button == 1 then
- term.setBackgroundColor(colors.cyan)
- term.setCursorPos(18,11)
- print " "
- term.setCursorPos(18,11)
- heslo3 = read("@")
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(18,11)
- print " "
- term.setCursorPos(18,11)
- print (var27)
- zmenahesla ()
- elseif x >= 18 and x <= 23 and y == 13 and button == 1 then
- if heslo1 == "" and heslo2 == "" and heslo3 == "" then
- zmenahesla ()
- end
- if heslo1 == passI then
- if heslo2 == heslo3 then
- local file = fs.open(".ucet/"..user.."/.data","w")
- file.writeLine(userI)
- file.writeLine(heslo2)
- file.close()
- passI = heslo2
- hesla = 0
- heslo1 = ""
- heslo2 = ""
- heslo3 = ""
- uzivatele ()
- else
- prc ("Error comfirm password failed.", 15)
- heslo3 = ""
- sleep (1)
- hesla = 0
- zmenahesla ()
- end
- else
- prc ("Error - Bad old password.", 15)
- heslo1 = ""
- sleep (1)
- hesla = 0
- zmenahesla ()
- end
- end
- end
- end
- function smazaniuctu ()
- term.setCursorPos(24,11)
- print " "
- term.setCursorPos(25,11)
- sucet = read ()
- if sucet == "" then
- uzivatele ()
- elseif sucet == " " then
- uzivatele ()
- elseif sucet == user then
- term.setBackgroundColor(colors.red)
- term.setCursorPos(24,11)
- print (var73)
- term.setCursorPos(24,12)
- print (var74)
- sleep (1)
- uzivatele ()
- else
- smazani ()
- end
- end
- function smazani ()
- if fs.exists ("/.ucet/"..sucet) then
- fs.delete("/.ucet/"..sucet)
- term.setBackgroundColor(colors.lime)
- term.setCursorPos(24,11)
- print (var75)
- sleep (1)
- uzivatele ()
- else
- term.setBackgroundColor(colors.red)
- term.setCursorPos(24,11)
- print (var76)
- sleep (1)
- uzivatele ()
- end
- end
- function registrace()
- local next = false
- if login == 0 then
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(5,7)
- print(var22)
- term.setCursorPos(5,9)
- print(var20.." ")
- term.setCursorPos(5,11)
- print(var21.." ")
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(18,9)
- print " "
- term.setCursorPos(18,11)
- print " "
- term.setCursorPos(18,13)
- print (var23)
- elseif login == 1 then
- end
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if x >= 18 and x <= 26 and y == 9 and button == 1 then
- term.setBackgroundColor(colors.cyan)
- term.setCursorPos(18,9)
- print " "
- term.setCursorPos(18,9)
- userI = read()
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(18,9)
- print " "
- term.setCursorPos(18,9)
- print (userI)
- if userI == "" then
- login = 0
- registrace()
- elseif userI == " " then
- login = 0
- registrace()
- else
- login = 1
- registrace()
- end
- elseif x >= 18 and x <= 26 and y == 11 and button == 1 then
- term.setBackgroundColor(colors.cyan)
- term.setCursorPos(18,11)
- print " "
- term.setCursorPos(18,11)
- pass = read("@")
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(18,11)
- print " "
- term.setCursorPos(18,11)
- print (pass)
- login = 1
- registrace ()
- end
- if x >= 18 and x <= 26 and y == 13 and button == 1 then
- if userI == 0 then
- term.setBackgroundColor(colors.white)
- fgc(colors.red)
- term.setCursorPos(5,13)
- print(var30)
- sleep (1)
- login = 0
- registrace ()
- elseif userI == " " then
- term.setBackgroundColor(colors.white)
- fgc(colors.red)
- term.setCursorPos(5,13)
- print(var25)
- sleep (1)
- login = 0
- registrace()
- end
- login = 0
- if not fs.isDir("/.ucet/"..userI) then
- fs.makeDir("/.ucet/"..userI)
- local file = fs.open(".ucet/"..userI.."/.data","w")
- file.writeLine(userI)
- file.writeLine(pass)
- file.close()
- if not fs.exists("/.core/ucet") then
- fs.open("/.core/ucet","w")
- end
- term.setBackgroundColor(colors.white)
- fgc(colors.lime)
- term.setCursorPos(5,13)
- shell.run ("pastebin get YHGDzX5a ", ".ucet/"..userI.."/bar.nfp")
- term.setCursorPos(5,13)
- shell.run ("pastebin get sc1LAE0x ", ".ucet/"..userI.."/nastaveni.cfg")
- term.setCursorPos(5,13)
- shell.run ("pastebin get sh70PdPx /.ucet/"..userI.."/language")
- term.setCursorPos(5,13)
- print(var24)
- sleep (1)
- userI = uss
- uzivatele ()
- else
- term.setBackgroundColor(colors.white)
- fgc(colors.red)
- term.setCursorPos(5,13)
- print(var25)
- sleep (1)
- uzivatele ()
- end
- end
- end
- end
- function pozadi ()
- local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
- local cnt=f.readAll()
- f.close()
- local nastaveni=textutils.unserialize(cnt)
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- term.setBackgroundColor(nastaveni.barva)
- term.setTextColor(colors.white)
- print " "
- term.setBackgroundColor(nastaveni.barva)
- term.setTextColor(colors.white)
- term.setCursorPos(19, 1)
- prc(var77)
- paintutils.drawPixel(51, 1, colors.red)
- term.setTextColor(colors.white)
- term.setCursorPos(51, 1)
- print "Q"
- paintutils.drawPixel(1, 1, colors.yellow)
- paintutils.drawPixel(2, 1, colors.yellow)
- term.setTextColor(colors.white)
- term.setCursorPos(1, 1)
- print "<-"
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(5, 7)
- print (var78)
- term.setCursorPos(5, 9)
- print "- Pepdroll"
- term.setCursorPos(5, 11)
- print "- Farm "
- term.setCursorPos(5, 13)
- print "- Island "
- term.setCursorPos(5, 5)
- print (var83)
- term.setCursorPos(5, 15)
- print "- Win XP "
- term.setCursorPos(5, 17)
- print "- Nothing "
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if x >= 1 and x <= 2 and y == 1 and button == 1 then
- obrnastaveni()
- break
- end
- if xy == "51,1" and button == 1 then
- plocha ()
- break
- end
- if x >= 5 and x <= 12 and y == 5 and button == 1 then
- barvapozadi ()
- break
- end
- if x >= 5 and x <= 12 and y == 7 and button == 1 then
- namalovat ()
- break
- end
- if x >= 5 and x <= 12 and y == 9 and button == 1 then
- pepdroll ()
- break
- end
- if x >= 5 and x <= 12 and y ==11 and button == 1 then
- statek ()
- end
- if x >= 5 and x <= 12 and y ==13 and button == 1 then
- ostrov ()
- end
- if x >= 5 and x <= 12 and y ==15 and button == 1 then
- xp ()
- end
- if x >= 5 and x <= 12 and y ==17 and button == 1 then
- shell.run ("delete /.ucet/"..user.."/bar.nfp")
- pozadi ()
- end
- end
- end
- function xp ()
- shell.run ("delete /.ucet/"..user.."/bar.nfp")
- shell.run ("pastebin get iy3EcA4Z /.ucet/"..user.."/bar.nfp")
- pozadi ()
- end
- function ostrov ()
- shell.run ("delete /.ucet/"..user.."/bar.nfp")
- shell.run ("pastebin get vm1p8DXs /.ucet/"..user.."/bar.nfp")
- pozadi ()
- end
- function pepdroll ()
- shell.run ("delete /.ucet/"..user.."/bar.nfp")
- shell.run ("pastebin get YHGDzX5a /.ucet/"..user.."/bar.nfp")
- pozadi ()
- end
- function statek ()
- shell.run ("delete /.ucet/"..user.."/bar.nfp")
- shell.run ("pastebin get K0zXPiKn /.ucet/"..user.."/bar.nfp")
- pozadi ()
- end
- function namalovat ()
- shell.run (".core/paint /.ucet/"..user.."/bar.nfp")
- end
- function aktualizace ()
- shell.run ("pastebin get Ge2p5qgQ /.core/verze")
- data = fs.open("/.core/verze","r")
- verzeup = data.readLine()
- data.close()
- local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","r")
- local cnt=f.readAll()
- f.close()
- local nastaveni=textutils.unserialize(cnt)
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- term.setBackgroundColor(nastaveni.barva)
- term.setTextColor(colors.white)
- print " "
- term.setBackgroundColor(nastaveni.barva)
- term.setTextColor(colors.white)
- term.setCursorPos(20, 1)
- prc(var79)
- paintutils.drawPixel(51, 1, colors.red)
- term.setTextColor(colors.white)
- term.setCursorPos(51, 1)
- print "Q"
- paintutils.drawPixel(1, 1, colors.yellow)
- paintutils.drawPixel(2, 1, colors.yellow)
- term.setTextColor(colors.white)
- term.setCursorPos(1, 1)
- print "<-"
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.setCursorPos(5, 14)
- print ("Current Build: "..verze)
- term.setCursorPos(5, 16)
- print ("Lates Build: "..verzeup)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(5, 7)
- print ("- "..var79)
- if verze == verzeup then
- term.setCursorPos(10, 15)
- term.setBackgroundColor(colors.lime)
- print ("You have got a lates build")
- end
- if verze < verzeup then
- term.setCursorPos(10, 15)
- term.setBackgroundColor(colors.green)
- print ("New version available")
- end
- if verze > verzeup then
- term.setCursorPos(10, 15)
- term.setBackgroundColor(colors.yellow)
- print ("You have unreleased version!")
- end
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if xy == "51,1" and button == 1 then
- fs.delete ("/.core/verze")
- plocha ()
- break
- end
- if x >= 1 and x <= 2 and y == 1 and button == 1 then
- fs.delete ("/.core/verze")
- system()
- break
- end
- if x >= 5 and x <= 18 and y ==7 and button == 1 then
- shell.run ("delete startup")
- shell.run ("pastebin get 6zPyzHHN startup")
- shell.run ("delete /.ucet/"..user.."/language")
- shell.run ("delete /.core/language")
- if var33 == Kalkulacka then
- shell.run("pastebin get AJULjcwC /.core/tut")
- else
- shell.run("pastebin get CyxwuZRw /.core/tut")
- end
- os.reboot ()
- break
- end
- end
- end
- function barvapozadi ()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- local nastaveni={barva=colors.blue}
- term.setCursorPos (5, 17)
- print (var80)
- term.setCursorPos (5, 18)
- local novaBarva=read() --#precist hodnotu od uzivatele
- if colors[novaBarva:lower()] then
- nastaveni.barva=colors[novaBarva:lower()]
- else
- print"Barva nenalezena, ponechano puvodni nastaveni"
- end
- --#ulozime
- local f=fs.open("/.ucet/"..user.."/nastaveni.cfg","w")
- f.write(textutils.serialize(nastaveni))
- f.close()
- pozadi ()
- end
- rozhodnutiins ()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement