Advertisement
DEv0on

Untitled

Nov 12th, 2017
440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.24 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. loggedMenu(username)
  152. else
  153. -- centerPrint(5,"Rejestracja nie powiodla sie!")
  154. centerPrint(5,"Blad polaczenia z serwerem lub")
  155. centerPrint(6," podano bledne dane ")
  156. sleep(3)
  157. main()
  158. end
  159. end
  160.  
  161. function loggedMenu(username)
  162. centerPrint(5,"Logowanie powiodlo sie!")
  163. sleep(3)
  164. drawMenu()
  165. printOption(5,"Sprawdz IC",1)
  166. printOption(6,"Wyloguj sie",2)
  167. local wybor = getInput("Twoj wybor: ")
  168. if wybor == 1 then
  169. drawMenu()
  170. centerPrint(5,"Twoje IC: ")
  171. centerPrint(6,JSON.parse(http.get("indbuildcraft.pl/tech/p/api/minecraft_bank_balance&lite=1&username="..username).readAll()).minecraft_bank_balance)
  172. sleep(3)
  173. loggedMenu()
  174. elseif wybor == 2 then
  175. os.reboot()
  176. end
  177. end
  178.  
  179. function dotacja()
  180. drawMenu()
  181. printOption(5,"CC",1)
  182. printOption(6,"IC",2)
  183. printOption(7,"GC",3)
  184. printOption(8,"DC",4)
  185. local wybor = getInput("Twoj wybor: ")
  186. if wybor == "1" then
  187. drawMenu()
  188. centerPrint(5,"Podaj ilosc CC")
  189. local cc = getInput("Ilosc: ")
  190. kup(tonumber(cc),CC)
  191. elseif wybor == "2" then
  192. drawMenu()
  193. centerPrint(5,"Podaj ilosc IC")
  194. local ic = getInput("Ilosc: ")
  195. kup(tonumber(ic),IC)
  196. elseif wybor == "3" then
  197. drawMenu()
  198. centerPrint(5,"Podaj ilosc GC")
  199. local gc = getInput("Ilosc: ")
  200. kup(tonumber(gc),GC)
  201. elseif wybor == "4" then
  202. drawMenu()
  203. centerPrint(5,"Podaj ilosc DC")
  204. local dc = getInput("Ilosc: ")
  205. kup(tonumber(dc),DC)
  206. end
  207. end
  208.  
  209.  
  210. function urlencode(str)
  211. if (str) then
  212. str = string.gsub(str, "\n", "\r\n")
  213. str =
  214. string.gsub(
  215. str,
  216. "([^%w ])",
  217. function(c)
  218. return string.format("%%%02X", string.byte(c))
  219. end
  220. )
  221. str = string.gsub(str, " ", "%%20")
  222. end
  223. return str
  224. end
  225.  
  226. function forward(ilosc)
  227. end
  228.  
  229. --clear()
  230. --drawMenu()
  231. --centerPrint(5, "nudzi ci sie nereq?")
  232. --sleep(233)
  233.  
  234. --clear()
  235. --if not http.get("http://nightgang.pw:3000/ping") then
  236. -- drawMenu()
  237. -- centerPrint(5, "Nie udalo sie polaczyc z serwerem")
  238. -- sleep(5)
  239. -- os.reboot()
  240. --end
  241. --centerPrint(5, )
  242. --sleep(10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement