Quantcast

Fixed bank screen not closing when closing frame

Brandon Talbot [07-25-16 - 18:36]
Fixed bank screen not closing when closing frame
Fixed reagent bank not acting as receiver
Added zhTW locale
Filename
src/lua/constants/contstants.lua
src/lua/controller/bank.lua
src/lua/element/item.lua
src/lua/utils/utils.lua
diff --git a/src/lua/constants/contstants.lua b/src/lua/constants/contstants.lua
index 9578c03..66c41d4 100644
--- a/src/lua/constants/contstants.lua
+++ b/src/lua/constants/contstants.lua
@@ -70,6 +70,36 @@ localeText['enUS'] = function()
     DJBags_LOCALE_MAX_ITEMS = 'Max items'
     DJBags_LOCALE_MAX_HEIGHT = 'Max height'
 end
+localeText['zhTW'] = function()
+    DJBags_LOCALE_MAIN_SETTINGS = '主設定:'
+    DJBags_LOCALE_ITEM_CONTAINER_SETTINGS = '分類外觀設定:'
+    DJBags_LOCALE_CONTAINER_SETTINGS = '背包外觀設定:'
+    DJBags_LOCALE_SUB_CLASS_SETTINGS = '子分類設定:'
+    DJBags_LOCALE_MAIN_BAR_SETTINGS = '主要功能列設定:'
+    DJBags_LOCALE_BANK_BAR_SETTINGS = '銀行功能列設定:'
+    DJBags_LOCALE_FORMAT_SETTINGS = '排列方式設定:'
+    DJBags_LOCALE_SETTINGS = 'DJBags 背包設定:'
+    DJBags_LOCALE_CLEAR_NEW_ITEMS = '清理新物品'
+    DJBags_LOCALE_BACKGROUND_COLOR = '背景顏色'
+    DJBags_LOCALE_BORDER_COLOR = '邊框顏色'
+    DJBags_LOCALE_TEXT_COLOR = '文字顏色'
+    DJBags_LOCALE_PADDING = '內距'
+    DJBags_LOCALE_SPACING = '間距'
+    DJBags_LOCALE_SCALE = '縮放大小'
+    DJBags_LOCALE_TEXT_SIZE = '文字大小'
+    DJBags_LOCALE_STACK_ALL = '堆疊所有物品'
+    DJBags_LOCALE_SELL_JUNK = '自動賣垃圾'
+    DJBags_LOCALE_DEPOSIT_REAGENT = '自動存放材料'
+    DJBags_LOCALE_MASONRY = '磚牆'
+    DJBags_LOCALE_BOX = '方盒'
+    DJBags_LOCALE_CATEGORY_DIALOG_TITLE = '設定分類: %s'
+    DJBags_LOCALE_GLOBAL = '全部'
+    DJBags_LOCALE_BOE = '裝備綁定'
+    DJBags_LOCALE_BOA = '帳號綁定'
+    DJBags_LOCALE_VERTICAL = '垂直'
+    DJBags_LOCALE_MAX_ITEMS = '分類寬度最多物品數目'
+    DJBags_LOCALE_MAX_HEIGHT = '最大高度'
+end

 if localeText[GetLocale()] then
     localeText[GetLocale()]()
diff --git a/src/lua/controller/bank.lua b/src/lua/controller/bank.lua
index 12ee421..10406a0 100644
--- a/src/lua/controller/bank.lua
+++ b/src/lua/controller/bank.lua
@@ -10,9 +10,12 @@ function controller:Init()
     ADDON.events:Add('BANKFRAME_OPENED', self)
     ADDON.events:Add('BANKFRAME_CLOSED', self)
     BankFrame:UnregisterAllEvents()
+    BankFrame:SetScript('OnShow', nil)
 end

 function DJBagsBankBar_OnShow(self)
+    BankFrame:Show()
+    BankFrame.selectedTab = 1
     PanelTemplates_SetTab(self, 1)
     DJBagsBankContainer:Show()
     DJBagsReagentContainer:Hide()
@@ -23,7 +26,10 @@ function DJBagsBankBar_OnShow(self)
 end

 function DJBagsBankBar_OnHide(self)
+    BankFrame:Hide()
     controller:UnRegister()
+    CloseBankFrame()
+    StaticPopup_Hide("CONFIRM_BUY_BANK_SLOT");
 end

 function DJBagsBankTab_OnClick(tab)
@@ -32,9 +38,11 @@ function DJBagsBankTab_OnClick(tab)
     if tab.tab == 1 then
         DJBagsBankContainer:Show()
         DJBagsReagentContainer:Hide()
+        BankFrame.selectedTab = 1
     else
         DJBagsBankContainer:Hide()
         DJBagsReagentContainer:Show()
+        BankFrame.selectedTab = 2
     end
 end

diff --git a/src/lua/element/item.lua b/src/lua/element/item.lua
index 37dd239..1a015c7 100644
--- a/src/lua/element/item.lua
+++ b/src/lua/element/item.lua
@@ -33,10 +33,8 @@ function item:Init(bag, slot)
 end

 function item:OnClick(button)
-    if self:GetParent().id then
-        if IsAltKeyDown() and button == 'LeftButton' then
+    if self:GetParent().id and IsAltKeyDown() and button == 'LeftButton' then
             DJBagsCategoryDialogLoad(self:GetParent().id, self:GetParent().name)
-        end
     end
 end

diff --git a/src/lua/utils/utils.lua b/src/lua/utils/utils.lua
index 7b73d26..8cbd68f 100644
--- a/src/lua/utils/utils.lua
+++ b/src/lua/utils/utils.lua
@@ -58,12 +58,12 @@ function ADDON:UpdateBags(bags)
         for slot = 1, bagSlots do
             local item = ADDON.cache:GetItem(bag, slot)
             item:Update()
+            local newParent = ADDON.cache:GetItemContainer(bag, item:GetContainerName())

             local currentParent = item:GetParent() and item:GetParent():GetParent()
             if currentParent and currentParent.RemoveItem then
                 currentParent:RemoveItem(item)
             end
-            local newParent = ADDON.cache:GetItemContainer(bag, item:GetContainerName())

             newParent:AddItem(item)
         end