diff --git a/code/__DEFINES/text.dm b/code/__DEFINES/text.dm index aae3d1f17449..d0c7f93f0f31 100644 --- a/code/__DEFINES/text.dm +++ b/code/__DEFINES/text.dm @@ -1,69 +1,3 @@ -/// Does 4 spaces. Used as a makeshift tabulator. -#define FOURSPACES "    " - -/// Standard maptext -/// Prepares a text to be used for maptext. Use this so it doesn't look hideous. -#define MAPTEXT(text) {"[##text]"} - -/** - * Pixel-perfect scaled fonts for use in the MAP element as defined in skin.dmf - * - * Four sizes to choose from, use the sizes as mentioned below. - * Between the variations and a step there should be an option that fits your use case. - * BYOND uses pt sizing, different than px used in TGUI. Using px will make it look blurry due to poor antialiasing. - * - * Default sizes are prefilled in the macro for ease of use and a consistent visual look. - * To use a step other than the default in the macro, specify it in a span style. - * For example: MAPTEXT_PIXELLARI("Some large maptext here") - */ -/// Large size (ie: context tooltips) - Size options: 12pt 24pt. -#define MAPTEXT_PIXELLARI(text) {"[##text]"} - -/// Standard size (ie: normal runechat) - Size options: 6pt 12pt 18pt. -#define MAPTEXT_GRAND9K(text) {"[##text]"} - -/// Small size. (ie: context subtooltips, spell delays) - Size options: 12pt 24pt. -#define MAPTEXT_TINY_UNICODE(text) {"[##text]"} - -/// Smallest size. (ie: whisper runechat) - Size options: 6pt 12pt 18pt. -#define MAPTEXT_SPESSFONT(text) {"[##text]"} - -/** - * Prepares a text to be used for maptext, using a variable size font. - * - * More flexible but doesn't scale pixel perfect to BYOND icon resolutions. - * (May be blurry.) Can use any size in pt or px. - * - * You MUST Specify the size when using the macro - * For example: MAPTEXT_VCR_OSD_MONO("Some large maptext here") - */ -/// Prepares a text to be used for maptext, using a variable size font. -/// Variable size font. More flexible but doesn't scale pixel perfect to BYOND icon resolutions. (May be blurry.) Can use any size in pt or px. -#define MAPTEXT_VCR_OSD_MONO(text) {"[##text]"} - -/// Macro from Lummox used to get height from a MeasureText proc. -/// resolves the MeasureText() return value once, then resolves the height, then sets return_var to that. -#define WXH_TO_HEIGHT(measurement, return_var) \ - do { \ - var/_measurement = measurement; \ - return_var = text2num(copytext(_measurement, findtextEx(_measurement, "x") + 1)); \ - } while(FALSE); - -/// Removes characters incompatible with file names. -#define SANITIZE_FILENAME(text) (GLOB.filename_forbidden_chars.Replace(text, "")) - -/// Simply removes the < and > characters, and limits the length of the message. -#define STRIP_HTML_SIMPLE(text, limit) (GLOB.angular_brackets.Replace(copytext(text, 1, limit), "")) - -/// Removes everything enclose in < and > inclusive of the bracket, and limits the length of the message. -#define STRIP_HTML_FULL(text, limit) (GLOB.html_tags.Replace(copytext(text, 1, limit), "")) - -/** - * stuff like `copytext(input, length(input))` will trim the last character of the input, - * because DM does it so it copies until the char BEFORE the `end` arg, so we need to bump `end` by 1 in these cases. - */ -#define PREVENT_CHARACTER_TRIM_LOSS(integer) (integer + 1) - /// BYOND's string procs don't support being used on datum references (as in it doesn't look for a name for stringification) /// We just use this macro to ensure that we will only pass strings to this BYOND-level function without developers needing to really worry about it. #define LOWER_TEXT(thing) lowertext(UNLINT("[thing]")) @@ -73,4 +7,4 @@ #define ALPHABET list("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z") #define VOWELS list("a", "e", "i", "o", "u") -#define CONSONANTS (ALPHABET - VOWELS) +#define CONSONANTS list("b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "y", "z") diff --git a/code/__DEFINES/~lobotomy_defines/lore_and_theme.dm b/code/__DEFINES/~lobotomy_defines/lore_and_theme.dm deleted file mode 100644 index 7a0f13414b6b..000000000000 --- a/code/__DEFINES/~lobotomy_defines/lore_and_theme.dm +++ /dev/null @@ -1,4 +0,0 @@ -/* -* I needed a place to put this list of districts. -*/ -#define LC_DISTRICT_LIST list("District 4", "District 5", "District 6", "District 7", "District 8", "District 9", "District 10", "District 11", "District 12", "District 13", "District 14", "District 15", "District 16", "District 17", "District 18", "District 19", "District 20", "District 21", "District 22", "District 23", "District 24") diff --git a/code/controllers/subsystem/economy.dm b/code/controllers/subsystem/economy.dm index 804dd170a264..db27b667a187 100644 --- a/code/controllers/subsystem/economy.dm +++ b/code/controllers/subsystem/economy.dm @@ -40,11 +40,21 @@ SUBSYSTEM_DEF(economy) ///The modifier multiplied to the value of cargo pack prices. var/pack_price_modifier = 1 var/market_crashing = FALSE + //STOCK MARKET VARS + var/list/stocks = list() + var/list/balances = list() + var/list/last_read = list() + var/list/stock_brokers = list() + var/list/logs + var/list/frozen_accounts = list() + /datum/controller/subsystem/economy/Initialize(timeofday) var/budget_to_hand_out = round(budget_pool / department_accounts.len) for(var/A in department_accounts) new /datum/bank_account/department(A, budget_to_hand_out) + generateBrokers() + generateStocks() return ..() /datum/controller/subsystem/economy/Recover() @@ -66,6 +76,9 @@ SUBSYSTEM_DEF(economy) station_target = max(round(temporary_total / max(bank_accounts_by_id.len * 2, 1)) + station_target_buffer, 1) // if(!market_crashing) // price_update() Fucks up Workshop, I'll figure out how to make it override soon:tm: - Kirie + for(var/stock in stocks) + var/datum/stock/S = stock + S.process() /** * Handy proc for obtaining a department's bank account, given the department ID, AKA the define assigned for what department they're under. @@ -113,3 +126,114 @@ SUBSYSTEM_DEF(economy) return 1 inflation_value = max(round(((station_total / bank_accounts_by_id.len) / station_target), 0.1), 1.0) return inflation_value + +//STOCK MARKET PROCS +/datum/controller/subsystem/economy/proc/list_frozen() + for(var/A in frozen_accounts) + to_chat(usr, "[A]: [length(frozen_accounts[A])] borrows") + +/datum/controller/subsystem/economy/proc/balanceLog(whose, net) + if (!(whose in balances)) + balances[whose] = net + else + balances[whose] += net + +/datum/controller/subsystem/economy/proc/generateBrokers() + stock_brokers = list() + var/list/fnames = list("Goldman", "Edward", "James", "Luis", "Alexander", "Walter", "Eugene", "Mary", "Morgan", "Jane", "Elizabeth", "Xavier", "Hayden", "Samuel", "Lee") + var/list/names = list("Johnson", "Rothschild", "Sachs", "Stanley", "Hepburn", "Brown", "McColl", "Fischer", "Edwards", "Becker", "Witter", "Walker", "Lambert", "Smith", "Montgomery", "Lynch", "Roosevelt", "Lehman") + var/list/locations = LC_DISTRICT_LIST + var/list/first = list("The", "First", "Premier", "Finest", "Prime") + var/list/company = list("Investments", "Securities", "Corporation", "Bank", "Brokerage", "& Co.", "Brothers", "& Sons", "Investement Firm", "Union", "Partners", "Capital", "Trade", "Holdings") + for(var/i in 1 to 5) + var/pname = "" + switch (rand(1,5)) + if (1) + pname = "[prob(10) ? pick(first) + " " : null][pick(names)] [pick(company)]" + if (2) + pname = "[pick(names)] & [pick(names)][prob(25) ? " " + pick(company) : null]" + if (3) + pname = "[prob(45) ? pick(first) + " " : null][pick(locations)] [pick(company)]" + if (4) + pname = "[prob(10) ? "The " : null][pick(names)] [pick(locations)] [pick(company)]" + if (5) + pname = "[prob(10) ? "The " : null][pick(fnames)] [pick(names)][prob(10) ? " " + pick(company) : null]" + if (pname in stock_brokers) + i-- + continue + stock_brokers += pname + +/datum/controller/subsystem/economy/proc/generateDesignation(name) + if (length(name) <= 4) + return uppertext(name) + var/list/w = splittext(name, " ") + if (w.len >= 2) + var/d = "" + for(var/i in 1 to min(5, w.len)) + d += uppertext(ascii2text(text2ascii(w[i], 1))) + return d + else + var/d = uppertext(ascii2text(text2ascii(name, 1))) + for(var/i in 2 to length(name)) + if (prob(100 / i)) + d += uppertext(ascii2text(text2ascii(name, i))) + return d + +/datum/controller/subsystem/economy/proc/generateStocks(amt = 15) + var/list/fruits = list("Banana", "Mimana", "Watermelon", "Ambrosia", "Pomegranate", "Reishi", "Papaya", "Mango", "Tomato", "Conkerberry", "Wood", "Lychee", "Mandarin", "Harebell", "Pumpkin", "Rhubarb", "Tamarillo", "Yantok", "Ziziphus", "Oranges", "Gatfruit", "Daisy", "Kudzu") + var/list/tech_prefix = list("Nano", "Cyber", "Funk", "Astro", "Fusion", "Tera", "Exo", "Star", "Virtual", "Plasma", "Robust", "Bit", "Future", "Hugbox", "Carbon", "Nerf", "Buff", "Nova", "Space", "Meta", "Cyber") + var/list/tech_short = list("soft", "tech", "prog", "tec", "tek", "ware", "", "gadgets", "nics", "tric", "trasen", "tronic", "coin") + var/list/random_nouns = list("Johnson", "Cluwne", "General", "Specific", "Master", "King", "Queen", "Table", "Rupture", "Dynamic", "Massive", "Mega", "Giga", "Certain", "Singulo", "State", "National", "International", "Interplanetary", "Sector", "Planet", "Burn", "Robust", "Exotic", "Solar", "Lunar", "Chelp", "Corgi", "Lag", "Lizard") + var/list/company = list("Company", "Factory", "Incorporated", "Industries", "Group", "Consolidated", "GmbH", "LLC", "Ltd", "Inc.", "Association", "Limited", "Software", "Technology", "Programming", "IT Group", "Electronics", "Nanotechnology", "Farms", "Stores", "Mobile", "Motors", "Electric", "Designs", "Energy", "Pharmaceuticals", "Communications", "Wholesale", "Holding", "Health", "Machines", "Astrotech", "Gadgets", "Kinetics") + for (var/i = 1, i <= amt, i++) + var/datum/stock/S = new + var/sname = "" + switch (rand(1,6)) + if(1) + if(sname == "" || sname == "FAG") // honestly it's a 0.6% chance per round this happens - or once in 166 rounds - so i'm accounting for it before someone yells at me + sname = "[CONSONANTS][VOWELS][CONSONANTS]" + if (2) + sname = "[pick(tech_prefix)][pick(tech_short)][prob(20) ? " " + pick(company) : null]" + if (3 to 4) + var/fruit = pick(fruits) + fruits -= fruit + sname = "[prob(10) ? "The " : null][fruit][prob(40) ? " " + pick(company): null]" + if (5 to 6) + var/pname = pick(random_nouns) + random_nouns -= pname + switch (rand(1,3)) + if (1) + sname = "[pname] & [pname]" + if (2) + sname = "[pname] [pick(company)]" + if (3) + sname = "[pname]" + S.name = sname + S.short_name = generateDesignation(S.name) + S.current_value = rand(10, 125) + var/dv = rand(10, 40) / 10 + S.fluctuational_coefficient = prob(50) ? (1 / dv) : dv + S.average_optimism = rand(-10, 10) / 100 + S.optimism = S.average_optimism + (rand(-40, 40) / 100) + S.current_trend = rand(-200, 200) / 10 + S.last_trend = S.current_trend + S.disp_value_change = rand(-1, 1) + S.speculation = rand(-20, 20) + S.average_shares = round(rand(500, 10000) / 10) + S.outside_shareholders = rand(1000, 30000) + S.available_shares = rand(200000, 800000) + S.fluctuation_rate = rand(6, 20) + S.generateIndustry() + S.generateEvents() + stocks += S + last_read[S] = list() + +/datum/controller/subsystem/economy/proc/add_log(log_type, user, company_name, stocks, shareprice, money) + var/datum/stock_log/L = new log_type + L.user_name = user + L.company_name = company_name + L.stocks = stocks + L.shareprice = shareprice + L.money = money + L.time = time2text(world.timeofday, "hh:mm") + logs += L diff --git a/code/controllers/subsystem/shuttle.dm b/code/controllers/subsystem/shuttle.dm index 6813fbae42f4..88f9c4e2391a 100644 --- a/code/controllers/subsystem/shuttle.dm +++ b/code/controllers/subsystem/shuttle.dm @@ -40,7 +40,7 @@ SUBSYSTEM_DEF(shuttle) //supply shuttle stuff var/obj/docking_port/mobile/supply/supply var/ordernum = 1 //order number given to next order - var/points = 5000 //number of trade-points we have + var/points = 500 //number of trade-points we have var/centcom_message = "" //Remarks from CentCom on how well you checked the last order. var/list/discoveredPlants = list() //Typepaths for unusual plants we've already sent CentCom, associated with their potencies diff --git a/code/modules/stock_market/articles.dm b/code/modules/stock_market/articles.dm index 1f3fa1c1067d..f02c6839bca2 100644 --- a/code/modules/stock_market/articles.dm +++ b/code/modules/stock_market/articles.dm @@ -1,3 +1,7 @@ +/* +* This is the code that generates the articles +* that tell you that your stock has plummeted. +*/ /proc/ucfirst(S) return "[uppertext(ascii2text(text2ascii(S, 1)))][copytext(S, 2)]" @@ -8,11 +12,49 @@ M += ucfirst(P) return jointext(M, " ") -GLOBAL_LIST_EMPTY(FrozenAccounts) +/proc/plotBarGraph(list/points, base_text, width=400, height=400) + var/output = "" + if (points.len && height > 20 && width > 20) + var/min = points[1] + var/max = points[1] + for (var/v in points) + if (v < min) + min = v + if (v > max) + max = v + var/cells = (height - 20) / 20 + if (cells > round(cells)) + cells = round(cells) + 1 + var/diff = max - min + var/ost = diff / cells + if (min > 0) + min = max(min - ost, 0) + diff = max - min + ost = diff / cells + var/cval = max + var/cwid = width / (points.len + 1) + for (var/y = cells, y > 0, y--) + if (y == cells) + output += "" + else + output += "" + for (var/x = 0, x <= points.len, x++) + if (x == 0) + output += "" + else + var/v = points[x] + if (v >= cval) + output += "" + else + output += "" + output += "" + cval -= ost + output += "" + else + output += "" + output += "" -/proc/list_frozen() - for(var/A in GLOB.FrozenAccounts) - to_chat(usr, "[A]: [length(GLOB.FrozenAccounts[A])] borrows") + return "[output]
[round(cval - ost)]  
[base_text]
[base_text]
" /datum/article var/headline = "Something big is happening" @@ -56,7 +98,7 @@ GLOBAL_LIST_EMPTY(FrozenAccounts) /datum/article/New() ..() - if ((outlets.len && !prob(100 / (outlets.len + 1))) || !outlets.len) + if((outlets.len && !prob(100 / (outlets.len + 1))) || !outlets.len) var/ON = generateOutletName() if (!(ON in outlets)) outlets[ON] = list() @@ -65,7 +107,7 @@ GLOBAL_LIST_EMPTY(FrozenAccounts) outlet = pick(outlets) var/list/authors = outlets[outlet] - if ((authors.len && !prob(100 / (authors.len + 1))) || !authors.len) + if((authors.len && !prob(100 / (authors.len + 1))) || !authors.len) var/AN = generateAuthorName() outlets[outlet] += AN author = AN @@ -98,7 +140,7 @@ GLOBAL_LIST_EMPTY(FrozenAccounts) var/ticksc = round(ticks/100) ticksc = ticksc % 100000 var/ticksp = "[ticksc]" - for(var/cycle = 1 to 5) + for(var/cycle = 0 to 4) ticksp = "0[ticksp]" spacetime = "[ticksp][time2text(world.realtime, "MM")][time2text(world.realtime, "DD")][text2num(time2text(world.realtime, "YYYY"))+540]" diff --git a/code/modules/stock_market/computer.dm b/code/modules/stock_market/computer.dm index 54beb1b832c1..db332820bc9c 100644 --- a/code/modules/stock_market/computer.dm +++ b/code/modules/stock_market/computer.dm @@ -1,3 +1,5 @@ +// The computer you sell stocks at. Mostly UI code. + /obj/machinery/computer/stockexchange name = "stock exchange computer" desc = "A console that connects to the cities stock market." @@ -55,19 +57,17 @@ a.updated { var/dat = "[station_name()] Stock Exchange[css]" dat += "Welcome, [station_name()] Cargo Department
Ahn: [balance()]
" - for (var/datum/stock/S in GLOB.stockExchange.last_read) - var/list/LR = GLOB.stockExchange.last_read[S] + for (var/datum/stock/S in SSeconomy.last_read) + var/list/LR = SSeconomy.last_read[S] if (!(logged_in in LR)) LR[logged_in] = 0 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) - for (var/datum/stock/S in GLOB.stockExchange.stocks) + for (var/datum/stock/S in SSeconomy.stocks) var/mystocks = 0 if (logged_in && (logged_in in S.shareholders)) mystocks = S.shareholders[logged_in] @@ -85,7 +85,7 @@ a.updated { dat += "[prod]
" var/news = 0 if (logged_in) - var/list/LR = GLOB.stockExchange.last_read[S] + var/list/LR = SSeconomy.last_read[S] var/lrt = LR[logged_in] for (var/datum/article/A in S.articles) if (A.ticks > lrt) @@ -102,7 +102,7 @@ a.updated { dat += "" dat += "" - for (var/datum/stock/S in GLOB.stockExchange.stocks) + for (var/datum/stock/S in SSeconomy.stocks) var/mystocks = 0 if (logged_in && (logged_in in S.shareholders)) mystocks = S.shareholders[logged_in] @@ -135,7 +135,7 @@ a.updated { dat += "" var/news = 0 if (logged_in) - var/list/LR = GLOB.stockExchange.last_read[S] + var/list/LR = SSeconomy.last_read[S] var/lrt = LR[logged_in] for (var/datum/article/A in S.articles) if (A.ticks > lrt) @@ -194,7 +194,7 @@ a.updated { to_chat(user, "Could not complete transaction.") return to_chat(user, "Sold [amt] shares of [S.name] at [S.current_value] a share for [total] ahn.") - GLOB.stockExchange.add_log(/datum/stock_log/sell, user.name, S.name, amt, S.current_value, total) + SSeconomy.add_log(/datum/stock_log/sell, user.name, S.name, amt, S.current_value, total) /obj/machinery/computer/stockexchange/proc/buy_some_shares(datum/stock/S, mob/user) if (!user || !S) @@ -229,12 +229,12 @@ a.updated { var/total = amt * S.current_value to_chat(user, "Bought [amt] shares of [S.name] at [S.current_value] a share for [total] ahn.") - GLOB.stockExchange.add_log(/datum/stock_log/buy, user.name, S.name, amt, S.current_value, total) + SSeconomy.add_log(/datum/stock_log/buy, user.name, S.name, amt, S.current_value, total) /obj/machinery/computer/stockexchange/proc/do_borrowing_deal(datum/borrow/B, mob/user) if (B.stock.borrow(B, logged_in)) to_chat(user, "You successfully borrowed [B.share_amount] shares. Deposit: [B.deposit].") - GLOB.stockExchange.add_log(/datum/stock_log/borrow, user.name, B.stock.name, B.share_amount, B.deposit) + SSeconomy.add_log(/datum/stock_log/borrow, user.name, B.stock.name, B.share_amount, B.deposit) else to_chat(user, "Could not complete transaction. Check your account balance.") @@ -246,7 +246,7 @@ a.updated { usr.machine = src if (href_list["viewhistory"]) - var/datum/stock/S = locate(href_list["viewhistory"]) in GLOB.stockExchange.stocks + var/datum/stock/S = locate(href_list["viewhistory"]) in SSeconomy.stocks if (S) S.displayValues(usr) @@ -254,18 +254,18 @@ a.updated { logged_in = null if (href_list["buyshares"]) - var/datum/stock/S = locate(href_list["buyshares"]) in GLOB.stockExchange.stocks + var/datum/stock/S = locate(href_list["buyshares"]) in SSeconomy.stocks if (S) buy_some_shares(S, usr) if (href_list["sellshares"]) - var/datum/stock/S = locate(href_list["sellshares"]) in GLOB.stockExchange.stocks + var/datum/stock/S = locate(href_list["sellshares"]) in SSeconomy.stocks if (S) sell_some_shares(S, usr) if (href_list["show_logs"]) var/dat = "Stock Transaction Logs

Stock Transaction Logs

Refresh

" - for(var/D in GLOB.stockExchange.logs) + for(var/D in SSeconomy.logs) var/datum/stock_log/L = D if(istype(L, /datum/stock_log/buy)) dat += "[L.time] | [L.user_name] bought [L.stocks] stocks at [L.shareprice] a share for [L.money] total ahn in [L.company_name].
" @@ -283,7 +283,7 @@ a.updated { if (href_list["archive"]) var/datum/stock/S = locate(href_list["archive"]) if (logged_in && logged_in != "") - var/list/LR = GLOB.stockExchange.last_read[S] + var/list/LR = SSeconomy.last_read[S] LR[logged_in] = world.time var/dat = "News feed for [S.name]

News feed for [S.name]

Refresh
" dat += "

Events

" diff --git a/code/modules/stock_market/events.dm b/code/modules/stock_market/events.dm index 0a1af3fa54d2..1f635d90180a 100644 --- a/code/modules/stock_market/events.dm +++ b/code/modules/stock_market/events.dm @@ -102,11 +102,11 @@ company.bankrupt = 1 for (var/X in company.shareholders) var/amt = company.shareholders[X] - GLOB.stockExchange.balanceLog(X, -amt * company.current_value) + SSeconomy.balanceLog(X, -amt * company.current_value) company.shareholders = list() company.current_value = 0 company.borrow_brokers = list() - GLOB.stockExchange.generateStocks(1) + SSeconomy.generateStocks(1) var/bailout = (effect > 0 && prob(80)) || (effect < 0 && prob(20)) current_title = "[company.name] [bailout ? "bailed out" : "on a painful rebound"]" diff --git a/code/modules/stock_market/industries.dm b/code/modules/stock_market/industries.dm index 80d83700ddfa..c77409b8fa93 100644 --- a/code/modules/stock_market/industries.dm +++ b/code/modules/stock_market/industries.dm @@ -1,3 +1,11 @@ +/* +* This inconsequential code is for generating products to invest in. +* Each time a company tries to improve its stock value with a product +* the product is themed based on the companies industry. +* /datum/industry/agriculture will be farming themed while +* /datum/industry/health will be drug themed. +*/ + /datum/industry var/name = "Industry" var/list/tokens = list() diff --git a/code/modules/stock_market/logs.dm b/code/modules/stock_market/logs.dm index c17550427274..a089602bd2aa 100644 --- a/code/modules/stock_market/logs.dm +++ b/code/modules/stock_market/logs.dm @@ -1,3 +1,7 @@ +/* +* Code made specifically for record +* keeping purposes. +*/ /datum/stock_log var/user_name = "" var/company_name = "" diff --git a/code/modules/stock_market/stockmarket.dm b/code/modules/stock_market/stockmarket.dm deleted file mode 100644 index 3752b8161edd..000000000000 --- a/code/modules/stock_market/stockmarket.dm +++ /dev/null @@ -1,171 +0,0 @@ - - -/datum/stockMarket - var/list/stocks = list() - var/list/balances = list() - var/list/last_read = list() - var/list/stockBrokers = list() - var/list/logs = list() - -/datum/stockMarket/New() - ..() - generateBrokers() - generateStocks() - START_PROCESSING(SSobj, src) - -/datum/stockMarket/proc/balanceLog(whose, net) - if (!(whose in balances)) - balances[whose] = net - else - balances[whose] += net -/datum/stockMarket/proc/generateBrokers() - stockBrokers = list() - var/list/fnames = list("Goldman", "Edward", "James", "Luis", "Alexander", "Walter", "Eugene", "Mary", "Morgan", "Jane", "Elizabeth", "Xavier", "Hayden", "Samuel", "Lee") - var/list/names = list("Johnson", "Rothschild", "Sachs", "Stanley", "Hepburn", "Brown", "McColl", "Fischer", "Edwards", "Becker", "Witter", "Walker", "Lambert", "Smith", "Montgomery", "Lynch", "Roosevelt", "Lehman") - var/list/locations = LC_DISTRICT_LIST - var/list/first = list("The", "First", "Premier", "Finest", "Prime") - var/list/company = list("Investments", "Securities", "Corporation", "Bank", "Brokerage", "& Co.", "Brothers", "& Sons", "Investement Firm", "Union", "Partners", "Capital", "Trade", "Holdings") - for(var/i in 1 to 5) - var/pname = "" - switch (rand(1,5)) - if (1) - pname = "[prob(10) ? pick(first) + " " : null][pick(names)] [pick(company)]" - if (2) - pname = "[pick(names)] & [pick(names)][prob(25) ? " " + pick(company) : null]" - if (3) - pname = "[prob(45) ? pick(first) + " " : null][pick(locations)] [pick(company)]" - if (4) - pname = "[prob(10) ? "The " : null][pick(names)] [pick(locations)] [pick(company)]" - if (5) - pname = "[prob(10) ? "The " : null][pick(fnames)] [pick(names)][prob(10) ? " " + pick(company) : null]" - if (pname in stockBrokers) - i-- - continue - stockBrokers += pname - -/datum/stockMarket/proc/generateDesignation(name) - if (length(name) <= 4) - return uppertext(name) - var/list/w = splittext(name, " ") - if (w.len >= 2) - var/d = "" - for(var/i in 1 to min(5, w.len)) - d += uppertext(ascii2text(text2ascii(w[i], 1))) - return d - else - var/d = uppertext(ascii2text(text2ascii(name, 1))) - for(var/i in 2 to length(name)) - if (prob(100 / i)) - d += uppertext(ascii2text(text2ascii(name, i))) - return d - -/datum/stockMarket/proc/generateStocks(amt = 15) - var/list/fruits = list("Banana", "Mimana", "Watermelon", "Ambrosia", "Pomegranate", "Reishi", "Papaya", "Mango", "Tomato", "Conkerberry", "Wood", "Lychee", "Mandarin", "Harebell", "Pumpkin", "Rhubarb", "Tamarillo", "Yantok", "Ziziphus", "Oranges", "Gatfruit", "Daisy", "Kudzu") - var/list/tech_prefix = list("Nano", "Cyber", "Funk", "Astro", "Fusion", "Tera", "Exo", "Star", "Virtual", "Plasma", "Robust", "Bit", "Future", "Hugbox", "Carbon", "Nerf", "Buff", "Nova", "Space", "Meta", "Cyber") - var/list/tech_short = list("soft", "tech", "prog", "tec", "tek", "ware", "", "gadgets", "nics", "tric", "trasen", "tronic", "coin") - var/list/random_nouns = list("Johnson", "Cluwne", "General", "Specific", "Master", "King", "Queen", "Table", "Rupture", "Dynamic", "Massive", "Mega", "Giga", "Certain", "Singulo", "State", "National", "International", "Interplanetary", "Sector", "Planet", "Burn", "Robust", "Exotic", "Solar", "Lunar", "Chelp", "Corgi", "Lag", "Lizard") - var/list/company = list("Company", "Factory", "Incorporated", "Industries", "Group", "Consolidated", "GmbH", "LLC", "Ltd", "Inc.", "Association", "Limited", "Software", "Technology", "Programming", "IT Group", "Electronics", "Nanotechnology", "Farms", "Stores", "Mobile", "Motors", "Electric", "Designs", "Energy", "Pharmaceuticals", "Communications", "Wholesale", "Holding", "Health", "Machines", "Astrotech", "Gadgets", "Kinetics") - for (var/i = 1, i <= amt, i++) - var/datum/stock/S = new - var/sname = "" - switch (rand(1,6)) - if(1) - if(sname == "" || sname == "FAG") // honestly it's a 0.6% chance per round this happens - or once in 166 rounds - so i'm accounting for it before someone yells at me - sname = "[CONSONANTS][VOWELS][CONSONANTS]" - if (2) - sname = "[pick(tech_prefix)][pick(tech_short)][prob(20) ? " " + pick(company) : null]" - if (3 to 4) - var/fruit = pick(fruits) - fruits -= fruit - sname = "[prob(10) ? "The " : null][fruit][prob(40) ? " " + pick(company): null]" - if (5 to 6) - var/pname = pick(random_nouns) - random_nouns -= pname - switch (rand(1,3)) - if (1) - sname = "[pname] & [pname]" - if (2) - sname = "[pname] [pick(company)]" - if (3) - sname = "[pname]" - S.name = sname - S.short_name = generateDesignation(S.name) - S.current_value = rand(10, 125) - var/dv = rand(10, 40) / 10 - S.fluctuational_coefficient = prob(50) ? (1 / dv) : dv - S.average_optimism = rand(-10, 10) / 100 - S.optimism = S.average_optimism + (rand(-40, 40) / 100) - S.current_trend = rand(-200, 200) / 10 - S.last_trend = S.current_trend - S.disp_value_change = rand(-1, 1) - S.speculation = rand(-20, 20) - S.average_shares = round(rand(500, 10000) / 10) - S.outside_shareholders = rand(1000, 30000) - S.available_shares = rand(200000, 800000) - S.fluctuation_rate = rand(6, 20) - S.generateIndustry() - S.generateEvents() - stocks += S - last_read[S] = list() - -/datum/stockMarket/process() - for (var/stock in stocks) - var/datum/stock/S = stock - S.process() - -/datum/stockMarket/proc/add_log(log_type, user, company_name, stocks, shareprice, money) - var/datum/stock_log/L = new log_type - L.user_name = user - L.company_name = company_name - L.stocks = stocks - L.shareprice = shareprice - L.money = money - L.time = time2text(world.timeofday, "hh:mm") - logs += L - -GLOBAL_DATUM_INIT(stockExchange, /datum/stockMarket, new) - -/proc/plotBarGraph(list/points, base_text, width=400, height=400) - var/output = "
 IDNameValueOwnedAvailActions
