ItemReminder: Added feature to reduce length of descriptions shown on the overview page

This commit is contained in:
Wofsauge committed 2024-05-03 18:50:14 +02:00
1 parent 6ff51b782e
commit 13c25fc8de
2 files changed
+26 -1

No files matched your search

+4
View File
@@ -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 -- 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 -- Default = ButtonAction.ACTION_SHOOTUP
["ItemReminderNavigateUpButton"] = 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 -- Default = 3
["ItemReminderMaxEntriesCount"] = 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 -- 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, ["ItemReminderNavigateRightButton"] = ButtonAction.ACTION_SHOOTRIGHT,
["ItemReminderNavigateDownButton"] = ButtonAction.ACTION_SHOOTDOWN, ["ItemReminderNavigateDownButton"] = ButtonAction.ACTION_SHOOTDOWN,
["ItemReminderNavigateUpButton"] = ButtonAction.ACTION_SHOOTUP, ["ItemReminderNavigateUpButton"] = ButtonAction.ACTION_SHOOTUP,
["ItemReminderOverviewHideAfterRows"] = 2,
["ItemReminderMaxEntriesCount"] = 5, ["ItemReminderMaxEntriesCount"] = 5,
["ItemReminderShowHiddenInfo"] = false, ["ItemReminderShowHiddenInfo"] = false,
["ItemReminderShowRNGCheats"] = false, ["ItemReminderShowRNGCheats"] = false,
+22 -1
View File
@@ -493,6 +493,21 @@ function EID:ItemReminderGetTitle()
return combinedText return combinedText
end 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() function EID:ItemReminderGetDescription()
EID.InsideItemReminder = true EID.InsideItemReminder = true
EID.ItemReminderTempDescriptions = {} EID.ItemReminderTempDescriptions = {}
@@ -580,7 +595,13 @@ function EID:ItemReminderGetDescription()
-- Default: put all descriptions into one long description -- Default: put all descriptions into one long description
for _, entry in ipairs(EID.ItemReminderTempDescriptions) do 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 end
EID.InsideItemReminder = false EID.InsideItemReminder = false