Thread Tools Display Modes
07-09-18, 02:31 AM   #1
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
Tooltip hook is added twice for recipes

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)
Click image for larger version

Name:	Unbenannt.png
Views:	262
Size:	283.0 KB
ID:	9065
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Tooltip hook is added twice for recipes

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off