diff --git a/RatingBuster.lua b/RatingBuster.lua index bfbc5f6..2524a50 100644 --- a/RatingBuster.lua +++ b/RatingBuster.lua @@ -2192,6 +2192,11 @@ end local escaped_large_number_sep = LARGE_NUMBER_SEPERATOR:gsub("[-.]", "%%%1") +---@param text string +---@param link string +---@param color ColorMixin +---@param statModContext StatModContext +---@return string function RatingBuster:ProcessText(text, link, color, statModContext) -- Convert text to lower so we don't have to worry about same ratings with different cases local lowerText = text:lower() @@ -2203,6 +2208,7 @@ function RatingBuster:ProcessText(text, link, color, statModContext) -- Capture the stat name for _, statPattern in ipairs(L["statList"]) do local pattern, stat = unpack(statPattern) + ---@cast pattern string if lowerText:find(pattern) then value = value:gsub(escaped_large_number_sep, "") value = tonumber(value) @@ -2212,7 +2218,7 @@ function RatingBuster:ProcessText(text, link, color, statModContext) local effects = {} -- Group effects with identical values for statID, effect in pairs(infoTable) do - if type(statID) == "table" and statID.isPercent or statID == "Spell" then + if type(statID) == "table" and statID.isPercent or statID == "Spell" then effect = ("%+.2f"):format(effect):gsub("(%.%d-)0+$", "%1"):trim(".") .. "%" effects[effect] = effects[effect] or {} tinsert(effects[effect], S[statID]) @@ -2756,7 +2762,7 @@ EventUtil.ContinueOnAddOnLoaded("Blizzard_ReforgingUI", function() profile = db:GetCurrentProfile(), spec = RatingBuster:GetDisplayedSpec() }) - og_SetText(self, RatingBuster:ProcessText(text, nil, nil, statModContext), ...) + og_SetText(self, RatingBuster:ProcessText(text, "", {}, statModContext), ...) end end diff --git a/libs/StatLogic/StatLogic.lua b/libs/StatLogic/StatLogic.lua index e40e10e..fee5f56 100644 --- a/libs/StatLogic/StatLogic.lua +++ b/libs/StatLogic/StatLogic.lua @@ -186,19 +186,11 @@ local function newPooledTable(...) end -- New stat table -local function newStatTable(...) +---@return StatTable +local function newStatTable() local t = next(pool) or {} pool[t] = nil setmetatable(t, statTableMetatable) - - for i = 1, select('#', ...), 2 do - local k = select(i, ...) - if k then - t[k] = select(i+1, ...) - else - break - end - end return t end