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

namespace VendingMachine.Patches
{
  [HarmonyPatch(typeof(GameScript))]
  [HarmonyPatch("RefreshRecipeUnlock")]
  [HarmonyGadget("VendingMachine")]
  public static class Patch_GameScript_RefreshRecipeUnlock
	{
    [HarmonyPrefix]
    public static bool Prefix(GameScript __instance, 
			int ___craftType, 
			int ___curRecipePage, 
			GameObject ___ultLocksObj, 
			GameObject ___recipeButtons,
			GameObject[] ___recipeLock,
			int[,] ___ultLocksUnlocked,
			GameObject[] ___ultLocks)
		{
			if (___craftType == 2 && ___curRecipePage >= 6)
			{
				___ultLocksObj.SetActive(true);
				___recipeButtons.SetActive(false);
				for (int i = 0; i < 36; i++)
				{
					if (i < 12)
					{
						___recipeLock[i].SetActive(false);
					}
					___ultLocks[i].SetActive(false);
				}
				return false;
			}
			return true;
		}
  }
}
