TLDR (my post is a tldr of the code, not I didn’t read your post),
There’s a whole bunch of code wrapping it up but essentially Blizzard is iterating the number of items to craft, doing some stuff and calling the function each time passing a count of 1.
I can take a look a bit later but my initial thought would be to grab it at the starting point rather than the end call. But that might depend on what you’re using it for.
function Gnosis:SetupHooks()
if (wowmainline) then
-- tradeskill hooking
hooksecurefunc(C_TradeSkillUI, 'CraftRecipe', function(index, num)
Gnosis.bNewTradeSkill = tonumber(num) and true or nil;
Gnosis.iLastTradeSkillCnt = tonumber(num);
end
);
hooksecurefunc(C_TradeSkillUI, 'CraftSalvage', function(index, num)
Gnosis.bNewTradeSkill = tonumber(num) and true or nil;
Gnosis.iLastTradeSkillCnt = tonumber(num);
end
);
hooksecurefunc(C_TradeSkillUI, 'CraftEnchant', function(index, num)
Gnosis.bNewTradeSkill = tonumber(num) and true or nil;
Gnosis.iLastTradeSkillCnt = tonumber(num);
end
);
hooksecurefunc(C_TradeSkillUI, 'CloseTradeSkill', function()
Gnosis.bNewTradeSkill = nil;
Gnosis.iLastTradeSkillCnt = nil;
Gnosis:CloseAllTradeskillBars();
end
);
Bars.lua:2107
-- tradeskill stuff
local bDoResize = true;
local bnTS = true;
if (cfg.unit == "player" and cfg.bMergeTrade) then
if (isTradeSkill) then
bnTS = false;
cb.tscnt = self.iLastTradeSkillCnt and self.iLastTradeSkillCnt or 1;
Then it’s basically checking if cb.tscnt > 1 to create a combined cast bar with the full craft duration rather than creating a bar on each cast.