Skip to content

Commit

Permalink
Added optional blizzard behaviour for Resurrection status (only enabl…
Browse files Browse the repository at this point in the history
…ed when resurrection is being cast).
  • Loading branch information
michaelnpsp committed Jan 18, 2024
1 parent 3978256 commit c42d343
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
18 changes: 17 additions & 1 deletion Options/modules/statuses/StatusMisc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,23 @@ Grid2Options:RegisterStatusOptions("self", "target", nil, {
titleIcon = "Interface\\Icons\\Inv_wand_12",
})

Grid2Options:RegisterStatusOptions("resurrection", "combat", nil, {
Grid2Options:RegisterStatusOptions("resurrection", "combat", function(self, status, options, optionParams)
self:MakeStatusColorOptions(status, options, optionParams)
self:MakeSpacerOptions(options, 40)
options.color2.hidden = function() return status.dbx.onlyReviving end
options.onlyReviving = {
type = "toggle",
name = L["Enabled only while the resurrection spell is being cast"],
desc = L["Check this option to clear the status after the resurrection spell cast ends."],
width = "full",
order = 50,
get = function () return status.dbx.onlyReviving end,
set = function (_, v)
status.dbx.onlyReviving = v or nil
status:Refresh()
end,
}
end, {
color1 = L["Casting resurrection"],
colorDesc1 = L["A resurrection spell is being casted on the unit"],
color2 = L["Resurrected"],
Expand Down
14 changes: 7 additions & 7 deletions modules/StatusRes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ local res_cache= {}

local function Timer()
for unit in next, res_cache do
if not (UnitExists(unit) and UnitIsDeadOrGhost(unit) and UnitHasIncomingResurrection(unit)) then
if not (UnitExists(unit) and UnitIsDeadOrGhost(unit)) then
res_cache[unit]= nil
Resurrection:UpdateIndicators(unit)
end
Expand All @@ -32,13 +32,13 @@ function Resurrection:INCOMING_RESURRECT_CHANGED(_, unit)
if res_cache[unit] ~= 1 then
res_cache[unit]= 1
self:UpdateIndicators(unit)
timer = timer or Grid2:CreateTimer( Timer, .25 )
end
else
if res_cache[unit] == 1 then
res_cache[unit]= 0
self:UpdateIndicators(unit)
if not self.dbx.onlyReviving then
timer = timer or Grid2:CreateTimer( Timer, .25 )
end
end
elseif res_cache[unit] == 1 then
res_cache[unit]= (not self.dbx.onlyReviving) and 0 or nil
self:UpdateIndicators(unit)
end
end
end
Expand Down

0 comments on commit c42d343

Please sign in to comment.