Patch_GameScript_RefreshGearMods.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. using GadgetCore.API;
  2. using HarmonyLib;
  3. using System.Reflection;
  4. using UnityEngine;
  5. namespace Subworlds.Patches
  6. {
  7. [HarmonyPatch(typeof(GameScript))]
  8. [HarmonyPatch("RefreshGearMods")]
  9. [HarmonyGadget("SubworldCore")]
  10. public static class Patch_GameScript_RefreshGearMods
  11. {
  12. [HarmonyPostfix]
  13. public static void Postfix(GameScript __instance, Item[] ___modSlot)
  14. {
  15. int n = 5;
  16. int id = ___modSlot[0].id;
  17. if (id > 0)
  18. for (int i = 0; i < 3; i++)
  19. if (___modSlot[0].aspect[i] > 0 && ___modSlot[0].aspect[i] == Core.itemOldTexMod.GetID())
  20. n += ___modSlot[0].aspectLvl[i];
  21. try
  22. {
  23. var text1Transform = GameObject.Find("Main Camera").transform.Find("menuMods").Find("txtName (1)");
  24. var text2Transform = text1Transform.GetChild(0);
  25. text1Transform.GetComponent<TextMesh>().text = "Mods can stack up to " + n + " times each";
  26. text2Transform.GetComponent<TextMesh>().text = "Mods can stack up to " + n + " times each";
  27. }
  28. catch { }
  29. }
  30. }
  31. }