WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Released AddOns (https://www.wowinterface.com/forums/forumdisplay.php?f=9)
-   -   cargBags - Help & Discussion (https://www.wowinterface.com/forums/showthread.php?t=23465)

xConStruct 05-10-09 04:05 PM

cargBags - Help & Discussion
 
Okay, here is the official thread to discuss all parts of modifying cargBags, the modular bag framework.

This thread is mostly for help requests and discussion around layouts, plugins or handlers - for feature requests or bug reports on the core, please write into the comment section of the addon.
Or you just show off your own custom layout :)

If you have questions, rather write here instead of sending PM's, so people can learn from it ;)

Additional resources:
- cargBags
- Find cargBags layouts/plugins on WoWInterface
- Git repository
- API-specifications

As more plugins and handlers come, I maybe provide some differentiation here and list them.

Good luck on creating your own custom bags!

jadakren 05-13-09 10:23 AM

Ok very nice, thanks for implementing cargBags_Anywhere.

Question : Can i run a function on the bag data before the bags are populated?

I want to change the types on some of the items before they get filtered by any potential filters that may exist.

ie "Wind-Up Train Wrecker" is listed as consumable when i want it treated as Miscellaneous, and "Fate Rune of Unsurpassed Vigor" is listed as quest when i want it treated as a Consumable.

Code:

local itemConversions = {
        ["Wind-Up Train Wrecker"] = {
                type = "Miscellaneous ",
                subtype = "Other"
        },
        ["Toy Train Set"] = {
                type = "Miscellaneous ",
                subtype = "Other"
        },
        ["Worn Troll Dice"] = {
                type = "Miscellaneous ",
                subtype = "Other"
        },
        ["Fate Rune of Unsurpassed Vigor"] = {
                type = "Consumable ",
                subtype = "Consumable"
        },
        ["Fate Rune of Primal Energy"] = {
                type = "Consumable ",
                subtype = "Consumable"
        },
        ["Fate Rune of Baneful Intent"] = {
                type = "Consumable ",
                subtype = "Consumable"
        },
}

local function PostBagDBInit(item,name,link)
        ConvertedItem = itemConversions[item.name]
        if(ConvertedItem)then
                item.type = ConvertedItem.type
        end

end


xConStruct 05-13-09 10:54 AM

Currently there are no functions for the layout that manipulate item data before it is passed to the filters. But there should be no problem in extending a filter like:
Code:

local onlyConsumables = function(item)
    return item.type == "Consumables" or itemConversions[item.name].type == "Consumables"
end

But there's a good chance that I'll include a callback for that in one of the next updates, but I don't want to commit myself at the moment:)

Luzzifus 05-16-09 04:39 AM

How to add item set filters for ItemRack, Outfitter and Blizzards Equipment Manager

Since I spent quite some time to analyse each of those addons code to extract all the information I need and to create all the necessary callbacks, I thought I'd share my resulting code. You are of course absolutely free to use it in your own cargBags layout, however if you decide to publish it, I'd appreciate to be credited. :)

All three filters are also included in my own layout, you can get it here:
cargBags_Nivaya

(Note: ClosetGnome doesn't need support anymore, since it is now only an LDB plugin for switching sets from Blizzards Equipment Manager.)

I'll first explain the code for extracting the item set info from each of those addons. The basic idea is to add some specific callbacks or hooks to each addon, which notify us when sets are added, removed or changed. Those callbacks then create a table containing all set items as a key, so the final filter can do its work efficiently.

Blizzards Equipment Manager
Code:

-- This table will hold information about all items which are part of a set:
local item2setEM = {}

-- This function will extract the item set data, so it can be
-- efficiently checked in the filter later:

local function cacheSetsEM()
    for k in pairs(item2setEM) do item2setEM[k] = nil end
    for k = 1, GetNumEquipmentSets() do
        local sName = GetEquipmentSetInfo(k)
        local set = GetEquipmentSetItemIDs(sName)
        for _,item in next, set do
            -- "item" is simply the item ID here:
            if item then item2setEM[item] = true end
        end
    end
    cargBags:UpdateBags()
end

-- This creates an invisible frame to hold the required event handlers:
local EQ_Event = CreateFrame("Frame")
EQ_Event:RegisterEvent("PLAYER_LOGIN")
EQ_Event:RegisterEvent("EQUIPMENT_SETS_CHANGED")
EQ_Event:SetScript("OnEvent", cacheSetsEM)

Outfitter
Code:

local OF = IsAddOnLoaded('Outfitter')
local item2setOF = {}
local pLevel = UnitLevel("player")
-- Outfitter doesn't use item strings or links to identify items by default,
-- so this is the function to create an item string:

local function createItemString(i) return "item:"..i.Code..":"..i.EnchantCode..":"..i.JewelCode1..":"..i.JewelCode2..":"..i.JewelCode3..":"..i.JewelCode4..":"..i.SubCode..":"..i.UniqueID..":"..pLevel end

local function cacheSetsOF()
    for k in pairs(item2setOF) do item2setOF[k] = nil end
    -- Outfitter grants access to sets via categories,
    -- so there are two loops here:

    for _,id in ipairs(Outfitter_GetCategoryOrder()) do
        local OFsets = Outfitter_GetOutfitsByCategoryID(id)
        for _,vSet in pairs(OFsets) do
            for _,item in pairs(vSet.Items) do
                -- "item" is a table here, and since I don't want to save
                -- the whole table, I'll create an itemstring out of it:

                if item then item2setOF[createItemString(item)] = true end
            end
        end
    end
    cargBags:UpdateBags()
end

if OF then
    -- Outfitter supports the needed callbacks by itself:
    Outfitter_RegisterOutfitEvent("ADD_OUTFIT", cacheSetsOF)
    Outfitter_RegisterOutfitEvent("DELETE_OUTFIT", cacheSetsOF)
    Outfitter_RegisterOutfitEvent("EDIT_OUTFIT", cacheSetsOF)
    if Outfitter:IsInitialized() then
        cacheSetsOF()
    else
        Outfitter_RegisterOutfitEvent('OUTFITTER_INIT', cacheSetsOF)
    end
end

ItemRack
Code:

local IR = IsAddOnLoaded('ItemRack')
local item2setIR = {}
local function cacheSetsIR()
    for k in pairs(item2setIR) do item2setIR[k] = nil end
    local IRsets = ItemRackUser.Sets
    for i in next, IRsets do
        -- Some internal sets and queues start with one of these
        -- characters, so let's exclude them:

        if not string.find(i, "^~") then
            for _,item in pairs(IRsets[i].equip) do
                -- "item" is a custom itemstring here:
                if item then item2setIR[item] = true end
            end
        end
    end
end

if IR then
    cacheSetsIR()
    -- ItemRack doesn't support any callbacks by itself, so we're going to
    -- hook into the functions we need manually:

    local function ItemRackOpt_CreateHooks()
        -- Those are the actual hooks for adding, updating and deleting sets:
        local IRsaveSet = ItemRackOpt.SaveSet
        function ItemRackOpt.SaveSet(...) IRsaveSet(...); cacheSetsIR(); cargBags:UpdateBags() end
        local IRdeleteSet = ItemRackOpt.DeleteSet
        function ItemRackOpt.DeleteSet(...) IRdeleteSet(...); cacheSetsIR(); cargBags:UpdateBags() end
    end
    -- Amusingly, ItemRack puts its set updating functions into a
    -- load-on-demand module, so we need to hook into the LoD-function first:

    local IRtoggleOpts = ItemRack.ToggleOptions
    function ItemRack.ToggleOptions(...) IRtoggleOpts(...) ItemRackOpt_CreateHooks() end
end


The filter

Finally the filter itself, use this function as an argument to SetFilter() for one of your cargBags bag objects:
Code:

local fItemSets = function(item)
    if not item.link then return false end
    -- Check ItemRack sets:
    if item2setIR[string.match(item.link,"item:(.+):%-?%d+")] then return true end
    -- Check Outfitter sets:
    local _,_,itemStr = string.find(item.link, "^|c%x+|H(.+)|h%[.*%]")
    if item2setOF[itemStr] then return true end
    -- Check Equipment Manager sets:
    local _,itemID = strsplit(":", itemStr)
    if item2setEM[tonumber(itemID)] then return true end   
    return false
end

Blizzards Equipment Manager simply uses the item ID to identify set items, ItemRack uses some custom item string and Outfitter uses a table with extracted values from the item link. I manually created an itemstring from those values in the corresponding cacheSets-function, so I don't have to match the whole table.

**edit: Updated for Blizzards Equipment Manager and removed ClosetGnome stuff, since it is not needed anymore.

Soeters 05-16-09 07:25 AM

Thanks for this very very good work Luzzifus.

Great job :banana:

xConStruct 05-16-09 07:44 AM

Quote:

Originally Posted by jadakren (Post 135701)
Question : Can i run a function on the bag data before the bags are populated?

The new update introduces the callback function cargBags:PreCheckFilters(item, updateType). This should make it a bit more easy :)
Please note that it's not a bag object callback, but one for the complete cargBags

@Luzzifus: I agree with Soeters - Yep, it's a nice tutorial! ;)

illum1n4ti 05-16-09 08:20 AM

Hello mates,

I was thinking to share this with you :D .. As you can see i have changed the texture of the border .. see my screen shot.



Code:

-- Function is called after a button was added to an object
-- We color the borders of the button to see if it is an ammo bag or else
-- Please note that the buttons are in most cases recycled and not new created
local PostAddButton = function(self, button, bag)
        if(not button.NormalTexture) then return end
        button.NormalTexture:SetWidth(43)
        button.NormalTexture:SetHeight(43)
        button.NormalTexture:SetTexture([[Interface\FXP\Classic.tga]])


        local bagType = cargBags.Bags[button.bagID].bagType
        if(button.bagID == KEYRING_CONTAINER) then
                button.NormalTexture:SetVertexColor(1, 0.7, 0)                -- Key ring
        elseif(bagType and bagType > 0 and bagType < 8) then
                button.NormalTexture:SetVertexColor(1, 1, 0)                -- Ammo bag
        elseif(bagType and bagType > 4) then
                button.NormalTexture:SetVertexColor(0, 1, 0)                -- Profession bags
        else
                button.NormalTexture:SetVertexColor(0.5, 0.5, 0.5)        -- Normal bags
        end
end

But as u can see my Ammo and Herb bags ain't coloring :( am i doing something wrong? maybe you guys can help me out.

xConStruct 05-17-09 08:44 AM

Okay, this seems to be a problem of the core. It will be fixed in the next cargBags-update.

illum1n4ti 05-17-09 08:49 AM

Quote:

Originally Posted by Cargor (Post 136510)
Okay, this seems to be a problem of the core. It will be fixed in the next cargBags-update.

i will be waiting :D in the mean time i am gonna look at core maybe i can find it :)

Cheers mate

moniker 05-18-09 02:16 PM

Hello,

I had started working on my own layout, but Luzzifus has implemented at least the containers that I want with cbNivaya (and Luzz is adding nice features faster than I have time to ;).

However, I have two additional custom functions that I always have to go in and add that color 'unusable' items with a red overlay (thanks for the help here Cargor) and another text overlay with '*BoE*' for BoE equipment (for mailing to my enchanter).

I looked into Plugins and Handlers but it seems these have a different purpose. Beyond hooking the two functions in cbNivaya directly (UpdateButton and UpdateButtonLock) using Lua is there a more 'recommended' approach?

Thanks!

xConStruct 05-18-09 02:52 PM

I think not. It's up to the layout and cargBags doesn't provide more than one different callback per object. But hooking should be perfectly fine ;)

Luzzifus 05-18-09 02:53 PM

If you PM me the code how you do that I might include it in my layout. :)

