SHOW:
|
|
- or go back to the newest paste.
| 1 | - | --Versamenti ORO V2 lego11 |
| 1 | + | --Versamenti MINERALI |
| 2 | - | --VARIABILI |
| 2 | + | local maxw, maxh = term.getSize() |
| 3 | - | local lbl = "BN Credit" |
| 3 | + | |
| 4 | - | local tabr = {}
|
| 4 | + | |
| 5 | - | local contanti = 0 |
| 5 | + | |
| 6 | - | local conteggio = 0 |
| 6 | + | |
| 7 | i,j = os.pullEvent("available_items_return")
| |
| 8 | ||
| 9 | refTurquoise = 0 | |
| 10 | refOnyx = 0 | |
| 11 | refAmethyst = 0 | |
| 12 | refCitrine = 0 | |
| 13 | refEmerald = 0 | |
| 14 | - | copper = 0 |
| 14 | + | refRuby = 0 |
| 15 | refSapphire = 0 | |
| 16 | - | inox = 0 |
| 16 | + | platinum = 0 |
| 17 | - | silver = 0 |
| 17 | + | |
| 18 | iridium = 0 | |
| 19 | diamond = 0 | |
| 20 | - | copperID = ben.getItemIdentifierIDFor(21256, 0) |
| 20 | + | |
| 21 | - | inoxID = ben.getItemIdentifierIDFor(30186, 0) |
| 21 | + | refTurquoiseID = ben.getItemIdentifierIDFor(31184, 7) |
| 22 | - | silverID = ben.getItemIdentifierIDFor(21256, 1) |
| 22 | + | refOnyxID = ben.getItemIdentifierIDFor(31184, 8) |
| 23 | - | goldID = ben.getItemIdentifierIDFor(21256, 2) |
| 23 | + | refAmethystID = ben.getItemIdentifierIDFor(31184, 9) |
| 24 | - | diamondID = ben.getItemIdentifierIDFor(21256, 3) |
| 24 | + | refCitrineID = ben.getItemIdentifierIDFor(31184, 10) |
| 25 | refEmeraldID = ben.getItemIdentifierIDFor(31184, 11) | |
| 26 | refRubyID = ben.getItemIdentifierIDFor(31184, 12) | |
| 27 | refSapphireID = ben.getItemIdentifierIDFor(31184, 13) | |
| 28 | - | if v[1] == inoxID then |
| 28 | + | |
| 29 | - | inox = v[2] |
| 29 | + | platinumID = ben.getItemIdentifierIDFor(21256, 27) |
| 30 | - | ben.makeRequest(inoxID, v[2]) |
| 30 | + | goldID = ben.getItemIdentifierIDFor(266, 0) |
| 31 | iridiumID = ben.getItemIdentifierIDFor(21256, 16) | |
| 32 | diamondID = ben.getItemIdentifierIDFor(264, 0) | |
| 33 | ||
| 34 | ||
| 35 | for k,v in pairs(j) do | |
| 36 | if v[1] == refTurquoiseID then | |
| 37 | - | elseif v[1] == copperID then |
| 37 | + | refTurquoise = v[2] |
| 38 | - | copper = v[2] |
| 38 | + | ben.makeRequest(refTurquoiseID, v[2]) |
| 39 | - | ben.makeRequest(copperID, v[2]) |
| 39 | + | |
| 40 | - | elseif v[1] == silverID then |
| 40 | + | elseif v[1] == refOnyxID then |
| 41 | - | silver = v[2] |
| 41 | + | refOnyx = v[2] |
| 42 | - | ben.makeRequest(silverID, v[2]) |
| 42 | + | ben.makeRequest(refOnyxID, v[2]) |
| 43 | - | end |
| 43 | + | |
| 44 | elseif v[1] == refAmethystID then | |
| 45 | refAmethyst = v[2] | |
| 46 | ben.makeRequest(refAmethystID, v[2]) | |
| 47 | ||
| 48 | elseif v[1] == refCitrineID then | |
| 49 | refCitrine = v[2] | |
| 50 | - | copperID = ben.getItemIdentifierIDFor(21256, 0) |
| 50 | + | ben.makeRequest(refCitrineID, v[2]) |
| 51 | - | inoxID = ben.getItemIdentifierIDFor(30186, 0) |
| 51 | + | |
| 52 | - | silverID = ben.getItemIdentifierIDFor(21256, 1) |
| 52 | + | elseif v[1] == refEmeraldID then |
| 53 | - | goldID = ben.getItemIdentifierIDFor(21256, 2) |
| 53 | + | refEmerald = v[2] |
| 54 | - | diamondID = ben.getItemIdentifierIDFor(21256, 3) |
| 54 | + | ben.makeRequest(refEmeraldID, v[2]) |
| 55 | ||
| 56 | elseif v[1] == refRubyID then | |
| 57 | refRuby = v[2] | |
| 58 | - | if v[1] == inoxID then |
| 58 | + | ben.makeRequest(refRubyID, v[2]) |
| 59 | - | inox = v[2] |
| 59 | + | |
| 60 | - | ben.makeRequest(inoxID, v[2]) |
| 60 | + | elseif v[1] == refSapphireID then |
| 61 | refSapphire = v[2] | |
| 62 | ben.makeRequest(refSapphireID, v[2]) | |
| 63 | ||
| 64 | elseif v[1] == platinumID then | |
| 65 | platinum = v[2] | |
| 66 | ben.makeRequest(platinumID, v[2]) | |
| 67 | - | elseif v[1] == copperID then |
| 67 | + | |
| 68 | - | copper = v[2] |
| 68 | + | |
| 69 | - | ben.makeRequest(copperID, v[2]) |
| 69 | + | |
| 70 | - | elseif v[1] == silverID then |
| 70 | + | |
| 71 | - | silver = v[2] |
| 71 | + | |
| 72 | - | ben.makeRequest(silverID, v[2]) |
| 72 | + | elseif v[1] == iridiumID then |
| 73 | - | end |
| 73 | + | iridium = v[2] |
| 74 | ben.makeRequest(iridiumID, v[2]) | |
| 75 | ||
| 76 | elseif v[1] == diamondID then | |
| 77 | diamond = v[2] | |
| 78 | ben.makeRequest(diamondID, v[2]) | |
| 79 | ||
| 80 | end | |
| 81 | sleep(0.1) | |
| 82 | end | |
| 83 | - | if copper ~= 0 or gold ~= 0 or inox ~= 0 or silver ~= 0 or diamond ~= 0 then |
| 83 | + | |
| 84 | ben.getAvailableItems() | |
| 85 | i,j = os.pullEvent("available_items_return")
| |
| 86 | ||
| 87 | refTurquoiseID = ben.getItemIdentifierIDFor(31184, 7) | |
| 88 | refOnyxID = ben.getItemIdentifierIDFor(31184, 8) | |
| 89 | refAmethystID = ben.getItemIdentifierIDFor(31184, 9) | |
| 90 | - | function pinErrato() |
| 90 | + | refCitrineID = ben.getItemIdentifierIDFor(31184, 10) |
| 91 | refEmeraldID = ben.getItemIdentifierIDFor(31184, 11) | |
| 92 | - | print("Errore di verifica del PIN")
|
| 92 | + | refRubyID = ben.getItemIdentifierIDFor(31184, 12) |
| 93 | refSapphireID = ben.getItemIdentifierIDFor(31184, 13) | |
| 94 | - | print("Premere un tasto per uscire")
|
| 94 | + | |
| 95 | platinumID = ben.getItemIdentifierIDFor(21256, 7) | |
| 96 | goldID = ben.getItemIdentifierIDFor(266, 0) | |
| 97 | iridiumID = ben.getItemIdentifierIDFor(21256, 16) | |
| 98 | diamondID = ben.getItemIdentifierIDFor(264, 0) | |
| 99 | ||
| 100 | - | function cartaNonValida() |
| 100 | + | |
| 101 | if v[1] == refTurquoiseID then | |
| 102 | - | print("Carta non valida o corrotta.")
|
| 102 | + | refTurquoise = v[2] |
| 103 | ben.makeRequest(refTurquoiseID, v[2]) | |
| 104 | - | print("Premere un tasto per uscire")
|
| 104 | + | |
| 105 | elseif v[1] == refOnyxID then | |
| 106 | refOnyx = v[2] | |
| 107 | ben.makeRequest(refOnyxID, v[2]) | |
| 108 | ||
| 109 | - | function cartaVuota() |
| 109 | + | elseif v[1] == refAmethystID then |
| 110 | refAmethyst = v[2] | |
| 111 | - | print("Carta smagnetizzata.")
|
| 111 | + | ben.makeRequest(refAmethystID, v[2]) |
| 112 | ||
| 113 | - | print("Premere un tasto per uscire")
|
| 113 | + | elseif v[1] == refCitrineID then |
| 114 | refCitrine = v[2] | |
| 115 | ben.makeRequest(refCitrineID, v[2]) | |
| 116 | ||
| 117 | elseif v[1] == refEmeraldID then | |
| 118 | - | function accredita() |
| 118 | + | refEmerald = v[2] |
| 119 | - | tabr.t = tab.t |
| 119 | + | ben.makeRequest(refEmeraldID, v[2]) |
| 120 | - | tabr.e = tab.e |
| 120 | + | |
| 121 | - | tabr.p = tab.p |
| 121 | + | elseif v[1] == refRubyID then |
| 122 | - | tabr.v = tostring(credito + contanti) |
| 122 | + | refRuby = v[2] |
| 123 | ben.makeRequest(refRubyID, v[2]) | |
| 124 | - | ncr = textutils.serialize(tabr) |
| 124 | + | |
| 125 | elseif v[1] == refSapphireID then | |
| 126 | - | m.setInsertCardLight(true) |
| 126 | + | refSapphire = v[2] |
| 127 | - | m.beginWrite(ncr,lbl) |
| 127 | + | ben.makeRequest(refSapphireID, v[2]) |
| 128 | - | os.pullEvent("mag_write_done")
|
| 128 | + | |
| 129 | - | m.setInsertCardLight(false) |
| 129 | + | elseif v[1] == platinumID then |
| 130 | platinum = v[2] | |
| 131 | ben.makeRequest(platinumID, v[2]) | |
| 132 | - | function oggettiEstranei() |
| 132 | + | |
| 133 | elseif v[1] == goldID then | |
| 134 | - | print("ATTENZIONE: RILEVATI OGGETTI ESTRANEI NELLA CASSAFORTE VERSAMENTI")
|
| 134 | + | |
| 135 | ben.makeRequest(goldID, v[2]) | |
| 136 | ||
| 137 | - | print("Rimuovere gli oggetti estranei e premere un tasto per uscire")
|
| 137 | + | elseif v[1] == iridiumID then |
| 138 | iridium = v[2] | |
| 139 | ben.makeRequest(iridiumID, v[2]) | |
| 140 | ||
| 141 | elseif v[1] == diamondID then | |
| 142 | diamond = v[2] | |
| 143 | ben.makeRequest(diamondID, v[2]) | |
| 144 | ||
| 145 | end | |
| 146 | sleep(0.1) | |
| 147 | - | m = peripheral.wrap("right")
|
| 147 | + | |
| 148 | ||
| 149 | ||
| 150 | - | print("Banco di NEBRASKA - Sistema VERSAMENTI")
|
| 150 | + | |
| 151 | term.clear() | |
| 152 | - | print("Inserire la carta")
|
| 152 | + | |
| 153 | - | m.setInsertCardLight(true) |
| 153 | + | |
| 154 | - | za,rawcarta = os.pullEvent("mag_swipe")
|
| 154 | + | |
| 155 | - | m.setInsertCardLight(false) |
| 155 | + | |
| 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 | |
| 157 | - | if rawcarta == nil then |
| 157 | + | |
| 158 | - | cartaVuota() |
| 158 | + | |
| 159 | sleep(60) | |
| 160 | os.reboot() | |
| 161 | - | tab = textutils.unserialize(rawcarta) |
| 161 | + | |
| 162 | ||
| 163 | - | if type(tab) ~= "table" then |
| 163 | + | function clear() |
| 164 | - | cartaNonValida() |
| 164 | + | term.clear() |
| 165 | term.setCursorPos(1, 1) | |
| 166 | end | |
| 167 | - | if tab.t ~= "cc" then |
| 167 | + | |
| 168 | - | cartaNonValida() |
| 168 | + | function clearRed() |
| 169 | sfondo(colors.red) | |
| 170 | term.clear() | |
| 171 | - | if tab.e ~= "BN" then |
| 171 | + | term.setCursorPos(1, 1) |
| 172 | - | cartaNonValida() |
| 172 | + | |
| 173 | ||
| 174 | function colore(sfumatura) term.setTextColour(sfumatura) end | |
| 175 | - | if tab.p ~= "0000" then |
| 175 | + | |
| 176 | function sfondo(sfumaturaSfondo) term.setBackgroundColour(sfumaturaSfondo) end | |
| 177 | - | print("Inserire il PIN e premere ENTER")
|
| 177 | + | |
| 178 | function fineColore() term.setTextColour(colours.white) end | |
| 179 | - | local pinUtente = read("#")
|
| 179 | + | |
| 180 | - | if pinUtente ~= tab.p then |
| 180 | + | function fineSfondo() term.setBackgroundColour(colours.black) end |
| 181 | - | pinErrato() |
| 181 | + | |
| 182 | ||
| 183 | -- IMPLEMENTAZIONE DEL DRAWFILLEDBOX | |
| 184 | local function drawPixelInternal(xPos, yPos) | |
| 185 | - | credito = tonumber(tab.v) |
| 185 | + | term.setCursorPos(xPos, yPos) |
| 186 | term.write(" ")
| |
| 187 | end | |
| 188 | - | print("La carta ha un saldo di "..credito.." IC.")
|
| 188 | + | |
| 189 | local tColourLookup = {}
| |
| 190 | for n = 1, 16 do | |
| 191 | tColourLookup[string.byte("0123456789abcdef", n, n)] = 2 ^ (n - 1)
| |
| 192 | - | print("[1] Versare dei contanti")
|
| 192 | + | |
| 193 | ||
| 194 | function drawFilledBox(startX, startY, endX, endY, nColour) | |
| 195 | if type(startX) ~= "number" or type(startX) ~= "number" or type(endX) ~= | |
| 196 | "number" or type(endY) ~= "number" or | |
| 197 | (nColour ~= nil and type(nColour) ~= "number") then | |
| 198 | error("Expected startX, startY, endX, endY, colour", 2)
| |
| 199 | end | |
| 200 | - | print("Inserire i contanti nello sportello sotto questo computer.")
|
| 200 | + | |
| 201 | startX = math.floor(startX) | |
| 202 | startY = math.floor(startY) | |
| 203 | - | print("Inserire SOLO monete!!!")
|
| 203 | + | endX = math.floor(endX) |
| 204 | endY = math.floor(endY) | |
| 205 | - | print("NON INSERIRE ASSOLUTAMENTE:")
|
| 205 | + | |
| 206 | - | print("- Minerali")
|
| 206 | + | if nColour then term.setBackgroundColor(nColour) end |
| 207 | - | print("- Altri oggetti")
|
| 207 | + | if startX == endX and startY == endY then |
| 208 | drawPixelInternal(startX, startY) | |
| 209 | return | |
| 210 | end | |
| 211 | ||
| 212 | local minX = math.min(startX, endX) | |
| 213 | if minX == startX then | |
| 214 | minY = startY | |
| 215 | maxX = endX | |
| 216 | maxY = endY | |
| 217 | else | |
| 218 | - | print("Conteggio contanti in corso...")
|
| 218 | + | minY = endY |
| 219 | maxX = startX | |
| 220 | maxY = startY | |
| 221 | end | |
| 222 | ||
| 223 | for x = minX, maxX do for y = minY, maxY do drawPixelInternal(x, y) end end | |
| 224 | end | |
| 225 | ||
| 226 | ||
| 227 | function titolo(testo) | |
| 228 | drawFilledBox(1, 1, maxw, 1, colors.yellow) | |
| 229 | term.setCursorPos((maxw - #testo) / 2, 1) | |
| 230 | colore(colors.black) | |
| 231 | term.write(testo) | |
| 232 | sfondo(colors.blue) | |
| 233 | end | |
| 234 | ||
| 235 | function errore(errore) | |
| 236 | sfondo(colors.red) | |
| 237 | colore(colors.white) | |
| 238 | term.clear() | |
| 239 | term.setCursorPos(1, 1) | |
| 240 | titolo("Errore irreversibile")
| |
| 241 | term.setCursorPos(1, 3) | |
| 242 | sfondo(colors.red) | |
| 243 | colore(colors.white) | |
| 244 | print(errore) | |
| 245 | print("\n\n\nAttendere qualche secondo...")
| |
| 246 | os.sleep(5) | |
| 247 | os.reboot() | |
| 248 | - | copper = 0 |
| 248 | + | |
| 249 | ||
| 250 | - | inox = 0 |
| 250 | + | |
| 251 | - | silver = 0 |
| 251 | + | print("Banco di NEBRASKA - Sistema MINERALI")
|
| 252 | print("")
| |
| 253 | print("Premere un tasto per iniziare l'operazione")
| |
| 254 | - | copperID = ben.getItemIdentifierIDFor(21256, 0) |
| 254 | + | event = os.pullEvent() |
| 255 | - | inoxID = ben.getItemIdentifierIDFor(30186, 0) |
| 255 | + | |
| 256 | - | silverID = ben.getItemIdentifierIDFor(21256, 1) |
| 256 | + | sfondo(colours.blue) |
| 257 | - | goldID = ben.getItemIdentifierIDFor(21256, 2) |
| 257 | + | term.clear() |
| 258 | - | diamondID = ben.getItemIdentifierIDFor(21256, 3) |
| 258 | + | term.setCursorPos(1, 1) |
| 259 | titolo("Accredita su Nebraska Pay")
| |
| 260 | sfondo(colours.blue) | |
| 261 | colore(colors.white) | |
| 262 | - | if v[1] == inoxID then |
| 262 | + | print( |
| 263 | - | inox = v[2] |
| 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.") |
| 264 | - | ben.makeRequest(inoxID, v[2]) |
| 264 | + | |
| 265 | -- nomeutente | |
| 266 | term.setCursorPos(1, 9) | |
| 267 | term.write("Nome utente:")
| |
| 268 | term.setCursorPos(15, 9) | |
| 269 | fineColore() | |
| 270 | utenteAccettato = false | |
| 271 | - | elseif v[1] == copperID then |
| 271 | + | conteggioErrori = 0 |
| 272 | - | copper = v[2] |
| 272 | + | while utenteAccettato == false do |
| 273 | - | ben.makeRequest(copperID, v[2]) |
| 273 | + | utente = read() |
| 274 | - | elseif v[1] == silverID then |
| 274 | + | utente = string.gsub(utente, "%s", "") |
| 275 | - | silver = v[2] |
| 275 | + | checkuser = http.get( |
| 276 | - | ben.makeRequest(silverID, v[2]) |
| 276 | + | "http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=no&richiesta=verifica&utente=" .. |
| 277 | - | end |
| 277 | + | utente).readAll() |
| 278 | tabcheckuser = textutils.unserialize(checkuser) | |
| 279 | if tabcheckuser.stato == "OK" then | |
| 280 | term.setCursorPos(15, 9) | |
| 281 | - | copperIC = copper * 0.125 |
| 281 | + | colore(colours.lime) |
| 282 | - | goldIC = gold * 64 |
| 282 | + | term.write(utente) |
| 283 | - | silverIC = silver * 8 |
| 283 | + | fineColore() |
| 284 | - | diamondIC = diamond * 512 |
| 284 | + | utenteAccettato = true |
| 285 | else | |
| 286 | - | contanti = copperIC + goldIC + silverIC + diamondIC + inox |
| 286 | + | term.setCursorPos(15, 9) |
| 287 | colore(colours.red) | |
| 288 | term.write("Utente errato! ")
| |
| 289 | sleep(2) | |
| 290 | term.setCursorPos(15, 9) | |
| 291 | - | print("Inserire nuovamente la carta per accreditare il totale")
|
| 291 | + | fineColore() |
| 292 | - | accredita() |
| 292 | + | term.write(" ")
|
| 293 | term.setCursorPos(15, 9) | |
| 294 | conteggioErrori = conteggioErrori + 1 | |
| 295 | if conteggioErrori > 2 then | |
| 296 | - | print("Vecchio saldo: "..credito.." IC")
|
| 296 | + | term.setCursorPos(15, 9) |
| 297 | - | print("Nuovo saldo : "..tabr.v.." IC")
|
| 297 | + | colore(colours.red) |
| 298 | errore("Troppi tentativi di immissione errati ")
| |
| 299 | end | |
| 300 | end | |
| 301 | end | |
| 302 | - | shell.run("pastebin get 1ZWwRELD startup2")
|
| 302 | + | colore(colours.white) |
| 303 | - | if fs.exists("startup2") then
|
| 303 | + | term.setCursorPos(1, 11) |
| 304 | - | shell.run("rm startup")
|
| 304 | + | term.write("Password:")
|
| 305 | - | shell.run("mv startup2 startup")
|
| 305 | + | term.setCursorPos(15, 11) |
| 306 | conteggioErrori = 0 | |
| 307 | passAccettata = false | |
| 308 | while passAccettata == false do | |
| 309 | fineColore() | |
| 310 | password = read("#")
| |
| 311 | colore(colours.black) | |
| 312 | checkuser = http.get( | |
| 313 | "http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=" .. | |
| 314 | - | shell.run("pastebin get 1ZWwRELD startup")
|
| 314 | + | password .. "&richiesta=addebito&valore=0&utente=" .. |
| 315 | utente).readAll() | |
| 316 | risposta = textutils.unserialize(checkuser) | |
| 317 | if risposta.stato == "OK" then | |
| 318 | term.setCursorPos(15, 11) | |
| 319 | colore(colours.lime) | |
| 320 | term.write("############## ")
| |
| 321 | fineColore() | |
| 322 | passAccettata = true | |
| 323 | else | |
| 324 | term.setCursorPos(15, 11) | |
| 325 | colore(colours.red) | |
| 326 | term.write("Password errata! ")
| |
| 327 | conteggioErrori = conteggioErrori + 1 | |
| 328 | sleep(2) | |
| 329 | term.setCursorPos(15, 11) | |
| 330 | term.write(" ")
| |
| 331 | term.setCursorPos(15, 11) | |
| 332 | if conteggioErrori > 2 then | |
| 333 | term.setCursorPos(15, 11) | |
| 334 | colore(colours.red) | |
| 335 | errore("Troppi tentativi di immissione errati")
| |
| 336 | end | |
| 337 | end | |
| 338 | end | |
| 339 | metodoPagamento = "NPAY" | |
| 340 | credito = tonumber(risposta.saldo) | |
| 341 | clear() | |
| 342 | ||
| 343 | while true do | |
| 344 | print("Il conto ha un saldo di "..credito.." IC.")
| |
| 345 | print("")
| |
| 346 | print("Per favore scegliere un'opzione utilizzando i tasti numerici e confermare con ENTER:")
| |
| 347 | print("")
| |
| 348 | print("[1] Versare dei minerali")
| |
| 349 | print("[2] Annullare il versamento")
| |
| 350 | ||
| 351 | num=tonumber(read()) | |
| 352 | if num == 1 then | |
| 353 | ||
| 354 | clear() | |
| 355 | redstone.setOutput("left", true)
| |
| 356 | print("Posizionare il vagone sullo scarico")
| |
| 357 | print("")
| |
| 358 | print("AVVERTENZA IMPORTANTE:")
| |
| 359 | print("Inserire SOLO questi minerali:")
| |
| 360 | print("Refined Turquoise, Onyx, Ametyhst, Citrine, Emerald, Ruby, Sapphire")
| |
| 361 | print("Platinum Ingot, Gold Ingot, Iridium Ingot, Diamond")
| |
| 362 | print("")
| |
| 363 | print("NON RIAVVIARE IL COMPUTER O SI PERDERA' IL VERSAMENTO")
| |
| 364 | print("")
| |
| 365 | print("Quando si è pronti per continuare, premere un tasto qualsiasi.")
| |
| 366 | os.pullEvent("key")
| |
| 367 | ||
| 368 | clear() | |
| 369 | ||
| 370 | redstone.setOutput("left", false)
| |
| 371 | ||
| 372 | print("Conteggio minerali in corso...")
| |
| 373 | ||
| 374 | term.setCursorPos(3, 3) | |
| 375 | term.write("*---")
| |
| 376 | sleep(0.5) | |
| 377 | term.setCursorPos(3, 3) | |
| 378 | term.write("-*--")
| |
| 379 | sleep(0.5) | |
| 380 | term.setCursorPos(3, 3) | |
| 381 | term.write("--*-")
| |
| 382 | sleep(0.5) | |
| 383 | term.setCursorPos(3, 3) | |
| 384 | term.write("---*")
| |
| 385 | sleep(0.5) | |
| 386 | term.setCursorPos(3, 3) | |
| 387 | term.write("--*-")
| |
| 388 | sleep(0.5) | |
| 389 | term.setCursorPos(3, 3) | |
| 390 | term.write("-*--")
| |
| 391 | sleep(0.5) | |
| 392 | term.setCursorPos(3, 3) | |
| 393 | term.write("*---")
| |
| 394 | sleep(0.5) | |
| 395 | ||
| 396 | ben = peripheral.wrap("back")
| |
| 397 | ben.getAvailableItems() | |
| 398 | i,j = os.pullEvent("available_items_return")
| |
| 399 | ||
| 400 | clear() | |
| 401 | ||
| 402 | refTurquoiseID = ben.getItemIdentifierIDFor(31184, 7) | |
| 403 | refOnyxID = ben.getItemIdentifierIDFor(31184, 8) | |
| 404 | refAmethystID = ben.getItemIdentifierIDFor(31184, 9) | |
| 405 | refCitrineID = ben.getItemIdentifierIDFor(31184, 10) | |
| 406 | refEmeraldID = ben.getItemIdentifierIDFor(31184, 11) | |
| 407 | refRubyID = ben.getItemIdentifierIDFor(31184, 12) | |
| 408 | refSapphireID = ben.getItemIdentifierIDFor(31184, 13) | |
| 409 | platinumID = ben.getItemIdentifierIDFor(21256, 7) | |
| 410 | goldID = ben.getItemIdentifierIDFor(266, 0) | |
| 411 | iridiumID = ben.getItemIdentifierIDFor(21256, 16) | |
| 412 | diamondID = ben.getItemIdentifierIDFor(264, 0) | |
| 413 | ||
| 414 | for k,v in pairs(j) do | |
| 415 | if v[1] == refTurquoiseID then | |
| 416 | refTurquoise = v[2] | |
| 417 | ben.makeRequest(refTurquoiseID, v[2]) | |
| 418 | ||
| 419 | elseif v[1] == refOnyxID then | |
| 420 | refOnyx = v[2] | |
| 421 | ben.makeRequest(refOnyxID, v[2]) | |
| 422 | ||
| 423 | elseif v[1] == refAmethystID then | |
| 424 | refAmethyst = v[2] | |
| 425 | ben.makeRequest(refAmethystID, v[2]) | |
| 426 | ||
| 427 | elseif v[1] == refCitrineID then | |
| 428 | refCitrine = v[2] | |
| 429 | ben.makeRequest(refCitrineID, v[2]) | |
| 430 | ||
| 431 | elseif v[1] == refEmeraldID then | |
| 432 | refEmerald = v[2] | |
| 433 | ben.makeRequest(refEmeraldID, v[2]) | |
| 434 | ||
| 435 | elseif v[1] == refRubyID then | |
| 436 | refRuby = v[2] | |
| 437 | ben.makeRequest(refRubyID, v[2]) | |
| 438 | ||
| 439 | elseif v[1] == refSapphireID then | |
| 440 | refSapphire = v[2] | |
| 441 | ben.makeRequest(refSapphireID, v[2]) | |
| 442 | ||
| 443 | elseif v[1] == platinumID then | |
| 444 | platinum = v[2] | |
| 445 | ben.makeRequest(platinumID, v[2]) | |
| 446 | ||
| 447 | elseif v[1] == goldID then | |
| 448 | gold = v[2] | |
| 449 | ben.makeRequest(goldID, v[2]) | |
| 450 | ||
| 451 | elseif v[1] == iridiumID then | |
| 452 | iridium = v[2] | |
| 453 | ben.makeRequest(iridiumID, v[2]) | |
| 454 | ||
| 455 | elseif v[1] == diamondID then | |
| 456 | diamond = v[2] | |
| 457 | ben.makeRequest(diamondID, v[2]) | |
| 458 | ||
| 459 | end | |
| 460 | sleep(0.1) | |
| 461 | end | |
| 462 | ||
| 463 | refTurquoiseIC = refTurquoise * 0.5 | |
| 464 | refOnyxIC = refOnyx * 0.5 | |
| 465 | refAmethystIC = refAmethyst * 0.25 | |
| 466 | refCitrineIC = refCitrine * 0.5 | |
| 467 | refEmeraldIC = refEmerald * 0.5 | |
| 468 | refRubyIC = refRuby * 0.25 | |
| 469 | refSapphireIC = refSapphire * 0.5 | |
| 470 | platinumIC = platinum * 0.31 | |
| 471 | goldIC = gold * 2 | |
| 472 | iridiumIC = iridium * 5 | |
| 473 | diamondIC = diamond * 6.4 | |
| 474 | ||
| 475 | contanti = refTurquoiseIC + refOnyxIC + refAmethystIC + refCitrineIC + refEmeraldIC + refRubyIC + platinumIC + iridiumIC + goldIC + diamondIC | |
| 476 | ||
| 477 | ||
| 478 | print("Totale versato: "..contanti.." IC")
| |
| 479 | print("")
| |
| 480 | inviaDenaro = http.get( | |
| 481 | "http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=" .. | |
| 482 | password .. "&utente=" .. utente .. | |
| 483 | "&richiesta=accredito&valore=" .. contanti).readAll() | |
| 484 | risultatoInvio = textutils.unserialize(inviaDenaro) | |
| 485 | if risultatoInvio.stato == "OK" then | |
| 486 | colore(colors.white) | |
| 487 | else | |
| 488 | clear() | |
| 489 | errore("Errore durante il pagamento")
| |
| 490 | sleep(5) | |
| 491 | os.reboot() | |
| 492 | end | |
| 493 | inviaFisco = http.get("http://172.16.20.220/luanet/servlets/fisco.php?msg=" .. contanti .. "%20IC%20-%20" .. utente)
| |
| 494 | sleep(1) | |
| 495 | clear() | |
| 496 | print("Denaro versato.")
| |
| 497 | print("")
| |
| 498 | print("")
| |
| 499 | print("Grazie!")
| |
| 500 | sleep(1) | |
| 501 | term.setTextColor(colors.black) | |
| 502 | shell.run("rm startup")
| |
| 503 | shell.run("pastebin get XGkJBpXJ startup")
| |
| 504 | os.reboot() | |
| 505 | elseif num == 2 then clear() break end | |
| 506 | end | |
| 507 | clear() | |
| 508 | print("Attendere")
| |
| 509 | term.setTextColor(colors.black) | |
| 510 | shell.run("rm startup")
| |
| 511 | shell.run("pastebin get XGkJBpXJ startup")
| |
| 512 | os.reboot() |