From d0abc5b7d2f9a9b05fc4b782865798d5de2eda89 Mon Sep 17 00:00:00 2001 From: Robert Date: Sat, 18 Oct 2014 14:37:53 -0400 Subject: [PATCH 1/3] 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 From fd668492efbc9bf9f814fa2095b0792baae29570 Mon Sep 17 00:00:00 2001 From: Robert Date: Sat, 18 Oct 2014 14:48:18 -0400 Subject: [PATCH 2/3] Removed unneed condition --- BagSync.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BagSync.lua b/BagSync.lua index e5e68dc..1997a8d 100644 --- a/BagSync.lua +++ b/BagSync.lua @@ -337,7 +337,7 @@ local function ScanVoidBank() slotItems[index] = itemID and tostring(itemID) or nil end end - end + end BS_DB['void'][0] = slotItems end @@ -1244,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 and (bagid ~= REAGENTBANK_CONTAINER) then return end + if bagid < -1 then return end if (bagid >= NUM_BAG_SLOTS + 1) and (bagid <= NUM_BAG_SLOTS + NUM_BANKBAGSLOTS) then bagname = 'bank' -- 1.7.9.5 From 2a091d7df0f922abfdaa5a3d714af1930a0df963 Mon Sep 17 00:00:00 2001 From: Robert Date: Sat, 18 Oct 2014 20:01:44 -0400 Subject: [PATCH 3/3] Fixed the currency counter IsActiveBattlefieldArena() was returning false false instead of nil nil, so the a==nil statement was always causing the function to return true. --- BagSync.lua | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/BagSync.lua b/BagSync.lua index 1997a8d..c5fe535 100644 --- a/BagSync.lua +++ b/BagSync.lua @@ -606,24 +606,16 @@ end ------------------------ -- Tokens -- ------------------------ - local function IsInBG() if (GetNumBattlefieldScores() > 0) then return true end - local status, mapName, instanceID, minlevel, maxlevel - for i=1, GetMaxBattlefieldID() do - status, mapName, instanceID, minlevel, maxlevel, teamSize = GetBattlefieldStatus(i) - if status == "active" then - return true - end - end return false end local function IsInArena() local a,b = IsActiveBattlefieldArena() - if (a == nil) then + if not a then return false end return true @@ -640,8 +632,10 @@ local function ScanTokens() end local lastHeader + local limit = GetCurrencyListSize() + + for i=1, limit do - for i=1, GetCurrencyListSize() do local name, isHeader, isExpanded, _, _, count, icon = GetCurrencyListInfo(i) --extraCurrencyType = 1 for arena points, 2 for honor points; 0 otherwise (an item-based currency). @@ -649,6 +643,7 @@ local function ScanTokens() if(isHeader and not isExpanded) then ExpandCurrencyList(i,1) lastHeader = name + limit = GetCurrencyListSize() elseif isHeader then lastHeader = name end @@ -1102,6 +1097,9 @@ function BagSync:PLAYER_LOGIN() self:RegisterEvent("AUCTION_HOUSE_SHOW") self:RegisterEvent("AUCTION_OWNED_LIST_UPDATE") + --currency + self:RegisterEvent('CURRENCY_DISPLAY_UPDATE') + --void storage self:RegisterEvent('VOID_STORAGE_OPEN') self:RegisterEvent('VOID_STORAGE_CLOSE') @@ -1203,6 +1201,12 @@ end -- Event Handlers -- ------------------------------ +function BagSync:CURRENCY_DISPLAY_UPDATE() + if IsInBG() or IsInArena() or InCombatLockdown() or UnitAffectingCombat("player") then return end + doTokenUpdate = 0 + ScanTokens() +end + function BagSync:PLAYER_REGEN_ENABLED() if IsInBG() or IsInArena() or InCombatLockdown() or UnitAffectingCombat("player") then return end self:UnregisterEvent("PLAYER_REGEN_ENABLED") -- 1.7.9.5