Advertisement
DEv0on

Untitled

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