Quantcast

Flame Shock tracker now track untargeted Flameshocks to, up to 4 untargeted debuff tracked

Taracque [05-18-11 - 13:21]
Flame Shock tracker now track untargeted Flameshocks to, up to 4 untargeted debuff tracked
Filename
Change_log.txt
Ele_GUI.lua
Elementarist.lua
diff --git a/Change_log.txt b/Change_log.txt
index 1d491e5..1f4fb66 100755
--- a/Change_log.txt
+++ b/Change_log.txt
@@ -1,108 +1,109 @@
 **v2.0.0alpha**
 * Change: Earth Shock advice modified
 * Change: CL advised if more than 2 enemies are presents
-* Bugfix: Better (and maybe faster) friend and foe detection
-
-**v1.9.9**
-* Bugfix: Fixed friend and foe detection
-* Change: Fire Nova advise if FS is on the target and enabled in config (thx Debose)
-* Change: API version changed to 40100
-* Added: Mind Quickening detection
-
-**v1.9.8**
-* Bugfix: Shadowform check fixed
-
-**v1.9.7**
-* Bugfix: fixed a typo in Ele_GUI.lua
-
-**v1.9.6**
-* Added: Unleashed Elements can be enabled in the configuration window
-
-**v1.9.5**
-* Bugfix: Level 80 Flasks replaced with their lvl85 couterparts (Flask of Enhancement and Flask of the Draconic Mind)
-* Bugfix: Wrath of Air Totem is not displayed if Moonkin aura, or Shadowform buff is on the player
-* Misc: Minor code cleanups
-
-**v1.9.4**
-* Updated to work with 4.0.3
-* Added: Unleash Elements just before Lava Burst, if mainhand weapon has temporary enchant (Flametongue)
-* Removed: Single target CL behaviour removed
-
-**v1.9.3**
-* Updated to work with 4.0.1
-* Added: Earth Shock added to rotation (suggested if Lightning Shield has 9 charges)
-* Added: Shield tracker window, display Lightning Shield charges in a separate frame
-* Added: Searing Totem suggestion if no fire totem is active
-* Added: SpellFlash add-on support, if SpellFlash installed, advised spells will flash on you action bar
-* Misc: Code cleanup
-
-**v1.6**
-* Added: Chain Lightning behaviour can be changed from the configuration dialog
-
-**v1.5**
-* Bugfix: talent change should not produce lua error anymore
-* Bugfix: If Demonic Pact or Heart of the Crusader is active, Totem of Wrath not advised
-* Added: A new type of behaviour can be selected, when FS advised just before LvB available
-* Added: Threat warning in raid warning frame can be turned on
-* Added: Flask of the North buff check if character is Alchemist, and has FotN in the bag
-
-**v1.4**
-* Timing is better, it also calculates when current cast will finish
-
-**v1.3**
-* Fire Nova displayed only if fire totem is active
-* Spell queue is added
-* Spell currently casted is not displayed (only if the next spell should be the same)
-
-**v1.2**
-* Totem of Wrath is also advised if target doesn't have Totem of Wrath Debuff (i.e. target is to far away from Totem of Wrath)
-* Talent detection improved, hopefully now works in all situations
-
-**v1.1**
-* new option to disable Elementarist when not on elemental talent
-* Fire Nova added to the rotation, in case of 3 or more foe detected (can be disabled in settings)
-* Friend and foe detection runs only while in combat (makes Dalaran less CPU intensive)
-
-**v1.0rc1**
-* Added configuration options for debuff tracker
-
-**v0.9.9a**
-* Bugfix: CPU usage has been reduced (was a bug in 0.9.9)
-
-**v0.9.9**
-* Flame Shock debuff tracker frame added as a separate frame, which shows remaining time for FS debuff on target
-
-**v0.9**
-* Bugfixes in combat log parsing (friend and foe detection)
-* Aggro alert (inverse cooldown effect on advised spell) not displayed if not in party, or no other friendly unit detected in combat
-
-**v0.8**
-* DPS and Threat meter added, DPS displayed for the selected target, not the total dps output, Threat displayed as percentage
-* Bugfixes
-
-**v0.7**
-* Bugfix: Frame position stored correctly between session
-* Bugfix: Lava Burst displays correctly
-
-**v0.6**
-* Should work for lower level shamans
-* Orc racial Blood Fury added
-
-**v0.5**
-Configuration panel now should fully work
-
-**v0.4**
-* Configuration panel added (can be accessed by /ele , or /elementarist slash commands)
-* Alpha and scale of the frame is now changeable
-* Frame can be locked, in that case it doesn't catch mouse clicks
-
-**v0.3**
-* Elementarist hidden if player is controlling a vehicle.
-* Berserking watched (in case of Troll player)
-* On buff side, Flametongue is the 1st priority now
-
-**v0.2**
-* Bugfix: Lava Burst displayed correctly
-
-**v0.1**
-Initial version
+* Bugfix: Better (and maybe faster) friend and foe detection
+* Added: Flame Shock tracker now track untargeted Flameshocks to, up to 4 untargeted debuff tracked
+
+**v1.9.9**
+* Bugfix: Fixed friend and foe detection
+* Change: Fire Nova advise if FS is on the target and enabled in config (thx Debose)
+* Change: API version changed to 40100
+* Added: Mind Quickening detection
+
+**v1.9.8**
+* Bugfix: Shadowform check fixed
+
+**v1.9.7**
+* Bugfix: fixed a typo in Ele_GUI.lua
+
+**v1.9.6**
+* Added: Unleashed Elements can be enabled in the configuration window
+
+**v1.9.5**
+* Bugfix: Level 80 Flasks replaced with their lvl85 couterparts (Flask of Enhancement and Flask of the Draconic Mind)
+* Bugfix: Wrath of Air Totem is not displayed if Moonkin aura, or Shadowform buff is on the player
+* Misc: Minor code cleanups
+
+**v1.9.4**
+* Updated to work with 4.0.3
+* Added: Unleash Elements just before Lava Burst, if mainhand weapon has temporary enchant (Flametongue)
+* Removed: Single target CL behaviour removed
+
+**v1.9.3**
+* Updated to work with 4.0.1
+* Added: Earth Shock added to rotation (suggested if Lightning Shield has 9 charges)
+* Added: Shield tracker window, display Lightning Shield charges in a separate frame
+* Added: Searing Totem suggestion if no fire totem is active
+* Added: SpellFlash add-on support, if SpellFlash installed, advised spells will flash on you action bar
+* Misc: Code cleanup
+
+**v1.6**
+* Added: Chain Lightning behaviour can be changed from the configuration dialog
+
+**v1.5**
+* Bugfix: talent change should not produce lua error anymore
+* Bugfix: If Demonic Pact or Heart of the Crusader is active, Totem of Wrath not advised
+* Added: A new type of behaviour can be selected, when FS advised just before LvB available
+* Added: Threat warning in raid warning frame can be turned on
+* Added: Flask of the North buff check if character is Alchemist, and has FotN in the bag
+
+**v1.4**
+* Timing is better, it also calculates when current cast will finish
+
+**v1.3**
+* Fire Nova displayed only if fire totem is active
+* Spell queue is added
+* Spell currently casted is not displayed (only if the next spell should be the same)
+
+**v1.2**
+* Totem of Wrath is also advised if target doesn't have Totem of Wrath Debuff (i.e. target is to far away from Totem of Wrath)
+* Talent detection improved, hopefully now works in all situations
+
+**v1.1**
+* new option to disable Elementarist when not on elemental talent
+* Fire Nova added to the rotation, in case of 3 or more foe detected (can be disabled in settings)
+* Friend and foe detection runs only while in combat (makes Dalaran less CPU intensive)
+
+**v1.0rc1**
+* Added configuration options for debuff tracker
+
+**v0.9.9a**
+* Bugfix: CPU usage has been reduced (was a bug in 0.9.9)
+
+**v0.9.9**
+* Flame Shock debuff tracker frame added as a separate frame, which shows remaining time for FS debuff on target
+
+**v0.9**
+* Bugfixes in combat log parsing (friend and foe detection)
+* Aggro alert (inverse cooldown effect on advised spell) not displayed if not in party, or no other friendly unit detected in combat
+
+**v0.8**
+* DPS and Threat meter added, DPS displayed for the selected target, not the total dps output, Threat displayed as percentage
+* Bugfixes
+
+**v0.7**
+* Bugfix: Frame position stored correctly between session
+* Bugfix: Lava Burst displays correctly
+
+**v0.6**
+* Should work for lower level shamans
+* Orc racial Blood Fury added
+
+**v0.5**
+Configuration panel now should fully work
+
+**v0.4**
+* Configuration panel added (can be accessed by /ele , or /elementarist slash commands)
+* Alpha and scale of the frame is now changeable
+* Frame can be locked, in that case it doesn't catch mouse clicks
+
+**v0.3**
+* Elementarist hidden if player is controlling a vehicle.
+* Berserking watched (in case of Troll player)
+* On buff side, Flametongue is the 1st priority now
+
+**v0.2**
+* Bugfix: Lava Burst displayed correctly
+
+**v0.1**
+Initial version
diff --git a/Ele_GUI.lua b/Ele_GUI.lua
index 3b07ea1..dc9f794 100755
--- a/Ele_GUI.lua
+++ b/Ele_GUI.lua
@@ -534,19 +534,20 @@ function Elementarist:CreateGUI()

 	local debuffTracker = CreateFrame("Frame","ElementaristDebuffTrackerFrame",UIParent)
 	debuffTracker:SetFrameStrata("BACKGROUND")
