Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ SNAPSHOT LOGIC ]]--
- --[[ This is the module that sniffs the combat log for specific events. Whenever it sees that we have successfully cast either Rip (1079) or Rake (1822) onto our target,
- it records what our stats were at that instant so we can calculate the difference of a future Rip or Rake. This accounts for Attack Power, Combo Points, Mastery,
- and damage multiplier buffs like Dream of Cenarius and Tiger's Fury. This module runs all the time. ]]--
- function (event, ...)
- if (event == "COMBAT_LOG_EVENT_UNFILTERED") then --Scan all combat log events
- local _, param, _, source, _, _, _, destination, _, _, _, spell, _, _, _, _, _, _, _, _, _ = ... --Filter log events based on specific criteria
- if (source == UnitGUID("player") and destination == UnitGUID("target") and param == "SPELL_CAST_SUCCESS") then --Check to see if an entry matches what we want
- if (spell == 1079) then --If we apply Rip to our target successfully...
- local Rip_sAP, Rip_sMastery, Rip_sMult = AP, Mastery, DamageMultiplier --Create snapshots of our current Attack Power, Mastery, and any multipliers
- Rip_sDamage = (((113 * Rip_sMastery) + 320 * 5 * Rip_sMastery + 0.0484 * 5 * Rip_sAP * Rip_sMastery) * Rip_sMult) --Calculates exactly how hard Rip ticks with those snapshots
- elseif(spell == 1822) then --If we apply Rake to our target successfully...
- local Rake_sAP, Rake_sMastery, Rake_sMult = AP, Mastery, DamageMultiplier --Create snapshots of our current Attack Power, Mastery, and any multipliers
- Rake_sDamage = (((99 + (Rake_sAP * 0.3)) * Rake_sMastery) * Rake_sMult) --Calculates exactly how hard Rake ticks with those snapshots
- end
- end
- end
- end
- --[[ STAT LOGIC ]]--
- --[[ To compare how much of a difference a new Rip or Rake could have on our target, we need to monitor our buffs and stats in real time. All other modules depend on
- the variables created here to form their snapshots or calculate damage deltas, hence the global declarations for Attack Power, CPs, and so on. Runs all the time. ]]--
- function()
- local APBase, APPos, APNeg = UnitAttackPower("player") --Attack Power is an aggregate value, so we have to combine base AP, AP bonuses, and AP decrements together
- local DoCSID = select(11, UnitAura("player", "Dream of Cenarius")) --Attempts to see if the player has the Dream of Cenarius buff, and if so, grabs its Spell ID
- AP, ComboPoints, DamageMultiplier, Mastery = (APBase + APPos + APNeg), GetComboPoints("player", "target"), select(7, UnitDamage("player")), (1 + (GetMasteryEffect() / 100)) --Global vars
- --[[ Due to the fact that Dream of Cenarius only increases the damage of two abilities when they are used, compared to abilities like Tiger's Fury which buff ALL
- damage over a period of time, the +25% damage multiplier isn't rolled into the API function we used to get our DamageMultiplier value above. Instead, we have
- to track the exact Spell ID and modify the DamageMultiplier value manually. ]]--
- if (DoCSID == 108381) then --If it turns out the Dream of Cenarius buff (the one that buffs damage) exists on the player...
- DamageMultiplier = DamageMultiplier * 1.25 --Increase DamageMultiplier by 25%
- end
- return '' --Returns an empty string. This is a remnant from my own version which I used to return my amount of DoC stacks, in addition to what it already does here
- end
- --[[ RAKE RATIO ]]--
- --[[ Displays the percent ratio of your next Rake, based on values fed to it by the Snapshot/Stat Logic modules. Color-coded to highlight specific thresholds for easier
- reaction in-game. Increases to Rake's duration by tier bonuses and the like are handled accurately, and although flat damage increases from tier bonuses aren't directly
- accounted for in the raw damage calculations, they are unneccary for comparative reasons since both our snapshot Rake and potential Rake will be affected by them.
- Only runs while in combat. ]]--
- function()
- if (displayRakeRatio == true) then --Global variable handled by WA's trigger detection. Only while Rake exists on a target will this script run
- local Rake_pDamage = (((99 + (AP * 0.3)) * Mastery) * DamageMultiplier) --Rake damage formula
- local Rake_Ratio = (Rake_pDamage / Rake_sDamage) --Decimal ratio of our potential Rake (pDamage) and snapshot Rake (sDamage.) Used for DPE calculation below
- local Rake_RatioPercent = (Rake_Ratio * 100) --Percent ratio. What ends up being shown on the text readout
- if (Rake_RatioPercent >= 101) then --DPE calculation. Since we can't possibly have a new Rake with higher DPE that's weaker, only run when >101%
- local _, _, _, _, _, Rake_tDuration, Rake_tExpiry = UnitDebuff("target", "Rake", nil, "PLAYER") --Grabs full duration of Rake and the timestamp it was applied
- local Rake_tClipPerSec = ((Rake_Ratio * Rake_tDuration) - Rake_tDuration) --Finds where the per-second damage advantage is
- local Rake_tClipInterval = (Rake_tClipPerSec - (Rake_tClipPerSec % 3)) --Updates damage advantage point to account for the fact that Rake ticks every 3 seconds
- local Rake_tRemaining = (Rake_tExpiry - GetTime()) --Calculate how much time is left on our Rake (since the WoW API does not do this for us)
- if (Rake_tRemaining <= Rake_tClipInterval) then --If we are at the point where we can clip Rake with a DPE gain...
- return format("|cFFFF6900%d|r", Rake_RatioPercent) --Return the damage ratio in ORANGE
- else --If not, we're still returning a ratio above 101%, so...
- return format("|cFF00FF00%d|r", Rake_RatioPercent) --Return the damage ratio in GREEN
- end
- else --If our damage ratio is <=100%...
- return format("|cFF777777%d|r", Rake_RatioPercent) --Return the damage ratio in GRAY
- end
- else --If Rake is not on our target at all...
- return '' --Return an empty string so nothing shows up
- end
- end
- --[[ RIP RATIO ]]--
- --[[ Displays the percent ratio of your next Rip, based on values fed to it by the Snapshot/Stat Logic modules. Color-coded to highlight specific thresholds for easier
- reaction in-game. Increases to Rip's duration by tier bonuses and Shred are handled accurately, and although flat damage increases from tier bonuses aren't directly
- accounted for in the raw damage calculations, they are unneccary for comparative reasons since both our snapshot Rip and potential Rip will be affected by them.
- Only runs while in combat. ]]--
- function()
- if (displayRipRatio == true) then --Global variable handled by WA's trigger detection. Only while Rip exists on a target will this script run
- local Rip_pDamage = (((113 * Mastery) + 320 * ComboPoints * Mastery + 0.0484 * ComboPoints * AP * Mastery) * DamageMultiplier) --Rip damage formula
- local Rip_Ratio = (Rip_pDamage / Rip_sDamage) --Decimal ratio of our potential Rip (pDamage) and snapshot Rip (sDamage.) Used for DPE calculation below
- local Rip_RatioPercent = (Rip_Ratio * 100) --Percent ratio. What ends up being shown on the text readout
- if (Rip_RatioPercent >= 101) then --DPE calculation. Since we can't possibly have a new Rip with higher DPE that's weaker, only run when >101%
- local _, _, _, _, _, Rip_tDuration, Rip_tExpiry = UnitDebuff("target", "Rip", nil, "PLAYER") --Grabs full duration of Rip and the timestamp it was applied
- local Rip_tClipPerSec = ((Rip_Ratio * Rip_tDuration) - Rip_tDuration) --Finds where the per-second damage advantage is
- local Rip_tClipInterval = (Rip_tClipPerSec - (Rip_tClipPerSec % 2)) --Updates damage advantage point to account for the fact that Rip ticks every 2 seconds
- local Rip_tRemaining = (Rip_tExpiry - GetTime()) --Calculate how much time is left on our Rip (since the WoW API does not do this for us.) Does update with Shred
- if (Rip_tRemaining <= Rip_tClipInterval) then --If we are at the point where we can clip Rip with a DPE gain...
- return format("|cFFFF6900%d|r", Rip_RatioPercent) --Return the damage ratio in ORANGE
- else --If not, we're still returning a ratio above 101%, so...
- return format("|cFF00FF00%d|r", Rip_RatioPercent) --Return the damage ratio in GREEN
- end
- else --If our damage ratio is <=100%...
- return format("|cFF777777%d|r", Rip_RatioPercent) --Return the damage ratio in GRAY
- end
- else --If Rip is not on our target at all...
- return '' --Return an empty string so nothing shows up
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement