diff --git a/CHANGELOG.md b/CHANGELOG.md
index f096d640..1df9de1d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,13 +9,19 @@
- Added additional methods to RuleBookManager: ItemShouldBeAdded, BoonShouldBeAdded, SlotModShouldBeAdded, GetUnformattedPageId
- Added GetFullBoon and GetFullConsumableItemData extension methods
- Added extension methods for adding text redirects to abilities, stat icons, items, boons, slot modifications, and rulebook pages
+- Added ModificationType.SetSharedRulebook - used for slot modifications that should share their rulebook entry with other slot modifications
+- Added support for multiple rulebook sprites for slot modifications (SetRulebookP03Sprite, SetRulebookGrimoraSprite, SetRulebookMagnificusSprite)
+- Added RuleBookController.Instance.OpenToCustomPage
- Fixed RuleBook construction patches having lower patch priority than intended
+- Fixed slot modification interactable being enabled when no rulebook entry exists
+- Fixed slot modification rulebook pages not working in Act 3
+- Fixed rulebook sprites being smaller than normal after flipping to a slot modification rulebook page
- Moved ConsumableItemManager patches to a separate ConsumableItemPatches class
- Modified implementation of rulebook fill page logic to let modders patch the API logic
- Patch 'RuleBookManagerPatches.FillPage' to do this
- Tweaked how custom rulebook pages are added and detected
-- Tweaked wiki page for adding custom rulebook sections
-- Added wiki section on adding text redirects
+- Wiki: Tweaked page for adding custom rulebook sections
+- Wiki: Added section on adding text redirects
# 2.21.1
- Fixed RuleBookManager not syncing when playing with no custom rulebook sections
diff --git a/InscryptionAPI/Rulebook/RuleBookManager.cs b/InscryptionAPI/Rulebook/RuleBookManager.cs
index 2346a008..f748923d 100644
--- a/InscryptionAPI/Rulebook/RuleBookManager.cs
+++ b/InscryptionAPI/Rulebook/RuleBookManager.cs
@@ -299,6 +299,25 @@ public static string GetUnformattedPageId(string pageId)
return pageId;
}
+ ///
+ /// Opens the rulebook to the page with the given pageId.
+ ///
+ /// RuleBookController.Instance.
+ /// The value to compare each rulebook pages' id against. If this starts with "[API_" then it will check against a page's unformatted id.
+ /// Whether to offset the camera view down when opening the rulebook.
+ public static void OpenToCustomPage(this RuleBookController instance, string pageId, bool offsetView = false)
+ {
+ instance.SetShown(shown: true, offsetView);
+ int pageIndex = -1;
+ if (pageId.StartsWith(RuleBookManagerPatches.API_ID))
+ pageIndex = instance.PageData.IndexOf(instance.PageData.Find(x => !string.IsNullOrEmpty(x.pageId) && x.pageId == pageId));
+ else
+ pageIndex = instance.PageData.IndexOf(instance.PageData.Find(x => !string.IsNullOrEmpty(x.pageId) && GetUnformattedPageId(x.pageId) == pageId));
+
+ instance.StopAllCoroutines();
+ instance.StartCoroutine(instance.flipper.FlipToPage(pageIndex, 0.2f));
+ }
+
public static bool ItemShouldBeAdded(ConsumableItemData item, AbilityMetaCategory metaCategory)
{
return item.rulebookCategory == metaCategory || item.GetFullConsumableItemData()?.rulebookMetaCategories.Contains(metaCategory) == true;
diff --git a/InscryptionAPI/Rulebook/RuleBookManagerPatches.cs b/InscryptionAPI/Rulebook/RuleBookManagerPatches.cs
index cfc783fe..5f4272fc 100644
--- a/InscryptionAPI/Rulebook/RuleBookManagerPatches.cs
+++ b/InscryptionAPI/Rulebook/RuleBookManagerPatches.cs
@@ -8,7 +8,7 @@
using System.Reflection;
using System.Reflection.Emit;
using TMPro;
-using UnityEngine;
+
using static InscryptionAPI.RuleBook.RuleBookManager;
namespace InscryptionAPI.RuleBook;
@@ -112,7 +112,7 @@ private static void SyncRuleBookRedirectsForEachPage(List __re
[HarmonyPatch(typeof(ItemPage), "FillPage")]
private static bool FixFillPage(RuleBookPage __instance, string headerText, params object[] otherArgs)
{
- if (otherArgs?.Length > 0 && otherArgs.Last() is string pageId && pageId.StartsWith(API_ID))
+ if (otherArgs?.Length > 0 && otherArgs.LastOrDefault() is string pageId && pageId.StartsWith(API_ID))
{
string sectionId = pageId.Replace(API_ID, "");
FullRuleBookRangeInfo fullInfo = AllRuleBookInfos.Find(x => sectionId.StartsWith(x.SubSectionName));