/
QualityID = {} |
QIDDB = { |
enabled = true; |
showid = true; |
showitemLvl = true; |
showStackCount = true; |
showIcon = true; |
showType = true; |
} |
QIDDB.enabled = true |
QIDDB.showid = true |
QIDDB.showitemLvl = true |
QIDDB.showStackCount = true |
QIDDB.showIcon = true |
QIDDB.showType = true |
QIDDB.showitemType = true |
QIDDB.QualityIDVersion = "3.05" |
--For testing if version is doubling info, if it shows twice, then we are sad pandas. |
if (not (QIDDB)) then DEFAULT_CHAT_FRAME:AddMessage("Setting up QIDDB.") end |
if (not (QIDDB)) then QIDDB = {} end |
if (not (QIDDB.enabled)) then QIDDB.enabled = self.enabled end |
if (not (QIDDB.showId)) then QIDDB.showId = self.showId end |
if (not (QIDDB.showitemLvl)) then QIDDB.showitemLvl = self.showitemLvl end |
if (not (QIDDB.showStackCount)) then QIDDB.showStackCount = self.showStackCount end |
if (not (QIDDB.showIcon)) then QIDDB.showIcon = self.showIcon end |
if (not (QIDDB.showitemType)) then QIDDB.showitemType = self.showitemType end |
QIDDB.enabled = true; |
elseif(msg:lower() == "off") then |
QIDDB.enabled = false; |
elseif(msg:lower() == "id") then |
QIDDB.showid = not QIDDB.showid; |
elseif(msg:lower() == "ilvl") then |
QIDDB.showitemLvl = not QIDDB.showitemLvl; |
elseif(msg:lower() == "stack") then |
QIDDB.showStackCount = not QIDDB.showStackCount; |
elseif(msg:lower() == "itemtype") then |
elseif(msg:lower() == "icon") then |
QIDDB.showIcon = not QIDDB.showIcon; |
elseif(msg == "") then |
chat("QIDTest options: /qid {toggle | on | off}"); |
chat("QualityID options: /qid {toggle | on | off}"); |
chat("/qid id {toggle} "); |
chat("/qid ilvl {toggle} "); |
chat("/qid stack {toggle}"); |
chat("/qid itemtype {toggle}"); |
chat("/qid icon {toggle}"); |
end |
local origs = {} |
--adds id, lvl, stkct, and type |
--adds id, ilvl, stkct, and type |
local function OnTooltipSetItem(frame, ...) |
local name, link = frame:GetItem() |
if QIDDB.enabled and link then |
local name,link,quality,ilvl,reqLevel,type,subType,stackCount = GetItemInfo(id) |
--text that you see in the tooltip |
frame:AddLine(" ") |
if stackCount and QIDDB.showStackCount and stackCount > 2 then |
frame:AddLine( "Stacks in lots of "..ITEM_QUALITY_COLORS[quality].hex..stackCount) |
end |
if quality then |
frame:AddLine( "Item ID: "..ITEM_QUALITY_COLORS[quality].hex..id) |
frame:AddLine( "Item Lvl: "..ITEM_QUALITY_COLORS[quality].hex..ilvl) |
if id and QIDDB.showid then |
frame:AddLine( "Item ID: "..ITEM_QUALITY_COLORS[quality].hex..id) |
end |
if ilvl and QIDDB.showitemLvl then |
frame:AddLine( "Item Lvl: "..ITEM_QUALITY_COLORS[quality].hex..ilvl) |
end |
if subType and QIDDB.showitemType then |
frame:AddLine( ""..type..": "..ITEM_QUALITY_COLORS[quality].hex..subType) |
end |
if stackCount and QIDDB.showStackCount and stackCount > 2 then |
frame:AddLine( "Stacks in lots of "..ITEM_QUALITY_COLORS[quality].hex..stackCount) |
end |
end |
if QIDDB.showitemType then |
frame:AddLine( ""..type..": "..subType, 0,1,0) |
end |
frame:AddLine(" ") |
end |
if origs[frame] then |
end |
--Add item icon to the tooltip. |
local function hookItem(frame, ...) |
local function hookTip(frame, ...) |
local _G = getfenv(0) |
local set = frame:GetScript('OnTooltipSetItem') |
end |
end) |
end |
hookItem(GameTooltip) |
hookItem(ItemRefTooltip) |
hookItem(ShoppingTooltip1) |
hookItem(ShoppingTooltip2) |
hookTip(GameTooltip) |
hookTip(ItemRefTooltip) |
hookTip(ShoppingTooltip1) |
hookTip(ShoppingTooltip2) |
for _,frame in pairs{GameTooltip, ItemRefTooltip, ShoppingTooltip1, ShoppingTooltip2} do |
origs[frame] = frame:GetScript("OnTooltipSetItem") |
--Run once when first loaded. |
do |
QID = CreateFrame("Frame", "QID") |
QID:RegisterEvent("VARIABLES_LOADED") |
QID:SetScript("OnEvent", function(self, event, ...) QualityID[event](QualityID, event, ...) end) |
DEFAULT_CHAT_FRAME:AddMessage("|cff00dd88" .. "QualityID: v"..QIDDB.QualityIDVersion.." enabled!"); |
end |