-	debuffTracker:SetWidth(50)
+	debuffTracker:SetWidth(100)
 	debuffTracker:SetHeight(50)
 	debuffTracker:SetBackdrop({
           bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 32,
 	})
 	debuffTracker:SetBackdropColor(0, 0, 0, .0)
 	debuffTracker:SetPoint(ElementaristDB.debuffrelativePoint,ElementaristDB.debuffx,ElementaristDB.debuffy)
+	debuffTracker:SetAlpha(ElementaristDB.debuffalpha)
 	Elementarist.debuffTracker = debuffTracker

 	local debuffTracker_cd = CreateFrame("Frame","$parent_debuff", ElementaristDebuffTrackerFrame)
 	debuffTracker_cd:SetWidth(50)
 	debuffTracker_cd:SetHeight(50)
-	debuffTracker_cd:SetPoint("CENTER", 0, 0)
+	debuffTracker_cd:SetPoint("TOPLEFT", 0, 0)
 	t = debuffTracker_cd:CreateTexture(nil,"BACKGROUND")
 	t:SetTexture(nil)
 	t:SetAllPoints(debuffTracker_cd)
@@ -564,11 +565,28 @@ function Elementarist:CreateGUI()
 	debuffCooldownFrame:SetHeight(50)
 	debuffCooldownFrame:SetWidth(50)
 	debuffCooldownFrame:ClearAllPoints()
