Skip to content

Commit b5a69de

Browse files
V1.12
1 parent 45fb15e commit b5a69de

8 files changed

Lines changed: 55 additions & 32 deletions

File tree

API.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFramework>netstandard2.0</TargetFramework>
55
<AssemblyName>API</AssemblyName>
66
<Description>An API for inscryption</Description>
7-
<Version>1.11.0.0</Version>
7+
<Version>1.12.0.0</Version>
88
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
99
<LangVersion>9.0</LangVersion>
1010
</PropertyGroup>

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# Changelog
2+
## v1.12
3+
- Fixes params
4+
- Adds feature for special abilities and special stat icons
5+
- Added support for emissions
6+
27
## v1.11
38
- Added support for more identifiers
49

Models/CustomCard.cs

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Collections.Generic;
22
using System.Linq;
3-
using CardLoaderPlugin.lib;
43
using DiskCardGame;
54
using UnityEngine;
65

@@ -9,12 +8,14 @@ namespace APIPlugin
98
public class CustomCard
109
{
1110
public static List<CustomCard> cards = new();
12-
11+
1312
public static Dictionary<int,List<AbilityIdentifier>> abilityIds = new();
1413
public static Dictionary<int, List<SpecialAbilityIdentifier>> specialAbilityIds = new();
1514
public static Dictionary<int,EvolveIdentifier> evolveIds = new();
1615
public static Dictionary<int,IceCubeIdentifier> iceCubeIds = new();
1716
public static Dictionary<int,TailIdentifier> tailIds = new();
17+
18+
public static Dictionary<string, Sprite> emissions = new();
1819
public string name;
1920
public List<CardMetaCategory> metaCategories;
2021
public CardComplexity? cardComplexity;
@@ -44,6 +45,7 @@ public class CustomCard
4445
[IgnoreMapping] public Texture2D altTex;
4546
public Texture titleGraphic;
4647
[IgnoreMapping] public Texture2D pixelTex;
48+
[IgnoreMapping] public Texture2D emissionTex;
4749
public GameObject animatedPortrait;
4850
public List<Texture> decals;
4951
public List<AbilityIdentifier> abilityIdList = new();
@@ -52,11 +54,11 @@ public class CustomCard
5254
public TailIdentifier tailId;
5355

5456
public CustomCard(
55-
string name,
56-
List<AbilityIdentifier> abilityIdParam=null,
57-
List<SpecialAbilityIdentifier> specialAbilityIdParam=null,
58-
EvolveIdentifier evolveId=null,
59-
IceCubeIdentifier iceCubeId=null,
57+
string name,
58+
List<AbilityIdentifier> abilityIdParam=null,
59+
List<SpecialAbilityIdentifier> specialAbilityIdParam=null,
60+
EvolveIdentifier evolveId=null,
61+
IceCubeIdentifier iceCubeId=null,
6062
TailIdentifier tailId=null)
6163
{
6264
this.name = name;
@@ -71,12 +73,12 @@ public CustomCard(
7173
this.abilities.Add(id.id);
7274
abilitiesToRemove.Add(id);
7375
}
74-
76+
7577
foreach (AbilityIdentifier id in abilitiesToRemove)
7678
{
7779
abilityIdParam.Remove(id);
7880
}
79-
81+
8082
if (abilityIdParam.Count > 0)
8183
{
8284
CustomCard.abilityIds[CustomCard.cards.Count - 1] = abilityIdParam;
@@ -91,12 +93,12 @@ public CustomCard(
9193
this.specialAbilities.Add(id.id);
9294
specialAbilitiesToRemove.Add(id);
9395
}
94-
96+
9597
foreach (SpecialAbilityIdentifier id in specialAbilitiesToRemove)
9698
{
9799
specialAbilityIdParam.Remove(id);
98100
}
99-
101+
100102
if (specialAbilityIdParam.Count > 0)
101103
{
102104
CustomCard.specialAbilityIds[CustomCard.cards.Count - 1] = specialAbilityIdParam;
@@ -133,6 +135,14 @@ public CardInfo AdjustCard(CardInfo card)
133135
tex.filterMode = FilterMode.Point;
134136
card.portraitTex = Sprite.Create(tex, CardUtils.DefaultCardArtRect, CardUtils.DefaultVector2);
135137
card.portraitTex.name = "portrait_" + name;
138+
if (this.emissionTex is not null)
139+
{
140+
emissionTex.name = tex.name + "_emission";
141+
emissionTex.filterMode = FilterMode.Point;
142+
Sprite emissionSprite = Sprite.Create(emissionTex, CardUtils.DefaultCardArtRect, CardUtils.DefaultVector2);
143+
emissionSprite.name = tex.name + "_emission";
144+
emissions.Add(tex.name, emissionSprite);
145+
}
136146
}
137147

138148
if (this.altTex is not null)
@@ -156,4 +166,4 @@ public CardInfo AdjustCard(CardInfo card)
156166
return card;
157167
}
158168
}
159-
}
169+
}

