Advertisement
FoxWorn3365

eternalcaso2vero

Dec 27th, 2021 (edited)
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.66 KB | None | 0 0
  1. -- CONFIGURAZIONE
  2. sideIsPaymentGood = "right"
  3. sideToStopPaymentGood = "back"
  4. beneficiario = "eternal"
  5. importo = 100 -- In IC
  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 button(x, y, color, text)
  60. term.setBackgroundColor(colors[color])
  61. term.setTextColor(colors.white)
  62. term.setCursorPos(x, y)
  63. print(text)
  64. term.setBackgroundColor(colors.white)
  65. term.setTextColor(colors.black)
  66. end
  67.  
  68. function clear()
  69. term.setBackgroundColor(colors.white)
  70. term.setTextColor(colors.black)
  71. term.clear()
  72. term.setCursorPos(1, 1)
  73. end
  74.  
  75. function titolo(testo)
  76. drawFilledBox(1, 1, maxw, 1, colors.blue)
  77. term.setCursorPos((maxw - #testo) / 2, 1)
  78. term.setTextColor(colors.white)
  79. term.write(testo)
  80. term.setTextColor(colors.black)
  81. term.setBackgroundColor(colors.white)
  82. end
  83.  
  84. isGood = false
  85. isLogged = false
  86.  
  87. page = 0
  88.  
  89. while true do
  90. -- Facciamo prima il check
  91. if rs.getInput(sideToStopPaymentGood) == false and isGood == true then
  92. rs.setOutput(sideIsPaymentGood, true)
  93. elseif rs.getInput(sideToStopPaymentGood) == true then
  94. isGood = false
  95. rs.setOutput(sideIsPaymentGood, false)
  96. end
  97. if page == 0 and isLogged == false then
  98. clear()
  99. titolo("Pagamento con nPay - Accedi!")
  100. print("\n\n\nNome Utente:")
  101. utente = read()
  102. checkuser = http.get("http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=no&richiesta=verifica&utente=" .. utente).readAll()
  103. print("\nPassword:")
  104. password = read("#")
  105. checkpass = http.get("http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=" .. password .. "&richiesta=addebito&valore=0&utente=".. utente).readAll()
  106. risposta = textutils.unserialize(checkpass)
  107. tabcheckuser = textutils.unserialize(checkuser)
  108. if tabcheckuser.stato == "OK" and risposta.stato == "OK" then
  109. isLogged = true
  110. page = "logged"
  111. else
  112. isLogged = false
  113. term.setTextColor(colors.red)
  114. print("\n\nNome Utente o Password errati!\n\nPotrai riprovare tra 2 secondi....")
  115. sleep(1.5)
  116. os.reboot()
  117. end
  118. elseif page == "logged" and isLogged == true then
  119. clear()
  120. titolo("Pagamento con nPay - Benvenuto, " ..utente.."!")
  121. print("\n\nStai per pagare "..importo.."IC a favore di " ..beneficiario.."!")
  122. button(15, 10, "green", " PAGA ORA ")
  123. button(30, 10, "red", " ANNULLA ")
  124.  
  125. local event, bt, x, y = os.pullEvent("mouse_click")
  126. if x > 15 and x < 25 then
  127. inviaDenaro = http.get("http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=" .. password .. "&utente=" .. utente .. "&richiesta=trasferimento&valore=" .. importo .. "&beneficiario=" .. beneficiario).readAll()
  128. risultatoInvio = textutils.unserialize(inviaDenaro)
  129. if risultatoInvio.stato == "OK" then
  130. clear()
  131. titolo("Pagamento con nPay - Pagamento Effettuato")
  132. term.setTextColor(colors.lime)
  133. print("\n\nPAGAMENTO EFFETTUATO CON SUCCESSO!\n\nVerrai sloggato automaticamente tra qualche secondo...")
  134. isGood = true
  135. sleep(5)
  136. -- Slogghiamo
  137. page = 0
  138. utente = nil
  139. password = nil
  140. else
  141. clear()
  142. term.setTextColor(colors.red)
  143. print("\n\nUn errore selvatico e' appena apparso ed il pagamento non e' avvenuto con successo...\nn\Potrai riprovare tra qualche secondo...")
  144. sleep(3)
  145. -- Slogghiamo ma in modo bello
  146. os.reboot()
  147. end
  148. elseif x > 30 then
  149. print("Ok, arrivederci!")
  150. sleep(1)
  151. os.reboot()
  152. end
  153. end
  154. sleep(0.11)
  155. end
  156.  
  157.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement