When a new segment starts, check for buffs to credit to the target as well (power infusion, prescience, and others)

This commit is contained in:
Tercio Jose
2023-12-04 20:42:21 -03:00
parent f82a2d8faa
commit 1c6bf8d2f1
2 changed files with 57 additions and 43 deletions
+53 -42
View File
@@ -1470,38 +1470,34 @@ local runes_id = {
}
--called from control on leave / enter combat
function _detalhes:CatchRaidBuffUptime (in_or_out)
function _detalhes:CatchRaidBuffUptime(in_or_out)
if (IsInRaid()) then
local pot_usage = {}
local focus_augmentation = {}
local potUsage = {}
local focusAugmentation = {}
--raid groups
local cacheGetTime = GetTime()
for raidIndex = 1, GetNumGroupMembers() do
local RaidIndex = "raid" .. raidIndex
local playerGUID = UnitGUID(RaidIndex)
local unitId = "raid" .. raidIndex
local playerGUID = UnitGUID(unitId)
if (playerGUID) then
local playerName, realmName = _UnitName (RaidIndex)
local playerName, realmName = _UnitName(unitId)
if (realmName and realmName ~= "") then
playerName = playerName .. "-" .. realmName
end
for buffIndex = 1, 41 do
local name, _, _, _, _, _, unitCaster, _, _, spellid = _UnitAura (RaidIndex, buffIndex, nil, "HELPFUL")
if (name and unitCaster and UnitExists(unitCaster) and UnitExists(RaidIndex) and UnitIsUnit(unitCaster, RaidIndex)) then
_detalhes.parser:add_buff_uptime (nil, cacheGetTime, playerGUID, playerName, 0x00000514, playerGUID, playerName, 0x00000514, 0x0, spellid, name, in_or_out)
local name, _, _, _, _, _, unitCaster, _, _, spellId = _UnitAura(unitId, buffIndex, nil, "HELPFUL")
if (name and unitCaster and UnitExists(unitCaster) and UnitExists(unitId) and UnitIsUnit(unitCaster, unitId)) then
_detalhes.parser:add_buff_uptime(nil, cacheGetTime, playerGUID, playerName, 0x00000514, playerGUID, playerName, 0x00000514, 0x0, spellId, name, in_or_out)
if (in_or_out == "BUFF_UPTIME_IN") then
if (_detalhes.PotionList [spellid]) then
pot_usage [playerName] = spellid
if (_detalhes.PotionList[spellId]) then
potUsage[playerName] = spellId
elseif (runes_id [spellid]) then
focus_augmentation [playerName] = true
elseif(runes_id[spellId]) then
focusAugmentation[playerName] = true
end
end
end
@@ -1512,7 +1508,7 @@ function _detalhes:CatchRaidBuffUptime (in_or_out)
if (in_or_out == "BUFF_UPTIME_IN") then
local string_output = "pre-potion: " --localize-me
for playername, potspellid in pairs(pot_usage) do
for playername, potspellid in pairs(potUsage) do
local name, _, icon = _GetSpellInfo(potspellid)
local unitClass = Details:GetUnitClass(playername)
local class_color = ""
@@ -1524,38 +1520,53 @@ function _detalhes:CatchRaidBuffUptime (in_or_out)
_detalhes.pre_pot_used = string_output
_detalhes:SendEvent("COMBAT_PREPOTION_UPDATED", nil, pot_usage, focus_augmentation)
_detalhes:SendEvent("COMBAT_PREPOTION_UPDATED", nil, potUsage, focusAugmentation)
end
elseif (IsInGroup()) then
local pot_usage = {}
local focus_augmentation = {}
local potUsage = {}
local focusAugmentation = {}
--party members
for groupIndex = 1, GetNumGroupMembers() - 1 do
for buffIndex = 1, 41 do
local name, _, _, _, _, _, unitCaster, _, _, spellid = _UnitAura ("party"..groupIndex, buffIndex, nil, "HELPFUL")
if (name and unitCaster and UnitExists(unitCaster) and UnitExists("party" .. groupIndex) and UnitIsUnit(unitCaster, "party" .. groupIndex)) then
local unitId = "party" .. groupIndex
local name, _, _, _, _, _, unitCaster, _, _, spellId = _UnitAura(unitId, buffIndex, nil, "HELPFUL")
local playerName, realmName = _UnitName ("party"..groupIndex)
local playerGUID = UnitGUID("party"..groupIndex)
local bBuffIsOnTarget = Details.CreditBuffToTarget[spellId]
if (playerGUID) then
if (realmName and realmName ~= "") then
playerName = playerName .. "-" .. realmName
end
if (name and unitCaster and UnitExists(unitCaster) and UnitExists(unitId) and (UnitIsUnit(unitCaster, unitId) or bBuffIsOnTarget)) then
if (bBuffIsOnTarget and not UnitIsUnit(unitCaster, unitId)) then
--could be prescince, ebom might or power infusion
local sourceSerial = UnitGUID(unitCaster)
local sourceName = Details:GetFullName(unitCaster)
local sourceFlags = 0x518
local targetSerial = UnitGUID(unitId)
local targetName = Details:GetFullName(unitId)
local targetFlags = 0x518
local targetFlags2 = 0x0
local spellName = name
Details.parser:buff("SPELL_AURA_APPLIED", time(), sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetFlags2, spellId, spellName, 0x4, "BUFF", 0)
--Details:Msg("Adding aura already existing in the target:", spellName, spellId, sourceName, targetName)
else
local playerName, realmName = _UnitName(unitId)
local playerGUID = UnitGUID(unitId)
if (in_or_out == "BUFF_UPTIME_IN") then
if (_detalhes.PotionList [spellid]) then
pot_usage [playerName] = spellid
elseif (runes_id [spellid]) then
focus_augmentation [playerName] = true
if (playerGUID) then
if (realmName and realmName ~= "") then
playerName = playerName .. "-" .. realmName
end
end
_detalhes.parser:add_buff_uptime (nil, GetTime(), playerGUID, playerName, 0x00000417, playerGUID, playerName, 0x00000417, 0x0, spellid, name, in_or_out)
if (in_or_out == "BUFF_UPTIME_IN") then
if (_detalhes.PotionList[spellId]) then
potUsage[playerName] = spellId
elseif (runes_id[spellId]) then
focusAugmentation [playerName] = true
end
end
_detalhes.parser:add_buff_uptime(nil, GetTime(), playerGUID, playerName, 0x00000417, playerGUID, playerName, 0x00000417, 0x0, spellId, name, in_or_out)
end
end
end
end
@@ -1570,9 +1581,9 @@ function _detalhes:CatchRaidBuffUptime (in_or_out)
if (playerGUID) then
if (in_or_out == "BUFF_UPTIME_IN") then
if (_detalhes.PotionList [spellid]) then
pot_usage [playerName] = spellid
potUsage [playerName] = spellid
elseif (runes_id [spellid]) then
focus_augmentation [playerName] = true
focusAugmentation [playerName] = true
end
end
@@ -1584,7 +1595,7 @@ function _detalhes:CatchRaidBuffUptime (in_or_out)
if (in_or_out == "BUFF_UPTIME_IN") then
local string_output = "pre-potion: "
for playername, potspellid in pairs(pot_usage) do
for playername, potspellid in pairs(potUsage) do
local name, _, icon = _GetSpellInfo(potspellid)
local unitClass = Details:GetUnitClass(playername)
local class_color = ""
@@ -1595,7 +1606,7 @@ function _detalhes:CatchRaidBuffUptime (in_or_out)
end
_detalhes.pre_pot_used = string_output
_detalhes:SendEvent("COMBAT_PREPOTION_UPDATED", nil, pot_usage, focus_augmentation)
_detalhes:SendEvent("COMBAT_PREPOTION_UPDATED", nil, potUsage, focusAugmentation)
end
else
+4 -1
View File
@@ -413,7 +413,10 @@
Details:UpdateParserGears(bFromCombatStart)
--get all buff already applied before the combat start
Details:CatchRaidBuffUptime("BUFF_UPTIME_IN")
C_Timer.After(0.05, function()
--wait the initial aura wipe done by the client on certain situations
Details:CatchRaidBuffUptime("BUFF_UPTIME_IN")
end)
Details:CatchRaidDebuffUptime("DEBUFF_UPTIME_IN")
Details:UptadeRaidMembersCache()