WoWInterface SVN QualityID

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 13 to Rev 12
    Reverse comparison

Rev 13 → Rev 12

trunk/QualityID/QualityID.lua
1,42 → 1,22
--######################
-- Interface: 30000
-- Title: QIDTest
-- Notes: Displays an items basic info in the color of the item's quality, in the tooltip.
-- Interface: 20400
-- Title: QualityID
-- Notes: Displays an items ID and Level in the color of the item's quality.
-- License: GNUv2GPL
-- Author: Anaral
-- Version: 3.05
-- Version: 2.05.00.wowi:revision
--#######################
 
QualityID = {}
QIDDB = {
enabled = true;
showStackCount = true;
showIcon = true;
showType = true;
}
--future sv
QualityID_DB = {}
local debug = true;
local enabled = true;
local showStackCount = true;
local showIcon = true;
local showType = true;
local QualityIDVersion = "|cff00dd88".."v 2.05.00.wowi:revision |r";
 
QIDDB.enabled = true
QIDDB.showStackCount = true
QIDDB.showIcon = true
QIDDB.showType = true
QIDDB.QualityIDVersion = "3.05"
 
--For testing if version is doubling info, if it shows twice, then we are sad pandas.
--DEFAULT_CHAT_FRAME:AddMessage("|cff00dd88" .. "QualityID: v"..QIDDB.QualityIDVersion.." enabled!")
 
function QualityID:CheckSavedVars()
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.showStackCount)) then QIDDB.showStackCount = self.showStackCount end
if (not (QIDDB.showIcon)) then QIDDB.showIcon = self.showIcon end
if (not (QIDDB.showType)) then QIDDB.showType = self.showType end
end
 
function QualityID:VARIABLES_LOADED()
QualityID:CheckSavedVars()
end
 
function chat(text)
if(type(text) == "boolean") then
if(text) then
46,63 → 26,63
end
end
if(text ~= nil) then
DEFAULT_CHAT_FRAME:AddMessage("|cff00dd88" .. text .. "|r");
DEFAULT_CHAT_FRAME:AddMessage("|cffe8cc01" .. text );
end
end
chat("QualityID: "..QualityIDVersion.."|cffe8cc01".." enabled! Type " .."|cff00dd88".."/qualityid" .."|cffe8cc01".." or ".."|cff00dd88".. "/qid " .."|cffe8cc01".."for toggle commands.")
 
SLASH_QUALITYID1 = "/qualityid"
SLASH_QUALITYID2 = "/qid"
SLASH_QualityID1 = "/qualityid"
SLASH_QualityID2 = "/qid"
-- SlashCmdList["SLASHCMD"] = function (msg, editBox) end; <--- blizz function for 3.0
SlashCmdList["QUALITYID"] = function(msg)
SlashCmdList["QualityID"] = function(msg)
QualityID_SlashCommandHandler(msg);
end
--slashcommand functions
 
function QualityID_SlashCommandHandler(msg)
if(msg ~= "") then
chat("QualityID: " .. msg .. " toggled.");
end
if(msg:lower() == "toggle") then
QIDDB.enabled = not QIDDB.enabled;
enabled = not enabled;
elseif(msg:lower() == "on") then
QIDDB.enabled = true;
enabled = true;
elseif(msg:lower() == "off") then
QIDDB.enabled = false;
enabled = false;
elseif(msg:lower() == "stack") then
QIDDB.showStackCount = not QIDDB.showStackCount;
showStackCount = not showStackCount;
elseif(msg:lower() == "type") then
QIDDB.showType = not QIDDB.showType;
showType = not showType;
elseif(msg:lower() == "icon") then
QIDDB.showIcon = not QIDDB.showIcon;
showIcon = not showIcon;
elseif(msg == "") then
chat("QIDTest options: /qid {toggle | on | off}");
chat("QualityID Options: /qid {toggle | on | off}");
chat("/qid stack {toggle}");
chat("/qid itype {toggle}");
chat("/qid type {toggle}");
chat("/qid icon {toggle}");
end
end
 
local origs = {}
--adds id, lvl, stkct, and type
local function OnTooltipSetItem(frame, ...)
local name, link = frame:GetItem()
if QIDDB.enabled and link then
 
if enabled and link then
local _, _, id, id2 = strfind(link, "item:(%d+).+:(.+:.+)%[")
--While not all returns will be called, all are listed for personal reference.
--While not all returns will be called, all are listed for reference.
local name,link,quality,ilvl,reqLevel,type,subType,stackCount = GetItemInfo(id)
-- text that you see in the tooltip
frame:AddLine(" ")
if QIDDB.showStackCount and stackCount > 2 then
frame:AddLine( "Stacks in lots of "..ITEM_QUALITY_COLORS[quality].hex..stackCount)
end
frame:AddLine( "Item ID: "..ITEM_QUALITY_COLORS[quality].hex..id)
frame:AddLine( "Item Lvl: "..ITEM_QUALITY_COLORS[quality].hex..ilvl)
if QIDDB.showType then
frame:AddLine( ""..type..": "..subType, 0,1,0)
if showStackCount and stackCount > 2 then
frame:AddLine( "Stacks in lots of "..ITEM_QUALITY_COLORS[quality].hex..stackCount)
end
if showType then
frame:AddLine( ""..type..": "..ITEM_QUALITY_COLORS[quality].hex..subType)
end
frame:AddLine(" ")
end
if origs[frame] then
return origs[frame](frame, ...)
if origs[frame] then
return origs[frame](frame, ...)
end
end
 
113,9 → 93,9
 
frame:SetScript('OnTooltipSetItem', function(self, ...)
local link = select(2, self:GetItem())
if link and GetItemInfo(link) then
if link and GetItemInfo(link) then
local text = _G[self:GetName() .. 'TextLeft1']
if QIDDB.showIcon and text and text:GetText():sub(1, 2) ~= '|T' then --make sure the icon does not display twice on recipies, which fire OnTooltipSetItem twice
if showIcon and text and text:GetText():sub(1, 2) ~= '|T' then --make sure the icon does not display twice on recipies, which fire OnTooltipSetItem twice
text:SetFormattedText('|T%s:%d|t%s', GetItemIcon(link), 36, text:GetText())
end
end
135,12 → 115,3
frame:SetScript("OnTooltipSetItem", OnTooltipSetItem)
end
 
 
--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
\ No newline at end of file
trunk/QualityID/QualityID.toc
1,9 → 1,10
## Interface: 30000
## Interface: 20400
## Title: QualityID
## Notes: Displays an items ID and Level in the color of the item's quality.
## License: GNUv2GPL
## Author: Anaral
## Version: 3.05.wowi:revision
## Saved Variables: QIDDB
## Version: 2.05.00.wowi:revision
## SavedVariables: QualityID_DB
## X-Category: Interface Enhancements
 
QualityID.lua
QualityID.lua
\ No newline at end of file