Skip to content

Commit

Permalink
Bugfix Release! (#150)
Browse files Browse the repository at this point in the history
* Fixed masque issues for Classic.

* Added a guard to fix a bug for an invalid WoW API return.

* Removed keys from the main view for grid view.

* Fixed a bug where currency items were not being released properly.
  • Loading branch information
Cidan authored Feb 19, 2024
1 parent c18fc30 commit e05495d
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 25 deletions.
12 changes: 7 additions & 5 deletions data/equipmentsets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ function equipmentSets:Update()
for _, setID in ipairs(sets) do
local setName = C_EquipmentSet.GetEquipmentSetInfo(setID)
local setLocations = C_EquipmentSet.GetItemLocations(setID)
for _, location in pairs(setLocations) do
local _, bank, bags, _, slot, bag = EquipmentManager_UnpackLocation(location)
if (bank or bags) and slot ~= nil and bag ~= nil then
self.bagAndSlotToSet[bag] = self.bagAndSlotToSet[bag] or {}
self.bagAndSlotToSet[bag][slot] = setName
if setLocations ~= nil then -- This is a bugfix for #113, no idea why this would return nil.
for _, location in pairs(setLocations) do
local _, bank, bags, _, slot, bag = EquipmentManager_UnpackLocation(location)
if (bank or bags) and slot ~= nil and bag ~= nil then
self.bagAndSlotToSet[bag] = self.bagAndSlotToSet[bag] or {}
self.bagAndSlotToSet[bag][slot] = setName
end
end
end
end
Expand Down
17 changes: 6 additions & 11 deletions frames/classic/bagbutton.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ function BagButtonFrame.bagButtonProto:SetBag(bag)
for i, id in ipairs(const.BANK_ONLY_BAGS_LIST) do
if slotsPurchased >= i and id == self.bag then
self.canBuy = false
self.frame.ItemSlotBackground:SetVertexColor(1.0,1.0,1.0)
self.frame:GetNormalTexture():SetVertexColor(1.0,1.0,1.0)
elseif id == self.bag then
self.canBuy = true
self.frame.ItemSlotBackground:SetVertexColor(1.0,0.1,0.1)
self.frame:GetNormalTexture():SetVertexColor(1.0,0.1,0.1)
end
end
else
Expand All @@ -47,14 +47,12 @@ function BagButtonFrame.bagButtonProto:SetBag(bag)
local hasItem = not not icon
if hasItem then
--TODO(lobato): Set count, other properties
self.frame.ItemSlotBackground:SetTexture(icon)
self.frame.ItemSlotBackground:SetVertexColor(1.0,1.0,1.0)
self.frame.ItemSlotBackground:Show()
SetItemButtonTexture(self.frame, icon)
self.frame:GetNormalTexture():SetVertexColor(1.0,1.0,1.0)
self.empty = false
else
local _, texture = GetInventorySlotInfo("Bag"..bag)
self.frame.ItemSlotBackground:SetTexture(texture)
self.frame.ItemSlotBackground:Show()
SetItemButtonTexture(self.frame, texture)
--icon = [[Interface\PaperDoll\UI-PaperDoll-Slot-Bag]]
--self.frame.ItemSlotBackground:Show()
self.empty = true
Expand All @@ -72,8 +70,7 @@ function BagButtonFrame.bagButtonProto:ClearBag()
self.empty = nil
self.kind = nil
self.canBuy = nil
self.frame.ItemSlotBackground:SetVertexColor(1.0,1.0,1.0)
self.frame.ItemSlotBackground:Hide()
self.frame:GetNormalTexture():SetVertexColor(1.0,1.0,1.0)
--SetItemButtonTexture(self.frame, nil)
--SetItemButtonQuality(self.frame, nil)
end
Expand All @@ -95,10 +92,8 @@ function BagButtonFrame:_DoCreate()
f:SetScript("OnDragStart", function() b:OnDragStart() end)
f:SetScript("OnReceiveDrag", function() b:OnReceiveDrag() end)
b.frame = f
f.ItemSlotBackground = f:CreateTexture(nil, "BACKGROUND")
--f.ItemSlotBackground:SetTexture([[Interface\PaperDoll\UI-Backpack-EmptySlot]])
--f.ItemSlotBackground:SetTexture(texture)
f.ItemSlotBackground:SetAllPoints(f);
--f.ItemSlotBackground:Hide()
return b
end
Expand Down
12 changes: 6 additions & 6 deletions frames/classic/item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ function itemFrame.itemProto:SetItem(data)
self.button.IconBorder:Show()
SetItemButtonCount(self.button, data.itemInfo.currentItemCount)
SetItemButtonDesaturated(self.button, data.itemInfo.isLocked)
self.IconQuestTexture:Hide()
self:SetLock(data.itemInfo.isLocked)
if data.bagid ~= nil then
ContainerFrame_UpdateCooldown(data.bagid, self.button)
Expand All @@ -110,7 +111,6 @@ function itemFrame.itemProto:SetItem(data)
--self.button:SetItemButtonTexture(data.itemInfo.itemIcon)
--self.button.
--[[
self.button.ItemSlotBackground:Hide()
ClearItemButtonOverlay(self.button)
self.button:SetHasItem(data.itemInfo.itemIcon)
self.button:SetItemButtonTexture(data.itemInfo.itemIcon)
Expand Down Expand Up @@ -157,7 +157,11 @@ function itemFrame.itemProto:SetFreeSlots(bagid, slotid, count, reagent)
SetItemButtonCount(self.button, count)
SetItemButtonQuality(self.button, false)
SetItemButtonDesaturated(self.button, false)
SetItemButtonTexture(self.button, 0)
SetItemButtonTexture(self.button, [[Interface\PaperDoll\UI-Backpack-EmptySlot]])
self.button.IconBorder:SetTexture([[Interface\Common\WhiteIconFrame]])
self.button.IconBorder:SetVertexColor(unpack(const.ITEM_QUALITY_COLOR[Enum.ItemQuality.Common]))
self.button.IconBorder:Show()
self.IconQuestTexture:Hide()
self.button.BattlepayItemTexture:SetShown(false)
self.button.NewItemTexture:Hide()
self.ilvlText:SetText("")
Expand Down Expand Up @@ -200,7 +204,6 @@ function itemFrame.itemProto:ClearItem()
self.button.BattlepayItemTexture:SetShown(false)
self.button.NewItemTexture:Hide()
--ClearItemButtonOverlay(self.button)
--self.button.ItemSlotBackground:Hide()
self.frame:SetID(0)
self.button:SetID(0)
self.button.minDisplayCount = 1
Expand Down Expand Up @@ -265,9 +268,6 @@ function itemFrame:_DoCreate()
me.searchOverlay:Show()
end
end
button.ItemSlotBackground = button:CreateTexture(nil, "BACKGROUND");
button.ItemSlotBackground:SetAllPoints(button)
button.ItemSlotBackground:SetTexture([[Interface\PaperDoll\UI-Backpack-EmptySlot]])

button.GetInventorySlot = ButtonInventorySlot
button.UpdateTooltip = function() i:UpdateTooltip() end
Expand Down
1 change: 1 addition & 0 deletions frames/classic/itemrow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function item.itemRowProto:SetItem(data)
self.button.ilvlText:Hide()
self.button.LockTexture:Hide()
self.button.button.IconBorder:SetSize(20, 20)
self.button.button:GetNormalTexture():SetSize(20, 20)

if bagid then
self.frame:SetID(bagid)
Expand Down
1 change: 0 additions & 1 deletion frames/column.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ end
function columnProto:RemoveAll()
for _, cell in pairs(self.cells) do
cell.frame:SetParent(nil)
cell.frame:ClearAllPoints()
end
wipe(self.cells)
wipe(self.idToCell)
Expand Down
8 changes: 8 additions & 0 deletions frames/currency.lua
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ function CurrencyFrame:GetCurrencyItem(index, info)
end

function CurrencyFrame:Update()
for _, cell in pairs(self.iconGrid.cells) do
---@cast cell CurrencyItem
cell:Release()
end
self.iconGrid:Wipe()
local index = 1
local showCount = 0
Expand Down Expand Up @@ -171,6 +175,10 @@ function CurrencyFrame:Update()
self.iconGrid:GetContainer():SetSize(w, h)
end

---@param index number
---@param header boolean
---@param nobackdrop? boolean
---@return CurrencyItem
function CurrencyFrame:CreateCurrencyItem(index, header, nobackdrop)
local item = setmetatable({}, {__index = CurrencyItem})
item.frame = CreateFrame("Frame", nil, nil, "BackdropTemplate") --[[@as Frame]]
Expand Down
4 changes: 2 additions & 2 deletions views/gridview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ local function GridView(view, bag, dirtyItems)
itemButton:SetItem(data)
end

-- Add the item to the correct category section.
if (not bag.slots:IsShown() and not data.isItemEmpty) or (bag.slots:IsShown()) then
-- Add the item to the correct category section, skipping the keyring unless we're showing bag slots.
if (not bag.slots:IsShown() and not data.isItemEmpty and bagid ~= Enum.BagIndex.Keyring) or (bag.slots:IsShown()) then
local category = itemButton:GetCategory()
local section = view:GetOrCreateSection(category)
section:AddCell(slotkey, itemButton)
Expand Down

0 comments on commit e05495d

Please sign in to comment.