Quantcast

Turn "aura lag" into an advanced slider option, defaulting to 400ms.

Johnny C. Lam [12-09-13 - 02:14]
Turn "aura lag" into an advanced slider option, defaulting to 400ms.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1245 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
OvaleAura.lua
OvaleOptions.lua
diff --git a/OvaleAura.lua b/OvaleAura.lua
index 517844a..0203402 100644
--- a/OvaleAura.lua
+++ b/OvaleAura.lua
@@ -22,6 +22,7 @@ local OvalePool = Ovale.OvalePool
 local OvaleData = nil
 local OvaleFuture = nil
 local OvaleGUID = nil
+local OvaleOptions = nil
 local OvalePaperDoll = nil
 local OvaleSpellBook = nil
 local OvaleState = nil
@@ -58,10 +59,6 @@ do
 	end
 end

--- Aura lag in milliseconds, with respect to the corresponding spellcast.
--- TODO: Promote this into a slider option in the config panel.
-local self_auraLag = 300
-
 -- Some auras have a nil caster, so treat those as having a GUID of zero for indexing purposes.
 local UNKNOWN_GUID = 0

@@ -212,7 +209,8 @@ local function RemoveAurasOnGUID(auraDB, guid)
 end

 local function IsWithinAuraLag(time1, time2)
-	return (time1 - time2 < self_auraLag/1000) and (time2 - time1 < self_auraLag/1000)
+	local auraLag = OvaleOptions:GetProfile().apparence.auraLag
+	return (time1 - time2 < auraLag/1000) and (time2 - time1 < auraLag/1000)
 end

 local function GetTickLength(auraId, snapshot)
@@ -240,6 +238,7 @@ function OvaleAura:OnInitialize()
 	OvaleData = Ovale.OvaleData
 	OvaleFuture = Ovale.OvaleFuture
 	OvaleGUID = Ovale.OvaleGUID
+	OvaleOptions = Ovale.OvaleOptions
 	OvalePaperDoll = Ovale.OvalePaperDoll
 	OvaleSpellBook = Ovale.OvaleSpellBook
 	OvaleState = Ovale.OvaleState
diff --git a/OvaleOptions.lua b/OvaleOptions.lua
index 769f189..2331d96 100644
--- a/OvaleOptions.lua
+++ b/OvaleOptions.lua
@@ -318,6 +318,24 @@ local self_options =
 						},
 					},
 				},
+				advanced = {
+					order = 80,
+					type = "group",
+					name = "Advanced",
+					args =
+					{
+						auraLag =
+						{
+							order = 100,
+							type = "range",
+							name = "Aura lag",
+							desc = "Lag (in milliseconds) between when an spell is cast and when the affected aura is applied or removed.",
+							min = 100, max = 700, step = 10,
+							get = function(info) return OvaleOptions.db.profile.apparence.auraLag end,
+							set = function(info, value) OvaleOptions.db.profile.apparence.auraLag = value end
+						},
+					},
+				},
 			}
 		},
 		code =
@@ -677,11 +695,31 @@ function OvaleOptions:OnInitialize()
 			check = {},
 			list = {},
 			debug = {},
-			apparence = {enCombat=false, iconScale = 2, secondIconScale = 1, margin = 4, fontScale = 0.5, iconShiftX = 0, iconShiftY = 0,
-				smallIconScale=1, raccourcis=true, numeric=false, avecCible = false,
-				verrouille = false, vertical = false, predictif=false, highlightIcon = true, clickThru = false,
-				hideVehicule=false, flashIcon=true, targetText = "●", alpha = 1,
-				optionsAlpha = 1, updateInterval=0.1}
+			apparence = {
+				enCombat = false,
+				iconScale = 2,
+				secondIconScale = 1,
+				margin = 4,
+				fontScale = 0.5,
+				iconShiftX = 0,
+				iconShiftY = 0,
+				smallIconScale=1,
+				raccourcis=true,
+				numeric=false,
+				avecCible = false,
+				verrouille = false,
+				vertical = false,
+				predictif = false,
+				highlightIcon = true,
+				clickThru = false,
+				hideVehicule = false,
+				flashIcon = true,
+				targetText = "●",
+				alpha = 1,
+				optionsAlpha = 1,
+				updateInterval = 0.1,
+				auraLag = 400,
+			}
 		}
 	})