-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcore.lua
More file actions
91 lines (79 loc) · 2.54 KB
/
core.lua
File metadata and controls
91 lines (79 loc) · 2.54 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
local name = ...;
--- @class MPT_NS: NumyConfigNS
local ns = select(2, ...);
--@debug@
_G.MythicPlusTweaks = ns;
if not _G.MPT then _G.MPT = ns; end
--@end-debug@
--- @class MPT_Main: NumyConfig_AceAddon, AceHook-3.0, AceEvent-3.0, AceConsole-3.0
local Main = LibStub('AceAddon-3.0'):NewAddon('Mythic Plus Tweaks', 'AceConsole-3.0', 'AceHook-3.0', 'AceEvent-3.0');
if not Main then return; end
ns.Main = Main;
function Main:OnInitialize()
if NumyProfiler then
--- @type NumyProfiler
local NumyProfiler = NumyProfiler;
NumyProfiler:WrapModules(name, 'Main', self);
NumyProfiler:WrapModules(name, 'Util', ns.Util);
for moduleName, module in self:IterateModules() do
NumyProfiler:WrapModules(name, moduleName, module);
end
end
MythicPlusTweaksDB = MythicPlusTweaksDB or {};
self.db = MythicPlusTweaksDB;
self.version = C_AddOns.GetAddOnMetadata(name, 'Version') or '';
self:InitDefaults();
for moduleName, module in self:IterateModules() do
if self.db.modules[moduleName] == false then
module:Disable();
end
end
ns.Util:Init();
local Config = ns.Config;
Config:Init("Mythic Plus Tweaks", "MythicPlusTweaks", self.db, nil, nil, self, {
'ShowOwnRatingOnLFGTooltip',
'ImproveKeystoneLink',
'AlwaysShowAffixes',
'miscQoL',
'PartyRating',
'DungeonTeleports',
'DungeonIconTooltip',
'DungeonIconText',
'KeystoneSharing-core',
'ShowScoreOnKeystoneTooltip',
'SortDungeonIcons',
'MistHelperSync',
}, function(configBuilder)
configBuilder:MakeButton(
"Open the Mythic+ UI",
function() ns.Util:ToggleMythicPlusFrame(); end
)
end);
SLASH_MYTHIC_PLUS_TWEAKS1 = '/mpt';
SLASH_MYTHIC_PLUS_TWEAKS2 = '/mythicplustweaks';
SlashCmdList['MYTHIC_PLUS_TWEAKS'] = function() Config:OpenSettings(); end
end
function Main:InitDefaults()
local defaults = {
modules = {},
moduleDb = {},
inlineConfig = true,
};
for key, value in pairs(defaults) do
if self.db[key] == nil then
self.db[key] = value;
end
end
end
function Main:SetModuleState(moduleName, enabled)
if enabled then
self:EnableModule(moduleName);
else
self:DisableModule(moduleName);
end
self.db.modules[moduleName] = enabled;
end
function Main:IsModuleEnabled(moduleName)
local module = self:GetModule(moduleName);
return module and module:IsEnabled() or false;
end