Download
(46Kb)
Download
Updated: 09-07-10 10:44 AM
Pictures
File Info
Updated:09-07-10 10:44 AM
Created:unknown
Downloads:70,692
Favorites:320
MD5:

cargBags  Popular! (More than 5000 hits)

Version: 2.1.2
by: Cargor [More]

Problems? Visit the Wiki or Help & Discussion Thread!

cargBags is a modular inventory framework. It was created with one simple thing in mind: Taking the boring work away for you, so that you can start right-away with the important things: Layout and categories! You don't have to care anymore about fetching item-data, updating at the right time or creating a sophisticated filtering system - cargBags does this all for you!

From a simple all-in-one inventory over multiple category-based bags to your own needs:

Just start with the user-friendly and commented example cargBags_Simplicity, build upon it and implement your own features. Create and release your own individual bag addon by embedding cargBags!

Default Features

  • modular: remove features you don't need or add new ones
  • simple, fully extensible filtering-system (optional)
  • object-oriented approach
  • embed cargBags and make your own bag addon!
  • extensive API: Hook into every part of cargBags
  • optimized: recycling of buttons, caching of item data and more
  • plugin-system for often-used snippets like a space- or money-display (optional)

Additional resources and help
FAQ

My cargBags doesn't show anything!
Do you have a layout? This is a framework and does nothing by itself!

Will you provide support for alt bags / bank?
No, because it would be too hackish and cause problems. You can use external addons like BagSync. But if you are a layout author, nothing stops you from providing support yourself.

What about auto-stacking / -sorting?
In my opinion, this does not need to be in a bag addon, because there are lots of external addons for this, like Genie or kRestack.

Guildbank? Stack compression?
I'm trying, but don't expect anything soon.

Do you support LibDataBroker?
You can use LibCargoShip for this.

cargBags is licensed under the GPL 2. Go ahead and fork it!

Changes to the core prior to version 1.2 are located in the changelog.txt.
Releases are normally not backwards-compatible, although changes are kept to a minimum!
In most cases the version tagging follows the scheme Rewrite.Feature.Bugfix.

2.1.2
* bank now updates correctly again (sorry for that!)
* mostly bagBar changes and equipSets bugfixes

- .HighlightFunction changed to .highlightFunction (small 'H', consistency FTW)
- bagBar now supports highlightFunctions
- bagBar can be global for all containers (.isGlobal = true)
- new function: Implementation:GetBagButton()
- fixed bagButton onClick not toggling its bag
- fixed typo in equipSets-itemkey
- equipSets now update all open bags when changed
- introducing cargBags:FireEvent(force, event, ...)

2.1.1
* bugfix update, you need this if you have 2.1!
* fixed searchbar, extended filters and bags-sieve

- item.bindOn now supports soulbound items ("soul")
- new itemKey: item.bagType
- removed item.clink
- .toc bumped to Cataclysm

2.1
* The wiki was updated!
* Improved embedding support
* Sieves! Replace the filters with another system
* Scaffolds! Provide your own templates for item buttons
* Extended filters: pass arguments to them!
* Localization tables for auction house item classes

- File structure overhaul
- new Sieve: by bagID - lightweight enthusiasts, get rid of this filter
clutter :P
- Moved the ItemButton-UpdateX functions to their own scaffold, "Default"
- Callbacks are now correctly named events (RegisterCallback -> RegisterEvent,
HasCallback -> IsEventRegistered)
- the SearchBar now needs a .HighlightFunction to work

2.0-beta
* COMPLETE REWRITE
* Don't ever think about fixing your old layout, build a new one =)
* Beta-version, please note the "Planned features"- / ToDo-List
* and please write a comment for bug-reports, feedback, thank-you's and flaming

- object-oriented approach
- bags initialize on first open instead of in loading screen
- new plugin: TagDisplay
- a lot more modular than before!

1.3
* licensed as GPL 3
* fixed background texture of empty bag buttons
* hovering over a bag button can now fade different bag objects
* fixed tooltip-parsing not working correctly
* and now the usual developer-stuff:

- BagBar new property: BagBar.BackgroundTexture - texture path if no icon was found
- new function: object:Fire(callback, ...) - fires a callback with the defined arguments
- new function cargBags.C2I(id) - translates a ContainerID into an InventoryID
- new function cargBags.I2C(id) - translates an InventoryID into a ContainerID
- function changed: cargBags.ParseBags(bagString or bagID or table) - now returns a table every time
- new property: cargBags.BagStrings[] - holds tables of the bagID's for the different bagStrings
- :PreCheckFilters() now also fires on :GetItemInfo()

1.2
* first tooltip-scanning code, if you have wishes for more parsed infos than bindOn,
* please let me know =)

- updated for 3.2
- fixed item.id not working properly
- new item data: item.bindOn - returns "equip", "pickup", "account", "quest", "use" or nil
- 3.2 only: new item data: item.stats - returns a table of all stats of the item (see GetItemStats() for info)
- 3.2 only: new item data: item.sellValue - returns the sellValue in copper of an item
- new plugin: DataBroker - displays a databroker-object, the addon cargoShip is needed for that
Optional Files (1)
File Name
Version
Size
Author
Date
Type
9.0 r93
104kB
01-28-21 04:12 AM
Addon


