Skip to content

SUPERAPIHOOK_SetItemButtonCount Fixes/Updates #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

veechs
Copy link

@veechs veechs commented Apr 14, 2024

Updates to SUPERAPIHOOK_SetItemButtonCount:

  • Prevent error Interface\AddOns\SuperAPI\SuperAPI.lua:123: attempt to perform arithmetic on local count' (a string value) when count < -999.
  • Allow Blizzard code to handle the basics and just worry about font color. (This also requires resetting button.count to 0 so the split stack code doesn't get confused.)

Updates to `SUPERAPIHOOK_SetItemButtonCount`:
* Prevent error `Interface\AddOns\SuperAPI\SuperAPI.lua:123: attempt to perform arithmetic on local `count' (a string value) when `count` < -999.
* Allow Blizzard code to handle the basics and just worry about font color. (This also requires resetting `button.count` to 0 so the split stack code doesn't get confused.)
@veechs
Copy link
Author

veechs commented Apr 14, 2024

I just realized that always relying on Blizzard code means that when charges is at 1, they’ll be hidden just like count, which is probably why you didn’t write it that way. So if that’s your goal, feel free to ignore this (you’ll probably still want to fix the string concatenation bug though).

@veechs
Copy link
Author

veechs commented Apr 14, 2024

A simple fix for only the concatination issue would be:

function SUPERAPIHOOK_SetItemButtonCount(button, count)
	if not button or not count then
		return SUPERAPIHOOK_SetItemButtonCountOriginal(button, count)
	end
	if (count < 0) then
		getglobal(button:GetName().."Count"):SetText((count < -999) and "*" or math.abs(count));
		getglobal(button:GetName().."Count"):Show();
		getglobal(button:GetName().."Count"):SetFontObject(NumberFontNormalYellow);
	else
		getglobal(button:GetName().."Count"):SetFontObject(NumberFontNormal);
		SUPERAPIHOOK_SetItemButtonCountOriginal(button, count)
	end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant