Quantcast

v1.14 - 7.0 patch update, demon hunter

Pawel [08-29-16 - 15:33]
v1.14 - 7.0 patch update, demon hunter
Filename
TDDps.lua
TDDps.toc
TDHelper.lua
diff --git a/TDDps.lua b/TDDps.lua
index 4ca243f..3888bd0 100644
--- a/TDDps.lua
+++ b/TDDps.lua
@@ -27,6 +27,7 @@ local Classes = {
 	[9] = 'Warlock',
 	[10] = 'Monk',
 	[11] = 'Druid',
+	[12] = 'DemonHunter',
 }
 local TDDps_Frame = CreateFrame('Frame', 'TDDps_Frame');
 TDDps_Frame.rotationEnabled = false;
diff --git a/TDDps.toc b/TDDps.toc
index f80b8e9..bd6d696 100644
--- a/TDDps.toc
+++ b/TDDps.toc
@@ -2,7 +2,7 @@
 ## Notes: Rotation helper framework.
 ## Version: 1.13
 ## Author: Kaminaris
-## Interface: 60200
+## Interface: 70000
 ## SavedVariables: TDDps_Options
 ## OptionalDependencies: Bartender4, ElvUI, ButtonForge, SVUI_ActionBars

diff --git a/TDHelper.lua b/TDHelper.lua
index 15f6fe3..71cd708 100644
--- a/TDHelper.lua
+++ b/TDHelper.lua
@@ -60,9 +60,10 @@ function TD_TargetAura(name, timeShift)
 	local spellName = GetSpellInfo(name) or name;
 	local _, _, _, _, _, _, expirationTime = UnitAura('target', spellName, nil, 'PLAYER|HARMFUL');
 	if expirationTime ~= nil and (expirationTime - GetTime()) > timeShift then
-		return true;
+		local cd = expirationTime - GetTime() - (timeShift or 0);
+		return true, cd;
 	end
-	return false;
+	return false, 0;
 end

 ----------------------------------------------
@@ -142,6 +143,34 @@ function TD_SpellAvailable(spell, timeShift)
 end

 ----------------------------------------------
+-- Extract tooltip number
+----------------------------------------------
+function TD_ExtractTooltip(spell, pattern)
+	local _pattern = gsub(pattern, "%%s", "([%%d%.,]+)");
+
+	if not TDSpellTooltip then
+		CreateFrame('GameTooltip', 'TDSpellTooltip', UIParent, 'GameTooltipTemplate');
+		TDSpellTooltip:SetOwner(UIParent, "ANCHOR_NONE")
+	end
+	TDSpellTooltip:SetSpellByID(spell);
+
+	for i = 2, 4 do
+		local line = _G['TDSpellTooltipTextLeft' .. i];
+		local text = line:GetText();
+
+		if text then
+			local cost = strmatch(text, _pattern);
+			if cost then
+				cost = cost and tonumber((gsub(cost, "%D", "")));
+				return cost;
+			end
+		end
+	end
+
+	return 0;
+end
+
+----------------------------------------------
 -- Spell Cooldown
 ----------------------------------------------
 function TD_Cooldown(spell, timeShift)