View Single Post
01-20-23, 02:21 AM   #2
LudiusMaximus
A Rage Talon Dragon Guard
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 323
I solved it myself. Turns out that for recipes, which create usable items, the hyperlink returned by GetItem() does not match the returned id. The hyperlink is of the created item but the id is of the recipe. So when I use the returned id I am good.


Lua Code:
  1. TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Item, function(self)
  2.  
  3.   local name, link, idFromTooltip = self:GetItem()
  4.   local idFromLink = tonumber(string_match(link, "^.-:(%d+):"))
  5.  
  6.   if idFromTooltip ~= idFromLink then
  7.     print("This recipe has the id", idFromTooltip, "and creates another teaching item with the id", idFromLink)
  8.    
  9.     print("Tooltip of created item:")
  10.     local tooltipLines = C_TooltipInfo.GetItemByID(idFromLink).lines
  11.     local numLines = 1
  12.     while tooltipLines[numLines] do
  13.       print(numLines .. ":", tooltipLines[numLines].args[2].stringVal)
  14.       numLines = numLines + 1
  15.     end
  16.   end
  17.  
  18.   print("Tooltip of recipe:")
  19.   local tooltipLines = C_TooltipInfo.GetItemByID(idFromTooltip).lines
  20.   local numLines = 1
  21.   while tooltipLines[numLines] do
  22.     print(numLines .. ":", tooltipLines[numLines].args[2].stringVal)
  23.     numLines = numLines + 1
  24.   end
  25.  
  26. end)
__________________
~ Be the change you want to see in the world... of warcraft interface! ~

Last edited by LudiusMaximus : 01-23-23 at 01:31 PM.
  Reply With Quote