From 4d998af43a811758234d3b6983d8694c3f35178f Mon Sep 17 00:00:00 2001 From: c0 Date: Sun, 17 Apr 2016 04:40:06 +0300 Subject: [PATCH] Changes to Stocks UI, Cargo fixes --- .../LavaRuins/lavaland_surface_greed.dmm | 2 +- _maps/RandomZLevels/wildwest.dmm | 4 +- code/game/objects/items/documents.dm | 3 + .../awaymissions/mission_code/Academy.dm | 2 +- code/modules/cargo/exports/intel.dm | 6 + code/modules/cargo/packs.dm | 2 +- code/modules/mining/mint.dm | 4 +- code/modules/mining/money_bag.dm | 108 ++-------------- code/modules/shuttle/supply.dm | 4 +- code/modules/stock_market/computer.dm | 121 +++++++++++------- 10 files changed, 104 insertions(+), 152 deletions(-) diff --git a/_maps/RandomRuins/LavaRuins/lavaland_surface_greed.dmm b/_maps/RandomRuins/LavaRuins/lavaland_surface_greed.dmm index 0026df56155..542e27d84dc 100644 --- a/_maps/RandomRuins/LavaRuins/lavaland_surface_greed.dmm +++ b/_maps/RandomRuins/LavaRuins/lavaland_surface_greed.dmm @@ -12,7 +12,7 @@ "l" = (/obj/item/weapon/coin/gold,/turf/open/floor/engine/cult{baseturf = /turf/open/floor/plating/lava/smooth},/area/ruin/powered) "m" = (/turf/open/floor/engine/cult{baseturf = /turf/open/floor/plating/lava/smooth},/area/ruin/powered) "n" = (/obj/structure/table/wood/poker,/obj/item/stack/spacecash/c1000,/turf/open/floor/engine/cult{baseturf = /turf/open/floor/plating/lava/smooth},/area/ruin/powered) -"o" = (/obj/item/weapon/moneybag,/turf/open/floor/engine/cult{baseturf = /turf/open/floor/plating/lava/smooth},/area/ruin/powered) +"o" = (/obj/item/weapon/storage/bag/money,/turf/open/floor/engine/cult{baseturf = /turf/open/floor/plating/lava/smooth},/area/ruin/powered) "p" = (/obj/structure/table/wood/poker,/obj/item/weapon/ore/gold,/turf/open/floor/engine/cult{baseturf = /turf/open/floor/plating/lava/smooth},/area/ruin/powered) "q" = (/obj/structure/table/wood/poker,/obj/item/stack/spacecash/c20,/obj/item/stack/spacecash/c50,/turf/open/floor/engine/cult{baseturf = /turf/open/floor/plating/lava/smooth},/area/ruin/powered) "r" = (/obj/structure/table/wood/poker,/obj/item/stack/spacecash/c500,/obj/item/stack/spacecash/c100,/obj/item/stack/spacecash/c1000,/turf/open/floor/engine/cult{baseturf = /turf/open/floor/plating/lava/smooth},/area/ruin/powered) diff --git a/_maps/RandomZLevels/wildwest.dmm b/_maps/RandomZLevels/wildwest.dmm index 9490d78d6ac..80e50732d6f 100644 --- a/_maps/RandomZLevels/wildwest.dmm +++ b/_maps/RandomZLevels/wildwest.dmm @@ -113,7 +113,7 @@ "cl" = (/obj/structure/chair/stool,/turf/open/floor/wood,/area/awaymission/wwmines) "cm" = (/obj/structure/bookcase{icon_state = "book-5"},/turf/open/floor/wood,/area/awaymission/wwgov) "cn" = (/turf/open/floor/wood,/area/awaymission/wwgov) -"co" = (/obj/item/weapon/moneybag,/turf/open/floor/wood,/area/awaymission/wwgov) +"co" = (/obj/item/weapon/storage/bag/money,/turf/open/floor/wood,/area/awaymission/wwgov) "cp" = (/obj/structure/closet/secure_closet/freezer/kitchen,/turf/open/floor/plasteel{icon_state = "stage_bleft"},/area/awaymission/wwgov) "cq" = (/obj/structure/table/wood,/turf/open/floor/plasteel{icon_state = "stage_bleft"},/area/awaymission/wwgov) "cr" = (/obj/structure/table/wood,/obj/machinery/microwave,/turf/open/floor/plasteel{icon_state = "stage_bleft"},/area/awaymission/wwgov) @@ -122,7 +122,7 @@ "cu" = (/obj/structure/lattice,/obj/structure/lattice,/turf/open/space,/area/space) "cv" = (/obj/effect/decal/cleanable/blood/splatter,/turf/open/floor/carpet,/area/awaymission/wwmines) "cw" = (/turf/open/floor/carpet,/area/awaymission/wwgov) -"cx" = (/obj/item/weapon/moneybag,/turf/open/floor/carpet,/area/awaymission/wwgov) +"cx" = (/obj/item/weapon/storage/bag/money,/turf/open/floor/carpet,/area/awaymission/wwgov) "cy" = (/obj/structure/chair/wood/wings,/turf/open/floor/wood,/area/awaymission/wwgov) "cz" = (/turf/open/floor/plasteel{icon_state = "stage_bleft"},/area/awaymission/wwgov) "cA" = (/obj/effect/decal/cleanable/blood/splatter,/turf/open/floor/wood,/area/awaymission/wwmines) diff --git a/code/game/objects/items/documents.dm b/code/game/objects/items/documents.dm index e9b23a5f450..6746919dcff 100644 --- a/code/game/objects/items/documents.dm +++ b/code/game/objects/items/documents.dm @@ -37,6 +37,9 @@ ..() if(copy) copy_type = copy.type + if(istype(copy, /obj/item/documents/photocopy)) // Copy Of A Copy Of A Copy + var/obj/item/documents/photocopy/C = copy + copy_type = C.copy_type /obj/item/documents/photocopy/attackby(obj/item/O, mob/user, params) if(istype(O, /obj/item/toy/crayon/red) || istype(O, /obj/item/toy/crayon/blue)) diff --git a/code/modules/awaymissions/mission_code/Academy.dm b/code/modules/awaymissions/mission_code/Academy.dm index b098e08e510..5955709c1de 100644 --- a/code/modules/awaymissions/mission_code/Academy.dm +++ b/code/modules/awaymissions/mission_code/Academy.dm @@ -248,7 +248,7 @@ if(rand(0,1)) new /obj/item/stack/spacecash/c1000(T) else - var/obj/item/weapon/moneybag/M = new(T) + var/obj/item/weapon/storage/bag/money/M = new(T) for(var/i in 1 to rand(5,50)) new /obj/item/weapon/coin/gold(M) if(14) diff --git a/code/modules/cargo/exports/intel.dm b/code/modules/cargo/exports/intel.dm index 4989fb4e0cc..faba926cb60 100644 --- a/code/modules/cargo/exports/intel.dm +++ b/code/modules/cargo/exports/intel.dm @@ -7,6 +7,7 @@ message = "of enemy intelligence" var/global/originals_recieved = list() var/global/copies_recieved = list() + var/copy_path = null export_types = list(/obj/item/documents/syndicate) /datum/export/intel/applies_to(obj/O, contr = 0, emag = 0) @@ -23,6 +24,9 @@ return FALSE if((C.copy_type in originals_recieved) || (C.copy_type in copies_recieved)) return FALSE + if(copy_path && !ispath(C.copy_type, copy_path)) + return FALSE + else if(O.type in originals_recieved) return FALSE @@ -45,6 +49,7 @@ cost = 15000 // Allows double agents to earn some cargo points without failing their objectives. unit_name = "photocopied article" export_types = list(/obj/item/documents/photocopy) + copy_path = /obj/item/documents/syndicate @@ -58,6 +63,7 @@ cost = 15000 unit_name = "photocopied article" export_types = list(/obj/item/documents/photocopy) + copy_path = /obj/item/documents/nanotrasen // Selling Syndicate docs to Syndicate, why not? /datum/export/intel/syndie/recovered diff --git a/code/modules/cargo/packs.dm b/code/modules/cargo/packs.dm index 8fcbcff8bcc..be0eeeed081 100644 --- a/code/modules/cargo/packs.dm +++ b/code/modules/cargo/packs.dm @@ -3,7 +3,7 @@ var/group = "" var/hidden = FALSE var/contraband = FALSE - var/cost = 7 // Minimum cost, or infinite points are possible. + var/cost = 700 // Minimum cost, or infinite points are possible. var/access = FALSE var/list/contains = null var/crate_name = "crate" diff --git a/code/modules/mining/mint.dm b/code/modules/mining/mint.dm index a751094bf28..43e9954c1f1 100644 --- a/code/modules/mining/mint.dm +++ b/code/modules/mining/mint.dm @@ -212,8 +212,8 @@ var/turf/T = get_step(src,output_dir) if(T) var/obj/item/O = new P(src) - var/obj/item/weapon/moneybag/M = locate(/obj/item/weapon/moneybag, T) + var/obj/item/weapon/storage/bag/money/M = locate(/obj/item/weapon/storage/bag/money, T) if(!M) - M = new /obj/item/weapon/moneybag(src) + M = new /obj/item/weapon/storage/bag/money(src) unload_mineral(M) O.loc = M \ No newline at end of file diff --git a/code/modules/mining/money_bag.dm b/code/modules/mining/money_bag.dm index e1edd84927c..3f4449a8256 100644 --- a/code/modules/mining/money_bag.dm +++ b/code/modules/mining/money_bag.dm @@ -1,112 +1,20 @@ /*****************************Money bag********************************/ -/obj/item/weapon/moneybag - icon = 'icons/obj/storage.dmi' - name = "Money bag" +/obj/item/weapon/storage/bag/money + name = "money bag" icon_state = "moneybag" - flags = CONDUCT force = 10 throwforce = 0 - w_class = 4 burn_state = FLAMMABLE burntime = 20 - -/obj/item/weapon/moneybag/attack_hand(mob/user) - var/amt_gold = 0 - var/amt_silver = 0 - var/amt_diamond = 0 - var/amt_iron = 0 - var/amt_plasma = 0 - var/amt_uranium = 0 - var/amt_clown = 0 - var/amt_adamantine = 0 - - for (var/obj/item/weapon/coin/C in contents) - if (istype(C,/obj/item/weapon/coin/diamond)) - amt_diamond++; - if (istype(C,/obj/item/weapon/coin/plasma)) - amt_plasma++; - if (istype(C,/obj/item/weapon/coin/iron)) - amt_iron++; - if (istype(C,/obj/item/weapon/coin/silver)) - amt_silver++; - if (istype(C,/obj/item/weapon/coin/gold)) - amt_gold++; - if (istype(C,/obj/item/weapon/coin/uranium)) - amt_uranium++; - if (istype(C,/obj/item/weapon/coin/clown)) - amt_clown++; - if (istype(C,/obj/item/weapon/coin/adamantine)) - amt_adamantine++; - - var/dat = text("The contents of the moneybag reveal...
") - if (amt_gold) - dat += text("Gold coins: [amt_gold] Remove one
") - if (amt_silver) - dat += text("Silver coins: [amt_silver] Remove one
") - if (amt_iron) - dat += text("Metal coins: [amt_iron] Remove one
") - if (amt_diamond) - dat += text("Diamond coins: [amt_diamond] Remove one
") - if (amt_plasma) - dat += text("Plasma coins: [amt_plasma] Remove one
") - if (amt_uranium) - dat += text("Uranium coins: [amt_uranium] Remove one
") - if (amt_clown) - dat += text("Bananium coins: [amt_clown] Remove one
") - if (amt_adamantine) - dat += text("Adamantine coins: [amt_adamantine] Remove one
") - user << browse("[dat]", "window=moneybag") - -/obj/item/weapon/moneybag/attackby(obj/item/weapon/W, mob/user, params) - ..() - if (istype(W, /obj/item/weapon/coin)) - var/obj/item/weapon/coin/C = W - if(!user.drop_item()) - return - user << "You add the [C.name] into the bag." - contents += C - if (istype(W, /obj/item/weapon/moneybag)) - var/obj/item/weapon/moneybag/C = W - for (var/obj/O in C.contents) - contents += O; - user << "You empty the [C.name] into the bag." - return - -/obj/item/weapon/moneybag/Topic(href, href_list) - if(..()) - return - usr.set_machine(src) - src.add_fingerprint(usr) - if(href_list["remove"]) - var/obj/item/weapon/coin/COIN - switch(href_list["remove"]) - if("gold") - COIN = locate(/obj/item/weapon/coin/gold,src.contents) - if("silver") - COIN = locate(/obj/item/weapon/coin/silver,src.contents) - if("iron") - COIN = locate(/obj/item/weapon/coin/iron,src.contents) - if("diamond") - COIN = locate(/obj/item/weapon/coin/diamond,src.contents) - if("plasma") - COIN = locate(/obj/item/weapon/coin/plasma,src.contents) - if("uranium") - COIN = locate(/obj/item/weapon/coin/uranium,src.contents) - if("clown") - COIN = locate(/obj/item/weapon/coin/clown,src.contents) - if("adamantine") - COIN = locate(/obj/item/weapon/coin/adamantine,src.contents) - if(!COIN) - return - COIN.loc = src.loc - return + w_class = 4 + max_w_class = 3 + storage_slots = 80 + max_combined_w_class = 40 + can_hold = list(/obj/item/weapon/coin, /obj/item/stack/spacecash) - -/obj/item/weapon/moneybag/vault - -/obj/item/weapon/moneybag/vault/New() +/obj/item/weapon/storage/bag/money/vault/New() ..() new /obj/item/weapon/coin/silver(src) new /obj/item/weapon/coin/silver(src) diff --git a/code/modules/shuttle/supply.dm b/code/modules/shuttle/supply.dm index 306bf6aebc1..76bb9ec82ea 100644 --- a/code/modules/shuttle/supply.dm +++ b/code/modules/shuttle/supply.dm @@ -1,7 +1,7 @@ /obj/docking_port/mobile/supply name = "supply shuttle" id = "supply" - callTime = 10 + callTime = 1200 dir = 8 travelDir = 90 @@ -27,7 +27,7 @@ var/list/storage_objects = list( /obj/structure/closet, /obj/item/weapon/storage, - /obj/item/weapon/moneybag, + /obj/item/weapon/storage/bag/money, /obj/item/weapon/folder, // Selling a folder of stamped manifests? Sure, why not! /obj/structure/filingcabinet, /obj/structure/ore_box, diff --git a/code/modules/stock_market/computer.dm b/code/modules/stock_market/computer.dm index 90f0c54d51b..1fc2a0a10fa 100644 --- a/code/modules/stock_market/computer.dm +++ b/code/modules/stock_market/computer.dm @@ -5,7 +5,7 @@ icon_screen = "stock_computer" icon_keyboard = "no_keyboard" var/logged_in = "Cargo Department" - var/vmode = 0 + var/vmode = 1 /obj/machinery/computer/stockexchange/New() ..() @@ -22,35 +22,47 @@ user.machine = src var/css={""} - var/dat = "[station_name()] Stock Exchange[css]

