From b2cf208b1ae98a95fef2828e8a85598bea7c1518 Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 11 May 2016 12:03:03 +0200 Subject: [PATCH] -Added an option to set the DR time. -The default DR time is now 15 seconds, because my tests show that servers use flat 15 seconds. --- Rekt.lua | 1 + data/drs.lua | 12 ++++++------ data/options.lua | 10 ++++++++++ data/optiontable.lua | 14 +++++++++++++- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/Rekt.lua b/Rekt.lua index 9757c6e..0ba765e 100644 --- a/Rekt.lua +++ b/Rekt.lua @@ -43,6 +43,7 @@ Rekt.defaults = { selfIBCDRegister = false, specdetection = true, petcdguessing = true, + drtime = 15, target = { enabled = true, size = 27, diff --git a/data/drs.lua b/data/drs.lua index 8e54eef..6a78dce 100644 --- a/data/drs.lua +++ b/data/drs.lua @@ -21,7 +21,7 @@ function Rekt:DRDebuffGained(spellID, dstGUID, isPlayer) Rekt:UpdateDRs(dstGUID); if not Rekt.drs[dstGUID][drCat] then - local cd = 18; + local cd = Rekt:getDRTime(); local currentTime = GetTime(); local endTime = currentTime + cd; local diminished = 1; @@ -45,7 +45,7 @@ function Rekt:DRDebuffGained(spellID, dstGUID, isPlayer) return; end - local cd = 18; + local cd = Rekt:getDRTime(); local currentTime = GetTime(); local endTime = currentTime + cd; Rekt.drs[dstGUID][drCat][1] = currentTime; @@ -56,7 +56,7 @@ function Rekt:DRDebuffGained(spellID, dstGUID, isPlayer) Rekt.drs[dstGUID][drCat][7] = false; Rekt.drs[dstGUID][drCat][9] = GetTime(); - --reset it back to 1, x > 3 means, the server updated the dr in less than 18 sec. + --reset it back to 1, x > 3 means, the server updated the dr in less than Rekt:getDRTime() sec. if Rekt.drs[dstGUID][drCat][6] > 3 then Rekt.drs[dstGUID][drCat][6] = 1; end @@ -94,7 +94,7 @@ function Rekt:DRDebuffFaded(spellID, dstGUID, isPlayer) --means we didn't see it applied Rekt:DRDebuffGained(spellID, dstGUID, isPlayer); else - local cd = 18; + local cd = Rekt:getDRTime(); local currentTime = GetTime(); local endTime = currentTime + cd; Rekt.drs[dstGUID][drCat][1] = currentTime; @@ -137,7 +137,7 @@ function Rekt:DRDebuffRefreshed(spellID, dstGUID, isPlayer) Rekt:DRDebuffGained(spellID, dstGUID, isPlayer); return; else - local cd = 18; + local cd = Rekt:getDRTime(); local currentTime = GetTime(); local endTime = currentTime + cd; Rekt.drs[dstGUID][drCat][1] = currentTime; @@ -148,7 +148,7 @@ function Rekt:DRDebuffRefreshed(spellID, dstGUID, isPlayer) Rekt.drs[dstGUID][drCat][7] = false; Rekt.drs[dstGUID][drCat][9] = GetTime(); - --reset it back to 1, x > 3 means, the server updated the dr in less than 18 sec. + --reset it back to 1, x > 3 means, the server updated the dr in less than Rekt:getDRTime() sec. if Rekt.drs[dstGUID][drCat][6] > 3 then Rekt.drs[dstGUID][drCat][6] = 1; end diff --git a/data/options.lua b/data/options.lua index db4c652..dd450a9 100644 --- a/data/options.lua +++ b/data/options.lua @@ -445,4 +445,14 @@ end function Rekt:setIBSelfCDRegister(v) local db = Rekt.db.profile; db["selfIBCDRegister"] = v; +end + +function Rekt:getDRTime() + local db = Rekt.db.profile; + return db["drtime"]; +end + +function Rekt:setDRTime(v) + local db = Rekt.db.profile; + db["drtime"] = v; end \ No newline at end of file diff --git a/data/optiontable.lua b/data/optiontable.lua index 571c7b7..e0acccd 100644 --- a/data/optiontable.lua +++ b/data/optiontable.lua @@ -273,7 +273,7 @@ function Rekt:getTargetandFocusOptions() Rekt:setDRNumPosition("targetdr", v); end }, - ]]-- + ]]-- } return args; end @@ -707,6 +707,18 @@ function Rekt:getGlobalOptions() Rekt:setColor("uncategorized", r, g, b, a); end }, + + --70+ + globalotherHeader = { + type = "header", name = "Other settings", order = 70 + }, + drtimerange = { + type = "range", name = "Diminishing Return time", order = 71, min = 1, max = 25, step = 1, + get = function() return Rekt:getDRTime() end, + set = function(_, v) + Rekt:setDRTime(v); + end + }, } return args; end