Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Versamenti MINERALI 1.19
- local maxw, maxh = term.getSize()
- --vuota il bancomat
- ben = peripheral.wrap("back")
- j=ben.getBlockData()
- copper = 0
- gold = 0
- iron = 0
- diamond = 0
- emerald = 0
- steel = 0
- glowstone = 0
- silver = 0
- bronze = 0
- lead = 0
- invar = 0
- electrum = 0
- nickel = 0
- coal = 0
- coal_coke = 0
- osmium = 0
- salt = 0
- for k,v in pairs(j.Items) do
- if v.id == "minecraft:copper_ingot" then
- copper = copper + v.Count
- elseif v.id == "minecraft:gold_ingot" then
- gold = gold + v.Count
- elseif v.id == "minecraft:iron_ingot" then
- iron = iron + v.Count
- elseif v.id == "minecraft:diamond" then
- diamond = diamond + v.Count
- elseif v.id == "minecraft:emerald" then
- emerald = emerald + v.Count
- elseif v.id == "immersiveengineering:ingot_steel" then
- steel = steel + v.Count
- elseif v.id == "railcraft:steel_ingot" then
- steel = steel + v.Count
- elseif v.id == "mekanism:ingot_steel" then
- steel = steel + v.Count
- elseif v.id == "minecraft:glowstone_dust" then
- glowstone = glowstone + v.Count
- elseif v.id == "ic2:ingot_silver" then
- silver = silver + v.Count
- elseif v.id == "thermal:ingot_silver" then
- silver = silver + v.Count
- end
- sleep(0.1)
- end
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- if copper ~= 0 or gold ~= 0 or iron ~= 0 or diamond ~= 0 or emerald ~= 0 or steel ~= 0 or glowstone ~= 0 or silver ~= 0 or bronze ~= 0 or lead ~= 0 or invar ~= 0 or electrum ~= 0 or nickel ~= 0 or coal ~= 0 or coal_coke ~= 0 or osmium ~= 0 or salt ~= 0 then
- clear()
- print("Bancomat temporaneamente non disponibile, per favore attendere")
- rs.setOutput("left", true)
- 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("left", false)
- 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("Autorità Portuale di New Radeon")
- sfondo(colours.blue)
- colore(colors.white)
- print("\n\nVendita Minerali")
- print("")
- print("Premere un tasto per iniziare l'operazione")
- 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 dei minerali")
- print("[2] Annullare il versamento")
- num=tonumber(read())
- if num == 1 then
- clear()
- redstone.setOutput("right", true)
- print("Inserire i minerali nello sportello sotto al computer")
- print("")
- print("AVVERTENZA IMPORTANTE:")
- print("Inserire SOLO questi minerali:")
- print("Minerali 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 minerali 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()
- copper = 0
- gold = 0
- iron = 0
- diamond = 0
- emerald = 0
- steel = 0
- glowstone = 0
- silver = 0
- bronze = 0
- lead = 0
- invar = 0
- electrum = 0
- nickel = 0
- coal = 0
- coal_coke = 0
- osmium = 0
- salt = 0
- for k,v in pairs(j.Items) do
- if v.id == "minecraft:copper_ingot" then
- copper = copper + v.Count
- elseif v.id == "minecraft:gold_ingot" then
- gold = gold + v.Count
- elseif v.id == "minecraft:iron_ingot" then
- iron = iron + v.Count
- elseif v.id == "minecraft:diamond" then
- diamond = diamond + v.Count
- elseif v.id == "minecraft:emerald" then
- emerald = emerald + v.Count
- elseif v.id == "immersiveengineering:ingot_steel" then
- steel = steel + v.Count
- elseif v.id == "railcraft:steel_ingot" then
- steel = steel + v.Count
- elseif v.id == "mekanism:ingot_steel" then
- steel = steel + v.Count
- elseif v.id == "minecraft:glowstone_dust" then
- glowstone = glowstone + v.Count
- elseif v.id == "ic2:ingot_silver" then
- silver = silver + v.Count
- elseif v.id == "thermal:ingot_silver" then
- silver = silver + v.Count
- end
- sleep(0.1)
- end
- copperIC = copper * 0.3
- goldIC = gold * 1
- ironIC = iron * 0.001
- contanti = copperIC + goldIC + ironIC
- print("\n\nTotale versato: "..contanti.." IC")
- print("")
- inviaDenaro = http.get(
- "http://luanet.rgbcraft.com/servlets/nebraskapay.php?auth=" ..
- password .. "&utente=" .. utente ..
- "&richiesta=accredito&causale=Vendita%20minerali&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
- if tonumber(contanti) ~= 0 then
- inviaFisco = http.get("http://luanet.rgbcraft.com/servlets/fisco.php?msg=" .. contanti .. "%20IC%20di%20minerali%20-%20" .. utente)
- inviaDGFE = http.get("http://luanet.rgbcraft.com/servlets/dgfe.php?npay_user=" .. utente .. "&transaction_type=Minerali&transaction_amount=" .. contanti)
- end
- sleep(1)
- clear()
- print("Denaro versato.")
- print("")
- print("")
- print("Grazie!")
- sleep(1)
- term.setTextColor(colors.black)
- shell.run("pastebin get 2Lju9eSn 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 2Lju9eSn 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