From d208885c16f9c0a868073cc64be326810f60c51e Mon Sep 17 00:00:00 2001 From: Meow <30401521+me0wg4ming@users.noreply.github.com> Date: Mon, 23 Mar 2026 12:41:24 +0100 Subject: [PATCH] Show proper charges for items in bags with nampower --- modules/bags.lua | 11 +++++++++++ modules/superwow.lua | 12 +----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/modules/bags.lua b/modules/bags.lua index 28f28d6e..79652fa6 100644 --- a/modules/bags.lua +++ b/modules/bags.lua @@ -438,6 +438,17 @@ pfUI:RegisterModule("bags", "vanilla:tbc", function () end local texture, count, locked, quality = GetContainerItemInfo(bag, slot) + + -- Nampower 4.1.4+: spellChargesRemaining gives accurate charge count for + -- charged items (e.g. Brilliant Mana Oil). + -- Only use it when stackCount == 1 and spellChargesRemaining > 1, + -- otherwise we'd override normal stack counts. + if GetBagItem then + local ok, itemInfo = pcall(GetBagItem, bag, slot) + if ok and itemInfo and itemInfo.stackCount == 1 and itemInfo.spellChargesRemaining and itemInfo.spellChargesRemaining > 1 then + count = itemInfo.spellChargesRemaining + end + end local linkstr = LinkToStr(GetContainerItemLink(bag, slot)) local _, _, q, _, _, _, itype = GetItemInfo(linkstr) diff --git a/modules/superwow.lua b/modules/superwow.lua index d3afd68b..bafbb295 100644 --- a/modules/superwow.lua +++ b/modules/superwow.lua @@ -213,16 +213,6 @@ pfUI:RegisterModule("superwow", "vanilla", function () end end - -- Enhanced GetContainerItemInfo for charges - -- SuperWoW returns charges as negative numbers - pfUI.api.GetItemCharges = function(bag, slot) - local texture, count = GetContainerItemInfo(bag, slot) - if count and count < 0 then - return math.abs(count) -- Return positive charge count - end - return nil -- Not a charged item - end - -- Weapon Enchant Info on other players if GetWeaponEnchantInfo then local origGetWeaponEnchantInfo = GetWeaponEnchantInfo @@ -359,4 +349,4 @@ pfUI:RegisterModule("superwow", "vanilla", function () end end end) -end) +end) \ No newline at end of file