From 33c79b4af0b2beac98aef484790740283c9aa672 Mon Sep 17 00:00:00 2001 From: Sokomine Date: Wed, 2 Jun 2021 03:54:30 +0200 Subject: [PATCH] added button back to trade list for dialog option trades --- trade_simple.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/trade_simple.lua b/trade_simple.lua index 0d20447..a1a77b1 100644 --- a/trade_simple.lua +++ b/trade_simple.lua @@ -29,6 +29,12 @@ yl_speak_up.input_do_trade_simple = function(player, formname, fields) return end + -- get from a dialog option trade back to the list of all these trades + if(fields.show_trade_list_dialog_options) then + yl_speak_up.show_fs(player, "trade_list", true) + return + end + -- a new trade has been stored - show it if(fields.trade_simple_stored) then yl_speak_up.show_fs(player, "trade_simple", yl_speak_up.speak_to[pname].trade_id) @@ -465,6 +471,8 @@ yl_speak_up.do_trade_simple = function(player, count) yl_speak_up.save_npc_inventory( trade.n_id ) -- store for statistics how many times the player has executed this trade + -- (this is also necessary to switch to the right target dialog when + -- dealing with dialog options trades) yl_speak_up.trade[pname].trade_done = yl_speak_up.trade[pname].trade_done + 1 -- log the trade @@ -574,6 +582,12 @@ yl_speak_up.get_fs_trade_simple = function(player, trade_id) "button[0.2,1.6;1.2,0.9;delete_trade_simple;Delete]".. "tooltip[delete_trade_simple;Delete this trade. You can do so only ".. "if you can edit the NPC as such (i.e. own it).]" + else + formspec = formspec.. + "button[0.2,1.0;2.0,0.9;show_trade_list_dialog_options;Back to list]".. + "tooltip[show_trade_list_dialog_options;".. + "Click here to get back to the list of all trades\n".. + "associated with dialog options (like this one).]" end end