diff --git a/trade_simple.lua b/trade_simple.lua index 9d86de6..0d20447 100644 --- a/trade_simple.lua +++ b/trade_simple.lua @@ -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