Advertisement
Enn3DevPlayer

NFuel

Jun 12th, 2023 (edited)
787
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 26.19 KB | Gaming | 0 0
  1. lp=peripheral.wrap("back")
  2. -- makeRequest(double:id dell'item nel network LP, double:quantità item richiesta) --
  3. -- x.makeRequest(-25188103, n1) -- request del carbone, con n1 variabile scelta dall'utente
  4. -- x.makeRequest(2097825633, n2) -- request del biofuel
  5. -- x.makeRequest(-641322352, n3) -- request del creosoto
  6.  
  7.  
  8. local maxw, maxh = term.getSize()
  9.  
  10. --IMPLEMENTAZIONE DEL DRAWFILLEDBOX
  11. local function drawPixelInternal(xPos, yPos)
  12.     term.setCursorPos(xPos, yPos)
  13.     term.write(" ")
  14. end
  15.  
  16. local tColourLookup = {}
  17. for n = 1,16 do
  18.     tColourLookup[string.byte("0123456789abcdef", n, n)] = 2^(n-1)
  19. end
  20.  
  21. function drawFilledBox(startX, startY, endX, endY, nColour)
  22.     if type(startX) ~= "number" or type(startX) ~= "number" or
  23.        type(endX) ~= "number" or type(endY) ~= "number" or
  24.        (nColour ~= nil and type(nColour) ~= "number") then
  25.         error("Expected startX, startY, endX, endY, colour", 2)
  26.     end
  27.  
  28.     startX = math.floor(startX)
  29.     startY = math.floor(startY)
  30.     endX = math.floor(endX)
  31.     endY = math.floor(endY)
  32.  
  33.     if nColour then
  34.         term.setBackgroundColor(nColour)
  35.     end
  36.     if startX == endX and startY == endY then
  37.         drawPixelInternal(startX, startY)
  38.         return
  39.     end
  40.  
  41.     local minX = math.min(startX, endX)
  42.     if minX == startX then
  43.         minY = startY
  44.         maxX = endX
  45.         maxY = endY
  46.     else
  47.         minY = endY
  48.         maxX = startX
  49.         maxY = startY
  50.     end
  51.  
  52.     for x = minX, maxX do
  53.         for y = minY, maxY do
  54.             drawPixelInternal(x, y)
  55.         end
  56.     end
  57. end
  58.  
  59. function clear()
  60.     sfondo(colors.lightBlue)
  61.     term.clear()
  62.     term.setCursorPos(1, 1)
  63. end
  64.  
  65. function colore(sfumatura)
  66.     term.setTextColour(sfumatura)
  67. end
  68.  
  69. function sfondo(sfumaturaSfondo)
  70.     term.setBackgroundColour(sfumaturaSfondo)
  71. end
  72.  
  73. function titolo(testo)
  74.     drawFilledBox(1, 1, maxw, 1, colors.yellow)
  75.     term.setCursorPos((maxw - #testo) / 2, 1)
  76.     colore(colors.black)
  77.     term.write(testo)
  78.     sfondo(colors.lightBlue)
  79. end
  80.  
  81.  
  82. function disconnetti()
  83.     clear()
  84.     text = "ARRIVEDERCI!"
  85.     colore(colors.white)
  86.     term.setCursorPos((maxw - #text) / 2, math.floor(maxh / 2))
  87.     term.write(text)
  88.     colore(colors.black)
  89.     text2 = "Tra poco saråA0 possibile eseguire"
  90.     text3 = "una nuova operazione..."
  91.     term.setCursorPos((maxw - #text2) / 2, math.floor(maxh / 2) + 2)
  92.     print(text2)
  93.     term.setCursorPos((maxw - #text3) / 2, math.floor(maxh / 2) + 3)
  94.     print(text3)
  95.     os.sleep(0.5)
  96.    
  97. end
  98.  
  99. function drawCard()
  100.     drawFilledBox(6, 7, 24, 7, colors.blue)
  101.     drawFilledBox(6, 15, 24, 15, colors.blue)
  102.     drawFilledBox(5, 8, 25, 14, colors.blue)
  103.  
  104.     drawFilledBox(7, 9, 23, 9, colors.lightGray)
  105.     drawFilledBox(7, 12, 23, 13, colors.black)
  106. end
  107.  
  108.  
  109.  
  110. sfondo(colors.lightBlue)
  111. clear()
  112.  
  113. colore(colors.black)
  114.  
  115. print("  _   _        ______ _    _ ______ _      ")
  116. print("  | \\ | |      |  ____| |  | |  ____| |     ")
  117. print("  |  \\| |______| |__  | |  | | |__  | |      ")
  118. print(" | .   |______|  __| | |  | |  __| | |     ")
  119. print("  | |\\  |      | |    | |__| | |____| |____ ")
  120. print("  |_| \\_|      |_|     \\____/|______|______| ")
  121.                                            
  122.                                            
  123.  
  124.  
  125. -- Bottoni login/registrati
  126.  
  127. drawFilledBox(14, 10, 38, 12, colors.white)
  128. term.setCursorPos(23, 11)
  129. colore(colors.black)
  130. term.write(" Accesso cliente")
  131.  
  132. drawFilledBox(14, 15, 38, 17, colors.white)
  133. term.setCursorPos(21, 16)
  134. colore(colors.black)
  135. term.write("Accesso operatore")
  136.  
  137. while true do
  138.     event, key, x, y = os.pullEvent("mouse_click")
  139.     if event == "mouse_click" and x >= 14 and x <= 38 and y >= 15 and y <= 17 then
  140.         -- Registrazione nuovo utente
  141.         clear()
  142.         titolo("Autenticazione operatore N-Fuel")
  143.         term.setCursorPos(1, 3)
  144.         print("Inserisci il codice OP")
  145.         term.setCursorPos(1, 5)
  146.         colore(colors.gray)
  147.         print("Premi ENTER per confermare il codice.\nSe i dati sono corretti, il campo diventeråA0 verde.\nSe sono errati, il programma chiederåA0 di reinserirli nuovamente.")
  148.  
  149.      --Codice superuser
  150.         colore(colors.black)
  151.         term.setCursorPos(1, 12)
  152.         term.write("Password:")
  153.         term.setCursorPos(11, 12)
  154.         colore(colors.white)
  155.  
  156.         passAccettata = false
  157.         conteggioErrori = 0
  158.         while passAccettata == false do
  159.             password1 = read("#")
  160.             colore(colors.black)
  161.             term.setCursorPos(1, 13)
  162.             term.write("Verifica:")
  163.             term.setCursorPos(11, 13)
  164.             colore(colors.white)
  165.             if password1 == "96643" then
  166.                 term.setCursorPos(11, 12)
  167.                 colore(colors.lime)
  168.                 term.write("###############")
  169.                 term.setCursorPos(11, 13)
  170.                 term.write("###############")
  171.                 colore(colors.white)
  172.                 passAccettata = true
  173.                
  174.                 sfondo(colors.lightBlue)
  175.                 clear()
  176.                
  177.                 drawFilledBox(14, 10, 38, 12, colors.white)
  178.                 term.setCursorPos(23, 11)
  179.                 colore(colors.black)
  180.                 term.write("Carbon coke")
  181.                
  182.                 drawFilledBox(14, 15, 38, 17, colors.white)
  183.                 term.setCursorPos(21, 16)
  184.                 colore(colors.black)
  185.                 term.write("Carburanti liquidi")
  186.          
  187.                 while true do
  188.                     event, key, x, y = os.pullEvent("mouse_click")
  189.                     if event == "mouse_click" and x >= 14 and x <= 38 and y >= 10 and y <= 12 then
  190.                         clear()
  191.                         titolo("Ritiro Coke")
  192.                         term.setCursorPos(1, 3)
  193.                         print("Inserisci la quantità di coke che si intende prelevare")
  194.                         term.setCursorPos(1, 5)
  195.                         colore(colors.gray)
  196.                         QTCoke = 0
  197.                         QTCoke = read("#")
  198.                         colore(colors.black)
  199.                         term.setCursorPos(1, 13)
  200.                         term.setCursorPos(11, 13)
  201.                         colore(colors.white)
  202.                         term.write("Distribuzione risorse in corso...")
  203.                         qtycoke = tonumber(QTCoke)
  204.                         while qtycoke > 0 do
  205.                             lp.makeRequest(lp.getItemIdentifierIDFor(7757, 0), 1)
  206.                             qtycoke = qtycoke - 1
  207.                         end
  208.                         sleep(10)
  209.                         clear()
  210.                         os.reboot()
  211.  
  212.                     elseif event == "mouse_click" and x >= 14 and x <= 38 and y >= 15 and y <= 17 then
  213.                         sfondo(colors.lightBlue)
  214.                         clear()
  215.                
  216.                         drawFilledBox(14, 10, 38, 12, colors.white)
  217.                         term.setCursorPos(23, 11)
  218.                         colore(colors.black)
  219.                         term.write("Creosoto")
  220.                
  221.                         drawFilledBox(14, 15, 38, 17, colors.white)
  222.                         term.setCursorPos(21, 16)
  223.                         colore(colors.black)
  224.                         term.write("Biofuel")
  225.                        
  226.                     else
  227.                         sleep()
  228.                     end
  229.                      
  230.                     while true do
  231.                         event, key, x, y = os.pullEvent("mouse_click")
  232.                         if event == "mouse_click" and x >= 14 and x <= 38 and y >= 10 and y <= 12 then
  233.                          clear()
  234.                          titolo("Creosoto")
  235.                          term.setCursorPos(1, 3)
  236.                          print("Inserisci la quantità di Creosoto (in bucket) che si intende prelevare")
  237.                          term.setCursorPos(1, 5)
  238.                          colore(colors.gray)
  239.                          QTCR = 0
  240.                          QTCR = read("#")
  241.                          colore(colors.black)
  242.                          term.setCursorPos(1, 13)
  243.                          term.setCursorPos(11, 13)
  244.                          colore(colors.white)
  245.                          term.write("Distribuzione risorse in corso...")
  246.                         qtycr = tonumber(QTBF)
  247.                         while qtycr > 0 do
  248.                          lp.makeRequest(lp.getItemIdentifierIDFor(7772, 0), 1)
  249.                          qtycr = qtycr - 1
  250.                     end
  251.                          sleep(10)
  252.                          clear()
  253.                          os.reboot()
  254.                      else
  255.                         sleep()
  256.                     end
  257.                   end
  258.                  
  259.                                    
  260.                          while true do
  261.                      event, key, x, y = os.pullEvent("mouse_click")
  262.                      if event == "mouse_click" and x >= 14 and x <= 15 and y >= 10 and y <= 17 then
  263.                          clear()
  264.                          titolo("Creosoto")
  265.                          term.setCursorPos(1, 3)
  266.                          print("Inserisci la quantità di Biofuel (in bucket) che si intende prelevare")
  267.                          term.setCursorPos(1, 5)
  268.                          colore(colors.gray)
  269.                          QTBF = 0
  270.                          QTBF = read("#")
  271.                          colore(colors.black)
  272.                          term.setCursorPos(1, 13)
  273.                          term.setCursorPos(11, 13)
  274.                          colore(colors.white)
  275.                          term.write("Distribuzione risorse in corso...")
  276.                         qtybf = tonumber(QTBF)
  277.                         while qtybf > 0 do
  278.                          lp.makeRequest(lp.getItemIdentifierIDFor(30227, 0), 1)
  279.                          qtybf = qtybf - 1
  280.                         end
  281.                          sleep(10)
  282.                          clear()
  283.                          os.reboot()
  284.                      else
  285.                         sleep()
  286.                     end
  287.                   end
  288.                 end
  289.                
  290.              
  291.                
  292.             else
  293.                 colore(colors.red)
  294.                 term.setCursorPos(11, 12)
  295.                 term.write("Codce Errato!    ")
  296.                 term.setCursorPos(1, 13)
  297.                 colore(colors.white)
  298.                 term.write("                               ")
  299.                 sleep(1.5)
  300.                 term.setCursorPos(11, 12)
  301.                 term.write("                               ")
  302.                 term.setCursorPos(11, 12)
  303.                 conteggioErrori = conteggioErrori + 1
  304.                 if conteggioErrori > 2 then
  305.                     term.setCursorPos(14, 12)
  306.                     colore(colors.red)
  307.                     term.write("Tre tentativi di immissione errati.")
  308.                     sleep(1.5)
  309.                     term.setCursorPos(14, 12)
  310.                     colore(colors.white)
  311.                     term.write("                       ")
  312.                     term.setCursorPos(14, 12)
  313.                     clear()
  314.                     os.reboot()
  315.                 end
  316.                        
  317.             end
  318.         end
  319.  
  320.      
  321.  
  322.     elseif event == "mouse_click" and x >= 14 and x <= 38 and y >= 10 and y <= 12 then
  323.         clear()
  324.         titolo("Accedi a nPay")
  325.         term.setCursorPos(1, 3)
  326.         colore(colors.black)
  327.         print("Inserire i propri dati.")
  328.         colore(colors.gray)
  329.         print("\nPremere Enter per confermare i dati inseriti.\nSe i dati sono corretti, il campo diventeråA0 verde.\nSe sono errati, il programma chiederåA0 di reinserirli nuovamente.")
  330.  
  331.         --nomeutente
  332.         term.setCursorPos(1, 10)
  333.         colore(colors.black)
  334.         term.write("Nome utente:")
  335.         term.setCursorPos(15, 10)
  336.         colore(colors.white)
  337.         utenteAccettato = false
  338.         conteggioErrori = 0
  339.         while utenteAccettato == false do
  340.             utente = read()
  341.             checkuser = http.get("http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=no&richiesta=verifica&utente=" .. utente).readAll()
  342.             tabcheckuser = textutils.unserialize(checkuser)
  343.             if tabcheckuser.stato == "OK" then
  344.                 term.setCursorPos(15, 10)
  345.                 colore(colors.lime)
  346.                 term.write(utente)
  347.                 colore(colors.white)
  348.                 utenteAccettato = true
  349.             else
  350.                 term.setCursorPos(15, 10)
  351.                 colore(colors.red)
  352.                 term.write("Utente errato!          ")
  353.                 sleep(2)
  354.                 term.setCursorPos(15, 10)
  355.                 colore(colors.white)
  356.                 term.write("                       ")
  357.                 term.setCursorPos(15, 10)
  358.                 conteggioErrori = conteggioErrori + 1
  359.                 if conteggioErrori > 2 then
  360.                     term.setCursorPos(15, 10)
  361.                     colore(colors.red)
  362.                     term.write("Tre tentativi di immissione errati.")
  363.                     sleep(2)
  364.                     term.setCursorPos(15, 10)
  365.                     colore(colors.white)
  366.                     term.write("                       ")
  367.                     term.setCursorPos(15, 10)
  368.                     clear()
  369.                     os.reboot()
  370.                 end
  371.             end
  372.         end
  373.  
  374.         --password
  375.         colore(colors.black)
  376.         term.setCursorPos(1,12)
  377.         term.write("Password:")
  378.         term.setCursorPos(15, 12)
  379.          
  380.         conteggioErrori = 0
  381.         passAccettata = false
  382.         while passAccettata == false do
  383.             colore(colors.white)
  384.             password = read("#")
  385.             colore(colors.black)
  386.             checkuser = http.get("http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=" .. password .. "&richiesta=addebito&valore=0&utente=".. utente).readAll()
  387.             risposta = textutils.unserialize(checkuser)
  388.             if risposta.stato == "OK" then
  389.                 term.setCursorPos(15, 12)
  390.                 colore(colors.lime)
  391.                 term.write("##############               ")
  392.                 colore(colors.white)
  393.                 passAccettata = true
  394.                 else
  395.                     term.setCursorPos(15, 12)
  396.                     colore(colors.red)
  397.                     term.write("Password errata!            ")
  398.                     conteggioErrori = conteggioErrori + 1
  399.                     sleep(2)
  400.                     term.setCursorPos(15, 12)
  401.                     term.write("                               ")
  402.                     term.setCursorPos(15, 12)
  403.                 if conteggioErrori > 2 then
  404.                     term.setCursorPos(15, 12)
  405.                     colore(colors.red)
  406.                     term.write("Tre tentativi di immissione errati.")
  407.                     sleep(2)
  408.                     term.setCursorPos(15, 12)
  409.                     term.write("                               ")
  410.                     term.setCursorPos(15, 12)
  411.                     clear()
  412.                     os.reboot()
  413.                 end
  414.             end
  415.         end
  416.  
  417.         conteggioErrori = 0
  418.         -- Pagina in cui scegli le operazioni da fare
  419.  
  420.         while true do
  421.             --Ricontrolla il saldo per gestire l'aggiornamento di piåB9 operazioni
  422.             checkuser = http.get("http://172.16.20.220/luanet/servlets/nebraskapay.php?auth="..password.."&richiesta=addebito&valore=0&utente="..utente).readAll()
  423.             risposta = textutils.unserialize(checkuser)
  424.             saldo = tonumber(risposta.saldo)
  425.             --Disegna la finestra del pannello utente
  426.             clear()
  427.             titolo("Pannello utente nPay")
  428.             term.setCursorPos(1, 3)
  429.             term.write("Benvenuto, ")
  430.             colore(colors.white)
  431.             term.write(utente)
  432.             colore(colors.black)
  433.             term.write("!         Saldo: ")
  434.             colore(colors.white)
  435.             term.write(saldo)
  436.             colore(colors.black)
  437.             term.write(" IC")
  438.             print("\n\nOperazioni disponibili:\n")
  439.             sfondo(colors.white)
  440.             print(" Compra Coke  \n")  --deprecato carica denaro
  441.             print(" Compra Creosoto \n")    --deprecato prelieva denaro
  442.             print(" Compra Biofuel     \n") --deprecato trasferisci denaro
  443.             colore(colors.red)              -- estratto conto rimosso
  444.             print(" Disconnettiti da nPay  \n")
  445.             colore(colors.black)
  446.  
  447.             antitonto = os.startTimer(60)
  448.  
  449.             event, key, x, y = os.pullEventRaw()
  450.             if event == "mouse_click" and y == 7 and x <= 24 then       --Pulsante coke
  451.                 clear()
  452.                 titolo("Compra Coke")
  453.  
  454.                 drawCard()
  455.  
  456.                 sfondo(colors.lightBlue)
  457.                 colore(colors.black)
  458.                 term.setCursorPos(30, 8)
  459.                 lp.makeRequest(-25188103, 1)
  460.                
  461.                
  462.  
  463.             elseif event == "mouse_click" and y == 9 and x <= 24 then  --Pulsante creosoto
  464.                 clear()
  465.                 titolo("Compra Creosoto")
  466.  
  467.                 drawCard()
  468.  
  469.                 sfondo(colors.lightBlue)
  470.                 colore(colors.black)
  471.                 term.setCursorPos(30, 8)
  472.                
  473.             elseif event == "mouse_click" and y == 11 and x <= 24 then --Pulsante biofuel
  474.                 --inizio pagina
  475.                 clear()
  476.                 titolo("Trasferimento di denaro")
  477.                 term.setCursorPos(1, 3)
  478.                 term.write("Inserire il nome utente del beneficiario.")
  479.                 colore(colors.gray)
  480.                 print("\n\nPremere Enter per confermare i dati inseriti.\nSe i dati sono corretti, il campo diventeråA0 verde.\nSe sono errati, il programma chiederåA0 di reinserirli nuovamente.")
  481.  
  482.                 --Mostra saldo
  483.                 term.setCursorPos(1, 10)
  484.                 colore(colors.gray)
  485.                 print("Saldo disponibile: " .. saldo .. " IC")
  486.                 colore(colors.black)
  487.  
  488.                 --Verifica Beneficiario
  489.                 term.setCursorPos(1, 12)
  490.                 term.write("Beneficiario:")
  491.                 term.setCursorPos(15, 12)
  492.                 colore(colors.white)
  493.                 destAccettato = false
  494.                 conteggioErrori = 0
  495.                 while destAccettato == false do
  496.                     beneficiario = read()
  497.                     checkuser = http.get("http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=no&richiesta=verifica&utente=" .. beneficiario).readAll()
  498.                     tabcheckuser = textutils.unserialize(checkuser)
  499.                     if tabcheckuser.stato == "OK" and beneficiario ~= utente then
  500.                         term.setCursorPos(15, 12)
  501.                         colore(colors.lime)
  502.                         term.write(beneficiario)
  503.                         colore(colors.white)
  504.                         destAccettato = true
  505.                     else
  506.                         conteggioErrori = conteggioErrori + 1
  507.                         term.setCursorPos(15, 12)
  508.                         colore(colors.red)
  509.                         if beneficiario == utente then
  510.                             term.write("Non puoi inserire te stesso.")
  511.                         else
  512.                             term.write("Utente inesistente!         ")
  513.                         end
  514.                         sleep(2)
  515.                         term.setCursorPos(15, 12)
  516.                         colore(colors.white)
  517.                         term.write("                                      ")
  518.                         term.setCursorPos(15, 12)
  519.                         if conteggioErrori > 2 then
  520.                             term.setCursorPos(15, 12)
  521.                             colore(colors.red)
  522.                             term.write("Tre tentativi di immissione errati.")
  523.                             sleep(2)
  524.                             term.setCursorPos(15, 12)
  525.                             colore(colors.white)
  526.                             term.write("                                   ")
  527.                             term.setCursorPos(15, 12)
  528.                             clear()
  529.                             os.reboot()
  530.                         end
  531.                     end
  532.                 end
  533.  
  534.                 colore(colors.black)
  535.                 --Verifica valore dell'invio
  536.                 term.setCursorPos(1, 14)
  537.                 term.write("Importo:")
  538.                 term.setCursorPos(15, 14)
  539.                 colore(colors.white)
  540.                 importoAccettato = false
  541.                 conteggioErrori = 0
  542.                 while importoAccettato == false do
  543.                     importo = tonumber(read())
  544.                     if importo == "" or importo == nil or importo <= 0 then
  545.                         conteggioErrori = conteggioErrori + 1
  546.                         term.setCursorPos(15, 14)
  547.                         colore(colors.red)
  548.                         term.write("Importo errato!                    ")
  549.                         sleep(2)
  550.                         term.setCursorPos(15, 14)
  551.                         colore(colors.white)
  552.                         term.write("                                   ")
  553.                         term.setCursorPos(15, 14)
  554.                     elseif importo <= saldo and importo > 0 then
  555.                         term.setCursorPos(15, 14)
  556.                         colore(colors.lime)
  557.                         term.write(importo .. " IC")
  558.                         colore(colors.white)
  559.                         importoAccettato = true
  560.                     else
  561.                         conteggioErrori = conteggioErrori + 1
  562.                         term.setCursorPos(15, 14)
  563.                         colore(colors.red)
  564.                         term.write("Credito insufficiente!          ")
  565.                         sleep(2)
  566.                         term.setCursorPos(15, 14)
  567.                         colore(colors.white)
  568.                         term.write("                                   ")
  569.                         term.setCursorPos(15, 14)
  570.                         if conteggioErrori > 2 then
  571.                             term.setCursorPos(15, 14)
  572.                             colore(colors.red)
  573.                             term.write("Tre tentativi di immissione errati.")
  574.                             sleep(2)
  575.                             term.setCursorPos(15, 14)
  576.                             colore(colors.white)
  577.                             term.write("                                   ")
  578.                             term.setCursorPos(15, 14)
  579.                             clear()
  580.                             os.reboot()
  581.                         end
  582.                     end
  583.                 end
  584.  
  585.                 sleep(0.5)
  586.                 clear()
  587.                 titolo("Riepilogo del trasferimento")
  588.  
  589.                 text = "Vuoi inviare " .. importo .. " IC a " .. beneficiario .. "?"
  590.                 term.setCursorPos((maxw - #text) / 2, 6)
  591.                 term.write("Vuoi inviare ")
  592.                 colore(colors.white)
  593.                 term.write(tostring(importo) .. " IC ")
  594.                 colore(colors.black)
  595.                 term.write("a ")
  596.                 colore(colors.white)
  597.                 term.write(beneficiario)
  598.                 colore(colors.black)
  599.                 term.write("?")
  600.  
  601.                 drawFilledBox(7, 11, 23, 13, colors.white)
  602.                 drawFilledBox(29, 11, 45, 13, colors.white)
  603.  
  604.                 term.setCursorPos(8, 12)
  605.                 colore(colors.lime)
  606.                 term.write("Invia il denaro")
  607.  
  608.                 term.setCursorPos(34, 12)
  609.                 colore(colors.red)
  610.                 term.write("Annulla")
  611.  
  612.                 inviare = false
  613.                 while true do
  614.                     event, key, x, y = os.pullEvent()
  615.                     if event == "mouse_click" and x >= 7 and x <= 23 and y >= 11 and y <= 13 then
  616.                         inviaDenaro = http.get("http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=" .. password .. "&utente=" .. utente .. "&richiesta=trasferimento&valore=" .. importo .. "&beneficiario=" .. beneficiario).readAll()
  617.                         risultatoInvio = textutils.unserialize(inviaDenaro)
  618.                         if risultatoInvio.stato == "OK" then
  619.                             text = "Invio del denaro riuscito."
  620.                             text2 = "Nuovo saldo: " .. risultatoInvio.credito .. " IC"
  621.                             sfondo(colors.lightBlue)
  622.                             colore(colors.lime)
  623.                             term.setCursorPos((maxw - #text) / 2, 16)
  624.                             term.write(text)
  625.                             colore(colors.black)
  626.                             term.setCursorPos((maxw - #text2) / 2, 18)
  627.                             term.write(text2)
  628.                             sleep(2)
  629.                             clear()
  630.                             break
  631.                         else
  632.                             text = "Errore durante l'invio del denaro."
  633.                             text2 = risultatoInvio.errore
  634.                             sfondo(colors.lightBlue)
  635.                             colore(colors.red)
  636.                             term.setCursorPos((maxw - #text) / 2, 16)
  637.                             term.write(text)
  638.                             colore(colors.black)
  639.                             term.setCursorPos((maxw - #text2) / 2, 18)
  640.                             term.write(text2)
  641.                             sleep(2)
  642.                             clear()
  643.                             break
  644.                         end
  645.                     elseif event == "mouse_click" and x >= 29 and x <= 45 and y >= 11 and y <= 13 then
  646.                         sfondo(colors.lightBlue)
  647.                         colore(colors.red)
  648.                         text = "Operazione annullata."
  649.                         term.setCursorPos((maxw - #text) / 2, 16)
  650.                         term.write(text)
  651.                         sleep(1.5)
  652.                         clear()
  653.                         break
  654.                     end
  655.                 end
  656.  
  657.        
  658.  
  659.             elseif event == "mouse_click" and y == 13 and x <= 24 then --Pulsante disconnetti da nPay
  660.                 disconnetti()
  661.  
  662.             elseif event == "timer" and key == antitonto then --Butta fuori l'utente se non fa niente
  663.                 disconnetti()
  664.  
  665.             elseif event == "mouse_click" and x == maxw and y == maxh then -- Auto aggiornamento su magic corner (pannello utente)
  666.                 update()
  667.             end
  668.         end
  669.  
  670.     elseif event == "mouse_click" and x == maxw and y == maxh then -- Auto aggiornamento su magic corner (schermata principale)
  671.         update()
  672.     end
  673. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement