Advertisement
Guest User

xApix

a guest
Nov 12th, 2017
431
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.58 KB | None | 0 0
  1. os.loadAPI("xdd")
  2. local horline = [[+-------------------------------------+]]
  3.  
  4. local vertline = [[|                                     |]]
  5.  
  6. CC = "indbuildcraft:ibcItemCoinCopper"
  7. IC = "IC2:itemCoin"
  8. GC = "indbuildcraft:ibcItemCoinGold"
  9. DC = "indbuildcraft:ibcItemCoinDiamond"
  10.  
  11. --GC = "minecraft:iron_ingot"
  12.  
  13. cipa = 1
  14. --while true do
  15.     --shell.run("rename startup pizda")
  16.     --sleep(1)
  17. --end
  18. --print(GC)
  19.  
  20. function isCoin(slot,typ)
  21.     local item = turtle.getItemDetail(slot)
  22.     if item == nil then
  23.         return false
  24.     end
  25.     return item.name == typ
  26. end
  27.  
  28. function getCount(slot)
  29.     local item = turtle.getItemDetail(slot)
  30.     if not item then
  31.         return false
  32.     end
  33.     return item.count
  34. end
  35.  
  36. function clear()
  37.     shell.run("clear")
  38. end
  39.  
  40. clear()
  41.  
  42. function drawMenu()
  43.     clear()
  44.     print(horline)
  45.     for i = 0, 9 do
  46.         print(vertline)
  47.     end
  48.     print(horline)
  49. end
  50.  
  51. function centerPrint(y, tekst)
  52.     term.setCursorPos((39 / 2) - (string.len(tekst) / 2), y)
  53.     term.write(tekst)
  54. end
  55.  
  56. function printOption(y, tekst, numer)
  57.     term.setCursorPos((39 / 2) - 14, y)
  58.     term.write(numer .. "> ")
  59.     centerPrint(y, tekst)
  60. end
  61.  
  62. function getInput(tekst)
  63.     term.setCursorPos(1, 13)
  64.     term.write(tekst)
  65.     term.setCursorPos(string.len(tekst) + 1, 13)
  66.     local textinput = read()
  67.     return textinput
  68. end
  69. function getInputPass(tekst)
  70.     term.setCursorPos(1, 13)
  71.     term.write(tekst)
  72.     term.setCursorPos(string.len(tekst) + 1, 13)
  73.     local textinput = read("*")
  74.     return textinput
  75. end
  76.  
  77. function buy(ilosc,typ)
  78.     if tonumber(ilosc) == nil then
  79.       print("ty kurwa wpisz normalna liczbe pacanie")
  80.       sleep(2)
  81.       os.reboot() --wypierdola biosa to reboot
  82.     end
  83.     if not isCoin(1,typ) then
  84.       if typ==cc then
  85.         return "Wloz " .. ilosc .. "CC lub przytrzymaj ctrl+r aby wyjsc"
  86.       elseif typ==ic then
  87.        
  88.     end
  89.     if getCount(1) < ilosc then
  90.         return "Za malo"
  91.     end
  92.     turtle.drop(ilosc)
  93.     return http.get("http://nightgang.pw:3000/?amount=" .. ilosc).readAll()
  94. end
  95.  
  96. function kup(ilosc,typ)
  97.     while true do
  98.         clear()
  99.         local val = buy(ilosc,typ)
  100.         if string.find(val, "token") then
  101.             print(
  102.                 string.gsub(val, "token", "") ..
  103.                     " to twoj token, zapisz go bo bedzie ci potrzebny do edytowania reklamy. Masz na to 15 sekund"
  104.             )
  105.             sleep(15)
  106.             os.reboot()
  107.         end
  108.         print(val)
  109.         sleep(0.5)
  110.     end
  111. end
  112.  
  113. function rejestracja()
  114.     drawMenu()
  115.     centerPrint(5,"REJESTRACJA")
  116.    username = getInput("Podaj nick: ")
  117.    username = string.gsub(username," ", "")
  118. --    username = read()
  119.     clear()
  120.     drawMenu()
  121.     centerPrint(5,"REJESTRACJA")
  122.    password =  getInputPass("Podaj haslo: ")
  123.    password = string.gsub(password," ", "")
  124.     if http.get("http://nightgang.pw/register.php?username="..username.."&password="..xdd.sha256(password)).readAll() == "true" then
  125.         centerPrint(5,"Rejestracja powiodla sie!")
  126.         sleep(3)
  127.         main()
  128.     else
  129. --       centerPrint(5,"Rejestracja nie powiodla sie!")
  130.         centerPrint(5,"Blad polaczenia z serwerem lub")
  131.         centerPrint(6,"      konto juz istnieje      ")
  132.         sleep(3)
  133.         main()
  134.     end
  135. end
  136. function logowanie()
  137.     drawMenu()
  138.     centerPrint(5,"LOGOWANIE")
  139.    username = getInput("Podaj nick: ")
  140.    username = string.gsub(username," ", "")
  141. --    username = read()
  142.     clear()
  143.     drawMenu()
  144.     centerPrint(5,"LOGOWANIE")
  145.    password =  getInputPass("Podaj haslo: ")
  146.    password = string.gsub(password," ", "")
  147.     if http.get("http://nightgang.pw/loginx.php?username="..username.."&password="..xdd.sha256(password)).readAll() == "true" then
  148.         centerPrint(5,"Logowanie powiodlo sie!")
  149.         sleep(3)
  150.         main()
  151.     else
  152. --       centerPrint(5,"Rejestracja nie powiodla sie!")
  153.         centerPrint(5,"Blad polaczenia z serwerem lub")
  154.         centerPrint(6,"      podano bledne dane      ")
  155.         sleep(3)
  156.         main()
  157.     end
  158. end
  159.  
  160. function dotacja()
  161.     drawMenu()
  162.     printOption(5,"CC",1)
  163.     printOption(6,"IC",2)
  164.     printOption(7,"GC",3)
  165.     printOption(8,"DC",4)
  166.     local wybor = getInput("Twoj wybor: ")
  167.     if wybor == "1" then
  168.         drawMenu()
  169.         centerPrint(5,"Podaj ilosc CC")
  170.         local cc = getInput("Ilosc: ")
  171.         kup(tonumber(cc),CC)
  172.     elseif wybor == "2" then
  173.         drawMenu()
  174.         centerPrint(5,"Podaj ilosc IC")
  175.         local ic = getInput("Ilosc: ")
  176.         kup(tonumber(ic),IC)
  177.     elseif wybor == "3" then
  178.         drawMenu()
  179.         centerPrint(5,"Podaj ilosc GC")
  180.         local gc = getInput("Ilosc: ")
  181.         kup(tonumber(gc),GC)
  182.     elseif wybor == "4" then
  183.         drawMenu()
  184.         centerPrint(5,"Podaj ilosc DC")
  185.         local dc = getInput("Ilosc: ")
  186.         kup(tonumber(dc),DC)
  187.     end
  188. end
  189.  
  190.  
  191. function urlencode(str)
  192.     if (str) then
  193.         str = string.gsub(str, "\n", "\r\n")
  194.         str =
  195.             string.gsub(
  196.             str,
  197.             "([^%w ])",
  198.             function(c)
  199.                 return string.format("%%%02X", string.byte(c))
  200.             end
  201.         )
  202.         str = string.gsub(str, " ", "%%20")
  203.     end
  204.     return str
  205. end
  206.  
  207. function forward(ilosc)
  208. end
  209.  
  210. --clear()
  211. --drawMenu()
  212. --centerPrint(5, "nudzi ci sie nereq?")
  213. --sleep(233)
  214.  
  215. --clear()
  216. --if not http.get("http://nightgang.pw:3000/ping") then
  217. --    drawMenu()
  218. --    centerPrint(5, "Nie udalo sie polaczyc z serwerem")
  219. --    sleep(5)
  220. --    os.reboot()
  221. --end
  222. --centerPrint(5, )
  223. --sleep(10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement