Skip to content

Commit

Permalink
3.0.3
Browse files Browse the repository at this point in the history
Fixed issue causing Session data to be wrong after removing a filtered item from your inventory
Fixed error with Custom Filters
  • Loading branch information
Noshei committed Nov 2, 2024
1 parent 81c0ea1 commit ef815ba
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"C_Seasons"
],
"Lua.diagnostics.disable": [
"assign-type-mismatch"
"assign-type-mismatch",
"cast-local-type"
]
}
24 changes: 16 additions & 8 deletions Config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1236,11 +1236,13 @@ local filterOptions = {
GT.db.profile.CustomFilters = key
local tempFilterTable = {}
for itemID in string.gmatch(GT.db.profile.CustomFilters, "[%d]+") do
itemID = tonumber(itemID) or 0
if GT.db.profile.CustomFiltersTable[itemID] then
tempFilterTable[itemID] = GT.db.profile.CustomFiltersTable[itemID]
else
tempFilterTable[itemID] = true
end
GT:RemoveItemData(tempFilterTable[itemID], itemID)
end
GT.db.profile.CustomFiltersTable = tempFilterTable
GT:CreateCustomFilterOptions()
Expand Down Expand Up @@ -1376,9 +1378,8 @@ function GT:CreateCustomFilterOptions()
end
for id, value in pairs(GT.db.profile.CustomFiltersTable) do
--Create a local item to get data from the server
local itemID = tonumber(id) or 1
local item = Item:CreateFromItemID(itemID)
GT.Debug("Create Custom Filter Options", 2, itemID)
local item = Item:CreateFromItemID(id)
GT.Debug("Create Custom Filter Options", 2, id)
--Waits for the data to be returned from the server
if not item:IsItemEmpty() then
item:ContinueOnItemLoad(function()
Expand All @@ -1396,8 +1397,8 @@ function GT:CreateCustomFilterOptions()
GT.db.profile.CustomFiltersTable[id] = false
end

GT:UpdateIDTable(itemID, key)
GT:RemoveItemData(key, itemID)
GT:UpdateIDTable(id, key)
GT:RemoveItemData(key, id)
GT:InventoryUpdate("Filters Custom " .. itemName .. " option clicked", true)
end,
imageCoords = function()
Expand All @@ -1407,12 +1408,12 @@ function GT:CreateCustomFilterOptions()
local borderColor = {}
local overlay = {}

if itemID <= #GT.ItemData.Other.Other then
if id <= #GT.ItemData.Other.Other then
border = { "Interface\\Common\\WhiteIconFrame", "texture" }
borderColor = { 1, 1, 1, 0.8 }
overlay = nil
else
local rarity = C_Item.GetItemQualityByID(itemID) or 1
local rarity = C_Item.GetItemQualityByID(id) or 1
if rarity <= 1 then
border = { "Interface\\Common\\WhiteIconFrame", "texture" }
else
Expand All @@ -1429,7 +1430,7 @@ function GT:CreateCustomFilterOptions()

return data
end,
order = (itemID + 1000)
order = (id + 1000)
}
AceConfigRegistry:NotifyChange("GT/Filter")
end)
Expand Down Expand Up @@ -1490,6 +1491,13 @@ local function UpdateChangedorRemovedSavedVariables()
GT.db.profile.Filters["bag"] = nil
GT.db.profile.Filters[2] = true
end

for id, value in pairs(GT.db.profile.CustomFiltersTable) do
if type(id) ~= "number" then
GT.db.profile.CustomFiltersTable[id] = nil
GT.db.profile.CustomFiltersTable[tonumber(id)] = value
end
end
end

local function InitializePriceSource()
Expand Down
6 changes: 3 additions & 3 deletions FilterButton.lua
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ function GT:CreateCustomFiltersList(frame, rootDescription)
GT.Debug("Custom Filters Button Clicked", 2)
local key = not IsSelected_CustomFilter()
for id, data in pairs(GT.db.profile.CustomFiltersTable) do
GT.db.profile.CustomFiltersTable[tostring(id)] = key
GT.db.profile.CustomFiltersTable[id] = key
GT:UpdateIDTable(id, key)
GT:RemoveItemData(key, id)
end
Expand All @@ -381,12 +381,12 @@ function GT:CreateCustomFiltersList(frame, rootDescription)

for itemIndex, itemData in ipairs(customFiltersList) do
local function IsSelected_CustomFilterItem()
return GT.db.profile.CustomFiltersTable[tostring(itemData.id)]
return GT.db.profile.CustomFiltersTable[itemData.id]
end
local function SetSelected_CustomFilterItem()
GT.Debug("Custom Filter Item Button Clicked", 2, itemData.text)
local key = not IsSelected_CustomFilterItem()
GT.db.profile.CustomFiltersTable[tostring(itemData.id)] = key
GT.db.profile.CustomFiltersTable[itemData.id] = key

GT:UpdateIDTable(itemData.id, key)
GT:RemoveItemData(IsSelected_CustomFilterItem(), itemData.id)
Expand Down
5 changes: 5 additions & 0 deletions GatheringTracker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,11 @@ function GT:ProcessData(event)

GT.InventoryData[data.id].sessionCount =
GT.InventoryData[data.id].count - GT.InventoryData[data.id].startAmount

if GT.InventoryData[data.id].sessionCount < 0 then
GT.InventoryData[data.id].sessionCount = 0
GT.InventoryData[data.id].startAmount = itemCount
end
end

if GT.GlobalStartTime == 0 then
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.0.2
## Version: 3.0.3
## OptionalDeps: TradeSkillMaster, RECrystallize, Auctionator
## SavedVariables: GatheringTrackerDB
## AddonCompartmentFunc: GatheringTracker_OnAddonCompartmentClick
Expand Down

0 comments on commit ef815ba

Please sign in to comment.