Johnny C. Lam [10-15-13 - 03:06]
diff --git a/OvaleBestAction.lua b/OvaleBestAction.lua
index c6cbc09..62f58e6 100644
--- a/OvaleBestAction.lua
+++ b/OvaleBestAction.lua
@@ -590,8 +590,8 @@ function OvaleBestAction:GetActionInfo(element)
-- Spell is a combo point finisher, but player has no combo points on the target.
return nil
end
- for _, power in pairs(OvalePower.SECONDARY_POWER) do
- if si[power] and si[power] > OvaleState.state[power] then
+ for _, powerType in pairs(OvalePower.SECONDARY_POWER) do
+ if si[powerType] and si[powerType] > OvaleState.state[powerType] then
-- Spell requires "secondary" resources, e.g., chi, focus, rage, etc.,
-- that the player does not have enough of.
return nil
diff --git a/OvaleCondition.lua b/OvaleCondition.lua
index c127805..233fa09 100644
--- a/OvaleCondition.lua
+++ b/OvaleCondition.lua
@@ -2674,7 +2674,7 @@ local function MaxPowerConditionHelper(target, power)
if target == "player" then
maxi = OvalePower.maxPower[power]
else
- maxi = API_UnitPowerMax(target, OvalePower.POWER[power].id, OvalePower.POWER[power].segments)
+ maxi = API_UnitPowerMax(target, OvalePower.POWER_INFO[power].id, OvalePower.POWER_INFO[power].segments)
end
return maxi
end
diff --git a/OvalePower.lua b/OvalePower.lua
index ac6c85f..b418856 100644
--- a/OvalePower.lua
+++ b/OvalePower.lua
@@ -34,14 +34,14 @@ local SPELL_POWER_SOUL_SHARDS = SPELL_POWER_SOUL_SHARDS
--<public-static-properties>
-- Player's current power type (key for POWER table).
-OvalePower.power = nil
--- Player's current max power; maxPower[power] = number.
+OvalePower.powerType = nil
+-- Player's current max power; maxPower[powerType] = number.
OvalePower.maxPower = {}
-- Player's current power regeneration rate for the active power type.
OvalePower.activeRegen = 0
OvalePower.inactiveRegen = 0
-OvalePower.POWER =
+OvalePower.POWER_INFO =
{
alternate = { id = SPELL_POWER_ALTERNATE_POWER, token = "ALTERNATE_RESOURCE_TEXT", mini = 0 },
burningembers = { id = SPELL_POWER_BURNING_EMBERS, token = "BURNING_EMBERS", mini = 0, segments = true },
@@ -69,9 +69,9 @@ OvalePower.SECONDARY_POWER = {
}
OvalePower.POWER_TYPE = {}
do
- for power, v in pairs(OvalePower.POWER) do
- OvalePower.POWER_TYPE[v.id] = power
- OvalePower.POWER_TYPE[v.token] = power
+ for powerType, v in pairs(OvalePower.POWER_INFO) do
+ OvalePower.POWER_TYPE[v.id] = powerType
+ OvalePower.POWER_TYPE[v.token] = powerType
end
end
--</public-static-properties>
@@ -112,7 +112,7 @@ end
function OvalePower:MaxPowerEventHandler(event)
self:UNIT_DISPLAYPOWER(event, "player")
- for _, powerInfo in pairs(self.POWER) do
+ for _, powerInfo in pairs(self.POWER_INFO) do
self:UNIT_MAXPOWER(event, "player", powerInfo.token)
end
end
@@ -126,7 +126,7 @@ end
function OvalePower:UNIT_DISPLAYPOWER(event, unitId)
if unitId == "player" then
local currentType, currentToken = API_UnitPowerType(unitId)
- self.power = self.POWER_TYPE[currentType]
+ self.powerType = self.POWER_TYPE[currentType]
self:UNIT_MAXPOWER(event, unitId, currentToken)
end
end
@@ -139,11 +139,11 @@ end
function OvalePower:UNIT_MAXPOWER(event, unitId, powerToken)
if unitId == "player" then
- local power = self.POWER_TYPE[powerToken]
- if power then
- local powerInfo = self.POWER[power]
+ local powerType = self.POWER_TYPE[powerToken]
+ if powerType then
+ local powerInfo = self.POWER_INFO[powerType]
if powerInfo then
- self.maxPower[power] = API_UnitPowerMax(unitId, powerInfo.id, powerInfo.segments)
+ self.maxPower[powerType] = API_UnitPowerMax(unitId, powerInfo.id, powerInfo.segments)
end
end
end
@@ -154,7 +154,7 @@ function OvalePower:UpdatePowerRegen()
end
function OvalePower:Debug()
- Ovale:FormatPrint("Power type: %s", self.power)
+ Ovale:FormatPrint("Power type: %s", self.powerType)
for k, v in pairs(self.maxPower) do
Ovale:FormatPrint("Max power (%s): %d", k, v)
end
diff --git a/OvaleState.lua b/OvaleState.lua
index dab9d58..10468e8 100644
--- a/OvaleState.lua
+++ b/OvaleState.lua
@@ -93,8 +93,8 @@ function OvaleState:StartNewFrame()
end
function OvaleState:UpdatePowerRates()
- for power in pairs(OvalePower.POWER) do
- self.powerRate[power] = 0
+ for powerType in pairs(OvalePower.POWER_INFO) do
+ self.powerRate[powerType] = 0
end
-- Energy regeneration for druids and monks out of DPS stance.
@@ -126,9 +126,9 @@ function OvaleState:UpdatePowerRates()
-- Power regeneration for current power type.
if Ovale.enCombat then
- self.powerRate[OvalePower.power] = OvalePower.activeRegen
+ self.powerRate[OvalePower.powerType] = OvalePower.activeRegen
else
- self.powerRate[OvalePower.power] = OvalePower.inactiveRegen
+ self.powerRate[OvalePower.powerType] = OvalePower.inactiveRegen
end
end
@@ -140,8 +140,8 @@ function OvaleState:Reset()
self.currentSpellId = nil
self.attenteFinCast = self.maintenant
self.state.combo = OvaleComboPoints.combo
- for power, v in pairs(OvalePower.POWER) do
- self.state[power] = API_UnitPower("player", v.id, v.segments)
+ for powerType, powerInfo in pairs(OvalePower.POWER_INFO) do
+ self.state[powerType] = API_UnitPower("player", powerInfo.id, powerInfo.segments)
end
self:UpdatePowerRates()
@@ -370,17 +370,17 @@ function OvaleState:ApplySpellCost(spellId, startCast, endCast)
-- Update power using information from GetSpellInfo() if there is no user-defined SpellInfo() for the spell's cost.
if cost and powerType then
- local power = OvalePower.POWER_TYPE[powerType]
- if not si or not si[power] then
- self.state[power] = self.state[power] - cost
+ powerType = OvalePower.POWER_TYPE[powerType]
+ if not si or not si[powerType] then
+ self.state[powerType] = self.state[powerType] - cost
end
end
if si then
-- Update power state, except for combo points, eclipse energy, and runes.
- for power, v in pairs(OvalePower.POWER) do
- if power ~= "eclipse" then
- local cost = si[power]
+ for powerType, powerInfo in pairs(OvalePower.POWER_INFO) do
+ if powerType ~= "eclipse" then
+ local cost = si[powerType]
if cost then
--[[
cost > 0 means that the spell costs resources.
@@ -388,30 +388,30 @@ function OvaleState:ApplySpellCost(spellId, startCast, endCast)
cost == 0 means that the spell uses all of the resources (zeroes it out).
--]]
if cost == 0 then
- self.state[power] = 0
+ self.state[powerType] = 0
else
- self.state[power] = self.state[power] - cost
+ self.state[powerType] = self.state[powerType] - cost
end
--[[
Add extra resource generated by presence of a buff.
- "buff_<power>" is the spell ID of the buff that causes extra resources to be generated or used.
- "buff_<power>_amount" is the amount of extra resources generated or used, defaulting to -1
+ "buff_<powerType>" is the spell ID of the buff that causes extra resources to be generated or used.
+ "buff_<powerType>_amount" is the amount of extra resources generated or used, defaulting to -1
(one extra resource generated).
--]]
- local buffParam = "buff_" .. tostring(power)
+ local buffParam = "buff_" .. tostring(powerType)
local buffAmoumtParam = buffParam .. "_amount"
if si[buffParam] and self:GetAura("player", si[buffParam], nil, true) then
local buffAmount = si[buffAmountParam] or -1
- self.state[power] = self.state[power] - buffAmount
+ self.state[powerType] = self.state[powerType] - buffAmount
end
- -- Clamp self.state[power] to lower and upper limits.
- local mini = v.mini or 0
- local maxi = v.maxi or OvalePower.maxPower[power]
- if mini and self.state[power] < mini then
- self.state[power] = mini
+ -- Clamp self.state[powerType] to lower and upper limits.
+ local mini = powerInfo.mini or 0
+ local maxi = powerInfo.maxi or OvalePower.maxPower[powerType]
+ if mini and self.state[powerType] < mini then
+ self.state[powerType] = mini
end
- if maxi and self.state[power] > maxi then
- self.state[power] = maxi
+ if maxi and self.state[powerType] > maxi then
+ self.state[powerType] = maxi
end
end
end
@@ -871,8 +871,8 @@ end
-- Print out the levels of each power type in the current state.
function OvaleState:DebugPower()
- for power in pairs(OvalePower.POWER) do
- Ovale:FormatPrint("%s = %d", power, self.state[power])
+ for powerType in pairs(OvalePower.POWER_INFO) do
+ Ovale:FormatPrint("%s = %d", powerType, self.state[powerType])
end
end
--</public-static-methods>