diff --git a/code/game/jobs/job_controller.dm b/code/game/jobs/job_controller.dm index 3c163ab1d6b..e457b566037 100644 --- a/code/game/jobs/job_controller.dm +++ b/code/game/jobs/job_controller.dm @@ -405,7 +405,7 @@ var/global/datum/controller/occupations/job_master H.buckled.loc = H.loc H.buckled.dir = H.dir - var/datum/money_account/M = create_account(H.real_name, 1000, null) + var/datum/money_account/M = create_account(H, 1000, null) if(H.mind) var/remembered_info = "" diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index d462d90bcc4..e9a6950449e 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -1336,6 +1336,7 @@ datum/preferences if("changeslot") load_character(user,text2num(href_list["num"])) + slot_name=text2num(href_list["num"]) close_load_dialog(user) if("tab") diff --git a/code/modules/economy/Accounts.dm b/code/modules/economy/Accounts.dm index 4323d352375..8864fda4940 100644 --- a/code/modules/economy/Accounts.dm +++ b/code/modules/economy/Accounts.dm @@ -58,9 +58,9 @@ var/global/list/all_money_accounts = list() //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) +/proc/create_account(var/mob/living/carbon/human/H, var/starting_funds = 0, var/obj/machinery/account_database/source_db, ) - var/DBQuery/query = dbcon.NewQuery("SELECT account_number,account_pin,account_balance FROM characters WHERE real_name='[sql_sanitize_text(new_owner_name)]'") + var/DBQuery/query = dbcon.NewQuery("SELECT account_number,account_pin,account_balance FROM characters WHERE ckey='[sql_sanitize_text(H.ckey)]' AND slot='[H.client.prefs.slot_name]'") if(!query.Execute()) var/err = query.ErrorMsg() log_game("SQL ERROR retrieving bank account information. Error : \[[err]\]\n") @@ -72,12 +72,12 @@ var/global/list/all_money_accounts = list() while(query.NextRow()) //create a new account var/datum/money_account/M = new() - M.owner_name = new_owner_name + M.owner_name = H.real_name if(text2num(query.item[1]) == 0) M.remote_access_pin = rand(1111, 111111) M.money = 1000 M.account_number = rand(111111, 999999) - var/DBQuery/query2 = dbcon.NewQuery("UPDATE characters SET account_number='[M.account_number]',account_pin='[M.remote_access_pin]', account_balance='[M.money]' WHERE real_name='[sql_sanitize_text(new_owner_name)]'") + var/DBQuery/query2 = dbcon.NewQuery("UPDATE characters SET account_number='[M.account_number]',account_pin='[M.remote_access_pin]', account_balance='[M.money]' WHERE ckey='[sql_sanitize_text(H.ckey)]' AND slot='[H.client.prefs.slot_name]'") if(!query2.Execute()) var/err = query2.ErrorMsg() log_game("SQL ERROR creating bank account. Error : \[[err]\]\n") diff --git a/code/modules/economy/Accounts_DB.dm b/code/modules/economy/Accounts_DB.dm index 757f0824846..d45b5e23029 100644 --- a/code/modules/economy/Accounts_DB.dm +++ b/code/modules/economy/Accounts_DB.dm @@ -179,7 +179,7 @@ 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) + create_account(account_name, starting_funds, src) // CHANGE account_name for human mob with new econ code if(starting_funds > 0) //subtract the money station_account.money -= starting_funds