Merge branch 'master' of github.com:Baystation12/Baystation12

This commit is contained in:
Spamcat
2013-07-12 03:06:41 +04:00
11 changed files with 1006 additions and 959 deletions
@@ -5,6 +5,7 @@ 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)
@@ -27,8 +28,7 @@ var/global/datum/money_account/vendor_account
//add the account
station_account.transaction_log.Add(T)
for(var/obj/machinery/account_database/A in machines)
A.accounts.Add(station_account)
all_money_accounts.Add(station_account)
/proc/create_department_account(department)
next_account_number = rand(111111, 999999)
@@ -50,14 +50,71 @@ var/global/datum/money_account/vendor_account
//add the account
department_account.transaction_log.Add(T)
for(var/obj/machinery/account_database/A in machines)
A.accounts.Add(department_account)
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(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
/datum/money_account
var/owner_name = ""
var/account_number = 0
@@ -82,7 +139,6 @@ var/global/datum/money_account/vendor_account
icon = 'virology.dmi'
icon_state = "analyser"
density = 1
var/list/accounts = list()
req_one_access = list(access_hop, access_captain)
var/receipt_num
var/machine_id = ""
@@ -156,10 +212,10 @@ var/global/datum/money_account/vendor_account
dat += "</tr>"
dat += "</table>"
else
dat += "<a href='?src=\ref[src];choice=create_account;'>Create new account</a> <a href='?src=\ref[src];choice=sync_accounts;'>Sync accounts across databases</a><br><br>"
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<=accounts.len, i++)
var/datum/money_account/D = accounts[i]
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>"
@@ -193,22 +249,12 @@ var/global/datum/money_account/vendor_account
if(href_list["choice"])
switch(href_list["choice"])
if("sync_accounts")
for(var/obj/machinery/account_database/A in machines)
for(var/datum/money_account/M in src.accounts)
if(!A.accounts.Find(M))
A.accounts.Add(M)
for(var/datum/money_account/M in A.accounts)
if(!src.accounts.Find(M))
src.accounts.Add(M)
usr << "\icon[src] <span class='info'>Accounts synched across all NanoTrasen financial databases.</span>"
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)
add_account(account_name, starting_funds)
create_account(account_name, starting_funds, src)
if(starting_funds > 0)
//subtract the money
station_account.money -= starting_funds
@@ -247,85 +293,18 @@ var/global/datum/money_account/vendor_account
access_level = 1
if("view_account_detail")
var/index = text2num(href_list["account_index"])
if(index && index <= accounts.len)
detailed_account_view = accounts[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/add_account_across_all(var/new_owner_name = "Default user", var/starting_funds = 0, var/pre_existing = 0)
var/datum/money_account/M = add_account(new_owner_name, starting_funds, pre_existing)
for(var/obj/machinery/account_database/D in machines)
if(D == src)
continue
D.accounts.Add(M)
return M
/obj/machinery/account_database/proc/add_account(var/new_owner_name = "Default user", var/starting_funds = 0, var/pre_existing = 0)
//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(pre_existing)
//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 = 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(src.loc)
var/obj/item/weapon/paper/R = new(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> [machine_id]<br>"
R.info += "<i>Authorised NT officer overseeing creation:</i> [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)
accounts.Add(M)
return M
/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 accounts)
for(var/datum/money_account/D in all_money_accounts)
if(D.account_number == attempt_account_number)
D.money += amount
@@ -350,7 +329,12 @@ var/global/datum/money_account/vendor_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 accounts)
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
@@ -21,6 +21,30 @@
spawn(0)
print_reference()
//create a short manual as well
var/obj/item/weapon/paper/R = new(src.loc)
R.name = "Steps to success: Correct EFTPOS Usage"
R.info += "<b>When first setting up your EFTPOS device:</b>"
R.info += "1. Memorise your EFTPOS command code (provided with all EFTPOS devices).<br>"
R.info += "2. Confirm that your EFTPOS device is connected to your local accounts database. For additional assistance with this step, contact NanoTrasen IT Support<br>"
R.info += "3. Confirm that your EFTPOS device has been linked to the account that you wish to recieve funds for all transactions processed on this device.<br>"
R.info += "<b>When starting a new transaction with your EFTPOS device:</b>"
R.info += "1. Ensure the device is UNLOCKED so that new data may be entered.<br>"
R.info += "2. Enter a sum of money and reference message for the new transaction.<br>"
R.info += "3. Lock the transaction, it is now ready for your customer.<br>"
R.info += "4. If at this stage you wish to modify or cancel your transaction, you may simply reset (unlock) your EFTPOS device.<br>"
R.info += "5. Give your EFTPOS device to the customer, they must authenticate the transaction by swiping their ID card and entering their PIN number.<br>"
R.info += "6. If done correctly, the transaction will be logged to both accounts with the reference you have entered, the terminal ID of your EFTPOS device and the money transferred across accounts.<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 EFTPOS device.</i>"
//by default, connect to the station account
//the user of the EFTPOS device can change the target account though, and no-one will be the wiser (except whoever's being charged)
linked_account = station_account
+13 -8
View File
@@ -36,9 +36,12 @@ log transactions
/obj/machinery/atm/New()
..()
reconnect_database()
machine_id = "[station_name()] RT #[num_financial_terminals++]"
/obj/machinery/atm/initialize()
..()
reconnect_database()
/obj/machinery/atm/process()
if(stat & NOPOWER)
return
@@ -253,13 +256,15 @@ log transactions
playsound(src, 'buzz-two.ogg', 50, 1)
//create an entry in the account transaction log
var/datum/transaction/T = new()
T.target_name = authenticated_account.owner_name
T.purpose = "Unauthorised login attempt"
T.source_terminal = machine_id
T.date = current_date_string
T.time = worldtime2text()
authenticated_account.transaction_log.Add(T)
var/datum/money_account/failed_account = linked_db.get_account(tried_account_num)
if(failed_account)
var/datum/transaction/T = new()
T.target_name = failed_account.owner_name
T.purpose = "Unauthorised login attempt"
T.source_terminal = machine_id
T.date = current_date_string
T.time = worldtime2text()
failed_account.transaction_log.Add(T)
else
usr << "\red \icon[src] Incorrect pin/account combination entered, [max_pin_attempts - number_incorrect_tries] attempts remaining."
previous_account_number = tried_account_num
+3 -1
View File
@@ -213,6 +213,8 @@ Implants;
for(var/mob/living/carbon/human/man in player_list) if(man.client && man.mind)
// NT relation option
var/special_role = man.mind.special_role
if (special_role == "Wizard" || special_role == "Ninja" || special_role == "Syndicate")
continue //NT intelligence ruled out possiblity that those are too classy to pretend to be a crew.
if(man.client.prefs.nanotrasen_relation == "Opposed" && prob(50) || \
man.client.prefs.nanotrasen_relation == "Skeptical" && prob(20))
suspects += man
@@ -473,4 +475,4 @@ proc/get_nt_opposed()
else if(man.client.prefs.nanotrasen_relation == "Skeptical" && prob(50))
dudes += man
if(dudes.len == 0) return null
return pick(dudes)
return pick(dudes)
+1 -1
View File
@@ -369,7 +369,7 @@ var/global/datum/controller/occupations/job_master
//give them an account in the station database
if(centcomm_account_db)
var/datum/money_account/M = centcomm_account_db.add_account_across_all(H.real_name, starting_funds = rand(50,500)*10, pre_existing = 1)
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>"
File diff suppressed because it is too large Load Diff
+10 -6
View File
@@ -103,8 +103,8 @@ var/global/normal_ooc_colour = "#002eb8"
msg = copytext(sanitize(msg), 1, MAX_MESSAGE_LEN)
if(!msg) return
if(!(prefs.toggles & CHAT_OOC))
src << "\red You have OOC muted."
if(!(prefs.toggles & CHAT_LOOC))
src << "\red You have LOOC muted."
return
if(!holder)
@@ -127,14 +127,15 @@ var/global/normal_ooc_colour = "#002eb8"
log_ooc("(LOCAL) [mob.name]/[key] : [msg]")
for(var/mob/M in hearers())
var/list/heard = get_mobs_in_view(7, src.mob)
for(var/mob/M in heard)
if(!M.client)
continue
var/client/C = M.client
if (C in admins)
continue //they are handled after that
if(C.prefs.toggles & CHAT_OOC)
if(C.prefs.toggles & CHAT_LOOC)
var/display_name = src.key
if(holder)
if(holder.fakekey)
@@ -144,5 +145,8 @@ var/global/normal_ooc_colour = "#002eb8"
display_name = holder.fakekey
C << "<font color='#6699CC'><span class='ooc'><span class='prefix'>LOOC:</span> <EM>[display_name]:</EM> <span class='message'>[msg]</span></span></font>"
for(var/client/C in admins)
if(C.prefs.toggles & CHAT_OOC)
C << "<font color='#6699CC'><span class='ooc'><span class='prefix'>LOOC:</span> <EM>[src.key]:</EM> <span class='message'>[msg]</span></span></font>"
if(C.prefs.toggles & CHAT_LOOC)
var/prefix = "(R)LOOC"
if (C.mob in heard)
prefix = "LOOC"
C << "<font color='#6699CC'><span class='ooc'><span class='prefix'>[prefix]:</span> <EM>[src.key]:</EM> <span class='message'>[msg]</span></span></font>"
@@ -95,6 +95,17 @@
src << "You will [(prefs.toggles & CHAT_OOC) ? "now" : "no longer"] see messages on the OOC channel."
feedback_add_details("admin_verb","TOOC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/listen_looc()
set name = "Show/Hide LOOC"
set category = "Preferences"
set desc = "Toggles seeing Local OutOfCharacter chat"
prefs.toggles ^= CHAT_LOOC
prefs.save_preferences()
src << "You will [(prefs.toggles & CHAT_LOOC) ? "now" : "no longer"] see messages on the LOOC channel."
feedback_add_details("admin_verb","TLOOC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/Toggle_Soundscape() //All new ambience should be added here so it works with this verb until someone better at things comes up with a fix that isn't awful
set name = "Hear/Silence Ambience"
set category = "Preferences"
+6 -5
View File
@@ -8,12 +8,13 @@
var/obj/machinery/account_database/affected_db
/datum/event/money_hacker/setup()
for(var/obj/machinery/account_database/DB in world)
if( DB.z == 1 && !(DB.stat&NOPOWER) && DB.activated && DB.accounts.len)
affected_db = DB
break
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(affected_db.accounts)
affected_account = pick(all_money_accounts.len)
else
kill()
return
+2 -2
View File
@@ -7,8 +7,8 @@
/datum/event/money_lotto/start()
winner_sum = pick(5000, 10000, 50000, 100000, 500000, 1000000, 1500000)
if(centcomm_account_db.accounts.len)
var/datum/money_account/D = pick(centcomm_account_db.accounts)
if(all_money_accounts.len)
var/datum/money_account/D = pick(all_money_accounts)
D.money += winner_sum
var/datum/transaction/T = new()
+1
View File
@@ -624,6 +624,7 @@ var/list/TAGGERLOCATIONS = list("Disposals",
#define CHAT_RADIO 512
#define CHAT_ATTACKLOGS 1024
#define CHAT_DEBUGLOGS 2048
#define CHAT_LOOC 4096
#define TOGGLES_DEFAULT (SOUND_ADMINHELP|SOUND_MIDI|SOUND_AMBIENCE|SOUND_LOBBY|CHAT_OOC|CHAT_DEAD|CHAT_GHOSTEARS|CHAT_GHOSTSIGHT|CHAT_PRAYER|CHAT_RADIO|CHAT_ATTACKLOGS)