/obj/machinery/computer/stockexchange
name = "stock exchange computer"
icon = 'icons/obj/computer.dmi'
icon_state = "oldcomp"
icon_screen = "stock_computer"
icon_keyboard = "no_keyboard"
var/logged_in = "Cargo Department"
var/vmode = 1
clockwork = TRUE //it'd look weird
/obj/machinery/computer/stockexchange/New()
..()
logged_in = "[world.name] Cargo Department"
/obj/machinery/computer/stockexchange/proc/balance()
if (!logged_in)
return 0
return SSshuttle.points
/obj/machinery/computer/stockexchange/attack_hand(var/mob/user)
if(..())
return
user.machine = src
var/css={""}
var/dat = "
[S.name] ([S.short_name])[S.bankrupt ? "
BANKRUPT" : null]
"
if (S.last_unification)
dat += "
Unified shares [(world.time - S.last_unification) / 600] minutes ago.
"
dat += "
Current value per share: [S.current_value] |
View history"
dat += "You currently own
[mystocks] shares in this company. There are [S.available_shares] purchasable shares on the market currently.
"
if (S.bankrupt)
dat += "You cannot buy or sell shares in a bankrupt company!
"
else
dat += "
Buy shares |
Sell shares"
dat += "
Prominent products:"
for (var/prod in S.products)
dat += "
[prod]"
dat += "
Borrow options:"
if (S.borrow_brokers.len)
for (var/datum/borrow/B in S.borrow_brokers)
dat += "
[B.broker] offers
[B.share_amount] shares for borrowing, for a deposit of
[B.deposit * 100]% of the shares' value.
"
dat += "The broker expects the return of the shares after
[B.lease_time / 600] minutes, with a grace period of
[B.grace_time / 600] minute(s).
"
dat += "
This offer expires in [(B.offer_expires - world.time) / 600] minutes."
dat += "
Note: If you do not return all shares by the end of the grace period, you will lose your deposit and the value of all unreturned shares at current value from your account!
"
dat += "
Note: You cannot withdraw or transfer money off your account while a borrow is active.
"
dat += "
Take offer (Estimated deposit: [B.deposit * S.current_value * B.share_amount] credits)
"
else
dat += "
No borrow options available"
for (var/datum/borrow/B in S.borrows)
if (B.borrower == logged_in)
dat += "You are borrowing
[B.share_amount] shares from
[B.broker].
"
dat += "Your deposit riding on the deal is
[B.deposit] credits.
"
if (world.time < B.lease_expires)
dat += "You are expected to return the borrowed shares in [(B.lease_expires - world.time) / 600] minutes.
"
else
dat += "The brokering agency is collecting. You still owe them
[B.share_debt] shares, which you have [(B.grace_expires - world.time) / 600] minutes to present.
"
var/news = 0
if (logged_in)
var/list/LR = stockExchange.last_read[S]
var/lrt = LR[logged_in]
for (var/datum/article/A in S.articles)
if (A.ticks > lrt)
news = 1
break
if (!news)
for (var/datum/stockEvent/E in S.events)
if (E.last_change > lrt && !E.hidden)
news = 1
break
dat += "
View news archives[news ? "
(updated)" : null]
"
else if (vmode == 1)
dat += "