From 13c25fc8de84097df7b23750bfc7ec76df1ffb10 Mon Sep 17 00:00:00 2001 From: Wofsauge Date: Fri, 3 May 2024 18:50:14 +0200 Subject: [PATCH] ItemReminder: Added feature to reduce length of descriptions shown on the overview page --- eid_config.lua | 4 ++++ eid_holdmapdesc.lua | 23 ++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/eid_config.lua b/eid_config.lua index 7689a0aa..d85e9a14 100644 --- a/eid_config.lua +++ b/eid_config.lua @@ -346,6 +346,9 @@ EID.UserConfig = { -- Look into the AB+ or Repentance documentation for the key names here: https://wofsauge.github.io/IsaacDocs/rep/enums/ButtonAction.html -- Default = ButtonAction.ACTION_SHOOTUP ["ItemReminderNavigateUpButton"] = ButtonAction.ACTION_SHOOTUP, + -- Limits the number of description bullet points to be displayed on the overview page for each item + -- Default = 2 + ["ItemReminderOverviewHideAfterRows"] = 2, -- Default = 3 ["ItemReminderMaxEntriesCount"] = 3, -- Items that grant you items without saying what they are (like Zodiac, Liberty Cap) can have their current granted item revealed in the Item Reminder @@ -602,6 +605,7 @@ EID.DefaultConfig = { ["ItemReminderNavigateRightButton"] = ButtonAction.ACTION_SHOOTRIGHT, ["ItemReminderNavigateDownButton"] = ButtonAction.ACTION_SHOOTDOWN, ["ItemReminderNavigateUpButton"] = ButtonAction.ACTION_SHOOTUP, + ["ItemReminderOverviewHideAfterRows"] = 2, ["ItemReminderMaxEntriesCount"] = 5, ["ItemReminderShowHiddenInfo"] = false, ["ItemReminderShowRNGCheats"] = false, diff --git a/eid_holdmapdesc.lua b/eid_holdmapdesc.lua index 6685424b..0651365a 100644 --- a/eid_holdmapdesc.lua +++ b/eid_holdmapdesc.lua @@ -493,6 +493,21 @@ function EID:ItemReminderGetTitle() return combinedText end +-- trim all entries to make them shorter, by removing bullet points +function EID:ItemReminderTrimBulletPoints(description) + local trimmedDescription = "" + local bulletPointsToPrint = EID.Config["ItemReminderOverviewHideAfterRows"] + for bulletPoint in string.gmatch(description, "[^#]+") do + if bulletPointsToPrint <= 0 or bulletPoint == "" then + trimmedDescription = trimmedDescription .. "..." .. "#" + break + end + trimmedDescription = trimmedDescription .. bulletPoint .. "#" + bulletPointsToPrint = bulletPointsToPrint - 1 + end + return trimmedDescription +end + function EID:ItemReminderGetDescription() EID.InsideItemReminder = true EID.ItemReminderTempDescriptions = {} @@ -580,7 +595,13 @@ function EID:ItemReminderGetDescription() -- Default: put all descriptions into one long description for _, entry in ipairs(EID.ItemReminderTempDescriptions) do - finalHoldMapDesc = finalHoldMapDesc .. entry[1] .. " {{ColorEIDObjName}}" .. entry[2] .. "#" .. entry[3] .. "#" + local description = entry[3] .. "#" + + if EID.ItemReminderSelectedCategory == 0 then + description = EID:ItemReminderTrimBulletPoints(description) + end + + finalHoldMapDesc = finalHoldMapDesc .. entry[1] .. " {{ColorEIDObjName}}" .. entry[2] .. "#" .. description end EID.InsideItemReminder = false