Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("xdd")
- local horline = [[+-------------------------------------+]]
- local vertline = [[| |]]
- CC = "indbuildcraft:ibcItemCoinCopper"
- IC = "IC2:itemCoin"
- GC = "indbuildcraft:ibcItemCoinGold"
- DC = "indbuildcraft:ibcItemCoinDiamond"
- --GC = "minecraft:iron_ingot"
- cipa = 1
- --while true do
- --shell.run("rename startup pizda")
- --sleep(1)
- --end
- --print(GC)
- function isCoin(slot,typ)
- local item = turtle.getItemDetail(slot)
- if item == nil then
- return false
- end
- return item.name == typ
- end
- function getCount(slot)
- local item = turtle.getItemDetail(slot)
- if not item then
- return false
- end
- return item.count
- end
- function clear()
- shell.run("clear")
- end
- clear()
- function drawMenu()
- clear()
- print(horline)
- for i = 0, 9 do
- print(vertline)
- end
- print(horline)
- end
- function centerPrint(y, tekst)
- term.setCursorPos((39 / 2) - (string.len(tekst) / 2), y)
- term.write(tekst)
- end
- function printOption(y, tekst, numer)
- term.setCursorPos((39 / 2) - 14, y)
- term.write(numer .. "> ")
- centerPrint(y, tekst)
- end
- function getInput(tekst)
- term.setCursorPos(1, 13)
- term.write(tekst)
- term.setCursorPos(string.len(tekst) + 1, 13)
- local textinput = read()
- return textinput
- end
- function getInputPass(tekst)
- term.setCursorPos(1, 13)
- term.write(tekst)
- term.setCursorPos(string.len(tekst) + 1, 13)
- local textinput = read("*")
- return textinput
- end
- function buy(ilosc,typ)
- if tonumber(ilosc) == nil then
- print("ty kurwa wpisz normalna liczbe pacanie")
- sleep(2)
- os.reboot() --wypierdola biosa to reboot
- end
- if not isCoin(1,typ) then
- if typ==CC then
- return "Wloz " .. ilosc .. "CC lub przytrzymaj ctrl+r aby wyjsc"
- elseif typ==IC then
- return "Wloz " .. ilosc .. "IC lub przytrzymaj ctrl+r aby wyjsc"
- elseif typ==GC then
- return "Wloz " .. ilosc .. "GC lub przytrzymaj ctrl+r aby wyjsc"
- elseif typ==DC then
- return "Wloz " .. ilosc .. "DC lub przytrzymaj ctrl+r aby wyjsc"
- end
- end
- if getCount(1) < ilosc then
- return "Za malo"
- end
- turtle.drop(ilosc)
- return true;
- end
- function kup(ilosc,typ)
- while true do
- clear()
- local val = buy(ilosc,typ)
- if val == true then
- drawMenu()
- centerPrint(5,"Dzieki za dotacje ziomeczku!")
- sleep(3)
- os.reboot()
- end
- print(val)
- sleep(0.5)
- end
- end
- function rejestracja()
- drawMenu()
- centerPrint(5,"REJESTRACJA")
- username = getInput("Podaj nick: ")
- username = string.gsub(username," ", "")
- -- username = read()
- clear()
- drawMenu()
- centerPrint(5,"REJESTRACJA")
- password = getInputPass("Podaj haslo: ")
- password = string.gsub(password," ", "")
- if http.get("http://nightgang.pw/register.php?username="..username.."&password="..xdd.sha256(password)).readAll() == "true" then
- centerPrint(5,"Rejestracja powiodla sie!")
- sleep(3)
- main()
- else
- -- centerPrint(5,"Rejestracja nie powiodla sie!")
- centerPrint(5,"Blad polaczenia z serwerem lub")
- centerPrint(6," konto juz istnieje ")
- sleep(3)
- main()
- end
- end
- function logowanie()
- drawMenu()
- centerPrint(5,"LOGOWANIE")
- username = getInput("Podaj nick: ")
- username = string.gsub(username," ", "")
- -- username = read()
- clear()
- drawMenu()
- centerPrint(5,"LOGOWANIE")
- password = getInputPass("Podaj haslo: ")
- password = string.gsub(password," ", "")
- if http.get("http://nightgang.pw/loginx.php?username="..username.."&password="..xdd.sha256(password)).readAll() == "true" then
- loggedMenu(username)
- else
- -- centerPrint(5,"Rejestracja nie powiodla sie!")
- centerPrint(5,"Blad polaczenia z serwerem lub")
- centerPrint(6," podano bledne dane ")
- sleep(3)
- main()
- end
- end
- function loggedMenu(username)
- centerPrint(5,"Logowanie powiodlo sie!")
- sleep(3)
- drawMenu()
- printOption(5,"Sprawdz IC",1)
- printOption(6,"Wyloguj sie",2)
- local wybor = getInput("Twoj wybor: ")
- if wybor == 1 then
- drawMenu()
- centerPrint(5,"Twoje IC: ")
- centerPrint(6,JSON.parse(http.get("indbuildcraft.pl/tech/p/api/minecraft_bank_balance&lite=1&username="..username).readAll()).minecraft_bank_balance)
- sleep(3)
- loggedMenu()
- elseif wybor == 2 then
- os.reboot()
- end
- end
- function dotacja()
- drawMenu()
- printOption(5,"CC",1)
- printOption(6,"IC",2)
- printOption(7,"GC",3)
- printOption(8,"DC",4)
- local wybor = getInput("Twoj wybor: ")
- if wybor == "1" then
- drawMenu()
- centerPrint(5,"Podaj ilosc CC")
- local cc = getInput("Ilosc: ")
- kup(tonumber(cc),CC)
- elseif wybor == "2" then
- drawMenu()
- centerPrint(5,"Podaj ilosc IC")
- local ic = getInput("Ilosc: ")
- kup(tonumber(ic),IC)
- elseif wybor == "3" then
- drawMenu()
- centerPrint(5,"Podaj ilosc GC")
- local gc = getInput("Ilosc: ")
- kup(tonumber(gc),GC)
- elseif wybor == "4" then
- drawMenu()
- centerPrint(5,"Podaj ilosc DC")
- local dc = getInput("Ilosc: ")
- kup(tonumber(dc),DC)
- end
- end
- function urlencode(str)
- if (str) then
- str = string.gsub(str, "\n", "\r\n")
- str =
- string.gsub(
- str,
- "([^%w ])",
- function(c)
- return string.format("%%%02X", string.byte(c))
- end
- )
- str = string.gsub(str, " ", "%%20")
- end
- return str
- end
- function forward(ilosc)
- end
- --clear()
- --drawMenu()
- --centerPrint(5, "nudzi ci sie nereq?")
- --sleep(233)
- --clear()
- --if not http.get("http://nightgang.pw:3000/ping") then
- -- drawMenu()
- -- centerPrint(5, "Nie udalo sie polaczyc z serwerem")
- -- sleep(5)
- -- os.reboot()
- --end
- --centerPrint(5, )
- --sleep(10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement