diff --git a/code/datums/trading/trade.dm b/code/datums/trading/trade.dm
index ca5d33818d4..b16ff8e28a6 100644
--- a/code/datums/trading/trade.dm
+++ b/code/datums/trading/trade.dm
@@ -117,7 +117,7 @@
num = Clamp(num,1,trading_items.len)
if(trading_items[num])
var/atom/movable/M = trading_items[num]
- return "[initial(M.name)]"
+ return "[initial(M.name)]"
/datum/trader/proc/get_item_value(var/trading_num)
if(!trading_items[trading_items[trading_num]])
diff --git a/code/modules/merchant/merchant_programs.dm b/code/modules/merchant/merchant_programs.dm
index 6420c2d3007..f4219a30ad4 100644
--- a/code/modules/merchant/merchant_programs.dm
+++ b/code/modules/merchant/merchant_programs.dm
@@ -1,10 +1,9 @@
/datum/computer_file/program/merchant
filename = "mlist"
- filedesc = "Merchant's List"
+ filedesc = "Orion Express Goods Trading"
extended_desc = "Allows communication and trade between passing vessels, even while jumping."
program_icon_state = "comm"
program_key_icon_state = "lightblue_key"
- nanomodule_path = /datum/nano_module/program/merchant
requires_ntnet = 0
available_on_ntnet = 0
size = 12
@@ -12,38 +11,34 @@
requires_access_to_run = PROGRAM_ACCESS_LIST_ONE
required_access_run = list(access_merchant)
required_access_download = list(access_merchant)
- var/obj/machinery/merchant_pad/pad = null
+ tgui_id = "Merchant"
+ var/obj/machinery/merchant_pad/pad
var/current_merchant = 0
var/show_trades = 0
var/hailed_merchant = 0
- var/last_comms = null
- var/temp = null
+ var/last_comms
+ var/temp
var/bank = 0 //A straight up money till
-/datum/nano_module/program/merchant
- name = "Merchant's List"
-
/datum/computer_file/program/merchant/proc/get_merchant(var/num)
if(num > SStrade.traders.len)
num = SStrade.traders.len
if(num)
return SStrade.traders[num]
-/datum/nano_module/program/merchant/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/ui_state/state = default_state)
- var/list/data = host.initial_data()
+/datum/computer_file/program/merchant/ui_data(mob/user)
+ var/list/data = initial_data()
var/show_trade = 0
var/hailed = 0
var/datum/trader/T
- if(program)
- var/datum/computer_file/program/merchant/P = program
- data["temp"] = P.temp
- data["mode"] = !!P.current_merchant
- data["last_comms"] = P.last_comms
- data["pad"] = !!P.pad
- data["bank"] = P.bank
- show_trade = P.show_trades
- hailed = P.hailed_merchant
- T = P.get_merchant(P.current_merchant)
+ data["temp"] = temp
+ data["mode"] = !!current_merchant
+ data["last_comms"] = last_comms
+ data["pad"] = !!pad
+ data["bank"] = bank
+ show_trade = show_trades
+ hailed = hailed_merchant
+ T = get_merchant(current_merchant)
data["mode"] = !!T
if(T)
data["traderName"] = T.name
@@ -55,12 +50,9 @@
for(var/i in 1 to T.trading_items.len)
trades += T.print_trading_items(i)
data["trades"] = trades
- ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
- if (!ui)
- ui = new(user, src, ui_key, "merchant.tmpl", "Merchant List", 575, 700, state = state)
- ui.auto_update_layout = 1
- ui.set_initial_data(data)
- ui.open()
+ else
+ data["trades"] = null
+ return data
/datum/computer_file/program/merchant/proc/connect_pad()
for(var/obj/machinery/merchant_pad/P in orange(1,get_turf(computer)))
@@ -162,94 +154,95 @@
bank = 0
B.update_icon()
-/datum/computer_file/program/merchant/Topic(href, href_list)
+/datum/computer_file/program/merchant/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
if(..())
- return 1
+ return
var/mob/user = usr
- if(href_list["PRG_connect_pad"])
- . = 1
- connect_pad()
- if(href_list["PRG_continue"])
- . = 1
- temp = null
- if(href_list["PRG_transfer_to_bank"])
- . = 1
- transfer_to_bank()
- if(href_list["PRG_get_money"])
- . = 1
- get_money()
- if(href_list["PRG_main_menu"])
- . = 1
- current_merchant = 0
- if(href_list["PRG_merchant_list"])
- if(SStrade.traders.len == 0)
- . = 0
- temp = "Cannot find any traders within broadcasting range."
- else
- . = 1
- current_merchant = 1
- hailed_merchant = 0
- last_comms = null
- if(href_list["PRG_test_fire"])
- . = 1
- if(test_fire())
- temp = "Test Fire Successful"
- else
- temp = "Test Fire Unsuccessful"
- if(href_list["PRG_scroll"])
- . = 1
- var/scrolled = 0
- switch(href_list["PRG_scroll"])
- if("right")
- scrolled = 1
- if("left")
- scrolled = -1
- var/new_merchant = Clamp(current_merchant + scrolled, 1, SStrade.traders.len)
- if(new_merchant != current_merchant)
- hailed_merchant = 0
- last_comms = null
- current_merchant = new_merchant
+ switch(action)
+ if("PRG_connect_pad")
+ . = TRUE
+ connect_pad()
+ if("PRG_continue")
+ . = TRUE
+ temp = null
+ if("PRG_transfer_to_bank")
+ . = TRUE
+ transfer_to_bank()
+ if("PRG_get_money")
+ . = TRUE
+ get_money()
+ if("PRG_main_menu")
+ . = TRUE
+ current_merchant = 0
+ if("PRG_merchant_list")
+ if(SStrade.traders.len == 0)
+ . = TRUE
+ temp = "Cannot find any traders within broadcasting range."
+ else
+ . = TRUE
+ current_merchant = 1
+ hailed_merchant = 0
+ last_comms = null
+ if("PRG_test_fire")
+ . = TRUE
+ if(test_fire())
+ temp = "Test Fire Successful"
+ else
+ temp = "Test Fire Unsuccessful"
+ if("PRG_scroll")
+ . = TRUE
+ var/scrolled = 0
+ switch(params["PRG_scroll"])
+ if("right")
+ scrolled = 1
+ if("left")
+ scrolled = -1
+ var/new_merchant = Clamp(current_merchant + scrolled, 1, SStrade.traders.len)
+ if(new_merchant != current_merchant)
+ hailed_merchant = 0
+ last_comms = null
+ current_merchant = new_merchant
if(current_merchant)
var/datum/trader/T = get_merchant(current_merchant)
if(!T.can_hail())
last_comms = T.get_response("hail_deny", "No, I'm not speaking with you.")
- . = 1
+ . = TRUE
else
- if(href_list["PRG_hail"])
- . = 1
+ if(action == "PRG_hail")
+ . = TRUE
last_comms = T.hail(user)
show_trades = 0
hailed_merchant = 1
- if(href_list["PRG_show_trades"])
- . = 1
+ if(action == "PRG_show_trades")
+ . = TRUE
show_trades = !show_trades
- if(href_list["PRG_insult"])
- . = 1
+ if(action == "PRG_insult")
+ . = TRUE
last_comms = T.insult()
- if(href_list["PRG_compliment"])
- . = 1
+ if(action == "PRG_compliment")
+ . = TRUE
last_comms = T.compliment()
- if(href_list["PRG_offer_item"])
- . = 1
- offer_item(T,text2num(href_list["PRG_offer_item"]) + 1)
- if(href_list["PRG_how_much_do_you_want"])
- . = 1
- last_comms = T.how_much_do_you_want(text2num(href_list["PRG_how_much_do_you_want"]) + 1)
- if(href_list["PRG_offer_money_for_item"])
- . = 1
- offer_money(T, text2num(href_list["PRG_offer_money_for_item"])+1)
- if (href_list["PRG_bulk_money_for_item"])
- . = 1
- bulk_offer(T, text2num(href_list["PRG_bulk_money_for_item"])+1)
- if(href_list["PRG_what_do_you_want"])
- . = 1
+ if(action == "PRG_offer_item")
+ . = TRUE
+ offer_item(T,text2num(params["PRG_offer_item"]) + 1)
+ if(action == "PRG_how_much_do_you_want")
+ . = TRUE
+ last_comms = T.how_much_do_you_want(text2num(params["PRG_how_much_do_you_want"]) + 1)
+ if(action == "PRG_offer_money_for_item")
+ . = TRUE
+ offer_money(T, text2num(params["PRG_offer_money_for_item"])+1)
+ if (action == "PRG_bulk_money_for_item")
+ . = TRUE
+ bulk_offer(T, text2num(params["PRG_bulk_money_for_item"])+1)
+ if(action == "PRG_what_do_you_want")
+ . = TRUE
last_comms = T.what_do_you_want()
- if(href_list["PRG_sell_items"])
- . = 1
+ if(action == "PRG_sell_items")
+ . = TRUE
sell_items(T)
- if(href_list["PRG_bribe"])
- . = 1
- bribe(T, text2num(href_list["PRG_bribe"]))
+ if(action == "PRG_bribe")
+ . = TRUE
+ bribe(T, text2num(params["PRG_bribe"]))
/datum/computer_file/program/merchant/nka
required_access_run = list(access_nka)
diff --git a/html/changelogs/mattatlas-youjustliketoactthefool.yml b/html/changelogs/mattatlas-youjustliketoactthefool.yml
new file mode 100644
index 00000000000..523aafc3562
--- /dev/null
+++ b/html/changelogs/mattatlas-youjustliketoactthefool.yml
@@ -0,0 +1,41 @@
+################################
+# Example Changelog File
+#
+# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
+#
+# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
+# When it is, any changes listed below will disappear.
+#
+# Valid Prefixes:
+# bugfix
+# wip (For works in progress)
+# tweak
+# soundadd
+# sounddel
+# rscadd (general adding of nice things)
+# rscdel (general deleting of nice things)
+# imageadd
+# imagedel
+# maptweak
+# spellcheck (typo fixes)
+# experiment
+# balance
+# admin
+# backend
+# security
+# refactor
+#################################
+
+# Your name.
+author: MattAtlas
+
+# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
+delete-after: True
+
+# Any changes you've made. See valid prefix list above.
+# INDENT WITH TWO SPACES. NOT TABS. SPACES.
+# SCREW THIS UP AND IT WON'T WORK.
+# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
+# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
+changes:
+ - bugfix: "The Merchant program now actually has an UI. Oops. It has also been renamed to Orion Express Goods Trading."
diff --git a/tgui/packages/tgui/interfaces/Merchant.tsx b/tgui/packages/tgui/interfaces/Merchant.tsx
new file mode 100644
index 00000000000..c37fb78afe9
--- /dev/null
+++ b/tgui/packages/tgui/interfaces/Merchant.tsx
@@ -0,0 +1,256 @@
+import { BooleanLike } from '../../common/react';
+import { capitalizeAll } from '../../common/string';
+import { useBackend } from '../backend';
+import { Box, Button, LabeledControls, LabeledList, NoticeBox, Section } from '../components';
+import { NtosWindow } from '../layouts';
+
+export type MerchantData = {
+ temp: string;
+ mode: BooleanLike;
+ last_comms: string;
+ pad: BooleanLike;
+ bank: number;
+
+ traderName: string;
+ origin: string;
+ hailed: BooleanLike;
+ trades: string[];
+};
+
+export const Merchant = (props, context) => {
+ const { act, data } = useBackend(context);
+
+ return (
+
+
+ {data.temp ? : data.mode ? : }
+
+
+ );
+};
+
+export const ModeWindow = (props, context) => {
+ const { act, data } = useBackend(context);
+
+ return (
+
+
+ );
+};
+
+export const Hailed = (props, context) => {
+ const { act, data } = useBackend(context);
+
+ return (
+
+ {data.trades ? (
+ act('PRG_show_trades')} />
+ }>
+ {data.trades.map((trade) => (
+
+
+ {capitalizeAll(trade)}
+
+
+
+
+ act('PRG_offer_item', {
+ PRG_offer_item: data.trades.indexOf(trade),
+ })
+ }
+ />
+
+
+
+ act('PRG_offer_money_for_item', {
+ PRG_offer_money_for_item: data.trades.indexOf(trade),
+ })
+ }
+ />
+
+
+
+ act('PRG_how_much_do_you_want', {
+ PRG_how_much_do_you_want: data.trades.indexOf(trade),
+ })
+ }
+ />
+
+
+
+ act('PRG_bulk_money_for_item', {
+ PRG_bulk_money_for_item: data.trades.indexOf(trade),
+ })
+ }
+ />
+
+
+
+ ))}
+
+ ) : (
+
+
+
+ act('PRG_show_trades')}
+ />
+
+
+ act('PRG_sell_items')}
+ />
+
+
+
+ act('PRG_compliment')}
+ />
+
+
+ act('PRG_insult')} />
+
+
+ act('PRG_what_do_you_want')}
+ />
+
+
+
+
+ act('PRG_bribe', { PRG_bribe: 100 })}
+ />
+ act('PRG_bribe', { PRG_bribe: 100 })}
+ />
+ act('PRG_bribe', { PRG_bribe: 1000 })}
+ />
+
+
+
+ )}
+
+ );
+};
+
+export const NotHailed = (props, context) => {
+ const { act, data } = useBackend(context);
+
+ return (
+
+ );
+};
+
+export const MainMenu = (props, context) => {
+ const { act, data } = useBackend(context);
+
+ return (
+
+
+
+ act('PRG_merchant_list')}
+ />
+
+
+ act('PRG_test_fire')}
+ />
+
+
+ act('PRG_connect_pad')}
+ />
+
+
+ act('PRG_transfer_to_bank')}
+ />
+
+
+ act('PRG_get_money')}
+ />
+
+
+
+
+ {data.pad ? 'Connected' : 'Not Connected'}
+
+
+
+ );
+};
+
+export const TempWindow = (props, context) => {
+ const { act, data } = useBackend(context);
+
+ return (
+ act('PRG_continue')}
+ />
+ }>
+ {data.temp}
+
+ );
+};