• 0

    posted a message on Inserting text into the item tooltip
    So, I've been looking at the tooltip code in both Bagon_Tooltips and Engravings, and have gotten the following rough code from them (It's just a stripped down version of the stuff in Bagon_Tooltips, really.)

    local function AddText(frame, link)
    	frame:AddDoubleLine("This is", "some text")
    	frame:Show()
    end
    
    local function HookTip(tooltip)
    	tooltip:HookScript('OnTooltipSetItem', function(self, ...)
    		local itemLink = select(2, self:GetItem())
    		if itemLink and GetItemInfo(itemLink) then --fix for blizzard doing craziness when doing getiteminfo
    			AddText(self, itemLink)
    		end
    	end)
    end
    
    HookTip(GameTooltip)
    HookTip(ItemRefTooltip)


    So, I really just need to then add in some code to get the relevant information to add in the AddText function, right? (AddDoubleLine was used as that's what I'm using in my addon anyway.)
    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.