count trades properly so that the right target dialog can be choosen

This commit is contained in:
Sokomine 2021-06-02 01:00:34 +02:00
parent a8c9321672
commit 26fb546bf7

View File

@ -465,7 +465,7 @@ 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
trade.trade_done = trade.trade_done + 1
yl_speak_up.trade[pname].trade_done = yl_speak_up.trade[pname].trade_done + 1
-- log the trade
yl_speak_up.log_change(pname, trade.n_id,
@ -485,7 +485,9 @@ yl_speak_up.get_fs_trade_simple = function(player, trade_id)
-- which trade are we talking about?
local trade = yl_speak_up.trade[pname]
if(trade_id) then
if(trade and trade.trade_id and trade_id and trade.trade_id == trade_id) then
-- nothing to do; trade is already loaded and stored
elseif(trade_id) then
local d_id = yl_speak_up.speak_to[pname].d_id
local n_id = yl_speak_up.speak_to[pname].n_id
local dialog = yl_speak_up.speak_to[pname].dialog