-	debuffCooldownFrame:SetPoint("CENTER", debuffTracker, "CENTER", 0, 0)
-
-	debuffTracker:SetAlpha(ElementaristDB.debuffalpha)
-
-	Elementarist.debuffCooldownFrame = debuffCooldownFrame
+	debuffCooldownFrame:SetPoint("TOPLEFT", Elementarist.debuffTracker, "TOPLEFT", 0, 0)
+	Elementarist.debuffCooldownFrame["main"] = debuffCooldownFrame
+
+	for i=1,4,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) ) ) )
+		t = debuffTracker_cd:CreateTexture(nil,"BACKGROUND")
+		t:SetTexture(nil)
+		t:SetAllPoints(debuffTracker_cd)
+		t:SetAlpha(1)
+		debuffTracker_cd.texture = t
+		Elementarist.textureList["debuff_" .. tostring(i)] = t
+
+		local debuffCooldownFrame = CreateFrame("Cooldown" ,"$parent_debuffcooldown_" .. tostring(i), ElementaristDebuffTrackerFrame, "CooldownFrameTemplate")
+		debuffCooldownFrame:SetHeight(25)
+		debuffCooldownFrame:SetWidth(25)
+		debuffCooldownFrame:ClearAllPoints()
+		debuffCooldownFrame:SetPoint("TOPLEFT", 50 + (25 * ( (i - 1) % 2) ), - ( 25 * ( math.floor( (i - 1) / 2) ) ) )
+		Elementarist.debuffCooldownFrame["mini_" .. tostring(i)] = debuffCooldownFrame
+	end

 	local shieldTracker = CreateFrame("Frame","ElementaristShieldTrackerFrame",UIParent)
 	shieldTracker:SetFrameStrata("BACKGROUND")
diff --git a/Elementarist.lua b/Elementarist.lua
index 666db7b..1a8529d 100755
--- a/Elementarist.lua
+++ b/Elementarist.lua
@@ -25,6 +25,8 @@ Elementarist.person = {
 	["friend"]  = {},
 	["foe"]		= {}
 }
+Elementarist.debuffCooldowns = {
+}
 Elementarist.lastPersonTablePurged = 0.0;
 Elementarist.configPanel = nil
 Elementarist.prevDB = {}
@@ -81,6 +83,13 @@ Elementarist.SpellList = {
 	["Flask of the Draconic Mind"] = GetSpellInfo(79470),
 	["Lifeblood"] = GetSpellInfo(55503)
 }
+Elementarist.debuffCooldownFrame = {
+	["main"] = nil,
+	["mini_1"] = nil,
+	["mini_2"] = nil,
+	["mini_3"] = nil,
+	["mini_4"] = nil
+}
 Elementarist.textureList = {
 	["next"] = nil,
 	["next1"] = nil,
@@ -88,6 +97,10 @@ Elementarist.textureList = {
 	["misc"] = nil,
 	["int"] = nil,
 	["debuff"] = nil,
+	["debuff_1"] = nil,
+	["debuff_2"] = nil,
+	["debuff_3"] = nil,
+	["debuff_4"] = nil,
 	["shield"] = nil
 }

@@ -279,6 +292,14 @@ function Elementarist:RemoveFromTables(guid)
 		Elementarist.person["foeCount"] = Elementarist.person["foeCount"] - 1
 		Elementarist:Debug('Friend died:', Elementarist.person["friendCount"])
 	end
+	if (Elementarist.debuffCooldowns[guid]) then
+		table.remove(Elementarist.debuffCooldowns, guid)
+		Elementarist:UpdateDebuffTracker()
+	end
+end
+
+function Elementarist:PurgeDebuffTable()
+	Elementarist.debuffCooldowns = {}
 end

 function Elementarist:PurgePersonTable()
@@ -455,6 +476,7 @@ function Elementarist.events.PLAYER_REGEN_ENABLED(...)
 	Elementarist.textList["debuff"]:SetText("")
 	Elementarist.cooldownFrame:SetReverse(false)
 	Elementarist:PurgePersonTable()
+	Elementarist:PurgeDebuffTable()
 end

 function Elementarist:isEnabled()
@@ -485,19 +507,44 @@ end

 function Elementarist:UpdateDebuffTracker()
 	local name, _, icon, _, _, d, e = Elementarist:hasDeBuff("target",Elementarist.SpellList["Flame Shock"],"player")
+	local tguid = UnitGUID("target")

 	Elementarist.debuffTrackerUpdate = GetTime()
 	if (name) then
+		if (tguid) and (not Elementarist.debuffCooldowns[tguid]) then
+			Elementarist.debuffCooldowns[tguid] = {}
+		end
+		Elementarist.debuffCooldowns[tguid]["start"] = e-d
+		Elementarist.debuffCooldowns[tguid]["duration"] = d
+	else
+		_, _, icon = GetSpellInfo(Elementarist.SpellList["Flame Shock"])
+	end
+
+	-- update mini frames
+	local m = 1
+	for i,v in pairs(Elementarist.debuffCooldowns) do
+		if ( (v["start"] + v["duration"]) > GetTime() ) and (i ~= tguid) and (m <= 4) then
+			Elementarist.textureList["debuff_" .. tostring(m)]:SetTexture(icon)
+			Elementarist.debuffCooldownFrame["mini_" .. tostring(m)]:SetCooldown( v["start"], v["duration"])
+
+			m = m + 1
+		end
+	end
+	for i=m,4,1 do
+		Elementarist.textureList["debuff_" .. tostring(m)]:SetTexture(nil)
+		Elementarist.debuffCooldownFrame["mini_" .. tostring(m)]:SetCooldown( 0, 0)
+	end
+
+	if (name) then
 		Elementarist.textureList["debuff"]:SetTexture(icon)
 		if (not Elementarist.OmniCC) then
 			Elementarist.textList["debuff"]:SetText(format('%.1f', (e - GetTime())))
 		end
-		Elementarist.debuffCooldownFrame:SetCooldown( e-d, d)
-
+		Elementarist.debuffCooldownFrame["main"]:SetCooldown( e-d, d)
 	else
 		Elementarist.textureList["debuff"]:SetTexture(nil)
 		Elementarist.textList["debuff"]:SetText("")
-		Elementarist.debuffCooldownFrame:SetCooldown(0, 0)
+		Elementarist.debuffCooldownFrame["main"]:SetCooldown(0, 0)
 	end
 end