[S.available_shares]
" - if (points.len && height > 20 && width > 20) - var/min = points[1] - var/max = points[1] - for (var/v in points) - if (v < min) - min = v - if (v > max) - max = v - var/cells = (height - 20) / 20 - if (cells > round(cells)) - cells = round(cells) + 1 - var/diff = max - min - var/ost = diff / cells - if (min > 0) - min = max(min - ost, 0) - diff = max - min - ost = diff / cells - var/cval = max - var/cwid = width / (points.len + 1) - for (var/y = cells, y > 0, y--) - if (y == cells) - output += "" - else - output += "" - for (var/x = 0, x <= points.len, x++) - if (x == 0) - output += "" - else - var/v = points[x] - if (v >= cval) - output += "" - else - output += "" - output += "" - cval -= ost - output += "" - else - output += "" - output += "" - - return "[output]
[round(cval - ost)]  
[base_text]
[base_text]
" - diff --git a/code/modules/stock_market/stocks.dm b/code/modules/stock_market/stocks.dm index 9f0728e9e3fb..81ab3614a49d 100644 --- a/code/modules/stock_market/stocks.dm +++ b/code/modules/stock_market/stocks.dm @@ -186,10 +186,10 @@ if (world.time > borrow.grace_expires) modifyAccount(borrow.borrower, -max(current_value * borrow.share_debt, 0), 1) borrows -= borrow - if (borrow.borrower in GLOB.FrozenAccounts) - GLOB.FrozenAccounts[borrow.borrower] -= borrow - if (length(GLOB.FrozenAccounts[borrow.borrower]) == 0) - GLOB.FrozenAccounts -= borrow.borrower + if (borrow.borrower in SSeconomy.frozen_accounts) + SSeconomy.frozen_accounts[borrow.borrower] -= borrow + if (length(SSeconomy.frozen_accounts[borrow.borrower]) == 0) + SSeconomy.frozen_accounts -= borrow.borrower qdel(borrow) else if (world.time > borrow.lease_expires) if (borrow.borrower in shareholders) @@ -197,10 +197,10 @@ if (amt > borrow.share_debt) shareholders[borrow.borrower] -= borrow.share_debt borrows -= borrow - if (borrow.borrower in GLOB.FrozenAccounts) - GLOB.FrozenAccounts[borrow.borrower] -= borrow - if (length(GLOB.FrozenAccounts[borrow.borrower]) == 0) - GLOB.FrozenAccounts -= borrow.borrower + if (borrow.borrower in SSeconomy.frozen_accounts) + SSeconomy.frozen_accounts[borrow.borrower] -= borrow + if (length(SSeconomy.frozen_accounts[borrow.borrower]) == 0) + SSeconomy.frozen_accounts -= borrow.borrower qdel(borrow) else shareholders -= borrow.borrower @@ -225,9 +225,9 @@ /datum/stock/proc/generateBrokers() if (borrow_brokers.len > 2) return - if (!GLOB.stockExchange.stockBrokers.len) - GLOB.stockExchange.generateBrokers() - var/broker = pick(GLOB.stockExchange.stockBrokers) + if (!SSeconomy.stock_brokers.len) + SSeconomy.generateBrokers() + var/broker = pick(SSeconomy.stock_brokers) var/datum/borrow/B = new B.broker = broker B.stock = src @@ -244,7 +244,7 @@ if (by < 0 && SSshuttle.points + by < 0 && !force) return 0 SSshuttle.points += by - GLOB.stockExchange.balanceLog(whose, by) + SSeconomy.balanceLog(whose, by) return 1 return 0 @@ -267,10 +267,10 @@ borrows += B B.borrower = who B.grace_expires = B.lease_expires + B.grace_time - if (!(who in GLOB.FrozenAccounts)) - GLOB.FrozenAccounts[who] = list(B) + if (!(who in SSeconomy.frozen_accounts)) + SSeconomy.frozen_accounts[who] = list(B) else - GLOB.FrozenAccounts[who] += B + SSeconomy.frozen_accounts[who] += B return 1 /datum/stock/proc/buyShares(who, howmany) diff --git a/lobotomy-corp13.dme b/lobotomy-corp13.dme index 170c6d5f0dd7..0199619ffc52 100644 --- a/lobotomy-corp13.dme +++ b/lobotomy-corp13.dme @@ -161,7 +161,6 @@ #include "code\__DEFINES\~lobotomy_defines\_patreon.dm" #include "code\__DEFINES\~lobotomy_defines\adventure.dm" #include "code\__DEFINES\~lobotomy_defines\is_helpers.dm" -#include "code\__DEFINES\~lobotomy_defines\lore_and_theme.dm" #include "code\__DEFINES\~lobotomy_defines\weapon.dm" #include "code\__HELPERS\_lists.dm" #include "code\__HELPERS\_logging.dm" @@ -3709,7 +3708,6 @@ #include "code\modules\stock_market\events.dm" #include "code\modules\stock_market\industries.dm" #include "code\modules\stock_market\logs.dm" -#include "code\modules\stock_market\stockmarket.dm" #include "code\modules\stock_market\stocks.dm" #include "code\modules\suppressions\_core_suppression.dm" #include "code\modules\suppressions\command.dm"