Download
(12 Kb)
Download
Updated: 02-26-11 02:28 PM
Pictures
File Info
Updated:02-26-11 02:28 PM
Created:01-05-09 03:11 PM
Downloads:9,056
Favorites:117
MD5:
Broker Bags  Popular! (More than 5000 hits)
Version: v4.0.1-Release
by: PProvost [More]
Broker_Bags is a very simple LibDataBroker (aka LDB) plugin that shows your bag information. It will not display anything by itself and requires an LDB display like NinjaPanel or Fortress to display anything.

It provides a simple text display like this: 25/64 that shows used/total. Clicking on the panel toggles your default bags. On mouse rollover, a tooltip is displayed that shows the same display for all of your toons on that realm.

Broker_Bags excludes ammo/shard bags since that is well covered by other LDB plugins like StatBlock_Ammo.
Tagging v1.5-release for patch 3.3

--------------------

- Final tweaks before patch 3.3 release
- Bit more cleanup
- Major code cleanup.
- Updated toc for patch 3.3

--== Tagging v1.4-Release ==--

commit 769eafbfa92aebe6a9c8dbb3fec86cd7c97485c1
Author: PProvost <peter@provost.org>
Date: Fri Aug 14 01:12:26 2009 -0600

Initial import from svn

------------------------------------------------------------------------
r24 Updated TOC for patch 3.2

------------------------------------------------------------------------
r23 | quaiche | 2009-04-16 06:31:34 +0000 (Thu, 16 Apr 2009) | 1 line
Changed paths:
A /tags/v1.3-Release (from /trunk:22)

Tagging as v1.3-Release
------------------------------------------------------------------------
r22 | quaiche | 2009-04-16 06:30:50 +0000 (Thu, 16 Apr 2009) | 2 lines
Changed paths:
M /trunk/Broker_Bags.toc

Updated TOC for Patch 3.1

------------------------------------------------------------------------
r20 | quaiche | 2009-02-19 21:41:00 +0000 (Thu, 19 Feb 2009) | 2 lines
Changed paths:
M /trunk/.pkgmeta
M /trunk/Broker_Bags.lua
M /trunk/Broker_Bags.toc

License and code cleanup for v1.2 release

------------------------------------------------------------------------
r19 | quaiche | 2009-02-19 19:34:51 +0000 (Thu, 19 Feb 2009) | 2 lines
Changed paths:
M /trunk/Broker_Bags.lua
M /trunk/Broker_Bags.toc
A /trunk/tektip.lua

Ticket #2 - Added a tooltip showing bag counts for your other toons on the realm

------------------------------------------------------------------------
r18 | quaiche | 2008-12-22 20:31:03 +0000 (Mon, 22 Dec 2008) | 1 line
Changed paths:
M /trunk/Broker_Bags.lua

Added type attribute to LDB object to be spec-compliant.
------------------------------------------------------------------------
r16 | quaiche | 2008-10-27 01:00:59 +0000 (Mon, 27 Oct 2008) | 2 lines
Changed paths:
M /trunk/Broker_Bags.toc

Updated for 3.0.2 repackaging

------------------------------------------------------------------------
r14 | quaiche | 2008-10-01 05:42:34 +0000 (Wed, 01 Oct 2008) | 1 line
Changed paths:
M /trunk/Broker_Bags.toc
A /trunk/CallbackHandler-1.0.lua

Added missing CallbackHandler-1.0.lua
------------------------------------------------------------------------
r13 | root | 2008-09-30 23:42:12 +0000 (Tue, 30 Sep 2008) | 1 line
Changed paths:
A /trunk/.pkgmeta

Facilitate WowAce-on-CurseForge transition
------------------------------------------------------------------------
r11 | root | 2008-09-30 23:41:33 +0000 (Tue, 30 Sep 2008) | 1 line
Changed paths:
D /tmp/trunk/Broker_Bags
A /trunk (from /tmp/trunk/Broker_Bags:10)

Importing oldrepo data under /trunk
------------------------------------------------------------------------
r10 | pprovost | 2008-09-24 20:29:17 +0000 (Wed, 24 Sep 2008) | 1 line
Changed paths:
M /tmp/trunk/Broker_Bags/Broker_Bags.toc

Broker_Bags: Updated X-Email in TOC
------------------------------------------------------------------------
r9 | pprovost | 2008-08-27 13:49:49 +0000 (Wed, 27 Aug 2008) | 1 line
Changed paths:
M /tmp/trunk/Broker_Bags/Broker_Bags.toc

Broker_Bags: Removed unneeded dependency from TOC
------------------------------------------------------------------------
r8 | pprovost | 2008-08-26 02:21:34 +0000 (Tue, 26 Aug 2008) | 2 lines
Changed paths:
M /tmp/trunk/Broker_Bags/Broker_Bags.lua

