Thread Tools Display Modes
09-15-19, 09:03 AM   #1
bsmorgan
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 219
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?
  Reply With Quote
09-15-19, 01:08 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
I just tested it out, and it's working fine for me in Classic.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
09-15-19, 01:10 PM   #3
bsmorgan
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 219
Originally Posted by bsmorgan View Post
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)
    ...
  Reply With Quote
09-15-19, 02:05 PM   #4
bsmorgan
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 219
Originally Posted by Seerah View Post
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.
  Reply With Quote
09-15-19, 08:06 PM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
I just did a quick test with a few things using item names. Yes, I had items in both the bag and bank.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
09-15-19, 08:37 PM   #6
bsmorgan
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 219
It is working for me now. I must have been delusional when I posted this.

Last edited by bsmorgan : 09-23-19 at 05:13 AM.
  Reply With Quote

WoWInterface » Classic - AddOns, Compliations, Macros » Classic - AddOn Help/Support » Serious bug in _classic_ GetItemCount

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off