View difference between Paste ID: EfySKdqZ and v84Q9wC1
SHOW: | | - or go back to the newest paste.
1-
-- BANCOMAT V2 aggiornato 2025 copyright lego11
1+
--Convertitore carte
2
--VARIABILI
3
local tabr = {}
4-
function clear()
4+
5
m = peripheral.wrap("bottom")
6
7
function clear() 
8
term.clear()
9
term.setCursorPos(1,1)
10-
    clear()
10+
11-
    print("Errore di verifica del PIN")
11+
12-
    print("")
12+
13-
    print("Premere un tasto per uscire")
13+
14-
    os.pullEvent("key")
14+
print("Errore di verifica del PIN")
15
print("")
16
print("Premere un tasto per uscire")
17
os.pullEvent("key")
18
os.reboot()
19-
    clear()
19+
20-
    print("Carta non valida o corrotta.")
20+
21-
    print("")
21+
22-
    print("Premere un tasto per uscire")
22+
23-
    os.pullEvent("key")
23+
24
print("Carta non valida o corrotta.")
25
print("")
26
print("Premere un tasto per uscire")
27
os.pullEvent("key")
28-
    clear()
28+
29-
    print("Carta smagnetizzata o vuota.")
29+
30-
    print("")
30+
31-
    print("Premere un tasto per uscire")
31+
function cartaGiaNuova()
32-
    os.pullEvent("key")
32+
33
print("Carta già convertita.")
34
print("")
35
print("Premere un tasto per uscire")
36-
function cartaNoSIB()
36+
os.pullEvent("key")
37-
    clear()
37+
38-
    print("Carta non in sistema interbancario.")
38+
39-
    print("")
39+
40-
    print("Premere un tasto per uscire")
40+
41-
    os.pullEvent("key")
41+
42
print("Carta smagnetizzata o vuota.")
43
print("")
44
print("Premere un tasto per uscire")
45-
function sibFail()
45+
os.pullEvent("key")
46-
    clear()
46+
47-
    print("Errore connessione sistema interbancario")
47+
48-
    print("")
48+
49-
    print("Premere un tasto per uscire")
49+
function errore(errore)
50-
    os.pullEvent("key")
50+
    sfondo(colors.white)
51
    colore(colors.black)
52
    term.clear()
53
    term.setCursorPos(1, 1)
54-
function cartaVecchia()
54+
    term.write("Errore irreversibile")
55-
    clear()
55+
    term.setCursorPos(1, 3)
56-
    print("CARTA NON SICURA. Convertire la carta presso lo sportello situato in:\n")
56+
    sfondo(colors.black)
57-
    print("\n Banco di Nebraska - P.zza Affari 3, New Radeon")
57+
    colore(colors.white)
58-
    print("")
58+
    print(errore)
59-
    print("Premere un tasto per uscire")
59+
    print("\n\n\nAttendere qualche secondo...")
60-
    os.pullEvent("key")
60+
    os.sleep(5)
61
    os.reboot()
62
end
63
 
64-
function preleva(prelievo, uuid)
64+
65-
    clear()
65+
66-
    erogati = 0
66+
67-
    sibRaw = http.get("http://luanet.rgbcraft.com/servlets/carte_debito.php?richiesta=addebito&valore=" .. prelievo ..
67+
68-
                          "&uuid=" .. uuid).readAll()
68+
print("Inserire la carta per attivarla o convertirla")
69-
    sib = textutils.unserialize(sibRaw)
69+
70
za,rawcarta = os.pullEvent("mag_swipe")
71-
    if type(sib) ~= "table" then
71+
72-
        print("\n\n\nImpossibile comunicare con il server interbancario")
72+
73-
        sleep(5)
73+
74-
        os.reboot()
74+
cartaVuota()
75-
    end
75+
76
77-
    if sib.stato == "DI" then
77+
78-
        print("Disponibilità insufficiente")
78+
79-
        sleep(5)
79+
80-
    elseif sib.stato ~= "OK" then
80+
cartaNonValida()
81-
        print(
81+
82-
            "\n\n\nLa carta non risulta nel sistema interbancario, potrebbe essere stata disabilitata per uso fraudolento")
82+
83-
        sleep(5)
83+
if tab.t == "cd" then
84-
        os.reboot()
84+
cartaGiaNuova()
85-
    else
85+
86-
        print("Ritirare il denaro")
86+
87-
        print("")
87+
if tab.t ~= "cc" then
88-
        for i = prelievo, 1, -64 do
88+
cartaNonValida()
89-
            redstone.setOutput("bottom", true)
89+
90-
            sleep(0.25)
90+
91-
            erogati = erogati + 64
91+
if tab.e ~= "BN" then 
92-
            print("Erogati " .. erogati .. " IC")
92+
cartaNonValida()
93-
            redstone.setOutput("bottom", false)
93+
94-
        end
94+
95-
        print("")
95+
if tab.p ~= "0000" then
96-
        term.setBackgroundColor(colors.white)
96+
97-
        term.setTextColor(colors.black)
97+
print("Inserire il PIN e premere ENTER")
98-
        clear()
98+
99-
        print("Prelievo effettuato\n")
99+
local pinUtente = read("#")
100-
        print("Tra poco sarà possibile eseguire un'altra operazione.")
100+
if pinUtente ~= tab.p then
101
pinErrato()
102-
        term.setTextColor(colors.white)
102+
103
end
104-
        shell.run("pastebin get v84Q9wC1 startup2") -- Inserire paste di nPay
104+
105-
        if fs.exists("startup2") then
105+
credito = tonumber(tab.v)
106-
            shell.run("rm startup")
106+
107-
            shell.run("mv startup2 startup")
107+
sibRaw = http.get("http://luanet.rgbcraft.com/servlets/carte_debito.php?richiesta=crea&auth=EAD&valore="..credito).readAll()
108-
        end
108+
109-
    end
109+
110
if type(sib) ~= "table" then
111
    errore("Impossibile comunicare con il server interbancario")
112-
m = peripheral.wrap("right")
112+
113-
lbl = "BN Credit"
113+
114
if sib.stato ~= "OK" then
115
    error("Errore irreversibile durante l'attivazione")
116
end
117
118-
print("Inserire la carta")
118+
119
print("Inserire nuovamente la carta per completare l'attivazione")
120-
za, rawcarta = os.pullEvent("mag_swipe")
120+
121
tabr.t = "cd"
122
tabr.e = tab.e
123
tabr.p = tab.p
124-
    cartaVuota()
124+
tabr.v = sib.uuid
125
126
local lbl = "BN Debit Card *" .. string.sub(tostring(sib.uuid), -4)
127
 
128
ncr = textutils.serialize(tabr)
129
 
130-
    cartaNonValida()
130+
131
m.beginWrite(ncr,lbl)
132
os.pullEvent("mag_write_done")
133-
if tab.t == "cc" then
133+
134-
    cartaVecchia()
134+
135
print("")
136
print("Tra poco sarà possibile eseguire un'altra operazione.")
137-
if tab.t ~= "cd" then
137+
sleep(5)
138-
    cartaNonValida()
138+
os.reboot()