@@ -34,6 +34,7 @@ build instructions.
3434 - [ ` GetItemCooldown(itemInfo) ` / ` C_Container.GetItemCooldown(itemID) ` ] ( #getitemcooldowniteminfo--c_containergetitemcooldownitemid )
3535 - [ ` C_Container.GetContainerItemDurability(containerIndex, slotIndex) ` ] ( #c_containergetcontaineritemdurabilitycontainerindex-slotindex )
3636 - [ ` C_Container.GetContainerItemRepairCost(containerIndex, slotIndex) ` ] ( #c_containergetcontaineritemrepaircostcontainerindex-slotindex )
37+ - [ ` C_Container.GetContainerItemCharges(containerIndex, slotIndex) ` ] ( #c_containergetcontaineritemchargescontainerindex-slotindex )
3738 - [ ` C_Container.GetContainerNumFreeSlots(bagID) ` ] ( #c_containergetcontainernumfreeslotsbagid )
3839 - [ ` C_Container.PlayerHasHearthstone() ` ] ( #c_containerplayerhashearthstone )
3940 - [ ` C_Container.UseHearthstone() ` ] ( #c_containerusehearthstone )
@@ -770,6 +771,62 @@ Useful for "repair only items above N copper" smart-repair logic
770771without scanning tooltips. ClassicAPI addition; modern WoW has no
771772direct equivalent.
772773
774+ ### ` C_Container.GetContainerItemCharges(containerIndex, slotIndex) `
775+
776+ Per-slot equivalent of
777+ [ ` C_Item.GetItemCount ` ] ( #c_itemgetitemcountitem-includebank-includecharges ) 's
778+ ` includeCharges=true ` mode — returns the total uses available in
779+ * this single slot* , where ` GetItemCount ` totals the same value
780+ across every matching slot.
781+
782+ ```
783+ uses = C_Container.GetContainerItemCharges(containerIndex, slotIndex)
784+ ```
785+
786+ ` containerIndex ` accepts the same values as
787+ [ ` C_Container.GetContainerItemDurability ` ] ( #c_containergetcontaineritemdurabilitycontainerindex-slotindex )
788+ (` 0 ` = backpack, ` 1..4 ` = equipped bags, ` -1 ` /` 5..11 ` = bank, etc.).
789+ ` slotIndex ` is 1-based.
790+
791+ Math is ` stack * usesPerItem ` , where ` usesPerItem ` is
792+ ` abs(SPELL_CHARGES[0]) ` for items with a negative charges field
793+ (consume-on-use: wands, healthstones, mana gems, sapper charges)
794+ and ` 1 ` for everything else. Worked examples:
795+
796+ | Slot contents | Stack | Raw charges | Returns |
797+ | ---| ---:| ---:| ---:|
798+ | Wand of Decay at 50 charges | 1 | -50 | ** 50** |
799+ | Wand at 1 charge | 1 | -1 | ** 1** |
800+ | Healthstone | 1 | -1 | ** 1** |
801+ | Stack of 20 water | 20 | -1 | ** 20** |
802+ | Stack of 5 mana potions | 5 | -1 | ** 5** |
803+ | Hearthstone (cooldown-only) | 1 | 0 | ** 1** |
804+ | Any other item in the slot | 1 | 0 | ** 1** |
805+
806+ Returns ` nil ` only when the slot is empty.
807+
808+ ``` lua
809+ -- "how many charges does my wand have left?"
810+ local charges = C_Container .GetContainerItemCharges (0 , 1 )
811+ print (" Wand charges remaining: " .. charges )
812+
813+ -- "how many drinks across the bags?" — same as GetItemCount(water, false, true)
814+ local total = 0
815+ for bag = 0 , 4 do
816+ for slot = 1 , GetContainerNumSlots (bag ) do
817+ if C_Container .GetContainerItemID (bag , slot ) == waterID then
818+ total = total + C_Container .GetContainerItemCharges (bag , slot )
819+ end
820+ end
821+ end
822+ ```
823+
824+ ClassicAPI addition; modern WoW has no direct equivalent (modern
825+ addons read charges off tooltip text). Useful when you need a
826+ per-slot number rather than ` GetItemCount ` 's rollup — e.g. to
827+ display "X charges" on the slot UI for a wand without re-walking
828+ every other matching item.
829+
773830### ` C_Container.GetContainerNumFreeSlots(bagID) `
774831
775832Returns the number of empty slots in the given bag, plus the bag's
0 commit comments