Stock Exchange

" - dat += "This is a work in progress. Certain features may not be available.
" + var/dat = "[station_name()] Stock Exchange[css]" - dat += "Welcome, [logged_in]
Cargo Points: [balance()] points
" + dat += "Welcome, [logged_in]
Credits: [balance()]
" for (var/datum/stock/S in stockExchange.last_read) var/list/LR = stockExchange.last_read[S] if (!(logged_in in LR)) LR[logged_in] = 0 - dat += "View mode: [vmode ? "compact" : "full"]" - dat += "Stock Transaction Log: Check" + dat += "View mode: [vmode ? "Compact" : "Full"] " + dat += "Stock Transaction Log: Check
" + + dat += "This is a work in progress. Certain features may not be available." + dat += "

Listed stocks

" if (vmode == 0) @@ -105,15 +117,40 @@ a.updated { dat += "View news archives[news ? " (updated)" : null]" else if (vmode == 1) dat += "Actions: + Buy, - Sell, (A)rchives, (H)istory

" - dat += "" + dat += "
 NameValueOwned/AvailActions
" + dat += "" + for (var/datum/stock/S in stockExchange.stocks) var/mystocks = 0 if (logged_in && (logged_in in S.shareholders)) mystocks = S.shareholders[logged_in] - dat += "" + + if(S.bankrupt) + dat += "" + else + dat += "" + + if(S.disp_value_change > 0) + dat += "" + else if(S.disp_value_change < 0) + dat += "" + else + dat += "" + + dat += "" + dat += "" + + if(!S.bankrupt) + dat += "" + else + dat += "" + + if(mystocks) + dat += "" + else + dat += "" + + dat += "" var/news = 0 if (logged_in) var/list/LR = stockExchange.last_read[S] @@ -129,12 +166,17 @@ a.updated { break dat += "" + dat += "(A)(H)" + + dat += "" + + dat += "
 IDNameValueOwnedAvailActions
