Skip to content

Commit

Permalink
3.1.1
Browse files Browse the repository at this point in the history
Added tooltips to filter menu items
Added Rarity color to filter menu item text color
  • Loading branch information
Noshei committed Dec 5, 2024
1 parent ae7a252 commit 6ba4060
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 18 deletions.
21 changes: 14 additions & 7 deletions Config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1667,21 +1667,28 @@ for expansion, expansionData in pairs(GT.ItemData) do
order = itemData.order
}
else
local rarity = C_Item.GetItemQualityByID(itemData.id) or 1
local R, G, B = C_Item.GetItemQualityColor(rarity)
filterOptions.args[expansion].args[category].args[tostring(itemData.id)] = {
type = "toggle",
dialogControl = "NW_CheckBox",
name = function()
local qualityHex = GT:RGBtoHex(R or 1, G or 1, B or 1, 1)
local name = "|c" .. qualityHex .. "|Hitem:" .. itemData.id .. "::::::::::::::::::|h" .. itemData.name

if itemData.quality then
if itemData.quality == 1 then
return "|cff784335" .. itemData.name .. "*"
name = name .. " |A:Professions-ChatIcon-Quality-Tier1:17:15::1|a|h|r"
elseif itemData.quality == 2 then
return "|cff96979E" .. itemData.name .. "**"
name = name .. " |A:Professions-ChatIcon-Quality-Tier2:17:23::|a|h|r"
elseif itemData.quality == 3 then
return "|cffDCC15F" .. itemData.name .. "***"
name = name .. " |A:Professions-ChatIcon-Quality-Tier3:17:18::1|a|h|r"
end
else
return itemData.name
name = name .. "|h|r"
end

return name
end,
image = function()
if itemData.id <= #GT.ItemData.Other.Other then
Expand All @@ -1702,14 +1709,12 @@ for expansion, expansionData in pairs(GT.ItemData) do
borderColor = { 1, 1, 1, 0.8 }
overlay = nil
else
local rarity = C_Item.GetItemQualityByID(itemData.id) or 1
if rarity <= 1 then
border = { "Interface\\Common\\WhiteIconFrame", "texture" }
else
border = { "bags-glow-white", "atlas" }
end

local R, G, B = C_Item.GetItemQualityColor(rarity)
borderColor = { R, G, B, 0.8 }

if itemData.quality then
Expand Down Expand Up @@ -1767,10 +1772,12 @@ function GT:CreateCustomFilterOptions()
if not item:IsItemEmpty() then
item:ContinueOnItemLoad(function()
local itemName = item:GetItemName()
local itemLink = item:GetItemLink()
itemLink = itemLink:gsub("[%[%]]", "")
filterOptions.args.custom.args[itemName] = {
type = "toggle",
dialogControl = "NW_CheckBox",
name = itemName,
name = itemLink,
image = function() return C_Item.GetItemIconByID(id) end,
get = function() return GT.db.profile.CustomFiltersTable[id] end,
set = function(_, key)
Expand Down
27 changes: 19 additions & 8 deletions FilterButton.lua
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,21 @@ function GT:GenerateFiltersMenu(frame)
if itemData.id == -1 then
local divider = frame[expansion][category]:CreateTitle(itemData.name)
else
local name = itemData.name
local rarity = C_Item.GetItemQualityByID(itemData.id) or 1
local R, G, B = C_Item.GetItemQualityColor(rarity)
local qualityHex = GT:RGBtoHex(R or 1, G or 1, B or 1, 1)
local name = "|c" .. qualityHex .. "|Hitem:" .. itemData.id .. "::::::::::::::::::|h" .. itemData.name

if itemData.quality then
if itemData.quality == 1 then
name = "|cff784335" .. name .. "*"
name = name .. " |A:Professions-ChatIcon-Quality-Tier1:17:15::1|a|h|r"
elseif itemData.quality == 2 then
name = "|cff96979E" .. name .. "**"
name = name .. " |A:Professions-ChatIcon-Quality-Tier2:17:23::|a|h|r"
elseif itemData.quality == 3 then
name = "|cffDCC15F" .. name .. "***"
name = name .. " |A:Professions-ChatIcon-Quality-Tier3:17:18::1|a|h|r"
end
else
name = name .. "|h|r"
end

frame[expansion][category][itemData.name] = frame[expansion][category]:CreateCheckbox(name, IsSelected_Item, SetSelected_Item)
Expand All @@ -231,13 +236,11 @@ function GT:GenerateFiltersMenu(frame)

local leftTextureRarity = text:AttachTexture()
leftTextureRarity:SetDrawLayer("BACKGROUND", 1)
local rarity = C_Item.GetItemQualityByID(itemData.id) or 1
if rarity <= 1 then
leftTextureRarity:SetTexture("Interface\\Common\\WhiteIconFrame")
else
leftTextureRarity:SetAtlas("bags-glow-white")
end
local R, G, B = C_Item.GetItemQualityColor(rarity)
leftTextureRarity:SetVertexColor(R, G, B, 0.8)
leftTextureRarity:SetAllPoints(leftTexture)

Expand All @@ -254,6 +257,9 @@ function GT:GenerateFiltersMenu(frame)
leftTextureQuality:SetAllPoints(leftTexture)
end
end)
frame[expansion][category][itemData.name]:SetTooltip(function(tooltip, elementDescription)
tooltip:SetHyperlink(name)
end)
end
end
end
Expand Down Expand Up @@ -340,10 +346,12 @@ function GT:CreateCustomFiltersList(frame, rootDescription)
--Waits for the data to be returned from the server
if not item:IsItemEmpty() then
item:ContinueOnItemLoad(function()
local itemLink = string.gsub(item:GetItemLink(), "[%[%]]", "")
local itemDetails = {
id = tonumber(id),
text = item:GetItemName(),
icon = tostring(C_Item.GetItemIconByID(itemID) or "")
icon = tostring(C_Item.GetItemIconByID(itemID) or ""),
link = itemLink,
}
table.insert(customFiltersList, itemDetails)
end)
Expand Down Expand Up @@ -394,7 +402,7 @@ function GT:CreateCustomFiltersList(frame, rootDescription)
GT:InventoryUpdate("Custom Filter " .. itemData.text .. " menu clicked", false)
end

frame["Custom Filters"][itemData.text] = frame["Custom Filters"]:CreateCheckbox(itemData.text, IsSelected_CustomFilterItem, SetSelected_CustomFilterItem)
frame["Custom Filters"][itemData.text] = frame["Custom Filters"]:CreateCheckbox(itemData.link, IsSelected_CustomFilterItem, SetSelected_CustomFilterItem)
frame["Custom Filters"][itemData.text]:AddInitializer(function(text, description, menu)
local leftTexture = text:AttachTexture()

Expand All @@ -418,6 +426,9 @@ function GT:CreateCustomFiltersList(frame, rootDescription)
leftTextureRarity:SetVertexColor(R, G, B, 0.8)
leftTextureRarity:SetAllPoints(leftTexture)
end)
frame["Custom Filters"][itemData.text]:SetTooltip(function(tooltip, elementDescription)
tooltip:SetHyperlink(itemData.link)
end)
end
end

Expand Down
2 changes: 1 addition & 1 deletion GatheringTracker.toc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Title: Gathering Tracker
## Notes: Addon for tracking gathered items, supports solo players and groups
## Author: Noshei
## Version: 3.1.0
## Version: 3.1.1
## OptionalDeps: TradeSkillMaster, RECrystallize, Auctionator
## SavedVariables: GatheringTrackerDB
## AddonCompartmentFunc: GatheringTracker_OnAddonCompartmentClick
Expand Down
19 changes: 17 additions & 2 deletions Libs/AceGUI-3.0-NosheiWidgets/CheckBox-Extended.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,23 @@ Scripts
local function Control_OnEnter(frame)
local self = frame.obj
self.background:SetVertexColor(0.35, 0.35, 0.35, 1)
frame.obj:Fire("OnEnter")
if self.border:GetTexture() then
GameTooltip:SetOwner(frame, self:GetTooltipAnchor())
GameTooltip:SetHyperlink(self.text:GetText())
GameTooltip:Show()
else
frame.obj:Fire("OnEnter")
end
end

local function Control_OnLeave(frame)
local self = frame.obj
self.background:SetVertexColor(0, 0, 0, 0)
frame.obj:Fire("OnLeave")
if self.border:GetTexture() then
GameTooltip:Hide()
else
frame.obj:Fire("OnLeave")
end
end

local function CheckBox_OnMouseDown(frame)
Expand Down Expand Up @@ -293,6 +303,11 @@ local methods = {
overlay:SetAtlas(path, true)
end
end,

["GetTooltipAnchor"] = function(self)
local x = self.frame:GetRight() / GetScreenWidth() > 0.8
return x and 'ANCHOR_LEFT' or 'ANCHOR_RIGHT'
end
}

--[[-----------------------------------------------------------------------------
Expand Down

0 comments on commit 6ba4060

Please sign in to comment.