Katae 05-24-09 11:33 AM

Restack Button

After moving to cargBags from ArkInventory, I was missing Ark's item stack merging feature, so I wrote kRestack (~18kb idle) and created a button for it in the Aurora layout (v1.0.1).

Now, kRestack isn't a plugin, but the function to run it is global and can be called directly from cargBags.

Quote:

kRestack(arg1[, arg2])
- arg1: "bags" or "bank"
- arg2: if true, will not warn the user about a restacking already in progress
This is how I implemented it in Aurora. Of course, it would need to be adapted for other layouts.

Code:

--[[ place in layout function ]]
if select(4,GetAddOnInfo("kRestack")) and (name == "cBags_Main" or name == "cBags_Bank") then
    local restack = createSmallButton("R", self, "BOTTOMLEFT", name == "cBags_Main" and 75 or 50, 0)
    restack:SetScript("OnClick", function() kRestack(name == "cBags_Main" and "bags" or "bank") end)
end

Search bar and filter

Also missed, was search from other mods, so I wrote these snipplets. I personally didn't think it warranted creating a whole plugin.

One downside is it doesn't work for keys or other custom windows. I tried, but the extra windows kept bugging out when the filter was applied, and it wasn't pretty. Maybe someone else can figure it out.

edit: the problem was actually hiding the key frame when there turned out to be no matches, this was the result. filterName() was changed to work with the keyring and other (specified) spawned frames.

This is also for Aurora, and by all means, make it work better. :D

Code:

--[[ place in layout function ]]
local sText = "Search"
local searchBar = CreateFrame("EditBox", "searchBar", self)
searchBar:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT", (name == "cBags_Main" and 125 or 75), 0)
searchBar:SetWidth(100)
searchBar:SetHeight(20)
searchBar:SetAutoFocus(false)
searchBar:SetFontObject("GameFontHighlight")
searchBar:SetTextColor(1,1,1)
searchBar:SetText(sText)
searchBar:SetAltArrowKeyMode()
searchBar:SetScript("OnTextChanged", function()
    count = 0
    filterName(searchBar:GetText(), self)
    if count == 0 and searchBar:GetText() ~= "" and searchBar:GetText() ~= sText then
        searchBar:SetTextColor(1,0.38,0.38)
        filterName("", self)
    elseif searchBar:GetText() == "" or searchBar:GetText() == sText then
        searchBar:SetTextColor(1,1,1)
        filterName("", self)
    else
        searchBar:SetTextColor(0.38,1,0.38)
    end
end)
searchBar:SetScript("OnEditFocusGained", function()
    if searchBar:GetText() ~= sText then
        if count == 0 and searchBar:GetText() ~= "" then
            searchBar:SetTextColor(1,0.38,0.38)
            filterName("", self)
        elseif searchBar:GetText() == "" then
            searchBar:SetTextColor(1,1,1)
        else
            searchBar:SetTextColor(0.38,1,0.38)
        end
        searchBar:HighlightText()
    else
        searchBar:SetText("")
    end
end)
searchBar:SetScript("OnEditFocusLost", function()
    searchBar:HighlightText(0,0)
    searchBar:SetTextColor(1,1,1)
    if searchBar:GetText() == "" then searchBar:SetText(sText) end
end)
searchBar:SetScript("OnEnterPressed", function() searchBar:ClearFocus() end)
searchBar:SetScript("OnEscapePressed", function() searchBar:SetText(""); searchBar:ClearFocus() end)


--[[ place with filters ]]
local searchName = function(item)
    local found
    if item.texture ~= nil and filter then
        found = strfind(string.lower(item.name), filter) ~= nil
    else
        found = false
    end
    if found then count = count + 1 end
    return found
end

--[[ place after bag objects are declared ]]
function filterName(str, frame)
    if str == "" then
        filter = nil
        frame:SetFilter(searchName, false)
        key:SetFilter(searchName, false)
        junk:SetFilter(searchName, false)
    else
        filter = string.lower(str)
        frame:SetFilter(searchName, true)
        if key:IsShown() then
            count = 0
            key:SetFilter(searchName, true)
        end
        if junk:IsShown() then
            count = 0
            junk:SetFilter(searchName, true)
        end
    end
end


Soeters 06-04-09 02:06 AM

Hi, I'm trying to replace the bags when his anchor is hidden.
So far here's the code I have (don't care the strange characters near bak, it means that the previous string his between brackets most likely this, bak[frame]) :

lua Code:
  1. local function SetPointToParent(frame, ...)
  2.     frame:SetPoint(...)
  3. end
  4.  
  5. function HideIfMain()
  6.     if not main:IsShown() then
  7.         CloseCargBags()
  8.     end
  9. end
  10.  
  11. local function PlaceFrame(frame, parent,...)
  12.     HideIfMain()
  13.     bak[frame] = {}
  14.     bak[frame].Point = {...}
  15.     bak[frame].ParentPoint = {parent:GetPoint()}
  16.    
  17.     SetPointToParent(frame,...)
  18.     -- Go upward
  19.     parent:SetScript("OnHide", function(self)
  20.         HideIfMain()
  21.         SetPointToParent(frame,unpack(bak[frame].ParentPoint))
  22.     end)
  23.        
  24.         -- Go to the last position
  25.     parent:SetScript("OnShow", function(self)
  26.             HideIfMain()
  27.                 frame:ClearAllPoints()
  28.               SetPointToParent(frame,unpack(bak[frame].Point))             
  29.     end)
  30. end
  31.  
  32.     -- Bags
  33. main:SetPoint("RIGHT",-65,0)
  34. filters:SetPoint("BOTTOMLEFT",main,"TOPLEFT",0,15)
  35.  
  36.  
  37. PlaceFrame(consumables,main,"TOP",main,"BOTTOM",0,-15)
  38. PlaceFrame(tgoods,consumables,"TOP",consumables,"BOTTOM",0,-15)
  39. PlaceFrame(equipment,main,"TOPRIGHT",main,"TOPLEFT",-15,0)
  40. PlaceFrame(stuff,equipment,"TOP",equipment,"BOTTOM",0,-15)
  41. PlaceFrame(quest,stuff,"TOP",stuff,"BOTTOM",0,-15)
  42. PlaceFrame(key,quest,"TOP",quest,"BOTTOM",0,-15)
  43.  
  44.     -- Bank
  45. bank:SetPoint("LEFT", 15, 0)

