using GadgetCore.API; using HarmonyLib; namespace IronmanChest.Patches { [HarmonyPatch(typeof(GameScript))] [HarmonyPatch(nameof(GameScript.LoadGame))] [HarmonyGadget("IronmanChest")] public static class Patch_GameScript_LoadGame { [HarmonyPostfix] public static void Postfix(GameScript __instance, Item[] ___storage, ref int ___storageLevel) { if (Menuu.curProfession == 1) { ___storageLevel = PreviewLabs.PlayerPrefs.GetInt(Menuu.curChar + "ironmanstorageLevel"); if (___storageLevel == 0) ___storageLevel = 1; for (int i = 0; i < Core.settingAmountPages * Core.settingAmountSlots; i++) { ___storage[i].id = PreviewLabs.PlayerPrefs.GetInt(Menuu.curChar + "ironmanstorage" + i + "id"); ___storage[i].q = PreviewLabs.PlayerPrefs.GetInt(Menuu.curChar + "ironmanstorage" + i + "q"); ___storage[i].exp = PreviewLabs.PlayerPrefs.GetInt(Menuu.curChar + "ironmanstorage" + i + "exp"); ___storage[i].tier = PreviewLabs.PlayerPrefs.GetInt(Menuu.curChar + "ironmanstorage" + i + "tier"); ___storage[i].corrupted = PreviewLabs.PlayerPrefs.GetInt(Menuu.curChar + "ironmanstorage" + i + "corrupted"); ___storage[i].aspect[0] = PreviewLabs.PlayerPrefs.GetInt(Menuu.curChar + "ironmanstorage" + i + "a0"); ___storage[i].aspect[1] = PreviewLabs.PlayerPrefs.GetInt(Menuu.curChar + "ironmanstorage" + i + "a1"); ___storage[i].aspect[2] = PreviewLabs.PlayerPrefs.GetInt(Menuu.curChar + "ironmanstorage" + i + "a2"); ___storage[i].aspectLvl[0] = PreviewLabs.PlayerPrefs.GetInt(Menuu.curChar + "ironmanstorage" + i + "aL0"); ___storage[i].aspectLvl[1] = PreviewLabs.PlayerPrefs.GetInt(Menuu.curChar + "ironmanstorage" + i + "aL1"); ___storage[i].aspectLvl[2] = PreviewLabs.PlayerPrefs.GetInt(Menuu.curChar + "ironmanstorage" + i + "aL2"); } __instance.StartCoroutine(__instance.RefreshStoragePage(0)); } } } }