View difference between Paste ID: 0M1pB5f3 and 2Lju9eSn
SHOW: | | - or go back to the newest paste.
1-
--Versamenti MINERALI 1.19
1+
--Versamenti contanti 1.19
2
3
--disabilita
4
rs.setOutput("top", true)
5
6
local maxw, maxh = term.getSize()
7
8-
copper = 0
8+
9-
gold = 0
9+
10-
iron = 0
10+
11-
diamond = 0
11+
12-
emerald = 0
12+
coin = 0
13-
steel = 0
13+
coin_8x = 0
14-
glowstone = 0
14+
coin_64x = 0
15-
silver = 0
15+
coin_512x = 0
16-
bronze = 0
16+
coin_4096x = 0
17-
lead = 0
17+
coin_32768x = 0
18-
invar = 0
18+
19-
electrum = 0
19+
20-
nickel = 0
20+
21-
coal = 0
21+
  if v.id == "ic2:coin" then
22-
coal_coke = 0
22+
    coin = coin + v.Count
23-
osmium = 0
23+
  elseif v.id == "ic2:coin_8x" then
24-
salt = 0
24+
    coin_8x = coin_8x + v.Count
25
  elseif v.id == "ic2:coin_64x" then
26
    coin_64x = coin_64x + v.Count
27-
  if v.id == "minecraft:copper_ingot" then
27+
  elseif v.id == "ic2:coin_512x" then
28-
    copper = copper + v.Count
28+
    coin_512x = coin_512x + v.Count
29-
  elseif v.id == "minecraft:gold_ingot" then
29+
  elseif v.id == "ic2:coin_4096x" then
30-
    gold = gold + v.Count
30+
    coin_4096x = coin_4096x + v.Count
31-
  elseif v.id == "minecraft:iron_ingot" then
31+
  elseif v.id == "ic2:coin_32768x" then
32-
    iron = iron + v.Count
32+
    coin_32768x = coin_32768x + v.Count
33-
  elseif v.id == "minecraft:diamond" then
33+
34-
    diamond = diamond + v.Count
34+
35-
  elseif v.id == "minecraft:emerald" then
35+
36-
    emerald = emerald + v.Count
36+
37-
  elseif v.id == "immersiveengineering:ingot_steel" then
37+
38-
    steel = steel + v.Count
38+
39-
  elseif v.id == "railcraft:steel_ingot" then
39+
40-
    steel = steel + v.Count
40+
41-
  elseif v.id == "mekanism:ingot_steel" then
41+
42-
    steel = steel + v.Count
42+
43-
  elseif v.id == "minecraft:glowstone_dust" then
43+
if coin ~= 0 or coin_8x ~= 0 or coin_64x ~= 0 or coin_512x ~= 0 or coin_4096x ~= 0 or coin_32768x ~= 0 then
44-
    glowstone = glowstone + v.Count
44+
45-
  elseif v.id == "ic2:ingot_silver" then
45+
46-
    silver = silver + v.Count
46+
  rs.setOutput("top", false)
47-
  elseif v.id == "thermal:ingot_silver" then
47+
48-
    silver = silver + v.Count
48+
49
    term.write("*---")
50
    sleep(0.5)
51
    term.setCursorPos(3, 3)
52
    term.write("-*--")
53
    sleep(0.5)
54
    term.setCursorPos(3, 3)
55
    term.write("--*-")
56
    sleep(0.5)
57
    term.setCursorPos(3, 3)
58
    term.write("---*")
59-
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
59+
60
  end
61
  rs.setOutput("top", true)
62-
  rs.setOutput("left", true)
62+
63
end
64
65
function clear()
66
    term.clear()
67
    term.setCursorPos(1, 1)
68
end
69
 
70
function clearRed()
71
    sfondo(colors.red)
72
    term.clear()
73
    term.setCursorPos(1, 1)
74
end
75
 
76
function colore(sfumatura) term.setTextColour(sfumatura) end
77-
  rs.setOutput("left", false)
77+
78
function sfondo(sfumaturaSfondo) term.setBackgroundColour(sfumaturaSfondo) end
79
 
80
function fineColore() term.setTextColour(colours.white) end
81
 
82
function fineSfondo() term.setBackgroundColour(colours.black) end
83
 
84
 
85
-- IMPLEMENTAZIONE DEL DRAWFILLEDBOX
86
local function drawPixelInternal(xPos, yPos)
87
    term.setCursorPos(xPos, yPos)
88
    term.write(" ")
89
end
90
 
91
local tColourLookup = {}
92
for n = 1, 16 do
93
    tColourLookup[string.byte("0123456789abcdef", n, n)] = 2 ^ (n - 1)
94
end
95
 
96
function drawFilledBox(startX, startY, endX, endY, nColour)
97
    if type(startX) ~= "number" or type(startX) ~= "number" or type(endX) ~=
98
        "number" or type(endY) ~= "number" or
99
        (nColour ~= nil and type(nColour) ~= "number") then
100
        error("Expected startX, startY, endX, endY, colour", 2)
101
    end
102
 
103
    startX = math.floor(startX)
104
    startY = math.floor(startY)
