-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCore.lua
More file actions
executable file
·123 lines (110 loc) · 4.36 KB
/
Core.lua
File metadata and controls
executable file
·123 lines (110 loc) · 4.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
--[[Created by Slothpala]]--
local addonName, addonTable = ...
addonTable.addon = LibStub("AceAddon-3.0"):NewAddon(addonName, "AceConsole-3.0", "AceSerializer-3.0", "AceEvent-3.0")
local addon = addonTable.addon
addon:SetDefaultModuleState(false)
addon:SetDefaultModuleLibraries("AceEvent-3.0")
local ACD = LibStub("AceConfigDialog-3.0")
local AC = LibStub("AceConfig-3.0")
local L = LibStub("AceLocale-3.0"):GetLocale(addonName)
local CR = {}
local LDBI = LibStub("LibDBIcon-1.0")
function addon:OnInitialize()
CR = addonTable.callbackRegistry
self:LoadDataBase()
local action_bars_tab = self:GetActionBarTabSettings()
local hud_tab = self:GetHUDTabOptions()
local user_modules_tab = self:GetUserModuleTabOptions()
local links_tab = self:GetLinksTabOptions()
local config_tab = self:GetConfigOptions()
local profile_options = self:GetProfileTabOptions()
local trigger_options = self:GetTriggerOptionsTable()
local event_delay_timer_options = self:GetEventDelayTimerOptions()
local create_module_options = self:GetCreateModuleOptions()
local remove_module_options = self:GetRemoveModuleOptions()
local export_module_options = self:GetExportModuleOptions()
local import_module_options = self:GetImportModuleOptions()
AC:RegisterOptionsTable("MouseOverActionSettings_Options_Tab_1", action_bars_tab)
AC:RegisterOptionsTable("MouseOverActionSettings_Options_Tab_2", hud_tab)
AC:RegisterOptionsTable("MouseOverActionSettings_Options_Tab_3", user_modules_tab)
AC:RegisterOptionsTable("MouseOverActionSettings_Options_Tab_4", links_tab)
AC:RegisterOptionsTable("MouseOverActionSettings_Options_Tab_5", config_tab)
AC:RegisterOptionsTable("MouseOverActionSettings_Options_Tab_6", profile_options)
AC:RegisterOptionsTable("MouseOverActionSettings_Options_Trigger", trigger_options)
AC:RegisterOptionsTable("MouseOverActionSettings_Options_EventTimer", event_delay_timer_options)
AC:RegisterOptionsTable("MouseOverActionSettings_Options_CreateModule", create_module_options)
AC:RegisterOptionsTable("MouseOverActionSettings_Options_RemoveModule", remove_module_options)
AC:RegisterOptionsTable("MouseOverActionSettings_Options_ExportModule", export_module_options)
AC:RegisterOptionsTable("MouseOverActionSettings_Options_ImportModule", import_module_options)
--Slash command
self:RegisterChatCommand(addonName, "SlashCommand")
self:RegisterChatCommand("mbars", "SlashCommand") --keeping this for a while for users that previously used mouseover action abrs
self:RegisterChatCommand("mas", "SlashCommand")
if self.db.global.TinkerZone then
C_Timer.After(3, function() --wait for other addons to load their stuff
addon:LoadUserModules()
end)
end
end
function addon:OnEnable()
for name, module in self:IterateModules() do
if self.db.profile[name].enabled then
module:Enable()
end
end
local minimap_button = LDBI:GetMinimapButton(addonName)
if not minimap_button then
return
end
minimap_button.icon:SetDesaturation(0)
end
function addon:OnDisable()
for name, module in self:IterateModules() do
module:Disable()
end
local minimap_button = LDBI:GetMinimapButton(addonName)
if not minimap_button then
return
end
minimap_button.icon:SetDesaturation(1)
end
function addon:UpdateTrigger()
--used to apply trigger settings immediately
for event, status in pairs(addonTable.events) do
CR:Fire(event, status)
end
end
function addon:ReloadConfig()
self:Disable()
self:Enable()
self:UpdateTrigger()
end
local moduleAssociations = {
["HotKeyFontSettings"] = "ActionBarConfig",
["CountFontSettings"] = "ActionBarConfig",
["NameFontSettings"] = "ActionBarConfig",
}
function addon:ReloadModule(name)
local name = moduleAssociations[name] or name
self:DisableModule(name)
self:EnableModule(name)
self:UpdateTrigger()
end
function addon:IsModuleEnabled(name)
return self.db.profile[name].enabled
end
function addon:SlashCommand()
if InCombatLockdown() then
self:Print(L["combat_message"])
return
end
local frame = addon:GetOptionsFrame()
if not frame:IsShown() then
frame:Show()
else
frame:Hide()
end
end
function MouseoverActionSettings_OnAddonCompartmentClick()
addon:SlashCommand()
end