Skip to content

Commit

Permalink
Added to show amount of interrupts casted at the interrupt display, e…
Browse files Browse the repository at this point in the history
…nable with /run Details:GetWindow(1).show_interrupt_casts = true
  • Loading branch information
Tercioo committed Oct 15, 2024
1 parent c5bad0e commit 4735ead
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Definitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@
---@field freezed boolean
---@field sub_atributo_last table
---@field row_info table
---@field
---@field show_interrupt_casts boolean
---@field
---@field
---@field GetActorBySubDisplayAndRank fun(self: instance, displayid: attributeid, subDisplay: attributeid, rank: number) : actor
Expand Down
31 changes: 31 additions & 0 deletions classes/class_utility.lua
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,11 @@ function atributo_misc:RefreshLine(instancia, barras_container, whichRowLine, lu

local tabela_anterior = esta_barra.minha_tabela

---@cast instancia instance

---@type combat
local combatObject = instancia:GetCombat()

esta_barra.minha_tabela = self
esta_barra.colocacao = lugar

Expand Down Expand Up @@ -986,6 +991,32 @@ function atributo_misc:RefreshLine(instancia, barras_container, whichRowLine, lu
porcentagem = porcentagem .. "%"
end

if (instancia.show_interrupt_casts) then
if (sub_atributo == DETAILS_SUBATTRIBUTE_INTERRUPT) then --interrupts
--get the interrupt spell for this actor class from libOpenRaid
if (LIB_OPEN_RAID_SPELL_INTERRUPT_BYCLASS) then
---@type table<spellname, table>
local classInterrupts = LIB_OPEN_RAID_SPELL_INTERRUPT_BYCLASS[self.classe]
if (classInterrupts) then
---@type table<spellname, number> number is the amount of casts
local spellCasts = combatObject.amountCasts[self.nome]
local amountOfInterruptsCasted = 0
--iterating between the spells that are interrupts for this class
for spellNameOrId in pairs(classInterrupts) do
--if the actor casted this spell
if (spellCasts[spellNameOrId]) then
amountOfInterruptsCasted = amountOfInterruptsCasted + spellCasts[spellNameOrId]
end
end

if (amountOfInterruptsCasted > 0) then
meu_total = meu_total .. " (" .. tostring(amountOfInterruptsCasted) .. ")"
end
end
end
end
end

local rightText = meu_total .. bars_brackets[1] .. porcentagem .. bars_brackets[2]
if (UsingCustomRightText) then
esta_barra.lineText4:SetText(_string_replace(instancia.row_info.textR_custom_text, meu_total, "", porcentagem, self, instancia.showing, instancia, rightText))
Expand Down
2 changes: 2 additions & 0 deletions classes/include_instance.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ _detalhes.instance_defaults = {
bg_g = 0.0941,
bg_b = 0.0941,
backdrop_texture = "Details Ground",
--show amount of interrupts the player casted
show_interrupt_casts = false,
--auto current
auto_current = true,
--show sidebars
Expand Down
2 changes: 1 addition & 1 deletion frames/window_options2_sections.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2961,7 +2961,7 @@ do
usedecimals = true,
step = 0.5,
name = Loc ["STRING_OPTIONS_GROUPING_HORIZONTAL_GAP"],
desc = Loc ["STRING_OPTIONS_GROUPING_HORIZONTAL_GAP_DESC"],
desc = Loc ["STRING_OPTIONS_GROUPING_HORIZONTAL_GAP"],
thumbscale = 2.2,
},

Expand Down

0 comments on commit 4735ead

Please sign in to comment.