diff --git a/code/modules/stock_market/computer.dm b/code/modules/stock_market/computer.dm index 97b462f2764f..4f4a6dc2537a 100644 --- a/code/modules/stock_market/computer.dm +++ b/code/modules/stock_market/computer.dm @@ -248,6 +248,16 @@ a.updated { src.add_fingerprint(usr) src.updateUsrDialog() +/obj/machinery/computer/stockexchange/attackby(obj/I, mob/user, params) + if(istype(I, /obj/item/holochip)) + var/obj/item/holochip/H = I + var/ahn_amount = H.get_item_credit_value() + H.spend(ahn_amount) + AdjustMonies(ahn_amount) + return + else + return ..() + /obj/machinery/computer/stockexchange/proc/sell_some_shares(datum/stock/S, mob/user) if (!user || !S) return @@ -255,7 +265,7 @@ a.updated { if (!li) to_chat(user, span_danger("No active account on the console!")) return - var/b = SSshuttle.points + var/b = credits var/avail = S.shareholders[logged_in] if (!avail) to_chat(user, span_danger("This account does not own any shares of [S.name]!")) @@ -270,7 +280,7 @@ a.updated { return if (li != logged_in) return - b = SSshuttle.points + b = credits if (!isnum(b)) to_chat(user, span_danger("No active account on the console!")) return diff --git a/code/modules/stock_market/events.dm b/code/modules/stock_market/events.dm index b8fc3391e79e..8aa9b6be2307 100644 --- a/code/modules/stock_market/events.dm +++ b/code/modules/stock_market/events.dm @@ -100,9 +100,6 @@ current_title = "[company.name]: Complete crash" current_desc = "The company had gone bankrupt, was not bailed out and could not recover. No further stock trade will take place. All shares in the company are effectively worthless." company.bankrupt = 1 - for (var/X in company.shareholders) - var/amt = company.shareholders[X] - SSstockmarket.balanceLog(X, -amt * company.current_value) company.shareholders = list() company.current_value = 0 company.borrow_brokers = list() diff --git a/code/modules/stock_market/stocks.dm b/code/modules/stock_market/stocks.dm index 6de4697077eb..ace2db1bc6bb 100644 --- a/code/modules/stock_market/stocks.dm +++ b/code/modules/stock_market/stocks.dm @@ -172,43 +172,42 @@ current_value *= 2 last_unification = world.time -/datum/stock/proc/modifyAccount(whose, by, force=0) - if (SSshuttle.points) - if (by < 0 && SSshuttle.points + by < 0 && !force) +/datum/stock/proc/modifyAccount(obj/machinery/computer/stockexchange/stonker, by, force=0) + if (stonker.credits) + if (by < 0 && stonker.credits + by < 0 && !force) return 0 - SSshuttle.points += by - SSstockmarket.balanceLog(whose, by) + stonker.credits += by return 1 return 0 -/datum/stock/proc/buyShares(who, howmany) +/datum/stock/proc/buyShares(obj/machinery/computer/stockexchange/stonker, howmany) if (howmany <= 0) return howmany = round(howmany) var/loss = howmany * current_value if (available_shares < howmany) return 0 - if (modifyAccount(who, -loss)) + if (modifyAccount(stonker, -loss)) supplyDrop(howmany) - if (!(who in shareholders)) - shareholders[who] = howmany + if (!(stonker in shareholders)) + shareholders[stonker] = howmany else - shareholders[who] += howmany + shareholders[stonker] += howmany return 1 return 0 -/datum/stock/proc/sellShares(whose, howmany) +/datum/stock/proc/sellShares(obj/machinery/computer/stockexchange/stonker, howmany) if (howmany < 0) return howmany = round(howmany) var/gain = howmany * current_value - if (shareholders[whose] < howmany) + if (shareholders[stonker] < howmany) return 0 - if (modifyAccount(whose, gain)) + if (modifyAccount(stonker, gain)) supplyGrowth(howmany) - shareholders[whose] -= howmany - if (shareholders[whose] <= 0) - shareholders -= whose + shareholders[stonker] -= howmany + if (shareholders[stonker] <= 0) + shareholders -= stonker return 1 return 0