Post A Reply Comment Options
Unread 09-13-10, 10:49 AM  
fakeh
A Murloc Raider

Forum posts: 7
File comments: 16
Uploads: 0
Thanks a lot Cargor. It's obvious to me now that you can't have one button showing in multiple containers - a button's a frame and you can't just render that more than once! It occurred to me that that was the exact symptom of the problem but I was for some reason blind to the cause that was staring right at me :P

I now have a kludged together version of the bag mod I've always wanted; sets of gear easily switched to-and-fro between the bank, inventory and bags, junk selling, new items filter and item stacking. When I get the opportunity to tidy up the code into something less horrific I'll publicise it, but I'll wait until after the Cataclysm.

Thanks for a great framework and your help,
All the best,
Dan.
Report comment to moderator  
Reply With Quote
Unread 09-12-10, 07:23 AM  
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view AddOns

Forum posts: 199
File comments: 374
Uploads: 18
I'm going to work on cargBags 2.2 and the equipSets today, and may try to find a working solution for you. I need to think through this from beginning to end

EDIT: Okay, 2.2 is still unstable, so I couldn't test my code. But I came up with this Gist. Your current problem is that you try to add a single button to multiple containers - but you need to add multiple buttons (with the same slot), each to its 'own' container.
__________________
« Website | GitHub »

Oh hai!
Last edited by xConStruct : 09-12-10 at 04:09 PM.
Report comment to moderator  
Reply With Quote
Unread 09-12-10, 06:02 AM  
fakeh
A Murloc Raider

Forum posts: 7
File comments: 16
Uploads: 0
Originally posted by Cargor
Theoretically you could overwrite a core-function in your layout to handle multiple buttons per slot - it would be Implementation:UpdateSlot(), originally in base/implementation.lua @ line 325.
Hi again, and thanks.

I've been pursuing this and have hit a stumbling block. I ended up assigning a group to my containers, wherein items are not exclusive. Containers without a group act as before - the first filter encountered gobbles up the item. I've got to the point where I appear to be adding the buttons to the right containers, but the button still only shows in one of them - seemingly arbitrarily.

Code:
        for _, group in pairs(groups) do
            for _, container in ipairs(group) do
                if(button) then
                    local foundButton = false
                    for _, btn in ipairs(container.buttons) do
                        if btn == button then foundButton = true; break; end
                    end
                    if(not foundButton) then
                        print('adding button for '..item.name ..' to '..container.name)
                        container:AddButton(button)
                    end
                else
                    print('adding new button for '..item.name ..' to '..container.name)
                    button = self.buttonClass:New(bagID, slotID)
                    self:SetButton(bagID, slotID, button)
                    container:AddButton(button)
                end
            end
            button:Update(item)
        end
This prints a line correctly for every container an item should have a button for. However, the button only displays once (although the other containers seemingly get an invisible button because their height increases to accommodate one). I think I'll have to rewrite button.container to be a table and so I can correctly remove buttons from containers and to more easily distinguish between cases when I have to add a button to a container and cases when the button already exists from some previous update, but I don't think that this would cause the problem I see currently.

Could I impose further and ask if you have any thoughts about the cause?

Thanks again,
Dan.
Report comment to moderator  
Reply With Quote
Unread 09-11-10, 02:44 PM  
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view AddOns

Forum posts: 199
File comments: 374
Uploads: 18
The core only provides one button per slot, because I never imagined people would like to see the same item twice.

Theoretically you could overwrite a core-function in your layout to handle multiple buttons per slot - it would be Implementation:UpdateSlot(), originally in base/implementation.lua @ line 325.
Or you create your own ItemButtons that you'd add to the container. But you would need to manually update them.
__________________
« Website | GitHub »

Oh hai!
Report comment to moderator  
Reply With Quote
Unread 09-11-10, 09:29 AM  
fakeh
A Murloc Raider

Forum posts: 7
File comments: 16
Uploads: 0
Originally posted by Cargor
Thanks for the suggestion. I'm going to include it, but probably store the setID in the key instead of value to make checking easier.
Great

Is it possible to have an item appearing in multiple containers? I'd like a container for each of my equipment sets (with buttons to withdraw and deopsit from and to the bank, etc), however I didn't realise that the filtering for an item would stop after its first allocation to a container.

Good work again,
Dan.
Report comment to moderator  
Reply With Quote
Unread 09-11-10, 08:04 AM  
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view AddOns

Forum posts: 199
File comments: 374
Uploads: 18
Thanks for the suggestion. I'm going to include it, but probably store the setID in the key instead of value to make checking easier, like:
Code:
setItems[id][setID] = true
so that you can use
Code:
item.setID[3] == true		-- for a specific set by ID
item.set["Tanking"] == true 	-- for a specific set by Name
item.set			-- for all sets
I'm currently working on some major changes (version 2.2, 'experimental'-branch), so expect a release on WoWI a bit later. Though I'll likely backport it to the 'master'-branch on GitHub.
__________________
« Website | GitHub »