Everything works well execpt for equipment, if I hide it then stuff or quest (depending on which ones are shown) don't move at all.
It can understand why this bag seems not to work (different anchoring method) but not how to resolve it.

Soeters 06-17-09 03:49 AM

No one knows ?

Luzzifus 06-18-09 03:24 AM

I'm not exactly certain what you're trying to achieve. If you want empty bags to hide and all bags around the hidden bag to move together then you could also take a look at my approach, which works perfectly an is easily extendable.

My idea was to save anchoring information for every bag frame. This is not information about which one the bag is anchored to but rather which bags are anchored to the current one (mainly for performance reasons). Then there is a function which does the actual anchoring based on this information whenever it is needed (UpdateButtonPositions).

If that is what you need I can explain my approach further if you want.

Soeters 06-18-09 04:18 AM

What I try to achieve is move the bag to his parent previous placement when the parent hides. For exemple I hide my consumable bag and then my trade goods bag moves to consumable place, but when I show the consumable bag again the tade goods bag goes to his initial placement.
If I use my work (the functions given above) everything works fine, except for the equipment bag, because the stuff bag doesn't move when I hide it. I don't know why the bag doesn't move but the only difference with the other bags is that it has a different anchoring method (topright to topleft).

But you can help me with hiding empty bags that would also be cool :banana:

Luzzifus 06-18-09 04:46 AM

Ok, now what comes to my attention is that you don't call ClearAllPoints in the parents OnHide() function. And if I understand your code correctly this should be there, since you always re-set the points on hiding/showing.

----------

What I am doing has a pretty similar effect to what you are doing, though I'm doing it different. You could simply expand your code to hide empty bags by simply expanding your conditions to hide bags.

Hiding empty bags with parent anchoring

The idea was to save anchoring information in every frame. This is not information about which one the frame is anchored to but rather which frames are anchored to the current one (mainly for performance reasons). So when I'm spawning the bags, it looks like this:

Code:

-----------------------------------------------
-- Store the anchoring order:
-- read: "tar" is anchored to "src" in the direction denoted by "dir".
-----------------------------------------------

local function CreateAnchorInfo(src,tar,dir)
    tar.AnchorTo = src
    tar.AnchorDir = dir
    if src then
        if not src.AnchorTargets then src.AnchorTargets = {} end
        src.AnchorTargets[tar] = true
    end
end

-- Main Anchors:
-- Note that you still have to set points for those!

CreateAnchorInfo(nil, cB_Bags.main, "Bottom")
CreateAnchorInfo(nil, cB_Bags.bank, "Bottom")

cB_Bags.main:SetPoint("BOTTOMRIGHT", -20, 150)
cB_Bags.bank:SetPoint("LEFT", 15, 0)   
   
-- Bank Anchors:
CreateAnchorInfo(cB_Bags.bank, cB_Bags.bankArmor, "Right")
CreateAnchorInfo(cB_Bags.bankArmor, cB_Bags.bankTrade, "Bottom")

-- more CreateAnchorInfos --

As already said, this does nothing more than storing the information about the hierarchy. I'm not setting any other points except those for the two main bags at the time of spawning. The "main bags" are obviously those which are anchored to UIParent.

Now you need this little fella in your code:

Code:

function cargBags_Nivaya:UpdateAnchors(self)
    if not self.AnchorTargets then return end
    for v,_ in pairs(self.AnchorTargets) do
        local t, u = v.AnchorTo, v.AnchorDir
        if t then
            local h = cB_BagHidden[t.Name]
            v:ClearAllPoints()
            if      not h  and u == "Top"      then v:SetPoint("BOTTOM", t, "TOP", 0, 15)
            elseif  h      and u == "Top"      then v:SetPoint("BOTTOM", t, "BOTTOM")
            elseif  not h  and u == "Bottom"  then v:SetPoint("TOP", t, "BOTTOM", 0, -15)
            elseif  h      and u == "Bottom"  then v:SetPoint("TOP", t, "TOP")
            elseif u == "Left" then v:SetPoint("BOTTOMRIGHT", t, "BOTTOMLEFT", -15, 0)
            elseif u == "Right" then v:SetPoint("TOPLEFT", t, "TOPRIGHT", 15, 0) end
        end
    end
end

This function is responsible for actually setting the points. Not all directions are covered, only those I currently need. But I hope you get the point.

The last thing you have to do is bind the anchoring update to an event. So just add something like the following to your UpdateButtonPositions handler. At the same time I'm checking for empty bags:
Code:

local tName = self.Name
local isEmpty = true

for _,v in ipairs(buttons) do
    ...
    isEmpty = false
end
cB_BagHidden[tName] = (not t) and isEmpty or false

cargBags_Nivaya:UpdateAnchors(self)

cB_BagHidden saves information about which bags should be hidden, which equals to the empty state for me. "t" is for exceptions, if you have them (see below).

Now it basically should work. There's two things you still have to do. First is to apply the check for empty bags to you OpenCargBags() function, I'm doing it like this:

Code:

local function ShowBag(bag) if not cB_BagHidden[bag.Name] then bag:Show() end end

function OpenCargBags()
    cB_Bags.main:Show()
    ShowBag(cB_Bags.armor)
    ShowBag(cB_Bags.bagNew)
    ShowBag(cB_Bags.bagItemSets)
    ShowBag(cB_Bags.quest)
    ...
end

The second thing you might wanna do is handle exceptions. So basically you usually don't want to hide the main bags when they're empty. This is also done in UpdateButtonPositions, for my layout it looks kinda messy though:

Code:

local tName = self.Name   
local tBankBags = string.find(tName, "cBniv_Bank%a+")
local tBank = tBankBags or (tName == "cBniv_Bank")

local t = (tName == "cBniv_Bag") or (tName == "cBniv_Bank") or (tName == "cBniv_Keyring")
local tAS = (tName == "cBniv_Ammo") or (tName == "cBniv_Soulshards")
if (not tBankBags and cB_Bags.main:IsShown() and not (t or tAS)) or (tBankBags and cB_Bags.bank:IsShown()) then
    if isEmpty then self:Hide() else self:Show() end
end

"t" excludes the main bags and the keyring, that's all the bags I never want to be automatically hidden or shown. The rest of the code handles automatic hiding and showing based on some conditions (appropriate main bag is opened and it's not one of the "locked" bags).

After typing all that I realize how complex my solution is.. :rolleyes:
Hope it helps anyways.

Soeters 06-18-09 05:29 AM

This isn't so complex, it's just a different point of view for setting points.
Thanks for the help, I didn't see that I forgot the ClearAllPoints in the OnHide script but not in the OnShow. Now everything is fine.

I will adapt your solution to adapt this with my layout.

jedcooper 07-08-09 11:19 AM

didn't see there is a help & discussion session, sry.
so here again my post:

i use the Nivaya addon!

first of all: very good addon, i want to use it further!! ;-)

but...

the game always gets really jerky if (it wasn't so before!) there's access to the bags. they are closed, and if i pick up loot or craft something which involves a bag place, the game stops for about 0,5 sec. it's a no go :-(

as in raids/instances where you often loot, it slows the whole game down... never had that in ANY other addon!

i hope there is a fix for this great addon... *sigh*

Dainton 07-12-09 11:19 AM

Hello, Carg.
First off, I love the addon; very minimalistic and to the point.

Secondly, is there a way to disable the item glow that your addon provides and use oGlow instead for this? I've tried commenting out all of the "glow" sections in _Pernobilis (3 to 12 & 26 to 32) which effectively removed your glow, but oGlow's does not show up.

The only reasons that I wish to use oGlow instead are that I'm using it to already glow the items in the character frame, merchant display, guild bank, etc. and also because haste's newest revision will glow quest items as well (http://github.com/haste/oGlow/tree/master).

Any help with this would be greatly appreciated. :)

xConStruct 07-13-09 03:30 PM

Preamble: This only works with the new oGlow-API (basically on haste's git).

You basically have to tell oGlow that cargBags needs to be updated, too.
Add this code on top of the layout (basically replacing the old createGlow-function):
Code:

local function dummy() end
oGlow:RegisterPipe('cargBags_Pernobilis', dummy, nil, dummy, [[The cargBags layout Pernobilis.]])
oGlow:RegisterFilterOnPipe('cargBags_Pernobilis', 'quality')
oGlow:RegisterFilterOnPipe('cargBags_Pernobilis', 'quest')

The dummy-function is merely a hack to circumvent the mandatory oGlow-functions which are not needed :/

And then this part into the UpdateButton-function, replacing the old glow-code:
Code:

        oGlow:CallFilters('cargBags_Pernobilis', button, item.link)

Dainton 07-13-09 04:15 PM

Thanks for the reply. :)

I might just be overlooking something or completely dumb (most likely the latter), but it's telling me that it's unable to index the global "oGlow".
"Interface\AddOns\cargBags_Pernobilis\layout.lua:4:attempt to index global 'oGlow' (a nil value)"

Here's how I changed the code in the Pernobilis layout.
http://i28.tinypic.com/28ugz2q.gif

xConStruct 07-13-09 04:19 PM

Uh yeah, I forgot that you have to add oGlow to the RequiredDeps-line in the cargBags_Pernobilis.toc-file. This ensures that it's loaded before cargBags ;)

Dainton 07-13-09 05:44 PM

I even added that to it and reloaded my ui, but I guess I needed to exit the game completely. :P
Thanks, carg, it works like a charm now. :D

gagou 07-16-09 03:37 AM

Thanks for this great mod I really like it.
The API page on your website is down, is there a copy of this API somewhere else?

also new features for 2.0 are exciting, any ETA on this one? :)

xConStruct 07-16-09 06:43 AM

Quote:

Originally Posted by Dainton (Post 147209)
I even added that to it and reloaded my ui, but I guess I needed to exit the game completely. :P
Thanks, carg, it works like a charm now. :D

Yep, .toc-changes always require a complete restart.

Quote:

Originally Posted by gagou (Post 147544)
Thanks for this great mod I really like it.
The API page on your website is down, is there a copy of this API somewhere else?

also new features for 2.0 are exciting, any ETA on this one? :)

Oh yeah, you're right, have to get the server back online :p

The API can be found as well on top of all the files in the cargBags-core. I'd recommend looking there, even if the site is back online, because ... you know, programmers are lazy .... just have to program a script which does this automatically ;)

Concerning 2.0: Uhh no, not at the moment. I'm just busy on writing a bugfix-release (1.3) and releasing it in the next days. Though 2.0 is planned as the next update then.

EDIT: server back online.

xXVegâsXx 07-17-09 03:45 AM

how do i activate layouts for cargbags? i have downloaded cargbags and the nivaya layout. but now i don't know how to activate it. pls help someone who knows how it works

this error comes every start.

Code:

cargBags_Nivaya\cargBags_Nivaya.lua:575: attempt to call method 'GetHandler' (a nil value)
cargBags-0.4.4.1\core.lua:114: in function `Spawn'
cargBags_Nivaya\cargBags_Nivaya.lua:65: in function `?'
cargBags_Nivaya\cargBags_Nivaya.lua:2: in function <Interface\AddOns\cargBags_Nivaya\cargBags_Nivaya.lua:2>


xConStruct 07-17-09 05:47 AM

