Advertisement
Filmos

Crypto - verifier

Jun 13th, 2024 (edited)
703
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.40 KB | None | 0 0
  1. HASH = "c25cbfb45654dad36efe68077710cc60"
  2. function selfInstall()
  3.     fileContents = 'shell.run("pastebin run 3HeLiT7k")'
  4.     local file = fs.open("startup", "w")
  5.     file.write(fileContents)
  6.     file.close()
  7. end
  8.  
  9. function krypto()
  10.     display = nil
  11.     inventory = {nil, 0}
  12.  
  13.     function setDisplay(disp)
  14.         display = disp
  15.     end
  16.     function setInventory(accessor, slotCount)
  17.         inventory = {accessor, slotCount}
  18.     end
  19.  
  20.     function check(nbt)
  21.         if nbt.name ~= "ironchests:key" then
  22.             return "not currency"
  23.         end
  24.         if nbt.nbt ~= HASH then
  25.             return "FAKE CURRENCY!"
  26.         end
  27.         return "valid currency"
  28.     end
  29.     function full_check()
  30.         display.clear()
  31.         display.setCursorPos(1, 1)
  32.         for i = 1, inventory[2] do
  33.             nbt = inventory[1](i)
  34.             if nbt ~= nil then
  35.                 display.write("Slot " .. i .. " - " .. check(nbt) .. "\n")
  36.                 x, y = display.getCursorPos()
  37.                 display.setCursorPos(1, y + 1)
  38.             end
  39.         end
  40.     end
  41.     function run()
  42.         while true do
  43.             full_check()
  44.             sleep(1)
  45.         end
  46.     end
  47.  
  48.     return {
  49.         setDisplay = setDisplay,
  50.         setInventory = setInventory,
  51.         run = run
  52.     }
  53. end
  54.  
  55. selfInstall()
  56. k = krypto()
  57. k.setDisplay(term)
  58. k.setInventory(turtle.getItemDetail, 16)
  59. k.run()
  60.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement