v7.1.4.2 - Target count detection
Pawel [01-29-17 - 04:09]
v7.1.4.2 - Target count detection
diff --git a/MaxDps.toc b/MaxDps.toc
index b214065..c17e823 100644
--- a/MaxDps.toc
+++ b/MaxDps.toc
@@ -1,6 +1,6 @@
## Title: MaxDps
## Notes: Rotation helper framework.
-## Version: 7.1.4.1
+## Version: 7.1.4.2
## Author: Kaminaris
## Interface: 70100
## SavedVariables: MaxDpsOptions
diff --git a/helper.lua b/helper.lua
index 3ff2d16..1637b57 100644
--- a/helper.lua
+++ b/helper.lua
@@ -142,6 +142,11 @@ function MaxDps:GlobalCooldown()
return gcd;
end
+function MaxDps:AttackHaste()
+ local haste = UnitSpellHaste('player');
+ return 1/((haste / 100) + 1);
+end
+
function MaxDps:SpellCharges(spell, timeShift)
local currentCharges, maxCharges, cooldownStart, cooldownDuration = GetSpellCharges(spell);
if currentCharges == nil then
@@ -156,6 +161,9 @@ function MaxDps:SpellCharges(spell, timeShift)
if cd > cooldownDuration then
cd = 0;
end
+ if cd > 0 then
+ currentCharges = currentCharges + (1 - (cd / cooldownDuration));
+ end
return cd, currentCharges, maxCharges;
end
@@ -215,6 +223,59 @@ function MaxDps:Bloodlust(timeShift)
return false;
end
+MaxDps.Spellbook = {};
+function MaxDps:FindSpellInSpellbook(spell)
+ local spellName = GetSpellInfo(spell);
+ if MaxDps.Spellbook[spellName] then
+ return MaxDps.Spellbook[spellName];
+ end
+
+ local _, _, offset, numSpells = GetSpellTabInfo(2);
+
+ local booktype = 'spell';
+
+ for index = offset + 1, numSpells + offset do
+ local spellID = select(2, GetSpellBookItemInfo(index, booktype));
+ if spellID and spellName == GetSpellBookItemName(index, booktype) then
+ MaxDps.Spellbook[spellName] = index;
+ return index;
+ end
+ end
+
+ return nil;
+end
+
+function MaxDps:IsSpellInRange(spell, unit)
+ unit = unit or 'target';
+
+ local inRange = IsSpellInRange(spell, unit);
+
+ if inRange == nil then
+ local booktype = 'spell';
+ local myIndex = MaxDps:FindSpellInSpellbook(spell)
+ if myIndex then
+ return IsSpellInRange(myIndex, booktype, unit);
+ end
+ return inRange;
+ end
+ return inRange;
+end
+
+function MaxDps:TargetsInRange(spell)
+ local count = 0;
+ for i = 0, 1000, 1 do
+ local np = _G['NamePlate' .. i];
+ if np ~= nil and
+ np:IsVisible() and
+ MaxDps:IsSpellInRange(spell, np.UnitFrame.unit) == 1
+ then
+ count = count + 1;
+ end
+ end
+
+ return count;
+end
+
function MaxDps:FormatTime(left)
local seconds = left >= 0 and math.floor((left % 60) / 1 ) or 0;
local minutes = left >= 60 and math.floor((left % 3600) / 60 ) or 0;
@@ -233,4 +294,4 @@ function MaxDps:FormatTime(left)
else
return string.format("%d [S]", seconds);
end
-end
+end
\ No newline at end of file