Advertisement
DEv0on

Untitled

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