Quantcast

Added some resto function

Taracque [09-02-12 - 19:25]
Added some resto function

Water shield tracker, Earthliving weapon
Filename
Elementarist.lua
Elementarist.toc
diff --git a/Elementarist.lua b/Elementarist.lua
index 434f3e8..a4f5406 100644
--- a/Elementarist.lua
+++ b/Elementarist.lua
@@ -1,5 +1,5 @@
 -------------------------------------------------------------------------------
--- Elementarist 2.9.2
+-- Elementarist 2.9.3
 --
 -- Shows the advised spell for an elemental shaman for optimal DPS output.
 -------------------------------------------------------------------------------
@@ -8,7 +8,7 @@ Elementarist = {Locals = {}}

 local L = Elementarist.Locals

-Elementarist.versionNumber = '2.9.2'
+Elementarist.versionNumber = '2.9.3'
 Elementarist.playerName = UnitName("player")
 Elementarist.playerGUID = UnitGUID("player")
 Elementarist.targetGUID = nil
@@ -42,7 +42,7 @@ Elementarist.SFHistory = {
 	["misc"] = nil,
 	["int"] = nil
 }
-Elementarist.isEle = false
+Elementarist.talent = ""
 Elementarist.talentUnsure = true
 Elementarist.tier6Talent = nil
 Elementarist.lastSpell = nil
