-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRevise.lua
More file actions
83 lines (76 loc) · 2.24 KB
/
Revise.lua
File metadata and controls
83 lines (76 loc) · 2.24 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
---@type BFI
local BFI = select(2, ...)
local L = BFI.L
---@class Funcs
local F = BFI.funcs
---@type AbstractFramework
local AF = _G.AbstractFramework
---------------------------------------------------------------------
-- common revisions
---------------------------------------------------------------------
local commonRevisions = {
-- {
-- ver = 2,
-- fn = function(config)
-- -- do something for version 2
-- end,
-- },
{
ver = 4,
fn = function(config)
config.enhancements.mythicPlus = BFI.modules.Enhancements.GetDefaults().mythicPlus
end,
}
}
function F.ReviseCommon()
if BFIConfig.revision and BFIConfig.revision < BFI.versionNum then
for _, revise in ipairs(commonRevisions) do
if BFIConfig.revision < revise.ver then
revise.fn(BFIConfig)
end
end
end
if BFIConfig.revision and BFIConfig.revision ~= BFI.versionNum then
AF.ShowNotificationPopup(
L["BFI has been updated to version %s\nClick here to view the changelog"]:format(AF.WrapTextInColor(BFI.version, "BFI")),
27,
"!" .. AF.GetIcon("BFI_64", BFI.name),
nil, nil, "LEFT",
F.ToggleChangelogsFrame
)
end
BFIConfig.revision = BFI.versionNum
end
---------------------------------------------------------------------
-- profile revisions
---------------------------------------------------------------------
local profileRevisions = {
-- {
-- ver = 2,
-- fn = function(profile)
-- -- do something for version 2
-- end,
-- },
{
ver = 3,
fn = function(profile)
profile.chat = BFI.modules.Chat.GetDefaults()
end,
},
{
ver = 4,
fn = function(profile)
profile.maps.worldMap = BFI.modules.Maps.GetDefaults().worldMap
end,
}
}
function F.ReviseProfile(profile, force)
if (profile.revision and profile.revision < BFI.versionNum) or force then
for _, revise in ipairs(profileRevisions) do
if profile.revision < revise.ver then
revise.fn(profile)
end
end
end
profile.revision = BFI.versionNum
end