Quantcast

Debug can now turned on/off ingame, using /ele debug command. All debug output goes to EleDBG chat frame, it needs to be exists for debugging

Taracque [05-25-11 - 10:46]
Debug can now turned on/off ingame, using /ele debug command. All debug output goes to EleDBG chat frame, it needs to be exists for debugging
Flame Shock tracker are now more accurate, if there is no FS tick on an enemy in last 4sec, it is automatically removed from tracker.
Filename
Ele_GUI.lua
Elementarist.lua
Elementarist.toc
diff --git a/Ele_GUI.lua b/Ele_GUI.lua
index ed47578..a1e306c 100755
--- a/Ele_GUI.lua
+++ b/Ele_GUI.lua
@@ -363,11 +363,24 @@ function Elementarist:CreateConfig()
 		self.onHide = nil
 	end)
 	-- Add the panel to the Interface Options
-	InterfaceOptions_AddCategory(Elementarist.configPanel);
+	InterfaceOptions_AddCategory(Elementarist.configPanel)
 end

-function Elementarist.Options()
-  InterfaceOptionsFrame_OpenToCategory(getglobal("ElementaristConfigPanel"))
+function Elementarist.Options(msg)
+	if msg=='debug' then
+		if (Elementarist.DebugMode) then
+			Elementarist:Debug("Debug ended", GetTime())
+		end
+		Elementarist.DebugMode = not ( Elementarist.DebugMode )
+		local debugStatus = "disabled"
+		if (Elementarist.DebugMode) then
+			debugStatus = "enabled. Using frame: " .. Elementarist.DebugChat:GetID()
+			Elementarist:Debug("Debug started", GetTime())
+		end
+		DEFAULT_CHAT_FRAME:AddMessage("Elementarist Debug " .. debugStatus)
+	else
+		InterfaceOptionsFrame_OpenToCategory(getglobal("ElementaristConfigPanel"))
+	end
 end

 function Elementarist:ResetPosition()
diff --git a/Elementarist.lua b/Elementarist.lua
index 07cc7de..6244b73 100755
--- a/Elementarist.lua
+++ b/Elementarist.lua
@@ -1,5 +1,5 @@
 -------------------------------------------------------------------------------
--- Elementarist 2.0.1
+-- Elementarist 2.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 = '2.0.1'
+Elementarist.versionNumber = '2.0.2'
 Elementarist.playerName = UnitName("player")
 Elementarist.playerGUID = UnitGUID("player")
 Elementarist.targetGUID = nil
@@ -32,6 +32,7 @@ Elementarist.configPanel = nil
 Elementarist.prevDB = {}
 Elementarist.DPSTable = {}
 Elementarist.DebugMode = false
+Elementarist.DebugChat = DEFAULT_CHAT_FRAME
 Elementarist.inParty = 0
 Elementarist.OmniCC = _G['OmniCC']
 Elementarist.SpellFlash = _G['SpellFlashAddon']
@@ -137,11 +138,20 @@ Elementarist.eventFrame:RegisterEvent("PLAYER_ALIVE")
 Elementarist.events = {}

 function Elementarist:Debug(statictxt,msg)
-	if (Elementarist.DebugMode) then
+	if (Elementarist.DebugMode) and (Elementarist.DebugChat) then
 		if (msg) then
-			ChatFrame4:AddMessage("ELEDBG: ".. statictxt  .. " : " .. msg)
+			Elementarist.DebugChat:AddMessage( statictxt  .. " : " .. msg)
 		else
-			ChatFrame4:AddMessage("ELEDBG: ".. statictxt  .. " : " .. "<nil>")
+			Elementarist.DebugChat:AddMessage( statictxt  .. " : " .. "<nil>")
+		end
+	end
+end
+
+function Elementarist:GetDebugFrame()
+	for i=1,NUM_CHAT_WINDOWS do
+		local windowName = GetChatWindowInfo(i);
+		if windowName == "EleDBG" then
+			return getglobal("ChatFrame" .. i)
 		end
 	end
 end
@@ -225,6 +235,9 @@ function Elementarist.events.ADDON_LOADED(addon)
 	Elementarist.eventFrame:RegisterEvent("PLAYER_REGEN_ENABLED") -- Left combat, clean up all enemy GUIDs
 	Elementarist.eventFrame:RegisterEvent("PLAYER_TALENT_UPDATE")
 	Elementarist.eventFrame:RegisterEvent("PARTY_MEMBERS_CHANGED")
+
+	-- get debug frame
+	Elementarist.DebugChat = Elementarist:GetDebugFrame()
 end

 function Elementarist:InitSettings()
@@ -305,7 +318,7 @@ end

 function Elementarist:PurgePersonTable()
 	for i,v in pairs(Elementarist.person["foe"]) do
-		if ( ( GetTime() - Elementarist.person["foe"][i] ) > 2) then
+		if ( ( GetTime() - Elementarist.person["foe"][i] ) > 3) then
 			-- no activity from that unit in last 2 seconds, remove it
 			if ( Elementarist.person["foe"][i] ~= 0) then
 				Elementarist.person["foe"][i] = 0	-- mark as inactive
@@ -315,7 +328,7 @@ function Elementarist:PurgePersonTable()
 		end
 	end
 	for i,v in pairs(Elementarist.person["friend"]) do
-		if ( ( GetTime() - Elementarist.person["friend"][i] ) > 2) then
+		if ( ( GetTime() - Elementarist.person["friend"][i] ) > 3) then
 			-- no activity from that unit in last 2 seconds, remove it
 			if ( Elementarist.person["friend"][i] ~= 0 ) then
 				Elementarist.person["friend"][i] = 0	-- mark as inactive
@@ -378,6 +391,9 @@ end
 function Elementarist.events.COMBAT_LOG_EVENT_UNFILTERED(timestamp, event, hideCaster, srcGUID, srcName, srcFlags, dstGUID, dstName, dstFlags, spellId, spellName, spellSchool, damage, ...)
 	if Elementarist.isEnabled() then
 		if srcName == Elementarist.playerName then
+			if (event=="SPELL_PERIODIC_DAMAGE") and (spellName==Elementarist.SpellList["Flame Shock"]) and (Elementarist.debuffCooldowns[dstGUID]) then
+				Elementarist.debuffCooldowns[dstGUID]["action"] = GetTime()
+			end
 			if (event=="SPELL_CAST_START") then
 				Elementarist.SFHistory.spell = nil
 				Elementarist.SFHistory.misc = nil
@@ -506,7 +522,7 @@ function Elementarist:UpdateShieldTracker()
 		Elementarist.textList["shield"]:SetText(format('%.0f', count))
 		Elementarist.shieldCooldownFrame:SetCooldown( e-d, d)
 	else
-		Elementarist.textureList["shield"]:SetTexture(nil)
+		Elementarist.textureList["shield"]:SetTexture("")
 		Elementarist.textList["shield"]:SetText("")
 		Elementarist.shieldCooldownFrame:SetCooldown(0, 0)
 	end
@@ -523,6 +539,7 @@ function Elementarist:UpdateDebuffTracker()
 		end
 		Elementarist.debuffCooldowns[tguid]["start"] = e-d
 		Elementarist.debuffCooldowns[tguid]["duration"] = d
+		Elementarist.debuffCooldowns[tguid]["action"] = GetTime()
 	else
 		_, _, icon = GetSpellInfo(Elementarist.SpellList["Flame Shock"])
 	end
@@ -530,18 +547,18 @@ function Elementarist:UpdateDebuffTracker()
 	-- 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
+		if ( (v["start"] + v["duration"]) > GetTime() ) and (i ~= tguid) and (m <= 4) and (v["action"]>GetTime() - 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.textureList["debuff_" .. tostring(m)]:SetTexture("")
 		Elementarist.debuffCooldownFrame["mini_" .. tostring(m)]:SetCooldown( 0, 0)
 	end
-
+
+	-- update main frame
 	if (name) then
 		Elementarist.textureList["debuff"]:SetTexture(icon)
 		if (not Elementarist.OmniCC) then
@@ -549,7 +566,7 @@ function Elementarist:UpdateDebuffTracker()
 		end
 		Elementarist.debuffCooldownFrame["main"]:SetCooldown( e-d, d)
 	else
-		Elementarist.textureList["debuff"]:SetTexture(nil)
+		Elementarist.textureList["debuff"]:SetTexture("")
 		Elementarist.textList["debuff"]:SetText("")
 		Elementarist.debuffCooldownFrame["main"]:SetCooldown(0, 0)
 	end
@@ -1012,28 +1029,28 @@ function Elementarist:DecideSpells()

 	if UnitInVehicle("player") then
 		-- player is in a "vehicle" don't suggest spell
-		Elementarist.textureList["next"]:SetTexture(nil)
-		Elementarist.textureList["next1"]:SetTexture(nil)
-		Elementarist.textureList["next2"]:SetTexture(nil)
-		Elementarist.textureList["misc"]:SetTexture(nil)
-		Elementarist.textureList["int"]:SetTexture(nil)
+		Elementarist.textureList["next"]:SetTexture("")
+		Elementarist.textureList["next1"]:SetTexture("")
+		Elementarist.textureList["next2"]:SetTexture("")
+		Elementarist.textureList["misc"]:SetTexture("")
+		Elementarist.textureList["int"]:SetTexture("")

 		return
 	end

 	if guid == nil then
-		Elementarist.textureList["next"]:SetTexture(nil)
-		Elementarist.textureList["next1"]:SetTexture(nil)
-		Elementarist.textureList["next2"]:SetTexture(nil)
-		Elementarist.textureList["misc"]:SetTexture(nil)
-		Elementarist.textureList["int"]:SetTexture(nil)
+		Elementarist.textureList["next"]:SetTexture("")
+		Elementarist.textureList["next1"]:SetTexture("")
+		Elementarist.textureList["next2"]:SetTexture("")
+		Elementarist.textureList["misc"]:SetTexture("")
+		Elementarist.textureList["int"]:SetTexture("")

 		return
 	end
   	if (UnitHealth("target") == 0) then
-		Elementarist.textureList["next"]:SetTexture(nil)
-		Elementarist.textureList["next1"]:SetTexture(nil)
-		Elementarist.textureList["next2"]:SetTexture(nil)
+		Elementarist.textureList["next"]:SetTexture("")
+		Elementarist.textureList["next1"]:SetTexture("")
+		Elementarist.textureList["next2"]:SetTexture("")

 		return
   	end
diff --git a/Elementarist.toc b/Elementarist.toc
index dfea284..109f4df 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: 2.0.1
+## Version: 2.0.2
 ## SavedVariables: ElementaristDB
 ## OptionalDeps: OmniCC, SpellFlash
 ## Dependencies: