Quantcast

Fix up some settings

Brandon Talbot [07-23-16 - 16:32]
Fix up some settings
Hide default bank screen
Filename
src/lua/controller/bank.lua
src/lua/element/bagItem.lua
src/lua/settings/settingsController.lua
src/xml/settings/categoryDialog.xml
src/xml/settings/containerSettings.xml
src/xml/settings/settingsContainer.xml
src/xml/settings/toggleSettings.xml
diff --git a/src/lua/controller/bank.lua b/src/lua/controller/bank.lua
index c441873..b160b9f 100644
--- a/src/lua/controller/bank.lua
+++ b/src/lua/controller/bank.lua
@@ -9,6 +9,7 @@ local controller = ADDON.bankController
 function controller:Init()
     ADDON.events:Add('BANKFRAME_OPENED', self)
     ADDON.events:Add('BANKFRAME_CLOSED', self)
+    BankFrame:UnregisterAllEvents()
 end

 function DJBagsBankBar_OnShow(self)
@@ -134,11 +135,7 @@ end
 function controller:ITEM_LOCK_CHANGED(bag, slot)
     if bag ~= BANK_CONTAINER and bag ~= REAGENTBANK_CONTAINER and bag <= NUM_BAG_SLOTS then return end

-    if bag == BANK_CONTAINER and slot > NUM_BANKGENERIC_SLOTS then
-        _G[DJBagsBankBar:GetName() .. 'Bag' .. (slot-NUM_BANKGENERIC_SLOTS)]:UpdateLock()
-    elseif slot then
-        ADDON.cache:GetItem(bag, slot):UpdateLock()
-    end
+    ADDON.cache:GetItem(bag, slot):UpdateLock()
 end

 function controller:PLAYERREAGENTBANKSLOTS_CHANGED()
diff --git a/src/lua/element/bagItem.lua b/src/lua/element/bagItem.lua
index 85063be..6fec9a1 100644
--- a/src/lua/element/bagItem.lua
+++ b/src/lua/element/bagItem.lua
@@ -33,6 +33,12 @@ function item:Init(id, slot)
 end

 function item:Update()
+    local numBankSlots, full = GetNumBankSlots()
+    if self.slot - NUM_BAG_SLOTS > numBankSlots  then
+        local cost = GetBankSlotCost(self.slot-1)
+        self:SetCost(cost)
+        return
+    end
     PaperDollItemSlotButton_Update(self)
     local slotcount = GetContainerNumSlots(self.slot)
     if slotcount > 0 then
@@ -41,6 +47,7 @@ function item:Update()
     else
         self.Count:Hide()
     end
+    self.buy = nil
 end

 function item:UpdateLock()
@@ -88,7 +95,7 @@ function item:SetCost(cost)
         self.IconBorder:Show()
         self.IconBorder:SetVertexColor(1, 0, 0, 1)
         self.Count:Show()
-        self.Count:SetText(cost)
+        self.Count:SetText(cost/10000 .. "|TInterface\\MoneyFrame\\UI-GoldIcon:12:12:2:0|t")
         self.buy = true
     end
 end
diff --git a/src/lua/settings/settingsController.lua b/src/lua/settings/settingsController.lua
index ffb3cbf..4b2745e 100644
--- a/src/lua/settings/settingsController.lua
+++ b/src/lua/settings/settingsController.lua
@@ -26,8 +26,7 @@ function settings:Init()
     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.global = DJBags_DB.global or {}
-    DJBags_DB.global.userDefined = DJBags_DB.global.userDefined or {}
+    DJBags_DB.userDefined = DJBags_DB.userDefined or {}

     self.default = {
         [DJBags_TYPE_MAIN] = {
@@ -86,6 +85,10 @@ function settings:Update(force)
     self:UpdateBag(DJBagsReagentContainer, ADDON.bankController, ADDON.cache.reagentContainers, force)
     self:UpdateBar(DJBagsBagContainer.mainBar)
     self:UpdateBar(DJBagsBankBar)
+
+    local scale = self:GetSettings(DJBags_TYPE_MAIN)[DJBags_SETTING_SCALE]
+    DJBagsBagContainer:SetScale(scale)
+    DJBagsBankBar:SetScale(scale)
 end

 function settings:UpdateBar(bar)
@@ -107,7 +110,6 @@ end

 function settings:GetSettings(type)
     local settings = DJBags_DB[self.realm][self.player][type] or {}
-    self:MigrateSettings(settings, DJBags_DB.global[type] or {})
     self:MigrateSettings(settings, self.default[type]or {})

     return settings
@@ -125,7 +127,7 @@ function settings:GetUserDefinedList()
 end

 function settings:GetGlobalUserDefinedList()
-    return DJBags_DB.global.userDefined
+    return DJBags_DB.userDefined
 end

 function settings:MigrateSettings(table, default)
diff --git a/src/xml/settings/categoryDialog.xml b/src/xml/settings/categoryDialog.xml
new file mode 100644
index 0000000..e69de29
diff --git a/src/xml/settings/containerSettings.xml b/src/xml/settings/containerSettings.xml
index b461681..4e3bdee 100644
--- a/src/xml/settings/containerSettings.xml
+++ b/src/xml/settings/containerSettings.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="DJBagsContainerSettings" inherits="DJBagsContainerTemplate" hidden="false" virtual="true">
-        <Size x="500" y="220"/>
+        <Size x="500" y="175"/>
         <Layers>
             <Layer level="ARTWORK">
                 <FontString name="$parentName" inherits="GameFontNormal" text="DJBags_LOCALE_CONTAINER_SETTINGS">
@@ -61,20 +61,6 @@
                     </OnShow>
                 </Scripts>
             </Slider>
-            <Slider name="$parentScaleSlider" inherits="DJBagsSettingsSliderTemplate">
-                <Anchors>
-                    <Anchor point="TOPLEFT" relativeTo="$parentSpacingSlider" relativePoint="BOTTOMLEFT">
-                        <Offset>
-                            <AbsDimension x="0" y="-32"/>
-                        </Offset>
-                    </Anchor>
-                </Anchors>
-                <Scripts>
-                    <OnShow>
-                        DJBagsInitSettingsSlider(self, DJBags_LOCALE_SCALE, 0.5, 2, 0.1, DJBags_TYPE_CONTAINER, DJBags_SETTING_SCALE)
-                    </OnShow>
-                </Scripts>
-            </Slider>
         </Frames>
         <Scripts>
             <OnLoad>
diff --git a/src/xml/settings/settingsContainer.xml b/src/xml/settings/settingsContainer.xml
index 181faa8..e3364b5 100644
--- a/src/xml/settings/settingsContainer.xml
+++ b/src/xml/settings/settingsContainer.xml
@@ -70,7 +70,7 @@
                     </OnMouseWheel>
                 </Scripts>
             </ScrollFrame>
-            <Slider name="$parentScrollBar" inherits="UIPanelScrollBarTemplate" minValue="0" maxValue="90" defaultValuie="1" valueStep="1">
+            <Slider name="$parentScrollBar" inherits="UIPanelScrollBarTemplate" minValue="0" maxValue="95" 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 c4c98b9..296e473 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" inherits="DJBagsContainerTemplate" hidden="false" virtual="true">
-        <Size x="500" y="65"/>
+        <Size x="500" y="115"/>
         <Layers>
             <Layer level="ARTWORK">
                 <FontString name="$parentName" inherits="GameFontNormal" text="DJBags_LOCALE_SUB_CLASS_SETTINGS">
@@ -42,6 +42,20 @@
                     </OnShow>
                 </Scripts>
             </CheckButton>
+            <Slider name="$parentScaleSlider" inherits="DJBagsSettingsSliderTemplate">
+                <Anchors>
+                    <Anchor point="TOPLEFT" relativeTo="$parentAutoSellJunk" relativePoint="BOTTOMLEFT">
+                        <Offset>
+                            <AbsDimension x="0" y="-32"/>
+                        </Offset>
+                    </Anchor>
+                </Anchors>
+                <Scripts>
+                    <OnShow>
+                        DJBagsInitSettingsSlider(self, DJBags_LOCALE_SCALE, 0.5, 2, 0.1, DJBags_TYPE_MAIN, DJBags_SETTING_SCALE)
+                    </OnShow>
+                </Scripts>
+            </Slider>
         </Frames>
         <Scripts>
             <OnLoad>