Originally Posted by Mazzop
I crate that tooltip frame with GameTooltipTemplate, so strings there are as before any addons touch them?
|
Correct; addons that modify the GameTooltip
frame don't affect other frames that also inherited from the GameTooltipTemplate or have the GameTooltip
frame type. (Blizzard's naming choices here are a little silly... it's like creating a Button type frames and naming it "Button" even though there are also hundreds of other Button type frames in the UI.)
If you did want to try item level matching, you can capture it like so:
Code:
-- Construct your pattern once at the top of the file:
local ITEM_LEVEL_PATTERN = "^" .. gsub(ITEM_LEVEL, "%%d", "(%d+)") .. "$"
-- Then use it:
for i = 2, GameTooltip:GetNumLines() do
local text = _G["GameTooltipTextLeft"..i]:GetText()
if text then -- it can be nil, which is fine for == checks but will break string.match
local iLevel = strmatch(text, ITEM_LEVEL_PATTERN)
if iLevel then
-- do something here
break -- stop looking
end
end
end