Quantcast

More modular things. SpellList can be loaded up by the module, Restoration now tracksTidal Waves instead of Water Shield.

Taracque [12-07-12 - 14:53]
More modular things. SpellList can be loaded up by the module, Restoration now tracksTidal Waves instead of Water Shield.
Filename
Ele_GUI.lua
Elementarist.lua
Elementarist.toc
modules/elemental.lua
modules/restoration.lua
diff --git a/Ele_GUI.lua b/Ele_GUI.lua
index 8f2bb6e..9dfbbfe 100755
--- a/Ele_GUI.lua
+++ b/Ele_GUI.lua
@@ -593,7 +593,7 @@ function Elementarist:CreateGUI()

 	local debuffTracker = CreateFrame("Frame","ElementaristDebuffTrackerFrame",UIParent)
 	debuffTracker:SetFrameStrata("BACKGROUND")
-	debuffTracker:SetWidth(100)
+	debuffTracker:SetWidth(175)
 	debuffTracker:SetHeight(50)
 	debuffTracker:SetBackdrop({
           bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 32,
@@ -629,11 +629,11 @@ function Elementarist:CreateGUI()
 	debuffCooldownFrame:SetPoint("TOPLEFT", Elementarist.debuffTracker, "TOPLEFT", 0, 0)
 	Elementarist.debuffCooldownFrame["main"] = debuffCooldownFrame

-	for i=1,4,1 do
+	for i=1,10,1 do
 		local debuffTracker_cd = CreateFrame("Frame","$parent_debuff_" .. tostring(i), ElementaristDebuffTrackerFrame)
 		debuffTracker_cd:SetWidth(25)
 		debuffTracker_cd:SetHeight(25)
-		debuffTracker_cd:SetPoint("TOPLEFT", 50 + (25 * ( (i - 1) % 2) ), - ( 25 * ( math.floor( (i - 1) / 2) ) ) )
+		debuffTracker_cd:SetPoint("TOPLEFT", 50 + ( 25 * ( math.floor( (i - 1) / 2) ) ), - (25 * ( (i - 1) % 2) ) )
 		t = debuffTracker_cd:CreateTexture(nil,"BACKGROUND")
 		Elementarist:SetTexture(t,"")
 		t:SetAllPoints(debuffTracker_cd)
@@ -645,7 +645,7 @@ function Elementarist:CreateGUI()
 		debuffCooldownFrame:SetHeight(25)
 		debuffCooldownFrame:SetWidth(25)
 		debuffCooldownFrame:ClearAllPoints()
-		debuffCooldownFrame:SetPoint("TOPLEFT", 50 + (25 * ( (i - 1) % 2) ), - ( 25 * ( math.floor( (i - 1) / 2) ) ) )
+		debuffCooldownFrame:SetPoint("TOPLEFT", 50 + ( 25 * ( math.floor( (i - 1) / 2) ) ), - (25 * ( (i - 1) % 2) ) )
 		Elementarist.debuffCooldownFrame["mini_" .. tostring(i)] = debuffCooldownFrame
 	end

diff --git a/Elementarist.lua b/Elementarist.lua
index d8db14e..d5e1f0c 100755
--- a/Elementarist.lua
+++ b/Elementarist.lua
@@ -1,5 +1,5 @@
 -------------------------------------------------------------------------------
--- Elementarist 3.0.1
+-- Elementarist 3.0.2
 --
 -- Shows the advised spell for an elemental shaman for optimal DPS output.
 -------------------------------------------------------------------------------
@@ -8,7 +8,7 @@ Elementarist = {Locals = {}}

 local L = Elementarist.Locals

-Elementarist.versionNumber = '3.0.1'
+Elementarist.versionNumber = '3.0.2'
 Elementarist.playerName = UnitName("player")
 Elementarist.playerGUID = UnitGUID("player")
 Elementarist.targetGUID = nil
@@ -82,14 +82,6 @@ Elementarist.SpellList = {

 	-- debuff
 	["Unleashed Fury"] = GetSpellInfo(118470),
-
-	-- 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,
@@ -256,6 +248,21 @@ function Elementarist:RegisterModule(talent)
 	Elementarist.modules[talent] = true;
 end;

+function Elementarist:CallModule( funcName, ... )
+	if (Elementarist.modules[Elementarist.talent]) and (Elementarist[Elementarist.talent]) and (Elementarist[Elementarist.talent][funcName]) then
+		return Elementarist[Elementarist.talent][funcName](...);
+	end;
+	return false;
+end;
+
+function Elementarist:LoadSpells(spellList)
+	local k,v;
+
+	for k,v in pairs(spellList) do
+		Elementarist.SpellList[k] = v;
+	end;
+end;
+
 function Elementarist:InitSettings()
 	if not ElementaristDB then
 		ElementaristDB = {} -- fresh start
@@ -290,20 +297,28 @@ end
 function Elementarist:detectTalent()
 	local spec = GetSpecialization()
 	local _
+	local talent = "";

 	if (spec == 1) then
-		Elementarist.talent = "elemental"
+		talent = "elemental"
 	end
 	if (spec == 2) then
-		Elementarist.talent = "enhancement"
+		talent = "enhancement"
 	end
 	if (spec == 3) then
-		Elementarist.talent = "restoration"
+		talent = "restoration"
 	end

 	_, Elementarist.tier6Talent = GetTalentRowSelectionInfo(6)
-
-	if (spec == nil) then
+
+	if (talent ~= "") and (talent ~= Elementarist.talent) then
+		if ((Elementarist.modules[talent]) and (Elementarist[talent].Initialize)) then
+			Elementarist[talent]:Initialize();
+		end;
+		Elementarist.talent = talent;
+	end;
+
+	if (spec == nil) or (talent == "") then
 		Elementarist.talentUnsure = true
 	else
 		Elementarist.talentUnsure = false
@@ -539,18 +554,14 @@ function Elementarist:isEnabled()
 end

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

 	Elementarist.shieldTrackerUpdate = GetTime()
 	if (name) then
 		Elementarist:SetTexture(Elementarist.textureList["shield"],icon)
-		if (Elementarist.talent ~= "restoration") then
-			Elementarist.textList["shield"]:SetText(format('%.0f', count))
-		end
+		Elementarist.textList["shield"]:SetText(format('%.0f', count))
 		Elementarist.shieldCooldownFrame:SetCooldown( e-d, d)
 	else
 		Elementarist:SetTexture(Elementarist.textureList["shield"],"")
@@ -584,7 +595,7 @@ function Elementarist:UpdateDebuffTracker()
 			m = m + 1
 		end
 	end
-	for i=m,4,1 do
+	for i=m,10,1 do
 		Elementarist:SetTexture(Elementarist.textureList["debuff_" .. tostring(m)],"")
 		Elementarist.debuffCooldownFrame["mini_" .. tostring(m)]:SetCooldown( 0, 0)
 	end
@@ -615,6 +626,22 @@ function Elementarist:GetSpellCooldownRemaining(spell)
 	return d
 end

+function Elementarist:hasAura(unit, spellName, casterUnit)
+	local i = 1;
+	while true do
+		local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable = UnitAura(unit, i);
+		if not name then
+			break;
+		end
+		if (name) and (spellName) then
+			if string.match(name, spellName) and ((unitCaster == casterUnit) or (casterUnit == nil)) then
+				return name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable;
+			end
+		end
+		i = i + 1;
+	end
+end;
+
 function Elementarist:hasDeBuff(unit, spellName, casterUnit)
 	local i = 1;
 	while true do
diff --git a/Elementarist.toc b/Elementarist.toc
index d4aee93..bef8264 100755
--- 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: 3.0.1
+## Version: 3.0.2
 ## SavedVariables: ElementaristDB
 ## OptionalDeps: OmniCC, SpellFlash
 ## Dependencies:
@@ -10,4 +10,5 @@
 Elementarist.lua
 Ele_GUI.lua
 Localization_enUS.lua
-modules\elemental.lua
\ No newline at end of file
+modules\elemental.lua
+modules\restoration.lua
\ No newline at end of file
diff --git a/modules/elemental.lua b/modules/elemental.lua
index fe0a1f5..d92a1f6 100755
--- a/modules/elemental.lua
+++ b/modules/elemental.lua
@@ -361,6 +361,9 @@ Elementarist.elemental = {
 		end

 		return ""
-	end
+	end;
+	ShieldName = function(self)
+		return "Lightning Shield";
+	end;

 };
diff --git a/modules/restoration.lua b/modules/restoration.lua
index bd9b362..be209b9 100755
--- a/modules/restoration.lua
+++ b/modules/restoration.lua
@@ -3,6 +3,19 @@ local L = Elementarist.Locals;
 Elementarist:RegisterModule("restoration");

 Elementarist.restoration = {
+	Initialize = function(self)
+		Elementarist:LoadSpells({
+			["Healing Wave"] = GetSpellInfo(331),
+			["Greater Healing Wave"] = GetSpellInfo(77472),
+			["Healing Surge"] = GetSpellInfo(8004),
+			["Riptide"] = GetSpellInfo(61295),
+			["Earthliving Weapon"] = GetSpellInfo(51730),
+			["Water Shield"] = GetSpellInfo(52127),
+			["Tidal Waves"] = GetSpellInfo(53390)
+		});
+
+	end;
+
 	NextSpell = function(self,timeshift,exspell1,exspell2)

 		return ""
@@ -49,6 +62,8 @@ Elementarist.restoration = {
 	IntSpell = function(self)

 		return ""
-	end
-
+	end;
+	ShieldName = function(Self)
+		return "Tidal Waves";
+	end;
 };