Skip to content

Commit 6e6d33f

Browse files
committed
11.1.0 updates
1 parent f4cb974 commit 6e6d33f

File tree

4 files changed

+54
-78
lines changed

4 files changed

+54
-78
lines changed

OmniCC/OmniCC.toc

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
## Interface: 110007, 110100, 40401, 11505
1+
## Interface: 110100, 110007, 40402, 40401, 11506
22
## Title: OmniCC
33
## Notes: Cooldown count for everything
4-
## Notes-koKR: 모든 것을 위한 쿨다운 카운트
54
## Notes-esMX: Contador de tiempo de reutilización
65
## Notes-esES: Contador de tiempo de reutilización
76
## Notes-ptBR: Contagem de tempo de recarga
87
## Notes-frFR: Compte à rebours du temps de recharge
98
## Notes-ruRU: Время восстановления способностей и т.п.
109
## Author: Tuller
10+
## Category: Combat
1111
## Version: @project-version@
1212
## SavedVariables: OmniCCDB, OmniCC4Config
1313
## IconTexture: Interface/Icons/spell_nature_timestop
14-
## AddonCompartmentFunc: OmniCC_Launch
1514
embeds.xml
1615
localization\localization.xml
1716
main.lua

OmniCC/main.lua

+47-74
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,76 @@
11
-- code to drive the addon
2-
local ADDON, Addon = ...
3-
local CONFIG_ADDON = ADDON .. '_Config'
4-
local L = LibStub('AceLocale-3.0'):GetLocale(ADDON)
5-
6-
function Addon:OnLoad()
7-
-- create and setup options frame and event loader
8-
local frame = self:CreateHiddenFrame('Frame')
9-
10-
-- setup an event handler
11-
frame:SetScript(
12-
'OnEvent',
13-
function(_, event, ...)
14-
local func = self[event]
15-
if type(func) == 'function' then
16-
func(self, event, ...)
17-
end
18-
end
19-
)
20-
21-
frame:RegisterEvent('ADDON_LOADED')
22-
frame:RegisterEvent('PLAYER_ENTERING_WORLD')
23-
frame:RegisterEvent('PLAYER_LOGIN')
24-
frame:RegisterEvent('PLAYER_LOGOUT')
25-
26-
self.frame = frame
2+
local AddonName, Addon = ...
3+
local CONFIG_ADDON = AddonName .. '_Config'
4+
local L = LibStub('AceLocale-3.0'):GetLocale(AddonName)
5+
6+
EventUtil.ContinueOnAddOnLoaded(AddonName, function(addonName)
7+
Addon:InitializeDB()
8+
Addon.Cooldown:SetupHooks()
9+
10+
-- setup addon compartment button
11+
if AddonCompartmentFrame then
12+
AddonCompartmentFrame:RegisterAddon{
13+
text = C_AddOns.GetAddOnMetadata(addonName, "Title"),
14+
icon = C_AddOns.GetAddOnMetadata(addonName, "IconTexture"),
15+
func = function() Addon:ShowOptionsFrame() end,
16+
}
17+
end
2718

2819
-- setup slash commands
29-
_G[('SLASH_%s1'):format(ADDON)] = ('/%s'):format(ADDON:lower())
30-
_G[('SLASH_%s2'):format(ADDON)] = '/occ'
31-
32-
SlashCmdList[ADDON] = function(cmd, ...)
20+
SlashCmdList[AddonName] = function(cmd, ...)
3321
if cmd == 'version' then
34-
print(L.Version:format(self.db.global.addonVersion))
22+
print(L.Version:format(Addon.db.global.addonVersion))
3523
else
36-
self:ShowOptionsFrame()
24+
Addon:ShowOptionsFrame()
3725
end
3826
end
3927

40-
self.OnLoad= nil
41-
end
42-
43-
-- events
44-
function Addon:ADDON_LOADED(event, addonName)
45-
if ADDON ~= addonName then
46-
return
47-
end
28+
SLASH_OmniCC1 = '/omnicc'
29+
SLASH_OmniCC2 = '/occ'
4830

49-
self.frame:UnregisterEvent(event)
31+
-- watch for subsequent events
32+
EventRegistry:RegisterFrameEventAndCallback("PLAYER_ENTERING_WORLD", Addon.PLAYER_ENTERING_WORLD, Addon)
5033

51-
self:InitializeDB()
52-
self.Cooldown:SetupHooks()
53-
end
34+
EventUtil.RegisterOnceFrameEventAndCallback("PLAYER_LOGIN", function()
35+
if not Addon.db.global.disableBlizzardCooldownText then return end
5436

55-
function Addon:PLAYER_ENTERING_WORLD()
56-
self.Timer:ForActive('Update')
57-
end
58-
59-
function Addon:PLAYER_LOGIN()
60-
if not self.db.global.disableBlizzardCooldownText then return end
37+
-- disable and preserve the user's blizzard cooldown count setting
38+
Addon.countdownForCooldowns = GetCVar('countdownForCooldowns')
39+
if Addon.countdownForCooldowns ~= '0' then
40+
SetCVar('countdownForCooldowns', '0')
41+
end
42+
end)
6143

62-
-- disable and preserve the user's blizzard cooldown count setting
63-
self.countdownForCooldowns = GetCVar('countdownForCooldowns')
64-
if self.countdownForCooldowns ~= '0' then
65-
SetCVar('countdownForCooldowns', '0')
66-
end
67-
end
44+
EventUtil.RegisterOnceFrameEventAndCallback("PLAYER_LOGOUT", function()
45+
if not Addon.db.global.disableBlizzardCooldownText then return end
6846

69-
function Addon:PLAYER_LOGOUT()
70-
if not self.db.global.disableBlizzardCooldownText then return end
47+
-- return the setting to whatever it was originally on logout
48+
-- so that the user can uninstall omnicc and go back to what they had
49+
local countdownForCooldowns = GetCVar('countdownForCooldowns')
50+
if Addon.countdownForCooldowns ~= countdownForCooldowns then
51+
SetCVar('countdownForCooldowns', Addon.countdownForCooldowns)
52+
end
53+
end)
54+
end)
7155

