Skip to content

Commit

Permalink
BugFix: New nameplates healthbar sometimes was not visible.
Browse files Browse the repository at this point in the history
Added NPCs nameplates display configuration.
  • Loading branch information
michaelnpsp committed Dec 1, 2023
1 parent 6a919e2 commit a554b2f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 14 deletions.
12 changes: 10 additions & 2 deletions core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ local format = string.format
local tinsert = table.insert
local tremove = table.remove
local tconcat = table.concat
local C_Timer_After = C_Timer.After

local isClassic = addon.isClassic
local isVanilla = addon.isVanilla
Expand Down Expand Up @@ -424,8 +425,15 @@ local function SkinPlate(plateFrame, UnitFrame, UnitAdded)
healthBar:SetPoint('BOTTOMRIGHT',anchorFrame, isVanilla and 'BOTTOMRIGHT' or 'TOPRIGHT', 0, gap or 0 )
UnitFrame.castBarGap = gap
end
healthBar:SetShown( db.kHealthBar_enabled )
healthBar:SetHeight( db.healthBarHeight or 12 )
if db.kHealthBar_enabled then
healthBar:Show()
if not healthBar:IsShown() then -- Workaround to weird bug, hidden bars refused to be visible
C_Timer_After(0, function() healthBar:Show() end)
end
else
healthBar:Hide()
end
-- castBar
local castBar = UnitFrame.kkCastBar
if castBar then
Expand Down Expand Up @@ -842,7 +850,7 @@ end
local function CombatReskinCheck(delay)
if delay then
-- We need to add a delay because some times UnitAffectingCombat() does not return correct values just after combat start.
C_Timer.After(.05, CombatReskinCheck)
C_Timer_After(.05, CombatReskinCheck)
return
end
local reskin = ConditionFields['@combat']
Expand Down
33 changes: 21 additions & 12 deletions options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,27 @@ Opt_SetupOption( 'General', 'Nameplates Visibility', {
end,
values = { [0] = "Never", [1] = "Always", [2]= "Only in combat", [3]= "Only out of combat", [4] = 'Only in instances' , [5] = 'Only outside instances' },
},
nameShowFriendlyNPCs= {
type = "toggle",
order = 201.5,
name = "NPCs", width = .4,
desc = "Show nameplates for friendly NPCs.",
get = function() return GetCVar ("nameplateShowFriendlyNPCs") == "1" end,
set = function (_, value) SetCVarCombat("nameplateShowFriendlyNPCs", value) end,
disabled = function() return GetCVar ("nameplateShowFriends") == "0" or addon.db.general.nameplateShowFriends==0 end,
},
nameplateShowFriendlyMinions = {
type = "toggle",
order = 202, width = .5,
name = "Minions",
desc = "Show nameplates for friendly minions.",
get = function() return GetCVar("nameplateShowFriendlyMinions") == "1" end,
set = function (_, value) SetCVarCombat("nameplateShowFriendlyMinions", value) end,
disabled = function() return GetCVar ("nameplateShowFriends") == "0" or addon.db.general.nameplateShowFriends==0 end,
},
nameplateShowFriendlyGuardians = {
type = "toggle",
order = 202, width = .55,
order = 203, width = .5,
name = "Guardians",
desc = "Show nameplates for friendly guardians.",
get = function() return GetCVar ("nameplateShowFriendlyGuardians") == "1" end,
Expand All @@ -477,25 +495,16 @@ Opt_SetupOption( 'General', 'Nameplates Visibility', {
},
nameplateShowFriendlyTotems = {
type = "toggle",
order = 203, width = .55,
order = 204, width = .5,
name = "Totems",
desc = "Show nameplates for friendly totems.",
get = function() return GetCVar("nameplateShowFriendlyTotems") == "1" end,
set = function (_, value) SetCVarCombat("nameplateShowFriendlyTotems", value) end,
disabled = function() return GetCVar ("nameplateShowFriends") == "0" or addon.db.general.nameplateShowFriends==0 end,
},
nameplateShowFriendlyMinions = {
type = "toggle",
order = 204, width = .55,
name = "Minions",
desc = "Show nameplates for friendly minions.",
get = function() return GetCVar("nameplateShowFriendlyMinions") == "1" end,
set = function (_, value) SetCVarCombat("nameplateShowFriendlyMinions", value) end,
disabled = function() return GetCVar ("nameplateShowFriends") == "0" or addon.db.general.nameplateShowFriends==0 end,
},
nameplateShowFriendlyPets = {
type = "toggle",
order = 205, width = .55,
order = 205, width = .35,
name = "Pets",
desc = "Show nameplates for friendly pets.",
get = function() return GetCVar("nameplateShowFriendlyPets") == "1" end,
Expand Down

0 comments on commit a554b2f

Please sign in to comment.