Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local maxw, maxh = term.getSize()
- function clear()
- term.clear()
- term.setCursorPos(1, 1)
- end
- function clearRed()
- sfondo(colors.red)
- term.clear()
- term.setCursorPos(1, 1)
- end
- function colore(sfumatura) term.setTextColour(sfumatura) end
- function sfondo(sfumaturaSfondo) term.setBackgroundColour(sfumaturaSfondo) end
- function fineColore() term.setTextColour(colours.white) end
- function fineSfondo() term.setBackgroundColour(colours.black) end
- -- IMPLEMENTAZIONE DEL DRAWFILLEDBOX
- local function drawPixelInternal(xPos, yPos)
- term.setCursorPos(xPos, yPos)
- term.write(" ")
- end
- local tColourLookup = {}
- for n = 1, 16 do
- tColourLookup[string.byte("0123456789abcdef", n, n)] = 2 ^ (n - 1)
- end
- function drawFilledBox(startX, startY, endX, endY, nColour)
- if type(startX) ~= "number" or type(startX) ~= "number" or type(endX) ~=
- "number" or type(endY) ~= "number" or
- (nColour ~= nil and type(nColour) ~= "number") then
- error("Expected startX, startY, endX, endY, colour", 2)
- end
- startX = math.floor(startX)
- startY = math.floor(startY)
- endX = math.floor(endX)
- endY = math.floor(endY)
- if nColour then term.setBackgroundColor(nColour) end
- if startX == endX and startY == endY then
- drawPixelInternal(startX, startY)
- return
- end
- local minX = math.min(startX, endX)
- if minX == startX then
- minY = startY
- maxX = endX
- maxY = endY
- else
- minY = endY
- maxX = startX
- maxY = startY
- end
- for x = minX, maxX do for y = minY, maxY do drawPixelInternal(x, y) end end
- end
- function titolo(testo)
- drawFilledBox(1, 1, maxw, 1, colors.yellow)
- term.setCursorPos((maxw - #testo) / 2, 1)
- colore(colors.black)
- term.write(testo)
- term.setBackgroundColor(colors.black)
- colore(colors.white)
- end
- function errore(errore)
- sfondo(colors.red)
- colore(colors.white)
- term.clear()
- term.setCursorPos(1, 1)
- titolo("Errore irreversibile")
- term.setCursorPos(1, 3)
- sfondo(colors.red)
- colore(colors.white)
- print(errore)
- print("\n\n\nAttendere qualche secondo...")
- os.sleep(5)
- os.reboot()
- end
- clear()
- titolo("MINISTERO DELL'ABBODANZA")
- print("\n\nRitiro premio giornaliero per VOTO SERVER")
- print("")
- print("Dopo aver votato il server su MineAlpha, ritira il premio su questo computer.")
- print("")
- colore(colors.orange)
- print("PER RITIRARE IL PREMIO:")
- print("Fare clic DESTRO sul sensore sottostante")
- local event, player = os.pullEvent()
- sfondo(colours.blue)
- term.clear()
- term.setCursorPos(1, 1)
- titolo("Autenticati con Nebraska Pay")
- sfondo(colours.blue)
- colore(colors.white)
- print(
- "\n\nInserire i propri dati (non verrà effettuato alcun addebito). Premere Enter per confermare i dati inseriti. \nSe i dati sono errati, il programma chiederà di reinserirli nuovamente.")
- -- nomeutente
- term.setCursorPos(1, 9)
- term.write("Nome utente:")
- term.setCursorPos(15, 9)
- fineColore()
- utenteAccettato = false
- conteggioErrori = 0
- while utenteAccettato == false do
- utente = read()
- utente = string.gsub(utente, "%s", "")
- checkuser = http.get(
- "http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=no&richiesta=verifica&utente=" ..
- utente).readAll()
- tabcheckuser = textutils.unserialize(checkuser)
- if tabcheckuser.stato == "OK" then
- term.setCursorPos(15, 9)
- colore(colours.lime)
- term.write(utente)
- fineColore()
- utenteAccettato = true
- else
- term.setCursorPos(15, 9)
- colore(colours.red)
- term.write("Utente errato! ")
- sleep(2)
- term.setCursorPos(15, 9)
- fineColore()
- term.write(" ")
- term.setCursorPos(15, 9)
- conteggioErrori = conteggioErrori + 1
- if conteggioErrori > 2 then
- term.setCursorPos(15, 9)
- colore(colours.red)
- errore("Troppi tentativi di immissione errati ")
- end
- end
- end
- colore(colours.white)
- term.setCursorPos(1, 11)
- term.write("Password:")
- term.setCursorPos(15, 11)
- conteggioErrori = 0
- passAccettata = false
- while passAccettata == false do
- fineColore()
- password = read("#")
- colore(colours.black)
- checkuser = http.get(
- "http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=" ..
- password .. "&richiesta=addebito&valore=0&utente=" ..
- utente).readAll()
- risposta = textutils.unserialize(checkuser)
- if risposta.stato == "OK" then
- term.setCursorPos(15, 11)
- colore(colours.lime)
- term.write("############## ")
- fineColore()
- passAccettata = true
- else
- term.setCursorPos(15, 11)
- colore(colours.red)
- term.write("Password errata! ")
- conteggioErrori = conteggioErrori + 1
- sleep(2)
- term.setCursorPos(15, 11)
- term.write(" ")
- term.setCursorPos(15, 11)
- if conteggioErrori > 2 then
- term.setCursorPos(15, 11)
- colore(colours.red)
- errore("Troppi tentativi di immissione errati")
- end
- end
- end
- local checkRaw = http.get("http://172.16.20.220/luanet/servlets/votesystem/?user=" .. player).readAll()
- check = textutils.unserialize(checkRaw)
- if check.stato == "EA" then
- errore(check.errore)
- end
- print(checkRaw)
- error(event)
- sfondo(colors.black)
- colore(colors.lime)
- term.clear()
- term.setCursorPos(1, 1)
- titolo("Ordini consegnati")
- term.setCursorPos(1, 3)
- sfondo(colors.black)
- colore(colors.lime)
- print("\n\n\nAttendere qualche secondo per l'erogazione di tutti gli ordini...")
- os.sleep(5)
- os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement