Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local maxw, maxh = term.getSize()
- lato = "bottom"
- soldi = 2000000
- rs.setOutput(lato, true)
- -- 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 colore(nome) term.setTextColor(nome) end
- function sfondo(nome) term.setBackgroundColor(nome) end
- function fineColore() term.setTextColour(colours.white) end
- function fineSfondo() term.setBackgroundColour(colours.black) end
- function titolo(testo)
- drawFilledBox(1, 1, maxw, 1, colors.blue)
- term.setCursorPos((maxw - #testo) / 2, 1)
- colore(colors.white)
- term.write(testo)
- sfondo(colors.white)
- end
- function clear()
- sfondo(colors.blue)
- term.clear()
- term.setCursorPos(1, 1)
- 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)
- term.setCursorPos(16, 10)
- term.write("Sei un poraccio...")
- os.sleep(5)
- os.reboot()
- end
- clear()
- sfondo(colors.lightBlue)
- colore(colors.black)
- term.setCursorPos(1, 1)
- titolo("RICHBICH")
- term.setCursorPos(1, 3)
- drawFilledBox(18, 9, 31, 11, colors.white)
- colore(colors.red)
- term.setCursorPos(20, 10)
- term.write("Login RICH")
- drawFilledBox(18, 13, 31, 15, colors.white)
- term.setCursorPos(19, 14)
- term.write("Login P-RICH")
- while true do
- local event, par1, par2, par3 = os.pullEvent("mouse_click")
- if par2 >= 20 and par2 <= 27 and par3 >= 10 and par3 <= 12 then -- Utenti
- clear()
- term.clear()
- fineSfondo()
- titolo("LOGIN MTF RICH")
- sfondo(colors.lightBlue)
- colore(colors.white)
- term.setCursorPos(1, 3)
- print("Inserire i propri dati.")
- colore(colors.gray)
- print("\nPremere Enter per confermare i dati inseriti.\nSe i dati sono corretti, il campo diventerà verde.\nSe sono errati, il programma chiederà di reinserirli nuovamente.")
- --nomeutente
- term.setCursorPos(1, 10)
- colore(colors.black)
- term.write("Nome utente:")
- term.setCursorPos(15, 10)
- colore(colors.white)
- utenteAccettato = false
- conteggioErrori = 0
- while utenteAccettato == false do
- utente = read()
- 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, 10)
- colore(colors.lime)
- term.write(utente)
- colore(colors.white)
- utenteAccettato = true
- else
- term.setCursorPos(15, 10)
- colore(colors.red)
- term.write("Utente errato!")
- sleep(2)
- term.setCursorPos(15, 10)
- colore(colors.white)
- term.write(" ")
- term.setCursorPos(15, 10)
- conteggioErrori = conteggioErrori + 1
- if conteggioErrori > 2 then
- term.setCursorPos(15, 10)
- colore(colors.red)
- term.write("Tre tentativi di immissione errati.")
- sleep(2)
- term.setCursorPos(15, 10)
- colore(colors.white)
- term.write(" ")
- term.setCursorPos(15, 10)
- clear()
- os.reboot()
- end
- end
- end
- --password
- colore(colors.black)
- term.setCursorPos(1,12)
- term.write("Password:")
- term.setCursorPos(15, 12)
- conteggioErrori = 0
- passAccettata = false
- while passAccettata == false do
- colore(colors.white)
- password = read("#")
- colore(colors.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, 12)
- colore(colors.lime)
- term.write("##############")
- colore(colors.white)
- passAccettata = true
- else
- term.setCursorPos(15, 12)
- colore(colors.red)
- term.write("Password errata!")
- conteggioErrori = conteggioErrori + 1
- sleep(2)
- term.setCursorPos(15, 12)
- term.write(" ")
- term.setCursorPos(15, 12)
- if conteggioErrori > 2 then
- term.setCursorPos(15, 12)
- colore(colors.red)
- term.write("Tre tentativi di immissione errati.")
- sleep(2)
- term.setCursorPos(15, 12)
- term.write(" ")
- term.setCursorPos(15, 12)
- clear()
- os.reboot()
- end
- end
- end
- while true do
- --Ricontrolla il saldo per gestire l'aggiornamento di piåA5B9 operazioni
- 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)
- saldo = tonumber(risposta.saldo)
- --Disegna la finestra del pannello utente
- clear()
- titolo("Pannello utente RICHBICH")
- sfondo(colors.lightBlue)
- colore(colors.black)
- term.setCursorPos(1, 3)
- term.write("Benvenuto, ")
- colore(colors.white)
- term.write(utente)
- colore(colors.black)
- term.write("! Saldo: ")
- colore(colors.white)
- term.write(saldo)
- colore(colors.black)
- term.write(" IC")
- print("\n\nOperazioni disponibili:\n")
- sfondo(colors.lightBlue)
- colore(colors.white)
- print(" Apri porta RICH \n")
- print(" Donazione RICH \n")
- colore(colors.red)
- print(" Disconnettiti da RICH \n")
- colore(colors.black)
- antitonto = os.startTimer(60)
- event, key, x, y = os.pullEventRaw()
- if event == "mouse_click" and y == 7 and x <= 24 then --Pulsante carica denaro su nPay
- clear()
- titolo("Apertura porta RICH")
- if(saldo>=soldi) then
- rs.setOutput(lato, false)
- sleep(3)
- os.reboot()
- else
- inviaDenaro = http.get("http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=" .. password .. "&utente=" .. utente .. "&richiesta=trasferimento&valore=" .. "10" .. "&beneficiario=" .. "calafricagroup").readAll()
- risultatoInvio = textutils.unserialize(inviaDenaro)
- if risultatoInvio.stato == "OK" then
- term.setCursorPos(1, 10)
- colore(colors.red)
- term.write("Soldi scalati ;)")
- else
- term.setCursorPos(1, 10)
- colore(colors.red)
- term.write("Che culo :(")
- end
- sleep(1)
- errore("poraccio")
- end
- else if event == "mouse_click" and y == 11 and x <= 31 then
- os.sleep(1)
- os.reboot()
- end
- end
- end
- else if par2 >= 19 and par2 <= 26 and par3 >= 13 and par3 <= 15 then
- while true do
- clear()
- titolo("Apertura porta RICH")
- testo = "Bucchi metti la mano sopra :)"
- term.setCursorPos((maxw - #testo) / 2, 12)
- colore(colors.black)
- term.write("Bucchi metti la mano sopra :)")
- antitonto = os.startTimer(5)
- event, playerName = os.pullEvent()
- if event == "player" and playerName == "dionesalvi" or playerName == "kiiw" then
- clear()
- titolo("Apertura porta RICH")
- rs.setOutput(lato, false)
- sleep(3)
- os.reboot()
- end
- os.reboot()
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement