From 2105bc37d5e956e6afc13764a55c064ef91fc8d3 Mon Sep 17 00:00:00 2001 From: Noshei <8866000+Noshei@users.noreply.github.com> Date: Sun, 15 Dec 2024 11:23:10 -0700 Subject: [PATCH] 1.0.8 Added Button to Blizzard Warband Bank UI to open the Log window --- .vscode/settings.json | 3 ++- Broker.lua | 1 + Display.lua | 14 ++++++++++++++ Plugins/Plugins.lua | 2 +- Warband-Bank-Log.lua | 21 ++------------------- Warband-Bank-Log.toc | 2 +- 6 files changed, 21 insertions(+), 22 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 47df5a5..dff682b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -29,7 +29,8 @@ "EventUtil", "Baganator_CategoryViewBankViewFrame", "Baganator_SingleViewBankViewFrame", - "Baganator" + "Baganator", + "AccountBankPanel" ], "Lua.diagnostics.disable": ["assign-type-mismatch"] } diff --git a/Broker.lua b/Broker.lua index 0d89a04..be58883 100644 --- a/Broker.lua +++ b/Broker.lua @@ -9,6 +9,7 @@ function WBL:InitializeBroker() local dataObj = ldb:NewDataObject(WBL.metaData.name, { type = "launcher", icon = 1505935, + label = "Warband Bank Log", OnClick = function(frame, button) if button == "LeftButton" then WBL_API:Toggle() diff --git a/Display.lua b/Display.lua index 9c6add4..be70b95 100644 --- a/Display.lua +++ b/Display.lua @@ -70,6 +70,20 @@ function WBL:CreateDisplay() WBL:InitializeDataProvider() end +function WBL:CreateBankButton() + local WBLButton = CreateFrame("Button", "WBLBlizzardButton", AccountBankPanel, "UIPanelButtonTemplate") + WBLButton:SetPoint("BOTTOMLEFT", 2, 6) + WBLButton:SetSize(105, 21) + WBLButton:SetFrameLevel(700) + WBLButton:SetText("Log") + + WBLButton:SetScript("OnClick", function() + WBL_API:Toggle() + end) + + WBL.Display.Button = WBLButton +end + function WBL:InitializeDataProvider() if #WBL.Logs == 0 then return diff --git a/Plugins/Plugins.lua b/Plugins/Plugins.lua index e2ef4c7..77cfc12 100644 --- a/Plugins/Plugins.lua +++ b/Plugins/Plugins.lua @@ -5,7 +5,7 @@ EventUtil.ContinueOnAddOnLoaded("Baganator", function() end local parent = details.region.Warband - local WBLButton = CreateFrame("Button", "WarbandBankLogButton", parent, "WBLBaganatorIcon") + local WBLButton = CreateFrame("Button", "WBLBaganatorButton", parent, "WBLBaganatorIcon") WBLButton:SetPoint("TOPLEFT", 5, 0) WBLButton:SetFrameLevel(700) WBLButton.tooltipHeader = "Warband Bank Log" diff --git a/Warband-Bank-Log.lua b/Warband-Bank-Log.lua index 4d477e8..fa6dfa4 100644 --- a/Warband-Bank-Log.lua +++ b/Warband-Bank-Log.lua @@ -42,6 +42,7 @@ function WBL:OnInitialize() WBL:InitializeBroker() WBL:CreateDisplay() + WBL:CreateBankButton() WBL:MinimapHandler(WBL.db.profile.minimap.enable) SLASH_WarbandBankLog1 = "/warbandbanklog" @@ -212,6 +213,7 @@ end ---Gets the contents of the Warband Bank and returns a temporary table that will be used to compare to cached data ---see https://warcraft.wiki.gg/wiki/BagID bag ID's that are used for initial loop values +---@param event string function WBL:GetBankContent(event) local items = {} local continuableContainer = ContinuableContainer:Create() @@ -221,25 +223,6 @@ function WBL:GetBankContent(event) if not item:IsItemEmpty() then table.insert(items, item) continuableContainer:AddContinuable(item) - - --[[if not C_Item.IsItemDataCachedByID(itemInfo.itemID) then - local item = Item:CreateFromBagAndSlot(bag, slot) - item:ContinueOnItemLoad(function() - output("Loaded item") - local chunks = strsplittable(":", item:GetItemLink()) - chunks[10] = "" - chunks[11] = "" - local link = table.concat(chunks, ":") - tempBank[link] = (tempBank[link] or 0) + item:GetStackCount() - end) - else - output("Cached item") - local chunks = strsplittable(":", itemInfo.hyperlink) - chunks[10] = "" - chunks[11] = "" - local link = table.concat(chunks, ":") - tempBank[link] = (tempBank[link] or 0) + itemInfo.stackCount - end]] end end end diff --git a/Warband-Bank-Log.toc b/Warband-Bank-Log.toc index f95ff65..1112130 100644 --- a/Warband-Bank-Log.toc +++ b/Warband-Bank-Log.toc @@ -2,7 +2,7 @@ ## Title: Warband Bank Log ## Notes: Provides a log of which character added or removed items/gold from the Warband Bank ## Author: Noshei -## Version: 1.0.7 +## Version: 1.0.8 ## SavedVariables: WarbandBankLogDB, WarbandBankLogSettings ## AddonCompartmentFunc: WarbandBankLog_OnAddonCompartmentClick ## IconTexture: 1505935