From c0c7b3aaf6dd1d586e945e7ddeab631c47f4339b Mon Sep 17 00:00:00 2001 From: Buurazu Date: Wed, 30 Mar 2022 02:34:25 -0400 Subject: [PATCH] Allow num replacing AND appending --- eid_modifiers.lua | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/eid_modifiers.lua b/eid_modifiers.lua index e3ea142e..c5d2c053 100644 --- a/eid_modifiers.lua +++ b/eid_modifiers.lua @@ -373,23 +373,28 @@ if REPENTANCE then end end) end + end --replacing a phrase, such as "half a heart" - elseif data.findReplace then + if data.findReplace then local textTable = EID:getDescriptionEntry("goldenTrinketEffects", trinketID) if textTable then descObj.Description, count = string.gsub(descObj.Description, textTable[1], "{{ColorGold}}" .. textTable[multiplier] .. "{{ColorText}}", 1) end + end --append some new text to the description - elseif data.append then + if data.append then local textTable = EID:getDescriptionEntry("goldenTrinketEffects", trinketID) if textTable then textChoice = math.min(textChoice, #textTable) -- some items have only 1 append description - descObj.Description = descObj.Description .. "#{{ColorGold}}" .. textTable[textChoice] - count = 1 + if textTable[textChoice] ~= "" then + descObj.Description = descObj.Description .. "#{{ColorGold}}" .. textTable[textChoice] + count = 1 + end end + end --the nuclear option: replacing the entire description; 1 = Gold, 2 = Mom's Box, 3 = Both --only replace if the chosen language has defined it - elseif data.fullReplace then + if data.fullReplace then local textTable = EID:getDescriptionEntry("goldenTrinketEffects", trinketID, true) if (textTable) then textChoice = math.min(textChoice, #textTable)