Quantcast

Fix ticket #211 - Burning Ember Number

Johnny C. Lam [03-02-13 - 17:58]
Fix ticket #211 - Burning Ember Number

UnitPower() has a hidden 3rd argument to get the true value of a warlock's
secondary power value.  This fixes BurningEmbers() and SoulShards() to
return values from 0 to 40 (for the number of ember or shard segments)
instead of 0 to 4 (full ember or shard).  This also now correctly
correlates with the burningembers=xxx and shards=xxx values in warlock
script SpellInfo() lines.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@710 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
OvaleData.lua
OvaleState.lua
diff --git a/OvaleData.lua b/OvaleData.lua
index 5710a23..6f2270e 100644
--- a/OvaleData.lua
+++ b/OvaleData.lua
@@ -18,6 +18,19 @@ local GetSpellBookItemInfo, GetSpellBookItemName = GetSpellBookItemInfo, GetSpel
 local GetSpellInfo, GetSpellTabInfo, GetTalentInfo = GetSpellInfo, GetSpellTabInfo, GetTalentInfo
 local HasPetSpells, UnitBuff, UnitClass = HasPetSpells, UnitBuff, UnitClass
 local BOOKTYPE_SPELL, BOOKTYPE_PET = BOOKTYPE_SPELL, BOOKTYPE_PET
+local SPELL_POWER_ALTERNATE_POWER = SPELL_POWER_ALTERNATE_POWER
+local SPELL_POWER_BURNING_EMBERS = SPELL_POWER_BURNING_EMBERS
+local SPELL_POWER_CHI = SPELL_POWER_CHI
+local SPELL_POWER_DEMONIC_FURY = SPELL_POWER_DEMONIC_FURY
+local SPELL_POWER_ECLIPSE = SPELL_POWER_ECLIPSE
+local SPELL_POWER_ENERGY = SPELL_POWER_ENERGY
+local SPELL_POWER_FOCUS = SPELL_POWER_FOCUS
+local SPELL_POWER_HOLY_POWER = SPELL_POWER_HOLY_POWER
+local SPELL_POWER_MANA = SPELL_POWER_MANA
+local SPELL_POWER_RAGE = SPELL_POWER_RAGE
+local SPELL_POWER_RUNIC_POWER = SPELL_POWER_RUNIC_POWER
+local SPELL_POWER_SHADOW_ORBS = SPELL_POWER_SHADOW_ORBS
+local SPELL_POWER_SOUL_SHARDS = SPELL_POWER_SOUL_SHARDS
 --</private-static-properties>

 --<public-static-properties>
@@ -43,18 +56,19 @@ OvaleData.spellFilter = { any = {}, mine = {} }

 OvaleData.power =
 {
-	mana = {id=0, mini=0},
-	rage = {id=1, mini=0, maxi=100},
-	focus ={id=2, mini=0, maxi=100},
-	energy = {id=3, mini=0, maxi=100},
-	runicpower = {id=6, mini=0, maxi=100},
-	shards = {id=7, mini=0, maxi=3},
-	eclipse = {id=8, mini=-100, maxi=100},
-	holy = {id=9, mini=0, maxi=5},
-	chi = {id=12, mini=0, maxi=4 },
-	shadoworbs = {id=13, mini=0, maxi=3},
-	burningembers = {id=14, mini=0},
-	demonicfury = {id=15, mini=0}
+	mana = { id = SPELL_POWER_MANA, mini = 0 },
+	rage = { id = SPELL_POWER_RAGE, mini = 0, maxi = 100 },
+	focus = { id = SPELL_POWER_FOCUS, mini = 0, maxi = 100 },
+	energy = { id = SPELL_POWER_ENERGY, mini = 0, maxi = 100 },
+	runicpower = { id = SPELL_POWER_RUNIC_POWER, mini = 0, maxi = 100 },
+	shards = { id = SPELL_POWER_SOUL_SHARDS, mini = 0, segments = true },
+	eclipse = { id = SPELL_POWER_ECLIPSE, mini = -100, maxi = 100 },
+	holy = { id = SPELL_POWER_HOLY_POWER, mini = 0, maxi = 5 },
+	alternate = { id = SPELL_POWER_ALTERNATE_POWER, mini = 0 },
+	chi = { id = SPELL_POWER_CHI, mini = 0, maxi = 4 },
+	shadoworbs = { id = SPELL_POWER_SHADOW_ORBS, mini = 0, maxi = 3 },
+	burningembers = { id = SPELL_POWER_BURNING_EMBERS, mini = 0, segments = true },
+	demonicfury = { id = SPELL_POWER_DEMONIC_FURY, mini = 0 }
 }
 OvaleData.secondaryPower = {"rage", "focus", "shards", "holy", "chi", "shadoworbs", "burningembers", "demonicfury"}
 OvaleData.powerType = {}
diff --git a/OvaleState.lua b/OvaleState.lua
index 302d2e4..79b1ad5 100644
--- a/OvaleState.lua
+++ b/OvaleState.lua
@@ -84,7 +84,7 @@ function OvaleState:Reset()
 	self.attenteFinCast = self.maintenant
 	self.state.combo = OvaleComboPoints.combo
 	for k,v in pairs(OvaleData.power) do
-		self.state[k] = UnitPower("player", v.id)
+		self.state[k] = UnitPower("player", v.id, v.segments)
 	end

 	self:UpdatePowerRates()
@@ -187,7 +187,7 @@ function OvaleState:AddSpellToStack(spellId, startCast, endCast, nextCast, nocd,
 					if v.maxi and self.state[k] > v.maxi then
 						self.state[k] = v.maxi
 					else
-						local maxi = UnitPowerMax("player", v.id)
+						local maxi = UnitPowerMax("player", v.id, v.segments)
 						if maxi and self.state[k] > maxi then
 							self.state[k] = maxi
 						end