You' ve got a totally outdated version of cargBags (0.4.4.1). The new version is already 1.2 - with this version, it should work without problems ;)

Dainton 09-01-09 11:27 PM

Occasionally when I get in combat I am unable to open my bags (or close them if they're open before I get in combat). Here's the message that I get with Baud Error:
Code:

cargBags blocked from using cBags_Main:Show()
Count: 1

Call Stack:
[C]: in function `Show'
Interface\AddOns\cargBags_Pernobilis\layout.lua:314: in function `OpenCargBags'
Interface\AddOns\cargBags_Pernobilis\layout.lua:323: in function `ToggleBackpack'
[string "TOGGLEBACKPACK"]:1: in function <[string "TOGGLEBACKPACK"]:1>

Here is my slightly modded Pernobilis also (oGlow support/spacing/colors/draggable):
http://www.pastey.net/124517

Without Baud Error no error is displayed aside from "Interface action failed because of an AddOn" in the chat frame.

Edit: I'm using 1.3 of cargBags and 1.1 of Pernobilis.

xConStruct 09-02-09 04:14 AM

At the moment, I don't think, cargBags is solely responsible for this taint, since it doesn't use any protected frames. I assume, the error is caused, because some protected frame interacts with cargBags / the inventory in some way that causes it to become protected.

Some questions to narrow down the issue:
Can you define 'occasionally' a bit more clearly?
How do you toggle your bags?
Which addons you are using could interfere with cargBags or the inventory in general?
Does it happen with the normal _Pernobilis or another layout? (Although your code looks good to me)

Dainton 09-02-09 05:13 AM

"Occasionally" meaning that at a random time while playing it will start to do this and will continue to consistently until I reload the UI.

My bags are toggled with the standard "B" keybinding.

No other mods that I use really interfere with the bags at all. Here's a list and I've highlighted the ones that could possibly have anything to do with the bags. http://www.pastey.net/124530

I can try using the standard Pernobilis layout later today and see if it happens at all.

xConStruct 09-02-09 05:46 AM

At a quick glance, Dolemite and Molinari seem suspicious to me, because both have a secure frame and anchor it to the item-buttons of cargBags, as soon as their animation starts, making it protected in combat.

I would suggest you to show the animation on the inventory button and after that try to toggle cargBags in combat.

EDIT: Tested and reported it to the author.

Dainton 09-02-09 01:54 PM

You're awesome, thanks! :)

Dainton 09-06-09 08:14 PM

Haha, sorry to keep coming back here with problems. I just noticed today while playing an alt that the [max] tag isn't including the backpack. Here's a screenshot to show you what I mean.
http://i28.tinypic.com/10y06wy.jpg
Nothing has changed since my last posting.

zero-kill 09-06-09 09:45 PM

You mean the default "backpack" that you get at the beginning?

Dainton 09-06-09 09:54 PM

Quote:

Originally Posted by zero-kill (Post 157884)
You mean the default "backpack" that you get at the beginning?

Yes, BagId 0.

zero-kill 09-06-09 10:38 PM

I don't believe any of the flavors are showing bagID0, might be because it cannot be un-equipped.

xConStruct 09-07-09 06:36 AM

The so-called custom variable bagType define which bags should be addressed by a plugin. In _Pernobilis it is defined in lines 111 to 116, directly before the space-indicator.
The default here is "bags", so using bagIDs 1 to 4. You can however replace it by "backpack+bags" to get 0 to 4. Same goes for bank which can also be replaced by "bankframe+bank".

Seems like it's an error and I will fix it in the next version.

Dainton 09-07-09 06:27 PM

Yeah, changing:
lua Code:
  1. local bagType
  2.         if(self.Name == "cBags_Main") then
  3.             bagType = "bags"    -- We want to add all bags to our bag button bar
  4.         else
  5.             bagType = "bank"    -- the bank gets bank bags, of course
  6.         end
to:
lua Code:
  1. local bagType
  2.         if(self.Name == "cBags_Main") then
  3.             bagType = "backpack+bags"   -- We want to add all bags to our bag button bar
  4.         else
  5.             bagType = "bankframe+bank"  -- the bank gets bank bags, of course
  6.         end
seems to have worked in _Pernobilis.
Thanks again for everything. :p

Fantomette 10-28-09 03:10 AM

How to ?
 
Hi to all,

I wanted to thank the author of CargBags, and the author of Cargbags_Nivaya, layaout i'm currently using.

I'm missing one thing actually :
I put a lot of items in bank from bags, and vice-versa.
CargBags could help me i guess, i would like to see 2 functions (plugins ?) :
One put all items specified (by subtype for example, or with a configurable filter) from bags to bank,
Other one do exactly the opposite :D

Is this something easy to do ? Even if the functions are only useable from commandline but actually, putting 140 items in bank to take 140 others items from bank is boring, so boring... :/

Another thing : is there a function to autostack all items in bag and bank ?

Thanks for your time reading my (so poor) english :D

xConStruct 10-28-09 05:33 AM

Quote:

Originally Posted by Fantomette (Post 163842)
One put all items specified (by subtype for example, or with a configurable filter) from bags to bank,
Other one do exactly the opposite :D

Should be fairly easy to do if you got some Lua experience. I don't have any code snippet for this particular feature, but I could maybe write something up for you, although I'm very busy at the moment. :/
Quote:

Originally Posted by Fantomette (Post 163842)
Another thing : is there a function to autostack all items in bag and bank ?

No, but there are small addons that can do this, for example kRestack. ;)

Fantomette 10-28-09 08:50 AM

Thank you for your answer and time you will spend for me, i will look in this addon, and will look the post every day :D

Have a good day !

Areli 10-29-09 09:48 AM

CB_Niv help
 
First of all, I'd like to thank the authors of CB and CB_Niv for such a great lightweight bag addon. It fulfills most of what I wanted with so little memory, not to mention I don't have to swim in a sea of confusion for configuration problems.

However, there are just 2 things that I want to ask for help.

1. Is there any way to track currency on the bag? It doesn't seem to show up when I've enabled tracking.

2. Currently CB_Niv changes the looks on both my inventory and bank bags. Is there anyway to disable the bank bags totally so that it shows in blizzard default? I only need the great CB_Niv functions for my inventory.

Again, thank you for such great addons, they are close to perfect!

xConStruct 10-29-09 10:04 AM

Quote:

Originally Posted by Areli (Post 163982)
1. Is there any way to track currency on the bag? It doesn't seem to show up when I've enabled tracking.

By default, there is no support for currency included at the moment (but I consider it for a future version). However, you could use the data broker-addonCurrencyTracker to display it. With my LDB display cargoShip and a bit of Lua knowledge, you could even place it on the bag frame - I don't know to what extend other display addons allow positioning, and databroker support is still very basic in cargBags.

Quote:

Originally Posted by Areli (Post 163982)
2. Currently CB_Niv changes the looks on both my inventory and bank bags. Is there anyway to disable the bank bags totally so that it shows in blizzard default? I only need the great CB_Niv functions for my inventory.

In general it should be possible, but I don't know anything about _Nivaya's code, so I can't help you with this one - it really depends on the layout.

Areli 10-29-09 11:02 AM

Thank you for the very fast reply Cargor.

I look forward to the day when you add "track currency" function to the addon. I'll look into the alternatives you've mentioned.

As to the bank bag question, I guess I'll try asking it at CB_Niv. Hopefully the author is still active.

xConStruct 11-04-09 06:05 AM

Okay, just wanted to provide a small roadmap on version 2.0, because I know you are all waiting for it ;)

The stack-compression is actually my biggest problem at the moment, because it is really difficult by terms of Blizz' API and my own modularity- and optimization-principles. I'm thinking really hard to find a good way to implement it while staying true to the principles, but it's a lot more difficult than I expected.

The focus on 2.0 is on a lot more modularity and diversity of the core cargBags. Let's face it: cargBags got so much features incorporated that I'm already getting requests of different "memory-minimalists" who would like to see a _Pernobilis without additional features. My plan is to support both sides and introduce two versions of the core, one with only the most important features and one with all. There is also the possibility that I create a script on my website which acts as a "builder" for the core: You could select which components of the cargBags-core you'd like to see.

I also plan to simplify a lot of things for the not-so-experienced users. It already began in the unreleased version 1.4 (on GitHub) which moves a lot of the layout functions back into the core, so that the layout only focuses on the important things - of course, you can completely rewrite this feature and I want to support backwards compatibility.

New default modules should include a search and a more comprehensive databroker-display. (Lightweight fanatics, remember the lite-version! ;))

Apart from that, Version 2.0 is going to feature another feature preview layout, to the same extend as _Pernobilis was to version 0.x and _Aurora/_Nivaya were to 1.x.The new version will bring a completely ingame configurable, intuitive inventory frame - I'm aiming to support draggable bags which can be compressed into one all-inventory type, a _Aurora-style mainbag with categories or separate bags like in _Nivaya. If all goes well, this configuration interface can also be easily included in other layouts.

Release date on 2.0? Don't ask that! I really don't know, and because I'm working in my unpaid freetime for it (in addition to other addons), it severely depends if I'm in the mood for cargBags-scripting. Especially since Luzzifus (author of _Nivaya) seems to be inactive, I don't get a lot of indepth API / layout suggestions and so not much motivation.

Stay tuned! :)

wurmfood 11-04-09 12:25 PM

Definitely looking forward to it! :)

One thing I'd suggest is instead of having multiple cores, include a config with the modules turned on (for those who are less likely to want to change things anyway) but turning off modules completely prevents them from loading (for the memory-conscious).

todd3835 11-04-09 12:53 PM

While I'm not a guru like luzzifus I've thought about making a new layout based on a lot of the same ideas. I'm horrible at graphics but I'm willing to give it a shot. If you have a beta version I'd be happy to test it andeither start a completely new mod for it or update Nivaya with the authors permission.....

xConStruct 11-04-09 01:46 PM

Quote:

Originally Posted by wurmfood (Post 164677)
Definitely looking forward to it! :)

One thing I'd suggest is instead of having multiple cores, include a config with the modules turned on (for those who are less likely to want to change things anyway) but turning off modules completely prevents them from loading (for the memory-conscious).

The modules are already divided into different files in the core and can be disabled in the toc. The problem is just that the average user wouldn't know which part does what (e.g. modules like "itemkeys" or "defaultCallbacks") and most of the time, it completely depends on the layout which parts are necessary. So, the only solution would be to split it into different addon folders, but I don't like this mess. Well, have to think about that ;)

Quote:

Originally Posted by todd3835 (Post 164683)
While I'm not a guru like luzzifus I've thought about making a new layout based on a lot of the same ideas. I'm horrible at graphics but I'm willing to give it a shot. If you have a beta version I'd be happy to test it andeither start a completely new mod for it or update Nivaya with the authors permission.....

That would be nice! cargBags needs a lot of layouts/plugins to gain popularity and more feedback. Graphics shouldn't be a problem (unless you want to make a really artistic layout) - in my opinion the important things are categorization and functionality. Just start simple and let the addon evolve, I think that's the route Nivaya went (well, and cargBags, too :) )
I currently don't have a beta-version for you - I have to admit that 2.0 isn't even in the alpha-stage, just thinking about the core changes at the moment. You can, however, begin with the current cargBags-release - I keep an eye on backwards-compatibility and most of the layout API would stay the same, it's more about enhancements and internal core changes.

wurmfood 11-04-09 01:59 PM

Quote:

Originally Posted by Cargor (Post 164687)
The modules are already divided into different files in the core and can be disabled in the toc. The problem is just that the average user wouldn't know which part does what (e.g. modules like "itemkeys" or "defaultCallbacks") and most of the time, it completely depends on the layout which parts are necessary. So, the only solution would be to split it into different addon folders, but I don't like this mess. Well, have to think about that ;)

I was thinking more of the ability to enable/disable modules in a lua file. If they're in the .toc, you have to exit the game for them to take effect. If you put them in a lua you can change them and see the effect with a /reload :)

xConStruct 11-04-09 02:11 PM

If you enable/disable files in the .toc, you would also just need to do a ReloadUI. I learned that from another poster on this forums, as well - guess, Blizz changed it in some patch. ;)
But your Lua-approach has some good points, too. I could probably handle module dependancy a lot better this way.

ricks322 11-04-09 04:04 PM

Quote:

Originally Posted by Fantomette (Post 163842)
Hi to all,

Another thing : is there a function to autostack all items in bag and bank ?

Thanks for your time reading my (so poor) english :D

You might want to look at BankStack, I haven't used all of the functions but stacking from bank to bag, or bag to bank is one I have used alot.

Quokka 12-14-09 10:35 AM

is there a way to include the gildbank?

after looking in Nivaya

I Suspect this would be the filter for Consumables
Code:

    local t = cargBags:Spawn("cBniv_BankCons")
    t:SetFilter(cB_Filters.fBank, true)
    t:SetFilter(cB_Filters.fBankFilter, true)
    t:SetFilter(cB_Filters.fConsumables, true)
    cB_Bags.bankConsumables = t

But could the be split up for Potions / Flask / Elxirs / Rest / Conjered stuff

xConStruct 12-14-09 11:05 AM

At the moment there is no guildbank-support in cargBags, but it is planned for 2.0.

Quokka 12-14-09 01:29 PM

Quote:

Originally Posted by Cargor (Post 169917)
At the moment there is no guildbank-support in cargBags, but it is planned for 2.0.

Thanks for the quick responce. But what about the filter?

theiven 01-14-10 02:43 PM

woooooo back up
 
I just downloaded cargbags and it is the closest thing to what I have been looking for that I have found. At least after I downloaded cargBags_Nivaya to go with it.
but it isnt perfect of course, and I would like to make a new bag or 3.
so I tried your more info links to find out how to make a bag.
The first link API-specifications seems to be broken ( so I figure with my luck that's the one I need).
then there was this link......... just a tad over the head of someone that just downloaded this thing.
could someone point me to a page that will get me started.

the nivaya layout is almost perfect all i want to change is.
I have 2 gem bags and a mining bag in my bank.
yet my gems are in my bank bag and my mining mats are in trade goods with a bunch of meet.
I would just like to add a miner bag and a JCing bag to the layout.
I'm cool with learning what I need to.
but I need a place to start and this thread seems to jump right in the middle.
If I missed something obvious feal free to flame me, but try to add the info someplace in the flame please.

wurmfood 01-14-10 04:30 PM

The key to adding bags is in the filter section and in the right order.

cargBags_Nivaya keeps the info in two places. In filters.lua you have the basic filters which then get applied in cargBags_Nivaya.lua and some descriptions in localization.lua.

Assuming you want to do it right, I'd start out in localization.lua. Here, I'd start with adding 'cBinvL.Mining = "Mining"' after the bullet entry, and then add '["cBinv_Mining"],' after the new items entry. Do something similar for JC.

Next we head over to filters.lua. I'd add these just after the Trade Goods filter in here, but that's just to keep them ordered in my mind. I don't think they have to go in any order here.

Our first filter is going to be for mining. The first few lines for a filter in Nivaya look to be pretty common (ignoring the config option). A basic filter looks like this:
Code:

cB_Filters.fMining = function(item)
  local tC = cBniv_CatInfo[item.name]
  if tC then return (tC == "cBinv_Mining") and true or false end
  return (item.type and item.type == L.Trades) and (item.subType == "Metal & Stone")
end

The subType info comes from http://www.wowwiki.com/ItemType.

Then create something similar for JC.

Now we get to the fun part. Something important about cargBags is that when it processes the filters it does so in a particular order. The first filter it comes across that matches the item is where it is placed. This means that if we put our above filters after the trade goods filter, they'll only ever be placed in trade goods.

The order of the filters seems to be around lines 64 - 153 of cargBags_Nivaya.lua. We see the trade goods bag appears at 144 - 147, so let's put our new bags just before that and after Consumable. Since filters appear to be applied in order of the bags, this should work for us.

The format for the bags is very simple. The mining bag should look something like this:
Code:

local t = cargBags:Spawn("cBinv_Mining") -- from localization.lua
t:SetFilter(cB_Filters.fMining, true) -- from the filter we created
cB_Bags.mining = t -- creating a new bag for the stuff

Again, do the same for JC.

Finally, we place the bag by anchoring it to something else. While you can place it where you want, I'll put it under the quest items.

The function to use here is called out at line 159 (note, all line numbers are before changes) and is really simple: CreateAnchorInfo(bag we anchor to, bag we want to anchor, source bag anchor point). So, if we want to attach our bag to the bottom of something, it appears to be "CreateAnchorInfo(cB_Bags.bagStuff, cB_Bags.mining, "Top")". If we put that in after the last CreateAnchorInfo line, you should be good.

Now, I haven't tested this, but it should work with only minimal debugging. Hopefully there was enough explanation there to help. :)

theiven 01-15-10 11:55 AM

wow that was amazing
thanks for the trouble you went threw
I spent a good part of last night playing with it and got it (sorta) working as I want.
with a little more learning and playing I think ill have it.
thanks again.
once I finnish compleetly is there a place you would like me to post my new arangment so others can use it
or is it werth it

I cant say this setup method is user friendly, but it sure is powerful
but I spose if everyone posts there work when they create a new layout soon there will be something out there for everyone
thnks again for your trouble and your addon

Quokka 01-15-10 04:21 PM

Edit:
-nearly fixed-

just looking for a way to get soulbound / accoundbound gear in a filter


All times are GMT -6. The time now is 06:21 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI