Created
December 17, 2014 19:20
-
-
Save Resike/8db002622fb054e53f9d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: RecountMitigation.lua | |
=================================================================== | |
--- RecountMitigation.lua (revision 25) | |
+++ RecountMitigation.lua (working copy) | |
@@ -1,4 +1,6 @@ | |
-if not Recount then return end | |
+if not Recount then | |
+ return | |
+end | |
local Recount = Recount | |
local RecountMitigation = LibStub("AceAddon-3.0"):NewAddon("RecountMitigation", "AceEvent-3.0", "AceTimer-3.0") | |
RecountMitigation.Version = 6.0 | |
@@ -5,6 +7,25 @@ | |
local RL = LibStub("AceLocale-3.0"):GetLocale("Recount") | |
local L = LibStub("AceLocale-3.0"):GetLocale("RecountMitigation") | |
+local type = type | |
+local print = print | |
+local pairs = pairs | |
+local math = math | |
+ | |
+local UnitBuff = UnitBuff | |
+local UnitArmor = UnitArmor | |
+local GetMastery = GetMastery | |
+local GetSpellInfo = GetSpellInfo | |
+local UnitLevel = UnitLevel | |
+local GetTime = GetTime | |
+local UnitIsUnit = UnitIsUnit | |
+local UnitName = UnitName | |
+local GetCombatRatingBonus = GetCombatRatingBonus | |
+ | |
+local GameTooltip = GameTooltip | |
+ | |
+local CR_VERSATILITY_DAMAGE_TAKEN = CR_VERSATILITY_DAMAGE_TAKEN | |
+ | |
local SPELLSCHOOL_PHYSICAL = 1 | |
local SPELLSCHOOL_HOLY = 2 | |
local SPELLSCHOOL_FIRE = 4 | |
@@ -195,7 +216,8 @@ | |
[132403] = function() return (0.25 + (GetMastery()/200)), PHYSICAL, nil end, -- Shield of the Righteous | |
[137593] = function() return (0.20), ALL, nil end, -- Indomitable Primal Diamond (Meta Gem, Unconfirmed) | |
[999998] = function() return (GetCombatRatingBonus(CR_VERSATILITY_DAMAGE_TAKEN)/100), ALL, nil end, -- Versatility | |
- [999999] = function(l) | |
+ [999999] = function(l) | |
+ local lvl | |
if type(l) ~= "number" then lvl = 0 else lvl = l end | |
return (UnitArmor("player")/(UnitArmor("player") + gtK[lvl] )), PHYSICAL, false end, -- Armor | |
[498] = function() return (0.40), MAGICAL, nil end, -- Divine Protection | |
@@ -241,8 +263,9 @@ | |
if not Recount then return end | |
RecountMitigation:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED", "CombatLogEvent") | |
RecountMitigation:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED", "mEventHTD") | |
- RecountMitigation:mBuffApplied(time(), _, _, "player", _, _, "player", _, 999998, "Versatility")--apply armor to player as a buff | |
- RecountMitigation:mBuffApplied(time(), _, _, "player", _, _, "player", _, 999999, "Armor")--apply armor to player as a buff | |
+ local _ | |
+ RecountMitigation:mBuffApplied(GetTime(), _, _, "player", _, _, "player", _, 999998, "Versatility")--apply armor to player as a buff | |
+ RecountMitigation:mBuffApplied(GetTime(), _, _, "player", _, _, "player", _, 999999, "Armor")--apply armor to player as a buff | |
--need to apply meta gem to player as a buff here and also add/remove when changing helmet | |
end | |
function RecountMitigation:OnDisable() | |
@@ -264,7 +287,9 @@ | |
-- SPELL DAMAGE -- | |
------------------ | |
function RecountMitigation:SpellDamage(timestamp, eventtype, srcGUID, srcName, srcFlags, dstGUID, dstName, dstFlags, spellId, spellName, spellSchool, amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing, isOffHand, multistrike) | |
- if eventtype == "RANGE_DAMAGE" then spellSchool = school end | |
+ if eventtype == "RANGE_DAMAGE" then | |
+ spellSchool = school | |
+ end | |
if eventtype == "SPELL_PERIODIC_DAMAGE" then | |
spellName = spellName .." ("..RL["DoT"]..")" | |
end | |
@@ -274,10 +299,12 @@ | |
-- SPELL MISS -- | |
------------------ | |
function RecountMitigation:SpellMiss(timestamp, eventtype, srcGUID, srcName, srcFlags, dstGUID, dstName, dstFlags, spellId, spellName, spellSchool, missType, isOffHand, multistrike, amountMissed) | |
- if eventtype == "RANGE_MISSED" then spellSchool = school end | |
- if eventtype == "SPELL_PERIODIC_MISSED" then | |
- spellName = spellName .." ("..RL["DoT"]..")" | |
- end | |
+ if eventtype == "RANGE_MISSED" then | |
+ spellSchool = missType | |
+ end | |
+ if eventtype == "SPELL_PERIODIC_MISSED" then | |
+ spellName = spellName .." ("..RL["DoT"]..")" | |
+ end | |
RecountMitigation:CalDM(srcName, dstName, spellName, spellSchool, 0, spellId, timestamp, amountMissed, nil, nil, srcGUID) | |
end | |
------------------ | |
@@ -284,7 +311,7 @@ | |
-- ENVIROMENTAL -- | |
------------------ | |
function RecountMitigation:EnvironmentalDamage(timestamp, eventtype, srcGUID, srcName, srcFlags, dstGUID, dstName, dstFlags, enviromentalType, amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing) | |
- RecountMitigation:CalDM("Environment", dstName, Recount:FixCaps(enviromentalType), school, amount, spellId, timestamp, absorbed, blocked, resisted, srcGUID) | |
+ RecountMitigation:CalDM("Environment", dstName, Recount:FixCaps(enviromentalType), school, amount, enviromentalType, timestamp, absorbed, blocked, resisted, srcGUID) | |
end | |
---------------------------------------------------------------------- | |
-- -- | |
@@ -383,7 +410,8 @@ | |
if unitId and UnitIsUnit(unitId, "player") then unitId = UnitName("player") else return end | |
if not mBuffs[spellId] then return end | |
if not ({mBuffs[spellId]()}) [3] then return end | |
- RecountMitigation:mBuffApplied(time(), eventtype, srcGUID, unitId, srcFlags, dstGUID, unitId, dstFlags, spellId, spellName, spellSchool, auraType, amount) | |
+ local _ | |
+ RecountMitigation:mBuffApplied(GetTime(), eventtype, _, unitId, _, _, unitId, _, spellId, spellName) | |
end | |
---------------------------------------------------------------------- | |
-- -- | |
@@ -407,15 +435,16 @@ | |
-- ABSORBED -- | |
-------------- | |
if absorbed ~= nil then | |
- mAbsorbed = absorbed | |
+ local mAbsorbed = absorbed | |
for mAbsorbId, mAbsorb in pairs(mAbsorbs) do | |
if mAbsorbs[mAbsorbId] then --Fix | |
if not(({mAbsorbs[mAbsorbId]()}) [2] and spellSchool ~= SPELLSCHOOL_PHYSICAL) then | |
local mAbsorbName = GetSpellInfo(mAbsorbId) | |
if mLeft[mAbsorbId] and mAbsorbed > 0 then | |
- print("mAbsorbId",mAbsorbId) | |
- print("mLeft",mLeft[mAbsorbId]) | |
- print("mAbsorbName",mAbsorbName) | |
+ --print("mAbsorbId",mAbsorbId) | |
+ --print("mLeft",mLeft[mAbsorbId]) | |
+ --print("mAbsorbName",mAbsorbName) | |
+ local mAbsorbedAmount | |
if mAbsorbId == 135286 then | |
mAbsorbedAmount = mAbsorbed | |
mAbsorbed = mAbsorbed - mAbsorbedAmount | |
@@ -430,7 +459,7 @@ | |
mAbsorbed = 0 | |
end | |
end | |
- print("mAbsorbName",mAbsorbName,"mAbsorbedAmount",mAbsorbedAmount,"victim",victim) | |
+ --print("mAbsorbName",mAbsorbName,"mAbsorbedAmount",mAbsorbedAmount,"victim",victim) | |
RecountMitigation:AddDM(mAbsorbName, mAbsorbedAmount, mAbsorbName, victim) | |
end | |
end --Fix | |
@@ -475,7 +504,7 @@ | |
for mSpellId, dmBuffed in pairs(dstDRBuffs) do | |
if dmBuffed then | |
if mBuffs[mSpellId] then --Fix | |
- mAmount = 0 | |
+ local mAmount = 0 | |
if spellSchool == SPELLSCHOOL_PHYSICAL and (({mBuffs[mSpellId]()}) [2] == PHYSICAL or ({mBuffs[mSpellId]()}) [2] == ALL) then | |
if damage <= 0 then | |
damage = ((absorbed or 0) + (blocked or 0) + (resisted or 0)) | |
@@ -539,12 +568,12 @@ | |
function RecountMitigation:TooltipFuncsDamageMitigation(name, data) | |
GameTooltip:ClearLines() | |
GameTooltip:AddLine(name) | |
- tTotal = {} | |
+ local tTotal = {} | |
tTotal[L["Incoming Damage"]] = {} | |
tTotal[L["Incoming Damage"]]["amount"] = (data.Fights[Recount.db.profile.CurDataSet].DamageTaken or 0) + (data.Fights[Recount.db.profile.CurDataSet].TotalDamageMitigation or 0) | |
- Recount:AddSortedTooltipData(L["Incoming Damage Before Mitigation"], tTotal,1) | |
+ Recount:AddSortedTooltipData(L["Incoming Damage Before Mitigation"], tTotal, 1) | |
GameTooltip:AddLine("") | |
- tBreakdown = {} | |
+ local tBreakdown = {} | |
tBreakdown[L["Damage Taken"]] = {} | |
tBreakdown[L["Damage Mitigated"]] = {} | |
tBreakdown[L["Damage Taken"]]["amount"] = (data.Fights[Recount.db.profile.CurDataSet].DamageTaken or 0) | |
@@ -551,9 +580,10 @@ | |
tBreakdown[L["Damage Mitigated"]]["amount"] = (data.Fights[Recount.db.profile.CurDataSet].TotalDamageMitigation or 0) | |
Recount:AddSortedTooltipData(L["of Incoming Damage"], tBreakdown,2) | |
GameTooltip:AddLine("") | |
- tSelfHeals = {} | |
+ local tSelfHeals = {} | |
tSelfHeals[L["Damage Self Healed"]] = {} | |
tSelfHeals[L["Damage Not Actioned"]] = {} | |
+ local SelfHeals | |
if data.Fights[Recount.db.profile.CurDataSet].HealedWho and data.Fights[Recount.db.profile.CurDataSet].HealedWho[UnitName("player")] and data.Fights[Recount.db.profile.CurDataSet].HealedWho[UnitName("player")]["amount"] then | |
SelfHeals = data.Fights[Recount.db.profile.CurDataSet].HealedWho[UnitName("player")]["amount"] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment