Skip to content

Commit

Permalink
Showing 14 changed files with 56 additions and 36 deletions.
14 changes: 1 addition & 13 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -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",
6 changes: 4 additions & 2 deletions .specs/Integration/ItemStorage/ItemRestore.spec.lua
Original file line number Diff line number Diff line change
@@ -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"
6 changes: 4 additions & 2 deletions .specs/Integration/Trade/FullTradeFlow.spec.lua
Original file line number Diff line number Diff line change
@@ -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]
6 changes: 4 additions & 2 deletions Classes/Core.lua
Original file line number Diff line number Diff line change
@@ -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)
5 changes: 3 additions & 2 deletions Modules/TradeUI.lua
Original file line number Diff line number Diff line change
@@ -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()
8 changes: 4 additions & 4 deletions Modules/options.lua
Original file line number Diff line number Diff line change
@@ -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,
7 changes: 7 additions & 0 deletions Modules/votingFrame.lua
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions RCLootCouncil.toc
Original file line number Diff line number Diff line change
@@ -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

8 changes: 4 additions & 4 deletions Utils/ItemStorage.lua
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion Utils/Utils.lua
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions __tests/wow_api.lua
Original file line number Diff line number Diff line change
@@ -921,6 +921,7 @@ function FauxScrollFrame_Update() end

function FauxScrollFrame_GetOffset() return 0 end

C_Container = {}
------------------------------------------
-- Constants from various places
------------------------------------------
14 changes: 14 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -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
5 changes: 3 additions & 2 deletions core.lua
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion ml_core.lua
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit cba504a

Please sign in to comment.