From 0e4b280f0606fc27b39393196c8f7e0c6ad81abe Mon Sep 17 00:00:00 2001 From: wardz <10900212+wardz@users.noreply.github.com> Date: Sat, 14 Sep 2024 16:25:42 +0200 Subject: [PATCH] add option for ignoring parent scale & not showing pet casts for nameplates --- .luacheckrc | 1 + ClassicCastbars/ClassicCastbars.lua | 1 + ClassicCastbars/core/Frames.lua | 1 + ClassicCastbars/core/SavedVariables.lua | 9 ++++- .../ClassicCastbars_Options.lua | 33 ++++++++++++++----- ClassicCastbars_Options/Locales/enUS.lua | 3 ++ 6 files changed, 39 insertions(+), 9 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index 0fb92dd..13334b9 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -83,6 +83,7 @@ read_globals = { "UnitCastingInfo", "UnitChannelInfo", "UnitIsFriend", + "UnitIsOtherPlayersPet", "strsplit", "C_AddOns", "C_Spell", diff --git a/ClassicCastbars/ClassicCastbars.lua b/ClassicCastbars/ClassicCastbars.lua index a7fa160..085ff62 100644 --- a/ClassicCastbars/ClassicCastbars.lua +++ b/ClassicCastbars/ClassicCastbars.lua @@ -64,6 +64,7 @@ function ClassicCastbars:GetCastbarFrameIfEnabled(unitID) if not self.db.nameplate.showForFriendly and isFriendly then return end if not self.db.nameplate.showForEnemy and not isFriendly then return end if UnitIsUnit("player", unitID) then return end -- personal resource display nameplate + if not self.db.nameplate.showForPets and UnitIsOtherPlayersPet(unitID) then return end end return self:GetCastbarFrame(unitID) diff --git a/ClassicCastbars/core/Frames.lua b/ClassicCastbars/core/Frames.lua index 4a67b24..d56131b 100644 --- a/ClassicCastbars/core/Frames.lua +++ b/ClassicCastbars/core/Frames.lua @@ -190,6 +190,7 @@ function ClassicCastbars:SetCastbarStyle(castbar, db, unitID) castbar.Text:SetWidth(db.width - 10) -- ensures text gets truncated castbar.currWidth = db.width -- avoids having to use a function call later on in OnUpdate castbar:SetIgnoreParentAlpha(db.ignoreParentAlpha) + castbar:SetIgnoreParentScale(db.ignoreParentScale) castbar.Border:SetDrawLayer("ARTWORK", 1) castbar.BorderShield:SetDrawLayer("ARTWORK", 2) diff --git a/ClassicCastbars/core/SavedVariables.lua b/ClassicCastbars/core/SavedVariables.lua index 626ecc0..6ea9cbc 100644 --- a/ClassicCastbars/core/SavedVariables.lua +++ b/ClassicCastbars/core/SavedVariables.lua @@ -1,7 +1,7 @@ local _, namespace = ... namespace.defaultConfig = { - version = "45", + version = "46", locale = GetLocale(), usePerCharacterSettings = false, @@ -9,6 +9,7 @@ namespace.defaultConfig = { enabled = true, showForFriendly = true, showForEnemy = true, + showForPets = true, width = 106, height = 11, iconSize = 13, @@ -43,6 +44,7 @@ namespace.defaultConfig = { borderPaddingHeight = 1.3, borderPaddingWidth = 1.17, edgeSizeLSM = 18, + ignoreParentScale = false, }, target = { @@ -81,6 +83,7 @@ namespace.defaultConfig = { borderPaddingHeight = 1.3, borderPaddingWidth = 1.17, edgeSizeLSM = 18, + ignoreParentScale = false, }, focus = { @@ -119,6 +122,7 @@ namespace.defaultConfig = { borderPaddingHeight = 1.3, borderPaddingWidth = 1.17, edgeSizeLSM = 18, + ignoreParentScale = false, }, party = { @@ -157,6 +161,7 @@ namespace.defaultConfig = { borderPaddingHeight = 1.3, borderPaddingWidth = 1.17, edgeSizeLSM = 18, + ignoreParentScale = false, }, arena = { @@ -195,6 +200,7 @@ namespace.defaultConfig = { borderPaddingHeight = 1.3, borderPaddingWidth = 1.17, edgeSizeLSM = 18, + ignoreParentScale = false, }, player = { @@ -234,5 +240,6 @@ namespace.defaultConfig = { borderPaddingHeight = 1.3, borderPaddingWidth = 1.17, edgeSizeLSM = 18, + ignoreParentScale = false, }, } diff --git a/ClassicCastbars_Options/ClassicCastbars_Options.lua b/ClassicCastbars_Options/ClassicCastbars_Options.lua index e308fb5..e4fce6c 100644 --- a/ClassicCastbars_Options/ClassicCastbars_Options.lua +++ b/ClassicCastbars_Options/ClassicCastbars_Options.lua @@ -128,9 +128,17 @@ local function CreateUnitTabGroup(unitID, localizedUnit, order) disabled = ModuleIsDisabled, hidden = unitID ~= "nameplate", }, - autoPosition = { + showForPets = { order = 4, width = "full", + name = L.SHOW_FOR_PETS, + type = "toggle", + disabled = ModuleIsDisabled, + hidden = unitID ~= "nameplate", + }, + autoPosition = { + order = 5, + width = "full", name = L.AUTO_POS_BAR, desc = unitID ~= "player" and L.AUTO_POS_BAR_TOOLTIP or "", type = "toggle", @@ -138,7 +146,7 @@ local function CreateUnitTabGroup(unitID, localizedUnit, order) disabled = ModuleIsDisabled, }, showTimer = { - order = 5, + order = 6, width = "full", name = L.SHOW_TIMER, desc = L.SHOW_TIMER_TOOLTIP, @@ -146,7 +154,7 @@ local function CreateUnitTabGroup(unitID, localizedUnit, order) disabled = ModuleIsDisabled, }, showTotalTimer = { - order = 5, + order = 7, width = "full", name = L.SHOW_TOTAL_TIMER, desc = L.SHOW_TOTAL_TIMER_TOOLTIP, @@ -155,14 +163,14 @@ local function CreateUnitTabGroup(unitID, localizedUnit, order) disabled = ModuleIsDisabled, }, showSpark = { - order = 6, + order = 8, width = "full", name = L.SHOW_SPARK, type = "toggle", disabled = ModuleIsDisabled, }, showBorderShield = { - order = 7, + order = 9, width = "full", name = L.BORDERSHIELD, desc = L.BORDERSHIELD_TOOLTIP, @@ -171,7 +179,7 @@ local function CreateUnitTabGroup(unitID, localizedUnit, order) hidden = unitID == "player", }, ignoreParentAlpha = { - order = 8, + order = 10, width = "full", name = L.IGNORE_PARENT_ALPHA, desc = L.IGNORE_PARENT_ALPHA_TOOLTIP, @@ -179,9 +187,18 @@ local function CreateUnitTabGroup(unitID, localizedUnit, order) disabled = ModuleIsDisabled, hidden = unitID == "player", }, + ignoreParentScale = { + order = 11, + width = "full", + name = L.IGNORE_PARENT_SCALE, + desc = L.IGNORE_PARENT_SCALE_TOOLTIP, + type = "toggle", + disabled = ModuleIsDisabled, + hidden = unitID == "player", + }, posX = { -- Position slider X for nameplate castbars only - order = 10, + order = 12, name = L.POS_X, desc = L.POSXY_TOOLTIP, width = 2, @@ -201,7 +218,7 @@ local function CreateUnitTabGroup(unitID, localizedUnit, order) }, posY = { -- Position slider Y for nameplate castbars only - order = 11, + order = 13, name = L.POS_Y, desc = L.POSXY_TOOLTIP, width = 2, diff --git a/ClassicCastbars_Options/Locales/enUS.lua b/ClassicCastbars_Options/Locales/enUS.lua index 37b991f..6c62c3f 100644 --- a/ClassicCastbars_Options/Locales/enUS.lua +++ b/ClassicCastbars_Options/Locales/enUS.lua @@ -48,6 +48,8 @@ L["ICON_SIZE"] = "Icon Size" L["ICON_SIZE_TOOLTIP"] = "Sets the size for the castbar spell icon." L["IGNORE_PARENT_ALPHA"] = "Ignore Parent Frame Alpha" L["IGNORE_PARENT_ALPHA_TOOLTIP"] = "Ignore transparency/alpha value inherited from castbars parent's frame." +L["IGNORE_PARENT_SCALE"] = "Ignore Parent Frame Scale" +L["IGNORE_PARENT_SCALE_TOOLTIP"] = "Ignore scale multiplier inherited from castbars parent's frame." L["NO_NAMEPLATE_VISIBLE"] = "You have no target or target nameplate is not visible on screen." L["PER_CHARACTER"] = "|TInterface\\OptionsFrame\\UI-OptionsFrame-NewFeatureIcon:0:0:0:-1|tCharacter Specific Settings" L["PER_CHARACTER_TOOLTIP"] = "Click this to toggle between general settings and settings specific to this character." @@ -57,6 +59,7 @@ L["POS_Y"] = "Position Y (Up/Down)" L["RESET_ALL"] = "Reset All Settings" L["SHOW_FOR_ENEMY"] = "Show Enemy Casts" L["SHOW_FOR_FRIENDLY"] = "Show Friendly Casts" +L["SHOW_FOR_PETS"] = "Show Player Pet Casts" L["SHOW_SPARK"] = "Show Castbar Spark Effect" L["SHOW_TIMER"] = "Show Timer Text" L["SHOW_TIMER_TOOLTIP"] = "Display a timer countdown for the current cast."