Patch_GameScript_Retry.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using GadgetCore.API;
  2. using GadgetCore.Util;
  3. using HarmonyLib;
  4. using System;
  5. using System.Collections;
  6. using System.Collections.Generic;
  7. using System.Reflection;
  8. using System.Reflection.Emit;
  9. using UnityEngine;
  10. namespace IronmanChest.Patches
  11. {
  12. [HarmonyPatch(typeof(GameScript))]
  13. [HarmonyPatch(nameof(GameScript.Retry))]
  14. [HarmonyGadget("IronmanChest")]
  15. public static class Patch_GameScript_Retry
  16. {
  17. [HarmonyPostfix]
  18. [HarmonyPriority(Priority.Low)]
  19. public static void Postfix(GameScript __instance, Item[] ___storage, ref int ___storageLevel)
  20. {
  21. if (Menuu.curProfession == 1 && !Core.IsSoftcore())
  22. {
  23. PreviewLabs.PlayerPrefs.SetInt(Menuu.curChar + "ironmanstorageLevel", 0);
  24. for (int i = 0; i < Core.settingAmountPages * Core.settingAmountSlots; i++)
  25. {
  26. PreviewLabs.PlayerPrefs.SetInt(Menuu.curChar + "ironmanstorage" + i + "id", 0);
  27. PreviewLabs.PlayerPrefs.SetInt(Menuu.curChar + "ironmanstorage" + i + "q", 0);
  28. PreviewLabs.PlayerPrefs.SetInt(Menuu.curChar + "ironmanstorage" + i + "exp", 0);
  29. PreviewLabs.PlayerPrefs.SetInt(Menuu.curChar + "ironmanstorage" + i + "tier", 0);
  30. PreviewLabs.PlayerPrefs.SetInt(Menuu.curChar + "ironmanstorage" + i + "corrupted", 0);
  31. PreviewLabs.PlayerPrefs.SetInt(Menuu.curChar + "ironmanstorage" + i + "a0", 0);
  32. PreviewLabs.PlayerPrefs.SetInt(Menuu.curChar + "ironmanstorage" + i + "a1", 0);
  33. PreviewLabs.PlayerPrefs.SetInt(Menuu.curChar + "ironmanstorage" + i + "a2", 0);
  34. PreviewLabs.PlayerPrefs.SetInt(Menuu.curChar + "ironmanstorage" + i + "aL0", 0);
  35. PreviewLabs.PlayerPrefs.SetInt(Menuu.curChar + "ironmanstorage" + i + "aL1", 0);
  36. PreviewLabs.PlayerPrefs.SetInt(Menuu.curChar + "ironmanstorage" + i + "aL2", 0);
  37. }
  38. Patch_GameScript_LoadGame.Postfix(__instance, ___storage, ref ___storageLevel);
  39. }
  40. }
  41. }
  42. }