Patch_GameScript_GatherLoot.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using HarmonyLib;
  2. using GadgetCore.API;
  3. using UnityEngine;
  4. using System.Collections;
  5. namespace First.Patches
  6. {
  7. [HarmonyPatch(typeof(GameScript))]
  8. [HarmonyPatch("GatherLoot")]
  9. [HarmonyGadget("First")]
  10. public static class Patch_GameScript_GatherLoot
  11. {
  12. [HarmonyPrefix]
  13. public static bool Prefix(GameScript __instance)
  14. {
  15. int num = Random.Range(0, 1000);
  16. if (num < 999)
  17. {
  18. __instance.AddItemGather(71);
  19. }
  20. else if (Random.Range(0, 20) == 12)
  21. {
  22. }
  23. else
  24. {
  25. int num2 = Random.Range(0, 4);
  26. if (num2 == 0)
  27. {
  28. __instance.AddItemGather(Random.Range(101, 104));
  29. }
  30. else if (num2 == 1)
  31. {
  32. __instance.AddItemGather(Random.Range(111, 114));
  33. }
  34. else if (num2 == 2)
  35. {
  36. __instance.AddItemGather(Random.Range(121, 124));
  37. }
  38. else
  39. {
  40. __instance.AddItemGather(Random.Range(131, 134));
  41. }
  42. }
  43. return false; // Return false to prevent the vanilla method from running.
  44. }
  45. /*
  46. [HarmonyPostfix]
  47. public static void Postfix(ClassName __instance)
  48. {
  49. // Add code to run after `MethodName` is called.
  50. }
  51. */
  52. }
  53. }