72-
-- return the setting to whatever it was originally on logout
73-
-- so that the user can uninstall omnicc and go back to what they had
74-
local countdownForCooldowns = GetCVar('countdownForCooldowns')
75-
if self.countdownForCooldowns ~= countdownForCooldowns then
76-
SetCVar('countdownForCooldowns', self.countdownForCooldowns)
77-
end
56+
function Addon:PLAYER_ENTERING_WORLD()
57+
self.Timer:ForActive('Update')
7858
end
7959

8060
-- utility methods
8161
function Addon:ShowOptionsFrame()
82-
if self:IsConfigAddonEnabled() and C_AddOns.LoadAddOn(CONFIG_ADDON) then
62+
if C_AddOns.LoadAddOn(CONFIG_ADDON) then
8363
local dialog = LibStub('AceConfigDialog-3.0')
8464

85-
dialog:Open(ADDON)
86-
dialog:SelectGroup(ADDON, "themes", DEFAULT)
65+
dialog:Open(AddonName)
66+
dialog:SelectGroup(AddonName, "themes", DEFAULT)
8767

8868
return true
8969
end
9070

9171
return false
9272
end
9373

94-
function Addon:IsConfigAddonEnabled()
95-
return C_AddOns.GetAddOnEnableState(CONFIG_ADDON, UnitName('player')) > 0
96-
end
97-
9874
function Addon:CreateHiddenFrame(...)
9975
local f = CreateFrame(...)
10076

@@ -121,8 +97,5 @@ function Addon:GetButtonIcon(frame)
12197
end
12298
end
12399

124-
Addon:OnLoad()
125-
126100
-- exports
127-
_G[ADDON] = Addon
128-
_G[ADDON .. '_Launch'] = function() Addon:ShowOptionsFrame() end
101+
_G[AddonName] = Addon

OmniCC_Config/OmniCC_Config.toc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Interface: 110007, 110100, 40401, 11505
1+
## Interface: 110100, 110007, 40402, 40401, 11506
22
## Title: OmniCC Config
33
## Title-ruRU: Конфигурация OmniCC
44
## Notes: OmniCC's configuration menu

changelog.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# OmniCC Changelog
22

3+
## 11.0.7
4+
5+
* Update TOCs for 11.1.0, 4.4.2 and 1.15.6
6+
37
## 11.0.6
48

59
* Fix another nil value error

0 commit comments

Comments
 (0)