diff --git a/content/CharacterModTemplate/CharMod/images/potions/potion.png b/content/CharacterModTemplate/CharMod/images/potions/potion.png new file mode 100644 index 0000000..7906323 Binary files /dev/null and b/content/CharacterModTemplate/CharMod/images/potions/potion.png differ diff --git a/content/CharacterModTemplate/CharModCode/Extensions/StringExtensions.cs b/content/CharacterModTemplate/CharModCode/Extensions/StringExtensions.cs index 1b669da..170b7ad 100644 --- a/content/CharacterModTemplate/CharModCode/Extensions/StringExtensions.cs +++ b/content/CharacterModTemplate/CharModCode/Extensions/StringExtensions.cs @@ -64,6 +64,15 @@ public static string BigRelicImagePath(this string path) return Path.Join(MainFile.ResPath, "images", "relics", "big", "relic.png"); } + public static string PotionImagePath(this string path) + { + path = Path.Join(MainFile.ResPath, "images", "potions", path); + if (ResourceLoader.Exists(path)) return path; + + MainFile.Logger.Info("Could not find potion image path: " + path); + return Path.Join(MainFile.ResPath, "images", "potions", "potion.png"); + } + public static string CharacterUiPath(this string path) { return Path.Join(MainFile.ResPath, "images", "charui", path); diff --git a/content/CharacterModTemplate/CharModCode/Potions/CharModPotion.cs b/content/CharacterModTemplate/CharModCode/Potions/CharModPotion.cs index 9ac83f1..0eaeae6 100644 --- a/content/CharacterModTemplate/CharModCode/Potions/CharModPotion.cs +++ b/content/CharacterModTemplate/CharModCode/Potions/CharModPotion.cs @@ -1,8 +1,13 @@ using BaseLib.Abstracts; using BaseLib.Utils; using CharMod.CharModCode.Character; +using CharMod.CharModCode.Extensions; namespace CharMod.CharModCode.Potions; [Pool(typeof(CharModPotionPool))] -public abstract class CharModPotion : CustomPotionModel; \ No newline at end of file +public abstract class CharModPotion : CustomPotionModel +{ + public override string? CustomPackedImagePath => + $"{Id.Entry.RemovePrefix().ToLowerInvariant()}.png".PotionImagePath(); +} \ No newline at end of file