Oh hai!
Report comment to moderator  
Reply With Quote
Unread 09-11-10, 03:42 AM  
fakeh
A Murloc Raider

Forum posts: 7
File comments: 16
Uploads: 0
Multiple setIDs

Hi Cargor,
Thank you so much for an excellent framework.
Could we have support for items occurring in multiple equipment sets? Something like (untested):
Code:
for setID = 1, GetNumEquipmentSets() do
    local name = GetEquipmentSetInfo(setID)
    local items = GetEquipmentSetItemIDs(name)

    for slot, id in pairs(items) do
        if not setItems[id] then setItems[id] = {} end
        table.insert(setItems[id], setID)
    end
end
in updateSets() might make sense.

Then:
Code:
ItemKeys["setID"] = function(i)
    if(not setItems) then initUpdater() end
    if(setItems[i.id]) then return setItems[i.id][0] else return nil end
end
ItemKeys["setIDs"] = function(i)
    if(not setItems) then initUpdater() end
    return setItems[i.id]
end
Thanks,
Dan.
Last edited by fakeh : 09-11-10 at 04:12 AM.
Report comment to moderator  
Reply With Quote
Unread 08-30-10, 08:27 AM  
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view AddOns

Forum posts: 199
File comments: 374
Uploads: 18
2.1 released with lots of changes!
The most important thing are the scaffolds, you probably want to add ItemButton:Scaffold("Default") to the top of the ItemButton-part.
__________________
« Website | GitHub »

Oh hai!
Report comment to moderator  
Reply With Quote
Unread 08-23-10, 04:16 PM  
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view AddOns

Forum posts: 199
File comments: 374
Uploads: 18
And it doesn't work with them? :O
Well, I'm afraid I can only give you the advice to do looots of debugging, I'm pretty sure there is no problem in the core and I can't spot an error in your code.

As for the filters, I'd suggest placing them in a separate table, just because it's more structured and tidy then
__________________
« Website | GitHub »

Oh hai!
Report comment to moderator  
Reply With Quote
Unread 08-23-10, 04:05 PM  
Soeters
A Warpwood Thunder Caller
 
Soeters's Avatar
AddOn Author - Click to view AddOns

Forum posts: 97
File comments: 207
Uploads: 20
Yes they are, if I'm not wrong it should refer to Gnomed (the implementation).
I already tried replacing self by Gnomed but same problem, maybe I should store the filters to another table.
__________________
Report comment to moderator  
Reply With Quote
Unread 08-23-10, 03:40 PM  
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view AddOns

Forum posts: 199
File comments: 374
Uploads: 18
Hm, in the commented ones they are stored in 'self'. Or am I missing something?
__________________
« Website | GitHub »

Oh hai!
Report comment to moderator  
Reply With Quote
Unread 08-23-10, 03:23 PM  
Soeters
A Warpwood Thunder Caller
 
Soeters's Avatar
AddOn Author - Click to view AddOns

Forum posts: 97
File comments: 207
Uploads: 20
Well before doing that they were created the same way commented ones are and were used as the commented bags are spawned. And I got the same problem unfortunately.
__________________
Report comment to moderator  
Reply With Quote
Unread 08-23-10, 01:04 PM  
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view AddOns

Forum posts: 199
File comments: 374
Uploads: 18
Your filters are local to :InitFilters() and not to :InitBags().
__________________
« Website | GitHub »

Oh hai!
Report comment to moderator  
Reply With Quote
Unread 08-23-10, 12:38 PM  
Soeters
A Warpwood Thunder Caller
 
Soeters's Avatar
AddOn Author - Click to view AddOns

Forum posts: 97
File comments: 207
Uploads: 20
Okay, prepare yourself for a wall of code (the stacktrace and other results will come tomorrow, I'm not on my wow computer)

http://gist.github.com/546036

Basicly this is just a reconversion of the original code but it may have added some issues I haven't spotted yet (if you want the others file code just tell me, but I don't think this is that important)
__________________
Report comment to moderator  
Reply With Quote
Unread 08-23-10, 09:24 AM  
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view AddOns

Forum posts: 199
File comments: 374
Uploads: 18
Oh, that sounds strange.

The :SetFilter() function is very simple, just:
Code:
function Container:SetFilter(filter, flag)
	self.filters[filter] = flag
end
so it seems like "onlyBank" is nil, although your code clearly states the opposite :/

Let's see ... does it happen with other containers / other filters? Can you check the type of onlyBank before setting the filter? Or please post your complete code, there's pastey.net for this or GitHub Gists including the whole stacktrace and the locals in the error-msg.

Well, you see, I'm running out of ideas - code looks completely correct to me :O
__________________
« Website | GitHub »

Oh hai!
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump:

Support AddOn Development!

You have just downloaded by the author . If you like this AddOn why not consider supporting the author? This author has set up a donation account. Donations ensure that authors can continue to develop useful tools for everyone.