Mercurial > wow > wowdb-profiler
diff Main.lua @ 323:901b9cd2a6c2
Added support for recording object locations in GOSSIP_SHOW.
author | James D. Callahan III <jcallahan@curse.com> |
---|---|
date | Mon, 14 Oct 2013 17:11:04 -0500 |
parents | fdf96c61d1b7 |
children | 9cc4ffab84d1 |
line wrap: on
line diff
--- 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