Quantcast

Handle new SpellInfo parameter "cd_haste".

Johnny C. Lam [04-05-13 - 06:21]
Handle new SpellInfo parameter "cd_haste".

A spell whose cooldown is affected by haste effects can be tagged with
"cd_haste=melee" or "cd_haste=spell".

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@893 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
OvaleState.lua
diff --git a/OvaleState.lua b/OvaleState.lua
index fa5d2f1..c9a2b3f 100644
--- a/OvaleState.lua
+++ b/OvaleState.lua
@@ -346,6 +346,13 @@ function OvaleState:ApplySpell(spellId, startCast, endCast, nextCast, nocd, targ
 					end
 				end
 			end
+			if cd.duration > 0 and si.cd_haste then
+				if si.cd_haste == "melee" then
+					cd.duration = cd.duration / OvalePaperDoll:GetMeleeHasteMultiplier()
+				elseif si.cd_haste == "spell" then
+					cd.duration = cd.duration / OvalePaperDoll:GetSpellHasteMultiplier()
+				end
+			end
 			cd.enable = 1
 			if si.toggle then
 				cd.toggled = 1
@@ -487,11 +494,11 @@ function OvaleState:GetCD(spellId)
 	if not spellId then
 		return nil
 	end
-
-	if OvaleData.spellInfo[spellId] and OvaleData.spellInfo[spellId].cd then
+	local si = OvaleData.spellInfo[spellId]
+	if si and si.cd then
 		local cdname
-		if OvaleData.spellInfo[spellId].sharedcd then
-			cdname = OvaleData.spellInfo[spellId].sharedcd
+		if si.sharedcd then
+			cdname = si.sharedcd
 		else
 			cdname = spellId
 		end