forked from your-land-mirror/yl_speak_up
log add_trade_simple in npc_was_changed as an exception without having to resort to edit_mode directly
This commit is contained in:
parent
0f6962e0a8
commit
1cc4f2e742
@ -195,10 +195,14 @@ yl_speak_up.input_add_trade_simple = function(player, formname, fields, input_to
|
|||||||
elseif(trade_id ~= "new" and (not(d_id) or not(o_id))) then
|
elseif(trade_id ~= "new" and (not(d_id) or not(o_id))) then
|
||||||
error_msg = "Internal error. o_id was not set."
|
error_msg = "Internal error. o_id was not set."
|
||||||
else
|
else
|
||||||
-- record this as a change, but do not save do disk yet
|
-- would be too complicated to handle exceptions; this is for edit_mode:
|
||||||
table.insert(yl_speak_up.npc_was_changed[ n_id ],
|
if(yl_speak_up.npc_was_changed
|
||||||
"Dialog "..d_id..": Trade "..tostring(trade_id).." added to option "..
|
and yl_speak_up.npc_was_changed[n_id]) then
|
||||||
tostring(o_id)..".")
|
-- record this as a change, but do not save do disk yet
|
||||||
|
table.insert(yl_speak_up.npc_was_changed[ n_id ],
|
||||||
|
"Dialog "..d_id..": Trade "..tostring(trade_id)..
|
||||||
|
" added to option "..tostring(o_id)..".")
|
||||||
|
end
|
||||||
-- add this new trade - complete with information to which dialog and
|
-- add this new trade - complete with information to which dialog and
|
||||||
-- to which option the trade belongs
|
-- to which option the trade belongs
|
||||||
dialog.trades[ trade_id ] = {pay={ps},buy={bs}, d_id = d_id, o_id = o_id}
|
dialog.trades[ trade_id ] = {pay={ps},buy={bs}, d_id = d_id, o_id = o_id}
|
||||||
@ -229,10 +233,14 @@ yl_speak_up.input_add_trade_simple = function(player, formname, fields, input_to
|
|||||||
-- delete this result (if it exists)
|
-- delete this result (if it exists)
|
||||||
-- get the necessary dialog data
|
-- get the necessary dialog data
|
||||||
local dialog = yl_speak_up.speak_to[pname].dialog
|
local dialog = yl_speak_up.speak_to[pname].dialog
|
||||||
-- record this as a change
|
-- would be too complicated to handle exceptions; this is for edit_mode:
|
||||||
table.insert(yl_speak_up.npc_was_changed[ n_id ],
|
if(yl_speak_up.npc_was_changed
|
||||||
"Dialog "..d_id..": Trade "..tostring(trade_id).." deleted from option "..
|
and yl_speak_up.npc_was_changed[n_id]) then
|
||||||
tostring(o_id)..".")
|
-- record this as a change
|
||||||
|
table.insert(yl_speak_up.npc_was_changed[ n_id ],
|
||||||
|
"Dialog "..d_id..": Trade "..tostring(trade_id)..
|
||||||
|
" deleted from option "..tostring(o_id)..".")
|
||||||
|
end
|
||||||
if(not(dialog.trades)) then
|
if(not(dialog.trades)) then
|
||||||
dialog.trades = {}
|
dialog.trades = {}
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user