GetActionCount() changed in 1.13.3

ISSUE: GetActionCount() appears to have changed in 1.13.3, returning zero for spells requiring a reagent such as mage teleports.

BACKGROUND: GetActionCount() previously returned how often one could cast spells assigned to an action bar that requiring a reagent; and it still does so for usable items like bandages and potions on the action bar.

DISCUSSION:

  • GetActionCount() returns zero if you can do the action zero times (out of materials) and also if the action doesn’t have any number (ie, ‘fireball’)
  • Addons often disambiguate using IsConsumableAction() which returns true for the zero-mats case, but false for actions not using any mats
  • With this apparent change, IsConsumableAction() still returns true so this method of disambiguation is insufficient.
  • It appears that IsStackableAction() might be able to disambiguate between items and spells requiring reagents; but I am still investigating
  • It is possible this is intended for #nochanges, but addons can just scan the inventory manually to replicate the behaviour…

REQUEST: Can Blizzard confirm this is an intended change, and does anyone have suggestions besides IsStackableAction()?

2 Likes

See the comment at line 4. Probably about as official as you will get.

function ActionButton_UpdateCount(self)
	local text = self.Count;
	local action = self.action;
	-- In Classic, we only want to show usage counts for item actions.
	if ( IsItemAction(action) and (IsConsumableAction(action) or IsStackableAction(action)) ) then
		local count = GetActionCount(action);
		if ( count > (self.maxDisplayCount or 9999 ) ) then
			text:SetText("*");
		else
			text:SetText(count);
		end
	else
		local charges, maxCharges, chargeStart, chargeDuration = GetActionCharges(action);
		if (maxCharges > 1) then
			text:SetText(charges);
		else
			text:SetText("");
		end
	end
end
1 Like

Thanks! Line 5 also provides a good solution for addons.