Commit 32c3df76 authored by Tukz's avatar Tukz

Fix action bar range indicator.

parent 3ad43371
......@@ -293,12 +293,47 @@ function TukuiActionBars:UpdateActionBarsScale()
RightBar:SetScale(1)
end
function TukuiActionBars:RangeUpdate(hasrange, inrange)
local Icon = self.icon
local NormalTexture = self.NormalTexture
local ID = self.action
if not ID then
return
end
local IsUsable, NotEnoughMana = IsUsableAction(ID)
local HasRange = hasrange
local InRange = inrange
if IsUsable then
if (HasRange and InRange == false) then
Icon:SetVertexColor(0.8, 0.1, 0.1)
NormalTexture:SetVertexColor(0.8, 0.1, 0.1)
else
Icon:SetVertexColor(1.0, 1.0, 1.0)
NormalTexture:SetVertexColor(1.0, 1.0, 1.0)
end
elseif NotEnoughMana then
Icon:SetVertexColor(0.1, 0.3, 1.0)
NormalTexture:SetVertexColor(0.1, 0.3, 1.0)
else
Icon:SetVertexColor(0.3, 0.3, 0.3)
NormalTexture:SetVertexColor(0.3, 0.3, 0.3)
end
end
function TukuiActionBars:AddHooks()
hooksecurefunc("ActionButton_UpdateFlyout", self.StyleFlyout)
hooksecurefunc("SpellButton_OnClick", self.StyleFlyout)
hooksecurefunc(ActionBarActionButtonMixin, "UpdateHotkeys", self.UpdateHotKey)
hooksecurefunc("PetActionButton_SetHotkeys", self.UpdateHotKey)
hooksecurefunc("MultiActionBar_Update", self.UpdateActionBarsScale)
hooksecurefunc("ActionButton_UpdateRangeIndicator", TukuiActionBars.RangeUpdate)
end
function TukuiActionBars:OnEvent(event)
......
local T, C, L = select(2, ...):unpack()
local TukuiActionBars = T["ActionBars"]
local IsUsableAction = IsUsableAction
local IsActionInRange = IsActionInRange
local ActionHasRange = ActionHasRange
function TukuiActionBars:RangeOnUpdate(elapsed)
if (not self.rangeTimer) then
return
end
if ( self.rangeTimer == TOOLTIP_UPDATE_TIME ) then
TukuiActionBars.RangeUpdate(self)
end
end
function TukuiActionBars:RangeUpdate()
local Icon = self.icon
local NormalTexture = self.NormalTexture
local ID = self.action
if not ID then return end
local IsUsable, NotEnoughMana = IsUsableAction(ID)
local HasRange = ActionHasRange(ID)
local InRange = IsActionInRange(ID)
if IsUsable then -- Usable
if (HasRange and InRange == false) then -- Out of range
Icon:SetVertexColor(0.8, 0.1, 0.1)
NormalTexture:SetVertexColor(0.8, 0.1, 0.1)
else -- In range
Icon:SetVertexColor(1.0, 1.0, 1.0)
NormalTexture:SetVertexColor(1.0, 1.0, 1.0)
end
elseif NotEnoughMana then -- Not enough power
Icon:SetVertexColor(0.1, 0.3, 1.0)
NormalTexture:SetVertexColor(0.1, 0.3, 1.0)
else -- Not usable
Icon:SetVertexColor(0.3, 0.3, 0.3)
NormalTexture:SetVertexColor(0.3, 0.3, 0.3)
end
end
hooksecurefunc(ActionBarActionButtonMixin, "OnUpdate", TukuiActionBars.RangeOnUpdate)
hooksecurefunc(ActionBarActionButtonMixin, "Update", TukuiActionBars.RangeUpdate)
hooksecurefunc(ActionBarActionButtonMixin, "UpdateUsable", TukuiActionBars.RangeUpdate)
......@@ -14,7 +14,6 @@
<!-- Action Bars -->
<Script file="ActionBars\Core.lua"/>
<Script file="ActionBars\Skin.lua"/>
<Script file="ActionBars\Range.lua"/>
<Script file="ActionBars\Bar1.lua"/>
<Script file="ActionBars\Bar2.lua"/>
<Script file="ActionBars\Bar3.lua"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment