Quantcast

v0.2

Pawel [05-12-15 - 22:27]
v0.2
Filename
Modules/TDWarriorDps.lua
Modules/_template.lua
TDButtons.lua
diff --git a/Modules/TDWarriorDps.lua b/Modules/TDWarriorDps.lua
new file mode 100644
index 0000000..d040305
--- /dev/null
+++ b/Modules/TDWarriorDps.lua
@@ -0,0 +1,132 @@
+-- Author      : Kaminari
+-- Create Date : 13:03 2015-04-20
+
+local _Bloodthirst		= 23881;
+local _WildStrike		= 100130;
+local _RagingBlow		= 85288;
+local _Execute			= 5308;
+local _BladeStorm		= 46924;
+local _StormBolt		= 107570;
+local _DragonRoar		= 118000;
+local _BerserkerRage	= 18499;
+local _Ravager			= 152277;
+local _Recklessness		= 1719;
+
+-- auras
+local _Enrage			= 12880;
+local _Bloodsurge		= 46916
+local _SuddenDeath		= 29725
+local _RagingBlowAura	= 131116
+
+-- talents
+local _isSuddenDeath = false;
+local _isUnquenchableThirst = false;
+local _isStormBolt = false;
+local _isDragonRoar = false;
+local _isUnquenchableThirst = false;
+local _isRavager = false;
+local _rageMax = 100;
+
+--flags
+local _RecklessnessHigh = false;
+
+----------------------------------------------
+-- Pre enable, checking talents
+----------------------------------------------
+TDWarriorDps_CheckTalents = function()
+	_isSuddenDeath = TDTalentEnabled("Sudden Death");
+	_isUnquenchableThirst = TDTalentEnabled("Unquenchable Thirst");
+	_isRavager = TDTalentEnabled("Ravager");
+	_isStormBolt = TDTalentEnabled("Storm Bolt");
+	_isDragonRoar = TDTalentEnabled("Dragon Roar");
+
+	_rageMax = UnitPowerMax('player', SPELL_POWER_RAGE);
+end
+
+----------------------------------------------
+-- Enabling Addon
+----------------------------------------------
+function TDWarriorDps_EnableAddon(mode)
+	mode = mode or 1;
+	_TD["DPS_Description"] = "TD Warrior DPS supports: Fury";
+	_TD["DPS_OnEnable"] = TDWarriorDps_CheckTalents;
+	if mode == 1 then
+		_TD["DPS_NextSpell"] = TDWarriorDps_Fury
+	end;
+	TDDps_EnableAddon();
+end
+
+----------------------------------------------
+-- Main rotation: Elemental
+----------------------------------------------
+TDWarriorDps_Fury = function()
+
+	local lcd, currentSpell = TDEndCast();
+
+	local berserRage = TDDps_SpellCooldown(_BerserkerRage, lcd);
+	local ravager = TDDps_SpellCooldown(_Ravager, lcd);
+	local sb = TDDps_SpellCooldown(_StormBolt, lcd);
+	local dr = TDDps_SpellCooldown(_DragonRoar, lcd);
+	local reck = TDDps_SpellCooldown(_Recklessness, lcd);
+	local enrage = TDAura(_Enrage);
+	local rb, rbCount = TDAura(_RagingBlowAura);
+	local rage = UnitPower('player', SPELL_POWER_RAGE);
+	local bs = TDAura(_Bloodsurge);
+	local sd = TDAura(_SuddenDeath);
+
+	local ph = TD_TargetPercentHealth();
+
+	if _Recklessness and not _RecklessnessHigh then
+		TDGlowIndependent(_Recklessness, 'reck');
+		_RecklessnessHigh = true;
+	elseif _RecklessnessHigh then
+		TDClearGlowIndependent(_Recklessness, 'reck');
+		_RecklessnessHigh = false;
+	end
+
+	if berserRage and not enrage then
+		return _BerserkerRage;
+	end
+
+	if (rage/_rageMax) >= 0.9 and ph > 0.2 then
+		return _WildStrike;
+	end
+
+	if sd then
+		return _Execute;
+	end
+
+	if rbCount >= 2 and ph > 0.2 then
+		return _RagingBlow;
+	end
+
+	if not enrage and (_isUnquenchableThirst or rage < 80) then
+		return _Bloodthirst;
+	end
+
+	if _isRavager and ravager then
+		return _Ravager;
+	end
+
+	if _isStormBolt and sb then
+		return _StormBolt;
+	end
+
+	if _isDragonRoar and dr then
+		return _DragonRoar;
+	end
+
+	if rage >= 30 and ph < 0.2 and enrage then
+		return _Execute;
+	end
+
+	if bs then
+		return _WildStrike;
+	end
+
+	if rbCount > 0 then
+		return _RagingBlow;
+	end
+
+	return _Bloodthirst;
+end
\ No newline at end of file
diff --git a/Modules/_template.lua b/Modules/_template.lua
new file mode 100644
index 0000000..e69de29
diff --git a/TDButtons.lua b/TDButtons.lua
index a8231e4..ab793bf 100644
--- a/TDButtons.lua
+++ b/TDButtons.lua
@@ -42,7 +42,7 @@ end
 ----------------------------------------------
 -- Show Overlay on button
 ----------------------------------------------
-function TDActionButton_Glow(self, id)
+function TDActionButton_Glow(self, id, r, g, b)
 	if ( self.tdOverlays and self.tdOverlays[id] ) then
 		self.tdOverlays[id]:Show();
 	else
@@ -60,7 +60,7 @@ function TDActionButton_Glow(self, id)
 		t:SetTexture("Interface\\Cooldown\\ping4")
 		t:SetBlendMode("ADD");
 		t:SetAllPoints(self.tdOverlays[id]);
-		t:SetVertexColor(1, 0, 0);
+		t:SetVertexColor(r or 1, g or 0, b or 0);
 		self.tdOverlays[id].texture = t;

 		self.tdOverlays[id]:SetPoint("CENTER",0,0);
@@ -196,12 +196,34 @@ function TDGlowSpellId(spellId)
 end

 ----------------------------------------------
+-- Glow independent button by spell name
+----------------------------------------------
+function TDGlowIndependent(spellName, id, r, g, b)
+	local name = GetSpellInfo(spellName) or spellName;
+	if TDActionSpells[name] ~= nil then
+		for k, button in pairs(TDActionSpells[name]) do
+			TDActionButton_Glow(button, id, r, g, b);
+		end
+	end
+end
+
+----------------------------------------------
+-- Clear glow independent button by spell name
+----------------------------------------------
+function TDClearGlowIndependent(spellName, id)
+	local name = GetSpellInfo(spellName) or spellName;
+	for k, button in pairs(TDActionSpells[name]) do
+		TDActionButton_HideGlow(button, id);
+	end
+end
+
+----------------------------------------------
 -- Glow spell by name
 ----------------------------------------------
 function TDGlowSpell(spellName)
     if TDActionSpells[spellName] ~= nil then
-        for k, v in pairs(TDActionSpells[spellName]) do
-            TDActionButton_ShowOverlayGlow(v);
+        for k, button in pairs(TDActionSpells[spellName]) do
+            TDActionButton_ShowOverlayGlow(button);
         end
         TDActionSpellsGlowing[spellName] = 1;
     end
@@ -238,6 +260,9 @@ function TDGlowClear()
     end
 end

+----------------------------------------------
+-- Frame init
+----------------------------------------------
 local TDButtonsFrame = CreateFrame("FRAME", "TDButtonsFrame");
 TDButtonsFrame:RegisterEvent("PLAYER_ENTERING_WORLD");