feat: item tracking with ctrl + click

This commit is contained in:
Salikh Gurgenidze
2025-12-23 04:01:46 +04:00
parent bd8ac3e4b0
commit 8eeb2331bc
6 changed files with 13 additions and 66 deletions
+2 -2
View File
@@ -45,7 +45,7 @@ function DB:Initialize()
hoverBagline = false,
hideFooter = false,
bgTransparency = 0.15,
showTrackedItems = false,
showTrackedItems = true,
trackedItems = {},
},
}
@@ -70,7 +70,7 @@ function DB:Initialize()
Guda_CharDB.settings.showQuestBar = true
end
if Guda_CharDB.settings.showTrackedItems == nil then
Guda_CharDB.settings.showTrackedItems = false
Guda_CharDB.settings.showTrackedItems = true
end
if Guda_CharDB.settings.trackedItems == nil then
Guda_CharDB.settings.trackedItems = {}
+9 -6
View File
@@ -124,12 +124,15 @@ function Main:SetupSlashCommands()
addon:Print("Quest bar: %s", show and "ON" or "OFF")
elseif msg == "track" then
-- Toggle tracked items
local show = not addon.Modules.DB:GetSetting("showTrackedItems")
addon.Modules.DB:SetSetting("showTrackedItems", show)
if addon.Modules.TrackedItemBar then addon.Modules.TrackedItemBar:Update() end
if addon.Modules.BagFrame then addon.Modules.BagFrame:Update() end
addon:Print("Track items: %s", show and "ON" or "OFF")
-- Toggle tracked items bar visibility
local frame = Guda_TrackedItemBar
if frame then
if frame:IsShown() then
frame:Hide()
else
frame:Show()
end
end
elseif msg == "cleanup" then
-- Cleanup old characters
+2 -2
View File
@@ -544,7 +544,7 @@ function Guda_ItemButton_SetItem(self, bagID, slotID, itemData, isBank, otherCha
local check = getglobal(self:GetName().."_Check")
if check then
local isTracked = false
if self.hasItem and addon.Modules.DB:GetSetting("showTrackedItems") then
if self.hasItem then
local itemID = addon.Modules.Utils:ExtractItemID(self.itemData and self.itemData.link)
if itemID then
local trackedItems = addon.Modules.DB:GetSetting("trackedItems") or {}
@@ -771,7 +771,7 @@ function Guda_ItemButton_SetItem(self, bagID, slotID, itemData, isBank, otherCha
if not self.isReadOnly and not self.otherChar then
local old_OnClick = self:GetScript("OnClick")
self:SetScript("OnClick", function()
if IsControlKeyDown() and addon.Modules.DB:GetSetting("showTrackedItems") then
if IsControlKeyDown() then
local itemID = addon.Modules.Utils:ExtractItemID(GetContainerItemLink(this:GetParent():GetID(), this:GetID()))
if itemID then
local trackedItems = addon.Modules.DB:GetSetting("trackedItems") or {}
-32
View File
@@ -65,10 +65,6 @@ function Guda_SettingsPopup_OnShow(self)
if hoverBagline == nil then
hoverBagline = false
end
local showTrackedItems = Guda.Modules.DB:GetSetting("showTrackedItems")
if showTrackedItems == nil then
showTrackedItems = false
end
local bgTransparency = Guda.Modules.DB:GetSetting("bgTransparency") or 0.15
-- Update sliders and checkboxes
@@ -85,7 +81,6 @@ function Guda_SettingsPopup_OnShow(self)
local showSearchBarCheckbox = getglobal("Guda_SettingsPopup_ShowSearchBarCheckbox")
local showQuestBarCheckbox = getglobal("Guda_SettingsPopup_ShowQuestBarCheckbox")
local hoverBaglineCheckbox = getglobal("Guda_SettingsPopup_HoverBaglineCheckbox")
local showTrackedItemsCheckbox = getglobal("Guda_SettingsPopup_ShowTrackedItemsCheckbox")
if bagSlider then
bagSlider:SetValue(bagColumns)
@@ -139,9 +134,6 @@ function Guda_SettingsPopup_OnShow(self)
hoverBaglineCheckbox:SetChecked(hoverBagline and 1 or 0)
end
if showTrackedItemsCheckbox then
showTrackedItemsCheckbox:SetChecked(showTrackedItems and 1 or 0)
end
-- Update display (might be too tall for current frame size)
local frame = getglobal("Guda_SettingsPopup")
@@ -819,27 +811,3 @@ function SettingsPopup:Initialize()
Guda:Debug("Settings popup initialized")
end
-- Show Tracked Items Checkbox OnLoad
function Guda_SettingsPopup_ShowTrackedItemsCheckbox_OnLoad(self)
getglobal(self:GetName().."Text"):SetText("Track items")
local currentValue = Guda.Modules.DB:GetSetting("showTrackedItems")
if currentValue == nil then
currentValue = false
end
self:SetChecked(currentValue and 1 or 0)
end
-- Show Tracked Items Checkbox OnClick
function Guda_SettingsPopup_ShowTrackedItemsCheckbox_OnClick(self)
local isChecked = self:GetChecked()
Guda.Modules.DB:SetSetting("showTrackedItems", isChecked == 1)
if Guda.Modules.TrackedItemBar and Guda.Modules.TrackedItemBar.Update then
Guda.Modules.TrackedItemBar:Update()
end
-- Refresh bag frame to show/hide checkmarks
if Guda.Modules.BagFrame and Guda.Modules.BagFrame.Update then
Guda.Modules.BagFrame:Update()
end
end
-18
View File
@@ -343,24 +343,6 @@
</Scripts>
</CheckButton>
<!-- Show Tracked Items Checkbox -->
<CheckButton name="$parent_ShowTrackedItemsCheckbox" inherits="OptionsCheckButtonTemplate">
<Anchors>
<Anchor point="TOP" relativePoint="BOTTOM" relativeTo="$parent_HoverBaglineCheckbox">
<Offset>
<AbsDimension x="0" y="-8"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
Guda_SettingsPopup_ShowTrackedItemsCheckbox_OnLoad(this)
</OnLoad>
<OnClick>
Guda_SettingsPopup_ShowTrackedItemsCheckbox_OnClick(this)
</OnClick>
</Scripts>
</CheckButton>
</Frames>
<Scripts>
-6
View File
@@ -64,14 +64,8 @@ end
-- Update the bar buttons
function TrackedItemBar:Update()
local showTrackedItems = addon.Modules.DB:GetSetting("showTrackedItems")
local frame = Guda_TrackedItemBar
if showTrackedItems == false then
if frame then frame:Hide() end
return
end
if not frame then return end
frame:Show()