From 228705829ab6c20827cb13424daa427355ec4957 Mon Sep 17 00:00:00 2001 From: Chaosyr Date: Sun, 13 Sep 2026 11:54:55 -0400 Subject: [PATCH 1/6] Implement StarterDeckExtensions for IconTexture. --- .../Ascension/StarterDeckExtensions.cs | 12 ++++ .../StarterDeckExtensionsPortraits.cs | 56 +++++++++++++++++++ InscryptionAPI/InscryptionAPI.csproj | 2 +- 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 InscryptionAPI/Ascension/StarterDeckExtensions.cs create mode 100644 InscryptionAPI/Ascension/StarterDeckExtensionsPortraits.cs diff --git a/InscryptionAPI/Ascension/StarterDeckExtensions.cs b/InscryptionAPI/Ascension/StarterDeckExtensions.cs new file mode 100644 index 00000000..dad230e2 --- /dev/null +++ b/InscryptionAPI/Ascension/StarterDeckExtensions.cs @@ -0,0 +1,12 @@ +using InscryptionAPI.Helpers; +using UnityEngine; + +namespace InscryptionAPI.Ascension; + +public static partial class StarterDeckExtensions +{ + private static Sprite GetPortrait(Texture2D portrait, TextureHelper.SpriteType spriteType, FilterMode? filterMode = null) + { + return portrait.ConvertTexture(spriteType, filterMode ?? FilterMode.Point); + } +} diff --git a/InscryptionAPI/Ascension/StarterDeckExtensionsPortraits.cs b/InscryptionAPI/Ascension/StarterDeckExtensionsPortraits.cs new file mode 100644 index 00000000..14889232 --- /dev/null +++ b/InscryptionAPI/Ascension/StarterDeckExtensionsPortraits.cs @@ -0,0 +1,56 @@ +using DiskCardGame; +using InscryptionAPI.Helpers; +using UnityEngine; + +namespace InscryptionAPI.Ascension; + +public static partial class StarterDeckExtensions +{ + #region iconTexture + /// + /// Sets the icon texture for the starter deck. + /// + /// StarterDeckInfo to access. + /// The path to the .png file containing the artwork (relative to the Plugins directory). + /// The same StarterDeckInfo so a chain can continue. + public static StarterDeckInfo SetIconTexture(this StarterDeckInfo info, string pathToArt) + { + try + { + return info.SetIconTexture(TextureHelper.GetImageAsTexture(pathToArt)); + } + catch (FileNotFoundException fnfe) + { + throw new ArgumentException($"Image file not found for card \"{info.name}\"!", fnfe); + } + } + + /// + /// Sets the icon texture for the starter deck. + /// + /// StarterDeckInfo to access. + /// The texture containing the emission. + /// The filter mode for the texture, or null if no change. + /// The same StarterDeckInfo so a chain can continue. + public static StarterDeckInfo SetIconTexture(this StarterDeckInfo info, Texture2D portrait, FilterMode? filterMode = null) + { + return info.SetIconTexture(GetPortrait(portrait, TextureHelper.SpriteType.CardPortrait, filterMode)); + } + + /// + /// Sets the icon texture for the starter deck. + /// + /// StarterDeckInfo to access. + /// The sprite containing the emission. + /// The same StarterDeckInfo so a chain can continue. + public static StarterDeckInfo SetIconTexture(this StarterDeckInfo info, Sprite sprite) + { + if (info.iconSprite == null) + throw new InvalidOperationException($"Cannot set emissive portrait before setting normal portrait!"); + + info.iconSprite.RegisterEmissionForSprite(sprite); + + return info; + } + #endregion +} diff --git a/InscryptionAPI/InscryptionAPI.csproj b/InscryptionAPI/InscryptionAPI.csproj index bfc82bfc..27de0776 100644 --- a/InscryptionAPI/InscryptionAPI.csproj +++ b/InscryptionAPI/InscryptionAPI.csproj @@ -10,7 +10,7 @@ full false true - 2.24.0 + 2.24.1 From 29b4d19df3b052d82ecc45e9d9d6264a171bd552 Mon Sep 17 00:00:00 2001 From: Chaosyr Date: Sun, 13 Sep 2026 11:59:34 -0400 Subject: [PATCH 2/6] Add A FullStarterDeck Creation Option accounting for the Title --- InscryptionAPI/Ascension/StarterDeckManager.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/InscryptionAPI/Ascension/StarterDeckManager.cs b/InscryptionAPI/Ascension/StarterDeckManager.cs index 4765ef10..9ec5bafa 100644 --- a/InscryptionAPI/Ascension/StarterDeckManager.cs +++ b/InscryptionAPI/Ascension/StarterDeckManager.cs @@ -149,6 +149,23 @@ public static FullStarterDeck New(string pluginGuid, string title, Texture2D ico return fsd; } + + public static FullStarterDeck New(string pluginGuid, string name, string title, Texture2D iconTexture, string[] cardNames, int unlockLevel = 0) + { + StarterDeckInfo info = ScriptableObject.CreateInstance(); + info.title = title; + info.iconSprite = TextureHelper.ConvertTexture(iconTexture, TextureHelper.SpriteType.StarterDeckIcon); + info.name = pluginGuid + "_" + name; + + FullStarterDeck fsd = new(); + fsd.Info = info; + fsd.UnlockLevel = unlockLevel; + fsd.CardNames = cardNames.ToList(); + + NewDecks.Add(fsd); + + return fsd; + } public static FullStarterDeck New(string pluginGuid, string title, string pathToIconTexture, string[] cardNames, int unlockLevel = 0) { From fa56ce47d00b48705dbcafc9564b5a00fe57a5b5 Mon Sep 17 00:00:00 2001 From: Chaosyr Date: Sun, 13 Sep 2026 12:01:20 -0400 Subject: [PATCH 3/6] Add A FullStarterDeck Creation Option accounting for the Title with path to IconTexture. --- InscryptionAPI/Ascension/StarterDeckManager.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/InscryptionAPI/Ascension/StarterDeckManager.cs b/InscryptionAPI/Ascension/StarterDeckManager.cs index 9ec5bafa..2b5e3680 100644 --- a/InscryptionAPI/Ascension/StarterDeckManager.cs +++ b/InscryptionAPI/Ascension/StarterDeckManager.cs @@ -172,6 +172,12 @@ public static FullStarterDeck New(string pluginGuid, string title, string pathTo Texture2D texture = TextureHelper.GetImageAsTexture(pathToIconTexture); return New(pluginGuid, title, texture, cardNames, unlockLevel); } + + public static FullStarterDeck New(string pluginGuid, string name, string title, string pathToIconTexture, string[] cardNames, int unlockLevel = 0) + { + Texture2D texture = TextureHelper.GetImageAsTexture(pathToIconTexture); + return New(pluginGuid, name, title, texture, cardNames, unlockLevel); + } [HarmonyPatch(typeof(AscensionUnlockSchedule), "StarterDeckIsUnlockedForLevel")] [HarmonyPrefix] From c29574401e64f159e42af32153d6548ffda60220 Mon Sep 17 00:00:00 2001 From: Chaosyr Date: Sun, 13 Sep 2026 12:15:27 -0400 Subject: [PATCH 4/6] Add Getters and Setters for Unlock Level to StarterDeckExtensions --- .../Ascension/StarterDeckExtensions.cs | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/InscryptionAPI/Ascension/StarterDeckExtensions.cs b/InscryptionAPI/Ascension/StarterDeckExtensions.cs index dad230e2..92baaa61 100644 --- a/InscryptionAPI/Ascension/StarterDeckExtensions.cs +++ b/InscryptionAPI/Ascension/StarterDeckExtensions.cs @@ -1,3 +1,4 @@ +using DiskCardGame; using InscryptionAPI.Helpers; using UnityEngine; @@ -9,4 +10,33 @@ private static Sprite GetPortrait(Texture2D portrait, TextureHelper.SpriteType s { return portrait.ConvertTexture(spriteType, filterMode ?? FilterMode.Point); } -} + + /// + /// Sets the Unlock Level of a Starter Deck. + /// + /// The StarterDeckInfo of the Deck. + /// The Unlock Level to set the Starter Deck with. + public static void SetUnlockLevel(this StarterDeckInfo info, int unlockLevel) + { + StarterDeckManager.FullStarterDeck fullStarterDeck = StarterDeckManager.AllDecks.FirstOrDefault(x => x.Info == info); + if (fullStarterDeck != null) + { + fullStarterDeck.UnlockLevel = unlockLevel; + } + } + + /// + /// Gets the Unlock Level associated with a Starter deck. + /// + /// The StarterDeckInfo of the Deck. + /// Returns the Unlock Level, if it fails it will return . + public static int GetUnlockLevel(this StarterDeckInfo info) + { + StarterDeckManager.FullStarterDeck fullStarterDeck = StarterDeckManager.AllDecks.FirstOrDefault(x => x.Info == info); + if (fullStarterDeck != null) + { + return fullStarterDeck.UnlockLevel; + } + return int.MaxValue; + } +} \ No newline at end of file From 1bc384c5406f042017ab794f9c54608f7ce6e427 Mon Sep 17 00:00:00 2001 From: Chaosyr Date: Sun, 13 Sep 2026 12:27:14 -0400 Subject: [PATCH 5/6] Update Changelog v2.24.1 --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d72b91d0..d4bddb22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 2.24.1 +* Added Extensions for setting the IconTexture of a Starter Deck. +* Added 2 Alternate Constructors for making a StarterDeck with a Display Name different from its Internal Name. +* Added Getters and Setters for Starter Deck Unlock Level. + # 2.24.0 - Fixed Part2CardCostRender.UpdatePlayableCardCost not being invoked - Fixed Part2CardCostRender.UpdateVanillaPlayableCardCost not being invoked From 6924bbb508e010c3b7a079aad0707d94a4f341f1 Mon Sep 17 00:00:00 2001 From: Chaosyr Date: Sun, 13 Sep 2026 12:36:47 -0400 Subject: [PATCH 6/6] Bump API Plugin Version --- InscryptionAPI/InscryptionAPIPlugin.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/InscryptionAPI/InscryptionAPIPlugin.cs b/InscryptionAPI/InscryptionAPIPlugin.cs index ee92caf1..fc46d62d 100644 --- a/InscryptionAPI/InscryptionAPIPlugin.cs +++ b/InscryptionAPI/InscryptionAPIPlugin.cs @@ -31,7 +31,7 @@ public class InscryptionAPIPlugin : BaseUnityPlugin { public const string ModGUID = "cyantist.inscryption.api"; public const string ModName = "InscryptionAPI"; - public const string ModVer = "2.24.0"; + public const string ModVer = "2.24.1"; public static string Directory = "";