Broker_Bags: Updated to exclude Ammo/Soul/Quiver bags. Use Broker_Ammo if you need those.

------------------------------------------------------------------------
r7 | pprovost | 2008-08-24 00:39:41 +0000 (Sun, 24 Aug 2008) | 1 line
Changed paths:
M /tmp/trunk/Broker_Bags/Broker_Bags.lua

Broker_Bags: Added OnClick handler to toggle backpack and removed some duplicated code.
------------------------------------------------------------------------
r6 | pprovost | 2008-08-23 03:10:08 +0000 (Sat, 23 Aug 2008) | 2 lines
Changed paths:
A /tmp/trunk/Broker_Bags/Broker_Bags.lua
A /tmp/trunk/Broker_Bags/Broker_Bags.toc
A /tmp/trunk/Broker_Bags/LibDataBroker-1.1.lua
A /tmp/trunk/Broker_Bags/LibStub.lua

Broker_Bags: Initial import

------------------------------------------------------------------------
r5 | pprovost | 2008-08-23 03:03:57 +0000 (Sat, 23 Aug 2008) | 1 line
Changed paths:
A /tmp/trunk/Broker_Bags

Broker_Bags: Folder create
------------------------------------------------------------------------
Archived Files (5)
File Name
Version
Size
Author
Date
v1.5-Release
14kB
PProvost
01-05-10 09:19 PM
v1.4-Release
13kB
PProvost
08-14-09 01:44 AM
v1.3-Release
13kB
PProvost
04-16-09 12:32 AM
v1.2-Release
13kB
PProvost
02-19-09 04:08 PM
v1.1-Release
6kB
PProvost
01-05-09 03:11 PM


Post A Reply Comment Options
Unread 02-27-11, 06:50 AM  
Elea
A Kobold Labourer
 
Elea's Avatar

Forum posts: 0
File comments: 3
Uploads: 0
Why not available?

I was always wondering why I can't on a single click open all my bags with this addon while it is enabled by default with FuBar_BagFu for instance. I thought the author will fix it but it appears this is still not the case... :/ It also seems that other users share the same need for such a simple feature, so here is my solution, completely borrowed from FuBar_BagFu. This works as follows:
- mouse click will open all your bags, except the profession bags
- mouse click + shift will open all your bags, including the profession bags
- mouse click + ctrl will open the keyring

Just copy/paste the following code in your Broker_Bags.lua :
Code:
local db
local playerName, playerRealm = UnitName("player"), GetRealmName()

local _G = _G
local KEYRING_CONTAINER = KEYRING_CONTAINER
local NUM_BAG_SLOTS = NUM_BAG_SLOTS

local ldb = LibStub:GetLibrary("LibDataBroker-1.1")
local dataobj = ldb:GetDataObjectByName("Bags") or ldb:NewDataObject("Bags", {
	type = "data source", icon = [[Interface\Icons\INV_Misc_Bag_11]], text = "0/0",
	OnClick = function()
		-- Holding shift will open all bags, even if you asked to not show professions/ammo.
		local shifted = IsShiftKeyDown()
		-- Just toggle the keyring if control is held
		if IsControlKeyDown() then
			ToggleBag(KEYRING_CONTAINER)
			return
		end
		--
		if not ContainerFrame1:IsShown() then
			for i = 1, NUM_BAG_SLOTS do
				if _G["ContainerFrame" .. (i + 1)]:IsShown() then
					_G["ContainerFrame" .. (i + 1)]:Hide()
				end
			end
			ToggleBackpack()
			if ContainerFrame1:IsShown() then
				for i = 1, NUM_BAG_SLOTS do
					local usable = true
					local _, bagType = GetContainerNumFreeSlots(i)
					if IsProfessionBag(bagType) then
						usable = false
					end
					if usable or shifted then
						ToggleBag(i)
					end
				end
			end
		else
			for i = 0, NUM_BAG_SLOTS do
				if _G["ContainerFrame" .. (i + 1)]:IsShown() then
					_G["ContainerFrame" .. (i + 1)]:Hide()
				end
			end
		end
	end,
	OnTooltipShow = function(tip)
		tip:AddLine("Characters on " .. playerRealm)
		for k,v in pairs(db[playerRealm]) do
			tip:AddDoubleLine(k, v, 1,1,1, 1,1,1)
		end
		tip:AddLine("Click to open your bags.")
		tip:AddLine("Hint: Click to open your bags.", 0, 1, 0, true)
	end,
})

function IsProfessionBag(bagType)
	-- 1024: Mining Bag
	-- 512: Gem Bag
	-- 128: Engineering Bag
	-- 64: Enchanting Bag
	-- 32: Herb Bag
	-- 16: Inscription Bag
	-- 8: Leatherworking Bag
	if bagType == 1024 or bagType == 512 or bagType == 128 or bagType == 64 or bagType == 32 or bagType == 16 or bagType == 8 then
		return true
	end
	return false
