SHOW:
|
|
- or go back to the newest paste.
| 1 | - | --Versamenti ISOTOPI |
| 1 | + | --Pompa petrolio al rovescio |
| 2 | ||
| 3 | -- Configurazione | |
| 4 | - | --vuota il bancomat |
| 4 | + | local price = 0.65 |
| 5 | - | ben = peripheral.wrap("back")
|
| 5 | + | local meter = peripheral.wrap("bottom")
|
| 6 | - | ben.getAvailableItems() |
| 6 | + | local meterDisplay = "left" |
| 7 | - | i,j = os.pullEvent("available_items_return")
|
| 7 | + | |
| 8 | local maxw, maxh = term.getSize() | |
| 9 | - | Pu238 = 0 |
| 9 | + | |
| 10 | - | Y90 = 0 |
| 10 | + | -- Reset variabili |
| 11 | - | Mo99 = 0 |
| 11 | + | local oil = 0 |
| 12 | - | Ir192 = 0 |
| 12 | + | local contanti = 0 |
| 13 | - | Am241 = 0 |
| 13 | + | |
| 14 | - | Cs137 = 0 |
| 14 | + | -- Accensione display di destra |
| 15 | - | Co60 = 0 |
| 15 | + | rs.setOutput("right", true)
|
| 16 | - | I131 = 0 |
| 16 | + | -- Blocca contatore |
| 17 | - | Sr90 = 0 |
| 17 | + | rs.setOutput("bottom", true)
|
| 18 | ||
| 19 | ||
| 20 | - | Pu238ID = ben.getItemIdentifierIDFor(17104, 0) |
| 20 | + | |
| 21 | - | Y90ID = ben.getItemIdentifierIDFor(17096, 0) |
| 21 | + | |
| 22 | - | Mo99ID = ben.getItemIdentifierIDFor(17097, 0) |
| 22 | + | |
| 23 | - | Ir192ID = ben.getItemIdentifierIDFor(17098, 0) |
| 23 | + | |
| 24 | - | Am241ID = ben.getItemIdentifierIDFor(17099, 0) |
| 24 | + | |
| 25 | - | Cs137ID = ben.getItemIdentifierIDFor(17100, 0) |
| 25 | + | |
| 26 | - | Co60ID = ben.getItemIdentifierIDFor(17101, 0) |
| 26 | + | |
| 27 | - | I131ID = ben.getItemIdentifierIDFor(17102, 0) |
| 27 | + | |
| 28 | - | Sr90ID = ben.getItemIdentifierIDFor(17103, 0) |
| 28 | + | |
| 29 | term.setCursorPos(1, 1) | |
| 30 | end | |
| 31 | - | for k,v in pairs(j) do |
| 31 | + | |
| 32 | - | if v[1] == Pu238ID then |
| 32 | + | |
| 33 | - | Pu238 = v[2] |
| 33 | + | |
| 34 | - | ben.makeRequest(Pu238ID, v[2]) |
| 34 | + | |
| 35 | ||
| 36 | - | elseif v[1] == Y90ID then |
| 36 | + | |
| 37 | - | Y90 = v[2] |
| 37 | + | |
| 38 | - | ben.makeRequest(Y90ID, v[2]) |
| 38 | + | |
| 39 | ||
| 40 | - | elseif v[1] == Mo99ID then |
| 40 | + | |
| 41 | - | Mo99 = v[2] |
| 41 | + | |
| 42 | - | ben.makeRequest(Mo99ID, v[2]) |
| 42 | + | |
| 43 | term.setCursorPos(xPos, yPos) | |
| 44 | - | elseif v[1] == Ir192ID then |
| 44 | + | |
| 45 | - | Ir192 = v[2] |
| 45 | + | |
| 46 | - | ben.makeRequest(Ir192ID, v[2]) |
| 46 | + | |
| 47 | local tColourLookup = {}
| |
| 48 | - | elseif v[1] == Am241ID then |
| 48 | + | |
| 49 | - | Am241 = v[2] |
| 49 | + | |
| 50 | - | ben.makeRequest(Am241ID, v[2]) |
| 50 | + | |
| 51 | ||
| 52 | - | elseif v[1] == Cs137ID then |
| 52 | + | |
| 53 | - | Cs137 = v[2] |
| 53 | + | |
| 54 | - | ben.makeRequest(Cs137ID, v[2]) |
| 54 | + | |
| 55 | (nColour ~= nil and type(nColour) ~= "number") then | |
| 56 | - | elseif v[1] == Co60ID then |
| 56 | + | |
| 57 | - | Co60 = v[2] |
| 57 | + | |
| 58 | - | ben.makeRequest(Co60ID, v[2]) |
| 58 | + | |
| 59 | startX = math.floor(startX) | |
| 60 | - | elseif v[1] == I131ID then |
| 60 | + | |
| 61 | - | I131 = v[2] |
| 61 | + | |
| 62 | - | ben.makeRequest(I131ID, v[2]) |
| 62 | + | |
| 63 | ||
| 64 | - | elseif v[1] == Sr90ID then |
| 64 | + | |
| 65 | - | Sr90 = v[2] |
| 65 | + | |
| 66 | - | ben.makeRequest(Sr90ID, v[2]) |
| 66 | + | |
| 67 | return | |
| 68 | - | sleep(0.1) |
| 68 | + | |
| 69 | ||
| 70 | local minX = math.min(startX, endX) | |
| 71 | - | ben.getAvailableItems() |
| 71 | + | |
| 72 | - | i,j = os.pullEvent("available_items_return")
|
| 72 | + | |
| 73 | maxX = endX | |
| 74 | - | Pu238ID = ben.getItemIdentifierIDFor(17104, 0) |
| 74 | + | |
| 75 | - | Y90ID = ben.getItemIdentifierIDFor(17096, 0) |
| 75 | + | |
| 76 | - | Mo99ID = ben.getItemIdentifierIDFor(17097, 0) |
| 76 | + | |
| 77 | - | Ir192ID = ben.getItemIdentifierIDFor(17098, 0) |
| 77 | + | |
| 78 | - | Am241ID = ben.getItemIdentifierIDFor(17099, 0) |
| 78 | + | |
| 79 | - | Cs137ID = ben.getItemIdentifierIDFor(17100, 0) |
| 79 | + | |
| 80 | - | Co60ID = ben.getItemIdentifierIDFor(17101, 0) |
| 80 | + | |
| 81 | - | I131ID = ben.getItemIdentifierIDFor(17102, 0) |
| 81 | + | |
| 82 | - | Sr90ID = ben.getItemIdentifierIDFor(17103, 0) |
| 82 | + | |
| 83 | ||
| 84 | ||
| 85 | - | for k,v in pairs(j) do |
| 85 | + | |
| 86 | - | if v[1] == Pu238ID then |
| 86 | + | |
| 87 | - | Pu238 = v[2] |
| 87 | + | |
| 88 | - | ben.makeRequest(Pu238ID, v[2]) |
| 88 | + | |
| 89 | term.write(testo) | |
| 90 | - | elseif v[1] == Y90ID then |
| 90 | + | term.setBackgroundColor(colors.black) |
| 91 | - | Y90 = v[2] |
| 91 | + | colore(colors.white) |
| 92 | - | ben.makeRequest(Y90ID, v[2]) |
| 92 | + | |
| 93 | ||
| 94 | - | elseif v[1] == Mo99ID then |
| 94 | + | |
| 95 | - | Mo99 = v[2] |
| 95 | + | |
| 96 | - | ben.makeRequest(Mo99ID, v[2]) |
| 96 | + | |
| 97 | term.clear() | |
| 98 | - | elseif v[1] == Ir192ID then |
| 98 | + | |
| 99 | - | Ir192 = v[2] |
| 99 | + | |
| 100 | - | ben.makeRequest(Ir192ID, v[2]) |
| 100 | + | |
| 101 | sfondo(colors.red) | |
| 102 | - | elseif v[1] == Am241ID then |
| 102 | + | |
| 103 | - | Am241 = v[2] |
| 103 | + | |
| 104 | - | ben.makeRequest(Am241ID, v[2]) |
| 104 | + | |
| 105 | os.sleep(5) | |
| 106 | - | elseif v[1] == Cs137ID then |
| 106 | + | |
| 107 | - | Cs137 = v[2] |
| 107 | + | |
| 108 | - | ben.makeRequest(Cs137ID, v[2]) |
| 108 | + | |
| 109 | oil = meter.getAmount() | |
| 110 | - | elseif v[1] == Co60ID then |
| 110 | + | if oil > 0 then |
| 111 | - | Co60 = v[2] |
| 111 | + | -- Sblocca il contatore, così si svuota, attendi e riblocca |
| 112 | - | ben.makeRequest(Co60ID, v[2]) |
| 112 | + | rs.setOutput("bottom", true)
|
| 113 | meter.reset() | |
| 114 | - | elseif v[1] == I131ID then |
| 114 | + | errore("Pompa temporaneamente non disponibile.\n\nLavaggio circuiti in corso...")
|
| 115 | - | I131 = v[2] |
| 115 | + | sleep(10) |
| 116 | - | ben.makeRequest(I131ID, v[2]) |
| 116 | + | rs.setOutput("bottom", false)
|
| 117 | os.reboot() | |
| 118 | - | elseif v[1] == Sr90ID then |
| 118 | + | |
| 119 | - | Sr90 = v[2] |
| 119 | + | |
| 120 | - | ben.makeRequest(Sr90ID, v[2]) |
| 120 | + | |
| 121 | titolo("NuovoPignone DigitalPump")
| |
| 122 | - | sleep(0.1) |
| 122 | + | print("\n\nPECTEN S.p.A.")
|
| 123 | print("")
| |
| 124 | print("Premere un tasto per iniziare l'operazione")
| |
| 125 | print("")
| |
| 126 | - | function clear() |
| 126 | + | |
| 127 | - | term.clear() |
| 127 | + | print("ATTENZIONE, AVVERTENZA MOLTO IMPORTANTE")
|
| 128 | - | term.setCursorPos(1,1) |
| 128 | + | print("NON RIAVVIARE MAI IL COMPUTER DURANTE IL POMPAGGIO")
|
| 129 | print("In caso contrario, il petrolio pompato verrà perduto!")
| |
| 130 | os.pullEvent("key")
| |
| 131 | ||
| 132 | - | if Pu238 ~= 0 or Y90 ~= 0 or Mo99 ~= 0 or Ir192 ~= 0 or Am241 ~= 0 or Cs137 ~= 0 or Co60 ~= 0 or I131 ~= 0 or Sr90 ~= 0 then |
| 132 | + | |
| 133 | term.clear() | |
| 134 | - | print("Bancomat temporaneamente non disponibile")
|
| 134 | + | |
| 135 | - | sleep(60) |
| 135 | + | |
| 136 | sfondo(colours.blue) | |
| 137 | colore(colors.white) | |
| 138 | print( | |
| 139 | "\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.") | |
| 140 | ||
| 141 | -- nomeutente | |
| 142 | term.setCursorPos(1, 9) | |
| 143 | term.write("Nome utente:")
| |
| 144 | term.setCursorPos(15, 9) | |
| 145 | fineColore() | |
| 146 | utenteAccettato = false | |
| 147 | conteggioErrori = 0 | |
| 148 | while utenteAccettato == false do | |
| 149 | utente = read() | |
| 150 | utente = string.gsub(utente, "%s", "") | |
| 151 | checkuser = http.get( | |
| 152 | "http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=no&richiesta=verifica&utente=" .. | |
| 153 | utente).readAll() | |
| 154 | tabcheckuser = textutils.unserialize(checkuser) | |
| 155 | if tabcheckuser.stato == "OK" then | |
| 156 | term.setCursorPos(15, 9) | |
| 157 | colore(colours.lime) | |
| 158 | term.write(utente) | |
| 159 | fineColore() | |
| 160 | utenteAccettato = true | |
| 161 | else | |
| 162 | term.setCursorPos(15, 9) | |
| 163 | colore(colours.red) | |
| 164 | term.write("Utente errato! ")
| |
| 165 | sleep(2) | |
| 166 | term.setCursorPos(15, 9) | |
| 167 | fineColore() | |
| 168 | term.write(" ")
| |
| 169 | term.setCursorPos(15, 9) | |
| 170 | conteggioErrori = conteggioErrori + 1 | |
| 171 | if conteggioErrori > 2 then | |
| 172 | term.setCursorPos(15, 9) | |
| 173 | colore(colours.red) | |
| 174 | errore("Troppi tentativi di immissione errati ")
| |
| 175 | end | |
| 176 | end | |
| 177 | end | |
| 178 | colore(colours.white) | |
| 179 | term.setCursorPos(1, 11) | |
| 180 | term.write("Password:")
| |
| 181 | term.setCursorPos(15, 11) | |
| 182 | conteggioErrori = 0 | |
| 183 | passAccettata = false | |
| 184 | while passAccettata == false do | |
| 185 | fineColore() | |
| 186 | password = read("#")
| |
| 187 | colore(colours.black) | |
| 188 | checkuser = http.get( | |
| 189 | "http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=" .. | |
| 190 | password .. "&richiesta=addebito&valore=0&utente=" .. | |
| 191 | utente).readAll() | |
| 192 | risposta = textutils.unserialize(checkuser) | |
| 193 | if risposta.stato == "OK" then | |
| 194 | term.setCursorPos(15, 11) | |
| 195 | colore(colours.lime) | |
| 196 | term.write("############## ")
| |
| 197 | fineColore() | |
| 198 | passAccettata = true | |
| 199 | else | |
| 200 | term.setCursorPos(15, 11) | |
| 201 | colore(colours.red) | |
| 202 | term.write("Password errata! ")
| |
| 203 | conteggioErrori = conteggioErrori + 1 | |
| 204 | sleep(2) | |
| 205 | term.setCursorPos(15, 11) | |
| 206 | term.write(" ")
| |
| 207 | term.setCursorPos(15, 11) | |
| 208 | - | sfondo(colors.blue) |
| 208 | + | |
| 209 | term.setCursorPos(15, 11) | |
| 210 | colore(colours.red) | |
| 211 | errore("Troppi tentativi di immissione errati")
| |
| 212 | end | |
| 213 | end | |
| 214 | end | |
| 215 | metodoPagamento = "NPAY" | |
| 216 | credito = tonumber(risposta.saldo) | |
| 217 | sfondo(colors.black) | |
| 218 | clear() | |
| 219 | titolo("NuovoPignone DigitalPump")
| |
| 220 | while true do | |
| 221 | print("\n\n")
| |
| 222 | print("Il conto ha un saldo di "..credito.." IC.")
| |
| 223 | print("")
| |
| 224 | print("Per favore scegliere un'opzione utilizzando i tasti numerici e confermare con ENTER:")
| |
| 225 | print("")
| |
| 226 | colore(colors.lime) | |
| 227 | - | print("CLINICA DI NEW RADEON")
|
| 227 | + | print("[1] Scaricare il petrolio")
|
| 228 | colore(colors.red) | |
| 229 | print("[2] Annullare il pompaggio")
| |
| 230 | colore(colors.white) | |
| 231 | num=tonumber(read()) | |
| 232 | - | print("ATTENZIONE AVVERTENZA MOLTO IMPORTANTE")
|
| 232 | + | |
| 233 | - | print("NON RIAVVIARE MAI IL COMPUTER DURANTE IL VERSAMENTO")
|
| 233 | + | |
| 234 | - | print("In caso contrario gli isotopi versati verranno distrutti irrimediabilmente!")
|
| 234 | + | titolo("NuovoPignone DigitalPump")
|
| 235 | - | event = os.pullEvent() |
| 235 | + | sfondo(colors.black) |
| 236 | print("\n\n")
| |
| 237 | print("Posizionare i vagoni sul dispositivo di pompaggio")
| |
| 238 | print("")
| |
| 239 | print("AVVERTENZA IMPORTANTE:")
| |
| 240 | print("Accetta SOLO petrolio.")
| |
| 241 | print("")
| |
| 242 | print("NON RIAVVIARE IL COMPUTER O SI PERDERA' IL VERSAMENTO")
| |
| 243 | print("")
| |
| 244 | print("Quando si è pronti per continuare, premere un tasto qualsiasi.")
| |
| 245 | os.pullEvent("key")
| |
| 246 | ||
| 247 | --Ricalibra e sblocca il contatore. Accendi display di sinistra | |
| 248 | meter.reset() | |
| 249 | rs.setOutput(meterDisplay, true) | |
| 250 | rs.setOutput("bottom", false)
| |
| 251 | ||
| 252 | clear() | |
| 253 | while true do | |
| 254 | clear() | |
| 255 | titolo("NuovoPignone DigitalPump")
| |
| 256 | sfondo(colors.black) | |
| 257 | print("\n\n")
| |
| 258 | print("Pompaggio in corso.\n\nPremere il tasto S per terminare.")
| |
| 259 | local event, key = os.pullEvent("key")
| |
| 260 | if event == "key" and key == 31 then | |
| 261 | break | |
| 262 | end | |
| 263 | sleep(0.1) | |
| 264 | end | |
| 265 | ||
| 266 | -- Conta il piscio e ricalibra | |
| 267 | clear() | |
| 268 | titolo("NuovoPignone DigitalPump")
| |
| 269 | sfondo(colors.black) | |
| 270 | print("\n\n")
| |
| 271 | print("Calibrazione in corso, attendere")
| |
| 272 | while true do | |
| 273 | oil = meter.getAmount() | |
| 274 | term.setCursorPos(3, 3) | |
| 275 | term.write("*--")
| |
| 276 | sleep(1) | |
| 277 | term.setCursorPos(3, 3) | |
| 278 | term.write("-*-")
| |
| 279 | sleep(1) | |
| 280 | if oil == meter.getAmount() then | |
| 281 | break | |
| 282 | end | |
| 283 | term.setCursorPos(3, 3) | |
| 284 | term.write("--*")
| |
| 285 | end | |
| 286 | ||
| 287 | --Blocca contatore | |
| 288 | rs.setOutput("bottom", true)
| |
| 289 | ||
| 290 | clear() | |
| 291 | -- millibucket -> bucket | |
| 292 | oil = oil / 1000 | |
| 293 | ||
| 294 | contanti = oil * price | |
| 295 | titolo ("Vendita completata!")
| |
| 296 | print("\n\n")
| |
| 297 | print("Totale pompato: "..oil.." secchi")
| |
| 298 | print("Prezzo unitario: "..price.." IC/secchio")
| |
| 299 | print("Pagato: "..contanti.." IC")
| |
| 300 | print("")
| |
| 301 | sleep(1) | |
| 302 | inviaDenaro = http.get( | |
| 303 | "http://172.16.20.220/luanet/servlets/pecten/npayproxy.php?beneficiario=" .. utente .. | |
| 304 | "&valore=" .. contanti).readAll() | |
| 305 | risultatoInvio = textutils.unserialize(inviaDenaro) | |
| 306 | if risultatoInvio.stato == "OK" then | |
| 307 | colore(colors.white) | |
| 308 | alert = http.get("http://172.16.20.220/luanet/servlets/pecten/email_service.php?auth=BEAFFBAC111&npay=" .. utente .. "&qty=" .. contanti .. "&success=true").readAll()
| |
| 309 | else | |
| 310 | clear() | |
| 311 | alert = http.get("http://172.16.20.220/luanet/servlets/pecten/email_service.php?auth=BEAFFBAC111&npay=" .. utente .. "&qty=" .. contanti .. "&success=false").readAll()
| |
| 312 | errore("Errore durante il pagamento.\n\nPer favore contattare un responsabile Pecten.\n\nQuesto evento è stato segnalato al Supporto Tecnico Pecten.")
| |
| 313 | sleep(10) | |
| 314 | os.reboot() | |
| 315 | end | |
| 316 | sleep(1) | |
| 317 | print("Denaro versato.")
| |
| 318 | print("")
| |
| 319 | print("")
| |
| 320 | print("Grazie!")
| |
| 321 | sleep(1) | |
| 322 | ||
| 323 | --Spegni display di sinistra e ricalibra | |
| 324 | meter.reset() | |
| 325 | rs.setOutput(meterDisplay, false) | |
| 326 | term.setTextColor(colors.black) | |
| 327 | clear() | |
| 328 | shell.run("pastebin get fc3G1D61 startup2")
| |
| 329 | - | print("[1] Versare degli isotopi")
|
| 329 | + | |
| 330 | - | print("[2] Annullare il versamento")
|
| 330 | + | |
| 331 | shell.run("mv startup2 startup")
| |
| 332 | end | |
| 333 | os.reboot() | |
| 334 | elseif num == 2 then clear() break end | |
| 335 | end | |
| 336 | - | redstone.setOutput("left", true)
|
| 336 | + | |
| 337 | - | print("Inserire gli isotopi nello sportello in basso")
|
| 337 | + | |
| 338 | term.setTextColor(colors.black) | |
| 339 | shell.run("pastebin get fc3G1D61 startup2")
| |
| 340 | - | print("Inserire SOLO isotopi.")
|
| 340 | + | |
| 341 | shell.run("rm startup")
| |
| 342 | shell.run("mv startup2 startup")
| |
| 343 | end | |
| 344 | os.reboot() |