Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,8 @@ stds.ecs = {
"CR_HIT_RANGED",
"CR_HIT_SPELL",
"CR_PARRY",
"CR_RESILIENCE_CRIT_TAKEN",
"CR_RESILIENCE_PLAYER_DAMAGE_TAKEN",
"CR_WEAPON_SKILL",
"CreateFont",
"CreateFrame",
Expand Down Expand Up @@ -1196,6 +1198,7 @@ stds.ecs = {
"GetMirrorTimerProgress",
"GetModifiedClick",
"GetModifiedClickAction",
"GetModResilienceDamageReduction",
"GetMoney",
"GetMonitorAspectRatio",
"GetMonitorCount",
Expand Down
16 changes: 15 additions & 1 deletion Modules/Config/DefenseSection.lua
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,23 @@ function _Config:LoadDefenseSection()
Stats.RebuildStatInfos()
end,
},
resilience = {
resilienceRating = {
type = "toggle",
order = 7,
name = function() return i18n("Resilience rating") end,
desc = function() return i18n("Shows/Hides the resilience rating.") end,
width = 1.5,
hidden = function() return ECS.IsClassic end,
disabled = function() return (not ExtendedCharacterStats.profile.defense.display); end,
get = function () return ExtendedCharacterStats.profile.defense.resilienceRating.display; end,
set = function (_, value)
ExtendedCharacterStats.profile.defense.resilienceRating.display = value
Stats.RebuildStatInfos()
end,
},
resilience = {
type = "toggle",
order = 8,
name = function() return i18n("Resilience") end,
desc = function() return i18n("Shows/Hides the resilience value.") end,
width = 1.5,
Expand Down
5 changes: 4 additions & 1 deletion Modules/Data/Data.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
local IsClassic = ECS.IsClassic

---@class Data
local Data = ECSLoader:CreateModule("Data")

Expand Down Expand Up @@ -66,7 +68,8 @@ dataFunctionRefs = {
["ParryChance"] = function() return Data:GetParryChance() end,
["BlockChance"] = function() return Data:GetBlockChance() end,
["BlockValue"] = function() return Data:GetBlockValue() end,
["ResilienceValue"] = function() return ECS.IsClassic and 0 or Data:GetResilienceRating() end,
["ResilienceRating"] = function() return IsClassic and 0 or Data:GetResilienceRating() end,
["Resilience"] = function() return IsClassic and 0 or Data:GetResilience() end,
-- Spell
["SpellHitRating"] = function() return ECS.IsClassic and 0 or Data:SpellHitRating() end,
["SpellHitBonus"] = function() return Data.SpellHitBonus(Data.HOLY_SCHOOL) end,
Expand Down
16 changes: 14 additions & 2 deletions Modules/Data/Defense.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function _Defense:GetCritReduction()
local meleeCritReduction = 0
local rangedCritReduction = 0
local spellCritReduction = 0
local critReducingFromResilience = 0
local i = 1
repeat
local aura = C_UnitAuras.GetAuraDataByIndex("player", i, "HELPFUL")
Expand Down Expand Up @@ -60,7 +61,9 @@ function _Defense:GetCritReduction()
if critReductionFromDefense < 0 then
critReductionFromDefense = 0
end
local critReducingFromResilience = GetCombatRatingBonus(15)
if CR_RESILIENCE_CRIT_TAKEN then
critReducingFromResilience = GetCombatRatingBonus(CR_RESILIENCE_CRIT_TAKEN)
end

if classId == Data.DRUID then
local coeff = ECS.IsWotlk and 2 or 1
Expand Down Expand Up @@ -219,7 +222,16 @@ end

---@return number
function Data:GetResilienceRating()
return DataUtils:Round(GetCombatRating(15), 2)
local rating = 0
if CR_RESILIENCE_PLAYER_DAMAGE_TAKEN then
rating = GetCombatRating(CR_RESILIENCE_PLAYER_DAMAGE_TAKEN)
end
return DataUtils:Round(rating, 2)
end

---@return number
function Data:GetResilience()
return DataUtils:Round(GetModResilienceDamageReduction(), 2)
end

---@return number
Expand Down
11 changes: 5 additions & 6 deletions Modules/Migration.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ function Migration:ToLatestProfileVersion(profileVersion)
return
end

if profileVersion < 24 then
ExtendedCharacterStats.profile.defense.resilienceRating = ExtendedCharacterStats.profile.defense.resilience
ExtendedCharacterStats.profile.defense.resilience = nil
end
if profileVersion < 25 then
ExtendedCharacterStats.profile.defense.resilience = nil
local defaultProfile = Profile:GetDefaultProfile()

if profileVersion < 26 then
ExtendedCharacterStats.profile.defense.resilience = defaultProfile.profile.defense.resilience
ExtendedCharacterStats.profile.defense.resilienceRating = defaultProfile.profile.defense.resilienceRating
end
end
9 changes: 7 additions & 2 deletions Modules/Profile.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ local Utils = ECSLoader:ImportModule("Utils")

---@return number
function Profile.GetProfileVersion()
return 25
return 26
end

---@return ECSProfile
Expand Down Expand Up @@ -286,7 +286,12 @@ local function GetDefaultStatsProfile()
dodge = {display = true, refName = "DodgeChance", text = "Dodge Chance"},
resilienceRating = {
display = true,
refName = "ResilienceValue",
refName = "ResilienceRating",
text = "Resilience rating"
},
resilience = {
display = true,
refName = "Resilience",
text = "Resilience"
},
},
Expand Down
5 changes: 4 additions & 1 deletion Modules/Stats.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
local IsClassic = ECS.IsClassic

------------------------------------------------------------------
-- Modules
------------------------------------------------------------------
Expand Down Expand Up @@ -290,7 +292,8 @@ _CreateStatInfos = function()
DataUtils:CanParry() and category.parry or nil,
(not ECS.IsClassic) and category.dodgeRating or nil,
category.dodge or nil,
(not ECS.IsClassic) and category.resilienceRating or nil
(not IsClassic) and category.resilienceRating or nil,
(not IsClassic) and category.resilience or nil
)

if UnitHasMana("player") then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,16 @@ local defenseConfigTranslations = {
["esMX"] = false,
["ptBR"] = false
},
["Shows/Hides the resilience rating."] = {
["enUS"] = true,
["deDE"] = false,
["frFR"] = false,
["zhCN"] = false,
["ruRU"] = false,
["esES"] = false,
["esMX"] = false,
["ptBR"] = false,
},
}

for k, v in pairs(defenseConfigTranslations) do
Expand Down
10 changes: 10 additions & 0 deletions Modules/i18n/translations/StatTranslations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,16 @@ local statTranslations = {
["esMX"] = "Probabilidad de esquivar",
["ptBR"] = "Chance de esquivar"
},
["Resilience rating"] = {
["enUS"] = true,
["deDE"] = false,
["frFR"] = false,
["zhCN"] = false,
["ruRU"] = false,
["esES"] = false,
["esMX"] = false,
["ptBR"] = false,
},
["Resilience"] = {
["enUS"] = true,
["deDE"] = "Abhärtung",
Expand Down
Loading