Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("sha256")
- os.loadAPI("json")
- local horline = [[+-------------------------------------+]]
- local vertline = [[| |]]
- interface = peripheral.wrap("front")
- returnedItemCount = nil
- CC = "indbuildcraft:ibcItemCoinCopper"
- IC = "IC2:itemCoin"
- GC = "indbuildcraft:ibcItemCoinGold"
- DC = "indbuildcraft:ibcItemCoinDiamond"
- ANY = ""
- xddd = nil
- --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
- xddd = false
- elseif typ == "ANY" then
- xddd = item.name == item.name
- else
- xddd = item.name == typ
- end
- return xddd
- 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 ctrl+r aby wyjsc"
- elseif typ==IC then
- return "Wloz " .. ilosc .. "IC lub ctrl+r aby wyjsc"
- elseif typ==GC then
- return "Wloz " .. ilosc .. "GC lub ctrl+r aby wyjsc"
- elseif typ==DC then
- return "Wloz " .. ilosc .. "DC"
- elseif typ=="ANY" then
- return "Dowolny item lub ctrl+r aby wyjsc"
- end
- end
- if typ ~= "ANY" then
- if getCount(1) < ilosc then
- return "Za malo"
- end
- else
- turtle.drop(64)
- end
- turtle.drop(ilosc)
- return true;
- end
- function kupShop(ilosc,typ,username)
- while true do
- clear()
- local val = buy(ilosc,typ)
- if val == true then
- drawMenu()
- centerPrint(5,"Zakup udany!")
- sleep(1.5)
- break
- end
- drawMenu()
- centerPrint(5,val)
- sleep(0.5)
- end
- end
- function kup(ilosc,typ)
- while true do
- clear()
- local val = buy(ilosc,typ)
- if val == true then
- drawMenu()
- centerPrint(5,"Zakup udany!")
- sleep(3)
- os.reboot()
- end
- drawMenu()
- centerPrint(5,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/cc/register.php?username="..username.."&password="..sha256.sha256(password)).readAll() == "true" then
- centerPrint(5,"Rejestracja powiodla sie!")
- sleep(1)
- 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/cc/loginx.php?username="..username.."&password="..sha256.sha256(password)).readAll() == "true" then
- centerPrint(5,"Logowanie powiodlo sie!")
- 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)
- sleep(1)
- drawMenu()
- printOption(5,"Sprawdz IC",1)
- printOption(6,"Kup przedmioty",2)
- printOption(7,"Wyloguj sie",3)
- local wyborx = getInput("Twoj wybor: ")
- if wyborx == "1" then
- drawMenu()
- centerPrint(5,"Twoje IC: ")
- centerPrint(6,json.decode(http.get("http://indbuildcraft.pl/tech/p/api/minecraft_bank_balance&lite=1&username="..username).readAll()).minecraft_bank_balance)
- sleep(3)
- loggedMenu(username)
- elseif wyborx == "2" then
- drawBuyerMenu(username)
- elseif wyborx == "3" then
- os.reboot()
- else
- loggedMenu(username)
- end
- end
- function drawBuyerMenu(username)
- drawMenu()
- term.setCursorPos(3,2)
- print("1> Rubber: 1 CC za 64 szt | "..getItemCountInAE("IC2:itemRubber","0"))
- term.setCursorPos(3,3)
- print("2> Steel: 2 IC za 5 szt | "..getItemCountInAE("Railcraft:ingot","0"))
- term.setCursorPos(3,4)
- print("3> Iron: 1 IC za 32 szt | "..getItemCountInAE("minecraft:iron_ingot","0"))
- term.setCursorPos(3,5)
- print("4> Diamond: 1 IC za 16 szt | "..getItemCountInAE("minecraft:diamond","0"))
- term.setCursorPos(3,6)
- print("5> Emerald: 1 IC za 2 szt | "..getItemCountInAE("minecraft:emerald","0"))
- term.setCursorPos(3,7)
- print("6> W_Hex: 1 IC za 16 szt | "..getItemCountInAE("hexcraft:itemHexoriumCrystalWhite","0"))
- term.setCursorPos(3,8)
- print("7> Wyloguj sie")
- term.setCursorPos(3,10)
- print("W_Hex = White Hexorium")
- local wyborkupna = getInput("Twoj wybor: ")
- if wyborkupna == "1" then
- if getItemCountInAE("IC2:itemRubber","0") >= 64 then
- wyborkupna = 0
- kupShop(1,CC,username)
- interface.exportItem({id="IC2:itemRubber"},"east",64)
- drawBuyerMenu(username)
- elseif getItemCountInAE("IC2:itemRubber","0") == nil then
- drawMenu()
- centerPrint(5,"Zbyt malo itemow aby zakupic")
- sleep(2)
- drawBuyerMenu(username)
- else
- drawMenu()
- centerPrint(5,"Zbyt malo itemow aby zakupic")
- sleep(2)
- drawBuyerMenu(username)
- end
- elseif wyborkupna == "2" then
- if getItemCountInAE("Railcraft:ingot","0") >= 5 then
- wyborkupna = 0
- kupShop(2,IC,username)
- interface.exportItem({id="Railcraft:ingot"},"east",5)
- drawBuyerMenu(username)
- elseif getItemCountInAE("Railcraft:ingot","0") == nil then
- drawMenu()
- centerPrint(5,"Zbyt malo itemow aby zakupic")
- sleep(2)
- drawBuyerMenu(username)
- else
- drawMenu()
- centerPrint(5,"Zbyt malo itemow aby zakupic")
- sleep(2)
- drawBuyerMenu(username)
- end
- elseif wyborkupna == "3" then
- if getItemCountInAE("minecraft:iron_ingot","0") >= 32 then
- wyborkupna = 0
- kupShop(1,IC,username)
- interface.exportItem({id="minecraft:iron_ingot"},"east",32)
- drawBuyerMenu(username)
- elseif getItemCountInAE("minecraft:iron_ingot","0") == nil then
- drawMenu()
- centerPrint(5,"Zbyt malo itemow aby zakupic")
- sleep(2)
- drawBuyerMenu(username)
- else
- drawMenu()
- centerPrint(5,"Zbyt malo itemow aby zakupic")
- sleep(2)
- drawBuyerMenu(username)
- end
- elseif wyborkupna == "4" then
- if getItemCountInAE("minecraft:diamond","0") >= 16 then
- wyborkupna = 0
- kupShop(1,IC,username)
- interface.exportItem({id="minecraft:diamond"},"east",16)
- drawBuyerMenu(username)
- elseif getItemCountInAE("minecraft:diamond","0") == nil then
- drawMenu()
- centerPrint(5,"Zbyt malo itemow aby zakupic")
- sleep(2)
- drawBuyerMenu(username)
- else
- drawMenu()
- centerPrint(5,"Zbyt malo itemow aby zakupic")
- sleep(2)
- drawBuyerMenu(username)
- end
- elseif wyborkupna == "5" then
- if getItemCountInAE("minecraft:emerald","0") >= 2 then
- wyborkupna = 0
- kupShop(1,IC,username)
- interface.exportItem({id="minecraft:emerald"},"east",2)
- drawBuyerMenu(username)
- elseif getItemCountInAE("minecraft:emerald","0") == nil then
- drawMenu()
- centerPrint(5,"Zbyt malo itemow aby zakupic")
- sleep(2)
- drawBuyerMenu(username)
- else
- drawMenu()
- centerPrint(5,"Zbyt malo itemow aby zakupic")
- sleep(2)
- drawBuyerMenu(username)
- end
- elseif wyborkupna == "7" then
- os.reboot()
- elseif wyborkupna == "6" then
- if getItemCountInAE("hexcraft:itemHexoriumCrystalWhite","0") >= 16 then
- wyborkupna = 0
- kupShop(1,IC,username)
- interface.exportItem({id="hexcraft:itemHexoriumCrystalWhite"},"east",16)
- drawBuyerMenu(username)
- elseif getItemCountInAE("hexcraft:itemHexoriumCrystalWhite","0") == nil then
- drawMenu()
- centerPrint(5,"Zbyt malo itemow aby zakupic")
- sleep(2)
- drawBuyerMenu(username)
- else
- drawMenu()
- centerPrint(5,"Zbyt malo itemow aby zakupic")
- sleep(2)
- drawBuyerMenu(username)
- end
- else
- drawBuyerMenu(username)
- end
- end
- function getItemCountInAE(itemid,dmg)
- returnedItemCount = 0
- itemList = interface.getAvailableItems()
- for k,v in pairs(itemList) do
- if v.fingerprint.id == itemid then
- if v.fingerprint.dmg == tonumber(dmg) then
- returnedItemCount = v.size
- end
- end
- end
- if returnedItemCount == nil then
- returnedItemCount = 0
- end
- return returnedItemCount
- end
- function dotacja()
- drawMenu()
- printOption(5,"CC",1)
- printOption(6,"IC",2)
- printOption(7,"GC",3)
- printOption(8,"DC",4)
- printOption(9,"Dowolny przedmiot",5)
- 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)
- elseif wybor == "5" then
- kup(1,"ANY")
- else
- dotacja()
- 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)
Add Comment
Please, Sign In to add comment