From 4b7ea4a098a081c0f9efa8e52a804108cd54186e Mon Sep 17 00:00:00 2001 From: evil_morfar <10189576+evil-morfar@users.noreply.github.com> Date: Fri, 4 Nov 2022 09:29:18 +0100 Subject: [PATCH 1/8] Removed deprecated calls to "GetContainer"* --- .luacheckrc | 14 +------------- .../Integration/ItemStorage/ItemRestore.spec.lua | 6 ++++-- .specs/Integration/Trade/FullTradeFlow.spec.lua | 6 ++++-- Modules/TradeUI.lua | 5 +++-- Utils/ItemStorage.lua | 8 ++++---- Utils/Utils.lua | 3 ++- __tests/wow_api.lua | 1 + core.lua | 5 +++-- ml_core.lua | 3 ++- 9 files changed, 24 insertions(+), 27 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index 5d915b15..dd4a8b28 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -163,6 +163,7 @@ globals = { -- Namespaces "C_EncounterJournal", "C_DateAndTime", + "C_Container", "C_CurrencyInfo", "C_Item", "C_Map", @@ -2482,19 +2483,6 @@ globals = { "GetComparisonAchievementPoints", "GetComparisonCategoryNumAchievements", "GetComparisonStatistic", - "GetContainerFreeSlots", - "GetContainerItemCooldown", - "GetContainerItemDurability", - "GetContainerItemEquipmentSetInfo", - "GetContainerItemID", - "GetContainerItemInfo", - "GetContainerItemLink", - "GetContainerItemPurchaseCurrency", - "GetContainerItemPurchaseInfo", - "GetContainerItemPurchaseItem", - "GetContainerItemQuestInfo", - "GetContainerNumFreeSlots", - "GetContainerNumSlots", "GetContinentMapInfo", "GetContinentMaps", "GetContinentName", diff --git a/.specs/Integration/ItemStorage/ItemRestore.spec.lua b/.specs/Integration/ItemStorage/ItemRestore.spec.lua index 9a5c6516..342dc9dd 100644 --- a/.specs/Integration/ItemStorage/ItemRestore.spec.lua +++ b/.specs/Integration/ItemStorage/ItemRestore.spec.lua @@ -86,9 +86,11 @@ end) -- Global helpers -function _G.GetContainerNumSlots(bagID) return 10 end +function _G.C_Container.GetContainerNumSlots(bagID) return 10 end + + +function _G.C_Container.GetContainerItemLink(bagID, slotIndex) -function _G.GetContainerItemLink(bagID, slotIndex) if bagID ~= 2 or (bagID == 2 and slotIndex ~= 3) then return _G.Items_Array[math.random(100, #_G.Items_Array)] end -- bag 2, slot 3 return "|cff1eff00|Hitem:55555::::::::80:::::::::|h[Book of Glyph Mastery]|h|r" diff --git a/.specs/Integration/Trade/FullTradeFlow.spec.lua b/.specs/Integration/Trade/FullTradeFlow.spec.lua index ee51d13c..3e7a9f28 100644 --- a/.specs/Integration/Trade/FullTradeFlow.spec.lua +++ b/.specs/Integration/Trade/FullTradeFlow.spec.lua @@ -146,10 +146,12 @@ describe("#Integration #Trade #FullTradeFlow", function() end) -- Global helpers -function _G.GetContainerNumSlots(bagID) return 10 end +function _G.C_Container.GetContainerNumSlots(bagID) return 10 end + -- Lets say our item is always in bag 2, slot 3 -function _G.GetContainerItemLink(bagID, slotIndex) +function _G.C_Container.GetContainerItemLink(bagID, slotIndex) + if bagID ~= 2 or (bagID == 2 and slotIndex ~= 3) then return _G.Items_Array[math.random(100, #_G.Items_Array)] end -- bag 2, slot 3 return _G.Items_Array[1] diff --git a/Modules/TradeUI.lua b/Modules/TradeUI.lua index fec0f846..39f7ee14 100644 --- a/Modules/TradeUI.lua +++ b/Modules/TradeUI.lua @@ -32,7 +32,7 @@ local TRADE_ADD_DELAY = 0.100 -- sec -- lua local select, GetItemInfoInstant, pairs, ipairs, unpack, tinsert, wipe, format, GetTime, InitiateTrade = select, GetItemInfoInstant, pairs, ipairs, unpack, tinsert, wipe, format, GetTime, InitiateTrade --- GLOBALS: GetContainerNumSlots, ClickTradeButton, PickupContainerItem, ClearCursor, GetContainerItemInfo, GetContainerItemLink, GetTradePlayerItemInfo, +-- GLOBALS: ClickTradeButton, PickupContainerItem, ClearCursor, GetTradePlayerItemInfo, -- GLOBALS: IsModifiedClick, HandleModifiedItemClick, GetTradePlayerItemLink, Ambiguate function TradeUI:OnInitialize() @@ -332,7 +332,8 @@ local function addItemToTradeWindow (tradeBtn, Item) addon:Print(L["trade_item_to_trade_not_found"]) return addon.Log:E("TradeUI", "Item missing when attempting to trade", Item.link, TradeUI.tradeTarget) end - local _, _, _, _, _, _, link = GetContainerItemInfo(c, s) + local _, _, _, _, _, _, link = C_Container.GetContainerItemInfo(c, s) + if addon:ItemIsItem(link, Item.link) then -- Extra check, probably also redundant addon.Log:d("Trading", link, c,s) ClearCursor() diff --git a/Utils/ItemStorage.lua b/Utils/ItemStorage.lua index c84b7841..b2bafe98 100644 --- a/Utils/ItemStorage.lua +++ b/Utils/ItemStorage.lua @@ -61,8 +61,6 @@ local error, table, tostring, tinsert, tremove, type, select, FindInTableIf, tim ipairs = error, table, tostring, tinsert, tremove, type, select, FindInTableIf, time, tFilter, setmetatable, CopyTable, ipairs --- GLOBALS: GetContainerNumSlots, GetContainerItemLink, _G - function addon:InitItemStorage() -- Extract items from our SV. Could be more elegant db = self:Getdb() local Item; @@ -253,8 +251,10 @@ function private:findItemInBags(link) if link and link ~= "" then local c, s, t for container = 0, _G.NUM_BAG_SLOTS do - for slot = 1, GetContainerNumSlots(container) or 0 do - if addon:ItemIsItem(link, GetContainerItemLink(container, slot)) then -- We found it + for slot = 1, C_Container.GetContainerNumSlots(container) or 0 do + + if addon:ItemIsItem(link, C_Container.GetContainerItemLink(container, slot)) then -- We found it + addon.Log:D("Found item at", container, slot) c, s = container, slot -- Now we need to ensure we don't have multiple of it diff --git a/Utils/Utils.lua b/Utils/Utils.lua index 0321abfa..c0c9b161 100644 --- a/Utils/Utils.lua +++ b/Utils/Utils.lua @@ -123,7 +123,8 @@ end function Utils:GetNumFreeBagSlots() local result = 0 for i = 1, _G.NUM_BAG_SLOTS do - result = result + (GetContainerNumFreeSlots(i)) + result = result + (C_Container.GetContainerNumFreeSlots(i)) + end return result end diff --git a/__tests/wow_api.lua b/__tests/wow_api.lua index 7225e39c..ae5eeafe 100644 --- a/__tests/wow_api.lua +++ b/__tests/wow_api.lua @@ -921,6 +921,7 @@ function FauxScrollFrame_Update() end function FauxScrollFrame_GetOffset() return 0 end +C_Container = {} ------------------------------------------ -- Constants from various places ------------------------------------------ diff --git a/core.lua b/core.lua index 892f8532..b0a1b646 100644 --- a/core.lua +++ b/core.lua @@ -1304,10 +1304,11 @@ end function RCLootCouncil:GetAllItemsInBagsWithTradeTimer() local items = {} for container=0, _G.NUM_BAG_SLOTS do - for slot=1, GetContainerNumSlots(container) or 0 do + for slot=1, C_Container.GetContainerNumSlots(container) or 0 do local time =self:GetContainerItemTradeTimeRemaining(container, slot) if time > 0 and time < math.huge then - tinsert(items, GetContainerItemLink(container, slot)) + tinsert(items, C_Container.GetContainerItemLink(container, slot)) + end end end diff --git a/ml_core.lua b/ml_core.lua index 21b6dadb..f0cb1a4f 100644 --- a/ml_core.lua +++ b/ml_core.lua @@ -574,7 +574,8 @@ function RCLootCouncilML:HaveFreeSpaceForItem(item) end -- Get the bag's family for bag = BACKPACK_CONTAINER, NUM_BAG_SLOTS do - local freeSlots, bagFamily = GetContainerNumFreeSlots(bag) + local freeSlots, bagFamily = C_Container.GetContainerNumFreeSlots(bag) + if freeSlots and freeSlots > 0 and (bagFamily == 0 or bit.band(itemFamily, bagFamily) > 0) then return true end From 9ee34cc8086966e4ff77f6d970f155896babe0f0 Mon Sep 17 00:00:00 2001 From: evil_morfar <10189576+evil-morfar@users.noreply.github.com> Date: Fri, 4 Nov 2022 09:29:58 +0100 Subject: [PATCH 2/8] Forgot to update .toc versions --- RCLootCouncil.toc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RCLootCouncil.toc b/RCLootCouncil.toc index 80931198..c3370e61 100644 --- a/RCLootCouncil.toc +++ b/RCLootCouncil.toc @@ -1,8 +1,8 @@ ## Author: Potdisc ## Interface: 100000 -## Notes: Interface for running a Loot Council v3.4.0 +## Notes: Interface for running a Loot Council v3.5.1 ## Title: RCLootCouncil -## Version: 3.4.0 +## Version: 3.5.1 ## SavedVariables: RCLootCouncilDB, RCLootCouncilLootDB ## OptionalDeps: LibStub, CallbackHandler-1.0, Ace3, lib-st, LibWindow-1.1, LibDialog-1.0 From 7957fe8125607ad6b38ce0a7d2ff97320374024d Mon Sep 17 00:00:00 2001 From: evil_morfar <10189576+evil-morfar@users.noreply.github.com> Date: Wed, 9 Nov 2022 16:17:53 +0100 Subject: [PATCH 3/8] Fixed issue with closing options menu --- Modules/options.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Modules/options.lua b/Modules/options.lua index 01f35c91..4dd1f3cd 100644 --- a/Modules/options.lua +++ b/Modules/options.lua @@ -310,7 +310,7 @@ function addon:OptionsTable() desc = L["test_desc"], type = "execute", func = function() - SettingsPanel:ExitWithoutCommit() -- close all option frames before testing + HideUIPanel(SettingsPanel) -- close all option frames before testing self:Test(3) end, }, @@ -320,7 +320,7 @@ function addon:OptionsTable() type = "execute", order = 9, func = function() - SettingsPanel:ExitWithoutCommit() + HideUIPanel(SettingsPanel) LibStub("AceConfigDialog-3.0"):CloseAll() addon:CallModule("version") end, @@ -331,7 +331,7 @@ function addon:OptionsTable() desc = L["Opens the synchronizer"], type = "execute", func = function() - SettingsPanel:ExitWithoutCommit() + HideUIPanel(SettingsPanel) LibStub("AceConfigDialog-3.0"):CloseAll() self.Sync:Enable() end, @@ -472,7 +472,7 @@ function addon:OptionsTable() name = L["Open the Loot History"], desc = L["open_the_loot_history_desc"], type = "execute", - func = function() self:CallModule("history"); SettingsPanel:ExitWithoutCommit();end, + func = function() self:CallModule("history"); HideUIPanel(SettingsPanel);end, }, clearLootDB = { order = 6, From 8355949e4cac9f824c34da23cf59c1729e7c14d9 Mon Sep 17 00:00:00 2001 From: nnp Date: Sat, 12 Nov 2022 23:17:56 +0100 Subject: [PATCH 4/8] Added checkmark. Session buttons now also shows a checkmark on awarded items. Untested. --- Modules/votingFrame.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Modules/votingFrame.lua b/Modules/votingFrame.lua index 43a89e47..5f828bae 100644 --- a/Modules/votingFrame.lua +++ b/Modules/votingFrame.lua @@ -1193,14 +1193,20 @@ function RCVotingFrame:UpdateSessionButton(i, texture, link, awarded) btn:SetPoint("TOP", sessionButtons[i-1], "BOTTOM", 0, -2) end btn:SetScript("Onclick", function() RCVotingFrame:SwitchSession(i); end) + btn.check = btn:CreateTexture("RCSessionButton"..i.."CheckMark", "BACKGROUND") + btn.check:SetTexture("interface/raidframe/readycheck-ready") + btn.check:SetAllPoints() + btn.check:Hide() end -- then update it btn:SetNormalTexture(texture or "Interface\\InventoryItems\\WoWUnknownItem01") + btn.check:Hide() local lines = { format(L["Click to switch to 'item'"], link) } if i == session then btn:SetBorderColor("yellow") elseif awarded then btn:SetBorderColor("green") + btn.check:Show() tinsert(lines, L["This item has been awarded"]) else btn:SetBorderColor("white") -- white From 015410182db2e91c3a0830aaace8c28f4831c9d5 Mon Sep 17 00:00:00 2001 From: evil_morfar <10189576+evil-morfar@users.noreply.github.com> Date: Fri, 18 Nov 2022 15:58:30 +0100 Subject: [PATCH 5/8] Added tostring to modules --- Classes/Core.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Classes/Core.lua b/Classes/Core.lua index 1fe79402..89d102cd 100644 --- a/Classes/Core.lua +++ b/Classes/Core.lua @@ -8,9 +8,11 @@ local private = {modules = {}, initOrder = {}} addon.ModuleData = {} local MODULE_MT = { __index = { + _name = "Unknown", OnInitialize = addon.noop, OnEnable = addon.noop - } + }, + __tostring = function(self) return self._name end } --- Initializes a shareable module @@ -22,7 +24,7 @@ function addon.Init(path) if private.modules[path] then error("Module already exists for path: " .. tostring(path)) end - local Module = setmetatable({}, MODULE_MT) + local Module = setmetatable({_name = path}, MODULE_MT) private.modules[path] = Module tinsert(private.initOrder, path) tinsert(addon.ModuleData, Module) From 20afc657b72f968cd8bc6cf9f7ee58bc70307b70 Mon Sep 17 00:00:00 2001 From: evil_morfar <10189576+evil-morfar@users.noreply.github.com> Date: Fri, 18 Nov 2022 16:31:26 +0100 Subject: [PATCH 6/8] Updated session button layering. This ensures checkmark and border are visible --- Modules/votingFrame.lua | 3 ++- changelog.md | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Modules/votingFrame.lua b/Modules/votingFrame.lua index 5f828bae..f404597b 100644 --- a/Modules/votingFrame.lua +++ b/Modules/votingFrame.lua @@ -1193,13 +1193,14 @@ function RCVotingFrame:UpdateSessionButton(i, texture, link, awarded) btn:SetPoint("TOP", sessionButtons[i-1], "BOTTOM", 0, -2) end btn:SetScript("Onclick", function() RCVotingFrame:SwitchSession(i); end) - btn.check = btn:CreateTexture("RCSessionButton"..i.."CheckMark", "BACKGROUND") + btn.check = btn:CreateTexture("RCSessionButton"..i.."CheckMark", "OVERLAY") btn.check:SetTexture("interface/raidframe/readycheck-ready") btn.check:SetAllPoints() btn.check:Hide() end -- then update it btn:SetNormalTexture(texture or "Interface\\InventoryItems\\WoWUnknownItem01") + btn:GetNormalTexture():SetDrawLayer("BACKGROUND") btn.check:Hide() local lines = { format(L["Click to switch to 'item'"], link) } if i == session then diff --git a/changelog.md b/changelog.md index deed70ce..b29ec50a 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,14 @@ ## Changes +### Checkmark + +Awarded items now also has a checkmark overlay on their session button. + +# v3.5.0 + +## Changes + ### Dragonflight Updated for Dragonflight prepatch. From 92dcc1a1af58404ba453db4aee87c226659db156 Mon Sep 17 00:00:00 2001 From: evil_morfar <10189576+evil-morfar@users.noreply.github.com> Date: Fri, 18 Nov 2022 16:32:06 +0100 Subject: [PATCH 7/8] Update changelog --- changelog.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index b29ec50a..06c41060 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,4 @@ -# v3.5.0 +# v3.5.1 ## Changes @@ -6,6 +6,10 @@ Awarded items now also has a checkmark overlay on their session button. +## Bugfixes + +- *Fixed error when clicking buttons in the options menu.* + # v3.5.0 ## Changes From 82f6660386bb581988e89519e46f302c5a1f6d4f Mon Sep 17 00:00:00 2001 From: evil_morfar <10189576+evil-morfar@users.noreply.github.com> Date: Fri, 18 Nov 2022 16:32:54 +0100 Subject: [PATCH 8/8] Update toc version --- RCLootCouncil.toc | 2 +- changelog.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/RCLootCouncil.toc b/RCLootCouncil.toc index c3370e61..c001f389 100644 --- a/RCLootCouncil.toc +++ b/RCLootCouncil.toc @@ -1,5 +1,5 @@ ## Author: Potdisc -## Interface: 100000 +## Interface: 100002 ## Notes: Interface for running a Loot Council v3.5.1 ## Title: RCLootCouncil ## Version: 3.5.1 diff --git a/changelog.md b/changelog.md index 06c41060..a96870eb 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,8 @@ ## Changes +Updated for prepatch phase 2. + ### Checkmark Awarded items now also has a checkmark overlay on their session button.