diff --git a/DJBags.toc b/DJBags.toc index cbe0adf..39c2104 100644 --- a/DJBags.toc +++ b/DJBags.toc @@ -2,7 +2,7 @@ ## Title: DJBags ## Author: DarkJaguar91 ## Notes: BagAddon -## Version: 0.6.4 +## Version: 0.6.5 ## SavedVariables: DJBags_DB src/manifest.xml \ No newline at end of file diff --git a/src/lua/constants/contstants.lua b/src/lua/constants/contstants.lua index 6920a9f..2c8e570 100644 --- a/src/lua/constants/contstants.lua +++ b/src/lua/constants/contstants.lua @@ -22,6 +22,7 @@ DJBags_SETTING_TEXT_COLOR = 'djbags_text_color' DJBags_SETTING_PADDING = 'djbags_padding' DJBags_SETTING_SPACING = 'djbags_spacing' DJBags_SETTING_SCALE = 'djbags_scale' +DJBags_SETTING_CLEAR_NEW_ITEMS = 'djbags_clear_new_items' DJBags_SETTING_FORMATTER = 'djbags_formatter' DJBags_SETTING_FORMATTER_VERT = 'djbags_formatter_vert' DJBags_SETTING_FORMATTER_MAX_ITEMS = 'djbags_formatter_max_items' @@ -70,6 +71,7 @@ localeText['enUS'] = function() DJBags_LOCALE_MAX_ITEMS = 'Max items' DJBags_LOCALE_MAX_HEIGHT = 'Max height' DJBags_LOCALE_SOLD_JUNK = 'Sold junk for: %s' + DJBags_LOCALE_CLEAR_NEW_ITEMS = 'Clear new items on close' end localeText['deDE'] = function() @@ -102,6 +104,7 @@ localeText['deDE'] = function() DJBags_LOCALE_MAX_ITEMS = 'Max. Gegenstände' DJBags_LOCALE_MAX_HEIGHT = 'Max. Höhe' DJBags_LOCALE_SOLD_JUNK = 'Schrott verkauft für: %s' + DJBags_LOCALE_CLEAR_NEW_ITEMS = 'Clear new items on close' end localeText['zhTW'] = function() @@ -134,6 +137,7 @@ localeText['zhTW'] = function() DJBags_LOCALE_MAX_ITEMS = '分類寬度最多物品數目' DJBags_LOCALE_MAX_HEIGHT = '最大高度' DJBags_LOCALE_SOLD_JUNK = '賣出垃圾獲得: %s' + DJBags_LOCALE_CLEAR_NEW_ITEMS = 'Clear new items on close' end if localeText[GetLocale()] then diff --git a/src/lua/controller/bag.lua b/src/lua/controller/bag.lua index 29eab45..6ad4fe3 100644 --- a/src/lua/controller/bag.lua +++ b/src/lua/controller/bag.lua @@ -26,6 +26,10 @@ function DJBagsBagContainer_OnHide() ADDON.events:Remove('ITEM_LOCK_CHANGED', controller) ADDON.events:Remove('BAG_UPDATE_DELAYED', controller) ADDON.events:Remove('DJBAGS_BAG_HOVER', controller) + + if ADDON.settings:GetSettings(DJBags_TYPE_MAIN)[DJBags_SETTING_CLEAR_NEW_ITEMS] then + C_NewItems:ClearAll() + end end function DJDBagsBagsButton_OnClick(self) diff --git a/src/lua/settings/settingsController.lua b/src/lua/settings/settingsController.lua index 16eb664..6c3dfcc 100644 --- a/src/lua/settings/settingsController.lua +++ b/src/lua/settings/settingsController.lua @@ -25,6 +25,7 @@ function settings:Init() DJBags_DB[self.realm] = DJBags_DB[self.realm] or {} DJBags_DB[self.realm][self.player] = DJBags_DB[self.realm][self.player] or {} DJBags_DB[self.realm][self.player].userDefined = DJBags_DB[self.realm][self.player].userDefined or {} + DJBags_DB[self.realm][self.player].hiddenContainers = DJBags_DB[self.realm][self.player].hiddenContainers or {} DJBags_DB.userDefined = DJBags_DB.userDefined or {} @@ -34,6 +35,7 @@ function settings:Init() [DJBags_SETTING_SELL_JUNK] = false, [DJBags_SETTING_DEPOSIT_REAGENT] = false, [DJBags_SETTING_SCALE] = 1, + [DJBags_SETTING_CLEAR_NEW_ITEMS] = false, }, [DJBags_TYPE_CONTAINER] = { [DJBags_SETTING_BACKGROUND_COLOR] = {0, 0, 0, 0.6}, @@ -110,6 +112,18 @@ function settings:UpdateBag(bag, controller, list, force) end end +function settings:IsContainerHidden(container) + return DJBags_DB[self.realm][self.player].hiddenContainers[container] +end + +function settings:SetContainerHidden(container) + DJBags_DB[self.realm][self.player].hiddenContainers[container] = true +end + +function settings:SetContainerVisible(container) + DJBags_DB[self.realm][self.player].hiddenContainers[container] = nil +end + function settings:GetSettings(type) local settings = DJBags_DB[self.realm][self.player][type] or {} self:MigrateSettings(settings, self.default[type]or {}) diff --git a/src/lua/tools/boxFormatter.lua b/src/lua/tools/boxFormatter.lua index 107a6cd..410aa03 100644 --- a/src/lua/tools/boxFormatter.lua +++ b/src/lua/tools/boxFormatter.lua @@ -27,7 +27,7 @@ ADDON.format[DJBags_FORMATTER_BOX] = function(frame, _, maxHeight, cols, _, over local height = 0 for item in ADDON:PairsByKey(frame.items, sorter) do - if item:IsEmpty() then + if item:IsEmpty() or ADDON.settings:IsContainerHidden(item.name.text) then item:Hide() else item:ClearAllPoints() diff --git a/src/lua/tools/masonryFormatter.lua b/src/lua/tools/masonryFormatter.lua index 0c80681..3d9d560 100644 --- a/src/lua/tools/masonryFormatter.lua +++ b/src/lua/tools/masonryFormatter.lua @@ -35,7 +35,7 @@ ADDON.format[DJBags_FORMATTER_MASONRY] = function(frame, maxItems, _, _, vert, o end return ans end) do - if v:IsEmpty() then + if v:IsEmpty() or ADDON.settings:IsContainerHidden(v.name.text) then v:Hide() else v:Show() diff --git a/src/xml/settings/settingsContainer.xml b/src/xml/settings/settingsContainer.xml index 05370f1..5df8e42 100644 --- a/src/xml/settings/settingsContainer.xml +++ b/src/xml/settings/settingsContainer.xml @@ -85,7 +85,7 @@ </OnMouseWheel> </Scripts> </ScrollFrame> - <Slider name="$parentScrollBar" inherits="UIPanelScrollBarTemplate" minValue="0" maxValue="450" defaultValuie="1" valueStep="1"> + <Slider name="$parentScrollBar" inherits="UIPanelScrollBarTemplate" minValue="0" maxValue="480" defaultValuie="1" valueStep="1"> <Backdrop bgFile="Interface\Buttons\UI-SliderBar-Background" edgeFile="Interface\Buttons\UI-SliderBar-Border" tile="true"> <EdgeSize val="8"/> diff --git a/src/xml/settings/toggleSettings.xml b/src/xml/settings/toggleSettings.xml index b76a1f4..90e1434 100644 --- a/src/xml/settings/toggleSettings.xml +++ b/src/xml/settings/toggleSettings.xml @@ -1,7 +1,7 @@ <Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd"> <Frame name="DJBagsMainSettings" hidden="false" virtual="true"> - <Size x="500" y="115"/> + <Size x="500" y="145"/> <Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\Buttons\WHITE8x8"> <EdgeSize> <AbsValue val="1" /> @@ -49,9 +49,19 @@ </OnShow> </Scripts> </CheckButton> + <CheckButton name="$parentClearNewItems" inherits="DJBagsSettingsCheckBoxTemplate"> + <Anchors> + <Anchor point="TOPLEFT" relativeTo="$parentAutoSellJunk" relativePoint="BOTTOMLEFT" /> + </Anchors> + <Scripts> + <OnShow> + DJBagsInitSettingsCheckBox(self, DJBags_LOCALE_CLEAR_NEW_ITEMS, DJBags_TYPE_MAIN, DJBags_SETTING_CLEAR_NEW_ITEMS) + </OnShow> + </Scripts> + </CheckButton> <Slider name="$parentScaleSlider" inherits="DJBagsSettingsSliderTemplate"> <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentAutoSellJunk" relativePoint="BOTTOMLEFT"> + <Anchor point="TOPLEFT" relativeTo="$parentClearNewItems" relativePoint="BOTTOMLEFT"> <Offset> <AbsDimension x="0" y="-32"/> </Offset>