Skip to content

Commit 4e93bee

Browse files
committed
internal/caravan/common.lua use trader over broker
When doing trading (i.e. the DF Trade window is open showing the two columns), it *can* happen that you *have* a broker, but you actually *trade* using a different unit. This can be triggered by opening the depot building view and choosing `Anyone requested at trade`, repeating this until some unit that is not the broker shows up to do the trading. When this happens, the DFHack `Select trade goods` overlay shows different obfuscated values than the DF Trade window. This patch fixes that case by using the trader's appraisal skill if trading is active.
1 parent 76b0f7e commit 4e93bee

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

internal/caravan/common.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ end
3636

3737
function get_broker_skill()
3838
local broker = dfhack.units.getUnitByNobleRole('broker')
39+
local interface_trade = df.global.game.main_interface.trade
40+
if interface_trade.open == true
41+
and interface_trade.choosing_merchant == false
42+
and interface_trade.fortress_trader ~= nil
43+
then
44+
broker = interface_trade.fortress_trader
45+
end
3946
if not broker then return 0 end
4047
for _,skill in ipairs(broker.status.current_soul.skills) do
4148
if skill.id == df.job_skill.APPRAISAL then

0 commit comments

Comments
 (0)