/datum/money_account var/owner_name = "" var/account_number = 0 var/remote_access_pin = 0 var/money = 0 var/list/transaction_log = list() var/suspended = 0 var/security_level = 0 //0 - auto-identify from worn ID, require only account number //1 - require manual login / account number and pin //2 - require card and manual login var/offmap = FALSE //Should this account be hidden from station consoles? /datum/transaction var/target_name = "" var/purpose = "" var/amount = 0 var/date = "" var/time = "" var/source_terminal = "" /proc/create_account(var/new_owner_name = "Default user", var/starting_funds = 0, var/obj/machinery/account_database/source_db, var/offmap = FALSE) //create a new account var/datum/money_account/M = new() M.offmap = offmap M.owner_name = new_owner_name M.remote_access_pin = rand(1111, 111111) M.money = starting_funds //create an entry in the account transaction log for when it was created var/datum/transaction/T = new() T.target_name = new_owner_name T.purpose = "Account creation" T.amount = starting_funds if(!source_db) //set a random date, time and location some time over the past few decades T.date = "[num2text(rand(1,28))] [pick("January","February","March","April","May","June","July","August","September","October","November","December")], 23[rand(12,19)]" T.time = "[rand(0,24)]:[rand(11,59)]" T.source_terminal = "NTGalaxyNet Terminal #[rand(111,1111)]" M.account_number = rand(111111, 999999) else T.date = current_date_string T.time = stationtime2text() T.source_terminal = source_db.machine_id M.account_number = next_account_number next_account_number += rand(1,25) //create a sealed package containing the account details var/obj/item/smallDelivery/P = new /obj/item/smallDelivery(source_db.loc) var/obj/item/weapon/paper/R = new /obj/item/weapon/paper(P) P.wrapped = R R.name = "Account information: [M.owner_name]" R.info = "Account details (confidential)


" R.info += "Account holder: [M.owner_name]
" R.info += "Account number: [M.account_number]
" R.info += "Account pin: [M.remote_access_pin]
" R.info += "Starting balance: $[M.money]
" R.info += "Date and time: [stationtime2text()], [current_date_string]

" R.info += "Creation terminal ID: [source_db.machine_id]
" R.info += "Authorised NT officer overseeing creation: [source_db.held_card.registered_name]
" //stamp the paper var/image/stampoverlay = image('icons/obj/bureaucracy.dmi') stampoverlay.icon_state = "paper_stamp-cent" if(!R.stamped) R.stamped = new R.stamped += /obj/item/weapon/stamp R.add_overlay(stampoverlay) R.stamps += "
This paper has been stamped by the Accounts Database." //add the account M.transaction_log.Add(T) all_money_accounts.Add(M) return M /proc/charge_to_account(var/attempt_account_number, var/source_name, var/purpose, var/terminal_id, var/amount) for(var/datum/money_account/D in all_money_accounts) if(D.account_number == attempt_account_number && !D.suspended) D.money += amount //create a transaction log entry var/datum/transaction/T = new() T.target_name = source_name T.purpose = purpose if(amount < 0) T.amount = "([amount])" else T.amount = "[amount]" T.date = current_date_string T.time = stationtime2text() T.source_terminal = terminal_id D.transaction_log.Add(T) return 1 return 0 //this returns the first account datum that matches the supplied accnum/pin combination, it returns null if the combination did not match any account /proc/attempt_account_access(var/attempt_account_number, var/attempt_pin_number, var/security_level_passed = 0) for(var/datum/money_account/D in all_money_accounts) if(D.account_number == attempt_account_number) if( D.security_level <= security_level_passed && (!D.security_level || D.remote_access_pin == attempt_pin_number) ) return D break /proc/get_account(var/account_number) for(var/datum/money_account/D in all_money_accounts) if(D.account_number == account_number) return D