Thread Tools Display Modes
10-22-20, 11:24 AM   #1
Iamyew
A Kobold Labourer
Join Date: Oct 2020
Posts: 1
Exclamation Weak Auras : Balance Druid

So, with the changes that have come out since 9.0.1, I no longer know how to track the Wrath and/or Starfire charges on my balance druid. I was trying to get past this issue programmatically, but my internal weak aura charge tracking is not incrementing this at the proper intervals, but I'm at a loss.

1. If somebody knows how to get the charges for these abilities (GetSpellCharges does not work for this, nor is there an associated aura)

2. If you do not know the answer to this (or if there isn't one), could somebody please help me see where this logic error is? the code is rather lengthy, but the issue becomes apparent during my "UNEMPOWERED" state, where these charges are relevant to my spell selection. The following code does not output anything, but I have icons that pull data from the arrays created in order to display my recommended actions in a similar way to Hekili.

Lua Code:
  1. -- Maximum DPS Spell Selector
  2. -- Druid - Balance
  3.  
  4. -- NOTES:
  5. --     DoTs and Buffs can be extended to 30% over their maximum duration if
  6. --         they are reapplied prior to their expiration.
  7.  
  8. function()
  9.    
  10.    
  11.     -- FUNCTIONS --------------------------------------------------------------
  12.    
  13.     -- Converts booleans to strings.
  14.     function BoolString(boolean)
  15.         if boolean then
  16.             return "true"
  17.         else
  18.             return "false"
  19.         end
  20.     end
  21.  
  22.     -- Returns the castTime of the supplied spellID and decrements the time of
  23.     --     every aura and cooldown contained within their respective arrays
  24.     --     for better move prediction.
  25.     function DecrementTime(spellID)
  26.         local castTime
  27.         local output
  28.         castTime = math.max((select(4,GetSpellInfo(spellID)) / 1000), gcd)
  29.         if type(dps_auraDuration) == "table" then
  30.             for i, v in pairs (dps_auraDuration) do
  31.                 dps_auraDuration[i] = Subtract(dps_auraDuration[i],
  32.                     castTime)
  33.             end
  34.         end
  35.         if type(dps_cdDuration) == "table" then
  36.             for i, v in pairs (dps_cdDuration) do
  37.                 dps_cdDuration[i] = Subtract(dps_cdDuration[i],
  38.                     castTime)
  39.             end
  40.         end
  41.         return castTime
  42.     end
  43.    
  44.     -- Returns the count of the supplied aura.
  45.     function GetAuraCount(unitString, spellID, filterString)
  46.         local count, internalSpellID, _
  47.         for i = 1, 40 do
  48.             _, _, count, _, _, _, _, _, _, internalSpellID = UnitAura(unitString, i, filterString)
  49.             -- If there is no spellID returned, break the loop.
  50.             if not internalSpellID then
  51.                 break
  52.                 -- Parse the internalSpellID against your supplied spellID
  53.             elseif internalSpellID == spellID then
  54.                 return count
  55.             end
  56.         end
  57.         return 0
  58.     end
  59.    
  60.     -- Returns the aura duration.
  61.     function GetAuraDuration(unitString, spellID, filterString)
  62.         local expirationTime, internalSpellID, _
  63.         for i = 1, 40 do
  64.             _, _, _, _, _, expirationTime, _, _, _, internalSpellID = UnitAura(unitString, i, filterString)
  65.             -- If there is no spellID returned, break the loop.
  66.             if not internalSpellID then
  67.                 break
  68.                 -- Parse the internalSpellID against your supplied spellID
  69.             elseif internalSpellID == spellID then
  70.                 return (expirationTime - GetTime() - gcd)
  71.             end
  72.         end
  73.         return 0
  74.     end
  75.    
  76.     -- Returns an integer number representing the number of enemies within the
  77.     --     specified range.
  78.     -- This is accomplished by leveraging specific item's use ranges due to the
  79.     --     fact that items' range can be checked regardless of level, class,
  80.     --     or the target's status.
  81.     function GetEnemiesInRange(range)
  82.         local rangeItemID
  83.         if (range <= 5) then
  84.             rangeItemID = 37727
  85.         elseif (range <= 8) then
  86.             rangeItemID = 34368
  87.         elseif (range <= 10) then
  88.             rangeItemID = 32321
  89.         elseif (range <= 15) then
  90.             rangeItemID = 33069
  91.         elseif (range <= 20) then
  92.             rangeItemID = 10645
  93.         elseif (range <= 25) then
  94.             rangeItemID = 24268
  95.         elseif (range <= 30) then
  96.             rangeItemID = 835
  97.         elseif (range <= 35) then
  98.             rangeItemID = 24269
  99.         elseif (range <= 40) then
  100.             rangeItemID = 28767
  101.         elseif (range <= 45) then
  102.             rangeItemID = 32698
  103.         elseif (range <= 60) then
  104.             rangeItemID = 32825
  105.         else
  106.             rangeItemID = 35278
  107.         end
  108.         enemiesInRange = 0
  109.         for i = 1, 40 do
  110.             local unit = "nameplate"..i
  111.             if UnitExists(unit) then
  112.                 if (UnitCanAttack("player", unit) and IsItemInRange(
  113.                     rangeItemID, unit)
  114.                 ) then
  115.                     enemiesInRange = enemiesInRange + 1
  116.                 end    
  117.             end
  118.         end
  119.         return enemiesInRange
  120.     end
  121.  
  122.     -- Returns the supplied spellID's hasted spell cast time.
  123.     function GetSpellCastTime(spellID)
  124.         return math.max((select(4,GetSpellInfo(spellID)) / 1000), gcd)
  125.     end
  126.    
  127.     -- Returns the supplied spellID's remaining cooldown time in seconds.
  128.     function GetSpellCooldownDuration(spellID)
  129.         if (spellID == nil) then
  130.             spellID = 61304
  131.         end
  132.         local _, start, duration, cdEnd
  133.         start, duration, _, _ = GetSpellCooldown(spellID)
  134.         cdEnd = (start + duration)
  135.         if ((cdEnd == 0) or (cdEnd == nil)) then
  136.             return 0
  137.         else
  138.             return (cdEnd - GetTime())
  139.         end
  140.     end
  141.  
  142.     -- Returns the supplied spellID's remaining recharge time in seconds.
  143.     function GetSpellRechargeDuration(spellID)
  144.         local _, start, duration, cdEnd
  145.         _, _, start, duration = GetSpellCharges(spellID)
  146.         cdEnd = (start + duration)
  147.         if cdEnd == 0 then
  148.             return cdEnd
  149.         else
  150.             return (cdEnd - GetTime())
  151.         end
  152.     end
  153.    
  154.     -- Returns the supplied spellID's icon.
  155.     function GetSpellIcon(spellID)
  156.         return select(3, GetSpellInfo(spellID))
  157.     end
  158.    
  159.     -- Returns the specified unit's Attack Power.
  160.     function GetUnitAttackPower(unit)
  161.         local apBase, apPosBuff, apNegBuff
  162.         apBase, apPosBuff, apNegBuff = UnitAttackPower(unit)
  163.         return (apBase + apPosBuff + apNegBuff)
  164.     end
  165.  
  166.     -- Returns the cast duration of the specified unit.
  167.     function GetUnitCastingDuration(unitString)
  168.         local castingEndTime = (select(5, UnitCastingInfo(unitString)))
  169.         local channellingEndTime = (select(5, UnitChannelInfo(unitString)))
  170.         if (castingEndTime == nil) then
  171.             castingDuration = 0
  172.         else
  173.             castingDuration = (castingEndTime - GetTime())
  174.         end
  175.         if (channellingEndTime == nil) then
  176.             channellingDuration = 0
  177.         else
  178.             channellingDuration = (channellingEndTime - GetTime())
  179.         end
  180.         return castingDuration + channellingDuration
  181.     end
  182.    
  183.     -- Returns the specified unit's Ranged Attack Power.
  184.     function GetUnitRangedAttackPower(unit)
  185.         local apBase, apPosBuff, apNegBuff
  186.         apBase, apPosBuff, apNegBuff = UnitRangedAttackPower(unit)
  187.         return (apBase + apPosBuff + apNegBuff)
  188.     end
  189.    
  190.     -- Returns a boolean stating wether or not the player has the specified
  191.     --     talent.
  192.     --     NOTE: dps Indexing starts at 1.
  193.     function HasTalent(tier, column)
  194.         return select(4, GetTalentInfo(tier, column, 1))
  195.     end
  196.    
  197.     -- Returns a boolean indicating wether the supplied unit is within
  198.     --     the supplied range.
  199.     -- This is accomplished by leveraging specific item's use ranges due to the
  200.     --     fact that items' range can be checked regardless of level, class,
  201.     --     or the target's status.
  202.     function IsUnitInRange(unit, range)
  203.         local rangeItemID
  204.         if (range <= 5) then
  205.             rangeItemID = 37727
  206.         elseif (range <= 8) then
  207.             rangeItemID = 34368
  208.         elseif (range <= 10) then
  209.             rangeItemID = 32321
  210.         elseif (range <= 15) then
  211.             rangeItemID = 33069
  212.         elseif (range <= 20) then
  213.             rangeItemID = 10645
  214.         elseif (range <= 25) then
  215.             rangeItemID = 24268
  216.         elseif (range <= 30) then
  217.             rangeItemID = 835
  218.         elseif (range <= 35) then
  219.             rangeItemID = 24269
  220.         elseif (range <= 40) then
  221.             rangeItemID = 28767
  222.         elseif (range <= 45) then
  223.             rangeItemID = 32698
  224.         elseif (range <= 60) then
  225.             rangeItemID = 32825
  226.         else
  227.             rangeItemID = 35278
  228.         end
  229.         return IsItemInRange(rangeItemID, unit)
  230.     end
  231.  
  232.     -- Returns the positive result of subtraction or a zero if the outcome of
  233.     --     that function would result in a negative.
  234.     function Subtract(base, less)
  235.         local output
  236.         output = base - less
  237.         if (output < 0) then
  238.             output = 0
  239.         end
  240.         return output
  241.     end
  242.    
  243.     -- MAIN METHODS -----------------------------------------------------------
  244.     function Initialize()
  245.         -- VARIABLES --------------------------------------------------------------
  246.         if type(lastEclipse_mt) ~= "string" then
  247.             lastEclipse_mt = "Lunar"
  248.         end
  249.        
  250.         dps_auraIndex = 0
  251.         dps_auraDuration = {}
  252.  
  253.         dps_cdIndex = 0
  254.         dps_cdDuration = {}
  255.  
  256.         dps_mtIndex = 0
  257.         dps_mtIndexMax = 3
  258.         dps_mtIcon = {}
  259.         dps_mtText = {}
  260.         dps_mtProgress = {}
  261.         dps_mtRange = {}
  262.        
  263.         -- Player Information -----------------------------------------------------
  264.         player_level = UnitLevel("player")
  265.         player_energy = UnitPower("player", 3)
  266.         player_energyMax = UnitPowerMax("player", 3)
  267.         player_comboPoints = UnitPower("player", 4)
  268.         player_astralPower = UnitPower("player", 8)
  269.         player_stealthed  = IsStealthed()
  270.         player_inCombat = UnitAffectingCombat("player")
  271.         player_manaPercent = ((UnitPower("player", 0))/(UnitPowerMax("player", 0)))
  272.         player_healthPercent = ((UnitHealth("player"))/(UnitHealthMax("player")))
  273.        
  274.         -- Target Information -----------------------------------------------------
  275.         target_healthPercent = ((UnitHealth("target"))/(UnitHealthMax("target")))
  276.         target_attackable = UnitCanAttack("player","target")
  277.             and (not UnitIsDeadOrGhost("target"))
  278.         target_isPlayer = UnitIsPlayer("target")
  279.        
  280.         -- Cooldowns --------------------------------------------------------------
  281.         gcd = GetSpellCooldownDuration(61304)
  282.  
  283.         -- Talents ----------------------------------------------------------------
  284.         naturesBalance_talent = HasTalent(1, 1)
  285.         warriorOfElune_talent = HasTalent(1, 2)
  286.         forceOfNature_talent = HasTalent(1, 3)
  287.         feralAffinity_talent = HasTalent(3, 1)
  288.         guardianAffinity_talent = HasTalent(3, 2)
  289.         restorationAffinity_talent = HasTalent(3, 3)
  290.         mightyBash_talent = HasTalent(4, 1)
  291.         massEntanglement_talent = HasTalent(4, 2)
  292.         soulOfTheForest_talent = HasTalent(5, 1)
  293.         starlord_talent = HasTalent(5, 2)
  294.         Incarnation_talent = HasTalent(5, 3)
  295.         stellarDrift_talent = HasTalent(6, 1)
  296.         twinMoons_talent = HasTalent(6, 2)
  297.         stellarFlare_talent = HasTalent(6, 3)
  298.         solstice_talent = HasTalent(7, 2)
  299.         furyOfElune_talent = HasTalent(7, 2)
  300.         newMoon_talent = HasTalent(7, 3)
  301.        
  302.         -- Forms ------------------------------------------------------------------
  303.         form_caster =  GetShapeshiftForm() == 0
  304.         form_bear =    GetShapeshiftForm() == 1
  305.         form_cat =     GetShapeshiftForm() == 2
  306.         form_travel =  GetShapeshiftForm() == 3
  307.         form_moonkin = GetShapeshiftForm() == 4
  308.         form_treant =  GetShapeshiftForm() == 5
  309.         form_stag =    GetShapeshiftForm() == 6
  310.        
  311.         -- Auras ------------------------------------------------------------------
  312.         -- Eclipse (Solar)
  313.         eclipseSolar_id = 48517
  314.         eclipseSolar_baseDuration = 15
  315.         dps_auraDuration[dps_auraIndex] = GetAuraDuration(
  316.             "player", eclipseSolar_id, "PLAYER|HELPFUL")
  317.         eclipseSolar_auraIndex = dps_auraIndex
  318.         dps_auraIndex = (dps_auraIndex + 1)
  319.  
  320.         -- Eclipse (Lunar)
  321.         eclipseLunar_id = 48518
  322.         eclipseLunar_baseDuration = 15
  323.         dps_auraDuration[dps_auraIndex] = GetAuraDuration(
  324.             "player", eclipseLunar_id, "PLAYER|HELPFUL")
  325.         eclipseLunar_auraIndex = dps_auraIndex
  326.         dps_auraIndex = (dps_auraIndex + 1)
  327.  
  328.         -- Starlord
  329.         starlord_id = 279709
  330.         dps_auraDuration[dps_auraIndex] = GetAuraDuration(
  331.             "player", starlord_id, "PLAYER|HELPFUL")
  332.         starlord_auraIndex = dps_auraIndex
  333.         dps_auraIndex = (dps_auraIndex + 1)
  334.         starlord_count = GetAuraCount("player", starlord_id, "PLAYER|HELPFUL")
  335.        
  336.         -- Abilities --------------------------------------------------------------
  337.  
  338.         -- Warrior of Elune
  339.         warriorOfElune_id = 202425
  340.         warriorOfElune_count = GetAuraCount("player", warriorOfElune_id,
  341.             "PLAYER|HELPFUL")
  342.  
  343.         warriorOfElune_baseCD = 45
  344.         dps_cdDuration[dps_cdIndex] = GetSpellCooldownDuration(warriorOfElune_id)
  345.         warriorOfElune_cdIndex = dps_cdIndex
  346.         dps_cdIndex = (dps_cdIndex + 1)
  347.  
  348.         warriorOfElune_use = false
  349.         warriorOfElune_icon = GetSpellIcon(warriorOfElune_id)
  350.         warriorOfElune_progress = ""
  351.         warriorOfElune_text = ""
  352.         function UseWarriorOfElune()
  353.  
  354.             DecrementTime(warriorOfElune_id)
  355.  
  356.             dps_mtIcon[dps_mtIndex] = warriorOfElune_icon
  357.             dps_mtText[dps_mtIndex] = warriorOfElune_text
  358.             dps_mtProgress[dps_mtIndex] = warriorOfElune_progress
  359.             dps_mtIndex = (dps_mtIndex + 1)
  360.         end
  361.  
  362.         -- Moonfire
  363.         moonfire_level = 1
  364.         moonfire_id = 8921
  365.         moonfire_auraID = 164812
  366.         moonfire_castTime = GetSpellCastTime(moonfire_id)
  367.         moonfire_baseDuration = 22
  368.         moonfire_powerGen = 2
  369.         dps_auraDuration[dps_auraIndex] = GetAuraDuration("target", moonfire_auraID,
  370.             "PLAYER|HARMFUL")
  371.         moonfire_auraIndex = dps_auraIndex
  372.         dps_auraIndex = (dps_auraIndex + 1)
  373.         moonfire_isActive = (dps_auraDuration[moonfire_auraIndex] >
  374.             (0.3 * moonfire_baseDuration))
  375.         moonfire_use = false
  376.         moonfire_icon = GetSpellIcon(moonfire_id)
  377.         moonfire_progress = ""
  378.         moonfire_text = ""
  379.         function UseMoonfire()
  380.             moonfire_use = true
  381.  
  382.             dps_auraDuration[moonfire_auraIndex] = (dps_auraDuration[moonfire_auraIndex]
  383.                 + moonfire_baseDuration)
  384.             moonfire_isActive = (dps_auraDuration[moonfire_auraIndex] >
  385.                 (0.3 * moonfire_baseDuration))
  386.             player_astralPower = (player_astralPower +
  387.                 moonfire_powerGen)
  388.  
  389.             moonfire_castTime = DecrementTime(moonfire_id)
  390.             dps_auraDuration[moonfire_auraIndex] = (moonfire_castTime
  391.                 + dps_auraDuration[moonfire_auraIndex])
  392.            
  393.             dps_mtIcon[dps_mtIndex] = moonfire_icon
  394.             dps_mtText[dps_mtIndex] = moonfire_text
  395.             dps_mtProgress[dps_mtIndex] = moonfire_progress
  396.             dps_mtIndex = (dps_mtIndex + 1)
  397.         end
  398.  
  399.         -- Sunfire
  400.         sunfire_level = 23
  401.         sunfire_id = 93402
  402.         sunfire_auraID = 164815
  403.         sunfire_castTime = GetSpellCastTime(sunfire_id)
  404.         sunfire_baseDuration = 18
  405.         sunfire_powerGen = 2
  406.         dps_auraDuration[dps_auraIndex] = GetAuraDuration("target", sunfire_auraID,
  407.             "PLAYER|HARMFUL")
  408.         sunfire_auraIndex = dps_auraIndex
  409.         dps_auraIndex = (dps_auraIndex + 1)
  410.         sunfire_isActive = (dps_auraDuration[sunfire_auraIndex] >
  411.             (0.3 * sunfire_baseDuration))
  412.         sunfire_use = false
  413.         sunfire_icon = GetSpellIcon(sunfire_id)
  414.         sunfire_progress = ""
  415.         sunfire_text = ""
  416.         function UseSunfire()
  417.             sunfire_use = true
  418.  
  419.             dps_auraDuration[sunfire_auraIndex] = (dps_auraDuration[sunfire_auraIndex]
  420.                 + sunfire_baseDuration)
  421.             sunfire_isActive = (dps_auraDuration[sunfire_auraIndex] >
  422.                 (0.3 * sunfire_baseDuration))
  423.             player_astralPower = (player_astralPower +
  424.                 sunfire_powerGen)
  425.  
  426.             sunfire_castTime = DecrementTime(sunfire_id)
  427.             dps_auraDuration[moonfire_auraIndex] = (sunfire_castTime
  428.                 + dps_auraDuration[sunfire_auraIndex])
  429.  
  430.             dps_mtIcon[dps_mtIndex] = sunfire_icon
  431.             dps_mtText[dps_mtIndex] = sunfire_text
  432.             dps_mtProgress[dps_mtIndex] = sunfire_progress
  433.             dps_mtIndex = (dps_mtIndex + 1)
  434.         end
  435.  
  436.         -- Stellar Flare
  437.         stellarFlare_id = 202347
  438.         stellarFlare_auraID = 202347
  439.         stellarFlare_castTime = GetSpellCastTime(stellarFlare_id)
  440.         stellarFlare_baseDuration = 24
  441.         stellarFlare_powerGen = 8
  442.         dps_auraDuration[dps_auraIndex] = GetAuraDuration("target", stellarFlare_auraID,
  443.             "PLAYER|HARMFUL")
  444.         stellarFlare_auraIndex = dps_auraIndex
  445.         dps_auraIndex = (dps_auraIndex + 1)
  446.         stellarFlare_isActive = (dps_auraDuration[stellarFlare_auraIndex] >
  447.             (0.3 * stellarFlare_baseDuration))
  448.         stellarFlare_use = false
  449.         stellarFlare_icon = GetSpellIcon(stellarFlare_id)
  450.         stellarFlare_progress = ""
  451.         stellarFlare_text = ""
  452.         function UseStellarFlare()
  453.             stellarFlare_use = true
  454.  
  455.             dps_auraDuration[stellarFlare_auraIndex] = (
  456.                 dps_auraDuration[stellarFlare_auraIndex] + stellarFlare_baseDuration)
  457.             stellarFlare_isActive = (dps_auraDuration[stellarFlare_auraIndex] >
  458.                 (0.3 * stellarFlare_baseDuration))
  459.             player_astralPower = (player_astralPower +
  460.                 stellarFlare_powerGen)
  461.  
  462.             stellarFlare_castTime = DecrementTime(stellarFlare_id)
  463.             dps_auraDuration[stellarFlare_auraIndex] = (stellarFlare_castTime
  464.                 + dps_auraDuration[stellarFlare_auraIndex])
  465.  
  466.             dps_mtIcon[dps_mtIndex] = stellarFlare_icon
  467.             dps_mtText[dps_mtIndex] = stellarFlare_text
  468.             dps_mtProgress[dps_mtIndex] = stellarFlare_progress
  469.             dps_mtIndex = (dps_mtIndex + 1)
  470.         end
  471.  
  472.         -- Starfire
  473.         starfire_level = 10
  474.         starfire_id = 194153
  475.         starfire_castTime = GetSpellCastTime(starfire_id)
  476.         starfire_basePowerGen = 8
  477.         if ((type(warriorOfElune_count) == "number")
  478.             and (warriorOfElune_count > 0)
  479.         ) then
  480.             starfire_powerGen = math.floor(starfire_basePowerGen * 1.4)
  481.         else
  482.             starfire_powerGen = starfire_basePowerGen
  483.         end
  484.         starfire_use = false
  485.         starfire_icon = GetSpellIcon(starfire_id)
  486.         starfire_icon = GetSpellIcon(starfire_id)
  487.         if ((starfire_charges ~= 0)
  488.             or (starfire_charges ~= 1)
  489.             or (starfire_charges ~= 2)
  490.         ) then
  491.             starfire_charges = 2
  492.         end
  493.         starfire_progress = ""
  494.         starfire_text = ""
  495.         function UseStarfire()
  496.             starfire_use = true
  497.             player_astralPower = (player_astralPower +
  498.                 starfire_powerGen)
  499.             warriorOfElune_count = Subtract(warriorOfElune_count, 1)
  500.             if (warriorOfElune_count > 0) then
  501.                 starfire_powerGen = math.floor(starfire_basePowerGen * 1.4)
  502.             else
  503.                 starfire_powerGen = starfire_basePowerGen
  504.             end
  505.  
  506.             DecrementTime(starfire_id)
  507.  
  508.             Subtract(warriorOfElune_count, 1)
  509.             dps_cdDuration[warriorOfElune_cdIndex] = warriorOfElune_baseCD
  510.  
  511.             dps_mtIcon[dps_mtIndex] = starfire_icon
  512.             dps_mtText[dps_mtIndex] = starfire_text
  513.             dps_mtProgress[dps_mtIndex] = starfire_progress
  514.             dps_mtIndex = (dps_mtIndex + 1)
  515.         end
  516.        
  517.         -- Wrath
  518.         wrath_level = 1
  519.         wrath_id = 190984
  520.         wrath_castTime = GetSpellCastTime(wrath_id)
  521.         wrath_basePowerGen = 6
  522.         if (soulOfTheForest_talent) then
  523.             wrath_powerGen = math.floor(wrath_basePowerGen * 1.5)
  524.         else
  525.             wrath_powerGen = wrath_basePowerGen
  526.         end
  527.         wrath_use = false
  528.         wrath_icon = GetSpellIcon(wrath_id)
  529.         if ((wrath_charges ~= 0)
  530.             or (wrath_charges ~= 1)
  531.             or (wrath_charges ~= 2)
  532.         ) then
  533.             wrath_charges = 2
  534.         end
  535.         wrath_progress = ""
  536.         wrath_text = ""
  537.         function UseWrath()
  538.             wrath_use = true
  539.             player_astralPower = (player_astralPower +
  540.                 wrath_powerGen)
  541.  
  542.             DecrementTime(wrath_id)
  543.  
  544.             dps_mtIcon[dps_mtIndex] = wrath_icon
  545.             dps_mtText[dps_mtIndex] = wrath_text
  546.             dps_mtProgress[dps_mtIndex] = wrath_progress
  547.             dps_mtIndex = (dps_mtIndex + 1)
  548.         end
  549.  
  550.         -- Starsurge
  551.         starsurge_level = 12
  552.         starsurge_id = 78674
  553.         starsurge_powerCost = 30
  554.         starsurge_use = false
  555.         starsurge_icon = GetSpellIcon(starsurge_id)
  556.         starsurge_progress = ""
  557.         starsurge_text = ""
  558.         function UseStarsurge()
  559.             starsurge_use = true
  560.             player_astralPower = (player_astralPower -
  561.                 starsurge_powerCost)
  562.  
  563.             DecrementTime(starsurge_id)
  564.  
  565.             if (starlord_talent) then
  566.                 starlord_count = (starlord_count + 1)
  567.             end
  568.  
  569.             dps_mtIcon[dps_mtIndex] = starsurge_icon
  570.             dps_mtText[dps_mtIndex] = starsurge_text
  571.             dps_mtProgress[dps_mtIndex] = starsurge_progress
  572.             dps_mtIndex = (dps_mtIndex + 1)
  573.         end
  574.        
  575.         -- Starfall
  576.         starfall_level = 34
  577.         starfall_id = 191034
  578.         starfall_castTime = GetSpellCastTime(starfall_id)
  579.         starfall_powerCost = 50
  580.  
  581.         starfall_baseDuration = 8
  582.         dps_auraDuration[dps_auraIndex] = GetAuraDuration("player", starfall_auraID,
  583.             "PLAYER|HELPFUL")
  584.         starfall_auraIndex = dps_auraIndex
  585.         dps_auraIndex = (dps_auraIndex + 1)
  586.         starfall_isActive = (dps_auraDuration[starfall_auraIndex] >
  587.             (0.3 * starfall_baseDuration))
  588.  
  589.         starfall_use = false
  590.         starfall_icon = GetSpellIcon(starfall_id)
  591.         starfall_progress = ""
  592.         starfall_text = ""
  593.         function UseStarfall()
  594.             starfall_use = true
  595.             dps_auraDuration[starfall_auraIndex] = (
  596.                 dps_auraDuration[starfall_auraIndex] + starfall_baseDuration)
  597.             starfall_isActive = (dps_auraDuration[starfall_auraIndex] >
  598.                 (0.3 * starfall_baseDuration))
  599.             player_astralPower = (player_astralPower -
  600.                 starfall_powerCost)
  601.  
  602.             starfall_castTime = DecrementTime(starfall_id)
  603.             dps_auraDuration[starfall_auraIndex] = (starfall_castTime
  604.                 + dps_auraDuration[starfall_auraIndex])
  605.  
  606.             if (starlord_talent) then
  607.                 starlord_count = (starlord_count + 1)
  608.             end
  609.  
  610.             dps_mtIcon[dps_mtIndex] = starfall_icon
  611.             dps_mtText[dps_mtIndex] = starfall_text
  612.             dps_mtProgress[dps_mtIndex] = starfall_progress
  613.             dps_mtIndex = (dps_mtIndex + 1)
  614.         end
  615.  
  616.         -- Celestial Alignment
  617.         celestialAlignment_level = 39
  618.         if (Incarnation_talent == true) then
  619.             celestialAlignment_id = 102560
  620.             celestialAlignment_baseDuration = 30
  621.         else
  622.             celestialAlignment_id = 194223
  623.             celestialAlignment_baseDuration = 20
  624.         end
  625.  
  626.         dps_auraDuration[dps_auraIndex] = GetAuraDuration("player",
  627.             celestialAlignment_id, "PLAYER|HELPFUL")
  628.         celestialAlignment_auraIndex = dps_auraIndex
  629.         dps_auraIndex = (dps_auraIndex + 1)
  630.  
  631.         celestialAlignment_baseCD = 180
  632.         dps_cdDuration[dps_cdIndex] = GetSpellCooldownDuration(celestialAlignment_id)
  633.         celestialAlignment_cdIndex = dps_cdIndex
  634.         dps_cdIndex = (dps_cdIndex + 1)
  635.  
  636.         celestialAlignment_use = false
  637.         celestialAlignment_icon = GetSpellIcon(celestialAlignment_id)
  638.         celestialAlignment_progress = ""
  639.         celestialAlignment_text = ""
  640.         function UseCelestialAlignment()
  641.             celestialAlignment_use = true
  642.             dps_auraDuration[celestialAlignment_auraIndex] = celestialAlignment_baseDuration
  643.             celestialAlignment_isActive = (dps_auraDuration[celestialAlignment_auraIndex] >
  644.                 (0.3 * celestialAlignment_baseDuration))
  645.  
  646.             celestialAlignment_castTime = DecrementTime(celestialAlignment_id)
  647.             dps_auraDuration[celestialAlignment_auraIndex] = (celestialAlignment_castTime
  648.                 + dps_auraDuration[celestialAlignment_auraIndex])
  649.             dps_cdDuration[celestialAlignment_cdIndex] = celestialAlignment_baseCD
  650.  
  651.             dps_mtIcon[dps_mtIndex] = celestialAlignment_icon
  652.             dps_mtText[dps_mtIndex] = celestialAlignment_text
  653.             dps_mtProgress[dps_mtIndex] = celestialAlignment_progress
  654.             dps_mtIndex = (dps_mtIndex + 1)
  655.         end
  656.  
  657.         -- Force of Nature
  658.         forceOfNature_id = 205636
  659.  
  660.         forceOfNature_baseDuration = 20
  661.         dps_auraDuration[dps_auraIndex] = GetAuraDuration("player",
  662.             forceOfNature_id , "PLAYER|HELPFUL")
  663.         forceOfNature_auraIndex = dps_auraIndex
  664.         dps_auraIndex = (dps_auraIndex + 1)
  665.  
  666.         forceOfNature_baseCD = 60
  667.         dps_cdDuration[dps_cdIndex] = GetSpellCooldownDuration(forceOfNature_id)
  668.         forceOfNature_cdIndex = dps_cdIndex
  669.         dps_cdIndex = (dps_cdIndex + 1)
  670.  
  671.         forceOfNature_castTime = GetSpellCastTime(forceOfNature_id)
  672.         forceOfNature_powerGen = 20
  673.         forceOfNature_use = false
  674.         forceOfNature_icon = GetSpellIcon(forceOfNature_id)
  675.         forceOfNature_progress = ""
  676.         forceOfNature_text = ""
  677.         function UseForceOfNature()
  678.             forceOfNature_use = true
  679.             dps_auraDuration[forceOfNature_auraIndex] = (
  680.                 dps_auraDuration[forceOfNature_auraIndex]
  681.                 + forceOfNature_baseDuration)
  682.             forceOfNature_isActive = (dps_auraDuration[forceOfNature_auraIndex] >
  683.                 (0.3 * forceOfNature_baseDuration))
  684.  
  685.             forceOfNature_castTime = DecrementTime(forceOfNature_id)
  686.             dps_auraDuration[forceOfNature_auraIndex] = (forceOfNature_castTime
  687.                 + dps_auraDuration[forceOfNature_auraIndex])
  688.             dps_cdDuration[forceOfNature_cdIndex] = forceOfNature_baseCD
  689.  
  690.             dps_mtIcon[dps_mtIndex] = forceOfNature_icon
  691.             dps_mtText[dps_mtIndex] = forceOfNature_text
  692.             dps_mtProgress[dps_mtIndex] = forceOfNature_progress
  693.             dps_mtIndex = (dps_mtIndex + 1)
  694.         end
  695.  
  696.         -- Fury of Elune
  697.         furyOfElune_id = 202770
  698.  
  699.         furyOfElune_baseDuration = 8
  700.         dps_auraDuration[dps_auraIndex] = GetAuraDuration("player",
  701.             furyOfElune_id , "PLAYER|HELPFUL")
  702.         furyOfElune_auraIndex = dps_auraIndex
  703.         dps_auraIndex = (dps_auraIndex + 1)
  704.  
  705.         furyOfElune_baseCD = 60
  706.         dps_cdDuration[dps_cdIndex] = GetSpellCooldownDuration(furyOfElune_id) - gcd
  707.         furyOfElune_cdIndex = dps_cdIndex
  708.         dps_cdIndex = (dps_cdIndex + 1)
  709.        
  710.         furyOfElune_castTime = GetSpellCastTime(furyOfElune_id)
  711.         furyOfElune_use = false
  712.         furyOfElune_icon = GetSpellIcon(furyOfElune_id)
  713.         furyOfElune_progress = ""
  714.         furyOfElune_text = ""
  715.         function UseFuryOfElune()
  716.             furyOfElune_use = true
  717.             dps_auraDuration[furyOfElune_auraIndex] = furyOfElune_baseDuration
  718.  
  719.             furyOfElune_castTime = DecrementTime(furyOfElune_id)
  720.             dps_auraDuration[furyOfElune_auraIndex] = (furyOfElune_castTime
  721.                 + dps_auraDuration[furyOfElune_auraIndex])
  722.             dps_cdDuration[furyOfElune_cdIndex] = furyOfElune_baseCD
  723.  
  724.             dps_mtIcon[dps_mtIndex] = furyOfElune_icon
  725.             dps_mtText[dps_mtIndex] = furyOfElune_text
  726.             dps_mtProgress[dps_mtIndex] = furyOfElune_progress
  727.             dps_mtIndex = (dps_mtIndex + 1)
  728.         end
  729.     end
  730.     -- DPS ROTATION - SINGLE TARGET -------------------------------------------
  731.     Initialize()
  732.     while (dps_mtIndex < dps_mtIndexMax) do
  733.         -- If you have a valid target...
  734.         if ((UnitExists("target"))
  735.             and (target_attackable)
  736.         ) then
  737.             -- Create an initial index value to check for equality to the final
  738.             --     index value at the end of our loop...
  739.             dps_mtIndexInit = dps_mtIndex
  740.  
  741.             -- COOLDOWNS & AURA MAINTENANCE
  742.             dps_mtPhase = "COOLDOWNS & AURA MAINTENANCE"
  743.  
  744.             if ((player_level >= starfall_level)
  745.                 and (not starfall_isActive)
  746.                 and (player_astralPower >= starfall_powerCost)
  747.             ) then
  748.                 UseStarfall()
  749.  
  750.             elseif ((forceOfNature_talent)
  751.                 and (dps_cdDuration[forceOfNature_cdIndex] <= 0)
  752.                 and (player_astralPower <= 80)
  753.             ) then
  754.                 UseForceOfNature()
  755.  
  756.             elseif ((furyOfElune_talent)
  757.                 and (dps_cdDuration[furyOfElune_cdIndex] <= 0)
  758.             ) then
  759.                 UseFuryOfElune()
  760.  
  761.             elseif ((warriorOfElune_talent)
  762.                 and (warriorOfElune_count <= 0)
  763.                 and (dps_cdDuration[warriorOfElune_cdIndex] <= 0)
  764.                 and (dps_auraDuration[eclipseLunar_auraIndex] > (gcd * 2))
  765.             ) then
  766.                 UseWarriorOfElune()
  767.  
  768.             -- ASTRAL POWER CAPPED
  769.             elseif (player_astralPower >=
  770.                 (starfall_powerCost + starsurge_powerCost)
  771.             ) then
  772.                 UseStarsurge()
  773.  
  774.             -- ASTRAL POWER UNCAPPED
  775.             else
  776.                 -- DOT APPLICATION
  777.                 dps_mtPhase = "DOT APPLICATION"
  778.                 -- If Moonfire is not active and the player is high enough level
  779.                 --     to use it, use Moonfire.
  780.                 if ((dps_mtIndex < dps_mtIndexMax)
  781.                     and (player_level > moonfire_level)
  782.                     and (player_level >= moonfire_level)
  783.                     and (not moonfire_isActive)
  784.                 ) then
  785.                     UseMoonfire()
  786.  
  787.                 -- If Sunfire is not active, and the player is high enough
  788.                 --     level to use it, use Sunfire.
  789.                 elseif ((dps_mtIndex < dps_mtIndexMax)
  790.                     and (player_level >= sunfire_level)
  791.                     and (not sunfire_isActive)
  792.                 ) then
  793.                     UseSunfire()
  794.                    
  795.                 -- if Stellar Flare was taken as a talent and it is not active,
  796.                 --     use Stellar Flare.
  797.                 elseif ((dps_mtIndex < dps_mtIndexMax)
  798.                     and (stellarFlare_talent)
  799.                     and (not stellarFlare_isActive)
  800.                 ) then
  801.                     UseStellarFlare()
  802.  
  803.                 -- CELESTIAL ALIGNMENT
  804.                 elseif (dps_auraDuration[celestialAlignment_auraIndex] > 0) then
  805.                     dps_mtPhase = "CELESTIAL ALIGNMENT"
  806.                     UseStarfire()
  807.                     starfire_charges = 2
  808.                     wrath_charges = 2
  809.  
  810.                 -- ECLIPSE (LUNAR)
  811.                 elseif (dps_auraDuration[eclipseLunar_auraIndex] > 0) then
  812.                     dps_mtPhase = "ECLIPSE (LUNAR)"
  813.                     UseStarfire()
  814.                     starfire_charges = 0
  815.                     wrath_charges = 2
  816.  
  817.                 -- ECLIPSE (SOLAR)
  818.                 elseif (dps_auraDuration[eclipseSolar_auraIndex] > 0) then
  819.                     dps_mtPhase = "ECLIPSE (SOLAR)"
  820.                     UseWrath()
  821.                     starfire_charges = 2
  822.                     wrath_charges = 0
  823.  
  824.                 -- UNEMPOWERED
  825.                 else
  826.                     dps_mtPhase = "UNEMPOWERED"
  827.                     if ((player_level > celestialAlignment_level)
  828.                         and (dps_cdDuration[celestialAlignment_cdIndex] <= 0)
  829.                     ) then
  830.                         UseCelestialAlignment()
  831.                     end
  832.                     if ((player_level > starfire_level)
  833.                         and ((starfire_charges > 0)
  834.                             or (warriorOfElune_count > 0))
  835.                     ) then
  836.                         UseStarfire()
  837.                         starfire_charges = Subtract(starfire_charges, 1)
  838.                     end
  839.                     if ((player_level > wrath_level)
  840.                         and (wrath_charges > 0)
  841.                     ) then
  842.                         UseWrath()
  843.                         wrath_charges = Subtract(wrath_charges, 1)
  844.                     end
  845.                 end
  846.             end
  847.             -- If your index hasn't incremented since the start of the loop,
  848.             --     exit the loop...
  849.             if (dps_mtIndexInit == dps_mtIndex) then
  850.                 dps_mtIndex = dps_mtIndexMax
  851.             end
  852.         else
  853.             dps_mtIndex = dps_mtIndexMax
  854.         end
  855.     ---------------------------------------------------------------------------
  856.     end
  857.     dps_mtDebug = ("")
  858.     return true
  859. end
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Weak Auras : Balance Druid

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off