Advertisement
lego11

ritiro premio

May 26th, 2023 (edited)
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.00 KB | None | 0 0
  1. local maxw, maxh = term.getSize()
  2.  
  3. function clear()
  4. term.clear()
  5. term.setCursorPos(1, 1)
  6. end
  7.  
  8. function clearRed()
  9. sfondo(colors.red)
  10. term.clear()
  11. term.setCursorPos(1, 1)
  12. end
  13.  
  14. function colore(sfumatura) term.setTextColour(sfumatura) end
  15.  
  16. function sfondo(sfumaturaSfondo) term.setBackgroundColour(sfumaturaSfondo) end
  17.  
  18. function fineColore() term.setTextColour(colours.white) end
  19.  
  20. function fineSfondo() term.setBackgroundColour(colours.black) end
  21.  
  22.  
  23. -- IMPLEMENTAZIONE DEL DRAWFILLEDBOX
  24. local function drawPixelInternal(xPos, yPos)
  25. term.setCursorPos(xPos, yPos)
  26. term.write(" ")
  27. end
  28.  
  29. local tColourLookup = {}
  30. for n = 1, 16 do
  31. tColourLookup[string.byte("0123456789abcdef", n, n)] = 2 ^ (n - 1)
  32. end
  33.  
  34. function drawFilledBox(startX, startY, endX, endY, nColour)
  35. if type(startX) ~= "number" or type(startX) ~= "number" or type(endX) ~=
  36. "number" or type(endY) ~= "number" or
  37. (nColour ~= nil and type(nColour) ~= "number") then
  38. error("Expected startX, startY, endX, endY, colour", 2)
  39. end
  40.  
  41. startX = math.floor(startX)
  42. startY = math.floor(startY)
  43. endX = math.floor(endX)
  44. endY = math.floor(endY)
  45.  
  46. if nColour then term.setBackgroundColor(nColour) end
  47. if startX == endX and startY == endY then
  48. drawPixelInternal(startX, startY)
  49. return
  50. end
  51.  
  52. local minX = math.min(startX, endX)
  53. if minX == startX then
  54. minY = startY
  55. maxX = endX
  56. maxY = endY
  57. else
  58. minY = endY
  59. maxX = startX
  60. maxY = startY
  61. end
  62.  
  63. for x = minX, maxX do for y = minY, maxY do drawPixelInternal(x, y) end end
  64. end
  65.  
  66.  
  67. function titolo(testo)
  68. drawFilledBox(1, 1, maxw, 1, colors.yellow)
  69. term.setCursorPos((maxw - #testo) / 2, 1)
  70. colore(colors.black)
  71. term.write(testo)
  72. term.setBackgroundColor(colors.black)
  73. colore(colors.white)
  74. end
  75.  
  76. function errore(errore)
  77. sfondo(colors.red)
  78. colore(colors.white)
  79. term.clear()
  80. term.setCursorPos(1, 1)
  81. titolo("Errore irreversibile")
  82. term.setCursorPos(1, 3)
  83. sfondo(colors.red)
  84. colore(colors.white)
  85. print(errore)
  86. print("\n\n\nAttendere qualche secondo...")
  87. os.sleep(5)
  88. os.reboot()
  89. end
  90.  
  91. clear()
  92. titolo("MINISTERO DELL'ABBODANZA")
  93. print("\n\nRitiro premio giornaliero per VOTO SERVER")
  94. print("")
  95. print("Dopo aver votato il server su MineAlpha, ritira il premio su questo computer.")
  96. print("")
  97. colore(colors.orange)
  98. print("PER RITIRARE IL PREMIO:")
  99. print("Fare clic DESTRO sul sensore sottostante")
  100. local event, player = os.pullEvent("player")
  101.  
  102. sfondo(colours.blue)
  103. term.clear()
  104. term.setCursorPos(1, 1)
  105. titolo("Autenticati con Nebraska Pay")
  106. sfondo(colours.blue)
  107. colore(colors.white)
  108. print(
  109. "\n\nInserire i propri dati (non verrà effettuato alcun addebito). Premere Enter per confermare i dati inseriti. \nSe i dati sono errati, il programma chiederà di reinserirli nuovamente.")
  110.  
  111. -- nomeutente
  112. term.setCursorPos(1, 9)
  113. term.write("Nome utente:")
  114. term.setCursorPos(15, 9)
  115. fineColore()
  116. utenteAccettato = false
  117. conteggioErrori = 0
  118. while utenteAccettato == false do
  119. utente = read()
  120. utente = string.gsub(utente, "%s", "")
  121. checkuser = http.get(
  122. "http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=no&richiesta=verifica&utente=" ..
  123. utente).readAll()
  124. tabcheckuser = textutils.unserialize(checkuser)
  125. if tabcheckuser.stato == "OK" then
  126. term.setCursorPos(15, 9)
  127. colore(colours.lime)
  128. term.write(utente)
  129. fineColore()
  130. utenteAccettato = true
  131. else
  132. term.setCursorPos(15, 9)
  133. colore(colours.red)
  134. term.write("Utente errato! ")
  135. sleep(2)
  136. term.setCursorPos(15, 9)
  137. fineColore()
  138. term.write(" ")
  139. term.setCursorPos(15, 9)
  140. conteggioErrori = conteggioErrori + 1
  141. if conteggioErrori > 2 then
  142. term.setCursorPos(15, 9)
  143. colore(colours.red)
  144. errore("Troppi tentativi di immissione errati ")
  145. end
  146. end
  147. end
  148.  
  149. colore(colours.white)
  150. term.setCursorPos(1, 11)
  151. term.write("Password:")
  152. term.setCursorPos(15, 11)
  153. conteggioErrori = 0
  154. passAccettata = false
  155. while passAccettata == false do
  156. fineColore()
  157. password = read("#")
  158. colore(colours.black)
  159. checkuser = http.get(
  160. "http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=" ..
  161. password .. "&richiesta=addebito&valore=0&utente=" ..
  162. utente).readAll()
  163. risposta = textutils.unserialize(checkuser)
  164. if risposta.stato == "OK" then
  165. term.setCursorPos(15, 11)
  166. colore(colours.lime)
  167. term.write("############## ")
  168. fineColore()
  169. passAccettata = true
  170. else
  171. term.setCursorPos(15, 11)
  172. colore(colours.red)
  173. term.write("Password errata! ")
  174. conteggioErrori = conteggioErrori + 1
  175. sleep(2)
  176. term.setCursorPos(15, 11)
  177. term.write(" ")
  178. term.setCursorPos(15, 11)
  179. if conteggioErrori > 2 then
  180. term.setCursorPos(15, 11)
  181. colore(colours.red)
  182. errore("Troppi tentativi di immissione errati")
  183. end
  184. end
  185. end
  186.  
  187. local checkRaw = http.get("http://172.16.20.220/luanet/servlets/votesystem/?user=" .. player .. "&npay_user=" .. utente).readAll()
  188. local check = textutils.unserialize(checkRaw)
  189.  
  190. if check.stato == "EA" then
  191. errore(check.errore)
  192. end
  193.  
  194. sfondo(colors.black)
  195. colore(colors.lime)
  196. term.clear()
  197. term.setCursorPos(1, 1)
  198. titolo("Premio erogato")
  199. term.setCursorPos(1, 3)
  200. sfondo(colors.black)
  201. colore(colors.lime)
  202. print("\n\n\nIl reddito giornaliero è stato accreditato sul proprio conto Nebraska Pay: " .. utente .. ".\n\nGloria al Ministero dell'Abbondanza.")
  203. os.sleep(5)
  204. shell.run("rm startup")
  205. shell.run("pastebin get g1LaZuH3 startup")
  206. os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement