Patch_GameScript_EraseCharacter.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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.EraseCharacter))]
  14. [HarmonyGadget("IronmanChest")]
  15. public static class Patch_GameScript_EraseCharacter
  16. {
  17. [HarmonyPrefix]
  18. [HarmonyPriority(Priority.Low)]
  19. public static void Prefix(GameScript __instance)
  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. }
  39. }
  40. }
  41. }