From e5672ccd29b5f301e86b4142212c9219e6cf46c2 Mon Sep 17 00:00:00 2001 From: Alessandro Barbieri Date: Tue, 3 Feb 2026 03:23:09 +0100 Subject: [PATCH 1/2] hide more stats if the required skill isn't learned --- Modules/Config/DefenseSection.lua | 6 ++++++ Modules/Config/MeleeSection.lua | 3 +++ 2 files changed, 9 insertions(+) diff --git a/Modules/Config/DefenseSection.lua b/Modules/Config/DefenseSection.lua index 2d42f42..19ccc29 100755 --- a/Modules/Config/DefenseSection.lua +++ b/Modules/Config/DefenseSection.lua @@ -7,6 +7,8 @@ local Stats = ECSLoader:ImportModule("Stats") ---@type i18n local i18n = ECSLoader:ImportModule("i18n") +local IsSpellKnown = C_SpellBook.IsSpellKnown + function _Config:LoadDefenseSection() return { type = "group", @@ -140,6 +142,7 @@ function _Config:LoadDefenseSection() name = function() return i18n("Block Chance") end, desc = function() return i18n("Shows/Hides the block chance.") end, width = 1.5, + hidden = function() return not IsSpellKnown(107) end, disabled = function() return (not ExtendedCharacterStats.profile.defense.display); end, get = function () return ExtendedCharacterStats.profile.defense.blockChance.display; end, set = function (_, value) @@ -153,6 +156,7 @@ function _Config:LoadDefenseSection() name = function() return i18n("Block Value") end, desc = function() return i18n("Shows/Hides the block value.") end, width = 1.5, + hidden = function() return not IsSpellKnown(107) end, disabled = function() return (not ExtendedCharacterStats.profile.defense.display); end, get = function () return ExtendedCharacterStats.profile.defense.blockValue.display; end, set = function (_, value) @@ -166,6 +170,7 @@ function _Config:LoadDefenseSection() name = function() return i18n("Parry Chance") end, desc = function() return i18n("Shows/Hides the parry chance.") end, width = 1.5, + hidden = function() return not (IsSpellKnown(3127) or IsSpellKnown(18848) or IsSpellKnown(3124)) end, disabled = function() return (not ExtendedCharacterStats.profile.defense.display); end, get = function () return ExtendedCharacterStats.profile.defense.parry.display; end, set = function (_, value) @@ -179,6 +184,7 @@ function _Config:LoadDefenseSection() name = function() return i18n("Dodge Chance") end, desc = function() return i18n("Shows/Hides the dodge chance.") end, width = 1.5, + hidden = function() return not IsSpellKnown(81) end, disabled = function() return (not ExtendedCharacterStats.profile.defense.display); end, get = function () return ExtendedCharacterStats.profile.defense.dodge.display; end, set = function (_, value) diff --git a/Modules/Config/MeleeSection.lua b/Modules/Config/MeleeSection.lua index 19c4a90..332c170 100755 --- a/Modules/Config/MeleeSection.lua +++ b/Modules/Config/MeleeSection.lua @@ -7,6 +7,8 @@ local Stats = ECSLoader:ImportModule("Stats") ---@type i18n local i18n = ECSLoader:ImportModule("i18n") +local IsSpellKnown = C_SpellBook.IsSpellKnown + function _Config:LoadMeleeSection() return { type = "group", @@ -367,6 +369,7 @@ function _Config:LoadMeleeSection() type = "toggle", order = 2, name = function() return i18n("Off Hand") end, + hidden = function() return not IsSpellKnown(674) end, desc = function() return i18n("Shows/Hides the attack speed of the off hand.") end, width = 1.5, disabled = function() From 86201bd3594c43c4db99a244095b592ec827fdf1 Mon Sep 17 00:00:00 2001 From: Alessandro Barbieri Date: Wed, 4 Feb 2026 01:18:36 +0100 Subject: [PATCH 2/2] wip --- Modules/Config/DefenseSection.lua | 10 +++++----- Modules/Config/MeleeSection.lua | 4 +--- Modules/Data/DataUtils.lua | 17 +++++++++++++++++ Modules/Stats.lua | 29 ++++++++++++++++++++++++++--- 4 files changed, 49 insertions(+), 11 deletions(-) diff --git a/Modules/Config/DefenseSection.lua b/Modules/Config/DefenseSection.lua index 19ccc29..b5838fd 100755 --- a/Modules/Config/DefenseSection.lua +++ b/Modules/Config/DefenseSection.lua @@ -6,8 +6,8 @@ local _Config = Config.private local Stats = ECSLoader:ImportModule("Stats") ---@type i18n local i18n = ECSLoader:ImportModule("i18n") - -local IsSpellKnown = C_SpellBook.IsSpellKnown +---@type DataUtils +local DataUtils = ECSLoader:ImportModule("DataUtils") function _Config:LoadDefenseSection() return { @@ -156,7 +156,7 @@ function _Config:LoadDefenseSection() name = function() return i18n("Block Value") end, desc = function() return i18n("Shows/Hides the block value.") end, width = 1.5, - hidden = function() return not IsSpellKnown(107) end, + hidden = function() return not DataUtils:CanBlock() end, disabled = function() return (not ExtendedCharacterStats.profile.defense.display); end, get = function () return ExtendedCharacterStats.profile.defense.blockValue.display; end, set = function (_, value) @@ -170,7 +170,7 @@ function _Config:LoadDefenseSection() name = function() return i18n("Parry Chance") end, desc = function() return i18n("Shows/Hides the parry chance.") end, width = 1.5, - hidden = function() return not (IsSpellKnown(3127) or IsSpellKnown(18848) or IsSpellKnown(3124)) end, + hidden = function() return not DataUtils:CanParry() end, disabled = function() return (not ExtendedCharacterStats.profile.defense.display); end, get = function () return ExtendedCharacterStats.profile.defense.parry.display; end, set = function (_, value) @@ -184,7 +184,7 @@ function _Config:LoadDefenseSection() name = function() return i18n("Dodge Chance") end, desc = function() return i18n("Shows/Hides the dodge chance.") end, width = 1.5, - hidden = function() return not IsSpellKnown(81) end, + hidden = function() return not DataUtils:CanDodge() end, disabled = function() return (not ExtendedCharacterStats.profile.defense.display); end, get = function () return ExtendedCharacterStats.profile.defense.dodge.display; end, set = function (_, value) diff --git a/Modules/Config/MeleeSection.lua b/Modules/Config/MeleeSection.lua index 332c170..744e837 100755 --- a/Modules/Config/MeleeSection.lua +++ b/Modules/Config/MeleeSection.lua @@ -7,8 +7,6 @@ local Stats = ECSLoader:ImportModule("Stats") ---@type i18n local i18n = ECSLoader:ImportModule("i18n") -local IsSpellKnown = C_SpellBook.IsSpellKnown - function _Config:LoadMeleeSection() return { type = "group", @@ -369,7 +367,7 @@ function _Config:LoadMeleeSection() type = "toggle", order = 2, name = function() return i18n("Off Hand") end, - hidden = function() return not IsSpellKnown(674) end, + hidden = function() return not CanDualWield() end, desc = function() return i18n("Shows/Hides the attack speed of the off hand.") end, width = 1.5, disabled = function() diff --git a/Modules/Data/DataUtils.lua b/Modules/Data/DataUtils.lua index 664e8b0..3851856 100644 --- a/Modules/Data/DataUtils.lua +++ b/Modules/Data/DataUtils.lua @@ -3,6 +3,8 @@ local DataUtils = ECSLoader:CreateModule("DataUtils") ---@type Data local Data = ECSLoader:ImportModule("Data") +local IsSpellKnown = C_SpellBook.IsSpellKnown + --- Rounds every number down to the given decimal places ---@param num number ---@param decimalPlaces number @@ -142,4 +144,19 @@ function DataUtils:GetSocketedGemsFromItemLink(itemLink) return nil end +---@return boolean +function DataUtils:CanParry() + return (IsSpellKnown(3127) or IsSpellKnown(18848) or IsSpellKnown(3124)) +end + +---@return boolean +function DataUtils:CanDodge() + return IsSpellKnown(81) +end + +---@return boolean +function DataUtils:CanBlock() + return IsSpellKnown(107) +end + return DataUtils diff --git a/Modules/Stats.lua b/Modules/Stats.lua index e10820a..6a173e1 100755 --- a/Modules/Stats.lua +++ b/Modules/Stats.lua @@ -15,6 +15,8 @@ local Config = ECSLoader:ImportModule("Config") local Utils = ECSLoader:ImportModule("Utils") ---@type Data local Data = ECSLoader:ImportModule("Data") +---@type DataUtils +local DataUtils = ECSLoader:ImportModule("DataUtils") ------------------------------------------------------------------ -- Defaults @@ -231,7 +233,11 @@ _CreateStatInfos = function() end category = profile.melee.attackSpeed - _CreateStatInfo(category, category.mainHand, category.offHand) + _CreateStatInfo( + category, + category.mainHand, + CanDualWield() and category.offHand or nil + ) end category = profile.ranged @@ -248,8 +254,25 @@ _CreateStatInfos = function() end category = profile.defense - _CreateStatInfo(category, category.armor, category.meleeCritReduction, category.rangedCritReduction, category.spellCritReduction, category.avoidance, category.avoidanceBoss, - category.defenseRating, category.defense, category.blockChance, category.blockValue, category.parry, category.dodge, category.resilience) + _CreateStatInfo( + category, + category.armor, + category.meleeCritReduction, + category.rangedCritReduction, + category.spellCritReduction, + category.avoidance, + category.avoidanceBoss, + ECS.IsClassic and nil or category.defenseRating, + category.defense, + (ECS.IsClassic or not DataUtils:CanBlock()) and nil or category.blockRating, + DataUtils:CanBlock() and category.blockChance or nil, + DataUtils:CanBlock() and category.blockValue or nil, + (ECS.IsClassic or not DataUtils:CanParry()) and nil or category.parryRating, + DataUtils:CanParry() and category.parry or nil, + (ECS.IsClassic or not DataUtils:CanDodge()) and nil or category.dodgeRating, + DataUtils:CanDodge() and category.dodge or nil, + ECS.IsClassic and nil or category.resilienceRating + ) category = profile.regen _CreateStatInfo(category, category.mp5Items, category.mp5Spirit, category.mp5Buffs, category.mp5Casting, category.mp5NotCasting)