SHOW:
|
|
- or go back to the newest paste.
| 1 | - | --Versamenti MINERALI |
| 1 | + | -- Versamenti GELATI |
| 2 | local maxw, maxh = term.getSize() | |
| 3 | ||
| 4 | - | --vuota il bancomat |
| 4 | + | -- vuota il bancomat |
| 5 | ben = peripheral.wrap("back")
| |
| 6 | ben.getAvailableItems() | |
| 7 | - | i,j = os.pullEvent("available_items_return")
|
| 7 | + | i, j = os.pullEvent("available_items_return")
|
| 8 | ||
| 9 | - | refTurquoise = 0 |
| 9 | + | conoStracciatella = 0 |
| 10 | - | refOnyx = 0 |
| 10 | + | conoFiordilatte = 0 |
| 11 | - | refAmethyst = 0 |
| 11 | + | conoCioccolato = 0 |
| 12 | - | refCitrine = 0 |
| 12 | + | |
| 13 | - | refEmerald = 0 |
| 13 | + | conoStracciatellaID = ben.getItemIdentifierIDFor(10292, 0) |
| 14 | - | refRuby = 0 |
| 14 | + | conoFiordilatteID = ben.getItemIdentifierIDFor(10293, 0) |
| 15 | - | refSapphire = 0 |
| 15 | + | conoCioccolatoID = ben.getItemIdentifierIDFor(10290, 0) |
| 16 | - | platinum = 0 |
| 16 | + | |
| 17 | - | gold = 0 |
| 17 | + | for k, v in pairs(j) do |
| 18 | - | iridium = 0 |
| 18 | + | if v[1] == conoStracciatellaID then |
| 19 | - | diamond = 0 |
| 19 | + | conoStracciatella = v[2] |
| 20 | - | |
| 20 | + | ben.makeRequest(conoStracciatellaID, v[2]) |
| 21 | - | refTurquoiseID = ben.getItemIdentifierIDFor(31184, 7) |
| 21 | + | |
| 22 | - | refOnyxID = ben.getItemIdentifierIDFor(31184, 8) |
| 22 | + | elseif v[1] == conoFiordilatteID then |
| 23 | - | refAmethystID = ben.getItemIdentifierIDFor(31184, 9) |
| 23 | + | conoFiordilatte = v[2] |
| 24 | - | refCitrineID = ben.getItemIdentifierIDFor(31184, 10) |
| 24 | + | ben.makeRequest(conoFiordilatteID, v[2]) |
| 25 | - | refEmeraldID = ben.getItemIdentifierIDFor(31184, 11) |
| 25 | + | |
| 26 | - | refRubyID = ben.getItemIdentifierIDFor(31184, 12) |
| 26 | + | elseif v[1] == conoCioccolatoID then |
| 27 | - | refSapphireID = ben.getItemIdentifierIDFor(31184, 13) |
| 27 | + | conoCioccolato = v[2] |
| 28 | ben.makeRequest(conoCioccolatoID, v[2]) | |
| 29 | - | platinumID = ben.getItemIdentifierIDFor(21256, 27) |
| 29 | + | sleep(0.1) |
| 30 | - | goldID = ben.getItemIdentifierIDFor(266, 0) |
| 30 | + | |
| 31 | - | iridiumID = ben.getItemIdentifierIDFor(21256, 16) |
| 31 | + | |
| 32 | - | diamondID = ben.getItemIdentifierIDFor(264, 0) |
| 32 | + | |
| 33 | ben.getAvailableItems() | |
| 34 | - | |
| 34 | + | i, j = os.pullEvent("available_items_return")
|
| 35 | - | for k,v in pairs(j) do |
| 35 | + | |
| 36 | - | if v[1] == refTurquoiseID then |
| 36 | + | conoStracciatellaID = ben.getItemIdentifierIDFor(10292, 0) |
| 37 | - | refTurquoise = v[2] |
| 37 | + | conoFiordilatteID = ben.getItemIdentifierIDFor(10293, 0) |
| 38 | - | ben.makeRequest(refTurquoiseID, v[2]) |
| 38 | + | conoCioccolatoID = ben.getItemIdentifierIDFor(10290, 0) |
| 39 | ||
| 40 | - | elseif v[1] == refOnyxID then |
| 40 | + | for k, v in pairs(j) do |
| 41 | - | refOnyx = v[2] |
| 41 | + | if v[1] == conoStracciatellaID then |
| 42 | - | ben.makeRequest(refOnyxID, v[2]) |
| 42 | + | conoStracciatella = v[2] |
| 43 | ben.makeRequest(conoStracciatellaID, v[2]) | |
| 44 | - | elseif v[1] == refAmethystID then |
| 44 | + | |
| 45 | - | refAmethyst = v[2] |
| 45 | + | elseif v[1] == conoFiordilatteID then |
| 46 | - | ben.makeRequest(refAmethystID, v[2]) |
| 46 | + | conoFiordilatte = v[2] |
| 47 | ben.makeRequest(conoFiordilatteID, v[2]) | |
| 48 | - | elseif v[1] == refCitrineID then |
| 48 | + | |
| 49 | - | refCitrine = v[2] |
| 49 | + | elseif v[1] == conoCioccolatoID then |
| 50 | - | ben.makeRequest(refCitrineID, v[2]) |
| 50 | + | conoCioccolato = v[2] |
| 51 | ben.makeRequest(conoCioccolatoID, v[2]) | |
| 52 | - | elseif v[1] == refEmeraldID then |
| 52 | + | sleep(0.1) |
| 53 | - | refEmerald = v[2] |
| 53 | + | |
| 54 | - | ben.makeRequest(refEmeraldID, v[2]) |
| 54 | + | |
| 55 | - | |
| 55 | + | |
| 56 | - | elseif v[1] == refRubyID then |
| 56 | + | |
| 57 | - | refRuby = v[2] |
| 57 | + | |
| 58 | - | ben.makeRequest(refRubyID, v[2]) |
| 58 | + | |
| 59 | end | |
| 60 | - | elseif v[1] == refSapphireID then |
| 60 | + | |
| 61 | - | refSapphire = v[2] |
| 61 | + | if conoStracciatella ~= 0 or conoFiordilatte ~= 0 or conoCioccolato ~= 0 then |
| 62 | - | ben.makeRequest(refSapphireID, v[2]) |
| 62 | + | clear() |
| 63 | - | |
| 63 | + | print("Bancomat temporaneamente non disponibile")
|
| 64 | - | elseif v[1] == platinumID then |
| 64 | + | sleep(60) |
| 65 | - | platinum = v[2] |
| 65 | + | |
| 66 | - | ben.makeRequest(platinumID, v[2]) |
| 66 | + | |
| 67 | - | |
| 67 | + | |
| 68 | - | elseif v[1] == goldID then |
| 68 | + | |
| 69 | - | gold = v[2] |
| 69 | + | |
| 70 | - | ben.makeRequest(goldID, v[2]) |
| 70 | + | |
| 71 | end | |
| 72 | - | elseif v[1] == iridiumID then |
| 72 | + | |
| 73 | - | iridium = v[2] |
| 73 | + | |
| 74 | - | ben.makeRequest(iridiumID, v[2]) |
| 74 | + | |
| 75 | - | |
| 75 | + | |
| 76 | - | elseif v[1] == diamondID then |
| 76 | + | |
| 77 | - | diamond = v[2] |
| 77 | + | |
| 78 | - | ben.makeRequest(diamondID, v[2]) |
| 78 | + | |
| 79 | - | |
| 79 | + | |
| 80 | ||
| 81 | - | sleep(0.1) |
| 81 | + | |
| 82 | ||
| 83 | function fineColore() term.setTextColour(colours.white) end | |
| 84 | ||
| 85 | - | i,j = os.pullEvent("available_items_return")
|
| 85 | + | |
| 86 | - | |
| 86 | + | |
| 87 | - | refTurquoiseID = ben.getItemIdentifierIDFor(31184, 7) |
| 87 | + | |
| 88 | - | refOnyxID = ben.getItemIdentifierIDFor(31184, 8) |
| 88 | + | |
| 89 | - | refAmethystID = ben.getItemIdentifierIDFor(31184, 9) |
| 89 | + | |
| 90 | - | refCitrineID = ben.getItemIdentifierIDFor(31184, 10) |
| 90 | + | |
| 91 | - | refEmeraldID = ben.getItemIdentifierIDFor(31184, 11) |
| 91 | + | |
| 92 | - | refRubyID = ben.getItemIdentifierIDFor(31184, 12) |
| 92 | + | |
| 93 | - | refSapphireID = ben.getItemIdentifierIDFor(31184, 13) |
| 93 | + | |
| 94 | for n = 1, 16 do | |
| 95 | - | platinumID = ben.getItemIdentifierIDFor(21256, 7) |
| 95 | + | |
| 96 | - | goldID = ben.getItemIdentifierIDFor(266, 0) |
| 96 | + | |
| 97 | - | iridiumID = ben.getItemIdentifierIDFor(21256, 16) |
| 97 | + | |
| 98 | - | diamondID = ben.getItemIdentifierIDFor(264, 0) |
| 98 | + | |
| 99 | if type(startX) ~= "number" or type(startX) ~= "number" or type(endX) ~= | |
| 100 | - | for k,v in pairs(j) do |
| 100 | + | |
| 101 | - | if v[1] == refTurquoiseID then |
| 101 | + | |
| 102 | - | refTurquoise = v[2] |
| 102 | + | |
| 103 | - | ben.makeRequest(refTurquoiseID, v[2]) |
| 103 | + | |
| 104 | ||
| 105 | - | elseif v[1] == refOnyxID then |
| 105 | + | |
| 106 | - | refOnyx = v[2] |
| 106 | + | |
| 107 | - | ben.makeRequest(refOnyxID, v[2]) |
| 107 | + | |
| 108 | endY = math.floor(endY) | |
| 109 | - | elseif v[1] == refAmethystID then |
| 109 | + | |
| 110 | - | refAmethyst = v[2] |
| 110 | + | |
| 111 | - | ben.makeRequest(refAmethystID, v[2]) |
| 111 | + | |
| 112 | drawPixelInternal(startX, startY) | |
| 113 | - | elseif v[1] == refCitrineID then |
| 113 | + | |
| 114 | - | refCitrine = v[2] |
| 114 | + | |
| 115 | - | ben.makeRequest(refCitrineID, v[2]) |
| 115 | + | |
| 116 | local minX = math.min(startX, endX) | |
| 117 | - | elseif v[1] == refEmeraldID then |
| 117 | + | |
| 118 | - | refEmerald = v[2] |
| 118 | + | |
| 119 | - | ben.makeRequest(refEmeraldID, v[2]) |
| 119 | + | |
| 120 | - | |
| 120 | + | |
| 121 | - | elseif v[1] == refRubyID then |
| 121 | + | |
| 122 | - | refRuby = v[2] |
| 122 | + | |
| 123 | - | ben.makeRequest(refRubyID, v[2]) |
| 123 | + | |
| 124 | maxY = startY | |
| 125 | - | elseif v[1] == refSapphireID then |
| 125 | + | |
| 126 | - | refSapphire = v[2] |
| 126 | + | |
| 127 | - | ben.makeRequest(refSapphireID, v[2]) |
| 127 | + | |
| 128 | - | |
| 128 | + | |
| 129 | - | elseif v[1] == platinumID then |
| 129 | + | |
| 130 | - | platinum = v[2] |
| 130 | + | |
| 131 | - | ben.makeRequest(platinumID, v[2]) |
| 131 | + | |
| 132 | - | |
| 132 | + | |
| 133 | - | elseif v[1] == goldID then |
| 133 | + | |
| 134 | - | gold = v[2] |
| 134 | + | |
| 135 | - | ben.makeRequest(goldID, v[2]) |
| 135 | + | |
| 136 | end | |
| 137 | - | elseif v[1] == iridiumID then |
| 137 | + | |
| 138 | - | iridium = v[2] |
| 138 | + | |
| 139 | - | ben.makeRequest(iridiumID, v[2]) |
| 139 | + | |
| 140 | - | |
| 140 | + | |
| 141 | - | elseif v[1] == diamondID then |
| 141 | + | |
| 142 | - | diamond = v[2] |
| 142 | + | |
| 143 | - | ben.makeRequest(diamondID, v[2]) |
| 143 | + | |
| 144 | - | |
| 144 | + | |
| 145 | sfondo(colors.red) | |
| 146 | - | sleep(0.1) |
| 146 | + | |
| 147 | print(errore) | |
| 148 | print("\n\n\nAttendere qualche secondo...")
| |
| 149 | os.sleep(5) | |
| 150 | - | function clear() |
| 150 | + | |
| 151 | end | |
| 152 | - | term.setCursorPos(1,1) |
| 152 | + | |
| 153 | clear() | |
| 154 | print("FRIGOR - VENDITA GELATI")
| |
| 155 | print("")
| |
| 156 | - | if platinum ~= 0 or gold ~= 0 or iridium ~= 0 or diamond ~= 0 or refTurquoise ~= 0 or refOnyx ~= 0 or refAmethyst ~= 0 or refCitrine ~= 0 or refEmerald ~= 0 or refSapphire ~= 0 then |
| 156 | + | |
| 157 | - | clear() |
| 157 | + | |
| 158 | - | print("Bancomat temporaneamente non disponibile")
|
| 158 | + | colore(colors.orange) |
| 159 | - | sleep(60) |
| 159 | + | print("ATTENZIONE AVVERTENZA MOLTO IMPORTANTE")
|
| 160 | - | os.reboot() |
| 160 | + | print("1. Accetta SOLO coni gelati. NO vaschette!")
|
| 161 | print( | |
| 162 | "2. In caso di utilizzo del deep, SI DEVE ATTENDERE CHE LO STESSO SIA COMPLETAMENTE VUOTO PRIMA DI PREMERE TASTI SUL COMPUTER.") | |
| 163 | print( | |
| 164 | " Per versare usando il deep, piazzarlo davanti al cubo rosso ED ATTENDERE CHE SIA VUOTO") | |
| 165 | print( | |
| 166 | " In caso contrario il gelato versato verrà distrutto irrimediabilmente!") | |
| 167 | - | |
| 167 | + | |
| 168 | sfondo(colours.blue) | |
| 169 | term.clear() | |
| 170 | term.setCursorPos(1, 1) | |
| 171 | titolo("Accredita su Nebraska Pay")
| |
| 172 | sfondo(colours.blue) | |
| 173 | - | |
| 173 | + | colore(colors.white) |
| 174 | print( | |
| 175 | - | |
| 175 | + | "\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.") |
| 176 | ||
| 177 | - | |
| 177 | + | -- nomeutente |
| 178 | term.setCursorPos(1, 9) | |
| 179 | - | |
| 179 | + | term.write("Nome utente:")
|
| 180 | term.setCursorPos(15, 9) | |
| 181 | - | |
| 181 | + | fineColore() |
| 182 | - | |
| 182 | + | utenteAccettato = false |
| 183 | conteggioErrori = 0 | |
| 184 | while utenteAccettato == false do | |
| 185 | utente = read() | |
| 186 | utente = string.gsub(utente, "%s", "") | |
| 187 | checkuser = http.get( | |
| 188 | - | |
| 188 | + | "http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=no&richiesta=verifica&utente=" .. |
| 189 | utente).readAll() | |
| 190 | tabcheckuser = textutils.unserialize(checkuser) | |
| 191 | if tabcheckuser.stato == "OK" then | |
| 192 | term.setCursorPos(15, 9) | |
| 193 | - | |
| 193 | + | colore(colours.lime) |
| 194 | term.write(utente) | |
| 195 | fineColore() | |
| 196 | utenteAccettato = true | |
| 197 | else | |
| 198 | term.setCursorPos(15, 9) | |
| 199 | colore(colours.red) | |
| 200 | - | |
| 200 | + | term.write("Utente errato! ")
|
| 201 | sleep(2) | |
| 202 | term.setCursorPos(15, 9) | |
| 203 | fineColore() | |
| 204 | term.write(" ")
| |
| 205 | - | |
| 205 | + | term.setCursorPos(15, 9) |
| 206 | conteggioErrori = conteggioErrori + 1 | |
| 207 | if conteggioErrori > 2 then | |
| 208 | term.setCursorPos(15, 9) | |
| 209 | colore(colours.red) | |
| 210 | errore("Troppi tentativi di immissione errati ")
| |
| 211 | - | |
| 211 | + | |
| 212 | end | |
| 213 | end | |
| 214 | colore(colours.white) | |
| 215 | term.setCursorPos(1, 11) | |
| 216 | term.write("Password:")
| |
| 217 | term.setCursorPos(15, 11) | |
| 218 | conteggioErrori = 0 | |
| 219 | passAccettata = false | |
| 220 | while passAccettata == false do | |
| 221 | fineColore() | |
| 222 | - | |
| 222 | + | password = read("#")
|
| 223 | colore(colours.black) | |
| 224 | checkuser = http.get( | |
| 225 | - | |
| 225 | + | "http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=" .. |
| 226 | - | |
| 226 | + | password .. "&richiesta=addebito&valore=0&utente=" .. |
| 227 | utente).readAll() | |
| 228 | risposta = textutils.unserialize(checkuser) | |
| 229 | if risposta.stato == "OK" then | |
| 230 | term.setCursorPos(15, 11) | |
| 231 | colore(colours.lime) | |
| 232 | term.write("############## ")
| |
| 233 | fineColore() | |
| 234 | - | |
| 234 | + | passAccettata = true |
| 235 | else | |
| 236 | term.setCursorPos(15, 11) | |
| 237 | colore(colours.red) | |
| 238 | term.write("Password errata! ")
| |
| 239 | conteggioErrori = conteggioErrori + 1 | |
| 240 | sleep(2) | |
| 241 | term.setCursorPos(15, 11) | |
| 242 | term.write(" ")
| |
| 243 | term.setCursorPos(15, 11) | |
| 244 | if conteggioErrori > 2 then | |
| 245 | term.setCursorPos(15, 11) | |
| 246 | colore(colours.red) | |
| 247 | errore("Troppi tentativi di immissione errati")
| |
| 248 | end | |
| 249 | end | |
| 250 | end | |
| 251 | - | print("Banco di NEBRASKA - Sistema MINERALI")
|
| 251 | + | |
| 252 | credito = tonumber(risposta.saldo) | |
| 253 | clear() | |
| 254 | ||
| 255 | while true do | |
| 256 | - | sfondo(colours.blue) |
| 256 | + | print("Il conto ha un saldo di " .. credito .. " IC.")
|
| 257 | print("")
| |
| 258 | print( | |
| 259 | - | titolo("Accredita su Nebraska Pay")
|
| 259 | + | "Per favore scegliere un'opzione utilizzando i tasti numerici e confermare con ENTER:") |
| 260 | - | sfondo(colours.blue) |
| 260 | + | print("")
|
| 261 | print("[1] Versare dei gelati")
| |
| 262 | print("[2] Annullare il versamento")
| |
| 263 | - | "\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.") |
| 263 | + | |
| 264 | - | |
| 264 | + | num = tonumber(read()) |
| 265 | - | -- nomeutente |
| 265 | + | if num == 1 then |
| 266 | - | term.setCursorPos(1, 9) |
| 266 | + | |
| 267 | - | term.write("Nome utente:")
|
| 267 | + | clear() |
| 268 | - | term.setCursorPos(15, 9) |
| 268 | + | redstone.setOutput("left", true)
|
| 269 | print( | |
| 270 | - | utenteAccettato = false |
| 270 | + | "Inserire i gelati nello sportello a destra oppure collocare il Deep Storage di fronte al cubo rosso o posizionare") |
| 271 | - | conteggioErrori = 0 |
| 271 | + | print("")
|
| 272 | - | while utenteAccettato == false do |
| 272 | + | print("AVVERTENZA IMPORTANTE:")
|
| 273 | - | utente = read() |
| 273 | + | print("Inserire SOLO questi gelati:")
|
| 274 | - | utente = string.gsub(utente, "%s", "") |
| 274 | + | print( |
| 275 | - | checkuser = http.get( |
| 275 | + | "Cono stracciatella, cono fiordilatte, gelato cioccolato, gelato stracciatella, gelato fiordilatte") |
| 276 | - | "http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=no&richiesta=verifica&utente=" .. |
| 276 | + | print("")
|
| 277 | - | utente).readAll() |
| 277 | + | print("NON RIAVVIARE IL COMPUTER O SI PERDERA' IL VERSAMENTO")
|
| 278 | - | tabcheckuser = textutils.unserialize(checkuser) |
| 278 | + | print("")
|
| 279 | - | if tabcheckuser.stato == "OK" then |
| 279 | + | print("Quando si è pronti per continuare, premere un tasto qualsiasi.")
|
| 280 | os.pullEvent("key")
| |
| 281 | - | colore(colours.lime) |
| 281 | + | clear() |
| 282 | - | term.write(utente) |
| 282 | + | |
| 283 | - | fineColore() |
| 283 | + | redstone.setOutput("left", false)
|
| 284 | - | utenteAccettato = true |
| 284 | + | |
| 285 | print("Conteggio gelati in corso...")
| |
| 286 | ||
| 287 | term.setCursorPos(3, 3) | |
| 288 | - | term.write("Utente errato! ")
|
| 288 | + | term.write("*---")
|
| 289 | - | sleep(2) |
| 289 | + | sleep(0.5) |
| 290 | term.setCursorPos(3, 3) | |
| 291 | - | fineColore() |
| 291 | + | term.write("-*--")
|
| 292 | - | term.write(" ")
|
| 292 | + | sleep(0.5) |
| 293 | term.setCursorPos(3, 3) | |
| 294 | - | conteggioErrori = conteggioErrori + 1 |
| 294 | + | term.write("--*-")
|
| 295 | - | if conteggioErrori > 2 then |
| 295 | + | sleep(0.5) |
| 296 | - | term.setCursorPos(15, 9) |
| 296 | + | term.setCursorPos(3, 3) |
| 297 | - | colore(colours.red) |
| 297 | + | term.write("---*")
|
| 298 | - | errore("Troppi tentativi di immissione errati ")
|
| 298 | + | sleep(0.5) |
| 299 | term.setCursorPos(3, 3) | |
| 300 | term.write("--*-")
| |
| 301 | sleep(0.5) | |
| 302 | - | colore(colours.white) |
| 302 | + | term.setCursorPos(3, 3) |
| 303 | - | term.setCursorPos(1, 11) |
| 303 | + | term.write("-*--")
|
| 304 | - | term.write("Password:")
|
| 304 | + | sleep(0.5) |
| 305 | - | term.setCursorPos(15, 11) |
| 305 | + | term.setCursorPos(3, 3) |
| 306 | - | conteggioErrori = 0 |
| 306 | + | term.write("*---")
|
| 307 | - | passAccettata = false |
| 307 | + | sleep(0.5) |
| 308 | - | while passAccettata == false do |
| 308 | + | |
| 309 | ben = peripheral.wrap("back")
| |
| 310 | - | password = read("#")
|
| 310 | + | ben.getAvailableItems() |
| 311 | - | colore(colours.black) |
| 311 | + | i, j = os.pullEvent("available_items_return")
|
| 312 | - | checkuser = http.get( |
| 312 | + | |
| 313 | - | "http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=" .. |
| 313 | + | clear() |
| 314 | - | password .. "&richiesta=addebito&valore=0&utente=" .. |
| 314 | + | |
| 315 | - | utente).readAll() |
| 315 | + | conoStracciatellaID = ben.getItemIdentifierIDFor(10292, 0) |
| 316 | - | risposta = textutils.unserialize(checkuser) |
| 316 | + | conoFiordilatteID = ben.getItemIdentifierIDFor(10293, 0) |
| 317 | - | if risposta.stato == "OK" then |
| 317 | + | conoCioccolatoID = ben.getItemIdentifierIDFor(10290, 0) |
| 318 | ||
| 319 | - | colore(colours.lime) |
| 319 | + | for k, v in pairs(j) do |
| 320 | - | term.write("############## ")
|
| 320 | + | if v[1] == conoStracciatellaID then |
| 321 | - | fineColore() |
| 321 | + | conoStracciatella = v[2] |
| 322 | - | passAccettata = true |
| 322 | + | ben.makeRequest(conoStracciatellaID, v[2]) |
| 323 | ||
| 324 | elseif v[1] == conoFiordilatteID then | |
| 325 | conoFiordilatte = v[2] | |
| 326 | - | term.write("Password errata! ")
|
| 326 | + | ben.makeRequest(conoFiordilatteID, v[2]) |
| 327 | - | conteggioErrori = conteggioErrori + 1 |
| 327 | + | |
| 328 | - | sleep(2) |
| 328 | + | elseif v[1] == conoCioccolatoID then |
| 329 | conoCioccolato = v[2] | |
| 330 | - | term.write(" ")
|
| 330 | + | ben.makeRequest(conoCioccolatoID, v[2]) |
| 331 | sleep(0.1) | |
| 332 | - | if conteggioErrori > 2 then |
| 332 | + | |
| 333 | - | term.setCursorPos(15, 11) |
| 333 | + | |
| 334 | - | colore(colours.red) |
| 334 | + | |
| 335 | - | errore("Troppi tentativi di immissione errati")
|
| 335 | + | conoStracciatellaIC = conoStracciatella * 0.25 |
| 336 | conoFiordilatteIC = conoFiordilatte * 0.23 | |
| 337 | conoCioccolatoIC = conoCioccolato * 0.29 | |
| 338 | ||
| 339 | contanti = conoStracciatellaIC + conoFiordilatteIC + conoCioccolatoIC | |
| 340 | ||
| 341 | print("Totale versato: " .. contanti .. " IC")
| |
| 342 | print("")
| |
| 343 | inviaDenaro = http.get( | |
| 344 | - | print("Il conto ha un saldo di "..credito.." IC.")
|
| 344 | + | "http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=" .. |
| 345 | password .. "&utente=" .. utente .. | |
| 346 | - | print("Per favore scegliere un'opzione utilizzando i tasti numerici e confermare con ENTER:")
|
| 346 | + | "&richiesta=accredito&valore=" .. contanti) |
| 347 | .readAll() | |
| 348 | - | print("[1] Versare dei minerali")
|
| 348 | + | risultatoInvio = textutils.unserialize(inviaDenaro) |
| 349 | - | print("[2] Annullare il versamento")
|
| 349 | + | if risultatoInvio.stato == "OK" then |
| 350 | colore(colors.white) | |
| 351 | - | num=tonumber(read()) |
| 351 | + | |
| 352 | - | if num == 1 then |
| 352 | + | clear() |
| 353 | errore("Errore durante il pagamento")
| |
| 354 | sleep(5) | |
| 355 | - | redstone.setOutput("left", true)
|
| 355 | + | os.reboot() |
| 356 | - | print("Inserire i minerali nello sportello a destra oppure collocare il Deep Storage di fronte al cubo rosso")
|
| 356 | + | |
| 357 | if tonumber(contanti) ~= 0 then | |
| 358 | - | print("AVVERTENZA IMPORTANTE:")
|
| 358 | + | inviaFisco = http.get( |
| 359 | - | print("Inserire SOLO questi minerali:")
|
| 359 | + | "http://172.16.20.220/luanet/servlets/fisco.php?msg=" .. |
| 360 | - | print("Refined Turquoise, Onyx, Ametyhst, Citrine, Emerald, Ruby, Sapphire")
|
| 360 | + | contanti .. "%20IC%20di%20gelati%20-%20" .. |
| 361 | - | print("Platinum Ingot, Gold Ingot, Iridium Ingot, Diamond")
|
| 361 | + | utente) |
| 362 | inviaDGFE = http.get( | |
| 363 | - | print("NON RIAVVIARE IL COMPUTER O SI PERDERA' IL VERSAMENTO")
|
| 363 | + | "http://172.16.20.220/luanet/servlets/dgfe.php?npay_user=" .. |
| 364 | utente .. | |
| 365 | - | print("Quando si è pronti per continuare, premere un tasto qualsiasi.")
|
| 365 | + | "&transaction_type=Gelati%20Frigor&transaction_amount=" .. |
| 366 | - | os.pullEvent("key")
|
| 366 | + | contanti) |
| 367 | end | |
| 368 | sleep(1) | |
| 369 | clear() | |
| 370 | - | redstone.setOutput("left", false)
|
| 370 | + | print("Denaro versato.")
|
| 371 | print("")
| |
| 372 | - | print("Conteggio minerali in corso...")
|
| 372 | + | print("")
|
| 373 | print("Grazie!")
| |
| 374 | - | term.setCursorPos(3, 3) |
| 374 | + | sleep(1) |
| 375 | - | term.write("*---")
|
| 375 | + | term.setTextColor(colors.black) |
| 376 | - | sleep(0.5) |
| 376 | + | shell.run("pastebin get 87bE40Er startup2")
|
| 377 | - | term.setCursorPos(3, 3) |
| 377 | + | if fs.exists("startup2") then
|
| 378 | - | term.write("-*--")
|
| 378 | + | shell.run("rm startup")
|
| 379 | - | sleep(0.5) |
| 379 | + | shell.run("mv startup2 startup")
|
| 380 | - | term.setCursorPos(3, 3) |
| 380 | + | |
| 381 | - | term.write("--*-")
|
| 381 | + | os.reboot() |
| 382 | - | sleep(0.5) |
| 382 | + | elseif num == 2 then |
| 383 | - | term.setCursorPos(3, 3) |
| 383 | + | clear() |
| 384 | - | term.write("---*")
|
| 384 | + | break |
| 385 | - | sleep(0.5) |
| 385 | + | |
| 386 | - | term.setCursorPos(3, 3) |
| 386 | + | |
| 387 | - | term.write("--*-")
|
| 387 | + | |
| 388 | - | sleep(0.5) |
| 388 | + | |
| 389 | - | term.setCursorPos(3, 3) |
| 389 | + | |
| 390 | - | term.write("-*--")
|
| 390 | + | shell.run("pastebin get 87bE40Er startup2")
|
| 391 | - | sleep(0.5) |
| 391 | + | if fs.exists("startup2") then
|
| 392 | - | term.setCursorPos(3, 3) |
| 392 | + | shell.run("rm startup")
|
| 393 | - | term.write("*---")
|
| 393 | + | shell.run("mv startup2 startup")
|
| 394 | - | sleep(0.5) |
| 394 | + | |
| 395 | os.reboot() -- Versamenti GELATI | |
| 396 | local maxw, maxh = term.getSize() | |
| 397 | ||
| 398 | - | i,j = os.pullEvent("available_items_return")
|
| 398 | + | -- vuota il bancomat |
| 399 | ben = peripheral.wrap("back")
| |
| 400 | ben.getAvailableItems() | |
| 401 | i, j = os.pullEvent("available_items_return")
| |
| 402 | - | refTurquoiseID = ben.getItemIdentifierIDFor(31184, 7) |
| 402 | + | |
| 403 | - | refOnyxID = ben.getItemIdentifierIDFor(31184, 8) |
| 403 | + | conoStracciatella = 0 |
| 404 | - | refAmethystID = ben.getItemIdentifierIDFor(31184, 9) |
| 404 | + | conoFiordilatte = 0 |
| 405 | - | refCitrineID = ben.getItemIdentifierIDFor(31184, 10) |
| 405 | + | conoCioccolato = 0 |
| 406 | - | refEmeraldID = ben.getItemIdentifierIDFor(31184, 11) |
| 406 | + | |
| 407 | - | refRubyID = ben.getItemIdentifierIDFor(31184, 12) |
| 407 | + | conoStracciatellaID = ben.getItemIdentifierIDFor(10292, 0) |
| 408 | - | refSapphireID = ben.getItemIdentifierIDFor(31184, 13) |
| 408 | + | conoFiordilatteID = ben.getItemIdentifierIDFor(10293, 0) |
| 409 | - | platinumID = ben.getItemIdentifierIDFor(21256, 7) |
| 409 | + | conoCioccolatoID = ben.getItemIdentifierIDFor(10290, 0) |
| 410 | - | goldID = ben.getItemIdentifierIDFor(266, 0) |
| 410 | + | |
| 411 | - | iridiumID = ben.getItemIdentifierIDFor(21256, 16) |
| 411 | + | for k, v in pairs(j) do |
| 412 | - | diamondID = ben.getItemIdentifierIDFor(264, 0) |
| 412 | + | if v[1] == conoStracciatellaID then |
| 413 | conoStracciatella = v[2] | |
| 414 | - | for k,v in pairs(j) do |
| 414 | + | ben.makeRequest(conoStracciatellaID, v[2]) |
| 415 | - | if v[1] == refTurquoiseID then |
| 415 | + | |
| 416 | - | refTurquoise = v[2] |
| 416 | + | elseif v[1] == conoFiordilatteID then |
| 417 | - | ben.makeRequest(refTurquoiseID, v[2]) |
| 417 | + | conoFiordilatte = v[2] |
| 418 | ben.makeRequest(conoFiordilatteID, v[2]) | |
| 419 | - | elseif v[1] == refOnyxID then |
| 419 | + | |
| 420 | - | refOnyx = v[2] |
| 420 | + | elseif v[1] == conoCioccolatoID then |
| 421 | - | ben.makeRequest(refOnyxID, v[2]) |
| 421 | + | conoCioccolato = v[2] |
| 422 | ben.makeRequest(conoCioccolatoID, v[2]) | |
| 423 | - | elseif v[1] == refAmethystID then |
| 423 | + | sleep(0.1) |
| 424 | - | refAmethyst = v[2] |
| 424 | + | |
| 425 | - | ben.makeRequest(refAmethystID, v[2]) |
| 425 | + | |
| 426 | ||
| 427 | - | elseif v[1] == refCitrineID then |
| 427 | + | |
| 428 | - | refCitrine = v[2] |
| 428 | + | i, j = os.pullEvent("available_items_return")
|
| 429 | - | ben.makeRequest(refCitrineID, v[2]) |
| 429 | + | |
| 430 | conoStracciatellaID = ben.getItemIdentifierIDFor(10292, 0) | |
| 431 | - | elseif v[1] == refEmeraldID then |
| 431 | + | conoFiordilatteID = ben.getItemIdentifierIDFor(10293, 0) |
| 432 | - | refEmerald = v[2] |
| 432 | + | conoCioccolatoID = ben.getItemIdentifierIDFor(10290, 0) |
| 433 | - | ben.makeRequest(refEmeraldID, v[2]) |
| 433 | + | |
| 434 | - | |
| 434 | + | for k, v in pairs(j) do |
| 435 | - | elseif v[1] == refRubyID then |
| 435 | + | if v[1] == conoStracciatellaID then |
| 436 | - | refRuby = v[2] |
| 436 | + | conoStracciatella = v[2] |
| 437 | - | ben.makeRequest(refRubyID, v[2]) |
| 437 | + | ben.makeRequest(conoStracciatellaID, v[2]) |
| 438 | ||
| 439 | - | elseif v[1] == refSapphireID then |
| 439 | + | elseif v[1] == conoFiordilatteID then |
| 440 | - | refSapphire = v[2] |
| 440 | + | conoFiordilatte = v[2] |
| 441 | - | ben.makeRequest(refSapphireID, v[2]) |
| 441 | + | ben.makeRequest(conoFiordilatteID, v[2]) |
| 442 | - | |
| 442 | + | |
| 443 | - | elseif v[1] == platinumID then |
| 443 | + | elseif v[1] == conoCioccolatoID then |
| 444 | - | platinum = v[2] |
| 444 | + | conoCioccolato = v[2] |
| 445 | - | ben.makeRequest(platinumID, v[2]) |
| 445 | + | ben.makeRequest(conoCioccolatoID, v[2]) |
| 446 | - | |
| 446 | + | sleep(0.1) |
| 447 | - | elseif v[1] == goldID then |
| 447 | + | |
| 448 | - | gold = v[2] |
| 448 | + | |
| 449 | - | ben.makeRequest(goldID, v[2]) |
| 449 | + | |
| 450 | function clear() | |
| 451 | - | elseif v[1] == iridiumID then |
| 451 | + | |
| 452 | - | iridium = v[2] |
| 452 | + | |
| 453 | - | ben.makeRequest(iridiumID, v[2]) |
| 453 | + | |
| 454 | - | |
| 454 | + | |
| 455 | - | elseif v[1] == diamondID then |
| 455 | + | if conoStracciatella ~= 0 or conoFiordilatte ~= 0 or conoCioccolato then |
| 456 | - | diamond = v[2] |
| 456 | + | clear() |
| 457 | - | ben.makeRequest(diamondID, v[2]) |
| 457 | + | print("Bancomat temporaneamente non disponibile")
|
| 458 | - | |
| 458 | + | sleep(60) |
| 459 | os.reboot() | |
| 460 | - | sleep(0.1) |
| 460 | + | |
| 461 | ||
| 462 | - | |
| 462 | + | |
| 463 | - | refTurquoiseIC = refTurquoise * 0.5 |
| 463 | + | |
| 464 | - | refOnyxIC = refOnyx * 0.5 |
| 464 | + | |
| 465 | - | refAmethystIC = refAmethyst * 0.25 |
| 465 | + | |
| 466 | - | refCitrineIC = refCitrine * 0.5 |
| 466 | + | |
| 467 | - | refEmeraldIC = refEmerald * 0.5 |
| 467 | + | |
| 468 | - | refRubyIC = refRuby * 0.25 |
| 468 | + | |
| 469 | - | refSapphireIC = refSapphire * 0.5 |
| 469 | + | |
| 470 | - | platinumIC = platinum * 0.31 |
| 470 | + | |
| 471 | - | goldIC = gold * 0.33 |
| 471 | + | |
| 472 | - | iridiumIC = iridium * 5 |
| 472 | + | |
| 473 | - | diamondIC = diamond * 6.4 |
| 473 | + | |
| 474 | ||
| 475 | - | contanti = refTurquoiseIC + refOnyxIC + refAmethystIC + refCitrineIC + refEmeraldIC + refRubyIC + platinumIC + iridiumIC + goldIC + diamondIC |
| 475 | + | |
| 476 | ||
| 477 | function fineColore() term.setTextColour(colours.white) end | |
| 478 | - | print("Totale versato: "..contanti.." IC")
|
| 478 | + | |
| 479 | function fineSfondo() term.setBackgroundColour(colours.black) end | |
| 480 | - | inviaDenaro = http.get( |
| 480 | + | |
| 481 | - | "http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=" .. |
| 481 | + | |
| 482 | - | password .. "&utente=" .. utente .. |
| 482 | + | |
| 483 | - | "&richiesta=accredito&causale=Vendita%20minerali&valore=" .. contanti).readAll() |
| 483 | + | |
| 484 | - | risultatoInvio = textutils.unserialize(inviaDenaro) |
| 484 | + | |
| 485 | - | if risultatoInvio.stato == "OK" then |
| 485 | + | |
| 486 | - | colore(colors.white) |
| 486 | + | |
| 487 | - | else |
| 487 | + | |
| 488 | - | clear() |
| 488 | + | |
| 489 | - | errore("Errore durante il pagamento")
|
| 489 | + | |
| 490 | - | sleep(5) |
| 490 | + | |
| 491 | - | os.reboot() |
| 491 | + | |
| 492 | function drawFilledBox(startX, startY, endX, endY, nColour) | |
| 493 | - | if tonumber(contanti) ~= 0 then |
| 493 | + | |
| 494 | - | inviaFisco = http.get("http://172.16.20.220/luanet/servlets/fisco.php?msg=" .. contanti .. "%20IC%20di%20minerali%20-%20" .. utente)
|
| 494 | + | |
| 495 | - | inviaDGFE = http.get("http://172.16.20.220/luanet/servlets/dgfe.php?npay_user=" .. utente .. "&transaction_type=Minerali&transaction_amount=" .. contanti)
|
| 495 | + | |
| 496 | error("Expected startX, startY, endX, endY, colour", 2)
| |
| 497 | - | sleep(1) |
| 497 | + | |
| 498 | ||
| 499 | - | print("Denaro versato.")
|
| 499 | + | |
| 500 | startY = math.floor(startY) | |
| 501 | endX = math.floor(endX) | |
| 502 | - | print("Grazie!")
|
| 502 | + | |
| 503 | - | sleep(1) |
| 503 | + | |
| 504 | if nColour then term.setBackgroundColor(nColour) end | |
| 505 | - | shell.run("pastebin get ksz0rxCx startup2")
|
| 505 | + | |
| 506 | - | if fs.exists("startup2") then
|
| 506 | + | |
| 507 | - | shell.run("rm startup")
|
| 507 | + | |
| 508 | - | shell.run("mv startup2 startup")
|
| 508 | + | |
| 509 | ||
| 510 | local minX = math.min(startX, endX) | |
| 511 | - | elseif num == 2 then clear() break end |
| 511 | + | |
| 512 | minY = startY | |
| 513 | maxX = endX | |
| 514 | maxY = endY | |
| 515 | else | |
| 516 | - | shell.run("rm startup")
|
| 516 | + | |
| 517 | - | shell.run("pastebin get ksz0rxCx startup")
|
| 517 | + | |
| 518 | - | os.reboot() |
| 518 | + | |
| 519 | end | |
| 520 | ||
| 521 | for x = minX, maxX do for y = minY, maxY do drawPixelInternal(x, y) end end | |
| 522 | end | |
| 523 | ||
| 524 | function titolo(testo) | |
| 525 | drawFilledBox(1, 1, maxw, 1, colors.yellow) | |
| 526 | term.setCursorPos((maxw - #testo) / 2, 1) | |
| 527 | colore(colors.black) | |
| 528 | term.write(testo) | |
| 529 | sfondo(colors.blue) | |
| 530 | end | |
| 531 | ||
| 532 | function errore(errore) | |
| 533 | sfondo(colors.red) | |
| 534 | colore(colors.white) | |
| 535 | term.clear() | |
| 536 | term.setCursorPos(1, 1) | |
| 537 | titolo("Errore irreversibile")
| |
| 538 | term.setCursorPos(1, 3) | |
| 539 | sfondo(colors.red) | |
| 540 | colore(colors.white) | |
| 541 | print(errore) | |
| 542 | print("\n\n\nAttendere qualche secondo...")
| |
| 543 | os.sleep(5) | |
| 544 | os.reboot() | |
| 545 | end | |
| 546 | ||
| 547 | clear() | |
| 548 | print("FRIGOR - VENDITA GELATI")
| |
| 549 | print("")
| |
| 550 | print("Premere un tasto per iniziare l'operazione")
| |
| 551 | print("")
| |
| 552 | colore(colors.orange) | |
| 553 | print("ATTENZIONE AVVERTENZA MOLTO IMPORTANTE")
| |
| 554 | print("1. Accetta SOLO coni gelati. NO vaschette!")
| |
| 555 | print( | |
| 556 | "2. In caso di utilizzo del deep, SI DEVE ATTENDERE CHE LO STESSO SIA COMPLETAMENTE VUOTO PRIMA DI PREMERE TASTI SUL COMPUTER.") | |
| 557 | print( | |
| 558 | " Per versare usando il deep, piazzarlo davanti al cubo rosso ED ATTENDERE CHE SIA VUOTO") | |
| 559 | print( | |
| 560 | " In caso contrario il gelato versato verrà distrutto irrimediabilmente!") | |
| 561 | event = os.pullEvent() | |
| 562 | ||
| 563 | sfondo(colours.blue) | |
| 564 | term.clear() | |
| 565 | term.setCursorPos(1, 1) | |
| 566 | titolo("Accredita su Nebraska Pay")
| |
| 567 | sfondo(colours.blue) | |
| 568 | colore(colors.white) | |
| 569 | print( | |
| 570 | "\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.") | |
| 571 | ||
| 572 | -- nomeutente | |
| 573 | term.setCursorPos(1, 9) | |
| 574 | term.write("Nome utente:")
| |
| 575 | term.setCursorPos(15, 9) | |
| 576 | fineColore() | |
| 577 | utenteAccettato = false | |
| 578 | conteggioErrori = 0 | |
| 579 | while utenteAccettato == false do | |
| 580 | utente = read() | |
| 581 | utente = string.gsub(utente, "%s", "") | |
| 582 | checkuser = http.get( | |
| 583 | "http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=no&richiesta=verifica&utente=" .. | |
| 584 | utente).readAll() | |
| 585 | tabcheckuser = textutils.unserialize(checkuser) | |
| 586 | if tabcheckuser.stato == "OK" then | |
| 587 | term.setCursorPos(15, 9) | |
| 588 | colore(colours.lime) | |
| 589 | term.write(utente) | |
| 590 | fineColore() | |
| 591 | utenteAccettato = true | |
| 592 | else | |
| 593 | term.setCursorPos(15, 9) | |
| 594 | colore(colours.red) | |
| 595 | term.write("Utente errato! ")
| |
| 596 | sleep(2) | |
| 597 | term.setCursorPos(15, 9) | |
| 598 | fineColore() | |
| 599 | term.write(" ")
| |
| 600 | term.setCursorPos(15, 9) | |
| 601 | conteggioErrori = conteggioErrori + 1 | |
| 602 | if conteggioErrori > 2 then | |
| 603 | term.setCursorPos(15, 9) | |
| 604 | colore(colours.red) | |
| 605 | errore("Troppi tentativi di immissione errati ")
| |
| 606 | end | |
| 607 | end | |
| 608 | end | |
| 609 | colore(colours.white) | |
| 610 | term.setCursorPos(1, 11) | |
| 611 | term.write("Password:")
| |
| 612 | term.setCursorPos(15, 11) | |
| 613 | conteggioErrori = 0 | |
| 614 | passAccettata = false | |
| 615 | while passAccettata == false do | |
| 616 | fineColore() | |
| 617 | password = read("#")
| |
| 618 | colore(colours.black) | |
| 619 | checkuser = http.get( | |
| 620 | "http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=" .. | |
| 621 | password .. "&richiesta=addebito&valore=0&utente=" .. | |
| 622 | utente).readAll() | |
| 623 | risposta = textutils.unserialize(checkuser) | |
| 624 | if risposta.stato == "OK" then | |
| 625 | term.setCursorPos(15, 11) | |
| 626 | colore(colours.lime) | |
| 627 | term.write("############## ")
| |
| 628 | fineColore() | |
| 629 | passAccettata = true | |
| 630 | else | |
| 631 | term.setCursorPos(15, 11) | |
| 632 | colore(colours.red) | |
| 633 | term.write("Password errata! ")
| |
| 634 | conteggioErrori = conteggioErrori + 1 | |
| 635 | sleep(2) | |
| 636 | term.setCursorPos(15, 11) | |
| 637 | term.write(" ")
| |
| 638 | term.setCursorPos(15, 11) | |
| 639 | if conteggioErrori > 2 then | |
| 640 | term.setCursorPos(15, 11) | |
| 641 | colore(colours.red) | |
| 642 | errore("Troppi tentativi di immissione errati")
| |
| 643 | end | |
| 644 | end | |
| 645 | end | |
| 646 | metodoPagamento = "NPAY" | |
| 647 | credito = tonumber(risposta.saldo) | |
| 648 | clear() | |
| 649 | ||
| 650 | while true do | |
| 651 | print("Il conto ha un saldo di " .. credito .. " IC.")
| |
| 652 | print("")
| |
| 653 | print( | |
| 654 | "Per favore scegliere un'opzione utilizzando i tasti numerici e confermare con ENTER:") | |
| 655 | print("")
| |
| 656 | print("[1] Versare dei gelati")
| |
| 657 | print("[2] Annullare il versamento")
| |
| 658 | ||
| 659 | num = tonumber(read()) | |
| 660 | if num == 1 then | |
| 661 | ||
| 662 | clear() | |
| 663 | redstone.setOutput("left", true)
| |
| 664 | print( | |
| 665 | "Inserire i gelati nello sportello a destra oppure collocare il Deep Storage di fronte al cubo rosso o posizionare") | |
| 666 | print("")
| |
| 667 | print("AVVERTENZA IMPORTANTE:")
| |
| 668 | print("Inserire SOLO questi gelati:")
| |
| 669 | print( | |
| 670 | "Cono stracciatella, cono fiordilatte, gelato cioccolato, gelato stracciatella, gelato fiordilatte") | |
| 671 | print("")
| |
| 672 | print("NON RIAVVIARE IL COMPUTER O SI PERDERA' IL VERSAMENTO")
| |
| 673 | print("")
| |
| 674 | print("Quando si è pronti per continuare, premere un tasto qualsiasi.")
| |
| 675 | os.pullEvent("key")
| |
| 676 | ||
| 677 | clear() | |
| 678 | ||
| 679 | redstone.setOutput("left", false)
| |
| 680 | ||
| 681 | print("Conteggio gelati in corso...")
| |
| 682 | ||
| 683 | term.setCursorPos(3, 3) | |
| 684 | term.write("*---")
| |
| 685 | sleep(0.5) | |
| 686 | term.setCursorPos(3, 3) | |
| 687 | term.write("-*--")
| |
| 688 | sleep(0.5) | |
| 689 | term.setCursorPos(3, 3) | |
| 690 | term.write("--*-")
| |
| 691 | sleep(0.5) | |
| 692 | term.setCursorPos(3, 3) | |
| 693 | term.write("---*")
| |
| 694 | sleep(0.5) | |
| 695 | term.setCursorPos(3, 3) | |
| 696 | term.write("--*-")
| |
| 697 | sleep(0.5) | |
| 698 | term.setCursorPos(3, 3) | |
| 699 | term.write("-*--")
| |
| 700 | sleep(0.5) | |
| 701 | term.setCursorPos(3, 3) | |
| 702 | term.write("*---")
| |
| 703 | sleep(0.5) | |
| 704 | ||
| 705 | ben = peripheral.wrap("back")
| |
| 706 | ben.getAvailableItems() | |
| 707 | i, j = os.pullEvent("available_items_return")
| |
| 708 | ||
| 709 | clear() | |
| 710 | ||
| 711 | conoStracciatellaID = ben.getItemIdentifierIDFor(10292, 0) | |
| 712 | conoFiordilatteID = ben.getItemIdentifierIDFor(10293, 0) | |
| 713 | conoCioccolatoID = ben.getItemIdentifierIDFor(10290, 0) | |
| 714 | ||
| 715 | for k, v in pairs(j) do | |
| 716 | if v[1] == conoStracciatellaID then | |
| 717 | conoStracciatella = v[2] | |
| 718 | ben.makeRequest(conoStracciatellaID, v[2]) | |
| 719 | ||
| 720 | elseif v[1] == conoFiordilatteID then | |
| 721 | conoFiordilatte = v[2] | |
| 722 | ben.makeRequest(conoFiordilatteID, v[2]) | |
| 723 | ||
| 724 | elseif v[1] == conoCioccolatoID then | |
| 725 | conoCioccolato = v[2] | |
| 726 | ben.makeRequest(conoCioccolatoID, v[2]) | |
| 727 | sleep(0.1) | |
| 728 | end | |
| 729 | end | |
| 730 | ||
| 731 | conoStracciatellaIC = conoStracciatella * 0.45 | |
| 732 | conoFiordilatteIC = conoFiordilatte * 0.43 | |
| 733 | conoCioccolatoIC = conoCioccolato * 0.49 | |
| 734 | ||
| 735 | contanti = conoStracciatellaIC + conoFiordilatteIC + conoCioccolatoIC | |
| 736 | ||
| 737 | print("Totale versato: " .. contanti .. " IC")
| |
| 738 | print("")
| |
| 739 | inviaDenaro = http.get( | |
| 740 | "http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=" .. | |
| 741 | password .. "&utente=" .. utente .. | |
| 742 | "&richiesta=accredito&valore=" .. contanti) | |
| 743 | .readAll() | |
| 744 | risultatoInvio = textutils.unserialize(inviaDenaro) | |
| 745 | if risultatoInvio.stato == "OK" then | |
| 746 | colore(colors.white) | |
| 747 | else | |
| 748 | clear() | |
| 749 | errore("Errore durante il pagamento")
| |
| 750 | sleep(5) | |
| 751 | os.reboot() | |
| 752 | end | |
| 753 | if tonumber(contanti) ~= 0 then | |
| 754 | inviaFisco = http.get( | |
| 755 | "http://172.16.20.220/luanet/servlets/fisco.php?msg=" .. | |
| 756 | contanti .. "%20IC%20di%20gelati%20-%20" .. | |
| 757 | utente) | |
| 758 | inviaDGFE = http.get( | |
| 759 | "http://172.16.20.220/luanet/servlets/dgfe.php?npay_user=" .. | |
| 760 | utente .. | |
| 761 | "&transaction_type=Gelati%20Frigor&transaction_amount=" .. | |
| 762 | contanti) | |
| 763 | end | |
| 764 | sleep(1) | |
| 765 | clear() | |
| 766 | print("Denaro versato.")
| |
| 767 | print("")
| |
| 768 | print("")
| |
| 769 | print("Grazie!")
| |
| 770 | sleep(1) | |
| 771 | term.setTextColor(colors.black) | |
| 772 | shell.run("pastebin get 87bE40Er startup2")
| |
| 773 | if fs.exists("startup2") then
| |
| 774 | shell.run("rm startup")
| |
| 775 | shell.run("mv startup2 startup")
| |
| 776 | end | |
| 777 | os.reboot() | |
| 778 | elseif num == 2 then | |
| 779 | clear() | |
| 780 | break | |
| 781 | end | |
| 782 | end | |
| 783 | clear() | |
| 784 | print("Attendere")
| |
| 785 | term.setTextColor(colors.black) | |
| 786 | shell.run("pastebin get 87bE40Er startup2")
| |
| 787 | if fs.exists("startup2") then
| |
| 788 | shell.run("rm startup")
| |
| 789 | shell.run("mv startup2 startup")
| |
| 790 | end | |
| 791 | os.reboot() | |
| 792 |