Skip to content

Commit

Permalink
v1.7.1 - fixed ability error
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottWilson0903 committed Nov 7, 2021
1 parent 1127056 commit 4626a80
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>API</AssemblyName>
<Description>An API for inscryption</Description>
<Version>1.7.0.0</Version>
<Version>1.7.1.0</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>9.0</LangVersion>
</PropertyGroup>
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Changelog
## v1.7.1
- Fixed error when not adding any abilities.

## v1.7
- Added support for custom abilities!

Expand Down
25 changes: 14 additions & 11 deletions Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -755,16 +755,19 @@ public class RuleBookInfo_ConstructPageData
{
public static void Postfix(AbilityMetaCategory metaCategory, RuleBookInfo __instance, ref List<RuleBookPageInfo> __result)
{
foreach (PageRangeInfo pageRangeInfo in __instance.pageRanges) {
if (pageRangeInfo.type == PageRangeType.Abilities)
{
List<int> customAbilities = NewAbility.abilities.Select(x => (int)x.ability).ToList();
int min = customAbilities.AsQueryable().Min();
int max = customAbilities.AsQueryable().Max();
PageRangeInfo pageRange = pageRangeInfo;
Func<int, bool> 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<RuleBookPageInfo, PageRangeInfo, int>(__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<int> customAbilities = NewAbility.abilities.Select(x => (int)x.ability).ToList();
int min = customAbilities.AsQueryable().Min();
int max = customAbilities.AsQueryable().Max();
PageRangeInfo pageRange = pageRangeInfo;
Func<int, bool> 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<RuleBookPageInfo, PageRangeInfo, int>(__instance.FillAbilityPage), Localization.Translate("APPENDIX XII, SUBSECTION I - MOD ABILITIES {0}")));
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down

0 comments on commit 4626a80

Please sign in to comment.