From d0abc5b7d2f9a9b05fc4b782865798d5de2eda89 Mon Sep 17 00:00:00 2001 From: Robert Date: Sat, 18 Oct 2014 14:37:53 -0400 Subject: [PATCH] Added Void Storage 2nd tab support Added Reagent Bank support Added Reagent Bank change as an event --- BagSync.lua | 47 ++++++++++++++++++++++++++++++++++++++--------- BagSync.toc | 4 ++-- 2 files changed, 40 insertions(+), 11 deletions(-) diff --git a/BagSync.lua b/BagSync.lua index d94951c..e5e68dc 100644 --- a/BagSync.lua +++ b/BagSync.lua @@ -311,6 +311,9 @@ local function ScanEntireBank() for i = NUM_BAG_SLOTS + 1, NUM_BAG_SLOTS + NUM_BANKBAGSLOTS do SaveBag('bank', i) end + if IsReagentBankUnlocked() then + SaveBag('reagentbank', REAGENTBANK_CONTAINER) + end end local function ScanVoidBank() @@ -322,13 +325,19 @@ local function ScanVoidBank() lastItem = nil lastDisplayed = {} + local numTabs = 2 + local index = 0 local slotItems = {} - for i = 1, 80 do - itemID, textureName, locked, recentDeposit, isFiltered = GetVoidItemInfo(i) - if (itemID) then - slotItems[i] = itemID and tostring(itemID) or nil + + for tab = 1, numTabs do + for i = 1, 80 do + itemID, textureName, locked, recentDeposit, isFiltered = GetVoidItemInfo(tab, i) + if (itemID) then + index = index + 1 + slotItems[index] = itemID and tostring(itemID) or nil + end end - end + end BS_DB['void'][0] = slotItems end @@ -688,6 +697,16 @@ local function CountsToInfoString(countTable) end total = total + countTable['bank'] end + + if countTable['reagentbank'] > 0 then + local count = L["ReagentBank: %d"]:format(countTable['reagentbank']) + if info then + info = strjoin(', ', info, count) + else + info = count + end + total = total + countTable['reagentbank'] + end if countTable['equip'] > 0 then local count = L["Equipped: %d"]:format(countTable['equip']) @@ -870,6 +889,7 @@ local function AddItemToTooltip(frame, link) local allowList = { ["bag"] = 0, ["bank"] = 0, + ["reagentbank"] = 0, ["equip"] = 0, ["mailbox"] = 0, ["void"] = 0, @@ -878,7 +898,7 @@ local function AddItemToTooltip(frame, link) } local infoString - local invCount, bankCount, equipCount, guildCount, mailboxCount, voidbankCount, auctionCount = 0, 0, 0, 0, 0, 0, 0 + local invCount, bankCount, reagentbankCount, equipCount, guildCount, mailboxCount, voidbankCount, auctionCount = 0, 0, 0, 0, 0, 0, 0, 0 local pFaction = v.faction or playerFaction --just in case ;) if we dont know the faction yet display it anyways --check if we should show both factions or not @@ -1073,6 +1093,7 @@ function BagSync:PLAYER_LOGIN() self:RegisterEvent('GUILDBANKFRAME_OPENED') self:RegisterEvent('GUILDBANKFRAME_CLOSED') self:RegisterEvent('GUILDBANKBAGSLOTS_CHANGED') + self:RegisterEvent('PLAYERREAGENTBANKSLOTS_CHANGED') self:RegisterEvent('BAG_UPDATE') self:RegisterEvent('UNIT_INVENTORY_CHANGED') self:RegisterEvent('GUILD_ROSTER_UPDATE') @@ -1215,7 +1236,7 @@ end function BagSync:BAG_UPDATE(event, bagid) -- -1 happens to be the primary bank slot ;) - if bagid <= BANK_CONTAINER then return end + if (bagid <= BANK_CONTAINER) then return end if not(bagid > NUM_BAG_SLOTS) or atBank or atVoidBank then --this will update the bank/bag slots @@ -1223,7 +1244,7 @@ function BagSync:BAG_UPDATE(event, bagid) --get the correct bag name based on it's id, trying NOT to use numbers as Blizzard may change bagspace in the future --so instead I'm using constants :) - if bagid < -1 then return end + if bagid < -1 and (bagid ~= REAGENTBANK_CONTAINER) then return end if (bagid >= NUM_BAG_SLOTS + 1) and (bagid <= NUM_BAG_SLOTS + NUM_BANKBAGSLOTS) then bagname = 'bank' @@ -1264,6 +1285,14 @@ function BagSync:BANKFRAME_CLOSED() end ------------------------------ +-- REAGENT BANK -- +------------------------------ + +function BagSync:PLAYERREAGENTBANKSLOTS_CHANGED() + SaveBag('reagentbank', REAGENTBANK_CONTAINER) +end + +------------------------------ -- VOID BANK -- ------------------------------ @@ -1437,4 +1466,4 @@ function BagSync:TRADE_SKILL_SHOW() end end -end +end \ No newline at end of file diff --git a/BagSync.toc b/BagSync.toc index f19412e..4c24f82 100644 --- a/BagSync.toc +++ b/BagSync.toc @@ -1,8 +1,8 @@ -## Interface: 50400 +## Interface: 60000 ## Title: BagSync ## Notes: BagSync tracks your characters items and displays it within tooltips. ## Author: Xruptor -## Version: 7.6 +## Version: 7.7 ## OptionalDeps: tekDebug ## SavedVariables: BagSyncDB, BagSyncOpt, BagSyncGUILD_DB, BagSyncTOKEN_DB, BagSyncCRAFT_DB, BagSyncBLACKLIST_DB -- 1.7.9.5