-- Maximum DPS Spell Selector
-- Druid - Balance
-- NOTES:
-- DoTs and Buffs can be extended to 30% over their maximum duration if
-- they are reapplied prior to their expiration.
function()
-- FUNCTIONS --------------------------------------------------------------
-- Converts booleans to strings.
function BoolString(boolean)
if boolean then
return "true"
else
return "false"
end
end
-- Returns the castTime of the supplied spellID and decrements the time of
-- every aura and cooldown contained within their respective arrays
-- for better move prediction.
function DecrementTime(spellID)
local castTime
local output
castTime = math.max((select(4,GetSpellInfo(spellID)) / 1000), gcd)
if type(dps_auraDuration) == "table" then
for i, v in pairs (dps_auraDuration) do
dps_auraDuration[i] = Subtract(dps_auraDuration[i],
castTime)
end
end
if type(dps_cdDuration) == "table" then
for i, v in pairs (dps_cdDuration) do
dps_cdDuration[i] = Subtract(dps_cdDuration[i],
castTime)
end
end
return castTime
end
-- Returns the count of the supplied aura.
function GetAuraCount(unitString, spellID, filterString)
local count, internalSpellID, _
for i = 1, 40 do
_, _, count, _, _, _, _, _, _, internalSpellID = UnitAura(unitString, i, filterString)
-- If there is no spellID returned, break the loop.
if not internalSpellID then
break
-- Parse the internalSpellID against your supplied spellID
elseif internalSpellID == spellID then
return count
end
end
return 0
end
-- Returns the aura duration.
function GetAuraDuration(unitString, spellID, filterString)
local expirationTime, internalSpellID, _
for i = 1, 40 do
_, _, _, _, _, expirationTime, _, _, _, internalSpellID = UnitAura(unitString, i, filterString)
-- If there is no spellID returned, break the loop.
if not internalSpellID then
break
-- Parse the internalSpellID against your supplied spellID
elseif internalSpellID == spellID then
return (expirationTime - GetTime() - gcd)
end
end
return 0
end
-- Returns an integer number representing the number of enemies within the
-- specified range.
-- This is accomplished by leveraging specific item's use ranges due to the
-- fact that items' range can be checked regardless of level, class,
-- or the target's status.
function GetEnemiesInRange(range)
local rangeItemID
if (range <= 5) then
rangeItemID = 37727
elseif (range <= 8) then
rangeItemID = 34368
elseif (range <= 10) then
rangeItemID = 32321
elseif (range <= 15) then
rangeItemID = 33069
elseif (range <= 20) then
rangeItemID = 10645
elseif (range <= 25) then
rangeItemID = 24268
elseif (range <= 30) then
rangeItemID = 835
elseif (range <= 35) then
rangeItemID = 24269
elseif (range <= 40) then
rangeItemID = 28767
elseif (range <= 45) then
rangeItemID = 32698
elseif (range <= 60) then
rangeItemID = 32825
else
rangeItemID = 35278
end
enemiesInRange = 0
for i = 1, 40 do
local unit = "nameplate"..i
if UnitExists(unit) then
if (UnitCanAttack("player", unit) and IsItemInRange(
rangeItemID, unit)
) then
enemiesInRange = enemiesInRange + 1
end
end
end
return enemiesInRange
end
-- Returns the supplied spellID's hasted spell cast time.
function GetSpellCastTime(spellID)
return math.max((select(4,GetSpellInfo(spellID)) / 1000), gcd)
end
-- Returns the supplied spellID's remaining cooldown time in seconds.
function GetSpellCooldownDuration(spellID)
if (spellID == nil) then
spellID = 61304
end
local _, start, duration, cdEnd
start, duration, _, _ = GetSpellCooldown(spellID)
cdEnd = (start + duration)
if ((cdEnd == 0) or (cdEnd == nil)) then
return 0
else
return (cdEnd - GetTime())
end
end
-- Returns the supplied spellID's remaining recharge time in seconds.
function GetSpellRechargeDuration(spellID)
local _, start, duration, cdEnd
_, _, start, duration = GetSpellCharges(spellID)
cdEnd = (start + duration)
if cdEnd == 0 then
return cdEnd
else
return (cdEnd - GetTime())
end
end
-- Returns the supplied spellID's icon.
function GetSpellIcon(spellID)
return select(3, GetSpellInfo(spellID))
end
-- Returns the specified unit's Attack Power.
function GetUnitAttackPower(unit)
local apBase, apPosBuff, apNegBuff
apBase, apPosBuff, apNegBuff = UnitAttackPower(unit)
return (apBase + apPosBuff + apNegBuff)
end
-- Returns the cast duration of the specified unit.
function GetUnitCastingDuration(unitString)
local castingEndTime = (select(5, UnitCastingInfo(unitString)))
local channellingEndTime = (select(5, UnitChannelInfo(unitString)))
if (castingEndTime == nil) then
castingDuration = 0
else
castingDuration = (castingEndTime - GetTime())
end
if (channellingEndTime == nil) then
channellingDuration = 0
else
channellingDuration = (channellingEndTime - GetTime())
end
return castingDuration + channellingDuration
end
-- Returns the specified unit's Ranged Attack Power.
function GetUnitRangedAttackPower(unit)
local apBase, apPosBuff, apNegBuff
apBase, apPosBuff, apNegBuff = UnitRangedAttackPower(unit)
return (apBase + apPosBuff + apNegBuff)
end
-- Returns a boolean stating wether or not the player has the specified
-- talent.
-- NOTE: dps Indexing starts at 1.
function HasTalent(tier, column)
return select(4, GetTalentInfo(tier, column, 1))
end
-- Returns a boolean indicating wether the supplied unit is within
-- the supplied range.
-- This is accomplished by leveraging specific item's use ranges due to the
-- fact that items' range can be checked regardless of level, class,
-- or the target's status.
function IsUnitInRange(unit, range)
local rangeItemID
if (range <= 5) then
rangeItemID = 37727
elseif (range <= 8) then
rangeItemID = 34368
elseif (range <= 10) then
rangeItemID = 32321
elseif (range <= 15) then
rangeItemID = 33069
elseif (range <= 20) then
rangeItemID = 10645
elseif (range <= 25) then
rangeItemID = 24268
elseif (range <= 30) then
rangeItemID = 835
elseif (range <= 35) then
rangeItemID = 24269
elseif (range <= 40) then
rangeItemID = 28767
elseif (range <= 45) then
rangeItemID = 32698
elseif (range <= 60) then
rangeItemID = 32825
else
rangeItemID = 35278
end
return IsItemInRange(rangeItemID, unit)
end
-- Returns the positive result of subtraction or a zero if the outcome of
-- that function would result in a negative.
function Subtract(base, less)
local output
output = base - less
if (output < 0) then
output = 0
end
return output
end
-- MAIN METHODS -----------------------------------------------------------
function Initialize()
-- VARIABLES --------------------------------------------------------------
if type(lastEclipse_mt) ~= "string" then
lastEclipse_mt = "Lunar"
end
dps_auraIndex = 0
dps_auraDuration = {}
dps_cdIndex = 0
dps_cdDuration = {}
dps_mtIndex = 0
dps_mtIndexMax = 3
dps_mtIcon = {}
dps_mtText = {}
dps_mtProgress = {}
dps_mtRange = {}
-- Player Information -----------------------------------------------------
player_level = UnitLevel("player")
player_energy = UnitPower("player", 3)
player_energyMax = UnitPowerMax("player", 3)
player_comboPoints = UnitPower("player", 4)
player_astralPower = UnitPower("player", 8)
player_stealthed = IsStealthed()
player_inCombat = UnitAffectingCombat("player")
player_manaPercent = ((UnitPower("player", 0))/(UnitPowerMax("player", 0)))
player_healthPercent = ((UnitHealth("player"))/(UnitHealthMax("player")))
-- Target Information -----------------------------------------------------
target_healthPercent = ((UnitHealth("target"))/(UnitHealthMax("target")))
target_attackable = UnitCanAttack("player","target")
and (not UnitIsDeadOrGhost("target"))
target_isPlayer = UnitIsPlayer("target")
-- Cooldowns --------------------------------------------------------------
gcd = GetSpellCooldownDuration(61304)
-- Talents ----------------------------------------------------------------
naturesBalance_talent = HasTalent(1, 1)
warriorOfElune_talent = HasTalent(1, 2)
forceOfNature_talent = HasTalent(1, 3)
feralAffinity_talent = HasTalent(3, 1)
guardianAffinity_talent = HasTalent(3, 2)
restorationAffinity_talent = HasTalent(3, 3)
mightyBash_talent = HasTalent(4, 1)
massEntanglement_talent = HasTalent(4, 2)
soulOfTheForest_talent = HasTalent(5, 1)
starlord_talent = HasTalent(5, 2)
Incarnation_talent = HasTalent(5, 3)
stellarDrift_talent = HasTalent(6, 1)
twinMoons_talent = HasTalent(6, 2)
stellarFlare_talent = HasTalent(6, 3)
solstice_talent = HasTalent(7, 2)
furyOfElune_talent = HasTalent(7, 2)
newMoon_talent = HasTalent(7, 3)
-- Forms ------------------------------------------------------------------
form_caster = GetShapeshiftForm() == 0
form_bear = GetShapeshiftForm() == 1
form_cat = GetShapeshiftForm() == 2
form_travel = GetShapeshiftForm() == 3
form_moonkin = GetShapeshiftForm() == 4
form_treant = GetShapeshiftForm() == 5
form_stag = GetShapeshiftForm() == 6
-- Auras ------------------------------------------------------------------
-- Eclipse (Solar)
eclipseSolar_id = 48517
eclipseSolar_baseDuration = 15
dps_auraDuration[dps_auraIndex] = GetAuraDuration(
"player", eclipseSolar_id, "PLAYER|HELPFUL")
eclipseSolar_auraIndex = dps_auraIndex
dps_auraIndex = (dps_auraIndex + 1)
-- Eclipse (Lunar)
eclipseLunar_id = 48518
eclipseLunar_baseDuration = 15
dps_auraDuration[dps_auraIndex] = GetAuraDuration(
"player", eclipseLunar_id, "PLAYER|HELPFUL")
eclipseLunar_auraIndex = dps_auraIndex
dps_auraIndex = (dps_auraIndex + 1)
-- Starlord
starlord_id = 279709
dps_auraDuration[dps_auraIndex] = GetAuraDuration(
"player", starlord_id, "PLAYER|HELPFUL")
starlord_auraIndex = dps_auraIndex
dps_auraIndex = (dps_auraIndex + 1)
starlord_count = GetAuraCount("player", starlord_id, "PLAYER|HELPFUL")
-- Abilities --------------------------------------------------------------
-- Warrior of Elune
warriorOfElune_id = 202425
warriorOfElune_count = GetAuraCount("player", warriorOfElune_id,
"PLAYER|HELPFUL")
warriorOfElune_baseCD = 45
dps_cdDuration[dps_cdIndex] = GetSpellCooldownDuration(warriorOfElune_id)
warriorOfElune_cdIndex = dps_cdIndex
dps_cdIndex = (dps_cdIndex + 1)
warriorOfElune_use = false
warriorOfElune_icon = GetSpellIcon(warriorOfElune_id)
warriorOfElune_progress = ""
warriorOfElune_text = ""
function UseWarriorOfElune()
DecrementTime(warriorOfElune_id)
dps_mtIcon[dps_mtIndex] = warriorOfElune_icon
dps_mtText[dps_mtIndex] = warriorOfElune_text
dps_mtProgress[dps_mtIndex] = warriorOfElune_progress
dps_mtIndex = (dps_mtIndex + 1)
end
-- Moonfire
moonfire_level = 1
moonfire_id = 8921
moonfire_auraID = 164812
moonfire_castTime = GetSpellCastTime(moonfire_id)
moonfire_baseDuration = 22
moonfire_powerGen = 2
dps_auraDuration[dps_auraIndex] = GetAuraDuration("target", moonfire_auraID,
"PLAYER|HARMFUL")
moonfire_auraIndex = dps_auraIndex
dps_auraIndex = (dps_auraIndex + 1)
moonfire_isActive = (dps_auraDuration[moonfire_auraIndex] >
(0.3 * moonfire_baseDuration))
moonfire_use = false
moonfire_icon = GetSpellIcon(moonfire_id)
moonfire_progress = ""
moonfire_text = ""
function UseMoonfire()
moonfire_use = true
dps_auraDuration[moonfire_auraIndex] = (dps_auraDuration[moonfire_auraIndex]
+ moonfire_baseDuration)
moonfire_isActive = (dps_auraDuration[moonfire_auraIndex] >
(0.3 * moonfire_baseDuration))
player_astralPower = (player_astralPower +
moonfire_powerGen)
moonfire_castTime = DecrementTime(moonfire_id)
dps_auraDuration[moonfire_auraIndex] = (moonfire_castTime
+ dps_auraDuration[moonfire_auraIndex])
dps_mtIcon[dps_mtIndex] = moonfire_icon
dps_mtText[dps_mtIndex] = moonfire_text
dps_mtProgress[dps_mtIndex] = moonfire_progress
dps_mtIndex = (dps_mtIndex + 1)
end
-- Sunfire
sunfire_level = 23
sunfire_id = 93402
sunfire_auraID = 164815
sunfire_castTime = GetSpellCastTime(sunfire_id)
sunfire_baseDuration = 18
sunfire_powerGen = 2
dps_auraDuration[dps_auraIndex] = GetAuraDuration("target", sunfire_auraID,
"PLAYER|HARMFUL")
sunfire_auraIndex = dps_auraIndex
dps_auraIndex = (dps_auraIndex + 1)
sunfire_isActive = (dps_auraDuration[sunfire_auraIndex] >
(0.3 * sunfire_baseDuration))
sunfire_use = false
sunfire_icon = GetSpellIcon(sunfire_id)
sunfire_progress = ""
sunfire_text = ""
function UseSunfire()
sunfire_use = true
dps_auraDuration[sunfire_auraIndex] = (dps_auraDuration[sunfire_auraIndex]
+ sunfire_baseDuration)
sunfire_isActive = (dps_auraDuration[sunfire_auraIndex] >
(0.3 * sunfire_baseDuration))
player_astralPower = (player_astralPower +
sunfire_powerGen)
sunfire_castTime = DecrementTime(sunfire_id)
dps_auraDuration[moonfire_auraIndex] = (sunfire_castTime
+ dps_auraDuration[sunfire_auraIndex])
dps_mtIcon[dps_mtIndex] = sunfire_icon
dps_mtText[dps_mtIndex] = sunfire_text
dps_mtProgress[dps_mtIndex] = sunfire_progress
dps_mtIndex = (dps_mtIndex + 1)
end
-- Stellar Flare
stellarFlare_id = 202347
stellarFlare_auraID = 202347
stellarFlare_castTime = GetSpellCastTime(stellarFlare_id)
stellarFlare_baseDuration = 24
stellarFlare_powerGen = 8
dps_auraDuration[dps_auraIndex] = GetAuraDuration("target", stellarFlare_auraID,
"PLAYER|HARMFUL")
stellarFlare_auraIndex = dps_auraIndex
dps_auraIndex = (dps_auraIndex + 1)
stellarFlare_isActive = (dps_auraDuration[stellarFlare_auraIndex] >
(0.3 * stellarFlare_baseDuration))
stellarFlare_use = false
stellarFlare_icon = GetSpellIcon(stellarFlare_id)
stellarFlare_progress = ""
stellarFlare_text = ""
function UseStellarFlare()
stellarFlare_use = true
dps_auraDuration[stellarFlare_auraIndex] = (
dps_auraDuration[stellarFlare_auraIndex] + stellarFlare_baseDuration)
stellarFlare_isActive = (dps_auraDuration[stellarFlare_auraIndex] >
(0.3 * stellarFlare_baseDuration))
player_astralPower = (player_astralPower +
stellarFlare_powerGen)
stellarFlare_castTime = DecrementTime(stellarFlare_id)
dps_auraDuration[stellarFlare_auraIndex] = (stellarFlare_castTime
+ dps_auraDuration[stellarFlare_auraIndex])
dps_mtIcon[dps_mtIndex] = stellarFlare_icon
dps_mtText[dps_mtIndex] = stellarFlare_text
dps_mtProgress[dps_mtIndex] = stellarFlare_progress
dps_mtIndex = (dps_mtIndex + 1)
end
-- Starfire
starfire_level = 10
starfire_id = 194153
starfire_castTime = GetSpellCastTime(starfire_id)
starfire_basePowerGen = 8
if ((type(warriorOfElune_count) == "number")
and (warriorOfElune_count > 0)
) then
starfire_powerGen = math.floor(starfire_basePowerGen * 1.4)
else
starfire_powerGen = starfire_basePowerGen
end
starfire_use = false
starfire_icon = GetSpellIcon(starfire_id)
starfire_icon = GetSpellIcon(starfire_id)
if ((starfire_charges ~= 0)
or (starfire_charges ~= 1)
or (starfire_charges ~= 2)
) then
starfire_charges = 2
end
starfire_progress = ""
starfire_text = ""
function UseStarfire()
starfire_use = true
player_astralPower = (player_astralPower +
starfire_powerGen)
warriorOfElune_count = Subtract(warriorOfElune_count, 1)
if (warriorOfElune_count > 0) then
starfire_powerGen = math.floor(starfire_basePowerGen * 1.4)
else
starfire_powerGen = starfire_basePowerGen
end
DecrementTime(starfire_id)
Subtract(warriorOfElune_count, 1)
dps_cdDuration[warriorOfElune_cdIndex] = warriorOfElune_baseCD
dps_mtIcon[dps_mtIndex] = starfire_icon
dps_mtText[dps_mtIndex] = starfire_text
dps_mtProgress[dps_mtIndex] = starfire_progress
dps_mtIndex = (dps_mtIndex + 1)
end
-- Wrath
wrath_level = 1
wrath_id = 190984
wrath_castTime = GetSpellCastTime(wrath_id)
wrath_basePowerGen = 6
if (soulOfTheForest_talent) then
wrath_powerGen = math.floor(wrath_basePowerGen * 1.5)
else
wrath_powerGen = wrath_basePowerGen
end
wrath_use = false
wrath_icon = GetSpellIcon(wrath_id)
if ((wrath_charges ~= 0)
or (wrath_charges ~= 1)
or (wrath_charges ~= 2)
) then
wrath_charges = 2
end
wrath_progress = ""
wrath_text = ""
function UseWrath()
wrath_use = true
player_astralPower = (player_astralPower +
wrath_powerGen)
DecrementTime(wrath_id)
dps_mtIcon[dps_mtIndex] = wrath_icon
dps_mtText[dps_mtIndex] = wrath_text
dps_mtProgress[dps_mtIndex] = wrath_progress
dps_mtIndex = (dps_mtIndex + 1)
end
-- Starsurge
starsurge_level = 12
starsurge_id = 78674
starsurge_powerCost = 30
starsurge_use = false
starsurge_icon = GetSpellIcon(starsurge_id)
starsurge_progress = ""
starsurge_text = ""
function UseStarsurge()
starsurge_use = true
player_astralPower = (player_astralPower -
starsurge_powerCost)
DecrementTime(starsurge_id)
if (starlord_talent) then
starlord_count = (starlord_count + 1)
end
dps_mtIcon[dps_mtIndex] = starsurge_icon
dps_mtText[dps_mtIndex] = starsurge_text
dps_mtProgress[dps_mtIndex] = starsurge_progress
dps_mtIndex = (dps_mtIndex + 1)
end
-- Starfall
starfall_level = 34
starfall_id = 191034
starfall_castTime = GetSpellCastTime(starfall_id)
starfall_powerCost = 50
starfall_baseDuration = 8
dps_auraDuration[dps_auraIndex] = GetAuraDuration("player", starfall_auraID,
"PLAYER|HELPFUL")
starfall_auraIndex = dps_auraIndex
dps_auraIndex = (dps_auraIndex + 1)
starfall_isActive = (dps_auraDuration[starfall_auraIndex] >
(0.3 * starfall_baseDuration))
starfall_use = false
starfall_icon = GetSpellIcon(starfall_id)
starfall_progress = ""
starfall_text = ""
function UseStarfall()
starfall_use = true
dps_auraDuration[starfall_auraIndex] = (
dps_auraDuration[starfall_auraIndex] + starfall_baseDuration)
starfall_isActive = (dps_auraDuration[starfall_auraIndex] >
(0.3 * starfall_baseDuration))
player_astralPower = (player_astralPower -
starfall_powerCost)
starfall_castTime = DecrementTime(starfall_id)
dps_auraDuration[starfall_auraIndex] = (starfall_castTime
+ dps_auraDuration[starfall_auraIndex])
if (starlord_talent) then
starlord_count = (starlord_count + 1)
end
dps_mtIcon[dps_mtIndex] = starfall_icon
dps_mtText[dps_mtIndex] = starfall_text
dps_mtProgress[dps_mtIndex] = starfall_progress
dps_mtIndex = (dps_mtIndex + 1)
end
-- Celestial Alignment
celestialAlignment_level = 39
if (Incarnation_talent == true) then
celestialAlignment_id = 102560
celestialAlignment_baseDuration = 30
else
celestialAlignment_id = 194223
celestialAlignment_baseDuration = 20
end
dps_auraDuration[dps_auraIndex] = GetAuraDuration("player",
celestialAlignment_id, "PLAYER|HELPFUL")
celestialAlignment_auraIndex = dps_auraIndex
dps_auraIndex = (dps_auraIndex + 1)
celestialAlignment_baseCD = 180
dps_cdDuration[dps_cdIndex] = GetSpellCooldownDuration(celestialAlignment_id)
celestialAlignment_cdIndex = dps_cdIndex
dps_cdIndex = (dps_cdIndex + 1)
celestialAlignment_use = false
celestialAlignment_icon = GetSpellIcon(celestialAlignment_id)
celestialAlignment_progress = ""
celestialAlignment_text = ""
function UseCelestialAlignment()
celestialAlignment_use = true
dps_auraDuration[celestialAlignment_auraIndex] = celestialAlignment_baseDuration
celestialAlignment_isActive = (dps_auraDuration[celestialAlignment_auraIndex] >
(0.3 * celestialAlignment_baseDuration))
celestialAlignment_castTime = DecrementTime(celestialAlignment_id)
dps_auraDuration[celestialAlignment_auraIndex] = (celestialAlignment_castTime
+ dps_auraDuration[celestialAlignment_auraIndex])
dps_cdDuration[celestialAlignment_cdIndex] = celestialAlignment_baseCD
dps_mtIcon[dps_mtIndex] = celestialAlignment_icon
dps_mtText[dps_mtIndex] = celestialAlignment_text
dps_mtProgress[dps_mtIndex] = celestialAlignment_progress
dps_mtIndex = (dps_mtIndex + 1)
end
-- Force of Nature
forceOfNature_id = 205636
forceOfNature_baseDuration = 20
dps_auraDuration[dps_auraIndex] = GetAuraDuration("player",
forceOfNature_id , "PLAYER|HELPFUL")
forceOfNature_auraIndex = dps_auraIndex
dps_auraIndex = (dps_auraIndex + 1)
forceOfNature_baseCD = 60
dps_cdDuration[dps_cdIndex] = GetSpellCooldownDuration(forceOfNature_id)
forceOfNature_cdIndex = dps_cdIndex
dps_cdIndex = (dps_cdIndex + 1)
forceOfNature_castTime = GetSpellCastTime(forceOfNature_id)
forceOfNature_powerGen = 20
forceOfNature_use = false
forceOfNature_icon = GetSpellIcon(forceOfNature_id)
forceOfNature_progress = ""
forceOfNature_text = ""
function UseForceOfNature()
forceOfNature_use = true
dps_auraDuration[forceOfNature_auraIndex] = (
dps_auraDuration[forceOfNature_auraIndex]
+ forceOfNature_baseDuration)
forceOfNature_isActive = (dps_auraDuration[forceOfNature_auraIndex] >
(0.3 * forceOfNature_baseDuration))
forceOfNature_castTime = DecrementTime(forceOfNature_id)
dps_auraDuration[forceOfNature_auraIndex] = (forceOfNature_castTime
+ dps_auraDuration[forceOfNature_auraIndex])
dps_cdDuration[forceOfNature_cdIndex] = forceOfNature_baseCD
dps_mtIcon[dps_mtIndex] = forceOfNature_icon
dps_mtText[dps_mtIndex] = forceOfNature_text
dps_mtProgress[dps_mtIndex] = forceOfNature_progress
dps_mtIndex = (dps_mtIndex + 1)
end
-- Fury of Elune
furyOfElune_id = 202770
furyOfElune_baseDuration = 8
dps_auraDuration[dps_auraIndex] = GetAuraDuration("player",
furyOfElune_id , "PLAYER|HELPFUL")
furyOfElune_auraIndex = dps_auraIndex
dps_auraIndex = (dps_auraIndex + 1)
furyOfElune_baseCD = 60
dps_cdDuration[dps_cdIndex] = GetSpellCooldownDuration(furyOfElune_id) - gcd
furyOfElune_cdIndex = dps_cdIndex
dps_cdIndex = (dps_cdIndex + 1)
furyOfElune_castTime = GetSpellCastTime(furyOfElune_id)
furyOfElune_use = false
furyOfElune_icon = GetSpellIcon(furyOfElune_id)
furyOfElune_progress = ""
furyOfElune_text = ""
function UseFuryOfElune()
furyOfElune_use = true
dps_auraDuration[furyOfElune_auraIndex] = furyOfElune_baseDuration
furyOfElune_castTime = DecrementTime(furyOfElune_id)
dps_auraDuration[furyOfElune_auraIndex] = (furyOfElune_castTime
+ dps_auraDuration[furyOfElune_auraIndex])
dps_cdDuration[furyOfElune_cdIndex] = furyOfElune_baseCD
dps_mtIcon[dps_mtIndex] = furyOfElune_icon
dps_mtText[dps_mtIndex] = furyOfElune_text
dps_mtProgress[dps_mtIndex] = furyOfElune_progress
dps_mtIndex = (dps_mtIndex + 1)
end
end
-- DPS ROTATION - SINGLE TARGET -------------------------------------------
Initialize()
while (dps_mtIndex < dps_mtIndexMax) do
-- If you have a valid target...
if ((UnitExists("target"))
and (target_attackable)
) then
-- Create an initial index value to check for equality to the final
-- index value at the end of our loop...
dps_mtIndexInit = dps_mtIndex
-- COOLDOWNS & AURA MAINTENANCE
dps_mtPhase = "COOLDOWNS & AURA MAINTENANCE"
if ((player_level >= starfall_level)
and (not starfall_isActive)
and (player_astralPower >= starfall_powerCost)
) then
UseStarfall()
elseif ((forceOfNature_talent)
and (dps_cdDuration[forceOfNature_cdIndex] <= 0)
and (player_astralPower <= 80)
) then
UseForceOfNature()
elseif ((furyOfElune_talent)
and (dps_cdDuration[furyOfElune_cdIndex] <= 0)
) then
UseFuryOfElune()
elseif ((warriorOfElune_talent)
and (warriorOfElune_count <= 0)
and (dps_cdDuration[warriorOfElune_cdIndex] <= 0)
and (dps_auraDuration[eclipseLunar_auraIndex] > (gcd * 2))
) then
UseWarriorOfElune()
-- ASTRAL POWER CAPPED
elseif (player_astralPower >=
(starfall_powerCost + starsurge_powerCost)
) then
UseStarsurge()
-- ASTRAL POWER UNCAPPED
else
-- DOT APPLICATION
dps_mtPhase = "DOT APPLICATION"
-- If Moonfire is not active and the player is high enough level
-- to use it, use Moonfire.
if ((dps_mtIndex < dps_mtIndexMax)
and (player_level > moonfire_level)
and (player_level >= moonfire_level)
and (not moonfire_isActive)
) then
UseMoonfire()
-- If Sunfire is not active, and the player is high enough
-- level to use it, use Sunfire.
elseif ((dps_mtIndex < dps_mtIndexMax)
and (player_level >= sunfire_level)
and (not sunfire_isActive)
) then
UseSunfire()
-- if Stellar Flare was taken as a talent and it is not active,
-- use Stellar Flare.
elseif ((dps_mtIndex < dps_mtIndexMax)
and (stellarFlare_talent)
and (not stellarFlare_isActive)
) then
UseStellarFlare()
-- CELESTIAL ALIGNMENT
elseif (dps_auraDuration[celestialAlignment_auraIndex] > 0) then
dps_mtPhase = "CELESTIAL ALIGNMENT"
UseStarfire()
starfire_charges = 2
wrath_charges = 2
-- ECLIPSE (LUNAR)
elseif (dps_auraDuration[eclipseLunar_auraIndex] > 0) then
dps_mtPhase = "ECLIPSE (LUNAR)"
UseStarfire()
starfire_charges = 0
wrath_charges = 2
-- ECLIPSE (SOLAR)
elseif (dps_auraDuration[eclipseSolar_auraIndex] > 0) then
dps_mtPhase = "ECLIPSE (SOLAR)"
UseWrath()
starfire_charges = 2
wrath_charges = 0
-- UNEMPOWERED
else
dps_mtPhase = "UNEMPOWERED"
if ((player_level > celestialAlignment_level)
and (dps_cdDuration[celestialAlignment_cdIndex] <= 0)
) then
UseCelestialAlignment()
end
if ((player_level > starfire_level)
and ((starfire_charges > 0)
or (warriorOfElune_count > 0))
) then
UseStarfire()
starfire_charges = Subtract(starfire_charges, 1)
end
if ((player_level > wrath_level)
and (wrath_charges > 0)
) then
UseWrath()
wrath_charges = Subtract(wrath_charges, 1)
end
end
end
-- If your index hasn't incremented since the start of the loop,
-- exit the loop...
if (dps_mtIndexInit == dps_mtIndex) then
dps_mtIndex = dps_mtIndexMax
end
else
dps_mtIndex = dps_mtIndexMax
end
---------------------------------------------------------------------------
end
dps_mtDebug = ("")
return true
end