WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Tooltip hook is added twice for recipes (https://www.wowinterface.com/forums/showthread.php?t=56345)

Rilgamon 07-09-18 02:31 AM

Tooltip hook is added twice for recipes
 
1 Attachment(s)
I try to create an addon like bankitems. Adding tooltips for itemcounts in your bank/bag.
When I mouse over a recipe with embedded item the additional lines are added twice. The inner tooltip uses the itemid of the outer recipe. I'm not sure what I'm looking for ... unsure if I should

a) find the itemid of the embedded item and show the right itemcount
b) dont add the tooltip to the embedded item and only show the recipe itemcount.

But so far I've not found a way to do it. Any ideas or documentation where I can read up?

Lua Code:
  1. local function GameTooltip_OnTooltipSetItem(tooltip)
  2.     local _, link = tooltip:GetItem()
  3.     if(not link) then
  4.         return
  5.     end
  6.     local id = addon['getItemId'](link)
  7.     if(not id) then
  8.         local tip
  9.         id,tip = checkID(id)
  10.         if(id and tip) then
  11.             tooltip = tip
  12.         end
  13.     end
  14.     if(id)then
  15. --      tooltip:AddLine()
  16.         for name,b in pairs(search(id)) do
  17.             local dname, drealm = strsplit(" - ",name)
  18.             local input,sum = output(b)
  19.             if(sum>0) then
  20.                 tooltip:AddLine(format("%s %s: %s [ %s ] ",addon:getIcon(id),dname,sum,addon['colorize'](table.concat(input,', '),"ffffff")))
  21.             end
  22.             input = nil
  23.         end
  24.         specialoutput(tooltip, id)
  25.         if(db['showID']) then
  26.             tooltip:AddLine(format("Id: %i",id))
  27.         end
  28.     end
  29.     tooltip:Show()
  30. end
  31. GameTooltip:HookScript("OnTooltipSetItem", GameTooltip_OnTooltipSetItem)
Attachment 9065


All times are GMT -6. The time now is 01:10 AM.

vBulletin © 2018, Jelsoft Enterprises Ltd
© 2004 - 2017 MMOUI