mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 08:24:44 +00:00
update bags and sort
This commit is contained in:
@@ -5,7 +5,7 @@ local LIP = LibStub("ItemPrice-1.1");
|
||||
|
||||
--Cache global variables
|
||||
--Lua functions
|
||||
local ipairs, pairs, pcall, tonumber, select, unpack = ipairs, pairs, pcall, tonumber, select, unpack
|
||||
local ipairs, pairs, pcall, tonumber, select, unpack, pcall = ipairs, pairs, pcall, tonumber, select, unpack, pcall
|
||||
local getn, tinsert, tremove, tsort, twipe = table.getn, table.insert, table.remove, table.sort, table.wipe
|
||||
local floor, mod = math.floor, math.mod
|
||||
local band = bit.band
|
||||
@@ -460,6 +460,7 @@ local blackListQueries = {}
|
||||
local function buildBlacklist(arg)
|
||||
for entry in pairs(arg) do
|
||||
local itemName = GetItemInfo(entry)
|
||||
|
||||
if itemName then
|
||||
blackList[itemName] = true
|
||||
elseif entry ~= "" then
|
||||
@@ -549,7 +550,6 @@ function B.FillBags(from, to)
|
||||
tinsert(specialtyBags, bag)
|
||||
end
|
||||
end
|
||||
|
||||
if getn(specialtyBags) > 0 then
|
||||
B:Fill(from, specialtyBags)
|
||||
end
|
||||
@@ -637,13 +637,40 @@ function B:StartStacking()
|
||||
end
|
||||
end
|
||||
|
||||
function B:StopStacking(message)
|
||||
local function RegisterUpdateDelayed()
|
||||
local shouldUpdateFade
|
||||
for _, bagFrame in pairs(B.BagFrames) do
|
||||
if bagFrame.registerUpdate then
|
||||
bagFrame:UpdateAllSlots()
|
||||
bagFrame.registerUpdate = nil -- call update and re-register events, keep this after UpdateAllSlots
|
||||
shouldUpdateFade = true -- we should refresh the bag search after sorting
|
||||
bagFrame:RegisterEvent("ITEM_LOCK_CHANGED")
|
||||
bagFrame:RegisterEvent("ITEM_UNLOCKED")
|
||||
bagFrame:RegisterEvent("BAG_UPDATE_COOLDOWN")
|
||||
bagFrame:RegisterEvent("BAG_UPDATE")
|
||||
if bagFrame.isBank then
|
||||
bagFrame:RegisterEvent("PLAYERBANKSLOTS_CHANGED")
|
||||
end
|
||||
end
|
||||
end
|
||||
if shouldUpdateFade then
|
||||
B:RefreshSearch() -- this will clear the bag lock look during a sort
|
||||
end
|
||||
end
|
||||
|
||||
function B:StopStacking(message, noUpdate)
|
||||
twipe(moves)
|
||||
twipe(moveTracker)
|
||||
moveRetries, lastItemID, lockStop, lastDestination, lastMove = 0, nil, nil, nil, nil, nil
|
||||
|
||||
self.SortUpdateTimer:Hide()
|
||||
|
||||
if not noUpdate then
|
||||
--Add a delayed update call, as BAG_UPDATE fires slightly delayed
|
||||
-- and we don't want the last few unneeded updates to be catched
|
||||
E:Delay(0.6, RegisterUpdateDelayed)
|
||||
end
|
||||
|
||||
if message then
|
||||
E:Print(message)
|
||||
end
|
||||
@@ -762,7 +789,7 @@ function B:DoMoves()
|
||||
lastItemID = moveID
|
||||
tremove(moves, i)
|
||||
|
||||
if moves[i-1] then
|
||||
if moves[i - 1] then
|
||||
WAIT_TIME = 0
|
||||
return
|
||||
end
|
||||
@@ -785,7 +812,7 @@ end
|
||||
function B:CommandDecorator(func, groupsDefaults)
|
||||
return function(groups)
|
||||
if self.SortUpdateTimer:IsShown() then
|
||||
B:StopStacking(L["Already Running.. Bailing Out!"])
|
||||
B:StopStacking(L["Already Running.. Bailing Out!"], true)
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user