Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- usernamesetup = "tomtrein"
- turtleid = 116
- settings = {}
- num = 0
- file = fs.open("settings", "r")
- istrue = true
- i = 0
- while istrue do
- i = i+1
- string1 = file.readLine()
- if string1==nill then
- istrue = false
- break
- end
- string2 = file.readLine()
- settings[i] = string2
- end
- if not settings[4]==nill then
- order = settings[4]=="true"
- else
- order = false
- end
- file.close()
- turtleid = tonumber(settings[3])
- banking = function()
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.white)
- term.clear()
- local image = paintutils.loadImage("bank")
- paintutils.drawImage(image, 1, 1)
- term.setCursorPos(16, 8)
- term.write("Please input card")
- while not disk.hasData(settings[1]) do
- os.queueEvent("randomEvent")
- os.pullEvent()
- end
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.white)
- term.clear()
- local image = paintutils.loadImage("bank")
- paintutils.drawImage(image, 1, 1)
- term.setCursorPos(16, 8)
- term.write("Please enter code")
- code = ""
- for i=1, 4 do
- ponies=false
- while not ponies do
- local event, key = os.pullEvent("key")
- if key>1 and key<11 then
- amount = key-1
- ponies = true
- end
- end
- code = code..amount
- paintutils.drawImage(image, 1, 1)
- term.setCursorPos(16, 10)
- term.setBackgroundColor(colors.lightBlue)
- term.write(code)
- end
- shell.run("delete", "disk/temp")
- shell.run("cp", "disk/money", "disk/temp")
- file = fs.open("disk/temp", "r")
- stringcode = file.readLine()
- file.close()
- shell.run("delete", "disk/temp")
- stringcode = string.sub(stringcode, 5, -5)
- file = fs.open("disk/temp", "w")
- file.writeLine(stringcode)
- file.close()
- shell.run("decrypt", "disk/temp", code)
- file = fs.open("disk/temp", "r")
- stringcode = tonumber(file.readLine())
- file.close()
- shell.run("delete", "disk/temp")
- if stringcode == nill then
- return "n"
- else
- stringcode = stringcode - price
- if stringcode < 0 then
- return "n"
- else
- stringcode = math.random(9)..math.random(9)..math.random(9)..math.random(9)..stringcode..math.random(9)..math.random(9)..math.random(9)..math.random(9)
- file = fs.open("disk/temp", "w")
- file.writeLine(stringcode)
- file.close()
- shell.run("crypt", "disk/temp", code, "f")
- shell.run("delete", "disk/money")
- shell.run("cp", "disk/temp", "disk/money")
- shell.run("delete", "disk/temp")
- return "y"
- end
- end
- end
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.white)
- term.clear()
- local image = paintutils.loadImage("recipe")
- paintutils.drawImage(image, 13, 5)
- term.setBackgroundColor(colors.white)
- term.setCursorPos(14, 6)
- term.write("Username")
- term.setCursorPos(14, 9)
- term.write("Purchase")
- term.setCursorPos(29, 9)
- term.write("*")
- term.setCursorPos(14, 11)
- term.write("Cost:")
- list = fs.open("items", "r")
- intrue = true
- while intrue do
- local event, button, x, y = os.pullEvent( "mouse_click" )
- if y==7 and x>14 and x<28 then
- paintutils.drawLine(15,7,27,7,colors.lightBlue)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(14, 7)
- user = read()
- if user == usernamesetup then
- shell.run("fg")
- end
- if user == settings[2] then
- shell.run("menu")
- end
- end
- if y==10 and x>14 and x<28 then
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(15,10)
- term.write("go up")
- ponies=false
- while not ponies do
- local event, key = os.pullEvent("key")
- if key == keys.enter then
- ponies = true
- end
- if key == keys.up then
- paintutils.drawLine(15,10,27,10,colors.lightBlue)
- term.setCursorPos(15,10)
- num = num+1
- toprint = list.readLine()
- cost = list.readLine()
- if cost == nill or toprint == nill then
- list.close()
- list = fs.open("items", "r")
- toprint = list.readLine()
- cost = list.readLine()
- num = 1
- end
- term.write(toprint)
- thitemchosen = toprint
- end
- end
- end
- if y==10 and x==29 then
- term.setCursorPos(29, 10)
- ponies=false
- while not ponies do
- local event, key = os.pullEvent("key")
- if key>1 and key<11 then
- amount = key-1
- paintutils.drawLine(29,10,29,10,colors.lightBlue)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(29, 10)
- term.write(amount)
- ponies = true
- paintutils.drawLine(15,12,22,12,colors.lightBlue)
- term.setCursorPos(15,12)
- price = tonumber(cost)*amount
- amount2020 = amount
- term.write(price)
- end
- end
- end
- if y==13 and x>32 and x<37 then
- if price == nill and user == nill then
- else
- intrue = false
- end
- end
- end
- if banking()=="y" then
- term.setBackgroundColor(colors.white)
- term.clear()
- local image = paintutils.loadImage("bank-ok")
- term.setCursorPos(1,1)
- paintutils.drawImage(image, 1, 1)
- else
- term.setBackgroundColor(colors.white)
- term.clear()
- local image = paintutils.loadImage("bank-bad")
- term.setCursorPos(1,1)
- paintutils.drawImage(image, 1, 1)
- os.sleep(3)
- os.reboot()
- end
- if not fs.exists("money") then
- file = fs.open("money", "w")
- file.writeLine("0")
- file.close()
- end
- file = fs.open("money", "r")
- money = tonumber(file.readLine())
- if money==nill then
- money=price
- else
- money = money+price
- end
- file.close()
- shell.run("delete", "money")
- file = fs.open("money", "w")
- file.writeLine(money)
- file.close()
- temp = fs.open(user, "w")
- temp.writeLine(thitemchosen)
- temp.writeLine(amount2020)
- temp.writeLine(user)
- temp.close()
- temp = fs.open("jobs", "a")
- temp.writeLine(user)
- temp.close()
- os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment