WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Classic - AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=179)
-   -   Serious bug in _classic_ GetItemCount (https://www.wowinterface.com/forums/showthread.php?t=57492)

bsmorgan 09-15-19 09:03 AM

Serious bug in _classic_ GetItemCount
 
Am I going nuts?

count = GetItemCount(itemID or "itemName" or "itemLink"[, includeBank][, includeCharges])

includeBank
Boolean - true: count includes bank items

In _retail_, GetItemCount("itemName") gives number in inventory, GetItemCount("itemName",true) gives number in both, and GetItemCount("itemName",false) gives number in inventory.

In _classic_ it should work the same way, correct?

In _classic_ GetItemCount("itemName"), GetItemCount("itemName",true) and GetItemCount("itemName",false) all return the number of items that are in both. This is a bug, correct?

Is there an API call in _classic_ that I don't know about that gives just the count in your bags?

Seerah 09-15-19 01:08 PM

I just tested it out, and it's working fine for me in Classic.

bsmorgan 09-15-19 01:10 PM

Quote:

Originally Posted by bsmorgan (Post 333756)
Is there an API call in _classic_ that I don't know about that gives just the count in your bags?

I found one but it's ugly...

Code:

local bags = {0,1,2,3,4}
for _, container in pairs(bags) do
    for i = 1, GetContainerNumSlots(container), 1 do
        local item = GetContainerItemLink(container, i)
        if item then
            local _,count = GetContainerItemInfo(container, i)
    ...


bsmorgan 09-15-19 02:05 PM

Quote:

Originally Posted by Seerah (Post 333767)
I just tested it out, and it's working fine for me in Classic.

That's weird. I guess I am going nuts!

Did you test with all of itemID or "itemName" or "itemLink"?

and, of course, you did have some of the same item in both your bags and your bank?

In any case, I wrote my own function that starts with GetItemCount(item,true) and works backwards.

Seerah 09-15-19 08:06 PM

I just did a quick test with a few things using item names. Yes, I had items in both the bag and bank. :rolleyes:

bsmorgan 09-15-19 08:37 PM

It is working for me now. I must have been delusional when I posted this.


All times are GMT -6. The time now is 03:45 AM.

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