@@ -482,6 +482,9 @@ function Inventory:UpdateWindow()
482
482
self .hasHiddenGroups = false -- Updated in this function.
483
483
self .hasHiddenItems = false -- Updated in GetGroupItemCountForLayout().
484
484
self .hasChanges = false -- Updated in AssignItemsToSlots().
485
+ self .hasOpenables = false -- Updated in AssignItemsToSlots().
486
+ self .nextOpenableItemBagNum = nil -- Updated in AssignItemsToSlots().
487
+ self .nextOpenableItemSlotNum = nil -- Updated in AssignItemsToSlots().
485
488
486
489
-- Full reset of empty slot stack counts is needed so that the tracking of which
487
490
-- bag they represent is rebuilt.
@@ -1005,48 +1008,6 @@ function Inventory:UpdateWindow()
1005
1008
uiFrames .bagBar :Hide ()
1006
1009
end
1007
1010
1008
- -- Variables for hearthstone button position based on whether money frame is shown.
1009
- local hearthButtonAnchorToFrame = uiButtons .toolbar .hearthstone .bagshuiData .defaultAnchorToFrame
1010
- local hearthButtonAnchorToPoint = uiButtons .toolbar .hearthstone .bagshuiData .defaultAnchorToPoint
1011
-
1012
- -- Show/hide Money frame.
1013
- if self .settings .showMoney then
1014
- uiFrames .money :Show ()
1015
- uiFrames .money :SetAlpha (self .editMode and 0.2 or 1 )
1016
- -- Use label colors for money text.
1017
- for _ , text in pairs (uiFrames .money .bagshuiData .texts ) do
1018
- text :SetTextColor (self .settings .groupLabelDefault [1 ], self .settings .groupLabelDefault [2 ], self .settings .groupLabelDefault [3 ], self .settings .groupLabelDefault [4 ])
1019
- end
1020
- else
1021
- uiFrames .money :Hide ()
1022
- -- Move the hearthstone button to the money frame's position.
1023
- _ , hearthButtonAnchorToFrame , hearthButtonAnchorToPoint = uiFrames .money :GetPoint (1 )
1024
- end
1025
-
1026
- -- Show/hide Hearthstone button.
1027
- if
1028
- self .hearthButton
1029
- and self .settings .showFooter
1030
- and self .settings .showHearthstone
1031
- and self .hearthstoneItemRef
1032
- then
1033
- uiButtons .toolbar .hearthstone :SetPoint (
1034
- " RIGHT" ,
1035
- hearthButtonAnchorToFrame ,
1036
- hearthButtonAnchorToPoint ,
1037
- uiButtons .toolbar .hearthstone .bagshuiData .defaultXOffset ,
1038
- 0
1039
- )
1040
- uiButtons .toolbar .hearthstone :Show ()
1041
-
1042
- -- Display cooldown.
1043
- local cooldownStart , cooldownDuration , isOnCooldown = _G .GetContainerItemCooldown (self .hearthstoneItemRef .bagNum , self .hearthstoneItemRef .slotNum )
1044
- self .ui :SetIconButtonCooldown (uiButtons .toolbar .hearthstone , cooldownStart , cooldownDuration , isOnCooldown )
1045
-
1046
- else
1047
- uiButtons .toolbar .hearthstone :Hide ()
1048
- end
1049
-
1050
1011
-- Apply bag bar scaling and opacity.
1051
1012
local bagBarScale = (itemSlotSize / uiButtons .itemSlots [1 ].bagshuiData .originalSizeAdjusted ) * BsSkin .bagBarScale
1052
1013
uiFrames .bagBar :SetScale (bagBarScale )
@@ -1061,7 +1022,6 @@ function Inventory:UpdateWindow()
1061
1022
end
1062
1023
end
1063
1024
1064
-
1065
1025
-- Determine footer height based on whether the bag bar is visible.
1066
1026
local footerHeight = self .settings .showBagBar
1067
1027
and (uiButtons .itemSlots [1 ].bagshuiData .originalSizeAdjusted * bagBarScale ) -- Bag bar visible.
@@ -1276,6 +1236,16 @@ function Inventory:AssignItemsToSlots(
1276
1236
self .hasChanges = true
1277
1237
end
1278
1238
1239
+ -- Should the Clam button be enabled?
1240
+ if item .openable == 1 then
1241
+ self .hasOpenables = true
1242
+ -- The first openable item we come across will be the one the Clam button targets.
1243
+ if not self .nextOpenableItemBagNum then
1244
+ self .nextOpenableItemBagNum = item .bagNum
1245
+ self .nextOpenableItemSlotNum = item .slotNum
1246
+ end
1247
+ end
1248
+
1279
1249
-- Increment counters.
1280
1250
itemsPlacedInCurrentRow = itemsPlacedInCurrentRow + 1
1281
1251
currentItemSlotButtonNum = currentItemSlotButtonNum + 1
@@ -1951,7 +1921,7 @@ function Inventory:UpdateToolbar()
1951
1921
self .ui :SetIconButtonColors (button )
1952
1922
end
1953
1923
1954
- -- State buttons.
1924
+ -- State buttons .
1955
1925
self :SetToolbarButtonState (toolbarButtons .offline , (not self .online ))
1956
1926
self :SetToolbarButtonState (toolbarButtons .error , (string.len (self .errorText or " " ) > 0 ))
1957
1927
self :SetToolbarButtonState (toolbarButtons .editMode , self .editMode , nil , self .editMode )
@@ -1980,9 +1950,75 @@ function Inventory:UpdateToolbar()
1980
1950
toolbarButtons .offline .bagshuiData .tooltipText = nil
1981
1951
end
1982
1952
1953
+ -- Money frame.
1954
+ if self .settings .showMoney then
1955
+ self .ui .frames .money :Show ()
1956
+ self .ui .frames .money :SetAlpha (self .editMode and 0.2 or 1 )
1957
+ -- Use label colors for money text.
1958
+ for _ , text in pairs (self .ui .frames .money .bagshuiData .texts ) do
1959
+ text :SetTextColor (self .settings .groupLabelDefault [1 ], self .settings .groupLabelDefault [2 ], self .settings .groupLabelDefault [3 ], self .settings .groupLabelDefault [4 ])
1960
+ end
1961
+ else
1962
+ self .ui .frames .money :Hide ()
1963
+ end
1964
+
1965
+ -- Hearthstone button.
1966
+ if
1967
+ self .hearthButton
1968
+ and self .settings .showFooter
1969
+ and self .settings .showHearthstone
1970
+ and self .hearthstoneItemRef
1971
+ then
1972
+ toolbarButtons .hearthstone :Show ()
1973
+
1974
+ -- Display cooldown.
1975
+ local cooldownStart , cooldownDuration , isOnCooldown = _G .GetContainerItemCooldown (self .hearthstoneItemRef .bagNum , self .hearthstoneItemRef .slotNum )
1976
+ self .ui :SetIconButtonCooldown (toolbarButtons .hearthstone , cooldownStart , cooldownDuration , isOnCooldown )
1977
+
1978
+ else
1979
+ toolbarButtons .hearthstone :Hide ()
1980
+ end
1981
+
1982
+ -- Clam (open container) button.
1983
+ self :SetToolbarButtonState (
1984
+ toolbarButtons .clam ,
1985
+ (
1986
+ self .clamButton
1987
+ and self .settings .showClam
1988
+ or false
1989
+ ),
1990
+ self .hasOpenables and not self .editMode
1991
+ )
1992
+
1993
+ -- Disenchant button.
1994
+ self :SetToolbarButtonState (
1995
+ toolbarButtons .disenchant ,
1996
+ (
1997
+ self .disenchantButton
1998
+ and BsCharacter .spellNamesToIds [toolbarButtons .disenchant .bagshuiData .spellName ]
1999
+ and self .settings .showDisenchant
2000
+ or false
2001
+ ),
2002
+ not self .editMode
2003
+ )
2004
+
2005
+ -- Pick Lock button.
2006
+ self :SetToolbarButtonState (
2007
+ toolbarButtons .pickLock ,
2008
+ (
2009
+ self .pickLockButton
2010
+ and BsCharacter .spellNamesToIds [toolbarButtons .pickLock .bagshuiData .spellName ]
2011
+ and self .settings .showPickLock
2012
+ or false
2013
+ ),
2014
+ not self .editMode
2015
+ )
2016
+
2017
+
1983
2018
-- Re-anchor all toolbar widgets based on visibility.
1984
- self :UpdateToolbarAnchoring (self .ui .ordering .leftToolbar , " LEFT" )
1985
- self :UpdateToolbarAnchoring (self .ui .ordering .rightToolbar , " RIGHT" )
2019
+ self :UpdateToolbarAnchoring (self .ui .ordering .topLeftToolbar , " LEFT" )
2020
+ self :UpdateToolbarAnchoring (self .ui .ordering .topRightToolbar , " RIGHT" )
2021
+ self :UpdateToolbarAnchoring (self .ui .ordering .bottomRightToolbar , " RIGHT" )
1986
2022
1987
2023
-- Disable unusable stuff in Edit Mode.
1988
2024
local editModeState = (self .editMode ) and " Disable" or " Enable"
@@ -2055,7 +2091,8 @@ end
2055
2091
--- @param widgetList (table | number )[] WoW UI widgets , in display order. Numbers are spacing directives that override the default.
2056
2092
--- @param anchorPoint " LEFT" | " RIGHT" Place to anchor each widget. This point will be anchored to the opposing point of the previous widget.
2057
2093
function Inventory :UpdateToolbarAnchoring (widgetList , anchorPoint )
2058
- local defaultOffset = (anchorPoint == " RIGHT" and - 1 or 1 ) * BsSkin .toolbarSpacing
2094
+ local invert = (anchorPoint == " RIGHT" and - 1 or 1 )
2095
+ local defaultOffset = invert * BsSkin .toolbarSpacing
2059
2096
local nextOffset
2060
2097
2061
2098
-- Go through the list of widgets in order, but skip the first one since
@@ -2064,8 +2101,8 @@ function Inventory:UpdateToolbarAnchoring(widgetList, anchorPoint)
2064
2101
local widget = widgetList [widgetPosition ]
2065
2102
-- Ignore spacing directives when finding widgets.
2066
2103
if type (widget ) == " table" and widget :IsShown () then
2067
- -- Assume default spacing.
2068
- nextOffset = defaultOffset
2104
+ -- Assume default spacing, adjusted if customized for the widget .
2105
+ nextOffset = defaultOffset + ( widget . bagshuiData and widget . bagshuiData . autoLayoutXOffset or 0 )
2069
2106
-- Walk backwards through the list of widgets and anchor to the first visible one.
2070
2107
for anchorPosition = widgetPosition - 1 , 1 , - 1 do
2071
2108
0 commit comments