All the info one needs and the commands to toggle them.
QualityID
This is a very minimalistic addon that adds an item's basic info into the tooltip, in the color of the item's quality. The info includes an item's; icon, id, item level, stack count, and type with subtype.
Commands:
/qualityid or /qid displays a full list of commands:
/qid {toggle|on|off} -- enables or disable all info
/qid icon --toggle the icon
/qid stack -- toggles the stack count
/qid type -- toggles the type: subtype
Any questions, comments, or suggestions please post them here in the comments section.
Change Log - QualityID
--3.05 r13:
* Added Saved Variables
--2.05.00.12:
* Added more info; stack count, type: subtype and icon.
* Added slashcommand toggles.
* Need to add saved variables, until then user options aren't saved between sessions.
--1.00.10: Added GNUv2GPL.txt and edited toc and lua accordingly
--1.0.0 r8: Rewrite of coding. Removed TipHookerLib dependency, made tooltip a double line.
--0.0.6: Just catching upto the svn. No changes.
--0.0.3: *whistles innocently*
--0.0.2: Cleaned up unneeded code, and a file.
--0.0.1: Original upload
I get an error on line 94 sometimes due to stackCount being nil. Adding a check for nil fixed it.
__________________
"We shaman don't command the magic we wield. As mages and warlocks strain and sweat to produce a tiny flame, I ask for the elements to lend me their strength."
Caellien, I believe the error is occuring due to tekCompares way of calling Hyperlinks. I'm pretty sure this means I need to add support for compare item addons like tekCompare. The issue doesn't stop either addon from doing its thing. So until I can figure out how to add support, I apologize for the inconvenience of the error pop-ups.
QualityID.lua:23: attempt to index field '?' (a nil value)
Count: 1
Call Stack:
[C]: ?
QualityID.lua:23: in function
QualityID.lua:16>
(tail call): ?
(tail call): ?
[C]: ?
[C]: in function `SetHyperlink'
Interface\AddOns\tekKompare\HoverTips.lua:9: in function <Interface\AddOns\tekKompare\HoverTips.lua:6>
You can pull the quality color directly out of the link string. Recipes will in fact call the handler twice, because there are two items set to the tip. The fact that GetItem returns the same value both times is a Blizzy bug that's been around for some time. As for why your getting double hook calls, I have no idea, it works fine for me. Perhaps you have another addon handling their hooks incorrectly?
Much of the unneeded code is stuff I was messing with, which I just hadn't removed. Bad addon author, I know. I'll clean it up and update here tomorrow morning.
After playing around with the code you supplied and trying to make it work. I can't seem to get the font to color by the item's quality AND more annoyingly, the info is multiplied (twice on items, four times on recipes). I'll continue messing with both yours and some other test code I've written.
TipHooker is not needed at all here. There's also a lot of unneeded code in your addon. You could slim this whole thing to a few lines of code:
Code:
local origs = {}
local function OnTooltipSetItem(frame, ...)
local name, link = frame:GetItem()
if link then
local id = tonumber(link:match("item:(%d+):"))
local _, _, _, ilvl = GetItemInfo(id)
frame:AddDoubleLine("ID:" , id)
frame:AddDoubleLine("iLevel:" , ilvl)
end
if origs[frame] then return origs[frame](frame, ...) end
end
for _,frame in pairs{GameTooltip, ItemRefTooltip, ShoppingTooltip1, ShoppingTooltip2} do
origs[frame] = frame:GetScript("OnTooltipSetItem")
frame:SetScript("OnTooltipSetItem", OnTooltipSetItem)
end