Skip to content

Commit

Permalink
Wallets and Bank Cards (#2979)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request

Makes wallets part of the outfit shit and splits money behavior of
access cards into bank cards
<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

## Why It's Good For The Game

<!-- Please add a short description of why you think these changes would
benefit the game. If you can't justify it in words, it might not be
worth adding. -->

## Changelog

:cl:
add: Bank accounts are now handled through cash cards! You now spawn
with a wallet to store your extra card!
/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
  • Loading branch information
FalloutFalcon authored Jun 20, 2024
1 parent 329760b commit dc34ff9
Show file tree
Hide file tree
Showing 46 changed files with 321 additions and 555 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,6 @@
/obj/item/clothing/under/rank/cargo/miner,
/obj/item/clothing/suit/hooded/wintercoat/miner,
/obj/item/clothing/shoes/winterboots,
/obj/item/card/id/mining,
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/wood,
/area/ruin/powered)
Expand Down
2 changes: 1 addition & 1 deletion _maps/RandomRuins/RockRuins/rockplanet_shippingdock.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -2068,7 +2068,7 @@
"sa" = (
/obj/effect/turf_decal/rechargefloor,
/obj/effect/turf_decal/industrial/warning/dust,
/obj/effect/spawner/lootdrop/whiteship_cere_ripley,
/obj/effect/spawner/lootdrop/ripley,
/turf/open/floor/plasteel/mono/dark,
/area/ruin/rockplanet/shippingdockwarehouse)
"sc" = (
Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/is_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ GLOBAL_LIST_INIT(turfs_without_ground, typecacheof(list(

#define isidcard(I) (istype(I, /obj/item/card/id))

#define isbankcard(I) (istype(I, /obj/item/card/bank))

#define isstructure(A) (istype(A, /obj/structure))

#define ismachinery(A) (istype(A, /obj/machinery))
Expand Down
13 changes: 11 additions & 2 deletions code/datums/outfit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,13 @@
/// Type path of item to go in the glasses slot
var/glasses = null

var/wallet = null

/// Type path of item to go in the idcard slot
var/id = null

var/bank_card = null

/// Type path of item for left pocket slot
var/l_pocket = null

Expand Down Expand Up @@ -180,8 +184,13 @@
H.equip_to_slot_or_del(new ears(H),ITEM_SLOT_EARS, TRUE)
if(glasses)
H.equip_to_slot_or_del(new glasses(H),ITEM_SLOT_EYES, TRUE)
if(id)
H.equip_to_slot_or_del(new id(H),ITEM_SLOT_ID, TRUE)
if(!visualsOnly)
if(wallet)
H.equip_to_slot_or_del(new wallet(H),ITEM_SLOT_ID, TRUE)
if(id)
H.equip_to_slot_or_del(new id(H),ITEM_SLOT_ID, TRUE)
if(bank_card)
H.equip_to_slot_or_del(new bank_card(H),ITEM_SLOT_ID, TRUE)
if(suit_store)
H.equip_to_slot_or_del(new suit_store(H),ITEM_SLOT_SUITSTORE, TRUE)

Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions code/game/machinery/bounty_board.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ GLOBAL_LIST_EMPTY(request_list)

/obj/machinery/bounty_board/attackby(obj/item/I, mob/living/user, params)
. = ..()
if(istype(I,/obj/item/card/id))
var/obj/item/card/id/current_card = I
if(istype(I,/obj/item/card/bank))
var/obj/item/card/bank/current_card = I
if(current_card.registered_account)
current_user = current_card.registered_account
return TRUE
Expand Down Expand Up @@ -72,9 +72,9 @@ GLOBAL_LIST_EMPTY(request_list)
if(request.applicants)
for(var/datum/bank_account/j in request.applicants)
formatted_applicants += list(list("name" = j.account_holder, "request_id" = request.owner_account.account_id, "requestee_id" = j.account_id))
var/obj/item/card/id/id_card = user.get_idcard()
if(id_card?.registered_account)
current_user = id_card.registered_account
var/obj/item/card/bank/bank_card = user.get_bankcard()
if(bank_card?.registered_account)
current_user = bank_card.registered_account
if(current_user)
data["accountName"] = current_user.account_holder
data["requests"] = formatted_requests
Expand Down
4 changes: 1 addition & 3 deletions code/game/machinery/computer/cloning.dm
Original file line number Diff line number Diff line change
Expand Up @@ -534,9 +534,7 @@

if(ishuman(mob_occupant))
dna = C.has_dna()
var/obj/item/card/id/I = C.get_idcard(TRUE)
if(I)
has_bank_account = I.registered_account
has_bank_account = C.get_bank_account()
if(isbrain(mob_occupant))
dna = B.stored_dna

Expand Down
File renamed without changes.
14 changes: 7 additions & 7 deletions code/game/machinery/roulette_machine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
var/chosen_bet_type = "0"
var/last_anti_spam = 0
var/anti_spam_cooldown = 20
var/obj/item/card/id/my_card
var/obj/item/card/bank/my_card
var/playing = FALSE
var/locked = FALSE
var/drop_dir = SOUTH
Expand Down Expand Up @@ -81,7 +81,7 @@
data["Spinning"] = playing
if(ishuman(user))
var/mob/living/carbon/human/H = user
var/obj/item/card/id/C = H.get_idcard(TRUE)
var/obj/item/card/bank/C = H.get_bankcard()
if(C)
data["AccountBalance"] = C.registered_account.account_balance
else
Expand Down Expand Up @@ -114,15 +114,15 @@
return
if(playing)
return ..()
if(istype(W, /obj/item/card/id))
if(istype(W, /obj/item/card/bank))
playsound(src, 'sound/machines/card_slide.ogg', 50, TRUE)

if(machine_stat & MAINT || !on || locked)
to_chat(user, "<span class='notice'>The machine appears to be disabled.</span>")
return FALSE

if(my_card)
var/obj/item/card/id/player_card = W
var/obj/item/card/bank/player_card = W
if(player_card.registered_account.account_balance < chosen_bet_amount) //Does the player have enough funds
audible_message("<span class='warning'>You do not have the funds to play! Lower your bet or get more money.</span>")
playsound(src, 'sound/machines/buzz-two.ogg', 30, TRUE)
Expand Down Expand Up @@ -167,7 +167,7 @@
addtimer(CALLBACK(src, PROC_REF(play), user, player_card, chosen_bet_type, chosen_bet_amount, potential_payout), 4) //Animation first
return TRUE
else
var/obj/item/card/id/new_card = W
var/obj/item/card/bank/new_card = W
if(new_card.registered_account)
var/msg = stripped_input(user, "Name of your roulette wheel:", "Roulette Naming", "Roulette Machine")
if(!msg)
Expand All @@ -181,7 +181,7 @@
return ..()

///Proc called when player is going to try and play
/obj/machinery/roulette/proc/play(mob/user, obj/item/card/id/player_id, bet_type, bet_amount, potential_payout)
/obj/machinery/roulette/proc/play(mob/user, obj/item/card/bank/player_id, bet_type, bet_amount, potential_payout)

var/payout = potential_payout

Expand All @@ -203,7 +203,7 @@
playsound(src, 'sound/machines/piston_lower.ogg', 70)

///Ran after a while to check if the player won or not.
/obj/machinery/roulette/proc/finish_play(obj/item/card/id/player_id, bet_type, bet_amount, potential_payout, rolled_number)
/obj/machinery/roulette/proc/finish_play(obj/item/card/bank/player_id, bet_type, bet_amount, potential_payout, rolled_number)
last_spin = rolled_number

var/is_winner = check_win(bet_type, bet_amount, rolled_number) //Predetermine if we won
Expand Down
File renamed without changes.
8 changes: 7 additions & 1 deletion code/game/objects/effects/spawners/lootdrop.dm
Original file line number Diff line number Diff line change
Expand Up @@ -468,12 +468,18 @@
/obj/structure/salvageable/destructive_analyzer
)

/obj/effect/spawner/lootdrop/ripley
name = "25% mech 75% wreckage ripley spawner"
loot = list(/obj/mecha/working/ripley/mining = 1,
/obj/structure/mecha_wreckage/ripley = 5)
lootdoubles = FALSE

/obj/effect/spawner/lootdrop/salvage_50
name = "50% salvage spawner"
loot = list(
/obj/effect/spawner/lootdrop/maintenance = 13,
/obj/effect/spawner/lootdrop/salvage_machine = 12,
/obj/effect/spawner/lootdrop/whiteship_cere_ripley = 12,
/obj/effect/spawner/lootdrop/ripley = 12,
/obj/structure/closet/crate/secure/loot = 13,
"" = 50
)
Expand Down
160 changes: 160 additions & 0 deletions code/game/objects/items/bank_card.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
/obj/item/card/bank
name = "cash card"
desc = "Managed by a bank outside the sector."
icon_state = "data_1"
var/mining_points = 0 //For redeeming at mining equipment vendors

var/registered_name = null // The name registered_name on the card
var/datum/bank_account/registered_account
var/obj/machinery/paystand/my_store

/obj/item/card/bank/Destroy()
if (registered_account)
registered_account.bank_cards -= src
if (my_store && my_store.my_card == src)
my_store.my_card = null
return ..()

/obj/item/card/bank/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/holochip))
insert_money(W, user)
return
else if(istype(W, /obj/item/spacecash/bundle))
insert_money(W, user, TRUE)
return
else if(istype(W, /obj/item/coin))
insert_money(W, user, TRUE)
return
else if(istype(W, /obj/item/storage/bag/money))
var/obj/item/storage/bag/money/money_bag = W
var/list/money_contained = money_bag.contents

var/money_added = mass_insert_money(money_contained, user)

if (money_added)
to_chat(user, "<span class='notice'>You stuff the contents into the card! They disappear in a puff of bluespace smoke, adding [money_added] worth of credits to the linked account.</span>")
return
else
return ..()

/obj/item/card/bank/proc/insert_money(obj/item/I, mob/user, physical_currency)
var/cash_money = I.get_item_credit_value()
if(!cash_money)
to_chat(user, "<span class='warning'>[I] doesn't seem to be worth anything!</span>")
return

if(!registered_account)
to_chat(user, "<span class='warning'>[src] doesn't have a linked account to deposit [I] into!</span>")
return

registered_account.adjust_money(cash_money)
SSblackbox.record_feedback("amount", "credits_inserted", cash_money)
log_econ("[cash_money] credits were inserted into [src] owned by [src.registered_name]")
if(physical_currency)
to_chat(user, "<span class='notice'>You stuff [I] into [src]. It disappears in a small puff of bluespace smoke, adding [cash_money] credits to the linked account.</span>")
else
to_chat(user, "<span class='notice'>You insert [I] into [src], adding [cash_money] credits to the linked account.</span>")

to_chat(user, "<span class='notice'>The linked account now reports a balance of [registered_account.account_balance] cr.</span>")
qdel(I)

/obj/item/card/bank/proc/mass_insert_money(list/money, mob/user)
if (!money || !money.len)
return FALSE

var/total = 0

for (var/obj/item/physical_money in money)
var/cash_money = physical_money.get_item_credit_value()

total += cash_money

registered_account.adjust_money(cash_money)
SSblackbox.record_feedback("amount", "credits_inserted", total)
log_econ("[total] credits were inserted into [src] owned by [src.registered_name]")
QDEL_LIST(money)

return total

/obj/item/card/bank/proc/alt_click_can_use_id(mob/living/user)
if(!isliving(user))
return
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return

return TRUE

// Returns true if new account was set.
/obj/item/card/bank/proc/set_new_account(mob/living/user)
. = FALSE
var/datum/bank_account/old_account = registered_account

var/new_bank_id = input(user, "Enter your account ID number.", "Account Reclamation", 111111) as num | null

if (isnull(new_bank_id))
return

if(!alt_click_can_use_id(user))
return
if(!new_bank_id || new_bank_id < 111111 || new_bank_id > 999999)
to_chat(user, "<span class='warning'>The account ID number needs to be between 111111 and 999999.</span>")
return
if (registered_account && registered_account.account_id == new_bank_id)
to_chat(user, "<span class='warning'>The account ID was already assigned to this card.</span>")
return

for(var/A in SSeconomy.bank_accounts)
var/datum/bank_account/B = A
if(B.account_id == new_bank_id)
if (old_account)
old_account.bank_cards -= src

B.bank_cards += src
registered_account = B
to_chat(user, "<span class='notice'>The provided account has been linked to this ID card.</span>")

return TRUE

to_chat(user, "<span class='warning'>The account ID number provided is invalid.</span>")
return

/obj/item/card/bank/AltClick(mob/living/user)
if(!alt_click_can_use_id(user))
return

if(!registered_account)
set_new_account(user)
return

var/amount_to_remove = FLOOR(input(user, "How much do you want to withdraw? Current Balance: [registered_account.account_balance]", "Withdraw Funds", 5) as num|null, 1)

if(!amount_to_remove || amount_to_remove < 0)
return
if(!alt_click_can_use_id(user))
return
if(registered_account.adjust_money(-amount_to_remove))
var/obj/item/holochip/holochip = new (user.drop_location(), amount_to_remove)
user.put_in_hands(holochip)
to_chat(user, "<span class='notice'>You withdraw [amount_to_remove] credits into a holochip.</span>")
SSblackbox.record_feedback("amount", "credits_removed", amount_to_remove)
log_econ("[amount_to_remove] credits were removed from [src] owned by [registered_account.account_holder]")
return
else
var/difference = amount_to_remove - registered_account.account_balance
registered_account.bank_card_talk("<span class='warning'>ERROR: The linked account requires [difference] more credit\s to perform that withdrawal.</span>", TRUE)

/obj/item/card/bank/examine(mob/user)
. = ..()
if(registered_account)
. += "The account linked to the ID belongs to '[registered_account.account_holder]' and reports a balance of <B>[registered_account.account_balance] cr</B>."
. += "The card indicates that the holder is <B>[registered_account.holder_age] years old</b>. [(registered_account.holder_age < AGE_MINOR) ? "There's a holographic stripe that reads <b><span class='danger'>'MINOR: DO NOT SERVE ALCOHOL OR TOBACCO'</span></b> along the bottom of the card." : ""]"
. += "<span class='info'>Alt-Click the ID to pull money from the linked account in the form of holochips.</span>"
. += "<span class='info'>You can insert credits into the linked account by pressing holochips, cash, or coins against the ID.</span>"
. += "<span class='boldnotice'>If you lose this ID card, you can reclaim your account by Alt-Clicking a blank ID card while holding it and entering your account ID number.</span>"
else
. += "<span class='info'>There is no registered account linked to this card. Alt-Click to add one.</span>"
if(mining_points)
. += "There's [mining_points] mining equipment redemption point\s loaded onto this card."

/obj/item/card/bank/GetBankCard()
return src
Loading

0 comments on commit dc34ff9

Please sign in to comment.