Commit 1b204fd2 authored by Robin Schoonover's avatar Robin Schoonover

Fix GameTooltip unit guid handling.

parent 7b5c3bb8
......@@ -14,6 +14,17 @@ addon:HookTipScript("OnTooltipSetSpell", function(self)
addon:AddIDLine(self, "Spell", spellID)
end)
--
--
--
function handleUnit(tip, unitType, ...)
if unitType == "Creature" or unitType == "Pet" or unitType == "GameObject" or unitType == "Vehicle" then
local _, _, _, _, id = ...
addon:AddIDLine(tip, unitType, id)
end
end
addon:HookTipScript("OnTooltipSetUnit", function(self)
local name, unit = self:GetUnit()
if not unit then
......@@ -21,15 +32,9 @@ addon:HookTipScript("OnTooltipSetUnit", function(self)
end
local guid = UnitGUID(unit)
if guid then
local utype = strsub(guid, 5, 5)
if utype == "1" then
-- world object
addon:AddIDLine(self, "Object", tonumber(strsub(guid, 6, 12), 16))
elseif utype == "3" or utype == "5" then
-- npc/pet/vehicle
addon:AddIDLine(self, "NPC", tonumber(strsub(guid, 6, 10), 16))
end
handleUnit(self, strsplit("-", guid))
else
-- TODO check for battle pet
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment