Getting the stack size of an item under the tooltip

These two functions will return (in StackSize) the size of the stack the mouse is currently hovering over. They work for the main bags, bags in the bank and item slots in the bank.

There are other functionhooks that will take care of items in the guild bank, loot on mobs etc, but these were the two main ones I was interested in.

Snippet

 --This Hook Does Standard Bad Items
 hooksecurefunc (GameTooltip, "SetBagItem",
 function(tip, whichbag, whichslot)
 _, StackSize = GetContainerItemInfo(whichbag, whichslot);
 end
 );

 --This Hook Does The Bank Objects
 hooksecurefunc (GameTooltip, "SetInventoryItem",
 function (tip, whichunit, whichslot)
 StackSize=GetInventoryItemCount(whichunit,whichslot)
 end
 );
Posted by Philburt at Sun, 04 Mar 2012 12:34:36 +0000