Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- oldPullEvent = os.pullEvent
- os.pullEvent = os.pullEventRaw
- --[[
- FusionCoins Wallet
- Coded by fun_ride
- Backend coded by Luca_S
- ]]--
- function drawFusion(x,y)
- paintutils.drawPixel(x,y,colors.red)
- paintutils.drawPixel(x + 1,y,colors.orange)
- paintutils.drawPixel(x,y + 1,colors.orange)
- paintutils.drawPixel(x + 1, y + 1,colors.red)
- term.setCursorPos(x,y)
- term.setBackgroundColor(colors.red)
- write("/")
- term.setCursorPos(x + 1,y)
- term.setBackgroundColor(colors.orange)
- write("\\")
- term.setCursorPos(x,y + 1)
- write("\\")
- term.setCursorPos(x + 1,y + 1)
- term.setBackgroundColor(colors.red)
- write("/")
- end
- os.loadAPI("/fusion/graphix")
- graphix.bgColor(colors.white)
- drawFusion(3,3)
- term.setCursorPos(7,5)
- term.setTextColor(colors.red)
- term.setBackgroundColor(colors.white)
- write("Username: ")
- local username = read()
- term.setCursorPos(7,6)
- write("Password: ")
- os.loadAPI("/fusion/sha256")
- local pass = sha256.sha256(read('*'))
- os.loadAPI("/fusion/api")
- os.loadAPI("/fusion/sha256")
- graphix.bgColor(colors.white)
- term.setBackgroundColor(colors.gray)
- term.setCursorPos(1,2)
- term.clearLine()
- if api.login(username,pass) then
- term.setTextColor(colors.lime)
- graphix.center(2,"Logged in.")
- else
- createUser = api.create(username,pass)
- if createUser == true then
- term.setTextColor(colors.lime)
- graphix.center(2,"Created user.")
- else
- term.setTextColor(colors.red)
- graphix.center(2,"Username Taken / Wrong Password")
- sleep(2)
- graphix.bgColor(colors.black)
- return
- end
- end
- sleep(5)
- term.setBackgroundColor(colors.white)
- graphix.totalClear()
- function drawMenu()
- graphix.bgColor(colors.white)
- term.setTextColor(colors.black)
- graphix.center(1,"Username: "..username)
- graphix.center(2,"Balance: "..api.getBalance(username))
- term.setBackgroundColor(colors.orange)
- term.setTextColor(colors.red)
- term.setCursorPos(3,5)
- print("Transaction")
- term.setCursorPos(3,7)
- print("Delete")
- term.setCursorPos(3,9)
- print("Exit")
- term.setCursorPos(1,18)
- local stream1 = http.get("http://www.fusionpoints.site50.net/announce.php")
- local stream = stream1.readAll():gsub("<!-- Hosting24 Analytics Code -->
- <script type="text/javascript" src="http://stats/hosting24.com/count.php"></script>
- <!-- End Of Analytics Code -->","")
- if stream == "No MSG" then
- -- Do nothing
- stream.close()
- else
- print("Service Announcement: "..stream.readAll())
- stream.close()
- end
- end
- drawMenu()
- --sleep(10)
- while true do
- drawMenu()
- e, b, x, y = os.pullEvent("mouse_click")
- if x > 3 and x < 14 and y == 5 then
- graphix.bgColor(colors.white)
- drawFusion(1,1)
- term.setCursorPos(3,3)
- term.setTextColor(colors.orange)
- term.setBackgroundColor(colors.white)
- write("Send to: ")
- local toUser = read()
- term.setCursorPos(3,4)
- write("Amount: ")
- local userAmt = tonumber(read())
- if userAmt == nil then
- term.setTextColor(colors.red)
- graphix.center(6,"Amount not a number.")
- else
- trans = api.transaction(username,pass,toUser,userAmt)
- if trans == "User doesn't exists!" then
- term.setTextColor(colors.red)
- graphix.center(7,"User doesn't exist!")
- sleep(1.5)
- elseif trans == "Not enough CST" then
- term.setTextColor(colors.red)
- graphix.center(7,"Insufficent Funds!")
- sleep(1.5)
- elseif trans == "Negative amount" then
- term.setTextColor(colors.red)
- graphix.center(7,"Negative funds!")
- sleep(1.5)
- elseif toUser == username then
- term.setTextColor(colors.red)
- graphix.center(7,"Cannot give money to yourself!")
- sleep(1.5)
- else
- term.setTextColor(colors.green)
- graphix.center(7,"Transfer Successful!")
- sleep(1.5)
- end
- end
- if x > 3 and x < 10 and y == 9 then
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.white)
- return
- end
- if x > 3 and x < 9 and y == 7 then
- graphix.bgColor(colors.white)
- term.setTextColor(colors.white)
- drawFusion(1,1)
- term.setTextColor(colors.red)
- graphix.center(1,"Account deletion")
- term.setCursorPos(3,5)
- print("Are you sure you want to delete account "..username.."?")
- term.setCursorPos(3,6)
- print("Press 1 to delete account.")
- term.setCursorPos(3,7)
- print("Press 2 to go back.")
- local e = {os.pullEvent("key")}
- if e == "key" and key == 1 then
- graphix.bgColor(colors.white)
- term.setTextColor(colors.red)
- graphix.center(1,"Confirm account login.")
- term.setCursorPos(3,3)
- write("Username: ")
- local delUser = read()
- term.setCursorPos(3,4)
- write("Password: ")
- local delPassword = sha256.sha256(read('*'))
- if not username == delUser then
- term.clear()
- term.setCursorPos(1,1)
- print("Account not deleted.")
- print("Reason: Wrong Username / Password.")
- return
- end
- local log = api.delete(delUser,delPassword)
- if log then
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.clear()
- term.setCursorPos(1,1)
- print("Thanks for being a member of FusionCoins!")
- return
- end
- if not log then
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.clear()
- term.setCursorPos(1,1)
- print("Account not deleted.")
- print("Reason: Wrong Username / Password")
- return
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement