Skip to content

Commit 7d11d6f

Browse files
pre-release
1 parent 6cb3683 commit 7d11d6f

5 files changed

Lines changed: 27 additions & 27 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,20 @@
22
<summary>View Changelog</summary>
33

44
# 2.22.0
5-
- Added AllFullBoons list to BoonManager
6-
- Added FullConsumableItemData to ConsumableItemManager
75
- Added FullBoon objects for each vanilla Boon
8-
- Added RuleBookManager.GetUnformattedPageId for retrieving a pageId without the API identifier
9-
- Added support for rulebook text redirects
10-
- Added GetFullBoon and GetFullConsumableItemData extension methods
6+
- Added 'AllFullBoons' list to BoonManager
117
- Added support for boons and items appearing in multiple acts' rulebooks
12-
- Added metaCategories field to FullBoon
13-
- Added BoonShouldBeAdded method to BoonManager
14-
- Added ItemShouldBeAdded method to ConsumableItemPatches
8+
- Added RuleBookRedirectManager and support for rulebook text redirects/page links
9+
- Added additional methods to RuleBookManager: ItemShouldBeAdded, BoonShouldBeAdded, SlotModShouldBeAdded, GetUnformattedPageId
10+
- Added GetFullBoon and GetFullConsumableItemData extension methods
11+
- Added extension methods for adding text redirects to abilities, stat icons, items, boons, slot modifications, and rulebook pages
1512
- Fixed RuleBook construction patches having lower patch priority than intended
16-
- Moved ConsumableItemManager patches to ConsumableItemPatches class
17-
- Changed patch to LoadPage from a prefix to a transpiler to avoid mod conflicts
18-
- modders can modify this transpiler by overriding
13+
- Moved ConsumableItemManager patches to a separate ConsumableItemPatches class
14+
- Modified implementation of rulebook fill page logic to let modders patch the API logic
15+
- Patch 'RuleBookManagerPatches.FillPage' to do this
1916
- Tweaked how custom rulebook pages are added and detected
20-
- Tweaked wiki page for adding custom rulebook sections, added additional section on text redirects
17+
- Tweaked wiki page for adding custom rulebook sections
18+
- Added wiki section on adding text redirects
2119

2220
# 2.21.1
2321
- Fixed RuleBookManager not syncing when playing with no custom rulebook sections

InscryptionAPI/Boons/BoonManager.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ private static void ConstructPageData(ref List<RuleBookPageInfo> __result, RuleB
342342
{
343343
int insertPosition = __result.FindLastIndex(rbi => rbi.pagePrefab == pageRangeInfo.rangePrefab) + 1;
344344
int curPageNum = (int)BoonData.Type.NUM_TYPES;
345-
List<FullBoon> abilitiesToAdd = NewBoons.Where(x => BoonShouldBeAdded(x, metaCategory)).ToList();
345+
List<FullBoon> abilitiesToAdd = NewBoons.Where(x => RuleBookManager.BoonShouldBeAdded(x, metaCategory)).ToList();
346346
//InscryptionAPIPlugin.Logger.LogInfo($"Adding {abilitiesToAdd.Count} out of {NewAbilities.Count} abilities to rulebook");
347347
foreach (FullBoon fboo in abilitiesToAdd)
348348
{
@@ -357,9 +357,4 @@ private static void ConstructPageData(ref List<RuleBookPageInfo> __result, RuleB
357357
}
358358
}
359359
}
360-
361-
public static bool BoonShouldBeAdded(FullBoon fullBoon, AbilityMetaCategory metaCategory)
362-
{
363-
return fullBoon?.boon?.icon != null && fullBoon.appearInRulebook && fullBoon.metaCategories.Contains(metaCategory);
364-
}
365360
}

InscryptionAPI/Items/ConsumableItemPatches.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using InscryptionAPI.Boons;
44
using InscryptionAPI.Helpers;
55
using InscryptionAPI.Items.Extensions;
6+
using InscryptionAPI.RuleBook;
67
using System;
78
using System.Collections;
89
using System.Collections.Generic;
@@ -201,14 +202,9 @@ public static List<RuleBookPageInfo> ConstructItemPages(RuleBookInfo instance, P
201202
{
202203
List<ConsumableItemData> allConsumables = ItemsUtil.AllConsumables;
203204
return instance.ConstructPages(pageRange, allConsumables.Count, 0,
204-
(int index) => ItemShouldBeAdded(allConsumables[index], metaCategory),
205+
(int index) => RuleBookManager.ItemShouldBeAdded(allConsumables[index], metaCategory),
205206
instance.FillItemPage,
206207
Localization.Translate("APPENDIX XII, SUBSECTION IX - ITEMS {0}")
207208
);
208209
}
209-
210-
public static bool ItemShouldBeAdded(ConsumableItemData item, AbilityMetaCategory metaCategory)
211-
{
212-
return item.rulebookCategory == metaCategory || item.GetFullConsumableItemData()?.rulebookMetaCategories.Contains(metaCategory) == true;
213-
}
214210
}

InscryptionAPI/Rulebook/RuleBookManager.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
using System.Collections.ObjectModel;
1010
using System.Reflection;
1111
using UnityEngine;
12+
using static InscryptionAPI.Boons.BoonManager;
13+
using static InscryptionAPI.Slots.SlotModificationManager;
14+
1215
namespace InscryptionAPI.RuleBook;
1316

1417

@@ -295,4 +298,14 @@ public static string GetUnformattedPageId(string pageId)
295298

296299
return pageId;
297300
}
301+
302+
public static bool ItemShouldBeAdded(ConsumableItemData item, AbilityMetaCategory metaCategory)
303+
{
304+
return item.rulebookCategory == metaCategory || item.GetFullConsumableItemData()?.rulebookMetaCategories.Contains(metaCategory) == true;
305+
}
306+
public static bool BoonShouldBeAdded(FullBoon fullBoon, AbilityMetaCategory metaCategory)
307+
{
308+
return fullBoon?.boon?.icon != null && fullBoon.appearInRulebook && fullBoon.metaCategories.Contains(metaCategory);
309+
}
310+
public static bool SlotModShouldBeAdded(Info info, ModificationMetaCategory category) => info.RulebookName != null && info.MetaCategories.Contains(category);
298311
}

InscryptionAPI/Slots/SlotModificationManager.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ private static void AddSlotModificationsToRuleBook(AbilityMetaCategory metaCateg
527527
//InscryptionAPIPlugin.Logger.LogInfo($"In rulebook patch: I see {AllModificationInfos.Count}");
528528
if (AllModificationInfos.Count > 0)
529529
{
530-
List<Info> infos = AllModificationInfos.Where(x => SlotModShouldBeAdded(x, (ModificationMetaCategory)metaCategory)).ToList();
530+
List<Info> infos = AllModificationInfos.Where(x => RuleBookManager.SlotModShouldBeAdded(x, (ModificationMetaCategory)metaCategory)).ToList();
531531
if (infos.Count == 0)
532532
return;
533533

@@ -552,8 +552,6 @@ private static void AddSlotModificationsToRuleBook(AbilityMetaCategory metaCateg
552552
}
553553
}
554554

555-
public static bool SlotModShouldBeAdded(Info info, ModificationMetaCategory category) => info.RulebookName != null && info.MetaCategories.Contains(category);
556-
557555
public const string SLOT_PAGEID = "SlotModification_";
558556

559557
[HarmonyPrefix, HarmonyPatch(typeof(ItemPage), nameof(ItemPage.FillPage))]

0 commit comments

Comments
 (0)