Quantcast
local MAX_COMPANIONS = {
	CRITTER = 188,
	MOUNT = 290
}

do
	local progress = CreateFrame("StatusBar", "CompanionCountProgress", SpellBookCompanionsFrame, "ProfessionStatusBarTemplate")
	progress:SetPoint("CENTER", 0, -220)

	hooksecurefunc("SpellBookFrame_UpdatePages", function()
		local mode = SpellBookCompanionsFrame.mode

		if mode then
			local cur, max = GetNumCompanions(mode), MAX_COMPANIONS[mode]
			progress:SetMinMaxValues(1, max)
			progress:SetValue(cur)
			progress.rankText:SetFormattedText("%d/%d", cur, max)
		end
	end)
end