Advertisement
DEv0on

Untitled

Nov 12th, 2017
493
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.01 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. return "Wloz " .. ilosc .. "IC lub przytrzymaj ctrl+r aby wyjsc"
  88. elseif typ==GC then
  89. return "Wloz " .. ilosc .. "GC lub przytrzymaj ctrl+r aby wyjsc"
  90. elseif typ==DC then
  91. return "Wloz " .. ilosc .. "DC lub przytrzymaj ctrl+r aby wyjsc"
  92. end
  93. end
  94. if getCount(1) < ilosc then
  95. return "Za malo"
  96. end
  97. turtle.drop(ilosc)
  98. return true;
  99. end
  100.  
  101. function kup(ilosc,typ)
  102. while true do
  103. clear()
  104. local val = buy(ilosc,typ)
  105. if val == true then
  106. drawMenu()
  107. centerPrint(5,"Dzieki za dotacje ziomeczku!")
  108. sleep(3)
  109. os.reboot()
  110. end
  111. print(val)
  112. sleep(0.5)
  113. end
  114. end
  115.  
  116. function rejestracja()
  117. drawMenu()
  118. centerPrint(5,"REJESTRACJA")
  119. username = getInput("Podaj nick: ")
  120. username = string.gsub(username," ", "")
  121. -- username = read()
  122. clear()
  123. drawMenu()
  124. centerPrint(5,"REJESTRACJA")
  125. password = getInputPass("Podaj haslo: ")
  126. password = string.gsub(password," ", "")
  127. if http.get("http://nightgang.pw/register.php?username="..username.."&password="..xdd.sha256(password)).readAll() == "true" then
  128. centerPrint(5,"Rejestracja powiodla sie!")
  129. sleep(3)
  130. main()
  131. else
  132. -- centerPrint(5,"Rejestracja nie powiodla sie!")
  133. centerPrint(5,"Blad polaczenia z serwerem lub")
  134. centerPrint(6," konto juz istnieje ")
  135. sleep(3)
  136. main()
  137. end
  138. end
  139. function logowanie()
  140. drawMenu()
  141. centerPrint(5,"LOGOWANIE")
  142. username = getInput("Podaj nick: ")
  143. username = string.gsub(username," ", "")
  144. -- username = read()
  145. clear()
  146. drawMenu()
  147. centerPrint(5,"LOGOWANIE")
  148. password = getInputPass("Podaj haslo: ")
  149. password = string.gsub(password," ", "")
  150. if http.get("http://nightgang.pw/loginx.php?username="..username.."&password="..xdd.sha256(password)).readAll() == "true" then
  151. centerPrint(5,"Logowanie powiodlo sie!")
  152. sleep(3)
  153. drawMenu()
  154. printOption(5,"Sprawdz IC",1)
  155. local wybor = getInput("Twoj wybor: ")
  156. if wybor == 1 then
  157. drawMenu()
  158. centerPrint(5,"Twoje IC: ")
  159. centerPrint(6,JSON.parse(http.get("indbuildcraft.pl/tech/p/api/minecraft_bank_balance&lite=1&username="..username).readAll()).minecraft_bank_balance)
  160. else
  161. -- centerPrint(5,"Rejestracja nie powiodla sie!")
  162. centerPrint(5,"Blad polaczenia z serwerem lub")
  163. centerPrint(6," podano bledne dane ")
  164. sleep(3)
  165. main()
  166. end
  167. end
  168.  
  169. function dotacja()
  170. drawMenu()
  171. printOption(5,"CC",1)
  172. printOption(6,"IC",2)
  173. printOption(7,"GC",3)
  174. printOption(8,"DC",4)
  175. local wybor = getInput("Twoj wybor: ")
  176. if wybor == "1" then
  177. drawMenu()
  178. centerPrint(5,"Podaj ilosc CC")
  179. local cc = getInput("Ilosc: ")
  180. kup(tonumber(cc),CC)
  181. elseif wybor == "2" then
  182. drawMenu()
  183. centerPrint(5,"Podaj ilosc IC")
  184. local ic = getInput("Ilosc: ")
  185. kup(tonumber(ic),IC)
  186. elseif wybor == "3" then
  187. drawMenu()
  188. centerPrint(5,"Podaj ilosc GC")
  189. local gc = getInput("Ilosc: ")
  190. kup(tonumber(gc),GC)
  191. elseif wybor == "4" then
  192. drawMenu()
  193. centerPrint(5,"Podaj ilosc DC")
  194. local dc = getInput("Ilosc: ")
  195. kup(tonumber(dc),DC)
  196. end
  197. end
  198.  
  199.  
  200. function urlencode(str)
  201. if (str) then
  202. str = string.gsub(str, "\n", "\r\n")
  203. str =
  204. string.gsub(
  205. str,
  206. "([^%w ])",
  207. function(c)
  208. return string.format("%%%02X", string.byte(c))
  209. end
  210. )
  211. str = string.gsub(str, " ", "%%20")
  212. end
  213. return str
  214. end
  215.  
  216. function forward(ilosc)
  217. end
  218.  
  219. --clear()
  220. --drawMenu()
  221. --centerPrint(5, "nudzi ci sie nereq?")
  222. --sleep(233)
  223.  
  224. --clear()
  225. --if not http.get("http://nightgang.pw:3000/ping") then
  226. -- drawMenu()
  227. -- centerPrint(5, "Nie udalo sie polaczyc z serwerem")
  228. -- sleep(5)
  229. -- os.reboot()
  230. --end
  231. --centerPrint(5, )
  232. --sleep(10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement