diff --git a/eid_modifiers.lua b/eid_modifiers.lua index fece1af6..b087209f 100644 --- a/eid_modifiers.lua +++ b/eid_modifiers.lua @@ -422,8 +422,37 @@ if EID.isRepentance then local function TarotClothCallback(descObj) local clothBuff = EID:getDescriptionEntry("tarotClothBuffs", descObj.ObjSubType) if clothBuff ~= nil then - local iconStr = "#{{Collectible451}} " - EID:appendToDescription(descObj, iconStr..clothBuff:gsub("#",iconStr)) + -- String = append + if type(clothBuff) == "string" then + local iconStr = "#{{Collectible451}} " + EID:appendToDescription(descObj, iconStr..clothBuff:gsub("#",iconStr)) + -- Table with 1 entry = replace + elseif #clothBuff == 1 then + descObj.Description = clothBuff[1] + -- Table with 2+ entries = find and replace + -- Entry 1 is replaced with entry 2, entry 3 is replaced with entry 4, etc. + else + local pos = 1 + while pos < #clothBuff do + local toFind = clothBuff[pos] + local replaceWith = clothBuff[pos+1] + + --"%d*%.?%d+" will grab every number group (1, 10, 0.5), this will allow us to not replace the "1" in "10" erroneously + if (type(toFind) == "number") then + local count = 0 + descObj.Description = string.gsub(descObj.Description, "%d*%.?%d+", function(s) + if (s == tostring(toFind) and count == 0) then + count = count + 1 + return "{{ColorShinyPurple}}" .. replaceWith .. "{{CR}}" + end + end) + -- Basic find+replace for non-numbers + else + descObj.Description = string.gsub(descObj.Description, tostring(toFind), "{{ColorShinyPurple}}" .. replaceWith .. "{{CR}}", 1) + end + pos = pos + 2 + end + end end return descObj end