end

local function UpdateText()
	local totalSlots, freeSlots = 0, 0
	local itemLink, subtype, isBag
	for i = 0,NUM_BAG_SLOTS do
		isBag = true
		if i > 0 then
			itemLink = GetInventoryItemLink("player", ContainerIDToInventoryID(i))
			if itemLink then
				subtype = select(7, GetItemInfo(itemLink))
				if (subtype == "Soul Bag") or (subtype == "Ammo Pouch") or (subtype == "Quiver") then
					isBag = false
				end
			end
		end
		if isBag then
			totalSlots = totalSlots + GetContainerNumSlots(i)
			freeSlots = freeSlots + GetContainerNumFreeSlots(i)
		end
	end

	dataobj.text = string.format("%d/%d", totalSlots - freeSlots, totalSlots)
	db[playerRealm][playerName] = dataobj.text
end

local f = CreateFrame("Frame")
f:SetScript("OnEvent", function(self, event, ...) if self[event] then return self[event](self, event, ...) end end)
f:RegisterEvent("ADDON_LOADED")

f:RegisterEvent("BAG_UPDATE")
f.BAG_UPDATE = UpdateText

f:RegisterEvent("UNIT_INVENTORY_CHANGED")
f.UNIT_INVENTORY_CHANGED = UpdateText

function f:ADDON_LOADED(event,addon)
	if addon:lower() ~= "broker_bags" then return end
	db = Broker_BagsDB or {}
	if not db[playerRealm] then db[playerRealm] = {} end	
	LibStub("tekKonfig-AboutPanel").new(nil, "Broker_Bags")
	self:UnregisterEvent("ADDON_LOADED")
	self.ADDON_LOADED = nil

	if IsLoggedIn() then UpdateText() else self:RegisterEvent("PLAYER_LOGIN"); self.PLAYER_LOGIN = UpdateText end
end
Hope this helps
Last edited by Elea : 02-27-11 at 02:33 PM.
Elea is offline Report comment to moderator  
Reply With Quote
Unread 02-27-11, 05:25 AM  
derzi
A Kobold Labourer

Forum posts: 0
File comments: 2
Uploads: 0
target of target issue

TO be short after adding the new update of broker_bags the xperl target of target doesn't work anymore tried latest version of xperl same thing deleting the bags brings back my target of target o.O
derzi is offline Report comment to moderator  
Reply With Quote
Unread 01-02-11, 11:44 PM  
jasonreid
A Kobold Labourer

Forum posts: 0
File comments: 3
Uploads: 0
This works. My first ever LUA edit...
jasonreid is offline Report comment to moderator  
Reply With Quote
Unread 10-17-10, 11:44 AM  
MisterGideon
A Kobold Labourer

Forum posts: 0
File comments: 1
Uploads: 0
On Right/Left click bag/all bags hack

Been fiddling with this, in the absence of a more general thing. it's quick, dirty and amateur, but this seems to work.

in Broker_Bags.lua, replace the OnClick line from line 26 with

Code:
OnClick = function(self,button) 
			if ( button == "RightButton" ) then
			OpenAllBags();
			elseif ( button == "LeftButton" ) then 
			ToggleBag(0)
			end
	
	end,
Quick and nasty, but it works. If you want it the other way up, just change the "RightButton" and "LeftButton" labels around.
MisterGideon is offline Report comment to moderator  
Reply With Quote
Unread 08-24-09, 12:45 AM  
xtoq
An Aku'mai Servant
 
xtoq's Avatar
AddOn Author - Click to view AddOns

Forum posts: 32
File comments: 640
Uploads: 3
I love this. Can you add the ability to open all bags with a left click and just the backpack with a right click?

EDIT: just saw the feature request button so I am making one, but I'm keeping this here just in case.
__________________
There is absolutely no evidence to support the theory that life is serious.
Last edited by xtoq : 08-24-09 at 12:46 AM.
xtoq is offline Report comment to moderator  
Reply With Quote
Unread 08-10-09, 01:35 PM  
cag_dk
A Deviate Faerie Dragon
 
cag_dk's Avatar

Forum posts: 14
File comments: 44
Uploads: 0
Re: Re: invert displayed bagspace

Originally posted by PProvost
Okay, okay... I'll look into adding the option. As you point out, the code change is trivial. Adding options is annoying.
Sounds good thanks

/Cag
__________________
King for a Day, Fool for a Lifetime
cag_dk is offline Report comment to moderator  
Reply With Quote
Unread 08-10-09, 12:02 PM  
PProvost
A Deviate Faerie Dragon
AddOn Author - Click to view AddOns

