From 73e9151c8a630c4f27c0b4152b5c7eb928d6d2ab Mon Sep 17 00:00:00 2001 From: Alessandro Barbieri Date: Mon, 2 Feb 2026 18:27:47 +0100 Subject: [PATCH 1/4] use UnitHasRelicSlot to check for ranged class --- Modules/Data/Ranged.lua | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Modules/Data/Ranged.lua b/Modules/Data/Ranged.lua index ac30f37..a6bc1a7 100755 --- a/Modules/Data/Ranged.lua +++ b/Modules/Data/Ranged.lua @@ -11,7 +11,7 @@ local _, _, classId = UnitClass("player") ---@return number function Data:GetRangeAttackPower() - if not _Ranged:IsRangeAttackClass() then + if UnitHasRelicSlot("player") then return 0 end @@ -19,11 +19,6 @@ function Data:GetRangeAttackPower() return melee + posBuff + negBuff end ----@return boolean -function _Ranged:IsRangeAttackClass() - return classId == Data.WARRIOR or classId == Data.ROGUE or classId == Data.HUNTER -end - ---@return number function Data:GetRangedHasteRating() local hasteRating = GetCombatRating(CR_HASTE_RANGED) From 3880c32223a0f1f4267e696cc89ffc628f8c46b6 Mon Sep 17 00:00:00 2001 From: Alessandro Barbieri Date: Tue, 3 Feb 2026 02:03:24 +0100 Subject: [PATCH 2/4] hide ranged stats on non ranged classes --- Modules/Config/RangeSection.lua | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/Modules/Config/RangeSection.lua b/Modules/Config/RangeSection.lua index 591e33c..7476df6 100755 --- a/Modules/Config/RangeSection.lua +++ b/Modules/Config/RangeSection.lua @@ -21,6 +21,7 @@ function _Config:LoadRangeSection() name = function() return i18n("Show Ranged Stats") end, desc = function() return i18n("Shows/Hides all ranged stats.") end, width = 1.5, + hidden = function() return UnitHasRelicSlot("player") end, get = function () return ExtendedCharacterStats.profile.ranged.display; end, set = function (_, value) ExtendedCharacterStats.profile.ranged.display = value @@ -33,6 +34,7 @@ function _Config:LoadRangeSection() name = function() return i18n("Ranged Attack Power") end, desc = function() return i18n("Shows/Hides the ranged attack power value.") end, width = 1.5, + hidden = function() return UnitHasRelicSlot("player") end, disabled = function() return (not ExtendedCharacterStats.profile.ranged.display); end, get = function () return ExtendedCharacterStats.profile.ranged.attackPower.display; end, set = function (_, value) @@ -46,6 +48,7 @@ function _Config:LoadRangeSection() name = function() return i18n("Ranged Crit") end, desc = function() return i18n("Shows/Hides the ranged crit chance.") end, width = 1.5, + hidden = function() return UnitHasRelicSlot("player") end, disabled = function() return (not ExtendedCharacterStats.profile.ranged.display); end, get = function () return ExtendedCharacterStats.profile.ranged.crit.display; end, set = function (_, value) @@ -59,9 +62,7 @@ function _Config:LoadRangeSection() name = function() return i18n("Armor Pen.") end, desc = function() return i18n("Shows/Hides the armor penetration value.") end, width = 1.5, - hidden = function() - return (not ECS.IsWotlk) - end, + hidden = function() return ECS.IsClassic or UnitHasRelicSlot("player") end, disabled = function() return (not ExtendedCharacterStats.profile.ranged.display); end, get = function () return ExtendedCharacterStats.profile.ranged.penetration.display; end, set = function (_, value) @@ -75,9 +76,7 @@ function _Config:LoadRangeSection() name = function() return i18n("Armor Pen. Rating") end, desc = function() return i18n("Shows/Hides the armor penetration rating value.") end, width = 1.5, - hidden = function() - return (not ECS.IsWotlk) - end, + hidden = function() return (not ECS.IsWotlk) or UnitHasRelicSlot("player") end, disabled = function() return (not ExtendedCharacterStats.profile.ranged.display); end, get = function () return ExtendedCharacterStats.profile.ranged.penetrationRating.display; end, set = function (_, value) @@ -91,9 +90,7 @@ function _Config:LoadRangeSection() name = function() return i18n("Haste Rating") end, desc = function() return i18n("Shows/Hides the ranged haste rating.") end, width = 1.5, - hidden = function() - return (not ECS.IsWotlk) - end, + hidden = function() return ECS.IsClassic or UnitHasRelicSlot("player") end, disabled = function() return (not ExtendedCharacterStats.profile.ranged.display); end, get = function () return ExtendedCharacterStats.profile.ranged.hasteRating.display; end, set = function (_, value) @@ -107,9 +104,7 @@ function _Config:LoadRangeSection() name = function() return i18n("Haste Bonus") end, desc = function() return i18n("Shows/Hides the ranged haste bonus value.") end, width = 1.5, - hidden = function() - return (not ECS.IsWotlk) - end, + hidden = function() return UnitHasRelicSlot("player") end, disabled = function() return (not ExtendedCharacterStats.profile.ranged.display); end, get = function () return ExtendedCharacterStats.profile.ranged.hasteBonus.display; end, set = function (_, value) @@ -123,6 +118,7 @@ function _Config:LoadRangeSection() name = function() return i18n("Attack Speed") end, desc = function() return i18n("Shows/Hides the ranged attack speed.") end, width = 1.5, + hidden = function() return UnitHasRelicSlot("player") end, disabled = function() return (not ExtendedCharacterStats.profile.ranged.display); end, get = function () return ExtendedCharacterStats.profile.ranged.attackSpeed.display; end, set = function (_, value) @@ -136,6 +132,7 @@ function _Config:LoadRangeSection() name = function() return i18n("Ranged Hit") end, desc = function() return i18n("Shows/Hides all ranged hit chance.") end, width = 1.5, + hidden = function() return UnitHasRelicSlot("player") end, disabled = function() return (not ExtendedCharacterStats.profile.ranged.display); end, get = function () return ExtendedCharacterStats.profile.ranged.hit.display; end, set = function (_, value) @@ -155,9 +152,7 @@ function _Config:LoadRangeSection() name = function() return i18n("Hit Rating") end, desc = function() return i18n("Shows/Hides the ranged hit rating.") end, width = 1.5, - hidden = function() - return (not ECS.IsWotlk) - end, + hidden = function() return ECS.IsClassic or UnitHasRelicSlot("player") end, disabled = function() return ((not ExtendedCharacterStats.profile.ranged.display) or (not ExtendedCharacterStats.profile.ranged.hit.display)) @@ -174,6 +169,7 @@ function _Config:LoadRangeSection() name = function() return i18n("Hit Bonus") end, desc = function() return i18n("Shows/Hides the ranged hit bonus.") end, width = 1.5, + hidden = function() return UnitHasRelicSlot("player") end, disabled = function() return ((not ExtendedCharacterStats.profile.ranged.display) or (not ExtendedCharacterStats.profile.ranged.hit.display)) @@ -190,6 +186,7 @@ function _Config:LoadRangeSection() name = function() return i18n("Miss Chance") end, desc = function() return i18n("Shows/Hides the ranged miss chance against enemies on the same level.") end, width = 1.5, + hidden = function() return UnitHasRelicSlot("player") end, disabled = function() return ((not ExtendedCharacterStats.profile.ranged.display) or (not ExtendedCharacterStats.profile.ranged.hit.display)) @@ -206,6 +203,7 @@ function _Config:LoadRangeSection() name = function() return i18n("Miss Chance Boss") end, desc = function() return i18n("Shows/Hides the ranged miss chance against boss enemies (+3 Level).") end, width = 1.5, + hidden = function() return UnitHasRelicSlot("player") end, disabled = function() return ((not ExtendedCharacterStats.profile.ranged.display) or (not ExtendedCharacterStats.profile.ranged.hit.display)) From db5cd929ea0cc8cedac9b9be4e5e85413a6a4205 Mon Sep 17 00:00:00 2001 From: Alessandro Barbieri Date: Tue, 3 Feb 2026 05:02:21 +0100 Subject: [PATCH 3/4] hide parent --- Modules/Config/RangeSection.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/Config/RangeSection.lua b/Modules/Config/RangeSection.lua index 7476df6..86d10f7 100755 --- a/Modules/Config/RangeSection.lua +++ b/Modules/Config/RangeSection.lua @@ -14,6 +14,7 @@ function _Config:LoadRangeSection() inline = false, width = 2, name = function() return i18n("Ranged") end, + hidden = function() return UnitHasRelicSlot("player") end, args = { showRangeStats = { type = "toggle", From 2f911edfc9305def6d9e6d2ecf61ad13815f23c8 Mon Sep 17 00:00:00 2001 From: Alessandro Barbieri Date: Wed, 4 Feb 2026 01:21:48 +0100 Subject: [PATCH 4/4] conditionally hide ranged in stats --- Modules/Stats.lua | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Modules/Stats.lua b/Modules/Stats.lua index e10820a..3056495 100755 --- a/Modules/Stats.lua +++ b/Modules/Stats.lua @@ -234,12 +234,19 @@ _CreateStatInfos = function() _CreateStatInfo(category, category.mainHand, category.offHand) end - category = profile.ranged - if ECS.IsWotlk then - _CreateStatInfo(category, category.attackPower, category.crit, category.penetration, category.penetrationRating, - category.hasteRating, category.hasteBonus, category.attackSpeed) - else - _CreateStatInfo(category, category.attackPower, category.crit, category.attackSpeed) + if not UnitHasRelicSlot("player") then + category = profile.ranged + _CreateStatInfo( + category, + category.attackPower, + ECS.IsClassic and nil or category.critRating, + category.crit, + ECS.IsWotlk and category.penetrationRating or nil, + ECS.IsClassic and nil or category.penetration, + ECS.IsClassic and nil or category.hasteRating, + category.hasteBonus, + category.attackSpeed + ) end if category.display then