Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Versamenti contanti 1.19
- --disabilita
- rs.setOutput("top", true)
- local maxw, maxh = term.getSize()
- --vuota il bancomat
- ben = peripheral.wrap("back")
- j=ben.getBlockData()
- coin = 0
- coin_8x = 0
- coin_64x = 0
- coin_512x = 0
- coin_4096x = 0
- coin_32768x = 0
- for k,v in pairs(j.Items) do
- if v.id == "ic2:coin" then
- coin = coin + v.Count
- elseif v.id == "ic2:coin_8x" then
- coin_8x = coin_8x + v.Count
- elseif v.id == "ic2:coin_64x" then
- coin_64x = coin_64x + v.Count
- elseif v.id == "ic2:coin_512x" then
- coin_512x = coin_512x + v.Count
- elseif v.id == "ic2:coin_4096x" then
- coin_4096x = coin_4096x + v.Count
- elseif v.id == "ic2:coin_32768x" then
- coin_32768x = coin_32768x + v.Count
- end
- sleep(0.1)
- end
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- if coin ~= 0 or coin_8x ~= 0 or coin_64x ~= 0 or coin_512x ~= 0 or coin_4096x ~= 0 or coin_32768x ~= 0 then
- clear()
- print("Bancomat temporaneamente non disponibile, per favore attendere")
- rs.setOutput("top", false)
- for i=1,5 do
- term.setCursorPos(3, 3)
- term.write("*---")
- sleep(0.5)
- term.setCursorPos(3, 3)
- term.write("-*--")
- sleep(0.5)
- term.setCursorPos(3, 3)
- term.write("--*-")
- sleep(0.5)
- term.setCursorPos(3, 3)
- term.write("---*")
- sleep(0.5)
- end
- rs.setOutput("top", true)
- os.reboot()
- end
- 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)
- sfondo(colors.blue)
- 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
- sfondo(colours.blue)
- clear()
- titolo("Banco di Nebraska")
- sfondo(colours.blue)
- colore(colors.white)
- print("\n\nSistema Versamento")
- print("")
- print("Premere un tasto per iniziare l'operazione di versamento")
- event = os.pullEvent()
- sfondo(colours.blue)
- term.clear()
- term.setCursorPos(1, 1)
- titolo("Accredita su Nebraska Pay")
- sfondo(colours.blue)
- colore(colors.white)
- print(
- "\n\nInserire i propri dati. Premere Enter per confermare i dati inseriti. \nSe i dati sono corretti, il campo diventerà verde. Se 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://luanet.rgbcraft.com/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://luanet.rgbcraft.com/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
- metodoPagamento = "NPAY"
- credito = tonumber(risposta.saldo)
- clear()
- while true do
- print("Il conto ha un saldo di "..credito.." IC.")
- print("")
- print("Per favore scegliere un'opzione utilizzando i tasti numerici e confermare con ENTER:")
- print("")
- print("[1] Versare contanti")
- print("[2] Annullare il versamento")
- num=tonumber(read())
- if num == 1 then
- clear()
- redstone.setOutput("right", true)
- print("Inserire i contanti nello sportello sotto al computer")
- print("")
- print("AVVERTENZA IMPORTANTE:")
- print("Inserire SOLO monete:")
- print("Oggetti non consentiti vengono rifiutati")
- print("")
- print("NON RIAVVIARE IL COMPUTER O SI PERDERA' IL VERSAMENTO")
- print("")
- print("Quando si è pronti per continuare, premere un tasto qualsiasi.")
- os.pullEvent("key")
- clear()
- redstone.setOutput("right", false)
- print("Conteggio contanti in corso...")
- term.setCursorPos(3, 3)
- term.write("*---")
- sleep(0.5)
- term.setCursorPos(3, 3)
- term.write("-*--")
- sleep(0.5)
- term.setCursorPos(3, 3)
- term.write("--*-")
- sleep(0.5)
- term.setCursorPos(3, 3)
- term.write("---*")
- sleep(0.5)
- ben = peripheral.wrap("back")
- j=ben.getBlockData()
- coin = 0
- coin_8x = 0
- coin_64x = 0
- coin_512x = 0
- coin_4096x = 0
- coin_32768x = 0
- for k,v in pairs(j.Items) do
- if v.id == "ic2:coin" then
- coin = coin + v.Count
- elseif v.id == "ic2:coin_8x" then
- coin_8x = coin_8x + v.Count
- elseif v.id == "ic2:coin_64x" then
- coin_64x = coin_64x + v.Count
- elseif v.id == "ic2:coin_512x" then
- coin_512x = coin_512x + v.Count
- elseif v.id == "ic2:coin_4096x" then
- coin_4096x = coin_4096x + v.Count
- elseif v.id == "ic2:coin_32768x" then
- coin_32768x = coin_32768x + v.Count
- end
- sleep(0.1)
- end
- contanti = coin + coin_8x*8 + coin_64x*64 + coin_512x*512 + coin_4096x*4096 + coin_32768x*32768
- print("\n\nTotale versato: "..contanti.." IC")
- rs.setOutput("top", false)
- print("")
- inviaDenaro = http.get(
- "http://luanet.rgbcraft.com/servlets/nebraskapay.php?auth=" ..
- password .. "&utente=" .. utente ..
- "&richiesta=accredito&causale=Vendita%20contanti&valore=" .. contanti).readAll()
- risultatoInvio = textutils.unserialize(inviaDenaro)
- if risultatoInvio.stato == "OK" then
- colore(colors.white)
- else
- clear()
- errore("Errore durante il pagamento")
- sleep(5)
- os.reboot()
- end
- sleep(1)
- clear()
- print("Denaro versato.")
- print("")
- print("")
- print("Grazie!")
- sleep(1)
- term.setTextColor(colors.black)
- rs.setOutput("top", true)
- shell.run("pastebin get 0M1pB5f3 startup2")
- if fs.exists("startup2") then
- shell.run("rm startup")
- shell.run("mv startup2 startup")
- end
- os.reboot()
- elseif num == 2 then clear() break end
- end
- clear()
- print("Attendere")
- shell.run("pastebin get 0M1pB5f3 startup2")
- if fs.exists("startup2") then
- shell.run("rm startup")
- shell.run("mv startup2 startup")
- end
- term.setTextColor(colors.black)
- os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment