From 4626a80b07c2bd7aa5af8a14c73bc4cc442235c2 Mon Sep 17 00:00:00 2001 From: Scott Wilson Date: Sun, 7 Nov 2021 00:48:59 +0000 Subject: [PATCH] v1.7.1 - fixed ability error --- API.csproj | 2 +- CHANGELOG.md | 3 +++ Plugin.cs | 25 ++++++++++++++----------- manifest.json | 2 +- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/API.csproj b/API.csproj index f0bef76d..f4a49c9b 100644 --- a/API.csproj +++ b/API.csproj @@ -4,7 +4,7 @@ netstandard2.0 API An API for inscryption - 1.7.0.0 + 1.7.1.0 true 9.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dd9e162..cf703db8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ # Changelog +## v1.7.1 +- Fixed error when not adding any abilities. + ## v1.7 - Added support for custom abilities! diff --git a/Plugin.cs b/Plugin.cs index 1823a6a9..27d098bf 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -14,7 +14,7 @@ public class Plugin : BaseUnityPlugin { private const string PluginGuid = "cyantist.inscryption.api"; private const string PluginName = "API"; - private const string PluginVersion = "1.7.0.0"; + private const string PluginVersion = "1.7.1.0"; internal static ManualLogSource Log; @@ -755,16 +755,19 @@ public class RuleBookInfo_ConstructPageData { public static void Postfix(AbilityMetaCategory metaCategory, RuleBookInfo __instance, ref List __result) { - foreach (PageRangeInfo pageRangeInfo in __instance.pageRanges) { - if (pageRangeInfo.type == PageRangeType.Abilities) - { - List customAbilities = NewAbility.abilities.Select(x => (int)x.ability).ToList(); - int min = customAbilities.AsQueryable().Min(); - int max = customAbilities.AsQueryable().Max(); - PageRangeInfo pageRange = pageRangeInfo; - Func doAddPageFunc; - doAddPageFunc = (int index) => customAbilities.Contains(index) && AbilitiesUtil.GetInfo((Ability)index).metaCategories.Contains(metaCategory); - __result.AddRange(__instance.ConstructPages(pageRange, max+1, min, doAddPageFunc, new Action(__instance.FillAbilityPage), Localization.Translate("APPENDIX XII, SUBSECTION I - MOD ABILITIES {0}"))); + if (NewAbility.abilities.Count > 0) + { + foreach (PageRangeInfo pageRangeInfo in __instance.pageRanges) { + if (pageRangeInfo.type == PageRangeType.Abilities) + { + List customAbilities = NewAbility.abilities.Select(x => (int)x.ability).ToList(); + int min = customAbilities.AsQueryable().Min(); + int max = customAbilities.AsQueryable().Max(); + PageRangeInfo pageRange = pageRangeInfo; + Func doAddPageFunc; + doAddPageFunc = (int index) => customAbilities.Contains(index) && AbilitiesUtil.GetInfo((Ability)index).metaCategories.Contains(metaCategory); + __result.AddRange(__instance.ConstructPages(pageRange, max+1, min, doAddPageFunc, new Action(__instance.FillAbilityPage), Localization.Translate("APPENDIX XII, SUBSECTION I - MOD ABILITIES {0}"))); + } } } } diff --git a/manifest.json b/manifest.json index 5effcfc9..cc8e6a21 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name": "API", - "version_number": "1.7.0", + "version_number": "1.7.1", "website_url": "https://github.com/ScottWilson0903/InscryptionAPI", "description": "This plugin is a BepInEx plugin made for Inscryption as an API. It can currently create custom cards and abilities and inject them into the data pool, or modify existing cards in the card pool.", "dependencies": [