Merge pull request #12238 from Ghommie/Ghommie-cit747

Some quick economy fixes and improvements.
This commit is contained in:
kevinz000
2020-05-14 04:48:14 -07:00
committed by GitHub
5 changed files with 26 additions and 13 deletions
+4 -5
View File
@@ -311,20 +311,19 @@
registered_account.bank_card_talk("<span class='warning'>ERROR: UNABLE TO LOGIN DUE TO SCHEDULED MAINTENANCE. MAINTENANCE IS SCHEDULED TO COMPLETE IN [(registered_account.withdrawDelay - world.time)/10] SECONDS.</span>", TRUE)
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)
var/amount_to_remove = input(user, "How much do you want to withdraw? Current Balance: [registered_account.account_balance]", "Withdraw Funds", 5) as num|null
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))
amount_to_remove = FLOOR(min(amount_to_remove, registered_account.account_balance), 1)
if(amount_to_remove && 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>")
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)
registered_account.bank_card_talk("<span class='warning'>ERROR: The linked account has no sufficient credits to perform that withdrawal.</span>", TRUE)
/obj/item/card/id/examine(mob/user)
. = ..()
@@ -280,4 +280,6 @@
item = /obj/item/suspiciousphone
cost = 7
restricted = TRUE
limited_stock = 1
*/
+5 -3
View File
@@ -299,6 +299,7 @@ GLOBAL_LIST_EMPTY(vending_products)
R.amount = amount
R.max_amount = amount
R.custom_price = initial(temp.custom_price)
R.custom_premium_price = initial(temp.custom_premium_price)
recordlist += R
/**
* Refill a vending machine from a refill canister
@@ -577,12 +578,13 @@ GLOBAL_LIST_EMPTY(vending_products)
if(cost_mult != 1)
.["cost_mult"] = cost_mult
if(cost_mult < 1)
.["cost_text"] = " [(1 - cost_mult) * 100]% OFF"
.["cost_text"] = " ([(1 - cost_mult) * 100]% OFF)"
else
.["cost_text"] = " [(cost_mult - 1) * 100]% EXTRA"
.["cost_text"] = " ([(cost_mult - 1) * 100]% EXTRA)"
.["stock"] = list()
for (var/datum/data/vending_product/R in product_records + coin_records + hidden_records)
.["stock"][R.name] = R.amount
.
.["extended_inventory"] = extended_inventory
/obj/machinery/vending/ui_act(action, params)
@@ -635,7 +637,7 @@ GLOBAL_LIST_EMPTY(vending_products)
return
var/datum/bank_account/account = C.registered_account
if(coin_records.Find(R) || hidden_records.Find(R))
price_to_use = R.custom_premium_price ? R.custom_premium_price : extra_price
price_to_use = R.custom_premium_price || extra_price
else
price_to_use = round(price_to_use * get_best_discount(C))
if(price_to_use && !account.adjust_money(-price_to_use))
+14 -4
View File
@@ -47,7 +47,18 @@ export const Vending = props => {
<Section title="Products" >
<Table>
{inventory.map((product => {
const suffix = ' cr' + data.cost_text;
const free = (
!data.onstation
|| product.price === 0
|| (
data.cost_mult === 0
&& !product.premium
)
);
const suffix = (!product.premium
? ' cr' + data.cost_text
: ' cr'
);
return (
<Table.Row key={product.name}>
<Table.Cell>
@@ -91,15 +102,14 @@ export const Vending = props => {
disabled={(
data.stock[product.namename] === 0
|| (
data.cost_mult !== 0
!free
&& (
!data.user
|| product.price > data.user.cash
)
)
)}
content={(data.onstation
&& product.price !== 0)
content={!free
? Math.round(product.price * data.cost_mult) + suffix
: 'FREE'}
onClick={() => act(ref, 'vend', {
File diff suppressed because one or more lines are too long