using GadgetCore.API; using HarmonyLib; namespace IronmanChest.Patches { [HarmonyPatch(typeof(GameScript))] [HarmonyPatch(nameof(GameScript.UpgradeStorage))] [HarmonyGadget("IronmanChest")] public static class Patch_GameScript_UpgradeStorage { [HarmonyPrefix] public static void Prefix(GameScript __instance, Item[] ___storage, ref int ___storageLevel, out int __state) { __state = -1; if (Menuu.curProfession == 1) { __state = PreviewLabs.PlayerPrefs.GetInt("storageLevel"); } } [HarmonyPostfix] [HarmonyPriority(Priority.Low)] public static void Postfix(GameScript __instance, Item[] ___storage, ref int ___storageLevel, int __state) { if (Menuu.curProfession == 1) { PreviewLabs.PlayerPrefs.SetInt("storageLevel", __state); PreviewLabs.PlayerPrefs.SetInt(Menuu.curChar + "ironmanstorageLevel", ___storageLevel); } } } }