Quantcast
WoWInterface - View Single Post - [BETA] Actionbar Range Help
View Single Post
08-22-20, 09:39 PM   #1
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 316
[BETA] Actionbar Range Help

I have been trying for serveral hours now and cannot seem to get this code to work .
Code:
local function UpdateRange( self, elapsed )
	local rangeTimer = self.rangeTimer
	local icon = self.icon;

	if( rangeTimer == TOOLTIP_UPDATE_TIME ) then
		local inRange = IsActionInRange( self.action );
		if( inRange == false ) then
			-- Red Out Button
			icon:SetVertexColor( 1, 0, 0 );
		else
			local canUse, amountMana = IsUsableAction( self.action );
			if( canUse ) then
				icon:SetVertexColor( 1.0, 1.0, 1.0 );
			elseif( amountMana ) then
				icon:SetVertexColor( 0.5, 0.5, 1.0 );
			else
				icon:SetVertexColor( 0.4, 0.4, 0.4 );
			end
		end
	end
end

do
	hooksecurefunc( "ActionButton_OnUpdate", UpdateRange );
end
Ive tried changing the *ActionButton_OnUpdate* to hooksecurefunc(ActionBarActionButtonMixin, "OnUpdate, UpdateRange) and it dont work.

The only way i got something to happen was by modifying this code:
Code:
function ActionButton_UpdateRangeIndicator(self, checksRange, inRange)
	if ( self.HotKey:GetText() == RANGE_INDICATOR ) then
		if ( checksRange ) then
			self.HotKey:Show();
			if ( inRange ) then
				self.HotKey:SetVertexColor(LIGHTGRAY_FONT_COLOR:GetRGB());
			else
				self.HotKey:SetVertexColor(RED_FONT_COLOR:GetRGB());
			end
		else
			self.HotKey:Hide();
		end
	else
		if ( checksRange and not inRange ) then
			self.HotKey:SetVertexColor(RED_FONT_COLOR:GetRGB());
		else
			self.HotKey:SetVertexColor(LIGHTGRAY_FONT_COLOR:GetRGB());
		end
	end
end
and changing it to
Code:
function ActionButton_UpdateRangeIndicator(self, checksRange, inRange)
	if ( self.HotKey:GetText() == RANGE_INDICATOR ) then
		if ( checksRange ) then
			self.icon:Show();
			if ( inRange ) then
				self.icon:SetVertexColor(LIGHTGRAY_FONT_COLOR:GetRGB());
			else
				self.icon:SetVertexColor(RED_FONT_COLOR:GetRGB());
			end
		end
	else
		if ( checksRange and not inRange ) then
			self.icon:SetVertexColor(RED_FONT_COLOR:GetRGB());
		else
			self.icon:SetVertexColor(LIGHTGRAY_FONT_COLOR:GetRGB());
		end
	end
end
and then all the icon are light grey and look wierd.

If anyone could help with this that would be great if not i guess Ill keep trying till i hopefully get the right combo.

Thanks Coke
  Reply With Quote