# HG changeset patch # User James D. Callahan III # Date 1381788664 18000 # Node ID 901b9cd2a6c235cb287575803ff15f057cf2bf15 # Parent fdf96c61d1b7a9af6bcd3b03d17a32726e2aba5d Added support for recording object locations in GOSSIP_SHOW. diff -r fdf96c61d1b7 -r 901b9cd2a6c2 Main.lua --- a/Main.lua Mon Oct 14 17:02:28 2013 -0500 +++ b/Main.lua Mon Oct 14 17:11:04 2013 -0500 @@ -2575,14 +2575,31 @@ end + local GOSSIP_SHOW_FUNCS = { + [private.UNIT_TYPES.NPC] = function(unit_idnum) + local gossip_options = { _G.GetGossipOptions() } + + for index = 2, #gossip_options, 2 do + if gossip_options[index] == "binder" then + SetUnitField("innkeeper", private.UNIT_TYPES.NPC) + return + end + end + end, + [private.UNIT_TYPES.OBJECT] = function(unit_idnum) + UpdateDBEntryLocation("objects", unit_idnum) + end, + } + + function WDP:GOSSIP_SHOW(event_name) - local gossip_options = { _G.GetGossipOptions() } - - for index = 2, #gossip_options, 2 do - if gossip_options[index] == "binder" then - SetUnitField("innkeeper", private.UNIT_TYPES.NPC) - return - end + local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("npc")) + if not unit_idnum then + return + end + + if GOSSIP_SHOW_FUNCS[unit_type] then + GOSSIP_SHOW_FUNCS[unit_type](unit_idnum) end end