Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fader optional case flags #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions modules/fader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -140,20 +140,25 @@ end


function Fader:Update(frame, event)
local ignoreCasting = ShadowUF.db.profile.units[frame.unitType].fader.ignoreCasting;
local ignoreHealthRegen = ShadowUF.db.profile.units[frame.unitType].fader.ignoreHealthRegen;
local ignorePowerRegen = ShadowUF.db.profile.units[frame.unitType].fader.ignorePowerRegen;
local ignoreTargetting = ShadowUF.db.profile.units[frame.unitType].fader.ignoreTargetting;

-- In combat, fade back in
if( InCombatLockdown() or event == "PLAYER_REGEN_DISABLED" ) then
startFading(frame, "in", ShadowUF.db.profile.units[frame.unitType].fader.combatAlpha)
-- Player is casting, fade in
elseif( frame.fader.playerCasting ) then
elseif( not ignoreCasting and frame.fader.playerCasting ) then
startFading(frame, "in", ShadowUF.db.profile.units[frame.unitType].fader.combatAlpha, true)
-- Ether mana or energy is not at 100%, fade in
elseif( powerDepletes[UnitPowerType(frame.unit)] and UnitPower(frame.unit) ~= UnitPowerMax(frame.unit) ) then
elseif( not ignorePowerRegen and powerDepletes[UnitPowerType(frame.unit)] and UnitPower(frame.unit) ~= UnitPowerMax(frame.unit) ) then
startFading(frame, "in", ShadowUF.db.profile.units[frame.unitType].fader.combatAlpha)
-- Health is not at max, fade in
elseif( UnitHealth(frame.unit) ~= UnitHealthMax(frame.unit) ) then
elseif( not ignoreHealthRegen and UnitHealth(frame.unit) ~= UnitHealthMax(frame.unit) ) then
startFading(frame, "in", ShadowUF.db.profile.units[frame.unitType].fader.combatAlpha)
-- Targetting somebody, fade in
elseif( frame.unitType == "player" and UnitExists("target") ) then
elseif( not ignoreTargetting and frame.unitType == "player" and UnitExists("target") ) then
startFading(frame, "in", ShadowUF.db.profile.units[frame.unitType].fader.combatAlpha)
-- Nothing else? Fade out!
else
Expand Down
28 changes: 28 additions & 0 deletions options/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2695,6 +2695,34 @@ local function loadUnitOptions()
hidden = false,
isPercent = true,
},
ignoreCasting = {
order = 3,
type = "toggle",
name = L["Ignore casting"],
hidden = false,
arg = "fader.ignoreCasting"
},
ignoreHealthRegen = {
order = 4,
type = "toggle",
name = L["Ignore health regen"],
hidden = false,
arg = "fader.ignoreHealthRegen"
},
ignorePowerRegen = {
order = 5,
type = "toggle",
name = L["Ignore power regen"],
hidden = false,
arg = "fader.ignorePowerRegen"
},
ignoreTargetting = {
order = 6,
type = "toggle",
name = L["Ignore targetting"],
hidden = false,
arg = "fader.ignoreTargetting"
},
}
},
range = {
Expand Down