[S.disp_value_change > 0 ? "+" : (S.disp_value_change < 0 ? "-" : "=")][S.name] " - if (S.bankrupt) - dat += "B" - dat += " ([S.short_name])[S.current_value][mystocks]/[S.available_shares]
+-=[S.short_name][S.name][S.current_value]0[mystocks]0[S.available_shares]" if (S.bankrupt) - dat += "+ - " + dat += "+ - " else dat += "+ - " - dat += "(A) (H)
" + dat += "" - var/datum/browser/popup = new(user, "computer", "Stock Exchange", 600, 400) + var/datum/browser/popup = new(user, "computer", "Stock Exchange", 600, 600) popup.set_content(dat) popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state)) popup.open() @@ -153,27 +195,25 @@ a.updated { user << "This account does not own any shares of [S.name]!" return var/price = S.current_value - var/amt = round(input(user, "How many shares? (Have: [avail], unit price: [price])", "Sell shares in [S.name]", 0) as num|null) - if (!user) + var/amt = round(input(user, "How many shares? \n(Have: [avail], unit price: [price])", "Sell shares in [S.name]", 0) as num|null) + amt = min(amt, S.shareholders[logged_in]) + + if (!user || !(user in range(1, src))) return if (!amt) return - if (!(user in range(1, src))) - return if (li != logged_in) return b = SSshuttle.points if (!isnum(b)) user << "No active account on the console!" return - if (amt > S.shareholders[logged_in]) - user << "You do not own that many shares!" - return + var/total = amt * S.current_value if (!S.sellShares(logged_in, amt)) user << "Could not complete transaction." return - user << "Sold [amt] shares of [S.name] at [S.current_value] a share for [total] points." + user << "Sold [amt] shares of [S.name] at [S.current_value] a share for [total] credits." stockExchange.add_log(/datum/stock_log/sell, user.name, S.name, amt, S.current_value, total) /obj/machinery/computer/stockexchange/proc/buy_some_shares(var/datum/stock/S, var/mob/user) @@ -190,12 +230,8 @@ a.updated { var/avail = S.available_shares var/price = S.current_value var/canbuy = round(b / price) - var/amt = round(input(user, "How many shares? (Available: [avail], unit price: [price], can buy: [canbuy])", "Buy shares in [S.name]", 0) as num|null) - if (!user) - return - if (!amt) - return - if (!(user in range(1, src))) + var/amt = round(input(user, "How many shares? \n(Available: [avail], unit price: [price], can buy: [canbuy])", "Buy shares in [S.name]", 0) as num|null) + if (!user || !(user in range(1, src))) return if (li != logged_in) return @@ -203,17 +239,16 @@ a.updated { if (!isnum(b)) user << "No active account on the console!" return - if (amt > S.available_shares) - user << "That many shares are not available!" - return - var/total = amt * S.current_value - if (total > b) - user << "Insufficient points." + + amt = min(amt, S.available_shares, round(b / S.current_value)) + if (!amt) return if (!S.buyShares(logged_in, amt)) user << "<Could not complete transaction." return - user << "Bought [amt] shares of [S.name] at [S.current_value] a share for [total] points." + + var/total = amt * S.current_value + user << "Bought [amt] shares of [S.name] at [S.current_value] a share for [total] credits." stockExchange.add_log(/datum/stock_log/buy, user.name, S.name, amt, S.current_value, total) /obj/machinery/computer/stockexchange/proc/do_borrowing_deal(var/datum/borrow/B, var/mob/user) @@ -261,7 +296,7 @@ a.updated { dat += "[L.time] | [L.user_name] bought [L.stocks] stocks at [L.shareprice] a share for [L.money] total credits in [L.company_name].
" continue if(istype(L, /datum/stock_log/sell)) - dat += "[L.time] | [L.user_name] sold [L.stocks] stocks at [L.shareprice] a share for [L.money] totalcredits from [L.company_name].
" + dat += "[L.time] | [L.user_name] sold [L.stocks] stocks at [L.shareprice] a share for [L.money] total credits from [L.company_name].
" continue if(istype(L, /datum/stock_log/borrow)) dat += "[L.time] | [L.user_name] borrowed [L.stocks] stocks with a deposit of [L.money] credits in [L.company_name].
"