Skip to content

Commit

Permalink
Update Functions.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
ViksUI committed May 30, 2015
1 parent 57f9fa3 commit 1832813
Showing 1 changed file with 30 additions and 22 deletions.
52 changes: 30 additions & 22 deletions ShestakUI/Core/Functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ function T.SkinScrollBar(frame)
if _G[frame:GetName().."Middle"] then
_G[frame:GetName().."Middle"]:SetTexture(nil)
end

end

local tabs = {
Expand Down Expand Up @@ -1001,33 +1002,40 @@ T.UpdateReputationColor = function(self, event, unit, bar)
end

T.UpdateComboPoint = function(self, event, unit)
if unit == "pet" then return end
if unit == "pet" then return end

local cpoints = self.CPoints
local cp = (UnitHasVehicleUI("player") or UnitHasVehicleUI("vehicle")) and UnitPower("vehicle", 4) or UnitPower("player", 4)
local cpoints = self.CPoints
local cp = (UnitHasVehicleUI("player") or UnitHasVehicleUI("vehicle")) and UnitPower("vehicle", 4) or UnitPower("player", 4)

for i = 1, MAX_COMBO_POINTS do
if i <= cp then
cpoints[i]:SetAlpha(1)
else
cpoints[i]:SetAlpha(0.2)
end
end

if (T.class == "DRUID" and C.unitframe_class_bar.comboalways ~= true) then
local CatForm = function(self, event, unit)
local unit = self.unit or "player"
local name = UnitBuff(unit, GetSpellInfo(768))
if name then
cpoints:Show()
if self.Debuffs then self.Debuffs:SetPoint("BOTTOMRIGHT", self, "TOPRIGHT", 2, 19) end
else
cpoints:Hide()
if self.Debuffs then self.Debuffs:SetPoint("BOTTOMRIGHT", self, "TOPRIGHT", 2, 5) end
end
end

for i = 1, MAX_COMBO_POINTS do
if i <= cp then
cpoints[i]:SetAlpha(1)
else
cpoints[i]:SetAlpha(0.2)
end
end
if T.class == "DRUID" then
local CheckForm = CreateFrame("Frame", self:GetName().."_CheckForm", cpoints)
CheckForm:RegisterEvent("UNIT_AURA")
CheckForm:RegisterEvent("PLAYER_LOGIN")
CheckForm:SetScript("OnEvent", function(self, event)
if (event == "PLAYER_LOGIN" or event == "UNIT_AURA") then
local unit = self.unit or "player"
local name = UnitBuff(unit, GetSpellInfo(768))
if name then
cpoints:Show()
else
cpoints:Hide()
end
end
end)
CheckForm:RegisterEvent("PLAYER_ENTERING_WORLD")
CheckForm:SetScript("OnEvent", CatForm)
CheckForm:SetScript("OnUpdate", CatForm)
CheckForm:SetScript("OnShow", CatForm)
CheckForm:SetScript("OnHide", CatForm)
end
end

Expand Down

0 comments on commit 1832813

Please sign in to comment.