Patch_GameScript_SaveGame.cs 1.3 KB

12345678910111213141516171819202122232425262728293031
  1. using GadgetCore.API;
  2. using HarmonyLib;
  3. namespace StorageExpansion.Patches
  4. {
  5. [HarmonyPatch(typeof(GameScript))]
  6. [HarmonyPatch("SaveGame")]
  7. [HarmonyGadget("StorageExpansion")]
  8. public static class Patch_GameScript_SaveGame
  9. {
  10. [HarmonyPostfix]
  11. public static void Postfix(GameScript __instance, int dood, Item[] ___storage)
  12. {
  13. for (int i = 0; i < Core.settingAmountPages * Core.settingAmountSlots; i++)
  14. {
  15. PreviewLabs.PlayerPrefs.SetInt("storage" + i + "id", ___storage[i].id);
  16. PreviewLabs.PlayerPrefs.SetInt("storage" + i + "q", ___storage[i].q);
  17. PreviewLabs.PlayerPrefs.SetInt("storage" + i + "exp", ___storage[i].exp);
  18. PreviewLabs.PlayerPrefs.SetInt("storage" + i + "tier", ___storage[i].tier);
  19. PreviewLabs.PlayerPrefs.SetInt("storage" + i + "corrupted", ___storage[i].corrupted);
  20. PreviewLabs.PlayerPrefs.SetInt("storage" + i + "a0", ___storage[i].aspect[0]);
  21. PreviewLabs.PlayerPrefs.SetInt("storage" + i + "a1", ___storage[i].aspect[1]);
  22. PreviewLabs.PlayerPrefs.SetInt("storage" + i + "a2", ___storage[i].aspect[2]);
  23. PreviewLabs.PlayerPrefs.SetInt("storage" + i + "aL0", ___storage[i].aspectLvl[0]);
  24. PreviewLabs.PlayerPrefs.SetInt("storage" + i + "aL1", ___storage[i].aspectLvl[1]);
  25. PreviewLabs.PlayerPrefs.SetInt("storage" + i + "aL2", ___storage[i].aspectLvl[2]);
  26. }
  27. }
  28. }
  29. }