Skip to content

Commit

Permalink
Kaycee's error patch
Browse files Browse the repository at this point in the history
  • Loading branch information
IngoHHacks committed Feb 9, 2022
1 parent 2bdb26e commit bc36345
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 4 deletions.
10 changes: 9 additions & 1 deletion API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>API</AssemblyName>
<Description>An API for inscryption</Description>
<Version>1.13.1.0</Version>
<Version>1.13.2.0</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>9.0</LangVersion>
<DebugType>full</DebugType>
Expand All @@ -28,5 +28,13 @@
<HintPath>lib\Sirenix.Serialization.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Unity.TextMeshPro">
<HintPath>lib\Unity.TextMeshPro.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>lib\UnityEngine.UI.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
</Project>
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## v1.13.2-nonkc
- Using normal API with Kaycee's Mod now shows an error.

## v1.13.1-nonkc
- Fix for JSONLoader cards
- Fix not allowing base game and modded special abilites on the same card
Expand Down
25 changes: 23 additions & 2 deletions Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine.SceneManagement;
using TMPro;
using UnityEngine;
using System.Linq;
using System.Collections;

#pragma warning disable 169

Expand All @@ -13,7 +17,7 @@ public partial class Plugin : BaseUnityPlugin
{
private const string PluginGuid = "cyantist.inscryption.api";
private const string PluginName = "API";
private const string PluginVersion = "1.13.1";
private const string PluginVersion = "1.13.2";

internal static ManualLogSource Log;
internal static ConfigEntry<bool> configEnergy;
Expand All @@ -32,7 +36,24 @@ private void Awake()
configDroneMox = Config.Bind("Mox","Mox Drone",false,"Drone displays mox (requires Energy Drone and Mox Refresh)");

Harmony harmony = new Harmony(PluginGuid);
harmony.PatchAll();
try
{
harmony.PatchAll();
}
catch
{
Log.LogError("Failed to apply patches for API. Are you using Kaycee's Mod?");
StartCoroutine(KayceeError());
}
}

private IEnumerator KayceeError()
{
AsyncOperation asyncOp = SceneLoader.StartAsyncLoad("CorruptedSaveMessage");
yield return new WaitUntil(() => asyncOp.isDone);
GameObject[] objects = SceneManager.GetSceneByName("CorruptedSaveMessage").GetRootGameObjects();
TextMeshProUGUI text = objects.ToList().Find(name => name.name == "Screen").GetComponentInChildren<TextMeshProUGUI>();
text.text = "Oh no! It looks like you're using the <color=#FB3F4F>normal API</color>\nfor Kaycee's Mod.\nYou need to use Kaycee's API if you want to use\nmods for Kaycee's Mod, or switch back to the base\ngame through Steam.\nKeep in mind that some mods may require a\ndifferent version to work, or are entirely\nincompatible with Kaycee's Mod.\n\n(Press Escape to quit)";
}

private void Start()
Expand Down
Binary file added lib/Unity.TextMeshPro.dll
Binary file not shown.
Binary file added lib/UnityEngine.UI.dll
Binary file not shown.
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.13.1",
"version_number": "1.13.2",
"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 bc36345

Please sign in to comment.