@@ -77,7 +77,15 @@ Elementarist.SpellList = {
 	["Demonic Pact"] = GetSpellInfo(48090),
 	["Alchemist's Flask"] = GetSpellInfo(Elementarist.CustomIDs["Alchemist's Flask Spell"]),
 	["Flask of the Warm Sun"] = GetSpellInfo(105691),
-	["Lifeblood"] = GetSpellInfo(55503)
+	["Lifeblood"] = GetSpellInfo(55503),
+
+	-- resto
+	["Healing Wave"] = GetSpellInfo(331),
+	["Greater Healing Wave"] = GetSpellInfo(77472),
+	["Healing Surge"] = GetSpellInfo(8004),
+	["Riptide"] = GetSpellInfo(61295),
+	["Earthliving Weapon"] = GetSpellInfo(51730),
+	["Water Shield"] = GetSpellInfo(52127)
 }
 Elementarist.debuffCooldownFrame = {
 	["main"] = nil,
@@ -271,7 +279,16 @@ function Elementarist:detectTalent()
 	local spec = GetSpecialization()
 	local _

-	Elementarist.isEle = (spec == 1)
+	if (spec == 1) then
+		Elementarist.talent = "elemental"
+	end
+	if (spec == 2) then
+		Elementarist.talent = "enhancement"
+	end
+	if (spec == 3) then
+		Elementarist.talent = "restoration"
+	end
+
 	_, Elementarist.tier6Talent = GetTalentRowSelectionInfo(6)

 	if (spec == nil) then
@@ -504,18 +521,24 @@ function Elementarist:isEnabled()
 	end
 	return (
 		ElementaristDB.enabled and (
-			(not ElementaristDB.disableIfNotEle) or (Elementarist.isEle)
+			(not ElementaristDB.disableIfNotEle) or (Elementarist.talent == "elemental")
 		)
 	)
 end

 function Elementarist:UpdateShieldTracker()
-	local name, _, icon, count, _, d, e = Elementarist:hasBuff("player",Elementarist.SpellList["Lightning Shield"])
+	local shieldName = "Lightning Shield"
+	if (Elementarist.talent == "restoration") then
+		shieldName = "Water Shield"
+	end
+	local name, _, icon, count, _, d, e = Elementarist:hasBuff("player",Elementarist.SpellList[ shieldName ])

 	Elementarist.shieldTrackerUpdate = GetTime()
 	if (name) then
 		Elementarist:SetTexture(Elementarist.textureList["shield"],icon)
-		Elementarist.textList["shield"]:SetText(format('%.0f', count))
+		if (Elementarist.talent ~= "restoration") then
+			Elementarist.textList["shield"]:SetText(format('%.0f', count))
+		end
 		Elementarist.shieldCooldownFrame:SetCooldown( e-d, d)
 	else
 		Elementarist:SetTexture(Elementarist.textureList["shield"],"")
@@ -644,6 +667,14 @@ function Elementarist:SpellAvailable(spell)
 end

 function Elementarist:NextSpell(timeshift,exspell1,exspell2)
+	if (Elementarist.talent == "elemental") then
+		return Elementarist:NextSpellElem(timeshift,exspell1,exspell2)
+	end
+
+	return ""
+end
+
+function Elementarist:NextSpellElem(timeshift,exspell1,exspell2)
 	local guid = UnitGUID("target")
 	local currentTime = GetTime()
 	local s,d,e
@@ -818,7 +849,6 @@ function Elementarist:NextSpell(timeshift,exspell1,exspell2)
 		end
 	end

-
 	-- otherwise lightning bolt
 	if IsSpellInRange(Elementarist.SpellList["Lightning Bolt"], "target") == 1 then
 		return Elementarist.SpellList["Lightning Bolt"]
@@ -833,6 +863,53 @@ function Elementarist:NextSpell(timeshift,exspell1,exspell2)
 end

 function Elementarist:MiscSpell()
+	if (Elementarist.talent == "elemental") then
+		return Elementarist:MiscSpellElem()
+	else
+		if (Elementarist.talent == "restoration") then
+			return Elementarist:MiscSpellResto()
+		end
+	end
+
+	return ""
+end
+
+function Elementarist:MiscSpellResto()
+	local d, e
+	local name, expirationTime, _
+
+	-- Alchemy Flask of Enhancement
+	if GetItemCount(Elementarist.CustomIDs["Alchemist's Flask Item"]) ~= 0 then
+		name = Elementarist:hasBuff("player", Elementarist.SpellList["Flask of the Warm Sun"]);
+		if (name == nil) then
+			name, _, _, _, _, _, expirationTime = Elementarist:hasBuff("player", Elementarist.SpellList["Alchemist's Flask"], false, Elementarist.CustomIDs["Alchemist's Flask Spell"]);
+			if (name == nil) or (expirationTime < 2) then
+				if (icon == nil) then
+					icon = GetItemIcon(Elementarist.CustomIDs["Alchemist's Flask Item"])
+				end
+				return nil,icon
+			end
+		end
+	end
+
+	-- Flametongue weapon
+	if Elementarist:SpellAvailable(Elementarist.SpellList["Earthliving Weapon"]) then
+		local hasMainHandEnchant, mainHandExpiration, _, _, _, _ = GetWeaponEnchantInfo()
+		if (hasMainHandEnchant == nil) or ((mainHandExpiration / 60000) < 1) then
+			return Elementarist.SpellList["Earthliving Weapon"]
+		end
+	end
+
+	-- Water Shield
+	if Elementarist:SpellAvailable(Elementarist.SpellList["Water Shield"]) then
+		name, _, _, _, _, _, expirationTime = Elementarist:hasBuff("player", Elementarist.SpellList["Water Shield"]);
+		if (name == nil) or (expirationTime < 1) then
+			return Elementarist.SpellList["Water Shield"]
+		end
+	end
+end
+
+function Elementarist:MiscSpellElem()
 	-- Miscelaneous spell order:
 	-- Flametongoue weapon
 	-- Lightning Shield
@@ -921,6 +998,14 @@ function Elementarist:MiscSpell()
 end

 function Elementarist:IntSpell()
+	if (Elementarist.talent == "elemental") then
+		return Elementarist:IntSpellElem()
+	end
+
+	return ""
+end
+
+function Elementarist:IntSpellElem()
 	-- interruptions, mana recharge wia thunderstorm, purge, and AoE on target
 	local d

diff --git a/Elementarist.toc b/Elementarist.toc
index 5115e13..f6a97ac 100644
--- a/Elementarist.toc
+++ b/Elementarist.toc
@@ -2,7 +2,7 @@
 ## Title: Elementarist
 ## Notes: Elemental shaman spell rotation helper
 ## Author: Taracque, Felmosórongy of Arathor
-## Version: 2.9.2
+## Version: 2.9.3
 ## SavedVariables: ElementaristDB
 ## OptionalDeps: OmniCC, SpellFlash
 ## Dependencies: