Johnny C. Lam [09-26-13 - 05:33]
diff --git a/OvalePaperDoll.lua b/OvalePaperDoll.lua
index fa9c6a7..e024e01 100644
--- a/OvalePaperDoll.lua
+++ b/OvalePaperDoll.lua
@@ -24,6 +24,7 @@ local tonumber = tonumber
local API_GetCritChance = GetCritChance
local API_GetMasteryEffect = GetMasteryEffect
local API_GetMeleeHaste = GetMeleeHaste
+local API_GetPowerRegen = GetPowerRegen
local API_GetRangedCritChance = GetRangedCritChance
local API_GetRangedHaste = GetRangedHaste
local API_GetSpecialization = GetSpecialization
@@ -35,6 +36,7 @@ local API_UnitAttackSpeed = UnitAttackSpeed
local API_UnitClass = UnitClass
local API_UnitDamage = UnitDamage
local API_UnitLevel = UnitLevel
+local API_UnitPowerType = UnitPowerType
local API_UnitRangedAttackPower = UnitRangedAttackPower
local API_UnitSpellHaste = UnitSpellHaste
local API_UnitStat = UnitStat
@@ -99,6 +101,11 @@ local OVALE_SNAPSHOT_STATS = {
mainHandWeaponDamage = "normalized weapon damage (mainhand)",
offHandWeaponDamage = "normalized weapon damage (offhand)",
baseDamageMultiplier = "base damage multiplier",
+ -- power type (energy, rage, mana)
+ powerType = "power type",
+ -- power regeneration rate (energy, rage, mana)
+ inactivePowerRegen = "inactive power regen",
+ activePowerRegen = "active power regen",
}
--</private-static-properties>
@@ -157,13 +164,14 @@ function OvalePaperDoll:OnEnable()
self:RegisterEvent("SPELL_POWER_CHANGED")
self:RegisterEvent("UNIT_ATTACK_POWER")
self:RegisterEvent("UNIT_DAMAGE", "UpdateDamage")
+ self:RegisterEvent("UNIT_DISPLAYPOWER")
self:RegisterEvent("UNIT_LEVEL")
self:RegisterEvent("UNIT_RANGEDDAMAGE")
self:RegisterEvent("UNIT_RANGED_ATTACK_POWER")
self:RegisterEvent("UNIT_SPELL_HASTE")
self:RegisterEvent("UNIT_STATS")
self:RegisterMessage("Ovale_EquipmentChanged", "UpdateDamage")
- self:RegisterMessage("Ovale_StanceChanged", "UpdateDamage")
+ self:RegisterMessage("Ovale_StanceChanged")
self.stat = GetSnapshot(Ovale.now)
end
@@ -180,6 +188,7 @@ function OvalePaperDoll:OnDisable()
self:UnregisterEvent("SPELL_POWER_CHANGED")
self:UnregisterEvent("UNIT_ATTACK_POWER")
self:UnregisterEvent("UNIT_DAMAGE")
+ self:UnregisterEvent("UNIT_DISPLAYPOWER")
self:UnregisterEvent("UNIT_LEVEL")
self:UnregisterEvent("UNIT_RANGEDDAMAGE")
self:UnregisterEvent("UNIT_RANGED_ATTACK_POWER")
@@ -245,6 +254,13 @@ function OvalePaperDoll:UNIT_ATTACK_POWER(event, unitId)
end
end
+function OvalePaperDoll:UNIT_DISPLAYPOWER(event, unitId)
+ if unitId == "player" then
+ self.stat.powerType = API_UnitPowerType(unitId)
+ Ovale:DebugPrintf(OVALE_PAPERDOLL_DEBUG, "%s @ %f: power type = %d", event, Ovale.now, self.stat.powerType)
+ end
+end
+
function OvalePaperDoll:UNIT_LEVEL(event, unitId)
if unitId == "player" then
self.level = API_UnitLevel(unitId)
@@ -276,10 +292,14 @@ function OvalePaperDoll:UNIT_SPELL_HASTE(event, unitId)
self.stat = GetSnapshot(Ovale.now)
self.stat.meleeHaste = API_GetMeleeHaste()
self.stat.spellHaste = API_UnitSpellHaste(unitId)
+ self.stat.inactivePowerRegen, self.stat.activePowerRegen = API_GetPowerRegen()
Ovale:DebugPrintf(OVALE_PAPERDOLL_DEBUG, "%s @ %f", event, Ovale.now)
Ovale:DebugPrintf(OVALE_PAPERDOLL_DEBUG, " %s = %f%%", OVALE_SNAPSHOT_STATS.meleeHaste, self.stat.meleeHaste)
Ovale:DebugPrintf(OVALE_PAPERDOLL_DEBUG, " %s = %f%%", OVALE_SNAPSHOT_STATS.spellHaste, self.stat.spellHaste)
+ Ovale:DebugPrintf(OVALE_PAPERDOLL_DEBUG, " %s = %f", OVALE_SNAPSHOT_STATS.inactivePowerRegen, self.stat.inactivePowerRegen)
+ Ovale:DebugPrintf(OVALE_PAPERDOLL_DEBUG, " %s = %f", OVALE_SNAPSHOT_STATS.activePowerRegen, self.stat.activePowerRegen)
self:UpdateDamage(event)
+ self:UpdatePowerRegen(event)
end
end
@@ -364,6 +384,7 @@ function OvalePaperDoll:UpdateStats(event)
self:PLAYER_DAMAGE_DONE_MODS(event, "player")
self:SPELL_POWER_CHANGED(event)
self:UNIT_ATTACK_POWER(event, "player")
+ self:UNIT_DISPLAYPOWER(event, "player")
self:UNIT_RANGEDDAMAGE(event, "player")
self:UNIT_RANGED_ATTACK_POWER(event, "player")
self:UNIT_SPELL_HASTE(event, "player")
@@ -371,6 +392,17 @@ function OvalePaperDoll:UpdateStats(event)
self:UpdateDamage(event)
end
+function OvalePaperDoll:UpdatePowerRegen(event)
+ self.stat.inactivePowerRegen, self.stat.activePowerRegen = API_GetPowerRegen()
+ Ovale:DebugPrintf(OVALE_PAPERDOLL_DEBUG, " %s = %f", OVALE_SNAPSHOT_STATS.inactivePowerRegen, self.stat.inactivePowerRegen)
+ Ovale:DebugPrintf(OVALE_PAPERDOLL_DEBUG, " %s = %f", OVALE_SNAPSHOT_STATS.activePowerRegen, self.stat.activePowerRegen)
+end
+
+function OvalePaperDoll:Ovale_StanceChanged(event)
+ self:UpdateDamage(event)
+ self:UpdatePowerRegen(event)
+end
+
function OvalePaperDoll:GetMasteryMultiplier()
return 1 + self.stat.masteryEffect / 100
end
diff --git a/OvaleState.lua b/OvaleState.lua
index f109365..70dd576 100644
--- a/OvaleState.lua
+++ b/OvaleState.lua
@@ -94,62 +94,19 @@ function OvaleState:StartNewFrame()
end
function OvaleState:UpdatePowerRates()
- local class = OvalePaperDoll.class
-
for k,v in pairs(OvaleData.power) do
self.powerRate[k] = 0
end
- -- Base power regeneration for all classes, based on power type.
- local energyRegen = 10 * OvalePaperDoll:GetMeleeHasteMultiplier()
- local focusRegen = 4 * OvalePaperDoll:GetRangedHasteMultiplier()
-
- -- Strip off 10% attack speed bonus that doesn't count toward power regeneration.
- if class == "HUNTER" then
- -- Strip off 10% attack speed bonus that doesn't count toward focus regeneration.
- if OvaleState:GetAura("player", "melee_haste") then
- focusRegen = focusRegen / 1.1
- end
- elseif class == "MONK" then
- -- Way of the Monk (monk)
- if OvaleEquipement:HasTwoHandedWeapon() then
- -- Strip off 40% melee attack speed bonus for two-handed weapon.
- energyRegen = energyRegen / 1.4
- end
-
- -- Ascension (monk)
- if OvaleData:GetTalentPoints(8) > 0 then
- energyRegen = energyRegen * 1.15
- end
-
- -- Stance of the Sturdy Ox (brewmaster monk)
- if OvaleStance:IsStance("monk_stance_of_the_sturdy_ox") then
- energyRegen = energyRegen * 1.1
- end
- elseif class == "ROGUE" then
- -- Rogue attack-speed self-buff incorrectly counts towards its melee haste.
- if OvalePaperDoll.level >= 30 then
- energyRegen = energyRegen / 1.1
- end
-
- -- Blade Flurry (combat rogue)
- if OvaleState:GetAura("player", 13877, "HELPFUL", true) then
- energyRegen = energyRegen * 0.8
- end
-
- -- Vitality (combat rogue)
- if OvalePaperDoll.specialization == 2 then
- energyRegen = energyRegen * 1.2
- end
+ -- Energy Regeneration for Druids not in Cat form
+ self.powerRate.energy = 10 * OvalePaperDoll:GetMeleeHasteMultiplier()
- -- Adrenaline Rush (rogue)
- if OvaleState:GetAura("player", 13750, "HELPFUL", true) then
- energyRegen = energyRegen * 2
- end
+ -- Power regeneration for current power type
+ if Ovale.enCombat then
+ self.powerRate[OvaleData.powerType[OvalePaperDoll.stat.powerType]] = OvalePaperDoll.stat.activePowerRegen
+ else
+ self.powerRate[OvaleData.powerType[OvalePaperDoll.stat.powerType]] = OvalePaperDoll.stat.inactivePowerRegen
end
-
- self.powerRate.energy = energyRegen
- self.powerRate.focus = focusRegen
end
function OvaleState:Reset()