diff --git a/Modules/Config/RangeSection.lua b/Modules/Config/RangeSection.lua index 591e33c..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", @@ -21,6 +22,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 +35,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 +49,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 +63,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 +77,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 +91,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 +105,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 +119,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 +133,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 +153,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 +170,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 +187,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 +204,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)) 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) 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