Skip to content

Commit

Permalink
Fixes #171
Browse files Browse the repository at this point in the history
Also fixed line endings to Unix
  • Loading branch information
Joao Cardoso committed Nov 11, 2016
1 parent c1f5383 commit 1a3d77e
Show file tree
Hide file tree
Showing 30 changed files with 1,241 additions and 1,241 deletions.
34 changes: 17 additions & 17 deletions OmniCC.toc
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
## Interface: 70100
## Title: |cffE32929OmniCC|r
## Notes: Cooldown count for everything
## Notes-koKR: 모든 것을 위한 쿨다운 카운트
## Author: Tuller
## Version: 7.1.0
## SavedVariables: OmniCC4Config

libs\libs.xml
localization\localization.xml

main.lua

core\core.xml
settings\settings.xml
engines\engines.xml
effects\effects.xml
## Interface: 70100
## Title: |cffE32929OmniCC|r
## Notes: Cooldown count for everything
## Notes-koKR: 모든 것을 위한 쿨다운 카운트
## Author: Tuller
## Version: 7.1.0
## SavedVariables: OmniCC4Config

libs\libs.xml
localization\localization.xml

main.lua

core\core.xml
settings\settings.xml
engines\engines.xml
effects\effects.xml
90 changes: 45 additions & 45 deletions core/actions.lua
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
--[[
actions.lua
Handles action buttons specific behaviour
--]]

local Actions = OmniCC:New('Actions', {visible = {}})
local Cooldown = OmniCC.Cooldown


--[[ API ]]--

function Actions:AddDefaults()
for i, button in pairs(ActionBarButtonEventsFrame.frames) do
self:Add(button.action, button.cooldown)
end
end

function Actions:Add(action, cooldown)
cooldown.omniccAction = action

if not cooldown.omnicc then
cooldown:HookScript('OnShow', Actions.OnShow)
cooldown:HookScript('OnHide', Actions.OnHide)
Cooldown.Setup(cooldown)
end
end

function Actions:Update()
for cooldown in pairs(self.visible) do
local start, duration = GetActionCooldown(cooldown.omniccAction)
local charges = GetActionCharges(cooldown.omniccAction)

Cooldown.Start(cooldown, start, duration, charges)
end
end


--[[ Events ]]--

function Actions:OnShow()
Actions.visible[self] = true
end

function Actions:OnHide()
Actions.visible[self] = nil
--[[
actions.lua
Handles action buttons specific behaviour
--]]

local Actions = OmniCC:New('Actions', {visible = {}})
local Cooldown = OmniCC.Cooldown


--[[ API ]]--

function Actions:AddDefaults()
for i, button in pairs(ActionBarButtonEventsFrame.frames) do
self:Add(button.action, button.cooldown)
end
end

function Actions:Add(action, cooldown)
cooldown.omniccAction = action

if not cooldown.omnicc then
cooldown:HookScript('OnShow', Actions.OnShow)
cooldown:HookScript('OnHide', Actions.OnHide)
Cooldown.Setup(cooldown)
end
end

function Actions:Update()
for cooldown in pairs(self.visible) do
local start, duration = GetActionCooldown(cooldown.omniccAction)
local charges = GetActionCharges(cooldown.omniccAction)

Cooldown.Start(cooldown, start, duration, charges)
end
end


--[[ Events ]]--

function Actions:OnShow()
Actions.visible[self] = true
end

function Actions:OnHide()
Actions.visible[self] = nil
end
214 changes: 107 additions & 107 deletions core/cooldown.lua
Original file line number Diff line number Diff line change
@@ -1,108 +1,108 @@
--[[
cooldown.lua
Manages the cooldowns need for timers
--]]

local Cooldown = OmniCC:New('Cooldown')


--[[ Control ]]--

function Cooldown:Start(...)
Cooldown.UpdateAlpha(self)

if Cooldown.CanShow(self, ...) then
Cooldown.Setup(self)
self.omnicc:Start(...)
else
Cooldown.Stop(self)
end
end

function Cooldown:Setup()
if not self.omnicc then
self:HookScript('OnShow', Cooldown.OnShow)
self:HookScript('OnHide', Cooldown.OnHide)
self:HookScript('OnSizeChanged', Cooldown.OnSizeChanged)
self.omnicc = OmniCC.Timer:New(self)
end

OmniCC:SetupEffect(self)
end

function Cooldown:Stop()
local timer = self.omnicc
if timer and timer.enabled then
timer:Stop()
end
end

function Cooldown:CanShow(start, duration)
if not self.noCooldownCount and duration and start and start > 0 then
local sets = OmniCC:GetGroupSettingsFor(self)
if duration >= sets.minDuration and sets.enabled then
local globalstart, globalduration = GetSpellCooldown(61304)
return start ~= globalstart or duration ~= globalduration
end
end
end


--[[ Frame Events ]]--

function Cooldown:OnShow()
local timer = self.omnicc
if timer and timer.enabled then
if timer:GetRemain() > 0 then
timer.visible = true
timer:UpdateShown()
else
timer:Stop()
end
end
end

function Cooldown:OnHide()
local timer = self.omnicc
if timer and timer.enabled then
timer.visible = nil
timer:Hide()
end
end

function Cooldown:OnSizeChanged(width, ...)
if self.omniWidth ~= width then
self.omniWidth = width

local timer = self.omnicc
if timer then
timer:UpdateFontSize(width, ...)
end
end
end

function Cooldown:OnColorSet(...)
if not self.omniTask then
self.omniR, self.omniG, self.omniB, self.omniA = ...
Cooldown.UpdateAlpha(self)
end
end


--[[ Misc ]]--

function Cooldown:UpdateAlpha()
local alpha = OmniCC:GetGroupSettingsFor(self).spiralOpacity * (self.omniA or 1)

self.omniTask = true
OmniCC.Meta.SetSwipeColor(self, self.omniR or 0, self.omniG or 0, self.omniB or 0, alpha)
self.omniTask = nil
end

function Cooldown:ForAll(func, ...)
func = self[func]

for cooldown in pairs(OmniCC.Cache) do
func(cooldown, ...)
end
--[[
cooldown.lua
Manages the cooldowns need for timers
--]]

local Cooldown = OmniCC:New('Cooldown')


--[[ Control ]]--

function Cooldown:Start(...)
Cooldown.UpdateAlpha(self)

if Cooldown.CanShow(self, ...) then
Cooldown.Setup(self)
self.omnicc:Start(...)
else
Cooldown.Stop(self)
end
end

function Cooldown:Setup()
if not self.omnicc then
self:HookScript('OnShow', Cooldown.OnShow)
self:HookScript('OnHide', Cooldown.OnHide)
self:HookScript('OnSizeChanged', Cooldown.OnSizeChanged)
self.omnicc = OmniCC.Timer:New(self)
end

OmniCC:SetupEffect(self)
end

function Cooldown:Stop()
local timer = self.omnicc
if timer and timer.enabled then
timer:Stop()
end
end

function Cooldown:CanShow(start, duration)
if not self.noCooldownCount and duration and start and start > 0 then
local sets = OmniCC:GetGroupSettingsFor(self)
if duration >= sets.minDuration and sets.enabled then
local globalstart, globalduration = GetSpellCooldown(61304)
return start ~= globalstart or duration ~= globalduration
end
end
end


--[[ Frame Events ]]--

function Cooldown:OnShow()
local timer = self.omnicc
if timer and timer.enabled then
if timer:GetRemain() > 0 then
timer.visible = true
timer:UpdateShown()
else
timer:Stop()
end
end
end

function Cooldown:OnHide()
local timer = self.omnicc
if timer and timer.enabled then
timer.visible = nil
timer:Hide()
end
end

function Cooldown:OnSizeChanged(width, ...)
if self.omniWidth ~= width then
self.omniWidth = width

local timer = self.omnicc
if timer then
timer:UpdateFontSize(width, ...)
end
end
end

function Cooldown:OnColorSet(...)
if not self.omniTask then
self.omniR, self.omniG, self.omniB, self.omniA = ...
Cooldown.UpdateAlpha(self)
end
end


--[[ Misc ]]--

function Cooldown:UpdateAlpha()
local alpha = OmniCC:GetGroupSettingsFor(self).spiralOpacity * (self.omniA or 1)

self.omniTask = true
OmniCC.Meta.SetSwipeColor(self, self.omniR or 0, self.omniG or 0, self.omniB or 0, alpha)
self.omniTask = nil
end

function Cooldown:ForAll(func, ...)
func = self[func]

for cooldown in pairs(OmniCC.Cache) do
func(cooldown, ...)
end
end
8 changes: 4 additions & 4 deletions core/core.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="timer.lua"/>
<Script file="cooldown.lua"/>
<Script file="actions.lua"/>
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="timer.lua"/>
<Script file="cooldown.lua"/>
<Script file="actions.lua"/>
</Ui>
Loading

0 comments on commit 1a3d77e

Please sign in to comment.