Skip to content

Commit

Permalink
toc bumps, deprecated method workarounds
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuller committed May 11, 2024
1 parent 3616305 commit f67ca22
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 21 deletions.
2 changes: 1 addition & 1 deletion OmniCC/OmniCC.toc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Interface: 100207, 40400
## Interface: 110000, 100207, 40400
## Interface-Classic: 11502
## Title: OmniCC
## Notes: Cooldown count for everything
Expand Down
50 changes: 39 additions & 11 deletions OmniCC/core/cooldown.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,52 @@ local cooldowns = {}
local Cooldown = {}

-- queries
local function IsGlobalCooldown(start, duration)
if start == 0 or duration == 0 then
return false
local IsGlobalCooldown, GetGCDTimeRemaining

if C_Spell and type(C_Spell.GetSpellCooldown) == "function" then
IsGlobalCooldown = function (start, duration)
if start == 0 or duration == 0 then
return false
end

local gcd = C_Spell.GetSpellCooldown(GCD_SPELL_ID)

return gcd and start == gcd.startTime and duration == gcd.duration
end

local gcdStart, gcdDuration = GetSpellCooldown(GCD_SPELL_ID)
GetGCDTimeRemaining = function()
local gcd = C_Spell.GetSpellCooldown(GCD_SPELL_ID)

return start == gcdStart and duration == gcdDuration
end
if not gcd then
return 0
end

if gcd.startTime == 0 or gcd.duration == 0 then
return 0
end

local function GetGCDTimeRemaining()
local start, duration = GetSpellCooldown(GCD_SPELL_ID)
return (gcd.startTime + gcd.duration) - GetTime()
end
else
IsGlobalCooldown = function (start, duration)
if start == 0 or duration == 0 then
return false
end

if start == 0 or duration == 0 then
return 0
local gcdStart, gcdDuration = GetSpellCooldown(GCD_SPELL_ID)

return start == gcdStart and duration == gcdDuration
end

return (start + duration) - GetTime()
GetGCDTimeRemaining = function()
local start, duration = GetSpellCooldown(GCD_SPELL_ID)

if start == 0 or duration == 0 then
return 0
end

return (start + duration) - GetTime()
end
end

function Cooldown:CanShowText()
Expand Down
8 changes: 2 additions & 6 deletions OmniCC/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ end

-- utility methods
function Addon:ShowOptionsFrame()
if self:IsConfigAddonEnabled() and LoadAddOn(CONFIG_ADDON) then
if self:IsConfigAddonEnabled() and C_AddOns.LoadAddOn(CONFIG_ADDON) then
local dialog = LibStub('AceConfigDialog-3.0')

dialog:Open(ADDON)
Expand All @@ -92,11 +92,7 @@ function Addon:ShowOptionsFrame()
end

function Addon:IsConfigAddonEnabled()
if GetAddOnEnableState(UnitName('player'), CONFIG_ADDON) >= 1 then
return true
end

return false
return C_AddOns.GetAddOnEnableState(CONFIG_ADDON, UnitName('player')) > 0
end

function Addon:CreateHiddenFrame(...)
Expand Down
4 changes: 2 additions & 2 deletions OmniCC/settings/settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ function Addon:UpgradeDB()
end

local addonVersion = self.db.global.addonVersion
if addonVersion ~= GetAddOnMetadata(AddonName, 'Version') then
self.db.global.addonVersion = GetAddOnMetadata(AddonName, 'Version')
if addonVersion ~= C_AddOns.GetAddOnMetadata(AddonName, 'Version') then
self.db.global.addonVersion = C_AddOns.GetAddOnMetadata(AddonName, 'Version')
end
end

Expand Down
2 changes: 1 addition & 1 deletion OmniCC_Config/OmniCC_Config.toc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Interface: 100207, 40400
## Interface: 110000, 100207, 40400
## Interface-Classic: 11502
## Title: OmniCC Config
## Title-ruRU: Конфигурация OmniCC
Expand Down
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 10.2.7

* Update TOCs
* Preliminary War Within support

## 10.2.6

Expand Down

0 comments on commit f67ca22

Please sign in to comment.