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/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) 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/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, diff --git a/Modules/votingFrame.lua b/Modules/votingFrame.lua index 43a89e47..f404597b 100644 --- a/Modules/votingFrame.lua +++ b/Modules/votingFrame.lua @@ -1193,14 +1193,21 @@ 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", "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 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 diff --git a/RCLootCouncil.toc b/RCLootCouncil.toc index 80931198..c001f389 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 +## Interface: 100002 +## 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 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/changelog.md b/changelog.md index deed70ce..a96870eb 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,17 @@ +# v3.5.1 + +## Changes + +Updated for prepatch phase 2. + +### Checkmark + +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 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