Forum posts: 13
File comments: 126
Uploads: 24
Re: invert displayed bagspace

Okay, okay... I'll look into adding the option. As you point out, the code change is trivial. Adding options is annoying.
PProvost is offline Report comment to moderator  
Reply With Quote
Unread 08-10-09, 11:23 AM  
cag_dk
A Deviate Faerie Dragon
 
cag_dk's Avatar

Forum posts: 14
File comments: 44
Uploads: 0
invert displayed bagspace

I would also like to have Broker_Bags show
'BagspaceLeft/BagspaceTotal'
instead of
'BagspaceUsed/BagspaceTotal'
I have no *.lua knowledge but fiddled a bit and found the answer:
find lines 80-83 in Broker_Bags.lua


80 if isBag then
81 totalSlots = totalSlots + GetContainerNumSlots(i)
82 freeSlots = freeSlots + GetContainerNumFreeSlots(i)
83 end

and change them to:


80 if isBag then
81 totalSlots = totalSlots + GetContainerNumSlots(i)
82 --freeSlots = freeSlots + GetContainerNumFreeSlots(i) -- used/total
83 freeSlots = freeSlots + (GetContainerNumSlots(i) - GetContainerNumFreeSlots(i)) -- free/total
84 end



/cag
__________________
King for a Day, Fool for a Lifetime
Last edited by cag_dk : 08-11-09 at 04:00 PM.
cag_dk is offline Report comment to moderator  
Reply With Quote
Unread 06-07-09, 08:54 PM  
PProvost
A Deviate Faerie Dragon
AddOn Author - Click to view AddOns

Forum posts: 13
File comments: 126
Uploads: 24
Re: Re: Class and profession bag support?

Originally posted by Codex
Can you make an option to invert it to show free slots rather than used slots please?
Well, probably not. Right now it has zero options and I like it that way. Adding an options UI would be overkill for an addon that is barely 75 lines of code.
PProvost is offline Report comment to moderator  
Reply With Quote
Unread 05-19-09, 04:35 PM  
Codex
A Deviate Faerie Dragon
AddOn Author - Click to view AddOns

Forum posts: 19
File comments: 281
Uploads: 21
Re: Class and profession bag support?

Can you make an option to invert it to show free slots rather than used slots please?
Codex is offline Report comment to moderator  
Reply With Quote
Unread 05-06-09, 08:28 AM  
forty2j
A Cobalt Mageweaver

Forum posts: 232
File comments: 260
Uploads: 0
Originally posted by PProvost
Ugh. Interesting information, but for me the whole point of this was to be minimalistic. If someone wants to resurrect Bagsy, great, but that isn't what this is.
Bagsy probably went a little overboard. You shouldn't need to play finger-Twister to get the information you want.

I'd like to see 3 options, which would load up to 3 different data sources in the broker display:
[ ] Show available/total space for all bags
[ ] Show available/total space for unrestricted bags
[ ] Show available/total space for restricted bags

The third option would add all your profession bags, shard bags, etc. together into one number, and tooltip would give the breakdown. The majority of users carry at most one restricted bag around with them anyway.
forty2j is offline Report comment to moderator  
Reply With Quote
Unread 05-04-09, 11:55 AM  
PProvost
A Deviate Faerie Dragon
AddOn Author - Click to view AddOns

Forum posts: 13
File comments: 126
Uploads: 24
Originally posted by xtoq
Something like Bagsy, since that's not being updated anymore?
Ugh. Interesting information, but for me the whole point of this was to be minimalistic. If someone wants to resurrect Bagsy, great, but that isn't what this is.
PProvost is offline Report comment to moderator  
Reply With Quote
Unread 04-25-09, 04:08 PM  
xtoq
An Aku'mai Servant
 
xtoq's Avatar
AddOn Author - Click to view AddOns

Forum posts: 32
File comments: 640
Uploads: 3
Something like Bagsy, since that's not being updated anymore?
xtoq is offline Report comment to moderator  
Reply With Quote
Unread 04-04-09, 03:55 PM  
PProvost
A Deviate Faerie Dragon
AddOn Author - Click to view AddOns

Forum posts: 13
File comments: 126
Uploads: 24
Re: Class and profession bag support?

Originally posted by Wizardling
Without support for these to be counted separately, this addon is not as useful as it could be to me. Can this please be added? :-) *hopeful look*
Interesting idea. On the tooltip maybe?
PProvost is offline Report comment to moderator  
Reply With Quote
Unread 04-01-09, 05:09 AM  
Wizardling
A Kobold Labourer
 
Wizardling's Avatar
Premium Member

Forum posts: 0
File comments: 96
Uploads: 0
Question Class and profession bag support?

Without support for these to be counted separately, this addon is not as useful as it could be to me. Can this please be added? :-) *hopeful look*
Wizardling is offline Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: