Quantcast

Code cleanup for clarity.

Johnny C. Lam [04-27-14 - 04:39]
Code cleanup for clarity.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1336 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
OvaleBanditsGuile.lua
OvaleSteadyFocus.lua
diff --git a/OvaleBanditsGuile.lua b/OvaleBanditsGuile.lua
index 1c9b778..0995157 100644
--- a/OvaleBanditsGuile.lua
+++ b/OvaleBanditsGuile.lua
@@ -48,23 +48,22 @@ local _, self_class = API_UnitClass("player")
 -- Player's GUID.
 local self_guid = nil

--- Bandit's Guile spell ID from spellbook; re-used has as the aura ID of the hidden, stacking buff.
-local BANDITS_GUILE = 84654
 -- Aura IDs for visible buff from Bandit's Guile.
 local SHALLOW_INSIGHT = 84745
 local MODERATE_INSIGHT = 84746
 local DEEP_INSIGHT = 84747
-local INSIGHT_DURATION = 15
 -- Spell IDs for abilities that proc Bandit's Guile.
 local REVEALING_STRIKE = 84617
 local SINISTER_STRIKE = 1752
 --</private-static-properties>

 --<public-static-properties>
--- start, ending, stacks for hidden Bandit's Guile buff.
-OvaleBanditsGuile.spellId = BANDITS_GUILE
+OvaleBanditsGuile.name = "Bandit's Guile"
+-- Bandit's Guile spell ID from spellbook; re-used as the aura ID of the hidden, stacking buff.
+OvaleBanditsGuile.spellId = 84654
 OvaleBanditsGuile.start = 0
 OvaleBanditsGuile.ending = math.huge
+OvaleBanditsGuile.duration = 15
 OvaleBanditsGuile.stacks = 0
 --</public-static-properties>

@@ -162,16 +161,16 @@ end

 function OvaleBanditsGuile:GainedAura(atTime)
 	atTime = atTime or API_GetTime()
-	OvaleAura:GainedAuraOnGUID(self_guid, atTime, BANDITS_GUILE, self_guid, "HELPFUL", nil, nil, self.stacks, nil, INSIGHT_DURATION, self.ending, nil, "Bandit's Guile", nil, nil, nil)
+	OvaleAura:GainedAuraOnGUID(self_guid, atTime, self.spellId, self_guid, "HELPFUL", nil, nil, self.stacks, nil, INSIGHT_DURATION, self.ending, nil, self.name, nil, nil, nil)
 end

 function OvaleBanditsGuile:LostAura(atTime)
 	atTime = atTime or API_GetTime()
-	OvaleAura:LostAuraOnGUID(self_guid, atTime, BANDITS_GUILE, self_guid)
+	OvaleAura:LostAuraOnGUID(self_guid, atTime, self.spellId, self_guid)
 end

 function OvaleBanditsGuile:Debug()
-	local aura = OvaleAura:GetAuraByGUID(self_guid, BANDITS_GUILE, "HELPFUL", true)
+	local aura = OvaleAura:GetAuraByGUID(self_guid, self.spellId, "HELPFUL", true)
 	Ovale:FormatPrint("Player has Bandit's Guile aura with start=%s, end=%s, stacks=%d.", aura.start, aura.ending, aura.stacks)
 end
 --</public-static-methods>
diff --git a/OvaleSteadyFocus.lua b/OvaleSteadyFocus.lua
index 6eb675e..d2b9745 100644
--- a/OvaleSteadyFocus.lua
+++ b/OvaleSteadyFocus.lua
@@ -43,8 +43,6 @@ local _, self_class = API_UnitClass("player")
 -- Player's GUID.
 local self_guid = nil

--- Steady Focus spell ID from spellbook; re-used has as the aura ID of the hidden buff.
-local PRE_STEADY_FOCUS = 53224
 -- Steady Focus aura ID for visible buff.
 local STEADY_FOCUS = 53220
 -- Steady Shot spell Id.
@@ -75,8 +73,13 @@ local RANGED_ATTACKS_BY_DEBUFF = {
 --</private-static-properties>

 --<public-static-properties>
+OvaleSteadyFocus.name = "Pre-Steady Focus"
+-- Steady Focus spell ID from spellbook; re-used as the aura ID of the hidden buff.
+OvaleSteadyFocus.spellId = 53224
+OvaleSteadyFocus.start = 0
 OvaleSteadyFocus.start = 0
 OvaleSteadyFocus.ending = 0
+OvaleSteadyFocus.duration = math.huge
 OvaleSteadyFocus.stacks = 0
 --</public-static-properties>

@@ -147,19 +150,19 @@ end

 function OvaleSteadyFocus:GainedAura(atTime)
 	self.start = atTime
-	self.ending = math.huge
+	self.ending = self.start + self.duration
 	self.stacks = self.stacks + 1
-	OvaleAura:GainedAuraOnGUID(self_guid, self.start, PRE_STEADY_FOCUS, self_guid, "HELPFUL", nil, nil, 1, nil, math.huge, self.ending, nil, "Pre-Steady Focus", nil, nil, nil)
+	OvaleAura:GainedAuraOnGUID(self_guid, self.start, self.spellId, self_guid, "HELPFUL", nil, nil, self.stacks, nil, self.duration, self.ending, nil, self.name, nil, nil, nil)
 end

 function OvaleSteadyFocus:LostAura(atTime)
 	self.ending = atTime
 	self.stacks = 0
-	OvaleAura:LostAuraOnGUID(self_guid, atTime, PRE_STEADY_FOCUS, self_guid)
+	OvaleAura:LostAuraOnGUID(self_guid, atTime, self.spellId, self_guid)
 end

 function OvaleSteadyFocus:Debug()
-	local aura = OvaleAura:GetAuraByGUID(self_guid, PRE_STEADY_FOCUS, "HELPFUL", true)
+	local aura = OvaleAura:GetAuraByGUID(self_guid, self.spellId, "HELPFUL", true)
 	if aura then
 		Ovale:FormatPrint("Player has pre-Steady Focus aura with start=%s, end=%s, stacks=%d.", aura.start, aura.ending, aura.stacks)
 	else