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

namespace VendingMachine.Patches
{
  [HarmonyPatch(typeof(GameScript))]
  [HarmonyPatch("RecipeUp")]
  [HarmonyGadget("VendingMachine")]
  public static class Patch_GameScript_RecipeUp
  {
    [HarmonyPrefix]
    public static bool Prefix(GameScript __instance, int ___craftType, ref int ___curRecipePage)
    {
      int pages = 1;
      switch (___craftType)
      {
        case 0:
          pages = 6;
          break;
        case 1:
          pages = 2;
          break;
        case 2:
          pages = 7;
          break;
      }
      ___curRecipePage = (___curRecipePage + 1) % pages;
      __instance.RefreshRecipe();
      return false;
    }
  }
}
