using HarmonyLib;
using GadgetCore.API;
using UnityEngine;
using System.Collections;

namespace First.Patches
{
  [HarmonyPatch(typeof(GameScript))]
  [HarmonyPatch("GatherLoot")]
  [HarmonyGadget("First")]
  public static class Patch_GameScript_GatherLoot
  {
    [HarmonyPrefix]
    public static bool Prefix(GameScript __instance)
    {
      int num = Random.Range(0, 1000);
      if (num < 999)
      {
        __instance.AddItemGather(71);
      }
      else if (Random.Range(0, 20) == 12)
      {
      }
      else
      {
        int num2 = Random.Range(0, 4);
        if (num2 == 0)
        {
          __instance.AddItemGather(Random.Range(101, 104));
        }
        else if (num2 == 1)
        {
          __instance.AddItemGather(Random.Range(111, 114));
        }
        else if (num2 == 2)
        {
          __instance.AddItemGather(Random.Range(121, 124));
        }
        else
        {
          __instance.AddItemGather(Random.Range(131, 134));
        }
      }
      return false; // Return false to prevent the vanilla method from running.
    }

    /*
        [HarmonyPostfix]
        public static void Postfix(ClassName __instance)
        {
            // Add code to run after `MethodName` is called.
        }
		*/
  }
}
