From 43d9ca6c3b068bbd22b1e7e6f3c59c7c2e36396f Mon Sep 17 00:00:00 2001 From: Anonomit Date: Wed, 20 Dec 2023 01:39:38 -0500 Subject: [PATCH] Some Classic Era stats show percentages in options menu --- Config/OptionsTables.lua | 7 +++++-- Stats/Stats.lua | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Config/OptionsTables.lua b/Config/OptionsTables.lua index 6042baf..68d23a2 100644 --- a/Config/OptionsTables.lua +++ b/Config/OptionsTables.lua @@ -323,13 +323,16 @@ end -- ███████║ ██║ ██║ ██║ ██║ ╚██████╔╝██║ ██║ ██║╚██████╔╝██║ ╚████║███████║ -- ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝ +local percentStats = Addon:MakeLookupTable{"Dodge Rating", "Parry Rating", "Block Rating", "Hit Rating", "Physical Hit Rating", "Physical Critical Strike Rating", "Spell Hit Rating", "Spell Critical Strike Rating"} local sampleNumber = 10 local function CreateStatOption(opts, i, stat) local self = Addon local GUI = self.GUI - local defaultText = GetDefaultStatText(sampleNumber, stat) - local formattedText = GetFormattedStatText(sampleNumber, stat) + local percent = Addon.isClassic and percentStats[stat] and "%" or "" + + local defaultText = GetDefaultStatText(sampleNumber .. percent, stat) + local formattedText = GetFormattedStatText(sampleNumber .. percent, stat) local opts = GUI:CreateGroup(opts, stat, formattedText, GetStatNormalName(stat), "tab") diff --git a/Stats/Stats.lua b/Stats/Stats.lua index efaf6f8..51d13f8 100644 --- a/Stats/Stats.lua +++ b/Stats/Stats.lua @@ -361,6 +361,9 @@ do function StatInfo:GetDefaultForm(number) local strNumber = tostring(number) + if type(number) == "string" then + number = tonumber(strMatch(number, "%d+")) + end if DECIMAL_SEPERATOR ~= "." then strNumber = strGsub(strNumber, "%.", DECIMAL_SEPERATOR) end