Skip to content

Commit

Permalink
Disable timed backup alert by default, adds migrations, tweak few def…
Browse files Browse the repository at this point in the history
…ault values, renamed timed backup alert var names
  • Loading branch information
Slivo-fr committed May 8, 2021
1 parent 6336232 commit cebc8ab
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 9 deletions.
1 change: 1 addition & 0 deletions TranqRotate.toc
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ src\defaults.lua
src\settings.lua
src\utils.lua
src\debuff.lua
src\migration.lua
7 changes: 4 additions & 3 deletions src/defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ function TranqRotate:LoadDefaults()
showWindowWhenTargetingBoss = false,
showFrenzyCooldownProgress = true,
enableIncapacitatedBackupAlert = true,
incapacitatedDelay = 1.5,
enableTimedBackupAlertValue = true,
timedBackupAlertValueDelay = 1.5,
incapacitatedDelay = 2,
enableTimedBackupAlert = false,
timedBackupAlertDelay = 3,
currentMigration = #TranqRotate.migrations,
},
}
end
4 changes: 2 additions & 2 deletions src/events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ end

-- Handle timed alert for non tranqed frenzy
function TranqRotate:handleTimedAlert()
if (TranqRotate.db.profile.enableTimedBackupAlertValue) then
C_Timer.After(TranqRotate.db.profile.timedBackupAlertValueDelay, function()
if (TranqRotate.db.profile.enableTimedBackupAlert) then
C_Timer.After(TranqRotate.db.profile.timedBackupAlertDelay, function()
if (TranqRotate.frenzy and TranqRotate:isPlayerNextTranq()) then
TranqRotate:alertBackup(TranqRotate.db.profile.unableToTranqMessage)
end
Expand Down
19 changes: 19 additions & 0 deletions src/migration.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
function TranqRotate:migrateProfile()

if (TranqRotate.db.profile.currentMigration == nil) then
TranqRotate.db.profile.currentMigration = 0
end

for i = TranqRotate.db.profile.currentMigration + 1, #TranqRotate.migrations, 1 do
TranqRotate.migrations[i]()
end
end

TranqRotate.migrations = {
-- 1.6.0
function()
-- Those are old, badly named key
TranqRotate.db.profile.enableTimedBackupAlertValue = nil
TranqRotate.db.profile.timedBackupAlertValueDelay = nil
end,
}
8 changes: 4 additions & 4 deletions src/settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -141,24 +141,24 @@ function TranqRotate:CreateConfig()
order = 26,
width = "normal",
min = 1,
max = 4,
max = 6,
step = 0.1,
},
enableTimedBackupAlertValue = {
enableTimedBackupAlert = {
name = L["ENABLE_AUTOMATIC_TIMED_BACKUP_ALERT"],
desc = L["ENABLE_AUTOMATIC_TIMED_BACKUP_ALERT_DESC"],
type = "toggle",
order = 30,
width = "double",
},
timedBackupAlertValueDelay = {
timedBackupAlertDelay = {
name = L["TIMED_DELAY_THRESHOLD"],
desc = L["TIMED_DELAY_THRESHOLD_DESC"],
type = "range",
order = 31,
width = "normal",
min = 1,
max = 4,
max = 6,
step = 0.1,
},
}
Expand Down
1 change: 1 addition & 0 deletions src/tranqRotate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function TranqRotate:init()
self.db.RegisterCallback(self, "OnProfileReset", "ProfilesChanged")

self:CreateConfig()
TranqRotate.migrateProfile()

TranqRotate.hunterTable = {}
TranqRotate.addonVersions = {}
Expand Down

0 comments on commit cebc8ab

Please sign in to comment.