mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-24 09:03:05 +00:00
Merge pull request #3693 from caelaislinn/accounts_updates
Economy/Accounts updates
This commit is contained in:
@@ -1,343 +0,0 @@
|
||||
var/global/current_date_string
|
||||
var/global/num_financial_terminals = 1
|
||||
var/global/datum/money_account/station_account
|
||||
var/global/list/datum/money_account/department_accounts = list()
|
||||
var/global/next_account_number = 0
|
||||
var/global/obj/machinery/account_database/centcomm_account_db
|
||||
var/global/datum/money_account/vendor_account
|
||||
var/global/list/all_money_accounts = list()
|
||||
|
||||
/proc/create_station_account()
|
||||
if(!station_account)
|
||||
next_account_number = rand(111111, 999999)
|
||||
|
||||
station_account = new()
|
||||
station_account.owner_name = "[station_name()] Station Account"
|
||||
station_account.account_number = rand(111111, 999999)
|
||||
station_account.remote_access_pin = rand(1000, 9999)
|
||||
station_account.money = 75000
|
||||
|
||||
//create an entry in the account transaction log for when it was created
|
||||
var/datum/transaction/T = new()
|
||||
T.target_name = station_account.owner_name
|
||||
T.purpose = "Account creation"
|
||||
T.amount = 75000
|
||||
T.date = "2nd April, 2555"
|
||||
T.time = "11:24"
|
||||
T.source_terminal = "Biesel GalaxyNet Terminal #277"
|
||||
|
||||
//add the account
|
||||
station_account.transaction_log.Add(T)
|
||||
all_money_accounts.Add(station_account)
|
||||
|
||||
/proc/create_department_account(department)
|
||||
next_account_number = rand(111111, 999999)
|
||||
|
||||
var/datum/money_account/department_account = new()
|
||||
department_account.owner_name = "[department] Account"
|
||||
department_account.account_number = rand(111111, 999999)
|
||||
department_account.remote_access_pin = rand(1000, 9999)
|
||||
department_account.money = 5000
|
||||
|
||||
//create an entry in the account transaction log for when it was created
|
||||
var/datum/transaction/T = new()
|
||||
T.target_name = department_account.owner_name
|
||||
T.purpose = "Account creation"
|
||||
T.amount = department_account.money
|
||||
T.date = "2nd April, 2555"
|
||||
T.time = "11:24"
|
||||
T.source_terminal = "Biesel GalaxyNet Terminal #277"
|
||||
|
||||
//add the account
|
||||
department_account.transaction_log.Add(T)
|
||||
all_money_accounts.Add(department_account)
|
||||
|
||||
department_accounts[department] = department_account
|
||||
|
||||
//the current ingame time (hh:mm) can be obtained by calling:
|
||||
//worldtime2text()
|
||||
|
||||
/proc/create_account(var/new_owner_name = "Default user", var/starting_funds = 0, var/obj/machinery/account_database/source_db)
|
||||
|
||||
//create a new account
|
||||
var/datum/money_account/M = new()
|
||||
M.owner_name = new_owner_name
|
||||
M.remote_access_pin = rand(1000, 9999)
|
||||
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,31))] [pick("January","February","March","April","May","June","July","August","September","October","November","December")], 25[rand(10,56)]"
|
||||
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 = worldtime2text()
|
||||
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 = "<b>Account details (confidential)</b><br><hr><br>"
|
||||
R.info += "<i>Account holder:</i> [M.owner_name]<br>"
|
||||
R.info += "<i>Account number:</i> [M.account_number]<br>"
|
||||
R.info += "<i>Account pin:</i> [M.remote_access_pin]<br>"
|
||||
R.info += "<i>Starting balance:</i> $[M.money]<br>"
|
||||
R.info += "<i>Date and time:</i> [worldtime2text()], [current_date_string]<br><br>"
|
||||
R.info += "<i>Creation terminal ID:</i> [source_db.machine_id]<br>"
|
||||
R.info += "<i>Authorised NT officer overseeing creation:</i> [source_db.held_card.registered_name]<br>"
|
||||
|
||||
//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.overlays += stampoverlay
|
||||
R.stamps += "<HR><i>This paper has been stamped by the Accounts Database.</i>"
|
||||
|
||||
//add the account
|
||||
M.transaction_log.Add(T)
|
||||
all_money_accounts.Add(M)
|
||||
|
||||
return M
|
||||
|
||||
/datum/money_account
|
||||
var/owner_name = ""
|
||||
var/account_number = 0
|
||||
var/remote_access_pin = 0
|
||||
var/money = 0
|
||||
var/list/transaction_log = list()
|
||||
var/security_level = 1 //0 - auto-identify from worn ID, require only account number
|
||||
//1 - require manual login / account number and pin
|
||||
//2 - require card and manual login
|
||||
|
||||
/datum/transaction
|
||||
var/target_name = ""
|
||||
var/purpose = ""
|
||||
var/amount = 0
|
||||
var/date = ""
|
||||
var/time = ""
|
||||
var/source_terminal = ""
|
||||
|
||||
/obj/machinery/account_database
|
||||
name = "Accounts database"
|
||||
desc = "Holds transaction logs, account data and all kinds of other financial records."
|
||||
icon = 'icons/obj/virology.dmi'
|
||||
icon_state = "analyser"
|
||||
density = 1
|
||||
req_one_access = list(access_hop, access_captain)
|
||||
var/receipt_num
|
||||
var/machine_id = ""
|
||||
var/obj/item/weapon/card/id/held_card
|
||||
var/access_level = 0
|
||||
var/datum/money_account/detailed_account_view
|
||||
var/creating_new_account = 0
|
||||
var/activated = 1
|
||||
|
||||
/obj/machinery/account_database/New()
|
||||
..()
|
||||
if(!station_account)
|
||||
create_station_account()
|
||||
|
||||
if(department_accounts.len == 0)
|
||||
for(var/department in station_departments)
|
||||
create_department_account(department)
|
||||
if(!vendor_account)
|
||||
create_department_account("Vendor")
|
||||
vendor_account = department_accounts["Vendor"]
|
||||
|
||||
if(!current_date_string)
|
||||
current_date_string = "[num2text(rand(1,31))] [pick("January","February","March","April","May","June","July","August","September","October","November","December")], [game_year]"
|
||||
|
||||
machine_id = "[station_name()] Acc. DB #[num_financial_terminals++]"
|
||||
|
||||
/obj/machinery/account_database/attack_hand(mob/user as mob)
|
||||
if(get_dist(src,user) <= 1)
|
||||
var/dat = "<b>Accounts Database</b><br>"
|
||||
dat += "<i>[machine_id]</i><br>"
|
||||
dat += "Confirm identity: <a href='?src=\ref[src];choice=insert_card'>[held_card ? held_card : "-----"]</a><br>"
|
||||
|
||||
if(access_level > 0)
|
||||
dat += "<a href='?src=\ref[src];toggle_activated=1'>[activated ? "Disable" : "Enable"] remote access</a><br>"
|
||||
dat += "You may not edit accounts at this terminal, only create and view them.<br>"
|
||||
if(creating_new_account)
|
||||
dat += "<br>"
|
||||
dat += "<a href='?src=\ref[src];choice=view_accounts_list;'>Return to accounts list</a>"
|
||||
dat += "<form name='create_account' action='?src=\ref[src]' method='get'>"
|
||||
dat += "<input type='hidden' name='src' value='\ref[src]'>"
|
||||
dat += "<input type='hidden' name='choice' value='finalise_create_account'>"
|
||||
dat += "<b>Holder name:</b> <input type='text' id='holder_name' name='holder_name' style='width:250px; background-color:white;'><br>"
|
||||
dat += "<b>Initial funds:</b> <input type='text' id='starting_funds' name='starting_funds' style='width:250px; background-color:white;'> (subtracted from station account)<br>"
|
||||
dat += "<i>New accounts are automatically assigned a secret number and pin, which are printed separately in a sealed package.</i><br>"
|
||||
dat += "<input type='submit' value='Create'><br>"
|
||||
dat += "</form>"
|
||||
else
|
||||
if(detailed_account_view)
|
||||
dat += "<br>"
|
||||
dat += "<a href='?src=\ref[src];choice=view_accounts_list;'>Return to accounts list</a><hr>"
|
||||
dat += "<b>Account number:</b> #[detailed_account_view.account_number]<br>"
|
||||
dat += "<b>Account holder:</b> [detailed_account_view.owner_name]<br>"
|
||||
dat += "<b>Account balance:</b> $[detailed_account_view.money]<br>"
|
||||
dat += "<table border=1 style='width:100%'>"
|
||||
dat += "<tr>"
|
||||
dat += "<td><b>Date</b></td>"
|
||||
dat += "<td><b>Time</b></td>"
|
||||
dat += "<td><b>Target</b></td>"
|
||||
dat += "<td><b>Purpose</b></td>"
|
||||
dat += "<td><b>Value</b></td>"
|
||||
dat += "<td><b>Source terminal ID</b></td>"
|
||||
dat += "</tr>"
|
||||
for(var/datum/transaction/T in detailed_account_view.transaction_log)
|
||||
dat += "<tr>"
|
||||
dat += "<td>[T.date]</td>"
|
||||
dat += "<td>[T.time]</td>"
|
||||
dat += "<td>[T.target_name]</td>"
|
||||
dat += "<td>[T.purpose]</td>"
|
||||
dat += "<td>$[T.amount]</td>"
|
||||
dat += "<td>[T.source_terminal]</td>"
|
||||
dat += "</tr>"
|
||||
dat += "</table>"
|
||||
else
|
||||
dat += "<a href='?src=\ref[src];choice=create_account;'>Create new account</a><br><br>"
|
||||
dat += "<table border=1 style='width:100%'>"
|
||||
for(var/i=1, i<=all_money_accounts.len, i++)
|
||||
var/datum/money_account/D = all_money_accounts[i]
|
||||
dat += "<tr>"
|
||||
dat += "<td>#[D.account_number]</td>"
|
||||
dat += "<td>[D.owner_name]</td>"
|
||||
dat += "<td><a href='?src=\ref[src];choice=view_account_detail;account_index=[i]'>View in detail</a></td>"
|
||||
dat += "</tr>"
|
||||
dat += "</table>"
|
||||
|
||||
user << browse(dat,"window=account_db;size=700x650")
|
||||
else
|
||||
user << browse(null,"window=account_db")
|
||||
|
||||
/obj/machinery/account_database/attackby(O as obj, user as mob)//TODO:SANITY
|
||||
if(istype(O, /obj/item/weapon/card))
|
||||
var/obj/item/weapon/card/id/idcard = O
|
||||
if(!held_card)
|
||||
usr.drop_item()
|
||||
idcard.loc = src
|
||||
held_card = idcard
|
||||
|
||||
if(access_cent_captain in idcard.access)
|
||||
access_level = 2
|
||||
else if(access_hop in idcard.access || access_captain in idcard.access)
|
||||
access_level = 1
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/machinery/account_database/Topic(var/href, var/href_list)
|
||||
|
||||
if(href_list["toggle_activated"])
|
||||
activated = !activated
|
||||
|
||||
if(href_list["choice"])
|
||||
switch(href_list["choice"])
|
||||
if("create_account")
|
||||
creating_new_account = 1
|
||||
if("finalise_create_account")
|
||||
var/account_name = href_list["holder_name"]
|
||||
var/starting_funds = max(text2num(href_list["starting_funds"]), 0)
|
||||
create_account(account_name, starting_funds, src)
|
||||
if(starting_funds > 0)
|
||||
//subtract the money
|
||||
station_account.money -= starting_funds
|
||||
|
||||
//create a transaction log entry
|
||||
var/datum/transaction/T = new()
|
||||
T.target_name = account_name
|
||||
T.purpose = "New account funds initialisation"
|
||||
T.amount = "([starting_funds])"
|
||||
T.date = current_date_string
|
||||
T.time = worldtime2text()
|
||||
T.source_terminal = machine_id
|
||||
station_account.transaction_log.Add(T)
|
||||
|
||||
creating_new_account = 0
|
||||
if("insert_card")
|
||||
if(held_card)
|
||||
held_card.loc = src.loc
|
||||
|
||||
if(ishuman(usr) && !usr.get_active_hand())
|
||||
usr.put_in_hands(held_card)
|
||||
held_card = null
|
||||
access_level = 0
|
||||
|
||||
else
|
||||
var/obj/item/I = usr.get_active_hand()
|
||||
if (istype(I, /obj/item/weapon/card/id))
|
||||
var/obj/item/weapon/card/id/C = I
|
||||
usr.drop_item()
|
||||
C.loc = src
|
||||
held_card = C
|
||||
|
||||
if(access_cent_captain in C.access)
|
||||
access_level = 2
|
||||
else if(access_hop in C.access || access_captain in C.access)
|
||||
access_level = 1
|
||||
if("view_account_detail")
|
||||
var/index = text2num(href_list["account_index"])
|
||||
if(index && index <= all_money_accounts.len)
|
||||
detailed_account_view = all_money_accounts[index]
|
||||
if("view_accounts_list")
|
||||
detailed_account_view = null
|
||||
creating_new_account = 0
|
||||
|
||||
src.attack_hand(usr)
|
||||
|
||||
/obj/machinery/account_database/proc/charge_to_account(var/attempt_account_number, var/source_name, var/purpose, var/terminal_id, var/amount)
|
||||
if(!activated)
|
||||
return 0
|
||||
for(var/datum/money_account/D in all_money_accounts)
|
||||
if(D.account_number == attempt_account_number)
|
||||
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 = worldtime2text()
|
||||
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
|
||||
/obj/machinery/account_database/proc/attempt_account_access(var/attempt_account_number, var/attempt_pin_number, var/security_level_passed = 0)
|
||||
if(!activated)
|
||||
return 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
|
||||
|
||||
/obj/machinery/account_database/proc/get_account(var/account_number)
|
||||
for(var/datum/money_account/D in all_money_accounts)
|
||||
if(D.account_number == account_number)
|
||||
return D
|
||||
|
||||
/obj/machinery/account_database/process()
|
||||
return 0
|
||||
@@ -106,13 +106,6 @@ var/global/datum/controller/gameticker/ticker
|
||||
else
|
||||
src.mode.announce()
|
||||
|
||||
//setup the money accounts
|
||||
if(!centcomm_account_db)
|
||||
for(var/obj/machinery/account_database/check_db in machines)
|
||||
if(check_db.z == 2)
|
||||
centcomm_account_db = check_db
|
||||
break
|
||||
|
||||
create_characters() //Create player characters and transfer them
|
||||
collect_minds()
|
||||
equip_characters()
|
||||
|
||||
@@ -368,35 +368,34 @@ var/global/datum/controller/occupations/job_master
|
||||
H.loc = S.loc
|
||||
|
||||
//give them an account in the station database
|
||||
if(centcomm_account_db)
|
||||
var/datum/money_account/M = create_account(H.real_name, rand(50,500)*10, null)
|
||||
if(H.mind)
|
||||
var/remembered_info = ""
|
||||
remembered_info += "<b>Your account number is:</b> #[M.account_number]<br>"
|
||||
remembered_info += "<b>Your account pin is:</b> [M.remote_access_pin]<br>"
|
||||
remembered_info += "<b>Your account funds are:</b> $[M.money]<br>"
|
||||
var/datum/money_account/M = create_account(H.real_name, rand(50,500)*10, null)
|
||||
if(H.mind)
|
||||
var/remembered_info = ""
|
||||
remembered_info += "<b>Your account number is:</b> #[M.account_number]<br>"
|
||||
remembered_info += "<b>Your account pin is:</b> [M.remote_access_pin]<br>"
|
||||
remembered_info += "<b>Your account funds are:</b> $[M.money]<br>"
|
||||
|
||||
if(M.transaction_log.len)
|
||||
var/datum/transaction/T = M.transaction_log[1]
|
||||
remembered_info += "<b>Your account was created:</b> [T.time], [T.date] at [T.source_terminal]<br>"
|
||||
H.mind.store_memory(remembered_info)
|
||||
if(M.transaction_log.len)
|
||||
var/datum/transaction/T = M.transaction_log[1]
|
||||
remembered_info += "<b>Your account was created:</b> [T.time], [T.date] at [T.source_terminal]<br>"
|
||||
H.mind.store_memory(remembered_info)
|
||||
|
||||
H.mind.initial_account = M
|
||||
H.mind.initial_account = M
|
||||
|
||||
// If they're head, give them the account info for their department
|
||||
if(H.mind && job.head_position)
|
||||
var/remembered_info = ""
|
||||
var/datum/money_account/department_account = department_accounts[job.department]
|
||||
// If they're head, give them the account info for their department
|
||||
if(H.mind && job.head_position)
|
||||
var/remembered_info = ""
|
||||
var/datum/money_account/department_account = department_accounts[job.department]
|
||||
|
||||
if(department_account)
|
||||
remembered_info += "<b>Your department's account number is:</b> #[department_account.account_number]<br>"
|
||||
remembered_info += "<b>Your department's account pin is:</b> [department_account.remote_access_pin]<br>"
|
||||
remembered_info += "<b>Your department's account funds are:</b> $[department_account.money]<br>"
|
||||
if(department_account)
|
||||
remembered_info += "<b>Your department's account number is:</b> #[department_account.account_number]<br>"
|
||||
remembered_info += "<b>Your department's account pin is:</b> [department_account.remote_access_pin]<br>"
|
||||
remembered_info += "<b>Your department's account funds are:</b> $[department_account.money]<br>"
|
||||
|
||||
H.mind.store_memory(remembered_info)
|
||||
H.mind.store_memory(remembered_info)
|
||||
|
||||
spawn(0)
|
||||
H << "\blue<b>Your account number is: [M.account_number], your account pin is: [M.remote_access_pin]</b>"
|
||||
spawn(0)
|
||||
H << "\blue<b>Your account number is: [M.account_number], your account pin is: [M.remote_access_pin]</b>"
|
||||
|
||||
var/alt_title = null
|
||||
if(H.mind)
|
||||
|
||||
@@ -52,9 +52,6 @@
|
||||
var/const/WIRE_SHOCK = 3
|
||||
var/const/WIRE_SHOOTINV = 4
|
||||
|
||||
var/obj/machinery/account_database/linked_db
|
||||
var/datum/money_account/linked_account
|
||||
|
||||
/obj/machinery/vending/New()
|
||||
..()
|
||||
spawn(4)
|
||||
@@ -71,19 +68,10 @@
|
||||
src.build_inventory(premium, 0, 1)
|
||||
power_change()
|
||||
|
||||
reconnect_database()
|
||||
linked_account = vendor_account
|
||||
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
/obj/machinery/vending/proc/reconnect_database()
|
||||
for(var/obj/machinery/account_database/DB in world)
|
||||
if(DB.z == src.z)
|
||||
linked_db = DB
|
||||
break
|
||||
|
||||
/obj/machinery/vending/ex_act(severity)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
@@ -158,17 +146,8 @@
|
||||
user << "\blue You insert the [W] into the [src]"
|
||||
return
|
||||
else if(istype(W, /obj/item/weapon/card) && currently_vending)
|
||||
//attempt to connect to a new db, and if that doesn't work then fail
|
||||
if(!linked_db)
|
||||
reconnect_database()
|
||||
if(linked_db)
|
||||
if(linked_account)
|
||||
var/obj/item/weapon/card/I = W
|
||||
scan_card(I)
|
||||
else
|
||||
usr << "\icon[src]<span class='warning'>Unable to connect to linked account.</span>"
|
||||
else
|
||||
usr << "\icon[src]<span class='warning'>Unable to connect to accounts database.</span>"
|
||||
var/obj/item/weapon/card/I = W
|
||||
scan_card(I)
|
||||
else
|
||||
..()
|
||||
|
||||
@@ -177,20 +156,20 @@
|
||||
if (istype(I, /obj/item/weapon/card/id))
|
||||
var/obj/item/weapon/card/id/C = I
|
||||
visible_message("<span class='info'>[usr] swipes a card through [src].</span>")
|
||||
if(linked_account)
|
||||
if(vendor_account)
|
||||
var/attempt_pin = input("Enter pin code", "Vendor transaction") as num
|
||||
var/datum/money_account/D = linked_db.attempt_account_access(C.associated_account_number, attempt_pin, 2)
|
||||
var/datum/money_account/D = attempt_account_access(C.associated_account_number, attempt_pin, 2)
|
||||
if(D)
|
||||
var/transaction_amount = currently_vending.price
|
||||
if(transaction_amount <= D.money)
|
||||
|
||||
//transfer the money
|
||||
D.money -= transaction_amount
|
||||
linked_account.money += transaction_amount
|
||||
vendor_account.money += transaction_amount
|
||||
|
||||
//create entries in the two account transaction logs
|
||||
var/datum/transaction/T = new()
|
||||
T.target_name = "[linked_account.owner_name] (via [src.name])"
|
||||
T.target_name = "[vendor_account.owner_name] (via [src.name])"
|
||||
T.purpose = "Purchase of [currently_vending.product_name]"
|
||||
if(transaction_amount > 0)
|
||||
T.amount = "([transaction_amount])"
|
||||
@@ -208,7 +187,7 @@
|
||||
T.source_terminal = src.name
|
||||
T.date = current_date_string
|
||||
T.time = worldtime2text()
|
||||
linked_account.transaction_log.Add(T)
|
||||
vendor_account.transaction_log.Add(T)
|
||||
|
||||
// Vend the item
|
||||
src.vend(src.currently_vending, usr)
|
||||
@@ -218,7 +197,7 @@
|
||||
else
|
||||
usr << "\icon[src]<span class='warning'>Unable to access account. Check security settings and try again.</span>"
|
||||
else
|
||||
usr << "\icon[src]<span class='warning'>EFTPOS is not connected to an account.</span>"
|
||||
usr << "\icon[src]<span class='warning'>Unable to access vendor account. Please record the machine ID and call CentComm Support.</span>"
|
||||
|
||||
/obj/machinery/vending/attack_paw(mob/user as mob)
|
||||
return attack_hand(user)
|
||||
|
||||
@@ -22,7 +22,6 @@ log transactions
|
||||
anchored = 1
|
||||
use_power = 1
|
||||
idle_power_usage = 10
|
||||
var/obj/machinery/account_database/linked_db
|
||||
var/datum/money_account/authenticated_account
|
||||
var/number_incorrect_tries = 0
|
||||
var/previous_account_number = 0
|
||||
@@ -38,20 +37,10 @@ log transactions
|
||||
..()
|
||||
machine_id = "[station_name()] RT #[num_financial_terminals++]"
|
||||
|
||||
/obj/machinery/atm/initialize()
|
||||
..()
|
||||
reconnect_database()
|
||||
|
||||
/obj/machinery/atm/process()
|
||||
if(stat & NOPOWER)
|
||||
return
|
||||
|
||||
if(linked_db && ( (linked_db.stat & NOPOWER) || !linked_db.activated ) )
|
||||
linked_db = null
|
||||
authenticated_account = null
|
||||
src.visible_message("\red \icon[src] [src] buzzes rudely, \"Connection to remote database lost.\"")
|
||||
updateDialog()
|
||||
|
||||
if(ticks_left_timeout > 0)
|
||||
ticks_left_timeout--
|
||||
if(ticks_left_timeout <= 0)
|
||||
@@ -69,12 +58,6 @@ log transactions
|
||||
playsound(loc, 'sound/items/polaroid2.ogg', 50, 1)
|
||||
break
|
||||
|
||||
/obj/machinery/atm/proc/reconnect_database()
|
||||
for(var/obj/machinery/account_database/DB in world) //Hotfix until someone finds out why it isn't in 'machines'
|
||||
if( DB.z == src.z && !(DB.stat & NOPOWER) && DB.activated )
|
||||
linked_db = DB
|
||||
break
|
||||
|
||||
/obj/machinery/atm/attackby(obj/item/I as obj, mob/user as mob)
|
||||
if(istype(I, /obj/item/weapon/card))
|
||||
var/obj/item/weapon/card/id/idcard = I
|
||||
@@ -126,69 +109,72 @@ log transactions
|
||||
if(ticks_left_locked_down > 0)
|
||||
dat += "<span class='alert'>Maximum number of pin attempts exceeded! Access to this ATM has been temporarily disabled.</span>"
|
||||
else if(authenticated_account)
|
||||
switch(view_screen)
|
||||
if(CHANGE_SECURITY_LEVEL)
|
||||
dat += "Select a new security level for this account:<br><hr>"
|
||||
var/text = "Zero - Either the account number or card is required to access this account. EFTPOS transactions will require a card and ask for a pin, but not verify the pin is correct."
|
||||
if(authenticated_account.security_level != 0)
|
||||
text = "<A href='?src=\ref[src];choice=change_security_level;new_security_level=0'>[text]</a>"
|
||||
dat += "[text]<hr>"
|
||||
text = "One - An account number and pin must be manually entered to access this account and process transactions."
|
||||
if(authenticated_account.security_level != 1)
|
||||
text = "<A href='?src=\ref[src];choice=change_security_level;new_security_level=1'>[text]</a>"
|
||||
dat += "[text]<hr>"
|
||||
text = "Two - In addition to account number and pin, a card is required to access this account and process transactions."
|
||||
if(authenticated_account.security_level != 2)
|
||||
text = "<A href='?src=\ref[src];choice=change_security_level;new_security_level=2'>[text]</a>"
|
||||
dat += "[text]<hr><br>"
|
||||
dat += "<A href='?src=\ref[src];choice=view_screen;view_screen=0'>Back</a>"
|
||||
if(VIEW_TRANSACTION_LOGS)
|
||||
dat += "<b>Transaction logs</b><br>"
|
||||
dat += "<A href='?src=\ref[src];choice=view_screen;view_screen=0'>Back</a>"
|
||||
dat += "<table border=1 style='width:100%'>"
|
||||
dat += "<tr>"
|
||||
dat += "<td><b>Date</b></td>"
|
||||
dat += "<td><b>Time</b></td>"
|
||||
dat += "<td><b>Target</b></td>"
|
||||
dat += "<td><b>Purpose</b></td>"
|
||||
dat += "<td><b>Value</b></td>"
|
||||
dat += "<td><b>Source terminal ID</b></td>"
|
||||
dat += "</tr>"
|
||||
for(var/datum/transaction/T in authenticated_account.transaction_log)
|
||||
if(authenticated_account.suspended)
|
||||
dat += "\red<b>Access to this account has been suspended, and the funds within frozen.</b>"
|
||||
else
|
||||
switch(view_screen)
|
||||
if(CHANGE_SECURITY_LEVEL)
|
||||
dat += "Select a new security level for this account:<br><hr>"
|
||||
var/text = "Zero - Either the account number or card is required to access this account. EFTPOS transactions will require a card and ask for a pin, but not verify the pin is correct."
|
||||
if(authenticated_account.security_level != 0)
|
||||
text = "<A href='?src=\ref[src];choice=change_security_level;new_security_level=0'>[text]</a>"
|
||||
dat += "[text]<hr>"
|
||||
text = "One - An account number and pin must be manually entered to access this account and process transactions."
|
||||
if(authenticated_account.security_level != 1)
|
||||
text = "<A href='?src=\ref[src];choice=change_security_level;new_security_level=1'>[text]</a>"
|
||||
dat += "[text]<hr>"
|
||||
text = "Two - In addition to account number and pin, a card is required to access this account and process transactions."
|
||||
if(authenticated_account.security_level != 2)
|
||||
text = "<A href='?src=\ref[src];choice=change_security_level;new_security_level=2'>[text]</a>"
|
||||
dat += "[text]<hr><br>"
|
||||
dat += "<A href='?src=\ref[src];choice=view_screen;view_screen=0'>Back</a>"
|
||||
if(VIEW_TRANSACTION_LOGS)
|
||||
dat += "<b>Transaction logs</b><br>"
|
||||
dat += "<A href='?src=\ref[src];choice=view_screen;view_screen=0'>Back</a>"
|
||||
dat += "<table border=1 style='width:100%'>"
|
||||
dat += "<tr>"
|
||||
dat += "<td>[T.date]</td>"
|
||||
dat += "<td>[T.time]</td>"
|
||||
dat += "<td>[T.target_name]</td>"
|
||||
dat += "<td>[T.purpose]</td>"
|
||||
dat += "<td>$[T.amount]</td>"
|
||||
dat += "<td>[T.source_terminal]</td>"
|
||||
dat += "<td><b>Date</b></td>"
|
||||
dat += "<td><b>Time</b></td>"
|
||||
dat += "<td><b>Target</b></td>"
|
||||
dat += "<td><b>Purpose</b></td>"
|
||||
dat += "<td><b>Value</b></td>"
|
||||
dat += "<td><b>Source terminal ID</b></td>"
|
||||
dat += "</tr>"
|
||||
dat += "</table>"
|
||||
if(TRANSFER_FUNDS)
|
||||
dat += "<b>Account balance:</b> $[authenticated_account.money]<br>"
|
||||
dat += "<A href='?src=\ref[src];choice=view_screen;view_screen=0'>Back</a><br><br>"
|
||||
dat += "<form name='transfer' action='?src=\ref[src]' method='get'>"
|
||||
dat += "<input type='hidden' name='src' value='\ref[src]'>"
|
||||
dat += "<input type='hidden' name='choice' value='transfer'>"
|
||||
dat += "Target account number: <input type='text' name='target_acc_number' value='' style='width:200px; background-color:white;'><br>"
|
||||
dat += "Funds to transfer: <input type='text' name='funds_amount' value='' style='width:200px; background-color:white;'><br>"
|
||||
dat += "Transaction purpose: <input type='text' name='purpose' value='Funds transfer' style='width:200px; background-color:white;'><br>"
|
||||
dat += "<input type='submit' value='Transfer funds'><br>"
|
||||
dat += "</form>"
|
||||
else
|
||||
dat += "Welcome, <b>[authenticated_account.owner_name].</b><br/>"
|
||||
dat += "<b>Account balance:</b> $[authenticated_account.money]"
|
||||
dat += "<form name='withdrawal' action='?src=\ref[src]' method='get'>"
|
||||
dat += "<input type='hidden' name='src' value='\ref[src]'>"
|
||||
dat += "<input type='hidden' name='choice' value='withdrawal'>"
|
||||
dat += "<input type='text' name='funds_amount' value='' style='width:200px; background-color:white;'><input type='submit' value='Withdraw funds'><br>"
|
||||
dat += "</form>"
|
||||
dat += "<A href='?src=\ref[src];choice=view_screen;view_screen=1'>Change account security level</a><br>"
|
||||
dat += "<A href='?src=\ref[src];choice=view_screen;view_screen=2'>Make transfer</a><br>"
|
||||
dat += "<A href='?src=\ref[src];choice=view_screen;view_screen=3'>View transaction log</a><br>"
|
||||
dat += "<A href='?src=\ref[src];choice=balance_statement'>Print balance statement</a><br>"
|
||||
dat += "<A href='?src=\ref[src];choice=logout'>Logout</a><br>"
|
||||
else if(linked_db)
|
||||
for(var/datum/transaction/T in authenticated_account.transaction_log)
|
||||
dat += "<tr>"
|
||||
dat += "<td>[T.date]</td>"
|
||||
dat += "<td>[T.time]</td>"
|
||||
dat += "<td>[T.target_name]</td>"
|
||||
dat += "<td>[T.purpose]</td>"
|
||||
dat += "<td>$[T.amount]</td>"
|
||||
dat += "<td>[T.source_terminal]</td>"
|
||||
dat += "</tr>"
|
||||
dat += "</table>"
|
||||
if(TRANSFER_FUNDS)
|
||||
dat += "<b>Account balance:</b> $[authenticated_account.money]<br>"
|
||||
dat += "<A href='?src=\ref[src];choice=view_screen;view_screen=0'>Back</a><br><br>"
|
||||
dat += "<form name='transfer' action='?src=\ref[src]' method='get'>"
|
||||
dat += "<input type='hidden' name='src' value='\ref[src]'>"
|
||||
dat += "<input type='hidden' name='choice' value='transfer'>"
|
||||
dat += "Target account number: <input type='text' name='target_acc_number' value='' style='width:200px; background-color:white;'><br>"
|
||||
dat += "Funds to transfer: <input type='text' name='funds_amount' value='' style='width:200px; background-color:white;'><br>"
|
||||
dat += "Transaction purpose: <input type='text' name='purpose' value='Funds transfer' style='width:200px; background-color:white;'><br>"
|
||||
dat += "<input type='submit' value='Transfer funds'><br>"
|
||||
dat += "</form>"
|
||||
else
|
||||
dat += "Welcome, <b>[authenticated_account.owner_name].</b><br/>"
|
||||
dat += "<b>Account balance:</b> $[authenticated_account.money]"
|
||||
dat += "<form name='withdrawal' action='?src=\ref[src]' method='get'>"
|
||||
dat += "<input type='hidden' name='src' value='\ref[src]'>"
|
||||
dat += "<input type='hidden' name='choice' value='withdrawal'>"
|
||||
dat += "<input type='text' name='funds_amount' value='' style='width:200px; background-color:white;'><input type='submit' value='Withdraw funds'><br>"
|
||||
dat += "</form>"
|
||||
dat += "<A href='?src=\ref[src];choice=view_screen;view_screen=1'>Change account security level</a><br>"
|
||||
dat += "<A href='?src=\ref[src];choice=view_screen;view_screen=2'>Make transfer</a><br>"
|
||||
dat += "<A href='?src=\ref[src];choice=view_screen;view_screen=3'>View transaction log</a><br>"
|
||||
dat += "<A href='?src=\ref[src];choice=balance_statement'>Print balance statement</a><br>"
|
||||
dat += "<A href='?src=\ref[src];choice=logout'>Logout</a><br>"
|
||||
else
|
||||
dat += "<form name='atm_auth' action='?src=\ref[src]' method='get'>"
|
||||
dat += "<input type='hidden' name='src' value='\ref[src]'>"
|
||||
dat += "<input type='hidden' name='choice' value='attempt_auth'>"
|
||||
@@ -196,9 +182,6 @@ log transactions
|
||||
dat += "<b>PIN:</b> <input type='text' id='account_pin' name='account_pin' style='width:250px; background-color:white;'><br>"
|
||||
dat += "<input type='submit' value='Submit'><br>"
|
||||
dat += "</form>"
|
||||
else
|
||||
dat += "<span class='warning'>Unable to connect to accounts database, please retry and if the issue persists contact NanoTrasen IT support.</span>"
|
||||
reconnect_database()
|
||||
|
||||
user << browse(dat,"window=atm;size=550x650")
|
||||
else
|
||||
@@ -208,14 +191,14 @@ log transactions
|
||||
if(href_list["choice"])
|
||||
switch(href_list["choice"])
|
||||
if("transfer")
|
||||
if(authenticated_account && linked_db)
|
||||
if(authenticated_account)
|
||||
var/transfer_amount = text2num(href_list["funds_amount"])
|
||||
if(transfer_amount <= 0)
|
||||
alert("That is not a valid amount.")
|
||||
else if(transfer_amount <= authenticated_account.money)
|
||||
var/target_account_number = text2num(href_list["target_acc_number"])
|
||||
var/transfer_purpose = href_list["purpose"]
|
||||
if(linked_db.charge_to_account(target_account_number, authenticated_account.owner_name, transfer_purpose, machine_id, transfer_amount))
|
||||
if(charge_to_account(target_account_number, authenticated_account.owner_name, transfer_purpose, machine_id, transfer_amount))
|
||||
usr << "\icon[src]<span class='info'>Funds transfer successful.</span>"
|
||||
authenticated_account.money -= transfer_amount
|
||||
|
||||
@@ -240,13 +223,13 @@ log transactions
|
||||
var/new_sec_level = max( min(text2num(href_list["new_security_level"]), 2), 0)
|
||||
authenticated_account.security_level = new_sec_level
|
||||
if("attempt_auth")
|
||||
if(linked_db && !ticks_left_locked_down)
|
||||
if(!ticks_left_locked_down)
|
||||
var/tried_account_num = text2num(href_list["account_num"])
|
||||
if(!tried_account_num)
|
||||
tried_account_num = held_card.associated_account_number
|
||||
var/tried_pin = text2num(href_list["account_pin"])
|
||||
|
||||
authenticated_account = linked_db.attempt_account_access(tried_account_num, tried_pin, held_card && held_card.associated_account_number == tried_account_num ? 2 : 1)
|
||||
authenticated_account = attempt_account_access(tried_account_num, tried_pin, held_card && held_card.associated_account_number == tried_account_num ? 2 : 1)
|
||||
if(!authenticated_account)
|
||||
number_incorrect_tries++
|
||||
if(previous_account_number == tried_account_num)
|
||||
@@ -256,7 +239,7 @@ log transactions
|
||||
playsound(src, 'sound/machines/buzz-two.ogg', 50, 1)
|
||||
|
||||
//create an entry in the account transaction log
|
||||
var/datum/money_account/failed_account = linked_db.get_account(tried_account_num)
|
||||
var/datum/money_account/failed_account = get_account(tried_account_num)
|
||||
if(failed_account)
|
||||
var/datum/transaction/T = new()
|
||||
T.target_name = failed_account.owner_name
|
||||
@@ -386,7 +369,7 @@ log transactions
|
||||
|
||||
//stolen wholesale and then edited a bit from newscasters, which are awesome and by Agouri
|
||||
/obj/machinery/atm/proc/scan_user(mob/living/carbon/human/human_user as mob)
|
||||
if(!authenticated_account && linked_db)
|
||||
if(!authenticated_account)
|
||||
if(human_user.wear_id)
|
||||
var/obj/item/weapon/card/id/I
|
||||
if(istype(human_user.wear_id, /obj/item/weapon/card/id) )
|
||||
@@ -395,7 +378,7 @@ log transactions
|
||||
var/obj/item/device/pda/P = human_user.wear_id
|
||||
I = P.id
|
||||
if(I)
|
||||
authenticated_account = linked_db.attempt_account_access(I.associated_account_number)
|
||||
authenticated_account = attempt_account_access(I.associated_account_number)
|
||||
if(authenticated_account)
|
||||
human_user << "\blue \icon[src] Access granted. Welcome user '[authenticated_account.owner_name].'"
|
||||
|
||||
113
code/modules/Economy/Accounts.dm
Normal file
113
code/modules/Economy/Accounts.dm
Normal file
@@ -0,0 +1,113 @@
|
||||
|
||||
/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 = 1 //0 - auto-identify from worn ID, require only account number
|
||||
//1 - require manual login / account number and pin
|
||||
//2 - require card and manual login
|
||||
|
||||
/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)
|
||||
|
||||
//create a new account
|
||||
var/datum/money_account/M = new()
|
||||
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,31))] [pick("January","February","March","April","May","June","July","August","September","October","November","December")], 25[rand(10,56)]"
|
||||
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 = worldtime2text()
|
||||
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 = "<b>Account details (confidential)</b><br><hr><br>"
|
||||
R.info += "<i>Account holder:</i> [M.owner_name]<br>"
|
||||
R.info += "<i>Account number:</i> [M.account_number]<br>"
|
||||
R.info += "<i>Account pin:</i> [M.remote_access_pin]<br>"
|
||||
R.info += "<i>Starting balance:</i> $[M.money]<br>"
|
||||
R.info += "<i>Date and time:</i> [worldtime2text()], [current_date_string]<br><br>"
|
||||
R.info += "<i>Creation terminal ID:</i> [source_db.machine_id]<br>"
|
||||
R.info += "<i>Authorised NT officer overseeing creation:</i> [source_db.held_card.registered_name]<br>"
|
||||
|
||||
//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.overlays += stampoverlay
|
||||
R.stamps += "<HR><i>This paper has been stamped by the Accounts Database.</i>"
|
||||
|
||||
//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 = worldtime2text()
|
||||
T.source_terminal = terminal_id
|
||||
D.transaction_log.Add(T)
|
||||
|
||||
return 1
|
||||
break
|
||||
|
||||
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
|
||||
169
code/modules/Economy/Accounts_DB.dm
Normal file
169
code/modules/Economy/Accounts_DB.dm
Normal file
@@ -0,0 +1,169 @@
|
||||
|
||||
/obj/machinery/account_database
|
||||
name = "Accounts uplink console"
|
||||
desc = "Access transaction logs, account data and all kinds of other financial records."
|
||||
icon = 'icons/obj/computer.dmi'
|
||||
icon_state = "aiupload"
|
||||
density = 1
|
||||
req_one_access = list(access_hop, access_captain, access_cent_captain)
|
||||
var/receipt_num
|
||||
var/machine_id = ""
|
||||
var/obj/item/weapon/card/id/held_card
|
||||
var/access_level = 0
|
||||
var/datum/money_account/detailed_account_view
|
||||
var/creating_new_account = 0
|
||||
|
||||
/obj/machinery/account_database/New()
|
||||
..()
|
||||
machine_id = "[station_name()] Acc. DB #[num_financial_terminals++]"
|
||||
|
||||
/obj/machinery/account_database/attack_hand(mob/user as mob)
|
||||
if(get_dist(src,user) <= 1)
|
||||
var/dat = "<b>Accounts Database</b><br>"
|
||||
dat += "<i>[machine_id]</i><br>"
|
||||
dat += "Confirm identity: <a href='?src=\ref[src];choice=insert_card'>[held_card ? held_card : "-----"]</a><br>"
|
||||
|
||||
if(access_level > 0)
|
||||
dat += "You may not edit accounts at this terminal, only create and view them.<br>"
|
||||
if(creating_new_account)
|
||||
dat += "<br>"
|
||||
dat += "<a href='?src=\ref[src];choice=view_accounts_list;'>Return to accounts list</a>"
|
||||
dat += "<form name='create_account' action='?src=\ref[src]' method='get'>"
|
||||
dat += "<input type='hidden' name='src' value='\ref[src]'>"
|
||||
dat += "<input type='hidden' name='choice' value='finalise_create_account'>"
|
||||
dat += "<b>Holder name:</b> <input type='text' id='holder_name' name='holder_name' style='width:250px; background-color:white;'><br>"
|
||||
dat += "<b>Initial funds:</b> <input type='text' id='starting_funds' name='starting_funds' style='width:250px; background-color:white;'> (subtracted from station account)<br>"
|
||||
dat += "<i>New accounts are automatically assigned a secret number and pin, which are printed separately in a sealed package.</i><br>"
|
||||
dat += "<input type='submit' value='Create'><br>"
|
||||
dat += "</form>"
|
||||
else
|
||||
if(detailed_account_view)
|
||||
dat += "<br>"
|
||||
dat += "<a href='?src=\ref[src];choice=view_accounts_list;'>Return to accounts list</a><hr>"
|
||||
dat += "<b>Account number:</b> #[detailed_account_view.account_number]<br>"
|
||||
dat += "<b>Account holder:</b> [detailed_account_view.owner_name]<br>"
|
||||
dat += "<b>Account balance:</b> $[detailed_account_view.money]<br>"
|
||||
if(access_level > 1)
|
||||
dat += "<b><a href='?src=\ref[src];choice=add_funds'>Silently add funds (no transaction log)</a><br>"
|
||||
dat += "<b><a href='?src=\ref[src];choice=remove_funds'>Silently remove funds (no transaction log)</a><br>"
|
||||
dat += "<b><a href='?src=\ref[src];choice=toggle_suspension'>[detailed_account_view.suspended ? "Unsuspend account" : "Suspend account"]</a><br>"
|
||||
dat += "<table border=1 style='width:100%'>"
|
||||
dat += "<tr>"
|
||||
dat += "<td><b>Date</b></td>"
|
||||
dat += "<td><b>Time</b></td>"
|
||||
dat += "<td><b>Target</b></td>"
|
||||
dat += "<td><b>Purpose</b></td>"
|
||||
dat += "<td><b>Value</b></td>"
|
||||
dat += "<td><b>Source terminal ID</b></td>"
|
||||
dat += "</tr>"
|
||||
for(var/datum/transaction/T in detailed_account_view.transaction_log)
|
||||
dat += "<tr>"
|
||||
dat += "<td>[T.date]</td>"
|
||||
dat += "<td>[T.time]</td>"
|
||||
dat += "<td>[T.target_name]</td>"
|
||||
dat += "<td>[T.purpose]</td>"
|
||||
dat += "<td>$[T.amount]</td>"
|
||||
dat += "<td>[T.source_terminal]</td>"
|
||||
dat += "</tr>"
|
||||
dat += "</table>"
|
||||
else
|
||||
dat += "<a href='?src=\ref[src];choice=create_account;'>Create new account</a><br><br>"
|
||||
dat += "<table border=1 style='width:100%'>"
|
||||
for(var/i=1, i<=all_money_accounts.len, i++)
|
||||
var/datum/money_account/D = all_money_accounts[i]
|
||||
dat += "<tr>"
|
||||
dat += "<td>#[D.account_number]</td>"
|
||||
dat += "<td>[D.owner_name]</td>"
|
||||
dat += "<td>[D.suspended ? "SUSPENDED" : ""]</td>"
|
||||
dat += "<td><a href='?src=\ref[src];choice=view_account_detail;account_index=[i]'>View in detail</a></td>"
|
||||
dat += "</tr>"
|
||||
dat += "</table>"
|
||||
|
||||
user << browse(dat,"window=account_db;size=700x650")
|
||||
else
|
||||
user << browse(null,"window=account_db")
|
||||
|
||||
/obj/machinery/account_database/attackby(O as obj, user as mob)//TODO:SANITY
|
||||
if(istype(O, /obj/item/weapon/card))
|
||||
var/obj/item/weapon/card/id/idcard = O
|
||||
if(!held_card)
|
||||
usr.drop_item()
|
||||
idcard.loc = src
|
||||
held_card = idcard
|
||||
|
||||
if(access_cent_captain in idcard.access)
|
||||
access_level = 2
|
||||
else if(access_hop in idcard.access || access_captain in idcard.access)
|
||||
access_level = 1
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/machinery/account_database/Topic(var/href, var/href_list)
|
||||
|
||||
if(href_list["choice"])
|
||||
switch(href_list["choice"])
|
||||
if("create_account")
|
||||
creating_new_account = 1
|
||||
if("add_funds")
|
||||
var/amount = input("Enter the amount you wish to add", "Silently add funds") as num
|
||||
if(detailed_account_view)
|
||||
detailed_account_view.money += amount
|
||||
if("remove_funds")
|
||||
var/amount = input("Enter the amount you wish to remove", "Silently remove funds") as num
|
||||
if(detailed_account_view)
|
||||
detailed_account_view.money -= amount
|
||||
if("toggle_suspension")
|
||||
if(detailed_account_view)
|
||||
if(detailed_account_view.suspended)
|
||||
detailed_account_view.suspended = 0
|
||||
else
|
||||
detailed_account_view.suspended = 1
|
||||
if("finalise_create_account")
|
||||
var/account_name = href_list["holder_name"]
|
||||
var/starting_funds = max(text2num(href_list["starting_funds"]), 0)
|
||||
create_account(account_name, starting_funds, src)
|
||||
if(starting_funds > 0)
|
||||
//subtract the money
|
||||
station_account.money -= starting_funds
|
||||
|
||||
//create a transaction log entry
|
||||
var/datum/transaction/T = new()
|
||||
T.target_name = account_name
|
||||
T.purpose = "New account funds initialisation"
|
||||
T.amount = "([starting_funds])"
|
||||
T.date = current_date_string
|
||||
T.time = worldtime2text()
|
||||
T.source_terminal = machine_id
|
||||
station_account.transaction_log.Add(T)
|
||||
|
||||
creating_new_account = 0
|
||||
if("insert_card")
|
||||
if(held_card)
|
||||
held_card.loc = src.loc
|
||||
|
||||
if(ishuman(usr) && !usr.get_active_hand())
|
||||
usr.put_in_hands(held_card)
|
||||
held_card = null
|
||||
access_level = 0
|
||||
|
||||
else
|
||||
var/obj/item/I = usr.get_active_hand()
|
||||
if (istype(I, /obj/item/weapon/card/id))
|
||||
var/obj/item/weapon/card/id/C = I
|
||||
usr.drop_item()
|
||||
C.loc = src
|
||||
held_card = C
|
||||
|
||||
if(access_cent_captain in C.access)
|
||||
access_level = 2
|
||||
else if(access_hop in C.access || access_captain in C.access)
|
||||
access_level = 1
|
||||
if("view_account_detail")
|
||||
var/index = text2num(href_list["account_index"])
|
||||
if(index && index <= all_money_accounts.len)
|
||||
detailed_account_view = all_money_accounts[index]
|
||||
if("view_accounts_list")
|
||||
detailed_account_view = null
|
||||
creating_new_account = 0
|
||||
|
||||
src.attack_hand(usr)
|
||||
@@ -10,14 +10,12 @@
|
||||
var/transaction_amount = 0
|
||||
var/transaction_purpose = "Default charge"
|
||||
var/access_code = 0
|
||||
var/obj/machinery/account_database/linked_db
|
||||
var/datum/money_account/linked_account
|
||||
|
||||
/obj/item/device/eftpos/New()
|
||||
..()
|
||||
machine_id = "[station_name()] EFTPOS #[num_financial_terminals++]"
|
||||
access_code = rand(1111,111111)
|
||||
reconnect_database()
|
||||
spawn(0)
|
||||
print_reference()
|
||||
|
||||
@@ -69,16 +67,6 @@
|
||||
D.wrapped = R
|
||||
D.name = "small parcel - 'EFTPOS access code'"
|
||||
|
||||
/obj/item/device/eftpos/proc/reconnect_database()
|
||||
var/turf/location = get_turf(src)
|
||||
if(!location)
|
||||
return
|
||||
|
||||
for(var/obj/machinery/account_database/DB in machines) //Hotfix until someone finds out why it isn't in 'machines'
|
||||
if(DB.z == location.z)
|
||||
linked_db = DB
|
||||
break
|
||||
|
||||
/obj/item/device/eftpos/attack_self(mob/user as mob)
|
||||
if(get_dist(src,user) <= 1)
|
||||
var/dat = "<b>[eftpos_name]</b><br>"
|
||||
@@ -109,17 +97,11 @@
|
||||
|
||||
/obj/item/device/eftpos/attackby(O as obj, user as mob)
|
||||
if(istype(O, /obj/item/weapon/card))
|
||||
//attempt to connect to a new db, and if that doesn't work then fail
|
||||
if(!linked_db)
|
||||
reconnect_database()
|
||||
if(linked_db)
|
||||
if(linked_account)
|
||||
var/obj/item/weapon/card/I = O
|
||||
scan_card(I)
|
||||
else
|
||||
usr << "\icon[src]<span class='warning'>Unable to connect to linked account.</span>"
|
||||
if(linked_account)
|
||||
var/obj/item/weapon/card/I = O
|
||||
scan_card(I)
|
||||
else
|
||||
usr << "\icon[src]<span class='warning'>Unable to connect to accounts database.</span>"
|
||||
usr << "\icon[src]<span class='warning'>Unable to connect to linked account.</span>"
|
||||
else
|
||||
..()
|
||||
|
||||
@@ -145,14 +127,12 @@
|
||||
else
|
||||
usr << "\icon[src]<span class='warning'>Incorrect code entered.</span>"
|
||||
if("link_account")
|
||||
if(!linked_db)
|
||||
reconnect_database()
|
||||
if(linked_db)
|
||||
var/attempt_account_num = input("Enter account number to pay EFTPOS charges into", "New account number") as num
|
||||
var/attempt_pin = input("Enter pin code", "Account pin") as num
|
||||
linked_account = linked_db.attempt_account_access(attempt_account_num, attempt_pin, 1)
|
||||
else
|
||||
usr << "\icon[src]<span class='warning'>Unable to connect to accounts database.</span>"
|
||||
var/attempt_account_num = input("Enter account number to pay EFTPOS charges into", "New account number") as num
|
||||
var/attempt_pin = input("Enter pin code", "Account pin") as num
|
||||
linked_account = attempt_account_access(attempt_account_num, attempt_pin, 1)
|
||||
if(linked_account.suspended)
|
||||
linked_account = null
|
||||
usr << "\icon[src]<span class='warning'>Account has been suspended.</span>"
|
||||
if("trans_purpose")
|
||||
transaction_purpose = input("Enter reason for EFTPOS transaction", "Transaction purpose")
|
||||
if("trans_value")
|
||||
@@ -172,10 +152,7 @@
|
||||
else
|
||||
usr << "\icon[src] <span class='warning'>No account connected to send transactions to.</span>"
|
||||
if("scan_card")
|
||||
//attempt to connect to a new db, and if that doesn't work then fail
|
||||
if(!linked_db)
|
||||
reconnect_database()
|
||||
if(linked_db && linked_account)
|
||||
if(linked_account)
|
||||
var/obj/item/I = usr.get_active_hand()
|
||||
if (istype(I, /obj/item/weapon/card))
|
||||
scan_card(I)
|
||||
@@ -201,45 +178,62 @@
|
||||
visible_message("<span class='info'>[usr] swipes a card through [src].</span>")
|
||||
if(transaction_locked && !transaction_paid)
|
||||
if(linked_account)
|
||||
var/attempt_pin = input("Enter pin code", "EFTPOS transaction") as num
|
||||
var/datum/money_account/D = linked_db.attempt_account_access(C.associated_account_number, attempt_pin, 2)
|
||||
if(D)
|
||||
if(transaction_amount <= D.money)
|
||||
playsound(src, 'sound/machines/chime.ogg', 50, 1)
|
||||
src.visible_message("\icon[src] The [src] chimes.")
|
||||
transaction_paid = 1
|
||||
if(!linked_account.suspended)
|
||||
var/attempt_pin = input("Enter pin code", "EFTPOS transaction") as num
|
||||
var/datum/money_account/D = attempt_account_access(C.associated_account_number, attempt_pin, 2)
|
||||
if(D)
|
||||
if(!D.suspended)
|
||||
if(transaction_amount <= D.money)
|
||||
playsound(src, 'sound/machines/chime.ogg', 50, 1)
|
||||
src.visible_message("\icon[src] The [src] chimes.")
|
||||
transaction_paid = 1
|
||||
|
||||
//transfer the money
|
||||
D.money -= transaction_amount
|
||||
linked_account.money += transaction_amount
|
||||
//transfer the money
|
||||
D.money -= transaction_amount
|
||||
linked_account.money += transaction_amount
|
||||
|
||||
//create entries in the two account transaction logs
|
||||
var/datum/transaction/T = new()
|
||||
T.target_name = "[linked_account.owner_name] (via [eftpos_name])"
|
||||
T.purpose = transaction_purpose
|
||||
if(transaction_amount > 0)
|
||||
T.amount = "([transaction_amount])"
|
||||
//create entries in the two account transaction logs
|
||||
var/datum/transaction/T = new()
|
||||
T.target_name = "[linked_account.owner_name] (via [eftpos_name])"
|
||||
T.purpose = transaction_purpose
|
||||
if(transaction_amount > 0)
|
||||
T.amount = "([transaction_amount])"
|
||||
else
|
||||
T.amount = "[transaction_amount]"
|
||||
T.source_terminal = machine_id
|
||||
T.date = current_date_string
|
||||
T.time = worldtime2text()
|
||||
D.transaction_log.Add(T)
|
||||
//
|
||||
T = new()
|
||||
T.target_name = D.owner_name
|
||||
T.purpose = transaction_purpose
|
||||
T.amount = "[transaction_amount]"
|
||||
T.source_terminal = machine_id
|
||||
T.date = current_date_string
|
||||
T.time = worldtime2text()
|
||||
linked_account.transaction_log.Add(T)
|
||||
else
|
||||
usr << "\icon[src]<span class='warning'>You don't have that much money!</span>"
|
||||
else
|
||||
T.amount = "[transaction_amount]"
|
||||
T.source_terminal = machine_id
|
||||
T.date = current_date_string
|
||||
T.time = worldtime2text()
|
||||
D.transaction_log.Add(T)
|
||||
//
|
||||
T = new()
|
||||
T.target_name = D.owner_name
|
||||
T.purpose = transaction_purpose
|
||||
T.amount = "[transaction_amount]"
|
||||
T.source_terminal = machine_id
|
||||
T.date = current_date_string
|
||||
T.time = worldtime2text()
|
||||
linked_account.transaction_log.Add(T)
|
||||
usr << "\icon[src]<span class='warning'>Your account has been suspended.</span>"
|
||||
else
|
||||
usr << "\icon[src]<span class='warning'>You don't have that much money!</span>"
|
||||
usr << "\icon[src]<span class='warning'>Unable to access account. Check security settings and try again.</span>"
|
||||
else
|
||||
usr << "\icon[src]<span class='warning'>Unable to access account. Check security settings and try again.</span>"
|
||||
usr << "\icon[src]<span class='warning'>Connected account has been suspended.</span>"
|
||||
else
|
||||
usr << "\icon[src]<span class='warning'>EFTPOS is not connected to an account.</span>"
|
||||
else if (istype(I, /obj/item/weapon/card/emag))
|
||||
if(transaction_locked)
|
||||
if(transaction_paid)
|
||||
usr << "\icon[src]<span class='info'>You stealthily swipe [I] through [src].</span>"
|
||||
transaction_locked = 0
|
||||
transaction_paid = 0
|
||||
else
|
||||
visible_message("<span class='info'>[usr] swipes a card through [src].</span>")
|
||||
playsound(src, 'sound/machines/chime.ogg', 50, 1)
|
||||
src.visible_message("\icon[src] The [src] chimes.")
|
||||
transaction_paid = 1
|
||||
else
|
||||
..()
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
var/datum/trade_destination/affected_dest
|
||||
|
||||
/datum/event/economic_event/start()
|
||||
if(!setup_economy)
|
||||
setup_economy()
|
||||
|
||||
affected_dest = pickweight(weighted_randomevent_locations)
|
||||
if(affected_dest.viable_random_events.len)
|
||||
endWhen = rand(60,300)
|
||||
@@ -44,7 +44,7 @@
|
||||
#define ROBOTICS 13
|
||||
#define BIOMEDICAL 14
|
||||
|
||||
#define EVA 15
|
||||
#define GEAR_EVA 15
|
||||
|
||||
//---- The following corporations are friendly with NanoTrasen and loosely enable trade and travel:
|
||||
//Corporation NanoTrasen - Generalised / high tech research and plasma exploitation.
|
||||
@@ -63,10 +63,20 @@
|
||||
//Destroyers are medium sized vessels, often used for escorting larger ships but able to go toe-to-toe with them if need be.
|
||||
//Frigates are medium sized vessels, often used for escorting larger ships. They will rapidly find themselves outclassed if forced to face heavy warships head on.
|
||||
|
||||
var/setup_economy = 0
|
||||
var/global/current_date_string
|
||||
|
||||
var/global/datum/money_account/vendor_account
|
||||
var/global/datum/money_account/station_account
|
||||
var/global/list/datum/money_account/department_accounts = list()
|
||||
var/global/num_financial_terminals = 1
|
||||
var/global/next_account_number = 0
|
||||
var/global/list/all_money_accounts = list()
|
||||
var/global/economy_init = 0
|
||||
|
||||
/proc/setup_economy()
|
||||
if(setup_economy)
|
||||
return
|
||||
if(economy_init)
|
||||
return 2
|
||||
|
||||
var/datum/feed_channel/newChannel = new /datum/feed_channel
|
||||
newChannel.channel_name = "Tau Ceti Daily"
|
||||
newChannel.author = "CentComm Minister of Information"
|
||||
@@ -86,4 +96,61 @@ var/setup_economy = 0
|
||||
weighted_randomevent_locations[D] = D.viable_random_events.len
|
||||
weighted_mundaneevent_locations[D] = D.viable_mundane_events.len
|
||||
|
||||
setup_economy = 1
|
||||
create_station_account()
|
||||
|
||||
for(var/department in station_departments)
|
||||
create_department_account(department)
|
||||
create_department_account("Vendor")
|
||||
vendor_account = department_accounts["Vendor"]
|
||||
|
||||
current_date_string = "[num2text(rand(1,31))] [pick("January","February","March","April","May","June","July","August","September","October","November","December")], 2557"
|
||||
|
||||
economy_init = 1
|
||||
return 1
|
||||
|
||||
/proc/create_station_account()
|
||||
if(!station_account)
|
||||
next_account_number = rand(111111, 999999)
|
||||
|
||||
station_account = new()
|
||||
station_account.owner_name = "[station_name()] Station Account"
|
||||
station_account.account_number = rand(111111, 999999)
|
||||
station_account.remote_access_pin = rand(1111, 111111)
|
||||
station_account.money = 75000
|
||||
|
||||
//create an entry in the account transaction log for when it was created
|
||||
var/datum/transaction/T = new()
|
||||
T.target_name = station_account.owner_name
|
||||
T.purpose = "Account creation"
|
||||
T.amount = 75000
|
||||
T.date = "2nd April, 2555"
|
||||
T.time = "11:24"
|
||||
T.source_terminal = "Biesel GalaxyNet Terminal #277"
|
||||
|
||||
//add the account
|
||||
station_account.transaction_log.Add(T)
|
||||
all_money_accounts.Add(station_account)
|
||||
|
||||
/proc/create_department_account(department)
|
||||
next_account_number = rand(111111, 999999)
|
||||
|
||||
var/datum/money_account/department_account = new()
|
||||
department_account.owner_name = "[department] Account"
|
||||
department_account.account_number = rand(111111, 999999)
|
||||
department_account.remote_access_pin = rand(1111, 111111)
|
||||
department_account.money = 5000
|
||||
|
||||
//create an entry in the account transaction log for when it was created
|
||||
var/datum/transaction/T = new()
|
||||
T.target_name = department_account.owner_name
|
||||
T.purpose = "Account creation"
|
||||
T.amount = department_account.money
|
||||
T.date = "2nd April, 2555"
|
||||
T.time = "11:24"
|
||||
T.source_terminal = "Biesel GalaxyNet Terminal #277"
|
||||
|
||||
//add the account
|
||||
department_account.transaction_log.Add(T)
|
||||
all_money_accounts.Add(department_account)
|
||||
|
||||
department_accounts[department] = department_account
|
||||
@@ -1,35 +1,22 @@
|
||||
/var/global/account_hack_attempted = 0
|
||||
|
||||
/datum/event/money_hacker
|
||||
endWhen = 10000
|
||||
var/time_duration = 0
|
||||
var/time_start = 0
|
||||
var/datum/money_account/affected_account
|
||||
var/obj/machinery/account_database/affected_db
|
||||
endWhen = 100
|
||||
var/end_time
|
||||
|
||||
/datum/event/money_hacker/setup()
|
||||
end_time = world.time + 6000
|
||||
if(all_money_accounts.len)
|
||||
for(var/obj/machinery/account_database/DB in world)
|
||||
if( DB.z == 1 && !(DB.stat&NOPOWER) && DB.activated )
|
||||
affected_db = DB
|
||||
break
|
||||
if(affected_db)
|
||||
affected_account = pick(all_money_accounts)
|
||||
|
||||
account_hack_attempted = 1
|
||||
else
|
||||
kill()
|
||||
return
|
||||
|
||||
time_start = world.time
|
||||
time_duration = rand(3000, 18000)
|
||||
endWhen = time_duration * 10 //a big enough buffer so that we should timeout before we run out of ticks
|
||||
account_hack_attempted = 1
|
||||
|
||||
/datum/event/money_hacker/start()
|
||||
return
|
||||
|
||||
/datum/event/money_hacker/announce()
|
||||
var/message = "A brute force hack has been detected (in progress since [worldtime2text()]). The target of the attack is: Financial account #[affected_account.account_number], \
|
||||
without intervention this attack will succeed in [time_duration / 600] minutes. Required intervention: complete shutdown of affected accounts databases until the attack has ceased. \
|
||||
without intervention this attack will succeed in approximately 10 minutes. Required intervention: temporary suspension of affected accounts until the attack has ceased. \
|
||||
Notifications will be sent as updates occur.<br>"
|
||||
var/my_department = "[station_name()] firewall subroutines"
|
||||
var/sending = message + "<font color='blue'><b>Message dispatched by [my_department].</b></font>"
|
||||
@@ -58,64 +45,62 @@
|
||||
Console.messages += "<B><FONT color='red'>High Priority message from [my_department]</FONT></B><BR>[sending]"
|
||||
|
||||
/datum/event/money_hacker/tick()
|
||||
if(world.time > time_start + time_duration)
|
||||
var/message
|
||||
if(affected_account && affected_db && affected_db.activated && !(affected_db.stat & (NOPOWER|BROKEN)) )
|
||||
//hacker wins
|
||||
message = "The hack attempt has succeeded."
|
||||
if(world.time >= end_time)
|
||||
endWhen = activeFor
|
||||
else
|
||||
endWhen = activeFor + 10
|
||||
|
||||
//subtract the money
|
||||
var/lost = affected_account.money * 0.8 + (rand(2,4) - 2) / 10
|
||||
affected_account.money -= lost
|
||||
|
||||
//create a taunting log entry
|
||||
var/datum/transaction/T = new()
|
||||
T.target_name = pick("","yo brotha from anotha motha","el Presidente","chieF smackDowN")
|
||||
T.purpose = pick("Ne$ ---ount fu%ds init*&lisat@*n","PAY BACK YOUR MUM","Funds withdrawal","pWnAgE","l33t hax","liberationez")
|
||||
T.amount = pick("","([rand(0,99999)])","alla money","9001$","HOLLA HOLLA GET DOLLA","([lost])")
|
||||
var/date1 = "31 December, 1999"
|
||||
var/date2 = "[num2text(rand(1,31))] [pick("January","February","March","April","May","June","July","August","September","October","November","December")], [rand(1000,3000)]"
|
||||
T.date = pick("", current_date_string, date1, date2)
|
||||
var/time1 = rand(0, 99999999)
|
||||
var/time2 = "[round(time1 / 36000)+12]:[(time1 / 600 % 60) < 10 ? add_zero(time1 / 600 % 60, 1) : time1 / 600 % 60]"
|
||||
T.time = pick("", worldtime2text(), time2)
|
||||
T.source_terminal = pick("","[pick("Biesel","New Gibson")] GalaxyNet Terminal #[rand(111,999)]","your mums place","nantrasen high CommanD")
|
||||
|
||||
affected_account.transaction_log.Add(T)
|
||||
|
||||
else
|
||||
//crew wins
|
||||
message = "The attack has ceased, the affected databases can now be brought online."
|
||||
|
||||
var/my_department = "[station_name()] firewall subroutines"
|
||||
var/sending = message + "<font color='blue'><b>Message dispatched by [my_department].</b></font>"
|
||||
|
||||
var/pass = 0
|
||||
for(var/obj/machinery/message_server/MS in world)
|
||||
if(!MS.active) continue
|
||||
// /obj/machinery/message_server/proc/send_rc_message(var/recipient = "",var/sender = "",var/message = "",var/stamp = "", var/id_auth = "", var/priority = 1)
|
||||
MS.send_rc_message("Engineering/Security/Bridge", my_department, message, "", "", 2)
|
||||
pass = 1
|
||||
|
||||
if(pass)
|
||||
var/keyed_dpt1 = ckey("Engineering")
|
||||
var/keyed_dpt2 = ckey("Security")
|
||||
var/keyed_dpt3 = ckey("Bridge")
|
||||
for (var/obj/machinery/requests_console/Console in allConsoles)
|
||||
var/keyed_department = ckey(Console.department)
|
||||
if(keyed_department == keyed_dpt1 || keyed_department == keyed_dpt2 || keyed_department == keyed_dpt3)
|
||||
if(Console.newmessagepriority < 2)
|
||||
Console.newmessagepriority = 2
|
||||
Console.icon_state = "req_comp2"
|
||||
if(!Console.silent)
|
||||
playsound(Console.loc, 'sound/machines/twobeep.ogg', 50, 1)
|
||||
for (var/mob/O in hearers(5, Console.loc))
|
||||
O.show_message(text("\icon[Console] *The Requests Console beeps: 'PRIORITY Alert in [my_department]'"))
|
||||
Console.messages += "<B><FONT color='red'>High Priority message from [my_department]</FONT></B><BR>[sending]"
|
||||
|
||||
kill()
|
||||
|
||||
//shouldn't ever hit this, but this is here just in case
|
||||
/datum/event/money_hacker/end()
|
||||
if(affected_account && affected_db)
|
||||
endWhen += time_duration
|
||||
var/message
|
||||
if(affected_account && !affected_account)
|
||||
//hacker wins
|
||||
message = "The hack attempt has succeeded."
|
||||
|
||||
//subtract the money
|
||||
var/lost = affected_account.money * 0.8 + (rand(2,4) - 2) / 10
|
||||
affected_account.money -= lost
|
||||
|
||||
//create a taunting log entry
|
||||
var/datum/transaction/T = new()
|
||||
T.target_name = pick("","yo brotha from anotha motha","el Presidente","chieF smackDowN")
|
||||
T.purpose = pick("Ne$ ---ount fu%ds init*&lisat@*n","PAY BACK YOUR MUM","Funds withdrawal","pWnAgE","l33t hax","liberationez")
|
||||
T.amount = pick("","([rand(0,99999)])","alla money","9001$","HOLLA HOLLA GET DOLLA","([lost])")
|
||||
var/date1 = "31 December, 1999"
|
||||
var/date2 = "[num2text(rand(1,31))] [pick("January","February","March","April","May","June","July","August","September","October","November","December")], [rand(1000,3000)]"
|
||||
T.date = pick("", current_date_string, date1, date2)
|
||||
var/time1 = rand(0, 99999999)
|
||||
var/time2 = "[round(time1 / 36000)+12]:[(time1 / 600 % 60) < 10 ? add_zero(time1 / 600 % 60, 1) : time1 / 600 % 60]"
|
||||
T.time = pick("", worldtime2text(), time2)
|
||||
T.source_terminal = pick("","[pick("Biesel","New Gibson")] GalaxyNet Terminal #[rand(111,999)]","your mums place","nantrasen high CommanD")
|
||||
|
||||
affected_account.transaction_log.Add(T)
|
||||
|
||||
else
|
||||
//crew wins
|
||||
message = "The attack has ceased, the affected accounts can now be brought online."
|
||||
|
||||
var/my_department = "[station_name()] firewall subroutines"
|
||||
var/sending = message + "<font color='blue'><b>Message dispatched by [my_department].</b></font>"
|
||||
|
||||
var/pass = 0
|
||||
for(var/obj/machinery/message_server/MS in world)
|
||||
if(!MS.active) continue
|
||||
// /obj/machinery/message_server/proc/send_rc_message(var/recipient = "",var/sender = "",var/message = "",var/stamp = "", var/id_auth = "", var/priority = 1)
|
||||
MS.send_rc_message("Engineering/Security/Bridge", my_department, message, "", "", 2)
|
||||
pass = 1
|
||||
|
||||
if(pass)
|
||||
var/keyed_dpt1 = ckey("Engineering")
|
||||
var/keyed_dpt2 = ckey("Security")
|
||||
var/keyed_dpt3 = ckey("Bridge")
|
||||
for (var/obj/machinery/requests_console/Console in allConsoles)
|
||||
var/keyed_department = ckey(Console.department)
|
||||
if(keyed_department == keyed_dpt1 || keyed_department == keyed_dpt2 || keyed_department == keyed_dpt3)
|
||||
if(Console.newmessagepriority < 2)
|
||||
Console.newmessagepriority = 2
|
||||
Console.icon_state = "req_comp2"
|
||||
if(!Console.silent)
|
||||
playsound(Console.loc, 'sound/machines/twobeep.ogg', 50, 1)
|
||||
for (var/mob/O in hearers(5, Console.loc))
|
||||
O.show_message(text("\icon[Console] *The Requests Console beeps: 'PRIORITY Alert in [my_department]'"))
|
||||
Console.messages += "<B><FONT color='red'>High Priority message from [my_department]</FONT></B><BR>[sending]"
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
/datum/event/money_lotto
|
||||
endWhen = 301
|
||||
announceWhen = 300
|
||||
var/winner_name = "John Smith"
|
||||
var/winner_sum = 0
|
||||
var/deposit_success = 0
|
||||
@@ -9,18 +7,20 @@
|
||||
winner_sum = pick(5000, 10000, 50000, 100000, 500000, 1000000, 1500000)
|
||||
if(all_money_accounts.len)
|
||||
var/datum/money_account/D = pick(all_money_accounts)
|
||||
D.money += winner_sum
|
||||
winner_name = D.owner_name
|
||||
if(!D.suspended)
|
||||
D.money += winner_sum
|
||||
|
||||
var/datum/transaction/T = new()
|
||||
T.target_name = "Tau Ceti Daily Grand Slam -Stellar- Lottery"
|
||||
T.purpose = "Winner!"
|
||||
T.amount = winner_sum
|
||||
T.date = current_date_string
|
||||
T.time = worldtime2text()
|
||||
T.source_terminal = "Biesel TCD Terminal #[rand(111,333)]"
|
||||
D.transaction_log.Add(T)
|
||||
else
|
||||
kill()
|
||||
var/datum/transaction/T = new()
|
||||
T.target_name = "Tau Ceti Daily Grand Slam -Stellar- Lottery"
|
||||
T.purpose = "Winner!"
|
||||
T.amount = winner_sum
|
||||
T.date = current_date_string
|
||||
T.time = worldtime2text()
|
||||
T.source_terminal = "Biesel TCD Terminal #[rand(111,333)]"
|
||||
D.transaction_log.Add(T)
|
||||
|
||||
deposit_success = 1
|
||||
|
||||
/datum/event/money_lotto/announce()
|
||||
var/datum/feed_message/newMsg = new /datum/feed_message
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
newMsg.body = "TC Daily wishes to congratulate <b>[winner_name]</b> for recieving the Tau Ceti Stellar Slam Lottery, and receiving the out of this world sum of [winner_sum] credits!"
|
||||
if(!deposit_success)
|
||||
newMsg.body += "<br>Unfortunately, we were unable to verify the account details provided, so we were unable to transfer the money. Send a cheque containing the sum of $500 to TCD 'Stellar Slam' office on Biesel Prime containing updated details, and it'll be resent within the month."
|
||||
newMsg.body += "<br>Unfortunately, we were unable to verify the account details provided, so we were unable to transfer the money. Send a cheque containing the sum of $500 to TCD 'Stellar Slam' office on Biesel Prime containing updated details, and your winnings'll be resent within the month."
|
||||
|
||||
for(var/datum/feed_channel/FC in news_network.network_channels)
|
||||
if(FC.channel_name == "Tau Ceti Daily")
|
||||
|
||||
Reference in New Issue
Block a user