Hey there,
so some tooltips return empty values (name = "" and link = []) if you use GameTooltip:GetItem(), for example tooltips from the QuestFrame and I believe the TradeSkillFrame.
My interface has item quality border coloring for tooltips but obviously not for said tooltips.
Lua Code:
GameTooltip:HookScript('OnTooltipSetItem', function(self)
local name, item = self:GetItem()
if (item) then
local quality = select(3, GetItemInfo(item))
if (quality) then
local r, g, b = GetItemQualityColor(quality)
self:SetBeautyBorderTexture('white')
self:SetBeautyBorderColor(r, g, b)
else
self:SetBeautyBorderTexture('white')
self:SetBeautyBorderColor(1, 1, 1)
end
end
end)
I tried it with this function (this probably works only for quest items though)
Lua Code:
name, texture, numItems, quality, isUsable = GetQuestItemInfo("type", index)
but the problem is that I have no idea how to get the index from the item I hover over.
Anyone has an idea how to approach this?
update:
The are six QuestProgressItem buttons according to the QuestFrame.xml, so I just hooked them all.
No idea if this is a good way to do this but it seems to be working.
Lua Code:
for i = 1, 6 do
local questprog = _G['QuestProgressItem'..i]
questprog:HookScript('OnEnter', function(self)
local ID = self:GetID()
local questitemtype = self.type
local link = GetQuestItemLink(questitemtype, ID)
if (link) then
local quality = select(3, GetItemInfo(link))
if (quality) then
local r, g, b = GetItemQualityColor(quality)
GameTooltip:SetBeautyBorderTexture('white')
GameTooltip:SetBeautyBorderColor(r, g, b)
end
end
end)
end
update2:
and here for the TradeSkillFrame
Lua Code:
if (not TradeSkillFrame) then
LoadAddOn('Blizzard_TradeSkillUI')
end
for i = 1, 8 do
local tsr = _G['TradeSkillReagent'..i]
tsr:HookScript('OnEnter', function(self)
local ID = self:GetID()
local skillindex = TradeSkillFrame.selectedSkill
local link = GetTradeSkillReagentItemLink(skillindex, ID)
if (link) then
local quality = select(3, GetItemInfo(link))
if (quality) then
local r, g, b = GetItemQualityColor(quality)
GameTooltip:SetBeautyBorderTexture('white')
GameTooltip:SetBeautyBorderColor(r, g, b)
end
end
end)
end
hooksecurefunc('TradeSkillItem_OnEnter', function(self)
local link = GetTradeSkillItemLink(TradeSkillFrame.selectedSkill)
if (link) then
local quality = select(3, GetItemInfo(link))
if (quality) then
local r, g, b = GetItemQualityColor(quality)
GameTooltip:SetBeautyBorderTexture('white')
GameTooltip:SetBeautyBorderColor(r, g, b)
end
end
end)
But still I wonder if this is a good way to do it.