105
    endX = math.floor(endX)
106
    endY = math.floor(endY)
107
 
108
    if nColour then term.setBackgroundColor(nColour) end
109
    if startX == endX and startY == endY then
110
        drawPixelInternal(startX, startY)
111
        return
112
    end
113
 
114
    local minX = math.min(startX, endX)
115
    if minX == startX then
116
        minY = startY
117
        maxX = endX
118
        maxY = endY
119
    else
120
        minY = endY
121
        maxX = startX
122
        maxY = startY
123
    end
124
 
125
    for x = minX, maxX do for y = minY, maxY do drawPixelInternal(x, y) end end
126
end
127
 
128
 
129
function titolo(testo)
130
    drawFilledBox(1, 1, maxw, 1, colors.yellow)
131
    term.setCursorPos((maxw - #testo) / 2, 1)
132
    colore(colors.black)
133
    term.write(testo)
134
    sfondo(colors.blue)
135
end
136
 
137
function errore(errore)
138
    sfondo(colors.red)
139
    colore(colors.white)
140
    term.clear()
141
    term.setCursorPos(1, 1)
142
    titolo("Errore irreversibile")
143
    term.setCursorPos(1, 3)
144
    sfondo(colors.red)
145
    colore(colors.white)
146
    print(errore)
147
    print("\n\n\nAttendere qualche secondo...")
148
    os.sleep(5)
149
    os.reboot()
150
end
151
152
sfondo(colours.blue)
153
clear()
154
titolo("Banco di Nebraska")
155
sfondo(colours.blue)
156
colore(colors.white)
157
print("\n\nSistema Versamento")
158
print("")
159
print("Premere un tasto per iniziare l'operazione di versamento")
160
event = os.pullEvent()
161
162
    sfondo(colours.blue)
163
    term.clear()
164
    term.setCursorPos(1, 1)
165
    titolo("Accredita su Nebraska Pay")
166
    sfondo(colours.blue)
167
    colore(colors.white)
168
    print(
169
        "\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.")
170-
titolo("Autorità Portuale di New Radeon")
170+
171
    -- nomeutente
172
    term.setCursorPos(1, 9)
173-
print("\n\nVendita Minerali")
173+
174
    term.setCursorPos(15, 9)
175-
print("Premere un tasto per iniziare l'operazione")
175+
176
    utenteAccettato = false
177
    conteggioErrori = 0
178
    while utenteAccettato == false do
179
        utente = read()
180
        utente = string.gsub(utente, "%s", "")
181
        checkuser = http.get(
182
                        "http://luanet.rgbcraft.com/servlets/nebraskapay.php?auth=no&richiesta=verifica&utente=" ..
183
                            utente).readAll()
184
        tabcheckuser = textutils.unserialize(checkuser)
185
        if tabcheckuser.stato == "OK" then
186
            term.setCursorPos(15, 9)
187
            colore(colours.lime)
188
            term.write(utente)
189
            fineColore()
190
            utenteAccettato = true
191
        else
192
            term.setCursorPos(15, 9)
193
            colore(colours.red)
194
            term.write("Utente errato!          ")
195
            sleep(2)
196
            term.setCursorPos(15, 9)
197
            fineColore()
198
            term.write("                       ")
199
            term.setCursorPos(15, 9)
200
            conteggioErrori = conteggioErrori + 1
201
            if conteggioErrori > 2 then
202
                term.setCursorPos(15, 9)
203
                colore(colours.red)
204
                errore("Troppi tentativi di immissione errati    ")
205
            end
206
        end
207
    end
208
    colore(colours.white)
209
    term.setCursorPos(1, 11)
210
    term.write("Password:")
211
    term.setCursorPos(15, 11)
212
    conteggioErrori = 0
213
    passAccettata = false
214
    while passAccettata == false do
215
        fineColore()
216
        password = read("#")
217
        colore(colours.black)
218
        checkuser = http.get(
219
                        "http://luanet.rgbcraft.com/servlets/nebraskapay.php?auth=" ..
220
                            password .. "&richiesta=addebito&valore=0&utente=" ..
221
                            utente).readAll()
222
        risposta = textutils.unserialize(checkuser)
223
        if risposta.stato == "OK" then
224
            term.setCursorPos(15, 11)
225
            colore(colours.lime)
226
            term.write("##############               ")
227
            fineColore()
228
            passAccettata = true
229
        else
230
            term.setCursorPos(15, 11)
231
            colore(colours.red)
232
            term.write("Password errata!            ")
233
            conteggioErrori = conteggioErrori + 1
234
            sleep(2)
235
            term.setCursorPos(15, 11)
236
            term.write("                               ")
237
            term.setCursorPos(15, 11)
238
            if conteggioErrori > 2 then
239
                term.setCursorPos(15, 11)
240
                colore(colours.red)
241
                errore("Troppi tentativi di immissione errati")
242
            end
243
        end
244
    end
245
metodoPagamento = "NPAY"
246
credito = tonumber(risposta.saldo)
247
clear()
248
249
while true do
250
print("Il conto ha un saldo di "..credito.." IC.")
251
print("")
252
print("Per favore scegliere un'opzione utilizzando i tasti numerici e confermare con ENTER:")
253
print("")
254
print("[1] Versare contanti")
255
print("[2] Annullare il versamento")
256
257
num=tonumber(read())
258
if num == 1 then
259
260
clear()
261
redstone.setOutput("right", true)
262
print("Inserire i contanti nello sportello sotto al computer")
263
print("")
264
print("AVVERTENZA IMPORTANTE:")
265
print("Inserire SOLO monete:")
266
print("Oggetti non consentiti vengono rifiutati")
267
print("")
268
print("NON RIAVVIARE IL COMPUTER O SI PERDERA' IL VERSAMENTO")
269
print("")
270-
print("[1] Versare dei minerali")
270+
271
os.pullEvent("key")
272
273
clear()
274
275
redstone.setOutput("right", false)
276
277
print("Conteggio contanti in corso...")
278-
print("Inserire i minerali nello sportello sotto al computer")
278+
279
term.write("*---")
280
sleep(0.5)
281-
print("Inserire SOLO questi minerali:")
281+
282-
print("Minerali non consentiti vengono rifiutati")
282+
283
sleep(0.5)
284
term.setCursorPos(3, 3)
285
term.write("--*-")
286
sleep(0.5)
287
term.setCursorPos(3, 3)
288
term.write("---*")
289
sleep(0.5)
290
291
ben = peripheral.wrap("back")
292
j=ben.getBlockData()
293-
print("Conteggio minerali in corso...")
293+
294
coin = 0
295
coin_8x = 0
296
coin_64x = 0
297
coin_512x = 0
298
coin_4096x = 0
299
coin_32768x = 0
300
301
 
302
for k,v in pairs(j.Items) do
303
  if v.id == "ic2:coin" then
304
    coin = coin + v.Count
305
  elseif v.id == "ic2:coin_8x" then
306
    coin_8x = coin_8x + v.Count
307
  elseif v.id == "ic2:coin_64x" then
308
    coin_64x = coin_64x + v.Count
309
  elseif v.id == "ic2:coin_512x" then
310
    coin_512x = coin_512x + v.Count
311-
copper = 0
311+
  elseif v.id == "ic2:coin_4096x" then
312-
gold = 0
312+
    coin_4096x = coin_4096x + v.Count
313-
iron = 0
313+
  elseif v.id == "ic2:coin_32768x" then
314-
diamond = 0
314+
    coin_32768x = coin_32768x + v.Count
315-
emerald = 0
315+
316-
steel = 0
316+
317-
glowstone = 0
317+
318-
silver = 0
318+
319-
bronze = 0
319+
contanti = coin + coin_8x*8 + coin_64x*64 + coin_512x*512 + coin_4096x*4096 + coin_32768x*32768
320-
lead = 0
320+
321-
invar = 0
321+
322-
electrum = 0
322+
323-
nickel = 0
323+
rs.setOutput("top", false)
324-
coal = 0
324+
325-
coal_coke = 0
325+
326-
osmium = 0
326+
327-
salt = 0
327+
328
                                  "&richiesta=accredito&causale=Vendita%20contanti&valore=" .. contanti).readAll()
329
            risultatoInvio = textutils.unserialize(inviaDenaro)
330-
  if v.id == "minecraft:copper_ingot" then
330+
331-
    copper = copper + v.Count
331+
332-
  elseif v.id == "minecraft:gold_ingot" then
332+
333-
    gold = gold + v.Count
333+
334-
  elseif v.id == "minecraft:iron_ingot" then
334+
335-
    iron = iron + v.Count
335+
336-
  elseif v.id == "minecraft:diamond" then
336+
337-
    diamond = diamond + v.Count
337+
338-
  elseif v.id == "minecraft:emerald" then
338+
339-
    emerald = emerald + v.Count
339+
340-
  elseif v.id == "immersiveengineering:ingot_steel" then
340+
341-
    steel = steel + v.Count
341+
342-
  elseif v.id == "railcraft:steel_ingot" then
342+
343-
    steel = steel + v.Count
343+
344-
  elseif v.id == "mekanism:ingot_steel" then
344+
345-
    steel = steel + v.Count
345+
346-
  elseif v.id == "minecraft:glowstone_dust" then
346+
347-
    glowstone = glowstone + v.Count
347+
rs.setOutput("top", true)
348-
  elseif v.id == "ic2:ingot_silver" then
348+
shell.run("pastebin get 0M1pB5f3 startup2")
349-
    silver = silver + v.Count
349+
350-
  elseif v.id == "thermal:ingot_silver" then
350+
351-
    silver = silver + v.Count
351+
352
    end
353
354
os.reboot()
355-
        
355+
356-
copperIC = copper * 0.3
356+
357-
goldIC = gold * 1
357+
358-
ironIC = iron * 0.001
358+
359
360-
contanti = copperIC + goldIC + ironIC
360+
shell.run("pastebin get 0M1pB5f3 startup2")
361
	if fs.exists("startup2") then
362
		shell.run("rm startup")
363
		shell.run("mv startup2 startup")
364
    end
365
366
term.setTextColor(colors.black)
367
os.reboot()