feat: pin slot
This commit is contained in:
+16
-7
@@ -642,7 +642,7 @@ end
|
|||||||
-- PHASE 2: Specialized Item Routing
|
-- PHASE 2: Specialized Item Routing
|
||||||
--===========================================================================
|
--===========================================================================
|
||||||
|
|
||||||
local function RouteSpecializedItems(bagIDs, containers)
|
local function RouteSpecializedItems(bagIDs, containers, pinnedSlots)
|
||||||
local routingPlan = {}
|
local routingPlan = {}
|
||||||
|
|
||||||
-- Scan all items and plan moves to specialized containers
|
-- Scan all items and plan moves to specialized containers
|
||||||
@@ -650,6 +650,8 @@ local function RouteSpecializedItems(bagIDs, containers)
|
|||||||
local numSlots = addon.Modules.Utils:GetBagSlotCount(bagID)
|
local numSlots = addon.Modules.Utils:GetBagSlotCount(bagID)
|
||||||
if numSlots and numSlots > 0 then
|
if numSlots and numSlots > 0 then
|
||||||
for slot = 1, numSlots do
|
for slot = 1, numSlots do
|
||||||
|
-- Skip pinned slots
|
||||||
|
if not (pinnedSlots and pinnedSlots[bagID * 1000 + slot]) then
|
||||||
local link = GetContainerItemLink(bagID, slot)
|
local link = GetContainerItemLink(bagID, slot)
|
||||||
if link then
|
if link then
|
||||||
local preferredType = addon.Modules.Utils:GetItemPreferredContainer(link)
|
local preferredType = addon.Modules.Utils:GetItemPreferredContainer(link)
|
||||||
@@ -665,7 +667,8 @@ local function RouteSpecializedItems(bagIDs, containers)
|
|||||||
if not foundSlot then
|
if not foundSlot then
|
||||||
local targetSlots = addon.Modules.Utils:GetBagSlotCount(targetBagID)
|
local targetSlots = addon.Modules.Utils:GetBagSlotCount(targetBagID)
|
||||||
for targetSlot = 1, targetSlots do
|
for targetSlot = 1, targetSlots do
|
||||||
if not GetContainerItemLink(targetBagID, targetSlot) then
|
if not GetContainerItemLink(targetBagID, targetSlot)
|
||||||
|
and not (pinnedSlots and pinnedSlots[targetBagID * 1000 + targetSlot]) then
|
||||||
table.insert(routingPlan, {
|
table.insert(routingPlan, {
|
||||||
fromBag = bagID,
|
fromBag = bagID,
|
||||||
fromSlot = slot,
|
fromSlot = slot,
|
||||||
@@ -681,6 +684,7 @@ local function RouteSpecializedItems(bagIDs, containers)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end -- pinned check
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -701,7 +705,7 @@ end
|
|||||||
-- PHASE 3: Stack Consolidation
|
-- PHASE 3: Stack Consolidation
|
||||||
--===========================================================================
|
--===========================================================================
|
||||||
|
|
||||||
local function ConsolidateStacks(bagIDs)
|
local function ConsolidateStacks(bagIDs, pinnedSlots)
|
||||||
local itemGroups = {}
|
local itemGroups = {}
|
||||||
|
|
||||||
-- Collect all items with their locations
|
-- Collect all items with their locations
|
||||||
@@ -709,6 +713,10 @@ local function ConsolidateStacks(bagIDs)
|
|||||||
local numSlots = addon.Modules.Utils:GetBagSlotCount(bagID)
|
local numSlots = addon.Modules.Utils:GetBagSlotCount(bagID)
|
||||||
if numSlots and numSlots > 0 then
|
if numSlots and numSlots > 0 then
|
||||||
for slot = 1, numSlots do
|
for slot = 1, numSlots do
|
||||||
|
-- Skip pinned slots
|
||||||
|
if pinnedSlots and pinnedSlots[bagID * 1000 + slot] then
|
||||||
|
-- do nothing
|
||||||
|
else
|
||||||
local link = GetContainerItemLink(bagID, slot)
|
local link = GetContainerItemLink(bagID, slot)
|
||||||
if link then
|
if link then
|
||||||
local texture, count = GetContainerItemInfo(bagID, slot)
|
local texture, count = GetContainerItemInfo(bagID, slot)
|
||||||
@@ -733,6 +741,7 @@ local function ConsolidateStacks(bagIDs)
|
|||||||
priority = tonumber(addon.Modules.Utils:GetContainerPriority(bagID)) or 0
|
priority = tonumber(addon.Modules.Utils:GetContainerPriority(bagID)) or 0
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
end -- pinned check
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1626,10 +1635,10 @@ function SortEngine:SortBagsPass()
|
|||||||
local containers = DetectSpecializedBags(bagIDs)
|
local containers = DetectSpecializedBags(bagIDs)
|
||||||
|
|
||||||
-- Phase 2: Route specialized items to their bags
|
-- Phase 2: Route specialized items to their bags
|
||||||
local routeCount = RouteSpecializedItems(bagIDs, containers)
|
local routeCount = RouteSpecializedItems(bagIDs, containers, pinnedSlots)
|
||||||
|
|
||||||
-- Phase 3: Consolidate stacks in ALL bags (including specialized)
|
-- Phase 3: Consolidate stacks in ALL bags (including specialized)
|
||||||
local consolidateCount = ConsolidateStacks(bagIDs)
|
local consolidateCount = ConsolidateStacks(bagIDs, pinnedSlots)
|
||||||
|
|
||||||
-- Phase 4: Sort items WITHIN each specialized bag (enchant, herb, soul, quiver, ammo)
|
-- Phase 4: Sort items WITHIN each specialized bag (enchant, herb, soul, quiver, ammo)
|
||||||
local specializedMoves = 0
|
local specializedMoves = 0
|
||||||
@@ -1782,10 +1791,10 @@ function SortEngine:SortBankPass()
|
|||||||
local containers = DetectSpecializedBags(bagIDs)
|
local containers = DetectSpecializedBags(bagIDs)
|
||||||
|
|
||||||
-- Phase 2: Route specialized items
|
-- Phase 2: Route specialized items
|
||||||
local routeCount = RouteSpecializedItems(bagIDs, containers)
|
local routeCount = RouteSpecializedItems(bagIDs, containers, pinnedSlots)
|
||||||
|
|
||||||
-- Phase 3: Consolidate stacks
|
-- Phase 3: Consolidate stacks
|
||||||
local consolidateCount = ConsolidateStacks(bagIDs)
|
local consolidateCount = ConsolidateStacks(bagIDs, pinnedSlots)
|
||||||
|
|
||||||
-- Phase 4: Sort items WITHIN each specialized bag (single pass)
|
-- Phase 4: Sort items WITHIN each specialized bag (single pass)
|
||||||
local specializedMoves = 0
|
local specializedMoves = 0
|
||||||
|
|||||||
+1
-1
@@ -1953,7 +1953,7 @@ function Guda_ItemButton_SetItem(self, bagID, slotID, itemData, isBank, otherCha
|
|||||||
end
|
end
|
||||||
self.categoryMarkIcon:SetPoint("BOTTOMLEFT", anchor, "BOTTOMLEFT", markOffX, markOffY)
|
self.categoryMarkIcon:SetPoint("BOTTOMLEFT", anchor, "BOTTOMLEFT", markOffX, markOffY)
|
||||||
self.categoryMarkIcon:SetTexture(categoryMarkTexture)
|
self.categoryMarkIcon:SetTexture(categoryMarkTexture)
|
||||||
self.categoryMarkIcon:SetVertexColor(0.85, 0.65, 0.13, 1)
|
self.categoryMarkIcon:SetVertexColor(1, 1, 1, 1)
|
||||||
self.categoryMarkIcon:SetAlpha(1)
|
self.categoryMarkIcon:SetAlpha(1)
|
||||||
self.categoryMarkIcon:Show()
|
self.categoryMarkIcon:Show()
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user