diff --git a/OmniCC/OmniCC.toc b/OmniCC/OmniCC.toc index 034efb0..9e940f9 100644 --- a/OmniCC/OmniCC.toc +++ b/OmniCC/OmniCC.toc @@ -1,4 +1,4 @@ -## Interface: 100207, 40400 +## Interface: 110000, 100207, 40400 ## Interface-Classic: 11502 ## Title: OmniCC ## Notes: Cooldown count for everything diff --git a/OmniCC/core/cooldown.lua b/OmniCC/core/cooldown.lua index 115160d..ad6f728 100644 --- a/OmniCC/core/cooldown.lua +++ b/OmniCC/core/cooldown.lua @@ -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() diff --git a/OmniCC/main.lua b/OmniCC/main.lua index ae4139d..b9dd9df 100644 --- a/OmniCC/main.lua +++ b/OmniCC/main.lua @@ -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) @@ -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(...) diff --git a/OmniCC/settings/settings.lua b/OmniCC/settings/settings.lua index 5c012f5..694903e 100644 --- a/OmniCC/settings/settings.lua +++ b/OmniCC/settings/settings.lua @@ -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 diff --git a/OmniCC_Config/OmniCC_Config.toc b/OmniCC_Config/OmniCC_Config.toc index af8eab3..2b79d62 100644 --- a/OmniCC_Config/OmniCC_Config.toc +++ b/OmniCC_Config/OmniCC_Config.toc @@ -1,4 +1,4 @@ -## Interface: 100207, 40400 +## Interface: 110000, 100207, 40400 ## Interface-Classic: 11502 ## Title: OmniCC Config ## Title-ruRU: Конфигурация OmniCC diff --git a/changelog.md b/changelog.md index 2401d4a..a263d62 100644 --- a/changelog.md +++ b/changelog.md @@ -3,6 +3,7 @@ ## 10.2.7 * Update TOCs +* Preliminary War Within support ## 10.2.6