Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[||
- Wow's users API
- This API need:
- -Modem
- -StringUtilsAPI
- All of the bank's servers and API are made by wow.
- All of the bank's graphics are made by Kuruyia.
- ||]]
- --[[
- 0 = Nothing
- 1 = nil / bad type
- 2 = unknown user
- 3 = nil Token: Outdated
- 4 = Bad Token: Outdated
- 5 = Bad Password
- 6 = Bad accesslevel
- 7 = ?
- 8 = Not engouth money (RIP)
- 9 = Unknown User to send
- ]]
- if not fs.exists("/StringUtils") then shell.run("pastebin get ad3aUsVw StringUtils") end
- local channel = 644
- local modem = peripheral.find("modem")
- local encryptionPass = "1"
- os.loadAPI("StringUtils")
- local function checkopened()
- if not modem.isOpen(channel) then modem.open(channel) end
- return true
- end
- local function addCheck(sTable, Username, password,noSHA)
- local cryptoken
- if noSHA then
- cryptoken = password
- else
- cryptoken = StringUtils.encrypt(encryptionPass, password)
- end
- sTable["fromUsername"] = Username
- sTable["fromPassword"] = cryptoken
- sTable["fromId"] = os.getComputerID()
- return sTable
- end
- local function send(sTable, password, Username, noSHA)
- checkopened()
- if sTable == nil then return 0x1 end
- local sTable = addCheck(sTable, password, Username, noSHA)
- modem.transmit(channel, channel, sTable)
- local x = true
- while x do
- local event, side, sChan, rChan, msg, distance = os.pullEvent("modem_message")
- if sChan == channel then
- x = false
- return msg
- end
- end
- end
- local pingInfo
- local function timeout()
- sleep(1)
- pingInfo = false
- return false
- end
- local function localPing()
- local TEMP_TABLE = {type = "ping"}
- send(TEMP_TABLE, "ptdr", "joke")
- pingInfo = true
- return true
- end
- function ping()
- parallel.waitForAny(timeout, localPing)
- return pingInfo
- end
- function createUser(username, password, biolock, al, uName, uPassword) --Will be removed in future (RIP)
- if username == nil or password == nil or biolock == nil or type(al) ~= "number" or type(uName) ~= "string" or type(uPassword) ~= "string" then
- return 0x1
- else
- local TEMP_TABLE = {type = "database", todo = "createUser", Username = username, Password = password, Biolock = biolock, accesslevel = al}
- local lol = textutils.serialise(TEMP_TABLE)
- return send(TEMP_TABLE, uName, uPassword)
- end
- end
- local function resetDB(uName, uPassword) --Will be removed in the future (Only for beta)
- if type(uName) ~= "string" or type(uPassword) ~= "string" then return 0x1 end
- local TEMP_TABLE = {type = "database", todo = "reset"}
- return send(TEMP_TABLE, uName,uPassword)
- end
- function getInfo(uName, uPassword)
- if type(uName) ~= "string" or type(uPassword) ~= "string" then
- return 0x1
- else
- local TEMP_TABLE = {type = "database", todo = "Userinfo"}
- return send(TEMP_TABLE, uName, uPassword)
- end
- end
- function updateInfo(whatupdate, new, who, uName, uPassword)
- if type(whatupdate) ~= "string" or type(new) ~= "string" or type(who) ~= "string" or type(uName) ~= "string" or type(uPassword) ~= "string" then return 0x5 end
- local TEMP_TABLE = {type = "database", todo = "update", toupdate = whatupdate, newupdate = new, who = who}
- return send(TEMP_TABLE, uName, uPassword)
- end --Not finished
- --Mark 1
- local function findBiolock(bioID, uName, uPassword)
- if type(bioID) ~= "string" or type(uName) ~= "string" or type(uPassword) ~= "string" then return 0x1 end
- local TEMP_TABLE = {type = "database", todo = "findBL", toFind = bioID}
- return send(TEMP_TABLE, uName, uPassword)
- end --Mark 2
- function sendMoney(samount, sto, uName, uPassword)
- if type(samount) ~= "number" or type(sto) ~= "string" or type(uName) ~= "string" or type(uPassword) ~= "string" then return 0x1 end
- local TEMP_TABLE = {type = "transaction", amount = samount, to = sto}
- return send(TEMP_TABLE, uName, uPassword)
- end
- function sendMoneyNoSHA(samount, sto, uName, uPassword)
- if type(samount) ~= "number" or type(sto) ~= "string" or type(uName) ~= "string" or type(uPassword) ~= "string" then return 0x1 end
- local TEMP_TABLE = {type = "transaction", amount = samount, to = sto}
- return send(TEMP_TABLE, uName, uPassword, true)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement