Skip to content

Commit

Permalink
Some Classic Era stats show percentages in options menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Anonomit committed Dec 20, 2023
1 parent a24aff4 commit 43d9ca6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Config/OptionsTables.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
3 changes: 3 additions & 0 deletions Stats/Stats.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 43d9ca6

Please sign in to comment.