Thread Rating:
  • 3 Vote(s) - 3.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GUI - Label Width and displaying Label + Figure. item.count function
#6
Code:
function ItemCount(itemid)
    local itemcount = 0
    
    --Look through regular bags first.
    for x=0,3 do
        local inv = Inventory("type="..tostring(x))
        for i, item in pairs(inv) do
            if (item.id == itemid) then
                itemcount = itemcount + item.count
            end
        end
    end
    
    --Look through equipped items bag.
    local inv = Inventory("type=1000")
    for i, item in pairs(inv) do
        if (item.id == itemid) then
            itemcount = itemcount + 1
        end
    end
    
    --Look through armory bags for off-hand through wrists
    for x=3200,3209 do
        local inv = Inventory("type="..tostring(x))
        for i, item in pairs(inv) do
            if (item.id == itemid) then
                itemcount = itemcount + 1
            end
        end
    end
    
    --Look through rings armory bag.
    local inv = Inventory("type=3300")
    for i, item in pairs(inv) do
        if (item.id == itemid) then
            itemcount = itemcount + 1
        end
    end
    
    --Look through soulstones armory bag.
    local inv = Inventory("type=3400")
    for i, item in pairs(inv) do
        if (item.id == itemid) then
            itemcount = itemcount + 1
        end
    end
    
    --Look through weapons armory bag.
    local inv = Inventory("type=3500")
    for i, item in pairs(inv) do
        if (item.id == itemid) then
            itemcount = itemcount + 1
        end
    end
    
    --Look through quest/key items bag.
    local inv = Inventory("type=2004")
    for i, item in pairs(inv) do
        if (item.id == itemid) then
            itemcount = itemcount + item.count
        end
    end
    
    return itemcount
end

This is an expanded version I use for misc inventory item counting. For fishing you really only need the first loop, but the main ffxivminion module will use this version (and I believe already uses one with basic inventory counting). You can use the code below to test:

Code:
d(ItemCount(itemid))
Reply
 


Messages In This Thread
RE: GUI - Some Progress made. - by Digitalrecline - 01-14-2015, 10:58 AM
RE: GUI - Label Width and displaying Label + Figure. item.count function - by Ace - 01-19-2015, 04:01 PM
Cheers - by Digitalrecline - 01-20-2015, 12:10 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)

We help you win the game.

FFXIV Bot and More.

 

Products