Skip to content

Commit

Permalink
Added Ebon Might uptime per player in the evoker extra bar tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Sep 30, 2024
1 parent 97cb6a7 commit 1d65d79
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 250 deletions.
94 changes: 64 additions & 30 deletions classes/class_damage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3046,7 +3046,7 @@ function damageClass:RefreshLine(instanceObject, lineContainer, whichRowLine, ra
return self:RefreshLineValue(thisLine, instanceObject, previousData, bForceRefresh, percentNumber, bUseAnimations, total, instanceObject.top)
end

---show an extra statusbar on the line, after the main statusbar
---show an extra statusbar on the line, after the main statusbar ~extra ~statusbar
---@param thisLine table
---@param amount valueamount
---@param extraAmount valueamount
Expand Down Expand Up @@ -3510,7 +3510,7 @@ function Details:RefreshBarra(thisLine, instance, fromResize) --[[exported]]
self:SetBarLeftText(thisLine, instance, enemy, arenaEnemy, arenaAlly, UsingCustomLeftText)
end

---comment
---~aug ~evoker
---@param self table extraStatusbar frame
function damageClass.PredictedAugSpellsOnEnter(self)
if (Details.show_aug_predicted_spell_damage) then
Expand Down Expand Up @@ -3575,25 +3575,36 @@ function damageClass.PredictedAugSpellsOnEnter(self)
---@type table<spellid, table<spellid, number, actorname, actorname, class, boolean>>
local buffUptimeTable = {}

local iconSize = 22
local iconBorderInfo = Details.tooltip.icon_border_texcoord

local CONST_SPELLID_EBONMIGHT = 395152
local CONST_SPELLID_PRESCIENCE = 410089
local CONST_SPELLID_BLACKATTUNEMENT = 403264
local CONST_SPELLID_BLISTERING_SCALES = 360827

local ebonMightSpellName, _, ebonMightSpellIcon = Details.GetSpellInfo(CONST_SPELLID_EBONMIGHT)
local _, _, ebonMightOnSelfIcon = Details.GetSpellInfo(395296)

---@type actor[]
local augmentationEvokers = {}

local thisEvokerObject = utilityContainer:GetActor(actorName)

--prescience and ebon might updatime on each actor
for _, actorObject in utilityContainer:ListActors() do
for _, actorUtilityObject in utilityContainer:ListActors() do
---@type spellcontainer
local receivedBuffs = actorObject.received_buffs_spells
local receivedBuffs = actorUtilityObject.received_buffs_spells

--check if the actor is an augmentation evoker
if (actorObject.spec == 1473) then
augmentationEvokers[#augmentationEvokers+1] = actorObject
if (actorUtilityObject.spec == 1473) then
augmentationEvokers[#augmentationEvokers+1] = actorUtilityObject
if (actorUtilityObject:Name() == actorName) then
thisEvokerObject = actorUtilityObject
end
end

if (receivedBuffs and actorObject:IsPlayer() and actorObject:IsGroupPlayer()) then
if (receivedBuffs and actorUtilityObject:IsPlayer() and actorUtilityObject:IsGroupPlayer()) then
for sourceNameSpellId, spellTable in receivedBuffs:ListSpells() do
local sourceName, spellId = strsplit("@", sourceNameSpellId)
if (sourceName == actorName) then
Expand All @@ -3602,13 +3613,13 @@ function damageClass.PredictedAugSpellsOnEnter(self)

if (spellName and spellId) then
sourceName = detailsFramework:RemoveRealmName(sourceName)
local targetName = actorObject:Name()
local targetName = actorUtilityObject:Name()
targetName = detailsFramework:RemoveRealmName(targetName)

local uptime = spellTable.uptime or 0
local bCanShowOnTooltip = true
buffUptimeTable[spellId] = buffUptimeTable[spellId] or {}
table.insert(buffUptimeTable[spellId], {spellId, uptime, sourceName, targetName, actorObject:Class(), bCanShowOnTooltip})
table.insert(buffUptimeTable[spellId], {spellId, uptime, sourceName, targetName, actorUtilityObject:Class(), bCanShowOnTooltip})
end
end
end
Expand All @@ -3627,9 +3638,6 @@ function damageClass.PredictedAugSpellsOnEnter(self)
Details:AddTooltipSpellHeaderText(Loc ["STRING_SPELLS"], headerColor, #buffUptimeTable, Details.tooltip_spell_icon.file, unpack(Details.tooltip_spell_icon.coords))
Details:AddTooltipHeaderStatusbar(.1, .1, .1, 0.834)

local iconSize = 22
local iconBorderInfo = Details.tooltip.icon_border_texcoord

--add the total combat time into the tooltip
local combatTimeMinutes, combatTimeSeconds = math.floor(combatTime / 60), math.floor(combatTime % 60)
GameCooltip:AddLine("Combat Time", combatTimeMinutes .. "m " .. combatTimeSeconds .. "s" .. " (" .. format("%.1f", 100) .. "%)")
Expand All @@ -3639,24 +3647,50 @@ function damageClass.PredictedAugSpellsOnEnter(self)
GameCooltip:AddLine("", "")
GameCooltip:AddIcon("", nil, nil, 1, 1)

local ebonMightTable = buffUptimeTable[CONST_SPELLID_EBONMIGHT][1]
if (ebonMightTable) then
local uptime = ebonMightTable[2]
local spellName, _, spellIcon = _GetSpellInfo(CONST_SPELLID_EBONMIGHT)
local uptimePercent = uptime / combatTime * 100
local sourceName = ebonMightTable[3]

if (uptime <= combatTime) then
local minutes, seconds = math.floor(uptime / 60), math.floor(uptime % 60)
if (minutes > 0) then
GameCooltip:AddLine(spellName, minutes .. "m " .. seconds .. "s" .. " (" .. format("%.1f", uptimePercent) .. "%)")
Details:AddTooltipBackgroundStatusbar(false, uptimePercent, true, sourceName and "darkgreen")
else
GameCooltip:AddLine(spellName, seconds .. "s" .. " (" .. format("%.1f", uptimePercent) .. "%)")
Details:AddTooltipBackgroundStatusbar(false, uptimePercent, true, sourceName and "darkgreen")
end
--show the caster evoker ebonmight uptime on the tooltip
local thisEvokerEbonMightSpellTable = thisEvokerObject.buff_uptime_spells:GetSpell(395296)
local evokerEbonMightUptime = thisEvokerEbonMightSpellTable and thisEvokerEbonMightSpellTable.uptime
local ebonMightColor = "saddlebrown"

if (evokerEbonMightUptime) then
local minutes, seconds = math.floor(evokerEbonMightUptime / 60), math.floor(evokerEbonMightUptime % 60)
local percent = evokerEbonMightUptime / combatTime * 100

GameCooltip:AddIcon(spellIcon, nil, nil, iconSize, iconSize, iconBorderInfo.L, iconBorderInfo.R, iconBorderInfo.T, iconBorderInfo.B)
if (minutes > 0) then
GameCooltip:AddLine(ebonMightSpellName .. " (self)", minutes .. "m " .. seconds .. "s" .. " (" .. format("%.1f", percent) .. "%)")
Details:AddTooltipBackgroundStatusbar(false, percent, true, ebonMightColor)
else
GameCooltip:AddLine(ebonMightSpellName .. " (self)", seconds .. "s" .. " (" .. format("%.1f", percent) .. "%)")
Details:AddTooltipBackgroundStatusbar(false, percent, true, ebonMightColor)
end

GameCooltip:AddIcon(ebonMightOnSelfIcon, nil, nil, iconSize, iconSize, iconBorderInfo.L, iconBorderInfo.R, iconBorderInfo.T, iconBorderInfo.B)
end

local ebonMightTable = buffUptimeTable[CONST_SPELLID_EBONMIGHT]

--all ebon mights
for i = 1, #ebonMightTable do
local thisEbonMightTable = ebonMightTable[i]
local uptime = thisEbonMightTable[2]
local evokerName = thisEbonMightTable[3]
local targetName = thisEbonMightTable[4]
local targetClass = thisEbonMightTable[5]

local spellName = ebonMightSpellName

if (evokerName) then
targetName = detailsFramework:AddClassColorToText(targetName, targetClass)
targetName = detailsFramework:AddClassIconToText(targetName, targetName, targetClass)
spellName = spellName .. " [" .. targetName .. " ]"
end

local minutes, seconds = math.floor(uptime / 60), math.floor(uptime % 60)
if (uptime > 0) then
local uptimePercent = uptime / combatTime * 100
GameCooltip:AddLine(spellName, minutes .. "m " .. seconds .. "s" .. " (" .. format("%.1f", uptimePercent) .. "%)")
GameCooltip:AddIcon(ebonMightSpellIcon, nil, nil, iconSize, iconSize, iconBorderInfo.L, iconBorderInfo.R, iconBorderInfo.T, iconBorderInfo.B)
Details:AddTooltipBackgroundStatusbar(false, uptimePercent, true, ebonMightColor)
end
end

Expand Down Expand Up @@ -3735,7 +3769,7 @@ function damageClass.PredictedAugSpellsOnEnter(self)
if (sourceName) then
targetName = detailsFramework:AddClassColorToText(targetName, targetClass)
targetName = detailsFramework:AddClassIconToText(targetName, targetName, targetClass)
spellName = spellName .. " [" .. targetName .. "]"
spellName = spellName .. " [" .. targetName .. " ]"
end

if (uptime <= combatTime) then
Expand Down
14 changes: 9 additions & 5 deletions core/aura_scan.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function AuraScan.CheckForOneHourBuffs()
if (Details222.OneHourAuras[spellId]) then
--is this buff have 100% uptime?
if (spellTable.uptime == combatTime) then
--remove the spell fro the container
utilityActor.buff_uptime = utilityActor.buff_uptime - spellTable.uptime
utilityActor.buff_uptime_spells._ActorTable[spellId] = nil
end
Expand All @@ -63,6 +64,9 @@ function AuraScan.CheckForOneHourBuffs()
end
end

------------------------------
---------Aura Scan ~aura ~scan

function AuraScan.RegisterCallback(callback)
AuraScan.Callbacks[callback] = true
end
Expand Down Expand Up @@ -372,7 +376,7 @@ end

------------------------------------------------------------------------------------------------------------------------------

local scanFrame = CreateFrame("frame", "DetailsAuraScanFrame", UIParent)
local scanFrame = CreateFrame("frame")

function AuraScan.Start()
AuraScan.Enabled = true
Expand All @@ -399,15 +403,15 @@ function AuraScan.Start()

bIsInitialScan = false

DetailsAuraScanFrame:RegisterEvent("UNIT_AURA")
DetailsAuraScanFrame:SetScript("OnEvent", AuraScan.OnEvent)
scanFrame:RegisterEvent("UNIT_AURA")
scanFrame:SetScript("OnEvent", AuraScan.OnEvent)
end

function AuraScan.Stop()
if (AuraScan.Enabled) then
AuraScan.Enabled = false
DetailsAuraScanFrame:UnregisterEvent("UNIT_AURA")
DetailsAuraScanFrame:SetScript("OnEvent", nil)
scanFrame:UnregisterEvent("UNIT_AURA")
scanFrame:SetScript("OnEvent", nil)

--close all opened auras (by running the remove function)
for targetGUID, auras in pairs(AuraScan.UnitAurasStorage) do
Expand Down
Loading

0 comments on commit 1d65d79

Please sign in to comment.