I replaced GetContainerItemInfo and GetContainerNumSlots with C_Container.GetContainerItemInfo and C_Container.GetContainerNumSlots (new UI from blizz)
Go to wow folder> Interface>AddOns>Reagentcount and open main.lua. copy my text and paste it in (replace all text currently in there.)
-- local references to globals
local ActionButton_Update = ActionButton_Update
local CreateFrame = CreateFrame
local GetContainerItemInfo = GetContainerItemInfo
local GetContainerNumSlots = GetContainerNumSlots
local SPELL_REAGENTS = SPELL_REAGENTS
local tooltipFrame
local function cleanName (name)
-- pull text from link
local itemString, itemName = name:match("|H(.*)|h%[(.*)%]|h")
return itemName or name
end
local function reagentCheck (slot)
tooltipFrame:SetAction(slot)
regions = { tooltipFrame:GetRegions() }
for i, region in pairs(regions) do
if region:GetObjectType() == "FontString" then
local text = region:GetText()
if text and string.find(text, SPELL_REAGENTS) then
local reagent = string.gsub(text, SPELL_REAGENTS, '')
return cleanName(reagent)
end
end
end
return nil
end
local function getInventoryCount (item)
local toFind = cleanName(item)
local count = 0
for bag = 4, 0, -1 do
local size = C_Container.GetContainerNumSlots(bag)
Hi,
first of all, I want to say great adddon!
Could you update it to the latest Classic Era Game Version of 1.15.0 (Season of Discovery)?
Would be awesome, thanks a lot in advance!
Hi,
first of all, I want to say great adddon!
Could you update it to the latest Classic Era Game Version of 1.14.4?
Would be awesome, thanks a lot in advance!
In reply to maximus210793:
See if the last update I made works.
Working LUA for Classic ERA:
I replaced GetContainerItemInfo and GetContainerNumSlots with C_Container.GetContainerItemInfo and C_Container.GetContainerNumSlots (new UI from blizz)
Go to wow folder> Interface>AddOns>Reagentcount and open main.lua. copy my text and paste it in (replace all text currently in there.)
-- local references to globals
local ActionButton_Update = ActionButton_Update
local CreateFrame = CreateFrame
local GetContainerItemInfo = GetContainerItemInfo
local GetContainerNumSlots = GetContainerNumSlots
local SPELL_REAGENTS = SPELL_REAGENTS
local tooltipFrame
local function cleanName (name)
-- pull text from link
local itemString, itemName = name:match("|H(.*)|h%[(.*)%]|h")
return itemName or name
end
local function reagentCheck (slot)
tooltipFrame:SetAction(slot)
regions = { tooltipFrame:GetRegions() }
for i, region in pairs(regions) do
if region:GetObjectType() == "FontString" then
local text = region:GetText()
if text and string.find(text, SPELL_REAGENTS) then
local reagent = string.gsub(text, SPELL_REAGENTS, '')
return cleanName(reagent)
end
end
end
return nil
end
local function getInventoryCount (item)
local toFind = cleanName(item)
local count = 0
for bag = 4, 0, -1 do
local size = C_Container.GetContainerNumSlots(bag)
for slot = 1, size do
local texture, itemCount, locked, quality, readable, lootable, itemLink = C_Container.GetContainerItemInfo(bag, slot);
if itemLink then
if toFind == cleanName(itemLink) then
count = count + itemCount
end
end
end
end
return count
end
local function init ()
-- create tooltip frame
tooltipFrame = CreateFrame("GameTooltip", "ReagentCount_GameTooltip", nil, "GameTooltipTemplate")
tooltipFrame:SetOwner(WorldFrame, "ANCHOR_NONE");
-- hook ActionButton_UpdateCount
hooksecurefunc("ActionButton_UpdateCount",
function (self)
local slot = self.action
if (GetActionInfo(slot) ~= 'item') then
local reagent = reagentCheck(slot)
if (reagent) then
local itemCount = getInventoryCount(reagent)
self.Count:SetText(itemCount)
end
end
end
)
end
init()
Hi,
can you please update for the latest WoW Classic Era Version.
Thanks a lot!
Can you update for WoW Classic Season of Mastery please? Would be awesome, thanks a lot!
ty very nice addon