Models/NewCard.cs

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Collections.Generic;
22
using System.Linq;
3-
using CardLoaderPlugin.lib;
43
using DiskCardGame;
54
using UnityEngine;
65

@@ -15,7 +14,9 @@ public static class NewCard
1514
public static Dictionary<int, EvolveIdentifier> evolveIds = new();
1615
public static Dictionary<int, IceCubeIdentifier> iceCubeIds = new();
1716
public static Dictionary<int, TailIdentifier> tailIds = new();
18-
17+
18+
public static Dictionary<string, Sprite> emissions = new();
19+
1920
public static void Add(CardInfo card, List<AbilityIdentifier> abilityIdsParam = null,
2021
List<SpecialAbilityIdentifier> specialAbilitiesIdsParam = null,
2122
EvolveIdentifier evolveId = null,
@@ -36,14 +37,14 @@ public static void Add(string name, string displayedName, int baseAttack, int ba
3637
int bloodCost = 0, int bonesCost = 0, int energyCost = 0,
3738
List<GemType> gemsCost = null, SpecialStatIcon specialStatIcon = SpecialStatIcon.None,
3839
List<Tribe> tribes = null, List<Trait> traits = null, List<SpecialTriggeredAbility> specialAbilities = null,
39-
List<Ability> abilities = null, List<AbilityIdentifier> abilityIdsParam = null,
40+
List<Ability> abilities = null, List<AbilityIdentifier> abilityIdsParam = null,
4041
List<SpecialAbilityIdentifier> specialAbilitiesIdsParam = null, EvolveParams evolveParams = null,
4142
string defaultEvolutionName = null, TailParams tailParams = null, IceCubeParams iceCubeParams = null,
4243
bool flipPortraitForStrafe = false, bool onePerDeck = false,
4344
List<CardAppearanceBehaviour.Appearance> appearanceBehaviour = null, Texture2D defaultTex = null,
4445
Texture2D altTex = null, Texture titleGraphic = null, Texture2D pixelTex = null,
45-
GameObject animatedPortrait = null, List<Texture> decals = null, EvolveIdentifier evolveId = null,
46-
IceCubeIdentifier iceCubeId = null, TailIdentifier tailId = null)
46+
Texture2D emissionTex = null, GameObject animatedPortrait = null, List<Texture> decals = null,
47+
EvolveIdentifier evolveId = null, IceCubeIdentifier iceCubeId = null, TailIdentifier tailId = null)
4748
{
4849
CardInfo card = ScriptableObject.CreateInstance<CardInfo>();
4950

@@ -119,7 +120,7 @@ public static void Add(string name, string displayedName, int baseAttack, int ba
119120
}
120121

121122
// textures
122-
DetermineAndSetCardArt(name, card, defaultTex, altTex, pixelTex);
123+
DetermineAndSetCardArt(name, card, defaultTex, altTex, pixelTex, emissionTex);
123124

124125
if (animatedPortrait is not null)
125126
{
@@ -166,23 +167,23 @@ private static void HandleIdentifiers(
166167
{
167168
abilityIdsParam.Remove(id);
168169
}
169-
170+
170171
if (abilityIdsParam.Count > 0)
171172
{
172173
NewCard.abilityIds[NewCard.cards.Count - 1] = abilityIdsParam;
173174
}
174175
}
175-
176+
176177
// Handle SpecialAbilityIds
177-
List<SpecialAbilityIdentifier> specialAbilitiesToRemove = new List<AbilityIdentifier>();
178+
List<SpecialAbilityIdentifier> specialAbilitiesToRemove = new List<SpecialAbilityIdentifier>();
178179
if (specialAbilitiesIdsParam is not null)
179180
{
180181
foreach (var id in specialAbilitiesIdsParam.Where(id => id.id != 0))
181182
{
182183
card.specialAbilities.Add(id.id);
183184
specialAbilitiesToRemove.Add(id);
184185
}
185-
186+
186187
foreach (SpecialAbilityIdentifier id in specialAbilitiesToRemove)
187188
{
188189
specialAbilitiesIdsParam.Remove(id);
@@ -215,7 +216,7 @@ private static void HandleIdentifiers(
215216

216217
private static void DetermineAndSetCardArt(
217218
string name, CardInfo card,
218-
Texture2D defaultTex, Texture2D altTex, Texture2D pixelTex)
219+
Texture2D defaultTex, Texture2D altTex, Texture2D pixelTex, Texture2D emissionTex)
219220
{
220221
var newName = "portrait_" + name;
221222
if (defaultTex is not null)
@@ -225,6 +226,14 @@ private static void DetermineAndSetCardArt(
225226

226227
card.portraitTex = Sprite.Create(defaultTex, CardUtils.DefaultCardArtRect, CardUtils.DefaultVector2);
227228
card.portraitTex.name = newName;
229+
if (emissionTex is not null)
230+
{
231+
emissionTex.name = newName + "_emission";
232+
emissionTex.filterMode = FilterMode.Point;
233+
Sprite emissionSprite = Sprite.Create(emissionTex, CardUtils.DefaultCardArtRect, CardUtils.DefaultVector2);
234+
emissionSprite.name = newName + "_emission";
235+
emissions.Add(newName, emissionSprite);
236+
}
228237
}
229238

230239
if (altTex is not null)
@@ -247,4 +256,4 @@ private static void DetermineAndSetCardArt(
247256
}
248257
}
249258
}
250-
}
259+
}

Patches/AbilitiesUtil.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace API.Patches
88
{
9-
[HarmonyPatch(typeof(AbilitiesUtil), "LoadAbilityIcon",
9+
[HarmonyPatch(typeof(AbilitiesUtil), "LoadAbilityIcon",
1010
typeof(string), typeof(bool), typeof(bool))]
1111
public class AbilitiesUtil_LoadAbilityIcon
1212
{
@@ -24,7 +24,7 @@ public static bool Prefix(string abilityName, CardTriggerHandler __instance, ref
2424
}
2525
}
2626

27-
[HarmonyPatch(typeof(AbilitiesUtil), "GetAbilities",
27+
[HarmonyPatch(typeof(AbilitiesUtil), "GetAbilities",
2828
typeof(bool), typeof(bool), typeof(int), typeof(int), typeof(AbilityMetaCategory))]
2929
public class AbilitiesUtil_GetAbilities
3030
{

Patches/StatIconInfo.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
namespace API.Patches
66
{
77
[HarmonyPatch(typeof(StatIconInfo), "LoadAbilityData")]
8-
public class StatIconInfoPatch
8+
public class StatIconInfo_LoadAbilityData
99
{
10-
[HarmonyPostfix]
1110
static void Postfix()
1211
{
1312
foreach (var ability in NewSpecialAbility.specialAbilities)
@@ -21,4 +20,4 @@ static void Postfix()
2120

2221
}
2322
}
24-
}
23+
}

Plugin.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public partial class Plugin : BaseUnityPlugin
1414
{
1515
private const string PluginGuid = "cyantist.inscryption.api";
1616
private const string PluginName = "API";
17-
private const string PluginVersion = "1.11.0.0";
17+
private const string PluginVersion = "1.12.0.0";
1818

1919
internal static ManualLogSource Log;
2020
internal static ConfigEntry<bool> configEnergy;

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "API",
3-
"version_number": "1.11.0",
3+
"version_number": "1.12.0",
44
"website_url": "https://github.com/ScottWilson0903/InscryptionAPI",
55
"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.",
66
"dependencies": [

0 commit comments

Comments
 (0)